12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828 |
- webpackJsonp(["vendor"],{
- /***/ "./node_modules/@angular/common/esm5/common.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export ɵregisterLocaleData */
- /* unused harmony export NgLocaleLocalization */
- /* unused harmony export NgLocalization */
- /* unused harmony export registerLocaleData */
- /* unused harmony export Plural */
- /* unused harmony export NumberFormatStyle */
- /* unused harmony export FormStyle */
- /* unused harmony export TranslationWidth */
- /* unused harmony export FormatWidth */
- /* unused harmony export NumberSymbol */
- /* unused harmony export WeekDay */
- /* unused harmony export getCurrencySymbol */
- /* unused harmony export getLocaleDayPeriods */
- /* unused harmony export getLocaleDayNames */
- /* unused harmony export getLocaleMonthNames */
- /* unused harmony export getLocaleId */
- /* unused harmony export getLocaleEraNames */
- /* unused harmony export getLocaleWeekEndRange */
- /* unused harmony export getLocaleFirstDayOfWeek */
- /* unused harmony export getLocaleDateFormat */
- /* unused harmony export getLocaleDateTimeFormat */
- /* unused harmony export getLocaleExtraDayPeriodRules */
- /* unused harmony export getLocaleExtraDayPeriods */
- /* unused harmony export getLocalePluralCase */
- /* unused harmony export getLocaleTimeFormat */
- /* unused harmony export getLocaleNumberSymbol */
- /* unused harmony export getLocaleNumberFormat */
- /* unused harmony export getLocaleCurrencyName */
- /* unused harmony export getLocaleCurrencySymbol */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return parseCookieValue; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CommonModule; });
- /* unused harmony export DeprecatedI18NPipesModule */
- /* unused harmony export NgClass */
- /* unused harmony export NgForOf */
- /* unused harmony export NgForOfContext */
- /* unused harmony export NgIf */
- /* unused harmony export NgIfContext */
- /* unused harmony export NgPlural */
- /* unused harmony export NgPluralCase */
- /* unused harmony export NgStyle */
- /* unused harmony export NgSwitch */
- /* unused harmony export NgSwitchCase */
- /* unused harmony export NgSwitchDefault */
- /* unused harmony export NgTemplateOutlet */
- /* unused harmony export NgComponentOutlet */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DOCUMENT; });
- /* unused harmony export AsyncPipe */
- /* unused harmony export DatePipe */
- /* unused harmony export I18nPluralPipe */
- /* unused harmony export I18nSelectPipe */
- /* unused harmony export JsonPipe */
- /* unused harmony export LowerCasePipe */
- /* unused harmony export CurrencyPipe */
- /* unused harmony export DecimalPipe */
- /* unused harmony export PercentPipe */
- /* unused harmony export SlicePipe */
- /* unused harmony export UpperCasePipe */
- /* unused harmony export TitleCasePipe */
- /* unused harmony export DeprecatedDatePipe */
- /* unused harmony export DeprecatedCurrencyPipe */
- /* unused harmony export DeprecatedDecimalPipe */
- /* unused harmony export DeprecatedPercentPipe */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return PLATFORM_BROWSER_ID; });
- /* unused harmony export ɵPLATFORM_SERVER_ID */
- /* unused harmony export ɵPLATFORM_WORKER_APP_ID */
- /* unused harmony export ɵPLATFORM_WORKER_UI_ID */
- /* unused harmony export isPlatformBrowser */
- /* unused harmony export isPlatformServer */
- /* unused harmony export isPlatformWorkerApp */
- /* unused harmony export isPlatformWorkerUi */
- /* unused harmony export VERSION */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return PlatformLocation; });
- /* unused harmony export LOCATION_INITIALIZED */
- /* unused harmony export LocationStrategy */
- /* unused harmony export APP_BASE_HREF */
- /* unused harmony export HashLocationStrategy */
- /* unused harmony export PathLocationStrategy */
- /* unused harmony export Location */
- /* unused harmony export ɵe */
- /* unused harmony export ɵd */
- /* unused harmony export ɵa */
- /* unused harmony export ɵb */
- /* unused harmony export ɵg */
- /* unused harmony export ɵf */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
- /**
- * @license Angular v5.2.9
- * (c) 2010-2018 Google, Inc. https://angular.io/
- * License: MIT
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * This class should not be used directly by an application developer. Instead, use
- * {\@link Location}.
- *
- * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform
- * agnostic.
- * This means that we can have different implementation of `PlatformLocation` for the different
- * platforms that angular supports. For example, `\@angular/platform-browser` provides an
- * implementation specific to the browser environment, while `\@angular/platform-webworker` provides
- * one suitable for use with web workers.
- *
- * The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy}
- * when they need to interact with the DOM apis like pushState, popState, etc...
- *
- * {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly
- * by the {\@link Router} in order to navigate between routes. Since all interactions between {\@link
- * Router} /
- * {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation`
- * class they are all platform independent.
- *
- * \@stable
- * @abstract
- */
- var PlatformLocation = /** @class */ (function () {
- function PlatformLocation() {
- }
- return PlatformLocation;
- }());
- /**
- * \@whatItDoes indicates when a location is initialized
- * \@experimental
- */
- var LOCATION_INITIALIZED = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* InjectionToken */]('Location Initialized');
- /**
- * A serializable version of the event from onPopState or onHashChange
- *
- * \@experimental
- * @record
- */
- /**
- * \@experimental
- * @record
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * `LocationStrategy` is responsible for representing and reading route state
- * from the browser's URL. Angular provides two strategies:
- * {\@link HashLocationStrategy} and {\@link PathLocationStrategy}.
- *
- * This is used under the hood of the {\@link Location} service.
- *
- * Applications should use the {\@link Router} or {\@link Location} services to
- * interact with application route state.
- *
- * For instance, {\@link HashLocationStrategy} produces URLs like
- * `http://example.com#/foo`, and {\@link PathLocationStrategy} produces
- * `http://example.com/foo` as an equivalent URL.
- *
- * See these two classes for more.
- *
- * \@stable
- * @abstract
- */
- var LocationStrategy = /** @class */ (function () {
- function LocationStrategy() {
- }
- return LocationStrategy;
- }());
- /**
- * The `APP_BASE_HREF` token represents the base href to be used with the
- * {\@link PathLocationStrategy}.
- *
- * If you're using {\@link PathLocationStrategy}, you must provide a provider to a string
- * representing the URL prefix that should be preserved when generating and recognizing
- * URLs.
- *
- * ### Example
- *
- * ```typescript
- * import {Component, NgModule} from '\@angular/core';
- * import {APP_BASE_HREF} from '\@angular/common';
- *
- * \@NgModule({
- * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
- * })
- * class AppModule {}
- * ```
- *
- * \@stable
- */
- var APP_BASE_HREF = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* InjectionToken */]('appBaseHref');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@experimental
- * @record
- */
- /**
- * \@whatItDoes `Location` is a service that applications can use to interact with a browser's URL.
- * \@description
- * Depending on which {\@link LocationStrategy} is used, `Location` will either persist
- * to the URL's path or the URL's hash segment.
- *
- * Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use
- * `Location` only if you need to interact with or create normalized URLs outside of
- * routing.
- *
- * `Location` is responsible for normalizing the URL against the application's base href.
- * A normalized URL is absolute from the URL host, includes the application's base href, and has no
- * trailing slash:
- * - `/my/app/user/123` is normalized
- * - `my/app/user/123` **is not** normalized
- * - `/my/app/user/123/` **is not** normalized
- *
- * ### Example
- * {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
- * \@stable
- */
- var Location = /** @class */ (function () {
- function Location(platformStrategy) {
- var _this = this;
- /**
- * \@internal
- */
- this._subject = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* EventEmitter */]();
- this._platformStrategy = platformStrategy;
- var /** @type {?} */ browserBaseHref = this._platformStrategy.getBaseHref();
- this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref));
- this._platformStrategy.onPopState(function (ev) {
- _this._subject.emit({
- 'url': _this.path(true),
- 'pop': true,
- 'type': ev.type,
- });
- });
- }
- /**
- * Returns the normalized URL path.
- */
- // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
- // removed.
- /**
- * Returns the normalized URL path.
- * @param {?=} includeHash
- * @return {?}
- */
- Location.prototype.path = /**
- * Returns the normalized URL path.
- * @param {?=} includeHash
- * @return {?}
- */
- function (includeHash) {
- if (includeHash === void 0) { includeHash = false; }
- return this.normalize(this._platformStrategy.path(includeHash));
- };
- /**
- * Normalizes the given path and compares to the current normalized path.
- */
- /**
- * Normalizes the given path and compares to the current normalized path.
- * @param {?} path
- * @param {?=} query
- * @return {?}
- */
- Location.prototype.isCurrentPathEqualTo = /**
- * Normalizes the given path and compares to the current normalized path.
- * @param {?} path
- * @param {?=} query
- * @return {?}
- */
- function (path, query) {
- if (query === void 0) { query = ''; }
- return this.path() == this.normalize(path + Location.normalizeQueryParams(query));
- };
- /**
- * Given a string representing a URL, returns the normalized URL path without leading or
- * trailing slashes.
- */
- /**
- * Given a string representing a URL, returns the normalized URL path without leading or
- * trailing slashes.
- * @param {?} url
- * @return {?}
- */
- Location.prototype.normalize = /**
- * Given a string representing a URL, returns the normalized URL path without leading or
- * trailing slashes.
- * @param {?} url
- * @return {?}
- */
- function (url) {
- return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
- };
- /**
- * Given a string representing a URL, returns the platform-specific external URL path.
- * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
- * before normalizing. This method will also add a hash if `HashLocationStrategy` is
- * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
- */
- /**
- * Given a string representing a URL, returns the platform-specific external URL path.
- * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
- * before normalizing. This method will also add a hash if `HashLocationStrategy` is
- * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
- * @param {?} url
- * @return {?}
- */
- Location.prototype.prepareExternalUrl = /**
- * Given a string representing a URL, returns the platform-specific external URL path.
- * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
- * before normalizing. This method will also add a hash if `HashLocationStrategy` is
- * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
- * @param {?} url
- * @return {?}
- */
- function (url) {
- if (url && url[0] !== '/') {
- url = '/' + url;
- }
- return this._platformStrategy.prepareExternalUrl(url);
- };
- // TODO: rename this method to pushState
- /**
- * Changes the browsers URL to the normalized version of the given URL, and pushes a
- * new item onto the platform's history.
- */
- /**
- * Changes the browsers URL to the normalized version of the given URL, and pushes a
- * new item onto the platform's history.
- * @param {?} path
- * @param {?=} query
- * @return {?}
- */
- Location.prototype.go = /**
- * Changes the browsers URL to the normalized version of the given URL, and pushes a
- * new item onto the platform's history.
- * @param {?} path
- * @param {?=} query
- * @return {?}
- */
- function (path, query) {
- if (query === void 0) { query = ''; }
- this._platformStrategy.pushState(null, '', path, query);
- };
- /**
- * Changes the browsers URL to the normalized version of the given URL, and replaces
- * the top item on the platform's history stack.
- */
- /**
- * Changes the browsers URL to the normalized version of the given URL, and replaces
- * the top item on the platform's history stack.
- * @param {?} path
- * @param {?=} query
- * @return {?}
- */
- Location.prototype.replaceState = /**
- * Changes the browsers URL to the normalized version of the given URL, and replaces
- * the top item on the platform's history stack.
- * @param {?} path
- * @param {?=} query
- * @return {?}
- */
- function (path, query) {
- if (query === void 0) { query = ''; }
- this._platformStrategy.replaceState(null, '', path, query);
- };
- /**
- * Navigates forward in the platform's history.
- */
- /**
- * Navigates forward in the platform's history.
- * @return {?}
- */
- Location.prototype.forward = /**
- * Navigates forward in the platform's history.
- * @return {?}
- */
- function () { this._platformStrategy.forward(); };
- /**
- * Navigates back in the platform's history.
- */
- /**
- * Navigates back in the platform's history.
- * @return {?}
- */
- Location.prototype.back = /**
- * Navigates back in the platform's history.
- * @return {?}
- */
- function () { this._platformStrategy.back(); };
- /**
- * Subscribe to the platform's `popState` events.
- */
- /**
- * Subscribe to the platform's `popState` events.
- * @param {?} onNext
- * @param {?=} onThrow
- * @param {?=} onReturn
- * @return {?}
- */
- Location.prototype.subscribe = /**
- * Subscribe to the platform's `popState` events.
- * @param {?} onNext
- * @param {?=} onThrow
- * @param {?=} onReturn
- * @return {?}
- */
- function (onNext, onThrow, onReturn) {
- return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
- };
- /**
- * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
- * is.
- * @param {?} params
- * @return {?}
- */
- Location.normalizeQueryParams = /**
- * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
- * is.
- * @param {?} params
- * @return {?}
- */
- function (params) {
- return params && params[0] !== '?' ? '?' + params : params;
- };
- /**
- * Given 2 parts of a url, join them with a slash if needed.
- * @param {?} start
- * @param {?} end
- * @return {?}
- */
- Location.joinWithSlash = /**
- * Given 2 parts of a url, join them with a slash if needed.
- * @param {?} start
- * @param {?} end
- * @return {?}
- */
- function (start, end) {
- if (start.length == 0) {
- return end;
- }
- if (end.length == 0) {
- return start;
- }
- var /** @type {?} */ slashes = 0;
- if (start.endsWith('/')) {
- slashes++;
- }
- if (end.startsWith('/')) {
- slashes++;
- }
- if (slashes == 2) {
- return start + end.substring(1);
- }
- if (slashes == 1) {
- return start + end;
- }
- return start + '/' + end;
- };
- /**
- * If url has a trailing slash, remove it, otherwise return url as is. This
- * method looks for the first occurence of either #, ?, or the end of the
- * line as `/` characters after any of these should not be replaced.
- * @param {?} url
- * @return {?}
- */
- Location.stripTrailingSlash = /**
- * If url has a trailing slash, remove it, otherwise return url as is. This
- * method looks for the first occurence of either #, ?, or the end of the
- * line as `/` characters after any of these should not be replaced.
- * @param {?} url
- * @return {?}
- */
- function (url) {
- var /** @type {?} */ match = url.match(/#|\?|$/);
- var /** @type {?} */ pathEndIdx = match && match.index || url.length;
- var /** @type {?} */ droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
- return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
- };
- Location.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- Location.ctorParameters = function () { return [
- { type: LocationStrategy, },
- ]; };
- return Location;
- }());
- /**
- * @param {?} baseHref
- * @param {?} url
- * @return {?}
- */
- function _stripBaseHref(baseHref, url) {
- return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
- }
- /**
- * @param {?} url
- * @return {?}
- */
- function _stripIndexHtml(url) {
- return url.replace(/\/index.html$/, '');
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@whatItDoes Use URL hash for storing application location data.
- * \@description
- * `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the
- * {\@link Location} service to represent its state in the
- * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
- * of the browser's URL.
- *
- * For instance, if you call `location.go('/foo')`, the browser's URL will become
- * `example.com#/foo`.
- *
- * ### Example
- *
- * {\@example common/location/ts/hash_location_component.ts region='LocationComponent'}
- *
- * \@stable
- */
- var HashLocationStrategy = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(HashLocationStrategy, _super);
- function HashLocationStrategy(_platformLocation, _baseHref) {
- var _this = _super.call(this) || this;
- _this._platformLocation = _platformLocation;
- _this._baseHref = '';
- if (_baseHref != null) {
- _this._baseHref = _baseHref;
- }
- return _this;
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- HashLocationStrategy.prototype.onPopState = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._platformLocation.onPopState(fn);
- this._platformLocation.onHashChange(fn);
- };
- /**
- * @return {?}
- */
- HashLocationStrategy.prototype.getBaseHref = /**
- * @return {?}
- */
- function () { return this._baseHref; };
- /**
- * @param {?=} includeHash
- * @return {?}
- */
- HashLocationStrategy.prototype.path = /**
- * @param {?=} includeHash
- * @return {?}
- */
- function (includeHash) {
- if (includeHash === void 0) { includeHash = false; }
- // the hash value is always prefixed with a `#`
- // and if it is empty then it will stay empty
- var /** @type {?} */ path = this._platformLocation.hash;
- if (path == null)
- path = '#';
- return path.length > 0 ? path.substring(1) : path;
- };
- /**
- * @param {?} internal
- * @return {?}
- */
- HashLocationStrategy.prototype.prepareExternalUrl = /**
- * @param {?} internal
- * @return {?}
- */
- function (internal) {
- var /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal);
- return url.length > 0 ? ('#' + url) : url;
- };
- /**
- * @param {?} state
- * @param {?} title
- * @param {?} path
- * @param {?} queryParams
- * @return {?}
- */
- HashLocationStrategy.prototype.pushState = /**
- * @param {?} state
- * @param {?} title
- * @param {?} path
- * @param {?} queryParams
- * @return {?}
- */
- function (state, title, path, queryParams) {
- var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
- if (url.length == 0) {
- url = this._platformLocation.pathname;
- }
- this._platformLocation.pushState(state, title, url);
- };
- /**
- * @param {?} state
- * @param {?} title
- * @param {?} path
- * @param {?} queryParams
- * @return {?}
- */
- HashLocationStrategy.prototype.replaceState = /**
- * @param {?} state
- * @param {?} title
- * @param {?} path
- * @param {?} queryParams
- * @return {?}
- */
- function (state, title, path, queryParams) {
- var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
- if (url.length == 0) {
- url = this._platformLocation.pathname;
- }
- this._platformLocation.replaceState(state, title, url);
- };
- /**
- * @return {?}
- */
- HashLocationStrategy.prototype.forward = /**
- * @return {?}
- */
- function () { this._platformLocation.forward(); };
- /**
- * @return {?}
- */
- HashLocationStrategy.prototype.back = /**
- * @return {?}
- */
- function () { this._platformLocation.back(); };
- HashLocationStrategy.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- HashLocationStrategy.ctorParameters = function () { return [
- { type: PlatformLocation, },
- { 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,] },] },
- ]; };
- return HashLocationStrategy;
- }(LocationStrategy));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@whatItDoes Use URL for storing application location data.
- * \@description
- * `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the
- * {\@link Location} service to represent its state in the
- * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
- * browser's URL.
- *
- * If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF}
- * or add a base element to the document. This URL prefix that will be preserved
- * when generating and recognizing URLs.
- *
- * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call
- * `location.go('/foo')`, the browser's URL will become
- * `example.com/my/app/foo`.
- *
- * Similarly, if you add `<base href='/my/app'/>` to the document and call
- * `location.go('/foo')`, the browser's URL will become
- * `example.com/my/app/foo`.
- *
- * ### Example
- *
- * {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
- *
- * \@stable
- */
- var PathLocationStrategy = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(PathLocationStrategy, _super);
- function PathLocationStrategy(_platformLocation, href) {
- var _this = _super.call(this) || this;
- _this._platformLocation = _platformLocation;
- if (href == null) {
- href = _this._platformLocation.getBaseHrefFromDOM();
- }
- if (href == null) {
- 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.");
- }
- _this._baseHref = href;
- return _this;
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- PathLocationStrategy.prototype.onPopState = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._platformLocation.onPopState(fn);
- this._platformLocation.onHashChange(fn);
- };
- /**
- * @return {?}
- */
- PathLocationStrategy.prototype.getBaseHref = /**
- * @return {?}
- */
- function () { return this._baseHref; };
- /**
- * @param {?} internal
- * @return {?}
- */
- PathLocationStrategy.prototype.prepareExternalUrl = /**
- * @param {?} internal
- * @return {?}
- */
- function (internal) {
- return Location.joinWithSlash(this._baseHref, internal);
- };
- /**
- * @param {?=} includeHash
- * @return {?}
- */
- PathLocationStrategy.prototype.path = /**
- * @param {?=} includeHash
- * @return {?}
- */
- function (includeHash) {
- if (includeHash === void 0) { includeHash = false; }
- var /** @type {?} */ pathname = this._platformLocation.pathname +
- Location.normalizeQueryParams(this._platformLocation.search);
- var /** @type {?} */ hash = this._platformLocation.hash;
- return hash && includeHash ? "" + pathname + hash : pathname;
- };
- /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @param {?} queryParams
- * @return {?}
- */
- PathLocationStrategy.prototype.pushState = /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @param {?} queryParams
- * @return {?}
- */
- function (state, title, url, queryParams) {
- var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
- this._platformLocation.pushState(state, title, externalUrl);
- };
- /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @param {?} queryParams
- * @return {?}
- */
- PathLocationStrategy.prototype.replaceState = /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @param {?} queryParams
- * @return {?}
- */
- function (state, title, url, queryParams) {
- var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
- this._platformLocation.replaceState(state, title, externalUrl);
- };
- /**
- * @return {?}
- */
- PathLocationStrategy.prototype.forward = /**
- * @return {?}
- */
- function () { this._platformLocation.forward(); };
- /**
- * @return {?}
- */
- PathLocationStrategy.prototype.back = /**
- * @return {?}
- */
- function () { this._platformLocation.back(); };
- PathLocationStrategy.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- PathLocationStrategy.ctorParameters = function () { return [
- { type: PlatformLocation, },
- { 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,] },] },
- ]; };
- return PathLocationStrategy;
- }(LocationStrategy));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // THIS CODE IS GENERATED - DO NOT MODIFY
- // See angular/tools/gulp-tasks/cldr/extract.js
- /**
- * \@internal
- */
- var CURRENCIES = {
- 'AOA': [, 'Kz'],
- 'ARS': [, '$'],
- 'AUD': ['A$', '$'],
- 'BAM': [, 'KM'],
- 'BBD': [, '$'],
- 'BDT': [, '৳'],
- 'BMD': [, '$'],
- 'BND': [, '$'],
- 'BOB': [, 'Bs'],
- 'BRL': ['R$'],
- 'BSD': [, '$'],
- 'BWP': [, 'P'],
- 'BYN': [, 'р.'],
- 'BZD': [, '$'],
- 'CAD': ['CA$', '$'],
- 'CLP': [, '$'],
- 'CNY': ['CN¥', '¥'],
- 'COP': [, '$'],
- 'CRC': [, '₡'],
- 'CUC': [, '$'],
- 'CUP': [, '$'],
- 'CZK': [, 'Kč'],
- 'DKK': [, 'kr'],
- 'DOP': [, '$'],
- 'EGP': [, 'E£'],
- 'ESP': [, '₧'],
- 'EUR': ['€'],
- 'FJD': [, '$'],
- 'FKP': [, '£'],
- 'GBP': ['£'],
- 'GEL': [, '₾'],
- 'GIP': [, '£'],
- 'GNF': [, 'FG'],
- 'GTQ': [, 'Q'],
- 'GYD': [, '$'],
- 'HKD': ['HK$', '$'],
- 'HNL': [, 'L'],
- 'HRK': [, 'kn'],
- 'HUF': [, 'Ft'],
- 'IDR': [, 'Rp'],
- 'ILS': ['₪'],
- 'INR': ['₹'],
- 'ISK': [, 'kr'],
- 'JMD': [, '$'],
- 'JPY': ['¥'],
- 'KHR': [, '៛'],
- 'KMF': [, 'CF'],
- 'KPW': [, '₩'],
- 'KRW': ['₩'],
- 'KYD': [, '$'],
- 'KZT': [, '₸'],
- 'LAK': [, '₭'],
- 'LBP': [, 'L£'],
- 'LKR': [, 'Rs'],
- 'LRD': [, '$'],
- 'LTL': [, 'Lt'],
- 'LVL': [, 'Ls'],
- 'MGA': [, 'Ar'],
- 'MMK': [, 'K'],
- 'MNT': [, '₮'],
- 'MUR': [, 'Rs'],
- 'MXN': ['MX$', '$'],
- 'MYR': [, 'RM'],
- 'NAD': [, '$'],
- 'NGN': [, '₦'],
- 'NIO': [, 'C$'],
- 'NOK': [, 'kr'],
- 'NPR': [, 'Rs'],
- 'NZD': ['NZ$', '$'],
- 'PHP': [, '₱'],
- 'PKR': [, 'Rs'],
- 'PLN': [, 'zł'],
- 'PYG': [, '₲'],
- 'RON': [, 'lei'],
- 'RUB': [, '₽'],
- 'RUR': [, 'р.'],
- 'RWF': [, 'RF'],
- 'SBD': [, '$'],
- 'SEK': [, 'kr'],
- 'SGD': [, '$'],
- 'SHP': [, '£'],
- 'SRD': [, '$'],
- 'SSP': [, '£'],
- 'STD': [, 'Db'],
- 'SYP': [, '£'],
- 'THB': [, '฿'],
- 'TOP': [, 'T$'],
- 'TRY': [, '₺'],
- 'TTD': [, '$'],
- 'TWD': ['NT$', '$'],
- 'UAH': [, '₴'],
- 'USD': ['$'],
- 'UYU': [, '$'],
- 'VEF': [, 'Bs'],
- 'VND': ['₫'],
- 'XAF': ['FCFA'],
- 'XCD': ['EC$', '$'],
- 'XOF': ['CFA'],
- 'XPF': ['CFPF'],
- 'ZAR': [, 'R'],
- 'ZMW': [, 'ZK'],
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // THIS CODE IS GENERATED - DO NOT MODIFY
- // See angular/tools/gulp-tasks/cldr/extract.js
- /**
- * @param {?} n
- * @return {?}
- */
- function plural(n) {
- var /** @type {?} */ i = Math.floor(Math.abs(n)), /** @type {?} */ v = n.toString().replace(/^[^.]*\.?/, '').length;
- if (i === 1 && v === 0)
- return 1;
- return 5;
- }
- var localeEn = [
- 'en',
- [
- ['a', 'p'],
- ['AM', 'PM'],
- ],
- [
- ['AM', 'PM'],
- ,
- ],
- [
- ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
- ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
- ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
- ],
- ,
- [
- ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
- ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
- [
- 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
- 'October', 'November', 'December'
- ]
- ],
- ,
- [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']], 0, [6, 0],
- ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'],
- ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'],
- [
- '{1}, {0}',
- ,
- '{1} \'at\' {0}',
- ],
- ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'],
- ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], '$', 'US Dollar', plural
- ];
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@experimental i18n support is experimental.
- */
- var LOCALE_DATA = {};
- /**
- * Register global data to be used internally by Angular. See the
- * {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale data.
- *
- * \@experimental i18n support is experimental.
- * @param {?} data
- * @param {?=} localeId
- * @param {?=} extraData
- * @return {?}
- */
- function registerLocaleData(data, localeId, extraData) {
- if (typeof localeId !== 'string') {
- extraData = localeId;
- localeId = data[0 /* LocaleId */];
- }
- localeId = localeId.toLowerCase().replace(/_/g, '-');
- LOCALE_DATA[localeId] = data;
- if (extraData) {
- LOCALE_DATA[localeId][18 /* ExtraData */] = extraData;
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var NumberFormatStyle = {
- Decimal: 0,
- Percent: 1,
- Currency: 2,
- Scientific: 3,
- };
- NumberFormatStyle[NumberFormatStyle.Decimal] = "Decimal";
- NumberFormatStyle[NumberFormatStyle.Percent] = "Percent";
- NumberFormatStyle[NumberFormatStyle.Currency] = "Currency";
- NumberFormatStyle[NumberFormatStyle.Scientific] = "Scientific";
- /** @enum {number} */
- var Plural = {
- Zero: 0,
- One: 1,
- Two: 2,
- Few: 3,
- Many: 4,
- Other: 5,
- };
- Plural[Plural.Zero] = "Zero";
- Plural[Plural.One] = "One";
- Plural[Plural.Two] = "Two";
- Plural[Plural.Few] = "Few";
- Plural[Plural.Many] = "Many";
- Plural[Plural.Other] = "Other";
- /** @enum {number} */
- var FormStyle = {
- Format: 0,
- Standalone: 1,
- };
- FormStyle[FormStyle.Format] = "Format";
- FormStyle[FormStyle.Standalone] = "Standalone";
- /** @enum {number} */
- var TranslationWidth = {
- Narrow: 0,
- Abbreviated: 1,
- Wide: 2,
- Short: 3,
- };
- TranslationWidth[TranslationWidth.Narrow] = "Narrow";
- TranslationWidth[TranslationWidth.Abbreviated] = "Abbreviated";
- TranslationWidth[TranslationWidth.Wide] = "Wide";
- TranslationWidth[TranslationWidth.Short] = "Short";
- /** @enum {number} */
- var FormatWidth = {
- Short: 0,
- Medium: 1,
- Long: 2,
- Full: 3,
- };
- FormatWidth[FormatWidth.Short] = "Short";
- FormatWidth[FormatWidth.Medium] = "Medium";
- FormatWidth[FormatWidth.Long] = "Long";
- FormatWidth[FormatWidth.Full] = "Full";
- /** @enum {number} */
- var NumberSymbol = {
- Decimal: 0,
- Group: 1,
- List: 2,
- PercentSign: 3,
- PlusSign: 4,
- MinusSign: 5,
- Exponential: 6,
- SuperscriptingExponent: 7,
- PerMille: 8,
- Infinity: 9,
- NaN: 10,
- TimeSeparator: 11,
- CurrencyDecimal: 12,
- CurrencyGroup: 13,
- };
- NumberSymbol[NumberSymbol.Decimal] = "Decimal";
- NumberSymbol[NumberSymbol.Group] = "Group";
- NumberSymbol[NumberSymbol.List] = "List";
- NumberSymbol[NumberSymbol.PercentSign] = "PercentSign";
- NumberSymbol[NumberSymbol.PlusSign] = "PlusSign";
- NumberSymbol[NumberSymbol.MinusSign] = "MinusSign";
- NumberSymbol[NumberSymbol.Exponential] = "Exponential";
- NumberSymbol[NumberSymbol.SuperscriptingExponent] = "SuperscriptingExponent";
- NumberSymbol[NumberSymbol.PerMille] = "PerMille";
- NumberSymbol[NumberSymbol.Infinity] = "Infinity";
- NumberSymbol[NumberSymbol.NaN] = "NaN";
- NumberSymbol[NumberSymbol.TimeSeparator] = "TimeSeparator";
- NumberSymbol[NumberSymbol.CurrencyDecimal] = "CurrencyDecimal";
- NumberSymbol[NumberSymbol.CurrencyGroup] = "CurrencyGroup";
- /** @enum {number} */
- var WeekDay = {
- Sunday: 0,
- Monday: 1,
- Tuesday: 2,
- Wednesday: 3,
- Thursday: 4,
- Friday: 5,
- Saturday: 6,
- };
- WeekDay[WeekDay.Sunday] = "Sunday";
- WeekDay[WeekDay.Monday] = "Monday";
- WeekDay[WeekDay.Tuesday] = "Tuesday";
- WeekDay[WeekDay.Wednesday] = "Wednesday";
- WeekDay[WeekDay.Thursday] = "Thursday";
- WeekDay[WeekDay.Friday] = "Friday";
- WeekDay[WeekDay.Saturday] = "Saturday";
- /**
- * The locale id for the chosen locale (e.g `en-GB`).
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @return {?}
- */
- function getLocaleId(locale) {
- return findLocaleData(locale)[0 /* LocaleId */];
- }
- /**
- * Periods of the day (e.g. `[AM, PM]` for en-US).
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} formStyle
- * @param {?} width
- * @return {?}
- */
- function getLocaleDayPeriods(locale, formStyle, width) {
- var /** @type {?} */ data = findLocaleData(locale);
- var /** @type {?} */ amPmData = /** @type {?} */ ([data[1 /* DayPeriodsFormat */], data[2 /* DayPeriodsStandalone */]]);
- var /** @type {?} */ amPm = getLastDefinedValue(amPmData, formStyle);
- return getLastDefinedValue(amPm, width);
- }
- /**
- * Days of the week for the Gregorian calendar (e.g. `[Sunday, Monday, ... Saturday]` for en-US).
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} formStyle
- * @param {?} width
- * @return {?}
- */
- function getLocaleDayNames(locale, formStyle, width) {
- var /** @type {?} */ data = findLocaleData(locale);
- var /** @type {?} */ daysData = /** @type {?} */ ([data[3 /* DaysFormat */], data[4 /* DaysStandalone */]]);
- var /** @type {?} */ days = getLastDefinedValue(daysData, formStyle);
- return getLastDefinedValue(days, width);
- }
- /**
- * Months of the year for the Gregorian calendar (e.g. `[January, February, ...]` for en-US).
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} formStyle
- * @param {?} width
- * @return {?}
- */
- function getLocaleMonthNames(locale, formStyle, width) {
- var /** @type {?} */ data = findLocaleData(locale);
- var /** @type {?} */ monthsData = /** @type {?} */ ([data[5 /* MonthsFormat */], data[6 /* MonthsStandalone */]]);
- var /** @type {?} */ months = getLastDefinedValue(monthsData, formStyle);
- return getLastDefinedValue(months, width);
- }
- /**
- * Eras for the Gregorian calendar (e.g. AD/BC).
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} width
- * @return {?}
- */
- function getLocaleEraNames(locale, width) {
- var /** @type {?} */ data = findLocaleData(locale);
- var /** @type {?} */ erasData = /** @type {?} */ (data[7 /* Eras */]);
- return getLastDefinedValue(erasData, width);
- }
- /**
- * First day of the week for this locale, based on english days (Sunday = 0, Monday = 1, ...).
- * For example in french the value would be 1 because the first day of the week is Monday.
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @return {?}
- */
- function getLocaleFirstDayOfWeek(locale) {
- var /** @type {?} */ data = findLocaleData(locale);
- return data[8 /* FirstDayOfWeek */];
- }
- /**
- * Range of days in the week that represent the week-end for this locale, based on english days
- * (Sunday = 0, Monday = 1, ...).
- * For example in english the value would be [6,0] for Saturday to Sunday.
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @return {?}
- */
- function getLocaleWeekEndRange(locale) {
- var /** @type {?} */ data = findLocaleData(locale);
- return data[9 /* WeekendRange */];
- }
- /**
- * Date format that depends on the locale.
- *
- * There are four basic date formats:
- * - `full` should contain long-weekday (EEEE), year (y), long-month (MMMM), day (d).
- *
- * For example, English uses `EEEE, MMMM d, y`, corresponding to a date like
- * "Tuesday, September 14, 1999".
- *
- * - `long` should contain year, long-month, day.
- *
- * For example, `MMMM d, y`, corresponding to a date like "September 14, 1999".
- *
- * - `medium` should contain year, abbreviated-month (MMM), day.
- *
- * For example, `MMM d, y`, corresponding to a date like "Sep 14, 1999".
- * For languages that do not use abbreviated months, use the numeric month (MM/M). For example,
- * `y/MM/dd`, corresponding to a date like "1999/09/14".
- *
- * - `short` should contain year, numeric-month (MM/M), and day.
- *
- * For example, `M/d/yy`, corresponding to a date like "9/14/99".
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} width
- * @return {?}
- */
- function getLocaleDateFormat(locale, width) {
- var /** @type {?} */ data = findLocaleData(locale);
- return getLastDefinedValue(data[10 /* DateFormat */], width);
- }
- /**
- * Time format that depends on the locale.
- *
- * The standard formats include four basic time formats:
- * - `full` should contain hour (h/H), minute (mm), second (ss), and zone (zzzz).
- * - `long` should contain hour, minute, second, and zone (z)
- * - `medium` should contain hour, minute, second.
- * - `short` should contain hour, minute.
- *
- * Note: The patterns depend on whether the main country using your language uses 12-hour time or
- * not:
- * - For 12-hour time, use a pattern like `hh:mm a` using h to mean a 12-hour clock cycle running
- * 1 through 12 (midnight plus 1 minute is 12:01), or using K to mean a 12-hour clock cycle
- * running 0 through 11 (midnight plus 1 minute is 0:01).
- * - For 24-hour time, use a pattern like `HH:mm` using H to mean a 24-hour clock cycle running 0
- * through 23 (midnight plus 1 minute is 0:01), or using k to mean a 24-hour clock cycle running
- * 1 through 24 (midnight plus 1 minute is 24:01).
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} width
- * @return {?}
- */
- function getLocaleTimeFormat(locale, width) {
- var /** @type {?} */ data = findLocaleData(locale);
- return getLastDefinedValue(data[11 /* TimeFormat */], width);
- }
- /**
- * Date-time format that depends on the locale.
- *
- * The date-time pattern shows how to combine separate patterns for date (represented by {1})
- * and time (represented by {0}) into a single pattern. It usually doesn't need to be changed.
- * What you want to pay attention to are:
- * - possibly removing a space for languages that don't use it, such as many East Asian languages
- * - possibly adding a comma, other punctuation, or a combining word
- *
- * For example:
- * - English uses `{1} 'at' {0}` or `{1}, {0}` (depending on date style), while Japanese uses
- * `{1}{0}`.
- * - An English formatted date-time using the combining pattern `{1}, {0}` could be
- * `Dec 10, 2010, 3:59:49 PM`. Notice the comma and space between the date portion and the time
- * portion.
- *
- * There are four formats (`full`, `long`, `medium`, `short`); the determination of which to use
- * is normally based on the date style. For example, if the date has a full month and weekday
- * name, the full combining pattern will be used to combine that with a time. If the date has
- * numeric month, the short version of the combining pattern will be used to combine that with a
- * time. English uses `{1} 'at' {0}` for full and long styles, and `{1}, {0}` for medium and short
- * styles.
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} width
- * @return {?}
- */
- function getLocaleDateTimeFormat(locale, width) {
- var /** @type {?} */ data = findLocaleData(locale);
- var /** @type {?} */ dateTimeFormatData = /** @type {?} */ (data[12 /* DateTimeFormat */]);
- return getLastDefinedValue(dateTimeFormatData, width);
- }
- /**
- * Number symbol that can be used to replace placeholders in number formats.
- * See {\@link NumberSymbol} for more information.
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} symbol
- * @return {?}
- */
- function getLocaleNumberSymbol(locale, symbol) {
- var /** @type {?} */ data = findLocaleData(locale);
- var /** @type {?} */ res = data[13 /* NumberSymbols */][symbol];
- if (typeof res === 'undefined') {
- if (symbol === NumberSymbol.CurrencyDecimal) {
- return data[13 /* NumberSymbols */][NumberSymbol.Decimal];
- }
- else if (symbol === NumberSymbol.CurrencyGroup) {
- return data[13 /* NumberSymbols */][NumberSymbol.Group];
- }
- }
- return res;
- }
- /**
- * Number format that depends on the locale.
- *
- * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
- * when used to format the number 12345.678 could result in "12'345,67". That would happen if the
- * grouping separator for your language is an apostrophe, and the decimal separator is a comma.
- *
- * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders;
- * they stand for the decimal separator, and so on, and are NOT real characters.
- * You must NOT "translate" the placeholders; for example, don't change `.` to `,` even though in
- * your language the decimal point is written with a comma. The symbols should be replaced by the
- * local equivalents, using the Number Symbols for your language.
- *
- * Here are the special characters used in number patterns:
- *
- * | Symbol | Meaning |
- * |--------|---------|
- * | . | Replaced automatically by the character used for the decimal point. |
- * | , | Replaced by the "grouping" (thousands) separator. |
- * | 0 | Replaced by a digit (or zero if there aren't enough digits). |
- * | # | Replaced by a digit (or nothing if there aren't enough). |
- * | ¤ | This will be replaced by a currency symbol, such as $ or USD. |
- * | % | This marks a percent format. The % symbol may change position, but must be retained. |
- * | E | This marks a scientific format. The E symbol may change position, but must be retained. |
- * | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
- *
- * You can find more information
- * [on the CLDR website](http://cldr.unicode.org/translation/number-patterns)
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} type
- * @return {?}
- */
- function getLocaleNumberFormat(locale, type) {
- var /** @type {?} */ data = findLocaleData(locale);
- return data[14 /* NumberFormats */][type];
- }
- /**
- * The symbol used to represent the currency for the main country using this locale (e.g. $ for
- * the locale en-US).
- * The symbol will be `null` if the main country cannot be determined.
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @return {?}
- */
- function getLocaleCurrencySymbol(locale) {
- var /** @type {?} */ data = findLocaleData(locale);
- return data[15 /* CurrencySymbol */] || null;
- }
- /**
- * The name of the currency for the main country using this locale (e.g. USD for the locale
- * en-US).
- * The name will be `null` if the main country cannot be determined.
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @return {?}
- */
- function getLocaleCurrencyName(locale) {
- var /** @type {?} */ data = findLocaleData(locale);
- return data[16 /* CurrencyName */] || null;
- }
- /**
- * The locale plural function used by ICU expressions to determine the plural case to use.
- * See {\@link NgPlural} for more information.
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @return {?}
- */
- function getLocalePluralCase(locale) {
- var /** @type {?} */ data = findLocaleData(locale);
- return data[17 /* PluralCase */];
- }
- /**
- * @param {?} data
- * @return {?}
- */
- function checkFullData(data) {
- if (!data[18 /* ExtraData */]) {
- 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.");
- }
- }
- /**
- * Rules used to determine which day period to use (See `dayPeriods` below).
- * The rules can either be an array or a single value. If it's an array, consider it as "from"
- * and "to". If it's a single value then it means that the period is only valid at this exact
- * value.
- * There is always the same number of rules as the number of day periods, which means that the
- * first rule is applied to the first day period and so on.
- * You should fallback to AM/PM when there are no rules available.
- *
- * Note: this is only available if you load the full locale data.
- * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
- * data.
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @return {?}
- */
- function getLocaleExtraDayPeriodRules(locale) {
- var /** @type {?} */ data = findLocaleData(locale);
- checkFullData(data);
- var /** @type {?} */ rules = data[18 /* ExtraData */][2 /* ExtraDayPeriodsRules */] || [];
- return rules.map(function (rule) {
- if (typeof rule === 'string') {
- return extractTime(rule);
- }
- return [extractTime(rule[0]), extractTime(rule[1])];
- });
- }
- /**
- * Day Periods indicate roughly how the day is broken up in different languages (e.g. morning,
- * noon, afternoon, midnight, ...).
- * You should use the function {\@link getLocaleExtraDayPeriodRules} to determine which period to
- * use.
- * You should fallback to AM/PM when there are no day periods available.
- *
- * Note: this is only available if you load the full locale data.
- * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
- * data.
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @param {?} formStyle
- * @param {?} width
- * @return {?}
- */
- function getLocaleExtraDayPeriods(locale, formStyle, width) {
- var /** @type {?} */ data = findLocaleData(locale);
- checkFullData(data);
- var /** @type {?} */ dayPeriodsData = /** @type {?} */ ([
- data[18 /* ExtraData */][0 /* ExtraDayPeriodFormats */],
- data[18 /* ExtraData */][1 /* ExtraDayPeriodStandalone */]
- ]);
- var /** @type {?} */ dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
- return getLastDefinedValue(dayPeriods, width) || [];
- }
- /**
- * Returns the first value that is defined in an array, going backwards.
- *
- * To avoid repeating the same data (e.g. when "format" and "standalone" are the same) we only
- * add the first one to the locale data arrays, the other ones are only defined when different.
- * We use this function to retrieve the first defined value.
- *
- * \@experimental i18n support is experimental.
- * @template T
- * @param {?} data
- * @param {?} index
- * @return {?}
- */
- function getLastDefinedValue(data, index) {
- for (var /** @type {?} */ i = index; i > -1; i--) {
- if (typeof data[i] !== 'undefined') {
- return data[i];
- }
- }
- throw new Error('Locale data API: locale data undefined');
- }
- /**
- * Extract the hours and minutes from a string like "15:45"
- * @param {?} time
- * @return {?}
- */
- function extractTime(time) {
- var _a = time.split(':'), h = _a[0], m = _a[1];
- return { hours: +h, minutes: +m };
- }
- /**
- * Finds the locale data for a locale id
- *
- * \@experimental i18n support is experimental.
- * @param {?} locale
- * @return {?}
- */
- function findLocaleData(locale) {
- var /** @type {?} */ normalizedLocale = locale.toLowerCase().replace(/_/g, '-');
- var /** @type {?} */ match = LOCALE_DATA[normalizedLocale];
- if (match) {
- return match;
- }
- // let's try to find a parent locale
- var /** @type {?} */ parentLocale = normalizedLocale.split('-')[0];
- match = LOCALE_DATA[parentLocale];
- if (match) {
- return match;
- }
- if (parentLocale === 'en') {
- return localeEn;
- }
- throw new Error("Missing locale data for the locale \"" + locale + "\".");
- }
- /**
- * Return the currency symbol for a given currency code, or the code if no symbol available
- * (e.g.: format narrow = $, format wide = US$, code = USD)
- *
- * \@experimental i18n support is experimental.
- * @param {?} code
- * @param {?} format
- * @return {?}
- */
- function getCurrencySymbol(code, format) {
- var /** @type {?} */ currency = CURRENCIES[code] || [];
- var /** @type {?} */ symbolNarrow = currency[1];
- if (format === 'narrow' && typeof symbolNarrow === 'string') {
- return symbolNarrow;
- }
- return currency[0] || code;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @deprecated from v5
- */
- var DEPRECATED_PLURAL_FN = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* InjectionToken */]('UseV4Plurals');
- /**
- * \@experimental
- * @abstract
- */
- var NgLocalization = /** @class */ (function () {
- function NgLocalization() {
- }
- return NgLocalization;
- }());
- /**
- * Returns the plural category for a given value.
- * - "=value" when the case exists,
- * - the plural category otherwise
- * @param {?} value
- * @param {?} cases
- * @param {?} ngLocalization
- * @param {?=} locale
- * @return {?}
- */
- function getPluralCategory(value, cases, ngLocalization, locale) {
- var /** @type {?} */ key = "=" + value;
- if (cases.indexOf(key) > -1) {
- return key;
- }
- key = ngLocalization.getPluralCategory(value, locale);
- if (cases.indexOf(key) > -1) {
- return key;
- }
- if (cases.indexOf('other') > -1) {
- return 'other';
- }
- throw new Error("No plural message found for value \"" + value + "\"");
- }
- /**
- * Returns the plural case based on the locale
- *
- * \@experimental
- */
- var NgLocaleLocalization = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(NgLocaleLocalization, _super);
- function NgLocaleLocalization(locale, /** @deprecated from v5 */
- deprecatedPluralFn) {
- var _this = _super.call(this) || this;
- _this.locale = locale;
- _this.deprecatedPluralFn = deprecatedPluralFn;
- return _this;
- }
- /**
- * @param {?} value
- * @param {?=} locale
- * @return {?}
- */
- NgLocaleLocalization.prototype.getPluralCategory = /**
- * @param {?} value
- * @param {?=} locale
- * @return {?}
- */
- function (value, locale) {
- var /** @type {?} */ plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) :
- getLocalePluralCase(locale || this.locale)(value);
- switch (plural) {
- case Plural.Zero:
- return 'zero';
- case Plural.One:
- return 'one';
- case Plural.Two:
- return 'two';
- case Plural.Few:
- return 'few';
- case Plural.Many:
- return 'many';
- default:
- return 'other';
- }
- };
- NgLocaleLocalization.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- NgLocaleLocalization.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
- { 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,] },] },
- ]; };
- return NgLocaleLocalization;
- }(NgLocalization));
- /**
- * Returns the plural case based on the locale
- *
- * @deprecated from v5 the plural case function is in locale data files common/locales/*.ts
- * \@experimental
- * @param {?} locale
- * @param {?} nLike
- * @return {?}
- */
- function getPluralCase(locale, nLike) {
- // TODO(vicb): lazy compute
- if (typeof nLike === 'string') {
- nLike = parseInt(/** @type {?} */ (nLike), 10);
- }
- var /** @type {?} */ n = /** @type {?} */ (nLike);
- var /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, '');
- var /** @type {?} */ i = Math.floor(Math.abs(n));
- var /** @type {?} */ v = nDecimal.length;
- var /** @type {?} */ f = parseInt(nDecimal, 10);
- var /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0;
- var /** @type {?} */ lang = locale.split('-')[0].toLowerCase();
- switch (lang) {
- case 'af':
- case 'asa':
- case 'az':
- case 'bem':
- case 'bez':
- case 'bg':
- case 'brx':
- case 'ce':
- case 'cgg':
- case 'chr':
- case 'ckb':
- case 'ee':
- case 'el':
- case 'eo':
- case 'es':
- case 'eu':
- case 'fo':
- case 'fur':
- case 'gsw':
- case 'ha':
- case 'haw':
- case 'hu':
- case 'jgo':
- case 'jmc':
- case 'ka':
- case 'kk':
- case 'kkj':
- case 'kl':
- case 'ks':
- case 'ksb':
- case 'ky':
- case 'lb':
- case 'lg':
- case 'mas':
- case 'mgo':
- case 'ml':
- case 'mn':
- case 'nb':
- case 'nd':
- case 'ne':
- case 'nn':
- case 'nnh':
- case 'nyn':
- case 'om':
- case 'or':
- case 'os':
- case 'ps':
- case 'rm':
- case 'rof':
- case 'rwk':
- case 'saq':
- case 'seh':
- case 'sn':
- case 'so':
- case 'sq':
- case 'ta':
- case 'te':
- case 'teo':
- case 'tk':
- case 'tr':
- case 'ug':
- case 'uz':
- case 'vo':
- case 'vun':
- case 'wae':
- case 'xog':
- if (n === 1)
- return Plural.One;
- return Plural.Other;
- case 'ak':
- case 'ln':
- case 'mg':
- case 'pa':
- case 'ti':
- if (n === Math.floor(n) && n >= 0 && n <= 1)
- return Plural.One;
- return Plural.Other;
- case 'am':
- case 'as':
- case 'bn':
- case 'fa':
- case 'gu':
- case 'hi':
- case 'kn':
- case 'mr':
- case 'zu':
- if (i === 0 || n === 1)
- return Plural.One;
- return Plural.Other;
- case 'ar':
- if (n === 0)
- return Plural.Zero;
- if (n === 1)
- return Plural.One;
- if (n === 2)
- return Plural.Two;
- if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10)
- return Plural.Few;
- if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99)
- return Plural.Many;
- return Plural.Other;
- case 'ast':
- case 'ca':
- case 'de':
- case 'en':
- case 'et':
- case 'fi':
- case 'fy':
- case 'gl':
- case 'it':
- case 'nl':
- case 'sv':
- case 'sw':
- case 'ur':
- case 'yi':
- if (i === 1 && v === 0)
- return Plural.One;
- return Plural.Other;
- case 'be':
- if (n % 10 === 1 && !(n % 100 === 11))
- return Plural.One;
- if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 &&
- !(n % 100 >= 12 && n % 100 <= 14))
- return Plural.Few;
- if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 ||
- n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14)
- return Plural.Many;
- return Plural.Other;
- case 'br':
- if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91))
- return Plural.One;
- if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92))
- return Plural.Two;
- if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) &&
- !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 ||
- n % 100 >= 90 && n % 100 <= 99))
- return Plural.Few;
- if (!(n === 0) && n % 1e6 === 0)
- return Plural.Many;
- return Plural.Other;
- case 'bs':
- case 'hr':
- case 'sr':
- if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11))
- return Plural.One;
- if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
- !(i % 100 >= 12 && i % 100 <= 14) ||
- f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 &&
- !(f % 100 >= 12 && f % 100 <= 14))
- return Plural.Few;
- return Plural.Other;
- case 'cs':
- case 'sk':
- if (i === 1 && v === 0)
- return Plural.One;
- if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0)
- return Plural.Few;
- if (!(v === 0))
- return Plural.Many;
- return Plural.Other;
- case 'cy':
- if (n === 0)
- return Plural.Zero;
- if (n === 1)
- return Plural.One;
- if (n === 2)
- return Plural.Two;
- if (n === 3)
- return Plural.Few;
- if (n === 6)
- return Plural.Many;
- return Plural.Other;
- case 'da':
- if (n === 1 || !(t === 0) && (i === 0 || i === 1))
- return Plural.One;
- return Plural.Other;
- case 'dsb':
- case 'hsb':
- if (v === 0 && i % 100 === 1 || f % 100 === 1)
- return Plural.One;
- if (v === 0 && i % 100 === 2 || f % 100 === 2)
- return Plural.Two;
- if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 ||
- f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4)
- return Plural.Few;
- return Plural.Other;
- case 'ff':
- case 'fr':
- case 'hy':
- case 'kab':
- if (i === 0 || i === 1)
- return Plural.One;
- return Plural.Other;
- case 'fil':
- if (v === 0 && (i === 1 || i === 2 || i === 3) ||
- v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) ||
- !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9))
- return Plural.One;
- return Plural.Other;
- case 'ga':
- if (n === 1)
- return Plural.One;
- if (n === 2)
- return Plural.Two;
- if (n === Math.floor(n) && n >= 3 && n <= 6)
- return Plural.Few;
- if (n === Math.floor(n) && n >= 7 && n <= 10)
- return Plural.Many;
- return Plural.Other;
- case 'gd':
- if (n === 1 || n === 11)
- return Plural.One;
- if (n === 2 || n === 12)
- return Plural.Two;
- if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19))
- return Plural.Few;
- return Plural.Other;
- case 'gv':
- if (v === 0 && i % 10 === 1)
- return Plural.One;
- if (v === 0 && i % 10 === 2)
- return Plural.Two;
- if (v === 0 &&
- (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80))
- return Plural.Few;
- if (!(v === 0))
- return Plural.Many;
- return Plural.Other;
- case 'he':
- if (i === 1 && v === 0)
- return Plural.One;
- if (i === 2 && v === 0)
- return Plural.Two;
- if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0)
- return Plural.Many;
- return Plural.Other;
- case 'is':
- if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0))
- return Plural.One;
- return Plural.Other;
- case 'ksh':
- if (n === 0)
- return Plural.Zero;
- if (n === 1)
- return Plural.One;
- return Plural.Other;
- case 'kw':
- case 'naq':
- case 'se':
- case 'smn':
- if (n === 1)
- return Plural.One;
- if (n === 2)
- return Plural.Two;
- return Plural.Other;
- case 'lag':
- if (n === 0)
- return Plural.Zero;
- if ((i === 0 || i === 1) && !(n === 0))
- return Plural.One;
- return Plural.Other;
- case 'lt':
- if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19))
- return Plural.One;
- if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 &&
- !(n % 100 >= 11 && n % 100 <= 19))
- return Plural.Few;
- if (!(f === 0))
- return Plural.Many;
- return Plural.Other;
- case 'lv':
- case 'prg':
- if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 ||
- v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19)
- return Plural.Zero;
- if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) ||
- !(v === 2) && f % 10 === 1)
- return Plural.One;
- return Plural.Other;
- case 'mk':
- if (v === 0 && i % 10 === 1 || f % 10 === 1)
- return Plural.One;
- return Plural.Other;
- case 'mt':
- if (n === 1)
- return Plural.One;
- if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10)
- return Plural.Few;
- if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19)
- return Plural.Many;
- return Plural.Other;
- case 'pl':
- if (i === 1 && v === 0)
- return Plural.One;
- if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
- !(i % 100 >= 12 && i % 100 <= 14))
- return Plural.Few;
- if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 ||
- v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
- v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14)
- return Plural.Many;
- return Plural.Other;
- case 'pt':
- if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2))
- return Plural.One;
- return Plural.Other;
- case 'ro':
- if (i === 1 && v === 0)
- return Plural.One;
- if (!(v === 0) || n === 0 ||
- !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19)
- return Plural.Few;
- return Plural.Other;
- case 'ru':
- case 'uk':
- if (v === 0 && i % 10 === 1 && !(i % 100 === 11))
- return Plural.One;
- if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
- !(i % 100 >= 12 && i % 100 <= 14))
- return Plural.Few;
- if (v === 0 && i % 10 === 0 ||
- v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
- v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14)
- return Plural.Many;
- return Plural.Other;
- case 'shi':
- if (i === 0 || n === 1)
- return Plural.One;
- if (n === Math.floor(n) && n >= 2 && n <= 10)
- return Plural.Few;
- return Plural.Other;
- case 'si':
- if (n === 0 || n === 1 || i === 0 && f === 1)
- return Plural.One;
- return Plural.Other;
- case 'sl':
- if (v === 0 && i % 100 === 1)
- return Plural.One;
- if (v === 0 && i % 100 === 2)
- return Plural.Two;
- if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0))
- return Plural.Few;
- return Plural.Other;
- case 'tzm':
- if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99)
- return Plural.One;
- return Plural.Other;
- // When there is no specification, the default is always "other"
- // Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules
- // > other (required—general plural form — also used if the language only has a single form)
- default:
- return Plural.Other;
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} cookieStr
- * @param {?} name
- * @return {?}
- */
- function parseCookieValue(cookieStr, name) {
- name = encodeURIComponent(name);
- for (var _i = 0, _a = cookieStr.split(';'); _i < _a.length; _i++) {
- var cookie = _a[_i];
- var /** @type {?} */ eqIndex = cookie.indexOf('=');
- var _b = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], cookieName = _b[0], cookieValue = _b[1];
- if (cookieName.trim() === name) {
- return decodeURIComponent(cookieValue);
- }
- }
- return null;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@ngModule CommonModule
- *
- * \@whatItDoes Adds and removes CSS classes on an HTML element.
- *
- * \@howToUse
- * ```
- * <some-element [ngClass]="'first second'">...</some-element>
- *
- * <some-element [ngClass]="['first', 'second']">...</some-element>
- *
- * <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
- *
- * <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
- *
- * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
- * ```
- *
- * \@description
- *
- * The CSS classes are updated as follows, depending on the type of the expression evaluation:
- * - `string` - the CSS classes listed in the string (space delimited) are added,
- * - `Array` - the CSS classes declared as Array elements are added,
- * - `Object` - keys are CSS classes that get added when the expression given in the value
- * evaluates to a truthy value, otherwise they are removed.
- *
- * \@stable
- */
- var NgClass = /** @class */ (function () {
- function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
- this._iterableDiffers = _iterableDiffers;
- this._keyValueDiffers = _keyValueDiffers;
- this._ngEl = _ngEl;
- this._renderer = _renderer;
- this._initialClasses = [];
- }
- Object.defineProperty(NgClass.prototype, "klass", {
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- this._applyInitialClasses(true);
- this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : [];
- this._applyInitialClasses(false);
- this._applyClasses(this._rawClass, false);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(NgClass.prototype, "ngClass", {
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- this._cleanupClasses(this._rawClass);
- this._iterableDiffer = null;
- this._keyValueDiffer = null;
- this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v;
- if (this._rawClass) {
- if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_25" /* ɵisListLikeIterable */])(this._rawClass)) {
- this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
- }
- else {
- this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
- }
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- NgClass.prototype.ngDoCheck = /**
- * @return {?}
- */
- function () {
- if (this._iterableDiffer) {
- var /** @type {?} */ iterableChanges = this._iterableDiffer.diff(/** @type {?} */ (this._rawClass));
- if (iterableChanges) {
- this._applyIterableChanges(iterableChanges);
- }
- }
- else if (this._keyValueDiffer) {
- var /** @type {?} */ keyValueChanges = this._keyValueDiffer.diff(/** @type {?} */ (this._rawClass));
- if (keyValueChanges) {
- this._applyKeyValueChanges(keyValueChanges);
- }
- }
- };
- /**
- * @param {?} rawClassVal
- * @return {?}
- */
- NgClass.prototype._cleanupClasses = /**
- * @param {?} rawClassVal
- * @return {?}
- */
- function (rawClassVal) {
- this._applyClasses(rawClassVal, true);
- this._applyInitialClasses(false);
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- NgClass.prototype._applyKeyValueChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- var _this = this;
- changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
- changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
- changes.forEachRemovedItem(function (record) {
- if (record.previousValue) {
- _this._toggleClass(record.key, false);
- }
- });
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- NgClass.prototype._applyIterableChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- var _this = this;
- changes.forEachAddedItem(function (record) {
- if (typeof record.item === 'string') {
- _this._toggleClass(record.item, true);
- }
- else {
- throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_39" /* ɵstringify */])(record.item));
- }
- });
- changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); });
- };
- /**
- * @param {?} isCleanup
- * @return {?}
- */
- NgClass.prototype._applyInitialClasses = /**
- * @param {?} isCleanup
- * @return {?}
- */
- function (isCleanup) {
- var _this = this;
- this._initialClasses.forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
- };
- /**
- * @param {?} rawClassVal
- * @param {?} isCleanup
- * @return {?}
- */
- NgClass.prototype._applyClasses = /**
- * @param {?} rawClassVal
- * @param {?} isCleanup
- * @return {?}
- */
- function (rawClassVal, isCleanup) {
- var _this = this;
- if (rawClassVal) {
- if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
- (/** @type {?} */ (rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
- }
- else {
- Object.keys(rawClassVal).forEach(function (klass) {
- if (rawClassVal[klass] != null)
- _this._toggleClass(klass, !isCleanup);
- });
- }
- }
- };
- /**
- * @param {?} klass
- * @param {?} enabled
- * @return {?}
- */
- NgClass.prototype._toggleClass = /**
- * @param {?} klass
- * @param {?} enabled
- * @return {?}
- */
- function (klass, enabled) {
- var _this = this;
- klass = klass.trim();
- if (klass) {
- klass.split(/\s+/g).forEach(function (klass) {
- if (enabled) {
- _this._renderer.addClass(_this._ngEl.nativeElement, klass);
- }
- else {
- _this._renderer.removeClass(_this._ngEl.nativeElement, klass);
- }
- });
- }
- };
- NgClass.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngClass]' },] },
- ];
- /** @nocollapse */
- NgClass.ctorParameters = function () { return [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* IterableDiffers */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["C" /* KeyValueDiffers */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ElementRef */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["R" /* Renderer2 */], },
- ]; };
- NgClass.propDecorators = {
- "klass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */], args: ['class',] },],
- "ngClass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- };
- return NgClass;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Instantiates a single {\@link Component} type and inserts its Host View into current View.
- * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
- *
- * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
- * any existing component will get destroyed.
- *
- * ### Fine tune control
- *
- * You can control the component creation process by using the following optional attributes:
- *
- * * `ngComponentOutletInjector`: Optional custom {\@link Injector} that will be used as parent for
- * the Component. Defaults to the injector of the current view container.
- *
- * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
- * section of the component, if exists.
- *
- * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other
- * module, then load a component from that module.
- *
- * ### Syntax
- *
- * Simple
- * ```
- * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
- * ```
- *
- * Customized injector/content
- * ```
- * <ng-container *ngComponentOutlet="componentTypeExpression;
- * injector: injectorExpression;
- * content: contentNodesExpression;">
- * </ng-container>
- * ```
- *
- * Customized ngModuleFactory
- * ```
- * <ng-container *ngComponentOutlet="componentTypeExpression;
- * ngModuleFactory: moduleFactory;">
- * </ng-container>
- * ```
- * ## Example
- *
- * {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
- *
- * A more complete example with additional options:
- *
- * {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
- * A more complete example with ngModuleFactory:
- *
- * {\@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'}
- *
- * \@experimental
- */
- var NgComponentOutlet = /** @class */ (function () {
- function NgComponentOutlet(_viewContainerRef) {
- this._viewContainerRef = _viewContainerRef;
- this._componentRef = null;
- this._moduleRef = null;
- }
- /**
- * @param {?} changes
- * @return {?}
- */
- NgComponentOutlet.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- this._viewContainerRef.clear();
- this._componentRef = null;
- if (this.ngComponentOutlet) {
- var /** @type {?} */ elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
- if (changes['ngComponentOutletNgModuleFactory']) {
- if (this._moduleRef)
- this._moduleRef.destroy();
- if (this.ngComponentOutletNgModuleFactory) {
- var /** @type {?} */ parentModule = elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["H" /* NgModuleRef */]);
- this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector);
- }
- else {
- this._moduleRef = null;
- }
- }
- var /** @type {?} */ componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver :
- elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */]);
- var /** @type {?} */ componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet);
- this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent);
- }
- };
- /**
- * @return {?}
- */
- NgComponentOutlet.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- if (this._moduleRef)
- this._moduleRef.destroy();
- };
- NgComponentOutlet.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngComponentOutlet]' },] },
- ];
- /** @nocollapse */
- NgComponentOutlet.ctorParameters = function () { return [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
- ]; };
- NgComponentOutlet.propDecorators = {
- "ngComponentOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- "ngComponentOutletInjector": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- "ngComponentOutletContent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- "ngComponentOutletNgModuleFactory": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- };
- return NgComponentOutlet;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- */
- var NgForOfContext = /** @class */ (function () {
- function NgForOfContext($implicit, ngForOf, index, count) {
- this.$implicit = $implicit;
- this.ngForOf = ngForOf;
- this.index = index;
- this.count = count;
- }
- Object.defineProperty(NgForOfContext.prototype, "first", {
- get: /**
- * @return {?}
- */
- function () { return this.index === 0; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(NgForOfContext.prototype, "last", {
- get: /**
- * @return {?}
- */
- function () { return this.index === this.count - 1; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(NgForOfContext.prototype, "even", {
- get: /**
- * @return {?}
- */
- function () { return this.index % 2 === 0; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(NgForOfContext.prototype, "odd", {
- get: /**
- * @return {?}
- */
- function () { return !this.even; },
- enumerable: true,
- configurable: true
- });
- return NgForOfContext;
- }());
- /**
- * The `NgForOf` directive instantiates a template once per item from an iterable. The context
- * for each instantiated template inherits from the outer context with the given loop variable
- * set to the current item from the iterable.
- *
- * ### Local Variables
- *
- * `NgForOf` provides several exported values that can be aliased to local variables:
- *
- * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
- * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
- * more complex then a property access, for example when using the async pipe (`userStreams |
- * async`).
- * - `index: number`: The index of the current item in the iterable.
- * - `first: boolean`: True when the item is the first item in the iterable.
- * - `last: boolean`: True when the item is the last item in the iterable.
- * - `even: boolean`: True when the item has an even index in the iterable.
- * - `odd: boolean`: True when the item has an odd index in the iterable.
- *
- * ```
- * <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst">
- * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
- * </li>
- * ```
- *
- * ### Change Propagation
- *
- * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
- *
- * * When an item is added, a new instance of the template is added to the DOM.
- * * When an item is removed, its template instance is removed from the DOM.
- * * When items are reordered, their respective templates are reordered in the DOM.
- * * Otherwise, the DOM element for that item will remain the same.
- *
- * Angular uses object identity to track insertions and deletions within the iterator and reproduce
- * those changes in the DOM. This has important implications for animations and any stateful
- * controls (such as `<input>` elements which accept user input) that are present. Inserted rows can
- * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
- * such as user input.
- *
- * It is possible for the identities of elements in the iterator to change while the data does not.
- * This can happen, for example, if the iterator produced from an RPC to the server, and that
- * RPC is re-run. Even if the data hasn't changed, the second response will produce objects with
- * different identities, and Angular will tear down the entire DOM and rebuild it (as if all old
- * elements were deleted and all new elements inserted). This is an expensive operation and should
- * be avoided if possible.
- *
- * To customize the default tracking algorithm, `NgForOf` supports `trackBy` option.
- * `trackBy` takes a function which has two arguments: `index` and `item`.
- * If `trackBy` is given, Angular tracks changes by the return value of the function.
- *
- * ### Syntax
- *
- * - `<li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>`
- *
- * With `<ng-template>` element:
- *
- * ```
- * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
- * <li>...</li>
- * </ng-template>
- * ```
- *
- * ### Example
- *
- * See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed
- * example.
- *
- * \@stable
- */
- var NgForOf = /** @class */ (function () {
- function NgForOf(_viewContainer, _template, _differs) {
- this._viewContainer = _viewContainer;
- this._template = _template;
- this._differs = _differs;
- this._differ = null;
- }
- Object.defineProperty(NgForOf.prototype, "ngForTrackBy", {
- get: /**
- * @return {?}
- */
- function () { return this._trackByFn; },
- set: /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* isDevMode */])() && fn != null && typeof fn !== 'function') {
- // TODO(vicb): use a log service once there is a public one available
- if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
- console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " +
- "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information.");
- }
- }
- this._trackByFn = fn;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(NgForOf.prototype, "ngForTemplate", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- // TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> once we move to TS v2.1
- // The current type is too restrictive; a template that just uses index, for example,
- // should be acceptable.
- if (value) {
- this._template = value;
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} changes
- * @return {?}
- */
- NgForOf.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- if ('ngForOf' in changes) {
- // React on ngForOf changes only once all inputs have been initialized
- var /** @type {?} */ value = changes['ngForOf'].currentValue;
- if (!this._differ && value) {
- try {
- this._differ = this._differs.find(value).create(this.ngForTrackBy);
- }
- catch (/** @type {?} */ e) {
- throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
- }
- }
- }
- };
- /**
- * @return {?}
- */
- NgForOf.prototype.ngDoCheck = /**
- * @return {?}
- */
- function () {
- if (this._differ) {
- var /** @type {?} */ changes = this._differ.diff(this.ngForOf);
- if (changes)
- this._applyChanges(changes);
- }
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- NgForOf.prototype._applyChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- var _this = this;
- var /** @type {?} */ insertTuples = [];
- changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
- if (item.previousIndex == null) {
- var /** @type {?} */ view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(/** @type {?} */ ((null)), _this.ngForOf, -1, -1), currentIndex);
- var /** @type {?} */ tuple = new RecordViewTuple(item, view);
- insertTuples.push(tuple);
- }
- else if (currentIndex == null) {
- _this._viewContainer.remove(adjustedPreviousIndex);
- }
- else {
- var /** @type {?} */ view = /** @type {?} */ ((_this._viewContainer.get(adjustedPreviousIndex)));
- _this._viewContainer.move(view, currentIndex);
- var /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view));
- insertTuples.push(tuple);
- }
- });
- for (var /** @type {?} */ i = 0; i < insertTuples.length; i++) {
- this._perViewChange(insertTuples[i].view, insertTuples[i].record);
- }
- for (var /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) {
- var /** @type {?} */ viewRef = /** @type {?} */ (this._viewContainer.get(i));
- viewRef.context.index = i;
- viewRef.context.count = ilen;
- }
- changes.forEachIdentityChange(function (record) {
- var /** @type {?} */ viewRef = /** @type {?} */ (_this._viewContainer.get(record.currentIndex));
- viewRef.context.$implicit = record.item;
- });
- };
- /**
- * @param {?} view
- * @param {?} record
- * @return {?}
- */
- NgForOf.prototype._perViewChange = /**
- * @param {?} view
- * @param {?} record
- * @return {?}
- */
- function (view, record) {
- view.context.$implicit = record.item;
- };
- NgForOf.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngFor][ngForOf]' },] },
- ];
- /** @nocollapse */
- NgForOf.ctorParameters = function () { return [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* IterableDiffers */], },
- ]; };
- NgForOf.propDecorators = {
- "ngForOf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- "ngForTrackBy": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- "ngForTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- };
- return NgForOf;
- }());
- var RecordViewTuple = /** @class */ (function () {
- function RecordViewTuple(record, view) {
- this.record = record;
- this.view = view;
- }
- return RecordViewTuple;
- }());
- /**
- * @param {?} type
- * @return {?}
- */
- function getTypeNameForDebugging(type) {
- return type['name'] || typeof type;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Conditionally includes a template based on the value of an `expression`.
- *
- * `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place
- * when expression is truthy or falsy respectively. Typically the:
- * - `then` template is the inline template of `ngIf` unless bound to a different value.
- * - `else` template is blank unless it is bound.
- *
- * ## Most common usage
- *
- * The most common usage of the `ngIf` directive is to conditionally show the inline template as
- * seen in this example:
- * {\@example common/ngIf/ts/module.ts region='NgIfSimple'}
- *
- * ## Showing an alternative template using `else`
- *
- * If it is necessary to display a template when the `expression` is falsy use the `else` template
- * binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`.
- * The template can be defined anywhere in the component view but is typically placed right after
- * `ngIf` for readability.
- *
- * {\@example common/ngIf/ts/module.ts region='NgIfElse'}
- *
- * ## Using non-inlined `then` template
- *
- * Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using
- * a binding (just like `else`). Because `then` and `else` are bindings, the template references can
- * change at runtime as shown in this example.
- *
- * {\@example common/ngIf/ts/module.ts region='NgIfThenElse'}
- *
- * ## Storing conditional result in a variable
- *
- * A common pattern is that we need to show a set of properties from the same object. If the
- * object is undefined, then we have to use the safe-traversal-operator `?.` to guard against
- * dereferencing a `null` value. This is especially the case when waiting on async data such as
- * when using the `async` pipe as shown in following example:
- *
- * ```
- * Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}!
- * ```
- *
- * There are several inefficiencies in the above example:
- * - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the
- * example above.
- * - We cannot display an alternative screen while waiting for the data to arrive asynchronously.
- * - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome.
- * - We have to place the `async` pipe in parenthesis.
- *
- * A better way to do this is to use `ngIf` and store the result of the condition in a local
- * variable as shown in the the example below:
- *
- * {\@example common/ngIf/ts/module.ts region='NgIfAs'}
- *
- * Notice that:
- * - We use only one `async` pipe and hence only one subscription gets created.
- * - `ngIf` stores the result of the `userStream|async` in the local variable `user`.
- * - The local `user` can then be bound repeatedly in a more efficient way.
- * - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only
- * display the data if `userStream` returns a value.
- * - We can display an alternative template while waiting for the data.
- *
- * ### Syntax
- *
- * Simple form:
- * - `<div *ngIf="condition">...</div>`
- * - `<ng-template [ngIf]="condition"><div>...</div></ng-template>`
- *
- * Form with an else block:
- * ```
- * <div *ngIf="condition; else elseBlock">...</div>
- * <ng-template #elseBlock>...</ng-template>
- * ```
- *
- * Form with a `then` and `else` block:
- * ```
- * <div *ngIf="condition; then thenBlock else elseBlock"></div>
- * <ng-template #thenBlock>...</ng-template>
- * <ng-template #elseBlock>...</ng-template>
- * ```
- *
- * Form with storing the value locally:
- * ```
- * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
- * <ng-template #elseBlock>...</ng-template>
- * ```
- *
- * \@stable
- */
- var NgIf = /** @class */ (function () {
- function NgIf(_viewContainer, templateRef) {
- this._viewContainer = _viewContainer;
- this._context = new NgIfContext();
- this._thenTemplateRef = null;
- this._elseTemplateRef = null;
- this._thenViewRef = null;
- this._elseViewRef = null;
- this._thenTemplateRef = templateRef;
- }
- Object.defineProperty(NgIf.prototype, "ngIf", {
- set: /**
- * @param {?} condition
- * @return {?}
- */
- function (condition) {
- this._context.$implicit = this._context.ngIf = condition;
- this._updateView();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(NgIf.prototype, "ngIfThen", {
- set: /**
- * @param {?} templateRef
- * @return {?}
- */
- function (templateRef) {
- this._thenTemplateRef = templateRef;
- this._thenViewRef = null; // clear previous view if any.
- this._updateView();
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(NgIf.prototype, "ngIfElse", {
- set: /**
- * @param {?} templateRef
- * @return {?}
- */
- function (templateRef) {
- this._elseTemplateRef = templateRef;
- this._elseViewRef = null; // clear previous view if any.
- this._updateView();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- NgIf.prototype._updateView = /**
- * @return {?}
- */
- function () {
- if (this._context.$implicit) {
- if (!this._thenViewRef) {
- this._viewContainer.clear();
- this._elseViewRef = null;
- if (this._thenTemplateRef) {
- this._thenViewRef =
- this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
- }
- }
- }
- else {
- if (!this._elseViewRef) {
- this._viewContainer.clear();
- this._thenViewRef = null;
- if (this._elseTemplateRef) {
- this._elseViewRef =
- this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
- }
- }
- }
- };
- NgIf.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngIf]' },] },
- ];
- /** @nocollapse */
- NgIf.ctorParameters = function () { return [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
- ]; };
- NgIf.propDecorators = {
- "ngIf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- "ngIfThen": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- "ngIfElse": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- };
- return NgIf;
- }());
- /**
- * \@stable
- */
- var NgIfContext = /** @class */ (function () {
- function NgIfContext() {
- this.$implicit = null;
- this.ngIf = null;
- }
- return NgIfContext;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var SwitchView = /** @class */ (function () {
- function SwitchView(_viewContainerRef, _templateRef) {
- this._viewContainerRef = _viewContainerRef;
- this._templateRef = _templateRef;
- this._created = false;
- }
- /**
- * @return {?}
- */
- SwitchView.prototype.create = /**
- * @return {?}
- */
- function () {
- this._created = true;
- this._viewContainerRef.createEmbeddedView(this._templateRef);
- };
- /**
- * @return {?}
- */
- SwitchView.prototype.destroy = /**
- * @return {?}
- */
- function () {
- this._created = false;
- this._viewContainerRef.clear();
- };
- /**
- * @param {?} created
- * @return {?}
- */
- SwitchView.prototype.enforceState = /**
- * @param {?} created
- * @return {?}
- */
- function (created) {
- if (created && !this._created) {
- this.create();
- }
- else if (!created && this._created) {
- this.destroy();
- }
- };
- return SwitchView;
- }());
- /**
- * \@ngModule CommonModule
- *
- * \@whatItDoes Adds / removes DOM sub-trees when the nest match expressions matches the switch
- * expression.
- *
- * \@howToUse
- * ```
- * <container-element [ngSwitch]="switch_expression">
- * <some-element *ngSwitchCase="match_expression_1">...</some-element>
- * <some-element *ngSwitchCase="match_expression_2">...</some-element>
- * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
- * <ng-container *ngSwitchCase="match_expression_3">
- * <!-- use a ng-container to group multiple root nodes -->
- * <inner-element></inner-element>
- * <inner-other-element></inner-other-element>
- * </ng-container>
- * <some-element *ngSwitchDefault>...</some-element>
- * </container-element>
- * ```
- * \@description
- *
- * `NgSwitch` stamps out nested views when their match expression value matches the value of the
- * switch expression.
- *
- * In other words:
- * - you define a container element (where you place the directive with a switch expression on the
- * `[ngSwitch]="..."` attribute)
- * - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view
- * root elements.
- *
- * Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will
- * be preserved at the location.
- *
- * The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the
- * expression is evaluated.
- * When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is
- * stamped out.
- *
- * \@stable
- */
- var NgSwitch = /** @class */ (function () {
- function NgSwitch() {
- this._defaultUsed = false;
- this._caseCount = 0;
- this._lastCaseCheckIndex = 0;
- this._lastCasesMatched = false;
- }
- Object.defineProperty(NgSwitch.prototype, "ngSwitch", {
- set: /**
- * @param {?} newValue
- * @return {?}
- */
- function (newValue) {
- this._ngSwitch = newValue;
- if (this._caseCount === 0) {
- this._updateDefaultCases(true);
- }
- },
- enumerable: true,
- configurable: true
- });
- /** @internal */
- /**
- * \@internal
- * @return {?}
- */
- NgSwitch.prototype._addCase = /**
- * \@internal
- * @return {?}
- */
- function () { return this._caseCount++; };
- /** @internal */
- /**
- * \@internal
- * @param {?} view
- * @return {?}
- */
- NgSwitch.prototype._addDefault = /**
- * \@internal
- * @param {?} view
- * @return {?}
- */
- function (view) {
- if (!this._defaultViews) {
- this._defaultViews = [];
- }
- this._defaultViews.push(view);
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- NgSwitch.prototype._matchCase = /**
- * \@internal
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var /** @type {?} */ matched = value == this._ngSwitch;
- this._lastCasesMatched = this._lastCasesMatched || matched;
- this._lastCaseCheckIndex++;
- if (this._lastCaseCheckIndex === this._caseCount) {
- this._updateDefaultCases(!this._lastCasesMatched);
- this._lastCaseCheckIndex = 0;
- this._lastCasesMatched = false;
- }
- return matched;
- };
- /**
- * @param {?} useDefault
- * @return {?}
- */
- NgSwitch.prototype._updateDefaultCases = /**
- * @param {?} useDefault
- * @return {?}
- */
- function (useDefault) {
- if (this._defaultViews && useDefault !== this._defaultUsed) {
- this._defaultUsed = useDefault;
- for (var /** @type {?} */ i = 0; i < this._defaultViews.length; i++) {
- var /** @type {?} */ defaultView = this._defaultViews[i];
- defaultView.enforceState(useDefault);
- }
- }
- };
- NgSwitch.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngSwitch]' },] },
- ];
- /** @nocollapse */
- NgSwitch.ctorParameters = function () { return []; };
- NgSwitch.propDecorators = {
- "ngSwitch": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- };
- return NgSwitch;
- }());
- /**
- * \@ngModule CommonModule
- *
- * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgSwitch} when the
- * given expression evaluate to respectively the same/different value as the switch
- * expression.
- *
- * \@howToUse
- * ```
- * <container-element [ngSwitch]="switch_expression">
- * <some-element *ngSwitchCase="match_expression_1">...</some-element>
- * </container-element>
- * ```
- * \@description
- *
- * Insert the sub-tree when the expression evaluates to the same value as the enclosing switch
- * expression.
- *
- * If multiple match expressions match the switch expression value, all of them are displayed.
- *
- * See {\@link NgSwitch} for more details and example.
- *
- * \@stable
- */
- var NgSwitchCase = /** @class */ (function () {
- function NgSwitchCase(viewContainer, templateRef, ngSwitch) {
- this.ngSwitch = ngSwitch;
- ngSwitch._addCase();
- this._view = new SwitchView(viewContainer, templateRef);
- }
- /**
- * @return {?}
- */
- NgSwitchCase.prototype.ngDoCheck = /**
- * @return {?}
- */
- function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); };
- NgSwitchCase.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngSwitchCase]' },] },
- ];
- /** @nocollapse */
- NgSwitchCase.ctorParameters = function () { return [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
- { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* Host */] },] },
- ]; };
- NgSwitchCase.propDecorators = {
- "ngSwitchCase": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- };
- return NgSwitchCase;
- }());
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Creates a view that is added to the parent {\@link NgSwitch} when no case expressions
- * match the
- * switch expression.
- *
- * \@howToUse
- * ```
- * <container-element [ngSwitch]="switch_expression">
- * <some-element *ngSwitchCase="match_expression_1">...</some-element>
- * <some-other-element *ngSwitchDefault>...</some-other-element>
- * </container-element>
- * ```
- *
- * \@description
- *
- * Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch
- * expression.
- *
- * See {\@link NgSwitch} for more details and example.
- *
- * \@stable
- */
- var NgSwitchDefault = /** @class */ (function () {
- function NgSwitchDefault(viewContainer, templateRef, ngSwitch) {
- ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
- }
- NgSwitchDefault.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngSwitchDefault]' },] },
- ];
- /** @nocollapse */
- NgSwitchDefault.ctorParameters = function () { return [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
- { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* Host */] },] },
- ]; };
- return NgSwitchDefault;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@ngModule CommonModule
- *
- * \@whatItDoes Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
- *
- * \@howToUse
- * ```
- * <some-element [ngPlural]="value">
- * <ng-template ngPluralCase="=0">there is nothing</ng-template>
- * <ng-template ngPluralCase="=1">there is one</ng-template>
- * <ng-template ngPluralCase="few">there are a few</ng-template>
- * </some-element>
- * ```
- *
- * \@description
- *
- * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
- * that match the switch expression's pluralization category.
- *
- * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
- * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
- * expression:
- * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
- * matches the switch expression exactly,
- * - otherwise, the view will be treated as a "category match", and will only display if exact
- * value matches aren't found and the value maps to its category for the defined locale.
- *
- * See http://cldr.unicode.org/index/cldr-spec/plural-rules
- *
- * \@experimental
- */
- var NgPlural = /** @class */ (function () {
- function NgPlural(_localization) {
- this._localization = _localization;
- this._caseViews = {};
- }
- Object.defineProperty(NgPlural.prototype, "ngPlural", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._switchValue = value;
- this._updateView();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} value
- * @param {?} switchView
- * @return {?}
- */
- NgPlural.prototype.addCase = /**
- * @param {?} value
- * @param {?} switchView
- * @return {?}
- */
- function (value, switchView) { this._caseViews[value] = switchView; };
- /**
- * @return {?}
- */
- NgPlural.prototype._updateView = /**
- * @return {?}
- */
- function () {
- this._clearViews();
- var /** @type {?} */ cases = Object.keys(this._caseViews);
- var /** @type {?} */ key = getPluralCategory(this._switchValue, cases, this._localization);
- this._activateView(this._caseViews[key]);
- };
- /**
- * @return {?}
- */
- NgPlural.prototype._clearViews = /**
- * @return {?}
- */
- function () {
- if (this._activeView)
- this._activeView.destroy();
- };
- /**
- * @param {?} view
- * @return {?}
- */
- NgPlural.prototype._activateView = /**
- * @param {?} view
- * @return {?}
- */
- function (view) {
- if (view) {
- this._activeView = view;
- this._activeView.create();
- }
- };
- NgPlural.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngPlural]' },] },
- ];
- /** @nocollapse */
- NgPlural.ctorParameters = function () { return [
- { type: NgLocalization, },
- ]; };
- NgPlural.propDecorators = {
- "ngPlural": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- };
- return NgPlural;
- }());
- /**
- * \@ngModule CommonModule
- *
- * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgPlural} when the
- * given expression matches the plural expression according to CLDR rules.
- *
- * \@howToUse
- * ```
- * <some-element [ngPlural]="value">
- * <ng-template ngPluralCase="=0">...</ng-template>
- * <ng-template ngPluralCase="other">...</ng-template>
- * </some-element>
- * ```
- *
- * See {\@link NgPlural} for more details and example.
- *
- * \@experimental
- */
- var NgPluralCase = /** @class */ (function () {
- function NgPluralCase(value, template, viewContainer, ngPlural) {
- this.value = value;
- var /** @type {?} */ isANumber = !isNaN(Number(value));
- ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template));
- }
- NgPluralCase.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngPluralCase]' },] },
- ];
- /** @nocollapse */
- NgPluralCase.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['ngPluralCase',] },] },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* TemplateRef */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
- { type: NgPlural, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* Host */] },] },
- ]; };
- return NgPluralCase;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@ngModule CommonModule
- *
- * \@whatItDoes Update an HTML element styles.
- *
- * \@howToUse
- * ```
- * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element>
- *
- * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
- *
- * <some-element [ngStyle]="objExp">...</some-element>
- * ```
- *
- * \@description
- *
- * The styles are updated according to the value of the expression evaluation:
- * - keys are style names with an optional `.<unit>` suffix (ie 'top.px', 'font-style.em'),
- * - values are the values assigned to those properties (expressed in the given unit).
- *
- * \@stable
- */
- var NgStyle = /** @class */ (function () {
- function NgStyle(_differs, _ngEl, _renderer) {
- this._differs = _differs;
- this._ngEl = _ngEl;
- this._renderer = _renderer;
- }
- Object.defineProperty(NgStyle.prototype, "ngStyle", {
- set: /**
- * @param {?} v
- * @return {?}
- */
- function (v) {
- this._ngStyle = v;
- if (!this._differ && v) {
- this._differ = this._differs.find(v).create();
- }
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- NgStyle.prototype.ngDoCheck = /**
- * @return {?}
- */
- function () {
- if (this._differ) {
- var /** @type {?} */ changes = this._differ.diff(this._ngStyle);
- if (changes) {
- this._applyChanges(changes);
- }
- }
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- NgStyle.prototype._applyChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- var _this = this;
- changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); });
- changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
- changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
- };
- /**
- * @param {?} nameAndUnit
- * @param {?} value
- * @return {?}
- */
- NgStyle.prototype._setStyle = /**
- * @param {?} nameAndUnit
- * @param {?} value
- * @return {?}
- */
- function (nameAndUnit, value) {
- var _a = nameAndUnit.split('.'), name = _a[0], unit = _a[1];
- value = value != null && unit ? "" + value + unit : value;
- if (value != null) {
- this._renderer.setStyle(this._ngEl.nativeElement, name, /** @type {?} */ (value));
- }
- else {
- this._renderer.removeStyle(this._ngEl.nativeElement, name);
- }
- };
- NgStyle.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngStyle]' },] },
- ];
- /** @nocollapse */
- NgStyle.ctorParameters = function () { return [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["C" /* KeyValueDiffers */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ElementRef */], },
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["R" /* Renderer2 */], },
- ]; };
- NgStyle.propDecorators = {
- "ngStyle": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- };
- return NgStyle;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@ngModule CommonModule
- *
- * \@whatItDoes Inserts an embedded view from a prepared `TemplateRef`
- *
- * \@howToUse
- * ```
- * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
- * ```
- *
- * \@description
- *
- * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
- * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
- * by the local template `let` declarations.
- *
- * Note: using the key `$implicit` in the context object will set its value as default.
- *
- * ## Example
- *
- * {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
- *
- * \@stable
- */
- var NgTemplateOutlet = /** @class */ (function () {
- function NgTemplateOutlet(_viewContainerRef) {
- this._viewContainerRef = _viewContainerRef;
- }
- /**
- * @param {?} changes
- * @return {?}
- */
- NgTemplateOutlet.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- var /** @type {?} */ recreateView = this._shouldRecreateView(changes);
- if (recreateView) {
- if (this._viewRef) {
- this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef));
- }
- if (this.ngTemplateOutlet) {
- this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext);
- }
- }
- else {
- if (this._viewRef && this.ngTemplateOutletContext) {
- this._updateExistingContext(this.ngTemplateOutletContext);
- }
- }
- };
- /**
- * We need to re-create existing embedded view if:
- * - templateRef has changed
- * - context has changes
- *
- * We mark context object as changed when the corresponding object
- * shape changes (new properties are added or existing properties are removed).
- * In other words we consider context with the same properties as "the same" even
- * if object reference changes (see https://github.com/angular/angular/issues/13407).
- * @param {?} changes
- * @return {?}
- */
- NgTemplateOutlet.prototype._shouldRecreateView = /**
- * We need to re-create existing embedded view if:
- * - templateRef has changed
- * - context has changes
- *
- * We mark context object as changed when the corresponding object
- * shape changes (new properties are added or existing properties are removed).
- * In other words we consider context with the same properties as "the same" even
- * if object reference changes (see https://github.com/angular/angular/issues/13407).
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- var /** @type {?} */ ctxChange = changes['ngTemplateOutletContext'];
- return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange));
- };
- /**
- * @param {?} ctxChange
- * @return {?}
- */
- NgTemplateOutlet.prototype._hasContextShapeChanged = /**
- * @param {?} ctxChange
- * @return {?}
- */
- function (ctxChange) {
- var /** @type {?} */ prevCtxKeys = Object.keys(ctxChange.previousValue || {});
- var /** @type {?} */ currCtxKeys = Object.keys(ctxChange.currentValue || {});
- if (prevCtxKeys.length === currCtxKeys.length) {
- for (var _i = 0, currCtxKeys_1 = currCtxKeys; _i < currCtxKeys_1.length; _i++) {
- var propName = currCtxKeys_1[_i];
- if (prevCtxKeys.indexOf(propName) === -1) {
- return true;
- }
- }
- return false;
- }
- else {
- return true;
- }
- };
- /**
- * @param {?} ctx
- * @return {?}
- */
- NgTemplateOutlet.prototype._updateExistingContext = /**
- * @param {?} ctx
- * @return {?}
- */
- function (ctx) {
- for (var _i = 0, _a = Object.keys(ctx); _i < _a.length; _i++) {
- var propName = _a[_i];
- (/** @type {?} */ (this._viewRef.context))[propName] = (/** @type {?} */ (this.ngTemplateOutletContext))[propName];
- }
- };
- NgTemplateOutlet.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Directive */], args: [{ selector: '[ngTemplateOutlet]' },] },
- ];
- /** @nocollapse */
- NgTemplateOutlet.ctorParameters = function () { return [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_2" /* ViewContainerRef */], },
- ]; };
- NgTemplateOutlet.propDecorators = {
- "ngTemplateOutletContext": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- "ngTemplateOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Input */] },],
- };
- return NgTemplateOutlet;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A collection of Angular directives that are likely to be used in each and every Angular
- * application.
- */
- var COMMON_DIRECTIVES = [
- NgClass,
- NgComponentOutlet,
- NgForOf,
- NgIf,
- NgTemplateOutlet,
- NgStyle,
- NgSwitch,
- NgSwitchCase,
- NgSwitchDefault,
- NgPlural,
- NgPluralCase,
- ];
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var NAMED_FORMATS = {};
- 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]*)/;
- /** @enum {number} */
- var ZoneWidth = {
- Short: 0,
- ShortGMT: 1,
- Long: 2,
- Extended: 3,
- };
- ZoneWidth[ZoneWidth.Short] = "Short";
- ZoneWidth[ZoneWidth.ShortGMT] = "ShortGMT";
- ZoneWidth[ZoneWidth.Long] = "Long";
- ZoneWidth[ZoneWidth.Extended] = "Extended";
- /** @enum {number} */
- var DateType = {
- FullYear: 0,
- Month: 1,
- Date: 2,
- Hours: 3,
- Minutes: 4,
- Seconds: 5,
- Milliseconds: 6,
- Day: 7,
- };
- DateType[DateType.FullYear] = "FullYear";
- DateType[DateType.Month] = "Month";
- DateType[DateType.Date] = "Date";
- DateType[DateType.Hours] = "Hours";
- DateType[DateType.Minutes] = "Minutes";
- DateType[DateType.Seconds] = "Seconds";
- DateType[DateType.Milliseconds] = "Milliseconds";
- DateType[DateType.Day] = "Day";
- /** @enum {number} */
- var TranslationType = {
- DayPeriods: 0,
- Days: 1,
- Months: 2,
- Eras: 3,
- };
- TranslationType[TranslationType.DayPeriods] = "DayPeriods";
- TranslationType[TranslationType.Days] = "Days";
- TranslationType[TranslationType.Months] = "Months";
- TranslationType[TranslationType.Eras] = "Eras";
- /**
- * Transforms a date to a locale string based on a pattern and a timezone
- *
- * \@internal
- * @param {?} date
- * @param {?} format
- * @param {?} locale
- * @param {?=} timezone
- * @return {?}
- */
- function formatDate(date, format, locale, timezone) {
- var /** @type {?} */ namedFormat = getNamedFormat(locale, format);
- format = namedFormat || format;
- var /** @type {?} */ parts = [];
- var /** @type {?} */ match;
- while (format) {
- match = DATE_FORMATS_SPLIT.exec(format);
- if (match) {
- parts = parts.concat(match.slice(1));
- var /** @type {?} */ part = parts.pop();
- if (!part) {
- break;
- }
- format = part;
- }
- else {
- parts.push(format);
- break;
- }
- }
- var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset();
- if (timezone) {
- dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
- date = convertTimezoneToLocal(date, timezone, true);
- }
- var /** @type {?} */ text = '';
- parts.forEach(function (value) {
- var /** @type {?} */ dateFormatter = getDateFormatter(value);
- text += dateFormatter ?
- dateFormatter(date, locale, dateTimezoneOffset) :
- value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
- });
- return text;
- }
- /**
- * @param {?} locale
- * @param {?} format
- * @return {?}
- */
- function getNamedFormat(locale, format) {
- var /** @type {?} */ localeId = getLocaleId(locale);
- NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {};
- if (NAMED_FORMATS[localeId][format]) {
- return NAMED_FORMATS[localeId][format];
- }
- var /** @type {?} */ formatValue = '';
- switch (format) {
- case 'shortDate':
- formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
- break;
- case 'mediumDate':
- formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
- break;
- case 'longDate':
- formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
- break;
- case 'fullDate':
- formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
- break;
- case 'shortTime':
- formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
- break;
- case 'mediumTime':
- formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
- break;
- case 'longTime':
- formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
- break;
- case 'fullTime':
- formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
- break;
- case 'short':
- var /** @type {?} */ shortTime = getNamedFormat(locale, 'shortTime');
- var /** @type {?} */ shortDate = getNamedFormat(locale, 'shortDate');
- formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
- break;
- case 'medium':
- var /** @type {?} */ mediumTime = getNamedFormat(locale, 'mediumTime');
- var /** @type {?} */ mediumDate = getNamedFormat(locale, 'mediumDate');
- formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
- break;
- case 'long':
- var /** @type {?} */ longTime = getNamedFormat(locale, 'longTime');
- var /** @type {?} */ longDate = getNamedFormat(locale, 'longDate');
- formatValue =
- formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
- break;
- case 'full':
- var /** @type {?} */ fullTime = getNamedFormat(locale, 'fullTime');
- var /** @type {?} */ fullDate = getNamedFormat(locale, 'fullDate');
- formatValue =
- formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
- break;
- }
- if (formatValue) {
- NAMED_FORMATS[localeId][format] = formatValue;
- }
- return formatValue;
- }
- /**
- * @param {?} str
- * @param {?} opt_values
- * @return {?}
- */
- function formatDateTime(str, opt_values) {
- if (opt_values) {
- str = str.replace(/\{([^}]+)}/g, function (match, key) {
- return (opt_values != null && key in opt_values) ? opt_values[key] : match;
- });
- }
- return str;
- }
- /**
- * @param {?} num
- * @param {?} digits
- * @param {?=} minusSign
- * @param {?=} trim
- * @param {?=} negWrap
- * @return {?}
- */
- function padNumber(num, digits, minusSign, trim, negWrap) {
- if (minusSign === void 0) { minusSign = '-'; }
- var /** @type {?} */ neg = '';
- if (num < 0 || (negWrap && num <= 0)) {
- if (negWrap) {
- num = -num + 1;
- }
- else {
- num = -num;
- neg = minusSign;
- }
- }
- var /** @type {?} */ strNum = '' + num;
- while (strNum.length < digits)
- strNum = '0' + strNum;
- if (trim) {
- strNum = strNum.substr(strNum.length - digits);
- }
- return neg + strNum;
- }
- /**
- * Returns a date formatter that transforms a date into its locale digit representation
- * @param {?} name
- * @param {?} size
- * @param {?=} offset
- * @param {?=} trim
- * @param {?=} negWrap
- * @return {?}
- */
- function dateGetter(name, size, offset, trim, negWrap) {
- if (offset === void 0) { offset = 0; }
- if (trim === void 0) { trim = false; }
- if (negWrap === void 0) { negWrap = false; }
- return function (date, locale) {
- var /** @type {?} */ part = getDatePart(name, date, size);
- if (offset > 0 || part > -offset) {
- part += offset;
- }
- if (name === DateType.Hours && part === 0 && offset === -12) {
- part = 12;
- }
- return padNumber(part, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim, negWrap);
- };
- }
- /**
- * @param {?} name
- * @param {?} date
- * @param {?} size
- * @return {?}
- */
- function getDatePart(name, date, size) {
- switch (name) {
- case DateType.FullYear:
- return date.getFullYear();
- case DateType.Month:
- return date.getMonth();
- case DateType.Date:
- return date.getDate();
- case DateType.Hours:
- return date.getHours();
- case DateType.Minutes:
- return date.getMinutes();
- case DateType.Seconds:
- return date.getSeconds();
- case DateType.Milliseconds:
- var /** @type {?} */ div = size === 1 ? 100 : (size === 2 ? 10 : 1);
- return Math.round(date.getMilliseconds() / div);
- case DateType.Day:
- return date.getDay();
- default:
- throw new Error("Unknown DateType value \"" + name + "\".");
- }
- }
- /**
- * Returns a date formatter that transforms a date into its locale string representation
- * @param {?} name
- * @param {?} width
- * @param {?=} form
- * @param {?=} extended
- * @return {?}
- */
- function dateStrGetter(name, width, form, extended) {
- if (form === void 0) { form = FormStyle.Format; }
- if (extended === void 0) { extended = false; }
- return function (date, locale) {
- return getDateTranslation(date, locale, name, width, form, extended);
- };
- }
- /**
- * Returns the locale translation of a date for a given form, type and width
- * @param {?} date
- * @param {?} locale
- * @param {?} name
- * @param {?} width
- * @param {?} form
- * @param {?} extended
- * @return {?}
- */
- function getDateTranslation(date, locale, name, width, form, extended) {
- switch (name) {
- case TranslationType.Months:
- return getLocaleMonthNames(locale, form, width)[date.getMonth()];
- case TranslationType.Days:
- return getLocaleDayNames(locale, form, width)[date.getDay()];
- case TranslationType.DayPeriods:
- var /** @type {?} */ currentHours_1 = date.getHours();
- var /** @type {?} */ currentMinutes_1 = date.getMinutes();
- if (extended) {
- var /** @type {?} */ rules = getLocaleExtraDayPeriodRules(locale);
- var /** @type {?} */ dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width);
- var /** @type {?} */ result_1;
- rules.forEach(function (rule, index) {
- if (Array.isArray(rule)) {
- // morning, afternoon, evening, night
- var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes;
- var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes;
- if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom &&
- (currentHours_1 < hoursTo ||
- (currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) {
- result_1 = dayPeriods_1[index];
- }
- }
- else {
- // noon or midnight
- var hours = rule.hours, minutes = rule.minutes;
- if (hours === currentHours_1 && minutes === currentMinutes_1) {
- result_1 = dayPeriods_1[index];
- }
- }
- });
- if (result_1) {
- return result_1;
- }
- }
- // if no rules for the day periods, we use am/pm by default
- return getLocaleDayPeriods(locale, form, /** @type {?} */ (width))[currentHours_1 < 12 ? 0 : 1];
- case TranslationType.Eras:
- return getLocaleEraNames(locale, /** @type {?} */ (width))[date.getFullYear() <= 0 ? 0 : 1];
- default:
- // This default case is not needed by TypeScript compiler, as the switch is exhaustive.
- // However Closure Compiler does not understand that and reports an error in typed mode.
- // The `throw new Error` below works around the problem, and the unexpected: never variable
- // makes sure tsc still checks this code is unreachable.
- var /** @type {?} */ unexpected = name;
- throw new Error("unexpected translation type " + unexpected);
- }
- }
- /**
- * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or
- * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30,
- * extended = +04:30)
- * @param {?} width
- * @return {?}
- */
- function timeZoneGetter(width) {
- return function (date, locale, offset) {
- var /** @type {?} */ zone = -1 * offset;
- var /** @type {?} */ minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
- var /** @type {?} */ hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
- switch (width) {
- case ZoneWidth.Short:
- return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) +
- padNumber(Math.abs(zone % 60), 2, minusSign);
- case ZoneWidth.ShortGMT:
- return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign);
- case ZoneWidth.Long:
- return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
- padNumber(Math.abs(zone % 60), 2, minusSign);
- case ZoneWidth.Extended:
- if (offset === 0) {
- return 'Z';
- }
- else {
- return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
- padNumber(Math.abs(zone % 60), 2, minusSign);
- }
- default:
- throw new Error("Unknown zone width \"" + width + "\"");
- }
- };
- }
- var JANUARY = 0;
- var THURSDAY = 4;
- /**
- * @param {?} year
- * @return {?}
- */
- function getFirstThursdayOfYear(year) {
- var /** @type {?} */ firstDayOfYear = (new Date(year, JANUARY, 1)).getDay();
- return new Date(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
- }
- /**
- * @param {?} datetime
- * @return {?}
- */
- function getThursdayThisWeek(datetime) {
- return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay()));
- }
- /**
- * @param {?} size
- * @param {?=} monthBased
- * @return {?}
- */
- function weekGetter(size, monthBased) {
- if (monthBased === void 0) { monthBased = false; }
- return function (date, locale) {
- var /** @type {?} */ result;
- if (monthBased) {
- var /** @type {?} */ nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
- var /** @type {?} */ today = date.getDate();
- result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
- }
- else {
- var /** @type {?} */ firstThurs = getFirstThursdayOfYear(date.getFullYear());
- var /** @type {?} */ thisThurs = getThursdayThisWeek(date);
- var /** @type {?} */ diff = thisThurs.getTime() - firstThurs.getTime();
- result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
- }
- return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
- };
- }
- var DATE_FORMATS = {};
- /**
- * @param {?} format
- * @return {?}
- */
- function getDateFormatter(format) {
- if (DATE_FORMATS[format]) {
- return DATE_FORMATS[format];
- }
- var /** @type {?} */ formatter;
- switch (format) {
- // Era name (AD/BC)
- case 'G':
- case 'GG':
- case 'GGG':
- formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated);
- break;
- case 'GGGG':
- formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide);
- break;
- case 'GGGGG':
- formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow);
- break;
- // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
- case 'y':
- formatter = dateGetter(DateType.FullYear, 1, 0, false, true);
- break;
- // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
- case 'yy':
- formatter = dateGetter(DateType.FullYear, 2, 0, true, true);
- break;
- // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
- case 'yyy':
- formatter = dateGetter(DateType.FullYear, 3, 0, false, true);
- break;
- // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
- case 'yyyy':
- formatter = dateGetter(DateType.FullYear, 4, 0, false, true);
- break;
- // Month of the year (1-12), numeric
- case 'M':
- case 'L':
- formatter = dateGetter(DateType.Month, 1, 1);
- break;
- case 'MM':
- case 'LL':
- formatter = dateGetter(DateType.Month, 2, 1);
- break;
- // Month of the year (January, ...), string, format
- case 'MMM':
- formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated);
- break;
- case 'MMMM':
- formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide);
- break;
- case 'MMMMM':
- formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow);
- break;
- // Month of the year (January, ...), string, standalone
- case 'LLL':
- formatter =
- dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone);
- break;
- case 'LLLL':
- formatter =
- dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone);
- break;
- case 'LLLLL':
- formatter =
- dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone);
- break;
- // Week of the year (1, ... 52)
- case 'w':
- formatter = weekGetter(1);
- break;
- case 'ww':
- formatter = weekGetter(2);
- break;
- // Week of the month (1, ...)
- case 'W':
- formatter = weekGetter(1, true);
- break;
- // Day of the month (1-31)
- case 'd':
- formatter = dateGetter(DateType.Date, 1);
- break;
- case 'dd':
- formatter = dateGetter(DateType.Date, 2);
- break;
- // Day of the Week
- case 'E':
- case 'EE':
- case 'EEE':
- formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated);
- break;
- case 'EEEE':
- formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide);
- break;
- case 'EEEEE':
- formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow);
- break;
- case 'EEEEEE':
- formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short);
- break;
- // Generic period of the day (am-pm)
- case 'a':
- case 'aa':
- case 'aaa':
- formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated);
- break;
- case 'aaaa':
- formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide);
- break;
- case 'aaaaa':
- formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow);
- break;
- // Extended period of the day (midnight, at night, ...), standalone
- case 'b':
- case 'bb':
- case 'bbb':
- formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
- break;
- case 'bbbb':
- formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true);
- break;
- case 'bbbbb':
- formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true);
- break;
- // Extended period of the day (midnight, night, ...), standalone
- case 'B':
- case 'BB':
- case 'BBB':
- formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true);
- break;
- case 'BBBB':
- formatter =
- dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true);
- break;
- case 'BBBBB':
- formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true);
- break;
- // Hour in AM/PM, (1-12)
- case 'h':
- formatter = dateGetter(DateType.Hours, 1, -12);
- break;
- case 'hh':
- formatter = dateGetter(DateType.Hours, 2, -12);
- break;
- // Hour of the day (0-23)
- case 'H':
- formatter = dateGetter(DateType.Hours, 1);
- break;
- // Hour in day, padded (00-23)
- case 'HH':
- formatter = dateGetter(DateType.Hours, 2);
- break;
- // Minute of the hour (0-59)
- case 'm':
- formatter = dateGetter(DateType.Minutes, 1);
- break;
- case 'mm':
- formatter = dateGetter(DateType.Minutes, 2);
- break;
- // Second of the minute (0-59)
- case 's':
- formatter = dateGetter(DateType.Seconds, 1);
- break;
- case 'ss':
- formatter = dateGetter(DateType.Seconds, 2);
- break;
- // Fractional second padded (0-9)
- case 'S':
- formatter = dateGetter(DateType.Milliseconds, 1);
- break;
- case 'SS':
- formatter = dateGetter(DateType.Milliseconds, 2);
- break;
- // = millisecond
- case 'SSS':
- formatter = dateGetter(DateType.Milliseconds, 3);
- break;
- // Timezone ISO8601 short format (-0430)
- case 'Z':
- case 'ZZ':
- case 'ZZZ':
- formatter = timeZoneGetter(ZoneWidth.Short);
- break;
- // Timezone ISO8601 extended format (-04:30)
- case 'ZZZZZ':
- formatter = timeZoneGetter(ZoneWidth.Extended);
- break;
- // Timezone GMT short format (GMT+4)
- case 'O':
- case 'OO':
- case 'OOO':
- // Should be location, but fallback to format O instead because we don't have the data yet
- case 'z':
- case 'zz':
- case 'zzz':
- formatter = timeZoneGetter(ZoneWidth.ShortGMT);
- break;
- // Timezone GMT long format (GMT+0430)
- case 'OOOO':
- case 'ZZZZ':
- // Should be location, but fallback to format O instead because we don't have the data yet
- case 'zzzz':
- formatter = timeZoneGetter(ZoneWidth.Long);
- break;
- default:
- return null;
- }
- DATE_FORMATS[format] = formatter;
- return formatter;
- }
- /**
- * @param {?} timezone
- * @param {?} fallback
- * @return {?}
- */
- function timezoneToOffset(timezone, fallback) {
- // Support: IE 9-11 only, Edge 13-15+
- // IE/Edge do not "understand" colon (`:`) in timezone
- timezone = timezone.replace(/:/g, '');
- var /** @type {?} */ requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
- return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
- }
- /**
- * @param {?} date
- * @param {?} minutes
- * @return {?}
- */
- function addDateMinutes(date, minutes) {
- date = new Date(date.getTime());
- date.setMinutes(date.getMinutes() + minutes);
- return date;
- }
- /**
- * @param {?} date
- * @param {?} timezone
- * @param {?} reverse
- * @return {?}
- */
- function convertTimezoneToLocal(date, timezone, reverse) {
- var /** @type {?} */ reverseValue = reverse ? -1 : 1;
- var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset();
- var /** @type {?} */ timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
- return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} type
- * @param {?} value
- * @return {?}
- */
- function invalidPipeArgumentError(type, value) {
- return Error("InvalidPipeArgument: '" + value + "' for pipe '" + Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_39" /* ɵstringify */])(type) + "'");
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Formats a date according to locale rules.
- * \@howToUse `date_expression | date[:format[:timezone[:locale]]]`
- * \@description
- *
- * Where:
- * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
- * (https://www.w3.org/TR/NOTE-datetime).
- * - `format` indicates which date/time components to include. The format can be predefined as
- * shown below (all examples are given for `en-US`) or custom as shown in the table.
- * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (e.g. `6/15/15, 9:03 AM`)
- * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (e.g. `Jun 15, 2015, 9:03:01 AM`)
- * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (e.g. `June 15, 2015 at 9:03:01 AM GMT+1`)
- * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (e.g. `Monday, June 15, 2015 at
- * 9:03:01 AM GMT+01:00`)
- * - `'shortDate'`: equivalent to `'M/d/yy'` (e.g. `6/15/15`)
- * - `'mediumDate'`: equivalent to `'MMM d, y'` (e.g. `Jun 15, 2015`)
- * - `'longDate'`: equivalent to `'MMMM d, y'` (e.g. `June 15, 2015`)
- * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (e.g. `Monday, June 15, 2015`)
- * - `'shortTime'`: equivalent to `'h:mm a'` (e.g. `9:03 AM`)
- * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (e.g. `9:03:01 AM`)
- * - `'longTime'`: equivalent to `'h:mm:ss a z'` (e.g. `9:03:01 AM GMT+1`)
- * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (e.g. `9:03:01 AM GMT+01:00`)
- * - `timezone` to be used for formatting. It understands UTC/GMT and the continental US time zone
- * abbreviations, but for general use, use a time zone offset, for example,
- * `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
- * If not specified, the local system timezone of the end-user's browser will be used.
- * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
- * default)
- *
- *
- * | Field Type | Format | Description | Example Value |
- * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
- * | Era | G, GG & GGG | Abbreviated | AD |
- * | | GGGG | Wide | Anno Domini |
- * | | GGGGG | Narrow | A |
- * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
- * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
- * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
- * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
- * | Month | M | Numeric: 1 digit | 9, 12 |
- * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
- * | | MMM | Abbreviated | Sep |
- * | | MMMM | Wide | September |
- * | | MMMMM | Narrow | S |
- * | Month standalone | L | Numeric: 1 digit | 9, 12 |
- * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
- * | | LLL | Abbreviated | Sep |
- * | | LLLL | Wide | September |
- * | | LLLLL | Narrow | S |
- * | Week of year | w | Numeric: minimum digits | 1... 53 |
- * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
- * | Week of month | W | Numeric: 1 digit | 1... 5 |
- * | Day of month | d | Numeric: minimum digits | 1 |
- * | | dd | Numeric: 2 digits + zero padded | 01 |
- * | Week day | E, EE & EEE | Abbreviated | Tue |
- * | | EEEE | Wide | Tuesday |
- * | | EEEEE | Narrow | T |
- * | | EEEEEE | Short | Tu |
- * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
- * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
- * | | aaaaa | Narrow | a/p |
- * | Period* | B, BB & BBB | Abbreviated | mid. |
- * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
- * | | BBBBB | Narrow | md |
- * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
- * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
- * | | bbbbb | Narrow | md |
- * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
- * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
- * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
- * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
- * | Minute | m | Numeric: minimum digits | 8, 59 |
- * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
- * | Second | s | Numeric: minimum digits | 0... 59 |
- * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
- * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
- * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
- * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
- * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
- * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
- * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
- * | | ZZZZ | Long localized GMT format | GMT-8:00 |
- * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
- * | | O, OO & OOO | Short localized GMT format | GMT-8 |
- * | | OOOO | Long localized GMT format | GMT-08:00 |
- *
- *
- * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
- * applied and the formatted text will have the same day, month and year of the expression.
- *
- * WARNINGS:
- * - this pipe has only access to en-US locale data by default. If you want to localize the dates
- * in another language, you will have to import data for other locales.
- * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
- * data.
- * - Fields suffixed with * are only available in the extra dataset.
- * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import extra locale
- * data.
- * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
- * Instead users should treat the date as an immutable object and change the reference when the
- * pipe needs to re-run (this is to avoid reformatting the date on every change detection run
- * which would be an expensive operation).
- *
- * ### Examples
- *
- * Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11)
- * in the _local_ time and locale is 'en-US':
- *
- * {\@example common/pipes/ts/date_pipe.ts region='DatePipe'}
- *
- * \@stable
- */
- var DatePipe = /** @class */ (function () {
- function DatePipe(locale) {
- this.locale = locale;
- }
- /**
- * @param {?} value
- * @param {?=} format
- * @param {?=} timezone
- * @param {?=} locale
- * @return {?}
- */
- DatePipe.prototype.transform = /**
- * @param {?} value
- * @param {?=} format
- * @param {?=} timezone
- * @param {?=} locale
- * @return {?}
- */
- function (value, format, timezone, locale) {
- if (format === void 0) { format = 'mediumDate'; }
- if (value == null || value === '' || value !== value)
- return null;
- if (typeof value === 'string') {
- value = value.trim();
- }
- var /** @type {?} */ date;
- var /** @type {?} */ match;
- if (isDate$1(value)) {
- date = value;
- }
- else if (!isNaN(value - parseFloat(value))) {
- date = new Date(parseFloat(value));
- }
- else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
- /**
- * For ISO Strings without time the day, month and year must be extracted from the ISO String
- * before Date creation to avoid time offset and errors in the new Date.
- * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
- * date, some browsers (e.g. IE 9) will throw an invalid Date error
- * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset
- * is applied
- * Note: ISO months are 0 for January, 1 for February, ...
- */
- var _a = value.split('-').map(function (val) { return +val; }), y = _a[0], m = _a[1], d = _a[2];
- date = new Date(y, m - 1, d);
- }
- else if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
- date = isoStringToDate(match);
- }
- else {
- date = new Date(value);
- }
- if (!isDate$1(date)) {
- throw invalidPipeArgumentError(DatePipe, value);
- }
- return formatDate(date, format, locale || this.locale, timezone);
- };
- DatePipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'date', pure: true },] },
- ];
- /** @nocollapse */
- DatePipe.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
- ]; };
- return DatePipe;
- }());
- /**
- * \@internal
- * @param {?} match
- * @return {?}
- */
- function isoStringToDate(match) {
- var /** @type {?} */ date = new Date(0);
- var /** @type {?} */ tzHour = 0;
- var /** @type {?} */ tzMin = 0;
- // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100"
- var /** @type {?} */ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
- var /** @type {?} */ timeSetter = match[8] ? date.setUTCHours : date.setHours;
- // if there is a timezone defined like "+01:00" or "+0100"
- if (match[9]) {
- tzHour = +(match[9] + match[10]);
- tzMin = +(match[9] + match[11]);
- }
- dateSetter.call(date, +(match[1]), +(match[2]) - 1, +(match[3]));
- var /** @type {?} */ h = +(match[4] || '0') - tzHour;
- var /** @type {?} */ m = +(match[5] || '0') - tzMin;
- var /** @type {?} */ s = +(match[6] || '0');
- var /** @type {?} */ ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
- timeSetter.call(date, h, m, s, ms);
- return date;
- }
- /**
- * @param {?} value
- * @return {?}
- */
- function isDate$1(value) {
- return value instanceof Date && !isNaN(value.valueOf());
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- var NumberFormatter = /** @class */ (function () {
- function NumberFormatter() {
- }
- /**
- * @param {?} num
- * @param {?} locale
- * @param {?} style
- * @param {?=} opts
- * @return {?}
- */
- NumberFormatter.format = /**
- * @param {?} num
- * @param {?} locale
- * @param {?} style
- * @param {?=} opts
- * @return {?}
- */
- function (num, locale, style, opts) {
- if (opts === void 0) { opts = {}; }
- var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _a = opts.currencyAsSymbol, currencyAsSymbol = _a === void 0 ? false : _a;
- var /** @type {?} */ options = {
- minimumIntegerDigits: minimumIntegerDigits,
- minimumFractionDigits: minimumFractionDigits,
- maximumFractionDigits: maximumFractionDigits,
- style: NumberFormatStyle[style].toLowerCase()
- };
- if (style == NumberFormatStyle.Currency) {
- options.currency = typeof currency == 'string' ? currency : undefined;
- options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
- }
- return new Intl.NumberFormat(locale, options).format(num);
- };
- return NumberFormatter;
- }());
- var DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/;
- var PATTERN_ALIASES = {
- // Keys are quoted so they do not get renamed during closure compilation.
- 'yMMMdjms': datePartGetterFactory(combine([
- digitCondition('year', 1),
- nameCondition('month', 3),
- digitCondition('day', 1),
- digitCondition('hour', 1),
- digitCondition('minute', 1),
- digitCondition('second', 1),
- ])),
- 'yMdjm': datePartGetterFactory(combine([
- digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1),
- digitCondition('hour', 1), digitCondition('minute', 1)
- ])),
- 'yMMMMEEEEd': datePartGetterFactory(combine([
- digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4),
- digitCondition('day', 1)
- ])),
- 'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])),
- 'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])),
- 'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])),
- 'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])),
- 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)]))
- };
- var DATE_FORMATS$1 = {
- // Keys are quoted so they do not get renamed.
- 'yyyy': datePartGetterFactory(digitCondition('year', 4)),
- 'yy': datePartGetterFactory(digitCondition('year', 2)),
- 'y': datePartGetterFactory(digitCondition('year', 1)),
- 'MMMM': datePartGetterFactory(nameCondition('month', 4)),
- 'MMM': datePartGetterFactory(nameCondition('month', 3)),
- 'MM': datePartGetterFactory(digitCondition('month', 2)),
- 'M': datePartGetterFactory(digitCondition('month', 1)),
- 'LLLL': datePartGetterFactory(nameCondition('month', 4)),
- 'L': datePartGetterFactory(nameCondition('month', 1)),
- 'dd': datePartGetterFactory(digitCondition('day', 2)),
- 'd': datePartGetterFactory(digitCondition('day', 1)),
- 'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))),
- 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),
- 'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))),
- 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
- 'jj': datePartGetterFactory(digitCondition('hour', 2)),
- 'j': datePartGetterFactory(digitCondition('hour', 1)),
- 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))),
- 'm': datePartGetterFactory(digitCondition('minute', 1)),
- 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))),
- 's': datePartGetterFactory(digitCondition('second', 1)),
- // while ISO 8601 requires fractions to be prefixed with `.` or `,`
- // we can be just safely rely on using `sss` since we currently don't support single or two digit
- // fractions
- 'sss': datePartGetterFactory(digitCondition('second', 3)),
- 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)),
- 'EEE': datePartGetterFactory(nameCondition('weekday', 3)),
- 'EE': datePartGetterFactory(nameCondition('weekday', 2)),
- 'E': datePartGetterFactory(nameCondition('weekday', 1)),
- 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
- 'Z': timeZoneGetter$1('short'),
- 'z': timeZoneGetter$1('long'),
- 'ww': datePartGetterFactory({}),
- // Week of year, padded (00-53). Week 01 is the week with the
- // first Thursday of the year. not support ?
- 'w': datePartGetterFactory({}),
- // Week of year (0-53). Week 1 is the week with the first Thursday
- // of the year not support ?
- 'G': datePartGetterFactory(nameCondition('era', 1)),
- 'GG': datePartGetterFactory(nameCondition('era', 2)),
- 'GGG': datePartGetterFactory(nameCondition('era', 3)),
- 'GGGG': datePartGetterFactory(nameCondition('era', 4))
- };
- /**
- * @param {?} inner
- * @return {?}
- */
- function digitModifier(inner) {
- return function (date, locale) {
- var /** @type {?} */ result = inner(date, locale);
- return result.length == 1 ? '0' + result : result;
- };
- }
- /**
- * @param {?} inner
- * @return {?}
- */
- function hourClockExtractor(inner) {
- return function (date, locale) { return inner(date, locale).split(' ')[1]; };
- }
- /**
- * @param {?} inner
- * @return {?}
- */
- function hourExtractor(inner) {
- return function (date, locale) { return inner(date, locale).split(' ')[0]; };
- }
- /**
- * @param {?} date
- * @param {?} locale
- * @param {?} options
- * @return {?}
- */
- function intlDateFormat(date, locale, options) {
- return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, '');
- }
- /**
- * @param {?} timezone
- * @return {?}
- */
- function timeZoneGetter$1(timezone) {
- // To workaround `Intl` API restriction for single timezone let format with 24 hours
- var /** @type {?} */ options = { hour: '2-digit', hour12: false, timeZoneName: timezone };
- return function (date, locale) {
- var /** @type {?} */ result = intlDateFormat(date, locale, options);
- // Then extract first 3 letters that related to hours
- return result ? result.substring(3) : '';
- };
- }
- /**
- * @param {?} options
- * @param {?} value
- * @return {?}
- */
- function hour12Modify(options, value) {
- options.hour12 = value;
- return options;
- }
- /**
- * @param {?} prop
- * @param {?} len
- * @return {?}
- */
- function digitCondition(prop, len) {
- var /** @type {?} */ result = {};
- result[prop] = len === 2 ? '2-digit' : 'numeric';
- return result;
- }
- /**
- * @param {?} prop
- * @param {?} len
- * @return {?}
- */
- function nameCondition(prop, len) {
- var /** @type {?} */ result = {};
- if (len < 4) {
- result[prop] = len > 1 ? 'short' : 'narrow';
- }
- else {
- result[prop] = 'long';
- }
- return result;
- }
- /**
- * @param {?} options
- * @return {?}
- */
- function combine(options) {
- return options.reduce(function (merged, opt) { return (Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __assign */])({}, merged, opt)); }, {});
- }
- /**
- * @param {?} ret
- * @return {?}
- */
- function datePartGetterFactory(ret) {
- return function (date, locale) { return intlDateFormat(date, locale, ret); };
- }
- var DATE_FORMATTER_CACHE = new Map();
- /**
- * @param {?} format
- * @param {?} date
- * @param {?} locale
- * @return {?}
- */
- function dateFormatter(format, date, locale) {
- var /** @type {?} */ fn = PATTERN_ALIASES[format];
- if (fn)
- return fn(date, locale);
- var /** @type {?} */ cacheKey = format;
- var /** @type {?} */ parts = DATE_FORMATTER_CACHE.get(cacheKey);
- if (!parts) {
- parts = [];
- var /** @type {?} */ match = void 0;
- DATE_FORMATS_SPLIT$1.exec(format);
- var /** @type {?} */ _format = format;
- while (_format) {
- match = DATE_FORMATS_SPLIT$1.exec(_format);
- if (match) {
- parts = parts.concat(match.slice(1));
- _format = /** @type {?} */ ((parts.pop()));
- }
- else {
- parts.push(_format);
- _format = null;
- }
- }
- DATE_FORMATTER_CACHE.set(cacheKey, parts);
- }
- return parts.reduce(function (text, part) {
- var /** @type {?} */ fn = DATE_FORMATS$1[part];
- return text + (fn ? fn(date, locale) : partToTime(part));
- }, '');
- }
- /**
- * @param {?} part
- * @return {?}
- */
- function partToTime(part) {
- return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
- }
- var DateFormatter = /** @class */ (function () {
- function DateFormatter() {
- }
- /**
- * @param {?} date
- * @param {?} locale
- * @param {?} pattern
- * @return {?}
- */
- DateFormatter.format = /**
- * @param {?} date
- * @param {?} locale
- * @param {?} pattern
- * @return {?}
- */
- function (date, locale, pattern) {
- return dateFormatter(pattern, date, locale);
- };
- return DateFormatter;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Formats a date according to locale rules.
- * \@howToUse `date_expression | date[:format]`
- * \@description
- *
- * Where:
- * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
- * (https://www.w3.org/TR/NOTE-datetime).
- * - `format` indicates which date/time components to include. The format can be predefined as
- * shown below or custom as shown in the table.
- * - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`)
- * - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`)
- * - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`)
- * - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`)
- * - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`)
- * - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`)
- * - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`)
- * - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`)
- *
- *
- * | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit |
- * |-----------|:------:|--------|--------------|-------------------|-----------|-----------|
- * | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - |
- * | year | y | - | - | - | y (2015) | yy (15) |
- * | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) |
- * | day | d | - | - | - | d (3) | dd (03) |
- * | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - |
- * | hour | j | - | - | - | j (13) | jj (13) |
- * | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)|
- * | hour24 | H | - | - | - | H (13) | HH (13) |
- * | minute | m | - | - | - | m (5) | mm (05) |
- * | second | s | - | - | - | s (9) | ss (09) |
- * | timezone | z | - | - | z (Pacific Standard Time)| - | - |
- * | timezone | Z | - | Z (GMT-8:00) | - | - | - |
- * | timezone | a | - | a (PM) | - | - | - |
- *
- * In javascript, only the components specified will be respected (not the ordering,
- * punctuations, ...) and details of the formatting will be dependent on the locale.
- *
- * Timezone of the formatted text will be the local system timezone of the end-user's machine.
- *
- * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
- * applied and the formatted text will have the same day, month and year of the expression.
- *
- * WARNINGS:
- * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
- * Instead users should treat the date as an immutable object and change the reference when the
- * pipe needs to re-run (this is to avoid reformatting the date on every change detection run
- * which would be an expensive operation).
- * - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera
- * browsers.
- *
- * ### Examples
- *
- * Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08)
- * in the _local_ time and locale is 'en-US':
- *
- * {\@example common/pipes/ts/date_pipe.ts region='DeprecatedDatePipe'}
- *
- * \@stable
- */
- var DeprecatedDatePipe = /** @class */ (function () {
- function DeprecatedDatePipe(_locale) {
- this._locale = _locale;
- }
- /**
- * @param {?} value
- * @param {?=} pattern
- * @return {?}
- */
- DeprecatedDatePipe.prototype.transform = /**
- * @param {?} value
- * @param {?=} pattern
- * @return {?}
- */
- function (value, pattern) {
- if (pattern === void 0) { pattern = 'mediumDate'; }
- if (value == null || value === '' || value !== value)
- return null;
- var /** @type {?} */ date;
- if (typeof value === 'string') {
- value = value.trim();
- }
- if (isDate(value)) {
- date = value;
- }
- else if (!isNaN(value - parseFloat(value))) {
- date = new Date(parseFloat(value));
- }
- else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
- /**
- * For ISO Strings without time the day, month and year must be extracted from the ISO String
- * before Date creation to avoid time offset and errors in the new Date.
- * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
- * date, some browsers (e.g. IE 9) will throw an invalid Date error
- * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the
- * timeoffset
- * is applied
- * Note: ISO months are 0 for January, 1 for February, ...
- */
- var _a = value.split('-').map(function (val) { return parseInt(val, 10); }), y = _a[0], m = _a[1], d = _a[2];
- date = new Date(y, m - 1, d);
- }
- else {
- date = new Date(value);
- }
- if (!isDate(date)) {
- var /** @type {?} */ match = void 0;
- if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
- date = isoStringToDate(match);
- }
- else {
- throw invalidPipeArgumentError(DeprecatedDatePipe, value);
- }
- }
- return DateFormatter.format(date, this._locale, DeprecatedDatePipe._ALIASES[pattern] || pattern);
- };
- /**
- * \@internal
- */
- DeprecatedDatePipe._ALIASES = {
- 'medium': 'yMMMdjms',
- 'short': 'yMdjm',
- 'fullDate': 'yMMMMEEEEd',
- 'longDate': 'yMMMMd',
- 'mediumDate': 'yMMMd',
- 'shortDate': 'yMd',
- 'mediumTime': 'jms',
- 'shortTime': 'jm'
- };
- DeprecatedDatePipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'date', pure: true },] },
- ];
- /** @nocollapse */
- DeprecatedDatePipe.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
- ]; };
- return DeprecatedDatePipe;
- }());
- /**
- * @param {?} value
- * @return {?}
- */
- function isDate(value) {
- return value instanceof Date && !isNaN(value.valueOf());
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
- var MAX_DIGITS = 22;
- var DECIMAL_SEP = '.';
- var ZERO_CHAR = '0';
- var PATTERN_SEP = ';';
- var GROUP_SEP = ',';
- var DIGIT_CHAR = '#';
- var CURRENCY_CHAR = '¤';
- var PERCENT_CHAR = '%';
- /**
- * Transform a number to a locale string based on a style and a format
- *
- * \@internal
- * @param {?} value
- * @param {?} locale
- * @param {?} style
- * @param {?=} digitsInfo
- * @param {?=} currency
- * @return {?}
- */
- function formatNumber$1(value, locale, style, digitsInfo, currency) {
- if (currency === void 0) { currency = null; }
- var /** @type {?} */ res = { str: null };
- var /** @type {?} */ format = getLocaleNumberFormat(locale, style);
- var /** @type {?} */ num;
- // Convert strings to numbers
- if (typeof value === 'string' && !isNaN(+value - parseFloat(value))) {
- num = +value;
- }
- else if (typeof value !== 'number') {
- res.error = value + " is not a number";
- return res;
- }
- else {
- num = value;
- }
- var /** @type {?} */ pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
- var /** @type {?} */ formattedText = '';
- var /** @type {?} */ isZero = false;
- if (!isFinite(num)) {
- formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
- }
- else {
- var /** @type {?} */ parsedNumber = parseNumber(num);
- if (style === NumberFormatStyle.Percent) {
- parsedNumber = toPercent(parsedNumber);
- }
- var /** @type {?} */ minInt = pattern.minInt;
- var /** @type {?} */ minFraction = pattern.minFrac;
- var /** @type {?} */ maxFraction = pattern.maxFrac;
- if (digitsInfo) {
- var /** @type {?} */ parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
- if (parts === null) {
- res.error = digitsInfo + " is not a valid digit info";
- return res;
- }
- var /** @type {?} */ minIntPart = parts[1];
- var /** @type {?} */ minFractionPart = parts[3];
- var /** @type {?} */ maxFractionPart = parts[5];
- if (minIntPart != null) {
- minInt = parseIntAutoRadix(minIntPart);
- }
- if (minFractionPart != null) {
- minFraction = parseIntAutoRadix(minFractionPart);
- }
- if (maxFractionPart != null) {
- maxFraction = parseIntAutoRadix(maxFractionPart);
- }
- else if (minFractionPart != null && minFraction > maxFraction) {
- maxFraction = minFraction;
- }
- }
- roundNumber(parsedNumber, minFraction, maxFraction);
- var /** @type {?} */ digits = parsedNumber.digits;
- var /** @type {?} */ integerLen = parsedNumber.integerLen;
- var /** @type {?} */ exponent = parsedNumber.exponent;
- var /** @type {?} */ decimals = [];
- isZero = digits.every(function (d) { return !d; });
- // pad zeros for small numbers
- for (; integerLen < minInt; integerLen++) {
- digits.unshift(0);
- }
- // pad zeros for small numbers
- for (; integerLen < 0; integerLen++) {
- digits.unshift(0);
- }
- // extract decimals digits
- if (integerLen > 0) {
- decimals = digits.splice(integerLen, digits.length);
- }
- else {
- decimals = digits;
- digits = [0];
- }
- // format the integer digits with grouping separators
- var /** @type {?} */ groups = [];
- if (digits.length >= pattern.lgSize) {
- groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
- }
- while (digits.length > pattern.gSize) {
- groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
- }
- if (digits.length) {
- groups.unshift(digits.join(''));
- }
- var /** @type {?} */ groupSymbol = currency ? NumberSymbol.CurrencyGroup : NumberSymbol.Group;
- formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
- // append the decimal digits
- if (decimals.length) {
- var /** @type {?} */ decimalSymbol = currency ? NumberSymbol.CurrencyDecimal : NumberSymbol.Decimal;
- formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
- }
- if (exponent) {
- formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;
- }
- }
- if (num < 0 && !isZero) {
- formattedText = pattern.negPre + formattedText + pattern.negSuf;
- }
- else {
- formattedText = pattern.posPre + formattedText + pattern.posSuf;
- }
- if (style === NumberFormatStyle.Currency && currency !== null) {
- res.str = formattedText
- .replace(CURRENCY_CHAR, currency)
- .replace(CURRENCY_CHAR, '');
- return res;
- }
- if (style === NumberFormatStyle.Percent) {
- res.str = formattedText.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
- return res;
- }
- res.str = formattedText;
- return res;
- }
- /**
- * @param {?} format
- * @param {?=} minusSign
- * @return {?}
- */
- function parseNumberFormat(format, minusSign) {
- if (minusSign === void 0) { minusSign = '-'; }
- var /** @type {?} */ p = {
- minInt: 1,
- minFrac: 0,
- maxFrac: 0,
- posPre: '',
- posSuf: '',
- negPre: '',
- negSuf: '',
- gSize: 0,
- lgSize: 0
- };
- var /** @type {?} */ patternParts = format.split(PATTERN_SEP);
- var /** @type {?} */ positive = patternParts[0];
- var /** @type {?} */ negative = patternParts[1];
- var /** @type {?} */ positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ?
- positive.split(DECIMAL_SEP) :
- [
- positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1),
- positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)
- ], /** @type {?} */
- integer = positiveParts[0], /** @type {?} */ fraction = positiveParts[1] || '';
- p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR));
- for (var /** @type {?} */ i = 0; i < fraction.length; i++) {
- var /** @type {?} */ ch = fraction.charAt(i);
- if (ch === ZERO_CHAR) {
- p.minFrac = p.maxFrac = i + 1;
- }
- else if (ch === DIGIT_CHAR) {
- p.maxFrac = i + 1;
- }
- else {
- p.posSuf += ch;
- }
- }
- var /** @type {?} */ groups = integer.split(GROUP_SEP);
- p.gSize = groups[1] ? groups[1].length : 0;
- p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0;
- if (negative) {
- var /** @type {?} */ trunkLen = positive.length - p.posPre.length - p.posSuf.length, /** @type {?} */
- pos = negative.indexOf(DIGIT_CHAR);
- p.negPre = negative.substr(0, pos).replace(/'/g, '');
- p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, '');
- }
- else {
- p.negPre = minusSign + p.posPre;
- p.negSuf = p.posSuf;
- }
- return p;
- }
- /**
- * @param {?} parsedNumber
- * @return {?}
- */
- function toPercent(parsedNumber) {
- // if the number is 0, don't do anything
- if (parsedNumber.digits[0] === 0) {
- return parsedNumber;
- }
- // Getting the current number of decimals
- var /** @type {?} */ fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
- if (parsedNumber.exponent) {
- parsedNumber.exponent += 2;
- }
- else {
- if (fractionLen === 0) {
- parsedNumber.digits.push(0, 0);
- }
- else if (fractionLen === 1) {
- parsedNumber.digits.push(0);
- }
- parsedNumber.integerLen += 2;
- }
- return parsedNumber;
- }
- /**
- * Parses a number.
- * Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/
- * @param {?} num
- * @return {?}
- */
- function parseNumber(num) {
- var /** @type {?} */ numStr = Math.abs(num) + '';
- var /** @type {?} */ exponent = 0, /** @type {?} */ digits, /** @type {?} */ integerLen;
- var /** @type {?} */ i, /** @type {?} */ j, /** @type {?} */ zeros;
- // Decimal point?
- if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
- numStr = numStr.replace(DECIMAL_SEP, '');
- }
- // Exponential form?
- if ((i = numStr.search(/e/i)) > 0) {
- // Work out the exponent.
- if (integerLen < 0)
- integerLen = i;
- integerLen += +numStr.slice(i + 1);
- numStr = numStr.substring(0, i);
- }
- else if (integerLen < 0) {
- // There was no decimal point or exponent so it is an integer.
- integerLen = numStr.length;
- }
- // Count the number of leading zeros.
- for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {
- /* empty */
- }
- if (i === (zeros = numStr.length)) {
- // The digits are all zero.
- digits = [0];
- integerLen = 1;
- }
- else {
- // Count the number of trailing zeros
- zeros--;
- while (numStr.charAt(zeros) === ZERO_CHAR)
- zeros--;
- // Trailing zeros are insignificant so ignore them
- integerLen -= i;
- digits = [];
- // Convert string to array of digits without leading/trailing zeros.
- for (j = 0; i <= zeros; i++, j++) {
- digits[j] = +numStr.charAt(i);
- }
- }
- // If the number overflows the maximum allowed digits then use an exponent.
- if (integerLen > MAX_DIGITS) {
- digits = digits.splice(0, MAX_DIGITS - 1);
- exponent = integerLen - 1;
- integerLen = 1;
- }
- return { digits: digits, exponent: exponent, integerLen: integerLen };
- }
- /**
- * Round the parsed number to the specified number of decimal places
- * This function changes the parsedNumber in-place
- * @param {?} parsedNumber
- * @param {?} minFrac
- * @param {?} maxFrac
- * @return {?}
- */
- function roundNumber(parsedNumber, minFrac, maxFrac) {
- if (minFrac > maxFrac) {
- throw new Error("The minimum number of digits after fraction (" + minFrac + ") is higher than the maximum (" + maxFrac + ").");
- }
- var /** @type {?} */ digits = parsedNumber.digits;
- var /** @type {?} */ fractionLen = digits.length - parsedNumber.integerLen;
- var /** @type {?} */ fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
- // The index of the digit to where rounding is to occur
- var /** @type {?} */ roundAt = fractionSize + parsedNumber.integerLen;
- var /** @type {?} */ digit = digits[roundAt];
- if (roundAt > 0) {
- // Drop fractional digits beyond `roundAt`
- digits.splice(Math.max(parsedNumber.integerLen, roundAt));
- // Set non-fractional digits beyond `roundAt` to 0
- for (var /** @type {?} */ j = roundAt; j < digits.length; j++) {
- digits[j] = 0;
- }
- }
- else {
- // We rounded to zero so reset the parsedNumber
- fractionLen = Math.max(0, fractionLen);
- parsedNumber.integerLen = 1;
- digits.length = Math.max(1, roundAt = fractionSize + 1);
- digits[0] = 0;
- for (var /** @type {?} */ i = 1; i < roundAt; i++)
- digits[i] = 0;
- }
- if (digit >= 5) {
- if (roundAt - 1 < 0) {
- for (var /** @type {?} */ k = 0; k > roundAt; k--) {
- digits.unshift(0);
- parsedNumber.integerLen++;
- }
- digits.unshift(1);
- parsedNumber.integerLen++;
- }
- else {
- digits[roundAt - 1]++;
- }
- }
- // Pad out with zeros to get the required fraction length
- for (; fractionLen < Math.max(0, fractionSize); fractionLen++)
- digits.push(0);
- var /** @type {?} */ dropTrailingZeros = fractionSize !== 0;
- // Minimal length = nb of decimals required + current nb of integers
- // Any number besides that is optional and can be removed if it's a trailing 0
- var /** @type {?} */ minLen = minFrac + parsedNumber.integerLen;
- // Do any carrying, e.g. a digit was rounded up to 10
- var /** @type {?} */ carry = digits.reduceRight(function (carry, d, i, digits) {
- d = d + carry;
- digits[i] = d < 10 ? d : d - 10; // d % 10
- if (dropTrailingZeros) {
- // Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52)
- if (digits[i] === 0 && i >= minLen) {
- digits.pop();
- }
- else {
- dropTrailingZeros = false;
- }
- }
- return d >= 10 ? 1 : 0; // Math.floor(d / 10);
- }, 0);
- if (carry) {
- digits.unshift(carry);
- parsedNumber.integerLen++;
- }
- }
- /**
- * \@internal
- * @param {?} text
- * @return {?}
- */
- function parseIntAutoRadix(text) {
- var /** @type {?} */ result = parseInt(text);
- if (isNaN(result)) {
- throw new Error('Invalid integer literal when parsing ' + text);
- }
- return result;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} pipe
- * @param {?} locale
- * @param {?} value
- * @param {?} style
- * @param {?=} digits
- * @param {?=} currency
- * @param {?=} currencyAsSymbol
- * @return {?}
- */
- function formatNumber(pipe, locale, value, style, digits, currency, currencyAsSymbol) {
- if (currency === void 0) { currency = null; }
- if (currencyAsSymbol === void 0) { currencyAsSymbol = false; }
- if (value == null)
- return null;
- // Convert strings to numbers
- value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value;
- if (typeof value !== 'number') {
- throw invalidPipeArgumentError(pipe, value);
- }
- var /** @type {?} */ minInt;
- var /** @type {?} */ minFraction;
- var /** @type {?} */ maxFraction;
- if (style !== NumberFormatStyle.Currency) {
- // rely on Intl default for currency
- minInt = 1;
- minFraction = 0;
- maxFraction = 3;
- }
- if (digits) {
- var /** @type {?} */ parts = digits.match(NUMBER_FORMAT_REGEXP);
- if (parts === null) {
- throw new Error(digits + " is not a valid digit info for number pipes");
- }
- if (parts[1] != null) {
- // min integer digits
- minInt = parseIntAutoRadix(parts[1]);
- }
- if (parts[3] != null) {
- // min fraction digits
- minFraction = parseIntAutoRadix(parts[3]);
- }
- if (parts[5] != null) {
- // max fraction digits
- maxFraction = parseIntAutoRadix(parts[5]);
- }
- }
- return NumberFormatter.format(/** @type {?} */ (value), locale, style, {
- minimumIntegerDigits: minInt,
- minimumFractionDigits: minFraction,
- maximumFractionDigits: maxFraction,
- currency: currency,
- currencyAsSymbol: currencyAsSymbol,
- });
- }
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Formats a number according to locale rules.
- * \@howToUse `number_expression | number[:digitInfo]`
- *
- * Formats a number as text. Group sizing and separator and other locale-specific
- * configurations are based on the active locale.
- *
- * where `expression` is a number:
- * - `digitInfo` is a `string` which has a following format: <br>
- * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
- * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
- * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
- * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
- *
- * For more information on the acceptable range for each of these numbers and other
- * details see your native internationalization library.
- *
- * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
- * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
- *
- * ### Example
- *
- * {\@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'}
- *
- * \@stable
- */
- var DeprecatedDecimalPipe = /** @class */ (function () {
- function DeprecatedDecimalPipe(_locale) {
- this._locale = _locale;
- }
- /**
- * @param {?} value
- * @param {?=} digits
- * @return {?}
- */
- DeprecatedDecimalPipe.prototype.transform = /**
- * @param {?} value
- * @param {?=} digits
- * @return {?}
- */
- function (value, digits) {
- return formatNumber(DeprecatedDecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits);
- };
- DeprecatedDecimalPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'number' },] },
- ];
- /** @nocollapse */
- DeprecatedDecimalPipe.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
- ]; };
- return DeprecatedDecimalPipe;
- }());
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Formats a number as a percentage according to locale rules.
- * \@howToUse `number_expression | percent[:digitInfo]`
- *
- * \@description
- *
- * Formats a number as percentage.
- *
- * - `digitInfo` See {\@link DecimalPipe} for detailed description.
- *
- * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
- * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
- *
- * ### Example
- *
- * {\@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'}
- *
- * \@stable
- */
- var DeprecatedPercentPipe = /** @class */ (function () {
- function DeprecatedPercentPipe(_locale) {
- this._locale = _locale;
- }
- /**
- * @param {?} value
- * @param {?=} digits
- * @return {?}
- */
- DeprecatedPercentPipe.prototype.transform = /**
- * @param {?} value
- * @param {?=} digits
- * @return {?}
- */
- function (value, digits) {
- return formatNumber(DeprecatedPercentPipe, this._locale, value, NumberFormatStyle.Percent, digits);
- };
- DeprecatedPercentPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'percent' },] },
- ];
- /** @nocollapse */
- DeprecatedPercentPipe.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
- ]; };
- return DeprecatedPercentPipe;
- }());
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Formats a number as currency using locale rules.
- * \@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]`
- * \@description
- *
- * Use `currency` to format a number as currency.
- *
- * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
- * as `USD` for the US dollar and `EUR` for the euro.
- * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code.
- * - `true`: use symbol (e.g. `$`).
- * - `false`(default): use code (e.g. `USD`).
- * - `digitInfo` See {\@link DecimalPipe} for detailed description.
- *
- * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
- * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
- *
- * ### Example
- *
- * {\@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'}
- *
- * \@stable
- */
- var DeprecatedCurrencyPipe = /** @class */ (function () {
- function DeprecatedCurrencyPipe(_locale) {
- this._locale = _locale;
- }
- /**
- * @param {?} value
- * @param {?=} currencyCode
- * @param {?=} symbolDisplay
- * @param {?=} digits
- * @return {?}
- */
- DeprecatedCurrencyPipe.prototype.transform = /**
- * @param {?} value
- * @param {?=} currencyCode
- * @param {?=} symbolDisplay
- * @param {?=} digits
- * @return {?}
- */
- function (value, currencyCode, symbolDisplay, digits) {
- if (currencyCode === void 0) { currencyCode = 'USD'; }
- if (symbolDisplay === void 0) { symbolDisplay = false; }
- return formatNumber(DeprecatedCurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay);
- };
- DeprecatedCurrencyPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'currency' },] },
- ];
- /** @nocollapse */
- DeprecatedCurrencyPipe.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
- ]; };
- return DeprecatedCurrencyPipe;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A collection of deprecated i18n pipes that require intl api
- *
- * @deprecated from v5
- */
- var COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe];
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ObservableStrategy = /** @class */ (function () {
- function ObservableStrategy() {
- }
- /**
- * @param {?} async
- * @param {?} updateLatestValue
- * @return {?}
- */
- ObservableStrategy.prototype.createSubscription = /**
- * @param {?} async
- * @param {?} updateLatestValue
- * @return {?}
- */
- function (async, updateLatestValue) {
- return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } });
- };
- /**
- * @param {?} subscription
- * @return {?}
- */
- ObservableStrategy.prototype.dispose = /**
- * @param {?} subscription
- * @return {?}
- */
- function (subscription) { subscription.unsubscribe(); };
- /**
- * @param {?} subscription
- * @return {?}
- */
- ObservableStrategy.prototype.onDestroy = /**
- * @param {?} subscription
- * @return {?}
- */
- function (subscription) { subscription.unsubscribe(); };
- return ObservableStrategy;
- }());
- var PromiseStrategy = /** @class */ (function () {
- function PromiseStrategy() {
- }
- /**
- * @param {?} async
- * @param {?} updateLatestValue
- * @return {?}
- */
- PromiseStrategy.prototype.createSubscription = /**
- * @param {?} async
- * @param {?} updateLatestValue
- * @return {?}
- */
- function (async, updateLatestValue) {
- return async.then(updateLatestValue, function (e) { throw e; });
- };
- /**
- * @param {?} subscription
- * @return {?}
- */
- PromiseStrategy.prototype.dispose = /**
- * @param {?} subscription
- * @return {?}
- */
- function (subscription) { };
- /**
- * @param {?} subscription
- * @return {?}
- */
- PromiseStrategy.prototype.onDestroy = /**
- * @param {?} subscription
- * @return {?}
- */
- function (subscription) { };
- return PromiseStrategy;
- }());
- var _promiseStrategy = new PromiseStrategy();
- var _observableStrategy = new ObservableStrategy();
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Unwraps a value from an asynchronous primitive.
- * \@howToUse `observable_or_promise_expression | async`
- * \@description
- * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
- * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
- * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
- * potential memory leaks.
- *
- *
- * ## Examples
- *
- * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
- * promise.
- *
- * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
- *
- * It's also possible to use `async` with Observables. The example below binds the `time` Observable
- * to the view. The Observable continuously updates the view with the current time.
- *
- * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
- *
- * \@stable
- */
- var AsyncPipe = /** @class */ (function () {
- function AsyncPipe(_ref) {
- this._ref = _ref;
- this._latestValue = null;
- this._latestReturnedValue = null;
- this._subscription = null;
- this._obj = null;
- this._strategy = /** @type {?} */ ((null));
- }
- /**
- * @return {?}
- */
- AsyncPipe.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- if (this._subscription) {
- this._dispose();
- }
- };
- /**
- * @param {?} obj
- * @return {?}
- */
- AsyncPipe.prototype.transform = /**
- * @param {?} obj
- * @return {?}
- */
- function (obj) {
- if (!this._obj) {
- if (obj) {
- this._subscribe(obj);
- }
- this._latestReturnedValue = this._latestValue;
- return this._latestValue;
- }
- if (obj !== this._obj) {
- this._dispose();
- return this.transform(/** @type {?} */ (obj));
- }
- if (this._latestValue === this._latestReturnedValue) {
- return this._latestReturnedValue;
- }
- this._latestReturnedValue = this._latestValue;
- return __WEBPACK_IMPORTED_MODULE_0__angular_core__["_4" /* WrappedValue */].wrap(this._latestValue);
- };
- /**
- * @param {?} obj
- * @return {?}
- */
- AsyncPipe.prototype._subscribe = /**
- * @param {?} obj
- * @return {?}
- */
- function (obj) {
- var _this = this;
- this._obj = obj;
- this._strategy = this._selectStrategy(obj);
- this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); });
- };
- /**
- * @param {?} obj
- * @return {?}
- */
- AsyncPipe.prototype._selectStrategy = /**
- * @param {?} obj
- * @return {?}
- */
- function (obj) {
- if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_27" /* ɵisPromise */])(obj)) {
- return _promiseStrategy;
- }
- if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_26" /* ɵisObservable */])(obj)) {
- return _observableStrategy;
- }
- throw invalidPipeArgumentError(AsyncPipe, obj);
- };
- /**
- * @return {?}
- */
- AsyncPipe.prototype._dispose = /**
- * @return {?}
- */
- function () {
- this._strategy.dispose(/** @type {?} */ ((this._subscription)));
- this._latestValue = null;
- this._latestReturnedValue = null;
- this._subscription = null;
- this._obj = null;
- };
- /**
- * @param {?} async
- * @param {?} value
- * @return {?}
- */
- AsyncPipe.prototype._updateLatestValue = /**
- * @param {?} async
- * @param {?} value
- * @return {?}
- */
- function (async, value) {
- if (async === this._obj) {
- this._latestValue = value;
- this._ref.markForCheck();
- }
- };
- AsyncPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'async', pure: false },] },
- ];
- /** @nocollapse */
- AsyncPipe.ctorParameters = function () { return [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["j" /* ChangeDetectorRef */], },
- ]; };
- return AsyncPipe;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Transforms text to lowercase.
- *
- * {\@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe' }
- *
- * \@stable
- */
- var LowerCasePipe = /** @class */ (function () {
- function LowerCasePipe() {
- }
- /**
- * @param {?} value
- * @return {?}
- */
- LowerCasePipe.prototype.transform = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (!value)
- return value;
- if (typeof value !== 'string') {
- throw invalidPipeArgumentError(LowerCasePipe, value);
- }
- return value.toLowerCase();
- };
- LowerCasePipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'lowercase' },] },
- ];
- /** @nocollapse */
- LowerCasePipe.ctorParameters = function () { return []; };
- return LowerCasePipe;
- }());
- /**
- * Helper method to transform a single word to titlecase.
- *
- * \@stable
- * @param {?} word
- * @return {?}
- */
- function titleCaseWord(word) {
- if (!word)
- return word;
- return word[0].toUpperCase() + word.substr(1).toLowerCase();
- }
- /**
- * Transforms text to titlecase.
- *
- * \@stable
- */
- var TitleCasePipe = /** @class */ (function () {
- function TitleCasePipe() {
- }
- /**
- * @param {?} value
- * @return {?}
- */
- TitleCasePipe.prototype.transform = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (!value)
- return value;
- if (typeof value !== 'string') {
- throw invalidPipeArgumentError(TitleCasePipe, value);
- }
- return value.split(/\b/g).map(function (word) { return titleCaseWord(word); }).join('');
- };
- TitleCasePipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'titlecase' },] },
- ];
- /** @nocollapse */
- TitleCasePipe.ctorParameters = function () { return []; };
- return TitleCasePipe;
- }());
- /**
- * Transforms text to uppercase.
- *
- * \@stable
- */
- var UpperCasePipe = /** @class */ (function () {
- function UpperCasePipe() {
- }
- /**
- * @param {?} value
- * @return {?}
- */
- UpperCasePipe.prototype.transform = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (!value)
- return value;
- if (typeof value !== 'string') {
- throw invalidPipeArgumentError(UpperCasePipe, value);
- }
- return value.toUpperCase();
- };
- UpperCasePipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'uppercase' },] },
- ];
- /** @nocollapse */
- UpperCasePipe.ctorParameters = function () { return []; };
- return UpperCasePipe;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _INTERPOLATION_REGEXP = /#/g;
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Maps a value to a string that pluralizes the value according to locale rules.
- * \@howToUse `expression | i18nPlural:mapping[:locale]`
- * \@description
- *
- * Where:
- * - `expression` is a number.
- * - `mapping` is an object that mimics the ICU format, see
- * http://userguide.icu-project.org/formatparse/messages
- * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
- * default)
- *
- * ## Example
- *
- * {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
- *
- * \@experimental
- */
- var I18nPluralPipe = /** @class */ (function () {
- function I18nPluralPipe(_localization) {
- this._localization = _localization;
- }
- /**
- * @param {?} value
- * @param {?} pluralMap
- * @param {?=} locale
- * @return {?}
- */
- I18nPluralPipe.prototype.transform = /**
- * @param {?} value
- * @param {?} pluralMap
- * @param {?=} locale
- * @return {?}
- */
- function (value, pluralMap, locale) {
- if (value == null)
- return '';
- if (typeof pluralMap !== 'object' || pluralMap === null) {
- throw invalidPipeArgumentError(I18nPluralPipe, pluralMap);
- }
- var /** @type {?} */ key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
- return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
- };
- I18nPluralPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'i18nPlural', pure: true },] },
- ];
- /** @nocollapse */
- I18nPluralPipe.ctorParameters = function () { return [
- { type: NgLocalization, },
- ]; };
- return I18nPluralPipe;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Generic selector that displays the string that matches the current value.
- * \@howToUse `expression | i18nSelect:mapping`
- * \@description
- *
- * Where `mapping` is an object that indicates the text that should be displayed
- * for different values of the provided `expression`.
- * If none of the keys of the mapping match the value of the `expression`, then the content
- * of the `other` key is returned when present, otherwise an empty string is returned.
- *
- * ## Example
- *
- * {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
- *
- * \@experimental
- */
- var I18nSelectPipe = /** @class */ (function () {
- function I18nSelectPipe() {
- }
- /**
- * @param {?} value
- * @param {?} mapping
- * @return {?}
- */
- I18nSelectPipe.prototype.transform = /**
- * @param {?} value
- * @param {?} mapping
- * @return {?}
- */
- function (value, mapping) {
- if (value == null)
- return '';
- if (typeof mapping !== 'object' || typeof value !== 'string') {
- throw invalidPipeArgumentError(I18nSelectPipe, mapping);
- }
- if (mapping.hasOwnProperty(value)) {
- return mapping[value];
- }
- if (mapping.hasOwnProperty('other')) {
- return mapping['other'];
- }
- return '';
- };
- I18nSelectPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'i18nSelect', pure: true },] },
- ];
- /** @nocollapse */
- I18nSelectPipe.ctorParameters = function () { return []; };
- return I18nSelectPipe;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Converts value into JSON string.
- * \@howToUse `expression | json`
- * \@description
- *
- * Converts value into string using `JSON.stringify`. Useful for debugging.
- *
- * ### Example
- * {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
- *
- * \@stable
- */
- var JsonPipe = /** @class */ (function () {
- function JsonPipe() {
- }
- /**
- * @param {?} value
- * @return {?}
- */
- JsonPipe.prototype.transform = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return JSON.stringify(value, null, 2); };
- JsonPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'json', pure: false },] },
- ];
- /** @nocollapse */
- JsonPipe.ctorParameters = function () { return []; };
- return JsonPipe;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Formats a number according to locale rules.
- * \@howToUse `number_expression | number[:digitInfo[:locale]]`
- *
- * Formats a number as text. Group sizing and separator and other locale-specific
- * configurations are based on the active locale.
- *
- * where `expression` is a number:
- * - `digitInfo` is a `string` which has a following format: <br>
- * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
- * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
- * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
- * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
- * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
- * default)
- *
- * For more information on the acceptable range for each of these numbers and other
- * details see your native internationalization library.
- *
- * ### Example
- *
- * {\@example common/pipes/ts/number_pipe.ts region='NumberPipe'}
- *
- * \@stable
- */
- var DecimalPipe = /** @class */ (function () {
- function DecimalPipe(_locale) {
- this._locale = _locale;
- }
- /**
- * @param {?} value
- * @param {?=} digits
- * @param {?=} locale
- * @return {?}
- */
- DecimalPipe.prototype.transform = /**
- * @param {?} value
- * @param {?=} digits
- * @param {?=} locale
- * @return {?}
- */
- function (value, digits, locale) {
- if (isEmpty(value))
- return null;
- locale = locale || this._locale;
- var _a = formatNumber$1(value, locale, NumberFormatStyle.Decimal, digits), str = _a.str, error = _a.error;
- if (error) {
- throw invalidPipeArgumentError(DecimalPipe, error);
- }
- return str;
- };
- DecimalPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'number' },] },
- ];
- /** @nocollapse */
- DecimalPipe.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
- ]; };
- return DecimalPipe;
- }());
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Formats a number as a percentage according to locale rules.
- * \@howToUse `number_expression | percent[:digitInfo[:locale]]`
- *
- * \@description
- *
- * Formats a number as percentage.
- *
- * - `digitInfo` See {\@link DecimalPipe} for detailed description.
- * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
- * default)
- *
- * ### Example
- *
- * {\@example common/pipes/ts/percent_pipe.ts region='PercentPipe'}
- *
- * \@stable
- */
- var PercentPipe = /** @class */ (function () {
- function PercentPipe(_locale) {
- this._locale = _locale;
- }
- /**
- * @param {?} value
- * @param {?=} digits
- * @param {?=} locale
- * @return {?}
- */
- PercentPipe.prototype.transform = /**
- * @param {?} value
- * @param {?=} digits
- * @param {?=} locale
- * @return {?}
- */
- function (value, digits, locale) {
- if (isEmpty(value))
- return null;
- locale = locale || this._locale;
- var _a = formatNumber$1(value, locale, NumberFormatStyle.Percent, digits), str = _a.str, error = _a.error;
- if (error) {
- throw invalidPipeArgumentError(PercentPipe, error);
- }
- return str;
- };
- PercentPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'percent' },] },
- ];
- /** @nocollapse */
- PercentPipe.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
- ]; };
- return PercentPipe;
- }());
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Formats a number as currency using locale rules.
- * \@howToUse `number_expression | currency[:currencyCode[:display[:digitInfo[:locale]]]]`
- * \@description
- *
- * Use `currency` to format a number as currency.
- *
- * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
- * as `USD` for the US dollar and `EUR` for the euro.
- * - `display` indicates whether to show the currency symbol or the code.
- * - `code`: use code (e.g. `USD`).
- * - `symbol`(default): use symbol (e.g. `$`).
- * - `symbol-narrow`: some countries have two symbols for their currency, one regular and one
- * narrow (e.g. the canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`).
- * - boolean (deprecated from v5): `true` for symbol and false for `code`
- * If there is no narrow symbol for the chosen currency, the regular symbol will be used.
- * - `digitInfo` See {\@link DecimalPipe} for detailed description.
- * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
- * default)
- *
- * ### Example
- *
- * {\@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'}
- *
- * \@stable
- */
- var CurrencyPipe = /** @class */ (function () {
- function CurrencyPipe(_locale) {
- this._locale = _locale;
- }
- /**
- * @param {?} value
- * @param {?=} currencyCode
- * @param {?=} display
- * @param {?=} digits
- * @param {?=} locale
- * @return {?}
- */
- CurrencyPipe.prototype.transform = /**
- * @param {?} value
- * @param {?=} currencyCode
- * @param {?=} display
- * @param {?=} digits
- * @param {?=} locale
- * @return {?}
- */
- function (value, currencyCode, display, digits, locale) {
- if (display === void 0) { display = 'symbol'; }
- if (isEmpty(value))
- return null;
- locale = locale || this._locale;
- if (typeof display === 'boolean') {
- if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
- 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\".");
- }
- display = display ? 'symbol' : 'code';
- }
- var /** @type {?} */ currency = currencyCode || 'USD';
- if (display !== 'code') {
- currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow');
- }
- var _a = formatNumber$1(value, locale, NumberFormatStyle.Currency, digits, currency), str = _a.str, error = _a.error;
- if (error) {
- throw invalidPipeArgumentError(CurrencyPipe, error);
- }
- return str;
- };
- CurrencyPipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'currency' },] },
- ];
- /** @nocollapse */
- CurrencyPipe.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* LOCALE_ID */],] },] },
- ]; };
- return CurrencyPipe;
- }());
- /**
- * @param {?} value
- * @return {?}
- */
- function isEmpty(value) {
- return value == null || value === '' || value !== value;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@ngModule CommonModule
- * \@whatItDoes Creates a new List or String containing a subset (slice) of the elements.
- * \@howToUse `array_or_string_expression | slice:start[:end]`
- * \@description
- *
- * Where the input expression is a `List` or `String`, and:
- * - `start`: The starting index of the subset to return.
- * - **a positive integer**: return the item at `start` index and all items after
- * in the list or string expression.
- * - **a negative integer**: return the item at `start` index from the end and all items after
- * in the list or string expression.
- * - **if positive and greater than the size of the expression**: return an empty list or string.
- * - **if negative and greater than the size of the expression**: return entire list or string.
- * - `end`: The ending index of the subset to return.
- * - **omitted**: return all items until the end.
- * - **if positive**: return all items before `end` index of the list or string.
- * - **if negative**: return all items before `end` index from the end of the list or string.
- *
- * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
- * and `String.prototype.slice()`.
- *
- * When operating on a [List], the returned list is always a copy even when all
- * the elements are being returned.
- *
- * When operating on a blank value, the pipe returns the blank value.
- *
- * ## List Example
- *
- * This `ngFor` example:
- *
- * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
- *
- * produces the following:
- *
- * <li>b</li>
- * <li>c</li>
- *
- * ## String Examples
- *
- * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
- *
- * \@stable
- */
- var SlicePipe = /** @class */ (function () {
- function SlicePipe() {
- }
- /**
- * @param {?} value
- * @param {?} start
- * @param {?=} end
- * @return {?}
- */
- SlicePipe.prototype.transform = /**
- * @param {?} value
- * @param {?} start
- * @param {?=} end
- * @return {?}
- */
- function (value, start, end) {
- if (value == null)
- return value;
- if (!this.supports(value)) {
- throw invalidPipeArgumentError(SlicePipe, value);
- }
- return value.slice(start, end);
- };
- /**
- * @param {?} obj
- * @return {?}
- */
- SlicePipe.prototype.supports = /**
- * @param {?} obj
- * @return {?}
- */
- function (obj) { return typeof obj === 'string' || Array.isArray(obj); };
- SlicePipe.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Pipe */], args: [{ name: 'slice', pure: false },] },
- ];
- /** @nocollapse */
- SlicePipe.ctorParameters = function () { return []; };
- return SlicePipe;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A collection of Angular pipes that are likely to be used in each and every application.
- */
- var COMMON_PIPES = [
- AsyncPipe,
- UpperCasePipe,
- LowerCasePipe,
- JsonPipe,
- SlicePipe,
- DecimalPipe,
- PercentPipe,
- TitleCasePipe,
- CurrencyPipe,
- DatePipe,
- I18nPluralPipe,
- I18nSelectPipe,
- ];
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * The module that includes all the basic Angular directives like {\@link NgIf}, {\@link NgForOf}, ...
- *
- * \@stable
- */
- var CommonModule = /** @class */ (function () {
- function CommonModule() {
- }
- CommonModule.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["F" /* NgModule */], args: [{
- declarations: [COMMON_DIRECTIVES, COMMON_PIPES],
- exports: [COMMON_DIRECTIVES, COMMON_PIPES],
- providers: [
- { provide: NgLocalization, useClass: NgLocaleLocalization },
- ],
- },] },
- ];
- /** @nocollapse */
- CommonModule.ctorParameters = function () { return []; };
- return CommonModule;
- }());
- var ɵ0 = getPluralCase;
- /**
- * A module that contains the deprecated i18n pipes.
- *
- * @deprecated from v5
- */
- var DeprecatedI18NPipesModule = /** @class */ (function () {
- function DeprecatedI18NPipesModule() {
- }
- DeprecatedI18NPipesModule.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["F" /* NgModule */], args: [{
- declarations: [COMMON_DEPRECATED_I18N_PIPES],
- exports: [COMMON_DEPRECATED_I18N_PIPES],
- providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0 }],
- },] },
- ];
- /** @nocollapse */
- DeprecatedI18NPipesModule.ctorParameters = function () { return []; };
- return DeprecatedI18NPipesModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A DI Token representing the main rendering context. In a browser this is the DOM Document.
- *
- * Note: Document might not be available in the Application Context when Application and Rendering
- * Contexts are not the same (e.g. when running the application into a Web Worker).
- *
- * \@stable
- */
- var DOCUMENT = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* InjectionToken */]('DocumentToken');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var PLATFORM_BROWSER_ID = 'browser';
- var PLATFORM_SERVER_ID = 'server';
- var PLATFORM_WORKER_APP_ID = 'browserWorkerApp';
- var PLATFORM_WORKER_UI_ID = 'browserWorkerUi';
- /**
- * Returns whether a platform id represents a browser platform.
- * \@experimental
- * @param {?} platformId
- * @return {?}
- */
- function isPlatformBrowser(platformId) {
- return platformId === PLATFORM_BROWSER_ID;
- }
- /**
- * Returns whether a platform id represents a server platform.
- * \@experimental
- * @param {?} platformId
- * @return {?}
- */
- function isPlatformServer(platformId) {
- return platformId === PLATFORM_SERVER_ID;
- }
- /**
- * Returns whether a platform id represents a web worker app platform.
- * \@experimental
- * @param {?} platformId
- * @return {?}
- */
- function isPlatformWorkerApp(platformId) {
- return platformId === PLATFORM_WORKER_APP_ID;
- }
- /**
- * Returns whether a platform id represents a web worker UI platform.
- * \@experimental
- * @param {?} platformId
- * @return {?}
- */
- function isPlatformWorkerUi(platformId) {
- return platformId === PLATFORM_WORKER_UI_ID;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- */
- var VERSION = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["_1" /* Version */]('5.2.9');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @module
- * @description
- * Entry point for all public APIs of the common package.
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @module
- * @description
- * Entry point for all public APIs of this package.
- */
- // This file only reexports content of the `src` folder. Keep it that way.
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * Generated bundle index. Do not edit.
- */
- //# sourceMappingURL=common.js.map
- /***/ }),
- /***/ "./node_modules/@angular/compiler/esm5/compiler.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export core */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CompilerConfig; });
- /* unused harmony export preserveWhitespacesDefault */
- /* unused harmony export isLoweredSymbol */
- /* unused harmony export createLoweredSymbol */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return Identifiers; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return JitCompiler; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return DirectiveResolver; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return PipeResolver; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return NgModuleResolver; });
- /* unused harmony export DEFAULT_INTERPOLATION_CONFIG */
- /* unused harmony export InterpolationConfig */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return NgModuleCompiler; });
- /* unused harmony export AssertNotNull */
- /* unused harmony export BinaryOperator */
- /* unused harmony export BinaryOperatorExpr */
- /* unused harmony export BuiltinMethod */
- /* unused harmony export BuiltinVar */
- /* unused harmony export CastExpr */
- /* unused harmony export ClassStmt */
- /* unused harmony export CommaExpr */
- /* unused harmony export CommentStmt */
- /* unused harmony export ConditionalExpr */
- /* unused harmony export DeclareFunctionStmt */
- /* unused harmony export DeclareVarStmt */
- /* unused harmony export ExpressionStatement */
- /* unused harmony export ExternalExpr */
- /* unused harmony export ExternalReference */
- /* unused harmony export FunctionExpr */
- /* unused harmony export IfStmt */
- /* unused harmony export InstantiateExpr */
- /* unused harmony export InvokeFunctionExpr */
- /* unused harmony export InvokeMethodExpr */
- /* unused harmony export LiteralArrayExpr */
- /* unused harmony export LiteralExpr */
- /* unused harmony export LiteralMapExpr */
- /* unused harmony export NotExpr */
- /* unused harmony export ReadKeyExpr */
- /* unused harmony export ReadPropExpr */
- /* unused harmony export ReadVarExpr */
- /* unused harmony export ReturnStatement */
- /* unused harmony export ThrowStmt */
- /* unused harmony export TryCatchStmt */
- /* unused harmony export WriteKeyExpr */
- /* unused harmony export WritePropExpr */
- /* unused harmony export WriteVarExpr */
- /* unused harmony export StmtModifier */
- /* unused harmony export Statement */
- /* unused harmony export collectExternalReferences */
- /* unused harmony export EmitterVisitorContext */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return ViewCompiler; });
- /* unused harmony export getParseErrors */
- /* unused harmony export isSyntaxError */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return syntaxError; });
- /* unused harmony export Version */
- /* unused harmony export VERSION */
- /* unused harmony export TextAst */
- /* unused harmony export BoundTextAst */
- /* unused harmony export AttrAst */
- /* unused harmony export BoundElementPropertyAst */
- /* unused harmony export BoundEventAst */
- /* unused harmony export ReferenceAst */
- /* unused harmony export VariableAst */
- /* unused harmony export ElementAst */
- /* unused harmony export EmbeddedTemplateAst */
- /* unused harmony export BoundDirectivePropertyAst */
- /* unused harmony export DirectiveAst */
- /* unused harmony export ProviderAst */
- /* unused harmony export ProviderAstType */
- /* unused harmony export NgContentAst */
- /* unused harmony export PropertyBindingType */
- /* unused harmony export NullTemplateVisitor */
- /* unused harmony export RecursiveTemplateAstVisitor */
- /* unused harmony export templateVisitAll */
- /* unused harmony export identifierName */
- /* unused harmony export identifierModuleUrl */
- /* unused harmony export viewClassName */
- /* unused harmony export rendererTypeName */
- /* unused harmony export hostViewClassName */
- /* unused harmony export componentFactoryName */
- /* unused harmony export CompileSummaryKind */
- /* unused harmony export tokenName */
- /* unused harmony export tokenReference */
- /* unused harmony export CompileStylesheetMetadata */
- /* unused harmony export CompileTemplateMetadata */
- /* unused harmony export CompileDirectiveMetadata */
- /* unused harmony export CompilePipeMetadata */
- /* unused harmony export CompileNgModuleMetadata */
- /* unused harmony export TransitiveCompileNgModuleMetadata */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return ProviderMeta; });
- /* unused harmony export flatten */
- /* unused harmony export templateSourceUrl */
- /* unused harmony export sharedStylesheetJitUrl */
- /* unused harmony export ngModuleJitUrl */
- /* unused harmony export templateJitUrl */
- /* unused harmony export createAotUrlResolver */
- /* unused harmony export createAotCompiler */
- /* unused harmony export AotCompiler */
- /* unused harmony export analyzeNgModules */
- /* unused harmony export analyzeAndValidateNgModules */
- /* unused harmony export analyzeFile */
- /* unused harmony export mergeAnalyzedFiles */
- /* unused harmony export GeneratedFile */
- /* unused harmony export toTypeScript */
- /* unused harmony export formattedError */
- /* unused harmony export isFormattedError */
- /* unused harmony export StaticReflector */
- /* unused harmony export StaticSymbol */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return StaticSymbolCache; });
- /* unused harmony export ResolvedStaticSymbol */
- /* unused harmony export StaticSymbolResolver */
- /* unused harmony export unescapeIdentifier */
- /* unused harmony export unwrapResolvedMetadata */
- /* unused harmony export AotSummaryResolver */
- /* unused harmony export AstPath */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return SummaryResolver; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return JitSummaryResolver; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CompileReflector; });
- /* unused harmony export createUrlResolverWithoutPackagePrefix */
- /* unused harmony export createOfflineCompileUrlResolver */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return UrlResolver; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return getUrlScheme; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return ResourceLoader; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return ElementSchemaRegistry; });
- /* unused harmony export Extractor */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return I18NHtmlParser; });
- /* unused harmony export MessageBundle */
- /* unused harmony export Serializer */
- /* unused harmony export Xliff */
- /* unused harmony export Xliff2 */
- /* unused harmony export Xmb */
- /* unused harmony export Xtb */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return DirectiveNormalizer; });
- /* unused harmony export ParserError */
- /* unused harmony export ParseSpan */
- /* unused harmony export AST */
- /* unused harmony export Quote */
- /* unused harmony export EmptyExpr */
- /* unused harmony export ImplicitReceiver */
- /* unused harmony export Chain */
- /* unused harmony export Conditional */
- /* unused harmony export PropertyRead */
- /* unused harmony export PropertyWrite */
- /* unused harmony export SafePropertyRead */
- /* unused harmony export KeyedRead */
- /* unused harmony export KeyedWrite */
- /* unused harmony export BindingPipe */
- /* unused harmony export LiteralPrimitive */
- /* unused harmony export LiteralArray */
- /* unused harmony export LiteralMap */
- /* unused harmony export Interpolation */
- /* unused harmony export Binary */
- /* unused harmony export PrefixNot */
- /* unused harmony export NonNullAssert */
- /* unused harmony export MethodCall */
- /* unused harmony export SafeMethodCall */
- /* unused harmony export FunctionCall */
- /* unused harmony export ASTWithSource */
- /* unused harmony export TemplateBinding */
- /* unused harmony export NullAstVisitor */
- /* unused harmony export RecursiveAstVisitor */
- /* unused harmony export AstTransformer */
- /* unused harmony export visitAstChildren */
- /* unused harmony export TokenType */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return Lexer; });
- /* unused harmony export Token */
- /* unused harmony export EOF */
- /* unused harmony export isIdentifier */
- /* unused harmony export isQuote */
- /* unused harmony export SplitInterpolation */
- /* unused harmony export TemplateBindingParseResult */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return Parser; });
- /* unused harmony export _ParseAST */
- /* unused harmony export ERROR_COMPONENT_TYPE */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CompileMetadataResolver; });
- /* unused harmony export Text */
- /* unused harmony export Expansion */
- /* unused harmony export ExpansionCase */
- /* unused harmony export Attribute */
- /* unused harmony export Element */
- /* unused harmony export Comment */
- /* unused harmony export visitAll */
- /* unused harmony export RecursiveVisitor */
- /* unused harmony export findNode */
- /* unused harmony export ParseTreeResult */
- /* unused harmony export TreeError */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return HtmlParser; });
- /* unused harmony export HtmlTagDefinition */
- /* unused harmony export getHtmlTagDefinition */
- /* unused harmony export TagContentType */
- /* unused harmony export splitNsName */
- /* unused harmony export isNgContainer */
- /* unused harmony export isNgContent */
- /* unused harmony export isNgTemplate */
- /* unused harmony export getNsPrefix */
- /* unused harmony export mergeNsAndName */
- /* unused harmony export NAMED_ENTITIES */
- /* unused harmony export NGSP_UNICODE */
- /* unused harmony export debugOutputAstAsTypeScript */
- /* unused harmony export TypeScriptEmitter */
- /* unused harmony export ParseLocation */
- /* unused harmony export ParseSourceFile */
- /* unused harmony export ParseSourceSpan */
- /* unused harmony export ParseErrorLevel */
- /* unused harmony export ParseError */
- /* unused harmony export typeSourceSpan */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return DomElementSchemaRegistry; });
- /* unused harmony export CssSelector */
- /* unused harmony export SelectorMatcher */
- /* unused harmony export SelectorListContext */
- /* unused harmony export SelectorContext */
- /* unused harmony export StylesCompileDependency */
- /* unused harmony export CompiledStylesheet */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return StyleCompiler; });
- /* unused harmony export TemplateParseError */
- /* unused harmony export TemplateParseResult */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return TemplateParser; });
- /* unused harmony export splitClasses */
- /* unused harmony export createElementCssSelector */
- /* unused harmony export removeSummaryDuplicates */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
- /**
- * @license Angular v5.2.9
- * (c) 2010-2018 Google, Inc. https://angular.io/
- * License: MIT
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // Attention:
- // This file duplicates types and values from @angular/core
- // so that we are able to make @angular/compiler independent of @angular/core.
- // This is important to prevent a build cycle, as @angular/core needs to
- // be compiled with the compiler.
- /**
- * @record
- */
- function Inject() { }
- var createInject = makeMetadataFactory('Inject', function (token) { return ({ token: token }); });
- var createInjectionToken = makeMetadataFactory('InjectionToken', function (desc) { return ({ _desc: desc }); });
- /**
- * @record
- */
- function Attribute() { }
- var createAttribute = makeMetadataFactory('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
- /**
- * @record
- */
- function Query() { }
- var createContentChildren = makeMetadataFactory('ContentChildren', function (selector, data) {
- if (data === void 0) { data = {}; }
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
- });
- var createContentChild = makeMetadataFactory('ContentChild', function (selector, data) {
- if (data === void 0) { data = {}; }
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
- });
- var createViewChildren = makeMetadataFactory('ViewChildren', function (selector, data) {
- if (data === void 0) { data = {}; }
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
- });
- var createViewChild = makeMetadataFactory('ViewChild', function (selector, data) {
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
- });
- /**
- * @record
- */
- function Directive() { }
- var createDirective = makeMetadataFactory('Directive', function (dir) {
- if (dir === void 0) { dir = {}; }
- return dir;
- });
- /**
- * @record
- */
- function Component() { }
- /** @enum {number} */
- var ViewEncapsulation = {
- Emulated: 0,
- Native: 1,
- None: 2,
- };
- ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
- ViewEncapsulation[ViewEncapsulation.Native] = "Native";
- ViewEncapsulation[ViewEncapsulation.None] = "None";
- /** @enum {number} */
- var ChangeDetectionStrategy = {
- OnPush: 0,
- Default: 1,
- };
- ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
- ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
- var createComponent = makeMetadataFactory('Component', function (c) {
- if (c === void 0) { c = {}; }
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ changeDetection: ChangeDetectionStrategy.Default }, c));
- });
- /**
- * @record
- */
- function Pipe() { }
- var createPipe = makeMetadataFactory('Pipe', function (p) { return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ pure: true }, p)); });
- /**
- * @record
- */
- function Input() { }
- var createInput = makeMetadataFactory('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
- /**
- * @record
- */
- function Output() { }
- var createOutput = makeMetadataFactory('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
- /**
- * @record
- */
- function HostBinding() { }
- var createHostBinding = makeMetadataFactory('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
- /**
- * @record
- */
- function HostListener() { }
- var createHostListener = makeMetadataFactory('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
- /**
- * @record
- */
- function NgModule() { }
- var createNgModule = makeMetadataFactory('NgModule', function (ngModule) { return ngModule; });
- /**
- * @record
- */
- function ModuleWithProviders() { }
- /**
- * @record
- */
- function SchemaMetadata() { }
- var CUSTOM_ELEMENTS_SCHEMA = {
- name: 'custom-elements'
- };
- var NO_ERRORS_SCHEMA = {
- name: 'no-errors-schema'
- };
- var createOptional = makeMetadataFactory('Optional');
- var createInjectable = makeMetadataFactory('Injectable');
- var createSelf = makeMetadataFactory('Self');
- var createSkipSelf = makeMetadataFactory('SkipSelf');
- var createHost = makeMetadataFactory('Host');
- var Type = Function;
- /** @enum {number} */
- var SecurityContext = {
- NONE: 0,
- HTML: 1,
- STYLE: 2,
- SCRIPT: 3,
- URL: 4,
- RESOURCE_URL: 5,
- };
- SecurityContext[SecurityContext.NONE] = "NONE";
- SecurityContext[SecurityContext.HTML] = "HTML";
- SecurityContext[SecurityContext.STYLE] = "STYLE";
- SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
- SecurityContext[SecurityContext.URL] = "URL";
- SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
- /** @enum {number} */
- var NodeFlags = {
- None: 0,
- TypeElement: 1,
- TypeText: 2,
- ProjectedTemplate: 4,
- CatRenderNode: 3,
- TypeNgContent: 8,
- TypePipe: 16,
- TypePureArray: 32,
- TypePureObject: 64,
- TypePurePipe: 128,
- CatPureExpression: 224,
- TypeValueProvider: 256,
- TypeClassProvider: 512,
- TypeFactoryProvider: 1024,
- TypeUseExistingProvider: 2048,
- LazyProvider: 4096,
- PrivateProvider: 8192,
- TypeDirective: 16384,
- Component: 32768,
- CatProviderNoDirective: 3840,
- CatProvider: 20224,
- OnInit: 65536,
- OnDestroy: 131072,
- DoCheck: 262144,
- OnChanges: 524288,
- AfterContentInit: 1048576,
- AfterContentChecked: 2097152,
- AfterViewInit: 4194304,
- AfterViewChecked: 8388608,
- EmbeddedViews: 16777216,
- ComponentView: 33554432,
- TypeContentQuery: 67108864,
- TypeViewQuery: 134217728,
- StaticQuery: 268435456,
- DynamicQuery: 536870912,
- CatQuery: 201326592,
- // mutually exclusive values...
- Types: 201347067,
- };
- /** @enum {number} */
- var DepFlags = {
- None: 0,
- SkipSelf: 1,
- Optional: 2,
- Value: 8,
- };
- /** @enum {number} */
- var ArgumentType = { Inline: 0, Dynamic: 1, };
- /** @enum {number} */
- var BindingFlags = {
- TypeElementAttribute: 1,
- TypeElementClass: 2,
- TypeElementStyle: 4,
- TypeProperty: 8,
- SyntheticProperty: 16,
- SyntheticHostProperty: 32,
- CatSyntheticProperty: 48,
- // mutually exclusive values...
- Types: 15,
- };
- /** @enum {number} */
- var QueryBindingType = { First: 0, All: 1, };
- /** @enum {number} */
- var QueryValueType = {
- ElementRef: 0,
- RenderElement: 1,
- TemplateRef: 2,
- ViewContainerRef: 3,
- Provider: 4,
- };
- /** @enum {number} */
- var ViewFlags = {
- None: 0,
- OnPush: 2,
- };
- /** @enum {number} */
- var MissingTranslationStrategy = {
- Error: 0,
- Warning: 1,
- Ignore: 2,
- };
- MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
- MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
- MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
- /**
- * @record
- */
- function MetadataFactory() { }
- /**
- * @template T
- * @param {?} name
- * @param {?=} props
- * @return {?}
- */
- function makeMetadataFactory(name, props) {
- var /** @type {?} */ factory = function () {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var /** @type {?} */ values = props ? props.apply(void 0, args) : {};
- return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ ngMetadataName: name }, values);
- };
- factory.isTypeOf = function (obj) { return obj && obj.ngMetadataName === name; };
- factory.ngMetadataName = name;
- return factory;
- }
- /**
- * @record
- */
- function Route() { }
- var core = Object.freeze({
- Inject: Inject,
- createInject: createInject,
- createInjectionToken: createInjectionToken,
- Attribute: Attribute,
- createAttribute: createAttribute,
- Query: Query,
- createContentChildren: createContentChildren,
- createContentChild: createContentChild,
- createViewChildren: createViewChildren,
- createViewChild: createViewChild,
- Directive: Directive,
- createDirective: createDirective,
- Component: Component,
- ViewEncapsulation: ViewEncapsulation,
- ChangeDetectionStrategy: ChangeDetectionStrategy,
- createComponent: createComponent,
- Pipe: Pipe,
- createPipe: createPipe,
- Input: Input,
- createInput: createInput,
- Output: Output,
- createOutput: createOutput,
- HostBinding: HostBinding,
- createHostBinding: createHostBinding,
- HostListener: HostListener,
- createHostListener: createHostListener,
- NgModule: NgModule,
- createNgModule: createNgModule,
- ModuleWithProviders: ModuleWithProviders,
- SchemaMetadata: SchemaMetadata,
- CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA,
- NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA,
- createOptional: createOptional,
- createInjectable: createInjectable,
- createSelf: createSelf,
- createSkipSelf: createSkipSelf,
- createHost: createHost,
- Type: Type,
- SecurityContext: SecurityContext,
- NodeFlags: NodeFlags,
- DepFlags: DepFlags,
- ArgumentType: ArgumentType,
- BindingFlags: BindingFlags,
- QueryBindingType: QueryBindingType,
- QueryValueType: QueryValueType,
- ViewFlags: ViewFlags,
- MissingTranslationStrategy: MissingTranslationStrategy,
- MetadataFactory: MetadataFactory,
- Route: Route
- });
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
- /**
- * @param {?} input
- * @return {?}
- */
- function dashCaseToCamelCase(input) {
- return input.replace(DASH_CASE_REGEXP, function () {
- var m = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- m[_i] = arguments[_i];
- }
- return m[1].toUpperCase();
- });
- }
- /**
- * @param {?} input
- * @param {?} defaultValues
- * @return {?}
- */
- function splitAtColon(input, defaultValues) {
- return _splitAt(input, ':', defaultValues);
- }
- /**
- * @param {?} input
- * @param {?} defaultValues
- * @return {?}
- */
- function splitAtPeriod(input, defaultValues) {
- return _splitAt(input, '.', defaultValues);
- }
- /**
- * @param {?} input
- * @param {?} character
- * @param {?} defaultValues
- * @return {?}
- */
- function _splitAt(input, character, defaultValues) {
- var /** @type {?} */ characterIndex = input.indexOf(character);
- if (characterIndex == -1)
- return defaultValues;
- return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
- }
- /**
- * @param {?} value
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function visitValue(value, visitor, context) {
- if (Array.isArray(value)) {
- return visitor.visitArray(/** @type {?} */ (value), context);
- }
- if (isStrictStringMap(value)) {
- return visitor.visitStringMap(/** @type {?} */ (value), context);
- }
- if (value == null || typeof value == 'string' || typeof value == 'number' ||
- typeof value == 'boolean') {
- return visitor.visitPrimitive(value, context);
- }
- return visitor.visitOther(value, context);
- }
- /**
- * @param {?} val
- * @return {?}
- */
- function isDefined(val) {
- return val !== null && val !== undefined;
- }
- /**
- * @template T
- * @param {?} val
- * @return {?}
- */
- function noUndefined(val) {
- return val === undefined ? /** @type {?} */ ((null)) : val;
- }
- /**
- * @record
- */
- var ValueTransformer = /** @class */ (function () {
- function ValueTransformer() {
- }
- /**
- * @param {?} arr
- * @param {?} context
- * @return {?}
- */
- ValueTransformer.prototype.visitArray = /**
- * @param {?} arr
- * @param {?} context
- * @return {?}
- */
- function (arr, context) {
- var _this = this;
- return arr.map(function (value) { return visitValue(value, _this, context); });
- };
- /**
- * @param {?} map
- * @param {?} context
- * @return {?}
- */
- ValueTransformer.prototype.visitStringMap = /**
- * @param {?} map
- * @param {?} context
- * @return {?}
- */
- function (map, context) {
- var _this = this;
- var /** @type {?} */ result = {};
- Object.keys(map).forEach(function (key) { result[key] = visitValue(map[key], _this, context); });
- return result;
- };
- /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- ValueTransformer.prototype.visitPrimitive = /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- function (value, context) { return value; };
- /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- ValueTransformer.prototype.visitOther = /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- function (value, context) { return value; };
- return ValueTransformer;
- }());
- var SyncAsync = {
- assertSync: function (value) {
- if (isPromise(value)) {
- throw new Error("Illegal state: value cannot be a promise");
- }
- return value;
- },
- then: function (value, cb) { return isPromise(value) ? value.then(cb) : cb(value); },
- all: function (syncAsyncValues) {
- return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : /** @type {?} */ (syncAsyncValues);
- }
- };
- /**
- * @param {?} msg
- * @param {?=} parseErrors
- * @return {?}
- */
- function syntaxError(msg, parseErrors) {
- var /** @type {?} */ error = Error(msg);
- (/** @type {?} */ (error))[ERROR_SYNTAX_ERROR] = true;
- if (parseErrors)
- (/** @type {?} */ (error))[ERROR_PARSE_ERRORS] = parseErrors;
- return error;
- }
- var ERROR_SYNTAX_ERROR = 'ngSyntaxError';
- var ERROR_PARSE_ERRORS = 'ngParseErrors';
- /**
- * @param {?} error
- * @return {?}
- */
- function isSyntaxError(error) {
- return (/** @type {?} */ (error))[ERROR_SYNTAX_ERROR];
- }
- /**
- * @param {?} error
- * @return {?}
- */
- function getParseErrors(error) {
- return (/** @type {?} */ (error))[ERROR_PARSE_ERRORS] || [];
- }
- /**
- * @param {?} s
- * @return {?}
- */
- function escapeRegExp(s) {
- return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
- }
- var STRING_MAP_PROTO = Object.getPrototypeOf({});
- /**
- * @param {?} obj
- * @return {?}
- */
- function isStrictStringMap(obj) {
- return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
- }
- /**
- * @param {?} str
- * @return {?}
- */
- function utf8Encode(str) {
- var /** @type {?} */ encoded = '';
- for (var /** @type {?} */ index = 0; index < str.length; index++) {
- var /** @type {?} */ codePoint = str.charCodeAt(index);
- // decode surrogate
- // see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
- if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) {
- var /** @type {?} */ low = str.charCodeAt(index + 1);
- if (low >= 0xdc00 && low <= 0xdfff) {
- index++;
- codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000;
- }
- }
- if (codePoint <= 0x7f) {
- encoded += String.fromCharCode(codePoint);
- }
- else if (codePoint <= 0x7ff) {
- encoded += String.fromCharCode(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80);
- }
- else if (codePoint <= 0xffff) {
- encoded += String.fromCharCode((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
- }
- else if (codePoint <= 0x1fffff) {
- encoded += String.fromCharCode(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
- }
- }
- return encoded;
- }
- /**
- * @record
- */
- /**
- * @param {?} token
- * @return {?}
- */
- function stringify(token) {
- if (typeof token === 'string') {
- return token;
- }
- if (token instanceof Array) {
- return '[' + token.map(stringify).join(', ') + ']';
- }
- if (token == null) {
- return '' + token;
- }
- if (token.overriddenName) {
- return "" + token.overriddenName;
- }
- if (token.name) {
- return "" + token.name;
- }
- var /** @type {?} */ res = token.toString();
- if (res == null) {
- return '' + res;
- }
- var /** @type {?} */ newLineIndex = res.indexOf('\n');
- return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
- }
- /**
- * Lazily retrieves the reference value from a forwardRef.
- * @param {?} type
- * @return {?}
- */
- function resolveForwardRef(type) {
- if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__')) {
- return type();
- }
- else {
- return type;
- }
- }
- /**
- * Determine if the argument is shaped like a Promise
- * @param {?} obj
- * @return {?}
- */
- function isPromise(obj) {
- // allow any Promise/A+ compliant thenable.
- // It's up to the caller to ensure that obj.then conforms to the spec
- return !!obj && typeof obj.then === 'function';
- }
- var Version = /** @class */ (function () {
- function Version(full) {
- this.full = full;
- var /** @type {?} */ splits = full.split('.');
- this.major = splits[0];
- this.minor = splits[1];
- this.patch = splits.slice(2).join('.');
- }
- return Version;
- }());
- /**
- * @record
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- */
- var VERSION = new Version('5.2.9');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An Abstract Syntax Tree node representing part of a parsed Angular template.
- * @record
- */
- /**
- * A segment of text within the template.
- */
- var TextAst = /** @class */ (function () {
- function TextAst(value, ngContentIndex, sourceSpan) {
- this.value = value;
- this.ngContentIndex = ngContentIndex;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- TextAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitText(this, context); };
- return TextAst;
- }());
- /**
- * A bound expression within the text of a template.
- */
- var BoundTextAst = /** @class */ (function () {
- function BoundTextAst(value, ngContentIndex, sourceSpan) {
- this.value = value;
- this.ngContentIndex = ngContentIndex;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- BoundTextAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitBoundText(this, context);
- };
- return BoundTextAst;
- }());
- /**
- * A plain attribute on an element.
- */
- var AttrAst = /** @class */ (function () {
- function AttrAst(name, value, sourceSpan) {
- this.name = name;
- this.value = value;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- AttrAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitAttr(this, context); };
- return AttrAst;
- }());
- /**
- * A binding for an element property (e.g. `[property]="expression"`) or an animation trigger (e.g.
- * `[\@trigger]="stateExp"`)
- */
- var BoundElementPropertyAst = /** @class */ (function () {
- function BoundElementPropertyAst(name, type, securityContext, value, unit, sourceSpan) {
- this.name = name;
- this.type = type;
- this.securityContext = securityContext;
- this.value = value;
- this.unit = unit;
- this.sourceSpan = sourceSpan;
- this.isAnimation = this.type === PropertyBindingType.Animation;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- BoundElementPropertyAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitElementProperty(this, context);
- };
- return BoundElementPropertyAst;
- }());
- /**
- * A binding for an element event (e.g. `(event)="handler()"`) or an animation trigger event (e.g.
- * `(\@trigger.phase)="callback($event)"`).
- */
- var BoundEventAst = /** @class */ (function () {
- function BoundEventAst(name, target, phase, handler, sourceSpan) {
- this.name = name;
- this.target = target;
- this.phase = phase;
- this.handler = handler;
- this.sourceSpan = sourceSpan;
- this.fullName = BoundEventAst.calcFullName(this.name, this.target, this.phase);
- this.isAnimation = !!this.phase;
- }
- /**
- * @param {?} name
- * @param {?} target
- * @param {?} phase
- * @return {?}
- */
- BoundEventAst.calcFullName = /**
- * @param {?} name
- * @param {?} target
- * @param {?} phase
- * @return {?}
- */
- function (name, target, phase) {
- if (target) {
- return target + ":" + name;
- }
- else if (phase) {
- return "@" + name + "." + phase;
- }
- else {
- return name;
- }
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- BoundEventAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitEvent(this, context);
- };
- return BoundEventAst;
- }());
- /**
- * A reference declaration on an element (e.g. `let someName="expression"`).
- */
- var ReferenceAst = /** @class */ (function () {
- function ReferenceAst(name, value, sourceSpan) {
- this.name = name;
- this.value = value;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ReferenceAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitReference(this, context);
- };
- return ReferenceAst;
- }());
- /**
- * A variable declaration on a <ng-template> (e.g. `var-someName="someLocalName"`).
- */
- var VariableAst = /** @class */ (function () {
- function VariableAst(name, value, sourceSpan) {
- this.name = name;
- this.value = value;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- VariableAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitVariable(this, context);
- };
- return VariableAst;
- }());
- /**
- * An element declaration in a template.
- */
- var ElementAst = /** @class */ (function () {
- function ElementAst(name, attrs, inputs, outputs, references, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan, endSourceSpan) {
- this.name = name;
- this.attrs = attrs;
- this.inputs = inputs;
- this.outputs = outputs;
- this.references = references;
- this.directives = directives;
- this.providers = providers;
- this.hasViewContainer = hasViewContainer;
- this.queryMatches = queryMatches;
- this.children = children;
- this.ngContentIndex = ngContentIndex;
- this.sourceSpan = sourceSpan;
- this.endSourceSpan = endSourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ElementAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitElement(this, context);
- };
- return ElementAst;
- }());
- /**
- * A `<ng-template>` element included in an Angular template.
- */
- var EmbeddedTemplateAst = /** @class */ (function () {
- function EmbeddedTemplateAst(attrs, outputs, references, variables, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan) {
- this.attrs = attrs;
- this.outputs = outputs;
- this.references = references;
- this.variables = variables;
- this.directives = directives;
- this.providers = providers;
- this.hasViewContainer = hasViewContainer;
- this.queryMatches = queryMatches;
- this.children = children;
- this.ngContentIndex = ngContentIndex;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- EmbeddedTemplateAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitEmbeddedTemplate(this, context);
- };
- return EmbeddedTemplateAst;
- }());
- /**
- * A directive property with a bound value (e.g. `*ngIf="condition").
- */
- var BoundDirectivePropertyAst = /** @class */ (function () {
- function BoundDirectivePropertyAst(directiveName, templateName, value, sourceSpan) {
- this.directiveName = directiveName;
- this.templateName = templateName;
- this.value = value;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- BoundDirectivePropertyAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitDirectiveProperty(this, context);
- };
- return BoundDirectivePropertyAst;
- }());
- /**
- * A directive declared on an element.
- */
- var DirectiveAst = /** @class */ (function () {
- function DirectiveAst(directive, inputs, hostProperties, hostEvents, contentQueryStartId, sourceSpan) {
- this.directive = directive;
- this.inputs = inputs;
- this.hostProperties = hostProperties;
- this.hostEvents = hostEvents;
- this.contentQueryStartId = contentQueryStartId;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- DirectiveAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitDirective(this, context);
- };
- return DirectiveAst;
- }());
- /**
- * A provider declared on an element
- */
- var ProviderAst = /** @class */ (function () {
- function ProviderAst(token, multiProvider, eager, providers, providerType, lifecycleHooks, sourceSpan) {
- this.token = token;
- this.multiProvider = multiProvider;
- this.eager = eager;
- this.providers = providers;
- this.providerType = providerType;
- this.lifecycleHooks = lifecycleHooks;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ProviderAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- // No visit method in the visitor for now...
- return null;
- };
- return ProviderAst;
- }());
- /** @enum {number} */
- var ProviderAstType = {
- PublicService: 0,
- PrivateService: 1,
- Component: 2,
- Directive: 3,
- Builtin: 4,
- };
- ProviderAstType[ProviderAstType.PublicService] = "PublicService";
- ProviderAstType[ProviderAstType.PrivateService] = "PrivateService";
- ProviderAstType[ProviderAstType.Component] = "Component";
- ProviderAstType[ProviderAstType.Directive] = "Directive";
- ProviderAstType[ProviderAstType.Builtin] = "Builtin";
- /**
- * Position where content is to be projected (instance of `<ng-content>` in a template).
- */
- var NgContentAst = /** @class */ (function () {
- function NgContentAst(index, ngContentIndex, sourceSpan) {
- this.index = index;
- this.ngContentIndex = ngContentIndex;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- NgContentAst.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitNgContent(this, context);
- };
- return NgContentAst;
- }());
- /** @enum {number} */
- var PropertyBindingType = {
- /**
- * A normal binding to a property (e.g. `[property]="expression"`).
- */
- Property: 0,
- /**
- * A binding to an element attribute (e.g. `[attr.name]="expression"`).
- */
- Attribute: 1,
- /**
- * A binding to a CSS class (e.g. `[class.name]="condition"`).
- */
- Class: 2,
- /**
- * A binding to a style rule (e.g. `[style.rule]="expression"`).
- */
- Style: 3,
- /**
- * A binding to an animation reference (e.g. `[animate.key]="expression"`).
- */
- Animation: 4,
- };
- PropertyBindingType[PropertyBindingType.Property] = "Property";
- PropertyBindingType[PropertyBindingType.Attribute] = "Attribute";
- PropertyBindingType[PropertyBindingType.Class] = "Class";
- PropertyBindingType[PropertyBindingType.Style] = "Style";
- PropertyBindingType[PropertyBindingType.Animation] = "Animation";
- /**
- * @record
- */
- /**
- * A visitor for {\@link TemplateAst} trees that will process each node.
- * @record
- */
- /**
- * A visitor that accepts each node but doesn't do anything. It is intended to be used
- * as the base class for a visitor that is only interested in a subset of the node types.
- */
- var NullTemplateVisitor = /** @class */ (function () {
- function NullTemplateVisitor() {
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitNgContent = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitEmbeddedTemplate = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitElement = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitReference = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitVariable = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitEvent = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitElementProperty = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitAttr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitBoundText = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitText = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitDirective = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullTemplateVisitor.prototype.visitDirectiveProperty = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- return NullTemplateVisitor;
- }());
- /**
- * Base class that can be used to build a visitor that visits each node
- * in an template ast recursively.
- */
- var RecursiveTemplateAstVisitor = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(RecursiveTemplateAstVisitor, _super);
- function RecursiveTemplateAstVisitor() {
- return _super.call(this) || this;
- }
- // Nodes with children
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveTemplateAstVisitor.prototype.visitEmbeddedTemplate = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.visitChildren(context, function (visit) {
- visit(ast.attrs);
- visit(ast.references);
- visit(ast.variables);
- visit(ast.directives);
- visit(ast.providers);
- visit(ast.children);
- });
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveTemplateAstVisitor.prototype.visitElement = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.visitChildren(context, function (visit) {
- visit(ast.attrs);
- visit(ast.inputs);
- visit(ast.outputs);
- visit(ast.references);
- visit(ast.directives);
- visit(ast.providers);
- visit(ast.children);
- });
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveTemplateAstVisitor.prototype.visitDirective = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.visitChildren(context, function (visit) {
- visit(ast.inputs);
- visit(ast.hostProperties);
- visit(ast.hostEvents);
- });
- };
- /**
- * @template T
- * @param {?} context
- * @param {?} cb
- * @return {?}
- */
- RecursiveTemplateAstVisitor.prototype.visitChildren = /**
- * @template T
- * @param {?} context
- * @param {?} cb
- * @return {?}
- */
- function (context, cb) {
- var /** @type {?} */ results = [];
- var /** @type {?} */ t = this;
- /**
- * @template T
- * @param {?} children
- * @return {?}
- */
- function visit(children) {
- if (children && children.length)
- results.push(templateVisitAll(t, children, context));
- }
- cb(visit);
- return [].concat.apply([], results);
- };
- return RecursiveTemplateAstVisitor;
- }(NullTemplateVisitor));
- /**
- * Visit every node in a list of {\@link TemplateAst}s with the given {\@link TemplateAstVisitor}.
- * @param {?} visitor
- * @param {?} asts
- * @param {?=} context
- * @return {?}
- */
- function templateVisitAll(visitor, asts, context) {
- if (context === void 0) { context = null; }
- var /** @type {?} */ result = [];
- var /** @type {?} */ visit = visitor.visit ?
- function (ast) { return ((visitor.visit))(ast, context) || ast.visit(visitor, context); } :
- function (ast) { return ast.visit(visitor, context); };
- asts.forEach(function (ast) {
- var /** @type {?} */ astResult = visit(ast);
- if (astResult) {
- result.push(astResult);
- }
- });
- return result;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var CompilerConfig = /** @class */ (function () {
- function CompilerConfig(_a) {
- 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;
- this.defaultEncapsulation = defaultEncapsulation;
- this.useJit = !!useJit;
- this.jitDevMode = !!jitDevMode;
- this.missingTranslation = missingTranslation;
- this.enableLegacyTemplate = enableLegacyTemplate === true;
- this.preserveWhitespaces = preserveWhitespacesDefault(noUndefined(preserveWhitespaces));
- this.strictInjectionParameters = strictInjectionParameters === true;
- }
- return CompilerConfig;
- }());
- /**
- * @param {?} preserveWhitespacesOption
- * @param {?=} defaultSetting
- * @return {?}
- */
- function preserveWhitespacesDefault(preserveWhitespacesOption, defaultSetting) {
- if (defaultSetting === void 0) { defaultSetting = true; }
- return preserveWhitespacesOption === null ? defaultSetting : preserveWhitespacesOption;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A token representing the a reference to a static type.
- *
- * This token is unique for a filePath and name and can be used as a hash table key.
- */
- var StaticSymbol = /** @class */ (function () {
- function StaticSymbol(filePath, name, members) {
- this.filePath = filePath;
- this.name = name;
- this.members = members;
- }
- /**
- * @return {?}
- */
- StaticSymbol.prototype.assertNoMembers = /**
- * @return {?}
- */
- function () {
- if (this.members.length) {
- throw new Error("Illegal state: symbol without members expected, but got " + JSON.stringify(this) + ".");
- }
- };
- return StaticSymbol;
- }());
- /**
- * A cache of static symbol used by the StaticReflector to return the same symbol for the
- * same symbol values.
- */
- var StaticSymbolCache = /** @class */ (function () {
- function StaticSymbolCache() {
- this.cache = new Map();
- }
- /**
- * @param {?} declarationFile
- * @param {?} name
- * @param {?=} members
- * @return {?}
- */
- StaticSymbolCache.prototype.get = /**
- * @param {?} declarationFile
- * @param {?} name
- * @param {?=} members
- * @return {?}
- */
- function (declarationFile, name, members) {
- members = members || [];
- var /** @type {?} */ memberSuffix = members.length ? "." + members.join('.') : '';
- var /** @type {?} */ key = "\"" + declarationFile + "\"." + name + memberSuffix;
- var /** @type {?} */ result = this.cache.get(key);
- if (!result) {
- result = new StaticSymbol(declarationFile, name, members);
- this.cache.set(key, result);
- }
- return result;
- };
- return StaticSymbolCache;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // group 0: "[prop] or (event) or @trigger"
- // group 1: "prop" from "[prop]"
- // group 2: "event" from "(event)"
- // group 3: "@trigger" from "@trigger"
- var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
- /**
- * @param {?} name
- * @return {?}
- */
- function _sanitizeIdentifier(name) {
- return name.replace(/\W/g, '_');
- }
- var _anonymousTypeIndex = 0;
- /**
- * @param {?} compileIdentifier
- * @return {?}
- */
- function identifierName(compileIdentifier) {
- if (!compileIdentifier || !compileIdentifier.reference) {
- return null;
- }
- var /** @type {?} */ ref = compileIdentifier.reference;
- if (ref instanceof StaticSymbol) {
- return ref.name;
- }
- if (ref['__anonymousType']) {
- return ref['__anonymousType'];
- }
- var /** @type {?} */ identifier = stringify(ref);
- if (identifier.indexOf('(') >= 0) {
- // case: anonymous functions!
- identifier = "anonymous_" + _anonymousTypeIndex++;
- ref['__anonymousType'] = identifier;
- }
- else {
- identifier = _sanitizeIdentifier(identifier);
- }
- return identifier;
- }
- /**
- * @param {?} compileIdentifier
- * @return {?}
- */
- function identifierModuleUrl(compileIdentifier) {
- var /** @type {?} */ ref = compileIdentifier.reference;
- if (ref instanceof StaticSymbol) {
- return ref.filePath;
- }
- // Runtime type
- return "./" + stringify(ref);
- }
- /**
- * @param {?} compType
- * @param {?} embeddedTemplateIndex
- * @return {?}
- */
- function viewClassName(compType, embeddedTemplateIndex) {
- return "View_" + identifierName({ reference: compType }) + "_" + embeddedTemplateIndex;
- }
- /**
- * @param {?} compType
- * @return {?}
- */
- function rendererTypeName(compType) {
- return "RenderType_" + identifierName({ reference: compType });
- }
- /**
- * @param {?} compType
- * @return {?}
- */
- function hostViewClassName(compType) {
- return "HostView_" + identifierName({ reference: compType });
- }
- /**
- * @param {?} compType
- * @return {?}
- */
- function componentFactoryName(compType) {
- return identifierName({ reference: compType }) + "NgFactory";
- }
- /**
- * @record
- */
- /**
- * @record
- */
- /** @enum {number} */
- var CompileSummaryKind = {
- Pipe: 0,
- Directive: 1,
- NgModule: 2,
- Injectable: 3,
- };
- CompileSummaryKind[CompileSummaryKind.Pipe] = "Pipe";
- CompileSummaryKind[CompileSummaryKind.Directive] = "Directive";
- CompileSummaryKind[CompileSummaryKind.NgModule] = "NgModule";
- CompileSummaryKind[CompileSummaryKind.Injectable] = "Injectable";
- /**
- * A CompileSummary is the data needed to use a directive / pipe / module
- * in other modules / components. However, this data is not enough to compile
- * the directive / module itself.
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @param {?} token
- * @return {?}
- */
- function tokenName(token) {
- return token.value != null ? _sanitizeIdentifier(token.value) : identifierName(token.identifier);
- }
- /**
- * @param {?} token
- * @return {?}
- */
- function tokenReference(token) {
- if (token.identifier != null) {
- return token.identifier.reference;
- }
- else {
- return token.value;
- }
- }
- /**
- * @record
- */
- /**
- * Metadata regarding compilation of a type.
- * @record
- */
- /**
- * @record
- */
- /**
- * Metadata about a stylesheet
- */
- var CompileStylesheetMetadata = /** @class */ (function () {
- function CompileStylesheetMetadata(_a) {
- var _b = _a === void 0 ? {} : _a, moduleUrl = _b.moduleUrl, styles = _b.styles, styleUrls = _b.styleUrls;
- this.moduleUrl = moduleUrl || null;
- this.styles = _normalizeArray(styles);
- this.styleUrls = _normalizeArray(styleUrls);
- }
- return CompileStylesheetMetadata;
- }());
- /**
- * Summary Metadata regarding compilation of a template.
- * @record
- */
- /**
- * Metadata regarding compilation of a template.
- */
- var CompileTemplateMetadata = /** @class */ (function () {
- function CompileTemplateMetadata(_a) {
- 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;
- this.encapsulation = encapsulation;
- this.template = template;
- this.templateUrl = templateUrl;
- this.htmlAst = htmlAst;
- this.styles = _normalizeArray(styles);
- this.styleUrls = _normalizeArray(styleUrls);
- this.externalStylesheets = _normalizeArray(externalStylesheets);
- this.animations = animations ? flatten(animations) : [];
- this.ngContentSelectors = ngContentSelectors || [];
- if (interpolation && interpolation.length != 2) {
- throw new Error("'interpolation' should have a start and an end symbol.");
- }
- this.interpolation = interpolation;
- this.isInline = isInline;
- this.preserveWhitespaces = preserveWhitespaces;
- }
- /**
- * @return {?}
- */
- CompileTemplateMetadata.prototype.toSummary = /**
- * @return {?}
- */
- function () {
- return {
- ngContentSelectors: this.ngContentSelectors,
- encapsulation: this.encapsulation,
- };
- };
- return CompileTemplateMetadata;
- }());
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * Metadata regarding compilation of a directive.
- */
- var CompileDirectiveMetadata = /** @class */ (function () {
- function CompileDirectiveMetadata(_a) {
- 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;
- this.isHost = !!isHost;
- this.type = type;
- this.isComponent = isComponent;
- this.selector = selector;
- this.exportAs = exportAs;
- this.changeDetection = changeDetection;
- this.inputs = inputs;
- this.outputs = outputs;
- this.hostListeners = hostListeners;
- this.hostProperties = hostProperties;
- this.hostAttributes = hostAttributes;
- this.providers = _normalizeArray(providers);
- this.viewProviders = _normalizeArray(viewProviders);
- this.queries = _normalizeArray(queries);
- this.guards = guards;
- this.viewQueries = _normalizeArray(viewQueries);
- this.entryComponents = _normalizeArray(entryComponents);
- this.template = template;
- this.componentViewType = componentViewType;
- this.rendererType = rendererType;
- this.componentFactory = componentFactory;
- }
- /**
- * @param {?} __0
- * @return {?}
- */
- CompileDirectiveMetadata.create = /**
- * @param {?} __0
- * @return {?}
- */
- function (_a) {
- 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;
- var /** @type {?} */ hostListeners = {};
- var /** @type {?} */ hostProperties = {};
- var /** @type {?} */ hostAttributes = {};
- if (host != null) {
- Object.keys(host).forEach(function (key) {
- var /** @type {?} */ value = host[key];
- var /** @type {?} */ matches = key.match(HOST_REG_EXP);
- if (matches === null) {
- hostAttributes[key] = value;
- }
- else if (matches[1] != null) {
- hostProperties[matches[1]] = value;
- }
- else if (matches[2] != null) {
- hostListeners[matches[2]] = value;
- }
- });
- }
- var /** @type {?} */ inputsMap = {};
- if (inputs != null) {
- inputs.forEach(function (bindConfig) {
- // canonical syntax: `dirProp: elProp`
- // if there is no `:`, use dirProp = elProp
- var /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
- inputsMap[parts[0]] = parts[1];
- });
- }
- var /** @type {?} */ outputsMap = {};
- if (outputs != null) {
- outputs.forEach(function (bindConfig) {
- // canonical syntax: `dirProp: elProp`
- // if there is no `:`, use dirProp = elProp
- var /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
- outputsMap[parts[0]] = parts[1];
- });
- }
- return new CompileDirectiveMetadata({
- isHost: isHost,
- type: type,
- isComponent: !!isComponent, selector: selector, exportAs: exportAs, changeDetection: changeDetection,
- inputs: inputsMap,
- outputs: outputsMap,
- hostListeners: hostListeners,
- hostProperties: hostProperties,
- hostAttributes: hostAttributes,
- providers: providers,
- viewProviders: viewProviders,
- queries: queries,
- guards: guards,
- viewQueries: viewQueries,
- entryComponents: entryComponents,
- template: template,
- componentViewType: componentViewType,
- rendererType: rendererType,
- componentFactory: componentFactory,
- });
- };
- /**
- * @return {?}
- */
- CompileDirectiveMetadata.prototype.toSummary = /**
- * @return {?}
- */
- function () {
- return {
- summaryKind: CompileSummaryKind.Directive,
- type: this.type,
- isComponent: this.isComponent,
- selector: this.selector,
- exportAs: this.exportAs,
- inputs: this.inputs,
- outputs: this.outputs,
- hostListeners: this.hostListeners,
- hostProperties: this.hostProperties,
- hostAttributes: this.hostAttributes,
- providers: this.providers,
- viewProviders: this.viewProviders,
- queries: this.queries,
- guards: this.guards,
- viewQueries: this.viewQueries,
- entryComponents: this.entryComponents,
- changeDetection: this.changeDetection,
- template: this.template && this.template.toSummary(),
- componentViewType: this.componentViewType,
- rendererType: this.rendererType,
- componentFactory: this.componentFactory
- };
- };
- return CompileDirectiveMetadata;
- }());
- /**
- * @record
- */
- var CompilePipeMetadata = /** @class */ (function () {
- function CompilePipeMetadata(_a) {
- var type = _a.type, name = _a.name, pure = _a.pure;
- this.type = type;
- this.name = name;
- this.pure = !!pure;
- }
- /**
- * @return {?}
- */
- CompilePipeMetadata.prototype.toSummary = /**
- * @return {?}
- */
- function () {
- return {
- summaryKind: CompileSummaryKind.Pipe,
- type: this.type,
- name: this.name,
- pure: this.pure
- };
- };
- return CompilePipeMetadata;
- }());
- /**
- * @record
- */
- /**
- * Metadata regarding compilation of a module.
- */
- var CompileNgModuleMetadata = /** @class */ (function () {
- function CompileNgModuleMetadata(_a) {
- 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;
- this.type = type || null;
- this.declaredDirectives = _normalizeArray(declaredDirectives);
- this.exportedDirectives = _normalizeArray(exportedDirectives);
- this.declaredPipes = _normalizeArray(declaredPipes);
- this.exportedPipes = _normalizeArray(exportedPipes);
- this.providers = _normalizeArray(providers);
- this.entryComponents = _normalizeArray(entryComponents);
- this.bootstrapComponents = _normalizeArray(bootstrapComponents);
- this.importedModules = _normalizeArray(importedModules);
- this.exportedModules = _normalizeArray(exportedModules);
- this.schemas = _normalizeArray(schemas);
- this.id = id || null;
- this.transitiveModule = transitiveModule || null;
- }
- /**
- * @return {?}
- */
- CompileNgModuleMetadata.prototype.toSummary = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ module = /** @type {?} */ ((this.transitiveModule));
- return {
- summaryKind: CompileSummaryKind.NgModule,
- type: this.type,
- entryComponents: module.entryComponents,
- providers: module.providers,
- modules: module.modules,
- exportedDirectives: module.exportedDirectives,
- exportedPipes: module.exportedPipes
- };
- };
- return CompileNgModuleMetadata;
- }());
- var TransitiveCompileNgModuleMetadata = /** @class */ (function () {
- function TransitiveCompileNgModuleMetadata() {
- this.directivesSet = new Set();
- this.directives = [];
- this.exportedDirectivesSet = new Set();
- this.exportedDirectives = [];
- this.pipesSet = new Set();
- this.pipes = [];
- this.exportedPipesSet = new Set();
- this.exportedPipes = [];
- this.modulesSet = new Set();
- this.modules = [];
- this.entryComponentsSet = new Set();
- this.entryComponents = [];
- this.providers = [];
- }
- /**
- * @param {?} provider
- * @param {?} module
- * @return {?}
- */
- TransitiveCompileNgModuleMetadata.prototype.addProvider = /**
- * @param {?} provider
- * @param {?} module
- * @return {?}
- */
- function (provider, module) {
- this.providers.push({ provider: provider, module: module });
- };
- /**
- * @param {?} id
- * @return {?}
- */
- TransitiveCompileNgModuleMetadata.prototype.addDirective = /**
- * @param {?} id
- * @return {?}
- */
- function (id) {
- if (!this.directivesSet.has(id.reference)) {
- this.directivesSet.add(id.reference);
- this.directives.push(id);
- }
- };
- /**
- * @param {?} id
- * @return {?}
- */
- TransitiveCompileNgModuleMetadata.prototype.addExportedDirective = /**
- * @param {?} id
- * @return {?}
- */
- function (id) {
- if (!this.exportedDirectivesSet.has(id.reference)) {
- this.exportedDirectivesSet.add(id.reference);
- this.exportedDirectives.push(id);
- }
- };
- /**
- * @param {?} id
- * @return {?}
- */
- TransitiveCompileNgModuleMetadata.prototype.addPipe = /**
- * @param {?} id
- * @return {?}
- */
- function (id) {
- if (!this.pipesSet.has(id.reference)) {
- this.pipesSet.add(id.reference);
- this.pipes.push(id);
- }
- };
- /**
- * @param {?} id
- * @return {?}
- */
- TransitiveCompileNgModuleMetadata.prototype.addExportedPipe = /**
- * @param {?} id
- * @return {?}
- */
- function (id) {
- if (!this.exportedPipesSet.has(id.reference)) {
- this.exportedPipesSet.add(id.reference);
- this.exportedPipes.push(id);
- }
- };
- /**
- * @param {?} id
- * @return {?}
- */
- TransitiveCompileNgModuleMetadata.prototype.addModule = /**
- * @param {?} id
- * @return {?}
- */
- function (id) {
- if (!this.modulesSet.has(id.reference)) {
- this.modulesSet.add(id.reference);
- this.modules.push(id);
- }
- };
- /**
- * @param {?} ec
- * @return {?}
- */
- TransitiveCompileNgModuleMetadata.prototype.addEntryComponent = /**
- * @param {?} ec
- * @return {?}
- */
- function (ec) {
- if (!this.entryComponentsSet.has(ec.componentType)) {
- this.entryComponentsSet.add(ec.componentType);
- this.entryComponents.push(ec);
- }
- };
- return TransitiveCompileNgModuleMetadata;
- }());
- /**
- * @param {?} obj
- * @return {?}
- */
- function _normalizeArray(obj) {
- return obj || [];
- }
- var ProviderMeta = /** @class */ (function () {
- function ProviderMeta(token, _a) {
- var useClass = _a.useClass, useValue = _a.useValue, useExisting = _a.useExisting, useFactory = _a.useFactory, deps = _a.deps, multi = _a.multi;
- this.token = token;
- this.useClass = useClass || null;
- this.useValue = useValue;
- this.useExisting = useExisting;
- this.useFactory = useFactory || null;
- this.dependencies = deps || null;
- this.multi = !!multi;
- }
- return ProviderMeta;
- }());
- /**
- * @template T
- * @param {?} list
- * @return {?}
- */
- function flatten(list) {
- return list.reduce(function (flat, item) {
- var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item;
- return (/** @type {?} */ (flat)).concat(flatItem);
- }, []);
- }
- /**
- * @param {?} url
- * @return {?}
- */
- function jitSourceUrl(url) {
- // Note: We need 3 "/" so that ng shows up as a separate domain
- // in the chrome dev tools.
- return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, 'ng:///');
- }
- /**
- * @param {?} ngModuleType
- * @param {?} compMeta
- * @param {?} templateMeta
- * @return {?}
- */
- function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
- var /** @type {?} */ url;
- if (templateMeta.isInline) {
- if (compMeta.type.reference instanceof StaticSymbol) {
- // Note: a .ts file might contain multiple components with inline templates,
- // so we need to give them unique urls, as these will be used for sourcemaps.
- url = compMeta.type.reference.filePath + "." + compMeta.type.reference.name + ".html";
- }
- else {
- url = identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".html";
- }
- }
- else {
- url = /** @type {?} */ ((templateMeta.templateUrl));
- }
- return compMeta.type.reference instanceof StaticSymbol ? url : jitSourceUrl(url);
- }
- /**
- * @param {?} meta
- * @param {?} id
- * @return {?}
- */
- function sharedStylesheetJitUrl(meta, id) {
- var /** @type {?} */ pathParts = /** @type {?} */ ((meta.moduleUrl)).split(/\/\\/g);
- var /** @type {?} */ baseName = pathParts[pathParts.length - 1];
- return jitSourceUrl("css/" + id + baseName + ".ngstyle.js");
- }
- /**
- * @param {?} moduleMeta
- * @return {?}
- */
- function ngModuleJitUrl(moduleMeta) {
- return jitSourceUrl(identifierName(moduleMeta.type) + "/module.ngfactory.js");
- }
- /**
- * @param {?} ngModuleType
- * @param {?} compMeta
- * @return {?}
- */
- function templateJitUrl(ngModuleType, compMeta) {
- return jitSourceUrl(identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".ngfactory.js");
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A path is an ordered set of elements. Typically a path is to a
- * particular offset in a source file. The head of the list is the top
- * most node. The tail is the node that contains the offset directly.
- *
- * For example, the expresion `a + b + c` might have an ast that looks
- * like:
- * +
- * / \
- * a +
- * / \
- * b c
- *
- * The path to the node at offset 9 would be `['+' at 1-10, '+' at 7-10,
- * 'c' at 9-10]` and the path the node at offset 1 would be
- * `['+' at 1-10, 'a' at 1-2]`.
- */
- var AstPath = /** @class */ (function () {
- function AstPath(path, position) {
- if (position === void 0) { position = -1; }
- this.path = path;
- this.position = position;
- }
- Object.defineProperty(AstPath.prototype, "empty", {
- get: /**
- * @return {?}
- */
- function () { return !this.path || !this.path.length; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(AstPath.prototype, "head", {
- get: /**
- * @return {?}
- */
- function () { return this.path[0]; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(AstPath.prototype, "tail", {
- get: /**
- * @return {?}
- */
- function () { return this.path[this.path.length - 1]; },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} node
- * @return {?}
- */
- AstPath.prototype.parentOf = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- return node && this.path[this.path.indexOf(node) - 1];
- };
- /**
- * @param {?} node
- * @return {?}
- */
- AstPath.prototype.childOf = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return this.path[this.path.indexOf(node) + 1]; };
- /**
- * @template N
- * @param {?} ctor
- * @return {?}
- */
- AstPath.prototype.first = /**
- * @template N
- * @param {?} ctor
- * @return {?}
- */
- function (ctor) {
- for (var /** @type {?} */ i = this.path.length - 1; i >= 0; i--) {
- var /** @type {?} */ item = this.path[i];
- if (item instanceof ctor)
- return /** @type {?} */ (item);
- }
- };
- /**
- * @param {?} node
- * @return {?}
- */
- AstPath.prototype.push = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { this.path.push(node); };
- /**
- * @return {?}
- */
- AstPath.prototype.pop = /**
- * @return {?}
- */
- function () { return /** @type {?} */ ((this.path.pop())); };
- return AstPath;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @record
- */
- var Text = /** @class */ (function () {
- function Text(value, sourceSpan) {
- this.value = value;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- Text.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitText(this, context); };
- return Text;
- }());
- var Expansion = /** @class */ (function () {
- function Expansion(switchValue, type, cases, sourceSpan, switchValueSourceSpan) {
- this.switchValue = switchValue;
- this.type = type;
- this.cases = cases;
- this.sourceSpan = sourceSpan;
- this.switchValueSourceSpan = switchValueSourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- Expansion.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitExpansion(this, context); };
- return Expansion;
- }());
- var ExpansionCase = /** @class */ (function () {
- function ExpansionCase(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) {
- this.value = value;
- this.expression = expression;
- this.sourceSpan = sourceSpan;
- this.valueSourceSpan = valueSourceSpan;
- this.expSourceSpan = expSourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ExpansionCase.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitExpansionCase(this, context); };
- return ExpansionCase;
- }());
- var Attribute$1 = /** @class */ (function () {
- function Attribute(name, value, sourceSpan, valueSpan) {
- this.name = name;
- this.value = value;
- this.sourceSpan = sourceSpan;
- this.valueSpan = valueSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- Attribute.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitAttribute(this, context); };
- return Attribute;
- }());
- var Element = /** @class */ (function () {
- function Element(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan) {
- if (startSourceSpan === void 0) { startSourceSpan = null; }
- if (endSourceSpan === void 0) { endSourceSpan = null; }
- this.name = name;
- this.attrs = attrs;
- this.children = children;
- this.sourceSpan = sourceSpan;
- this.startSourceSpan = startSourceSpan;
- this.endSourceSpan = endSourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- Element.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitElement(this, context); };
- return Element;
- }());
- var Comment = /** @class */ (function () {
- function Comment(value, sourceSpan) {
- this.value = value;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- Comment.prototype.visit = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitComment(this, context); };
- return Comment;
- }());
- /**
- * @record
- */
- /**
- * @param {?} visitor
- * @param {?} nodes
- * @param {?=} context
- * @return {?}
- */
- function visitAll(visitor, nodes, context) {
- if (context === void 0) { context = null; }
- var /** @type {?} */ result = [];
- var /** @type {?} */ visit = visitor.visit ?
- function (ast) { return ((visitor.visit))(ast, context) || ast.visit(visitor, context); } :
- function (ast) { return ast.visit(visitor, context); };
- nodes.forEach(function (ast) {
- var /** @type {?} */ astResult = visit(ast);
- if (astResult) {
- result.push(astResult);
- }
- });
- return result;
- }
- var RecursiveVisitor = /** @class */ (function () {
- function RecursiveVisitor() {
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveVisitor.prototype.visitElement = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- this.visitChildren(context, function (visit) {
- visit(ast.attrs);
- visit(ast.children);
- });
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveVisitor.prototype.visitAttribute = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveVisitor.prototype.visitText = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveVisitor.prototype.visitComment = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveVisitor.prototype.visitExpansion = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.visitChildren(context, function (visit) { visit(ast.cases); });
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveVisitor.prototype.visitExpansionCase = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @template T
- * @param {?} context
- * @param {?} cb
- * @return {?}
- */
- RecursiveVisitor.prototype.visitChildren = /**
- * @template T
- * @param {?} context
- * @param {?} cb
- * @return {?}
- */
- function (context, cb) {
- var /** @type {?} */ results = [];
- var /** @type {?} */ t = this;
- /**
- * @template T
- * @param {?} children
- * @return {?}
- */
- function visit(children) {
- if (children)
- results.push(visitAll(t, children, context));
- }
- cb(visit);
- return [].concat.apply([], results);
- };
- return RecursiveVisitor;
- }());
- /**
- * @param {?} ast
- * @return {?}
- */
- function spanOf(ast) {
- var /** @type {?} */ start = ast.sourceSpan.start.offset;
- var /** @type {?} */ end = ast.sourceSpan.end.offset;
- if (ast instanceof Element) {
- if (ast.endSourceSpan) {
- end = ast.endSourceSpan.end.offset;
- }
- else if (ast.children && ast.children.length) {
- end = spanOf(ast.children[ast.children.length - 1]).end;
- }
- }
- return { start: start, end: end };
- }
- /**
- * @param {?} nodes
- * @param {?} position
- * @return {?}
- */
- function findNode(nodes, position) {
- var /** @type {?} */ path = [];
- var /** @type {?} */ visitor = new /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(class_1, _super);
- function class_1() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- class_1.prototype.visit = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var /** @type {?} */ span = spanOf(ast);
- if (span.start <= position && position < span.end) {
- path.push(ast);
- }
- else {
- // Returning a value here will result in the children being skipped.
- return true;
- }
- };
- return class_1;
- }(RecursiveVisitor));
- visitAll(visitor, nodes);
- return new AstPath(path, position);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} identifier
- * @param {?} value
- * @return {?}
- */
- function assertArrayOfStrings(identifier, value) {
- if (value == null) {
- return;
- }
- if (!Array.isArray(value)) {
- throw new Error("Expected '" + identifier + "' to be an array of strings.");
- }
- for (var /** @type {?} */ i = 0; i < value.length; i += 1) {
- if (typeof value[i] !== 'string') {
- throw new Error("Expected '" + identifier + "' to be an array of strings.");
- }
- }
- }
- var INTERPOLATION_BLACKLIST_REGEXPS = [
- /^\s*$/,
- /[<>]/,
- /^[{}]$/,
- /&(#|[a-z])/i,
- /^\/\//,
- ];
- /**
- * @param {?} identifier
- * @param {?} value
- * @return {?}
- */
- function assertInterpolationSymbols(identifier, value) {
- if (value != null && !(Array.isArray(value) && value.length == 2)) {
- throw new Error("Expected '" + identifier + "' to be an array, [start, end].");
- }
- else if (value != null) {
- var /** @type {?} */ start_1 = /** @type {?} */ (value[0]);
- var /** @type {?} */ end_1 = /** @type {?} */ (value[1]);
- // black list checking
- INTERPOLATION_BLACKLIST_REGEXPS.forEach(function (regexp) {
- if (regexp.test(start_1) || regexp.test(end_1)) {
- throw new Error("['" + start_1 + "', '" + end_1 + "'] contains unusable interpolation symbol.");
- }
- });
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var InterpolationConfig = /** @class */ (function () {
- function InterpolationConfig(start, end) {
- this.start = start;
- this.end = end;
- }
- /**
- * @param {?} markers
- * @return {?}
- */
- InterpolationConfig.fromArray = /**
- * @param {?} markers
- * @return {?}
- */
- function (markers) {
- if (!markers) {
- return DEFAULT_INTERPOLATION_CONFIG;
- }
- assertInterpolationSymbols('interpolation', markers);
- return new InterpolationConfig(markers[0], markers[1]);
- };
- return InterpolationConfig;
- }());
- var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig('{{', '}}');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var StyleWithImports = /** @class */ (function () {
- function StyleWithImports(style, styleUrls) {
- this.style = style;
- this.styleUrls = styleUrls;
- }
- return StyleWithImports;
- }());
- /**
- * @param {?} url
- * @return {?}
- */
- function isStyleUrlResolvable(url) {
- if (url == null || url.length === 0 || url[0] == '/')
- return false;
- var /** @type {?} */ schemeMatch = url.match(URL_WITH_SCHEMA_REGEXP);
- return schemeMatch === null || schemeMatch[1] == 'package' || schemeMatch[1] == 'asset';
- }
- /**
- * Rewrites stylesheets by resolving and removing the \@import urls that
- * are either relative or don't have a `package:` scheme
- * @param {?} resolver
- * @param {?} baseUrl
- * @param {?} cssText
- * @return {?}
- */
- function extractStyleUrls(resolver, baseUrl, cssText) {
- var /** @type {?} */ foundUrls = [];
- var /** @type {?} */ modifiedCssText = cssText.replace(CSS_STRIPPABLE_COMMENT_REGEXP, '')
- .replace(CSS_IMPORT_REGEXP, function () {
- var m = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- m[_i] = arguments[_i];
- }
- var /** @type {?} */ url = m[1] || m[2];
- if (!isStyleUrlResolvable(url)) {
- // Do not attempt to resolve non-package absolute URLs with URI
- // scheme
- return m[0];
- }
- foundUrls.push(resolver.resolve(baseUrl, url));
- return '';
- });
- return new StyleWithImports(modifiedCssText, foundUrls);
- }
- var CSS_IMPORT_REGEXP = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g;
- var CSS_STRIPPABLE_COMMENT_REGEXP = /\/\*(?!#\s*(?:sourceURL|sourceMappingURL)=)[\s\S]+?\*\//g;
- var URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var TagContentType = {
- RAW_TEXT: 0,
- ESCAPABLE_RAW_TEXT: 1,
- PARSABLE_DATA: 2,
- };
- TagContentType[TagContentType.RAW_TEXT] = "RAW_TEXT";
- TagContentType[TagContentType.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT";
- TagContentType[TagContentType.PARSABLE_DATA] = "PARSABLE_DATA";
- /**
- * @record
- */
- /**
- * @param {?} elementName
- * @return {?}
- */
- function splitNsName(elementName) {
- if (elementName[0] != ':') {
- return [null, elementName];
- }
- var /** @type {?} */ colonIndex = elementName.indexOf(':', 1);
- if (colonIndex == -1) {
- throw new Error("Unsupported format \"" + elementName + "\" expecting \":namespace:name\"");
- }
- return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
- }
- /**
- * @param {?} tagName
- * @return {?}
- */
- function isNgContainer(tagName) {
- return splitNsName(tagName)[1] === 'ng-container';
- }
- /**
- * @param {?} tagName
- * @return {?}
- */
- function isNgContent(tagName) {
- return splitNsName(tagName)[1] === 'ng-content';
- }
- /**
- * @param {?} tagName
- * @return {?}
- */
- function isNgTemplate(tagName) {
- return splitNsName(tagName)[1] === 'ng-template';
- }
- /**
- * @param {?} fullName
- * @return {?}
- */
- function getNsPrefix(fullName) {
- return fullName === null ? null : splitNsName(fullName)[0];
- }
- /**
- * @param {?} prefix
- * @param {?} localName
- * @return {?}
- */
- function mergeNsAndName(prefix, localName) {
- return prefix ? ":" + prefix + ":" + localName : localName;
- }
- // see http://www.w3.org/TR/html51/syntax.html#named-character-references
- // see https://html.spec.whatwg.org/multipage/entities.json
- // This list is not exhaustive to keep the compiler footprint low.
- // The `{` / `ƫ` syntax should be used when the named character reference does not
- // exist.
- var NAMED_ENTITIES = {
- 'Aacute': '\u00C1',
- 'aacute': '\u00E1',
- 'Acirc': '\u00C2',
- 'acirc': '\u00E2',
- 'acute': '\u00B4',
- 'AElig': '\u00C6',
- 'aelig': '\u00E6',
- 'Agrave': '\u00C0',
- 'agrave': '\u00E0',
- 'alefsym': '\u2135',
- 'Alpha': '\u0391',
- 'alpha': '\u03B1',
- 'amp': '&',
- 'and': '\u2227',
- 'ang': '\u2220',
- 'apos': '\u0027',
- 'Aring': '\u00C5',
- 'aring': '\u00E5',
- 'asymp': '\u2248',
- 'Atilde': '\u00C3',
- 'atilde': '\u00E3',
- 'Auml': '\u00C4',
- 'auml': '\u00E4',
- 'bdquo': '\u201E',
- 'Beta': '\u0392',
- 'beta': '\u03B2',
- 'brvbar': '\u00A6',
- 'bull': '\u2022',
- 'cap': '\u2229',
- 'Ccedil': '\u00C7',
- 'ccedil': '\u00E7',
- 'cedil': '\u00B8',
- 'cent': '\u00A2',
- 'Chi': '\u03A7',
- 'chi': '\u03C7',
- 'circ': '\u02C6',
- 'clubs': '\u2663',
- 'cong': '\u2245',
- 'copy': '\u00A9',
- 'crarr': '\u21B5',
- 'cup': '\u222A',
- 'curren': '\u00A4',
- 'dagger': '\u2020',
- 'Dagger': '\u2021',
- 'darr': '\u2193',
- 'dArr': '\u21D3',
- 'deg': '\u00B0',
- 'Delta': '\u0394',
- 'delta': '\u03B4',
- 'diams': '\u2666',
- 'divide': '\u00F7',
- 'Eacute': '\u00C9',
- 'eacute': '\u00E9',
- 'Ecirc': '\u00CA',
- 'ecirc': '\u00EA',
- 'Egrave': '\u00C8',
- 'egrave': '\u00E8',
- 'empty': '\u2205',
- 'emsp': '\u2003',
- 'ensp': '\u2002',
- 'Epsilon': '\u0395',
- 'epsilon': '\u03B5',
- 'equiv': '\u2261',
- 'Eta': '\u0397',
- 'eta': '\u03B7',
- 'ETH': '\u00D0',
- 'eth': '\u00F0',
- 'Euml': '\u00CB',
- 'euml': '\u00EB',
- 'euro': '\u20AC',
- 'exist': '\u2203',
- 'fnof': '\u0192',
- 'forall': '\u2200',
- 'frac12': '\u00BD',
- 'frac14': '\u00BC',
- 'frac34': '\u00BE',
- 'frasl': '\u2044',
- 'Gamma': '\u0393',
- 'gamma': '\u03B3',
- 'ge': '\u2265',
- 'gt': '>',
- 'harr': '\u2194',
- 'hArr': '\u21D4',
- 'hearts': '\u2665',
- 'hellip': '\u2026',
- 'Iacute': '\u00CD',
- 'iacute': '\u00ED',
- 'Icirc': '\u00CE',
- 'icirc': '\u00EE',
- 'iexcl': '\u00A1',
- 'Igrave': '\u00CC',
- 'igrave': '\u00EC',
- 'image': '\u2111',
- 'infin': '\u221E',
- 'int': '\u222B',
- 'Iota': '\u0399',
- 'iota': '\u03B9',
- 'iquest': '\u00BF',
- 'isin': '\u2208',
- 'Iuml': '\u00CF',
- 'iuml': '\u00EF',
- 'Kappa': '\u039A',
- 'kappa': '\u03BA',
- 'Lambda': '\u039B',
- 'lambda': '\u03BB',
- 'lang': '\u27E8',
- 'laquo': '\u00AB',
- 'larr': '\u2190',
- 'lArr': '\u21D0',
- 'lceil': '\u2308',
- 'ldquo': '\u201C',
- 'le': '\u2264',
- 'lfloor': '\u230A',
- 'lowast': '\u2217',
- 'loz': '\u25CA',
- 'lrm': '\u200E',
- 'lsaquo': '\u2039',
- 'lsquo': '\u2018',
- 'lt': '<',
- 'macr': '\u00AF',
- 'mdash': '\u2014',
- 'micro': '\u00B5',
- 'middot': '\u00B7',
- 'minus': '\u2212',
- 'Mu': '\u039C',
- 'mu': '\u03BC',
- 'nabla': '\u2207',
- 'nbsp': '\u00A0',
- 'ndash': '\u2013',
- 'ne': '\u2260',
- 'ni': '\u220B',
- 'not': '\u00AC',
- 'notin': '\u2209',
- 'nsub': '\u2284',
- 'Ntilde': '\u00D1',
- 'ntilde': '\u00F1',
- 'Nu': '\u039D',
- 'nu': '\u03BD',
- 'Oacute': '\u00D3',
- 'oacute': '\u00F3',
- 'Ocirc': '\u00D4',
- 'ocirc': '\u00F4',
- 'OElig': '\u0152',
- 'oelig': '\u0153',
- 'Ograve': '\u00D2',
- 'ograve': '\u00F2',
- 'oline': '\u203E',
- 'Omega': '\u03A9',
- 'omega': '\u03C9',
- 'Omicron': '\u039F',
- 'omicron': '\u03BF',
- 'oplus': '\u2295',
- 'or': '\u2228',
- 'ordf': '\u00AA',
- 'ordm': '\u00BA',
- 'Oslash': '\u00D8',
- 'oslash': '\u00F8',
- 'Otilde': '\u00D5',
- 'otilde': '\u00F5',
- 'otimes': '\u2297',
- 'Ouml': '\u00D6',
- 'ouml': '\u00F6',
- 'para': '\u00B6',
- 'permil': '\u2030',
- 'perp': '\u22A5',
- 'Phi': '\u03A6',
- 'phi': '\u03C6',
- 'Pi': '\u03A0',
- 'pi': '\u03C0',
- 'piv': '\u03D6',
- 'plusmn': '\u00B1',
- 'pound': '\u00A3',
- 'prime': '\u2032',
- 'Prime': '\u2033',
- 'prod': '\u220F',
- 'prop': '\u221D',
- 'Psi': '\u03A8',
- 'psi': '\u03C8',
- 'quot': '\u0022',
- 'radic': '\u221A',
- 'rang': '\u27E9',
- 'raquo': '\u00BB',
- 'rarr': '\u2192',
- 'rArr': '\u21D2',
- 'rceil': '\u2309',
- 'rdquo': '\u201D',
- 'real': '\u211C',
- 'reg': '\u00AE',
- 'rfloor': '\u230B',
- 'Rho': '\u03A1',
- 'rho': '\u03C1',
- 'rlm': '\u200F',
- 'rsaquo': '\u203A',
- 'rsquo': '\u2019',
- 'sbquo': '\u201A',
- 'Scaron': '\u0160',
- 'scaron': '\u0161',
- 'sdot': '\u22C5',
- 'sect': '\u00A7',
- 'shy': '\u00AD',
- 'Sigma': '\u03A3',
- 'sigma': '\u03C3',
- 'sigmaf': '\u03C2',
- 'sim': '\u223C',
- 'spades': '\u2660',
- 'sub': '\u2282',
- 'sube': '\u2286',
- 'sum': '\u2211',
- 'sup': '\u2283',
- 'sup1': '\u00B9',
- 'sup2': '\u00B2',
- 'sup3': '\u00B3',
- 'supe': '\u2287',
- 'szlig': '\u00DF',
- 'Tau': '\u03A4',
- 'tau': '\u03C4',
- 'there4': '\u2234',
- 'Theta': '\u0398',
- 'theta': '\u03B8',
- 'thetasym': '\u03D1',
- 'thinsp': '\u2009',
- 'THORN': '\u00DE',
- 'thorn': '\u00FE',
- 'tilde': '\u02DC',
- 'times': '\u00D7',
- 'trade': '\u2122',
- 'Uacute': '\u00DA',
- 'uacute': '\u00FA',
- 'uarr': '\u2191',
- 'uArr': '\u21D1',
- 'Ucirc': '\u00DB',
- 'ucirc': '\u00FB',
- 'Ugrave': '\u00D9',
- 'ugrave': '\u00F9',
- 'uml': '\u00A8',
- 'upsih': '\u03D2',
- 'Upsilon': '\u03A5',
- 'upsilon': '\u03C5',
- 'Uuml': '\u00DC',
- 'uuml': '\u00FC',
- 'weierp': '\u2118',
- 'Xi': '\u039E',
- 'xi': '\u03BE',
- 'Yacute': '\u00DD',
- 'yacute': '\u00FD',
- 'yen': '\u00A5',
- 'yuml': '\u00FF',
- 'Yuml': '\u0178',
- 'Zeta': '\u0396',
- 'zeta': '\u03B6',
- 'zwj': '\u200D',
- 'zwnj': '\u200C',
- };
- // The &ngsp; pseudo-entity is denoting a space. see:
- // https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart
- var NGSP_UNICODE = '\uE500';
- NAMED_ENTITIES['ngsp'] = NGSP_UNICODE;
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var NG_CONTENT_SELECT_ATTR = 'select';
- var LINK_ELEMENT = 'link';
- var LINK_STYLE_REL_ATTR = 'rel';
- var LINK_STYLE_HREF_ATTR = 'href';
- var LINK_STYLE_REL_VALUE = 'stylesheet';
- var STYLE_ELEMENT = 'style';
- var SCRIPT_ELEMENT = 'script';
- var NG_NON_BINDABLE_ATTR = 'ngNonBindable';
- var NG_PROJECT_AS = 'ngProjectAs';
- /**
- * @param {?} ast
- * @return {?}
- */
- function preparseElement(ast) {
- var /** @type {?} */ selectAttr = /** @type {?} */ ((null));
- var /** @type {?} */ hrefAttr = /** @type {?} */ ((null));
- var /** @type {?} */ relAttr = /** @type {?} */ ((null));
- var /** @type {?} */ nonBindable = false;
- var /** @type {?} */ projectAs = /** @type {?} */ ((null));
- ast.attrs.forEach(function (attr) {
- var /** @type {?} */ lcAttrName = attr.name.toLowerCase();
- if (lcAttrName == NG_CONTENT_SELECT_ATTR) {
- selectAttr = attr.value;
- }
- else if (lcAttrName == LINK_STYLE_HREF_ATTR) {
- hrefAttr = attr.value;
- }
- else if (lcAttrName == LINK_STYLE_REL_ATTR) {
- relAttr = attr.value;
- }
- else if (attr.name == NG_NON_BINDABLE_ATTR) {
- nonBindable = true;
- }
- else if (attr.name == NG_PROJECT_AS) {
- if (attr.value.length > 0) {
- projectAs = attr.value;
- }
- }
- });
- selectAttr = normalizeNgContentSelect(selectAttr);
- var /** @type {?} */ nodeName = ast.name.toLowerCase();
- var /** @type {?} */ type = PreparsedElementType.OTHER;
- if (isNgContent(nodeName)) {
- type = PreparsedElementType.NG_CONTENT;
- }
- else if (nodeName == STYLE_ELEMENT) {
- type = PreparsedElementType.STYLE;
- }
- else if (nodeName == SCRIPT_ELEMENT) {
- type = PreparsedElementType.SCRIPT;
- }
- else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) {
- type = PreparsedElementType.STYLESHEET;
- }
- return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs);
- }
- /** @enum {number} */
- var PreparsedElementType = {
- NG_CONTENT: 0,
- STYLE: 1,
- STYLESHEET: 2,
- SCRIPT: 3,
- OTHER: 4,
- };
- PreparsedElementType[PreparsedElementType.NG_CONTENT] = "NG_CONTENT";
- PreparsedElementType[PreparsedElementType.STYLE] = "STYLE";
- PreparsedElementType[PreparsedElementType.STYLESHEET] = "STYLESHEET";
- PreparsedElementType[PreparsedElementType.SCRIPT] = "SCRIPT";
- PreparsedElementType[PreparsedElementType.OTHER] = "OTHER";
- var PreparsedElement = /** @class */ (function () {
- function PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs) {
- this.type = type;
- this.selectAttr = selectAttr;
- this.hrefAttr = hrefAttr;
- this.nonBindable = nonBindable;
- this.projectAs = projectAs;
- }
- return PreparsedElement;
- }());
- /**
- * @param {?} selectAttr
- * @return {?}
- */
- function normalizeNgContentSelect(selectAttr) {
- if (selectAttr === null || selectAttr.length === 0) {
- return '*';
- }
- return selectAttr;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @record
- */
- var DirectiveNormalizer = /** @class */ (function () {
- function DirectiveNormalizer(_resourceLoader, _urlResolver, _htmlParser, _config) {
- this._resourceLoader = _resourceLoader;
- this._urlResolver = _urlResolver;
- this._htmlParser = _htmlParser;
- this._config = _config;
- this._resourceLoaderCache = new Map();
- }
- /**
- * @return {?}
- */
- DirectiveNormalizer.prototype.clearCache = /**
- * @return {?}
- */
- function () { this._resourceLoaderCache.clear(); };
- /**
- * @param {?} normalizedDirective
- * @return {?}
- */
- DirectiveNormalizer.prototype.clearCacheFor = /**
- * @param {?} normalizedDirective
- * @return {?}
- */
- function (normalizedDirective) {
- var _this = this;
- if (!normalizedDirective.isComponent) {
- return;
- }
- var /** @type {?} */ template = /** @type {?} */ ((normalizedDirective.template));
- this._resourceLoaderCache.delete(/** @type {?} */ ((template.templateUrl)));
- template.externalStylesheets.forEach(function (stylesheet) { _this._resourceLoaderCache.delete(/** @type {?} */ ((stylesheet.moduleUrl))); });
- };
- /**
- * @param {?} url
- * @return {?}
- */
- DirectiveNormalizer.prototype._fetch = /**
- * @param {?} url
- * @return {?}
- */
- function (url) {
- var /** @type {?} */ result = this._resourceLoaderCache.get(url);
- if (!result) {
- result = this._resourceLoader.get(url);
- this._resourceLoaderCache.set(url, result);
- }
- return result;
- };
- /**
- * @param {?} prenormData
- * @return {?}
- */
- DirectiveNormalizer.prototype.normalizeTemplate = /**
- * @param {?} prenormData
- * @return {?}
- */
- function (prenormData) {
- var _this = this;
- if (isDefined(prenormData.template)) {
- if (isDefined(prenormData.templateUrl)) {
- throw syntaxError("'" + stringify(prenormData.componentType) + "' component cannot define both template and templateUrl");
- }
- if (typeof prenormData.template !== 'string') {
- throw syntaxError("The template specified for component " + stringify(prenormData.componentType) + " is not a string");
- }
- }
- else if (isDefined(prenormData.templateUrl)) {
- if (typeof prenormData.templateUrl !== 'string') {
- throw syntaxError("The templateUrl specified for component " + stringify(prenormData.componentType) + " is not a string");
- }
- }
- else {
- throw syntaxError("No template specified for component " + stringify(prenormData.componentType));
- }
- if (isDefined(prenormData.preserveWhitespaces) &&
- typeof prenormData.preserveWhitespaces !== 'boolean') {
- throw syntaxError("The preserveWhitespaces option for component " + stringify(prenormData.componentType) + " must be a boolean");
- }
- return SyncAsync.then(this._preParseTemplate(prenormData), function (preparsedTemplate) { return _this._normalizeTemplateMetadata(prenormData, preparsedTemplate); });
- };
- /**
- * @param {?} prenomData
- * @return {?}
- */
- DirectiveNormalizer.prototype._preParseTemplate = /**
- * @param {?} prenomData
- * @return {?}
- */
- function (prenomData) {
- var _this = this;
- var /** @type {?} */ template;
- var /** @type {?} */ templateUrl;
- if (prenomData.template != null) {
- template = prenomData.template;
- templateUrl = prenomData.moduleUrl;
- }
- else {
- templateUrl = this._urlResolver.resolve(prenomData.moduleUrl, /** @type {?} */ ((prenomData.templateUrl)));
- template = this._fetch(templateUrl);
- }
- return SyncAsync.then(template, function (template) { return _this._preparseLoadedTemplate(prenomData, template, templateUrl); });
- };
- /**
- * @param {?} prenormData
- * @param {?} template
- * @param {?} templateAbsUrl
- * @return {?}
- */
- DirectiveNormalizer.prototype._preparseLoadedTemplate = /**
- * @param {?} prenormData
- * @param {?} template
- * @param {?} templateAbsUrl
- * @return {?}
- */
- function (prenormData, template, templateAbsUrl) {
- var /** @type {?} */ isInline = !!prenormData.template;
- var /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((prenormData.interpolation)));
- var /** @type {?} */ rootNodesAndErrors = this._htmlParser.parse(template, templateSourceUrl({ reference: prenormData.ngModuleType }, { type: { reference: prenormData.componentType } }, { isInline: isInline, templateUrl: templateAbsUrl }), true, interpolationConfig);
- if (rootNodesAndErrors.errors.length > 0) {
- var /** @type {?} */ errorString = rootNodesAndErrors.errors.join('\n');
- throw syntaxError("Template parse errors:\n" + errorString);
- }
- var /** @type {?} */ templateMetadataStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: prenormData.styles, moduleUrl: prenormData.moduleUrl }));
- var /** @type {?} */ visitor = new TemplatePreparseVisitor();
- visitAll(visitor, rootNodesAndErrors.rootNodes);
- var /** @type {?} */ templateStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: visitor.styles, styleUrls: visitor.styleUrls, moduleUrl: templateAbsUrl }));
- var /** @type {?} */ styles = templateMetadataStyles.styles.concat(templateStyles.styles);
- var /** @type {?} */ inlineStyleUrls = templateMetadataStyles.styleUrls.concat(templateStyles.styleUrls);
- var /** @type {?} */ styleUrls = this
- ._normalizeStylesheet(new CompileStylesheetMetadata({ styleUrls: prenormData.styleUrls, moduleUrl: prenormData.moduleUrl }))
- .styleUrls;
- return {
- template: template,
- templateUrl: templateAbsUrl, isInline: isInline,
- htmlAst: rootNodesAndErrors, styles: styles, inlineStyleUrls: inlineStyleUrls, styleUrls: styleUrls,
- ngContentSelectors: visitor.ngContentSelectors,
- };
- };
- /**
- * @param {?} prenormData
- * @param {?} preparsedTemplate
- * @return {?}
- */
- DirectiveNormalizer.prototype._normalizeTemplateMetadata = /**
- * @param {?} prenormData
- * @param {?} preparsedTemplate
- * @return {?}
- */
- function (prenormData, preparsedTemplate) {
- var _this = this;
- return SyncAsync.then(this._loadMissingExternalStylesheets(preparsedTemplate.styleUrls.concat(preparsedTemplate.inlineStyleUrls)), function (externalStylesheets) {
- return _this._normalizeLoadedTemplateMetadata(prenormData, preparsedTemplate, externalStylesheets);
- });
- };
- /**
- * @param {?} prenormData
- * @param {?} preparsedTemplate
- * @param {?} stylesheets
- * @return {?}
- */
- DirectiveNormalizer.prototype._normalizeLoadedTemplateMetadata = /**
- * @param {?} prenormData
- * @param {?} preparsedTemplate
- * @param {?} stylesheets
- * @return {?}
- */
- function (prenormData, preparsedTemplate, stylesheets) {
- var _this = this;
- // Algorithm:
- // - produce exactly 1 entry per original styleUrl in
- // CompileTemplateMetadata.externalStylesheets whith all styles inlined
- // - inline all styles that are referenced by the template into CompileTemplateMetadata.styles.
- // Reason: be able to determine how many stylesheets there are even without loading
- // the template nor the stylesheets, so we can create a stub for TypeScript always synchronously
- // (as resouce loading may be async)
- var /** @type {?} */ styles = preparsedTemplate.styles.slice();
- this._inlineStyles(preparsedTemplate.inlineStyleUrls, stylesheets, styles);
- var /** @type {?} */ styleUrls = preparsedTemplate.styleUrls;
- var /** @type {?} */ externalStylesheets = styleUrls.map(function (styleUrl) {
- var /** @type {?} */ stylesheet = /** @type {?} */ ((stylesheets.get(styleUrl)));
- var /** @type {?} */ styles = stylesheet.styles.slice();
- _this._inlineStyles(stylesheet.styleUrls, stylesheets, styles);
- return new CompileStylesheetMetadata({ moduleUrl: styleUrl, styles: styles });
- });
- var /** @type {?} */ encapsulation = prenormData.encapsulation;
- if (encapsulation == null) {
- encapsulation = this._config.defaultEncapsulation;
- }
- if (encapsulation === ViewEncapsulation.Emulated && styles.length === 0 &&
- styleUrls.length === 0) {
- encapsulation = ViewEncapsulation.None;
- }
- return new CompileTemplateMetadata({
- encapsulation: encapsulation,
- template: preparsedTemplate.template,
- templateUrl: preparsedTemplate.templateUrl,
- htmlAst: preparsedTemplate.htmlAst, styles: styles, styleUrls: styleUrls,
- ngContentSelectors: preparsedTemplate.ngContentSelectors,
- animations: prenormData.animations,
- interpolation: prenormData.interpolation,
- isInline: preparsedTemplate.isInline, externalStylesheets: externalStylesheets,
- preserveWhitespaces: preserveWhitespacesDefault(prenormData.preserveWhitespaces, this._config.preserveWhitespaces),
- });
- };
- /**
- * @param {?} styleUrls
- * @param {?} stylesheets
- * @param {?} targetStyles
- * @return {?}
- */
- DirectiveNormalizer.prototype._inlineStyles = /**
- * @param {?} styleUrls
- * @param {?} stylesheets
- * @param {?} targetStyles
- * @return {?}
- */
- function (styleUrls, stylesheets, targetStyles) {
- var _this = this;
- styleUrls.forEach(function (styleUrl) {
- var /** @type {?} */ stylesheet = /** @type {?} */ ((stylesheets.get(styleUrl)));
- stylesheet.styles.forEach(function (style) { return targetStyles.push(style); });
- _this._inlineStyles(stylesheet.styleUrls, stylesheets, targetStyles);
- });
- };
- /**
- * @param {?} styleUrls
- * @param {?=} loadedStylesheets
- * @return {?}
- */
- DirectiveNormalizer.prototype._loadMissingExternalStylesheets = /**
- * @param {?} styleUrls
- * @param {?=} loadedStylesheets
- * @return {?}
- */
- function (styleUrls, loadedStylesheets) {
- var _this = this;
- if (loadedStylesheets === void 0) { loadedStylesheets = new Map(); }
- return SyncAsync.then(SyncAsync.all(styleUrls.filter(function (styleUrl) { return !loadedStylesheets.has(styleUrl); })
- .map(function (styleUrl) {
- return SyncAsync.then(_this._fetch(styleUrl), function (loadedStyle) {
- var /** @type {?} */ stylesheet = _this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: [loadedStyle], moduleUrl: styleUrl }));
- loadedStylesheets.set(styleUrl, stylesheet);
- return _this._loadMissingExternalStylesheets(stylesheet.styleUrls, loadedStylesheets);
- });
- })), function (_) { return loadedStylesheets; });
- };
- /**
- * @param {?} stylesheet
- * @return {?}
- */
- DirectiveNormalizer.prototype._normalizeStylesheet = /**
- * @param {?} stylesheet
- * @return {?}
- */
- function (stylesheet) {
- var _this = this;
- var /** @type {?} */ moduleUrl = /** @type {?} */ ((stylesheet.moduleUrl));
- var /** @type {?} */ allStyleUrls = stylesheet.styleUrls.filter(isStyleUrlResolvable)
- .map(function (url) { return _this._urlResolver.resolve(moduleUrl, url); });
- var /** @type {?} */ allStyles = stylesheet.styles.map(function (style) {
- var /** @type {?} */ styleWithImports = extractStyleUrls(_this._urlResolver, moduleUrl, style);
- allStyleUrls.push.apply(allStyleUrls, styleWithImports.styleUrls);
- return styleWithImports.style;
- });
- return new CompileStylesheetMetadata({ styles: allStyles, styleUrls: allStyleUrls, moduleUrl: moduleUrl });
- };
- return DirectiveNormalizer;
- }());
- var TemplatePreparseVisitor = /** @class */ (function () {
- function TemplatePreparseVisitor() {
- this.ngContentSelectors = [];
- this.styles = [];
- this.styleUrls = [];
- this.ngNonBindableStackCount = 0;
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- TemplatePreparseVisitor.prototype.visitElement = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var /** @type {?} */ preparsedElement = preparseElement(ast);
- switch (preparsedElement.type) {
- case PreparsedElementType.NG_CONTENT:
- if (this.ngNonBindableStackCount === 0) {
- this.ngContentSelectors.push(preparsedElement.selectAttr);
- }
- break;
- case PreparsedElementType.STYLE:
- var /** @type {?} */ textContent_1 = '';
- ast.children.forEach(function (child) {
- if (child instanceof Text) {
- textContent_1 += child.value;
- }
- });
- this.styles.push(textContent_1);
- break;
- case PreparsedElementType.STYLESHEET:
- this.styleUrls.push(preparsedElement.hrefAttr);
- break;
- default:
- break;
- }
- if (preparsedElement.nonBindable) {
- this.ngNonBindableStackCount++;
- }
- visitAll(this, ast.children);
- if (preparsedElement.nonBindable) {
- this.ngNonBindableStackCount--;
- }
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- TemplatePreparseVisitor.prototype.visitExpansion = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { visitAll(this, ast.cases); };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- TemplatePreparseVisitor.prototype.visitExpansionCase = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- visitAll(this, ast.expression);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- TemplatePreparseVisitor.prototype.visitComment = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return null; };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- TemplatePreparseVisitor.prototype.visitAttribute = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return null; };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- TemplatePreparseVisitor.prototype.visitText = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return null; };
- return TemplatePreparseVisitor;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var QUERY_METADATA_IDENTIFIERS = [
- createViewChild,
- createViewChildren,
- createContentChild,
- createContentChildren,
- ];
- var DirectiveResolver = /** @class */ (function () {
- function DirectiveResolver(_reflector) {
- this._reflector = _reflector;
- }
- /**
- * @param {?} type
- * @return {?}
- */
- DirectiveResolver.prototype.isDirective = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type));
- return typeMetadata && typeMetadata.some(isDirectiveMetadata);
- };
- /**
- * @param {?} type
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- DirectiveResolver.prototype.resolve = /**
- * @param {?} type
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- function (type, throwIfNotFound) {
- if (throwIfNotFound === void 0) { throwIfNotFound = true; }
- var /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type));
- if (typeMetadata) {
- var /** @type {?} */ metadata = findLast(typeMetadata, isDirectiveMetadata);
- if (metadata) {
- var /** @type {?} */ propertyMetadata = this._reflector.propMetadata(type);
- var /** @type {?} */ guards = this._reflector.guards(type);
- return this._mergeWithPropertyMetadata(metadata, propertyMetadata, guards, type);
- }
- }
- if (throwIfNotFound) {
- throw new Error("No Directive annotation found on " + stringify(type));
- }
- return null;
- };
- /**
- * @param {?} dm
- * @param {?} propertyMetadata
- * @param {?} guards
- * @param {?} directiveType
- * @return {?}
- */
- DirectiveResolver.prototype._mergeWithPropertyMetadata = /**
- * @param {?} dm
- * @param {?} propertyMetadata
- * @param {?} guards
- * @param {?} directiveType
- * @return {?}
- */
- function (dm, propertyMetadata, guards, directiveType) {
- var /** @type {?} */ inputs = [];
- var /** @type {?} */ outputs = [];
- var /** @type {?} */ host = {};
- var /** @type {?} */ queries = {};
- Object.keys(propertyMetadata).forEach(function (propName) {
- var /** @type {?} */ input = findLast(propertyMetadata[propName], function (a) { return createInput.isTypeOf(a); });
- if (input) {
- if (input.bindingPropertyName) {
- inputs.push(propName + ": " + input.bindingPropertyName);
- }
- else {
- inputs.push(propName);
- }
- }
- var /** @type {?} */ output = findLast(propertyMetadata[propName], function (a) { return createOutput.isTypeOf(a); });
- if (output) {
- if (output.bindingPropertyName) {
- outputs.push(propName + ": " + output.bindingPropertyName);
- }
- else {
- outputs.push(propName);
- }
- }
- var /** @type {?} */ hostBindings = propertyMetadata[propName].filter(function (a) { return createHostBinding.isTypeOf(a); });
- hostBindings.forEach(function (hostBinding) {
- if (hostBinding.hostPropertyName) {
- var /** @type {?} */ startWith = hostBinding.hostPropertyName[0];
- if (startWith === '(') {
- throw new Error("@HostBinding can not bind to events. Use @HostListener instead.");
- }
- else if (startWith === '[') {
- throw new Error("@HostBinding parameter should be a property name, 'class.<name>', or 'attr.<name>'.");
- }
- host["[" + hostBinding.hostPropertyName + "]"] = propName;
- }
- else {
- host["[" + propName + "]"] = propName;
- }
- });
- var /** @type {?} */ hostListeners = propertyMetadata[propName].filter(function (a) { return createHostListener.isTypeOf(a); });
- hostListeners.forEach(function (hostListener) {
- var /** @type {?} */ args = hostListener.args || [];
- host["(" + hostListener.eventName + ")"] = propName + "(" + args.join(',') + ")";
- });
- var /** @type {?} */ query = findLast(propertyMetadata[propName], function (a) { return QUERY_METADATA_IDENTIFIERS.some(function (i) { return i.isTypeOf(a); }); });
- if (query) {
- queries[propName] = query;
- }
- });
- return this._merge(dm, inputs, outputs, host, queries, guards, directiveType);
- };
- /**
- * @param {?} def
- * @return {?}
- */
- DirectiveResolver.prototype._extractPublicName = /**
- * @param {?} def
- * @return {?}
- */
- function (def) { return splitAtColon(def, [/** @type {?} */ ((null)), def])[1].trim(); };
- /**
- * @param {?} bindings
- * @return {?}
- */
- DirectiveResolver.prototype._dedupeBindings = /**
- * @param {?} bindings
- * @return {?}
- */
- function (bindings) {
- var /** @type {?} */ names = new Set();
- var /** @type {?} */ publicNames = new Set();
- var /** @type {?} */ reversedResult = [];
- // go last to first to allow later entries to overwrite previous entries
- for (var /** @type {?} */ i = bindings.length - 1; i >= 0; i--) {
- var /** @type {?} */ binding = bindings[i];
- var /** @type {?} */ name_1 = this._extractPublicName(binding);
- publicNames.add(name_1);
- if (!names.has(name_1)) {
- names.add(name_1);
- reversedResult.push(binding);
- }
- }
- return reversedResult.reverse();
- };
- /**
- * @param {?} directive
- * @param {?} inputs
- * @param {?} outputs
- * @param {?} host
- * @param {?} queries
- * @param {?} guards
- * @param {?} directiveType
- * @return {?}
- */
- DirectiveResolver.prototype._merge = /**
- * @param {?} directive
- * @param {?} inputs
- * @param {?} outputs
- * @param {?} host
- * @param {?} queries
- * @param {?} guards
- * @param {?} directiveType
- * @return {?}
- */
- function (directive, inputs, outputs, host, queries, guards, directiveType) {
- var /** @type {?} */ mergedInputs = this._dedupeBindings(directive.inputs ? directive.inputs.concat(inputs) : inputs);
- var /** @type {?} */ mergedOutputs = this._dedupeBindings(directive.outputs ? directive.outputs.concat(outputs) : outputs);
- var /** @type {?} */ mergedHost = directive.host ? Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, directive.host, host) : host;
- var /** @type {?} */ mergedQueries = directive.queries ? Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, directive.queries, queries) : queries;
- if (createComponent.isTypeOf(directive)) {
- var /** @type {?} */ comp = /** @type {?} */ (directive);
- return createComponent({
- selector: comp.selector,
- inputs: mergedInputs,
- outputs: mergedOutputs,
- host: mergedHost,
- exportAs: comp.exportAs,
- moduleId: comp.moduleId,
- queries: mergedQueries,
- changeDetection: comp.changeDetection,
- providers: comp.providers,
- viewProviders: comp.viewProviders,
- entryComponents: comp.entryComponents,
- template: comp.template,
- templateUrl: comp.templateUrl,
- styles: comp.styles,
- styleUrls: comp.styleUrls,
- encapsulation: comp.encapsulation,
- animations: comp.animations,
- interpolation: comp.interpolation,
- preserveWhitespaces: directive.preserveWhitespaces,
- });
- }
- else {
- return createDirective({
- selector: directive.selector,
- inputs: mergedInputs,
- outputs: mergedOutputs,
- host: mergedHost,
- exportAs: directive.exportAs,
- queries: mergedQueries,
- providers: directive.providers, guards: guards
- });
- }
- };
- return DirectiveResolver;
- }());
- /**
- * @param {?} type
- * @return {?}
- */
- function isDirectiveMetadata(type) {
- return createDirective.isTypeOf(type) || createComponent.isTypeOf(type);
- }
- /**
- * @template T
- * @param {?} arr
- * @param {?} condition
- * @return {?}
- */
- function findLast(arr, condition) {
- for (var /** @type {?} */ i = arr.length - 1; i >= 0; i--) {
- if (condition(arr[i])) {
- return arr[i];
- }
- }
- return null;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var $EOF = 0;
- var $TAB = 9;
- var $LF = 10;
- var $VTAB = 11;
- var $FF = 12;
- var $CR = 13;
- var $SPACE = 32;
- var $BANG = 33;
- var $DQ = 34;
- var $HASH = 35;
- var $$ = 36;
- var $PERCENT = 37;
- var $AMPERSAND = 38;
- var $SQ = 39;
- var $LPAREN = 40;
- var $RPAREN = 41;
- var $STAR = 42;
- var $PLUS = 43;
- var $COMMA = 44;
- var $MINUS = 45;
- var $PERIOD = 46;
- var $SLASH = 47;
- var $COLON = 58;
- var $SEMICOLON = 59;
- var $LT = 60;
- var $EQ = 61;
- var $GT = 62;
- var $QUESTION = 63;
- var $0 = 48;
- var $9 = 57;
- var $A = 65;
- var $E = 69;
- var $F = 70;
- var $X = 88;
- var $Z = 90;
- var $LBRACKET = 91;
- var $BACKSLASH = 92;
- var $RBRACKET = 93;
- var $CARET = 94;
- var $_ = 95;
- var $a = 97;
- var $e = 101;
- var $f = 102;
- var $n = 110;
- var $r = 114;
- var $t = 116;
- var $u = 117;
- var $v = 118;
- var $x = 120;
- var $z = 122;
- var $LBRACE = 123;
- var $BAR = 124;
- var $RBRACE = 125;
- var $NBSP = 160;
- var $BT = 96;
- /**
- * @param {?} code
- * @return {?}
- */
- function isWhitespace(code) {
- return (code >= $TAB && code <= $SPACE) || (code == $NBSP);
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isDigit(code) {
- return $0 <= code && code <= $9;
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isAsciiLetter(code) {
- return code >= $a && code <= $z || code >= $A && code <= $Z;
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isAsciiHexDigit(code) {
- return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var TokenType = {
- Character: 0,
- Identifier: 1,
- Keyword: 2,
- String: 3,
- Operator: 4,
- Number: 5,
- Error: 6,
- };
- TokenType[TokenType.Character] = "Character";
- TokenType[TokenType.Identifier] = "Identifier";
- TokenType[TokenType.Keyword] = "Keyword";
- TokenType[TokenType.String] = "String";
- TokenType[TokenType.Operator] = "Operator";
- TokenType[TokenType.Number] = "Number";
- TokenType[TokenType.Error] = "Error";
- var KEYWORDS = ['var', 'let', 'as', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this'];
- var Lexer = /** @class */ (function () {
- function Lexer() {
- }
- /**
- * @param {?} text
- * @return {?}
- */
- Lexer.prototype.tokenize = /**
- * @param {?} text
- * @return {?}
- */
- function (text) {
- var /** @type {?} */ scanner = new _Scanner(text);
- var /** @type {?} */ tokens = [];
- var /** @type {?} */ token = scanner.scanToken();
- while (token != null) {
- tokens.push(token);
- token = scanner.scanToken();
- }
- return tokens;
- };
- return Lexer;
- }());
- var Token = /** @class */ (function () {
- function Token(index, type, numValue, strValue) {
- this.index = index;
- this.type = type;
- this.numValue = numValue;
- this.strValue = strValue;
- }
- /**
- * @param {?} code
- * @return {?}
- */
- Token.prototype.isCharacter = /**
- * @param {?} code
- * @return {?}
- */
- function (code) {
- return this.type == TokenType.Character && this.numValue == code;
- };
- /**
- * @return {?}
- */
- Token.prototype.isNumber = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Number; };
- /**
- * @return {?}
- */
- Token.prototype.isString = /**
- * @return {?}
- */
- function () { return this.type == TokenType.String; };
- /**
- * @param {?} operater
- * @return {?}
- */
- Token.prototype.isOperator = /**
- * @param {?} operater
- * @return {?}
- */
- function (operater) {
- return this.type == TokenType.Operator && this.strValue == operater;
- };
- /**
- * @return {?}
- */
- Token.prototype.isIdentifier = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Identifier; };
- /**
- * @return {?}
- */
- Token.prototype.isKeyword = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Keyword; };
- /**
- * @return {?}
- */
- Token.prototype.isKeywordLet = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Keyword && this.strValue == 'let'; };
- /**
- * @return {?}
- */
- Token.prototype.isKeywordAs = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Keyword && this.strValue == 'as'; };
- /**
- * @return {?}
- */
- Token.prototype.isKeywordNull = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Keyword && this.strValue == 'null'; };
- /**
- * @return {?}
- */
- Token.prototype.isKeywordUndefined = /**
- * @return {?}
- */
- function () {
- return this.type == TokenType.Keyword && this.strValue == 'undefined';
- };
- /**
- * @return {?}
- */
- Token.prototype.isKeywordTrue = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Keyword && this.strValue == 'true'; };
- /**
- * @return {?}
- */
- Token.prototype.isKeywordFalse = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Keyword && this.strValue == 'false'; };
- /**
- * @return {?}
- */
- Token.prototype.isKeywordThis = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Keyword && this.strValue == 'this'; };
- /**
- * @return {?}
- */
- Token.prototype.isError = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Error; };
- /**
- * @return {?}
- */
- Token.prototype.toNumber = /**
- * @return {?}
- */
- function () { return this.type == TokenType.Number ? this.numValue : -1; };
- /**
- * @return {?}
- */
- Token.prototype.toString = /**
- * @return {?}
- */
- function () {
- switch (this.type) {
- case TokenType.Character:
- case TokenType.Identifier:
- case TokenType.Keyword:
- case TokenType.Operator:
- case TokenType.String:
- case TokenType.Error:
- return this.strValue;
- case TokenType.Number:
- return this.numValue.toString();
- default:
- return null;
- }
- };
- return Token;
- }());
- /**
- * @param {?} index
- * @param {?} code
- * @return {?}
- */
- function newCharacterToken(index, code) {
- return new Token(index, TokenType.Character, code, String.fromCharCode(code));
- }
- /**
- * @param {?} index
- * @param {?} text
- * @return {?}
- */
- function newIdentifierToken(index, text) {
- return new Token(index, TokenType.Identifier, 0, text);
- }
- /**
- * @param {?} index
- * @param {?} text
- * @return {?}
- */
- function newKeywordToken(index, text) {
- return new Token(index, TokenType.Keyword, 0, text);
- }
- /**
- * @param {?} index
- * @param {?} text
- * @return {?}
- */
- function newOperatorToken(index, text) {
- return new Token(index, TokenType.Operator, 0, text);
- }
- /**
- * @param {?} index
- * @param {?} text
- * @return {?}
- */
- function newStringToken(index, text) {
- return new Token(index, TokenType.String, 0, text);
- }
- /**
- * @param {?} index
- * @param {?} n
- * @return {?}
- */
- function newNumberToken(index, n) {
- return new Token(index, TokenType.Number, n, '');
- }
- /**
- * @param {?} index
- * @param {?} message
- * @return {?}
- */
- function newErrorToken(index, message) {
- return new Token(index, TokenType.Error, 0, message);
- }
- var EOF = new Token(-1, TokenType.Character, 0, '');
- var _Scanner = /** @class */ (function () {
- function _Scanner(input) {
- this.input = input;
- this.peek = 0;
- this.index = -1;
- this.length = input.length;
- this.advance();
- }
- /**
- * @return {?}
- */
- _Scanner.prototype.advance = /**
- * @return {?}
- */
- function () {
- this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index);
- };
- /**
- * @return {?}
- */
- _Scanner.prototype.scanToken = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ input = this.input, /** @type {?} */ length = this.length;
- var /** @type {?} */ peek = this.peek, /** @type {?} */ index = this.index;
- // Skip whitespace.
- while (peek <= $SPACE) {
- if (++index >= length) {
- peek = $EOF;
- break;
- }
- else {
- peek = input.charCodeAt(index);
- }
- }
- this.peek = peek;
- this.index = index;
- if (index >= length) {
- return null;
- }
- // Handle identifiers and numbers.
- if (isIdentifierStart(peek))
- return this.scanIdentifier();
- if (isDigit(peek))
- return this.scanNumber(index);
- var /** @type {?} */ start = index;
- switch (peek) {
- case $PERIOD:
- this.advance();
- return isDigit(this.peek) ? this.scanNumber(start) :
- newCharacterToken(start, $PERIOD);
- case $LPAREN:
- case $RPAREN:
- case $LBRACE:
- case $RBRACE:
- case $LBRACKET:
- case $RBRACKET:
- case $COMMA:
- case $COLON:
- case $SEMICOLON:
- return this.scanCharacter(start, peek);
- case $SQ:
- case $DQ:
- return this.scanString();
- case $HASH:
- case $PLUS:
- case $MINUS:
- case $STAR:
- case $SLASH:
- case $PERCENT:
- case $CARET:
- return this.scanOperator(start, String.fromCharCode(peek));
- case $QUESTION:
- return this.scanComplexOperator(start, '?', $PERIOD, '.');
- case $LT:
- case $GT:
- return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=');
- case $BANG:
- case $EQ:
- return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=', $EQ, '=');
- case $AMPERSAND:
- return this.scanComplexOperator(start, '&', $AMPERSAND, '&');
- case $BAR:
- return this.scanComplexOperator(start, '|', $BAR, '|');
- case $NBSP:
- while (isWhitespace(this.peek))
- this.advance();
- return this.scanToken();
- }
- this.advance();
- return this.error("Unexpected character [" + String.fromCharCode(peek) + "]", 0);
- };
- /**
- * @param {?} start
- * @param {?} code
- * @return {?}
- */
- _Scanner.prototype.scanCharacter = /**
- * @param {?} start
- * @param {?} code
- * @return {?}
- */
- function (start, code) {
- this.advance();
- return newCharacterToken(start, code);
- };
- /**
- * @param {?} start
- * @param {?} str
- * @return {?}
- */
- _Scanner.prototype.scanOperator = /**
- * @param {?} start
- * @param {?} str
- * @return {?}
- */
- function (start, str) {
- this.advance();
- return newOperatorToken(start, str);
- };
- /**
- * Tokenize a 2/3 char long operator
- *
- * @param start start index in the expression
- * @param one first symbol (always part of the operator)
- * @param twoCode code point for the second symbol
- * @param two second symbol (part of the operator when the second code point matches)
- * @param threeCode code point for the third symbol
- * @param three third symbol (part of the operator when provided and matches source expression)
- */
- /**
- * Tokenize a 2/3 char long operator
- *
- * @param {?} start start index in the expression
- * @param {?} one first symbol (always part of the operator)
- * @param {?} twoCode code point for the second symbol
- * @param {?} two second symbol (part of the operator when the second code point matches)
- * @param {?=} threeCode code point for the third symbol
- * @param {?=} three third symbol (part of the operator when provided and matches source expression)
- * @return {?}
- */
- _Scanner.prototype.scanComplexOperator = /**
- * Tokenize a 2/3 char long operator
- *
- * @param {?} start start index in the expression
- * @param {?} one first symbol (always part of the operator)
- * @param {?} twoCode code point for the second symbol
- * @param {?} two second symbol (part of the operator when the second code point matches)
- * @param {?=} threeCode code point for the third symbol
- * @param {?=} three third symbol (part of the operator when provided and matches source expression)
- * @return {?}
- */
- function (start, one, twoCode, two, threeCode, three) {
- this.advance();
- var /** @type {?} */ str = one;
- if (this.peek == twoCode) {
- this.advance();
- str += two;
- }
- if (threeCode != null && this.peek == threeCode) {
- this.advance();
- str += three;
- }
- return newOperatorToken(start, str);
- };
- /**
- * @return {?}
- */
- _Scanner.prototype.scanIdentifier = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ start = this.index;
- this.advance();
- while (isIdentifierPart(this.peek))
- this.advance();
- var /** @type {?} */ str = this.input.substring(start, this.index);
- return KEYWORDS.indexOf(str) > -1 ? newKeywordToken(start, str) :
- newIdentifierToken(start, str);
- };
- /**
- * @param {?} start
- * @return {?}
- */
- _Scanner.prototype.scanNumber = /**
- * @param {?} start
- * @return {?}
- */
- function (start) {
- var /** @type {?} */ simple = (this.index === start);
- this.advance(); // Skip initial digit.
- while (true) {
- if (isDigit(this.peek)) {
- // Do nothing.
- }
- else if (this.peek == $PERIOD) {
- simple = false;
- }
- else if (isExponentStart(this.peek)) {
- this.advance();
- if (isExponentSign(this.peek))
- this.advance();
- if (!isDigit(this.peek))
- return this.error('Invalid exponent', -1);
- simple = false;
- }
- else {
- break;
- }
- this.advance();
- }
- var /** @type {?} */ str = this.input.substring(start, this.index);
- var /** @type {?} */ value = simple ? parseIntAutoRadix(str) : parseFloat(str);
- return newNumberToken(start, value);
- };
- /**
- * @return {?}
- */
- _Scanner.prototype.scanString = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ start = this.index;
- var /** @type {?} */ quote = this.peek;
- this.advance(); // Skip initial quote.
- var /** @type {?} */ buffer = '';
- var /** @type {?} */ marker = this.index;
- var /** @type {?} */ input = this.input;
- while (this.peek != quote) {
- if (this.peek == $BACKSLASH) {
- buffer += input.substring(marker, this.index);
- this.advance();
- var /** @type {?} */ unescapedCode = void 0;
- // Workaround for TS2.1-introduced type strictness
- this.peek = this.peek;
- if (this.peek == $u) {
- // 4 character hex code for unicode character.
- var /** @type {?} */ hex = input.substring(this.index + 1, this.index + 5);
- if (/^[0-9a-f]+$/i.test(hex)) {
- unescapedCode = parseInt(hex, 16);
- }
- else {
- return this.error("Invalid unicode escape [\\u" + hex + "]", 0);
- }
- for (var /** @type {?} */ i = 0; i < 5; i++) {
- this.advance();
- }
- }
- else {
- unescapedCode = unescape(this.peek);
- this.advance();
- }
- buffer += String.fromCharCode(unescapedCode);
- marker = this.index;
- }
- else if (this.peek == $EOF) {
- return this.error('Unterminated quote', 0);
- }
- else {
- this.advance();
- }
- }
- var /** @type {?} */ last = input.substring(marker, this.index);
- this.advance(); // Skip terminating quote.
- return newStringToken(start, buffer + last);
- };
- /**
- * @param {?} message
- * @param {?} offset
- * @return {?}
- */
- _Scanner.prototype.error = /**
- * @param {?} message
- * @param {?} offset
- * @return {?}
- */
- function (message, offset) {
- var /** @type {?} */ position = this.index + offset;
- return newErrorToken(position, "Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]");
- };
- return _Scanner;
- }());
- /**
- * @param {?} code
- * @return {?}
- */
- function isIdentifierStart(code) {
- return ($a <= code && code <= $z) || ($A <= code && code <= $Z) ||
- (code == $_) || (code == $$);
- }
- /**
- * @param {?} input
- * @return {?}
- */
- function isIdentifier(input) {
- if (input.length == 0)
- return false;
- var /** @type {?} */ scanner = new _Scanner(input);
- if (!isIdentifierStart(scanner.peek))
- return false;
- scanner.advance();
- while (scanner.peek !== $EOF) {
- if (!isIdentifierPart(scanner.peek))
- return false;
- scanner.advance();
- }
- return true;
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isIdentifierPart(code) {
- return isAsciiLetter(code) || isDigit(code) || (code == $_) ||
- (code == $$);
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isExponentStart(code) {
- return code == $e || code == $E;
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isExponentSign(code) {
- return code == $MINUS || code == $PLUS;
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isQuote(code) {
- return code === $SQ || code === $DQ || code === $BT;
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function unescape(code) {
- switch (code) {
- case $n:
- return $LF;
- case $f:
- return $FF;
- case $r:
- return $CR;
- case $t:
- return $TAB;
- case $v:
- return $VTAB;
- default:
- return code;
- }
- }
- /**
- * @param {?} text
- * @return {?}
- */
- function parseIntAutoRadix(text) {
- var /** @type {?} */ result = parseInt(text);
- if (isNaN(result)) {
- throw new Error('Invalid integer literal when parsing ' + text);
- }
- return result;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ParserError = /** @class */ (function () {
- function ParserError(message, input, errLocation, ctxLocation) {
- this.input = input;
- this.errLocation = errLocation;
- this.ctxLocation = ctxLocation;
- this.message = "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation;
- }
- return ParserError;
- }());
- var ParseSpan = /** @class */ (function () {
- function ParseSpan(start, end) {
- this.start = start;
- this.end = end;
- }
- return ParseSpan;
- }());
- var AST = /** @class */ (function () {
- function AST(span) {
- this.span = span;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- AST.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return null;
- };
- /**
- * @return {?}
- */
- AST.prototype.toString = /**
- * @return {?}
- */
- function () { return 'AST'; };
- return AST;
- }());
- /**
- * Represents a quoted expression of the form:
- *
- * quote = prefix `:` uninterpretedExpression
- * prefix = identifier
- * uninterpretedExpression = arbitrary string
- *
- * A quoted expression is meant to be pre-processed by an AST transformer that
- * converts it into another AST that no longer contains quoted expressions.
- * It is meant to allow third-party developers to extend Angular template
- * expression language. The `uninterpretedExpression` part of the quote is
- * therefore not interpreted by the Angular's own expression parser.
- */
- var Quote = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Quote, _super);
- function Quote(span, prefix, uninterpretedExpression, location) {
- var _this = _super.call(this, span) || this;
- _this.prefix = prefix;
- _this.uninterpretedExpression = uninterpretedExpression;
- _this.location = location;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- Quote.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitQuote(this, context);
- };
- /**
- * @return {?}
- */
- Quote.prototype.toString = /**
- * @return {?}
- */
- function () { return 'Quote'; };
- return Quote;
- }(AST));
- var EmptyExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(EmptyExpr, _super);
- function EmptyExpr() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- EmptyExpr.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- // do nothing
- };
- return EmptyExpr;
- }(AST));
- var ImplicitReceiver = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ImplicitReceiver, _super);
- function ImplicitReceiver() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- ImplicitReceiver.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitImplicitReceiver(this, context);
- };
- return ImplicitReceiver;
- }(AST));
- /**
- * Multiple expressions separated by a semicolon.
- */
- var Chain = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Chain, _super);
- function Chain(span, expressions) {
- var _this = _super.call(this, span) || this;
- _this.expressions = expressions;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- Chain.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitChain(this, context);
- };
- return Chain;
- }(AST));
- var Conditional = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Conditional, _super);
- function Conditional(span, condition, trueExp, falseExp) {
- var _this = _super.call(this, span) || this;
- _this.condition = condition;
- _this.trueExp = trueExp;
- _this.falseExp = falseExp;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- Conditional.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitConditional(this, context);
- };
- return Conditional;
- }(AST));
- var PropertyRead = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PropertyRead, _super);
- function PropertyRead(span, receiver, name) {
- var _this = _super.call(this, span) || this;
- _this.receiver = receiver;
- _this.name = name;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- PropertyRead.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitPropertyRead(this, context);
- };
- return PropertyRead;
- }(AST));
- var PropertyWrite = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PropertyWrite, _super);
- function PropertyWrite(span, receiver, name, value) {
- var _this = _super.call(this, span) || this;
- _this.receiver = receiver;
- _this.name = name;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- PropertyWrite.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitPropertyWrite(this, context);
- };
- return PropertyWrite;
- }(AST));
- var SafePropertyRead = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(SafePropertyRead, _super);
- function SafePropertyRead(span, receiver, name) {
- var _this = _super.call(this, span) || this;
- _this.receiver = receiver;
- _this.name = name;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- SafePropertyRead.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitSafePropertyRead(this, context);
- };
- return SafePropertyRead;
- }(AST));
- var KeyedRead = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(KeyedRead, _super);
- function KeyedRead(span, obj, key) {
- var _this = _super.call(this, span) || this;
- _this.obj = obj;
- _this.key = key;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- KeyedRead.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitKeyedRead(this, context);
- };
- return KeyedRead;
- }(AST));
- var KeyedWrite = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(KeyedWrite, _super);
- function KeyedWrite(span, obj, key, value) {
- var _this = _super.call(this, span) || this;
- _this.obj = obj;
- _this.key = key;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- KeyedWrite.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitKeyedWrite(this, context);
- };
- return KeyedWrite;
- }(AST));
- var BindingPipe = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BindingPipe, _super);
- function BindingPipe(span, exp, name, args) {
- var _this = _super.call(this, span) || this;
- _this.exp = exp;
- _this.name = name;
- _this.args = args;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- BindingPipe.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitPipe(this, context);
- };
- return BindingPipe;
- }(AST));
- var LiteralPrimitive = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralPrimitive, _super);
- function LiteralPrimitive(span, value) {
- var _this = _super.call(this, span) || this;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- LiteralPrimitive.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitLiteralPrimitive(this, context);
- };
- return LiteralPrimitive;
- }(AST));
- var LiteralArray = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralArray, _super);
- function LiteralArray(span, expressions) {
- var _this = _super.call(this, span) || this;
- _this.expressions = expressions;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- LiteralArray.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitLiteralArray(this, context);
- };
- return LiteralArray;
- }(AST));
- var LiteralMap = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralMap, _super);
- function LiteralMap(span, keys, values) {
- var _this = _super.call(this, span) || this;
- _this.keys = keys;
- _this.values = values;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- LiteralMap.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitLiteralMap(this, context);
- };
- return LiteralMap;
- }(AST));
- var Interpolation = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Interpolation, _super);
- function Interpolation(span, strings, expressions) {
- var _this = _super.call(this, span) || this;
- _this.strings = strings;
- _this.expressions = expressions;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- Interpolation.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitInterpolation(this, context);
- };
- return Interpolation;
- }(AST));
- var Binary = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Binary, _super);
- function Binary(span, operation, left, right) {
- var _this = _super.call(this, span) || this;
- _this.operation = operation;
- _this.left = left;
- _this.right = right;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- Binary.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitBinary(this, context);
- };
- return Binary;
- }(AST));
- var PrefixNot = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PrefixNot, _super);
- function PrefixNot(span, expression) {
- var _this = _super.call(this, span) || this;
- _this.expression = expression;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- PrefixNot.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitPrefixNot(this, context);
- };
- return PrefixNot;
- }(AST));
- var NonNullAssert = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NonNullAssert, _super);
- function NonNullAssert(span, expression) {
- var _this = _super.call(this, span) || this;
- _this.expression = expression;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- NonNullAssert.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitNonNullAssert(this, context);
- };
- return NonNullAssert;
- }(AST));
- var MethodCall = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(MethodCall, _super);
- function MethodCall(span, receiver, name, args) {
- var _this = _super.call(this, span) || this;
- _this.receiver = receiver;
- _this.name = name;
- _this.args = args;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- MethodCall.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitMethodCall(this, context);
- };
- return MethodCall;
- }(AST));
- var SafeMethodCall = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(SafeMethodCall, _super);
- function SafeMethodCall(span, receiver, name, args) {
- var _this = _super.call(this, span) || this;
- _this.receiver = receiver;
- _this.name = name;
- _this.args = args;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- SafeMethodCall.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitSafeMethodCall(this, context);
- };
- return SafeMethodCall;
- }(AST));
- var FunctionCall = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FunctionCall, _super);
- function FunctionCall(span, target, args) {
- var _this = _super.call(this, span) || this;
- _this.target = target;
- _this.args = args;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- FunctionCall.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return visitor.visitFunctionCall(this, context);
- };
- return FunctionCall;
- }(AST));
- var ASTWithSource = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ASTWithSource, _super);
- function ASTWithSource(ast, source, location, errors) {
- var _this = _super.call(this, new ParseSpan(0, source == null ? 0 : source.length)) || this;
- _this.ast = ast;
- _this.source = source;
- _this.location = location;
- _this.errors = errors;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- ASTWithSource.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) {
- if (context === void 0) { context = null; }
- return this.ast.visit(visitor, context);
- };
- /**
- * @return {?}
- */
- ASTWithSource.prototype.toString = /**
- * @return {?}
- */
- function () { return this.source + " in " + this.location; };
- return ASTWithSource;
- }(AST));
- var TemplateBinding = /** @class */ (function () {
- function TemplateBinding(span, key, keyIsVar, name, expression) {
- this.span = span;
- this.key = key;
- this.keyIsVar = keyIsVar;
- this.name = name;
- this.expression = expression;
- }
- return TemplateBinding;
- }());
- /**
- * @record
- */
- var NullAstVisitor = /** @class */ (function () {
- function NullAstVisitor() {
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitBinary = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitChain = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitConditional = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitFunctionCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitImplicitReceiver = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitInterpolation = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitKeyedRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitKeyedWrite = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitLiteralArray = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitLiteralMap = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitLiteralPrimitive = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitMethodCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitPipe = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitPrefixNot = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitNonNullAssert = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitPropertyRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitPropertyWrite = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitQuote = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitSafeMethodCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- NullAstVisitor.prototype.visitSafePropertyRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- return NullAstVisitor;
- }());
- var RecursiveAstVisitor = /** @class */ (function () {
- function RecursiveAstVisitor() {
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitBinary = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.left.visit(this);
- ast.right.visit(this);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitChain = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return this.visitAll(ast.expressions, context); };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitConditional = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.condition.visit(this);
- ast.trueExp.visit(this);
- ast.falseExp.visit(this);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitPipe = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.exp.visit(this);
- this.visitAll(ast.args, context);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitFunctionCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- /** @type {?} */ ((ast.target)).visit(this);
- this.visitAll(ast.args, context);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitImplicitReceiver = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return null; };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitInterpolation = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.visitAll(ast.expressions, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitKeyedRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.obj.visit(this);
- ast.key.visit(this);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitKeyedWrite = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.obj.visit(this);
- ast.key.visit(this);
- ast.value.visit(this);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitLiteralArray = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.visitAll(ast.expressions, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitLiteralMap = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return this.visitAll(ast.values, context); };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitLiteralPrimitive = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return null; };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitMethodCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visit(this);
- return this.visitAll(ast.args, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitPrefixNot = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.expression.visit(this);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitNonNullAssert = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.expression.visit(this);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitPropertyRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visit(this);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitPropertyWrite = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visit(this);
- ast.value.visit(this);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitSafePropertyRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visit(this);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitSafeMethodCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visit(this);
- return this.visitAll(ast.args, context);
- };
- /**
- * @param {?} asts
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitAll = /**
- * @param {?} asts
- * @param {?} context
- * @return {?}
- */
- function (asts, context) {
- var _this = this;
- asts.forEach(function (ast) { return ast.visit(_this, context); });
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitQuote = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return null; };
- return RecursiveAstVisitor;
- }());
- var AstTransformer = /** @class */ (function () {
- function AstTransformer() {
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitImplicitReceiver = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return ast; };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitInterpolation = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new Interpolation(ast.span, ast.strings, this.visitAll(ast.expressions));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitLiteralPrimitive = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new LiteralPrimitive(ast.span, ast.value);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitPropertyRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new PropertyRead(ast.span, ast.receiver.visit(this), ast.name);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitPropertyWrite = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new PropertyWrite(ast.span, ast.receiver.visit(this), ast.name, ast.value.visit(this));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitSafePropertyRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new SafePropertyRead(ast.span, ast.receiver.visit(this), ast.name);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitMethodCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new MethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitSafeMethodCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new SafeMethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitFunctionCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new FunctionCall(ast.span, /** @type {?} */ ((ast.target)).visit(this), this.visitAll(ast.args));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitLiteralArray = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new LiteralArray(ast.span, this.visitAll(ast.expressions));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitLiteralMap = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new LiteralMap(ast.span, ast.keys, this.visitAll(ast.values));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitBinary = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new Binary(ast.span, ast.operation, ast.left.visit(this), ast.right.visit(this));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitPrefixNot = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new PrefixNot(ast.span, ast.expression.visit(this));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitNonNullAssert = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new NonNullAssert(ast.span, ast.expression.visit(this));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitConditional = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new Conditional(ast.span, ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitPipe = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new BindingPipe(ast.span, ast.exp.visit(this), ast.name, this.visitAll(ast.args));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitKeyedRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new KeyedRead(ast.span, ast.obj.visit(this), ast.key.visit(this));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitKeyedWrite = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new KeyedWrite(ast.span, ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this));
- };
- /**
- * @param {?} asts
- * @return {?}
- */
- AstTransformer.prototype.visitAll = /**
- * @param {?} asts
- * @return {?}
- */
- function (asts) {
- var /** @type {?} */ res = new Array(asts.length);
- for (var /** @type {?} */ i = 0; i < asts.length; ++i) {
- res[i] = asts[i].visit(this);
- }
- return res;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitChain = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new Chain(ast.span, this.visitAll(ast.expressions));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitQuote = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return new Quote(ast.span, ast.prefix, ast.uninterpretedExpression, ast.location);
- };
- return AstTransformer;
- }());
- /**
- * @param {?} ast
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function visitAstChildren(ast, visitor, context) {
- /**
- * @param {?} ast
- * @return {?}
- */
- function visit(ast) {
- visitor.visit && visitor.visit(ast, context) || ast.visit(visitor, context);
- }
- /**
- * @template T
- * @param {?} asts
- * @return {?}
- */
- function visitAll(asts) { asts.forEach(visit); }
- ast.visit({
- visitBinary: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- visit(ast.left);
- visit(ast.right);
- },
- visitChain: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { visitAll(ast.expressions); },
- visitConditional: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- visit(ast.condition);
- visit(ast.trueExp);
- visit(ast.falseExp);
- },
- visitFunctionCall: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- if (ast.target) {
- visit(ast.target);
- }
- visitAll(ast.args);
- },
- visitImplicitReceiver: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { },
- visitInterpolation: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { visitAll(ast.expressions); },
- visitKeyedRead: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- visit(ast.obj);
- visit(ast.key);
- },
- visitKeyedWrite: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- visit(ast.obj);
- visit(ast.key);
- visit(ast.obj);
- },
- visitLiteralArray: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { visitAll(ast.expressions); },
- visitLiteralMap: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { },
- visitLiteralPrimitive: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { },
- visitMethodCall: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- visit(ast.receiver);
- visitAll(ast.args);
- },
- visitPipe: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- visit(ast.exp);
- visitAll(ast.args);
- },
- visitPrefixNot: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { visit(ast.expression); },
- visitNonNullAssert: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { visit(ast.expression); },
- visitPropertyRead: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { visit(ast.receiver); },
- visitPropertyWrite: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- visit(ast.receiver);
- visit(ast.value);
- },
- visitQuote: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { },
- visitSafeMethodCall: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- visit(ast.receiver);
- visitAll(ast.args);
- },
- visitSafePropertyRead: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { visit(ast.receiver); },
- });
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var SplitInterpolation = /** @class */ (function () {
- function SplitInterpolation(strings, expressions, offsets) {
- this.strings = strings;
- this.expressions = expressions;
- this.offsets = offsets;
- }
- return SplitInterpolation;
- }());
- var TemplateBindingParseResult = /** @class */ (function () {
- function TemplateBindingParseResult(templateBindings, warnings, errors) {
- this.templateBindings = templateBindings;
- this.warnings = warnings;
- this.errors = errors;
- }
- return TemplateBindingParseResult;
- }());
- /**
- * @param {?} config
- * @return {?}
- */
- function _createInterpolateRegExp(config) {
- var /** @type {?} */ pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end);
- return new RegExp(pattern, 'g');
- }
- var Parser = /** @class */ (function () {
- function Parser(_lexer) {
- this._lexer = _lexer;
- this.errors = [];
- }
- /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- Parser.prototype.parseAction = /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- function (input, location, interpolationConfig) {
- if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- this._checkNoInterpolation(input, location, interpolationConfig);
- var /** @type {?} */ sourceToLex = this._stripComments(input);
- var /** @type {?} */ tokens = this._lexer.tokenize(this._stripComments(input));
- var /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, true, this.errors, input.length - sourceToLex.length)
- .parseChain();
- return new ASTWithSource(ast, input, location, this.errors);
- };
- /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- Parser.prototype.parseBinding = /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- function (input, location, interpolationConfig) {
- if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- var /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig);
- return new ASTWithSource(ast, input, location, this.errors);
- };
- /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- Parser.prototype.parseSimpleBinding = /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- function (input, location, interpolationConfig) {
- if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- var /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig);
- var /** @type {?} */ errors = SimpleExpressionChecker.check(ast);
- if (errors.length > 0) {
- this._reportError("Host binding expression cannot contain " + errors.join(' '), input, location);
- }
- return new ASTWithSource(ast, input, location, this.errors);
- };
- /**
- * @param {?} message
- * @param {?} input
- * @param {?} errLocation
- * @param {?=} ctxLocation
- * @return {?}
- */
- Parser.prototype._reportError = /**
- * @param {?} message
- * @param {?} input
- * @param {?} errLocation
- * @param {?=} ctxLocation
- * @return {?}
- */
- function (message, input, errLocation, ctxLocation) {
- this.errors.push(new ParserError(message, input, errLocation, ctxLocation));
- };
- /**
- * @param {?} input
- * @param {?} location
- * @param {?} interpolationConfig
- * @return {?}
- */
- Parser.prototype._parseBindingAst = /**
- * @param {?} input
- * @param {?} location
- * @param {?} interpolationConfig
- * @return {?}
- */
- function (input, location, interpolationConfig) {
- // Quotes expressions use 3rd-party expression language. We don't want to use
- // our lexer or parser for that, so we check for that ahead of time.
- var /** @type {?} */ quote = this._parseQuote(input, location);
- if (quote != null) {
- return quote;
- }
- this._checkNoInterpolation(input, location, interpolationConfig);
- var /** @type {?} */ sourceToLex = this._stripComments(input);
- var /** @type {?} */ tokens = this._lexer.tokenize(sourceToLex);
- return new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, input.length - sourceToLex.length)
- .parseChain();
- };
- /**
- * @param {?} input
- * @param {?} location
- * @return {?}
- */
- Parser.prototype._parseQuote = /**
- * @param {?} input
- * @param {?} location
- * @return {?}
- */
- function (input, location) {
- if (input == null)
- return null;
- var /** @type {?} */ prefixSeparatorIndex = input.indexOf(':');
- if (prefixSeparatorIndex == -1)
- return null;
- var /** @type {?} */ prefix = input.substring(0, prefixSeparatorIndex).trim();
- if (!isIdentifier(prefix))
- return null;
- var /** @type {?} */ uninterpretedExpression = input.substring(prefixSeparatorIndex + 1);
- return new Quote(new ParseSpan(0, input.length), prefix, uninterpretedExpression, location);
- };
- /**
- * @param {?} prefixToken
- * @param {?} input
- * @param {?} location
- * @return {?}
- */
- Parser.prototype.parseTemplateBindings = /**
- * @param {?} prefixToken
- * @param {?} input
- * @param {?} location
- * @return {?}
- */
- function (prefixToken, input, location) {
- var /** @type {?} */ tokens = this._lexer.tokenize(input);
- if (prefixToken) {
- // Prefix the tokens with the tokens from prefixToken but have them take no space (0 index).
- var /** @type {?} */ prefixTokens = this._lexer.tokenize(prefixToken).map(function (t) {
- t.index = 0;
- return t;
- });
- tokens.unshift.apply(tokens, prefixTokens);
- }
- return new _ParseAST(input, location, tokens, input.length, false, this.errors, 0)
- .parseTemplateBindings();
- };
- /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- Parser.prototype.parseInterpolation = /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- function (input, location, interpolationConfig) {
- if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- var /** @type {?} */ split = this.splitInterpolation(input, location, interpolationConfig);
- if (split == null)
- return null;
- var /** @type {?} */ expressions = [];
- for (var /** @type {?} */ i = 0; i < split.expressions.length; ++i) {
- var /** @type {?} */ expressionText = split.expressions[i];
- var /** @type {?} */ sourceToLex = this._stripComments(expressionText);
- var /** @type {?} */ tokens = this._lexer.tokenize(sourceToLex);
- var /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, split.offsets[i] + (expressionText.length - sourceToLex.length))
- .parseChain();
- expressions.push(ast);
- }
- return new ASTWithSource(new Interpolation(new ParseSpan(0, input == null ? 0 : input.length), split.strings, expressions), input, location, this.errors);
- };
- /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- Parser.prototype.splitInterpolation = /**
- * @param {?} input
- * @param {?} location
- * @param {?=} interpolationConfig
- * @return {?}
- */
- function (input, location, interpolationConfig) {
- if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- var /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig);
- var /** @type {?} */ parts = input.split(regexp);
- if (parts.length <= 1) {
- return null;
- }
- var /** @type {?} */ strings = [];
- var /** @type {?} */ expressions = [];
- var /** @type {?} */ offsets = [];
- var /** @type {?} */ offset = 0;
- for (var /** @type {?} */ i = 0; i < parts.length; i++) {
- var /** @type {?} */ part = parts[i];
- if (i % 2 === 0) {
- // fixed string
- strings.push(part);
- offset += part.length;
- }
- else if (part.trim().length > 0) {
- offset += interpolationConfig.start.length;
- expressions.push(part);
- offsets.push(offset);
- offset += part.length + interpolationConfig.end.length;
- }
- else {
- this._reportError('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i, interpolationConfig) + " in", location);
- expressions.push('$implict');
- offsets.push(offset);
- }
- }
- return new SplitInterpolation(strings, expressions, offsets);
- };
- /**
- * @param {?} input
- * @param {?} location
- * @return {?}
- */
- Parser.prototype.wrapLiteralPrimitive = /**
- * @param {?} input
- * @param {?} location
- * @return {?}
- */
- function (input, location) {
- return new ASTWithSource(new LiteralPrimitive(new ParseSpan(0, input == null ? 0 : input.length), input), input, location, this.errors);
- };
- /**
- * @param {?} input
- * @return {?}
- */
- Parser.prototype._stripComments = /**
- * @param {?} input
- * @return {?}
- */
- function (input) {
- var /** @type {?} */ i = this._commentStart(input);
- return i != null ? input.substring(0, i).trim() : input;
- };
- /**
- * @param {?} input
- * @return {?}
- */
- Parser.prototype._commentStart = /**
- * @param {?} input
- * @return {?}
- */
- function (input) {
- var /** @type {?} */ outerQuote = null;
- for (var /** @type {?} */ i = 0; i < input.length - 1; i++) {
- var /** @type {?} */ char = input.charCodeAt(i);
- var /** @type {?} */ nextChar = input.charCodeAt(i + 1);
- if (char === $SLASH && nextChar == $SLASH && outerQuote == null)
- return i;
- if (outerQuote === char) {
- outerQuote = null;
- }
- else if (outerQuote == null && isQuote(char)) {
- outerQuote = char;
- }
- }
- return null;
- };
- /**
- * @param {?} input
- * @param {?} location
- * @param {?} interpolationConfig
- * @return {?}
- */
- Parser.prototype._checkNoInterpolation = /**
- * @param {?} input
- * @param {?} location
- * @param {?} interpolationConfig
- * @return {?}
- */
- function (input, location, interpolationConfig) {
- var /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig);
- var /** @type {?} */ parts = input.split(regexp);
- if (parts.length > 1) {
- this._reportError("Got interpolation (" + interpolationConfig.start + interpolationConfig.end + ") where expression was expected", input, "at column " + this._findInterpolationErrorColumn(parts, 1, interpolationConfig) + " in", location);
- }
- };
- /**
- * @param {?} parts
- * @param {?} partInErrIdx
- * @param {?} interpolationConfig
- * @return {?}
- */
- Parser.prototype._findInterpolationErrorColumn = /**
- * @param {?} parts
- * @param {?} partInErrIdx
- * @param {?} interpolationConfig
- * @return {?}
- */
- function (parts, partInErrIdx, interpolationConfig) {
- var /** @type {?} */ errLocation = '';
- for (var /** @type {?} */ j = 0; j < partInErrIdx; j++) {
- errLocation += j % 2 === 0 ?
- parts[j] :
- "" + interpolationConfig.start + parts[j] + interpolationConfig.end;
- }
- return errLocation.length;
- };
- return Parser;
- }());
- var _ParseAST = /** @class */ (function () {
- function _ParseAST(input, location, tokens, inputLength, parseAction, errors, offset) {
- this.input = input;
- this.location = location;
- this.tokens = tokens;
- this.inputLength = inputLength;
- this.parseAction = parseAction;
- this.errors = errors;
- this.offset = offset;
- this.rparensExpected = 0;
- this.rbracketsExpected = 0;
- this.rbracesExpected = 0;
- this.index = 0;
- }
- /**
- * @param {?} offset
- * @return {?}
- */
- _ParseAST.prototype.peek = /**
- * @param {?} offset
- * @return {?}
- */
- function (offset) {
- var /** @type {?} */ i = this.index + offset;
- return i < this.tokens.length ? this.tokens[i] : EOF;
- };
- Object.defineProperty(_ParseAST.prototype, "next", {
- get: /**
- * @return {?}
- */
- function () { return this.peek(0); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(_ParseAST.prototype, "inputIndex", {
- get: /**
- * @return {?}
- */
- function () {
- return (this.index < this.tokens.length) ? this.next.index + this.offset :
- this.inputLength + this.offset;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} start
- * @return {?}
- */
- _ParseAST.prototype.span = /**
- * @param {?} start
- * @return {?}
- */
- function (start) { return new ParseSpan(start, this.inputIndex); };
- /**
- * @return {?}
- */
- _ParseAST.prototype.advance = /**
- * @return {?}
- */
- function () { this.index++; };
- /**
- * @param {?} code
- * @return {?}
- */
- _ParseAST.prototype.optionalCharacter = /**
- * @param {?} code
- * @return {?}
- */
- function (code) {
- if (this.next.isCharacter(code)) {
- this.advance();
- return true;
- }
- else {
- return false;
- }
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.peekKeywordLet = /**
- * @return {?}
- */
- function () { return this.next.isKeywordLet(); };
- /**
- * @return {?}
- */
- _ParseAST.prototype.peekKeywordAs = /**
- * @return {?}
- */
- function () { return this.next.isKeywordAs(); };
- /**
- * @param {?} code
- * @return {?}
- */
- _ParseAST.prototype.expectCharacter = /**
- * @param {?} code
- * @return {?}
- */
- function (code) {
- if (this.optionalCharacter(code))
- return;
- this.error("Missing expected " + String.fromCharCode(code));
- };
- /**
- * @param {?} op
- * @return {?}
- */
- _ParseAST.prototype.optionalOperator = /**
- * @param {?} op
- * @return {?}
- */
- function (op) {
- if (this.next.isOperator(op)) {
- this.advance();
- return true;
- }
- else {
- return false;
- }
- };
- /**
- * @param {?} operator
- * @return {?}
- */
- _ParseAST.prototype.expectOperator = /**
- * @param {?} operator
- * @return {?}
- */
- function (operator) {
- if (this.optionalOperator(operator))
- return;
- this.error("Missing expected operator " + operator);
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.expectIdentifierOrKeyword = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ n = this.next;
- if (!n.isIdentifier() && !n.isKeyword()) {
- this.error("Unexpected token " + n + ", expected identifier or keyword");
- return '';
- }
- this.advance();
- return /** @type {?} */ (n.toString());
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.expectIdentifierOrKeywordOrString = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ n = this.next;
- if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
- this.error("Unexpected token " + n + ", expected identifier, keyword, or string");
- return '';
- }
- this.advance();
- return /** @type {?} */ (n.toString());
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseChain = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ exprs = [];
- var /** @type {?} */ start = this.inputIndex;
- while (this.index < this.tokens.length) {
- var /** @type {?} */ expr = this.parsePipe();
- exprs.push(expr);
- if (this.optionalCharacter($SEMICOLON)) {
- if (!this.parseAction) {
- this.error('Binding expression cannot contain chained expression');
- }
- while (this.optionalCharacter($SEMICOLON)) {
- } // read all semicolons
- }
- else if (this.index < this.tokens.length) {
- this.error("Unexpected token '" + this.next + "'");
- }
- }
- if (exprs.length == 0)
- return new EmptyExpr(this.span(start));
- if (exprs.length == 1)
- return exprs[0];
- return new Chain(this.span(start), exprs);
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parsePipe = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ result = this.parseExpression();
- if (this.optionalOperator('|')) {
- if (this.parseAction) {
- this.error('Cannot have a pipe in an action expression');
- }
- do {
- var /** @type {?} */ name_1 = this.expectIdentifierOrKeyword();
- var /** @type {?} */ args = [];
- while (this.optionalCharacter($COLON)) {
- args.push(this.parseExpression());
- }
- result = new BindingPipe(this.span(result.span.start), result, name_1, args);
- } while (this.optionalOperator('|'));
- }
- return result;
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseExpression = /**
- * @return {?}
- */
- function () { return this.parseConditional(); };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseConditional = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ start = this.inputIndex;
- var /** @type {?} */ result = this.parseLogicalOr();
- if (this.optionalOperator('?')) {
- var /** @type {?} */ yes = this.parsePipe();
- var /** @type {?} */ no = void 0;
- if (!this.optionalCharacter($COLON)) {
- var /** @type {?} */ end = this.inputIndex;
- var /** @type {?} */ expression = this.input.substring(start, end);
- this.error("Conditional expression " + expression + " requires all 3 expressions");
- no = new EmptyExpr(this.span(start));
- }
- else {
- no = this.parsePipe();
- }
- return new Conditional(this.span(start), result, yes, no);
- }
- else {
- return result;
- }
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseLogicalOr = /**
- * @return {?}
- */
- function () {
- // '||'
- var /** @type {?} */ result = this.parseLogicalAnd();
- while (this.optionalOperator('||')) {
- var /** @type {?} */ right = this.parseLogicalAnd();
- result = new Binary(this.span(result.span.start), '||', result, right);
- }
- return result;
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseLogicalAnd = /**
- * @return {?}
- */
- function () {
- // '&&'
- var /** @type {?} */ result = this.parseEquality();
- while (this.optionalOperator('&&')) {
- var /** @type {?} */ right = this.parseEquality();
- result = new Binary(this.span(result.span.start), '&&', result, right);
- }
- return result;
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseEquality = /**
- * @return {?}
- */
- function () {
- // '==','!=','===','!=='
- var /** @type {?} */ result = this.parseRelational();
- while (this.next.type == TokenType.Operator) {
- var /** @type {?} */ operator = this.next.strValue;
- switch (operator) {
- case '==':
- case '===':
- case '!=':
- case '!==':
- this.advance();
- var /** @type {?} */ right = this.parseRelational();
- result = new Binary(this.span(result.span.start), operator, result, right);
- continue;
- }
- break;
- }
- return result;
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseRelational = /**
- * @return {?}
- */
- function () {
- // '<', '>', '<=', '>='
- var /** @type {?} */ result = this.parseAdditive();
- while (this.next.type == TokenType.Operator) {
- var /** @type {?} */ operator = this.next.strValue;
- switch (operator) {
- case '<':
- case '>':
- case '<=':
- case '>=':
- this.advance();
- var /** @type {?} */ right = this.parseAdditive();
- result = new Binary(this.span(result.span.start), operator, result, right);
- continue;
- }
- break;
- }
- return result;
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseAdditive = /**
- * @return {?}
- */
- function () {
- // '+', '-'
- var /** @type {?} */ result = this.parseMultiplicative();
- while (this.next.type == TokenType.Operator) {
- var /** @type {?} */ operator = this.next.strValue;
- switch (operator) {
- case '+':
- case '-':
- this.advance();
- var /** @type {?} */ right = this.parseMultiplicative();
- result = new Binary(this.span(result.span.start), operator, result, right);
- continue;
- }
- break;
- }
- return result;
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseMultiplicative = /**
- * @return {?}
- */
- function () {
- // '*', '%', '/'
- var /** @type {?} */ result = this.parsePrefix();
- while (this.next.type == TokenType.Operator) {
- var /** @type {?} */ operator = this.next.strValue;
- switch (operator) {
- case '*':
- case '%':
- case '/':
- this.advance();
- var /** @type {?} */ right = this.parsePrefix();
- result = new Binary(this.span(result.span.start), operator, result, right);
- continue;
- }
- break;
- }
- return result;
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parsePrefix = /**
- * @return {?}
- */
- function () {
- if (this.next.type == TokenType.Operator) {
- var /** @type {?} */ start = this.inputIndex;
- var /** @type {?} */ operator = this.next.strValue;
- var /** @type {?} */ result = void 0;
- switch (operator) {
- case '+':
- this.advance();
- result = this.parsePrefix();
- return new Binary(this.span(start), '-', result, new LiteralPrimitive(new ParseSpan(start, start), 0));
- case '-':
- this.advance();
- result = this.parsePrefix();
- return new Binary(this.span(start), operator, new LiteralPrimitive(new ParseSpan(start, start), 0), result);
- case '!':
- this.advance();
- result = this.parsePrefix();
- return new PrefixNot(this.span(start), result);
- }
- }
- return this.parseCallChain();
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseCallChain = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ result = this.parsePrimary();
- while (true) {
- if (this.optionalCharacter($PERIOD)) {
- result = this.parseAccessMemberOrMethodCall(result, false);
- }
- else if (this.optionalOperator('?.')) {
- result = this.parseAccessMemberOrMethodCall(result, true);
- }
- else if (this.optionalCharacter($LBRACKET)) {
- this.rbracketsExpected++;
- var /** @type {?} */ key = this.parsePipe();
- this.rbracketsExpected--;
- this.expectCharacter($RBRACKET);
- if (this.optionalOperator('=')) {
- var /** @type {?} */ value = this.parseConditional();
- result = new KeyedWrite(this.span(result.span.start), result, key, value);
- }
- else {
- result = new KeyedRead(this.span(result.span.start), result, key);
- }
- }
- else if (this.optionalCharacter($LPAREN)) {
- this.rparensExpected++;
- var /** @type {?} */ args = this.parseCallArguments();
- this.rparensExpected--;
- this.expectCharacter($RPAREN);
- result = new FunctionCall(this.span(result.span.start), result, args);
- }
- else if (this.optionalOperator('!')) {
- result = new NonNullAssert(this.span(result.span.start), result);
- }
- else {
- return result;
- }
- }
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parsePrimary = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ start = this.inputIndex;
- if (this.optionalCharacter($LPAREN)) {
- this.rparensExpected++;
- var /** @type {?} */ result = this.parsePipe();
- this.rparensExpected--;
- this.expectCharacter($RPAREN);
- return result;
- }
- else if (this.next.isKeywordNull()) {
- this.advance();
- return new LiteralPrimitive(this.span(start), null);
- }
- else if (this.next.isKeywordUndefined()) {
- this.advance();
- return new LiteralPrimitive(this.span(start), void 0);
- }
- else if (this.next.isKeywordTrue()) {
- this.advance();
- return new LiteralPrimitive(this.span(start), true);
- }
- else if (this.next.isKeywordFalse()) {
- this.advance();
- return new LiteralPrimitive(this.span(start), false);
- }
- else if (this.next.isKeywordThis()) {
- this.advance();
- return new ImplicitReceiver(this.span(start));
- }
- else if (this.optionalCharacter($LBRACKET)) {
- this.rbracketsExpected++;
- var /** @type {?} */ elements = this.parseExpressionList($RBRACKET);
- this.rbracketsExpected--;
- this.expectCharacter($RBRACKET);
- return new LiteralArray(this.span(start), elements);
- }
- else if (this.next.isCharacter($LBRACE)) {
- return this.parseLiteralMap();
- }
- else if (this.next.isIdentifier()) {
- return this.parseAccessMemberOrMethodCall(new ImplicitReceiver(this.span(start)), false);
- }
- else if (this.next.isNumber()) {
- var /** @type {?} */ value = this.next.toNumber();
- this.advance();
- return new LiteralPrimitive(this.span(start), value);
- }
- else if (this.next.isString()) {
- var /** @type {?} */ literalValue = this.next.toString();
- this.advance();
- return new LiteralPrimitive(this.span(start), literalValue);
- }
- else if (this.index >= this.tokens.length) {
- this.error("Unexpected end of expression: " + this.input);
- return new EmptyExpr(this.span(start));
- }
- else {
- this.error("Unexpected token " + this.next);
- return new EmptyExpr(this.span(start));
- }
- };
- /**
- * @param {?} terminator
- * @return {?}
- */
- _ParseAST.prototype.parseExpressionList = /**
- * @param {?} terminator
- * @return {?}
- */
- function (terminator) {
- var /** @type {?} */ result = [];
- if (!this.next.isCharacter(terminator)) {
- do {
- result.push(this.parsePipe());
- } while (this.optionalCharacter($COMMA));
- }
- return result;
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseLiteralMap = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ keys = [];
- var /** @type {?} */ values = [];
- var /** @type {?} */ start = this.inputIndex;
- this.expectCharacter($LBRACE);
- if (!this.optionalCharacter($RBRACE)) {
- this.rbracesExpected++;
- do {
- var /** @type {?} */ quoted = this.next.isString();
- var /** @type {?} */ key = this.expectIdentifierOrKeywordOrString();
- keys.push({ key: key, quoted: quoted });
- this.expectCharacter($COLON);
- values.push(this.parsePipe());
- } while (this.optionalCharacter($COMMA));
- this.rbracesExpected--;
- this.expectCharacter($RBRACE);
- }
- return new LiteralMap(this.span(start), keys, values);
- };
- /**
- * @param {?} receiver
- * @param {?=} isSafe
- * @return {?}
- */
- _ParseAST.prototype.parseAccessMemberOrMethodCall = /**
- * @param {?} receiver
- * @param {?=} isSafe
- * @return {?}
- */
- function (receiver, isSafe) {
- if (isSafe === void 0) { isSafe = false; }
- var /** @type {?} */ start = receiver.span.start;
- var /** @type {?} */ id = this.expectIdentifierOrKeyword();
- if (this.optionalCharacter($LPAREN)) {
- this.rparensExpected++;
- var /** @type {?} */ args = this.parseCallArguments();
- this.expectCharacter($RPAREN);
- this.rparensExpected--;
- var /** @type {?} */ span = this.span(start);
- return isSafe ? new SafeMethodCall(span, receiver, id, args) :
- new MethodCall(span, receiver, id, args);
- }
- else {
- if (isSafe) {
- if (this.optionalOperator('=')) {
- this.error('The \'?.\' operator cannot be used in the assignment');
- return new EmptyExpr(this.span(start));
- }
- else {
- return new SafePropertyRead(this.span(start), receiver, id);
- }
- }
- else {
- if (this.optionalOperator('=')) {
- if (!this.parseAction) {
- this.error('Bindings cannot contain assignments');
- return new EmptyExpr(this.span(start));
- }
- var /** @type {?} */ value = this.parseConditional();
- return new PropertyWrite(this.span(start), receiver, id, value);
- }
- else {
- return new PropertyRead(this.span(start), receiver, id);
- }
- }
- }
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseCallArguments = /**
- * @return {?}
- */
- function () {
- if (this.next.isCharacter($RPAREN))
- return [];
- var /** @type {?} */ positionals = [];
- do {
- positionals.push(this.parsePipe());
- } while (this.optionalCharacter($COMMA));
- return /** @type {?} */ (positionals);
- };
- /**
- * An identifier, a keyword, a string with an optional `-` inbetween.
- */
- /**
- * An identifier, a keyword, a string with an optional `-` inbetween.
- * @return {?}
- */
- _ParseAST.prototype.expectTemplateBindingKey = /**
- * An identifier, a keyword, a string with an optional `-` inbetween.
- * @return {?}
- */
- function () {
- var /** @type {?} */ result = '';
- var /** @type {?} */ operatorFound = false;
- do {
- result += this.expectIdentifierOrKeywordOrString();
- operatorFound = this.optionalOperator('-');
- if (operatorFound) {
- result += '-';
- }
- } while (operatorFound);
- return result.toString();
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.parseTemplateBindings = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ bindings = [];
- var /** @type {?} */ prefix = /** @type {?} */ ((null));
- var /** @type {?} */ warnings = [];
- while (this.index < this.tokens.length) {
- var /** @type {?} */ start = this.inputIndex;
- var /** @type {?} */ keyIsVar = this.peekKeywordLet();
- if (keyIsVar) {
- this.advance();
- }
- var /** @type {?} */ rawKey = this.expectTemplateBindingKey();
- var /** @type {?} */ key = rawKey;
- if (!keyIsVar) {
- if (prefix == null) {
- prefix = key;
- }
- else {
- key = prefix + key[0].toUpperCase() + key.substring(1);
- }
- }
- this.optionalCharacter($COLON);
- var /** @type {?} */ name_2 = /** @type {?} */ ((null));
- var /** @type {?} */ expression = /** @type {?} */ ((null));
- if (keyIsVar) {
- if (this.optionalOperator('=')) {
- name_2 = this.expectTemplateBindingKey();
- }
- else {
- name_2 = '\$implicit';
- }
- }
- else if (this.peekKeywordAs()) {
- var /** @type {?} */ letStart = this.inputIndex;
- this.advance(); // consume `as`
- name_2 = rawKey;
- key = this.expectTemplateBindingKey(); // read local var name
- keyIsVar = true;
- }
- else if (this.next !== EOF && !this.peekKeywordLet()) {
- var /** @type {?} */ start_1 = this.inputIndex;
- var /** @type {?} */ ast = this.parsePipe();
- var /** @type {?} */ source = this.input.substring(start_1 - this.offset, this.inputIndex - this.offset);
- expression = new ASTWithSource(ast, source, this.location, this.errors);
- }
- bindings.push(new TemplateBinding(this.span(start), key, keyIsVar, name_2, expression));
- if (this.peekKeywordAs() && !keyIsVar) {
- var /** @type {?} */ letStart = this.inputIndex;
- this.advance(); // consume `as`
- var /** @type {?} */ letName = this.expectTemplateBindingKey(); // read local var name
- bindings.push(new TemplateBinding(this.span(letStart), letName, true, key, /** @type {?} */ ((null))));
- }
- if (!this.optionalCharacter($SEMICOLON)) {
- this.optionalCharacter($COMMA);
- }
- }
- return new TemplateBindingParseResult(bindings, warnings, this.errors);
- };
- /**
- * @param {?} message
- * @param {?=} index
- * @return {?}
- */
- _ParseAST.prototype.error = /**
- * @param {?} message
- * @param {?=} index
- * @return {?}
- */
- function (message, index) {
- if (index === void 0) { index = null; }
- this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location));
- this.skip();
- };
- /**
- * @param {?=} index
- * @return {?}
- */
- _ParseAST.prototype.locationText = /**
- * @param {?=} index
- * @return {?}
- */
- function (index) {
- if (index === void 0) { index = null; }
- if (index == null)
- index = this.index;
- return (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" :
- "at the end of the expression";
- };
- /**
- * @return {?}
- */
- _ParseAST.prototype.skip = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ n = this.next;
- while (this.index < this.tokens.length && !n.isCharacter($SEMICOLON) &&
- (this.rparensExpected <= 0 || !n.isCharacter($RPAREN)) &&
- (this.rbracesExpected <= 0 || !n.isCharacter($RBRACE)) &&
- (this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET))) {
- if (this.next.isError()) {
- this.errors.push(new ParserError(/** @type {?} */ ((this.next.toString())), this.input, this.locationText(), this.location));
- }
- this.advance();
- n = this.next;
- }
- };
- return _ParseAST;
- }());
- var SimpleExpressionChecker = /** @class */ (function () {
- function SimpleExpressionChecker() {
- this.errors = [];
- }
- /**
- * @param {?} ast
- * @return {?}
- */
- SimpleExpressionChecker.check = /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- var /** @type {?} */ s = new SimpleExpressionChecker();
- ast.visit(s);
- return s.errors;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitImplicitReceiver = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitInterpolation = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitLiteralPrimitive = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitPropertyRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitPropertyWrite = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitSafePropertyRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitMethodCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitSafeMethodCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitFunctionCall = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitLiteralArray = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { this.visitAll(ast.expressions); };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitLiteralMap = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { this.visitAll(ast.values); };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitBinary = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitPrefixNot = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitNonNullAssert = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitConditional = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitPipe = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { this.errors.push('pipes'); };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitKeyedRead = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitKeyedWrite = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} asts
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitAll = /**
- * @param {?} asts
- * @return {?}
- */
- function (asts) {
- var _this = this;
- return asts.map(function (node) { return node.visit(_this); });
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitChain = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- SimpleExpressionChecker.prototype.visitQuote = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- return SimpleExpressionChecker;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- var ParseLocation = /** @class */ (function () {
- function ParseLocation(file, offset, line, col) {
- this.file = file;
- this.offset = offset;
- this.line = line;
- this.col = col;
- }
- /**
- * @return {?}
- */
- ParseLocation.prototype.toString = /**
- * @return {?}
- */
- function () {
- return this.offset != null ? this.file.url + "@" + this.line + ":" + this.col : this.file.url;
- };
- /**
- * @param {?} delta
- * @return {?}
- */
- ParseLocation.prototype.moveBy = /**
- * @param {?} delta
- * @return {?}
- */
- function (delta) {
- var /** @type {?} */ source = this.file.content;
- var /** @type {?} */ len = source.length;
- var /** @type {?} */ offset = this.offset;
- var /** @type {?} */ line = this.line;
- var /** @type {?} */ col = this.col;
- while (offset > 0 && delta < 0) {
- offset--;
- delta++;
- var /** @type {?} */ ch = source.charCodeAt(offset);
- if (ch == $LF) {
- line--;
- var /** @type {?} */ priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
- col = priorLine > 0 ? offset - priorLine : offset;
- }
- else {
- col--;
- }
- }
- while (offset < len && delta > 0) {
- var /** @type {?} */ ch = source.charCodeAt(offset);
- offset++;
- delta--;
- if (ch == $LF) {
- line++;
- col = 0;
- }
- else {
- col++;
- }
- }
- return new ParseLocation(this.file, offset, line, col);
- };
- // Return the source around the location
- // Up to `maxChars` or `maxLines` on each side of the location
- /**
- * @param {?} maxChars
- * @param {?} maxLines
- * @return {?}
- */
- ParseLocation.prototype.getContext = /**
- * @param {?} maxChars
- * @param {?} maxLines
- * @return {?}
- */
- function (maxChars, maxLines) {
- var /** @type {?} */ content = this.file.content;
- var /** @type {?} */ startOffset = this.offset;
- if (startOffset != null) {
- if (startOffset > content.length - 1) {
- startOffset = content.length - 1;
- }
- var /** @type {?} */ endOffset = startOffset;
- var /** @type {?} */ ctxChars = 0;
- var /** @type {?} */ ctxLines = 0;
- while (ctxChars < maxChars && startOffset > 0) {
- startOffset--;
- ctxChars++;
- if (content[startOffset] == '\n') {
- if (++ctxLines == maxLines) {
- break;
- }
- }
- }
- ctxChars = 0;
- ctxLines = 0;
- while (ctxChars < maxChars && endOffset < content.length - 1) {
- endOffset++;
- ctxChars++;
- if (content[endOffset] == '\n') {
- if (++ctxLines == maxLines) {
- break;
- }
- }
- }
- return {
- before: content.substring(startOffset, this.offset),
- after: content.substring(this.offset, endOffset + 1),
- };
- }
- return null;
- };
- return ParseLocation;
- }());
- var ParseSourceFile = /** @class */ (function () {
- function ParseSourceFile(content, url) {
- this.content = content;
- this.url = url;
- }
- return ParseSourceFile;
- }());
- var ParseSourceSpan = /** @class */ (function () {
- function ParseSourceSpan(start, end, details) {
- if (details === void 0) { details = null; }
- this.start = start;
- this.end = end;
- this.details = details;
- }
- /**
- * @return {?}
- */
- ParseSourceSpan.prototype.toString = /**
- * @return {?}
- */
- function () {
- return this.start.file.content.substring(this.start.offset, this.end.offset);
- };
- return ParseSourceSpan;
- }());
- /** @enum {number} */
- var ParseErrorLevel = {
- WARNING: 0,
- ERROR: 1,
- };
- ParseErrorLevel[ParseErrorLevel.WARNING] = "WARNING";
- ParseErrorLevel[ParseErrorLevel.ERROR] = "ERROR";
- var ParseError = /** @class */ (function () {
- function ParseError(span, msg, level) {
- if (level === void 0) { level = ParseErrorLevel.ERROR; }
- this.span = span;
- this.msg = msg;
- this.level = level;
- }
- /**
- * @return {?}
- */
- ParseError.prototype.contextualMessage = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ ctx = this.span.start.getContext(100, 3);
- return ctx ? this.msg + " (\"" + ctx.before + "[" + ParseErrorLevel[this.level] + " ->]" + ctx.after + "\")" :
- this.msg;
- };
- /**
- * @return {?}
- */
- ParseError.prototype.toString = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ details = this.span.details ? ", " + this.span.details : '';
- return this.contextualMessage() + ": " + this.span.start + details;
- };
- return ParseError;
- }());
- /**
- * @param {?} kind
- * @param {?} type
- * @return {?}
- */
- function typeSourceSpan(kind, type) {
- var /** @type {?} */ moduleUrl = identifierModuleUrl(type);
- var /** @type {?} */ sourceFileName = moduleUrl != null ? "in " + kind + " " + identifierName(type) + " in " + moduleUrl :
- "in " + kind + " " + identifierName(type);
- var /** @type {?} */ sourceFile = new ParseSourceFile('', sourceFileName);
- return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var TokenType$1 = {
- TAG_OPEN_START: 0,
- TAG_OPEN_END: 1,
- TAG_OPEN_END_VOID: 2,
- TAG_CLOSE: 3,
- TEXT: 4,
- ESCAPABLE_RAW_TEXT: 5,
- RAW_TEXT: 6,
- COMMENT_START: 7,
- COMMENT_END: 8,
- CDATA_START: 9,
- CDATA_END: 10,
- ATTR_NAME: 11,
- ATTR_VALUE: 12,
- DOC_TYPE: 13,
- EXPANSION_FORM_START: 14,
- EXPANSION_CASE_VALUE: 15,
- EXPANSION_CASE_EXP_START: 16,
- EXPANSION_CASE_EXP_END: 17,
- EXPANSION_FORM_END: 18,
- EOF: 19,
- };
- TokenType$1[TokenType$1.TAG_OPEN_START] = "TAG_OPEN_START";
- TokenType$1[TokenType$1.TAG_OPEN_END] = "TAG_OPEN_END";
- TokenType$1[TokenType$1.TAG_OPEN_END_VOID] = "TAG_OPEN_END_VOID";
- TokenType$1[TokenType$1.TAG_CLOSE] = "TAG_CLOSE";
- TokenType$1[TokenType$1.TEXT] = "TEXT";
- TokenType$1[TokenType$1.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT";
- TokenType$1[TokenType$1.RAW_TEXT] = "RAW_TEXT";
- TokenType$1[TokenType$1.COMMENT_START] = "COMMENT_START";
- TokenType$1[TokenType$1.COMMENT_END] = "COMMENT_END";
- TokenType$1[TokenType$1.CDATA_START] = "CDATA_START";
- TokenType$1[TokenType$1.CDATA_END] = "CDATA_END";
- TokenType$1[TokenType$1.ATTR_NAME] = "ATTR_NAME";
- TokenType$1[TokenType$1.ATTR_VALUE] = "ATTR_VALUE";
- TokenType$1[TokenType$1.DOC_TYPE] = "DOC_TYPE";
- TokenType$1[TokenType$1.EXPANSION_FORM_START] = "EXPANSION_FORM_START";
- TokenType$1[TokenType$1.EXPANSION_CASE_VALUE] = "EXPANSION_CASE_VALUE";
- TokenType$1[TokenType$1.EXPANSION_CASE_EXP_START] = "EXPANSION_CASE_EXP_START";
- TokenType$1[TokenType$1.EXPANSION_CASE_EXP_END] = "EXPANSION_CASE_EXP_END";
- TokenType$1[TokenType$1.EXPANSION_FORM_END] = "EXPANSION_FORM_END";
- TokenType$1[TokenType$1.EOF] = "EOF";
- var Token$1 = /** @class */ (function () {
- function Token(type, parts, sourceSpan) {
- this.type = type;
- this.parts = parts;
- this.sourceSpan = sourceSpan;
- }
- return Token;
- }());
- var TokenError = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TokenError, _super);
- function TokenError(errorMsg, tokenType, span) {
- var _this = _super.call(this, span, errorMsg) || this;
- _this.tokenType = tokenType;
- return _this;
- }
- return TokenError;
- }(ParseError));
- var TokenizeResult = /** @class */ (function () {
- function TokenizeResult(tokens, errors) {
- this.tokens = tokens;
- this.errors = errors;
- }
- return TokenizeResult;
- }());
- /**
- * @param {?} source
- * @param {?} url
- * @param {?} getTagDefinition
- * @param {?=} tokenizeExpansionForms
- * @param {?=} interpolationConfig
- * @return {?}
- */
- function tokenize(source, url, getTagDefinition, tokenizeExpansionForms, interpolationConfig) {
- if (tokenizeExpansionForms === void 0) { tokenizeExpansionForms = false; }
- if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- return new _Tokenizer(new ParseSourceFile(source, url), getTagDefinition, tokenizeExpansionForms, interpolationConfig)
- .tokenize();
- }
- var _CR_OR_CRLF_REGEXP = /\r\n?/g;
- /**
- * @param {?} charCode
- * @return {?}
- */
- function _unexpectedCharacterErrorMsg(charCode) {
- var /** @type {?} */ char = charCode === $EOF ? 'EOF' : String.fromCharCode(charCode);
- return "Unexpected character \"" + char + "\"";
- }
- /**
- * @param {?} entitySrc
- * @return {?}
- */
- function _unknownEntityErrorMsg(entitySrc) {
- return "Unknown entity \"" + entitySrc + "\" - use the \"&#<decimal>;\" or \"&#x<hex>;\" syntax";
- }
- var _ControlFlowError = /** @class */ (function () {
- function _ControlFlowError(error) {
- this.error = error;
- }
- return _ControlFlowError;
- }());
- var _Tokenizer = /** @class */ (function () {
- /**
- * @param _file The html source
- * @param _getTagDefinition
- * @param _tokenizeIcu Whether to tokenize ICU messages (considered as text nodes when false)
- * @param _interpolationConfig
- */
- function _Tokenizer(_file, _getTagDefinition, _tokenizeIcu, _interpolationConfig) {
- if (_interpolationConfig === void 0) { _interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- this._file = _file;
- this._getTagDefinition = _getTagDefinition;
- this._tokenizeIcu = _tokenizeIcu;
- this._interpolationConfig = _interpolationConfig;
- this._peek = -1;
- this._nextPeek = -1;
- this._index = -1;
- this._line = 0;
- this._column = -1;
- this._expansionCaseStack = [];
- this._inInterpolation = false;
- this.tokens = [];
- this.errors = [];
- this._input = _file.content;
- this._length = _file.content.length;
- this._advance();
- }
- /**
- * @param {?} content
- * @return {?}
- */
- _Tokenizer.prototype._processCarriageReturns = /**
- * @param {?} content
- * @return {?}
- */
- function (content) {
- // http://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream
- // In order to keep the original position in the source, we can not
- // pre-process it.
- // Instead CRs are processed right before instantiating the tokens.
- return content.replace(_CR_OR_CRLF_REGEXP, '\n');
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype.tokenize = /**
- * @return {?}
- */
- function () {
- while (this._peek !== $EOF) {
- var /** @type {?} */ start = this._getLocation();
- try {
- if (this._attemptCharCode($LT)) {
- if (this._attemptCharCode($BANG)) {
- if (this._attemptCharCode($LBRACKET)) {
- this._consumeCdata(start);
- }
- else if (this._attemptCharCode($MINUS)) {
- this._consumeComment(start);
- }
- else {
- this._consumeDocType(start);
- }
- }
- else if (this._attemptCharCode($SLASH)) {
- this._consumeTagClose(start);
- }
- else {
- this._consumeTagOpen(start);
- }
- }
- else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
- this._consumeText();
- }
- }
- catch (/** @type {?} */ e) {
- if (e instanceof _ControlFlowError) {
- this.errors.push(e.error);
- }
- else {
- throw e;
- }
- }
- }
- this._beginToken(TokenType$1.EOF);
- this._endToken([]);
- return new TokenizeResult(mergeTextTokens(this.tokens), this.errors);
- };
- /**
- * \@internal
- * @return {?} whether an ICU token has been created
- */
- _Tokenizer.prototype._tokenizeExpansionForm = /**
- * \@internal
- * @return {?} whether an ICU token has been created
- */
- function () {
- if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) {
- this._consumeExpansionFormStart();
- return true;
- }
- if (isExpansionCaseStart(this._peek) && this._isInExpansionForm()) {
- this._consumeExpansionCaseStart();
- return true;
- }
- if (this._peek === $RBRACE) {
- if (this._isInExpansionCase()) {
- this._consumeExpansionCaseEnd();
- return true;
- }
- if (this._isInExpansionForm()) {
- this._consumeExpansionFormEnd();
- return true;
- }
- }
- return false;
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._getLocation = /**
- * @return {?}
- */
- function () {
- return new ParseLocation(this._file, this._index, this._line, this._column);
- };
- /**
- * @param {?=} start
- * @param {?=} end
- * @return {?}
- */
- _Tokenizer.prototype._getSpan = /**
- * @param {?=} start
- * @param {?=} end
- * @return {?}
- */
- function (start, end) {
- if (start === void 0) { start = this._getLocation(); }
- if (end === void 0) { end = this._getLocation(); }
- return new ParseSourceSpan(start, end);
- };
- /**
- * @param {?} type
- * @param {?=} start
- * @return {?}
- */
- _Tokenizer.prototype._beginToken = /**
- * @param {?} type
- * @param {?=} start
- * @return {?}
- */
- function (type, start) {
- if (start === void 0) { start = this._getLocation(); }
- this._currentTokenStart = start;
- this._currentTokenType = type;
- };
- /**
- * @param {?} parts
- * @param {?=} end
- * @return {?}
- */
- _Tokenizer.prototype._endToken = /**
- * @param {?} parts
- * @param {?=} end
- * @return {?}
- */
- function (parts, end) {
- if (end === void 0) { end = this._getLocation(); }
- var /** @type {?} */ token = new Token$1(this._currentTokenType, parts, new ParseSourceSpan(this._currentTokenStart, end));
- this.tokens.push(token);
- this._currentTokenStart = /** @type {?} */ ((null));
- this._currentTokenType = /** @type {?} */ ((null));
- return token;
- };
- /**
- * @param {?} msg
- * @param {?} span
- * @return {?}
- */
- _Tokenizer.prototype._createError = /**
- * @param {?} msg
- * @param {?} span
- * @return {?}
- */
- function (msg, span) {
- if (this._isInExpansionForm()) {
- msg += " (Do you have an unescaped \"{\" in your template? Use \"{{ '{' }}\") to escape it.)";
- }
- var /** @type {?} */ error = new TokenError(msg, this._currentTokenType, span);
- this._currentTokenStart = /** @type {?} */ ((null));
- this._currentTokenType = /** @type {?} */ ((null));
- return new _ControlFlowError(error);
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._advance = /**
- * @return {?}
- */
- function () {
- if (this._index >= this._length) {
- throw this._createError(_unexpectedCharacterErrorMsg($EOF), this._getSpan());
- }
- if (this._peek === $LF) {
- this._line++;
- this._column = 0;
- }
- else if (this._peek !== $LF && this._peek !== $CR) {
- this._column++;
- }
- this._index++;
- this._peek = this._index >= this._length ? $EOF : this._input.charCodeAt(this._index);
- this._nextPeek =
- this._index + 1 >= this._length ? $EOF : this._input.charCodeAt(this._index + 1);
- };
- /**
- * @param {?} charCode
- * @return {?}
- */
- _Tokenizer.prototype._attemptCharCode = /**
- * @param {?} charCode
- * @return {?}
- */
- function (charCode) {
- if (this._peek === charCode) {
- this._advance();
- return true;
- }
- return false;
- };
- /**
- * @param {?} charCode
- * @return {?}
- */
- _Tokenizer.prototype._attemptCharCodeCaseInsensitive = /**
- * @param {?} charCode
- * @return {?}
- */
- function (charCode) {
- if (compareCharCodeCaseInsensitive(this._peek, charCode)) {
- this._advance();
- return true;
- }
- return false;
- };
- /**
- * @param {?} charCode
- * @return {?}
- */
- _Tokenizer.prototype._requireCharCode = /**
- * @param {?} charCode
- * @return {?}
- */
- function (charCode) {
- var /** @type {?} */ location = this._getLocation();
- if (!this._attemptCharCode(charCode)) {
- throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location, location));
- }
- };
- /**
- * @param {?} chars
- * @return {?}
- */
- _Tokenizer.prototype._attemptStr = /**
- * @param {?} chars
- * @return {?}
- */
- function (chars) {
- var /** @type {?} */ len = chars.length;
- if (this._index + len > this._length) {
- return false;
- }
- var /** @type {?} */ initialPosition = this._savePosition();
- for (var /** @type {?} */ i = 0; i < len; i++) {
- if (!this._attemptCharCode(chars.charCodeAt(i))) {
- // If attempting to parse the string fails, we want to reset the parser
- // to where it was before the attempt
- this._restorePosition(initialPosition);
- return false;
- }
- }
- return true;
- };
- /**
- * @param {?} chars
- * @return {?}
- */
- _Tokenizer.prototype._attemptStrCaseInsensitive = /**
- * @param {?} chars
- * @return {?}
- */
- function (chars) {
- for (var /** @type {?} */ i = 0; i < chars.length; i++) {
- if (!this._attemptCharCodeCaseInsensitive(chars.charCodeAt(i))) {
- return false;
- }
- }
- return true;
- };
- /**
- * @param {?} chars
- * @return {?}
- */
- _Tokenizer.prototype._requireStr = /**
- * @param {?} chars
- * @return {?}
- */
- function (chars) {
- var /** @type {?} */ location = this._getLocation();
- if (!this._attemptStr(chars)) {
- throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location));
- }
- };
- /**
- * @param {?} predicate
- * @return {?}
- */
- _Tokenizer.prototype._attemptCharCodeUntilFn = /**
- * @param {?} predicate
- * @return {?}
- */
- function (predicate) {
- while (!predicate(this._peek)) {
- this._advance();
- }
- };
- /**
- * @param {?} predicate
- * @param {?} len
- * @return {?}
- */
- _Tokenizer.prototype._requireCharCodeUntilFn = /**
- * @param {?} predicate
- * @param {?} len
- * @return {?}
- */
- function (predicate, len) {
- var /** @type {?} */ start = this._getLocation();
- this._attemptCharCodeUntilFn(predicate);
- if (this._index - start.offset < len) {
- throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(start, start));
- }
- };
- /**
- * @param {?} char
- * @return {?}
- */
- _Tokenizer.prototype._attemptUntilChar = /**
- * @param {?} char
- * @return {?}
- */
- function (char) {
- while (this._peek !== char) {
- this._advance();
- }
- };
- /**
- * @param {?} decodeEntities
- * @return {?}
- */
- _Tokenizer.prototype._readChar = /**
- * @param {?} decodeEntities
- * @return {?}
- */
- function (decodeEntities) {
- if (decodeEntities && this._peek === $AMPERSAND) {
- return this._decodeEntity();
- }
- else {
- var /** @type {?} */ index = this._index;
- this._advance();
- return this._input[index];
- }
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._decodeEntity = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ start = this._getLocation();
- this._advance();
- if (this._attemptCharCode($HASH)) {
- var /** @type {?} */ isHex = this._attemptCharCode($x) || this._attemptCharCode($X);
- var /** @type {?} */ numberStart = this._getLocation().offset;
- this._attemptCharCodeUntilFn(isDigitEntityEnd);
- if (this._peek != $SEMICOLON) {
- throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan());
- }
- this._advance();
- var /** @type {?} */ strNum = this._input.substring(numberStart, this._index - 1);
- try {
- var /** @type {?} */ charCode = parseInt(strNum, isHex ? 16 : 10);
- return String.fromCharCode(charCode);
- }
- catch (/** @type {?} */ e) {
- var /** @type {?} */ entity = this._input.substring(start.offset + 1, this._index - 1);
- throw this._createError(_unknownEntityErrorMsg(entity), this._getSpan(start));
- }
- }
- else {
- var /** @type {?} */ startPosition = this._savePosition();
- this._attemptCharCodeUntilFn(isNamedEntityEnd);
- if (this._peek != $SEMICOLON) {
- this._restorePosition(startPosition);
- return '&';
- }
- this._advance();
- var /** @type {?} */ name_1 = this._input.substring(start.offset + 1, this._index - 1);
- var /** @type {?} */ char = NAMED_ENTITIES[name_1];
- if (!char) {
- throw this._createError(_unknownEntityErrorMsg(name_1), this._getSpan(start));
- }
- return char;
- }
- };
- /**
- * @param {?} decodeEntities
- * @param {?} firstCharOfEnd
- * @param {?} attemptEndRest
- * @return {?}
- */
- _Tokenizer.prototype._consumeRawText = /**
- * @param {?} decodeEntities
- * @param {?} firstCharOfEnd
- * @param {?} attemptEndRest
- * @return {?}
- */
- function (decodeEntities, firstCharOfEnd, attemptEndRest) {
- var /** @type {?} */ tagCloseStart;
- var /** @type {?} */ textStart = this._getLocation();
- this._beginToken(decodeEntities ? TokenType$1.ESCAPABLE_RAW_TEXT : TokenType$1.RAW_TEXT, textStart);
- var /** @type {?} */ parts = [];
- while (true) {
- tagCloseStart = this._getLocation();
- if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {
- break;
- }
- if (this._index > tagCloseStart.offset) {
- // add the characters consumed by the previous if statement to the output
- parts.push(this._input.substring(tagCloseStart.offset, this._index));
- }
- while (this._peek !== firstCharOfEnd) {
- parts.push(this._readChar(decodeEntities));
- }
- }
- return this._endToken([this._processCarriageReturns(parts.join(''))], tagCloseStart);
- };
- /**
- * @param {?} start
- * @return {?}
- */
- _Tokenizer.prototype._consumeComment = /**
- * @param {?} start
- * @return {?}
- */
- function (start) {
- var _this = this;
- this._beginToken(TokenType$1.COMMENT_START, start);
- this._requireCharCode($MINUS);
- this._endToken([]);
- var /** @type {?} */ textToken = this._consumeRawText(false, $MINUS, function () { return _this._attemptStr('->'); });
- this._beginToken(TokenType$1.COMMENT_END, textToken.sourceSpan.end);
- this._endToken([]);
- };
- /**
- * @param {?} start
- * @return {?}
- */
- _Tokenizer.prototype._consumeCdata = /**
- * @param {?} start
- * @return {?}
- */
- function (start) {
- var _this = this;
- this._beginToken(TokenType$1.CDATA_START, start);
- this._requireStr('CDATA[');
- this._endToken([]);
- var /** @type {?} */ textToken = this._consumeRawText(false, $RBRACKET, function () { return _this._attemptStr(']>'); });
- this._beginToken(TokenType$1.CDATA_END, textToken.sourceSpan.end);
- this._endToken([]);
- };
- /**
- * @param {?} start
- * @return {?}
- */
- _Tokenizer.prototype._consumeDocType = /**
- * @param {?} start
- * @return {?}
- */
- function (start) {
- this._beginToken(TokenType$1.DOC_TYPE, start);
- this._attemptUntilChar($GT);
- this._advance();
- this._endToken([this._input.substring(start.offset + 2, this._index - 1)]);
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._consumePrefixAndName = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ nameOrPrefixStart = this._index;
- var /** @type {?} */ prefix = /** @type {?} */ ((null));
- while (this._peek !== $COLON && !isPrefixEnd(this._peek)) {
- this._advance();
- }
- var /** @type {?} */ nameStart;
- if (this._peek === $COLON) {
- this._advance();
- prefix = this._input.substring(nameOrPrefixStart, this._index - 1);
- nameStart = this._index;
- }
- else {
- nameStart = nameOrPrefixStart;
- }
- this._requireCharCodeUntilFn(isNameEnd, this._index === nameStart ? 1 : 0);
- var /** @type {?} */ name = this._input.substring(nameStart, this._index);
- return [prefix, name];
- };
- /**
- * @param {?} start
- * @return {?}
- */
- _Tokenizer.prototype._consumeTagOpen = /**
- * @param {?} start
- * @return {?}
- */
- function (start) {
- var /** @type {?} */ savedPos = this._savePosition();
- var /** @type {?} */ tagName;
- var /** @type {?} */ lowercaseTagName;
- try {
- if (!isAsciiLetter(this._peek)) {
- throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan());
- }
- var /** @type {?} */ nameStart = this._index;
- this._consumeTagOpenStart(start);
- tagName = this._input.substring(nameStart, this._index);
- lowercaseTagName = tagName.toLowerCase();
- this._attemptCharCodeUntilFn(isNotWhitespace);
- while (this._peek !== $SLASH && this._peek !== $GT) {
- this._consumeAttributeName();
- this._attemptCharCodeUntilFn(isNotWhitespace);
- if (this._attemptCharCode($EQ)) {
- this._attemptCharCodeUntilFn(isNotWhitespace);
- this._consumeAttributeValue();
- }
- this._attemptCharCodeUntilFn(isNotWhitespace);
- }
- this._consumeTagOpenEnd();
- }
- catch (/** @type {?} */ e) {
- if (e instanceof _ControlFlowError) {
- // When the start tag is invalid, assume we want a "<"
- this._restorePosition(savedPos);
- // Back to back text tokens are merged at the end
- this._beginToken(TokenType$1.TEXT, start);
- this._endToken(['<']);
- return;
- }
- throw e;
- }
- var /** @type {?} */ contentTokenType = this._getTagDefinition(tagName).contentType;
- if (contentTokenType === TagContentType.RAW_TEXT) {
- this._consumeRawTextWithTagClose(lowercaseTagName, false);
- }
- else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) {
- this._consumeRawTextWithTagClose(lowercaseTagName, true);
- }
- };
- /**
- * @param {?} lowercaseTagName
- * @param {?} decodeEntities
- * @return {?}
- */
- _Tokenizer.prototype._consumeRawTextWithTagClose = /**
- * @param {?} lowercaseTagName
- * @param {?} decodeEntities
- * @return {?}
- */
- function (lowercaseTagName, decodeEntities) {
- var _this = this;
- var /** @type {?} */ textToken = this._consumeRawText(decodeEntities, $LT, function () {
- if (!_this._attemptCharCode($SLASH))
- return false;
- _this._attemptCharCodeUntilFn(isNotWhitespace);
- if (!_this._attemptStrCaseInsensitive(lowercaseTagName))
- return false;
- _this._attemptCharCodeUntilFn(isNotWhitespace);
- return _this._attemptCharCode($GT);
- });
- this._beginToken(TokenType$1.TAG_CLOSE, textToken.sourceSpan.end);
- this._endToken([/** @type {?} */ ((null)), lowercaseTagName]);
- };
- /**
- * @param {?} start
- * @return {?}
- */
- _Tokenizer.prototype._consumeTagOpenStart = /**
- * @param {?} start
- * @return {?}
- */
- function (start) {
- this._beginToken(TokenType$1.TAG_OPEN_START, start);
- var /** @type {?} */ parts = this._consumePrefixAndName();
- this._endToken(parts);
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._consumeAttributeName = /**
- * @return {?}
- */
- function () {
- this._beginToken(TokenType$1.ATTR_NAME);
- var /** @type {?} */ prefixAndName = this._consumePrefixAndName();
- this._endToken(prefixAndName);
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._consumeAttributeValue = /**
- * @return {?}
- */
- function () {
- this._beginToken(TokenType$1.ATTR_VALUE);
- var /** @type {?} */ value;
- if (this._peek === $SQ || this._peek === $DQ) {
- var /** @type {?} */ quoteChar = this._peek;
- this._advance();
- var /** @type {?} */ parts = [];
- while (this._peek !== quoteChar) {
- parts.push(this._readChar(true));
- }
- value = parts.join('');
- this._advance();
- }
- else {
- var /** @type {?} */ valueStart = this._index;
- this._requireCharCodeUntilFn(isNameEnd, 1);
- value = this._input.substring(valueStart, this._index);
- }
- this._endToken([this._processCarriageReturns(value)]);
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._consumeTagOpenEnd = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ tokenType = this._attemptCharCode($SLASH) ? TokenType$1.TAG_OPEN_END_VOID : TokenType$1.TAG_OPEN_END;
- this._beginToken(tokenType);
- this._requireCharCode($GT);
- this._endToken([]);
- };
- /**
- * @param {?} start
- * @return {?}
- */
- _Tokenizer.prototype._consumeTagClose = /**
- * @param {?} start
- * @return {?}
- */
- function (start) {
- this._beginToken(TokenType$1.TAG_CLOSE, start);
- this._attemptCharCodeUntilFn(isNotWhitespace);
- var /** @type {?} */ prefixAndName = this._consumePrefixAndName();
- this._attemptCharCodeUntilFn(isNotWhitespace);
- this._requireCharCode($GT);
- this._endToken(prefixAndName);
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._consumeExpansionFormStart = /**
- * @return {?}
- */
- function () {
- this._beginToken(TokenType$1.EXPANSION_FORM_START, this._getLocation());
- this._requireCharCode($LBRACE);
- this._endToken([]);
- this._expansionCaseStack.push(TokenType$1.EXPANSION_FORM_START);
- this._beginToken(TokenType$1.RAW_TEXT, this._getLocation());
- var /** @type {?} */ condition = this._readUntil($COMMA);
- this._endToken([condition], this._getLocation());
- this._requireCharCode($COMMA);
- this._attemptCharCodeUntilFn(isNotWhitespace);
- this._beginToken(TokenType$1.RAW_TEXT, this._getLocation());
- var /** @type {?} */ type = this._readUntil($COMMA);
- this._endToken([type], this._getLocation());
- this._requireCharCode($COMMA);
- this._attemptCharCodeUntilFn(isNotWhitespace);
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._consumeExpansionCaseStart = /**
- * @return {?}
- */
- function () {
- this._beginToken(TokenType$1.EXPANSION_CASE_VALUE, this._getLocation());
- var /** @type {?} */ value = this._readUntil($LBRACE).trim();
- this._endToken([value], this._getLocation());
- this._attemptCharCodeUntilFn(isNotWhitespace);
- this._beginToken(TokenType$1.EXPANSION_CASE_EXP_START, this._getLocation());
- this._requireCharCode($LBRACE);
- this._endToken([], this._getLocation());
- this._attemptCharCodeUntilFn(isNotWhitespace);
- this._expansionCaseStack.push(TokenType$1.EXPANSION_CASE_EXP_START);
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._consumeExpansionCaseEnd = /**
- * @return {?}
- */
- function () {
- this._beginToken(TokenType$1.EXPANSION_CASE_EXP_END, this._getLocation());
- this._requireCharCode($RBRACE);
- this._endToken([], this._getLocation());
- this._attemptCharCodeUntilFn(isNotWhitespace);
- this._expansionCaseStack.pop();
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._consumeExpansionFormEnd = /**
- * @return {?}
- */
- function () {
- this._beginToken(TokenType$1.EXPANSION_FORM_END, this._getLocation());
- this._requireCharCode($RBRACE);
- this._endToken([]);
- this._expansionCaseStack.pop();
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._consumeText = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ start = this._getLocation();
- this._beginToken(TokenType$1.TEXT, start);
- var /** @type {?} */ parts = [];
- do {
- if (this._interpolationConfig && this._attemptStr(this._interpolationConfig.start)) {
- parts.push(this._interpolationConfig.start);
- this._inInterpolation = true;
- }
- else if (this._interpolationConfig && this._inInterpolation &&
- this._attemptStr(this._interpolationConfig.end)) {
- parts.push(this._interpolationConfig.end);
- this._inInterpolation = false;
- }
- else {
- parts.push(this._readChar(true));
- }
- } while (!this._isTextEnd());
- this._endToken([this._processCarriageReturns(parts.join(''))]);
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._isTextEnd = /**
- * @return {?}
- */
- function () {
- if (this._peek === $LT || this._peek === $EOF) {
- return true;
- }
- if (this._tokenizeIcu && !this._inInterpolation) {
- if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) {
- // start of an expansion form
- return true;
- }
- if (this._peek === $RBRACE && this._isInExpansionCase()) {
- // end of and expansion case
- return true;
- }
- }
- return false;
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._savePosition = /**
- * @return {?}
- */
- function () {
- return [this._peek, this._index, this._column, this._line, this.tokens.length];
- };
- /**
- * @param {?} char
- * @return {?}
- */
- _Tokenizer.prototype._readUntil = /**
- * @param {?} char
- * @return {?}
- */
- function (char) {
- var /** @type {?} */ start = this._index;
- this._attemptUntilChar(char);
- return this._input.substring(start, this._index);
- };
- /**
- * @param {?} position
- * @return {?}
- */
- _Tokenizer.prototype._restorePosition = /**
- * @param {?} position
- * @return {?}
- */
- function (position) {
- this._peek = position[0];
- this._index = position[1];
- this._column = position[2];
- this._line = position[3];
- var /** @type {?} */ nbTokens = position[4];
- if (nbTokens < this.tokens.length) {
- // remove any extra tokens
- this.tokens = this.tokens.slice(0, nbTokens);
- }
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._isInExpansionCase = /**
- * @return {?}
- */
- function () {
- return this._expansionCaseStack.length > 0 &&
- this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
- TokenType$1.EXPANSION_CASE_EXP_START;
- };
- /**
- * @return {?}
- */
- _Tokenizer.prototype._isInExpansionForm = /**
- * @return {?}
- */
- function () {
- return this._expansionCaseStack.length > 0 &&
- this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
- TokenType$1.EXPANSION_FORM_START;
- };
- return _Tokenizer;
- }());
- /**
- * @param {?} code
- * @return {?}
- */
- function isNotWhitespace(code) {
- return !isWhitespace(code) || code === $EOF;
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isNameEnd(code) {
- return isWhitespace(code) || code === $GT || code === $SLASH ||
- code === $SQ || code === $DQ || code === $EQ;
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isPrefixEnd(code) {
- return (code < $a || $z < code) && (code < $A || $Z < code) &&
- (code < $0 || code > $9);
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isDigitEntityEnd(code) {
- return code == $SEMICOLON || code == $EOF || !isAsciiHexDigit(code);
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function isNamedEntityEnd(code) {
- return code == $SEMICOLON || code == $EOF || !isAsciiLetter(code);
- }
- /**
- * @param {?} input
- * @param {?} offset
- * @param {?} interpolationConfig
- * @return {?}
- */
- function isExpansionFormStart(input, offset, interpolationConfig) {
- var /** @type {?} */ isInterpolationStart = interpolationConfig ? input.indexOf(interpolationConfig.start, offset) == offset : false;
- return input.charCodeAt(offset) == $LBRACE && !isInterpolationStart;
- }
- /**
- * @param {?} peek
- * @return {?}
- */
- function isExpansionCaseStart(peek) {
- return peek === $EQ || isAsciiLetter(peek) || isDigit(peek);
- }
- /**
- * @param {?} code1
- * @param {?} code2
- * @return {?}
- */
- function compareCharCodeCaseInsensitive(code1, code2) {
- return toUpperCaseCharCode(code1) == toUpperCaseCharCode(code2);
- }
- /**
- * @param {?} code
- * @return {?}
- */
- function toUpperCaseCharCode(code) {
- return code >= $a && code <= $z ? code - $a + $A : code;
- }
- /**
- * @param {?} srcTokens
- * @return {?}
- */
- function mergeTextTokens(srcTokens) {
- var /** @type {?} */ dstTokens = [];
- var /** @type {?} */ lastDstToken = undefined;
- for (var /** @type {?} */ i = 0; i < srcTokens.length; i++) {
- var /** @type {?} */ token = srcTokens[i];
- if (lastDstToken && lastDstToken.type == TokenType$1.TEXT && token.type == TokenType$1.TEXT) {
- lastDstToken.parts[0] += token.parts[0];
- lastDstToken.sourceSpan.end = token.sourceSpan.end;
- }
- else {
- lastDstToken = token;
- dstTokens.push(lastDstToken);
- }
- }
- return dstTokens;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var TreeError = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TreeError, _super);
- function TreeError(elementName, span, msg) {
- var _this = _super.call(this, span, msg) || this;
- _this.elementName = elementName;
- return _this;
- }
- /**
- * @param {?} elementName
- * @param {?} span
- * @param {?} msg
- * @return {?}
- */
- TreeError.create = /**
- * @param {?} elementName
- * @param {?} span
- * @param {?} msg
- * @return {?}
- */
- function (elementName, span, msg) {
- return new TreeError(elementName, span, msg);
- };
- return TreeError;
- }(ParseError));
- var ParseTreeResult = /** @class */ (function () {
- function ParseTreeResult(rootNodes, errors) {
- this.rootNodes = rootNodes;
- this.errors = errors;
- }
- return ParseTreeResult;
- }());
- var Parser$1 = /** @class */ (function () {
- function Parser(getTagDefinition) {
- this.getTagDefinition = getTagDefinition;
- }
- /**
- * @param {?} source
- * @param {?} url
- * @param {?=} parseExpansionForms
- * @param {?=} interpolationConfig
- * @return {?}
- */
- Parser.prototype.parse = /**
- * @param {?} source
- * @param {?} url
- * @param {?=} parseExpansionForms
- * @param {?=} interpolationConfig
- * @return {?}
- */
- function (source, url, parseExpansionForms, interpolationConfig) {
- if (parseExpansionForms === void 0) { parseExpansionForms = false; }
- if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- var /** @type {?} */ tokensAndErrors = tokenize(source, url, this.getTagDefinition, parseExpansionForms, interpolationConfig);
- var /** @type {?} */ treeAndErrors = new _TreeBuilder(tokensAndErrors.tokens, this.getTagDefinition).build();
- return new ParseTreeResult(treeAndErrors.rootNodes, (/** @type {?} */ (tokensAndErrors.errors)).concat(treeAndErrors.errors));
- };
- return Parser;
- }());
- var _TreeBuilder = /** @class */ (function () {
- function _TreeBuilder(tokens, getTagDefinition) {
- this.tokens = tokens;
- this.getTagDefinition = getTagDefinition;
- this._index = -1;
- this._rootNodes = [];
- this._errors = [];
- this._elementStack = [];
- this._advance();
- }
- /**
- * @return {?}
- */
- _TreeBuilder.prototype.build = /**
- * @return {?}
- */
- function () {
- while (this._peek.type !== TokenType$1.EOF) {
- if (this._peek.type === TokenType$1.TAG_OPEN_START) {
- this._consumeStartTag(this._advance());
- }
- else if (this._peek.type === TokenType$1.TAG_CLOSE) {
- this._consumeEndTag(this._advance());
- }
- else if (this._peek.type === TokenType$1.CDATA_START) {
- this._closeVoidElement();
- this._consumeCdata(this._advance());
- }
- else if (this._peek.type === TokenType$1.COMMENT_START) {
- this._closeVoidElement();
- this._consumeComment(this._advance());
- }
- else if (this._peek.type === TokenType$1.TEXT || this._peek.type === TokenType$1.RAW_TEXT ||
- this._peek.type === TokenType$1.ESCAPABLE_RAW_TEXT) {
- this._closeVoidElement();
- this._consumeText(this._advance());
- }
- else if (this._peek.type === TokenType$1.EXPANSION_FORM_START) {
- this._consumeExpansion(this._advance());
- }
- else {
- // Skip all other tokens...
- this._advance();
- }
- }
- return new ParseTreeResult(this._rootNodes, this._errors);
- };
- /**
- * @return {?}
- */
- _TreeBuilder.prototype._advance = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ prev = this._peek;
- if (this._index < this.tokens.length - 1) {
- // Note: there is always an EOF token at the end
- this._index++;
- }
- this._peek = this.tokens[this._index];
- return prev;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- _TreeBuilder.prototype._advanceIf = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- if (this._peek.type === type) {
- return this._advance();
- }
- return null;
- };
- /**
- * @param {?} startToken
- * @return {?}
- */
- _TreeBuilder.prototype._consumeCdata = /**
- * @param {?} startToken
- * @return {?}
- */
- function (startToken) {
- this._consumeText(this._advance());
- this._advanceIf(TokenType$1.CDATA_END);
- };
- /**
- * @param {?} token
- * @return {?}
- */
- _TreeBuilder.prototype._consumeComment = /**
- * @param {?} token
- * @return {?}
- */
- function (token) {
- var /** @type {?} */ text = this._advanceIf(TokenType$1.RAW_TEXT);
- this._advanceIf(TokenType$1.COMMENT_END);
- var /** @type {?} */ value = text != null ? text.parts[0].trim() : null;
- this._addToParent(new Comment(value, token.sourceSpan));
- };
- /**
- * @param {?} token
- * @return {?}
- */
- _TreeBuilder.prototype._consumeExpansion = /**
- * @param {?} token
- * @return {?}
- */
- function (token) {
- var /** @type {?} */ switchValue = this._advance();
- var /** @type {?} */ type = this._advance();
- var /** @type {?} */ cases = [];
- // read =
- while (this._peek.type === TokenType$1.EXPANSION_CASE_VALUE) {
- var /** @type {?} */ expCase = this._parseExpansionCase();
- if (!expCase)
- return; // error
- cases.push(expCase);
- }
- // read the final }
- if (this._peek.type !== TokenType$1.EXPANSION_FORM_END) {
- this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '}'."));
- return;
- }
- var /** @type {?} */ sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end);
- this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan));
- this._advance();
- };
- /**
- * @return {?}
- */
- _TreeBuilder.prototype._parseExpansionCase = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ value = this._advance();
- // read {
- if (this._peek.type !== TokenType$1.EXPANSION_CASE_EXP_START) {
- this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '{'."));
- return null;
- }
- // read until }
- var /** @type {?} */ start = this._advance();
- var /** @type {?} */ exp = this._collectExpansionExpTokens(start);
- if (!exp)
- return null;
- var /** @type {?} */ end = this._advance();
- exp.push(new Token$1(TokenType$1.EOF, [], end.sourceSpan));
- // parse everything in between { and }
- var /** @type {?} */ parsedExp = new _TreeBuilder(exp, this.getTagDefinition).build();
- if (parsedExp.errors.length > 0) {
- this._errors = this._errors.concat(/** @type {?} */ (parsedExp.errors));
- return null;
- }
- var /** @type {?} */ sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end);
- var /** @type {?} */ expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end);
- return new ExpansionCase(value.parts[0], parsedExp.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan);
- };
- /**
- * @param {?} start
- * @return {?}
- */
- _TreeBuilder.prototype._collectExpansionExpTokens = /**
- * @param {?} start
- * @return {?}
- */
- function (start) {
- var /** @type {?} */ exp = [];
- var /** @type {?} */ expansionFormStack = [TokenType$1.EXPANSION_CASE_EXP_START];
- while (true) {
- if (this._peek.type === TokenType$1.EXPANSION_FORM_START ||
- this._peek.type === TokenType$1.EXPANSION_CASE_EXP_START) {
- expansionFormStack.push(this._peek.type);
- }
- if (this._peek.type === TokenType$1.EXPANSION_CASE_EXP_END) {
- if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_CASE_EXP_START)) {
- expansionFormStack.pop();
- if (expansionFormStack.length == 0)
- return exp;
- }
- else {
- this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
- return null;
- }
- }
- if (this._peek.type === TokenType$1.EXPANSION_FORM_END) {
- if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_FORM_START)) {
- expansionFormStack.pop();
- }
- else {
- this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
- return null;
- }
- }
- if (this._peek.type === TokenType$1.EOF) {
- this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
- return null;
- }
- exp.push(this._advance());
- }
- };
- /**
- * @param {?} token
- * @return {?}
- */
- _TreeBuilder.prototype._consumeText = /**
- * @param {?} token
- * @return {?}
- */
- function (token) {
- var /** @type {?} */ text = token.parts[0];
- if (text.length > 0 && text[0] == '\n') {
- var /** @type {?} */ parent_1 = this._getParentElement();
- if (parent_1 != null && parent_1.children.length == 0 &&
- this.getTagDefinition(parent_1.name).ignoreFirstLf) {
- text = text.substring(1);
- }
- }
- if (text.length > 0) {
- this._addToParent(new Text(text, token.sourceSpan));
- }
- };
- /**
- * @return {?}
- */
- _TreeBuilder.prototype._closeVoidElement = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ el = this._getParentElement();
- if (el && this.getTagDefinition(el.name).isVoid) {
- this._elementStack.pop();
- }
- };
- /**
- * @param {?} startTagToken
- * @return {?}
- */
- _TreeBuilder.prototype._consumeStartTag = /**
- * @param {?} startTagToken
- * @return {?}
- */
- function (startTagToken) {
- var /** @type {?} */ prefix = startTagToken.parts[0];
- var /** @type {?} */ name = startTagToken.parts[1];
- var /** @type {?} */ attrs = [];
- while (this._peek.type === TokenType$1.ATTR_NAME) {
- attrs.push(this._consumeAttr(this._advance()));
- }
- var /** @type {?} */ fullName = this._getElementFullName(prefix, name, this._getParentElement());
- var /** @type {?} */ selfClosing = false;
- // Note: There could have been a tokenizer error
- // so that we don't get a token for the end tag...
- if (this._peek.type === TokenType$1.TAG_OPEN_END_VOID) {
- this._advance();
- selfClosing = true;
- var /** @type {?} */ tagDef = this.getTagDefinition(fullName);
- if (!(tagDef.canSelfClose || getNsPrefix(fullName) !== null || tagDef.isVoid)) {
- this._errors.push(TreeError.create(fullName, startTagToken.sourceSpan, "Only void and foreign elements can be self closed \"" + startTagToken.parts[1] + "\""));
- }
- }
- else if (this._peek.type === TokenType$1.TAG_OPEN_END) {
- this._advance();
- selfClosing = false;
- }
- var /** @type {?} */ end = this._peek.sourceSpan.start;
- var /** @type {?} */ span = new ParseSourceSpan(startTagToken.sourceSpan.start, end);
- var /** @type {?} */ el = new Element(fullName, attrs, [], span, span, undefined);
- this._pushElement(el);
- if (selfClosing) {
- this._popElement(fullName);
- el.endSourceSpan = span;
- }
- };
- /**
- * @param {?} el
- * @return {?}
- */
- _TreeBuilder.prototype._pushElement = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- var /** @type {?} */ parentEl = this._getParentElement();
- if (parentEl && this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) {
- this._elementStack.pop();
- }
- var /** @type {?} */ tagDef = this.getTagDefinition(el.name);
- var _a = this._getParentElementSkippingContainers(), parent = _a.parent, container = _a.container;
- if (parent && tagDef.requireExtraParent(parent.name)) {
- var /** @type {?} */ newParent = new Element(tagDef.parentToAdd, [], [], el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
- this._insertBeforeContainer(parent, container, newParent);
- }
- this._addToParent(el);
- this._elementStack.push(el);
- };
- /**
- * @param {?} endTagToken
- * @return {?}
- */
- _TreeBuilder.prototype._consumeEndTag = /**
- * @param {?} endTagToken
- * @return {?}
- */
- function (endTagToken) {
- var /** @type {?} */ fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement());
- if (this._getParentElement()) {
- /** @type {?} */ ((this._getParentElement())).endSourceSpan = endTagToken.sourceSpan;
- }
- if (this.getTagDefinition(fullName).isVoid) {
- this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, "Void elements do not have end tags \"" + endTagToken.parts[1] + "\""));
- }
- else if (!this._popElement(fullName)) {
- 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";
- this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
- }
- };
- /**
- * @param {?} fullName
- * @return {?}
- */
- _TreeBuilder.prototype._popElement = /**
- * @param {?} fullName
- * @return {?}
- */
- function (fullName) {
- for (var /** @type {?} */ stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
- var /** @type {?} */ el = this._elementStack[stackIndex];
- if (el.name == fullName) {
- this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
- return true;
- }
- if (!this.getTagDefinition(el.name).closedByParent) {
- return false;
- }
- }
- return false;
- };
- /**
- * @param {?} attrName
- * @return {?}
- */
- _TreeBuilder.prototype._consumeAttr = /**
- * @param {?} attrName
- * @return {?}
- */
- function (attrName) {
- var /** @type {?} */ fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);
- var /** @type {?} */ end = attrName.sourceSpan.end;
- var /** @type {?} */ value = '';
- var /** @type {?} */ valueSpan = /** @type {?} */ ((undefined));
- if (this._peek.type === TokenType$1.ATTR_VALUE) {
- var /** @type {?} */ valueToken = this._advance();
- value = valueToken.parts[0];
- end = valueToken.sourceSpan.end;
- valueSpan = valueToken.sourceSpan;
- }
- return new Attribute$1(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end), valueSpan);
- };
- /**
- * @return {?}
- */
- _TreeBuilder.prototype._getParentElement = /**
- * @return {?}
- */
- function () {
- return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
- };
- /**
- * Returns the parent in the DOM and the container.
- *
- * `<ng-container>` elements are skipped as they are not rendered as DOM element.
- * @return {?}
- */
- _TreeBuilder.prototype._getParentElementSkippingContainers = /**
- * Returns the parent in the DOM and the container.
- *
- * `<ng-container>` elements are skipped as they are not rendered as DOM element.
- * @return {?}
- */
- function () {
- var /** @type {?} */ container = null;
- for (var /** @type {?} */ i = this._elementStack.length - 1; i >= 0; i--) {
- if (!isNgContainer(this._elementStack[i].name)) {
- return { parent: this._elementStack[i], container: container };
- }
- container = this._elementStack[i];
- }
- return { parent: null, container: container };
- };
- /**
- * @param {?} node
- * @return {?}
- */
- _TreeBuilder.prototype._addToParent = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- var /** @type {?} */ parent = this._getParentElement();
- if (parent != null) {
- parent.children.push(node);
- }
- else {
- this._rootNodes.push(node);
- }
- };
- /**
- * Insert a node between the parent and the container.
- * When no container is given, the node is appended as a child of the parent.
- * Also updates the element stack accordingly.
- *
- * \@internal
- * @param {?} parent
- * @param {?} container
- * @param {?} node
- * @return {?}
- */
- _TreeBuilder.prototype._insertBeforeContainer = /**
- * Insert a node between the parent and the container.
- * When no container is given, the node is appended as a child of the parent.
- * Also updates the element stack accordingly.
- *
- * \@internal
- * @param {?} parent
- * @param {?} container
- * @param {?} node
- * @return {?}
- */
- function (parent, container, node) {
- if (!container) {
- this._addToParent(node);
- this._elementStack.push(node);
- }
- else {
- if (parent) {
- // replace the container with the new node in the children
- var /** @type {?} */ index = parent.children.indexOf(container);
- parent.children[index] = node;
- }
- else {
- this._rootNodes.push(node);
- }
- node.children.push(container);
- this._elementStack.splice(this._elementStack.indexOf(container), 0, node);
- }
- };
- /**
- * @param {?} prefix
- * @param {?} localName
- * @param {?} parentElement
- * @return {?}
- */
- _TreeBuilder.prototype._getElementFullName = /**
- * @param {?} prefix
- * @param {?} localName
- * @param {?} parentElement
- * @return {?}
- */
- function (prefix, localName, parentElement) {
- if (prefix == null) {
- prefix = /** @type {?} */ ((this.getTagDefinition(localName).implicitNamespacePrefix));
- if (prefix == null && parentElement != null) {
- prefix = getNsPrefix(parentElement.name);
- }
- }
- return mergeNsAndName(prefix, localName);
- };
- return _TreeBuilder;
- }());
- /**
- * @param {?} stack
- * @param {?} element
- * @return {?}
- */
- function lastOnStack(stack, element) {
- return stack.length > 0 && stack[stack.length - 1] === element;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} message
- * @return {?}
- */
- function digest(message) {
- return message.id || sha1(serializeNodes(message.nodes).join('') + ("[" + message.meaning + "]"));
- }
- /**
- * @param {?} message
- * @return {?}
- */
- function decimalDigest(message) {
- if (message.id) {
- return message.id;
- }
- var /** @type {?} */ visitor = new _SerializerIgnoreIcuExpVisitor();
- var /** @type {?} */ parts = message.nodes.map(function (a) { return a.visit(visitor, null); });
- return computeMsgId(parts.join(''), message.meaning);
- }
- /**
- * Serialize the i18n ast to something xml-like in order to generate an UID.
- *
- * The visitor is also used in the i18n parser tests
- *
- * \@internal
- */
- var _SerializerVisitor = /** @class */ (function () {
- function _SerializerVisitor() {
- }
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- _SerializerVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) { return text.value; };
- /**
- * @param {?} container
- * @param {?} context
- * @return {?}
- */
- _SerializerVisitor.prototype.visitContainer = /**
- * @param {?} container
- * @param {?} context
- * @return {?}
- */
- function (container, context) {
- var _this = this;
- return "[" + container.children.map(function (child) { return child.visit(_this); }).join(', ') + "]";
- };
- /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- _SerializerVisitor.prototype.visitIcu = /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- function (icu, context) {
- var _this = this;
- var /** @type {?} */ strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
- return "{" + icu.expression + ", " + icu.type + ", " + strCases.join(', ') + "}";
- };
- /**
- * @param {?} ph
- * @param {?} context
- * @return {?}
- */
- _SerializerVisitor.prototype.visitTagPlaceholder = /**
- * @param {?} ph
- * @param {?} context
- * @return {?}
- */
- function (ph, context) {
- var _this = this;
- return ph.isVoid ?
- "<ph tag name=\"" + ph.startName + "\"/>" :
- "<ph tag name=\"" + ph.startName + "\">" + ph.children.map(function (child) { return child.visit(_this); }).join(', ') + "</ph name=\"" + ph.closeName + "\">";
- };
- /**
- * @param {?} ph
- * @param {?} context
- * @return {?}
- */
- _SerializerVisitor.prototype.visitPlaceholder = /**
- * @param {?} ph
- * @param {?} context
- * @return {?}
- */
- function (ph, context) {
- return ph.value ? "<ph name=\"" + ph.name + "\">" + ph.value + "</ph>" : "<ph name=\"" + ph.name + "\"/>";
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _SerializerVisitor.prototype.visitIcuPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- return "<ph icu name=\"" + ph.name + "\">" + ph.value.visit(this) + "</ph>";
- };
- return _SerializerVisitor;
- }());
- var serializerVisitor = new _SerializerVisitor();
- /**
- * @param {?} nodes
- * @return {?}
- */
- function serializeNodes(nodes) {
- return nodes.map(function (a) { return a.visit(serializerVisitor, null); });
- }
- /**
- * Serialize the i18n ast to something xml-like in order to generate an UID.
- *
- * Ignore the ICU expressions so that message IDs stays identical if only the expression changes.
- *
- * \@internal
- */
- var _SerializerIgnoreIcuExpVisitor = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_SerializerIgnoreIcuExpVisitor, _super);
- function _SerializerIgnoreIcuExpVisitor() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- _SerializerIgnoreIcuExpVisitor.prototype.visitIcu = /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- function (icu, context) {
- var _this = this;
- var /** @type {?} */ strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
- // Do not take the expression into account
- return "{" + icu.type + ", " + strCases.join(', ') + "}";
- };
- return _SerializerIgnoreIcuExpVisitor;
- }(_SerializerVisitor));
- /**
- * Compute the SHA1 of the given string
- *
- * see http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
- *
- * WARNING: this function has not been designed not tested with security in mind.
- * DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.
- * @param {?} str
- * @return {?}
- */
- function sha1(str) {
- var /** @type {?} */ utf8 = utf8Encode(str);
- var /** @type {?} */ words32 = stringToWords32(utf8, Endian.Big);
- var /** @type {?} */ len = utf8.length * 8;
- var /** @type {?} */ w = new Array(80);
- var _a = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0], a = _a[0], b = _a[1], c = _a[2], d = _a[3], e = _a[4];
- words32[len >> 5] |= 0x80 << (24 - len % 32);
- words32[((len + 64 >> 9) << 4) + 15] = len;
- for (var /** @type {?} */ i = 0; i < words32.length; i += 16) {
- var _b = [a, b, c, d, e], h0 = _b[0], h1 = _b[1], h2 = _b[2], h3 = _b[3], h4 = _b[4];
- for (var /** @type {?} */ j = 0; j < 80; j++) {
- if (j < 16) {
- w[j] = words32[i + j];
- }
- else {
- w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
- }
- var _c = fk(j, b, c, d), f = _c[0], k = _c[1];
- var /** @type {?} */ temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
- _d = [d, c, rol32(b, 30), a, temp], e = _d[0], d = _d[1], c = _d[2], b = _d[3], a = _d[4];
- }
- _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];
- }
- return byteStringToHexString(words32ToByteString([a, b, c, d, e]));
- var _d, _e;
- }
- /**
- * @param {?} index
- * @param {?} b
- * @param {?} c
- * @param {?} d
- * @return {?}
- */
- function fk(index, b, c, d) {
- if (index < 20) {
- return [(b & c) | (~b & d), 0x5a827999];
- }
- if (index < 40) {
- return [b ^ c ^ d, 0x6ed9eba1];
- }
- if (index < 60) {
- return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc];
- }
- return [b ^ c ^ d, 0xca62c1d6];
- }
- /**
- * Compute the fingerprint of the given string
- *
- * The output is 64 bit number encoded as a decimal string
- *
- * based on:
- * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
- * @param {?} str
- * @return {?}
- */
- function fingerprint(str) {
- var /** @type {?} */ utf8 = utf8Encode(str);
- var _a = [hash32(utf8, 0), hash32(utf8, 102072)], hi = _a[0], lo = _a[1];
- if (hi == 0 && (lo == 0 || lo == 1)) {
- hi = hi ^ 0x130f9bef;
- lo = lo ^ -0x6b5f56d8;
- }
- return [hi, lo];
- }
- /**
- * @param {?} msg
- * @param {?} meaning
- * @return {?}
- */
- function computeMsgId(msg, meaning) {
- var _a = fingerprint(msg), hi = _a[0], lo = _a[1];
- if (meaning) {
- var _b = fingerprint(meaning), him = _b[0], lom = _b[1];
- _c = add64(rol64([hi, lo], 1), [him, lom]), hi = _c[0], lo = _c[1];
- }
- return byteStringToDecString(words32ToByteString([hi & 0x7fffffff, lo]));
- var _c;
- }
- /**
- * @param {?} str
- * @param {?} c
- * @return {?}
- */
- function hash32(str, c) {
- var _a = [0x9e3779b9, 0x9e3779b9], a = _a[0], b = _a[1];
- var /** @type {?} */ i;
- var /** @type {?} */ len = str.length;
- for (i = 0; i + 12 <= len; i += 12) {
- a = add32(a, wordAt(str, i, Endian.Little));
- b = add32(b, wordAt(str, i + 4, Endian.Little));
- c = add32(c, wordAt(str, i + 8, Endian.Little));
- _b = mix([a, b, c]), a = _b[0], b = _b[1], c = _b[2];
- }
- a = add32(a, wordAt(str, i, Endian.Little));
- b = add32(b, wordAt(str, i + 4, Endian.Little));
- // the first byte of c is reserved for the length
- c = add32(c, len);
- c = add32(c, wordAt(str, i + 8, Endian.Little) << 8);
- return mix([a, b, c])[2];
- var _b;
- }
- /**
- * @param {?} __0
- * @return {?}
- */
- function mix(_a) {
- var a = _a[0], b = _a[1], c = _a[2];
- a = sub32(a, b);
- a = sub32(a, c);
- a ^= c >>> 13;
- b = sub32(b, c);
- b = sub32(b, a);
- b ^= a << 8;
- c = sub32(c, a);
- c = sub32(c, b);
- c ^= b >>> 13;
- a = sub32(a, b);
- a = sub32(a, c);
- a ^= c >>> 12;
- b = sub32(b, c);
- b = sub32(b, a);
- b ^= a << 16;
- c = sub32(c, a);
- c = sub32(c, b);
- c ^= b >>> 5;
- a = sub32(a, b);
- a = sub32(a, c);
- a ^= c >>> 3;
- b = sub32(b, c);
- b = sub32(b, a);
- b ^= a << 10;
- c = sub32(c, a);
- c = sub32(c, b);
- c ^= b >>> 15;
- return [a, b, c];
- }
- /** @enum {number} */
- var Endian = {
- Little: 0,
- Big: 1,
- };
- Endian[Endian.Little] = "Little";
- Endian[Endian.Big] = "Big";
- /**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function add32(a, b) {
- return add32to64(a, b)[1];
- }
- /**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function add32to64(a, b) {
- var /** @type {?} */ low = (a & 0xffff) + (b & 0xffff);
- var /** @type {?} */ high = (a >>> 16) + (b >>> 16) + (low >>> 16);
- return [high >>> 16, (high << 16) | (low & 0xffff)];
- }
- /**
- * @param {?} __0
- * @param {?} __1
- * @return {?}
- */
- function add64(_a, _b) {
- var ah = _a[0], al = _a[1];
- var bh = _b[0], bl = _b[1];
- var _c = add32to64(al, bl), carry = _c[0], l = _c[1];
- var /** @type {?} */ h = add32(add32(ah, bh), carry);
- return [h, l];
- }
- /**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function sub32(a, b) {
- var /** @type {?} */ low = (a & 0xffff) - (b & 0xffff);
- var /** @type {?} */ high = (a >> 16) - (b >> 16) + (low >> 16);
- return (high << 16) | (low & 0xffff);
- }
- /**
- * @param {?} a
- * @param {?} count
- * @return {?}
- */
- function rol32(a, count) {
- return (a << count) | (a >>> (32 - count));
- }
- /**
- * @param {?} __0
- * @param {?} count
- * @return {?}
- */
- function rol64(_a, count) {
- var hi = _a[0], lo = _a[1];
- var /** @type {?} */ h = (hi << count) | (lo >>> (32 - count));
- var /** @type {?} */ l = (lo << count) | (hi >>> (32 - count));
- return [h, l];
- }
- /**
- * @param {?} str
- * @param {?} endian
- * @return {?}
- */
- function stringToWords32(str, endian) {
- var /** @type {?} */ words32 = Array((str.length + 3) >>> 2);
- for (var /** @type {?} */ i = 0; i < words32.length; i++) {
- words32[i] = wordAt(str, i * 4, endian);
- }
- return words32;
- }
- /**
- * @param {?} str
- * @param {?} index
- * @return {?}
- */
- function byteAt(str, index) {
- return index >= str.length ? 0 : str.charCodeAt(index) & 0xff;
- }
- /**
- * @param {?} str
- * @param {?} index
- * @param {?} endian
- * @return {?}
- */
- function wordAt(str, index, endian) {
- var /** @type {?} */ word = 0;
- if (endian === Endian.Big) {
- for (var /** @type {?} */ i = 0; i < 4; i++) {
- word += byteAt(str, index + i) << (24 - 8 * i);
- }
- }
- else {
- for (var /** @type {?} */ i = 0; i < 4; i++) {
- word += byteAt(str, index + i) << 8 * i;
- }
- }
- return word;
- }
- /**
- * @param {?} words32
- * @return {?}
- */
- function words32ToByteString(words32) {
- return words32.reduce(function (str, word) { return str + word32ToByteString(word); }, '');
- }
- /**
- * @param {?} word
- * @return {?}
- */
- function word32ToByteString(word) {
- var /** @type {?} */ str = '';
- for (var /** @type {?} */ i = 0; i < 4; i++) {
- str += String.fromCharCode((word >>> 8 * (3 - i)) & 0xff);
- }
- return str;
- }
- /**
- * @param {?} str
- * @return {?}
- */
- function byteStringToHexString(str) {
- var /** @type {?} */ hex = '';
- for (var /** @type {?} */ i = 0; i < str.length; i++) {
- var /** @type {?} */ b = byteAt(str, i);
- hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16);
- }
- return hex.toLowerCase();
- }
- /**
- * @param {?} str
- * @return {?}
- */
- function byteStringToDecString(str) {
- var /** @type {?} */ decimal = '';
- var /** @type {?} */ toThePower = '1';
- for (var /** @type {?} */ i = str.length - 1; i >= 0; i--) {
- decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i), toThePower));
- toThePower = numberTimesBigInt(256, toThePower);
- }
- return decimal.split('').reverse().join('');
- }
- /**
- * @param {?} x
- * @param {?} y
- * @return {?}
- */
- function addBigInt(x, y) {
- var /** @type {?} */ sum = '';
- var /** @type {?} */ len = Math.max(x.length, y.length);
- for (var /** @type {?} */ i = 0, /** @type {?} */ carry = 0; i < len || carry; i++) {
- var /** @type {?} */ tmpSum = carry + +(x[i] || 0) + +(y[i] || 0);
- if (tmpSum >= 10) {
- carry = 1;
- sum += tmpSum - 10;
- }
- else {
- carry = 0;
- sum += tmpSum;
- }
- }
- return sum;
- }
- /**
- * @param {?} num
- * @param {?} b
- * @return {?}
- */
- function numberTimesBigInt(num, b) {
- var /** @type {?} */ product = '';
- var /** @type {?} */ bToThePower = b;
- for (; num !== 0; num = num >>> 1) {
- if (num & 1)
- product = addBigInt(product, bToThePower);
- bToThePower = addBigInt(bToThePower, bToThePower);
- }
- return product;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var Message = /** @class */ (function () {
- /**
- * @param nodes message AST
- * @param placeholders maps placeholder names to static content
- * @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
- * @param meaning
- * @param description
- * @param id
- */
- function Message(nodes, placeholders, placeholderToMessage, meaning, description, id) {
- this.nodes = nodes;
- this.placeholders = placeholders;
- this.placeholderToMessage = placeholderToMessage;
- this.meaning = meaning;
- this.description = description;
- this.id = id;
- if (nodes.length) {
- this.sources = [{
- filePath: nodes[0].sourceSpan.start.file.url,
- startLine: nodes[0].sourceSpan.start.line + 1,
- startCol: nodes[0].sourceSpan.start.col + 1,
- endLine: nodes[nodes.length - 1].sourceSpan.end.line + 1,
- endCol: nodes[0].sourceSpan.start.col + 1
- }];
- }
- else {
- this.sources = [];
- }
- }
- return Message;
- }());
- /**
- * @record
- */
- /**
- * @record
- */
- var Text$1 = /** @class */ (function () {
- function Text(value, sourceSpan) {
- this.value = value;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- Text.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitText(this, context); };
- return Text;
- }());
- var Container = /** @class */ (function () {
- function Container(children, sourceSpan) {
- this.children = children;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- Container.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitContainer(this, context); };
- return Container;
- }());
- var Icu = /** @class */ (function () {
- function Icu(expression, type, cases, sourceSpan) {
- this.expression = expression;
- this.type = type;
- this.cases = cases;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- Icu.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitIcu(this, context); };
- return Icu;
- }());
- var TagPlaceholder = /** @class */ (function () {
- function TagPlaceholder(tag, attrs, startName, closeName, children, isVoid, sourceSpan) {
- this.tag = tag;
- this.attrs = attrs;
- this.startName = startName;
- this.closeName = closeName;
- this.children = children;
- this.isVoid = isVoid;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- TagPlaceholder.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitTagPlaceholder(this, context); };
- return TagPlaceholder;
- }());
- var Placeholder = /** @class */ (function () {
- function Placeholder(value, name, sourceSpan) {
- this.value = value;
- this.name = name;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- Placeholder.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitPlaceholder(this, context); };
- return Placeholder;
- }());
- var IcuPlaceholder = /** @class */ (function () {
- function IcuPlaceholder(value, name, sourceSpan) {
- this.value = value;
- this.name = name;
- this.sourceSpan = sourceSpan;
- }
- /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- IcuPlaceholder.prototype.visit = /**
- * @param {?} visitor
- * @param {?=} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitIcuPlaceholder(this, context); };
- return IcuPlaceholder;
- }());
- /**
- * @record
- */
- var CloneVisitor = /** @class */ (function () {
- function CloneVisitor() {
- }
- /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- CloneVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- function (text, context) { return new Text$1(text.value, text.sourceSpan); };
- /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- CloneVisitor.prototype.visitContainer = /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- function (container, context) {
- var _this = this;
- var /** @type {?} */ children = container.children.map(function (n) { return n.visit(_this, context); });
- return new Container(children, container.sourceSpan);
- };
- /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- CloneVisitor.prototype.visitIcu = /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- function (icu, context) {
- var _this = this;
- var /** @type {?} */ cases = {};
- Object.keys(icu.cases).forEach(function (key) { return cases[key] = icu.cases[key].visit(_this, context); });
- var /** @type {?} */ msg = new Icu(icu.expression, icu.type, cases, icu.sourceSpan);
- msg.expressionPlaceholder = icu.expressionPlaceholder;
- return msg;
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- CloneVisitor.prototype.visitTagPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var _this = this;
- var /** @type {?} */ children = ph.children.map(function (n) { return n.visit(_this, context); });
- return new TagPlaceholder(ph.tag, ph.attrs, ph.startName, ph.closeName, children, ph.isVoid, ph.sourceSpan);
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- CloneVisitor.prototype.visitPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- return new Placeholder(ph.value, ph.name, ph.sourceSpan);
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- CloneVisitor.prototype.visitIcuPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- return new IcuPlaceholder(ph.value, ph.name, ph.sourceSpan);
- };
- return CloneVisitor;
- }());
- var RecurseVisitor = /** @class */ (function () {
- function RecurseVisitor() {
- }
- /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- RecurseVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- function (text, context) { };
- /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- RecurseVisitor.prototype.visitContainer = /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- function (container, context) {
- var _this = this;
- container.children.forEach(function (child) { return child.visit(_this); });
- };
- /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- RecurseVisitor.prototype.visitIcu = /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- function (icu, context) {
- var _this = this;
- Object.keys(icu.cases).forEach(function (k) { icu.cases[k].visit(_this); });
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- RecurseVisitor.prototype.visitTagPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var _this = this;
- ph.children.forEach(function (child) { return child.visit(_this); });
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- RecurseVisitor.prototype.visitPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) { };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- RecurseVisitor.prototype.visitIcuPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) { };
- return RecurseVisitor;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var HtmlTagDefinition = /** @class */ (function () {
- function HtmlTagDefinition(_a) {
- 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;
- var _this = this;
- this.closedByChildren = {};
- this.closedByParent = false;
- this.canSelfClose = false;
- if (closedByChildren && closedByChildren.length > 0) {
- closedByChildren.forEach(function (tagName) { return _this.closedByChildren[tagName] = true; });
- }
- this.isVoid = isVoid;
- this.closedByParent = closedByParent || isVoid;
- if (requiredParents && requiredParents.length > 0) {
- this.requiredParents = {};
- // The first parent is the list is automatically when none of the listed parents are present
- this.parentToAdd = requiredParents[0];
- requiredParents.forEach(function (tagName) { return _this.requiredParents[tagName] = true; });
- }
- this.implicitNamespacePrefix = implicitNamespacePrefix || null;
- this.contentType = contentType;
- this.ignoreFirstLf = ignoreFirstLf;
- }
- /**
- * @param {?} currentParent
- * @return {?}
- */
- HtmlTagDefinition.prototype.requireExtraParent = /**
- * @param {?} currentParent
- * @return {?}
- */
- function (currentParent) {
- if (!this.requiredParents) {
- return false;
- }
- if (!currentParent) {
- return true;
- }
- var /** @type {?} */ lcParent = currentParent.toLowerCase();
- var /** @type {?} */ isParentTemplate = lcParent === 'template' || currentParent === 'ng-template';
- return !isParentTemplate && this.requiredParents[lcParent] != true;
- };
- /**
- * @param {?} name
- * @return {?}
- */
- HtmlTagDefinition.prototype.isClosedByChild = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- return this.isVoid || name.toLowerCase() in this.closedByChildren;
- };
- return HtmlTagDefinition;
- }());
- // see http://www.w3.org/TR/html51/syntax.html#optional-tags
- // This implementation does not fully conform to the HTML5 spec.
- var TAG_DEFINITIONS = {
- 'base': new HtmlTagDefinition({ isVoid: true }),
- 'meta': new HtmlTagDefinition({ isVoid: true }),
- 'area': new HtmlTagDefinition({ isVoid: true }),
- 'embed': new HtmlTagDefinition({ isVoid: true }),
- 'link': new HtmlTagDefinition({ isVoid: true }),
- 'img': new HtmlTagDefinition({ isVoid: true }),
- 'input': new HtmlTagDefinition({ isVoid: true }),
- 'param': new HtmlTagDefinition({ isVoid: true }),
- 'hr': new HtmlTagDefinition({ isVoid: true }),
- 'br': new HtmlTagDefinition({ isVoid: true }),
- 'source': new HtmlTagDefinition({ isVoid: true }),
- 'track': new HtmlTagDefinition({ isVoid: true }),
- 'wbr': new HtmlTagDefinition({ isVoid: true }),
- 'p': new HtmlTagDefinition({
- closedByChildren: [
- 'address', 'article', 'aside', 'blockquote', 'div', 'dl', 'fieldset', 'footer', 'form',
- 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr',
- 'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'
- ],
- closedByParent: true
- }),
- 'thead': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'] }),
- 'tbody': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'], closedByParent: true }),
- 'tfoot': new HtmlTagDefinition({ closedByChildren: ['tbody'], closedByParent: true }),
- 'tr': new HtmlTagDefinition({
- closedByChildren: ['tr'],
- requiredParents: ['tbody', 'tfoot', 'thead'],
- closedByParent: true
- }),
- 'td': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }),
- 'th': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }),
- 'col': new HtmlTagDefinition({ requiredParents: ['colgroup'], isVoid: true }),
- 'svg': new HtmlTagDefinition({ implicitNamespacePrefix: 'svg' }),
- 'math': new HtmlTagDefinition({ implicitNamespacePrefix: 'math' }),
- 'li': new HtmlTagDefinition({ closedByChildren: ['li'], closedByParent: true }),
- 'dt': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'] }),
- 'dd': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'], closedByParent: true }),
- 'rb': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
- 'rt': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
- 'rtc': new HtmlTagDefinition({ closedByChildren: ['rb', 'rtc', 'rp'], closedByParent: true }),
- 'rp': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
- 'optgroup': new HtmlTagDefinition({ closedByChildren: ['optgroup'], closedByParent: true }),
- 'option': new HtmlTagDefinition({ closedByChildren: ['option', 'optgroup'], closedByParent: true }),
- 'pre': new HtmlTagDefinition({ ignoreFirstLf: true }),
- 'listing': new HtmlTagDefinition({ ignoreFirstLf: true }),
- 'style': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
- 'script': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
- 'title': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT }),
- 'textarea': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT, ignoreFirstLf: true }),
- };
- var _DEFAULT_TAG_DEFINITION = new HtmlTagDefinition();
- /**
- * @param {?} tagName
- * @return {?}
- */
- function getHtmlTagDefinition(tagName) {
- return TAG_DEFINITIONS[tagName.toLowerCase()] || _DEFAULT_TAG_DEFINITION;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var TAG_TO_PLACEHOLDER_NAMES = {
- 'A': 'LINK',
- 'B': 'BOLD_TEXT',
- 'BR': 'LINE_BREAK',
- 'EM': 'EMPHASISED_TEXT',
- 'H1': 'HEADING_LEVEL1',
- 'H2': 'HEADING_LEVEL2',
- 'H3': 'HEADING_LEVEL3',
- 'H4': 'HEADING_LEVEL4',
- 'H5': 'HEADING_LEVEL5',
- 'H6': 'HEADING_LEVEL6',
- 'HR': 'HORIZONTAL_RULE',
- 'I': 'ITALIC_TEXT',
- 'LI': 'LIST_ITEM',
- 'LINK': 'MEDIA_LINK',
- 'OL': 'ORDERED_LIST',
- 'P': 'PARAGRAPH',
- 'Q': 'QUOTATION',
- 'S': 'STRIKETHROUGH_TEXT',
- 'SMALL': 'SMALL_TEXT',
- 'SUB': 'SUBSTRIPT',
- 'SUP': 'SUPERSCRIPT',
- 'TBODY': 'TABLE_BODY',
- 'TD': 'TABLE_CELL',
- 'TFOOT': 'TABLE_FOOTER',
- 'TH': 'TABLE_HEADER_CELL',
- 'THEAD': 'TABLE_HEADER',
- 'TR': 'TABLE_ROW',
- 'TT': 'MONOSPACED_TEXT',
- 'U': 'UNDERLINED_TEXT',
- 'UL': 'UNORDERED_LIST',
- };
- /**
- * Creates unique names for placeholder with different content.
- *
- * Returns the same placeholder name when the content is identical.
- */
- var PlaceholderRegistry = /** @class */ (function () {
- function PlaceholderRegistry() {
- this._placeHolderNameCounts = {};
- this._signatureToName = {};
- }
- /**
- * @param {?} tag
- * @param {?} attrs
- * @param {?} isVoid
- * @return {?}
- */
- PlaceholderRegistry.prototype.getStartTagPlaceholderName = /**
- * @param {?} tag
- * @param {?} attrs
- * @param {?} isVoid
- * @return {?}
- */
- function (tag, attrs, isVoid) {
- var /** @type {?} */ signature = this._hashTag(tag, attrs, isVoid);
- if (this._signatureToName[signature]) {
- return this._signatureToName[signature];
- }
- var /** @type {?} */ upperTag = tag.toUpperCase();
- var /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag;
- var /** @type {?} */ name = this._generateUniqueName(isVoid ? baseName : "START_" + baseName);
- this._signatureToName[signature] = name;
- return name;
- };
- /**
- * @param {?} tag
- * @return {?}
- */
- PlaceholderRegistry.prototype.getCloseTagPlaceholderName = /**
- * @param {?} tag
- * @return {?}
- */
- function (tag) {
- var /** @type {?} */ signature = this._hashClosingTag(tag);
- if (this._signatureToName[signature]) {
- return this._signatureToName[signature];
- }
- var /** @type {?} */ upperTag = tag.toUpperCase();
- var /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag;
- var /** @type {?} */ name = this._generateUniqueName("CLOSE_" + baseName);
- this._signatureToName[signature] = name;
- return name;
- };
- /**
- * @param {?} name
- * @param {?} content
- * @return {?}
- */
- PlaceholderRegistry.prototype.getPlaceholderName = /**
- * @param {?} name
- * @param {?} content
- * @return {?}
- */
- function (name, content) {
- var /** @type {?} */ upperName = name.toUpperCase();
- var /** @type {?} */ signature = "PH: " + upperName + "=" + content;
- if (this._signatureToName[signature]) {
- return this._signatureToName[signature];
- }
- var /** @type {?} */ uniqueName = this._generateUniqueName(upperName);
- this._signatureToName[signature] = uniqueName;
- return uniqueName;
- };
- /**
- * @param {?} name
- * @return {?}
- */
- PlaceholderRegistry.prototype.getUniquePlaceholder = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- return this._generateUniqueName(name.toUpperCase());
- };
- /**
- * @param {?} tag
- * @param {?} attrs
- * @param {?} isVoid
- * @return {?}
- */
- PlaceholderRegistry.prototype._hashTag = /**
- * @param {?} tag
- * @param {?} attrs
- * @param {?} isVoid
- * @return {?}
- */
- function (tag, attrs, isVoid) {
- var /** @type {?} */ start = "<" + tag;
- var /** @type {?} */ strAttrs = Object.keys(attrs).sort().map(function (name) { return " " + name + "=" + attrs[name]; }).join('');
- var /** @type {?} */ end = isVoid ? '/>' : "></" + tag + ">";
- return start + strAttrs + end;
- };
- /**
- * @param {?} tag
- * @return {?}
- */
- PlaceholderRegistry.prototype._hashClosingTag = /**
- * @param {?} tag
- * @return {?}
- */
- function (tag) { return this._hashTag("/" + tag, {}, false); };
- /**
- * @param {?} base
- * @return {?}
- */
- PlaceholderRegistry.prototype._generateUniqueName = /**
- * @param {?} base
- * @return {?}
- */
- function (base) {
- var /** @type {?} */ seen = this._placeHolderNameCounts.hasOwnProperty(base);
- if (!seen) {
- this._placeHolderNameCounts[base] = 1;
- return base;
- }
- var /** @type {?} */ id = this._placeHolderNameCounts[base];
- this._placeHolderNameCounts[base] = id + 1;
- return base + "_" + id;
- };
- return PlaceholderRegistry;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _expParser = new Parser(new Lexer());
- /**
- * Returns a function converting html nodes to an i18n Message given an interpolationConfig
- * @param {?} interpolationConfig
- * @return {?}
- */
- function createI18nMessageFactory(interpolationConfig) {
- var /** @type {?} */ visitor = new _I18nVisitor(_expParser, interpolationConfig);
- return function (nodes, meaning, description, id) {
- return visitor.toI18nMessage(nodes, meaning, description, id);
- };
- }
- var _I18nVisitor = /** @class */ (function () {
- function _I18nVisitor(_expressionParser, _interpolationConfig) {
- this._expressionParser = _expressionParser;
- this._interpolationConfig = _interpolationConfig;
- }
- /**
- * @param {?} nodes
- * @param {?} meaning
- * @param {?} description
- * @param {?} id
- * @return {?}
- */
- _I18nVisitor.prototype.toI18nMessage = /**
- * @param {?} nodes
- * @param {?} meaning
- * @param {?} description
- * @param {?} id
- * @return {?}
- */
- function (nodes, meaning, description, id) {
- this._isIcu = nodes.length == 1 && nodes[0] instanceof Expansion;
- this._icuDepth = 0;
- this._placeholderRegistry = new PlaceholderRegistry();
- this._placeholderToContent = {};
- this._placeholderToMessage = {};
- var /** @type {?} */ i18nodes = visitAll(this, nodes, {});
- return new Message(i18nodes, this._placeholderToContent, this._placeholderToMessage, meaning, description, id);
- };
- /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- _I18nVisitor.prototype.visitElement = /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- function (el, context) {
- var /** @type {?} */ children = visitAll(this, el.children);
- var /** @type {?} */ attrs = {};
- el.attrs.forEach(function (attr) {
- // Do not visit the attributes, translatable ones are top-level ASTs
- attrs[attr.name] = attr.value;
- });
- var /** @type {?} */ isVoid = getHtmlTagDefinition(el.name).isVoid;
- var /** @type {?} */ startPhName = this._placeholderRegistry.getStartTagPlaceholderName(el.name, attrs, isVoid);
- this._placeholderToContent[startPhName] = /** @type {?} */ ((el.sourceSpan)).toString();
- var /** @type {?} */ closePhName = '';
- if (!isVoid) {
- closePhName = this._placeholderRegistry.getCloseTagPlaceholderName(el.name);
- this._placeholderToContent[closePhName] = "</" + el.name + ">";
- }
- return new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, /** @type {?} */ ((el.sourceSpan)));
- };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- _I18nVisitor.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) {
- return this._visitTextWithInterpolation(attribute.value, attribute.sourceSpan);
- };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- _I18nVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) {
- return this._visitTextWithInterpolation(text.value, /** @type {?} */ ((text.sourceSpan)));
- };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- _I18nVisitor.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { return null; };
- /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- _I18nVisitor.prototype.visitExpansion = /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- function (icu, context) {
- var _this = this;
- this._icuDepth++;
- var /** @type {?} */ i18nIcuCases = {};
- var /** @type {?} */ i18nIcu = new Icu(icu.switchValue, icu.type, i18nIcuCases, icu.sourceSpan);
- icu.cases.forEach(function (caze) {
- i18nIcuCases[caze.value] = new Container(caze.expression.map(function (node) { return node.visit(_this, {}); }), caze.expSourceSpan);
- });
- this._icuDepth--;
- if (this._isIcu || this._icuDepth > 0) {
- // Returns an ICU node when:
- // - the message (vs a part of the message) is an ICU message, or
- // - the ICU message is nested.
- var /** @type {?} */ expPh = this._placeholderRegistry.getUniquePlaceholder("VAR_" + icu.type);
- i18nIcu.expressionPlaceholder = expPh;
- this._placeholderToContent[expPh] = icu.switchValue;
- return i18nIcu;
- }
- // Else returns a placeholder
- // ICU placeholders should not be replaced with their original content but with the their
- // translations. We need to create a new visitor (they are not re-entrant) to compute the
- // message id.
- // TODO(vicb): add a html.Node -> i18n.Message cache to avoid having to re-create the msg
- var /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName('ICU', icu.sourceSpan.toString());
- var /** @type {?} */ visitor = new _I18nVisitor(this._expressionParser, this._interpolationConfig);
- this._placeholderToMessage[phName] = visitor.toI18nMessage([icu], '', '', '');
- return new IcuPlaceholder(i18nIcu, phName, icu.sourceSpan);
- };
- /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- _I18nVisitor.prototype.visitExpansionCase = /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- function (icuCase, context) {
- throw new Error('Unreachable code');
- };
- /**
- * @param {?} text
- * @param {?} sourceSpan
- * @return {?}
- */
- _I18nVisitor.prototype._visitTextWithInterpolation = /**
- * @param {?} text
- * @param {?} sourceSpan
- * @return {?}
- */
- function (text, sourceSpan) {
- var /** @type {?} */ splitInterpolation = this._expressionParser.splitInterpolation(text, sourceSpan.start.toString(), this._interpolationConfig);
- if (!splitInterpolation) {
- // No expression, return a single text
- return new Text$1(text, sourceSpan);
- }
- // Return a group of text + expressions
- var /** @type {?} */ nodes = [];
- var /** @type {?} */ container = new Container(nodes, sourceSpan);
- var _a = this._interpolationConfig, sDelimiter = _a.start, eDelimiter = _a.end;
- for (var /** @type {?} */ i = 0; i < splitInterpolation.strings.length - 1; i++) {
- var /** @type {?} */ expression = splitInterpolation.expressions[i];
- var /** @type {?} */ baseName = _extractPlaceholderName(expression) || 'INTERPOLATION';
- var /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName(baseName, expression);
- if (splitInterpolation.strings[i].length) {
- // No need to add empty strings
- nodes.push(new Text$1(splitInterpolation.strings[i], sourceSpan));
- }
- nodes.push(new Placeholder(expression, phName, sourceSpan));
- this._placeholderToContent[phName] = sDelimiter + expression + eDelimiter;
- }
- // The last index contains no expression
- var /** @type {?} */ lastStringIdx = splitInterpolation.strings.length - 1;
- if (splitInterpolation.strings[lastStringIdx].length) {
- nodes.push(new Text$1(splitInterpolation.strings[lastStringIdx], sourceSpan));
- }
- return container;
- };
- return _I18nVisitor;
- }());
- var _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g;
- /**
- * @param {?} input
- * @return {?}
- */
- function _extractPlaceholderName(input) {
- return input.split(_CUSTOM_PH_EXP)[2];
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An i18n error.
- */
- var I18nError = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(I18nError, _super);
- function I18nError(span, msg) {
- return _super.call(this, span, msg) || this;
- }
- return I18nError;
- }(ParseError));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _I18N_ATTR = 'i18n';
- var _I18N_ATTR_PREFIX = 'i18n-';
- var _I18N_COMMENT_PREFIX_REGEXP = /^i18n:?/;
- var MEANING_SEPARATOR = '|';
- var ID_SEPARATOR = '@@';
- var i18nCommentsWarned = false;
- /**
- * Extract translatable messages from an html AST
- * @param {?} nodes
- * @param {?} interpolationConfig
- * @param {?} implicitTags
- * @param {?} implicitAttrs
- * @return {?}
- */
- function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) {
- var /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs);
- return visitor.extract(nodes, interpolationConfig);
- }
- /**
- * @param {?} nodes
- * @param {?} translations
- * @param {?} interpolationConfig
- * @param {?} implicitTags
- * @param {?} implicitAttrs
- * @return {?}
- */
- function mergeTranslations(nodes, translations, interpolationConfig, implicitTags, implicitAttrs) {
- var /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs);
- return visitor.merge(nodes, translations, interpolationConfig);
- }
- var ExtractionResult = /** @class */ (function () {
- function ExtractionResult(messages, errors) {
- this.messages = messages;
- this.errors = errors;
- }
- return ExtractionResult;
- }());
- /** @enum {number} */
- var _VisitorMode = {
- Extract: 0,
- Merge: 1,
- };
- _VisitorMode[_VisitorMode.Extract] = "Extract";
- _VisitorMode[_VisitorMode.Merge] = "Merge";
- /**
- * This Visitor is used:
- * 1. to extract all the translatable strings from an html AST (see `extract()`),
- * 2. to replace the translatable strings with the actual translations (see `merge()`)
- *
- * \@internal
- */
- var _Visitor = /** @class */ (function () {
- function _Visitor(_implicitTags, _implicitAttrs) {
- this._implicitTags = _implicitTags;
- this._implicitAttrs = _implicitAttrs;
- }
- /**
- * Extracts the messages from the tree
- */
- /**
- * Extracts the messages from the tree
- * @param {?} nodes
- * @param {?} interpolationConfig
- * @return {?}
- */
- _Visitor.prototype.extract = /**
- * Extracts the messages from the tree
- * @param {?} nodes
- * @param {?} interpolationConfig
- * @return {?}
- */
- function (nodes, interpolationConfig) {
- var _this = this;
- this._init(_VisitorMode.Extract, interpolationConfig);
- nodes.forEach(function (node) { return node.visit(_this, null); });
- if (this._inI18nBlock) {
- this._reportError(nodes[nodes.length - 1], 'Unclosed block');
- }
- return new ExtractionResult(this._messages, this._errors);
- };
- /**
- * Returns a tree where all translatable nodes are translated
- */
- /**
- * Returns a tree where all translatable nodes are translated
- * @param {?} nodes
- * @param {?} translations
- * @param {?} interpolationConfig
- * @return {?}
- */
- _Visitor.prototype.merge = /**
- * Returns a tree where all translatable nodes are translated
- * @param {?} nodes
- * @param {?} translations
- * @param {?} interpolationConfig
- * @return {?}
- */
- function (nodes, translations, interpolationConfig) {
- this._init(_VisitorMode.Merge, interpolationConfig);
- this._translations = translations;
- // Construct a single fake root element
- var /** @type {?} */ wrapper = new Element('wrapper', [], nodes, /** @type {?} */ ((undefined)), undefined, undefined);
- var /** @type {?} */ translatedNode = wrapper.visit(this, null);
- if (this._inI18nBlock) {
- this._reportError(nodes[nodes.length - 1], 'Unclosed block');
- }
- return new ParseTreeResult(translatedNode.children, this._errors);
- };
- /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- _Visitor.prototype.visitExpansionCase = /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- function (icuCase, context) {
- // Parse cases for translatable html attributes
- var /** @type {?} */ expression = visitAll(this, icuCase.expression, context);
- if (this._mode === _VisitorMode.Merge) {
- return new ExpansionCase(icuCase.value, expression, icuCase.sourceSpan, icuCase.valueSourceSpan, icuCase.expSourceSpan);
- }
- };
- /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- _Visitor.prototype.visitExpansion = /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- function (icu, context) {
- this._mayBeAddBlockChildren(icu);
- var /** @type {?} */ wasInIcu = this._inIcu;
- if (!this._inIcu) {
- // nested ICU messages should not be extracted but top-level translated as a whole
- if (this._isInTranslatableSection) {
- this._addMessage([icu]);
- }
- this._inIcu = true;
- }
- var /** @type {?} */ cases = visitAll(this, icu.cases, context);
- if (this._mode === _VisitorMode.Merge) {
- icu = new Expansion(icu.switchValue, icu.type, cases, icu.sourceSpan, icu.switchValueSourceSpan);
- }
- this._inIcu = wasInIcu;
- return icu;
- };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- _Visitor.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) {
- var /** @type {?} */ isOpening = _isOpeningComment(comment);
- if (isOpening && this._isInTranslatableSection) {
- this._reportError(comment, 'Could not start a block inside a translatable section');
- return;
- }
- var /** @type {?} */ isClosing = _isClosingComment(comment);
- if (isClosing && !this._inI18nBlock) {
- this._reportError(comment, 'Trying to close an unopened block');
- return;
- }
- if (!this._inI18nNode && !this._inIcu) {
- if (!this._inI18nBlock) {
- if (isOpening) {
- // deprecated from v5 you should use <ng-container i18n> instead of i18n comments
- if (!i18nCommentsWarned && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
- i18nCommentsWarned = true;
- var /** @type {?} */ details = comment.sourceSpan.details ? ", " + comment.sourceSpan.details : '';
- // TODO(ocombe): use a log service once there is a public one available
- console.warn("I18n comments are deprecated, use an <ng-container> element instead (" + comment.sourceSpan.start + details + ")");
- }
- this._inI18nBlock = true;
- this._blockStartDepth = this._depth;
- this._blockChildren = [];
- this._blockMeaningAndDesc = /** @type {?} */ ((comment.value)).replace(_I18N_COMMENT_PREFIX_REGEXP, '').trim();
- this._openTranslatableSection(comment);
- }
- }
- else {
- if (isClosing) {
- if (this._depth == this._blockStartDepth) {
- this._closeTranslatableSection(comment, this._blockChildren);
- this._inI18nBlock = false;
- var /** @type {?} */ message = /** @type {?} */ ((this._addMessage(this._blockChildren, this._blockMeaningAndDesc)));
- // merge attributes in sections
- var /** @type {?} */ nodes = this._translateMessage(comment, message);
- return visitAll(this, nodes);
- }
- else {
- this._reportError(comment, 'I18N blocks should not cross element boundaries');
- return;
- }
- }
- }
- }
- };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- _Visitor.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) {
- if (this._isInTranslatableSection) {
- this._mayBeAddBlockChildren(text);
- }
- return text;
- };
- /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- _Visitor.prototype.visitElement = /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- function (el, context) {
- var _this = this;
- this._mayBeAddBlockChildren(el);
- this._depth++;
- var /** @type {?} */ wasInI18nNode = this._inI18nNode;
- var /** @type {?} */ wasInImplicitNode = this._inImplicitNode;
- var /** @type {?} */ childNodes = [];
- var /** @type {?} */ translatedChildNodes = /** @type {?} */ ((undefined));
- // Extract:
- // - top level nodes with the (implicit) "i18n" attribute if not already in a section
- // - ICU messages
- var /** @type {?} */ i18nAttr = _getI18nAttr(el);
- var /** @type {?} */ i18nMeta = i18nAttr ? i18nAttr.value : '';
- var /** @type {?} */ isImplicit = this._implicitTags.some(function (tag) { return el.name === tag; }) && !this._inIcu &&
- !this._isInTranslatableSection;
- var /** @type {?} */ isTopLevelImplicit = !wasInImplicitNode && isImplicit;
- this._inImplicitNode = wasInImplicitNode || isImplicit;
- if (!this._isInTranslatableSection && !this._inIcu) {
- if (i18nAttr || isTopLevelImplicit) {
- this._inI18nNode = true;
- var /** @type {?} */ message = /** @type {?} */ ((this._addMessage(el.children, i18nMeta)));
- translatedChildNodes = this._translateMessage(el, message);
- }
- if (this._mode == _VisitorMode.Extract) {
- var /** @type {?} */ isTranslatable = i18nAttr || isTopLevelImplicit;
- if (isTranslatable)
- this._openTranslatableSection(el);
- visitAll(this, el.children);
- if (isTranslatable)
- this._closeTranslatableSection(el, el.children);
- }
- }
- else {
- if (i18nAttr || isTopLevelImplicit) {
- this._reportError(el, 'Could not mark an element as translatable inside a translatable section');
- }
- if (this._mode == _VisitorMode.Extract) {
- // Descend into child nodes for extraction
- visitAll(this, el.children);
- }
- }
- if (this._mode === _VisitorMode.Merge) {
- var /** @type {?} */ visitNodes = translatedChildNodes || el.children;
- visitNodes.forEach(function (child) {
- var /** @type {?} */ visited = child.visit(_this, context);
- if (visited && !_this._isInTranslatableSection) {
- // Do not add the children from translatable sections (= i18n blocks here)
- // They will be added later in this loop when the block closes (i.e. on `<!-- /i18n -->`)
- childNodes = childNodes.concat(visited);
- }
- });
- }
- this._visitAttributesOf(el);
- this._depth--;
- this._inI18nNode = wasInI18nNode;
- this._inImplicitNode = wasInImplicitNode;
- if (this._mode === _VisitorMode.Merge) {
- var /** @type {?} */ translatedAttrs = this._translateAttributes(el);
- return new Element(el.name, translatedAttrs, childNodes, el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
- }
- return null;
- };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- _Visitor.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) {
- throw new Error('unreachable code');
- };
- /**
- * @param {?} mode
- * @param {?} interpolationConfig
- * @return {?}
- */
- _Visitor.prototype._init = /**
- * @param {?} mode
- * @param {?} interpolationConfig
- * @return {?}
- */
- function (mode, interpolationConfig) {
- this._mode = mode;
- this._inI18nBlock = false;
- this._inI18nNode = false;
- this._depth = 0;
- this._inIcu = false;
- this._msgCountAtSectionStart = undefined;
- this._errors = [];
- this._messages = [];
- this._inImplicitNode = false;
- this._createI18nMessage = createI18nMessageFactory(interpolationConfig);
- };
- /**
- * @param {?} el
- * @return {?}
- */
- _Visitor.prototype._visitAttributesOf = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- var _this = this;
- var /** @type {?} */ explicitAttrNameToValue = {};
- var /** @type {?} */ implicitAttrNames = this._implicitAttrs[el.name] || [];
- el.attrs.filter(function (attr) { return attr.name.startsWith(_I18N_ATTR_PREFIX); })
- .forEach(function (attr) {
- return explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
- attr.value;
- });
- el.attrs.forEach(function (attr) {
- if (attr.name in explicitAttrNameToValue) {
- _this._addMessage([attr], explicitAttrNameToValue[attr.name]);
- }
- else if (implicitAttrNames.some(function (name) { return attr.name === name; })) {
- _this._addMessage([attr]);
- }
- });
- };
- /**
- * @param {?} ast
- * @param {?=} msgMeta
- * @return {?}
- */
- _Visitor.prototype._addMessage = /**
- * @param {?} ast
- * @param {?=} msgMeta
- * @return {?}
- */
- function (ast, msgMeta) {
- if (ast.length == 0 ||
- ast.length == 1 && ast[0] instanceof Attribute$1 && !(/** @type {?} */ (ast[0])).value) {
- // Do not create empty messages
- return null;
- }
- var _a = _parseMessageMeta(msgMeta), meaning = _a.meaning, description = _a.description, id = _a.id;
- var /** @type {?} */ message = this._createI18nMessage(ast, meaning, description, id);
- this._messages.push(message);
- return message;
- };
- /**
- * @param {?} el
- * @param {?} message
- * @return {?}
- */
- _Visitor.prototype._translateMessage = /**
- * @param {?} el
- * @param {?} message
- * @return {?}
- */
- function (el, message) {
- if (message && this._mode === _VisitorMode.Merge) {
- var /** @type {?} */ nodes = this._translations.get(message);
- if (nodes) {
- return nodes;
- }
- this._reportError(el, "Translation unavailable for message id=\"" + this._translations.digest(message) + "\"");
- }
- return [];
- };
- /**
- * @param {?} el
- * @return {?}
- */
- _Visitor.prototype._translateAttributes = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- var _this = this;
- var /** @type {?} */ attributes = el.attrs;
- var /** @type {?} */ i18nParsedMessageMeta = {};
- attributes.forEach(function (attr) {
- if (attr.name.startsWith(_I18N_ATTR_PREFIX)) {
- i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
- _parseMessageMeta(attr.value);
- }
- });
- var /** @type {?} */ translatedAttributes = [];
- attributes.forEach(function (attr) {
- if (attr.name === _I18N_ATTR || attr.name.startsWith(_I18N_ATTR_PREFIX)) {
- // strip i18n specific attributes
- return;
- }
- if (attr.value && attr.value != '' && i18nParsedMessageMeta.hasOwnProperty(attr.name)) {
- var _a = i18nParsedMessageMeta[attr.name], meaning = _a.meaning, description = _a.description, id = _a.id;
- var /** @type {?} */ message = _this._createI18nMessage([attr], meaning, description, id);
- var /** @type {?} */ nodes = _this._translations.get(message);
- if (nodes) {
- if (nodes.length == 0) {
- translatedAttributes.push(new Attribute$1(attr.name, '', attr.sourceSpan));
- }
- else if (nodes[0] instanceof Text) {
- var /** @type {?} */ value = (/** @type {?} */ (nodes[0])).value;
- translatedAttributes.push(new Attribute$1(attr.name, value, attr.sourceSpan));
- }
- else {
- _this._reportError(el, "Unexpected translation for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")");
- }
- }
- else {
- _this._reportError(el, "Translation unavailable for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")");
- }
- }
- else {
- translatedAttributes.push(attr);
- }
- });
- return translatedAttributes;
- };
- /**
- * Add the node as a child of the block when:
- * - we are in a block,
- * - we are not inside a ICU message (those are handled separately),
- * - the node is a "direct child" of the block
- * @param {?} node
- * @return {?}
- */
- _Visitor.prototype._mayBeAddBlockChildren = /**
- * Add the node as a child of the block when:
- * - we are in a block,
- * - we are not inside a ICU message (those are handled separately),
- * - the node is a "direct child" of the block
- * @param {?} node
- * @return {?}
- */
- function (node) {
- if (this._inI18nBlock && !this._inIcu && this._depth == this._blockStartDepth) {
- this._blockChildren.push(node);
- }
- };
- /**
- * Marks the start of a section, see `_closeTranslatableSection`
- * @param {?} node
- * @return {?}
- */
- _Visitor.prototype._openTranslatableSection = /**
- * Marks the start of a section, see `_closeTranslatableSection`
- * @param {?} node
- * @return {?}
- */
- function (node) {
- if (this._isInTranslatableSection) {
- this._reportError(node, 'Unexpected section start');
- }
- else {
- this._msgCountAtSectionStart = this._messages.length;
- }
- };
- Object.defineProperty(_Visitor.prototype, "_isInTranslatableSection", {
- get: /**
- * A translatable section could be:
- * - the content of translatable element,
- * - nodes between `<!-- i18n -->` and `<!-- /i18n -->` comments
- * @return {?}
- */
- function () {
- return this._msgCountAtSectionStart !== void 0;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Terminates a section.
- *
- * If a section has only one significant children (comments not significant) then we should not
- * keep the message from this children:
- *
- * `<p i18n="meaning|description">{ICU message}</p>` would produce two messages:
- * - one for the <p> content with meaning and description,
- * - another one for the ICU message.
- *
- * In this case the last message is discarded as it contains less information (the AST is
- * otherwise identical).
- *
- * Note that we should still keep messages extracted from attributes inside the section (ie in the
- * ICU message here)
- * @param {?} node
- * @param {?} directChildren
- * @return {?}
- */
- _Visitor.prototype._closeTranslatableSection = /**
- * Terminates a section.
- *
- * If a section has only one significant children (comments not significant) then we should not
- * keep the message from this children:
- *
- * `<p i18n="meaning|description">{ICU message}</p>` would produce two messages:
- * - one for the <p> content with meaning and description,
- * - another one for the ICU message.
- *
- * In this case the last message is discarded as it contains less information (the AST is
- * otherwise identical).
- *
- * Note that we should still keep messages extracted from attributes inside the section (ie in the
- * ICU message here)
- * @param {?} node
- * @param {?} directChildren
- * @return {?}
- */
- function (node, directChildren) {
- if (!this._isInTranslatableSection) {
- this._reportError(node, 'Unexpected section end');
- return;
- }
- var /** @type {?} */ startIndex = this._msgCountAtSectionStart;
- var /** @type {?} */ significantChildren = directChildren.reduce(function (count, node) { return count + (node instanceof Comment ? 0 : 1); }, 0);
- if (significantChildren == 1) {
- for (var /** @type {?} */ i = this._messages.length - 1; i >= /** @type {?} */ ((startIndex)); i--) {
- var /** @type {?} */ ast = this._messages[i].nodes;
- if (!(ast.length == 1 && ast[0] instanceof Text$1)) {
- this._messages.splice(i, 1);
- break;
- }
- }
- }
- this._msgCountAtSectionStart = undefined;
- };
- /**
- * @param {?} node
- * @param {?} msg
- * @return {?}
- */
- _Visitor.prototype._reportError = /**
- * @param {?} node
- * @param {?} msg
- * @return {?}
- */
- function (node, msg) {
- this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), msg));
- };
- return _Visitor;
- }());
- /**
- * @param {?} n
- * @return {?}
- */
- function _isOpeningComment(n) {
- return !!(n instanceof Comment && n.value && n.value.startsWith('i18n'));
- }
- /**
- * @param {?} n
- * @return {?}
- */
- function _isClosingComment(n) {
- return !!(n instanceof Comment && n.value && n.value === '/i18n');
- }
- /**
- * @param {?} p
- * @return {?}
- */
- function _getI18nAttr(p) {
- return p.attrs.find(function (attr) { return attr.name === _I18N_ATTR; }) || null;
- }
- /**
- * @param {?=} i18n
- * @return {?}
- */
- function _parseMessageMeta(i18n) {
- if (!i18n)
- return { meaning: '', description: '', id: '' };
- var /** @type {?} */ idIndex = i18n.indexOf(ID_SEPARATOR);
- var /** @type {?} */ descIndex = i18n.indexOf(MEANING_SEPARATOR);
- var _a = (idIndex > -1) ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''], meaningAndDesc = _a[0], id = _a[1];
- var _b = (descIndex > -1) ?
- [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] :
- ['', meaningAndDesc], meaning = _b[0], description = _b[1];
- return { meaning: meaning, description: description, id: id };
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var XmlTagDefinition = /** @class */ (function () {
- function XmlTagDefinition() {
- this.closedByParent = false;
- this.contentType = TagContentType.PARSABLE_DATA;
- this.isVoid = false;
- this.ignoreFirstLf = false;
- this.canSelfClose = true;
- }
- /**
- * @param {?} currentParent
- * @return {?}
- */
- XmlTagDefinition.prototype.requireExtraParent = /**
- * @param {?} currentParent
- * @return {?}
- */
- function (currentParent) { return false; };
- /**
- * @param {?} name
- * @return {?}
- */
- XmlTagDefinition.prototype.isClosedByChild = /**
- * @param {?} name
- * @return {?}
- */
- function (name) { return false; };
- return XmlTagDefinition;
- }());
- var _TAG_DEFINITION = new XmlTagDefinition();
- /**
- * @param {?} tagName
- * @return {?}
- */
- function getXmlTagDefinition(tagName) {
- return _TAG_DEFINITION;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var XmlParser = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(XmlParser, _super);
- function XmlParser() {
- return _super.call(this, getXmlTagDefinition) || this;
- }
- /**
- * @param {?} source
- * @param {?} url
- * @param {?=} parseExpansionForms
- * @return {?}
- */
- XmlParser.prototype.parse = /**
- * @param {?} source
- * @param {?} url
- * @param {?=} parseExpansionForms
- * @return {?}
- */
- function (source, url, parseExpansionForms) {
- if (parseExpansionForms === void 0) { parseExpansionForms = false; }
- return _super.prototype.parse.call(this, source, url, parseExpansionForms);
- };
- return XmlParser;
- }(Parser$1));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @abstract
- */
- var Serializer = /** @class */ (function () {
- function Serializer() {
- }
- // Creates a name mapper, see `PlaceholderMapper`
- // Returning `null` means that no name mapping is used.
- /**
- * @param {?} message
- * @return {?}
- */
- Serializer.prototype.createNameMapper = /**
- * @param {?} message
- * @return {?}
- */
- function (message) { return null; };
- return Serializer;
- }());
- /**
- * A `PlaceholderMapper` converts placeholder names from internal to serialized representation and
- * back.
- *
- * It should be used for serialization format that put constraints on the placeholder names.
- * @record
- */
- /**
- * A simple mapper that take a function to transform an internal name to a public name
- */
- var SimplePlaceholderMapper = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(SimplePlaceholderMapper, _super);
- // create a mapping from the message
- function SimplePlaceholderMapper(message, mapName) {
- var _this = _super.call(this) || this;
- _this.mapName = mapName;
- _this.internalToPublic = {};
- _this.publicToNextId = {};
- _this.publicToInternal = {};
- message.nodes.forEach(function (node) { return node.visit(_this); });
- return _this;
- }
- /**
- * @param {?} internalName
- * @return {?}
- */
- SimplePlaceholderMapper.prototype.toPublicName = /**
- * @param {?} internalName
- * @return {?}
- */
- function (internalName) {
- return this.internalToPublic.hasOwnProperty(internalName) ?
- this.internalToPublic[internalName] :
- null;
- };
- /**
- * @param {?} publicName
- * @return {?}
- */
- SimplePlaceholderMapper.prototype.toInternalName = /**
- * @param {?} publicName
- * @return {?}
- */
- function (publicName) {
- return this.publicToInternal.hasOwnProperty(publicName) ? this.publicToInternal[publicName] :
- null;
- };
- /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- SimplePlaceholderMapper.prototype.visitText = /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- function (text, context) { return null; };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- SimplePlaceholderMapper.prototype.visitTagPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- this.visitPlaceholderName(ph.startName);
- _super.prototype.visitTagPlaceholder.call(this, ph, context);
- this.visitPlaceholderName(ph.closeName);
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- SimplePlaceholderMapper.prototype.visitPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) { this.visitPlaceholderName(ph.name); };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- SimplePlaceholderMapper.prototype.visitIcuPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- this.visitPlaceholderName(ph.name);
- };
- /**
- * @param {?} internalName
- * @return {?}
- */
- SimplePlaceholderMapper.prototype.visitPlaceholderName = /**
- * @param {?} internalName
- * @return {?}
- */
- function (internalName) {
- if (!internalName || this.internalToPublic.hasOwnProperty(internalName)) {
- return;
- }
- var /** @type {?} */ publicName = this.mapName(internalName);
- if (this.publicToInternal.hasOwnProperty(publicName)) {
- // Create a new XMB when it has already been used
- var /** @type {?} */ nextId = this.publicToNextId[publicName];
- this.publicToNextId[publicName] = nextId + 1;
- publicName = publicName + "_" + nextId;
- }
- else {
- this.publicToNextId[publicName] = 1;
- }
- this.internalToPublic[internalName] = publicName;
- this.publicToInternal[publicName] = internalName;
- };
- return SimplePlaceholderMapper;
- }(RecurseVisitor));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @record
- */
- var _Visitor$1 = /** @class */ (function () {
- function _Visitor() {
- }
- /**
- * @param {?} tag
- * @return {?}
- */
- _Visitor.prototype.visitTag = /**
- * @param {?} tag
- * @return {?}
- */
- function (tag) {
- var _this = this;
- var /** @type {?} */ strAttrs = this._serializeAttributes(tag.attrs);
- if (tag.children.length == 0) {
- return "<" + tag.name + strAttrs + "/>";
- }
- var /** @type {?} */ strChildren = tag.children.map(function (node) { return node.visit(_this); });
- return "<" + tag.name + strAttrs + ">" + strChildren.join('') + "</" + tag.name + ">";
- };
- /**
- * @param {?} text
- * @return {?}
- */
- _Visitor.prototype.visitText = /**
- * @param {?} text
- * @return {?}
- */
- function (text) { return text.value; };
- /**
- * @param {?} decl
- * @return {?}
- */
- _Visitor.prototype.visitDeclaration = /**
- * @param {?} decl
- * @return {?}
- */
- function (decl) {
- return "<?xml" + this._serializeAttributes(decl.attrs) + " ?>";
- };
- /**
- * @param {?} attrs
- * @return {?}
- */
- _Visitor.prototype._serializeAttributes = /**
- * @param {?} attrs
- * @return {?}
- */
- function (attrs) {
- var /** @type {?} */ strAttrs = Object.keys(attrs).map(function (name) { return name + "=\"" + attrs[name] + "\""; }).join(' ');
- return strAttrs.length > 0 ? ' ' + strAttrs : '';
- };
- /**
- * @param {?} doctype
- * @return {?}
- */
- _Visitor.prototype.visitDoctype = /**
- * @param {?} doctype
- * @return {?}
- */
- function (doctype) {
- return "<!DOCTYPE " + doctype.rootTag + " [\n" + doctype.dtd + "\n]>";
- };
- return _Visitor;
- }());
- var _visitor = new _Visitor$1();
- /**
- * @param {?} nodes
- * @return {?}
- */
- function serialize(nodes) {
- return nodes.map(function (node) { return node.visit(_visitor); }).join('');
- }
- /**
- * @record
- */
- var Declaration = /** @class */ (function () {
- function Declaration(unescapedAttrs) {
- var _this = this;
- this.attrs = {};
- Object.keys(unescapedAttrs).forEach(function (k) {
- _this.attrs[k] = _escapeXml(unescapedAttrs[k]);
- });
- }
- /**
- * @param {?} visitor
- * @return {?}
- */
- Declaration.prototype.visit = /**
- * @param {?} visitor
- * @return {?}
- */
- function (visitor) { return visitor.visitDeclaration(this); };
- return Declaration;
- }());
- var Doctype = /** @class */ (function () {
- function Doctype(rootTag, dtd) {
- this.rootTag = rootTag;
- this.dtd = dtd;
- }
- /**
- * @param {?} visitor
- * @return {?}
- */
- Doctype.prototype.visit = /**
- * @param {?} visitor
- * @return {?}
- */
- function (visitor) { return visitor.visitDoctype(this); };
- return Doctype;
- }());
- var Tag = /** @class */ (function () {
- function Tag(name, unescapedAttrs, children) {
- if (unescapedAttrs === void 0) { unescapedAttrs = {}; }
- if (children === void 0) { children = []; }
- var _this = this;
- this.name = name;
- this.children = children;
- this.attrs = {};
- Object.keys(unescapedAttrs).forEach(function (k) {
- _this.attrs[k] = _escapeXml(unescapedAttrs[k]);
- });
- }
- /**
- * @param {?} visitor
- * @return {?}
- */
- Tag.prototype.visit = /**
- * @param {?} visitor
- * @return {?}
- */
- function (visitor) { return visitor.visitTag(this); };
- return Tag;
- }());
- var Text$2 = /** @class */ (function () {
- function Text(unescapedValue) {
- this.value = _escapeXml(unescapedValue);
- }
- /**
- * @param {?} visitor
- * @return {?}
- */
- Text.prototype.visit = /**
- * @param {?} visitor
- * @return {?}
- */
- function (visitor) { return visitor.visitText(this); };
- return Text;
- }());
- var CR = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CR, _super);
- function CR(ws) {
- if (ws === void 0) { ws = 0; }
- return _super.call(this, "\n" + new Array(ws + 1).join(' ')) || this;
- }
- return CR;
- }(Text$2));
- var _ESCAPED_CHARS = [
- [/&/g, '&'],
- [/"/g, '"'],
- [/'/g, '''],
- [/</g, '<'],
- [/>/g, '>'],
- ];
- /**
- * @param {?} text
- * @return {?}
- */
- function _escapeXml(text) {
- return _ESCAPED_CHARS.reduce(function (text, entry) { return text.replace(entry[0], entry[1]); }, text);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _VERSION = '1.2';
- var _XMLNS = 'urn:oasis:names:tc:xliff:document:1.2';
- // TODO(vicb): make this a param (s/_/-/)
- var _DEFAULT_SOURCE_LANG = 'en';
- var _PLACEHOLDER_TAG = 'x';
- var _MARKER_TAG = 'mrk';
- var _FILE_TAG = 'file';
- var _SOURCE_TAG = 'source';
- var _SEGMENT_SOURCE_TAG = 'seg-source';
- var _TARGET_TAG = 'target';
- var _UNIT_TAG = 'trans-unit';
- var _CONTEXT_GROUP_TAG = 'context-group';
- var _CONTEXT_TAG = 'context';
- var Xliff = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xliff, _super);
- function Xliff() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} messages
- * @param {?} locale
- * @return {?}
- */
- Xliff.prototype.write = /**
- * @param {?} messages
- * @param {?} locale
- * @return {?}
- */
- function (messages, locale) {
- var /** @type {?} */ visitor = new _WriteVisitor();
- var /** @type {?} */ transUnits = [];
- messages.forEach(function (message) {
- var /** @type {?} */ contextTags = [];
- message.sources.forEach(function (source) {
- var /** @type {?} */ contextGroupTag = new Tag(_CONTEXT_GROUP_TAG, { purpose: 'location' });
- 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));
- contextTags.push(new CR(8), contextGroupTag);
- });
- var /** @type {?} */ transUnit = new Tag(_UNIT_TAG, { id: message.id, datatype: 'html' });
- (_a = transUnit.children).push.apply(_a, [new CR(8), new Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes))].concat(contextTags));
- if (message.description) {
- transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'description' }, [new Text$2(message.description)]));
- }
- if (message.meaning) {
- transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'meaning' }, [new Text$2(message.meaning)]));
- }
- transUnit.children.push(new CR(6));
- transUnits.push(new CR(6), transUnit);
- var _a;
- });
- var /** @type {?} */ body = new Tag('body', {}, transUnits.concat([new CR(4)]));
- var /** @type {?} */ file = new Tag('file', {
- 'source-language': locale || _DEFAULT_SOURCE_LANG,
- datatype: 'plaintext',
- original: 'ng2.template',
- }, [new CR(4), body, new CR(2)]);
- var /** @type {?} */ xliff = new Tag('xliff', { version: _VERSION, xmlns: _XMLNS }, [new CR(2), file, new CR()]);
- return serialize([
- new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR()
- ]);
- };
- /**
- * @param {?} content
- * @param {?} url
- * @return {?}
- */
- Xliff.prototype.load = /**
- * @param {?} content
- * @param {?} url
- * @return {?}
- */
- function (content, url) {
- // xliff to xml nodes
- var /** @type {?} */ xliffParser = new XliffParser();
- var _a = xliffParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
- // xml nodes to i18n nodes
- var /** @type {?} */ i18nNodesByMsgId = {};
- var /** @type {?} */ converter = new XmlToI18n();
- Object.keys(msgIdToHtml).forEach(function (msgId) {
- var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors;
- errors.push.apply(errors, e);
- i18nNodesByMsgId[msgId] = i18nNodes;
- });
- if (errors.length) {
- throw new Error("xliff parse errors:\n" + errors.join('\n'));
- }
- return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId };
- };
- /**
- * @param {?} message
- * @return {?}
- */
- Xliff.prototype.digest = /**
- * @param {?} message
- * @return {?}
- */
- function (message) { return digest(message); };
- return Xliff;
- }(Serializer));
- var _WriteVisitor = /** @class */ (function () {
- function _WriteVisitor() {
- }
- /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- function (text, context) { return [new Text$2(text.value)]; };
- /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitContainer = /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- function (container, context) {
- var _this = this;
- var /** @type {?} */ nodes = [];
- container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); });
- return nodes;
- };
- /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitIcu = /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- function (icu, context) {
- var _this = this;
- var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
- Object.keys(icu.cases).forEach(function (c) {
- nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")]));
- });
- nodes.push(new Text$2("}"));
- return nodes;
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitTagPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var /** @type {?} */ ctype = getCtypeForTag(ph.tag);
- if (ph.isVoid) {
- // void tags have no children nor closing tags
- return [new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + "/>" })];
- }
- var /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + ">" });
- var /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.closeName, ctype: ctype, 'equiv-text': "</" + ph.tag + ">" });
- return [startTagPh].concat(this.serialize(ph.children), [closeTagPh]);
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': "{{" + ph.value + "}}" })];
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitIcuPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var /** @type {?} */ equivText = "{" + ph.value.expression + ", " + ph.value.type + ", " + Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ') + "}";
- return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': equivText })];
- };
- /**
- * @param {?} nodes
- * @return {?}
- */
- _WriteVisitor.prototype.serialize = /**
- * @param {?} nodes
- * @return {?}
- */
- function (nodes) {
- var _this = this;
- return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); }));
- };
- return _WriteVisitor;
- }());
- var XliffParser = /** @class */ (function () {
- function XliffParser() {
- this._locale = null;
- }
- /**
- * @param {?} xliff
- * @param {?} url
- * @return {?}
- */
- XliffParser.prototype.parse = /**
- * @param {?} xliff
- * @param {?} url
- * @return {?}
- */
- function (xliff, url) {
- this._unitMlString = null;
- this._msgIdToHtml = {};
- var /** @type {?} */ xml = new XmlParser().parse(xliff, url, false);
- this._errors = xml.errors;
- visitAll(this, xml.rootNodes, null);
- return {
- msgIdToHtml: this._msgIdToHtml,
- errors: this._errors,
- locale: this._locale,
- };
- };
- /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- XliffParser.prototype.visitElement = /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- function (element, context) {
- switch (element.name) {
- case _UNIT_TAG:
- this._unitMlString = /** @type {?} */ ((null));
- var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
- if (!idAttr) {
- this._addError(element, "<" + _UNIT_TAG + "> misses the \"id\" attribute");
- }
- else {
- var /** @type {?} */ id = idAttr.value;
- if (this._msgIdToHtml.hasOwnProperty(id)) {
- this._addError(element, "Duplicated translations for msg " + id);
- }
- else {
- visitAll(this, element.children, null);
- if (typeof this._unitMlString === 'string') {
- this._msgIdToHtml[id] = this._unitMlString;
- }
- else {
- this._addError(element, "Message " + id + " misses a translation");
- }
- }
- }
- break;
- // ignore those tags
- case _SOURCE_TAG:
- case _SEGMENT_SOURCE_TAG:
- break;
- case _TARGET_TAG:
- var /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset;
- var /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset;
- var /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content;
- var /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd);
- this._unitMlString = innerText;
- break;
- case _FILE_TAG:
- var /** @type {?} */ localeAttr = element.attrs.find(function (attr) { return attr.name === 'target-language'; });
- if (localeAttr) {
- this._locale = localeAttr.value;
- }
- visitAll(this, element.children, null);
- break;
- default:
- // TODO(vicb): assert file structure, xliff version
- // For now only recurse on unhandled nodes
- visitAll(this, element.children, null);
- }
- };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- XliffParser.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) { };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- XliffParser.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) { };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- XliffParser.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { };
- /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- XliffParser.prototype.visitExpansion = /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- function (expansion, context) { };
- /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- XliffParser.prototype.visitExpansionCase = /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- function (expansionCase, context) { };
- /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- XliffParser.prototype._addError = /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- function (node, message) {
- this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
- };
- return XliffParser;
- }());
- var XmlToI18n = /** @class */ (function () {
- function XmlToI18n() {
- }
- /**
- * @param {?} message
- * @param {?} url
- * @return {?}
- */
- XmlToI18n.prototype.convert = /**
- * @param {?} message
- * @param {?} url
- * @return {?}
- */
- function (message, url) {
- var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true);
- this._errors = xmlIcu.errors;
- var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
- [] : [].concat.apply([], visitAll(this, xmlIcu.rootNodes));
- return {
- i18nNodes: i18nNodes,
- errors: this._errors,
- };
- };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); };
- /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitElement = /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- function (el, context) {
- if (el.name === _PLACEHOLDER_TAG) {
- var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'id'; });
- if (nameAttr) {
- return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan)));
- }
- this._addError(el, "<" + _PLACEHOLDER_TAG + "> misses the \"id\" attribute");
- return null;
- }
- if (el.name === _MARKER_TAG) {
- return [].concat.apply([], visitAll(this, el.children));
- }
- this._addError(el, "Unexpected tag");
- return null;
- };
- /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitExpansion = /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- function (icu, context) {
- var /** @type {?} */ caseMap = {};
- visitAll(this, icu.cases).forEach(function (c) {
- caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
- });
- return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
- };
- /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitExpansionCase = /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- function (icuCase, context) {
- return {
- value: icuCase.value,
- nodes: visitAll(this, icuCase.expression),
- };
- };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) { };
- /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- XmlToI18n.prototype._addError = /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- function (node, message) {
- this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
- };
- return XmlToI18n;
- }());
- /**
- * @param {?} tag
- * @return {?}
- */
- function getCtypeForTag(tag) {
- switch (tag.toLowerCase()) {
- case 'br':
- return 'lb';
- case 'img':
- return 'image';
- default:
- return "x-" + tag;
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _VERSION$1 = '2.0';
- var _XMLNS$1 = 'urn:oasis:names:tc:xliff:document:2.0';
- // TODO(vicb): make this a param (s/_/-/)
- var _DEFAULT_SOURCE_LANG$1 = 'en';
- var _PLACEHOLDER_TAG$1 = 'ph';
- var _PLACEHOLDER_SPANNING_TAG = 'pc';
- var _MARKER_TAG$1 = 'mrk';
- var _XLIFF_TAG = 'xliff';
- var _SOURCE_TAG$1 = 'source';
- var _TARGET_TAG$1 = 'target';
- var _UNIT_TAG$1 = 'unit';
- var Xliff2 = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xliff2, _super);
- function Xliff2() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} messages
- * @param {?} locale
- * @return {?}
- */
- Xliff2.prototype.write = /**
- * @param {?} messages
- * @param {?} locale
- * @return {?}
- */
- function (messages, locale) {
- var /** @type {?} */ visitor = new _WriteVisitor$1();
- var /** @type {?} */ units = [];
- messages.forEach(function (message) {
- var /** @type {?} */ unit = new Tag(_UNIT_TAG$1, { id: message.id });
- var /** @type {?} */ notes = new Tag('notes');
- if (message.description || message.meaning) {
- if (message.description) {
- notes.children.push(new CR(8), new Tag('note', { category: 'description' }, [new Text$2(message.description)]));
- }
- if (message.meaning) {
- notes.children.push(new CR(8), new Tag('note', { category: 'meaning' }, [new Text$2(message.meaning)]));
- }
- }
- message.sources.forEach(function (source) {
- notes.children.push(new CR(8), new Tag('note', { category: 'location' }, [
- new Text$2(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : ''))
- ]));
- });
- notes.children.push(new CR(6));
- unit.children.push(new CR(6), notes);
- var /** @type {?} */ segment = new Tag('segment');
- segment.children.push(new CR(8), new Tag(_SOURCE_TAG$1, {}, visitor.serialize(message.nodes)), new CR(6));
- unit.children.push(new CR(6), segment, new CR(4));
- units.push(new CR(4), unit);
- });
- var /** @type {?} */ file = new Tag('file', { 'original': 'ng.template', id: 'ngi18n' }, units.concat([new CR(2)]));
- 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()]);
- return serialize([
- new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR()
- ]);
- };
- /**
- * @param {?} content
- * @param {?} url
- * @return {?}
- */
- Xliff2.prototype.load = /**
- * @param {?} content
- * @param {?} url
- * @return {?}
- */
- function (content, url) {
- // xliff to xml nodes
- var /** @type {?} */ xliff2Parser = new Xliff2Parser();
- var _a = xliff2Parser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
- // xml nodes to i18n nodes
- var /** @type {?} */ i18nNodesByMsgId = {};
- var /** @type {?} */ converter = new XmlToI18n$1();
- Object.keys(msgIdToHtml).forEach(function (msgId) {
- var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors;
- errors.push.apply(errors, e);
- i18nNodesByMsgId[msgId] = i18nNodes;
- });
- if (errors.length) {
- throw new Error("xliff2 parse errors:\n" + errors.join('\n'));
- }
- return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId };
- };
- /**
- * @param {?} message
- * @return {?}
- */
- Xliff2.prototype.digest = /**
- * @param {?} message
- * @return {?}
- */
- function (message) { return decimalDigest(message); };
- return Xliff2;
- }(Serializer));
- var _WriteVisitor$1 = /** @class */ (function () {
- function _WriteVisitor() {
- }
- /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- function (text, context) { return [new Text$2(text.value)]; };
- /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitContainer = /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- function (container, context) {
- var _this = this;
- var /** @type {?} */ nodes = [];
- container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); });
- return nodes;
- };
- /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitIcu = /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- function (icu, context) {
- var _this = this;
- var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
- Object.keys(icu.cases).forEach(function (c) {
- nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")]));
- });
- nodes.push(new Text$2("}"));
- return nodes;
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitTagPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var _this = this;
- var /** @type {?} */ type = getTypeForTag(ph.tag);
- if (ph.isVoid) {
- var /** @type {?} */ tagPh = new Tag(_PLACEHOLDER_TAG$1, {
- id: (this._nextPlaceholderId++).toString(),
- equiv: ph.startName,
- type: type,
- disp: "<" + ph.tag + "/>",
- });
- return [tagPh];
- }
- var /** @type {?} */ tagPc = new Tag(_PLACEHOLDER_SPANNING_TAG, {
- id: (this._nextPlaceholderId++).toString(),
- equivStart: ph.startName,
- equivEnd: ph.closeName,
- type: type,
- dispStart: "<" + ph.tag + ">",
- dispEnd: "</" + ph.tag + ">",
- });
- var /** @type {?} */ nodes = [].concat.apply([], ph.children.map(function (node) { return node.visit(_this); }));
- if (nodes.length) {
- nodes.forEach(function (node) { return tagPc.children.push(node); });
- }
- else {
- tagPc.children.push(new Text$2(''));
- }
- return [tagPc];
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var /** @type {?} */ idStr = (this._nextPlaceholderId++).toString();
- return [new Tag(_PLACEHOLDER_TAG$1, {
- id: idStr,
- equiv: ph.name,
- disp: "{{" + ph.value + "}}",
- })];
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _WriteVisitor.prototype.visitIcuPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var /** @type {?} */ cases = Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ');
- var /** @type {?} */ idStr = (this._nextPlaceholderId++).toString();
- return [new Tag(_PLACEHOLDER_TAG$1, { id: idStr, equiv: ph.name, disp: "{" + ph.value.expression + ", " + ph.value.type + ", " + cases + "}" })];
- };
- /**
- * @param {?} nodes
- * @return {?}
- */
- _WriteVisitor.prototype.serialize = /**
- * @param {?} nodes
- * @return {?}
- */
- function (nodes) {
- var _this = this;
- this._nextPlaceholderId = 0;
- return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); }));
- };
- return _WriteVisitor;
- }());
- var Xliff2Parser = /** @class */ (function () {
- function Xliff2Parser() {
- this._locale = null;
- }
- /**
- * @param {?} xliff
- * @param {?} url
- * @return {?}
- */
- Xliff2Parser.prototype.parse = /**
- * @param {?} xliff
- * @param {?} url
- * @return {?}
- */
- function (xliff, url) {
- this._unitMlString = null;
- this._msgIdToHtml = {};
- var /** @type {?} */ xml = new XmlParser().parse(xliff, url, false);
- this._errors = xml.errors;
- visitAll(this, xml.rootNodes, null);
- return {
- msgIdToHtml: this._msgIdToHtml,
- errors: this._errors,
- locale: this._locale,
- };
- };
- /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- Xliff2Parser.prototype.visitElement = /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- function (element, context) {
- switch (element.name) {
- case _UNIT_TAG$1:
- this._unitMlString = null;
- var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
- if (!idAttr) {
- this._addError(element, "<" + _UNIT_TAG$1 + "> misses the \"id\" attribute");
- }
- else {
- var /** @type {?} */ id = idAttr.value;
- if (this._msgIdToHtml.hasOwnProperty(id)) {
- this._addError(element, "Duplicated translations for msg " + id);
- }
- else {
- visitAll(this, element.children, null);
- if (typeof this._unitMlString === 'string') {
- this._msgIdToHtml[id] = this._unitMlString;
- }
- else {
- this._addError(element, "Message " + id + " misses a translation");
- }
- }
- }
- break;
- case _SOURCE_TAG$1:
- // ignore source message
- break;
- case _TARGET_TAG$1:
- var /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset;
- var /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset;
- var /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content;
- var /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd);
- this._unitMlString = innerText;
- break;
- case _XLIFF_TAG:
- var /** @type {?} */ localeAttr = element.attrs.find(function (attr) { return attr.name === 'trgLang'; });
- if (localeAttr) {
- this._locale = localeAttr.value;
- }
- var /** @type {?} */ versionAttr = element.attrs.find(function (attr) { return attr.name === 'version'; });
- if (versionAttr) {
- var /** @type {?} */ version = versionAttr.value;
- if (version !== '2.0') {
- this._addError(element, "The XLIFF file version " + version + " is not compatible with XLIFF 2.0 serializer");
- }
- else {
- visitAll(this, element.children, null);
- }
- }
- break;
- default:
- visitAll(this, element.children, null);
- }
- };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- Xliff2Parser.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) { };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- Xliff2Parser.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) { };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- Xliff2Parser.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { };
- /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- Xliff2Parser.prototype.visitExpansion = /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- function (expansion, context) { };
- /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- Xliff2Parser.prototype.visitExpansionCase = /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- function (expansionCase, context) { };
- /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- Xliff2Parser.prototype._addError = /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- function (node, message) {
- this._errors.push(new I18nError(node.sourceSpan, message));
- };
- return Xliff2Parser;
- }());
- var XmlToI18n$1 = /** @class */ (function () {
- function XmlToI18n() {
- }
- /**
- * @param {?} message
- * @param {?} url
- * @return {?}
- */
- XmlToI18n.prototype.convert = /**
- * @param {?} message
- * @param {?} url
- * @return {?}
- */
- function (message, url) {
- var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true);
- this._errors = xmlIcu.errors;
- var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
- [] : [].concat.apply([], visitAll(this, xmlIcu.rootNodes));
- return {
- i18nNodes: i18nNodes,
- errors: this._errors,
- };
- };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) { return new Text$1(text.value, text.sourceSpan); };
- /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitElement = /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- function (el, context) {
- var _this = this;
- switch (el.name) {
- case _PLACEHOLDER_TAG$1:
- var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'equiv'; });
- if (nameAttr) {
- return [new Placeholder('', nameAttr.value, el.sourceSpan)];
- }
- this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equiv\" attribute");
- break;
- case _PLACEHOLDER_SPANNING_TAG:
- var /** @type {?} */ startAttr = el.attrs.find(function (attr) { return attr.name === 'equivStart'; });
- var /** @type {?} */ endAttr = el.attrs.find(function (attr) { return attr.name === 'equivEnd'; });
- if (!startAttr) {
- this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivStart\" attribute");
- }
- else if (!endAttr) {
- this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivEnd\" attribute");
- }
- else {
- var /** @type {?} */ startId = startAttr.value;
- var /** @type {?} */ endId = endAttr.value;
- var /** @type {?} */ nodes = [];
- 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)]));
- }
- break;
- case _MARKER_TAG$1:
- return [].concat.apply([], visitAll(this, el.children));
- default:
- this._addError(el, "Unexpected tag");
- }
- return null;
- };
- /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitExpansion = /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- function (icu, context) {
- var /** @type {?} */ caseMap = {};
- visitAll(this, icu.cases).forEach(function (c) {
- caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
- });
- return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
- };
- /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitExpansionCase = /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- function (icuCase, context) {
- return {
- value: icuCase.value,
- nodes: [].concat.apply([], visitAll(this, icuCase.expression)),
- };
- };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) { };
- /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- XmlToI18n.prototype._addError = /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- function (node, message) {
- this._errors.push(new I18nError(node.sourceSpan, message));
- };
- return XmlToI18n;
- }());
- /**
- * @param {?} tag
- * @return {?}
- */
- function getTypeForTag(tag) {
- switch (tag.toLowerCase()) {
- case 'br':
- case 'b':
- case 'i':
- case 'u':
- return 'fmt';
- case 'img':
- return 'image';
- case 'a':
- return 'link';
- default:
- return 'other';
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _MESSAGES_TAG = 'messagebundle';
- var _MESSAGE_TAG = 'msg';
- var _PLACEHOLDER_TAG$2 = 'ph';
- var _EXEMPLE_TAG = 'ex';
- var _SOURCE_TAG$2 = 'source';
- 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)>";
- var Xmb = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xmb, _super);
- function Xmb() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} messages
- * @param {?} locale
- * @return {?}
- */
- Xmb.prototype.write = /**
- * @param {?} messages
- * @param {?} locale
- * @return {?}
- */
- function (messages, locale) {
- var /** @type {?} */ exampleVisitor = new ExampleVisitor();
- var /** @type {?} */ visitor = new _Visitor$2();
- var /** @type {?} */ rootNode = new Tag(_MESSAGES_TAG);
- messages.forEach(function (message) {
- var /** @type {?} */ attrs = { id: message.id };
- if (message.description) {
- attrs['desc'] = message.description;
- }
- if (message.meaning) {
- attrs['meaning'] = message.meaning;
- }
- var /** @type {?} */ sourceTags = [];
- message.sources.forEach(function (source) {
- sourceTags.push(new Tag(_SOURCE_TAG$2, {}, [
- new Text$2(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : ''))
- ]));
- });
- rootNode.children.push(new CR(2), new Tag(_MESSAGE_TAG, attrs, sourceTags.concat(visitor.serialize(message.nodes))));
- });
- rootNode.children.push(new CR());
- return serialize([
- new Declaration({ version: '1.0', encoding: 'UTF-8' }),
- new CR(),
- new Doctype(_MESSAGES_TAG, _DOCTYPE),
- new CR(),
- exampleVisitor.addDefaultExamples(rootNode),
- new CR(),
- ]);
- };
- /**
- * @param {?} content
- * @param {?} url
- * @return {?}
- */
- Xmb.prototype.load = /**
- * @param {?} content
- * @param {?} url
- * @return {?}
- */
- function (content, url) {
- throw new Error('Unsupported');
- };
- /**
- * @param {?} message
- * @return {?}
- */
- Xmb.prototype.digest = /**
- * @param {?} message
- * @return {?}
- */
- function (message) { return digest$1(message); };
- /**
- * @param {?} message
- * @return {?}
- */
- Xmb.prototype.createNameMapper = /**
- * @param {?} message
- * @return {?}
- */
- function (message) {
- return new SimplePlaceholderMapper(message, toPublicName);
- };
- return Xmb;
- }(Serializer));
- var _Visitor$2 = /** @class */ (function () {
- function _Visitor() {
- }
- /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- _Visitor.prototype.visitText = /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- function (text, context) { return [new Text$2(text.value)]; };
- /**
- * @param {?} container
- * @param {?} context
- * @return {?}
- */
- _Visitor.prototype.visitContainer = /**
- * @param {?} container
- * @param {?} context
- * @return {?}
- */
- function (container, context) {
- var _this = this;
- var /** @type {?} */ nodes = [];
- container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); });
- return nodes;
- };
- /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- _Visitor.prototype.visitIcu = /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- function (icu, context) {
- var _this = this;
- var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
- Object.keys(icu.cases).forEach(function (c) {
- nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")]));
- });
- nodes.push(new Text$2("}"));
- return nodes;
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _Visitor.prototype.visitTagPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var /** @type {?} */ startEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("<" + ph.tag + ">")]);
- var /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.startName }, [startEx]);
- if (ph.isVoid) {
- // void tags have no children nor closing tags
- return [startTagPh];
- }
- var /** @type {?} */ closeEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("</" + ph.tag + ">")]);
- var /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.closeName }, [closeEx]);
- return [startTagPh].concat(this.serialize(ph.children), [closeTagPh]);
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _Visitor.prototype.visitPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var /** @type {?} */ exTag = new Tag(_EXEMPLE_TAG, {}, [new Text$2("{{" + ph.value + "}}")]);
- return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])];
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- _Visitor.prototype.visitIcuPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var /** @type {?} */ exTag = new Tag(_EXEMPLE_TAG, {}, [
- new Text$2("{" + ph.value.expression + ", " + ph.value.type + ", " + Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ') + "}")
- ]);
- return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])];
- };
- /**
- * @param {?} nodes
- * @return {?}
- */
- _Visitor.prototype.serialize = /**
- * @param {?} nodes
- * @return {?}
- */
- function (nodes) {
- var _this = this;
- return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); }));
- };
- return _Visitor;
- }());
- /**
- * @param {?} message
- * @return {?}
- */
- function digest$1(message) {
- return decimalDigest(message);
- }
- var ExampleVisitor = /** @class */ (function () {
- function ExampleVisitor() {
- }
- /**
- * @param {?} node
- * @return {?}
- */
- ExampleVisitor.prototype.addDefaultExamples = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- node.visit(this);
- return node;
- };
- /**
- * @param {?} tag
- * @return {?}
- */
- ExampleVisitor.prototype.visitTag = /**
- * @param {?} tag
- * @return {?}
- */
- function (tag) {
- var _this = this;
- if (tag.name === _PLACEHOLDER_TAG$2) {
- if (!tag.children || tag.children.length == 0) {
- var /** @type {?} */ exText = new Text$2(tag.attrs['name'] || '...');
- tag.children = [new Tag(_EXEMPLE_TAG, {}, [exText])];
- }
- }
- else if (tag.children) {
- tag.children.forEach(function (node) { return node.visit(_this); });
- }
- };
- /**
- * @param {?} text
- * @return {?}
- */
- ExampleVisitor.prototype.visitText = /**
- * @param {?} text
- * @return {?}
- */
- function (text) { };
- /**
- * @param {?} decl
- * @return {?}
- */
- ExampleVisitor.prototype.visitDeclaration = /**
- * @param {?} decl
- * @return {?}
- */
- function (decl) { };
- /**
- * @param {?} doctype
- * @return {?}
- */
- ExampleVisitor.prototype.visitDoctype = /**
- * @param {?} doctype
- * @return {?}
- */
- function (doctype) { };
- return ExampleVisitor;
- }());
- /**
- * @param {?} internalName
- * @return {?}
- */
- function toPublicName(internalName) {
- return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, '_');
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _TRANSLATIONS_TAG = 'translationbundle';
- var _TRANSLATION_TAG = 'translation';
- var _PLACEHOLDER_TAG$3 = 'ph';
- var Xtb = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xtb, _super);
- function Xtb() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} messages
- * @param {?} locale
- * @return {?}
- */
- Xtb.prototype.write = /**
- * @param {?} messages
- * @param {?} locale
- * @return {?}
- */
- function (messages, locale) { throw new Error('Unsupported'); };
- /**
- * @param {?} content
- * @param {?} url
- * @return {?}
- */
- Xtb.prototype.load = /**
- * @param {?} content
- * @param {?} url
- * @return {?}
- */
- function (content, url) {
- // xtb to xml nodes
- var /** @type {?} */ xtbParser = new XtbParser();
- var _a = xtbParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
- // xml nodes to i18n nodes
- var /** @type {?} */ i18nNodesByMsgId = {};
- var /** @type {?} */ converter = new XmlToI18n$2();
- // Because we should be able to load xtb files that rely on features not supported by angular,
- // we need to delay the conversion of html to i18n nodes so that non angular messages are not
- // converted
- Object.keys(msgIdToHtml).forEach(function (msgId) {
- var /** @type {?} */ valueFn = function () {
- var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, errors = _a.errors;
- if (errors.length) {
- throw new Error("xtb parse errors:\n" + errors.join('\n'));
- }
- return i18nNodes;
- };
- createLazyProperty(i18nNodesByMsgId, msgId, valueFn);
- });
- if (errors.length) {
- throw new Error("xtb parse errors:\n" + errors.join('\n'));
- }
- return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId };
- };
- /**
- * @param {?} message
- * @return {?}
- */
- Xtb.prototype.digest = /**
- * @param {?} message
- * @return {?}
- */
- function (message) { return digest$1(message); };
- /**
- * @param {?} message
- * @return {?}
- */
- Xtb.prototype.createNameMapper = /**
- * @param {?} message
- * @return {?}
- */
- function (message) {
- return new SimplePlaceholderMapper(message, toPublicName);
- };
- return Xtb;
- }(Serializer));
- /**
- * @param {?} messages
- * @param {?} id
- * @param {?} valueFn
- * @return {?}
- */
- function createLazyProperty(messages, id, valueFn) {
- Object.defineProperty(messages, id, {
- configurable: true,
- enumerable: true,
- get: function () {
- var /** @type {?} */ value = valueFn();
- Object.defineProperty(messages, id, { enumerable: true, value: value });
- return value;
- },
- set: function (_) { throw new Error('Could not overwrite an XTB translation'); },
- });
- }
- var XtbParser = /** @class */ (function () {
- function XtbParser() {
- this._locale = null;
- }
- /**
- * @param {?} xtb
- * @param {?} url
- * @return {?}
- */
- XtbParser.prototype.parse = /**
- * @param {?} xtb
- * @param {?} url
- * @return {?}
- */
- function (xtb, url) {
- this._bundleDepth = 0;
- this._msgIdToHtml = {};
- // We can not parse the ICU messages at this point as some messages might not originate
- // from Angular that could not be lex'd.
- var /** @type {?} */ xml = new XmlParser().parse(xtb, url, false);
- this._errors = xml.errors;
- visitAll(this, xml.rootNodes);
- return {
- msgIdToHtml: this._msgIdToHtml,
- errors: this._errors,
- locale: this._locale,
- };
- };
- /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- XtbParser.prototype.visitElement = /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- function (element, context) {
- switch (element.name) {
- case _TRANSLATIONS_TAG:
- this._bundleDepth++;
- if (this._bundleDepth > 1) {
- this._addError(element, "<" + _TRANSLATIONS_TAG + "> elements can not be nested");
- }
- var /** @type {?} */ langAttr = element.attrs.find(function (attr) { return attr.name === 'lang'; });
- if (langAttr) {
- this._locale = langAttr.value;
- }
- visitAll(this, element.children, null);
- this._bundleDepth--;
- break;
- case _TRANSLATION_TAG:
- var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
- if (!idAttr) {
- this._addError(element, "<" + _TRANSLATION_TAG + "> misses the \"id\" attribute");
- }
- else {
- var /** @type {?} */ id = idAttr.value;
- if (this._msgIdToHtml.hasOwnProperty(id)) {
- this._addError(element, "Duplicated translations for msg " + id);
- }
- else {
- var /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset;
- var /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset;
- var /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content;
- var /** @type {?} */ innerText = content.slice(/** @type {?} */ ((innerTextStart)), /** @type {?} */ ((innerTextEnd)));
- this._msgIdToHtml[id] = innerText;
- }
- }
- break;
- default:
- this._addError(element, 'Unexpected tag');
- }
- };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- XtbParser.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) { };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- XtbParser.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) { };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- XtbParser.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { };
- /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- XtbParser.prototype.visitExpansion = /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- function (expansion, context) { };
- /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- XtbParser.prototype.visitExpansionCase = /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- function (expansionCase, context) { };
- /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- XtbParser.prototype._addError = /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- function (node, message) {
- this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
- };
- return XtbParser;
- }());
- var XmlToI18n$2 = /** @class */ (function () {
- function XmlToI18n() {
- }
- /**
- * @param {?} message
- * @param {?} url
- * @return {?}
- */
- XmlToI18n.prototype.convert = /**
- * @param {?} message
- * @param {?} url
- * @return {?}
- */
- function (message, url) {
- var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true);
- this._errors = xmlIcu.errors;
- var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
- [] :
- visitAll(this, xmlIcu.rootNodes);
- return {
- i18nNodes: i18nNodes,
- errors: this._errors,
- };
- };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); };
- /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitExpansion = /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- function (icu, context) {
- var /** @type {?} */ caseMap = {};
- visitAll(this, icu.cases).forEach(function (c) {
- caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
- });
- return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
- };
- /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitExpansionCase = /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- function (icuCase, context) {
- return {
- value: icuCase.value,
- nodes: visitAll(this, icuCase.expression),
- };
- };
- /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitElement = /**
- * @param {?} el
- * @param {?} context
- * @return {?}
- */
- function (el, context) {
- if (el.name === _PLACEHOLDER_TAG$3) {
- var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'name'; });
- if (nameAttr) {
- return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan)));
- }
- this._addError(el, "<" + _PLACEHOLDER_TAG$3 + "> misses the \"name\" attribute");
- }
- else {
- this._addError(el, "Unexpected tag");
- }
- return null;
- };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- XmlToI18n.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) { };
- /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- XmlToI18n.prototype._addError = /**
- * @param {?} node
- * @param {?} message
- * @return {?}
- */
- function (node, message) {
- this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
- };
- return XmlToI18n;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var HtmlParser = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(HtmlParser, _super);
- function HtmlParser() {
- return _super.call(this, getHtmlTagDefinition) || this;
- }
- /**
- * @param {?} source
- * @param {?} url
- * @param {?=} parseExpansionForms
- * @param {?=} interpolationConfig
- * @return {?}
- */
- HtmlParser.prototype.parse = /**
- * @param {?} source
- * @param {?} url
- * @param {?=} parseExpansionForms
- * @param {?=} interpolationConfig
- * @return {?}
- */
- function (source, url, parseExpansionForms, interpolationConfig) {
- if (parseExpansionForms === void 0) { parseExpansionForms = false; }
- if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- return _super.prototype.parse.call(this, source, url, parseExpansionForms, interpolationConfig);
- };
- return HtmlParser;
- }(Parser$1));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A container for translated messages
- */
- var TranslationBundle = /** @class */ (function () {
- function TranslationBundle(_i18nNodesByMsgId, locale, digest, mapperFactory, missingTranslationStrategy, console) {
- if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; }
- if (missingTranslationStrategy === void 0) { missingTranslationStrategy = MissingTranslationStrategy.Warning; }
- this._i18nNodesByMsgId = _i18nNodesByMsgId;
- this.digest = digest;
- this.mapperFactory = mapperFactory;
- this._i18nToHtml = new I18nToHtmlVisitor(_i18nNodesByMsgId, locale, digest, /** @type {?} */ ((mapperFactory)), missingTranslationStrategy, console);
- }
- // Creates a `TranslationBundle` by parsing the given `content` with the `serializer`.
- /**
- * @param {?} content
- * @param {?} url
- * @param {?} serializer
- * @param {?} missingTranslationStrategy
- * @param {?=} console
- * @return {?}
- */
- TranslationBundle.load = /**
- * @param {?} content
- * @param {?} url
- * @param {?} serializer
- * @param {?} missingTranslationStrategy
- * @param {?=} console
- * @return {?}
- */
- function (content, url, serializer, missingTranslationStrategy, console) {
- var _a = serializer.load(content, url), locale = _a.locale, i18nNodesByMsgId = _a.i18nNodesByMsgId;
- var /** @type {?} */ digestFn = function (m) { return serializer.digest(m); };
- var /** @type {?} */ mapperFactory = function (m) { return ((serializer.createNameMapper(m))); };
- return new TranslationBundle(i18nNodesByMsgId, locale, digestFn, mapperFactory, missingTranslationStrategy, console);
- };
- // Returns the translation as HTML nodes from the given source message.
- /**
- * @param {?} srcMsg
- * @return {?}
- */
- TranslationBundle.prototype.get = /**
- * @param {?} srcMsg
- * @return {?}
- */
- function (srcMsg) {
- var /** @type {?} */ html = this._i18nToHtml.convert(srcMsg);
- if (html.errors.length) {
- throw new Error(html.errors.join('\n'));
- }
- return html.nodes;
- };
- /**
- * @param {?} srcMsg
- * @return {?}
- */
- TranslationBundle.prototype.has = /**
- * @param {?} srcMsg
- * @return {?}
- */
- function (srcMsg) { return this.digest(srcMsg) in this._i18nNodesByMsgId; };
- return TranslationBundle;
- }());
- var I18nToHtmlVisitor = /** @class */ (function () {
- function I18nToHtmlVisitor(_i18nNodesByMsgId, _locale, _digest, _mapperFactory, _missingTranslationStrategy, _console) {
- if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; }
- this._i18nNodesByMsgId = _i18nNodesByMsgId;
- this._locale = _locale;
- this._digest = _digest;
- this._mapperFactory = _mapperFactory;
- this._missingTranslationStrategy = _missingTranslationStrategy;
- this._console = _console;
- this._contextStack = [];
- this._errors = [];
- }
- /**
- * @param {?} srcMsg
- * @return {?}
- */
- I18nToHtmlVisitor.prototype.convert = /**
- * @param {?} srcMsg
- * @return {?}
- */
- function (srcMsg) {
- this._contextStack.length = 0;
- this._errors.length = 0;
- // i18n to text
- var /** @type {?} */ text = this._convertToText(srcMsg);
- // text to html
- var /** @type {?} */ url = srcMsg.nodes[0].sourceSpan.start.file.url;
- var /** @type {?} */ html = new HtmlParser().parse(text, url, true);
- return {
- nodes: html.rootNodes,
- errors: this._errors.concat(html.errors),
- };
- };
- /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- I18nToHtmlVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?=} context
- * @return {?}
- */
- function (text, context) { return text.value; };
- /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- I18nToHtmlVisitor.prototype.visitContainer = /**
- * @param {?} container
- * @param {?=} context
- * @return {?}
- */
- function (container, context) {
- var _this = this;
- return container.children.map(function (n) { return n.visit(_this); }).join('');
- };
- /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- I18nToHtmlVisitor.prototype.visitIcu = /**
- * @param {?} icu
- * @param {?=} context
- * @return {?}
- */
- function (icu, context) {
- var _this = this;
- var /** @type {?} */ cases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
- // TODO(vicb): Once all format switch to using expression placeholders
- // we should throw when the placeholder is not in the source message
- var /** @type {?} */ exp = this._srcMsg.placeholders.hasOwnProperty(icu.expression) ?
- this._srcMsg.placeholders[icu.expression] :
- icu.expression;
- return "{" + exp + ", " + icu.type + ", " + cases.join(' ') + "}";
- };
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- I18nToHtmlVisitor.prototype.visitPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var /** @type {?} */ phName = this._mapper(ph.name);
- if (this._srcMsg.placeholders.hasOwnProperty(phName)) {
- return this._srcMsg.placeholders[phName];
- }
- if (this._srcMsg.placeholderToMessage.hasOwnProperty(phName)) {
- return this._convertToText(this._srcMsg.placeholderToMessage[phName]);
- }
- this._addError(ph, "Unknown placeholder \"" + ph.name + "\"");
- return '';
- };
- // Loaded message contains only placeholders (vs tag and icu placeholders).
- // However when a translation can not be found, we need to serialize the source message
- // which can contain tag placeholders
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- I18nToHtmlVisitor.prototype.visitTagPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- var _this = this;
- var /** @type {?} */ tag = "" + ph.tag;
- var /** @type {?} */ attrs = Object.keys(ph.attrs).map(function (name) { return name + "=\"" + ph.attrs[name] + "\""; }).join(' ');
- if (ph.isVoid) {
- return "<" + tag + " " + attrs + "/>";
- }
- var /** @type {?} */ children = ph.children.map(function (c) { return c.visit(_this); }).join('');
- return "<" + tag + " " + attrs + ">" + children + "</" + tag + ">";
- };
- // Loaded message contains only placeholders (vs tag and icu placeholders).
- // However when a translation can not be found, we need to serialize the source message
- // which can contain tag placeholders
- /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- I18nToHtmlVisitor.prototype.visitIcuPlaceholder = /**
- * @param {?} ph
- * @param {?=} context
- * @return {?}
- */
- function (ph, context) {
- // An ICU placeholder references the source message to be serialized
- return this._convertToText(this._srcMsg.placeholderToMessage[ph.name]);
- };
- /**
- * Convert a source message to a translated text string:
- * - text nodes are replaced with their translation,
- * - placeholders are replaced with their content,
- * - ICU nodes are converted to ICU expressions.
- * @param {?} srcMsg
- * @return {?}
- */
- I18nToHtmlVisitor.prototype._convertToText = /**
- * Convert a source message to a translated text string:
- * - text nodes are replaced with their translation,
- * - placeholders are replaced with their content,
- * - ICU nodes are converted to ICU expressions.
- * @param {?} srcMsg
- * @return {?}
- */
- function (srcMsg) {
- var _this = this;
- var /** @type {?} */ id = this._digest(srcMsg);
- var /** @type {?} */ mapper = this._mapperFactory ? this._mapperFactory(srcMsg) : null;
- var /** @type {?} */ nodes;
- this._contextStack.push({ msg: this._srcMsg, mapper: this._mapper });
- this._srcMsg = srcMsg;
- if (this._i18nNodesByMsgId.hasOwnProperty(id)) {
- // When there is a translation use its nodes as the source
- // And create a mapper to convert serialized placeholder names to internal names
- nodes = this._i18nNodesByMsgId[id];
- this._mapper = function (name) { return mapper ? /** @type {?} */ ((mapper.toInternalName(name))) : name; };
- }
- else {
- // When no translation has been found
- // - report an error / a warning / nothing,
- // - use the nodes from the original message
- // - placeholders are already internal and need no mapper
- if (this._missingTranslationStrategy === MissingTranslationStrategy.Error) {
- var /** @type {?} */ ctx = this._locale ? " for locale \"" + this._locale + "\"" : '';
- this._addError(srcMsg.nodes[0], "Missing translation for message \"" + id + "\"" + ctx);
- }
- else if (this._console &&
- this._missingTranslationStrategy === MissingTranslationStrategy.Warning) {
- var /** @type {?} */ ctx = this._locale ? " for locale \"" + this._locale + "\"" : '';
- this._console.warn("Missing translation for message \"" + id + "\"" + ctx);
- }
- nodes = srcMsg.nodes;
- this._mapper = function (name) { return name; };
- }
- var /** @type {?} */ text = nodes.map(function (node) { return node.visit(_this); }).join('');
- var /** @type {?} */ context = /** @type {?} */ ((this._contextStack.pop()));
- this._srcMsg = context.msg;
- this._mapper = context.mapper;
- return text;
- };
- /**
- * @param {?} el
- * @param {?} msg
- * @return {?}
- */
- I18nToHtmlVisitor.prototype._addError = /**
- * @param {?} el
- * @param {?} msg
- * @return {?}
- */
- function (el, msg) {
- this._errors.push(new I18nError(el.sourceSpan, msg));
- };
- return I18nToHtmlVisitor;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var I18NHtmlParser = /** @class */ (function () {
- function I18NHtmlParser(_htmlParser, translations, translationsFormat, missingTranslation, console) {
- if (missingTranslation === void 0) { missingTranslation = MissingTranslationStrategy.Warning; }
- this._htmlParser = _htmlParser;
- if (translations) {
- var /** @type {?} */ serializer = createSerializer(translationsFormat);
- this._translationBundle =
- TranslationBundle.load(translations, 'i18n', serializer, missingTranslation, console);
- }
- else {
- this._translationBundle =
- new TranslationBundle({}, null, digest, undefined, missingTranslation, console);
- }
- }
- /**
- * @param {?} source
- * @param {?} url
- * @param {?=} parseExpansionForms
- * @param {?=} interpolationConfig
- * @return {?}
- */
- I18NHtmlParser.prototype.parse = /**
- * @param {?} source
- * @param {?} url
- * @param {?=} parseExpansionForms
- * @param {?=} interpolationConfig
- * @return {?}
- */
- function (source, url, parseExpansionForms, interpolationConfig) {
- if (parseExpansionForms === void 0) { parseExpansionForms = false; }
- if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
- var /** @type {?} */ parseResult = this._htmlParser.parse(source, url, parseExpansionForms, interpolationConfig);
- if (parseResult.errors.length) {
- return new ParseTreeResult(parseResult.rootNodes, parseResult.errors);
- }
- return mergeTranslations(parseResult.rootNodes, this._translationBundle, interpolationConfig, [], {});
- };
- return I18NHtmlParser;
- }());
- /**
- * @param {?=} format
- * @return {?}
- */
- function createSerializer(format) {
- format = (format || 'xlf').toLowerCase();
- switch (format) {
- case 'xmb':
- return new Xmb();
- case 'xtb':
- return new Xtb();
- case 'xliff2':
- case 'xlf2':
- return new Xliff2();
- case 'xliff':
- case 'xlf':
- default:
- return new Xliff();
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var STRIP_SRC_FILE_SUFFIXES = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
- var GENERATED_FILE = /\.ngfactory\.|\.ngsummary\./;
- var JIT_SUMMARY_FILE = /\.ngsummary\./;
- var JIT_SUMMARY_NAME = /NgSummary$/;
- /**
- * @param {?} filePath
- * @param {?=} forceSourceFile
- * @return {?}
- */
- function ngfactoryFilePath(filePath, forceSourceFile) {
- if (forceSourceFile === void 0) { forceSourceFile = false; }
- var /** @type {?} */ urlWithSuffix = splitTypescriptSuffix(filePath, forceSourceFile);
- return urlWithSuffix[0] + ".ngfactory" + normalizeGenFileSuffix(urlWithSuffix[1]);
- }
- /**
- * @param {?} filePath
- * @return {?}
- */
- function stripGeneratedFileSuffix(filePath) {
- return filePath.replace(GENERATED_FILE, '.');
- }
- /**
- * @param {?} filePath
- * @return {?}
- */
- function isGeneratedFile(filePath) {
- return GENERATED_FILE.test(filePath);
- }
- /**
- * @param {?} path
- * @param {?=} forceSourceFile
- * @return {?}
- */
- function splitTypescriptSuffix(path, forceSourceFile) {
- if (forceSourceFile === void 0) { forceSourceFile = false; }
- if (path.endsWith('.d.ts')) {
- return [path.slice(0, -5), forceSourceFile ? '.ts' : '.d.ts'];
- }
- var /** @type {?} */ lastDot = path.lastIndexOf('.');
- if (lastDot !== -1) {
- return [path.substring(0, lastDot), path.substring(lastDot)];
- }
- return [path, ''];
- }
- /**
- * @param {?} srcFileSuffix
- * @return {?}
- */
- function normalizeGenFileSuffix(srcFileSuffix) {
- return srcFileSuffix === '.tsx' ? '.ts' : srcFileSuffix;
- }
- /**
- * @param {?} fileName
- * @return {?}
- */
- function summaryFileName(fileName) {
- var /** @type {?} */ fileNameWithoutSuffix = fileName.replace(STRIP_SRC_FILE_SUFFIXES, '');
- return fileNameWithoutSuffix + ".ngsummary.json";
- }
- /**
- * @param {?} fileName
- * @param {?=} forceSourceFile
- * @return {?}
- */
- function summaryForJitFileName(fileName, forceSourceFile) {
- if (forceSourceFile === void 0) { forceSourceFile = false; }
- var /** @type {?} */ urlWithSuffix = splitTypescriptSuffix(stripGeneratedFileSuffix(fileName), forceSourceFile);
- return urlWithSuffix[0] + ".ngsummary" + urlWithSuffix[1];
- }
- /**
- * @param {?} filePath
- * @return {?}
- */
- function stripSummaryForJitFileSuffix(filePath) {
- return filePath.replace(JIT_SUMMARY_FILE, '.');
- }
- /**
- * @param {?} symbolName
- * @return {?}
- */
- function summaryForJitName(symbolName) {
- return symbolName + "NgSummary";
- }
- /**
- * @param {?} symbolName
- * @return {?}
- */
- function stripSummaryForJitNameSuffix(symbolName) {
- return symbolName.replace(JIT_SUMMARY_NAME, '');
- }
- var LOWERED_SYMBOL = /\u0275\d+/;
- /**
- * @param {?} name
- * @return {?}
- */
- function isLoweredSymbol(name) {
- return LOWERED_SYMBOL.test(name);
- }
- /**
- * @param {?} id
- * @return {?}
- */
- function createLoweredSymbol(id) {
- return "\u0275" + id;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var CORE = '@angular/core';
- var Identifiers = /** @class */ (function () {
- function Identifiers() {
- }
- Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS = {
- name: 'ANALYZE_FOR_ENTRY_COMPONENTS',
- moduleName: CORE,
- };
- Identifiers.ElementRef = { name: 'ElementRef', moduleName: CORE };
- Identifiers.NgModuleRef = { name: 'NgModuleRef', moduleName: CORE };
- Identifiers.ViewContainerRef = { name: 'ViewContainerRef', moduleName: CORE };
- Identifiers.ChangeDetectorRef = {
- name: 'ChangeDetectorRef',
- moduleName: CORE,
- };
- Identifiers.QueryList = { name: 'QueryList', moduleName: CORE };
- Identifiers.TemplateRef = { name: 'TemplateRef', moduleName: CORE };
- Identifiers.CodegenComponentFactoryResolver = {
- name: 'ɵCodegenComponentFactoryResolver',
- moduleName: CORE,
- };
- Identifiers.ComponentFactoryResolver = {
- name: 'ComponentFactoryResolver',
- moduleName: CORE,
- };
- Identifiers.ComponentFactory = { name: 'ComponentFactory', moduleName: CORE };
- Identifiers.ComponentRef = { name: 'ComponentRef', moduleName: CORE };
- Identifiers.NgModuleFactory = { name: 'NgModuleFactory', moduleName: CORE };
- Identifiers.createModuleFactory = {
- name: 'ɵcmf',
- moduleName: CORE,
- };
- Identifiers.moduleDef = {
- name: 'ɵmod',
- moduleName: CORE,
- };
- Identifiers.moduleProviderDef = {
- name: 'ɵmpd',
- moduleName: CORE,
- };
- Identifiers.RegisterModuleFactoryFn = {
- name: 'ɵregisterModuleFactory',
- moduleName: CORE,
- };
- Identifiers.Injector = { name: 'Injector', moduleName: CORE };
- Identifiers.ViewEncapsulation = {
- name: 'ViewEncapsulation',
- moduleName: CORE,
- };
- Identifiers.ChangeDetectionStrategy = {
- name: 'ChangeDetectionStrategy',
- moduleName: CORE,
- };
- Identifiers.SecurityContext = {
- name: 'SecurityContext',
- moduleName: CORE,
- };
- Identifiers.LOCALE_ID = { name: 'LOCALE_ID', moduleName: CORE };
- Identifiers.TRANSLATIONS_FORMAT = {
- name: 'TRANSLATIONS_FORMAT',
- moduleName: CORE,
- };
- Identifiers.inlineInterpolate = {
- name: 'ɵinlineInterpolate',
- moduleName: CORE,
- };
- Identifiers.interpolate = { name: 'ɵinterpolate', moduleName: CORE };
- Identifiers.EMPTY_ARRAY = { name: 'ɵEMPTY_ARRAY', moduleName: CORE };
- Identifiers.EMPTY_MAP = { name: 'ɵEMPTY_MAP', moduleName: CORE };
- Identifiers.Renderer = { name: 'Renderer', moduleName: CORE };
- Identifiers.viewDef = { name: 'ɵvid', moduleName: CORE };
- Identifiers.elementDef = { name: 'ɵeld', moduleName: CORE };
- Identifiers.anchorDef = { name: 'ɵand', moduleName: CORE };
- Identifiers.textDef = { name: 'ɵted', moduleName: CORE };
- Identifiers.directiveDef = { name: 'ɵdid', moduleName: CORE };
- Identifiers.providerDef = { name: 'ɵprd', moduleName: CORE };
- Identifiers.queryDef = { name: 'ɵqud', moduleName: CORE };
- Identifiers.pureArrayDef = { name: 'ɵpad', moduleName: CORE };
- Identifiers.pureObjectDef = { name: 'ɵpod', moduleName: CORE };
- Identifiers.purePipeDef = { name: 'ɵppd', moduleName: CORE };
- Identifiers.pipeDef = { name: 'ɵpid', moduleName: CORE };
- Identifiers.nodeValue = { name: 'ɵnov', moduleName: CORE };
- Identifiers.ngContentDef = { name: 'ɵncd', moduleName: CORE };
- Identifiers.unwrapValue = { name: 'ɵunv', moduleName: CORE };
- Identifiers.createRendererType2 = { name: 'ɵcrt', moduleName: CORE };
- // type only
- Identifiers.RendererType2 = {
- name: 'RendererType2',
- moduleName: CORE,
- };
- // type only
- Identifiers.ViewDefinition = {
- name: 'ɵViewDefinition',
- moduleName: CORE,
- };
- Identifiers.createComponentFactory = { name: 'ɵccf', moduleName: CORE };
- return Identifiers;
- }());
- /**
- * @param {?} reference
- * @return {?}
- */
- function createTokenForReference(reference) {
- return { identifier: { reference: reference } };
- }
- /**
- * @param {?} reflector
- * @param {?} reference
- * @return {?}
- */
- function createTokenForExternalReference(reflector, reference) {
- return createTokenForReference(reflector.resolveExternalReference(reference));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var LifecycleHooks = {
- OnInit: 0,
- OnDestroy: 1,
- DoCheck: 2,
- OnChanges: 3,
- AfterContentInit: 4,
- AfterContentChecked: 5,
- AfterViewInit: 6,
- AfterViewChecked: 7,
- };
- LifecycleHooks[LifecycleHooks.OnInit] = "OnInit";
- LifecycleHooks[LifecycleHooks.OnDestroy] = "OnDestroy";
- LifecycleHooks[LifecycleHooks.DoCheck] = "DoCheck";
- LifecycleHooks[LifecycleHooks.OnChanges] = "OnChanges";
- LifecycleHooks[LifecycleHooks.AfterContentInit] = "AfterContentInit";
- LifecycleHooks[LifecycleHooks.AfterContentChecked] = "AfterContentChecked";
- LifecycleHooks[LifecycleHooks.AfterViewInit] = "AfterViewInit";
- LifecycleHooks[LifecycleHooks.AfterViewChecked] = "AfterViewChecked";
- var LIFECYCLE_HOOKS_VALUES = [
- LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges,
- LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit,
- LifecycleHooks.AfterViewChecked
- ];
- /**
- * @param {?} reflector
- * @param {?} hook
- * @param {?} token
- * @return {?}
- */
- function hasLifecycleHook(reflector, hook, token) {
- return reflector.hasLifecycleHook(token, getHookName(hook));
- }
- /**
- * @param {?} reflector
- * @param {?} token
- * @return {?}
- */
- function getAllLifecycleHooks(reflector, token) {
- return LIFECYCLE_HOOKS_VALUES.filter(function (hook) { return hasLifecycleHook(reflector, hook, token); });
- }
- /**
- * @param {?} hook
- * @return {?}
- */
- function getHookName(hook) {
- switch (hook) {
- case LifecycleHooks.OnInit:
- return 'ngOnInit';
- case LifecycleHooks.OnDestroy:
- return 'ngOnDestroy';
- case LifecycleHooks.DoCheck:
- return 'ngDoCheck';
- case LifecycleHooks.OnChanges:
- return 'ngOnChanges';
- case LifecycleHooks.AfterContentInit:
- return 'ngAfterContentInit';
- case LifecycleHooks.AfterContentChecked:
- return 'ngAfterContentChecked';
- case LifecycleHooks.AfterViewInit:
- return 'ngAfterViewInit';
- case LifecycleHooks.AfterViewChecked:
- return 'ngAfterViewChecked';
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' + //":not("
- '([-\\w]+)|' + // "tag"
- '(?:\\.([-\\w]+))|' + // ".class"
- '(?:\\[([-.\\w*]+)(?:=([\"\']?)([^\\]\"\']*)\\5)?\\])|' + // "[name]", "[name=value]",
- '(\\))|' + // ")"
- '(\\s*,\\s*)', // ","
- 'g');
- /**
- * A css selector contains an element name,
- * css classes and attribute/value pairs with the purpose
- * of selecting subsets out of them.
- */
- var CssSelector = /** @class */ (function () {
- function CssSelector() {
- this.element = null;
- this.classNames = [];
- this.attrs = [];
- this.notSelectors = [];
- }
- /**
- * @param {?} selector
- * @return {?}
- */
- CssSelector.parse = /**
- * @param {?} selector
- * @return {?}
- */
- function (selector) {
- var /** @type {?} */ results = [];
- var /** @type {?} */ _addResult = function (res, cssSel) {
- if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 &&
- cssSel.attrs.length == 0) {
- cssSel.element = '*';
- }
- res.push(cssSel);
- };
- var /** @type {?} */ cssSelector = new CssSelector();
- var /** @type {?} */ match;
- var /** @type {?} */ current = cssSelector;
- var /** @type {?} */ inNot = false;
- _SELECTOR_REGEXP.lastIndex = 0;
- while (match = _SELECTOR_REGEXP.exec(selector)) {
- if (match[1]) {
- if (inNot) {
- throw new Error('Nesting :not is not allowed in a selector');
- }
- inNot = true;
- current = new CssSelector();
- cssSelector.notSelectors.push(current);
- }
- if (match[2]) {
- current.setElement(match[2]);
- }
- if (match[3]) {
- current.addClassName(match[3]);
- }
- if (match[4]) {
- current.addAttribute(match[4], match[6]);
- }
- if (match[7]) {
- inNot = false;
- current = cssSelector;
- }
- if (match[8]) {
- if (inNot) {
- throw new Error('Multiple selectors in :not are not supported');
- }
- _addResult(results, cssSelector);
- cssSelector = current = new CssSelector();
- }
- }
- _addResult(results, cssSelector);
- return results;
- };
- /**
- * @return {?}
- */
- CssSelector.prototype.isElementSelector = /**
- * @return {?}
- */
- function () {
- return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 &&
- this.notSelectors.length === 0;
- };
- /**
- * @return {?}
- */
- CssSelector.prototype.hasElementSelector = /**
- * @return {?}
- */
- function () { return !!this.element; };
- /**
- * @param {?=} element
- * @return {?}
- */
- CssSelector.prototype.setElement = /**
- * @param {?=} element
- * @return {?}
- */
- function (element) {
- if (element === void 0) { element = null; }
- this.element = element;
- };
- /** Gets a template string for an element that matches the selector. */
- /**
- * Gets a template string for an element that matches the selector.
- * @return {?}
- */
- CssSelector.prototype.getMatchingElementTemplate = /**
- * Gets a template string for an element that matches the selector.
- * @return {?}
- */
- function () {
- var /** @type {?} */ tagName = this.element || 'div';
- var /** @type {?} */ classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : '';
- var /** @type {?} */ attrs = '';
- for (var /** @type {?} */ i = 0; i < this.attrs.length; i += 2) {
- var /** @type {?} */ attrName = this.attrs[i];
- var /** @type {?} */ attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : '';
- attrs += " " + attrName + attrValue;
- }
- return getHtmlTagDefinition(tagName).isVoid ? "<" + tagName + classAttr + attrs + "/>" :
- "<" + tagName + classAttr + attrs + "></" + tagName + ">";
- };
- /**
- * @param {?} name
- * @param {?=} value
- * @return {?}
- */
- CssSelector.prototype.addAttribute = /**
- * @param {?} name
- * @param {?=} value
- * @return {?}
- */
- function (name, value) {
- if (value === void 0) { value = ''; }
- this.attrs.push(name, value && value.toLowerCase() || '');
- };
- /**
- * @param {?} name
- * @return {?}
- */
- CssSelector.prototype.addClassName = /**
- * @param {?} name
- * @return {?}
- */
- function (name) { this.classNames.push(name.toLowerCase()); };
- /**
- * @return {?}
- */
- CssSelector.prototype.toString = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ res = this.element || '';
- if (this.classNames) {
- this.classNames.forEach(function (klass) { return res += "." + klass; });
- }
- if (this.attrs) {
- for (var /** @type {?} */ i = 0; i < this.attrs.length; i += 2) {
- var /** @type {?} */ name_1 = this.attrs[i];
- var /** @type {?} */ value = this.attrs[i + 1];
- res += "[" + name_1 + (value ? '=' + value : '') + "]";
- }
- }
- this.notSelectors.forEach(function (notSelector) { return res += ":not(" + notSelector + ")"; });
- return res;
- };
- return CssSelector;
- }());
- /**
- * Reads a list of CssSelectors and allows to calculate which ones
- * are contained in a given CssSelector.
- */
- var SelectorMatcher = /** @class */ (function () {
- function SelectorMatcher() {
- this._elementMap = new Map();
- this._elementPartialMap = new Map();
- this._classMap = new Map();
- this._classPartialMap = new Map();
- this._attrValueMap = new Map();
- this._attrValuePartialMap = new Map();
- this._listContexts = [];
- }
- /**
- * @param {?} notSelectors
- * @return {?}
- */
- SelectorMatcher.createNotMatcher = /**
- * @param {?} notSelectors
- * @return {?}
- */
- function (notSelectors) {
- var /** @type {?} */ notMatcher = new SelectorMatcher();
- notMatcher.addSelectables(notSelectors, null);
- return notMatcher;
- };
- /**
- * @param {?} cssSelectors
- * @param {?=} callbackCtxt
- * @return {?}
- */
- SelectorMatcher.prototype.addSelectables = /**
- * @param {?} cssSelectors
- * @param {?=} callbackCtxt
- * @return {?}
- */
- function (cssSelectors, callbackCtxt) {
- var /** @type {?} */ listContext = /** @type {?} */ ((null));
- if (cssSelectors.length > 1) {
- listContext = new SelectorListContext(cssSelectors);
- this._listContexts.push(listContext);
- }
- for (var /** @type {?} */ i = 0; i < cssSelectors.length; i++) {
- this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
- }
- };
- /**
- * Add an object that can be found later on by calling `match`.
- * @param {?} cssSelector A css selector
- * @param {?} callbackCtxt An opaque object that will be given to the callback of the `match` function
- * @param {?} listContext
- * @return {?}
- */
- SelectorMatcher.prototype._addSelectable = /**
- * Add an object that can be found later on by calling `match`.
- * @param {?} cssSelector A css selector
- * @param {?} callbackCtxt An opaque object that will be given to the callback of the `match` function
- * @param {?} listContext
- * @return {?}
- */
- function (cssSelector, callbackCtxt, listContext) {
- var /** @type {?} */ matcher = this;
- var /** @type {?} */ element = cssSelector.element;
- var /** @type {?} */ classNames = cssSelector.classNames;
- var /** @type {?} */ attrs = cssSelector.attrs;
- var /** @type {?} */ selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);
- if (element) {
- var /** @type {?} */ isTerminal = attrs.length === 0 && classNames.length === 0;
- if (isTerminal) {
- this._addTerminal(matcher._elementMap, element, selectable);
- }
- else {
- matcher = this._addPartial(matcher._elementPartialMap, element);
- }
- }
- if (classNames) {
- for (var /** @type {?} */ i = 0; i < classNames.length; i++) {
- var /** @type {?} */ isTerminal = attrs.length === 0 && i === classNames.length - 1;
- var /** @type {?} */ className = classNames[i];
- if (isTerminal) {
- this._addTerminal(matcher._classMap, className, selectable);
- }
- else {
- matcher = this._addPartial(matcher._classPartialMap, className);
- }
- }
- }
- if (attrs) {
- for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
- var /** @type {?} */ isTerminal = i === attrs.length - 2;
- var /** @type {?} */ name_2 = attrs[i];
- var /** @type {?} */ value = attrs[i + 1];
- if (isTerminal) {
- var /** @type {?} */ terminalMap = matcher._attrValueMap;
- var /** @type {?} */ terminalValuesMap = terminalMap.get(name_2);
- if (!terminalValuesMap) {
- terminalValuesMap = new Map();
- terminalMap.set(name_2, terminalValuesMap);
- }
- this._addTerminal(terminalValuesMap, value, selectable);
- }
- else {
- var /** @type {?} */ partialMap = matcher._attrValuePartialMap;
- var /** @type {?} */ partialValuesMap = partialMap.get(name_2);
- if (!partialValuesMap) {
- partialValuesMap = new Map();
- partialMap.set(name_2, partialValuesMap);
- }
- matcher = this._addPartial(partialValuesMap, value);
- }
- }
- }
- };
- /**
- * @param {?} map
- * @param {?} name
- * @param {?} selectable
- * @return {?}
- */
- SelectorMatcher.prototype._addTerminal = /**
- * @param {?} map
- * @param {?} name
- * @param {?} selectable
- * @return {?}
- */
- function (map, name, selectable) {
- var /** @type {?} */ terminalList = map.get(name);
- if (!terminalList) {
- terminalList = [];
- map.set(name, terminalList);
- }
- terminalList.push(selectable);
- };
- /**
- * @param {?} map
- * @param {?} name
- * @return {?}
- */
- SelectorMatcher.prototype._addPartial = /**
- * @param {?} map
- * @param {?} name
- * @return {?}
- */
- function (map, name) {
- var /** @type {?} */ matcher = map.get(name);
- if (!matcher) {
- matcher = new SelectorMatcher();
- map.set(name, matcher);
- }
- return matcher;
- };
- /**
- * Find the objects that have been added via `addSelectable`
- * whose css selector is contained in the given css selector.
- * @param cssSelector A css selector
- * @param matchedCallback This callback will be called with the object handed into `addSelectable`
- * @return boolean true if a match was found
- */
- /**
- * Find the objects that have been added via `addSelectable`
- * whose css selector is contained in the given css selector.
- * @param {?} cssSelector A css selector
- * @param {?} matchedCallback This callback will be called with the object handed into `addSelectable`
- * @return {?} boolean true if a match was found
- */
- SelectorMatcher.prototype.match = /**
- * Find the objects that have been added via `addSelectable`
- * whose css selector is contained in the given css selector.
- * @param {?} cssSelector A css selector
- * @param {?} matchedCallback This callback will be called with the object handed into `addSelectable`
- * @return {?} boolean true if a match was found
- */
- function (cssSelector, matchedCallback) {
- var /** @type {?} */ result = false;
- var /** @type {?} */ element = /** @type {?} */ ((cssSelector.element));
- var /** @type {?} */ classNames = cssSelector.classNames;
- var /** @type {?} */ attrs = cssSelector.attrs;
- for (var /** @type {?} */ i = 0; i < this._listContexts.length; i++) {
- this._listContexts[i].alreadyMatched = false;
- }
- result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;
- result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) ||
- result;
- if (classNames) {
- for (var /** @type {?} */ i = 0; i < classNames.length; i++) {
- var /** @type {?} */ className = classNames[i];
- result =
- this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;
- result =
- this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) ||
- result;
- }
- }
- if (attrs) {
- for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
- var /** @type {?} */ name_3 = attrs[i];
- var /** @type {?} */ value = attrs[i + 1];
- var /** @type {?} */ terminalValuesMap = /** @type {?} */ ((this._attrValueMap.get(name_3)));
- if (value) {
- result =
- this._matchTerminal(terminalValuesMap, '', cssSelector, matchedCallback) || result;
- }
- result =
- this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result;
- var /** @type {?} */ partialValuesMap = /** @type {?} */ ((this._attrValuePartialMap.get(name_3)));
- if (value) {
- result = this._matchPartial(partialValuesMap, '', cssSelector, matchedCallback) || result;
- }
- result =
- this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result;
- }
- }
- return result;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} map
- * @param {?} name
- * @param {?} cssSelector
- * @param {?} matchedCallback
- * @return {?}
- */
- SelectorMatcher.prototype._matchTerminal = /**
- * \@internal
- * @param {?} map
- * @param {?} name
- * @param {?} cssSelector
- * @param {?} matchedCallback
- * @return {?}
- */
- function (map, name, cssSelector, matchedCallback) {
- if (!map || typeof name !== 'string') {
- return false;
- }
- var /** @type {?} */ selectables = map.get(name) || [];
- var /** @type {?} */ starSelectables = /** @type {?} */ ((map.get('*')));
- if (starSelectables) {
- selectables = selectables.concat(starSelectables);
- }
- if (selectables.length === 0) {
- return false;
- }
- var /** @type {?} */ selectable;
- var /** @type {?} */ result = false;
- for (var /** @type {?} */ i = 0; i < selectables.length; i++) {
- selectable = selectables[i];
- result = selectable.finalize(cssSelector, matchedCallback) || result;
- }
- return result;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} map
- * @param {?} name
- * @param {?} cssSelector
- * @param {?} matchedCallback
- * @return {?}
- */
- SelectorMatcher.prototype._matchPartial = /**
- * \@internal
- * @param {?} map
- * @param {?} name
- * @param {?} cssSelector
- * @param {?} matchedCallback
- * @return {?}
- */
- function (map, name, cssSelector, matchedCallback) {
- if (!map || typeof name !== 'string') {
- return false;
- }
- var /** @type {?} */ nestedSelector = map.get(name);
- if (!nestedSelector) {
- return false;
- }
- // TODO(perf): get rid of recursion and measure again
- // TODO(perf): don't pass the whole selector into the recursion,
- // but only the not processed parts
- return nestedSelector.match(cssSelector, matchedCallback);
- };
- return SelectorMatcher;
- }());
- var SelectorListContext = /** @class */ (function () {
- function SelectorListContext(selectors) {
- this.selectors = selectors;
- this.alreadyMatched = false;
- }
- return SelectorListContext;
- }());
- var SelectorContext = /** @class */ (function () {
- function SelectorContext(selector, cbContext, listContext) {
- this.selector = selector;
- this.cbContext = cbContext;
- this.listContext = listContext;
- this.notSelectors = selector.notSelectors;
- }
- /**
- * @param {?} cssSelector
- * @param {?} callback
- * @return {?}
- */
- SelectorContext.prototype.finalize = /**
- * @param {?} cssSelector
- * @param {?} callback
- * @return {?}
- */
- function (cssSelector, callback) {
- var /** @type {?} */ result = true;
- if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) {
- var /** @type {?} */ notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);
- result = !notMatcher.match(cssSelector, null);
- }
- if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) {
- if (this.listContext) {
- this.listContext.alreadyMatched = true;
- }
- callback(this.selector, this.cbContext);
- }
- return result;
- };
- return SelectorContext;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ERROR_COMPONENT_TYPE = 'ngComponentType';
- var CompileMetadataResolver = /** @class */ (function () {
- function CompileMetadataResolver(_config, _htmlParser, _ngModuleResolver, _directiveResolver, _pipeResolver, _summaryResolver, _schemaRegistry, _directiveNormalizer, _console, _staticSymbolCache, _reflector, _errorCollector) {
- this._config = _config;
- this._htmlParser = _htmlParser;
- this._ngModuleResolver = _ngModuleResolver;
- this._directiveResolver = _directiveResolver;
- this._pipeResolver = _pipeResolver;
- this._summaryResolver = _summaryResolver;
- this._schemaRegistry = _schemaRegistry;
- this._directiveNormalizer = _directiveNormalizer;
- this._console = _console;
- this._staticSymbolCache = _staticSymbolCache;
- this._reflector = _reflector;
- this._errorCollector = _errorCollector;
- this._nonNormalizedDirectiveCache = new Map();
- this._directiveCache = new Map();
- this._summaryCache = new Map();
- this._pipeCache = new Map();
- this._ngModuleCache = new Map();
- this._ngModuleOfTypes = new Map();
- }
- /**
- * @return {?}
- */
- CompileMetadataResolver.prototype.getReflector = /**
- * @return {?}
- */
- function () { return this._reflector; };
- /**
- * @param {?} type
- * @return {?}
- */
- CompileMetadataResolver.prototype.clearCacheFor = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var /** @type {?} */ dirMeta = this._directiveCache.get(type);
- this._directiveCache.delete(type);
- this._nonNormalizedDirectiveCache.delete(type);
- this._summaryCache.delete(type);
- this._pipeCache.delete(type);
- this._ngModuleOfTypes.delete(type);
- // Clear all of the NgModule as they contain transitive information!
- this._ngModuleCache.clear();
- if (dirMeta) {
- this._directiveNormalizer.clearCacheFor(dirMeta);
- }
- };
- /**
- * @return {?}
- */
- CompileMetadataResolver.prototype.clearCache = /**
- * @return {?}
- */
- function () {
- this._directiveCache.clear();
- this._nonNormalizedDirectiveCache.clear();
- this._summaryCache.clear();
- this._pipeCache.clear();
- this._ngModuleCache.clear();
- this._ngModuleOfTypes.clear();
- this._directiveNormalizer.clearCache();
- };
- /**
- * @param {?} baseType
- * @param {?} name
- * @return {?}
- */
- CompileMetadataResolver.prototype._createProxyClass = /**
- * @param {?} baseType
- * @param {?} name
- * @return {?}
- */
- function (baseType, name) {
- var /** @type {?} */ delegate = null;
- var /** @type {?} */ proxyClass = /** @type {?} */ (function () {
- if (!delegate) {
- throw new Error("Illegal state: Class " + name + " for type " + stringify(baseType) + " is not compiled yet!");
- }
- return delegate.apply(this, arguments);
- });
- proxyClass.setDelegate = function (d) {
- delegate = d;
- (/** @type {?} */ (proxyClass)).prototype = d.prototype;
- };
- // Make stringify work correctly
- (/** @type {?} */ (proxyClass)).overriddenName = name;
- return proxyClass;
- };
- /**
- * @param {?} dirType
- * @param {?} name
- * @return {?}
- */
- CompileMetadataResolver.prototype.getGeneratedClass = /**
- * @param {?} dirType
- * @param {?} name
- * @return {?}
- */
- function (dirType, name) {
- if (dirType instanceof StaticSymbol) {
- return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), name);
- }
- else {
- return this._createProxyClass(dirType, name);
- }
- };
- /**
- * @param {?} dirType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getComponentViewClass = /**
- * @param {?} dirType
- * @return {?}
- */
- function (dirType) {
- return this.getGeneratedClass(dirType, viewClassName(dirType, 0));
- };
- /**
- * @param {?} dirType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getHostComponentViewClass = /**
- * @param {?} dirType
- * @return {?}
- */
- function (dirType) {
- return this.getGeneratedClass(dirType, hostViewClassName(dirType));
- };
- /**
- * @param {?} dirType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getHostComponentType = /**
- * @param {?} dirType
- * @return {?}
- */
- function (dirType) {
- var /** @type {?} */ name = identifierName({ reference: dirType }) + "_Host";
- if (dirType instanceof StaticSymbol) {
- return this._staticSymbolCache.get(dirType.filePath, name);
- }
- else {
- var /** @type {?} */ HostClass = /** @type {?} */ (function HostClass() { });
- HostClass.overriddenName = name;
- return HostClass;
- }
- };
- /**
- * @param {?} dirType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getRendererType = /**
- * @param {?} dirType
- * @return {?}
- */
- function (dirType) {
- if (dirType instanceof StaticSymbol) {
- return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), rendererTypeName(dirType));
- }
- else {
- // returning an object as proxy,
- // that we fill later during runtime compilation.
- return /** @type {?} */ ({});
- }
- };
- /**
- * @param {?} selector
- * @param {?} dirType
- * @param {?} inputs
- * @param {?} outputs
- * @return {?}
- */
- CompileMetadataResolver.prototype.getComponentFactory = /**
- * @param {?} selector
- * @param {?} dirType
- * @param {?} inputs
- * @param {?} outputs
- * @return {?}
- */
- function (selector, dirType, inputs, outputs) {
- if (dirType instanceof StaticSymbol) {
- return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), componentFactoryName(dirType));
- }
- else {
- var /** @type {?} */ hostView = this.getHostComponentViewClass(dirType);
- // Note: ngContentSelectors will be filled later once the template is
- // loaded.
- var /** @type {?} */ createComponentFactory = this._reflector.resolveExternalReference(Identifiers.createComponentFactory);
- return createComponentFactory(selector, dirType, /** @type {?} */ (hostView), inputs, outputs, []);
- }
- };
- /**
- * @param {?} factory
- * @param {?} ngContentSelectors
- * @return {?}
- */
- CompileMetadataResolver.prototype.initComponentFactory = /**
- * @param {?} factory
- * @param {?} ngContentSelectors
- * @return {?}
- */
- function (factory, ngContentSelectors) {
- if (!(factory instanceof StaticSymbol)) {
- (_a = (/** @type {?} */ (factory)).ngContentSelectors).push.apply(_a, ngContentSelectors);
- }
- var _a;
- };
- /**
- * @param {?} type
- * @param {?} kind
- * @return {?}
- */
- CompileMetadataResolver.prototype._loadSummary = /**
- * @param {?} type
- * @param {?} kind
- * @return {?}
- */
- function (type, kind) {
- var /** @type {?} */ typeSummary = this._summaryCache.get(type);
- if (!typeSummary) {
- var /** @type {?} */ summary = this._summaryResolver.resolveSummary(type);
- typeSummary = summary ? summary.type : null;
- this._summaryCache.set(type, typeSummary || null);
- }
- return typeSummary && typeSummary.summaryKind === kind ? typeSummary : null;
- };
- /**
- * @param {?} compMeta
- * @param {?=} hostViewType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getHostComponentMetadata = /**
- * @param {?} compMeta
- * @param {?=} hostViewType
- * @return {?}
- */
- function (compMeta, hostViewType) {
- var /** @type {?} */ hostType = this.getHostComponentType(compMeta.type.reference);
- if (!hostViewType) {
- hostViewType = this.getHostComponentViewClass(hostType);
- }
- // Note: ! is ok here as this method should only be called with normalized directive
- // metadata, which always fills in the selector.
- var /** @type {?} */ template = CssSelector.parse(/** @type {?} */ ((compMeta.selector)))[0].getMatchingElementTemplate();
- var /** @type {?} */ templateUrl = '';
- var /** @type {?} */ htmlAst = this._htmlParser.parse(template, templateUrl);
- return CompileDirectiveMetadata.create({
- isHost: true,
- type: { reference: hostType, diDeps: [], lifecycleHooks: [] },
- template: new CompileTemplateMetadata({
- encapsulation: ViewEncapsulation.None,
- template: template,
- templateUrl: templateUrl,
- htmlAst: htmlAst,
- styles: [],
- styleUrls: [],
- ngContentSelectors: [],
- animations: [],
- isInline: true,
- externalStylesheets: [],
- interpolation: null,
- preserveWhitespaces: false,
- }),
- exportAs: null,
- changeDetection: ChangeDetectionStrategy.Default,
- inputs: [],
- outputs: [],
- host: {},
- isComponent: true,
- selector: '*',
- providers: [],
- viewProviders: [],
- queries: [],
- guards: {},
- viewQueries: [],
- componentViewType: hostViewType,
- rendererType: /** @type {?} */ ({ id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {} }),
- entryComponents: [],
- componentFactory: null
- });
- };
- /**
- * @param {?} ngModuleType
- * @param {?} directiveType
- * @param {?} isSync
- * @return {?}
- */
- CompileMetadataResolver.prototype.loadDirectiveMetadata = /**
- * @param {?} ngModuleType
- * @param {?} directiveType
- * @param {?} isSync
- * @return {?}
- */
- function (ngModuleType, directiveType, isSync) {
- var _this = this;
- if (this._directiveCache.has(directiveType)) {
- return null;
- }
- directiveType = resolveForwardRef(directiveType);
- var _a = /** @type {?} */ ((this.getNonNormalizedDirectiveMetadata(directiveType))), annotation = _a.annotation, metadata = _a.metadata;
- var /** @type {?} */ createDirectiveMetadata = function (templateMetadata) {
- var /** @type {?} */ normalizedDirMeta = new CompileDirectiveMetadata({
- isHost: false,
- type: metadata.type,
- isComponent: metadata.isComponent,
- selector: metadata.selector,
- exportAs: metadata.exportAs,
- changeDetection: metadata.changeDetection,
- inputs: metadata.inputs,
- outputs: metadata.outputs,
- hostListeners: metadata.hostListeners,
- hostProperties: metadata.hostProperties,
- hostAttributes: metadata.hostAttributes,
- providers: metadata.providers,
- viewProviders: metadata.viewProviders,
- queries: metadata.queries,
- guards: metadata.guards,
- viewQueries: metadata.viewQueries,
- entryComponents: metadata.entryComponents,
- componentViewType: metadata.componentViewType,
- rendererType: metadata.rendererType,
- componentFactory: metadata.componentFactory,
- template: templateMetadata
- });
- if (templateMetadata) {
- _this.initComponentFactory(/** @type {?} */ ((metadata.componentFactory)), templateMetadata.ngContentSelectors);
- }
- _this._directiveCache.set(directiveType, normalizedDirMeta);
- _this._summaryCache.set(directiveType, normalizedDirMeta.toSummary());
- return null;
- };
- if (metadata.isComponent) {
- var /** @type {?} */ template = /** @type {?} */ ((metadata.template));
- var /** @type {?} */ templateMeta = this._directiveNormalizer.normalizeTemplate({
- ngModuleType: ngModuleType,
- componentType: directiveType,
- moduleUrl: this._reflector.componentModuleUrl(directiveType, annotation),
- encapsulation: template.encapsulation,
- template: template.template,
- templateUrl: template.templateUrl,
- styles: template.styles,
- styleUrls: template.styleUrls,
- animations: template.animations,
- interpolation: template.interpolation,
- preserveWhitespaces: template.preserveWhitespaces
- });
- if (isPromise(templateMeta) && isSync) {
- this._reportError(componentStillLoadingError(directiveType), directiveType);
- return null;
- }
- return SyncAsync.then(templateMeta, createDirectiveMetadata);
- }
- else {
- // directive
- createDirectiveMetadata(null);
- return null;
- }
- };
- /**
- * @param {?} directiveType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getNonNormalizedDirectiveMetadata = /**
- * @param {?} directiveType
- * @return {?}
- */
- function (directiveType) {
- var _this = this;
- directiveType = resolveForwardRef(directiveType);
- if (!directiveType) {
- return null;
- }
- var /** @type {?} */ cacheEntry = this._nonNormalizedDirectiveCache.get(directiveType);
- if (cacheEntry) {
- return cacheEntry;
- }
- var /** @type {?} */ dirMeta = this._directiveResolver.resolve(directiveType, false);
- if (!dirMeta) {
- return null;
- }
- var /** @type {?} */ nonNormalizedTemplateMetadata = /** @type {?} */ ((undefined));
- if (createComponent.isTypeOf(dirMeta)) {
- // component
- var /** @type {?} */ compMeta = /** @type {?} */ (dirMeta);
- assertArrayOfStrings('styles', compMeta.styles);
- assertArrayOfStrings('styleUrls', compMeta.styleUrls);
- assertInterpolationSymbols('interpolation', compMeta.interpolation);
- var /** @type {?} */ animations = compMeta.animations;
- nonNormalizedTemplateMetadata = new CompileTemplateMetadata({
- encapsulation: noUndefined(compMeta.encapsulation),
- template: noUndefined(compMeta.template),
- templateUrl: noUndefined(compMeta.templateUrl),
- htmlAst: null,
- styles: compMeta.styles || [],
- styleUrls: compMeta.styleUrls || [],
- animations: animations || [],
- interpolation: noUndefined(compMeta.interpolation),
- isInline: !!compMeta.template,
- externalStylesheets: [],
- ngContentSelectors: [],
- preserveWhitespaces: noUndefined(dirMeta.preserveWhitespaces),
- });
- }
- var /** @type {?} */ changeDetectionStrategy = /** @type {?} */ ((null));
- var /** @type {?} */ viewProviders = [];
- var /** @type {?} */ entryComponentMetadata = [];
- var /** @type {?} */ selector = dirMeta.selector;
- if (createComponent.isTypeOf(dirMeta)) {
- // Component
- var /** @type {?} */ compMeta = /** @type {?} */ (dirMeta);
- changeDetectionStrategy = /** @type {?} */ ((compMeta.changeDetection));
- if (compMeta.viewProviders) {
- viewProviders = this._getProvidersMetadata(compMeta.viewProviders, entryComponentMetadata, "viewProviders for \"" + stringifyType(directiveType) + "\"", [], directiveType);
- }
- if (compMeta.entryComponents) {
- entryComponentMetadata = flattenAndDedupeArray(compMeta.entryComponents)
- .map(function (type) { return ((_this._getEntryComponentMetadata(type))); })
- .concat(entryComponentMetadata);
- }
- if (!selector) {
- selector = this._schemaRegistry.getDefaultComponentElementName();
- }
- }
- else {
- // Directive
- if (!selector) {
- this._reportError(syntaxError("Directive " + stringifyType(directiveType) + " has no selector, please add it!"), directiveType);
- selector = 'error';
- }
- }
- var /** @type {?} */ providers = [];
- if (dirMeta.providers != null) {
- providers = this._getProvidersMetadata(dirMeta.providers, entryComponentMetadata, "providers for \"" + stringifyType(directiveType) + "\"", [], directiveType);
- }
- var /** @type {?} */ queries = [];
- var /** @type {?} */ viewQueries = [];
- if (dirMeta.queries != null) {
- queries = this._getQueriesMetadata(dirMeta.queries, false, directiveType);
- viewQueries = this._getQueriesMetadata(dirMeta.queries, true, directiveType);
- }
- var /** @type {?} */ metadata = CompileDirectiveMetadata.create({
- isHost: false,
- selector: selector,
- exportAs: noUndefined(dirMeta.exportAs),
- isComponent: !!nonNormalizedTemplateMetadata,
- type: this._getTypeMetadata(directiveType),
- template: nonNormalizedTemplateMetadata,
- changeDetection: changeDetectionStrategy,
- inputs: dirMeta.inputs || [],
- outputs: dirMeta.outputs || [],
- host: dirMeta.host || {},
- providers: providers || [],
- viewProviders: viewProviders || [],
- queries: queries || [],
- guards: dirMeta.guards || {},
- viewQueries: viewQueries || [],
- entryComponents: entryComponentMetadata,
- componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) :
- null,
- rendererType: nonNormalizedTemplateMetadata ? this.getRendererType(directiveType) : null,
- componentFactory: null
- });
- if (nonNormalizedTemplateMetadata) {
- metadata.componentFactory =
- this.getComponentFactory(selector, directiveType, metadata.inputs, metadata.outputs);
- }
- cacheEntry = { metadata: metadata, annotation: dirMeta };
- this._nonNormalizedDirectiveCache.set(directiveType, cacheEntry);
- return cacheEntry;
- };
- /**
- * Gets the metadata for the given directive.
- * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
- */
- /**
- * Gets the metadata for the given directive.
- * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
- * @param {?} directiveType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getDirectiveMetadata = /**
- * Gets the metadata for the given directive.
- * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
- * @param {?} directiveType
- * @return {?}
- */
- function (directiveType) {
- var /** @type {?} */ dirMeta = /** @type {?} */ ((this._directiveCache.get(directiveType)));
- if (!dirMeta) {
- this._reportError(syntaxError("Illegal state: getDirectiveMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Directive " + stringifyType(directiveType) + "."), directiveType);
- }
- return dirMeta;
- };
- /**
- * @param {?} dirType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getDirectiveSummary = /**
- * @param {?} dirType
- * @return {?}
- */
- function (dirType) {
- var /** @type {?} */ dirSummary = /** @type {?} */ (this._loadSummary(dirType, CompileSummaryKind.Directive));
- if (!dirSummary) {
- this._reportError(syntaxError("Illegal state: Could not load the summary for directive " + stringifyType(dirType) + "."), dirType);
- }
- return dirSummary;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- CompileMetadataResolver.prototype.isDirective = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- return !!this._loadSummary(type, CompileSummaryKind.Directive) ||
- this._directiveResolver.isDirective(type);
- };
- /**
- * @param {?} type
- * @return {?}
- */
- CompileMetadataResolver.prototype.isPipe = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- return !!this._loadSummary(type, CompileSummaryKind.Pipe) ||
- this._pipeResolver.isPipe(type);
- };
- /**
- * @param {?} type
- * @return {?}
- */
- CompileMetadataResolver.prototype.isNgModule = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- return !!this._loadSummary(type, CompileSummaryKind.NgModule) ||
- this._ngModuleResolver.isNgModule(type);
- };
- /**
- * @param {?} moduleType
- * @param {?=} alreadyCollecting
- * @return {?}
- */
- CompileMetadataResolver.prototype.getNgModuleSummary = /**
- * @param {?} moduleType
- * @param {?=} alreadyCollecting
- * @return {?}
- */
- function (moduleType, alreadyCollecting) {
- if (alreadyCollecting === void 0) { alreadyCollecting = null; }
- var /** @type {?} */ moduleSummary = /** @type {?} */ (this._loadSummary(moduleType, CompileSummaryKind.NgModule));
- if (!moduleSummary) {
- var /** @type {?} */ moduleMeta = this.getNgModuleMetadata(moduleType, false, alreadyCollecting);
- moduleSummary = moduleMeta ? moduleMeta.toSummary() : null;
- if (moduleSummary) {
- this._summaryCache.set(moduleType, moduleSummary);
- }
- }
- return moduleSummary;
- };
- /**
- * Loads the declared directives and pipes of an NgModule.
- */
- /**
- * Loads the declared directives and pipes of an NgModule.
- * @param {?} moduleType
- * @param {?} isSync
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- CompileMetadataResolver.prototype.loadNgModuleDirectiveAndPipeMetadata = /**
- * Loads the declared directives and pipes of an NgModule.
- * @param {?} moduleType
- * @param {?} isSync
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- function (moduleType, isSync, throwIfNotFound) {
- var _this = this;
- if (throwIfNotFound === void 0) { throwIfNotFound = true; }
- var /** @type {?} */ ngModule = this.getNgModuleMetadata(moduleType, throwIfNotFound);
- var /** @type {?} */ loading = [];
- if (ngModule) {
- ngModule.declaredDirectives.forEach(function (id) {
- var /** @type {?} */ promise = _this.loadDirectiveMetadata(moduleType, id.reference, isSync);
- if (promise) {
- loading.push(promise);
- }
- });
- ngModule.declaredPipes.forEach(function (id) { return _this._loadPipeMetadata(id.reference); });
- }
- return Promise.all(loading);
- };
- /**
- * @param {?} moduleType
- * @param {?=} throwIfNotFound
- * @param {?=} alreadyCollecting
- * @return {?}
- */
- CompileMetadataResolver.prototype.getNgModuleMetadata = /**
- * @param {?} moduleType
- * @param {?=} throwIfNotFound
- * @param {?=} alreadyCollecting
- * @return {?}
- */
- function (moduleType, throwIfNotFound, alreadyCollecting) {
- var _this = this;
- if (throwIfNotFound === void 0) { throwIfNotFound = true; }
- if (alreadyCollecting === void 0) { alreadyCollecting = null; }
- moduleType = resolveForwardRef(moduleType);
- var /** @type {?} */ compileMeta = this._ngModuleCache.get(moduleType);
- if (compileMeta) {
- return compileMeta;
- }
- var /** @type {?} */ meta = this._ngModuleResolver.resolve(moduleType, throwIfNotFound);
- if (!meta) {
- return null;
- }
- var /** @type {?} */ declaredDirectives = [];
- var /** @type {?} */ exportedNonModuleIdentifiers = [];
- var /** @type {?} */ declaredPipes = [];
- var /** @type {?} */ importedModules = [];
- var /** @type {?} */ exportedModules = [];
- var /** @type {?} */ providers = [];
- var /** @type {?} */ entryComponents = [];
- var /** @type {?} */ bootstrapComponents = [];
- var /** @type {?} */ schemas = [];
- if (meta.imports) {
- flattenAndDedupeArray(meta.imports).forEach(function (importedType) {
- var /** @type {?} */ importedModuleType = /** @type {?} */ ((undefined));
- if (isValidType(importedType)) {
- importedModuleType = importedType;
- }
- else if (importedType && importedType.ngModule) {
- var /** @type {?} */ moduleWithProviders = importedType;
- importedModuleType = moduleWithProviders.ngModule;
- if (moduleWithProviders.providers) {
- providers.push.apply(providers, _this._getProvidersMetadata(moduleWithProviders.providers, entryComponents, "provider for the NgModule '" + stringifyType(importedModuleType) + "'", [], importedType));
- }
- }
- if (importedModuleType) {
- if (_this._checkSelfImport(moduleType, importedModuleType))
- return;
- if (!alreadyCollecting)
- alreadyCollecting = new Set();
- if (alreadyCollecting.has(importedModuleType)) {
- _this._reportError(syntaxError(_this._getTypeDescriptor(importedModuleType) + " '" + stringifyType(importedType) + "' is imported recursively by the module '" + stringifyType(moduleType) + "'."), moduleType);
- return;
- }
- alreadyCollecting.add(importedModuleType);
- var /** @type {?} */ importedModuleSummary = _this.getNgModuleSummary(importedModuleType, alreadyCollecting);
- alreadyCollecting.delete(importedModuleType);
- if (!importedModuleSummary) {
- _this._reportError(syntaxError("Unexpected " + _this._getTypeDescriptor(importedType) + " '" + stringifyType(importedType) + "' imported by the module '" + stringifyType(moduleType) + "'. Please add a @NgModule annotation."), moduleType);
- return;
- }
- importedModules.push(importedModuleSummary);
- }
- else {
- _this._reportError(syntaxError("Unexpected value '" + stringifyType(importedType) + "' imported by the module '" + stringifyType(moduleType) + "'"), moduleType);
- return;
- }
- });
- }
- if (meta.exports) {
- flattenAndDedupeArray(meta.exports).forEach(function (exportedType) {
- if (!isValidType(exportedType)) {
- _this._reportError(syntaxError("Unexpected value '" + stringifyType(exportedType) + "' exported by the module '" + stringifyType(moduleType) + "'"), moduleType);
- return;
- }
- if (!alreadyCollecting)
- alreadyCollecting = new Set();
- if (alreadyCollecting.has(exportedType)) {
- _this._reportError(syntaxError(_this._getTypeDescriptor(exportedType) + " '" + stringify(exportedType) + "' is exported recursively by the module '" + stringifyType(moduleType) + "'"), moduleType);
- return;
- }
- alreadyCollecting.add(exportedType);
- var /** @type {?} */ exportedModuleSummary = _this.getNgModuleSummary(exportedType, alreadyCollecting);
- alreadyCollecting.delete(exportedType);
- if (exportedModuleSummary) {
- exportedModules.push(exportedModuleSummary);
- }
- else {
- exportedNonModuleIdentifiers.push(_this._getIdentifierMetadata(exportedType));
- }
- });
- }
- // Note: This will be modified later, so we rely on
- // getting a new instance every time!
- var /** @type {?} */ transitiveModule = this._getTransitiveNgModuleMetadata(importedModules, exportedModules);
- if (meta.declarations) {
- flattenAndDedupeArray(meta.declarations).forEach(function (declaredType) {
- if (!isValidType(declaredType)) {
- _this._reportError(syntaxError("Unexpected value '" + stringifyType(declaredType) + "' declared by the module '" + stringifyType(moduleType) + "'"), moduleType);
- return;
- }
- var /** @type {?} */ declaredIdentifier = _this._getIdentifierMetadata(declaredType);
- if (_this.isDirective(declaredType)) {
- transitiveModule.addDirective(declaredIdentifier);
- declaredDirectives.push(declaredIdentifier);
- _this._addTypeToModule(declaredType, moduleType);
- }
- else if (_this.isPipe(declaredType)) {
- transitiveModule.addPipe(declaredIdentifier);
- transitiveModule.pipes.push(declaredIdentifier);
- declaredPipes.push(declaredIdentifier);
- _this._addTypeToModule(declaredType, moduleType);
- }
- else {
- _this._reportError(syntaxError("Unexpected " + _this._getTypeDescriptor(declaredType) + " '" + stringifyType(declaredType) + "' declared by the module '" + stringifyType(moduleType) + "'. Please add a @Pipe/@Directive/@Component annotation."), moduleType);
- return;
- }
- });
- }
- var /** @type {?} */ exportedDirectives = [];
- var /** @type {?} */ exportedPipes = [];
- exportedNonModuleIdentifiers.forEach(function (exportedId) {
- if (transitiveModule.directivesSet.has(exportedId.reference)) {
- exportedDirectives.push(exportedId);
- transitiveModule.addExportedDirective(exportedId);
- }
- else if (transitiveModule.pipesSet.has(exportedId.reference)) {
- exportedPipes.push(exportedId);
- transitiveModule.addExportedPipe(exportedId);
- }
- else {
- _this._reportError(syntaxError("Can't export " + _this._getTypeDescriptor(exportedId.reference) + " " + stringifyType(exportedId.reference) + " from " + stringifyType(moduleType) + " as it was neither declared nor imported!"), moduleType);
- return;
- }
- });
- // The providers of the module have to go last
- // so that they overwrite any other provider we already added.
- if (meta.providers) {
- providers.push.apply(providers, this._getProvidersMetadata(meta.providers, entryComponents, "provider for the NgModule '" + stringifyType(moduleType) + "'", [], moduleType));
- }
- if (meta.entryComponents) {
- entryComponents.push.apply(entryComponents, flattenAndDedupeArray(meta.entryComponents)
- .map(function (type) { return ((_this._getEntryComponentMetadata(type))); }));
- }
- if (meta.bootstrap) {
- flattenAndDedupeArray(meta.bootstrap).forEach(function (type) {
- if (!isValidType(type)) {
- _this._reportError(syntaxError("Unexpected value '" + stringifyType(type) + "' used in the bootstrap property of module '" + stringifyType(moduleType) + "'"), moduleType);
- return;
- }
- bootstrapComponents.push(_this._getIdentifierMetadata(type));
- });
- }
- entryComponents.push.apply(entryComponents, bootstrapComponents.map(function (type) { return ((_this._getEntryComponentMetadata(type.reference))); }));
- if (meta.schemas) {
- schemas.push.apply(schemas, flattenAndDedupeArray(meta.schemas));
- }
- compileMeta = new CompileNgModuleMetadata({
- type: this._getTypeMetadata(moduleType),
- providers: providers,
- entryComponents: entryComponents,
- bootstrapComponents: bootstrapComponents,
- schemas: schemas,
- declaredDirectives: declaredDirectives,
- exportedDirectives: exportedDirectives,
- declaredPipes: declaredPipes,
- exportedPipes: exportedPipes,
- importedModules: importedModules,
- exportedModules: exportedModules,
- transitiveModule: transitiveModule,
- id: meta.id || null,
- });
- entryComponents.forEach(function (id) { return transitiveModule.addEntryComponent(id); });
- providers.forEach(function (provider) { return transitiveModule.addProvider(provider, /** @type {?} */ ((compileMeta)).type); });
- transitiveModule.addModule(compileMeta.type);
- this._ngModuleCache.set(moduleType, compileMeta);
- return compileMeta;
- };
- /**
- * @param {?} moduleType
- * @param {?} importedModuleType
- * @return {?}
- */
- CompileMetadataResolver.prototype._checkSelfImport = /**
- * @param {?} moduleType
- * @param {?} importedModuleType
- * @return {?}
- */
- function (moduleType, importedModuleType) {
- if (moduleType === importedModuleType) {
- this._reportError(syntaxError("'" + stringifyType(moduleType) + "' module can't import itself"), moduleType);
- return true;
- }
- return false;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- CompileMetadataResolver.prototype._getTypeDescriptor = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- if (isValidType(type)) {
- if (this.isDirective(type)) {
- return 'directive';
- }
- if (this.isPipe(type)) {
- return 'pipe';
- }
- if (this.isNgModule(type)) {
- return 'module';
- }
- }
- if ((/** @type {?} */ (type)).provide) {
- return 'provider';
- }
- return 'value';
- };
- /**
- * @param {?} type
- * @param {?} moduleType
- * @return {?}
- */
- CompileMetadataResolver.prototype._addTypeToModule = /**
- * @param {?} type
- * @param {?} moduleType
- * @return {?}
- */
- function (type, moduleType) {
- var /** @type {?} */ oldModule = this._ngModuleOfTypes.get(type);
- if (oldModule && oldModule !== moduleType) {
- this._reportError(syntaxError("Type " + stringifyType(type) + " is part of the declarations of 2 modules: " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + "! " +
- ("Please consider moving " + stringifyType(type) + " to a higher module that imports " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + ". ") +
- ("You can also create a new NgModule that exports and includes " + stringifyType(type) + " then import that NgModule in " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + ".")), moduleType);
- return;
- }
- this._ngModuleOfTypes.set(type, moduleType);
- };
- /**
- * @param {?} importedModules
- * @param {?} exportedModules
- * @return {?}
- */
- CompileMetadataResolver.prototype._getTransitiveNgModuleMetadata = /**
- * @param {?} importedModules
- * @param {?} exportedModules
- * @return {?}
- */
- function (importedModules, exportedModules) {
- // collect `providers` / `entryComponents` from all imported and all exported modules
- var /** @type {?} */ result = new TransitiveCompileNgModuleMetadata();
- var /** @type {?} */ modulesByToken = new Map();
- importedModules.concat(exportedModules).forEach(function (modSummary) {
- modSummary.modules.forEach(function (mod) { return result.addModule(mod); });
- modSummary.entryComponents.forEach(function (comp) { return result.addEntryComponent(comp); });
- var /** @type {?} */ addedTokens = new Set();
- modSummary.providers.forEach(function (entry) {
- var /** @type {?} */ tokenRef = tokenReference(entry.provider.token);
- var /** @type {?} */ prevModules = modulesByToken.get(tokenRef);
- if (!prevModules) {
- prevModules = new Set();
- modulesByToken.set(tokenRef, prevModules);
- }
- var /** @type {?} */ moduleRef = entry.module.reference;
- // Note: the providers of one module may still contain multiple providers
- // per token (e.g. for multi providers), and we need to preserve these.
- if (addedTokens.has(tokenRef) || !prevModules.has(moduleRef)) {
- prevModules.add(moduleRef);
- addedTokens.add(tokenRef);
- result.addProvider(entry.provider, entry.module);
- }
- });
- });
- exportedModules.forEach(function (modSummary) {
- modSummary.exportedDirectives.forEach(function (id) { return result.addExportedDirective(id); });
- modSummary.exportedPipes.forEach(function (id) { return result.addExportedPipe(id); });
- });
- importedModules.forEach(function (modSummary) {
- modSummary.exportedDirectives.forEach(function (id) { return result.addDirective(id); });
- modSummary.exportedPipes.forEach(function (id) { return result.addPipe(id); });
- });
- return result;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- CompileMetadataResolver.prototype._getIdentifierMetadata = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- type = resolveForwardRef(type);
- return { reference: type };
- };
- /**
- * @param {?} type
- * @return {?}
- */
- CompileMetadataResolver.prototype.isInjectable = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var /** @type {?} */ annotations = this._reflector.annotations(type);
- return annotations.some(function (ann) { return createInjectable.isTypeOf(ann); });
- };
- /**
- * @param {?} type
- * @return {?}
- */
- CompileMetadataResolver.prototype.getInjectableSummary = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- return {
- summaryKind: CompileSummaryKind.Injectable,
- type: this._getTypeMetadata(type, null, false)
- };
- };
- /**
- * @param {?} type
- * @param {?=} dependencies
- * @return {?}
- */
- CompileMetadataResolver.prototype._getInjectableMetadata = /**
- * @param {?} type
- * @param {?=} dependencies
- * @return {?}
- */
- function (type, dependencies) {
- if (dependencies === void 0) { dependencies = null; }
- var /** @type {?} */ typeSummary = this._loadSummary(type, CompileSummaryKind.Injectable);
- if (typeSummary) {
- return typeSummary.type;
- }
- return this._getTypeMetadata(type, dependencies);
- };
- /**
- * @param {?} type
- * @param {?=} dependencies
- * @param {?=} throwOnUnknownDeps
- * @return {?}
- */
- CompileMetadataResolver.prototype._getTypeMetadata = /**
- * @param {?} type
- * @param {?=} dependencies
- * @param {?=} throwOnUnknownDeps
- * @return {?}
- */
- function (type, dependencies, throwOnUnknownDeps) {
- if (dependencies === void 0) { dependencies = null; }
- if (throwOnUnknownDeps === void 0) { throwOnUnknownDeps = true; }
- var /** @type {?} */ identifier = this._getIdentifierMetadata(type);
- return {
- reference: identifier.reference,
- diDeps: this._getDependenciesMetadata(identifier.reference, dependencies, throwOnUnknownDeps),
- lifecycleHooks: getAllLifecycleHooks(this._reflector, identifier.reference),
- };
- };
- /**
- * @param {?} factory
- * @param {?=} dependencies
- * @return {?}
- */
- CompileMetadataResolver.prototype._getFactoryMetadata = /**
- * @param {?} factory
- * @param {?=} dependencies
- * @return {?}
- */
- function (factory, dependencies) {
- if (dependencies === void 0) { dependencies = null; }
- factory = resolveForwardRef(factory);
- return { reference: factory, diDeps: this._getDependenciesMetadata(factory, dependencies) };
- };
- /**
- * Gets the metadata for the given pipe.
- * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
- */
- /**
- * Gets the metadata for the given pipe.
- * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
- * @param {?} pipeType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getPipeMetadata = /**
- * Gets the metadata for the given pipe.
- * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
- * @param {?} pipeType
- * @return {?}
- */
- function (pipeType) {
- var /** @type {?} */ pipeMeta = this._pipeCache.get(pipeType);
- if (!pipeMeta) {
- this._reportError(syntaxError("Illegal state: getPipeMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Pipe " + stringifyType(pipeType) + "."), pipeType);
- }
- return pipeMeta || null;
- };
- /**
- * @param {?} pipeType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getPipeSummary = /**
- * @param {?} pipeType
- * @return {?}
- */
- function (pipeType) {
- var /** @type {?} */ pipeSummary = /** @type {?} */ (this._loadSummary(pipeType, CompileSummaryKind.Pipe));
- if (!pipeSummary) {
- this._reportError(syntaxError("Illegal state: Could not load the summary for pipe " + stringifyType(pipeType) + "."), pipeType);
- }
- return pipeSummary;
- };
- /**
- * @param {?} pipeType
- * @return {?}
- */
- CompileMetadataResolver.prototype.getOrLoadPipeMetadata = /**
- * @param {?} pipeType
- * @return {?}
- */
- function (pipeType) {
- var /** @type {?} */ pipeMeta = this._pipeCache.get(pipeType);
- if (!pipeMeta) {
- pipeMeta = this._loadPipeMetadata(pipeType);
- }
- return pipeMeta;
- };
- /**
- * @param {?} pipeType
- * @return {?}
- */
- CompileMetadataResolver.prototype._loadPipeMetadata = /**
- * @param {?} pipeType
- * @return {?}
- */
- function (pipeType) {
- pipeType = resolveForwardRef(pipeType);
- var /** @type {?} */ pipeAnnotation = /** @type {?} */ ((this._pipeResolver.resolve(pipeType)));
- var /** @type {?} */ pipeMeta = new CompilePipeMetadata({
- type: this._getTypeMetadata(pipeType),
- name: pipeAnnotation.name,
- pure: !!pipeAnnotation.pure
- });
- this._pipeCache.set(pipeType, pipeMeta);
- this._summaryCache.set(pipeType, pipeMeta.toSummary());
- return pipeMeta;
- };
- /**
- * @param {?} typeOrFunc
- * @param {?} dependencies
- * @param {?=} throwOnUnknownDeps
- * @return {?}
- */
- CompileMetadataResolver.prototype._getDependenciesMetadata = /**
- * @param {?} typeOrFunc
- * @param {?} dependencies
- * @param {?=} throwOnUnknownDeps
- * @return {?}
- */
- function (typeOrFunc, dependencies, throwOnUnknownDeps) {
- var _this = this;
- if (throwOnUnknownDeps === void 0) { throwOnUnknownDeps = true; }
- var /** @type {?} */ hasUnknownDeps = false;
- var /** @type {?} */ params = dependencies || this._reflector.parameters(typeOrFunc) || [];
- var /** @type {?} */ dependenciesMetadata = params.map(function (param) {
- var /** @type {?} */ isAttribute = false;
- var /** @type {?} */ isHost = false;
- var /** @type {?} */ isSelf = false;
- var /** @type {?} */ isSkipSelf = false;
- var /** @type {?} */ isOptional = false;
- var /** @type {?} */ token = null;
- if (Array.isArray(param)) {
- param.forEach(function (paramEntry) {
- if (createHost.isTypeOf(paramEntry)) {
- isHost = true;
- }
- else if (createSelf.isTypeOf(paramEntry)) {
- isSelf = true;
- }
- else if (createSkipSelf.isTypeOf(paramEntry)) {
- isSkipSelf = true;
- }
- else if (createOptional.isTypeOf(paramEntry)) {
- isOptional = true;
- }
- else if (createAttribute.isTypeOf(paramEntry)) {
- isAttribute = true;
- token = paramEntry.attributeName;
- }
- else if (createInject.isTypeOf(paramEntry)) {
- token = paramEntry.token;
- }
- else if (createInjectionToken.isTypeOf(paramEntry) || paramEntry instanceof StaticSymbol) {
- token = paramEntry;
- }
- else if (isValidType(paramEntry) && token == null) {
- token = paramEntry;
- }
- });
- }
- else {
- token = param;
- }
- if (token == null) {
- hasUnknownDeps = true;
- return /** @type {?} */ ((null));
- }
- return {
- isAttribute: isAttribute,
- isHost: isHost,
- isSelf: isSelf,
- isSkipSelf: isSkipSelf,
- isOptional: isOptional,
- token: _this._getTokenMetadata(token)
- };
- });
- if (hasUnknownDeps) {
- var /** @type {?} */ depsTokens = dependenciesMetadata.map(function (dep) { return dep ? stringifyType(dep.token) : '?'; }).join(', ');
- var /** @type {?} */ message = "Can't resolve all parameters for " + stringifyType(typeOrFunc) + ": (" + depsTokens + ").";
- if (throwOnUnknownDeps || this._config.strictInjectionParameters) {
- this._reportError(syntaxError(message), typeOrFunc);
- }
- else {
- this._console.warn("Warning: " + message + " This will become an error in Angular v6.x");
- }
- }
- return dependenciesMetadata;
- };
- /**
- * @param {?} token
- * @return {?}
- */
- CompileMetadataResolver.prototype._getTokenMetadata = /**
- * @param {?} token
- * @return {?}
- */
- function (token) {
- token = resolveForwardRef(token);
- var /** @type {?} */ compileToken;
- if (typeof token === 'string') {
- compileToken = { value: token };
- }
- else {
- compileToken = { identifier: { reference: token } };
- }
- return compileToken;
- };
- /**
- * @param {?} providers
- * @param {?} targetEntryComponents
- * @param {?=} debugInfo
- * @param {?=} compileProviders
- * @param {?=} type
- * @return {?}
- */
- CompileMetadataResolver.prototype._getProvidersMetadata = /**
- * @param {?} providers
- * @param {?} targetEntryComponents
- * @param {?=} debugInfo
- * @param {?=} compileProviders
- * @param {?=} type
- * @return {?}
- */
- function (providers, targetEntryComponents, debugInfo, compileProviders, type) {
- var _this = this;
- if (compileProviders === void 0) { compileProviders = []; }
- providers.forEach(function (provider, providerIdx) {
- if (Array.isArray(provider)) {
- _this._getProvidersMetadata(provider, targetEntryComponents, debugInfo, compileProviders);
- }
- else {
- provider = resolveForwardRef(provider);
- var /** @type {?} */ providerMeta = /** @type {?} */ ((undefined));
- if (provider && typeof provider === 'object' && provider.hasOwnProperty('provide')) {
- _this._validateProvider(provider);
- providerMeta = new ProviderMeta(provider.provide, provider);
- }
- else if (isValidType(provider)) {
- providerMeta = new ProviderMeta(provider, { useClass: provider });
- }
- else if (provider === void 0) {
- _this._reportError(syntaxError("Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files."));
- return;
- }
- else {
- var /** @type {?} */ providersInfo = (/** @type {?} */ (providers.reduce(function (soFar, seenProvider, seenProviderIdx) {
- if (seenProviderIdx < providerIdx) {
- soFar.push("" + stringifyType(seenProvider));
- }
- else if (seenProviderIdx == providerIdx) {
- soFar.push("?" + stringifyType(seenProvider) + "?");
- }
- else if (seenProviderIdx == providerIdx + 1) {
- soFar.push('...');
- }
- return soFar;
- }, [])))
- .join(', ');
- _this._reportError(syntaxError("Invalid " + (debugInfo ? debugInfo : 'provider') + " - only instances of Provider and Type are allowed, got: [" + providersInfo + "]"), type);
- return;
- }
- if (providerMeta.token ===
- _this._reflector.resolveExternalReference(Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS)) {
- targetEntryComponents.push.apply(targetEntryComponents, _this._getEntryComponentsFromProvider(providerMeta, type));
- }
- else {
- compileProviders.push(_this.getProviderMetadata(providerMeta));
- }
- }
- });
- return compileProviders;
- };
- /**
- * @param {?} provider
- * @return {?}
- */
- CompileMetadataResolver.prototype._validateProvider = /**
- * @param {?} provider
- * @return {?}
- */
- function (provider) {
- if (provider.hasOwnProperty('useClass') && provider.useClass == null) {
- 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."));
- }
- };
- /**
- * @param {?} provider
- * @param {?=} type
- * @return {?}
- */
- CompileMetadataResolver.prototype._getEntryComponentsFromProvider = /**
- * @param {?} provider
- * @param {?=} type
- * @return {?}
- */
- function (provider, type) {
- var _this = this;
- var /** @type {?} */ components = [];
- var /** @type {?} */ collectedIdentifiers = [];
- if (provider.useFactory || provider.useExisting || provider.useClass) {
- this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports useValue!"), type);
- return [];
- }
- if (!provider.multi) {
- this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports 'multi = true'!"), type);
- return [];
- }
- extractIdentifiers(provider.useValue, collectedIdentifiers);
- collectedIdentifiers.forEach(function (identifier) {
- var /** @type {?} */ entry = _this._getEntryComponentMetadata(identifier.reference, false);
- if (entry) {
- components.push(entry);
- }
- });
- return components;
- };
- /**
- * @param {?} dirType
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- CompileMetadataResolver.prototype._getEntryComponentMetadata = /**
- * @param {?} dirType
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- function (dirType, throwIfNotFound) {
- if (throwIfNotFound === void 0) { throwIfNotFound = true; }
- var /** @type {?} */ dirMeta = this.getNonNormalizedDirectiveMetadata(dirType);
- if (dirMeta && dirMeta.metadata.isComponent) {
- return { componentType: dirType, componentFactory: /** @type {?} */ ((dirMeta.metadata.componentFactory)) };
- }
- var /** @type {?} */ dirSummary = /** @type {?} */ (this._loadSummary(dirType, CompileSummaryKind.Directive));
- if (dirSummary && dirSummary.isComponent) {
- return { componentType: dirType, componentFactory: /** @type {?} */ ((dirSummary.componentFactory)) };
- }
- if (throwIfNotFound) {
- throw syntaxError(dirType.name + " cannot be used as an entry component.");
- }
- return null;
- };
- /**
- * @param {?} provider
- * @return {?}
- */
- CompileMetadataResolver.prototype.getProviderMetadata = /**
- * @param {?} provider
- * @return {?}
- */
- function (provider) {
- var /** @type {?} */ compileDeps = /** @type {?} */ ((undefined));
- var /** @type {?} */ compileTypeMetadata = /** @type {?} */ ((null));
- var /** @type {?} */ compileFactoryMetadata = /** @type {?} */ ((null));
- var /** @type {?} */ token = this._getTokenMetadata(provider.token);
- if (provider.useClass) {
- compileTypeMetadata = this._getInjectableMetadata(provider.useClass, provider.dependencies);
- compileDeps = compileTypeMetadata.diDeps;
- if (provider.token === provider.useClass) {
- // use the compileTypeMetadata as it contains information about lifecycleHooks...
- token = { identifier: compileTypeMetadata };
- }
- }
- else if (provider.useFactory) {
- compileFactoryMetadata = this._getFactoryMetadata(provider.useFactory, provider.dependencies);
- compileDeps = compileFactoryMetadata.diDeps;
- }
- return {
- token: token,
- useClass: compileTypeMetadata,
- useValue: provider.useValue,
- useFactory: compileFactoryMetadata,
- useExisting: provider.useExisting ? this._getTokenMetadata(provider.useExisting) : undefined,
- deps: compileDeps,
- multi: provider.multi
- };
- };
- /**
- * @param {?} queries
- * @param {?} isViewQuery
- * @param {?} directiveType
- * @return {?}
- */
- CompileMetadataResolver.prototype._getQueriesMetadata = /**
- * @param {?} queries
- * @param {?} isViewQuery
- * @param {?} directiveType
- * @return {?}
- */
- function (queries, isViewQuery, directiveType) {
- var _this = this;
- var /** @type {?} */ res = [];
- Object.keys(queries).forEach(function (propertyName) {
- var /** @type {?} */ query = queries[propertyName];
- if (query.isViewQuery === isViewQuery) {
- res.push(_this._getQueryMetadata(query, propertyName, directiveType));
- }
- });
- return res;
- };
- /**
- * @param {?} selector
- * @return {?}
- */
- CompileMetadataResolver.prototype._queryVarBindings = /**
- * @param {?} selector
- * @return {?}
- */
- function (selector) { return selector.split(/\s*,\s*/); };
- /**
- * @param {?} q
- * @param {?} propertyName
- * @param {?} typeOrFunc
- * @return {?}
- */
- CompileMetadataResolver.prototype._getQueryMetadata = /**
- * @param {?} q
- * @param {?} propertyName
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (q, propertyName, typeOrFunc) {
- var _this = this;
- var /** @type {?} */ selectors;
- if (typeof q.selector === 'string') {
- selectors =
- this._queryVarBindings(q.selector).map(function (varName) { return _this._getTokenMetadata(varName); });
- }
- else {
- if (!q.selector) {
- this._reportError(syntaxError("Can't construct a query for the property \"" + propertyName + "\" of \"" + stringifyType(typeOrFunc) + "\" since the query selector wasn't defined."), typeOrFunc);
- selectors = [];
- }
- else {
- selectors = [this._getTokenMetadata(q.selector)];
- }
- }
- return {
- selectors: selectors,
- first: q.first,
- descendants: q.descendants, propertyName: propertyName,
- read: q.read ? this._getTokenMetadata(q.read) : /** @type {?} */ ((null))
- };
- };
- /**
- * @param {?} error
- * @param {?=} type
- * @param {?=} otherType
- * @return {?}
- */
- CompileMetadataResolver.prototype._reportError = /**
- * @param {?} error
- * @param {?=} type
- * @param {?=} otherType
- * @return {?}
- */
- function (error, type, otherType) {
- if (this._errorCollector) {
- this._errorCollector(error, type);
- if (otherType) {
- this._errorCollector(error, otherType);
- }
- }
- else {
- throw error;
- }
- };
- return CompileMetadataResolver;
- }());
- /**
- * @param {?} tree
- * @param {?=} out
- * @return {?}
- */
- function flattenArray(tree, out) {
- if (out === void 0) { out = []; }
- if (tree) {
- for (var /** @type {?} */ i = 0; i < tree.length; i++) {
- var /** @type {?} */ item = resolveForwardRef(tree[i]);
- if (Array.isArray(item)) {
- flattenArray(item, out);
- }
- else {
- out.push(item);
- }
- }
- }
- return out;
- }
- /**
- * @param {?} array
- * @return {?}
- */
- function dedupeArray(array) {
- if (array) {
- return Array.from(new Set(array));
- }
- return [];
- }
- /**
- * @param {?} tree
- * @return {?}
- */
- function flattenAndDedupeArray(tree) {
- return dedupeArray(flattenArray(tree));
- }
- /**
- * @param {?} value
- * @return {?}
- */
- function isValidType(value) {
- return (value instanceof StaticSymbol) || (value instanceof Type);
- }
- /**
- * @param {?} value
- * @param {?} targetIdentifiers
- * @return {?}
- */
- function extractIdentifiers(value, targetIdentifiers) {
- visitValue(value, new _CompileValueConverter(), targetIdentifiers);
- }
- var _CompileValueConverter = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_CompileValueConverter, _super);
- function _CompileValueConverter() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} value
- * @param {?} targetIdentifiers
- * @return {?}
- */
- _CompileValueConverter.prototype.visitOther = /**
- * @param {?} value
- * @param {?} targetIdentifiers
- * @return {?}
- */
- function (value, targetIdentifiers) {
- targetIdentifiers.push({ reference: value });
- };
- return _CompileValueConverter;
- }(ValueTransformer));
- /**
- * @param {?} type
- * @return {?}
- */
- function stringifyType(type) {
- if (type instanceof StaticSymbol) {
- return type.name + " in " + type.filePath;
- }
- else {
- return stringify(type);
- }
- }
- /**
- * Indicates that a component is still being loaded in a synchronous compile.
- * @param {?} compType
- * @return {?}
- */
- function componentStillLoadingError(compType) {
- var /** @type {?} */ error = Error("Can't compile synchronously as " + stringify(compType) + " is still being loaded!");
- (/** @type {?} */ (error))[ERROR_COMPONENT_TYPE] = compType;
- return error;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var TypeModifier = {
- Const: 0,
- };
- TypeModifier[TypeModifier.Const] = "Const";
- /**
- * @abstract
- */
- var Type$1 = /** @class */ (function () {
- function Type(modifiers) {
- if (modifiers === void 0) { modifiers = null; }
- this.modifiers = modifiers;
- if (!modifiers) {
- this.modifiers = [];
- }
- }
- /**
- * @param {?} modifier
- * @return {?}
- */
- Type.prototype.hasModifier = /**
- * @param {?} modifier
- * @return {?}
- */
- function (modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; };
- return Type;
- }());
- /** @enum {number} */
- var BuiltinTypeName = {
- Dynamic: 0,
- Bool: 1,
- String: 2,
- Int: 3,
- Number: 4,
- Function: 5,
- Inferred: 6,
- };
- BuiltinTypeName[BuiltinTypeName.Dynamic] = "Dynamic";
- BuiltinTypeName[BuiltinTypeName.Bool] = "Bool";
- BuiltinTypeName[BuiltinTypeName.String] = "String";
- BuiltinTypeName[BuiltinTypeName.Int] = "Int";
- BuiltinTypeName[BuiltinTypeName.Number] = "Number";
- BuiltinTypeName[BuiltinTypeName.Function] = "Function";
- BuiltinTypeName[BuiltinTypeName.Inferred] = "Inferred";
- var BuiltinType = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BuiltinType, _super);
- function BuiltinType(name, modifiers) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, modifiers) || this;
- _this.name = name;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- BuiltinType.prototype.visitType = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitBuiltintType(this, context);
- };
- return BuiltinType;
- }(Type$1));
- var ExpressionType = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExpressionType, _super);
- function ExpressionType(value, modifiers) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, modifiers) || this;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ExpressionType.prototype.visitType = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitExpressionType(this, context);
- };
- return ExpressionType;
- }(Type$1));
- var ArrayType = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ArrayType, _super);
- function ArrayType(of, modifiers) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, modifiers) || this;
- _this.of = of;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ArrayType.prototype.visitType = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitArrayType(this, context);
- };
- return ArrayType;
- }(Type$1));
- var MapType = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(MapType, _super);
- function MapType(valueType, modifiers) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, modifiers) || this;
- _this.valueType = valueType || null;
- return _this;
- }
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- MapType.prototype.visitType = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) { return visitor.visitMapType(this, context); };
- return MapType;
- }(Type$1));
- var DYNAMIC_TYPE = new BuiltinType(BuiltinTypeName.Dynamic);
- var INFERRED_TYPE = new BuiltinType(BuiltinTypeName.Inferred);
- var BOOL_TYPE = new BuiltinType(BuiltinTypeName.Bool);
- var INT_TYPE = new BuiltinType(BuiltinTypeName.Int);
- var NUMBER_TYPE = new BuiltinType(BuiltinTypeName.Number);
- var STRING_TYPE = new BuiltinType(BuiltinTypeName.String);
- var FUNCTION_TYPE = new BuiltinType(BuiltinTypeName.Function);
- /**
- * @record
- */
- /** @enum {number} */
- var BinaryOperator = {
- Equals: 0,
- NotEquals: 1,
- Identical: 2,
- NotIdentical: 3,
- Minus: 4,
- Plus: 5,
- Divide: 6,
- Multiply: 7,
- Modulo: 8,
- And: 9,
- Or: 10,
- Lower: 11,
- LowerEquals: 12,
- Bigger: 13,
- BiggerEquals: 14,
- };
- BinaryOperator[BinaryOperator.Equals] = "Equals";
- BinaryOperator[BinaryOperator.NotEquals] = "NotEquals";
- BinaryOperator[BinaryOperator.Identical] = "Identical";
- BinaryOperator[BinaryOperator.NotIdentical] = "NotIdentical";
- BinaryOperator[BinaryOperator.Minus] = "Minus";
- BinaryOperator[BinaryOperator.Plus] = "Plus";
- BinaryOperator[BinaryOperator.Divide] = "Divide";
- BinaryOperator[BinaryOperator.Multiply] = "Multiply";
- BinaryOperator[BinaryOperator.Modulo] = "Modulo";
- BinaryOperator[BinaryOperator.And] = "And";
- BinaryOperator[BinaryOperator.Or] = "Or";
- BinaryOperator[BinaryOperator.Lower] = "Lower";
- BinaryOperator[BinaryOperator.LowerEquals] = "LowerEquals";
- BinaryOperator[BinaryOperator.Bigger] = "Bigger";
- BinaryOperator[BinaryOperator.BiggerEquals] = "BiggerEquals";
- /**
- * @template T
- * @param {?} base
- * @param {?} other
- * @return {?}
- */
- function nullSafeIsEquivalent(base, other) {
- if (base == null || other == null) {
- return base == other;
- }
- return base.isEquivalent(other);
- }
- /**
- * @template T
- * @param {?} base
- * @param {?} other
- * @return {?}
- */
- function areAllEquivalent(base, other) {
- var /** @type {?} */ len = base.length;
- if (len !== other.length) {
- return false;
- }
- for (var /** @type {?} */ i = 0; i < len; i++) {
- if (!base[i].isEquivalent(other[i])) {
- return false;
- }
- }
- return true;
- }
- /**
- * @abstract
- */
- var Expression = /** @class */ (function () {
- function Expression(type, sourceSpan) {
- this.type = type || null;
- this.sourceSpan = sourceSpan || null;
- }
- /**
- * @param {?} name
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.prop = /**
- * @param {?} name
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (name, sourceSpan) {
- return new ReadPropExpr(this, name, null, sourceSpan);
- };
- /**
- * @param {?} index
- * @param {?=} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.key = /**
- * @param {?} index
- * @param {?=} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (index, type, sourceSpan) {
- return new ReadKeyExpr(this, index, type, sourceSpan);
- };
- /**
- * @param {?} name
- * @param {?} params
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.callMethod = /**
- * @param {?} name
- * @param {?} params
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (name, params, sourceSpan) {
- return new InvokeMethodExpr(this, name, params, null, sourceSpan);
- };
- /**
- * @param {?} params
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.callFn = /**
- * @param {?} params
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (params, sourceSpan) {
- return new InvokeFunctionExpr(this, params, null, sourceSpan);
- };
- /**
- * @param {?} params
- * @param {?=} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.instantiate = /**
- * @param {?} params
- * @param {?=} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (params, type, sourceSpan) {
- return new InstantiateExpr(this, params, type, sourceSpan);
- };
- /**
- * @param {?} trueCase
- * @param {?=} falseCase
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.conditional = /**
- * @param {?} trueCase
- * @param {?=} falseCase
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (trueCase, falseCase, sourceSpan) {
- if (falseCase === void 0) { falseCase = null; }
- return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.equals = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.notEquals = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.identical = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.notIdentical = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.minus = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.plus = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.divide = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.multiply = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Multiply, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.modulo = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.and = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.or = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.lower = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Lower, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.lowerEquals = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.LowerEquals, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.bigger = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.Bigger, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.biggerEquals = /**
- * @param {?} rhs
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (rhs, sourceSpan) {
- return new BinaryOperatorExpr(BinaryOperator.BiggerEquals, this, rhs, null, sourceSpan);
- };
- /**
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.isBlank = /**
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (sourceSpan) {
- // Note: We use equals by purpose here to compare to null and undefined in JS.
- // We use the typed null to allow strictNullChecks to narrow types.
- return this.equals(TYPED_NULL_EXPR, sourceSpan);
- };
- /**
- * @param {?} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- Expression.prototype.cast = /**
- * @param {?} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- function (type, sourceSpan) {
- return new CastExpr(this, type, sourceSpan);
- };
- /**
- * @return {?}
- */
- Expression.prototype.toStmt = /**
- * @return {?}
- */
- function () { return new ExpressionStatement(this, null); };
- return Expression;
- }());
- /** @enum {number} */
- var BuiltinVar = {
- This: 0,
- Super: 1,
- CatchError: 2,
- CatchStack: 3,
- };
- BuiltinVar[BuiltinVar.This] = "This";
- BuiltinVar[BuiltinVar.Super] = "Super";
- BuiltinVar[BuiltinVar.CatchError] = "CatchError";
- BuiltinVar[BuiltinVar.CatchStack] = "CatchStack";
- var ReadVarExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReadVarExpr, _super);
- function ReadVarExpr(name, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- if (typeof name === 'string') {
- _this.name = name;
- _this.builtin = null;
- }
- else {
- _this.name = null;
- _this.builtin = /** @type {?} */ (name);
- }
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- ReadVarExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof ReadVarExpr && this.name === e.name && this.builtin === e.builtin;
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ReadVarExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitReadVarExpr(this, context);
- };
- /**
- * @param {?} value
- * @return {?}
- */
- ReadVarExpr.prototype.set = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (!this.name) {
- throw new Error("Built in variable " + this.builtin + " can not be assigned to.");
- }
- return new WriteVarExpr(this.name, value, null, this.sourceSpan);
- };
- return ReadVarExpr;
- }(Expression));
- var WriteVarExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(WriteVarExpr, _super);
- function WriteVarExpr(name, value, type, sourceSpan) {
- var _this = _super.call(this, type || value.type, sourceSpan) || this;
- _this.name = name;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- WriteVarExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof WriteVarExpr && this.name === e.name && this.value.isEquivalent(e.value);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- WriteVarExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitWriteVarExpr(this, context);
- };
- /**
- * @param {?=} type
- * @param {?=} modifiers
- * @return {?}
- */
- WriteVarExpr.prototype.toDeclStmt = /**
- * @param {?=} type
- * @param {?=} modifiers
- * @return {?}
- */
- function (type, modifiers) {
- return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);
- };
- return WriteVarExpr;
- }(Expression));
- var WriteKeyExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(WriteKeyExpr, _super);
- function WriteKeyExpr(receiver, index, value, type, sourceSpan) {
- var _this = _super.call(this, type || value.type, sourceSpan) || this;
- _this.receiver = receiver;
- _this.index = index;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- WriteKeyExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof WriteKeyExpr && this.receiver.isEquivalent(e.receiver) &&
- this.index.isEquivalent(e.index) && this.value.isEquivalent(e.value);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- WriteKeyExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitWriteKeyExpr(this, context);
- };
- return WriteKeyExpr;
- }(Expression));
- var WritePropExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(WritePropExpr, _super);
- function WritePropExpr(receiver, name, value, type, sourceSpan) {
- var _this = _super.call(this, type || value.type, sourceSpan) || this;
- _this.receiver = receiver;
- _this.name = name;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- WritePropExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof WritePropExpr && this.receiver.isEquivalent(e.receiver) &&
- this.name === e.name && this.value.isEquivalent(e.value);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- WritePropExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitWritePropExpr(this, context);
- };
- return WritePropExpr;
- }(Expression));
- /** @enum {number} */
- var BuiltinMethod = {
- ConcatArray: 0,
- SubscribeObservable: 1,
- Bind: 2,
- };
- BuiltinMethod[BuiltinMethod.ConcatArray] = "ConcatArray";
- BuiltinMethod[BuiltinMethod.SubscribeObservable] = "SubscribeObservable";
- BuiltinMethod[BuiltinMethod.Bind] = "Bind";
- var InvokeMethodExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(InvokeMethodExpr, _super);
- function InvokeMethodExpr(receiver, method, args, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.receiver = receiver;
- _this.args = args;
- if (typeof method === 'string') {
- _this.name = method;
- _this.builtin = null;
- }
- else {
- _this.name = null;
- _this.builtin = /** @type {?} */ (method);
- }
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- InvokeMethodExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof InvokeMethodExpr && this.receiver.isEquivalent(e.receiver) &&
- this.name === e.name && this.builtin === e.builtin && areAllEquivalent(this.args, e.args);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- InvokeMethodExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitInvokeMethodExpr(this, context);
- };
- return InvokeMethodExpr;
- }(Expression));
- var InvokeFunctionExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(InvokeFunctionExpr, _super);
- function InvokeFunctionExpr(fn, args, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.fn = fn;
- _this.args = args;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- InvokeFunctionExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) &&
- areAllEquivalent(this.args, e.args);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- InvokeFunctionExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitInvokeFunctionExpr(this, context);
- };
- return InvokeFunctionExpr;
- }(Expression));
- var InstantiateExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(InstantiateExpr, _super);
- function InstantiateExpr(classExpr, args, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.classExpr = classExpr;
- _this.args = args;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- InstantiateExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof InstantiateExpr && this.classExpr.isEquivalent(e.classExpr) &&
- areAllEquivalent(this.args, e.args);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- InstantiateExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitInstantiateExpr(this, context);
- };
- return InstantiateExpr;
- }(Expression));
- var LiteralExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralExpr, _super);
- function LiteralExpr(value, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- LiteralExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof LiteralExpr && this.value === e.value;
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- LiteralExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitLiteralExpr(this, context);
- };
- return LiteralExpr;
- }(Expression));
- var ExternalExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExternalExpr, _super);
- function ExternalExpr(value, type, typeParams, sourceSpan) {
- if (typeParams === void 0) { typeParams = null; }
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.value = value;
- _this.typeParams = typeParams;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- ExternalExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof ExternalExpr && this.value.name === e.value.name &&
- this.value.moduleName === e.value.moduleName && this.value.runtime === e.value.runtime;
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ExternalExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitExternalExpr(this, context);
- };
- return ExternalExpr;
- }(Expression));
- var ExternalReference = /** @class */ (function () {
- function ExternalReference(moduleName, name, runtime) {
- this.moduleName = moduleName;
- this.name = name;
- this.runtime = runtime;
- }
- return ExternalReference;
- }());
- var ConditionalExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ConditionalExpr, _super);
- function ConditionalExpr(condition, trueCase, falseCase, type, sourceSpan) {
- if (falseCase === void 0) { falseCase = null; }
- var _this = _super.call(this, type || trueCase.type, sourceSpan) || this;
- _this.condition = condition;
- _this.falseCase = falseCase;
- _this.trueCase = trueCase;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- ConditionalExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof ConditionalExpr && this.condition.isEquivalent(e.condition) &&
- this.trueCase.isEquivalent(e.trueCase) && nullSafeIsEquivalent(this.falseCase, e.falseCase);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ConditionalExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitConditionalExpr(this, context);
- };
- return ConditionalExpr;
- }(Expression));
- var NotExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NotExpr, _super);
- function NotExpr(condition, sourceSpan) {
- var _this = _super.call(this, BOOL_TYPE, sourceSpan) || this;
- _this.condition = condition;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- NotExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof NotExpr && this.condition.isEquivalent(e.condition);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- NotExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitNotExpr(this, context);
- };
- return NotExpr;
- }(Expression));
- var AssertNotNull = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(AssertNotNull, _super);
- function AssertNotNull(condition, sourceSpan) {
- var _this = _super.call(this, condition.type, sourceSpan) || this;
- _this.condition = condition;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- AssertNotNull.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof AssertNotNull && this.condition.isEquivalent(e.condition);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- AssertNotNull.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitAssertNotNullExpr(this, context);
- };
- return AssertNotNull;
- }(Expression));
- var CastExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CastExpr, _super);
- function CastExpr(value, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- CastExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof CastExpr && this.value.isEquivalent(e.value);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- CastExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitCastExpr(this, context);
- };
- return CastExpr;
- }(Expression));
- var FnParam = /** @class */ (function () {
- function FnParam(name, type) {
- if (type === void 0) { type = null; }
- this.name = name;
- this.type = type;
- }
- /**
- * @param {?} param
- * @return {?}
- */
- FnParam.prototype.isEquivalent = /**
- * @param {?} param
- * @return {?}
- */
- function (param) { return this.name === param.name; };
- return FnParam;
- }());
- var FunctionExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FunctionExpr, _super);
- function FunctionExpr(params, statements, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.params = params;
- _this.statements = statements;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- FunctionExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof FunctionExpr && areAllEquivalent(this.params, e.params) &&
- areAllEquivalent(this.statements, e.statements);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- FunctionExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitFunctionExpr(this, context);
- };
- /**
- * @param {?} name
- * @param {?=} modifiers
- * @return {?}
- */
- FunctionExpr.prototype.toDeclStmt = /**
- * @param {?} name
- * @param {?=} modifiers
- * @return {?}
- */
- function (name, modifiers) {
- if (modifiers === void 0) { modifiers = null; }
- return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan);
- };
- return FunctionExpr;
- }(Expression));
- var BinaryOperatorExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BinaryOperatorExpr, _super);
- function BinaryOperatorExpr(operator, lhs, rhs, type, sourceSpan) {
- var _this = _super.call(this, type || lhs.type, sourceSpan) || this;
- _this.operator = operator;
- _this.rhs = rhs;
- _this.lhs = lhs;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- BinaryOperatorExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof BinaryOperatorExpr && this.operator === e.operator &&
- this.lhs.isEquivalent(e.lhs) && this.rhs.isEquivalent(e.rhs);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- BinaryOperatorExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitBinaryOperatorExpr(this, context);
- };
- return BinaryOperatorExpr;
- }(Expression));
- var ReadPropExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReadPropExpr, _super);
- function ReadPropExpr(receiver, name, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.receiver = receiver;
- _this.name = name;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- ReadPropExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) &&
- this.name === e.name;
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ReadPropExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitReadPropExpr(this, context);
- };
- /**
- * @param {?} value
- * @return {?}
- */
- ReadPropExpr.prototype.set = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan);
- };
- return ReadPropExpr;
- }(Expression));
- var ReadKeyExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReadKeyExpr, _super);
- function ReadKeyExpr(receiver, index, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.receiver = receiver;
- _this.index = index;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- ReadKeyExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof ReadKeyExpr && this.receiver.isEquivalent(e.receiver) &&
- this.index.isEquivalent(e.index);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ReadKeyExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitReadKeyExpr(this, context);
- };
- /**
- * @param {?} value
- * @return {?}
- */
- ReadKeyExpr.prototype.set = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan);
- };
- return ReadKeyExpr;
- }(Expression));
- var LiteralArrayExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralArrayExpr, _super);
- function LiteralArrayExpr(entries, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.entries = entries;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- LiteralArrayExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof LiteralArrayExpr && areAllEquivalent(this.entries, e.entries);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- LiteralArrayExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitLiteralArrayExpr(this, context);
- };
- return LiteralArrayExpr;
- }(Expression));
- var LiteralMapEntry = /** @class */ (function () {
- function LiteralMapEntry(key, value, quoted) {
- this.key = key;
- this.value = value;
- this.quoted = quoted;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- LiteralMapEntry.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return this.key === e.key && this.value.isEquivalent(e.value);
- };
- return LiteralMapEntry;
- }());
- var LiteralMapExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralMapExpr, _super);
- function LiteralMapExpr(entries, type, sourceSpan) {
- var _this = _super.call(this, type, sourceSpan) || this;
- _this.entries = entries;
- _this.valueType = null;
- if (type) {
- _this.valueType = type.valueType;
- }
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- LiteralMapExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof LiteralMapExpr && areAllEquivalent(this.entries, e.entries);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- LiteralMapExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitLiteralMapExpr(this, context);
- };
- return LiteralMapExpr;
- }(Expression));
- var CommaExpr = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CommaExpr, _super);
- function CommaExpr(parts, sourceSpan) {
- var _this = _super.call(this, parts[parts.length - 1].type, sourceSpan) || this;
- _this.parts = parts;
- return _this;
- }
- /**
- * @param {?} e
- * @return {?}
- */
- CommaExpr.prototype.isEquivalent = /**
- * @param {?} e
- * @return {?}
- */
- function (e) {
- return e instanceof CommaExpr && areAllEquivalent(this.parts, e.parts);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- CommaExpr.prototype.visitExpression = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitCommaExpr(this, context);
- };
- return CommaExpr;
- }(Expression));
- /**
- * @record
- */
- var THIS_EXPR = new ReadVarExpr(BuiltinVar.This, null, null);
- var SUPER_EXPR = new ReadVarExpr(BuiltinVar.Super, null, null);
- var CATCH_ERROR_VAR = new ReadVarExpr(BuiltinVar.CatchError, null, null);
- var CATCH_STACK_VAR = new ReadVarExpr(BuiltinVar.CatchStack, null, null);
- var NULL_EXPR = new LiteralExpr(null, null, null);
- var TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
- /** @enum {number} */
- var StmtModifier = {
- Final: 0,
- Private: 1,
- Exported: 2,
- };
- StmtModifier[StmtModifier.Final] = "Final";
- StmtModifier[StmtModifier.Private] = "Private";
- StmtModifier[StmtModifier.Exported] = "Exported";
- /**
- * @abstract
- */
- var Statement = /** @class */ (function () {
- function Statement(modifiers, sourceSpan) {
- this.modifiers = modifiers || [];
- this.sourceSpan = sourceSpan || null;
- }
- /**
- * @param {?} modifier
- * @return {?}
- */
- Statement.prototype.hasModifier = /**
- * @param {?} modifier
- * @return {?}
- */
- function (modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; };
- return Statement;
- }());
- var DeclareVarStmt = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DeclareVarStmt, _super);
- function DeclareVarStmt(name, value, type, modifiers, sourceSpan) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, modifiers, sourceSpan) || this;
- _this.name = name;
- _this.value = value;
- _this.type = type || value.type;
- return _this;
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- DeclareVarStmt.prototype.isEquivalent = /**
- * @param {?} stmt
- * @return {?}
- */
- function (stmt) {
- return stmt instanceof DeclareVarStmt && this.name === stmt.name &&
- this.value.isEquivalent(stmt.value);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- DeclareVarStmt.prototype.visitStatement = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitDeclareVarStmt(this, context);
- };
- return DeclareVarStmt;
- }(Statement));
- var DeclareFunctionStmt = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DeclareFunctionStmt, _super);
- function DeclareFunctionStmt(name, params, statements, type, modifiers, sourceSpan) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, modifiers, sourceSpan) || this;
- _this.name = name;
- _this.params = params;
- _this.statements = statements;
- _this.type = type || null;
- return _this;
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- DeclareFunctionStmt.prototype.isEquivalent = /**
- * @param {?} stmt
- * @return {?}
- */
- function (stmt) {
- return stmt instanceof DeclareFunctionStmt && areAllEquivalent(this.params, stmt.params) &&
- areAllEquivalent(this.statements, stmt.statements);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- DeclareFunctionStmt.prototype.visitStatement = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitDeclareFunctionStmt(this, context);
- };
- return DeclareFunctionStmt;
- }(Statement));
- var ExpressionStatement = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExpressionStatement, _super);
- function ExpressionStatement(expr, sourceSpan) {
- var _this = _super.call(this, null, sourceSpan) || this;
- _this.expr = expr;
- return _this;
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- ExpressionStatement.prototype.isEquivalent = /**
- * @param {?} stmt
- * @return {?}
- */
- function (stmt) {
- return stmt instanceof ExpressionStatement && this.expr.isEquivalent(stmt.expr);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ExpressionStatement.prototype.visitStatement = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitExpressionStmt(this, context);
- };
- return ExpressionStatement;
- }(Statement));
- var ReturnStatement = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReturnStatement, _super);
- function ReturnStatement(value, sourceSpan) {
- var _this = _super.call(this, null, sourceSpan) || this;
- _this.value = value;
- return _this;
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- ReturnStatement.prototype.isEquivalent = /**
- * @param {?} stmt
- * @return {?}
- */
- function (stmt) {
- return stmt instanceof ReturnStatement && this.value.isEquivalent(stmt.value);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ReturnStatement.prototype.visitStatement = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitReturnStmt(this, context);
- };
- return ReturnStatement;
- }(Statement));
- var AbstractClassPart = /** @class */ (function () {
- function AbstractClassPart(type, modifiers) {
- this.modifiers = modifiers;
- if (!modifiers) {
- this.modifiers = [];
- }
- this.type = type || null;
- }
- /**
- * @param {?} modifier
- * @return {?}
- */
- AbstractClassPart.prototype.hasModifier = /**
- * @param {?} modifier
- * @return {?}
- */
- function (modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; };
- return AbstractClassPart;
- }());
- var ClassField = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassField, _super);
- function ClassField(name, type, modifiers) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, type, modifiers) || this;
- _this.name = name;
- return _this;
- }
- /**
- * @param {?} f
- * @return {?}
- */
- ClassField.prototype.isEquivalent = /**
- * @param {?} f
- * @return {?}
- */
- function (f) { return this.name === f.name; };
- return ClassField;
- }(AbstractClassPart));
- var ClassMethod = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassMethod, _super);
- function ClassMethod(name, params, body, type, modifiers) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, type, modifiers) || this;
- _this.name = name;
- _this.params = params;
- _this.body = body;
- return _this;
- }
- /**
- * @param {?} m
- * @return {?}
- */
- ClassMethod.prototype.isEquivalent = /**
- * @param {?} m
- * @return {?}
- */
- function (m) {
- return this.name === m.name && areAllEquivalent(this.body, m.body);
- };
- return ClassMethod;
- }(AbstractClassPart));
- var ClassGetter = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassGetter, _super);
- function ClassGetter(name, body, type, modifiers) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, type, modifiers) || this;
- _this.name = name;
- _this.body = body;
- return _this;
- }
- /**
- * @param {?} m
- * @return {?}
- */
- ClassGetter.prototype.isEquivalent = /**
- * @param {?} m
- * @return {?}
- */
- function (m) {
- return this.name === m.name && areAllEquivalent(this.body, m.body);
- };
- return ClassGetter;
- }(AbstractClassPart));
- var ClassStmt = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassStmt, _super);
- function ClassStmt(name, parent, fields, getters, constructorMethod, methods, modifiers, sourceSpan) {
- if (modifiers === void 0) { modifiers = null; }
- var _this = _super.call(this, modifiers, sourceSpan) || this;
- _this.name = name;
- _this.parent = parent;
- _this.fields = fields;
- _this.getters = getters;
- _this.constructorMethod = constructorMethod;
- _this.methods = methods;
- return _this;
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- ClassStmt.prototype.isEquivalent = /**
- * @param {?} stmt
- * @return {?}
- */
- function (stmt) {
- return stmt instanceof ClassStmt && this.name === stmt.name &&
- nullSafeIsEquivalent(this.parent, stmt.parent) &&
- areAllEquivalent(this.fields, stmt.fields) &&
- areAllEquivalent(this.getters, stmt.getters) &&
- this.constructorMethod.isEquivalent(stmt.constructorMethod) &&
- areAllEquivalent(this.methods, stmt.methods);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ClassStmt.prototype.visitStatement = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitDeclareClassStmt(this, context);
- };
- return ClassStmt;
- }(Statement));
- var IfStmt = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(IfStmt, _super);
- function IfStmt(condition, trueCase, falseCase, sourceSpan) {
- if (falseCase === void 0) { falseCase = []; }
- var _this = _super.call(this, null, sourceSpan) || this;
- _this.condition = condition;
- _this.trueCase = trueCase;
- _this.falseCase = falseCase;
- return _this;
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- IfStmt.prototype.isEquivalent = /**
- * @param {?} stmt
- * @return {?}
- */
- function (stmt) {
- return stmt instanceof IfStmt && this.condition.isEquivalent(stmt.condition) &&
- areAllEquivalent(this.trueCase, stmt.trueCase) &&
- areAllEquivalent(this.falseCase, stmt.falseCase);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- IfStmt.prototype.visitStatement = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitIfStmt(this, context);
- };
- return IfStmt;
- }(Statement));
- var CommentStmt = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CommentStmt, _super);
- function CommentStmt(comment, sourceSpan) {
- var _this = _super.call(this, null, sourceSpan) || this;
- _this.comment = comment;
- return _this;
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- CommentStmt.prototype.isEquivalent = /**
- * @param {?} stmt
- * @return {?}
- */
- function (stmt) { return stmt instanceof CommentStmt; };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- CommentStmt.prototype.visitStatement = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitCommentStmt(this, context);
- };
- return CommentStmt;
- }(Statement));
- var TryCatchStmt = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TryCatchStmt, _super);
- function TryCatchStmt(bodyStmts, catchStmts, sourceSpan) {
- var _this = _super.call(this, null, sourceSpan) || this;
- _this.bodyStmts = bodyStmts;
- _this.catchStmts = catchStmts;
- return _this;
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- TryCatchStmt.prototype.isEquivalent = /**
- * @param {?} stmt
- * @return {?}
- */
- function (stmt) {
- return stmt instanceof TryCatchStmt && areAllEquivalent(this.bodyStmts, stmt.bodyStmts) &&
- areAllEquivalent(this.catchStmts, stmt.catchStmts);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- TryCatchStmt.prototype.visitStatement = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitTryCatchStmt(this, context);
- };
- return TryCatchStmt;
- }(Statement));
- var ThrowStmt = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ThrowStmt, _super);
- function ThrowStmt(error, sourceSpan) {
- var _this = _super.call(this, null, sourceSpan) || this;
- _this.error = error;
- return _this;
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- ThrowStmt.prototype.isEquivalent = /**
- * @param {?} stmt
- * @return {?}
- */
- function (stmt) {
- return stmt instanceof TryCatchStmt && this.error.isEquivalent(stmt.error);
- };
- /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- ThrowStmt.prototype.visitStatement = /**
- * @param {?} visitor
- * @param {?} context
- * @return {?}
- */
- function (visitor, context) {
- return visitor.visitThrowStmt(this, context);
- };
- return ThrowStmt;
- }(Statement));
- /**
- * @record
- */
- var AstTransformer$1 = /** @class */ (function () {
- function AstTransformer() {
- }
- /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.transformExpr = /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- function (expr, context) { return expr; };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.transformStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) { return stmt; };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitReadVarExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return this.transformExpr(ast, context); };
- /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitWriteVarExpr = /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- function (expr, context) {
- return this.transformExpr(new WriteVarExpr(expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
- };
- /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitWriteKeyExpr = /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- function (expr, context) {
- 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);
- };
- /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitWritePropExpr = /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- function (expr, context) {
- return this.transformExpr(new WritePropExpr(expr.receiver.visitExpression(this, context), expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitInvokeMethodExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var /** @type {?} */ method = ast.builtin || ast.name;
- return this.transformExpr(new InvokeMethodExpr(ast.receiver.visitExpression(this, context), /** @type {?} */ ((method)), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitInvokeFunctionExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new InvokeFunctionExpr(ast.fn.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitInstantiateExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new InstantiateExpr(ast.classExpr.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitLiteralExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return this.transformExpr(ast, context); };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitExternalExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitConditionalExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- 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);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitNotExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new NotExpr(ast.condition.visitExpression(this, context), ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitAssertNotNullExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new AssertNotNull(ast.condition.visitExpression(this, context), ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitCastExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new CastExpr(ast.value.visitExpression(this, context), ast.type, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitFunctionExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new FunctionExpr(ast.params, this.visitAllStatements(ast.statements, context), ast.type, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitBinaryOperatorExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new BinaryOperatorExpr(ast.operator, ast.lhs.visitExpression(this, context), ast.rhs.visitExpression(this, context), ast.type, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitReadPropExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new ReadPropExpr(ast.receiver.visitExpression(this, context), ast.name, ast.type, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitReadKeyExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new ReadKeyExpr(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context), ast.type, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitLiteralArrayExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new LiteralArrayExpr(this.visitAllExpressions(ast.entries, context), ast.type, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitLiteralMapExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- var /** @type {?} */ entries = ast.entries.map(function (entry) {
- return new LiteralMapEntry(entry.key, entry.value.visitExpression(_this, context), entry.quoted);
- });
- var /** @type {?} */ mapType = new MapType(ast.valueType, null);
- return this.transformExpr(new LiteralMapExpr(entries, mapType, ast.sourceSpan), context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitCommaExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.transformExpr(new CommaExpr(this.visitAllExpressions(ast.parts, context), ast.sourceSpan), context);
- };
- /**
- * @param {?} exprs
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitAllExpressions = /**
- * @param {?} exprs
- * @param {?} context
- * @return {?}
- */
- function (exprs, context) {
- var _this = this;
- return exprs.map(function (expr) { return expr.visitExpression(_this, context); });
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitDeclareVarStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- return this.transformStmt(new DeclareVarStmt(stmt.name, stmt.value.visitExpression(this, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context);
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitDeclareFunctionStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- return this.transformStmt(new DeclareFunctionStmt(stmt.name, stmt.params, this.visitAllStatements(stmt.statements, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context);
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitExpressionStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- return this.transformStmt(new ExpressionStatement(stmt.expr.visitExpression(this, context), stmt.sourceSpan), context);
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitReturnStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- return this.transformStmt(new ReturnStatement(stmt.value.visitExpression(this, context), stmt.sourceSpan), context);
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitDeclareClassStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- var _this = this;
- var /** @type {?} */ parent = /** @type {?} */ ((stmt.parent)).visitExpression(this, context);
- var /** @type {?} */ getters = stmt.getters.map(function (getter) {
- return new ClassGetter(getter.name, _this.visitAllStatements(getter.body, context), getter.type, getter.modifiers);
- });
- var /** @type {?} */ ctorMethod = stmt.constructorMethod &&
- new ClassMethod(stmt.constructorMethod.name, stmt.constructorMethod.params, this.visitAllStatements(stmt.constructorMethod.body, context), stmt.constructorMethod.type, stmt.constructorMethod.modifiers);
- var /** @type {?} */ methods = stmt.methods.map(function (method) {
- return new ClassMethod(method.name, method.params, _this.visitAllStatements(method.body, context), method.type, method.modifiers);
- });
- return this.transformStmt(new ClassStmt(stmt.name, parent, stmt.fields, getters, ctorMethod, methods, stmt.modifiers, stmt.sourceSpan), context);
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitIfStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- return this.transformStmt(new IfStmt(stmt.condition.visitExpression(this, context), this.visitAllStatements(stmt.trueCase, context), this.visitAllStatements(stmt.falseCase, context), stmt.sourceSpan), context);
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitTryCatchStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- return this.transformStmt(new TryCatchStmt(this.visitAllStatements(stmt.bodyStmts, context), this.visitAllStatements(stmt.catchStmts, context), stmt.sourceSpan), context);
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitThrowStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- return this.transformStmt(new ThrowStmt(stmt.error.visitExpression(this, context), stmt.sourceSpan), context);
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitCommentStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- return this.transformStmt(stmt, context);
- };
- /**
- * @param {?} stmts
- * @param {?} context
- * @return {?}
- */
- AstTransformer.prototype.visitAllStatements = /**
- * @param {?} stmts
- * @param {?} context
- * @return {?}
- */
- function (stmts, context) {
- var _this = this;
- return stmts.map(function (stmt) { return stmt.visitStatement(_this, context); });
- };
- return AstTransformer;
- }());
- var RecursiveAstVisitor$1 = /** @class */ (function () {
- function RecursiveAstVisitor() {
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitType = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { return ast; };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitExpression = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- if (ast.type) {
- ast.type.visitType(this, context);
- }
- return ast;
- };
- /**
- * @param {?} type
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitBuiltintType = /**
- * @param {?} type
- * @param {?} context
- * @return {?}
- */
- function (type, context) { return this.visitType(type, context); };
- /**
- * @param {?} type
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitExpressionType = /**
- * @param {?} type
- * @param {?} context
- * @return {?}
- */
- function (type, context) {
- type.value.visitExpression(this, context);
- return this.visitType(type, context);
- };
- /**
- * @param {?} type
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitArrayType = /**
- * @param {?} type
- * @param {?} context
- * @return {?}
- */
- function (type, context) { return this.visitType(type, context); };
- /**
- * @param {?} type
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitMapType = /**
- * @param {?} type
- * @param {?} context
- * @return {?}
- */
- function (type, context) { return this.visitType(type, context); };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitReadVarExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitWriteVarExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.value.visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitWriteKeyExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visitExpression(this, context);
- ast.index.visitExpression(this, context);
- ast.value.visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitWritePropExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visitExpression(this, context);
- ast.value.visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitInvokeMethodExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visitExpression(this, context);
- this.visitAllExpressions(ast.args, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitInvokeFunctionExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.fn.visitExpression(this, context);
- this.visitAllExpressions(ast.args, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitInstantiateExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.classExpr.visitExpression(this, context);
- this.visitAllExpressions(ast.args, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitLiteralExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitExternalExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- if (ast.typeParams) {
- ast.typeParams.forEach(function (type) { return type.visitType(_this, context); });
- }
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitConditionalExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.condition.visitExpression(this, context);
- ast.trueCase.visitExpression(this, context); /** @type {?} */
- ((ast.falseCase)).visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitNotExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.condition.visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitAssertNotNullExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.condition.visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitCastExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.value.visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitFunctionExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- this.visitAllStatements(ast.statements, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitBinaryOperatorExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.lhs.visitExpression(this, context);
- ast.rhs.visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitReadPropExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitReadKeyExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- ast.receiver.visitExpression(this, context);
- ast.index.visitExpression(this, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitLiteralArrayExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- this.visitAllExpressions(ast.entries, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitLiteralMapExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- ast.entries.forEach(function (entry) { return entry.value.visitExpression(_this, context); });
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitCommaExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- this.visitAllExpressions(ast.parts, context);
- return this.visitExpression(ast, context);
- };
- /**
- * @param {?} exprs
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitAllExpressions = /**
- * @param {?} exprs
- * @param {?} context
- * @return {?}
- */
- function (exprs, context) {
- var _this = this;
- exprs.forEach(function (expr) { return expr.visitExpression(_this, context); });
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitDeclareVarStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- stmt.value.visitExpression(this, context);
- if (stmt.type) {
- stmt.type.visitType(this, context);
- }
- return stmt;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitDeclareFunctionStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- this.visitAllStatements(stmt.statements, context);
- if (stmt.type) {
- stmt.type.visitType(this, context);
- }
- return stmt;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitExpressionStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- stmt.expr.visitExpression(this, context);
- return stmt;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitReturnStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- stmt.value.visitExpression(this, context);
- return stmt;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitDeclareClassStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- var _this = this;
- /** @type {?} */ ((stmt.parent)).visitExpression(this, context);
- stmt.getters.forEach(function (getter) { return _this.visitAllStatements(getter.body, context); });
- if (stmt.constructorMethod) {
- this.visitAllStatements(stmt.constructorMethod.body, context);
- }
- stmt.methods.forEach(function (method) { return _this.visitAllStatements(method.body, context); });
- return stmt;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitIfStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- stmt.condition.visitExpression(this, context);
- this.visitAllStatements(stmt.trueCase, context);
- this.visitAllStatements(stmt.falseCase, context);
- return stmt;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitTryCatchStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- this.visitAllStatements(stmt.bodyStmts, context);
- this.visitAllStatements(stmt.catchStmts, context);
- return stmt;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitThrowStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- stmt.error.visitExpression(this, context);
- return stmt;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitCommentStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) { return stmt; };
- /**
- * @param {?} stmts
- * @param {?} context
- * @return {?}
- */
- RecursiveAstVisitor.prototype.visitAllStatements = /**
- * @param {?} stmts
- * @param {?} context
- * @return {?}
- */
- function (stmts, context) {
- var _this = this;
- stmts.forEach(function (stmt) { return stmt.visitStatement(_this, context); });
- };
- return RecursiveAstVisitor;
- }());
- /**
- * @param {?} stmts
- * @return {?}
- */
- function findReadVarNames(stmts) {
- var /** @type {?} */ visitor = new _ReadVarVisitor();
- visitor.visitAllStatements(stmts, null);
- return visitor.varNames;
- }
- var _ReadVarVisitor = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_ReadVarVisitor, _super);
- function _ReadVarVisitor() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.varNames = new Set();
- return _this;
- }
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- _ReadVarVisitor.prototype.visitDeclareFunctionStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- // Don't descend into nested functions
- return stmt;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- _ReadVarVisitor.prototype.visitDeclareClassStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- // Don't descend into nested classes
- return stmt;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- _ReadVarVisitor.prototype.visitReadVarExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- if (ast.name) {
- this.varNames.add(ast.name);
- }
- return null;
- };
- return _ReadVarVisitor;
- }(RecursiveAstVisitor$1));
- /**
- * @param {?} stmts
- * @return {?}
- */
- function collectExternalReferences(stmts) {
- var /** @type {?} */ visitor = new _FindExternalReferencesVisitor();
- visitor.visitAllStatements(stmts, null);
- return visitor.externalReferences;
- }
- var _FindExternalReferencesVisitor = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_FindExternalReferencesVisitor, _super);
- function _FindExternalReferencesVisitor() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.externalReferences = [];
- return _this;
- }
- /**
- * @param {?} e
- * @param {?} context
- * @return {?}
- */
- _FindExternalReferencesVisitor.prototype.visitExternalExpr = /**
- * @param {?} e
- * @param {?} context
- * @return {?}
- */
- function (e, context) {
- this.externalReferences.push(e.value);
- return _super.prototype.visitExternalExpr.call(this, e, context);
- };
- return _FindExternalReferencesVisitor;
- }(RecursiveAstVisitor$1));
- /**
- * @param {?} stmt
- * @param {?} sourceSpan
- * @return {?}
- */
- function applySourceSpanToStatementIfNeeded(stmt, sourceSpan) {
- if (!sourceSpan) {
- return stmt;
- }
- var /** @type {?} */ transformer = new _ApplySourceSpanTransformer(sourceSpan);
- return stmt.visitStatement(transformer, null);
- }
- /**
- * @param {?} expr
- * @param {?} sourceSpan
- * @return {?}
- */
- function applySourceSpanToExpressionIfNeeded(expr, sourceSpan) {
- if (!sourceSpan) {
- return expr;
- }
- var /** @type {?} */ transformer = new _ApplySourceSpanTransformer(sourceSpan);
- return expr.visitExpression(transformer, null);
- }
- var _ApplySourceSpanTransformer = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_ApplySourceSpanTransformer, _super);
- function _ApplySourceSpanTransformer(sourceSpan) {
- var _this = _super.call(this) || this;
- _this.sourceSpan = sourceSpan;
- return _this;
- }
- /**
- * @param {?} obj
- * @return {?}
- */
- _ApplySourceSpanTransformer.prototype._clone = /**
- * @param {?} obj
- * @return {?}
- */
- function (obj) {
- var /** @type {?} */ clone = Object.create(obj.constructor.prototype);
- for (var /** @type {?} */ prop in obj) {
- clone[prop] = obj[prop];
- }
- return clone;
- };
- /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- _ApplySourceSpanTransformer.prototype.transformExpr = /**
- * @param {?} expr
- * @param {?} context
- * @return {?}
- */
- function (expr, context) {
- if (!expr.sourceSpan) {
- expr = this._clone(expr);
- expr.sourceSpan = this.sourceSpan;
- }
- return expr;
- };
- /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- _ApplySourceSpanTransformer.prototype.transformStmt = /**
- * @param {?} stmt
- * @param {?} context
- * @return {?}
- */
- function (stmt, context) {
- if (!stmt.sourceSpan) {
- stmt = this._clone(stmt);
- stmt.sourceSpan = this.sourceSpan;
- }
- return stmt;
- };
- return _ApplySourceSpanTransformer;
- }(AstTransformer$1));
- /**
- * @param {?} name
- * @param {?=} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- function variable(name, type, sourceSpan) {
- return new ReadVarExpr(name, type, sourceSpan);
- }
- /**
- * @param {?} id
- * @param {?=} typeParams
- * @param {?=} sourceSpan
- * @return {?}
- */
- function importExpr(id, typeParams, sourceSpan) {
- if (typeParams === void 0) { typeParams = null; }
- return new ExternalExpr(id, null, typeParams, sourceSpan);
- }
- /**
- * @param {?} id
- * @param {?=} typeParams
- * @param {?=} typeModifiers
- * @return {?}
- */
- function importType(id, typeParams, typeModifiers) {
- if (typeParams === void 0) { typeParams = null; }
- if (typeModifiers === void 0) { typeModifiers = null; }
- return id != null ? expressionType(importExpr(id, typeParams, null), typeModifiers) : null;
- }
- /**
- * @param {?} expr
- * @param {?=} typeModifiers
- * @return {?}
- */
- function expressionType(expr, typeModifiers) {
- if (typeModifiers === void 0) { typeModifiers = null; }
- return new ExpressionType(expr, typeModifiers);
- }
- /**
- * @param {?} values
- * @param {?=} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- function literalArr(values, type, sourceSpan) {
- return new LiteralArrayExpr(values, type, sourceSpan);
- }
- /**
- * @param {?} values
- * @param {?=} type
- * @return {?}
- */
- function literalMap(values, type) {
- if (type === void 0) { type = null; }
- return new LiteralMapExpr(values.map(function (e) { return new LiteralMapEntry(e.key, e.value, e.quoted); }), type, null);
- }
- /**
- * @param {?} expr
- * @param {?=} sourceSpan
- * @return {?}
- */
- function not(expr, sourceSpan) {
- return new NotExpr(expr, sourceSpan);
- }
- /**
- * @param {?} expr
- * @param {?=} sourceSpan
- * @return {?}
- */
- function assertNotNull(expr, sourceSpan) {
- return new AssertNotNull(expr, sourceSpan);
- }
- /**
- * @param {?} params
- * @param {?} body
- * @param {?=} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- function fn(params, body, type, sourceSpan) {
- return new FunctionExpr(params, body, type, sourceSpan);
- }
- /**
- * @param {?} value
- * @param {?=} type
- * @param {?=} sourceSpan
- * @return {?}
- */
- function literal(value, type, sourceSpan) {
- return new LiteralExpr(value, type, sourceSpan);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ProviderError = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ProviderError, _super);
- function ProviderError(message, span) {
- return _super.call(this, span, message) || this;
- }
- return ProviderError;
- }(ParseError));
- /**
- * @record
- */
- var ProviderViewContext = /** @class */ (function () {
- function ProviderViewContext(reflector, component) {
- var _this = this;
- this.reflector = reflector;
- this.component = component;
- this.errors = [];
- this.viewQueries = _getViewQueries(component);
- this.viewProviders = new Map();
- component.viewProviders.forEach(function (provider) {
- if (_this.viewProviders.get(tokenReference(provider.token)) == null) {
- _this.viewProviders.set(tokenReference(provider.token), true);
- }
- });
- }
- return ProviderViewContext;
- }());
- var ProviderElementContext = /** @class */ (function () {
- function ProviderElementContext(viewContext, _parent, _isViewRoot, _directiveAsts, attrs, refs, isTemplate, contentQueryStartId, _sourceSpan) {
- var _this = this;
- this.viewContext = viewContext;
- this._parent = _parent;
- this._isViewRoot = _isViewRoot;
- this._directiveAsts = _directiveAsts;
- this._sourceSpan = _sourceSpan;
- this._transformedProviders = new Map();
- this._seenProviders = new Map();
- this._queriedTokens = new Map();
- this.transformedHasViewContainer = false;
- this._attrs = {};
- attrs.forEach(function (attrAst) { return _this._attrs[attrAst.name] = attrAst.value; });
- var /** @type {?} */ directivesMeta = _directiveAsts.map(function (directiveAst) { return directiveAst.directive; });
- this._allProviders =
- _resolveProvidersFromDirectives(directivesMeta, _sourceSpan, viewContext.errors);
- this._contentQueries = _getContentQueries(contentQueryStartId, directivesMeta);
- Array.from(this._allProviders.values()).forEach(function (provider) {
- _this._addQueryReadsTo(provider.token, provider.token, _this._queriedTokens);
- });
- if (isTemplate) {
- var /** @type {?} */ templateRefId = createTokenForExternalReference(this.viewContext.reflector, Identifiers.TemplateRef);
- this._addQueryReadsTo(templateRefId, templateRefId, this._queriedTokens);
- }
- refs.forEach(function (refAst) {
- var /** @type {?} */ defaultQueryValue = refAst.value ||
- createTokenForExternalReference(_this.viewContext.reflector, Identifiers.ElementRef);
- _this._addQueryReadsTo({ value: refAst.name }, defaultQueryValue, _this._queriedTokens);
- });
- if (this._queriedTokens.get(this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef))) {
- this.transformedHasViewContainer = true;
- }
- // create the providers that we know are eager first
- Array.from(this._allProviders.values()).forEach(function (provider) {
- var /** @type {?} */ eager = provider.eager || _this._queriedTokens.get(tokenReference(provider.token));
- if (eager) {
- _this._getOrCreateLocalProvider(provider.providerType, provider.token, true);
- }
- });
- }
- /**
- * @return {?}
- */
- ProviderElementContext.prototype.afterElement = /**
- * @return {?}
- */
- function () {
- var _this = this;
- // collect lazy providers
- Array.from(this._allProviders.values()).forEach(function (provider) {
- _this._getOrCreateLocalProvider(provider.providerType, provider.token, false);
- });
- };
- Object.defineProperty(ProviderElementContext.prototype, "transformProviders", {
- get: /**
- * @return {?}
- */
- function () {
- // Note: Maps keep their insertion order.
- var /** @type {?} */ lazyProviders = [];
- var /** @type {?} */ eagerProviders = [];
- this._transformedProviders.forEach(function (provider) {
- if (provider.eager) {
- eagerProviders.push(provider);
- }
- else {
- lazyProviders.push(provider);
- }
- });
- return lazyProviders.concat(eagerProviders);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ProviderElementContext.prototype, "transformedDirectiveAsts", {
- get: /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ sortedProviderTypes = this.transformProviders.map(function (provider) { return provider.token.identifier; });
- var /** @type {?} */ sortedDirectives = this._directiveAsts.slice();
- sortedDirectives.sort(function (dir1, dir2) {
- return sortedProviderTypes.indexOf(dir1.directive.type) -
- sortedProviderTypes.indexOf(dir2.directive.type);
- });
- return sortedDirectives;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ProviderElementContext.prototype, "queryMatches", {
- get: /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ allMatches = [];
- this._queriedTokens.forEach(function (matches) { allMatches.push.apply(allMatches, matches); });
- return allMatches;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} token
- * @param {?} defaultValue
- * @param {?} queryReadTokens
- * @return {?}
- */
- ProviderElementContext.prototype._addQueryReadsTo = /**
- * @param {?} token
- * @param {?} defaultValue
- * @param {?} queryReadTokens
- * @return {?}
- */
- function (token, defaultValue, queryReadTokens) {
- this._getQueriesFor(token).forEach(function (query) {
- var /** @type {?} */ queryValue = query.meta.read || defaultValue;
- var /** @type {?} */ tokenRef = tokenReference(queryValue);
- var /** @type {?} */ queryMatches = queryReadTokens.get(tokenRef);
- if (!queryMatches) {
- queryMatches = [];
- queryReadTokens.set(tokenRef, queryMatches);
- }
- queryMatches.push({ queryId: query.queryId, value: queryValue });
- });
- };
- /**
- * @param {?} token
- * @return {?}
- */
- ProviderElementContext.prototype._getQueriesFor = /**
- * @param {?} token
- * @return {?}
- */
- function (token) {
- var /** @type {?} */ result = [];
- var /** @type {?} */ currentEl = this;
- var /** @type {?} */ distance = 0;
- var /** @type {?} */ queries;
- while (currentEl !== null) {
- queries = currentEl._contentQueries.get(tokenReference(token));
- if (queries) {
- result.push.apply(result, queries.filter(function (query) { return query.meta.descendants || distance <= 1; }));
- }
- if (currentEl._directiveAsts.length > 0) {
- distance++;
- }
- currentEl = currentEl._parent;
- }
- queries = this.viewContext.viewQueries.get(tokenReference(token));
- if (queries) {
- result.push.apply(result, queries);
- }
- return result;
- };
- /**
- * @param {?} requestingProviderType
- * @param {?} token
- * @param {?} eager
- * @return {?}
- */
- ProviderElementContext.prototype._getOrCreateLocalProvider = /**
- * @param {?} requestingProviderType
- * @param {?} token
- * @param {?} eager
- * @return {?}
- */
- function (requestingProviderType, token, eager) {
- var _this = this;
- var /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token));
- if (!resolvedProvider || ((requestingProviderType === ProviderAstType.Directive ||
- requestingProviderType === ProviderAstType.PublicService) &&
- resolvedProvider.providerType === ProviderAstType.PrivateService) ||
- ((requestingProviderType === ProviderAstType.PrivateService ||
- requestingProviderType === ProviderAstType.PublicService) &&
- resolvedProvider.providerType === ProviderAstType.Builtin)) {
- return null;
- }
- var /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token));
- if (transformedProviderAst) {
- return transformedProviderAst;
- }
- if (this._seenProviders.get(tokenReference(token)) != null) {
- this.viewContext.errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), this._sourceSpan));
- return null;
- }
- this._seenProviders.set(tokenReference(token), true);
- var /** @type {?} */ transformedProviders = resolvedProvider.providers.map(function (provider) {
- var /** @type {?} */ transformedUseValue = provider.useValue;
- var /** @type {?} */ transformedUseExisting = /** @type {?} */ ((provider.useExisting));
- var /** @type {?} */ transformedDeps = /** @type {?} */ ((undefined));
- if (provider.useExisting != null) {
- var /** @type {?} */ existingDiDep = /** @type {?} */ ((_this._getDependency(resolvedProvider.providerType, { token: provider.useExisting }, eager)));
- if (existingDiDep.token != null) {
- transformedUseExisting = existingDiDep.token;
- }
- else {
- transformedUseExisting = /** @type {?} */ ((null));
- transformedUseValue = existingDiDep.value;
- }
- }
- else if (provider.useFactory) {
- var /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps;
- transformedDeps =
- deps.map(function (dep) { return ((_this._getDependency(resolvedProvider.providerType, dep, eager))); });
- }
- else if (provider.useClass) {
- var /** @type {?} */ deps = provider.deps || provider.useClass.diDeps;
- transformedDeps =
- deps.map(function (dep) { return ((_this._getDependency(resolvedProvider.providerType, dep, eager))); });
- }
- return _transformProvider(provider, {
- useExisting: transformedUseExisting,
- useValue: transformedUseValue,
- deps: transformedDeps
- });
- });
- transformedProviderAst =
- _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
- this._transformedProviders.set(tokenReference(token), transformedProviderAst);
- return transformedProviderAst;
- };
- /**
- * @param {?} requestingProviderType
- * @param {?} dep
- * @param {?=} eager
- * @return {?}
- */
- ProviderElementContext.prototype._getLocalDependency = /**
- * @param {?} requestingProviderType
- * @param {?} dep
- * @param {?=} eager
- * @return {?}
- */
- function (requestingProviderType, dep, eager) {
- if (eager === void 0) { eager = false; }
- if (dep.isAttribute) {
- var /** @type {?} */ attrValue = this._attrs[/** @type {?} */ ((dep.token)).value];
- return { isValue: true, value: attrValue == null ? null : attrValue };
- }
- if (dep.token != null) {
- // access builtints
- if ((requestingProviderType === ProviderAstType.Directive ||
- requestingProviderType === ProviderAstType.Component)) {
- if (tokenReference(dep.token) ===
- this.viewContext.reflector.resolveExternalReference(Identifiers.Renderer) ||
- tokenReference(dep.token) ===
- this.viewContext.reflector.resolveExternalReference(Identifiers.ElementRef) ||
- tokenReference(dep.token) ===
- this.viewContext.reflector.resolveExternalReference(Identifiers.ChangeDetectorRef) ||
- tokenReference(dep.token) ===
- this.viewContext.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
- return dep;
- }
- if (tokenReference(dep.token) ===
- this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) {
- (/** @type {?} */ (this)).transformedHasViewContainer = true;
- }
- }
- // access the injector
- if (tokenReference(dep.token) ===
- this.viewContext.reflector.resolveExternalReference(Identifiers.Injector)) {
- return dep;
- }
- // access providers
- if (this._getOrCreateLocalProvider(requestingProviderType, dep.token, eager) != null) {
- return dep;
- }
- }
- return null;
- };
- /**
- * @param {?} requestingProviderType
- * @param {?} dep
- * @param {?=} eager
- * @return {?}
- */
- ProviderElementContext.prototype._getDependency = /**
- * @param {?} requestingProviderType
- * @param {?} dep
- * @param {?=} eager
- * @return {?}
- */
- function (requestingProviderType, dep, eager) {
- if (eager === void 0) { eager = false; }
- var /** @type {?} */ currElement = this;
- var /** @type {?} */ currEager = eager;
- var /** @type {?} */ result = null;
- if (!dep.isSkipSelf) {
- result = this._getLocalDependency(requestingProviderType, dep, eager);
- }
- if (dep.isSelf) {
- if (!result && dep.isOptional) {
- result = { isValue: true, value: null };
- }
- }
- else {
- // check parent elements
- while (!result && currElement._parent) {
- var /** @type {?} */ prevElement = currElement;
- currElement = currElement._parent;
- if (prevElement._isViewRoot) {
- currEager = false;
- }
- result = currElement._getLocalDependency(ProviderAstType.PublicService, dep, currEager);
- }
- // check @Host restriction
- if (!result) {
- if (!dep.isHost || this.viewContext.component.isHost ||
- this.viewContext.component.type.reference === tokenReference(/** @type {?} */ ((dep.token))) ||
- this.viewContext.viewProviders.get(tokenReference(/** @type {?} */ ((dep.token)))) != null) {
- result = dep;
- }
- else {
- result = dep.isOptional ? result = { isValue: true, value: null } : null;
- }
- }
- }
- if (!result) {
- this.viewContext.errors.push(new ProviderError("No provider for " + tokenName((/** @type {?} */ ((dep.token)))), this._sourceSpan));
- }
- return result;
- };
- return ProviderElementContext;
- }());
- var NgModuleProviderAnalyzer = /** @class */ (function () {
- function NgModuleProviderAnalyzer(reflector, ngModule, extraProviders, sourceSpan) {
- var _this = this;
- this.reflector = reflector;
- this._transformedProviders = new Map();
- this._seenProviders = new Map();
- this._errors = [];
- this._allProviders = new Map();
- ngModule.transitiveModule.modules.forEach(function (ngModuleType) {
- var /** @type {?} */ ngModuleProvider = { token: { identifier: ngModuleType }, useClass: ngModuleType };
- _resolveProviders([ngModuleProvider], ProviderAstType.PublicService, true, sourceSpan, _this._errors, _this._allProviders);
- });
- _resolveProviders(ngModule.transitiveModule.providers.map(function (entry) { return entry.provider; }).concat(extraProviders), ProviderAstType.PublicService, false, sourceSpan, this._errors, this._allProviders);
- }
- /**
- * @return {?}
- */
- NgModuleProviderAnalyzer.prototype.parse = /**
- * @return {?}
- */
- function () {
- var _this = this;
- Array.from(this._allProviders.values()).forEach(function (provider) {
- _this._getOrCreateLocalProvider(provider.token, provider.eager);
- });
- if (this._errors.length > 0) {
- var /** @type {?} */ errorString = this._errors.join('\n');
- throw new Error("Provider parse errors:\n" + errorString);
- }
- // Note: Maps keep their insertion order.
- var /** @type {?} */ lazyProviders = [];
- var /** @type {?} */ eagerProviders = [];
- this._transformedProviders.forEach(function (provider) {
- if (provider.eager) {
- eagerProviders.push(provider);
- }
- else {
- lazyProviders.push(provider);
- }
- });
- return lazyProviders.concat(eagerProviders);
- };
- /**
- * @param {?} token
- * @param {?} eager
- * @return {?}
- */
- NgModuleProviderAnalyzer.prototype._getOrCreateLocalProvider = /**
- * @param {?} token
- * @param {?} eager
- * @return {?}
- */
- function (token, eager) {
- var _this = this;
- var /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token));
- if (!resolvedProvider) {
- return null;
- }
- var /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token));
- if (transformedProviderAst) {
- return transformedProviderAst;
- }
- if (this._seenProviders.get(tokenReference(token)) != null) {
- this._errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), resolvedProvider.sourceSpan));
- return null;
- }
- this._seenProviders.set(tokenReference(token), true);
- var /** @type {?} */ transformedProviders = resolvedProvider.providers.map(function (provider) {
- var /** @type {?} */ transformedUseValue = provider.useValue;
- var /** @type {?} */ transformedUseExisting = /** @type {?} */ ((provider.useExisting));
- var /** @type {?} */ transformedDeps = /** @type {?} */ ((undefined));
- if (provider.useExisting != null) {
- var /** @type {?} */ existingDiDep = _this._getDependency({ token: provider.useExisting }, eager, resolvedProvider.sourceSpan);
- if (existingDiDep.token != null) {
- transformedUseExisting = existingDiDep.token;
- }
- else {
- transformedUseExisting = /** @type {?} */ ((null));
- transformedUseValue = existingDiDep.value;
- }
- }
- else if (provider.useFactory) {
- var /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps;
- transformedDeps =
- deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
- }
- else if (provider.useClass) {
- var /** @type {?} */ deps = provider.deps || provider.useClass.diDeps;
- transformedDeps =
- deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
- }
- return _transformProvider(provider, {
- useExisting: transformedUseExisting,
- useValue: transformedUseValue,
- deps: transformedDeps
- });
- });
- transformedProviderAst =
- _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
- this._transformedProviders.set(tokenReference(token), transformedProviderAst);
- return transformedProviderAst;
- };
- /**
- * @param {?} dep
- * @param {?=} eager
- * @param {?=} requestorSourceSpan
- * @return {?}
- */
- NgModuleProviderAnalyzer.prototype._getDependency = /**
- * @param {?} dep
- * @param {?=} eager
- * @param {?=} requestorSourceSpan
- * @return {?}
- */
- function (dep, eager, requestorSourceSpan) {
- if (eager === void 0) { eager = false; }
- var /** @type {?} */ foundLocal = false;
- if (!dep.isSkipSelf && dep.token != null) {
- // access the injector
- if (tokenReference(dep.token) ===
- this.reflector.resolveExternalReference(Identifiers.Injector) ||
- tokenReference(dep.token) ===
- this.reflector.resolveExternalReference(Identifiers.ComponentFactoryResolver)) {
- foundLocal = true;
- // access providers
- }
- else if (this._getOrCreateLocalProvider(dep.token, eager) != null) {
- foundLocal = true;
- }
- }
- var /** @type {?} */ result = dep;
- if (dep.isSelf && !foundLocal) {
- if (dep.isOptional) {
- result = { isValue: true, value: null };
- }
- else {
- this._errors.push(new ProviderError("No provider for " + tokenName((/** @type {?} */ ((dep.token)))), requestorSourceSpan));
- }
- }
- return result;
- };
- return NgModuleProviderAnalyzer;
- }());
- /**
- * @param {?} provider
- * @param {?} __1
- * @return {?}
- */
- function _transformProvider(provider, _a) {
- var useExisting = _a.useExisting, useValue = _a.useValue, deps = _a.deps;
- return {
- token: provider.token,
- useClass: provider.useClass,
- useExisting: useExisting,
- useFactory: provider.useFactory,
- useValue: useValue,
- deps: deps,
- multi: provider.multi
- };
- }
- /**
- * @param {?} provider
- * @param {?} __1
- * @return {?}
- */
- function _transformProviderAst(provider, _a) {
- var eager = _a.eager, providers = _a.providers;
- return new ProviderAst(provider.token, provider.multiProvider, provider.eager || eager, providers, provider.providerType, provider.lifecycleHooks, provider.sourceSpan);
- }
- /**
- * @param {?} directives
- * @param {?} sourceSpan
- * @param {?} targetErrors
- * @return {?}
- */
- function _resolveProvidersFromDirectives(directives, sourceSpan, targetErrors) {
- var /** @type {?} */ providersByToken = new Map();
- directives.forEach(function (directive) {
- var /** @type {?} */ dirProvider = { token: { identifier: directive.type }, useClass: directive.type };
- _resolveProviders([dirProvider], directive.isComponent ? ProviderAstType.Component : ProviderAstType.Directive, true, sourceSpan, targetErrors, providersByToken);
- });
- // Note: directives need to be able to overwrite providers of a component!
- var /** @type {?} */ directivesWithComponentFirst = directives.filter(function (dir) { return dir.isComponent; }).concat(directives.filter(function (dir) { return !dir.isComponent; }));
- directivesWithComponentFirst.forEach(function (directive) {
- _resolveProviders(directive.providers, ProviderAstType.PublicService, false, sourceSpan, targetErrors, providersByToken);
- _resolveProviders(directive.viewProviders, ProviderAstType.PrivateService, false, sourceSpan, targetErrors, providersByToken);
- });
- return providersByToken;
- }
- /**
- * @param {?} providers
- * @param {?} providerType
- * @param {?} eager
- * @param {?} sourceSpan
- * @param {?} targetErrors
- * @param {?} targetProvidersByToken
- * @return {?}
- */
- function _resolveProviders(providers, providerType, eager, sourceSpan, targetErrors, targetProvidersByToken) {
- providers.forEach(function (provider) {
- var /** @type {?} */ resolvedProvider = targetProvidersByToken.get(tokenReference(provider.token));
- if (resolvedProvider != null && !!resolvedProvider.multiProvider !== !!provider.multi) {
- targetErrors.push(new ProviderError("Mixing multi and non multi provider is not possible for token " + tokenName(resolvedProvider.token), sourceSpan));
- }
- if (!resolvedProvider) {
- var /** @type {?} */ lifecycleHooks = provider.token.identifier &&
- (/** @type {?} */ (provider.token.identifier)).lifecycleHooks ?
- (/** @type {?} */ (provider.token.identifier)).lifecycleHooks :
- [];
- var /** @type {?} */ isUseValue = !(provider.useClass || provider.useExisting || provider.useFactory);
- resolvedProvider = new ProviderAst(provider.token, !!provider.multi, eager || isUseValue, [provider], providerType, lifecycleHooks, sourceSpan);
- targetProvidersByToken.set(tokenReference(provider.token), resolvedProvider);
- }
- else {
- if (!provider.multi) {
- resolvedProvider.providers.length = 0;
- }
- resolvedProvider.providers.push(provider);
- }
- });
- }
- /**
- * @param {?} component
- * @return {?}
- */
- function _getViewQueries(component) {
- // Note: queries start with id 1 so we can use the number in a Bloom filter!
- var /** @type {?} */ viewQueryId = 1;
- var /** @type {?} */ viewQueries = new Map();
- if (component.viewQueries) {
- component.viewQueries.forEach(function (query) { return _addQueryToTokenMap(viewQueries, { meta: query, queryId: viewQueryId++ }); });
- }
- return viewQueries;
- }
- /**
- * @param {?} contentQueryStartId
- * @param {?} directives
- * @return {?}
- */
- function _getContentQueries(contentQueryStartId, directives) {
- var /** @type {?} */ contentQueryId = contentQueryStartId;
- var /** @type {?} */ contentQueries = new Map();
- directives.forEach(function (directive, directiveIndex) {
- if (directive.queries) {
- directive.queries.forEach(function (query) { return _addQueryToTokenMap(contentQueries, { meta: query, queryId: contentQueryId++ }); });
- }
- });
- return contentQueries;
- }
- /**
- * @param {?} map
- * @param {?} query
- * @return {?}
- */
- function _addQueryToTokenMap(map, query) {
- query.meta.selectors.forEach(function (token) {
- var /** @type {?} */ entry = map.get(tokenReference(token));
- if (!entry) {
- entry = [];
- map.set(tokenReference(token), entry);
- }
- entry.push(query);
- });
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var QUOTED_KEYS = '$quoted$';
- /**
- * @param {?} ctx
- * @param {?} value
- * @param {?=} type
- * @return {?}
- */
- function convertValueToOutputAst(ctx, value, type) {
- if (type === void 0) { type = null; }
- return visitValue(value, new _ValueOutputAstTransformer(ctx), type);
- }
- var _ValueOutputAstTransformer = /** @class */ (function () {
- function _ValueOutputAstTransformer(ctx) {
- this.ctx = ctx;
- }
- /**
- * @param {?} arr
- * @param {?} type
- * @return {?}
- */
- _ValueOutputAstTransformer.prototype.visitArray = /**
- * @param {?} arr
- * @param {?} type
- * @return {?}
- */
- function (arr, type) {
- var _this = this;
- return literalArr(arr.map(function (value) { return visitValue(value, _this, null); }), type);
- };
- /**
- * @param {?} map
- * @param {?} type
- * @return {?}
- */
- _ValueOutputAstTransformer.prototype.visitStringMap = /**
- * @param {?} map
- * @param {?} type
- * @return {?}
- */
- function (map, type) {
- var _this = this;
- var /** @type {?} */ entries = [];
- var /** @type {?} */ quotedSet = new Set(map && map[QUOTED_KEYS]);
- Object.keys(map).forEach(function (key) {
- entries.push(new LiteralMapEntry(key, visitValue(map[key], _this, null), quotedSet.has(key)));
- });
- return new LiteralMapExpr(entries, type);
- };
- /**
- * @param {?} value
- * @param {?} type
- * @return {?}
- */
- _ValueOutputAstTransformer.prototype.visitPrimitive = /**
- * @param {?} value
- * @param {?} type
- * @return {?}
- */
- function (value, type) { return literal(value, type); };
- /**
- * @param {?} value
- * @param {?} type
- * @return {?}
- */
- _ValueOutputAstTransformer.prototype.visitOther = /**
- * @param {?} value
- * @param {?} type
- * @return {?}
- */
- function (value, type) {
- if (value instanceof Expression) {
- return value;
- }
- else {
- return this.ctx.importExpr(value);
- }
- };
- return _ValueOutputAstTransformer;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} ctx
- * @param {?} providerAst
- * @return {?}
- */
- function providerDef(ctx, providerAst) {
- var /** @type {?} */ flags = 0;
- if (!providerAst.eager) {
- flags |= 4096 /* LazyProvider */;
- }
- if (providerAst.providerType === ProviderAstType.PrivateService) {
- flags |= 8192 /* PrivateProvider */;
- }
- providerAst.lifecycleHooks.forEach(function (lifecycleHook) {
- // for regular providers, we only support ngOnDestroy
- if (lifecycleHook === LifecycleHooks.OnDestroy ||
- providerAst.providerType === ProviderAstType.Directive ||
- providerAst.providerType === ProviderAstType.Component) {
- flags |= lifecycleHookToNodeFlag(lifecycleHook);
- }
- });
- var _a = providerAst.multiProvider ?
- multiProviderDef(ctx, flags, providerAst.providers) :
- singleProviderDef(ctx, flags, providerAst.providerType, providerAst.providers[0]), providerExpr = _a.providerExpr, providerFlags = _a.flags, depsExpr = _a.depsExpr;
- return {
- providerExpr: providerExpr,
- flags: providerFlags, depsExpr: depsExpr,
- tokenExpr: tokenExpr(ctx, providerAst.token),
- };
- }
- /**
- * @param {?} ctx
- * @param {?} flags
- * @param {?} providers
- * @return {?}
- */
- function multiProviderDef(ctx, flags, providers) {
- var /** @type {?} */ allDepDefs = [];
- var /** @type {?} */ allParams = [];
- var /** @type {?} */ exprs = providers.map(function (provider, providerIndex) {
- var /** @type {?} */ expr;
- if (provider.useClass) {
- var /** @type {?} */ depExprs = convertDeps(providerIndex, provider.deps || provider.useClass.diDeps);
- expr = ctx.importExpr(provider.useClass.reference).instantiate(depExprs);
- }
- else if (provider.useFactory) {
- var /** @type {?} */ depExprs = convertDeps(providerIndex, provider.deps || provider.useFactory.diDeps);
- expr = ctx.importExpr(provider.useFactory.reference).callFn(depExprs);
- }
- else if (provider.useExisting) {
- var /** @type {?} */ depExprs = convertDeps(providerIndex, [{ token: provider.useExisting }]);
- expr = depExprs[0];
- }
- else {
- expr = convertValueToOutputAst(ctx, provider.useValue);
- }
- return expr;
- });
- var /** @type {?} */ providerExpr = fn(allParams, [new ReturnStatement(literalArr(exprs))], INFERRED_TYPE);
- return {
- providerExpr: providerExpr,
- flags: flags | 1024 /* TypeFactoryProvider */,
- depsExpr: literalArr(allDepDefs)
- };
- /**
- * @param {?} providerIndex
- * @param {?} deps
- * @return {?}
- */
- function convertDeps(providerIndex, deps) {
- return deps.map(function (dep, depIndex) {
- var /** @type {?} */ paramName = "p" + providerIndex + "_" + depIndex;
- allParams.push(new FnParam(paramName, DYNAMIC_TYPE));
- allDepDefs.push(depDef(ctx, dep));
- return variable(paramName);
- });
- }
- }
- /**
- * @param {?} ctx
- * @param {?} flags
- * @param {?} providerType
- * @param {?} providerMeta
- * @return {?}
- */
- function singleProviderDef(ctx, flags, providerType, providerMeta) {
- var /** @type {?} */ providerExpr;
- var /** @type {?} */ deps;
- if (providerType === ProviderAstType.Directive || providerType === ProviderAstType.Component) {
- providerExpr = ctx.importExpr(/** @type {?} */ ((providerMeta.useClass)).reference);
- flags |= 16384 /* TypeDirective */;
- deps = providerMeta.deps || /** @type {?} */ ((providerMeta.useClass)).diDeps;
- }
- else {
- if (providerMeta.useClass) {
- providerExpr = ctx.importExpr(providerMeta.useClass.reference);
- flags |= 512 /* TypeClassProvider */;
- deps = providerMeta.deps || providerMeta.useClass.diDeps;
- }
- else if (providerMeta.useFactory) {
- providerExpr = ctx.importExpr(providerMeta.useFactory.reference);
- flags |= 1024 /* TypeFactoryProvider */;
- deps = providerMeta.deps || providerMeta.useFactory.diDeps;
- }
- else if (providerMeta.useExisting) {
- providerExpr = NULL_EXPR;
- flags |= 2048 /* TypeUseExistingProvider */;
- deps = [{ token: providerMeta.useExisting }];
- }
- else {
- providerExpr = convertValueToOutputAst(ctx, providerMeta.useValue);
- flags |= 256 /* TypeValueProvider */;
- deps = [];
- }
- }
- var /** @type {?} */ depsExpr = literalArr(deps.map(function (dep) { return depDef(ctx, dep); }));
- return { providerExpr: providerExpr, flags: flags, depsExpr: depsExpr };
- }
- /**
- * @param {?} ctx
- * @param {?} tokenMeta
- * @return {?}
- */
- function tokenExpr(ctx, tokenMeta) {
- return tokenMeta.identifier ? ctx.importExpr(tokenMeta.identifier.reference) :
- literal(tokenMeta.value);
- }
- /**
- * @param {?} ctx
- * @param {?} dep
- * @return {?}
- */
- function depDef(ctx, dep) {
- // Note: the following fields have already been normalized out by provider_analyzer:
- // - isAttribute, isSelf, isHost
- var /** @type {?} */ expr = dep.isValue ? convertValueToOutputAst(ctx, dep.value) : tokenExpr(ctx, /** @type {?} */ ((dep.token)));
- var /** @type {?} */ flags = 0;
- if (dep.isSkipSelf) {
- flags |= 1 /* SkipSelf */;
- }
- if (dep.isOptional) {
- flags |= 2 /* Optional */;
- }
- if (dep.isValue) {
- flags |= 8 /* Value */;
- }
- return flags === 0 /* None */ ? expr : literalArr([literal(flags), expr]);
- }
- /**
- * @param {?} lifecycleHook
- * @return {?}
- */
- function lifecycleHookToNodeFlag(lifecycleHook) {
- var /** @type {?} */ nodeFlag = 0;
- switch (lifecycleHook) {
- case LifecycleHooks.AfterContentChecked:
- nodeFlag = 2097152 /* AfterContentChecked */;
- break;
- case LifecycleHooks.AfterContentInit:
- nodeFlag = 1048576 /* AfterContentInit */;
- break;
- case LifecycleHooks.AfterViewChecked:
- nodeFlag = 8388608 /* AfterViewChecked */;
- break;
- case LifecycleHooks.AfterViewInit:
- nodeFlag = 4194304 /* AfterViewInit */;
- break;
- case LifecycleHooks.DoCheck:
- nodeFlag = 262144 /* DoCheck */;
- break;
- case LifecycleHooks.OnChanges:
- nodeFlag = 524288 /* OnChanges */;
- break;
- case LifecycleHooks.OnDestroy:
- nodeFlag = 131072 /* OnDestroy */;
- break;
- case LifecycleHooks.OnInit:
- nodeFlag = 65536 /* OnInit */;
- break;
- }
- return nodeFlag;
- }
- /**
- * @param {?} reflector
- * @param {?} ctx
- * @param {?} flags
- * @param {?} entryComponents
- * @return {?}
- */
- function componentFactoryResolverProviderDef(reflector, ctx, flags, entryComponents) {
- var /** @type {?} */ entryComponentFactories = entryComponents.map(function (entryComponent) { return ctx.importExpr(entryComponent.componentFactory); });
- var /** @type {?} */ token = createTokenForExternalReference(reflector, Identifiers.ComponentFactoryResolver);
- var /** @type {?} */ classMeta = {
- diDeps: [
- { isValue: true, value: literalArr(entryComponentFactories) },
- { token: token, isSkipSelf: true, isOptional: true },
- { token: createTokenForExternalReference(reflector, Identifiers.NgModuleRef) },
- ],
- lifecycleHooks: [],
- reference: reflector.resolveExternalReference(Identifiers.CodegenComponentFactoryResolver)
- };
- var _a = singleProviderDef(ctx, flags, ProviderAstType.PrivateService, {
- token: token,
- multi: false,
- useClass: classMeta,
- }), providerExpr = _a.providerExpr, providerFlags = _a.flags, depsExpr = _a.depsExpr;
- return { providerExpr: providerExpr, flags: providerFlags, depsExpr: depsExpr, tokenExpr: tokenExpr(ctx, token) };
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var NgModuleCompileResult = /** @class */ (function () {
- function NgModuleCompileResult(ngModuleFactoryVar) {
- this.ngModuleFactoryVar = ngModuleFactoryVar;
- }
- return NgModuleCompileResult;
- }());
- var LOG_VAR = variable('_l');
- var NgModuleCompiler = /** @class */ (function () {
- function NgModuleCompiler(reflector) {
- this.reflector = reflector;
- }
- /**
- * @param {?} ctx
- * @param {?} ngModuleMeta
- * @param {?} extraProviders
- * @return {?}
- */
- NgModuleCompiler.prototype.compile = /**
- * @param {?} ctx
- * @param {?} ngModuleMeta
- * @param {?} extraProviders
- * @return {?}
- */
- function (ctx, ngModuleMeta, extraProviders) {
- var /** @type {?} */ sourceSpan = typeSourceSpan('NgModule', ngModuleMeta.type);
- var /** @type {?} */ entryComponentFactories = ngModuleMeta.transitiveModule.entryComponents;
- var /** @type {?} */ bootstrapComponents = ngModuleMeta.bootstrapComponents;
- var /** @type {?} */ providerParser = new NgModuleProviderAnalyzer(this.reflector, ngModuleMeta, extraProviders, sourceSpan);
- var /** @type {?} */ providerDefs = [componentFactoryResolverProviderDef(this.reflector, ctx, 0 /* None */, entryComponentFactories)]
- .concat(providerParser.parse().map(function (provider) { return providerDef(ctx, provider); }))
- .map(function (_a) {
- var providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, flags = _a.flags, tokenExpr = _a.tokenExpr;
- return importExpr(Identifiers.moduleProviderDef).callFn([
- literal(flags), tokenExpr, providerExpr, depsExpr
- ]);
- });
- var /** @type {?} */ ngModuleDef = importExpr(Identifiers.moduleDef).callFn([literalArr(providerDefs)]);
- var /** @type {?} */ ngModuleDefFactory = fn([new FnParam(/** @type {?} */ ((LOG_VAR.name)))], [new ReturnStatement(ngModuleDef)], INFERRED_TYPE);
- var /** @type {?} */ ngModuleFactoryVar = identifierName(ngModuleMeta.type) + "NgFactory";
- this._createNgModuleFactory(ctx, ngModuleMeta.type.reference, importExpr(Identifiers.createModuleFactory).callFn([
- ctx.importExpr(ngModuleMeta.type.reference),
- literalArr(bootstrapComponents.map(function (id) { return ctx.importExpr(id.reference); })),
- ngModuleDefFactory
- ]));
- if (ngModuleMeta.id) {
- var /** @type {?} */ registerFactoryStmt = importExpr(Identifiers.RegisterModuleFactoryFn)
- .callFn([literal(ngModuleMeta.id), variable(ngModuleFactoryVar)])
- .toStmt();
- ctx.statements.push(registerFactoryStmt);
- }
- return new NgModuleCompileResult(ngModuleFactoryVar);
- };
- /**
- * @param {?} ctx
- * @param {?} ngModuleReference
- * @return {?}
- */
- NgModuleCompiler.prototype.createStub = /**
- * @param {?} ctx
- * @param {?} ngModuleReference
- * @return {?}
- */
- function (ctx, ngModuleReference) {
- this._createNgModuleFactory(ctx, ngModuleReference, NULL_EXPR);
- };
- /**
- * @param {?} ctx
- * @param {?} reference
- * @param {?} value
- * @return {?}
- */
- NgModuleCompiler.prototype._createNgModuleFactory = /**
- * @param {?} ctx
- * @param {?} reference
- * @param {?} value
- * @return {?}
- */
- function (ctx, reference, value) {
- var /** @type {?} */ ngModuleFactoryVar = identifierName({ reference: reference }) + "NgFactory";
- var /** @type {?} */ ngModuleFactoryStmt = variable(ngModuleFactoryVar)
- .set(value)
- .toDeclStmt(importType(Identifiers.NgModuleFactory, [/** @type {?} */ ((expressionType(ctx.importExpr(reference))))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]);
- ctx.statements.push(ngModuleFactoryStmt);
- };
- return NgModuleCompiler;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Resolves types to {\@link NgModule}.
- */
- var NgModuleResolver = /** @class */ (function () {
- function NgModuleResolver(_reflector) {
- this._reflector = _reflector;
- }
- /**
- * @param {?} type
- * @return {?}
- */
- NgModuleResolver.prototype.isNgModule = /**
- * @param {?} type
- * @return {?}
- */
- function (type) { return this._reflector.annotations(type).some(createNgModule.isTypeOf); };
- /**
- * @param {?} type
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- NgModuleResolver.prototype.resolve = /**
- * @param {?} type
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- function (type, throwIfNotFound) {
- if (throwIfNotFound === void 0) { throwIfNotFound = true; }
- var /** @type {?} */ ngModuleMeta = findLast(this._reflector.annotations(type), createNgModule.isTypeOf);
- if (ngModuleMeta) {
- return ngModuleMeta;
- }
- else {
- if (throwIfNotFound) {
- throw new Error("No NgModule metadata found for '" + stringify(type) + "'.");
- }
- return null;
- }
- };
- return NgModuleResolver;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
- var VERSION$1 = 3;
- var JS_B64_PREFIX = '# sourceMappingURL=data:application/json;base64,';
- var SourceMapGenerator = /** @class */ (function () {
- function SourceMapGenerator(file) {
- if (file === void 0) { file = null; }
- this.file = file;
- this.sourcesContent = new Map();
- this.lines = [];
- this.lastCol0 = 0;
- this.hasMappings = false;
- }
- // The content is `null` when the content is expected to be loaded using the URL
- /**
- * @param {?} url
- * @param {?=} content
- * @return {?}
- */
- SourceMapGenerator.prototype.addSource = /**
- * @param {?} url
- * @param {?=} content
- * @return {?}
- */
- function (url, content) {
- if (content === void 0) { content = null; }
- if (!this.sourcesContent.has(url)) {
- this.sourcesContent.set(url, content);
- }
- return this;
- };
- /**
- * @return {?}
- */
- SourceMapGenerator.prototype.addLine = /**
- * @return {?}
- */
- function () {
- this.lines.push([]);
- this.lastCol0 = 0;
- return this;
- };
- /**
- * @param {?} col0
- * @param {?=} sourceUrl
- * @param {?=} sourceLine0
- * @param {?=} sourceCol0
- * @return {?}
- */
- SourceMapGenerator.prototype.addMapping = /**
- * @param {?} col0
- * @param {?=} sourceUrl
- * @param {?=} sourceLine0
- * @param {?=} sourceCol0
- * @return {?}
- */
- function (col0, sourceUrl, sourceLine0, sourceCol0) {
- if (!this.currentLine) {
- throw new Error("A line must be added before mappings can be added");
- }
- if (sourceUrl != null && !this.sourcesContent.has(sourceUrl)) {
- throw new Error("Unknown source file \"" + sourceUrl + "\"");
- }
- if (col0 == null) {
- throw new Error("The column in the generated code must be provided");
- }
- if (col0 < this.lastCol0) {
- throw new Error("Mapping should be added in output order");
- }
- if (sourceUrl && (sourceLine0 == null || sourceCol0 == null)) {
- throw new Error("The source location must be provided when a source url is provided");
- }
- this.hasMappings = true;
- this.lastCol0 = col0;
- this.currentLine.push({ col0: col0, sourceUrl: sourceUrl, sourceLine0: sourceLine0, sourceCol0: sourceCol0 });
- return this;
- };
- Object.defineProperty(SourceMapGenerator.prototype, "currentLine", {
- get: /**
- * @return {?}
- */
- function () { return this.lines.slice(-1)[0]; },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- SourceMapGenerator.prototype.toJSON = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (!this.hasMappings) {
- return null;
- }
- var /** @type {?} */ sourcesIndex = new Map();
- var /** @type {?} */ sources = [];
- var /** @type {?} */ sourcesContent = [];
- Array.from(this.sourcesContent.keys()).forEach(function (url, i) {
- sourcesIndex.set(url, i);
- sources.push(url);
- sourcesContent.push(_this.sourcesContent.get(url) || null);
- });
- var /** @type {?} */ mappings = '';
- var /** @type {?} */ lastCol0 = 0;
- var /** @type {?} */ lastSourceIndex = 0;
- var /** @type {?} */ lastSourceLine0 = 0;
- var /** @type {?} */ lastSourceCol0 = 0;
- this.lines.forEach(function (segments) {
- lastCol0 = 0;
- mappings += segments
- .map(function (segment) {
- // zero-based starting column of the line in the generated code
- var /** @type {?} */ segAsStr = toBase64VLQ(segment.col0 - lastCol0);
- lastCol0 = segment.col0;
- if (segment.sourceUrl != null) {
- // zero-based index into the “sources” list
- segAsStr +=
- toBase64VLQ(/** @type {?} */ ((sourcesIndex.get(segment.sourceUrl))) - lastSourceIndex);
- lastSourceIndex = /** @type {?} */ ((sourcesIndex.get(segment.sourceUrl)));
- // the zero-based starting line in the original source
- segAsStr += toBase64VLQ(/** @type {?} */ ((segment.sourceLine0)) - lastSourceLine0);
- lastSourceLine0 = /** @type {?} */ ((segment.sourceLine0));
- // the zero-based starting column in the original source
- segAsStr += toBase64VLQ(/** @type {?} */ ((segment.sourceCol0)) - lastSourceCol0);
- lastSourceCol0 = /** @type {?} */ ((segment.sourceCol0));
- }
- return segAsStr;
- })
- .join(',');
- mappings += ';';
- });
- mappings = mappings.slice(0, -1);
- return {
- 'file': this.file || '',
- 'version': VERSION$1,
- 'sourceRoot': '',
- 'sources': sources,
- 'sourcesContent': sourcesContent,
- 'mappings': mappings,
- };
- };
- /**
- * @return {?}
- */
- SourceMapGenerator.prototype.toJsComment = /**
- * @return {?}
- */
- function () {
- return this.hasMappings ? '//' + JS_B64_PREFIX + toBase64String(JSON.stringify(this, null, 0)) :
- '';
- };
- return SourceMapGenerator;
- }());
- /**
- * @param {?} value
- * @return {?}
- */
- function toBase64String(value) {
- var /** @type {?} */ b64 = '';
- value = utf8Encode(value);
- for (var /** @type {?} */ i = 0; i < value.length;) {
- var /** @type {?} */ i1 = value.charCodeAt(i++);
- var /** @type {?} */ i2 = value.charCodeAt(i++);
- var /** @type {?} */ i3 = value.charCodeAt(i++);
- b64 += toBase64Digit(i1 >> 2);
- b64 += toBase64Digit(((i1 & 3) << 4) | (isNaN(i2) ? 0 : i2 >> 4));
- b64 += isNaN(i2) ? '=' : toBase64Digit(((i2 & 15) << 2) | (i3 >> 6));
- b64 += isNaN(i2) || isNaN(i3) ? '=' : toBase64Digit(i3 & 63);
- }
- return b64;
- }
- /**
- * @param {?} value
- * @return {?}
- */
- function toBase64VLQ(value) {
- value = value < 0 ? ((-value) << 1) + 1 : value << 1;
- var /** @type {?} */ out = '';
- do {
- var /** @type {?} */ digit = value & 31;
- value = value >> 5;
- if (value > 0) {
- digit = digit | 32;
- }
- out += toBase64Digit(digit);
- } while (value > 0);
- return out;
- }
- var B64_DIGITS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
- /**
- * @param {?} value
- * @return {?}
- */
- function toBase64Digit(value) {
- if (value < 0 || value >= 64) {
- throw new Error("Can only encode value in the range [0, 63]");
- }
- return B64_DIGITS[value];
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g;
- var _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;
- var _INDENT_WITH = ' ';
- var CATCH_ERROR_VAR$1 = variable('error', null, null);
- var CATCH_STACK_VAR$1 = variable('stack', null, null);
- /**
- * @record
- */
- var _EmittedLine = /** @class */ (function () {
- function _EmittedLine(indent) {
- this.indent = indent;
- this.partsLength = 0;
- this.parts = [];
- this.srcSpans = [];
- }
- return _EmittedLine;
- }());
- var EmitterVisitorContext = /** @class */ (function () {
- function EmitterVisitorContext(_indent) {
- this._indent = _indent;
- this._classes = [];
- this._preambleLineCount = 0;
- this._lines = [new _EmittedLine(_indent)];
- }
- /**
- * @return {?}
- */
- EmitterVisitorContext.createRoot = /**
- * @return {?}
- */
- function () { return new EmitterVisitorContext(0); };
- Object.defineProperty(EmitterVisitorContext.prototype, "_currentLine", {
- get: /**
- * @return {?}
- */
- function () { return this._lines[this._lines.length - 1]; },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?=} from
- * @param {?=} lastPart
- * @return {?}
- */
- EmitterVisitorContext.prototype.println = /**
- * @param {?=} from
- * @param {?=} lastPart
- * @return {?}
- */
- function (from, lastPart) {
- if (lastPart === void 0) { lastPart = ''; }
- this.print(from || null, lastPart, true);
- };
- /**
- * @return {?}
- */
- EmitterVisitorContext.prototype.lineIsEmpty = /**
- * @return {?}
- */
- function () { return this._currentLine.parts.length === 0; };
- /**
- * @return {?}
- */
- EmitterVisitorContext.prototype.lineLength = /**
- * @return {?}
- */
- function () {
- return this._currentLine.indent * _INDENT_WITH.length + this._currentLine.partsLength;
- };
- /**
- * @param {?} from
- * @param {?} part
- * @param {?=} newLine
- * @return {?}
- */
- EmitterVisitorContext.prototype.print = /**
- * @param {?} from
- * @param {?} part
- * @param {?=} newLine
- * @return {?}
- */
- function (from, part, newLine) {
- if (newLine === void 0) { newLine = false; }
- if (part.length > 0) {
- this._currentLine.parts.push(part);
- this._currentLine.partsLength += part.length;
- this._currentLine.srcSpans.push(from && from.sourceSpan || null);
- }
- if (newLine) {
- this._lines.push(new _EmittedLine(this._indent));
- }
- };
- /**
- * @return {?}
- */
- EmitterVisitorContext.prototype.removeEmptyLastLine = /**
- * @return {?}
- */
- function () {
- if (this.lineIsEmpty()) {
- this._lines.pop();
- }
- };
- /**
- * @return {?}
- */
- EmitterVisitorContext.prototype.incIndent = /**
- * @return {?}
- */
- function () {
- this._indent++;
- if (this.lineIsEmpty()) {
- this._currentLine.indent = this._indent;
- }
- };
- /**
- * @return {?}
- */
- EmitterVisitorContext.prototype.decIndent = /**
- * @return {?}
- */
- function () {
- this._indent--;
- if (this.lineIsEmpty()) {
- this._currentLine.indent = this._indent;
- }
- };
- /**
- * @param {?} clazz
- * @return {?}
- */
- EmitterVisitorContext.prototype.pushClass = /**
- * @param {?} clazz
- * @return {?}
- */
- function (clazz) { this._classes.push(clazz); };
- /**
- * @return {?}
- */
- EmitterVisitorContext.prototype.popClass = /**
- * @return {?}
- */
- function () { return /** @type {?} */ ((this._classes.pop())); };
- Object.defineProperty(EmitterVisitorContext.prototype, "currentClass", {
- get: /**
- * @return {?}
- */
- function () {
- return this._classes.length > 0 ? this._classes[this._classes.length - 1] : null;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- EmitterVisitorContext.prototype.toSource = /**
- * @return {?}
- */
- function () {
- return this.sourceLines
- .map(function (l) { return l.parts.length > 0 ? _createIndent(l.indent) + l.parts.join('') : ''; })
- .join('\n');
- };
- /**
- * @param {?} genFilePath
- * @param {?=} startsAtLine
- * @return {?}
- */
- EmitterVisitorContext.prototype.toSourceMapGenerator = /**
- * @param {?} genFilePath
- * @param {?=} startsAtLine
- * @return {?}
- */
- function (genFilePath, startsAtLine) {
- if (startsAtLine === void 0) { startsAtLine = 0; }
- var /** @type {?} */ map = new SourceMapGenerator(genFilePath);
- var /** @type {?} */ firstOffsetMapped = false;
- var /** @type {?} */ mapFirstOffsetIfNeeded = function () {
- if (!firstOffsetMapped) {
- // Add a single space so that tools won't try to load the file from disk.
- // Note: We are using virtual urls like `ng:///`, so we have to
- // provide a content here.
- map.addSource(genFilePath, ' ').addMapping(0, genFilePath, 0, 0);
- firstOffsetMapped = true;
- }
- };
- for (var /** @type {?} */ i = 0; i < startsAtLine; i++) {
- map.addLine();
- mapFirstOffsetIfNeeded();
- }
- this.sourceLines.forEach(function (line, lineIdx) {
- map.addLine();
- var /** @type {?} */ spans = line.srcSpans;
- var /** @type {?} */ parts = line.parts;
- var /** @type {?} */ col0 = line.indent * _INDENT_WITH.length;
- var /** @type {?} */ spanIdx = 0;
- // skip leading parts without source spans
- while (spanIdx < spans.length && !spans[spanIdx]) {
- col0 += parts[spanIdx].length;
- spanIdx++;
- }
- if (spanIdx < spans.length && lineIdx === 0 && col0 === 0) {
- firstOffsetMapped = true;
- }
- else {
- mapFirstOffsetIfNeeded();
- }
- while (spanIdx < spans.length) {
- var /** @type {?} */ span = /** @type {?} */ ((spans[spanIdx]));
- var /** @type {?} */ source = span.start.file;
- var /** @type {?} */ sourceLine = span.start.line;
- var /** @type {?} */ sourceCol = span.start.col;
- map.addSource(source.url, source.content)
- .addMapping(col0, source.url, sourceLine, sourceCol);
- col0 += parts[spanIdx].length;
- spanIdx++;
- // assign parts without span or the same span to the previous segment
- while (spanIdx < spans.length && (span === spans[spanIdx] || !spans[spanIdx])) {
- col0 += parts[spanIdx].length;
- spanIdx++;
- }
- }
- });
- return map;
- };
- /**
- * @param {?} count
- * @return {?}
- */
- EmitterVisitorContext.prototype.setPreambleLineCount = /**
- * @param {?} count
- * @return {?}
- */
- function (count) { return this._preambleLineCount = count; };
- /**
- * @param {?} line
- * @param {?} column
- * @return {?}
- */
- EmitterVisitorContext.prototype.spanOf = /**
- * @param {?} line
- * @param {?} column
- * @return {?}
- */
- function (line, column) {
- var /** @type {?} */ emittedLine = this._lines[line - this._preambleLineCount];
- if (emittedLine) {
- var /** @type {?} */ columnsLeft = column - _createIndent(emittedLine.indent).length;
- for (var /** @type {?} */ partIndex = 0; partIndex < emittedLine.parts.length; partIndex++) {
- var /** @type {?} */ part = emittedLine.parts[partIndex];
- if (part.length > columnsLeft) {
- return emittedLine.srcSpans[partIndex];
- }
- columnsLeft -= part.length;
- }
- }
- return null;
- };
- Object.defineProperty(EmitterVisitorContext.prototype, "sourceLines", {
- get: /**
- * @return {?}
- */
- function () {
- if (this._lines.length && this._lines[this._lines.length - 1].parts.length === 0) {
- return this._lines.slice(0, -1);
- }
- return this._lines;
- },
- enumerable: true,
- configurable: true
- });
- return EmitterVisitorContext;
- }());
- /**
- * @abstract
- */
- var AbstractEmitterVisitor = /** @class */ (function () {
- function AbstractEmitterVisitor(_escapeDollarInStrings) {
- this._escapeDollarInStrings = _escapeDollarInStrings;
- }
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitExpressionStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- stmt.expr.visitExpression(this, ctx);
- ctx.println(stmt, ';');
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitReturnStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.print(stmt, "return ");
- stmt.value.visitExpression(this, ctx);
- ctx.println(stmt, ';');
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitIfStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.print(stmt, "if (");
- stmt.condition.visitExpression(this, ctx);
- ctx.print(stmt, ") {");
- var /** @type {?} */ hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
- if (stmt.trueCase.length <= 1 && !hasElseCase) {
- ctx.print(stmt, " ");
- this.visitAllStatements(stmt.trueCase, ctx);
- ctx.removeEmptyLastLine();
- ctx.print(stmt, " ");
- }
- else {
- ctx.println();
- ctx.incIndent();
- this.visitAllStatements(stmt.trueCase, ctx);
- ctx.decIndent();
- if (hasElseCase) {
- ctx.println(stmt, "} else {");
- ctx.incIndent();
- this.visitAllStatements(stmt.falseCase, ctx);
- ctx.decIndent();
- }
- }
- ctx.println(stmt, "}");
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitThrowStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.print(stmt, "throw ");
- stmt.error.visitExpression(this, ctx);
- ctx.println(stmt, ";");
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitCommentStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- var /** @type {?} */ lines = stmt.comment.split('\n');
- lines.forEach(function (line) { ctx.println(stmt, "// " + line); });
- return null;
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitWriteVarExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- var /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty();
- if (!lineWasEmpty) {
- ctx.print(expr, '(');
- }
- ctx.print(expr, expr.name + " = ");
- expr.value.visitExpression(this, ctx);
- if (!lineWasEmpty) {
- ctx.print(expr, ')');
- }
- return null;
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitWriteKeyExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- var /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty();
- if (!lineWasEmpty) {
- ctx.print(expr, '(');
- }
- expr.receiver.visitExpression(this, ctx);
- ctx.print(expr, "[");
- expr.index.visitExpression(this, ctx);
- ctx.print(expr, "] = ");
- expr.value.visitExpression(this, ctx);
- if (!lineWasEmpty) {
- ctx.print(expr, ')');
- }
- return null;
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitWritePropExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- var /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty();
- if (!lineWasEmpty) {
- ctx.print(expr, '(');
- }
- expr.receiver.visitExpression(this, ctx);
- ctx.print(expr, "." + expr.name + " = ");
- expr.value.visitExpression(this, ctx);
- if (!lineWasEmpty) {
- ctx.print(expr, ')');
- }
- return null;
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitInvokeMethodExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- expr.receiver.visitExpression(this, ctx);
- var /** @type {?} */ name = expr.name;
- if (expr.builtin != null) {
- name = this.getBuiltinMethodName(expr.builtin);
- if (name == null) {
- // some builtins just mean to skip the call.
- return null;
- }
- }
- ctx.print(expr, "." + name + "(");
- this.visitAllExpressions(expr.args, ctx, ",");
- ctx.print(expr, ")");
- return null;
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitInvokeFunctionExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- expr.fn.visitExpression(this, ctx);
- ctx.print(expr, "(");
- this.visitAllExpressions(expr.args, ctx, ',');
- ctx.print(expr, ")");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitReadVarExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ varName = /** @type {?} */ ((ast.name));
- if (ast.builtin != null) {
- switch (ast.builtin) {
- case BuiltinVar.Super:
- varName = 'super';
- break;
- case BuiltinVar.This:
- varName = 'this';
- break;
- case BuiltinVar.CatchError:
- varName = /** @type {?} */ ((CATCH_ERROR_VAR$1.name));
- break;
- case BuiltinVar.CatchStack:
- varName = /** @type {?} */ ((CATCH_STACK_VAR$1.name));
- break;
- default:
- throw new Error("Unknown builtin variable " + ast.builtin);
- }
- }
- ctx.print(ast, varName);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitInstantiateExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ctx.print(ast, "new ");
- ast.classExpr.visitExpression(this, ctx);
- ctx.print(ast, "(");
- this.visitAllExpressions(ast.args, ctx, ',');
- ctx.print(ast, ")");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitLiteralExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ value = ast.value;
- if (typeof value === 'string') {
- ctx.print(ast, escapeIdentifier(value, this._escapeDollarInStrings));
- }
- else {
- ctx.print(ast, "" + value);
- }
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitConditionalExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ctx.print(ast, "(");
- ast.condition.visitExpression(this, ctx);
- ctx.print(ast, '? ');
- ast.trueCase.visitExpression(this, ctx);
- ctx.print(ast, ': '); /** @type {?} */
- ((ast.falseCase)).visitExpression(this, ctx);
- ctx.print(ast, ")");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitNotExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ctx.print(ast, '!');
- ast.condition.visitExpression(this, ctx);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitAssertNotNullExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ast.condition.visitExpression(this, ctx);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitBinaryOperatorExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ opStr;
- switch (ast.operator) {
- case BinaryOperator.Equals:
- opStr = '==';
- break;
- case BinaryOperator.Identical:
- opStr = '===';
- break;
- case BinaryOperator.NotEquals:
- opStr = '!=';
- break;
- case BinaryOperator.NotIdentical:
- opStr = '!==';
- break;
- case BinaryOperator.And:
- opStr = '&&';
- break;
- case BinaryOperator.Or:
- opStr = '||';
- break;
- case BinaryOperator.Plus:
- opStr = '+';
- break;
- case BinaryOperator.Minus:
- opStr = '-';
- break;
- case BinaryOperator.Divide:
- opStr = '/';
- break;
- case BinaryOperator.Multiply:
- opStr = '*';
- break;
- case BinaryOperator.Modulo:
- opStr = '%';
- break;
- case BinaryOperator.Lower:
- opStr = '<';
- break;
- case BinaryOperator.LowerEquals:
- opStr = '<=';
- break;
- case BinaryOperator.Bigger:
- opStr = '>';
- break;
- case BinaryOperator.BiggerEquals:
- opStr = '>=';
- break;
- default:
- throw new Error("Unknown operator " + ast.operator);
- }
- ctx.print(ast, "(");
- ast.lhs.visitExpression(this, ctx);
- ctx.print(ast, " " + opStr + " ");
- ast.rhs.visitExpression(this, ctx);
- ctx.print(ast, ")");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitReadPropExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ast.receiver.visitExpression(this, ctx);
- ctx.print(ast, ".");
- ctx.print(ast, ast.name);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitReadKeyExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ast.receiver.visitExpression(this, ctx);
- ctx.print(ast, "[");
- ast.index.visitExpression(this, ctx);
- ctx.print(ast, "]");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitLiteralArrayExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ctx.print(ast, "[");
- this.visitAllExpressions(ast.entries, ctx, ',');
- ctx.print(ast, "]");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitLiteralMapExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var _this = this;
- ctx.print(ast, "{");
- this.visitAllObjects(function (entry) {
- ctx.print(ast, escapeIdentifier(entry.key, _this._escapeDollarInStrings, entry.quoted) + ":");
- entry.value.visitExpression(_this, ctx);
- }, ast.entries, ctx, ',');
- ctx.print(ast, "}");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitCommaExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ctx.print(ast, '(');
- this.visitAllExpressions(ast.parts, ctx, ',');
- ctx.print(ast, ')');
- return null;
- };
- /**
- * @param {?} expressions
- * @param {?} ctx
- * @param {?} separator
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitAllExpressions = /**
- * @param {?} expressions
- * @param {?} ctx
- * @param {?} separator
- * @return {?}
- */
- function (expressions, ctx, separator) {
- var _this = this;
- this.visitAllObjects(function (expr) { return expr.visitExpression(_this, ctx); }, expressions, ctx, separator);
- };
- /**
- * @template T
- * @param {?} handler
- * @param {?} expressions
- * @param {?} ctx
- * @param {?} separator
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitAllObjects = /**
- * @template T
- * @param {?} handler
- * @param {?} expressions
- * @param {?} ctx
- * @param {?} separator
- * @return {?}
- */
- function (handler, expressions, ctx, separator) {
- var /** @type {?} */ incrementedIndent = false;
- for (var /** @type {?} */ i = 0; i < expressions.length; i++) {
- if (i > 0) {
- if (ctx.lineLength() > 80) {
- ctx.print(null, separator, true);
- if (!incrementedIndent) {
- // continuation are marked with double indent.
- ctx.incIndent();
- ctx.incIndent();
- incrementedIndent = true;
- }
- }
- else {
- ctx.print(null, separator, false);
- }
- }
- handler(expressions[i]);
- }
- if (incrementedIndent) {
- // continuation are marked with double indent.
- ctx.decIndent();
- ctx.decIndent();
- }
- };
- /**
- * @param {?} statements
- * @param {?} ctx
- * @return {?}
- */
- AbstractEmitterVisitor.prototype.visitAllStatements = /**
- * @param {?} statements
- * @param {?} ctx
- * @return {?}
- */
- function (statements, ctx) {
- var _this = this;
- statements.forEach(function (stmt) { return stmt.visitStatement(_this, ctx); });
- };
- return AbstractEmitterVisitor;
- }());
- /**
- * @param {?} input
- * @param {?} escapeDollar
- * @param {?=} alwaysQuote
- * @return {?}
- */
- function escapeIdentifier(input, escapeDollar, alwaysQuote) {
- if (alwaysQuote === void 0) { alwaysQuote = true; }
- if (input == null) {
- return null;
- }
- var /** @type {?} */ body = input.replace(_SINGLE_QUOTE_ESCAPE_STRING_RE, function () {
- var match = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- match[_i] = arguments[_i];
- }
- if (match[0] == '$') {
- return escapeDollar ? '\\$' : '$';
- }
- else if (match[0] == '\n') {
- return '\\n';
- }
- else if (match[0] == '\r') {
- return '\\r';
- }
- else {
- return "\\" + match[0];
- }
- });
- var /** @type {?} */ requiresQuotes = alwaysQuote || !_LEGAL_IDENTIFIER_RE.test(body);
- return requiresQuotes ? "'" + body + "'" : body;
- }
- /**
- * @param {?} count
- * @return {?}
- */
- function _createIndent(count) {
- var /** @type {?} */ res = '';
- for (var /** @type {?} */ i = 0; i < count; i++) {
- res += _INDENT_WITH;
- }
- return res;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} ast
- * @return {?}
- */
- function debugOutputAstAsTypeScript(ast) {
- var /** @type {?} */ converter = new _TsEmitterVisitor();
- var /** @type {?} */ ctx = EmitterVisitorContext.createRoot();
- var /** @type {?} */ asts = Array.isArray(ast) ? ast : [ast];
- asts.forEach(function (ast) {
- if (ast instanceof Statement) {
- ast.visitStatement(converter, ctx);
- }
- else if (ast instanceof Expression) {
- ast.visitExpression(converter, ctx);
- }
- else if (ast instanceof Type$1) {
- ast.visitType(converter, ctx);
- }
- else {
- throw new Error("Don't know how to print debug info for " + ast);
- }
- });
- return ctx.toSource();
- }
- var TypeScriptEmitter = /** @class */ (function () {
- function TypeScriptEmitter() {
- }
- /**
- * @param {?} genFilePath
- * @param {?} stmts
- * @param {?=} preamble
- * @param {?=} emitSourceMaps
- * @param {?=} referenceFilter
- * @return {?}
- */
- TypeScriptEmitter.prototype.emitStatementsAndContext = /**
- * @param {?} genFilePath
- * @param {?} stmts
- * @param {?=} preamble
- * @param {?=} emitSourceMaps
- * @param {?=} referenceFilter
- * @return {?}
- */
- function (genFilePath, stmts, preamble, emitSourceMaps, referenceFilter) {
- if (preamble === void 0) { preamble = ''; }
- if (emitSourceMaps === void 0) { emitSourceMaps = true; }
- var /** @type {?} */ converter = new _TsEmitterVisitor(referenceFilter);
- var /** @type {?} */ ctx = EmitterVisitorContext.createRoot();
- converter.visitAllStatements(stmts, ctx);
- var /** @type {?} */ preambleLines = preamble ? preamble.split('\n') : [];
- converter.reexports.forEach(function (reexports, exportedModuleName) {
- var /** @type {?} */ reexportsCode = reexports.map(function (reexport) { return reexport.name + " as " + reexport.as; }).join(',');
- preambleLines.push("export {" + reexportsCode + "} from '" + exportedModuleName + "';");
- });
- converter.importsWithPrefixes.forEach(function (prefix, importedModuleName) {
- // Note: can't write the real word for import as it screws up system.js auto detection...
- preambleLines.push("imp" +
- ("ort * as " + prefix + " from '" + importedModuleName + "';"));
- });
- var /** @type {?} */ sm = emitSourceMaps ?
- ctx.toSourceMapGenerator(genFilePath, preambleLines.length).toJsComment() :
- '';
- var /** @type {?} */ lines = preambleLines.concat([ctx.toSource(), sm]);
- if (sm) {
- // always add a newline at the end, as some tools have bugs without it.
- lines.push('');
- }
- ctx.setPreambleLineCount(preambleLines.length);
- return { sourceText: lines.join('\n'), context: ctx };
- };
- /**
- * @param {?} genFilePath
- * @param {?} stmts
- * @param {?=} preamble
- * @return {?}
- */
- TypeScriptEmitter.prototype.emitStatements = /**
- * @param {?} genFilePath
- * @param {?} stmts
- * @param {?=} preamble
- * @return {?}
- */
- function (genFilePath, stmts, preamble) {
- if (preamble === void 0) { preamble = ''; }
- return this.emitStatementsAndContext(genFilePath, stmts, preamble).sourceText;
- };
- return TypeScriptEmitter;
- }());
- var _TsEmitterVisitor = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_TsEmitterVisitor, _super);
- function _TsEmitterVisitor(referenceFilter) {
- var _this = _super.call(this, false) || this;
- _this.referenceFilter = referenceFilter;
- _this.typeExpression = 0;
- _this.importsWithPrefixes = new Map();
- _this.reexports = new Map();
- return _this;
- }
- /**
- * @param {?} t
- * @param {?} ctx
- * @param {?=} defaultType
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitType = /**
- * @param {?} t
- * @param {?} ctx
- * @param {?=} defaultType
- * @return {?}
- */
- function (t, ctx, defaultType) {
- if (defaultType === void 0) { defaultType = 'any'; }
- if (t) {
- this.typeExpression++;
- t.visitType(this, ctx);
- this.typeExpression--;
- }
- else {
- ctx.print(null, defaultType);
- }
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitLiteralExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ value = ast.value;
- if (value == null && ast.type != INFERRED_TYPE) {
- ctx.print(ast, "(" + value + " as any)");
- return null;
- }
- return _super.prototype.visitLiteralExpr.call(this, ast, ctx);
- };
- // Temporary workaround to support strictNullCheck enabled consumers of ngc emit.
- // In SNC mode, [] have the type never[], so we cast here to any[].
- // TODO: narrow the cast to a more explicit type, or use a pattern that does not
- // start with [].concat. see https://github.com/angular/angular/pull/11846
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitLiteralArrayExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- if (ast.entries.length === 0) {
- ctx.print(ast, '(');
- }
- var /** @type {?} */ result = _super.prototype.visitLiteralArrayExpr.call(this, ast, ctx);
- if (ast.entries.length === 0) {
- ctx.print(ast, ' as any[])');
- }
- return result;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitExternalExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- this._visitIdentifier(ast.value, ast.typeParams, ctx);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitAssertNotNullExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ result = _super.prototype.visitAssertNotNullExpr.call(this, ast, ctx);
- ctx.print(ast, '!');
- return result;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitDeclareVarStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- if (stmt.hasModifier(StmtModifier.Exported) && stmt.value instanceof ExternalExpr &&
- !stmt.type) {
- // check for a reexport
- var _a = stmt.value.value, name_1 = _a.name, moduleName = _a.moduleName;
- if (moduleName) {
- var /** @type {?} */ reexports = this.reexports.get(moduleName);
- if (!reexports) {
- reexports = [];
- this.reexports.set(moduleName, reexports);
- }
- reexports.push({ name: /** @type {?} */ ((name_1)), as: stmt.name });
- return null;
- }
- }
- if (stmt.hasModifier(StmtModifier.Exported)) {
- ctx.print(stmt, "export ");
- }
- if (stmt.hasModifier(StmtModifier.Final)) {
- ctx.print(stmt, "const");
- }
- else {
- ctx.print(stmt, "var");
- }
- ctx.print(stmt, " " + stmt.name);
- this._printColonType(stmt.type, ctx);
- ctx.print(stmt, " = ");
- stmt.value.visitExpression(this, ctx);
- ctx.println(stmt, ";");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitCastExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ctx.print(ast, "(<"); /** @type {?} */
- ((ast.type)).visitType(this, ctx);
- ctx.print(ast, ">");
- ast.value.visitExpression(this, ctx);
- ctx.print(ast, ")");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitInstantiateExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ctx.print(ast, "new ");
- this.typeExpression++;
- ast.classExpr.visitExpression(this, ctx);
- this.typeExpression--;
- ctx.print(ast, "(");
- this.visitAllExpressions(ast.args, ctx, ',');
- ctx.print(ast, ")");
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitDeclareClassStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- var _this = this;
- ctx.pushClass(stmt);
- if (stmt.hasModifier(StmtModifier.Exported)) {
- ctx.print(stmt, "export ");
- }
- ctx.print(stmt, "class " + stmt.name);
- if (stmt.parent != null) {
- ctx.print(stmt, " extends ");
- this.typeExpression++;
- stmt.parent.visitExpression(this, ctx);
- this.typeExpression--;
- }
- ctx.println(stmt, " {");
- ctx.incIndent();
- stmt.fields.forEach(function (field) { return _this._visitClassField(field, ctx); });
- if (stmt.constructorMethod != null) {
- this._visitClassConstructor(stmt, ctx);
- }
- stmt.getters.forEach(function (getter) { return _this._visitClassGetter(getter, ctx); });
- stmt.methods.forEach(function (method) { return _this._visitClassMethod(method, ctx); });
- ctx.decIndent();
- ctx.println(stmt, "}");
- ctx.popClass();
- return null;
- };
- /**
- * @param {?} field
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype._visitClassField = /**
- * @param {?} field
- * @param {?} ctx
- * @return {?}
- */
- function (field, ctx) {
- if (field.hasModifier(StmtModifier.Private)) {
- // comment out as a workaround for #10967
- ctx.print(null, "/*private*/ ");
- }
- ctx.print(null, field.name);
- this._printColonType(field.type, ctx);
- ctx.println(null, ";");
- };
- /**
- * @param {?} getter
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype._visitClassGetter = /**
- * @param {?} getter
- * @param {?} ctx
- * @return {?}
- */
- function (getter, ctx) {
- if (getter.hasModifier(StmtModifier.Private)) {
- ctx.print(null, "private ");
- }
- ctx.print(null, "get " + getter.name + "()");
- this._printColonType(getter.type, ctx);
- ctx.println(null, " {");
- ctx.incIndent();
- this.visitAllStatements(getter.body, ctx);
- ctx.decIndent();
- ctx.println(null, "}");
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype._visitClassConstructor = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.print(stmt, "constructor(");
- this._visitParams(stmt.constructorMethod.params, ctx);
- ctx.println(stmt, ") {");
- ctx.incIndent();
- this.visitAllStatements(stmt.constructorMethod.body, ctx);
- ctx.decIndent();
- ctx.println(stmt, "}");
- };
- /**
- * @param {?} method
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype._visitClassMethod = /**
- * @param {?} method
- * @param {?} ctx
- * @return {?}
- */
- function (method, ctx) {
- if (method.hasModifier(StmtModifier.Private)) {
- ctx.print(null, "private ");
- }
- ctx.print(null, method.name + "(");
- this._visitParams(method.params, ctx);
- ctx.print(null, ")");
- this._printColonType(method.type, ctx, 'void');
- ctx.println(null, " {");
- ctx.incIndent();
- this.visitAllStatements(method.body, ctx);
- ctx.decIndent();
- ctx.println(null, "}");
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitFunctionExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ctx.print(ast, "(");
- this._visitParams(ast.params, ctx);
- ctx.print(ast, ")");
- this._printColonType(ast.type, ctx, 'void');
- ctx.println(ast, " => {");
- ctx.incIndent();
- this.visitAllStatements(ast.statements, ctx);
- ctx.decIndent();
- ctx.print(ast, "}");
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitDeclareFunctionStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- if (stmt.hasModifier(StmtModifier.Exported)) {
- ctx.print(stmt, "export ");
- }
- ctx.print(stmt, "function " + stmt.name + "(");
- this._visitParams(stmt.params, ctx);
- ctx.print(stmt, ")");
- this._printColonType(stmt.type, ctx, 'void');
- ctx.println(stmt, " {");
- ctx.incIndent();
- this.visitAllStatements(stmt.statements, ctx);
- ctx.decIndent();
- ctx.println(stmt, "}");
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitTryCatchStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.println(stmt, "try {");
- ctx.incIndent();
- this.visitAllStatements(stmt.bodyStmts, ctx);
- ctx.decIndent();
- ctx.println(stmt, "} catch (" + CATCH_ERROR_VAR$1.name + ") {");
- ctx.incIndent();
- var /** @type {?} */ catchStmts = [/** @type {?} */ (CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack', null)).toDeclStmt(null, [
- StmtModifier.Final
- ]))].concat(stmt.catchStmts);
- this.visitAllStatements(catchStmts, ctx);
- ctx.decIndent();
- ctx.println(stmt, "}");
- return null;
- };
- /**
- * @param {?} type
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitBuiltintType = /**
- * @param {?} type
- * @param {?} ctx
- * @return {?}
- */
- function (type, ctx) {
- var /** @type {?} */ typeStr;
- switch (type.name) {
- case BuiltinTypeName.Bool:
- typeStr = 'boolean';
- break;
- case BuiltinTypeName.Dynamic:
- typeStr = 'any';
- break;
- case BuiltinTypeName.Function:
- typeStr = 'Function';
- break;
- case BuiltinTypeName.Number:
- typeStr = 'number';
- break;
- case BuiltinTypeName.Int:
- typeStr = 'number';
- break;
- case BuiltinTypeName.String:
- typeStr = 'string';
- break;
- default:
- throw new Error("Unsupported builtin type " + type.name);
- }
- ctx.print(null, typeStr);
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitExpressionType = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ast.value.visitExpression(this, ctx);
- return null;
- };
- /**
- * @param {?} type
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitArrayType = /**
- * @param {?} type
- * @param {?} ctx
- * @return {?}
- */
- function (type, ctx) {
- this.visitType(type.of, ctx);
- ctx.print(null, "[]");
- return null;
- };
- /**
- * @param {?} type
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype.visitMapType = /**
- * @param {?} type
- * @param {?} ctx
- * @return {?}
- */
- function (type, ctx) {
- ctx.print(null, "{[key: string]:");
- this.visitType(type.valueType, ctx);
- ctx.print(null, "}");
- return null;
- };
- /**
- * @param {?} method
- * @return {?}
- */
- _TsEmitterVisitor.prototype.getBuiltinMethodName = /**
- * @param {?} method
- * @return {?}
- */
- function (method) {
- var /** @type {?} */ name;
- switch (method) {
- case BuiltinMethod.ConcatArray:
- name = 'concat';
- break;
- case BuiltinMethod.SubscribeObservable:
- name = 'subscribe';
- break;
- case BuiltinMethod.Bind:
- name = 'bind';
- break;
- default:
- throw new Error("Unknown builtin method: " + method);
- }
- return name;
- };
- /**
- * @param {?} params
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype._visitParams = /**
- * @param {?} params
- * @param {?} ctx
- * @return {?}
- */
- function (params, ctx) {
- var _this = this;
- this.visitAllObjects(function (param) {
- ctx.print(null, param.name);
- _this._printColonType(param.type, ctx);
- }, params, ctx, ',');
- };
- /**
- * @param {?} value
- * @param {?} typeParams
- * @param {?} ctx
- * @return {?}
- */
- _TsEmitterVisitor.prototype._visitIdentifier = /**
- * @param {?} value
- * @param {?} typeParams
- * @param {?} ctx
- * @return {?}
- */
- function (value, typeParams, ctx) {
- var _this = this;
- var name = value.name, moduleName = value.moduleName;
- if (this.referenceFilter && this.referenceFilter(value)) {
- ctx.print(null, '(null as any)');
- return;
- }
- if (moduleName) {
- var /** @type {?} */ prefix = this.importsWithPrefixes.get(moduleName);
- if (prefix == null) {
- prefix = "i" + this.importsWithPrefixes.size;
- this.importsWithPrefixes.set(moduleName, prefix);
- }
- ctx.print(null, prefix + ".");
- }
- ctx.print(null, /** @type {?} */ ((name)));
- if (this.typeExpression > 0) {
- // If we are in a type expression that refers to a generic type then supply
- // the required type parameters. If there were not enough type parameters
- // supplied, supply any as the type. Outside a type expression the reference
- // should not supply type parameters and be treated as a simple value reference
- // to the constructor function itself.
- var /** @type {?} */ suppliedParameters = typeParams || [];
- if (suppliedParameters.length > 0) {
- ctx.print(null, "<");
- this.visitAllObjects(function (type) { return type.visitType(_this, ctx); }, /** @type {?} */ ((typeParams)), ctx, ',');
- ctx.print(null, ">");
- }
- }
- };
- /**
- * @param {?} type
- * @param {?} ctx
- * @param {?=} defaultType
- * @return {?}
- */
- _TsEmitterVisitor.prototype._printColonType = /**
- * @param {?} type
- * @param {?} ctx
- * @param {?=} defaultType
- * @return {?}
- */
- function (type, ctx, defaultType) {
- if (type !== INFERRED_TYPE) {
- ctx.print(null, ':');
- this.visitType(type, ctx, defaultType);
- }
- };
- return _TsEmitterVisitor;
- }(AbstractEmitterVisitor));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Resolve a `Type` for {\@link Pipe}.
- *
- * This interface can be overridden by the application developer to create custom behavior.
- *
- * See {\@link Compiler}
- */
- var PipeResolver = /** @class */ (function () {
- function PipeResolver(_reflector) {
- this._reflector = _reflector;
- }
- /**
- * @param {?} type
- * @return {?}
- */
- PipeResolver.prototype.isPipe = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type));
- return typeMetadata && typeMetadata.some(createPipe.isTypeOf);
- };
- /**
- * Return {@link Pipe} for a given `Type`.
- */
- /**
- * Return {\@link Pipe} for a given `Type`.
- * @param {?} type
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- PipeResolver.prototype.resolve = /**
- * Return {\@link Pipe} for a given `Type`.
- * @param {?} type
- * @param {?=} throwIfNotFound
- * @return {?}
- */
- function (type, throwIfNotFound) {
- if (throwIfNotFound === void 0) { throwIfNotFound = true; }
- var /** @type {?} */ metas = this._reflector.annotations(resolveForwardRef(type));
- if (metas) {
- var /** @type {?} */ annotation = findLast(metas, createPipe.isTypeOf);
- if (annotation) {
- return annotation;
- }
- }
- if (throwIfNotFound) {
- throw new Error("No Pipe decorator found on " + stringify(type));
- }
- return null;
- };
- return PipeResolver;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Map from tagName|propertyName SecurityContext. Properties applying to all tags use '*'.
- */
- var SECURITY_SCHEMA = {};
- /**
- * @param {?} ctx
- * @param {?} specs
- * @return {?}
- */
- function registerContext(ctx, specs) {
- for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
- var spec = specs_1[_i];
- SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
- }
- }
- // Case is insignificant below, all element and attribute names are lower-cased for lookup.
- registerContext(SecurityContext.HTML, [
- 'iframe|srcdoc',
- '*|innerHTML',
- '*|outerHTML',
- ]);
- registerContext(SecurityContext.STYLE, ['*|style']);
- // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
- registerContext(SecurityContext.URL, [
- '*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href',
- 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action',
- 'img|src', 'img|srcset', 'input|src', 'ins|cite', 'q|cite',
- 'source|src', 'source|srcset', 'track|src', 'video|poster', 'video|src',
- ]);
- registerContext(SecurityContext.RESOURCE_URL, [
- 'applet|code',
- 'applet|codebase',
- 'base|href',
- 'embed|src',
- 'frame|src',
- 'head|profile',
- 'html|manifest',
- 'iframe|src',
- 'link|href',
- 'media|src',
- 'object|codebase',
- 'object|data',
- 'script|src',
- ]);
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @abstract
- */
- var ElementSchemaRegistry = /** @class */ (function () {
- function ElementSchemaRegistry() {
- }
- return ElementSchemaRegistry;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var BOOLEAN = 'boolean';
- var NUMBER = 'number';
- var STRING = 'string';
- var OBJECT = 'object';
- /**
- * This array represents the DOM schema. It encodes inheritance, properties, and events.
- *
- * ## Overview
- *
- * Each line represents one kind of element. The `element_inheritance` and properties are joined
- * using `element_inheritance|properties` syntax.
- *
- * ## Element Inheritance
- *
- * The `element_inheritance` can be further subdivided as `element1,element2,...^parentElement`.
- * Here the individual elements are separated by `,` (commas). Every element in the list
- * has identical properties.
- *
- * An `element` may inherit additional properties from `parentElement` If no `^parentElement` is
- * specified then `""` (blank) element is assumed.
- *
- * NOTE: The blank element inherits from root `[Element]` element, the super element of all
- * elements.
- *
- * NOTE an element prefix such as `:svg:` has no special meaning to the schema.
- *
- * ## Properties
- *
- * Each element has a set of properties separated by `,` (commas). Each property can be prefixed
- * by a special character designating its type:
- *
- * - (no prefix): property is a string.
- * - `*`: property represents an event.
- * - `!`: property is a boolean.
- * - `#`: property is a number.
- * - `%`: property is an object.
- *
- * ## Query
- *
- * The class creates an internal squas representation which allows to easily answer the query of
- * if a given property exist on a given element.
- *
- * NOTE: We don't yet support querying for types or events.
- * NOTE: This schema is auto extracted from `schema_extractor.ts` located in the test folder,
- * see dom_element_schema_registry_spec.ts
- */
- var SCHEMA = [
- '[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop,slot' +
- ',*message,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored',
- '[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',
- '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',
- 'media^[HTMLElement]|!autoplay,!controls,%controlsList,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,*waitingforkey,#playbackRate,preload,src,%srcObject,#volume',
- ':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',
- ':svg:graphics^:svg:|',
- ':svg:animation^:svg:|*begin,*end,*repeat',
- ':svg:geometry^:svg:|',
- ':svg:componentTransferFunction^:svg:|',
- ':svg:gradient^:svg:|',
- ':svg:textContent^:svg:graphics|',
- ':svg:textPositioning^:svg:textContent|',
- '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',
- 'area^[HTMLElement]|alt,coords,download,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,rel,search,shape,target,username',
- 'audio^media|',
- 'br^[HTMLElement]|clear',
- 'base^[HTMLElement]|href,target',
- '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',
- 'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value',
- 'canvas^[HTMLElement]|#height,#width',
- 'content^[HTMLElement]|select',
- 'dl^[HTMLElement]|!compact',
- 'datalist^[HTMLElement]|',
- 'details^[HTMLElement]|!open',
- 'dialog^[HTMLElement]|!open,returnValue',
- 'dir^[HTMLElement]|!compact',
- 'div^[HTMLElement]|align',
- 'embed^[HTMLElement]|align,height,name,src,type,width',
- 'fieldset^[HTMLElement]|!disabled,name',
- 'font^[HTMLElement]|color,face,size',
- 'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target',
- 'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src',
- 'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows',
- 'hr^[HTMLElement]|align,color,!noShade,size,width',
- 'head^[HTMLElement]|',
- 'h1,h2,h3,h4,h5,h6^[HTMLElement]|align',
- 'html^[HTMLElement]|version',
- 'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width',
- 'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width',
- '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',
- 'li^[HTMLElement]|type,#value',
- 'label^[HTMLElement]|htmlFor',
- 'legend^[HTMLElement]|align',
- 'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,referrerPolicy,rel,%relList,rev,%sizes,target,type',
- 'map^[HTMLElement]|name',
- 'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width',
- 'menu^[HTMLElement]|!compact',
- 'meta^[HTMLElement]|content,httpEquiv,name,scheme',
- 'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value',
- 'ins,del^[HTMLElement]|cite,dateTime',
- 'ol^[HTMLElement]|!compact,!reversed,#start,type',
- 'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width',
- 'optgroup^[HTMLElement]|!disabled,label',
- 'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value',
- 'output^[HTMLElement]|defaultValue,%htmlFor,name,value',
- 'p^[HTMLElement]|align',
- 'param^[HTMLElement]|name,type,value,valueType',
- 'picture^[HTMLElement]|',
- 'pre^[HTMLElement]|#width',
- 'progress^[HTMLElement]|#max,#value',
- 'q,blockquote,cite^[HTMLElement]|',
- 'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type',
- 'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value',
- 'shadow^[HTMLElement]|',
- 'slot^[HTMLElement]|name',
- 'source^[HTMLElement]|media,sizes,src,srcset,type',
- 'span^[HTMLElement]|',
- 'style^[HTMLElement]|!disabled,media,type',
- 'caption^[HTMLElement]|align',
- 'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width',
- 'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width',
- 'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width',
- 'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign',
- 'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign',
- 'template^[HTMLElement]|',
- 'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap',
- 'title^[HTMLElement]|text',
- 'track^[HTMLElement]|!default,kind,label,src,srclang',
- 'ul^[HTMLElement]|!compact,type',
- 'unknown^[HTMLElement]|',
- 'video^media|#height,poster,#width',
- ':svg:a^:svg:graphics|',
- ':svg:animate^:svg:animation|',
- ':svg:animateMotion^:svg:animation|',
- ':svg:animateTransform^:svg:animation|',
- ':svg:circle^:svg:geometry|',
- ':svg:clipPath^:svg:graphics|',
- ':svg:defs^:svg:graphics|',
- ':svg:desc^:svg:|',
- ':svg:discard^:svg:|',
- ':svg:ellipse^:svg:geometry|',
- ':svg:feBlend^:svg:|',
- ':svg:feColorMatrix^:svg:|',
- ':svg:feComponentTransfer^:svg:|',
- ':svg:feComposite^:svg:|',
- ':svg:feConvolveMatrix^:svg:|',
- ':svg:feDiffuseLighting^:svg:|',
- ':svg:feDisplacementMap^:svg:|',
- ':svg:feDistantLight^:svg:|',
- ':svg:feDropShadow^:svg:|',
- ':svg:feFlood^:svg:|',
- ':svg:feFuncA^:svg:componentTransferFunction|',
- ':svg:feFuncB^:svg:componentTransferFunction|',
- ':svg:feFuncG^:svg:componentTransferFunction|',
- ':svg:feFuncR^:svg:componentTransferFunction|',
- ':svg:feGaussianBlur^:svg:|',
- ':svg:feImage^:svg:|',
- ':svg:feMerge^:svg:|',
- ':svg:feMergeNode^:svg:|',
- ':svg:feMorphology^:svg:|',
- ':svg:feOffset^:svg:|',
- ':svg:fePointLight^:svg:|',
- ':svg:feSpecularLighting^:svg:|',
- ':svg:feSpotLight^:svg:|',
- ':svg:feTile^:svg:|',
- ':svg:feTurbulence^:svg:|',
- ':svg:filter^:svg:|',
- ':svg:foreignObject^:svg:graphics|',
- ':svg:g^:svg:graphics|',
- ':svg:image^:svg:graphics|',
- ':svg:line^:svg:geometry|',
- ':svg:linearGradient^:svg:gradient|',
- ':svg:mpath^:svg:|',
- ':svg:marker^:svg:|',
- ':svg:mask^:svg:|',
- ':svg:metadata^:svg:|',
- ':svg:path^:svg:geometry|',
- ':svg:pattern^:svg:|',
- ':svg:polygon^:svg:geometry|',
- ':svg:polyline^:svg:geometry|',
- ':svg:radialGradient^:svg:gradient|',
- ':svg:rect^:svg:geometry|',
- ':svg:svg^:svg:graphics|#currentScale,#zoomAndPan',
- ':svg:script^:svg:|type',
- ':svg:set^:svg:animation|',
- ':svg:stop^:svg:|',
- ':svg:style^:svg:|!disabled,media,title,type',
- ':svg:switch^:svg:graphics|',
- ':svg:symbol^:svg:|',
- ':svg:tspan^:svg:textPositioning|',
- ':svg:text^:svg:textPositioning|',
- ':svg:textPath^:svg:textContent|',
- ':svg:title^:svg:|',
- ':svg:use^:svg:graphics|',
- ':svg:view^:svg:|#zoomAndPan',
- 'data^[HTMLElement]|value',
- 'keygen^[HTMLElement]|!autofocus,challenge,!disabled,form,keytype,name',
- 'menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default',
- 'summary^[HTMLElement]|',
- 'time^[HTMLElement]|dateTime',
- ':svg:cursor^:svg:|',
- ];
- var _ATTR_TO_PROP = {
- 'class': 'className',
- 'for': 'htmlFor',
- 'formaction': 'formAction',
- 'innerHtml': 'innerHTML',
- 'readonly': 'readOnly',
- 'tabindex': 'tabIndex',
- };
- var DomElementSchemaRegistry = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DomElementSchemaRegistry, _super);
- function DomElementSchemaRegistry() {
- var _this = _super.call(this) || this;
- _this._schema = {};
- SCHEMA.forEach(function (encodedType) {
- var /** @type {?} */ type = {};
- var _a = encodedType.split('|'), strType = _a[0], strProperties = _a[1];
- var /** @type {?} */ properties = strProperties.split(',');
- var _b = strType.split('^'), typeNames = _b[0], superName = _b[1];
- typeNames.split(',').forEach(function (tag) { return _this._schema[tag.toLowerCase()] = type; });
- var /** @type {?} */ superType = superName && _this._schema[superName.toLowerCase()];
- if (superType) {
- Object.keys(superType).forEach(function (prop) { type[prop] = superType[prop]; });
- }
- properties.forEach(function (property) {
- if (property.length > 0) {
- switch (property[0]) {
- case '*':
- // We don't yet support events.
- // If ever allowing to bind to events, GO THROUGH A SECURITY REVIEW, allowing events
- // will
- // almost certainly introduce bad XSS vulnerabilities.
- // type[property.substring(1)] = EVENT;
- break;
- case '!':
- type[property.substring(1)] = BOOLEAN;
- break;
- case '#':
- type[property.substring(1)] = NUMBER;
- break;
- case '%':
- type[property.substring(1)] = OBJECT;
- break;
- default:
- type[property] = STRING;
- }
- }
- });
- });
- return _this;
- }
- /**
- * @param {?} tagName
- * @param {?} propName
- * @param {?} schemaMetas
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.hasProperty = /**
- * @param {?} tagName
- * @param {?} propName
- * @param {?} schemaMetas
- * @return {?}
- */
- function (tagName, propName, schemaMetas) {
- if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) {
- return true;
- }
- if (tagName.indexOf('-') > -1) {
- if (isNgContainer(tagName) || isNgContent(tagName)) {
- return false;
- }
- if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) {
- // Can't tell now as we don't know which properties a custom element will get
- // once it is instantiated
- return true;
- }
- }
- var /** @type {?} */ elementProperties = this._schema[tagName.toLowerCase()] || this._schema['unknown'];
- return !!elementProperties[propName];
- };
- /**
- * @param {?} tagName
- * @param {?} schemaMetas
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.hasElement = /**
- * @param {?} tagName
- * @param {?} schemaMetas
- * @return {?}
- */
- function (tagName, schemaMetas) {
- if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) {
- return true;
- }
- if (tagName.indexOf('-') > -1) {
- if (isNgContainer(tagName) || isNgContent(tagName)) {
- return true;
- }
- if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) {
- // Allow any custom elements
- return true;
- }
- }
- return !!this._schema[tagName.toLowerCase()];
- };
- /**
- * securityContext returns the security context for the given property on the given DOM tag.
- *
- * Tag and property name are statically known and cannot change at runtime, i.e. it is not
- * possible to bind a value into a changing attribute or tag name.
- *
- * The filtering is white list based. All attributes in the schema above are assumed to have the
- * 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
- * attack vectors are assigned their appropriate context.
- */
- /**
- * securityContext returns the security context for the given property on the given DOM tag.
- *
- * Tag and property name are statically known and cannot change at runtime, i.e. it is not
- * possible to bind a value into a changing attribute or tag name.
- *
- * The filtering is white list based. All attributes in the schema above are assumed to have the
- * 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
- * attack vectors are assigned their appropriate context.
- * @param {?} tagName
- * @param {?} propName
- * @param {?} isAttribute
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.securityContext = /**
- * securityContext returns the security context for the given property on the given DOM tag.
- *
- * Tag and property name are statically known and cannot change at runtime, i.e. it is not
- * possible to bind a value into a changing attribute or tag name.
- *
- * The filtering is white list based. All attributes in the schema above are assumed to have the
- * 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
- * attack vectors are assigned their appropriate context.
- * @param {?} tagName
- * @param {?} propName
- * @param {?} isAttribute
- * @return {?}
- */
- function (tagName, propName, isAttribute) {
- if (isAttribute) {
- // NB: For security purposes, use the mapped property name, not the attribute name.
- propName = this.getMappedPropName(propName);
- }
- // Make sure comparisons are case insensitive, so that case differences between attribute and
- // property names do not have a security impact.
- tagName = tagName.toLowerCase();
- propName = propName.toLowerCase();
- var /** @type {?} */ ctx = SECURITY_SCHEMA[tagName + '|' + propName];
- if (ctx) {
- return ctx;
- }
- ctx = SECURITY_SCHEMA['*|' + propName];
- return ctx ? ctx : SecurityContext.NONE;
- };
- /**
- * @param {?} propName
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.getMappedPropName = /**
- * @param {?} propName
- * @return {?}
- */
- function (propName) { return _ATTR_TO_PROP[propName] || propName; };
- /**
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.getDefaultComponentElementName = /**
- * @return {?}
- */
- function () { return 'ng-component'; };
- /**
- * @param {?} name
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.validateProperty = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- if (name.toLowerCase().startsWith('on')) {
- var /** @type {?} */ msg = "Binding to event property '" + name + "' is disallowed for security reasons, " +
- ("please use (" + name.slice(2) + ")=...") +
- ("\nIf '" + name + "' is a directive input, make sure the directive is imported by the") +
- " current module.";
- return { error: true, msg: msg };
- }
- else {
- return { error: false };
- }
- };
- /**
- * @param {?} name
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.validateAttribute = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- if (name.toLowerCase().startsWith('on')) {
- var /** @type {?} */ msg = "Binding to event attribute '" + name + "' is disallowed for security reasons, " +
- ("please use (" + name.slice(2) + ")=...");
- return { error: true, msg: msg };
- }
- else {
- return { error: false };
- }
- };
- /**
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.allKnownElementNames = /**
- * @return {?}
- */
- function () { return Object.keys(this._schema); };
- /**
- * @param {?} propName
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.normalizeAnimationStyleProperty = /**
- * @param {?} propName
- * @return {?}
- */
- function (propName) {
- return dashCaseToCamelCase(propName);
- };
- /**
- * @param {?} camelCaseProp
- * @param {?} userProvidedProp
- * @param {?} val
- * @return {?}
- */
- DomElementSchemaRegistry.prototype.normalizeAnimationStyleValue = /**
- * @param {?} camelCaseProp
- * @param {?} userProvidedProp
- * @param {?} val
- * @return {?}
- */
- function (camelCaseProp, userProvidedProp, val) {
- var /** @type {?} */ unit = '';
- var /** @type {?} */ strVal = val.toString().trim();
- var /** @type {?} */ errorMsg = /** @type {?} */ ((null));
- if (_isPixelDimensionStyle(camelCaseProp) && val !== 0 && val !== '0') {
- if (typeof val === 'number') {
- unit = 'px';
- }
- else {
- var /** @type {?} */ valAndSuffixMatch = val.match(/^[+-]?[\d\.]+([a-z]*)$/);
- if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {
- errorMsg = "Please provide a CSS unit value for " + userProvidedProp + ":" + val;
- }
- }
- }
- return { error: errorMsg, value: strVal + unit };
- };
- return DomElementSchemaRegistry;
- }(ElementSchemaRegistry));
- /**
- * @param {?} prop
- * @return {?}
- */
- function _isPixelDimensionStyle(prop) {
- switch (prop) {
- case 'width':
- case 'height':
- case 'minWidth':
- case 'minHeight':
- case 'maxWidth':
- case 'maxHeight':
- case 'left':
- case 'top':
- case 'bottom':
- case 'right':
- case 'fontSize':
- case 'outlineWidth':
- case 'outlineOffset':
- case 'paddingTop':
- case 'paddingLeft':
- case 'paddingBottom':
- case 'paddingRight':
- case 'marginTop':
- case 'marginLeft':
- case 'marginBottom':
- case 'marginRight':
- case 'borderRadius':
- case 'borderWidth':
- case 'borderTopWidth':
- case 'borderLeftWidth':
- case 'borderRightWidth':
- case 'borderBottomWidth':
- case 'textIndent':
- return true;
- default:
- return false;
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * This file is a port of shadowCSS from webcomponents.js to TypeScript.
- *
- * Please make sure to keep to edits in sync with the source file.
- *
- * Source:
- * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
- *
- * The original file level comment is reproduced below
- */
- /*
- This is a limited shim for ShadowDOM css styling.
- https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles
- The intention here is to support only the styling features which can be
- relatively simply implemented. The goal is to allow users to avoid the
- most obvious pitfalls and do so without compromising performance significantly.
- For ShadowDOM styling that's not covered here, a set of best practices
- can be provided that should allow users to accomplish more complex styling.
- The following is a list of specific ShadowDOM styling features and a brief
- discussion of the approach used to shim.
- Shimmed features:
- * :host, :host-context: ShadowDOM allows styling of the shadowRoot's host
- element using the :host rule. To shim this feature, the :host styles are
- reformatted and prefixed with a given scope name and promoted to a
- document level stylesheet.
- For example, given a scope name of .foo, a rule like this:
- :host {
- background: red;
- }
- }
- becomes:
- .foo {
- background: red;
- }
- * encapsulation: Styles defined within ShadowDOM, apply only to
- dom inside the ShadowDOM. Polymer uses one of two techniques to implement
- this feature.
- By default, rules are prefixed with the host element tag name
- as a descendant selector. This ensures styling does not leak out of the 'top'
- of the element's ShadowDOM. For example,
- div {
- font-weight: bold;
- }
- becomes:
- x-foo div {
- font-weight: bold;
- }
- becomes:
- Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then
- selectors are scoped by adding an attribute selector suffix to each
- simple selector that contains the host element tag name. Each element
- in the element's ShadowDOM template is also given the scope attribute.
- Thus, these rules match only elements that have the scope attribute.
- For example, given a scope name of x-foo, a rule like this:
- div {
- font-weight: bold;
- }
- becomes:
- div[x-foo] {
- font-weight: bold;
- }
- Note that elements that are dynamically added to a scope must have the scope
- selector added to them manually.
- * upper/lower bound encapsulation: Styles which are defined outside a
- shadowRoot should not cross the ShadowDOM boundary and should not apply
- inside a shadowRoot.
- This styling behavior is not emulated. Some possible ways to do this that
- were rejected due to complexity and/or performance concerns include: (1) reset
- every possible property for every possible selector for a given scope name;
- (2) re-implement css in javascript.
- As an alternative, users should make sure to use selectors
- specific to the scope in which they are working.
- * ::distributed: This behavior is not emulated. It's often not necessary
- to style the contents of a specific insertion point and instead, descendants
- of the host element can be styled selectively. Users can also create an
- extra node around an insertion point and style that node's contents
- via descendent selectors. For example, with a shadowRoot like this:
- <style>
- ::content(div) {
- background: red;
- }
- </style>
- <content></content>
- could become:
- <style>
- / *@polyfill .content-container div * /
- ::content(div) {
- background: red;
- }
- </style>
- <div class="content-container">
- <content></content>
- </div>
- Note the use of @polyfill in the comment above a ShadowDOM specific style
- declaration. This is a directive to the styling shim to use the selector
- in comments in lieu of the next selector when running under polyfill.
- */
- var ShadowCss = /** @class */ (function () {
- function ShadowCss() {
- this.strictStyling = true;
- }
- /*
- * Shim some cssText with the given selector. Returns cssText that can
- * be included in the document via WebComponents.ShadowCSS.addCssToDocument(css).
- *
- * When strictStyling is true:
- * - selector is the attribute added to all elements inside the host,
- * - hostSelector is the attribute added to the host itself.
- */
- /**
- * @param {?} cssText
- * @param {?} selector
- * @param {?=} hostSelector
- * @return {?}
- */
- ShadowCss.prototype.shimCssText = /**
- * @param {?} cssText
- * @param {?} selector
- * @param {?=} hostSelector
- * @return {?}
- */
- function (cssText, selector, hostSelector) {
- if (hostSelector === void 0) { hostSelector = ''; }
- var /** @type {?} */ commentsWithHash = extractCommentsWithHash(cssText);
- cssText = stripComments(cssText);
- cssText = this._insertDirectives(cssText);
- var /** @type {?} */ scopedCssText = this._scopeCssText(cssText, selector, hostSelector);
- return [scopedCssText].concat(commentsWithHash).join('\n');
- };
- /**
- * @param {?} cssText
- * @return {?}
- */
- ShadowCss.prototype._insertDirectives = /**
- * @param {?} cssText
- * @return {?}
- */
- function (cssText) {
- cssText = this._insertPolyfillDirectivesInCssText(cssText);
- return this._insertPolyfillRulesInCssText(cssText);
- };
- /**
- * @param {?} cssText
- * @return {?}
- */
- ShadowCss.prototype._insertPolyfillDirectivesInCssText = /**
- * @param {?} cssText
- * @return {?}
- */
- function (cssText) {
- // Difference with webcomponents.js: does not handle comments
- return cssText.replace(_cssContentNextSelectorRe, function () {
- var m = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- m[_i] = arguments[_i];
- }
- return m[2] + '{';
- });
- };
- /**
- * @param {?} cssText
- * @return {?}
- */
- ShadowCss.prototype._insertPolyfillRulesInCssText = /**
- * @param {?} cssText
- * @return {?}
- */
- function (cssText) {
- // Difference with webcomponents.js: does not handle comments
- return cssText.replace(_cssContentRuleRe, function () {
- var m = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- m[_i] = arguments[_i];
- }
- var /** @type {?} */ rule = m[0].replace(m[1], '').replace(m[2], '');
- return m[4] + rule;
- });
- };
- /**
- * @param {?} cssText
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- ShadowCss.prototype._scopeCssText = /**
- * @param {?} cssText
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- function (cssText, scopeSelector, hostSelector) {
- var /** @type {?} */ unscopedRules = this._extractUnscopedRulesFromCssText(cssText);
- // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively
- cssText = this._insertPolyfillHostInCssText(cssText);
- cssText = this._convertColonHost(cssText);
- cssText = this._convertColonHostContext(cssText);
- cssText = this._convertShadowDOMSelectors(cssText);
- if (scopeSelector) {
- cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
- }
- cssText = cssText + '\n' + unscopedRules;
- return cssText.trim();
- };
- /**
- * @param {?} cssText
- * @return {?}
- */
- ShadowCss.prototype._extractUnscopedRulesFromCssText = /**
- * @param {?} cssText
- * @return {?}
- */
- function (cssText) {
- // Difference with webcomponents.js: does not handle comments
- var /** @type {?} */ r = '';
- var /** @type {?} */ m;
- _cssContentUnscopedRuleRe.lastIndex = 0;
- while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) {
- var /** @type {?} */ rule = m[0].replace(m[2], '').replace(m[1], m[4]);
- r += rule + '\n\n';
- }
- return r;
- };
- /**
- * @param {?} cssText
- * @return {?}
- */
- ShadowCss.prototype._convertColonHost = /**
- * @param {?} cssText
- * @return {?}
- */
- function (cssText) {
- return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer);
- };
- /**
- * @param {?} cssText
- * @return {?}
- */
- ShadowCss.prototype._convertColonHostContext = /**
- * @param {?} cssText
- * @return {?}
- */
- function (cssText) {
- return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer);
- };
- /**
- * @param {?} cssText
- * @param {?} regExp
- * @param {?} partReplacer
- * @return {?}
- */
- ShadowCss.prototype._convertColonRule = /**
- * @param {?} cssText
- * @param {?} regExp
- * @param {?} partReplacer
- * @return {?}
- */
- function (cssText, regExp, partReplacer) {
- // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
- return cssText.replace(regExp, function () {
- var m = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- m[_i] = arguments[_i];
- }
- if (m[2]) {
- var /** @type {?} */ parts = m[2].split(',');
- var /** @type {?} */ r = [];
- for (var /** @type {?} */ i = 0; i < parts.length; i++) {
- var /** @type {?} */ p = parts[i].trim();
- if (!p)
- break;
- r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
- }
- return r.join(',');
- }
- else {
- return _polyfillHostNoCombinator + m[3];
- }
- });
- };
- /**
- * @param {?} host
- * @param {?} part
- * @param {?} suffix
- * @return {?}
- */
- ShadowCss.prototype._colonHostContextPartReplacer = /**
- * @param {?} host
- * @param {?} part
- * @param {?} suffix
- * @return {?}
- */
- function (host, part, suffix) {
- if (part.indexOf(_polyfillHost) > -1) {
- return this._colonHostPartReplacer(host, part, suffix);
- }
- else {
- return host + part + suffix + ', ' + part + ' ' + host + suffix;
- }
- };
- /**
- * @param {?} host
- * @param {?} part
- * @param {?} suffix
- * @return {?}
- */
- ShadowCss.prototype._colonHostPartReplacer = /**
- * @param {?} host
- * @param {?} part
- * @param {?} suffix
- * @return {?}
- */
- function (host, part, suffix) {
- return host + part.replace(_polyfillHost, '') + suffix;
- };
- /**
- * @param {?} cssText
- * @return {?}
- */
- ShadowCss.prototype._convertShadowDOMSelectors = /**
- * @param {?} cssText
- * @return {?}
- */
- function (cssText) {
- return _shadowDOMSelectorsRe.reduce(function (result, pattern) { return result.replace(pattern, ' '); }, cssText);
- };
- /**
- * @param {?} cssText
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- ShadowCss.prototype._scopeSelectors = /**
- * @param {?} cssText
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- function (cssText, scopeSelector, hostSelector) {
- var _this = this;
- return processRules(cssText, function (rule) {
- var /** @type {?} */ selector = rule.selector;
- var /** @type {?} */ content = rule.content;
- if (rule.selector[0] != '@') {
- selector =
- _this._scopeSelector(rule.selector, scopeSelector, hostSelector, _this.strictStyling);
- }
- else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
- rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) {
- content = _this._scopeSelectors(rule.content, scopeSelector, hostSelector);
- }
- return new CssRule(selector, content);
- });
- };
- /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @param {?} strict
- * @return {?}
- */
- ShadowCss.prototype._scopeSelector = /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @param {?} strict
- * @return {?}
- */
- function (selector, scopeSelector, hostSelector, strict) {
- var _this = this;
- return selector.split(',')
- .map(function (part) { return part.trim().split(_shadowDeepSelectors); })
- .map(function (deepParts) {
- var shallowPart = deepParts[0], otherParts = deepParts.slice(1);
- var /** @type {?} */ applyScope = function (shallowPart) {
- if (_this._selectorNeedsScoping(shallowPart, scopeSelector)) {
- return strict ?
- _this._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) :
- _this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
- }
- else {
- return shallowPart;
- }
- };
- return [applyScope(shallowPart)].concat(otherParts).join(' ');
- })
- .join(', ');
- };
- /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @return {?}
- */
- ShadowCss.prototype._selectorNeedsScoping = /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @return {?}
- */
- function (selector, scopeSelector) {
- var /** @type {?} */ re = this._makeScopeMatcher(scopeSelector);
- return !re.test(selector);
- };
- /**
- * @param {?} scopeSelector
- * @return {?}
- */
- ShadowCss.prototype._makeScopeMatcher = /**
- * @param {?} scopeSelector
- * @return {?}
- */
- function (scopeSelector) {
- var /** @type {?} */ lre = /\[/g;
- var /** @type {?} */ rre = /\]/g;
- scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
- return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
- };
- /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- ShadowCss.prototype._applySelectorScope = /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- function (selector, scopeSelector, hostSelector) {
- // Difference from webcomponents.js: scopeSelector could not be an array
- return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);
- };
- /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- ShadowCss.prototype._applySimpleSelectorScope = /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- function (selector, scopeSelector, hostSelector) {
- // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
- _polyfillHostRe.lastIndex = 0;
- if (_polyfillHostRe.test(selector)) {
- var /** @type {?} */ replaceBy_1 = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector;
- return selector
- .replace(_polyfillHostNoCombinatorRe, function (hnc, selector) {
- return selector.replace(/([^:]*)(:*)(.*)/, function (_, before, colon, after) {
- return before + replaceBy_1 + colon + after;
- });
- })
- .replace(_polyfillHostRe, replaceBy_1 + ' ');
- }
- return scopeSelector + ' ' + selector;
- };
- /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- ShadowCss.prototype._applyStrictSelectorScope = /**
- * @param {?} selector
- * @param {?} scopeSelector
- * @param {?} hostSelector
- * @return {?}
- */
- function (selector, scopeSelector, hostSelector) {
- var _this = this;
- var /** @type {?} */ isRe = /\[is=([^\]]*)\]/g;
- scopeSelector = scopeSelector.replace(isRe, function (_) {
- var parts = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- parts[_i - 1] = arguments[_i];
- }
- return parts[0];
- });
- var /** @type {?} */ attrName = '[' + scopeSelector + ']';
- var /** @type {?} */ _scopeSelectorPart = function (p) {
- var /** @type {?} */ scopedP = p.trim();
- if (!scopedP) {
- return '';
- }
- if (p.indexOf(_polyfillHostNoCombinator) > -1) {
- scopedP = _this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
- }
- else {
- // remove :host since it should be unnecessary
- var /** @type {?} */ t = p.replace(_polyfillHostRe, '');
- if (t.length > 0) {
- var /** @type {?} */ matches = t.match(/([^:]*)(:*)(.*)/);
- if (matches) {
- scopedP = matches[1] + attrName + matches[2] + matches[3];
- }
- }
- }
- return scopedP;
- };
- var /** @type {?} */ safeContent = new SafeSelector(selector);
- selector = safeContent.content();
- var /** @type {?} */ scopedSelector = '';
- var /** @type {?} */ startIndex = 0;
- var /** @type {?} */ res;
- var /** @type {?} */ sep = /( |>|\+|~(?!=))\s*/g;
- // If a selector appears before :host it should not be shimmed as it
- // matches on ancestor elements and not on elements in the host's shadow
- // `:host-context(div)` is transformed to
- // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
- // the `div` is not part of the component in the 2nd selectors and should not be scoped.
- // Historically `component-tag:host` was matching the component so we also want to preserve
- // this behavior to avoid breaking legacy apps (it should not match).
- // The behavior should be:
- // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
- // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
- // `:host-context(tag)`)
- var /** @type {?} */ hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
- // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
- var /** @type {?} */ shouldScope = !hasHost;
- while ((res = sep.exec(selector)) !== null) {
- var /** @type {?} */ separator = res[1];
- var /** @type {?} */ part_1 = selector.slice(startIndex, res.index).trim();
- shouldScope = shouldScope || part_1.indexOf(_polyfillHostNoCombinator) > -1;
- var /** @type {?} */ scopedPart = shouldScope ? _scopeSelectorPart(part_1) : part_1;
- scopedSelector += scopedPart + " " + separator + " ";
- startIndex = sep.lastIndex;
- }
- var /** @type {?} */ part = selector.substring(startIndex);
- shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
- scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
- // replace the placeholders with their original values
- return safeContent.restore(scopedSelector);
- };
- /**
- * @param {?} selector
- * @return {?}
- */
- ShadowCss.prototype._insertPolyfillHostInCssText = /**
- * @param {?} selector
- * @return {?}
- */
- function (selector) {
- return selector.replace(_colonHostContextRe, _polyfillHostContext)
- .replace(_colonHostRe, _polyfillHost);
- };
- return ShadowCss;
- }());
- var SafeSelector = /** @class */ (function () {
- function SafeSelector(selector) {
- var _this = this;
- this.placeholders = [];
- this.index = 0;
- // Replaces attribute selectors with placeholders.
- // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
- selector = selector.replace(/(\[[^\]]*\])/g, function (_, keep) {
- var /** @type {?} */ replaceBy = "__ph-" + _this.index + "__";
- _this.placeholders.push(keep);
- _this.index++;
- return replaceBy;
- });
- // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
- // WS and "+" would otherwise be interpreted as selector separators.
- this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, function (_, pseudo, exp) {
- var /** @type {?} */ replaceBy = "__ph-" + _this.index + "__";
- _this.placeholders.push(exp);
- _this.index++;
- return pseudo + replaceBy;
- });
- }
- /**
- * @param {?} content
- * @return {?}
- */
- SafeSelector.prototype.restore = /**
- * @param {?} content
- * @return {?}
- */
- function (content) {
- var _this = this;
- return content.replace(/__ph-(\d+)__/g, function (ph, index) { return _this.placeholders[+index]; });
- };
- /**
- * @return {?}
- */
- SafeSelector.prototype.content = /**
- * @return {?}
- */
- function () { return this._content; };
- return SafeSelector;
- }());
- var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
- var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
- var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
- var _polyfillHost = '-shadowcsshost';
- // note: :host-context pre-processed to -shadowcsshostcontext.
- var _polyfillHostContext = '-shadowcsscontext';
- var _parenSuffix = ')(?:\\((' +
- '(?:\\([^)(]*\\)|[^)(]*)+?' +
- ')\\))?([^,{]*)';
- var _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
- var _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
- var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
- var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
- var _shadowDOMSelectorsRe = [
- /::shadow/g,
- /::content/g,
- /\/shadow-deep\//g,
- /\/shadow\//g,
- ];
- // The deep combinator is deprecated in the CSS spec
- // Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future.
- // see https://github.com/angular/angular/pull/17677
- var _shadowDeepSelectors = /(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g;
- var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$';
- var _polyfillHostRe = /-shadowcsshost/gim;
- var _colonHostRe = /:host/gim;
- var _colonHostContextRe = /:host-context/gim;
- var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
- /**
- * @param {?} input
- * @return {?}
- */
- function stripComments(input) {
- return input.replace(_commentRe, '');
- }
- var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
- /**
- * @param {?} input
- * @return {?}
- */
- function extractCommentsWithHash(input) {
- return input.match(_commentWithHashRe) || [];
- }
- var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
- var _curlyRe = /([{}])/g;
- var OPEN_CURLY = '{';
- var CLOSE_CURLY = '}';
- var BLOCK_PLACEHOLDER = '%BLOCK%';
- var CssRule = /** @class */ (function () {
- function CssRule(selector, content) {
- this.selector = selector;
- this.content = content;
- }
- return CssRule;
- }());
- /**
- * @param {?} input
- * @param {?} ruleCallback
- * @return {?}
- */
- function processRules(input, ruleCallback) {
- var /** @type {?} */ inputWithEscapedBlocks = escapeBlocks(input);
- var /** @type {?} */ nextBlockIndex = 0;
- return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function () {
- var m = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- m[_i] = arguments[_i];
- }
- var /** @type {?} */ selector = m[2];
- var /** @type {?} */ content = '';
- var /** @type {?} */ suffix = m[4];
- var /** @type {?} */ contentPrefix = '';
- if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
- content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
- suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
- contentPrefix = '{';
- }
- var /** @type {?} */ rule = ruleCallback(new CssRule(selector, content));
- return "" + m[1] + rule.selector + m[3] + contentPrefix + rule.content + suffix;
- });
- }
- var StringWithEscapedBlocks = /** @class */ (function () {
- function StringWithEscapedBlocks(escapedString, blocks) {
- this.escapedString = escapedString;
- this.blocks = blocks;
- }
- return StringWithEscapedBlocks;
- }());
- /**
- * @param {?} input
- * @return {?}
- */
- function escapeBlocks(input) {
- var /** @type {?} */ inputParts = input.split(_curlyRe);
- var /** @type {?} */ resultParts = [];
- var /** @type {?} */ escapedBlocks = [];
- var /** @type {?} */ bracketCount = 0;
- var /** @type {?} */ currentBlockParts = [];
- for (var /** @type {?} */ partIndex = 0; partIndex < inputParts.length; partIndex++) {
- var /** @type {?} */ part = inputParts[partIndex];
- if (part == CLOSE_CURLY) {
- bracketCount--;
- }
- if (bracketCount > 0) {
- currentBlockParts.push(part);
- }
- else {
- if (currentBlockParts.length > 0) {
- escapedBlocks.push(currentBlockParts.join(''));
- resultParts.push(BLOCK_PLACEHOLDER);
- currentBlockParts = [];
- }
- resultParts.push(part);
- }
- if (part == OPEN_CURLY) {
- bracketCount++;
- }
- }
- if (currentBlockParts.length > 0) {
- escapedBlocks.push(currentBlockParts.join(''));
- resultParts.push(BLOCK_PLACEHOLDER);
- }
- return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var COMPONENT_VARIABLE = '%COMP%';
- var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
- var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
- var StylesCompileDependency = /** @class */ (function () {
- function StylesCompileDependency(name, moduleUrl, setValue) {
- this.name = name;
- this.moduleUrl = moduleUrl;
- this.setValue = setValue;
- }
- return StylesCompileDependency;
- }());
- var CompiledStylesheet = /** @class */ (function () {
- function CompiledStylesheet(outputCtx, stylesVar, dependencies, isShimmed, meta) {
- this.outputCtx = outputCtx;
- this.stylesVar = stylesVar;
- this.dependencies = dependencies;
- this.isShimmed = isShimmed;
- this.meta = meta;
- }
- return CompiledStylesheet;
- }());
- var StyleCompiler = /** @class */ (function () {
- function StyleCompiler(_urlResolver) {
- this._urlResolver = _urlResolver;
- this._shadowCss = new ShadowCss();
- }
- /**
- * @param {?} outputCtx
- * @param {?} comp
- * @return {?}
- */
- StyleCompiler.prototype.compileComponent = /**
- * @param {?} outputCtx
- * @param {?} comp
- * @return {?}
- */
- function (outputCtx, comp) {
- var /** @type {?} */ template = /** @type {?} */ ((comp.template));
- return this._compileStyles(outputCtx, comp, new CompileStylesheetMetadata({
- styles: template.styles,
- styleUrls: template.styleUrls,
- moduleUrl: identifierModuleUrl(comp.type)
- }), this.needsStyleShim(comp), true);
- };
- /**
- * @param {?} outputCtx
- * @param {?} comp
- * @param {?} stylesheet
- * @param {?=} shim
- * @return {?}
- */
- StyleCompiler.prototype.compileStyles = /**
- * @param {?} outputCtx
- * @param {?} comp
- * @param {?} stylesheet
- * @param {?=} shim
- * @return {?}
- */
- function (outputCtx, comp, stylesheet, shim) {
- if (shim === void 0) { shim = this.needsStyleShim(comp); }
- return this._compileStyles(outputCtx, comp, stylesheet, shim, false);
- };
- /**
- * @param {?} comp
- * @return {?}
- */
- StyleCompiler.prototype.needsStyleShim = /**
- * @param {?} comp
- * @return {?}
- */
- function (comp) {
- return /** @type {?} */ ((comp.template)).encapsulation === ViewEncapsulation.Emulated;
- };
- /**
- * @param {?} outputCtx
- * @param {?} comp
- * @param {?} stylesheet
- * @param {?} shim
- * @param {?} isComponentStylesheet
- * @return {?}
- */
- StyleCompiler.prototype._compileStyles = /**
- * @param {?} outputCtx
- * @param {?} comp
- * @param {?} stylesheet
- * @param {?} shim
- * @param {?} isComponentStylesheet
- * @return {?}
- */
- function (outputCtx, comp, stylesheet, shim, isComponentStylesheet) {
- var _this = this;
- var /** @type {?} */ styleExpressions = stylesheet.styles.map(function (plainStyle) { return literal(_this._shimIfNeeded(plainStyle, shim)); });
- var /** @type {?} */ dependencies = [];
- stylesheet.styleUrls.forEach(function (styleUrl) {
- var /** @type {?} */ exprIndex = styleExpressions.length;
- // Note: This placeholder will be filled later.
- styleExpressions.push(/** @type {?} */ ((null)));
- dependencies.push(new StylesCompileDependency(getStylesVarName(null), styleUrl, function (value) { return styleExpressions[exprIndex] = outputCtx.importExpr(value); }));
- });
- // styles variable contains plain strings and arrays of other styles arrays (recursive),
- // so we set its type to dynamic.
- var /** @type {?} */ stylesVar = getStylesVarName(isComponentStylesheet ? comp : null);
- var /** @type {?} */ stmt = variable(stylesVar)
- .set(literalArr(styleExpressions, new ArrayType(DYNAMIC_TYPE, [TypeModifier.Const])))
- .toDeclStmt(null, isComponentStylesheet ? [StmtModifier.Final] : [
- StmtModifier.Final, StmtModifier.Exported
- ]);
- outputCtx.statements.push(stmt);
- return new CompiledStylesheet(outputCtx, stylesVar, dependencies, shim, stylesheet);
- };
- /**
- * @param {?} style
- * @param {?} shim
- * @return {?}
- */
- StyleCompiler.prototype._shimIfNeeded = /**
- * @param {?} style
- * @param {?} shim
- * @return {?}
- */
- function (style, shim) {
- return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style;
- };
- return StyleCompiler;
- }());
- /**
- * @param {?} component
- * @return {?}
- */
- function getStylesVarName(component) {
- var /** @type {?} */ result = "styles";
- if (component) {
- result += "_" + identifierName(component.type);
- }
- return result;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var PRESERVE_WS_ATTR_NAME = 'ngPreserveWhitespaces';
- var SKIP_WS_TRIM_TAGS = new Set(['pre', 'template', 'textarea', 'script', 'style']);
- // Equivalent to \s with \u00a0 (non-breaking space) excluded.
- // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
- var WS_CHARS = ' \f\n\r\t\v\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff';
- var NO_WS_REGEXP = new RegExp("[^" + WS_CHARS + "]");
- var WS_REPLACE_REGEXP = new RegExp("[" + WS_CHARS + "]{2,}", 'g');
- /**
- * @param {?} attrs
- * @return {?}
- */
- function hasPreserveWhitespacesAttr(attrs) {
- return attrs.some(function (attr) { return attr.name === PRESERVE_WS_ATTR_NAME; });
- }
- /**
- * Angular Dart introduced &ngsp; as a placeholder for non-removable space, see:
- * https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart#L25-L32
- * In Angular Dart &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character
- * and later on replaced by a space. We are re-implementing the same idea here.
- * @param {?} value
- * @return {?}
- */
- function replaceNgsp(value) {
- // lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE
- return value.replace(new RegExp(NGSP_UNICODE, 'g'), ' ');
- }
- /**
- * This visitor can walk HTML parse tree and remove / trim text nodes using the following rules:
- * - consider spaces, tabs and new lines as whitespace characters;
- * - drop text nodes consisting of whitespace characters only;
- * - for all other text nodes replace consecutive whitespace characters with one space;
- * - convert &ngsp; pseudo-entity to a single space;
- *
- * Removal and trimming of whitespaces have positive performance impact (less code to generate
- * while compiling templates, faster view creation). At the same time it can be "destructive"
- * in some cases (whitespaces can influence layout). Because of the potential of breaking layout
- * this visitor is not activated by default in Angular 5 and people need to explicitly opt-in for
- * whitespace removal. The default option for whitespace removal will be revisited in Angular 6
- * and might be changed to "on" by default.
- */
- var WhitespaceVisitor = /** @class */ (function () {
- function WhitespaceVisitor() {
- }
- /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- WhitespaceVisitor.prototype.visitElement = /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- function (element, context) {
- if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) {
- // don't descent into elements where we need to preserve whitespaces
- // but still visit all attributes to eliminate one used as a market to preserve WS
- return new Element(element.name, visitAll(this, element.attrs), element.children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
- }
- return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
- };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- WhitespaceVisitor.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) {
- return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null;
- };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- WhitespaceVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) {
- var /** @type {?} */ isNotBlank = text.value.match(NO_WS_REGEXP);
- if (isNotBlank) {
- return new Text(replaceNgsp(text.value).replace(WS_REPLACE_REGEXP, ' '), text.sourceSpan);
- }
- return null;
- };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- WhitespaceVisitor.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { return comment; };
- /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- WhitespaceVisitor.prototype.visitExpansion = /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- function (expansion, context) { return expansion; };
- /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- WhitespaceVisitor.prototype.visitExpansionCase = /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- function (expansionCase, context) { return expansionCase; };
- return WhitespaceVisitor;
- }());
- /**
- * @param {?} htmlAstWithErrors
- * @return {?}
- */
- function removeWhitespaces(htmlAstWithErrors) {
- return new ParseTreeResult(visitAll(new WhitespaceVisitor(), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // http://cldr.unicode.org/index/cldr-spec/plural-rules
- var PLURAL_CASES = ['zero', 'one', 'two', 'few', 'many', 'other'];
- /**
- * Expands special forms into elements.
- *
- * For example,
- *
- * ```
- * { messages.length, plural,
- * =0 {zero}
- * =1 {one}
- * other {more than one}
- * }
- * ```
- *
- * will be expanded into
- *
- * ```
- * <ng-container [ngPlural]="messages.length">
- * <ng-template ngPluralCase="=0">zero</ng-template>
- * <ng-template ngPluralCase="=1">one</ng-template>
- * <ng-template ngPluralCase="other">more than one</ng-template>
- * </ng-container>
- * ```
- * @param {?} nodes
- * @return {?}
- */
- function expandNodes(nodes) {
- var /** @type {?} */ expander = new _Expander();
- return new ExpansionResult(visitAll(expander, nodes), expander.isExpanded, expander.errors);
- }
- var ExpansionResult = /** @class */ (function () {
- function ExpansionResult(nodes, expanded, errors) {
- this.nodes = nodes;
- this.expanded = expanded;
- this.errors = errors;
- }
- return ExpansionResult;
- }());
- var ExpansionError = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExpansionError, _super);
- function ExpansionError(span, errorMsg) {
- return _super.call(this, span, errorMsg) || this;
- }
- return ExpansionError;
- }(ParseError));
- /**
- * Expand expansion forms (plural, select) to directives
- *
- * \@internal
- */
- var _Expander = /** @class */ (function () {
- function _Expander() {
- this.isExpanded = false;
- this.errors = [];
- }
- /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- _Expander.prototype.visitElement = /**
- * @param {?} element
- * @param {?} context
- * @return {?}
- */
- function (element, context) {
- return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
- };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- _Expander.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) { return attribute; };
- /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- _Expander.prototype.visitText = /**
- * @param {?} text
- * @param {?} context
- * @return {?}
- */
- function (text, context) { return text; };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- _Expander.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { return comment; };
- /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- _Expander.prototype.visitExpansion = /**
- * @param {?} icu
- * @param {?} context
- * @return {?}
- */
- function (icu, context) {
- this.isExpanded = true;
- return icu.type == 'plural' ? _expandPluralForm(icu, this.errors) :
- _expandDefaultForm(icu, this.errors);
- };
- /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- _Expander.prototype.visitExpansionCase = /**
- * @param {?} icuCase
- * @param {?} context
- * @return {?}
- */
- function (icuCase, context) {
- throw new Error('Should not be reached');
- };
- return _Expander;
- }());
- /**
- * @param {?} ast
- * @param {?} errors
- * @return {?}
- */
- function _expandPluralForm(ast, errors) {
- var /** @type {?} */ children = ast.cases.map(function (c) {
- if (PLURAL_CASES.indexOf(c.value) == -1 && !c.value.match(/^=\d+$/)) {
- errors.push(new ExpansionError(c.valueSourceSpan, "Plural cases should be \"=<number>\" or one of " + PLURAL_CASES.join(", ")));
- }
- var /** @type {?} */ expansionResult = expandNodes(c.expression);
- errors.push.apply(errors, expansionResult.errors);
- return new Element("ng-template", [new Attribute$1('ngPluralCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
- });
- var /** @type {?} */ switchAttr = new Attribute$1('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan);
- return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
- }
- /**
- * @param {?} ast
- * @param {?} errors
- * @return {?}
- */
- function _expandDefaultForm(ast, errors) {
- var /** @type {?} */ children = ast.cases.map(function (c) {
- var /** @type {?} */ expansionResult = expandNodes(c.expression);
- errors.push.apply(errors, expansionResult.errors);
- if (c.value === 'other') {
- // other is the default case when no values match
- return new Element("ng-template", [new Attribute$1('ngSwitchDefault', '', c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
- }
- return new Element("ng-template", [new Attribute$1('ngSwitchCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
- });
- var /** @type {?} */ switchAttr = new Attribute$1('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan);
- return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var PROPERTY_PARTS_SEPARATOR = '.';
- var ATTRIBUTE_PREFIX = 'attr';
- var CLASS_PREFIX = 'class';
- var STYLE_PREFIX = 'style';
- var ANIMATE_PROP_PREFIX = 'animate-';
- /** @enum {number} */
- var BoundPropertyType = {
- DEFAULT: 0,
- LITERAL_ATTR: 1,
- ANIMATION: 2,
- };
- BoundPropertyType[BoundPropertyType.DEFAULT] = "DEFAULT";
- BoundPropertyType[BoundPropertyType.LITERAL_ATTR] = "LITERAL_ATTR";
- BoundPropertyType[BoundPropertyType.ANIMATION] = "ANIMATION";
- /**
- * Represents a parsed property.
- */
- var BoundProperty = /** @class */ (function () {
- function BoundProperty(name, expression, type, sourceSpan) {
- this.name = name;
- this.expression = expression;
- this.type = type;
- this.sourceSpan = sourceSpan;
- this.isLiteral = this.type === BoundPropertyType.LITERAL_ATTR;
- this.isAnimation = this.type === BoundPropertyType.ANIMATION;
- }
- return BoundProperty;
- }());
- /**
- * Parses bindings in templates and in the directive host area.
- */
- var BindingParser = /** @class */ (function () {
- function BindingParser(_exprParser, _interpolationConfig, _schemaRegistry, pipes, _targetErrors) {
- var _this = this;
- this._exprParser = _exprParser;
- this._interpolationConfig = _interpolationConfig;
- this._schemaRegistry = _schemaRegistry;
- this._targetErrors = _targetErrors;
- this.pipesByName = new Map();
- this._usedPipes = new Map();
- pipes.forEach(function (pipe) { return _this.pipesByName.set(pipe.name, pipe); });
- }
- /**
- * @return {?}
- */
- BindingParser.prototype.getUsedPipes = /**
- * @return {?}
- */
- function () { return Array.from(this._usedPipes.values()); };
- /**
- * @param {?} dirMeta
- * @param {?} elementSelector
- * @param {?} sourceSpan
- * @return {?}
- */
- BindingParser.prototype.createDirectiveHostPropertyAsts = /**
- * @param {?} dirMeta
- * @param {?} elementSelector
- * @param {?} sourceSpan
- * @return {?}
- */
- function (dirMeta, elementSelector, sourceSpan) {
- var _this = this;
- if (dirMeta.hostProperties) {
- var /** @type {?} */ boundProps_1 = [];
- Object.keys(dirMeta.hostProperties).forEach(function (propName) {
- var /** @type {?} */ expression = dirMeta.hostProperties[propName];
- if (typeof expression === 'string') {
- _this.parsePropertyBinding(propName, expression, true, sourceSpan, [], boundProps_1);
- }
- else {
- _this._reportError("Value of the host property binding \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
- }
- });
- return boundProps_1.map(function (prop) { return _this.createElementPropertyAst(elementSelector, prop); });
- }
- return null;
- };
- /**
- * @param {?} dirMeta
- * @param {?} sourceSpan
- * @return {?}
- */
- BindingParser.prototype.createDirectiveHostEventAsts = /**
- * @param {?} dirMeta
- * @param {?} sourceSpan
- * @return {?}
- */
- function (dirMeta, sourceSpan) {
- var _this = this;
- if (dirMeta.hostListeners) {
- var /** @type {?} */ targetEventAsts_1 = [];
- Object.keys(dirMeta.hostListeners).forEach(function (propName) {
- var /** @type {?} */ expression = dirMeta.hostListeners[propName];
- if (typeof expression === 'string') {
- _this.parseEvent(propName, expression, sourceSpan, [], targetEventAsts_1);
- }
- else {
- _this._reportError("Value of the host listener \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
- }
- });
- return targetEventAsts_1;
- }
- return null;
- };
- /**
- * @param {?} value
- * @param {?} sourceSpan
- * @return {?}
- */
- BindingParser.prototype.parseInterpolation = /**
- * @param {?} value
- * @param {?} sourceSpan
- * @return {?}
- */
- function (value, sourceSpan) {
- var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
- try {
- var /** @type {?} */ ast = /** @type {?} */ ((this._exprParser.parseInterpolation(value, sourceInfo, this._interpolationConfig)));
- if (ast)
- this._reportExpressionParserErrors(ast.errors, sourceSpan);
- this._checkPipes(ast, sourceSpan);
- return ast;
- }
- catch (/** @type {?} */ e) {
- this._reportError("" + e, sourceSpan);
- return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
- }
- };
- /**
- * @param {?} prefixToken
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @param {?} targetVars
- * @return {?}
- */
- BindingParser.prototype.parseInlineTemplateBinding = /**
- * @param {?} prefixToken
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @param {?} targetVars
- * @return {?}
- */
- function (prefixToken, value, sourceSpan, targetMatchableAttrs, targetProps, targetVars) {
- var /** @type {?} */ bindings = this._parseTemplateBindings(prefixToken, value, sourceSpan);
- for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
- var /** @type {?} */ binding = bindings[i];
- if (binding.keyIsVar) {
- targetVars.push(new VariableAst(binding.key, binding.name, sourceSpan));
- }
- else if (binding.expression) {
- this._parsePropertyAst(binding.key, binding.expression, sourceSpan, targetMatchableAttrs, targetProps);
- }
- else {
- targetMatchableAttrs.push([binding.key, '']);
- this.parseLiteralAttr(binding.key, null, sourceSpan, targetMatchableAttrs, targetProps);
- }
- }
- };
- /**
- * @param {?} prefixToken
- * @param {?} value
- * @param {?} sourceSpan
- * @return {?}
- */
- BindingParser.prototype._parseTemplateBindings = /**
- * @param {?} prefixToken
- * @param {?} value
- * @param {?} sourceSpan
- * @return {?}
- */
- function (prefixToken, value, sourceSpan) {
- var _this = this;
- var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
- try {
- var /** @type {?} */ bindingsResult = this._exprParser.parseTemplateBindings(prefixToken, value, sourceInfo);
- this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan);
- bindingsResult.templateBindings.forEach(function (binding) {
- if (binding.expression) {
- _this._checkPipes(binding.expression, sourceSpan);
- }
- });
- bindingsResult.warnings.forEach(function (warning) { _this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); });
- return bindingsResult.templateBindings;
- }
- catch (/** @type {?} */ e) {
- this._reportError("" + e, sourceSpan);
- return [];
- }
- };
- /**
- * @param {?} name
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- BindingParser.prototype.parseLiteralAttr = /**
- * @param {?} name
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- function (name, value, sourceSpan, targetMatchableAttrs, targetProps) {
- if (_isAnimationLabel(name)) {
- name = name.substring(1);
- if (value) {
- this._reportError("Assigning animation triggers via @prop=\"exp\" attributes with an expression is invalid." +
- " Use property bindings (e.g. [@prop]=\"exp\") or use an attribute without a value (e.g. @prop) instead.", sourceSpan, ParseErrorLevel.ERROR);
- }
- this._parseAnimation(name, value, sourceSpan, targetMatchableAttrs, targetProps);
- }
- else {
- targetProps.push(new BoundProperty(name, this._exprParser.wrapLiteralPrimitive(value, ''), BoundPropertyType.LITERAL_ATTR, sourceSpan));
- }
- };
- /**
- * @param {?} name
- * @param {?} expression
- * @param {?} isHost
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- BindingParser.prototype.parsePropertyBinding = /**
- * @param {?} name
- * @param {?} expression
- * @param {?} isHost
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- function (name, expression, isHost, sourceSpan, targetMatchableAttrs, targetProps) {
- var /** @type {?} */ isAnimationProp = false;
- if (name.startsWith(ANIMATE_PROP_PREFIX)) {
- isAnimationProp = true;
- name = name.substring(ANIMATE_PROP_PREFIX.length);
- }
- else if (_isAnimationLabel(name)) {
- isAnimationProp = true;
- name = name.substring(1);
- }
- if (isAnimationProp) {
- this._parseAnimation(name, expression, sourceSpan, targetMatchableAttrs, targetProps);
- }
- else {
- this._parsePropertyAst(name, this._parseBinding(expression, isHost, sourceSpan), sourceSpan, targetMatchableAttrs, targetProps);
- }
- };
- /**
- * @param {?} name
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- BindingParser.prototype.parsePropertyInterpolation = /**
- * @param {?} name
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- function (name, value, sourceSpan, targetMatchableAttrs, targetProps) {
- var /** @type {?} */ expr = this.parseInterpolation(value, sourceSpan);
- if (expr) {
- this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps);
- return true;
- }
- return false;
- };
- /**
- * @param {?} name
- * @param {?} ast
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- BindingParser.prototype._parsePropertyAst = /**
- * @param {?} name
- * @param {?} ast
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- function (name, ast, sourceSpan, targetMatchableAttrs, targetProps) {
- targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]);
- targetProps.push(new BoundProperty(name, ast, BoundPropertyType.DEFAULT, sourceSpan));
- };
- /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- BindingParser.prototype._parseAnimation = /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @return {?}
- */
- function (name, expression, sourceSpan, targetMatchableAttrs, targetProps) {
- // This will occur when a @trigger is not paired with an expression.
- // For animations it is valid to not have an expression since */void
- // states will be applied by angular when the element is attached/detached
- var /** @type {?} */ ast = this._parseBinding(expression || 'undefined', false, sourceSpan);
- targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]);
- targetProps.push(new BoundProperty(name, ast, BoundPropertyType.ANIMATION, sourceSpan));
- };
- /**
- * @param {?} value
- * @param {?} isHostBinding
- * @param {?} sourceSpan
- * @return {?}
- */
- BindingParser.prototype._parseBinding = /**
- * @param {?} value
- * @param {?} isHostBinding
- * @param {?} sourceSpan
- * @return {?}
- */
- function (value, isHostBinding, sourceSpan) {
- var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
- try {
- var /** @type {?} */ ast = isHostBinding ?
- this._exprParser.parseSimpleBinding(value, sourceInfo, this._interpolationConfig) :
- this._exprParser.parseBinding(value, sourceInfo, this._interpolationConfig);
- if (ast)
- this._reportExpressionParserErrors(ast.errors, sourceSpan);
- this._checkPipes(ast, sourceSpan);
- return ast;
- }
- catch (/** @type {?} */ e) {
- this._reportError("" + e, sourceSpan);
- return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
- }
- };
- /**
- * @param {?} elementSelector
- * @param {?} boundProp
- * @return {?}
- */
- BindingParser.prototype.createElementPropertyAst = /**
- * @param {?} elementSelector
- * @param {?} boundProp
- * @return {?}
- */
- function (elementSelector, boundProp) {
- if (boundProp.isAnimation) {
- return new BoundElementPropertyAst(boundProp.name, PropertyBindingType.Animation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan);
- }
- var /** @type {?} */ unit = null;
- var /** @type {?} */ bindingType = /** @type {?} */ ((undefined));
- var /** @type {?} */ boundPropertyName = null;
- var /** @type {?} */ parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
- var /** @type {?} */ securityContexts = /** @type {?} */ ((undefined));
- // Check check for special cases (prefix style, attr, class)
- if (parts.length > 1) {
- if (parts[0] == ATTRIBUTE_PREFIX) {
- boundPropertyName = parts[1];
- this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
- securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true);
- var /** @type {?} */ nsSeparatorIdx = boundPropertyName.indexOf(':');
- if (nsSeparatorIdx > -1) {
- var /** @type {?} */ ns = boundPropertyName.substring(0, nsSeparatorIdx);
- var /** @type {?} */ name_1 = boundPropertyName.substring(nsSeparatorIdx + 1);
- boundPropertyName = mergeNsAndName(ns, name_1);
- }
- bindingType = PropertyBindingType.Attribute;
- }
- else if (parts[0] == CLASS_PREFIX) {
- boundPropertyName = parts[1];
- bindingType = PropertyBindingType.Class;
- securityContexts = [SecurityContext.NONE];
- }
- else if (parts[0] == STYLE_PREFIX) {
- unit = parts.length > 2 ? parts[2] : null;
- boundPropertyName = parts[1];
- bindingType = PropertyBindingType.Style;
- securityContexts = [SecurityContext.STYLE];
- }
- }
- // If not a special case, use the full property name
- if (boundPropertyName === null) {
- boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name);
- securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, false);
- bindingType = PropertyBindingType.Property;
- this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
- }
- return new BoundElementPropertyAst(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan);
- };
- /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetEvents
- * @return {?}
- */
- BindingParser.prototype.parseEvent = /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetEvents
- * @return {?}
- */
- function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
- if (_isAnimationLabel(name)) {
- name = name.substr(1);
- this._parseAnimationEvent(name, expression, sourceSpan, targetEvents);
- }
- else {
- this._parseEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents);
- }
- };
- /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetEvents
- * @return {?}
- */
- BindingParser.prototype._parseAnimationEvent = /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetEvents
- * @return {?}
- */
- function (name, expression, sourceSpan, targetEvents) {
- var /** @type {?} */ matches = splitAtPeriod(name, [name, '']);
- var /** @type {?} */ eventName = matches[0];
- var /** @type {?} */ phase = matches[1].toLowerCase();
- if (phase) {
- switch (phase) {
- case 'start':
- case 'done':
- var /** @type {?} */ ast = this._parseAction(expression, sourceSpan);
- targetEvents.push(new BoundEventAst(eventName, null, phase, ast, sourceSpan));
- break;
- default:
- this._reportError("The provided animation output phase value \"" + phase + "\" for \"@" + eventName + "\" is not supported (use start or done)", sourceSpan);
- break;
- }
- }
- else {
- this._reportError("The animation trigger output event (@" + eventName + ") is missing its phase value name (start or done are currently supported)", sourceSpan);
- }
- };
- /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetEvents
- * @return {?}
- */
- BindingParser.prototype._parseEvent = /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetEvents
- * @return {?}
- */
- function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
- // long format: 'target: eventName'
- var _a = splitAtColon(name, [/** @type {?} */ ((null)), name]), target = _a[0], eventName = _a[1];
- var /** @type {?} */ ast = this._parseAction(expression, sourceSpan);
- targetMatchableAttrs.push([/** @type {?} */ ((name)), /** @type {?} */ ((ast.source))]);
- targetEvents.push(new BoundEventAst(eventName, target, null, ast, sourceSpan));
- // Don't detect directives for event names for now,
- // so don't add the event name to the matchableAttrs
- };
- /**
- * @param {?} value
- * @param {?} sourceSpan
- * @return {?}
- */
- BindingParser.prototype._parseAction = /**
- * @param {?} value
- * @param {?} sourceSpan
- * @return {?}
- */
- function (value, sourceSpan) {
- var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
- try {
- var /** @type {?} */ ast = this._exprParser.parseAction(value, sourceInfo, this._interpolationConfig);
- if (ast) {
- this._reportExpressionParserErrors(ast.errors, sourceSpan);
- }
- if (!ast || ast.ast instanceof EmptyExpr) {
- this._reportError("Empty expressions are not allowed", sourceSpan);
- return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
- }
- this._checkPipes(ast, sourceSpan);
- return ast;
- }
- catch (/** @type {?} */ e) {
- this._reportError("" + e, sourceSpan);
- return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
- }
- };
- /**
- * @param {?} message
- * @param {?} sourceSpan
- * @param {?=} level
- * @return {?}
- */
- BindingParser.prototype._reportError = /**
- * @param {?} message
- * @param {?} sourceSpan
- * @param {?=} level
- * @return {?}
- */
- function (message, sourceSpan, level) {
- if (level === void 0) { level = ParseErrorLevel.ERROR; }
- this._targetErrors.push(new ParseError(sourceSpan, message, level));
- };
- /**
- * @param {?} errors
- * @param {?} sourceSpan
- * @return {?}
- */
- BindingParser.prototype._reportExpressionParserErrors = /**
- * @param {?} errors
- * @param {?} sourceSpan
- * @return {?}
- */
- function (errors, sourceSpan) {
- for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {
- var error = errors_1[_i];
- this._reportError(error.message, sourceSpan);
- }
- };
- /**
- * @param {?} ast
- * @param {?} sourceSpan
- * @return {?}
- */
- BindingParser.prototype._checkPipes = /**
- * @param {?} ast
- * @param {?} sourceSpan
- * @return {?}
- */
- function (ast, sourceSpan) {
- var _this = this;
- if (ast) {
- var /** @type {?} */ collector = new PipeCollector();
- ast.visit(collector);
- collector.pipes.forEach(function (ast, pipeName) {
- var /** @type {?} */ pipeMeta = _this.pipesByName.get(pipeName);
- if (!pipeMeta) {
- _this._reportError("The pipe '" + pipeName + "' could not be found", new ParseSourceSpan(sourceSpan.start.moveBy(ast.span.start), sourceSpan.start.moveBy(ast.span.end)));
- }
- else {
- _this._usedPipes.set(pipeName, pipeMeta);
- }
- });
- }
- };
- /**
- * @param {?} propName the name of the property / attribute
- * @param {?} sourceSpan
- * @param {?} isAttr true when binding to an attribute
- * @return {?}
- */
- BindingParser.prototype._validatePropertyOrAttributeName = /**
- * @param {?} propName the name of the property / attribute
- * @param {?} sourceSpan
- * @param {?} isAttr true when binding to an attribute
- * @return {?}
- */
- function (propName, sourceSpan, isAttr) {
- var /** @type {?} */ report = isAttr ? this._schemaRegistry.validateAttribute(propName) :
- this._schemaRegistry.validateProperty(propName);
- if (report.error) {
- this._reportError(/** @type {?} */ ((report.msg)), sourceSpan, ParseErrorLevel.ERROR);
- }
- };
- return BindingParser;
- }());
- var PipeCollector = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PipeCollector, _super);
- function PipeCollector() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.pipes = new Map();
- return _this;
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- PipeCollector.prototype.visitPipe = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- this.pipes.set(ast.name, ast);
- ast.exp.visit(this);
- this.visitAll(ast.args, context);
- return null;
- };
- return PipeCollector;
- }(RecursiveAstVisitor));
- /**
- * @param {?} name
- * @return {?}
- */
- function _isAnimationLabel(name) {
- return name[0] == '@';
- }
- /**
- * @param {?} registry
- * @param {?} selector
- * @param {?} propName
- * @param {?} isAttribute
- * @return {?}
- */
- function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
- var /** @type {?} */ ctxs = [];
- CssSelector.parse(selector).forEach(function (selector) {
- var /** @type {?} */ elementNames = selector.element ? [selector.element] : registry.allKnownElementNames();
- var /** @type {?} */ notElementNames = new Set(selector.notSelectors.filter(function (selector) { return selector.isElementSelector(); })
- .map(function (selector) { return selector.element; }));
- var /** @type {?} */ possibleElementNames = elementNames.filter(function (elementName) { return !notElementNames.has(elementName); });
- ctxs.push.apply(ctxs, possibleElementNames.map(function (elementName) { return registry.securityContext(elementName, propName, isAttribute); }));
- });
- return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort();
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/;
- // Group 1 = "bind-"
- var KW_BIND_IDX = 1;
- // Group 2 = "let-"
- var KW_LET_IDX = 2;
- // Group 3 = "ref-/#"
- var KW_REF_IDX = 3;
- // Group 4 = "on-"
- var KW_ON_IDX = 4;
- // Group 5 = "bindon-"
- var KW_BINDON_IDX = 5;
- // Group 6 = "@"
- var KW_AT_IDX = 6;
- // Group 7 = the identifier after "bind-", "let-", "ref-/#", "on-", "bindon-" or "@"
- var IDENT_KW_IDX = 7;
- // Group 8 = identifier inside [()]
- var IDENT_BANANA_BOX_IDX = 8;
- // Group 9 = identifier inside []
- var IDENT_PROPERTY_IDX = 9;
- // Group 10 = identifier inside ()
- var IDENT_EVENT_IDX = 10;
- // deprecated in 4.x
- var TEMPLATE_ELEMENT = 'template';
- // deprecated in 4.x
- var TEMPLATE_ATTR = 'template';
- var TEMPLATE_ATTR_PREFIX = '*';
- var CLASS_ATTR = 'class';
- var TEXT_CSS_SELECTOR = CssSelector.parse('*')[0];
- var TEMPLATE_ELEMENT_DEPRECATION_WARNING = 'The <template> element is deprecated. Use <ng-template> instead';
- var TEMPLATE_ATTR_DEPRECATION_WARNING = 'The template attribute is deprecated. Use an ng-template element instead.';
- var warningCounts = {};
- /**
- * @param {?} warnings
- * @return {?}
- */
- function warnOnlyOnce(warnings) {
- return function (error) {
- if (warnings.indexOf(error.msg) !== -1) {
- warningCounts[error.msg] = (warningCounts[error.msg] || 0) + 1;
- return warningCounts[error.msg] <= 1;
- }
- return true;
- };
- }
- var TemplateParseError = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TemplateParseError, _super);
- function TemplateParseError(message, span, level) {
- return _super.call(this, span, message, level) || this;
- }
- return TemplateParseError;
- }(ParseError));
- var TemplateParseResult = /** @class */ (function () {
- function TemplateParseResult(templateAst, usedPipes, errors) {
- this.templateAst = templateAst;
- this.usedPipes = usedPipes;
- this.errors = errors;
- }
- return TemplateParseResult;
- }());
- var TemplateParser = /** @class */ (function () {
- function TemplateParser(_config, _reflector, _exprParser, _schemaRegistry, _htmlParser, _console, transforms) {
- this._config = _config;
- this._reflector = _reflector;
- this._exprParser = _exprParser;
- this._schemaRegistry = _schemaRegistry;
- this._htmlParser = _htmlParser;
- this._console = _console;
- this.transforms = transforms;
- }
- /**
- * @param {?} component
- * @param {?} template
- * @param {?} directives
- * @param {?} pipes
- * @param {?} schemas
- * @param {?} templateUrl
- * @param {?} preserveWhitespaces
- * @return {?}
- */
- TemplateParser.prototype.parse = /**
- * @param {?} component
- * @param {?} template
- * @param {?} directives
- * @param {?} pipes
- * @param {?} schemas
- * @param {?} templateUrl
- * @param {?} preserveWhitespaces
- * @return {?}
- */
- function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) {
- var /** @type {?} */ result = this.tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces);
- var /** @type {?} */ warnings = /** @type {?} */ ((result.errors)).filter(function (error) { return error.level === ParseErrorLevel.WARNING; }).filter(warnOnlyOnce([TEMPLATE_ATTR_DEPRECATION_WARNING, TEMPLATE_ELEMENT_DEPRECATION_WARNING]));
- var /** @type {?} */ errors = /** @type {?} */ ((result.errors)).filter(function (error) { return error.level === ParseErrorLevel.ERROR; });
- if (warnings.length > 0) {
- this._console.warn("Template parse warnings:\n" + warnings.join('\n'));
- }
- if (errors.length > 0) {
- var /** @type {?} */ errorString = errors.join('\n');
- throw syntaxError("Template parse errors:\n" + errorString, errors);
- }
- return { template: /** @type {?} */ ((result.templateAst)), pipes: /** @type {?} */ ((result.usedPipes)) };
- };
- /**
- * @param {?} component
- * @param {?} template
- * @param {?} directives
- * @param {?} pipes
- * @param {?} schemas
- * @param {?} templateUrl
- * @param {?} preserveWhitespaces
- * @return {?}
- */
- TemplateParser.prototype.tryParse = /**
- * @param {?} component
- * @param {?} template
- * @param {?} directives
- * @param {?} pipes
- * @param {?} schemas
- * @param {?} templateUrl
- * @param {?} preserveWhitespaces
- * @return {?}
- */
- function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) {
- var /** @type {?} */ htmlParseResult = typeof template === 'string' ? /** @type {?} */ ((this._htmlParser)).parse(template, templateUrl, true, this.getInterpolationConfig(component)) :
- template;
- if (!preserveWhitespaces) {
- htmlParseResult = removeWhitespaces(htmlParseResult);
- }
- return this.tryParseHtml(this.expandHtml(htmlParseResult), component, directives, pipes, schemas);
- };
- /**
- * @param {?} htmlAstWithErrors
- * @param {?} component
- * @param {?} directives
- * @param {?} pipes
- * @param {?} schemas
- * @return {?}
- */
- TemplateParser.prototype.tryParseHtml = /**
- * @param {?} htmlAstWithErrors
- * @param {?} component
- * @param {?} directives
- * @param {?} pipes
- * @param {?} schemas
- * @return {?}
- */
- function (htmlAstWithErrors, component, directives, pipes, schemas) {
- var /** @type {?} */ result;
- var /** @type {?} */ errors = htmlAstWithErrors.errors;
- var /** @type {?} */ usedPipes = [];
- if (htmlAstWithErrors.rootNodes.length > 0) {
- var /** @type {?} */ uniqDirectives = removeSummaryDuplicates(directives);
- var /** @type {?} */ uniqPipes = removeSummaryDuplicates(pipes);
- var /** @type {?} */ providerViewContext = new ProviderViewContext(this._reflector, component);
- var /** @type {?} */ interpolationConfig = /** @type {?} */ ((undefined));
- if (component.template && component.template.interpolation) {
- interpolationConfig = {
- start: component.template.interpolation[0],
- end: component.template.interpolation[1]
- };
- }
- var /** @type {?} */ bindingParser = new BindingParser(this._exprParser, /** @type {?} */ ((interpolationConfig)), this._schemaRegistry, uniqPipes, errors);
- var /** @type {?} */ parseVisitor = new TemplateParseVisitor(this._reflector, this._config, providerViewContext, uniqDirectives, bindingParser, this._schemaRegistry, schemas, errors);
- result = visitAll(parseVisitor, htmlAstWithErrors.rootNodes, EMPTY_ELEMENT_CONTEXT);
- errors.push.apply(errors, providerViewContext.errors);
- usedPipes.push.apply(usedPipes, bindingParser.getUsedPipes());
- }
- else {
- result = [];
- }
- this._assertNoReferenceDuplicationOnTemplate(result, errors);
- if (errors.length > 0) {
- return new TemplateParseResult(result, usedPipes, errors);
- }
- if (this.transforms) {
- this.transforms.forEach(function (transform) { result = templateVisitAll(transform, result); });
- }
- return new TemplateParseResult(result, usedPipes, errors);
- };
- /**
- * @param {?} htmlAstWithErrors
- * @param {?=} forced
- * @return {?}
- */
- TemplateParser.prototype.expandHtml = /**
- * @param {?} htmlAstWithErrors
- * @param {?=} forced
- * @return {?}
- */
- function (htmlAstWithErrors, forced) {
- if (forced === void 0) { forced = false; }
- var /** @type {?} */ errors = htmlAstWithErrors.errors;
- if (errors.length == 0 || forced) {
- // Transform ICU messages to angular directives
- var /** @type {?} */ expandedHtmlAst = expandNodes(htmlAstWithErrors.rootNodes);
- errors.push.apply(errors, expandedHtmlAst.errors);
- htmlAstWithErrors = new ParseTreeResult(expandedHtmlAst.nodes, errors);
- }
- return htmlAstWithErrors;
- };
- /**
- * @param {?} component
- * @return {?}
- */
- TemplateParser.prototype.getInterpolationConfig = /**
- * @param {?} component
- * @return {?}
- */
- function (component) {
- if (component.template) {
- return InterpolationConfig.fromArray(component.template.interpolation);
- }
- return undefined;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} result
- * @param {?} errors
- * @return {?}
- */
- TemplateParser.prototype._assertNoReferenceDuplicationOnTemplate = /**
- * \@internal
- * @param {?} result
- * @param {?} errors
- * @return {?}
- */
- function (result, errors) {
- var /** @type {?} */ existingReferences = [];
- result.filter(function (element) { return !!(/** @type {?} */ (element)).references; })
- .forEach(function (element) {
- return (/** @type {?} */ (element)).references.forEach(function (reference) {
- var /** @type {?} */ name = reference.name;
- if (existingReferences.indexOf(name) < 0) {
- existingReferences.push(name);
- }
- else {
- var /** @type {?} */ error = new TemplateParseError("Reference \"#" + name + "\" is defined several times", reference.sourceSpan, ParseErrorLevel.ERROR);
- errors.push(error);
- }
- });
- });
- };
- return TemplateParser;
- }());
- var TemplateParseVisitor = /** @class */ (function () {
- function TemplateParseVisitor(reflector, config, providerViewContext, directives, _bindingParser, _schemaRegistry, _schemas, _targetErrors) {
- var _this = this;
- this.reflector = reflector;
- this.config = config;
- this.providerViewContext = providerViewContext;
- this._bindingParser = _bindingParser;
- this._schemaRegistry = _schemaRegistry;
- this._schemas = _schemas;
- this._targetErrors = _targetErrors;
- this.selectorMatcher = new SelectorMatcher();
- this.directivesIndex = new Map();
- this.ngContentCount = 0;
- // Note: queries start with id 1 so we can use the number in a Bloom filter!
- this.contentQueryStartId = providerViewContext.component.viewQueries.length + 1;
- directives.forEach(function (directive, index) {
- var /** @type {?} */ selector = CssSelector.parse(/** @type {?} */ ((directive.selector)));
- _this.selectorMatcher.addSelectables(selector, directive);
- _this.directivesIndex.set(directive, index);
- });
- }
- /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- TemplateParseVisitor.prototype.visitExpansion = /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- function (expansion, context) { return null; };
- /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- TemplateParseVisitor.prototype.visitExpansionCase = /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- function (expansionCase, context) { return null; };
- /**
- * @param {?} text
- * @param {?} parent
- * @return {?}
- */
- TemplateParseVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?} parent
- * @return {?}
- */
- function (text, parent) {
- var /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(TEXT_CSS_SELECTOR)));
- var /** @type {?} */ valueNoNgsp = replaceNgsp(text.value);
- var /** @type {?} */ expr = this._bindingParser.parseInterpolation(valueNoNgsp, /** @type {?} */ ((text.sourceSpan)));
- return expr ? new BoundTextAst(expr, ngContentIndex, /** @type {?} */ ((text.sourceSpan))) :
- new TextAst(valueNoNgsp, ngContentIndex, /** @type {?} */ ((text.sourceSpan)));
- };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- TemplateParseVisitor.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) {
- return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan);
- };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- TemplateParseVisitor.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { return null; };
- /**
- * @param {?} element
- * @param {?} parent
- * @return {?}
- */
- TemplateParseVisitor.prototype.visitElement = /**
- * @param {?} element
- * @param {?} parent
- * @return {?}
- */
- function (element, parent) {
- var _this = this;
- var /** @type {?} */ queryStartIndex = this.contentQueryStartId;
- var /** @type {?} */ nodeName = element.name;
- var /** @type {?} */ preparsedElement = preparseElement(element);
- if (preparsedElement.type === PreparsedElementType.SCRIPT ||
- preparsedElement.type === PreparsedElementType.STYLE) {
- // Skipping <script> for security reasons
- // Skipping <style> as we already processed them
- // in the StyleCompiler
- return null;
- }
- if (preparsedElement.type === PreparsedElementType.STYLESHEET &&
- isStyleUrlResolvable(preparsedElement.hrefAttr)) {
- // Skipping stylesheets with either relative urls or package scheme as we already processed
- // them in the StyleCompiler
- return null;
- }
- var /** @type {?} */ matchableAttrs = [];
- var /** @type {?} */ elementOrDirectiveProps = [];
- var /** @type {?} */ elementOrDirectiveRefs = [];
- var /** @type {?} */ elementVars = [];
- var /** @type {?} */ events = [];
- var /** @type {?} */ templateElementOrDirectiveProps = [];
- var /** @type {?} */ templateMatchableAttrs = [];
- var /** @type {?} */ templateElementVars = [];
- var /** @type {?} */ hasInlineTemplates = false;
- var /** @type {?} */ attrs = [];
- var /** @type {?} */ isTemplateElement = isTemplate(element, this.config.enableLegacyTemplate, function (m, span) { return _this._reportError(m, span, ParseErrorLevel.WARNING); });
- element.attrs.forEach(function (attr) {
- var /** @type {?} */ hasBinding = _this._parseAttr(isTemplateElement, attr, matchableAttrs, elementOrDirectiveProps, events, elementOrDirectiveRefs, elementVars);
- var /** @type {?} */ templateBindingsSource;
- var /** @type {?} */ prefixToken;
- var /** @type {?} */ normalizedName = _this._normalizeAttributeName(attr.name);
- if (_this.config.enableLegacyTemplate && normalizedName == TEMPLATE_ATTR) {
- _this._reportError(TEMPLATE_ATTR_DEPRECATION_WARNING, attr.sourceSpan, ParseErrorLevel.WARNING);
- templateBindingsSource = attr.value;
- }
- else if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) {
- templateBindingsSource = attr.value;
- prefixToken = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length) + ':';
- }
- var /** @type {?} */ hasTemplateBinding = templateBindingsSource != null;
- if (hasTemplateBinding) {
- if (hasInlineTemplates) {
- _this._reportError("Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with *", attr.sourceSpan);
- }
- hasInlineTemplates = true;
- _this._bindingParser.parseInlineTemplateBinding(/** @type {?} */ ((prefixToken)), /** @type {?} */ ((templateBindingsSource)), attr.sourceSpan, templateMatchableAttrs, templateElementOrDirectiveProps, templateElementVars);
- }
- if (!hasBinding && !hasTemplateBinding) {
- // don't include the bindings as attributes as well in the AST
- attrs.push(_this.visitAttribute(attr, null));
- matchableAttrs.push([attr.name, attr.value]);
- }
- });
- var /** @type {?} */ elementCssSelector = createElementCssSelector(nodeName, matchableAttrs);
- var _a = this._parseDirectives(this.selectorMatcher, elementCssSelector), directiveMetas = _a.directives, matchElement = _a.matchElement;
- var /** @type {?} */ references = [];
- var /** @type {?} */ boundDirectivePropNames = new Set();
- var /** @type {?} */ directiveAsts = this._createDirectiveAsts(isTemplateElement, element.name, directiveMetas, elementOrDirectiveProps, elementOrDirectiveRefs, /** @type {?} */ ((element.sourceSpan)), references, boundDirectivePropNames);
- var /** @type {?} */ elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, boundDirectivePropNames);
- var /** @type {?} */ isViewRoot = parent.isTemplateElement || hasInlineTemplates;
- var /** @type {?} */ providerContext = new ProviderElementContext(this.providerViewContext, /** @type {?} */ ((parent.providerContext)), isViewRoot, directiveAsts, attrs, references, isTemplateElement, queryStartIndex, /** @type {?} */ ((element.sourceSpan)));
- var /** @type {?} */ children = visitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, ElementContext.create(isTemplateElement, directiveAsts, isTemplateElement ? /** @type {?} */ ((parent.providerContext)) : providerContext));
- providerContext.afterElement();
- // Override the actual selector when the `ngProjectAs` attribute is provided
- var /** @type {?} */ projectionSelector = preparsedElement.projectAs != null ?
- CssSelector.parse(preparsedElement.projectAs)[0] :
- elementCssSelector;
- var /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(projectionSelector)));
- var /** @type {?} */ parsedElement;
- if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
- if (element.children && !element.children.every(_isEmptyTextNode)) {
- this._reportError("<ng-content> element cannot have content.", /** @type {?} */ ((element.sourceSpan)));
- }
- parsedElement = new NgContentAst(this.ngContentCount++, hasInlineTemplates ? /** @type {?} */ ((null)) : ngContentIndex, /** @type {?} */ ((element.sourceSpan)));
- }
- else if (isTemplateElement) {
- this._assertAllEventsPublishedByDirectives(directiveAsts, events);
- this._assertNoComponentsNorElementBindingsOnTemplate(directiveAsts, elementProps, /** @type {?} */ ((element.sourceSpan)));
- parsedElement = new EmbeddedTemplateAst(attrs, events, references, elementVars, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? /** @type {?} */ ((null)) : ngContentIndex, /** @type {?} */ ((element.sourceSpan)));
- }
- else {
- this._assertElementExists(matchElement, element);
- this._assertOnlyOneComponent(directiveAsts, /** @type {?} */ ((element.sourceSpan)));
- var /** @type {?} */ ngContentIndex_1 = hasInlineTemplates ? null : parent.findNgContentIndex(projectionSelector);
- 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);
- }
- if (hasInlineTemplates) {
- var /** @type {?} */ templateQueryStartIndex = this.contentQueryStartId;
- var /** @type {?} */ templateSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs);
- var templateDirectiveMetas = this._parseDirectives(this.selectorMatcher, templateSelector).directives;
- var /** @type {?} */ templateBoundDirectivePropNames = new Set();
- var /** @type {?} */ templateDirectiveAsts = this._createDirectiveAsts(true, element.name, templateDirectiveMetas, templateElementOrDirectiveProps, [], /** @type {?} */ ((element.sourceSpan)), [], templateBoundDirectivePropNames);
- var /** @type {?} */ templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateBoundDirectivePropNames);
- this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectiveAsts, templateElementProps, /** @type {?} */ ((element.sourceSpan)));
- var /** @type {?} */ templateProviderContext = new ProviderElementContext(this.providerViewContext, /** @type {?} */ ((parent.providerContext)), parent.isTemplateElement, templateDirectiveAsts, [], [], true, templateQueryStartIndex, /** @type {?} */ ((element.sourceSpan)));
- templateProviderContext.afterElement();
- parsedElement = new EmbeddedTemplateAst([], [], [], templateElementVars, templateProviderContext.transformedDirectiveAsts, templateProviderContext.transformProviders, templateProviderContext.transformedHasViewContainer, templateProviderContext.queryMatches, [parsedElement], ngContentIndex, /** @type {?} */ ((element.sourceSpan)));
- }
- return parsedElement;
- };
- /**
- * @param {?} isTemplateElement
- * @param {?} attr
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @param {?} targetEvents
- * @param {?} targetRefs
- * @param {?} targetVars
- * @return {?}
- */
- TemplateParseVisitor.prototype._parseAttr = /**
- * @param {?} isTemplateElement
- * @param {?} attr
- * @param {?} targetMatchableAttrs
- * @param {?} targetProps
- * @param {?} targetEvents
- * @param {?} targetRefs
- * @param {?} targetVars
- * @return {?}
- */
- function (isTemplateElement, attr, targetMatchableAttrs, targetProps, targetEvents, targetRefs, targetVars) {
- var /** @type {?} */ name = this._normalizeAttributeName(attr.name);
- var /** @type {?} */ value = attr.value;
- var /** @type {?} */ srcSpan = attr.sourceSpan;
- var /** @type {?} */ bindParts = name.match(BIND_NAME_REGEXP);
- var /** @type {?} */ hasBinding = false;
- if (bindParts !== null) {
- hasBinding = true;
- if (bindParts[KW_BIND_IDX] != null) {
- this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
- }
- else if (bindParts[KW_LET_IDX]) {
- if (isTemplateElement) {
- var /** @type {?} */ identifier = bindParts[IDENT_KW_IDX];
- this._parseVariable(identifier, value, srcSpan, targetVars);
- }
- else {
- this._reportError("\"let-\" is only supported on ng-template elements.", srcSpan);
- }
- }
- else if (bindParts[KW_REF_IDX]) {
- var /** @type {?} */ identifier = bindParts[IDENT_KW_IDX];
- this._parseReference(identifier, value, srcSpan, targetRefs);
- }
- else if (bindParts[KW_ON_IDX]) {
- this._bindingParser.parseEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
- }
- else if (bindParts[KW_BINDON_IDX]) {
- this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
- this._parseAssignmentEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
- }
- else if (bindParts[KW_AT_IDX]) {
- this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
- }
- else if (bindParts[IDENT_BANANA_BOX_IDX]) {
- this._bindingParser.parsePropertyBinding(bindParts[IDENT_BANANA_BOX_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
- this._parseAssignmentEvent(bindParts[IDENT_BANANA_BOX_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
- }
- else if (bindParts[IDENT_PROPERTY_IDX]) {
- this._bindingParser.parsePropertyBinding(bindParts[IDENT_PROPERTY_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
- }
- else if (bindParts[IDENT_EVENT_IDX]) {
- this._bindingParser.parseEvent(bindParts[IDENT_EVENT_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
- }
- }
- else {
- hasBinding = this._bindingParser.parsePropertyInterpolation(name, value, srcSpan, targetMatchableAttrs, targetProps);
- }
- if (!hasBinding) {
- this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
- }
- return hasBinding;
- };
- /**
- * @param {?} attrName
- * @return {?}
- */
- TemplateParseVisitor.prototype._normalizeAttributeName = /**
- * @param {?} attrName
- * @return {?}
- */
- function (attrName) {
- return /^data-/i.test(attrName) ? attrName.substring(5) : attrName;
- };
- /**
- * @param {?} identifier
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetVars
- * @return {?}
- */
- TemplateParseVisitor.prototype._parseVariable = /**
- * @param {?} identifier
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetVars
- * @return {?}
- */
- function (identifier, value, sourceSpan, targetVars) {
- if (identifier.indexOf('-') > -1) {
- this._reportError("\"-\" is not allowed in variable names", sourceSpan);
- }
- targetVars.push(new VariableAst(identifier, value, sourceSpan));
- };
- /**
- * @param {?} identifier
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetRefs
- * @return {?}
- */
- TemplateParseVisitor.prototype._parseReference = /**
- * @param {?} identifier
- * @param {?} value
- * @param {?} sourceSpan
- * @param {?} targetRefs
- * @return {?}
- */
- function (identifier, value, sourceSpan, targetRefs) {
- if (identifier.indexOf('-') > -1) {
- this._reportError("\"-\" is not allowed in reference names", sourceSpan);
- }
- targetRefs.push(new ElementOrDirectiveRef(identifier, value, sourceSpan));
- };
- /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetEvents
- * @return {?}
- */
- TemplateParseVisitor.prototype._parseAssignmentEvent = /**
- * @param {?} name
- * @param {?} expression
- * @param {?} sourceSpan
- * @param {?} targetMatchableAttrs
- * @param {?} targetEvents
- * @return {?}
- */
- function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
- this._bindingParser.parseEvent(name + "Change", expression + "=$event", sourceSpan, targetMatchableAttrs, targetEvents);
- };
- /**
- * @param {?} selectorMatcher
- * @param {?} elementCssSelector
- * @return {?}
- */
- TemplateParseVisitor.prototype._parseDirectives = /**
- * @param {?} selectorMatcher
- * @param {?} elementCssSelector
- * @return {?}
- */
- function (selectorMatcher, elementCssSelector) {
- var _this = this;
- // Need to sort the directives so that we get consistent results throughout,
- // as selectorMatcher uses Maps inside.
- // Also deduplicate directives as they might match more than one time!
- var /** @type {?} */ directives = new Array(this.directivesIndex.size);
- // Whether any directive selector matches on the element name
- var /** @type {?} */ matchElement = false;
- selectorMatcher.match(elementCssSelector, function (selector, directive) {
- directives[/** @type {?} */ ((_this.directivesIndex.get(directive)))] = directive;
- matchElement = matchElement || selector.hasElementSelector();
- });
- return {
- directives: directives.filter(function (dir) { return !!dir; }),
- matchElement: matchElement,
- };
- };
- /**
- * @param {?} isTemplateElement
- * @param {?} elementName
- * @param {?} directives
- * @param {?} props
- * @param {?} elementOrDirectiveRefs
- * @param {?} elementSourceSpan
- * @param {?} targetReferences
- * @param {?} targetBoundDirectivePropNames
- * @return {?}
- */
- TemplateParseVisitor.prototype._createDirectiveAsts = /**
- * @param {?} isTemplateElement
- * @param {?} elementName
- * @param {?} directives
- * @param {?} props
- * @param {?} elementOrDirectiveRefs
- * @param {?} elementSourceSpan
- * @param {?} targetReferences
- * @param {?} targetBoundDirectivePropNames
- * @return {?}
- */
- function (isTemplateElement, elementName, directives, props, elementOrDirectiveRefs, elementSourceSpan, targetReferences, targetBoundDirectivePropNames) {
- var _this = this;
- var /** @type {?} */ matchedReferences = new Set();
- var /** @type {?} */ component = /** @type {?} */ ((null));
- var /** @type {?} */ directiveAsts = directives.map(function (directive) {
- var /** @type {?} */ sourceSpan = new ParseSourceSpan(elementSourceSpan.start, elementSourceSpan.end, "Directive " + identifierName(directive.type));
- if (directive.isComponent) {
- component = directive;
- }
- var /** @type {?} */ directiveProperties = [];
- var /** @type {?} */ hostProperties = /** @type {?} */ ((_this._bindingParser.createDirectiveHostPropertyAsts(directive, elementName, sourceSpan)));
- // Note: We need to check the host properties here as well,
- // as we don't know the element name in the DirectiveWrapperCompiler yet.
- hostProperties = _this._checkPropertiesInSchema(elementName, hostProperties);
- var /** @type {?} */ hostEvents = /** @type {?} */ ((_this._bindingParser.createDirectiveHostEventAsts(directive, sourceSpan)));
- _this._createDirectivePropertyAsts(directive.inputs, props, directiveProperties, targetBoundDirectivePropNames);
- elementOrDirectiveRefs.forEach(function (elOrDirRef) {
- if ((elOrDirRef.value.length === 0 && directive.isComponent) ||
- (elOrDirRef.isReferenceToDirective(directive))) {
- targetReferences.push(new ReferenceAst(elOrDirRef.name, createTokenForReference(directive.type.reference), elOrDirRef.sourceSpan));
- matchedReferences.add(elOrDirRef.name);
- }
- });
- var /** @type {?} */ contentQueryStartId = _this.contentQueryStartId;
- _this.contentQueryStartId += directive.queries.length;
- return new DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, contentQueryStartId, sourceSpan);
- });
- elementOrDirectiveRefs.forEach(function (elOrDirRef) {
- if (elOrDirRef.value.length > 0) {
- if (!matchedReferences.has(elOrDirRef.name)) {
- _this._reportError("There is no directive with \"exportAs\" set to \"" + elOrDirRef.value + "\"", elOrDirRef.sourceSpan);
- }
- }
- else if (!component) {
- var /** @type {?} */ refToken = /** @type {?} */ ((null));
- if (isTemplateElement) {
- refToken = createTokenForExternalReference(_this.reflector, Identifiers.TemplateRef);
- }
- targetReferences.push(new ReferenceAst(elOrDirRef.name, refToken, elOrDirRef.sourceSpan));
- }
- });
- return directiveAsts;
- };
- /**
- * @param {?} directiveProperties
- * @param {?} boundProps
- * @param {?} targetBoundDirectiveProps
- * @param {?} targetBoundDirectivePropNames
- * @return {?}
- */
- TemplateParseVisitor.prototype._createDirectivePropertyAsts = /**
- * @param {?} directiveProperties
- * @param {?} boundProps
- * @param {?} targetBoundDirectiveProps
- * @param {?} targetBoundDirectivePropNames
- * @return {?}
- */
- function (directiveProperties, boundProps, targetBoundDirectiveProps, targetBoundDirectivePropNames) {
- if (directiveProperties) {
- var /** @type {?} */ boundPropsByName_1 = new Map();
- boundProps.forEach(function (boundProp) {
- var /** @type {?} */ prevValue = boundPropsByName_1.get(boundProp.name);
- if (!prevValue || prevValue.isLiteral) {
- // give [a]="b" a higher precedence than a="b" on the same element
- // give [a]="b" a higher precedence than a="b" on the same element
- boundPropsByName_1.set(boundProp.name, boundProp);
- }
- });
- Object.keys(directiveProperties).forEach(function (dirProp) {
- var /** @type {?} */ elProp = directiveProperties[dirProp];
- var /** @type {?} */ boundProp = boundPropsByName_1.get(elProp);
- // Bindings are optional, so this binding only needs to be set up if an expression is given.
- if (boundProp) {
- targetBoundDirectivePropNames.add(boundProp.name);
- if (!isEmptyExpression(boundProp.expression)) {
- targetBoundDirectiveProps.push(new BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceSpan));
- }
- }
- });
- }
- };
- /**
- * @param {?} elementName
- * @param {?} props
- * @param {?} boundDirectivePropNames
- * @return {?}
- */
- TemplateParseVisitor.prototype._createElementPropertyAsts = /**
- * @param {?} elementName
- * @param {?} props
- * @param {?} boundDirectivePropNames
- * @return {?}
- */
- function (elementName, props, boundDirectivePropNames) {
- var _this = this;
- var /** @type {?} */ boundElementProps = [];
- props.forEach(function (prop) {
- if (!prop.isLiteral && !boundDirectivePropNames.has(prop.name)) {
- boundElementProps.push(_this._bindingParser.createElementPropertyAst(elementName, prop));
- }
- });
- return this._checkPropertiesInSchema(elementName, boundElementProps);
- };
- /**
- * @param {?} directives
- * @return {?}
- */
- TemplateParseVisitor.prototype._findComponentDirectives = /**
- * @param {?} directives
- * @return {?}
- */
- function (directives) {
- return directives.filter(function (directive) { return directive.directive.isComponent; });
- };
- /**
- * @param {?} directives
- * @return {?}
- */
- TemplateParseVisitor.prototype._findComponentDirectiveNames = /**
- * @param {?} directives
- * @return {?}
- */
- function (directives) {
- return this._findComponentDirectives(directives)
- .map(function (directive) { return ((identifierName(directive.directive.type))); });
- };
- /**
- * @param {?} directives
- * @param {?} sourceSpan
- * @return {?}
- */
- TemplateParseVisitor.prototype._assertOnlyOneComponent = /**
- * @param {?} directives
- * @param {?} sourceSpan
- * @return {?}
- */
- function (directives, sourceSpan) {
- var /** @type {?} */ componentTypeNames = this._findComponentDirectiveNames(directives);
- if (componentTypeNames.length > 1) {
- this._reportError("More than one component matched on this element.\n" +
- "Make sure that only one component's selector can match a given element.\n" +
- ("Conflicting components: " + componentTypeNames.join(',')), sourceSpan);
- }
- };
- /**
- * Make sure that non-angular tags conform to the schemas.
- *
- * Note: An element is considered an angular tag when at least one directive selector matches the
- * tag name.
- *
- * @param {?} matchElement Whether any directive has matched on the tag name
- * @param {?} element the html element
- * @return {?}
- */
- TemplateParseVisitor.prototype._assertElementExists = /**
- * Make sure that non-angular tags conform to the schemas.
- *
- * Note: An element is considered an angular tag when at least one directive selector matches the
- * tag name.
- *
- * @param {?} matchElement Whether any directive has matched on the tag name
- * @param {?} element the html element
- * @return {?}
- */
- function (matchElement, element) {
- var /** @type {?} */ elName = element.name.replace(/^:xhtml:/, '');
- if (!matchElement && !this._schemaRegistry.hasElement(elName, this._schemas)) {
- var /** @type {?} */ errorMsg = "'" + elName + "' is not a known element:\n";
- errorMsg +=
- "1. If '" + elName + "' is an Angular component, then verify that it is part of this module.\n";
- if (elName.indexOf('-') > -1) {
- errorMsg +=
- "2. If '" + elName + "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.";
- }
- else {
- errorMsg +=
- "2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
- }
- this._reportError(errorMsg, /** @type {?} */ ((element.sourceSpan)));
- }
- };
- /**
- * @param {?} directives
- * @param {?} elementProps
- * @param {?} sourceSpan
- * @return {?}
- */
- TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = /**
- * @param {?} directives
- * @param {?} elementProps
- * @param {?} sourceSpan
- * @return {?}
- */
- function (directives, elementProps, sourceSpan) {
- var _this = this;
- var /** @type {?} */ componentTypeNames = this._findComponentDirectiveNames(directives);
- if (componentTypeNames.length > 0) {
- this._reportError("Components on an embedded template: " + componentTypeNames.join(','), sourceSpan);
- }
- elementProps.forEach(function (prop) {
- _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);
- });
- };
- /**
- * @param {?} directives
- * @param {?} events
- * @return {?}
- */
- TemplateParseVisitor.prototype._assertAllEventsPublishedByDirectives = /**
- * @param {?} directives
- * @param {?} events
- * @return {?}
- */
- function (directives, events) {
- var _this = this;
- var /** @type {?} */ allDirectiveEvents = new Set();
- directives.forEach(function (directive) {
- Object.keys(directive.directive.outputs).forEach(function (k) {
- var /** @type {?} */ eventName = directive.directive.outputs[k];
- allDirectiveEvents.add(eventName);
- });
- });
- events.forEach(function (event) {
- if (event.target != null || !allDirectiveEvents.has(event.name)) {
- _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);
- }
- });
- };
- /**
- * @param {?} elementName
- * @param {?} boundProps
- * @return {?}
- */
- TemplateParseVisitor.prototype._checkPropertiesInSchema = /**
- * @param {?} elementName
- * @param {?} boundProps
- * @return {?}
- */
- function (elementName, boundProps) {
- var _this = this;
- // Note: We can't filter out empty expressions before this method,
- // as we still want to validate them!
- return boundProps.filter(function (boundProp) {
- if (boundProp.type === PropertyBindingType.Property &&
- !_this._schemaRegistry.hasProperty(elementName, boundProp.name, _this._schemas)) {
- var /** @type {?} */ errorMsg = "Can't bind to '" + boundProp.name + "' since it isn't a known property of '" + elementName + "'.";
- if (elementName.startsWith('ng-')) {
- errorMsg +=
- "\n1. If '" + boundProp.name + "' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component." +
- "\n2. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
- }
- else if (elementName.indexOf('-') > -1) {
- errorMsg +=
- "\n1. If '" + elementName + "' is an Angular component and it has '" + boundProp.name + "' input, then verify that it is part of this module." +
- ("\n2. If '" + elementName + "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.") +
- "\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
- }
- _this._reportError(errorMsg, boundProp.sourceSpan);
- }
- return !isEmptyExpression(boundProp.value);
- });
- };
- /**
- * @param {?} message
- * @param {?} sourceSpan
- * @param {?=} level
- * @return {?}
- */
- TemplateParseVisitor.prototype._reportError = /**
- * @param {?} message
- * @param {?} sourceSpan
- * @param {?=} level
- * @return {?}
- */
- function (message, sourceSpan, level) {
- if (level === void 0) { level = ParseErrorLevel.ERROR; }
- this._targetErrors.push(new ParseError(sourceSpan, message, level));
- };
- return TemplateParseVisitor;
- }());
- var NonBindableVisitor = /** @class */ (function () {
- function NonBindableVisitor() {
- }
- /**
- * @param {?} ast
- * @param {?} parent
- * @return {?}
- */
- NonBindableVisitor.prototype.visitElement = /**
- * @param {?} ast
- * @param {?} parent
- * @return {?}
- */
- function (ast, parent) {
- var /** @type {?} */ preparsedElement = preparseElement(ast);
- if (preparsedElement.type === PreparsedElementType.SCRIPT ||
- preparsedElement.type === PreparsedElementType.STYLE ||
- preparsedElement.type === PreparsedElementType.STYLESHEET) {
- // Skipping <script> for security reasons
- // Skipping <style> and stylesheets as we already processed them
- // in the StyleCompiler
- return null;
- }
- var /** @type {?} */ attrNameAndValues = ast.attrs.map(function (attr) { return [attr.name, attr.value]; });
- var /** @type {?} */ selector = createElementCssSelector(ast.name, attrNameAndValues);
- var /** @type {?} */ ngContentIndex = parent.findNgContentIndex(selector);
- var /** @type {?} */ children = visitAll(this, ast.children, EMPTY_ELEMENT_CONTEXT);
- return new ElementAst(ast.name, visitAll(this, ast.attrs), [], [], [], [], [], false, [], children, ngContentIndex, ast.sourceSpan, ast.endSourceSpan);
- };
- /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- NonBindableVisitor.prototype.visitComment = /**
- * @param {?} comment
- * @param {?} context
- * @return {?}
- */
- function (comment, context) { return null; };
- /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- NonBindableVisitor.prototype.visitAttribute = /**
- * @param {?} attribute
- * @param {?} context
- * @return {?}
- */
- function (attribute, context) {
- return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan);
- };
- /**
- * @param {?} text
- * @param {?} parent
- * @return {?}
- */
- NonBindableVisitor.prototype.visitText = /**
- * @param {?} text
- * @param {?} parent
- * @return {?}
- */
- function (text, parent) {
- var /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(TEXT_CSS_SELECTOR)));
- return new TextAst(text.value, ngContentIndex, /** @type {?} */ ((text.sourceSpan)));
- };
- /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- NonBindableVisitor.prototype.visitExpansion = /**
- * @param {?} expansion
- * @param {?} context
- * @return {?}
- */
- function (expansion, context) { return expansion; };
- /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- NonBindableVisitor.prototype.visitExpansionCase = /**
- * @param {?} expansionCase
- * @param {?} context
- * @return {?}
- */
- function (expansionCase, context) { return expansionCase; };
- return NonBindableVisitor;
- }());
- /**
- * A reference to an element or directive in a template. E.g., the reference in this template:
- *
- * <div #myMenu="coolMenu">
- *
- * would be {name: 'myMenu', value: 'coolMenu', sourceSpan: ...}
- */
- var ElementOrDirectiveRef = /** @class */ (function () {
- function ElementOrDirectiveRef(name, value, sourceSpan) {
- this.name = name;
- this.value = value;
- this.sourceSpan = sourceSpan;
- }
- /** Gets whether this is a reference to the given directive. */
- /**
- * Gets whether this is a reference to the given directive.
- * @param {?} directive
- * @return {?}
- */
- ElementOrDirectiveRef.prototype.isReferenceToDirective = /**
- * Gets whether this is a reference to the given directive.
- * @param {?} directive
- * @return {?}
- */
- function (directive) {
- return splitExportAs(directive.exportAs).indexOf(this.value) !== -1;
- };
- return ElementOrDirectiveRef;
- }());
- /**
- * Splits a raw, potentially comma-delimted `exportAs` value into an array of names.
- * @param {?} exportAs
- * @return {?}
- */
- function splitExportAs(exportAs) {
- return exportAs ? exportAs.split(',').map(function (e) { return e.trim(); }) : [];
- }
- /**
- * @param {?} classAttrValue
- * @return {?}
- */
- function splitClasses(classAttrValue) {
- return classAttrValue.trim().split(/\s+/g);
- }
- var ElementContext = /** @class */ (function () {
- function ElementContext(isTemplateElement, _ngContentIndexMatcher, _wildcardNgContentIndex, providerContext) {
- this.isTemplateElement = isTemplateElement;
- this._ngContentIndexMatcher = _ngContentIndexMatcher;
- this._wildcardNgContentIndex = _wildcardNgContentIndex;
- this.providerContext = providerContext;
- }
- /**
- * @param {?} isTemplateElement
- * @param {?} directives
- * @param {?} providerContext
- * @return {?}
- */
- ElementContext.create = /**
- * @param {?} isTemplateElement
- * @param {?} directives
- * @param {?} providerContext
- * @return {?}
- */
- function (isTemplateElement, directives, providerContext) {
- var /** @type {?} */ matcher = new SelectorMatcher();
- var /** @type {?} */ wildcardNgContentIndex = /** @type {?} */ ((null));
- var /** @type {?} */ component = directives.find(function (directive) { return directive.directive.isComponent; });
- if (component) {
- var /** @type {?} */ ngContentSelectors = /** @type {?} */ ((component.directive.template)).ngContentSelectors;
- for (var /** @type {?} */ i = 0; i < ngContentSelectors.length; i++) {
- var /** @type {?} */ selector = ngContentSelectors[i];
- if (selector === '*') {
- wildcardNgContentIndex = i;
- }
- else {
- matcher.addSelectables(CssSelector.parse(ngContentSelectors[i]), i);
- }
- }
- }
- return new ElementContext(isTemplateElement, matcher, wildcardNgContentIndex, providerContext);
- };
- /**
- * @param {?} selector
- * @return {?}
- */
- ElementContext.prototype.findNgContentIndex = /**
- * @param {?} selector
- * @return {?}
- */
- function (selector) {
- var /** @type {?} */ ngContentIndices = [];
- this._ngContentIndexMatcher.match(selector, function (selector, ngContentIndex) { ngContentIndices.push(ngContentIndex); });
- ngContentIndices.sort();
- if (this._wildcardNgContentIndex != null) {
- ngContentIndices.push(this._wildcardNgContentIndex);
- }
- return ngContentIndices.length > 0 ? ngContentIndices[0] : null;
- };
- return ElementContext;
- }());
- /**
- * @param {?} elementName
- * @param {?} attributes
- * @return {?}
- */
- function createElementCssSelector(elementName, attributes) {
- var /** @type {?} */ cssSelector = new CssSelector();
- var /** @type {?} */ elNameNoNs = splitNsName(elementName)[1];
- cssSelector.setElement(elNameNoNs);
- for (var /** @type {?} */ i = 0; i < attributes.length; i++) {
- var /** @type {?} */ attrName = attributes[i][0];
- var /** @type {?} */ attrNameNoNs = splitNsName(attrName)[1];
- var /** @type {?} */ attrValue = attributes[i][1];
- cssSelector.addAttribute(attrNameNoNs, attrValue);
- if (attrName.toLowerCase() == CLASS_ATTR) {
- var /** @type {?} */ classes = splitClasses(attrValue);
- classes.forEach(function (className) { return cssSelector.addClassName(className); });
- }
- }
- return cssSelector;
- }
- var EMPTY_ELEMENT_CONTEXT = new ElementContext(true, new SelectorMatcher(), null, null);
- var NON_BINDABLE_VISITOR = new NonBindableVisitor();
- /**
- * @param {?} node
- * @return {?}
- */
- function _isEmptyTextNode(node) {
- return node instanceof Text && node.value.trim().length == 0;
- }
- /**
- * @template T
- * @param {?} items
- * @return {?}
- */
- function removeSummaryDuplicates(items) {
- var /** @type {?} */ map = new Map();
- items.forEach(function (item) {
- if (!map.get(item.type.reference)) {
- map.set(item.type.reference, item);
- }
- });
- return Array.from(map.values());
- }
- /**
- * @param {?} ast
- * @return {?}
- */
- function isEmptyExpression(ast) {
- if (ast instanceof ASTWithSource) {
- ast = ast.ast;
- }
- return ast instanceof EmptyExpr;
- }
- /**
- * @param {?} el
- * @param {?} enableLegacyTemplate
- * @param {?} reportDeprecation
- * @return {?}
- */
- function isTemplate(el, enableLegacyTemplate, reportDeprecation) {
- if (isNgTemplate(el.name))
- return true;
- var /** @type {?} */ tagNoNs = splitNsName(el.name)[1];
- // `<template>` is HTML and case insensitive
- if (tagNoNs.toLowerCase() === TEMPLATE_ELEMENT) {
- if (enableLegacyTemplate && tagNoNs.toLowerCase() === TEMPLATE_ELEMENT) {
- reportDeprecation(TEMPLATE_ELEMENT_DEPRECATION_WARNING, /** @type {?} */ ((el.sourceSpan)));
- return true;
- }
- }
- return false;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var EventHandlerVars = /** @class */ (function () {
- function EventHandlerVars() {
- }
- EventHandlerVars.event = variable('$event');
- return EventHandlerVars;
- }());
- /**
- * @record
- */
- var ConvertActionBindingResult = /** @class */ (function () {
- function ConvertActionBindingResult(stmts, allowDefault) {
- this.stmts = stmts;
- this.allowDefault = allowDefault;
- }
- return ConvertActionBindingResult;
- }());
- /**
- * Converts the given expression AST into an executable output AST, assuming the expression is
- * used in an action binding (e.g. an event handler).
- * @param {?} localResolver
- * @param {?} implicitReceiver
- * @param {?} action
- * @param {?} bindingId
- * @return {?}
- */
- function convertActionBinding(localResolver, implicitReceiver, action, bindingId) {
- if (!localResolver) {
- localResolver = new DefaultLocalResolver();
- }
- var /** @type {?} */ actionWithoutBuiltins = convertPropertyBindingBuiltins({
- createLiteralArrayConverter: function (argCount) {
- // Note: no caching for literal arrays in actions.
- return function (args) { return literalArr(args); };
- },
- createLiteralMapConverter: function (keys) {
- // Note: no caching for literal maps in actions.
- return function (values) {
- var /** @type {?} */ entries = keys.map(function (k, i) {
- return ({
- key: k.key,
- value: values[i],
- quoted: k.quoted,
- });
- });
- return literalMap(entries);
- };
- },
- createPipeConverter: function (name) {
- throw new Error("Illegal State: Actions are not allowed to contain pipes. Pipe: " + name);
- }
- }, action);
- var /** @type {?} */ visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId);
- var /** @type {?} */ actionStmts = [];
- flattenStatements(actionWithoutBuiltins.visit(visitor, _Mode.Statement), actionStmts);
- prependTemporaryDecls(visitor.temporaryCount, bindingId, actionStmts);
- var /** @type {?} */ lastIndex = actionStmts.length - 1;
- var /** @type {?} */ preventDefaultVar = /** @type {?} */ ((null));
- if (lastIndex >= 0) {
- var /** @type {?} */ lastStatement = actionStmts[lastIndex];
- var /** @type {?} */ returnExpr = convertStmtIntoExpression(lastStatement);
- if (returnExpr) {
- // Note: We need to cast the result of the method call to dynamic,
- // as it might be a void method!
- preventDefaultVar = createPreventDefaultVar(bindingId);
- actionStmts[lastIndex] =
- preventDefaultVar.set(returnExpr.cast(DYNAMIC_TYPE).notIdentical(literal(false)))
- .toDeclStmt(null, [StmtModifier.Final]);
- }
- }
- return new ConvertActionBindingResult(actionStmts, preventDefaultVar);
- }
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @param {?} converterFactory
- * @param {?} ast
- * @return {?}
- */
- function convertPropertyBindingBuiltins(converterFactory, ast) {
- return convertBuiltins(converterFactory, ast);
- }
- var ConvertPropertyBindingResult = /** @class */ (function () {
- function ConvertPropertyBindingResult(stmts, currValExpr) {
- this.stmts = stmts;
- this.currValExpr = currValExpr;
- }
- return ConvertPropertyBindingResult;
- }());
- /** @enum {number} */
- var BindingForm = {
- // The general form of binding expression, supports all expressions.
- General: 0,
- // Try to generate a simple binding (no temporaries or statements)
- // otherise generate a general binding
- TrySimple: 1,
- };
- BindingForm[BindingForm.General] = "General";
- BindingForm[BindingForm.TrySimple] = "TrySimple";
- /**
- * Converts the given expression AST into an executable output AST, assuming the expression
- * is used in property binding. The expression has to be preprocessed via
- * `convertPropertyBindingBuiltins`.
- * @param {?} localResolver
- * @param {?} implicitReceiver
- * @param {?} expressionWithoutBuiltins
- * @param {?} bindingId
- * @param {?} form
- * @return {?}
- */
- function convertPropertyBinding(localResolver, implicitReceiver, expressionWithoutBuiltins, bindingId, form) {
- if (!localResolver) {
- localResolver = new DefaultLocalResolver();
- }
- var /** @type {?} */ currValExpr = createCurrValueExpr(bindingId);
- var /** @type {?} */ stmts = [];
- var /** @type {?} */ visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId);
- var /** @type {?} */ outputExpr = expressionWithoutBuiltins.visit(visitor, _Mode.Expression);
- if (visitor.temporaryCount) {
- for (var /** @type {?} */ i = 0; i < visitor.temporaryCount; i++) {
- stmts.push(temporaryDeclaration(bindingId, i));
- }
- }
- else if (form == BindingForm.TrySimple) {
- return new ConvertPropertyBindingResult([], outputExpr);
- }
- stmts.push(currValExpr.set(outputExpr).toDeclStmt(DYNAMIC_TYPE, [StmtModifier.Final]));
- return new ConvertPropertyBindingResult(stmts, currValExpr);
- }
- /**
- * @param {?} converterFactory
- * @param {?} ast
- * @return {?}
- */
- function convertBuiltins(converterFactory, ast) {
- var /** @type {?} */ visitor = new _BuiltinAstConverter(converterFactory);
- return ast.visit(visitor);
- }
- /**
- * @param {?} bindingId
- * @param {?} temporaryNumber
- * @return {?}
- */
- function temporaryName(bindingId, temporaryNumber) {
- return "tmp_" + bindingId + "_" + temporaryNumber;
- }
- /**
- * @param {?} bindingId
- * @param {?} temporaryNumber
- * @return {?}
- */
- function temporaryDeclaration(bindingId, temporaryNumber) {
- return new DeclareVarStmt(temporaryName(bindingId, temporaryNumber), NULL_EXPR);
- }
- /**
- * @param {?} temporaryCount
- * @param {?} bindingId
- * @param {?} statements
- * @return {?}
- */
- function prependTemporaryDecls(temporaryCount, bindingId, statements) {
- for (var /** @type {?} */ i = temporaryCount - 1; i >= 0; i--) {
- statements.unshift(temporaryDeclaration(bindingId, i));
- }
- }
- /** @enum {number} */
- var _Mode = {
- Statement: 0,
- Expression: 1,
- };
- _Mode[_Mode.Statement] = "Statement";
- _Mode[_Mode.Expression] = "Expression";
- /**
- * @param {?} mode
- * @param {?} ast
- * @return {?}
- */
- function ensureStatementMode(mode, ast) {
- if (mode !== _Mode.Statement) {
- throw new Error("Expected a statement, but saw " + ast);
- }
- }
- /**
- * @param {?} mode
- * @param {?} ast
- * @return {?}
- */
- function ensureExpressionMode(mode, ast) {
- if (mode !== _Mode.Expression) {
- throw new Error("Expected an expression, but saw " + ast);
- }
- }
- /**
- * @param {?} mode
- * @param {?} expr
- * @return {?}
- */
- function convertToStatementIfNeeded(mode, expr) {
- if (mode === _Mode.Statement) {
- return expr.toStmt();
- }
- else {
- return expr;
- }
- }
- var _BuiltinAstConverter = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_BuiltinAstConverter, _super);
- function _BuiltinAstConverter(_converterFactory) {
- var _this = _super.call(this) || this;
- _this._converterFactory = _converterFactory;
- return _this;
- }
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- _BuiltinAstConverter.prototype.visitPipe = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- var /** @type {?} */ args = [ast.exp].concat(ast.args).map(function (ast) { return ast.visit(_this, context); });
- return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createPipeConverter(ast.name, args.length));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- _BuiltinAstConverter.prototype.visitLiteralArray = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- var /** @type {?} */ args = ast.expressions.map(function (ast) { return ast.visit(_this, context); });
- return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralArrayConverter(ast.expressions.length));
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- _BuiltinAstConverter.prototype.visitLiteralMap = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- var /** @type {?} */ args = ast.values.map(function (ast) { return ast.visit(_this, context); });
- return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralMapConverter(ast.keys));
- };
- return _BuiltinAstConverter;
- }(AstTransformer));
- var _AstToIrVisitor = /** @class */ (function () {
- function _AstToIrVisitor(_localResolver, _implicitReceiver, bindingId) {
- this._localResolver = _localResolver;
- this._implicitReceiver = _implicitReceiver;
- this.bindingId = bindingId;
- this._nodeMap = new Map();
- this._resultMap = new Map();
- this._currentTemporary = 0;
- this.temporaryCount = 0;
- }
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitBinary = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- var /** @type {?} */ op;
- switch (ast.operation) {
- case '+':
- op = BinaryOperator.Plus;
- break;
- case '-':
- op = BinaryOperator.Minus;
- break;
- case '*':
- op = BinaryOperator.Multiply;
- break;
- case '/':
- op = BinaryOperator.Divide;
- break;
- case '%':
- op = BinaryOperator.Modulo;
- break;
- case '&&':
- op = BinaryOperator.And;
- break;
- case '||':
- op = BinaryOperator.Or;
- break;
- case '==':
- op = BinaryOperator.Equals;
- break;
- case '!=':
- op = BinaryOperator.NotEquals;
- break;
- case '===':
- op = BinaryOperator.Identical;
- break;
- case '!==':
- op = BinaryOperator.NotIdentical;
- break;
- case '<':
- op = BinaryOperator.Lower;
- break;
- case '>':
- op = BinaryOperator.Bigger;
- break;
- case '<=':
- op = BinaryOperator.LowerEquals;
- break;
- case '>=':
- op = BinaryOperator.BiggerEquals;
- break;
- default:
- throw new Error("Unsupported operation " + ast.operation);
- }
- return convertToStatementIfNeeded(mode, new BinaryOperatorExpr(op, this._visit(ast.left, _Mode.Expression), this._visit(ast.right, _Mode.Expression)));
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitChain = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- ensureStatementMode(mode, ast);
- return this.visitAll(ast.expressions, mode);
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitConditional = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- var /** @type {?} */ value = this._visit(ast.condition, _Mode.Expression);
- return convertToStatementIfNeeded(mode, value.conditional(this._visit(ast.trueExp, _Mode.Expression), this._visit(ast.falseExp, _Mode.Expression)));
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitPipe = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- throw new Error("Illegal state: Pipes should have been converted into functions. Pipe: " + ast.name);
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitFunctionCall = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- var /** @type {?} */ convertedArgs = this.visitAll(ast.args, _Mode.Expression);
- var /** @type {?} */ fnResult;
- if (ast instanceof BuiltinFunctionCall) {
- fnResult = ast.converter(convertedArgs);
- }
- else {
- fnResult = this._visit(/** @type {?} */ ((ast.target)), _Mode.Expression).callFn(convertedArgs);
- }
- return convertToStatementIfNeeded(mode, fnResult);
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitImplicitReceiver = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- ensureExpressionMode(mode, ast);
- return this._implicitReceiver;
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitInterpolation = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- ensureExpressionMode(mode, ast);
- var /** @type {?} */ args = [literal(ast.expressions.length)];
- for (var /** @type {?} */ i = 0; i < ast.strings.length - 1; i++) {
- args.push(literal(ast.strings[i]));
- args.push(this._visit(ast.expressions[i], _Mode.Expression));
- }
- args.push(literal(ast.strings[ast.strings.length - 1]));
- return ast.expressions.length <= 9 ?
- importExpr(Identifiers.inlineInterpolate).callFn(args) :
- importExpr(Identifiers.interpolate).callFn([args[0], literalArr(args.slice(1))]);
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitKeyedRead = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- var /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast);
- if (leftMostSafe) {
- return this.convertSafeAccess(ast, leftMostSafe, mode);
- }
- else {
- return convertToStatementIfNeeded(mode, this._visit(ast.obj, _Mode.Expression).key(this._visit(ast.key, _Mode.Expression)));
- }
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitKeyedWrite = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- var /** @type {?} */ obj = this._visit(ast.obj, _Mode.Expression);
- var /** @type {?} */ key = this._visit(ast.key, _Mode.Expression);
- var /** @type {?} */ value = this._visit(ast.value, _Mode.Expression);
- return convertToStatementIfNeeded(mode, obj.key(key).set(value));
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitLiteralArray = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- throw new Error("Illegal State: literal arrays should have been converted into functions");
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitLiteralMap = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- throw new Error("Illegal State: literal maps should have been converted into functions");
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitLiteralPrimitive = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- // For literal values of null, undefined, true, or false allow type inteference
- // to infer the type.
- var /** @type {?} */ type = ast.value === null || ast.value === undefined || ast.value === true || ast.value === true ?
- INFERRED_TYPE :
- undefined;
- return convertToStatementIfNeeded(mode, literal(ast.value, type));
- };
- /**
- * @param {?} name
- * @return {?}
- */
- _AstToIrVisitor.prototype._getLocal = /**
- * @param {?} name
- * @return {?}
- */
- function (name) { return this._localResolver.getLocal(name); };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitMethodCall = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- if (ast.receiver instanceof ImplicitReceiver && ast.name == '$any') {
- var /** @type {?} */ args = /** @type {?} */ (this.visitAll(ast.args, _Mode.Expression));
- if (args.length != 1) {
- throw new Error("Invalid call to $any, expected 1 argument but received " + (args.length || 'none'));
- }
- return (/** @type {?} */ (args[0])).cast(DYNAMIC_TYPE);
- }
- var /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast);
- if (leftMostSafe) {
- return this.convertSafeAccess(ast, leftMostSafe, mode);
- }
- else {
- var /** @type {?} */ args = this.visitAll(ast.args, _Mode.Expression);
- var /** @type {?} */ result = null;
- var /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression);
- if (receiver === this._implicitReceiver) {
- var /** @type {?} */ varExpr = this._getLocal(ast.name);
- if (varExpr) {
- result = varExpr.callFn(args);
- }
- }
- if (result == null) {
- result = receiver.callMethod(ast.name, args);
- }
- return convertToStatementIfNeeded(mode, result);
- }
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitPrefixNot = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- return convertToStatementIfNeeded(mode, not(this._visit(ast.expression, _Mode.Expression)));
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitNonNullAssert = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- return convertToStatementIfNeeded(mode, assertNotNull(this._visit(ast.expression, _Mode.Expression)));
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitPropertyRead = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- var /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast);
- if (leftMostSafe) {
- return this.convertSafeAccess(ast, leftMostSafe, mode);
- }
- else {
- var /** @type {?} */ result = null;
- var /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression);
- if (receiver === this._implicitReceiver) {
- result = this._getLocal(ast.name);
- }
- if (result == null) {
- result = receiver.prop(ast.name);
- }
- return convertToStatementIfNeeded(mode, result);
- }
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitPropertyWrite = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- var /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression);
- if (receiver === this._implicitReceiver) {
- var /** @type {?} */ varExpr = this._getLocal(ast.name);
- if (varExpr) {
- throw new Error('Cannot assign to a reference or variable!');
- }
- }
- return convertToStatementIfNeeded(mode, receiver.prop(ast.name).set(this._visit(ast.value, _Mode.Expression)));
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitSafePropertyRead = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitSafeMethodCall = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
- };
- /**
- * @param {?} asts
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitAll = /**
- * @param {?} asts
- * @param {?} mode
- * @return {?}
- */
- function (asts, mode) {
- var _this = this;
- return asts.map(function (ast) { return _this._visit(ast, mode); });
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.visitQuote = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- throw new Error("Quotes are not supported for evaluation!\n Statement: " + ast.uninterpretedExpression + " located at " + ast.location);
- };
- /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype._visit = /**
- * @param {?} ast
- * @param {?} mode
- * @return {?}
- */
- function (ast, mode) {
- var /** @type {?} */ result = this._resultMap.get(ast);
- if (result)
- return result;
- return (this._nodeMap.get(ast) || ast).visit(this, mode);
- };
- /**
- * @param {?} ast
- * @param {?} leftMostSafe
- * @param {?} mode
- * @return {?}
- */
- _AstToIrVisitor.prototype.convertSafeAccess = /**
- * @param {?} ast
- * @param {?} leftMostSafe
- * @param {?} mode
- * @return {?}
- */
- function (ast, leftMostSafe, mode) {
- // If the expression contains a safe access node on the left it needs to be converted to
- // an expression that guards the access to the member by checking the receiver for blank. As
- // execution proceeds from left to right, the left most part of the expression must be guarded
- // first but, because member access is left associative, the right side of the expression is at
- // the top of the AST. The desired result requires lifting a copy of the the left part of the
- // expression up to test it for blank before generating the unguarded version.
- // Consider, for example the following expression: a?.b.c?.d.e
- // This results in the ast:
- // .
- // / \
- // ?. e
- // / \
- // . d
- // / \
- // ?. c
- // / \
- // a b
- // The following tree should be generated:
- //
- // /---- ? ----\
- // / | \
- // a /--- ? ---\ null
- // / | \
- // . . null
- // / \ / \
- // . c . e
- // / \ / \
- // a b , d
- // / \
- // . c
- // / \
- // a b
- //
- // Notice that the first guard condition is the left hand of the left most safe access node
- // which comes in as leftMostSafe to this routine.
- var /** @type {?} */ guardedExpression = this._visit(leftMostSafe.receiver, _Mode.Expression);
- var /** @type {?} */ temporary = /** @type {?} */ ((undefined));
- if (this.needsTemporary(leftMostSafe.receiver)) {
- // If the expression has method calls or pipes then we need to save the result into a
- // temporary variable to avoid calling stateful or impure code more than once.
- temporary = this.allocateTemporary();
- // Preserve the result in the temporary variable
- guardedExpression = temporary.set(guardedExpression);
- // Ensure all further references to the guarded expression refer to the temporary instead.
- this._resultMap.set(leftMostSafe.receiver, temporary);
- }
- var /** @type {?} */ condition = guardedExpression.isBlank();
- // Convert the ast to an unguarded access to the receiver's member. The map will substitute
- // leftMostNode with its unguarded version in the call to `this.visit()`.
- if (leftMostSafe instanceof SafeMethodCall) {
- this._nodeMap.set(leftMostSafe, new MethodCall(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name, leftMostSafe.args));
- }
- else {
- this._nodeMap.set(leftMostSafe, new PropertyRead(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name));
- }
- // Recursively convert the node now without the guarded member access.
- var /** @type {?} */ access = this._visit(ast, _Mode.Expression);
- // Remove the mapping. This is not strictly required as the converter only traverses each node
- // once but is safer if the conversion is changed to traverse the nodes more than once.
- this._nodeMap.delete(leftMostSafe);
- // If we allocated a temporary, release it.
- if (temporary) {
- this.releaseTemporary(temporary);
- }
- // Produce the conditional
- return convertToStatementIfNeeded(mode, condition.conditional(literal(null), access));
- };
- /**
- * @param {?} ast
- * @return {?}
- */
- _AstToIrVisitor.prototype.leftMostSafeNode = /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- var _this = this;
- var /** @type {?} */ visit = function (visitor, ast) {
- return (_this._nodeMap.get(ast) || ast).visit(visitor);
- };
- return ast.visit({
- visitBinary: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitChain: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitConditional: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitFunctionCall: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitImplicitReceiver: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitInterpolation: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitKeyedRead: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return visit(this, ast.obj); },
- visitKeyedWrite: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitLiteralArray: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitLiteralMap: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitLiteralPrimitive: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitMethodCall: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return visit(this, ast.receiver); },
- visitPipe: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitPrefixNot: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitNonNullAssert: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitPropertyRead: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return visit(this, ast.receiver); },
- visitPropertyWrite: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitQuote: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return null; },
- visitSafeMethodCall: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return visit(this, ast.receiver) || ast; },
- visitSafePropertyRead: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- return visit(this, ast.receiver) || ast;
- }
- });
- };
- /**
- * @param {?} ast
- * @return {?}
- */
- _AstToIrVisitor.prototype.needsTemporary = /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- var _this = this;
- var /** @type {?} */ visit = function (visitor, ast) {
- return ast && (_this._nodeMap.get(ast) || ast).visit(visitor);
- };
- var /** @type {?} */ visitSome = function (visitor, ast) {
- return ast.some(function (ast) { return visit(visitor, ast); });
- };
- return ast.visit({
- visitBinary: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return visit(this, ast.left) || visit(this, ast.right); },
- visitChain: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return false; },
- visitConditional: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- return visit(this, ast.condition) || visit(this, ast.trueExp) ||
- visit(this, ast.falseExp);
- },
- visitFunctionCall: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return true; },
- visitImplicitReceiver: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return false; },
- visitInterpolation: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return visitSome(this, ast.expressions); },
- visitKeyedRead: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return false; },
- visitKeyedWrite: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return false; },
- visitLiteralArray: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return true; },
- visitLiteralMap: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return true; },
- visitLiteralPrimitive: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return false; },
- visitMethodCall: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return true; },
- visitPipe: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return true; },
- visitPrefixNot: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return visit(this, ast.expression); },
- visitNonNullAssert: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return visit(this, ast.expression); },
- visitPropertyRead: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return false; },
- visitPropertyWrite: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return false; },
- visitQuote: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return false; },
- visitSafeMethodCall: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return true; },
- visitSafePropertyRead: /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return false; }
- });
- };
- /**
- * @return {?}
- */
- _AstToIrVisitor.prototype.allocateTemporary = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ tempNumber = this._currentTemporary++;
- this.temporaryCount = Math.max(this._currentTemporary, this.temporaryCount);
- return new ReadVarExpr(temporaryName(this.bindingId, tempNumber));
- };
- /**
- * @param {?} temporary
- * @return {?}
- */
- _AstToIrVisitor.prototype.releaseTemporary = /**
- * @param {?} temporary
- * @return {?}
- */
- function (temporary) {
- this._currentTemporary--;
- if (temporary.name != temporaryName(this.bindingId, this._currentTemporary)) {
- throw new Error("Temporary " + temporary.name + " released out of order");
- }
- };
- return _AstToIrVisitor;
- }());
- /**
- * @param {?} arg
- * @param {?} output
- * @return {?}
- */
- function flattenStatements(arg, output) {
- if (Array.isArray(arg)) {
- (/** @type {?} */ (arg)).forEach(function (entry) { return flattenStatements(entry, output); });
- }
- else {
- output.push(arg);
- }
- }
- var DefaultLocalResolver = /** @class */ (function () {
- function DefaultLocalResolver() {
- }
- /**
- * @param {?} name
- * @return {?}
- */
- DefaultLocalResolver.prototype.getLocal = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- if (name === EventHandlerVars.event.name) {
- return EventHandlerVars.event;
- }
- return null;
- };
- return DefaultLocalResolver;
- }());
- /**
- * @param {?} bindingId
- * @return {?}
- */
- function createCurrValueExpr(bindingId) {
- return variable("currVal_" + bindingId); // fix syntax highlighting: `
- }
- /**
- * @param {?} bindingId
- * @return {?}
- */
- function createPreventDefaultVar(bindingId) {
- return variable("pd_" + bindingId);
- }
- /**
- * @param {?} stmt
- * @return {?}
- */
- function convertStmtIntoExpression(stmt) {
- if (stmt instanceof ExpressionStatement) {
- return stmt.expr;
- }
- else if (stmt instanceof ReturnStatement) {
- return stmt.value;
- }
- return null;
- }
- var BuiltinFunctionCall = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BuiltinFunctionCall, _super);
- function BuiltinFunctionCall(span, args, converter) {
- var _this = _super.call(this, span, null, args) || this;
- _this.args = args;
- _this.converter = converter;
- return _this;
- }
- return BuiltinFunctionCall;
- }(FunctionCall));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Generates code that is used to type check templates.
- */
- var TypeCheckCompiler = /** @class */ (function () {
- function TypeCheckCompiler(options, reflector) {
- this.options = options;
- this.reflector = reflector;
- }
- /**
- * Important notes:
- * - This must not produce new `import` statements, but only refer to types outside
- * of the file via the variables provided via externalReferenceVars.
- * This allows Typescript to reuse the old program's structure as no imports have changed.
- * - This must not produce any exports, as this would pollute the .d.ts file
- * and also violate the point above.
- */
- /**
- * Important notes:
- * - This must not produce new `import` statements, but only refer to types outside
- * of the file via the variables provided via externalReferenceVars.
- * This allows Typescript to reuse the old program's structure as no imports have changed.
- * - This must not produce any exports, as this would pollute the .d.ts file
- * and also violate the point above.
- * @param {?} componentId
- * @param {?} component
- * @param {?} template
- * @param {?} usedPipes
- * @param {?} externalReferenceVars
- * @param {?} ctx
- * @return {?}
- */
- TypeCheckCompiler.prototype.compileComponent = /**
- * Important notes:
- * - This must not produce new `import` statements, but only refer to types outside
- * of the file via the variables provided via externalReferenceVars.
- * This allows Typescript to reuse the old program's structure as no imports have changed.
- * - This must not produce any exports, as this would pollute the .d.ts file
- * and also violate the point above.
- * @param {?} componentId
- * @param {?} component
- * @param {?} template
- * @param {?} usedPipes
- * @param {?} externalReferenceVars
- * @param {?} ctx
- * @return {?}
- */
- function (componentId, component, template, usedPipes, externalReferenceVars, ctx) {
- var _this = this;
- var /** @type {?} */ pipes = new Map();
- usedPipes.forEach(function (p) { return pipes.set(p.name, p.type.reference); });
- var /** @type {?} */ embeddedViewCount = 0;
- var /** @type {?} */ viewBuilderFactory = function (parent, guards) {
- var /** @type {?} */ embeddedViewIndex = embeddedViewCount++;
- return new ViewBuilder(_this.options, _this.reflector, externalReferenceVars, parent, component.type.reference, component.isHost, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory);
- };
- var /** @type {?} */ visitor = viewBuilderFactory(null, []);
- visitor.visitAll([], template);
- return visitor.build(componentId);
- };
- return TypeCheckCompiler;
- }());
- var DYNAMIC_VAR_NAME = '_any';
- var TypeCheckLocalResolver = /** @class */ (function () {
- function TypeCheckLocalResolver() {
- }
- /**
- * @param {?} name
- * @return {?}
- */
- TypeCheckLocalResolver.prototype.getLocal = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- if (name === EventHandlerVars.event.name) {
- // References to the event should not be type-checked.
- // TODO(chuckj): determine a better type for the event.
- return variable(DYNAMIC_VAR_NAME);
- }
- return null;
- };
- return TypeCheckLocalResolver;
- }());
- var defaultResolver = new TypeCheckLocalResolver();
- var ViewBuilder = /** @class */ (function () {
- function ViewBuilder(options, reflector, externalReferenceVars, parent, component, isHostComponent, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory) {
- this.options = options;
- this.reflector = reflector;
- this.externalReferenceVars = externalReferenceVars;
- this.parent = parent;
- this.component = component;
- this.isHostComponent = isHostComponent;
- this.embeddedViewIndex = embeddedViewIndex;
- this.pipes = pipes;
- this.guards = guards;
- this.ctx = ctx;
- this.viewBuilderFactory = viewBuilderFactory;
- this.refOutputVars = new Map();
- this.variables = [];
- this.children = [];
- this.updates = [];
- this.actions = [];
- }
- /**
- * @param {?} type
- * @return {?}
- */
- ViewBuilder.prototype.getOutputVar = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var /** @type {?} */ varName;
- if (type === this.component && this.isHostComponent) {
- varName = DYNAMIC_VAR_NAME;
- }
- else if (type instanceof StaticSymbol) {
- varName = this.externalReferenceVars.get(type);
- }
- else {
- varName = DYNAMIC_VAR_NAME;
- }
- if (!varName) {
- throw new Error("Illegal State: referring to a type without a variable " + JSON.stringify(type));
- }
- return varName;
- };
- /**
- * @param {?} ast
- * @return {?}
- */
- ViewBuilder.prototype.getTypeGuardExpressions = /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- var /** @type {?} */ result = this.guards.slice();
- for (var _i = 0, _a = ast.directives; _i < _a.length; _i++) {
- var directive = _a[_i];
- for (var _b = 0, _c = directive.inputs; _b < _c.length; _b++) {
- var input = _c[_b];
- var /** @type {?} */ guard = directive.directive.guards[input.directiveName];
- if (guard) {
- var /** @type {?} */ useIf = guard === 'UseIf';
- result.push({
- guard: guard,
- useIf: useIf,
- expression: /** @type {?} */ ({ context: this.component, value: input.value })
- });
- }
- }
- }
- return result;
- };
- /**
- * @param {?} variables
- * @param {?} astNodes
- * @return {?}
- */
- ViewBuilder.prototype.visitAll = /**
- * @param {?} variables
- * @param {?} astNodes
- * @return {?}
- */
- function (variables, astNodes) {
- this.variables = variables;
- templateVisitAll(this, astNodes);
- };
- /**
- * @param {?} componentId
- * @param {?=} targetStatements
- * @return {?}
- */
- ViewBuilder.prototype.build = /**
- * @param {?} componentId
- * @param {?=} targetStatements
- * @return {?}
- */
- function (componentId, targetStatements) {
- var _this = this;
- if (targetStatements === void 0) { targetStatements = []; }
- this.children.forEach(function (child) { return child.build(componentId, targetStatements); });
- var /** @type {?} */ viewStmts = [variable(DYNAMIC_VAR_NAME).set(NULL_EXPR).toDeclStmt(DYNAMIC_TYPE)];
- var /** @type {?} */ bindingCount = 0;
- this.updates.forEach(function (expression) {
- var _a = _this.preprocessUpdateExpression(expression), sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
- var /** @type {?} */ bindingId = "" + bindingCount++;
- var /** @type {?} */ nameResolver = context === _this.component ? _this : defaultResolver;
- var _b = convertPropertyBinding(nameResolver, variable(_this.getOutputVar(context)), value, bindingId, BindingForm.General), stmts = _b.stmts, currValExpr = _b.currValExpr;
- stmts.push(new ExpressionStatement(currValExpr));
- viewStmts.push.apply(viewStmts, stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }));
- });
- this.actions.forEach(function (_a) {
- var sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
- var /** @type {?} */ bindingId = "" + bindingCount++;
- var /** @type {?} */ nameResolver = context === _this.component ? _this : defaultResolver;
- var stmts = convertActionBinding(nameResolver, variable(_this.getOutputVar(context)), value, bindingId).stmts;
- viewStmts.push.apply(viewStmts, stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }));
- });
- if (this.guards.length) {
- var /** @type {?} */ guardExpression = undefined;
- for (var _i = 0, _a = this.guards; _i < _a.length; _i++) {
- var guard = _a[_i];
- var _b = this.preprocessUpdateExpression(guard.expression), context = _b.context, value = _b.value;
- var /** @type {?} */ bindingId = "" + bindingCount++;
- var /** @type {?} */ nameResolver = context === this.component ? this : defaultResolver;
- // We only support support simple expressions and ignore others as they
- // are unlikely to affect type narrowing.
- var _c = convertPropertyBinding(nameResolver, variable(this.getOutputVar(context)), value, bindingId, BindingForm.TrySimple), stmts = _c.stmts, currValExpr = _c.currValExpr;
- if (stmts.length == 0) {
- var /** @type {?} */ guardClause = guard.useIf ? currValExpr : this.ctx.importExpr(guard.guard).callFn([currValExpr]);
- guardExpression = guardExpression ? guardExpression.and(guardClause) : guardClause;
- }
- }
- if (guardExpression) {
- viewStmts = [new IfStmt(guardExpression, viewStmts)];
- }
- }
- var /** @type {?} */ viewName = "_View_" + componentId + "_" + this.embeddedViewIndex;
- var /** @type {?} */ viewFactory = new DeclareFunctionStmt(viewName, [], viewStmts);
- targetStatements.push(viewFactory);
- return targetStatements;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitBoundText = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- var /** @type {?} */ astWithSource = /** @type {?} */ (ast.value);
- var /** @type {?} */ inter = /** @type {?} */ (astWithSource.ast);
- inter.expressions.forEach(function (expr) {
- return _this.updates.push({ context: _this.component, value: expr, sourceSpan: ast.sourceSpan });
- });
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitEmbeddedTemplate = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- this.visitElementOrTemplate(ast);
- // Note: The old view compiler used to use an `any` type
- // for the context in any embedded view.
- // We keep this behaivor behind a flag for now.
- if (this.options.fullTemplateTypeCheck) {
- // Find any applicable type guards. For example, NgIf has a type guard on ngIf
- // (see NgIf.ngIfTypeGuard) that can be used to indicate that a template is only
- // stamped out if ngIf is truthy so any bindings in the template can assume that,
- // if a nullable type is used for ngIf, that expression is not null or undefined.
- var /** @type {?} */ guards = this.getTypeGuardExpressions(ast);
- var /** @type {?} */ childVisitor = this.viewBuilderFactory(this, guards);
- this.children.push(childVisitor);
- childVisitor.visitAll(ast.variables, ast.children);
- }
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitElement = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- this.visitElementOrTemplate(ast);
- var /** @type {?} */ inputDefs = [];
- var /** @type {?} */ updateRendererExpressions = [];
- var /** @type {?} */ outputDefs = [];
- ast.inputs.forEach(function (inputAst) {
- _this.updates.push({ context: _this.component, value: inputAst.value, sourceSpan: inputAst.sourceSpan });
- });
- templateVisitAll(this, ast.children);
- };
- /**
- * @param {?} ast
- * @return {?}
- */
- ViewBuilder.prototype.visitElementOrTemplate = /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) {
- var _this = this;
- ast.directives.forEach(function (dirAst) { _this.visitDirective(dirAst); });
- ast.references.forEach(function (ref) {
- var /** @type {?} */ outputVarType = /** @type {?} */ ((null));
- // Note: The old view compiler used to use an `any` type
- // for directives exposed via `exportAs`.
- // We keep this behaivor behind a flag for now.
- if (ref.value && ref.value.identifier && _this.options.fullTemplateTypeCheck) {
- outputVarType = ref.value.identifier.reference;
- }
- else {
- outputVarType = BuiltinTypeName.Dynamic;
- }
- _this.refOutputVars.set(ref.name, outputVarType);
- });
- ast.outputs.forEach(function (outputAst) {
- _this.actions.push({ context: _this.component, value: outputAst.handler, sourceSpan: outputAst.sourceSpan });
- });
- };
- /**
- * @param {?} dirAst
- * @return {?}
- */
- ViewBuilder.prototype.visitDirective = /**
- * @param {?} dirAst
- * @return {?}
- */
- function (dirAst) {
- var _this = this;
- var /** @type {?} */ dirType = dirAst.directive.type.reference;
- dirAst.inputs.forEach(function (input) {
- return _this.updates.push({ context: _this.component, value: input.value, sourceSpan: input.sourceSpan });
- });
- // Note: The old view compiler used to use an `any` type
- // for expressions in host properties / events.
- // We keep this behaivor behind a flag for now.
- if (this.options.fullTemplateTypeCheck) {
- dirAst.hostProperties.forEach(function (inputAst) {
- return _this.updates.push({ context: dirType, value: inputAst.value, sourceSpan: inputAst.sourceSpan });
- });
- dirAst.hostEvents.forEach(function (hostEventAst) {
- return _this.actions.push({
- context: dirType,
- value: hostEventAst.handler,
- sourceSpan: hostEventAst.sourceSpan
- });
- });
- }
- };
- /**
- * @param {?} name
- * @return {?}
- */
- ViewBuilder.prototype.getLocal = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- if (name == EventHandlerVars.event.name) {
- return variable(this.getOutputVar(BuiltinTypeName.Dynamic));
- }
- for (var /** @type {?} */ currBuilder = this; currBuilder; currBuilder = currBuilder.parent) {
- var /** @type {?} */ outputVarType = void 0;
- // check references
- outputVarType = currBuilder.refOutputVars.get(name);
- if (outputVarType == null) {
- // check variables
- var /** @type {?} */ varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; });
- if (varAst) {
- outputVarType = BuiltinTypeName.Dynamic;
- }
- }
- if (outputVarType != null) {
- return variable(this.getOutputVar(outputVarType));
- }
- }
- return null;
- };
- /**
- * @param {?} name
- * @return {?}
- */
- ViewBuilder.prototype.pipeOutputVar = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- var /** @type {?} */ pipe = this.pipes.get(name);
- if (!pipe) {
- throw new Error("Illegal State: Could not find pipe " + name + " in template of " + this.component);
- }
- return this.getOutputVar(pipe);
- };
- /**
- * @param {?} expression
- * @return {?}
- */
- ViewBuilder.prototype.preprocessUpdateExpression = /**
- * @param {?} expression
- * @return {?}
- */
- function (expression) {
- var _this = this;
- return {
- sourceSpan: expression.sourceSpan,
- context: expression.context,
- value: convertPropertyBindingBuiltins({
- createLiteralArrayConverter: function (argCount) {
- return function (args) {
- var /** @type {?} */ arr = literalArr(args);
- // Note: The old view compiler used to use an `any` type
- // for arrays.
- return _this.options.fullTemplateTypeCheck ? arr : arr.cast(DYNAMIC_TYPE);
- };
- },
- createLiteralMapConverter: function (keys) {
- return function (values) {
- var /** @type {?} */ entries = keys.map(function (k, i) {
- return ({
- key: k.key,
- value: values[i],
- quoted: k.quoted,
- });
- });
- var /** @type {?} */ map = literalMap(entries);
- // Note: The old view compiler used to use an `any` type
- // for maps.
- return _this.options.fullTemplateTypeCheck ? map : map.cast(DYNAMIC_TYPE);
- };
- },
- createPipeConverter: function (name, argCount) {
- return function (args) {
- // Note: The old view compiler used to use an `any` type
- // for pipes.
- var /** @type {?} */ pipeExpr = _this.options.fullTemplateTypeCheck ?
- variable(_this.pipeOutputVar(name)) :
- variable(_this.getOutputVar(BuiltinTypeName.Dynamic));
- return pipeExpr.callMethod('transform', args);
- };
- },
- }, expression.value)
- };
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitNgContent = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitText = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitDirectiveProperty = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitReference = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitVariable = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitEvent = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitElementProperty = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitAttr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- return ViewBuilder;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var CLASS_ATTR$1 = 'class';
- var STYLE_ATTR = 'style';
- var IMPLICIT_TEMPLATE_VAR = '\$implicit';
- var ViewCompileResult = /** @class */ (function () {
- function ViewCompileResult(viewClassVar, rendererTypeVar) {
- this.viewClassVar = viewClassVar;
- this.rendererTypeVar = rendererTypeVar;
- }
- return ViewCompileResult;
- }());
- var ViewCompiler = /** @class */ (function () {
- function ViewCompiler(_reflector) {
- this._reflector = _reflector;
- }
- /**
- * @param {?} outputCtx
- * @param {?} component
- * @param {?} template
- * @param {?} styles
- * @param {?} usedPipes
- * @return {?}
- */
- ViewCompiler.prototype.compileComponent = /**
- * @param {?} outputCtx
- * @param {?} component
- * @param {?} template
- * @param {?} styles
- * @param {?} usedPipes
- * @return {?}
- */
- function (outputCtx, component, template, styles, usedPipes) {
- var _this = this;
- var /** @type {?} */ embeddedViewCount = 0;
- var /** @type {?} */ staticQueryIds = findStaticQueryIds(template);
- var /** @type {?} */ renderComponentVarName = /** @type {?} */ ((undefined));
- if (!component.isHost) {
- var /** @type {?} */ template_1 = /** @type {?} */ ((component.template));
- var /** @type {?} */ customRenderData = [];
- if (template_1.animations && template_1.animations.length) {
- customRenderData.push(new LiteralMapEntry('animation', convertValueToOutputAst(outputCtx, template_1.animations), true));
- }
- var /** @type {?} */ renderComponentVar = variable(rendererTypeName(component.type.reference));
- renderComponentVarName = /** @type {?} */ ((renderComponentVar.name));
- outputCtx.statements.push(renderComponentVar
- .set(importExpr(Identifiers.createRendererType2).callFn([new LiteralMapExpr([
- new LiteralMapEntry('encapsulation', literal(template_1.encapsulation), false),
- new LiteralMapEntry('styles', styles, false),
- new LiteralMapEntry('data', new LiteralMapExpr(customRenderData), false)
- ])]))
- .toDeclStmt(importType(Identifiers.RendererType2), [StmtModifier.Final, StmtModifier.Exported]));
- }
- var /** @type {?} */ viewBuilderFactory = function (parent) {
- var /** @type {?} */ embeddedViewIndex = embeddedViewCount++;
- return new ViewBuilder$1(_this._reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory);
- };
- var /** @type {?} */ visitor = viewBuilderFactory(null);
- visitor.visitAll([], template);
- (_a = outputCtx.statements).push.apply(_a, visitor.build());
- return new ViewCompileResult(visitor.viewName, renderComponentVarName);
- var _a;
- };
- return ViewCompiler;
- }());
- var LOG_VAR$1 = variable('_l');
- var VIEW_VAR = variable('_v');
- var CHECK_VAR = variable('_ck');
- var COMP_VAR = variable('_co');
- var EVENT_NAME_VAR = variable('en');
- var ALLOW_DEFAULT_VAR = variable("ad");
- var ViewBuilder$1 = /** @class */ (function () {
- function ViewBuilder(reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory) {
- this.reflector = reflector;
- this.outputCtx = outputCtx;
- this.parent = parent;
- this.component = component;
- this.embeddedViewIndex = embeddedViewIndex;
- this.usedPipes = usedPipes;
- this.staticQueryIds = staticQueryIds;
- this.viewBuilderFactory = viewBuilderFactory;
- this.nodes = [];
- this.purePipeNodeIndices = Object.create(null);
- this.refNodeIndices = Object.create(null);
- this.variables = [];
- this.children = [];
- // TODO(tbosch): The old view compiler used to use an `any` type
- // for the context in any embedded view. We keep this behaivor for now
- // to be able to introduce the new view compiler without too many errors.
- this.compType = this.embeddedViewIndex > 0 ?
- DYNAMIC_TYPE : /** @type {?} */
- ((expressionType(outputCtx.importExpr(this.component.type.reference))));
- this.viewName = viewClassName(this.component.type.reference, this.embeddedViewIndex);
- }
- /**
- * @param {?} variables
- * @param {?} astNodes
- * @return {?}
- */
- ViewBuilder.prototype.visitAll = /**
- * @param {?} variables
- * @param {?} astNodes
- * @return {?}
- */
- function (variables, astNodes) {
- var _this = this;
- this.variables = variables;
- // create the pipes for the pure pipes immediately, so that we know their indices.
- if (!this.parent) {
- this.usedPipes.forEach(function (pipe) {
- if (pipe.pure) {
- _this.purePipeNodeIndices[pipe.name] = _this._createPipe(null, pipe);
- }
- });
- }
- if (!this.parent) {
- var /** @type {?} */ queryIds_1 = staticViewQueryIds(this.staticQueryIds);
- this.component.viewQueries.forEach(function (query, queryIndex) {
- // Note: queries start with id 1 so we can use the number in a Bloom filter!
- var /** @type {?} */ queryId = queryIndex + 1;
- var /** @type {?} */ bindingType = query.first ? 0 /* First */ : 1;
- var /** @type {?} */ flags = 134217728 /* TypeViewQuery */ | calcStaticDynamicQueryFlags(queryIds_1, queryId, query.first);
- _this.nodes.push(function () {
- return ({
- sourceSpan: null,
- nodeFlags: flags,
- nodeDef: importExpr(Identifiers.queryDef).callFn([
- literal(flags), literal(queryId),
- new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])
- ])
- });
- });
- });
- }
- templateVisitAll(this, astNodes);
- if (this.parent && (astNodes.length === 0 || needsAdditionalRootNode(astNodes))) {
- // if the view is an embedded view, then we need to add an additional root node in some cases
- this.nodes.push(function () {
- return ({
- sourceSpan: null,
- nodeFlags: 1 /* TypeElement */,
- nodeDef: importExpr(Identifiers.anchorDef).callFn([
- literal(0 /* None */), NULL_EXPR, NULL_EXPR, literal(0)
- ])
- });
- });
- }
- };
- /**
- * @param {?=} targetStatements
- * @return {?}
- */
- ViewBuilder.prototype.build = /**
- * @param {?=} targetStatements
- * @return {?}
- */
- function (targetStatements) {
- if (targetStatements === void 0) { targetStatements = []; }
- this.children.forEach(function (child) { return child.build(targetStatements); });
- var _a = this._createNodeExpressions(), updateRendererStmts = _a.updateRendererStmts, updateDirectivesStmts = _a.updateDirectivesStmts, nodeDefExprs = _a.nodeDefExprs;
- var /** @type {?} */ updateRendererFn = this._createUpdateFn(updateRendererStmts);
- var /** @type {?} */ updateDirectivesFn = this._createUpdateFn(updateDirectivesStmts);
- var /** @type {?} */ viewFlags = 0;
- if (!this.parent && this.component.changeDetection === ChangeDetectionStrategy.OnPush) {
- viewFlags |= 2 /* OnPush */;
- }
- var /** @type {?} */ viewFactory = new DeclareFunctionStmt(this.viewName, [new FnParam(/** @type {?} */ ((LOG_VAR$1.name)))], [new ReturnStatement(importExpr(Identifiers.viewDef).callFn([
- literal(viewFlags),
- literalArr(nodeDefExprs),
- updateDirectivesFn,
- updateRendererFn,
- ]))], importType(Identifiers.ViewDefinition), this.embeddedViewIndex === 0 ? [StmtModifier.Exported] : []);
- targetStatements.push(viewFactory);
- return targetStatements;
- };
- /**
- * @param {?} updateStmts
- * @return {?}
- */
- ViewBuilder.prototype._createUpdateFn = /**
- * @param {?} updateStmts
- * @return {?}
- */
- function (updateStmts) {
- var /** @type {?} */ updateFn;
- if (updateStmts.length > 0) {
- var /** @type {?} */ preStmts = [];
- if (!this.component.isHost && findReadVarNames(updateStmts).has(/** @type {?} */ ((COMP_VAR.name)))) {
- preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType));
- }
- updateFn = fn([
- new FnParam(/** @type {?} */ ((CHECK_VAR.name)), INFERRED_TYPE),
- new FnParam(/** @type {?} */ ((VIEW_VAR.name)), INFERRED_TYPE)
- ], preStmts.concat(updateStmts), INFERRED_TYPE);
- }
- else {
- updateFn = NULL_EXPR;
- }
- return updateFn;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitNgContent = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- // ngContentDef(ngContentIndex: number, index: number): NodeDef;
- this.nodes.push(function () {
- return ({
- sourceSpan: ast.sourceSpan,
- nodeFlags: 8 /* TypeNgContent */,
- nodeDef: importExpr(Identifiers.ngContentDef).callFn([
- literal(ast.ngContentIndex), literal(ast.index)
- ])
- });
- });
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitText = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- // Static text nodes have no check function
- var /** @type {?} */ checkIndex = -1;
- this.nodes.push(function () {
- return ({
- sourceSpan: ast.sourceSpan,
- nodeFlags: 2 /* TypeText */,
- nodeDef: importExpr(Identifiers.textDef).callFn([
- literal(checkIndex),
- literal(ast.ngContentIndex),
- literalArr([literal(ast.value)]),
- ])
- });
- });
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitBoundText = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- var /** @type {?} */ nodeIndex = this.nodes.length;
- // reserve the space in the nodeDefs array
- this.nodes.push(/** @type {?} */ ((null)));
- var /** @type {?} */ astWithSource = /** @type {?} */ (ast.value);
- var /** @type {?} */ inter = /** @type {?} */ (astWithSource.ast);
- var /** @type {?} */ updateRendererExpressions = inter.expressions.map(function (expr, bindingIndex) {
- return _this._preprocessUpdateExpression({ nodeIndex: nodeIndex, bindingIndex: bindingIndex, sourceSpan: ast.sourceSpan, context: COMP_VAR, value: expr });
- });
- // Check index is the same as the node index during compilation
- // They might only differ at runtime
- var /** @type {?} */ checkIndex = nodeIndex;
- this.nodes[nodeIndex] = function () {
- return ({
- sourceSpan: ast.sourceSpan,
- nodeFlags: 2 /* TypeText */,
- nodeDef: importExpr(Identifiers.textDef).callFn([
- literal(checkIndex),
- literal(ast.ngContentIndex),
- literalArr(inter.strings.map(function (s) { return literal(s); })),
- ]),
- updateRenderer: updateRendererExpressions
- });
- };
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitEmbeddedTemplate = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- var /** @type {?} */ nodeIndex = this.nodes.length;
- // reserve the space in the nodeDefs array
- this.nodes.push(/** @type {?} */ ((null)));
- var _a = this._visitElementOrTemplate(nodeIndex, ast), flags = _a.flags, queryMatchesExpr = _a.queryMatchesExpr, hostEvents = _a.hostEvents;
- var /** @type {?} */ childVisitor = this.viewBuilderFactory(this);
- this.children.push(childVisitor);
- childVisitor.visitAll(ast.variables, ast.children);
- var /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1;
- // anchorDef(
- // flags: NodeFlags, matchedQueries: [string, QueryValueType][], ngContentIndex: number,
- // childCount: number, handleEventFn?: ElementHandleEventFn, templateFactory?:
- // ViewDefinitionFactory): NodeDef;
- this.nodes[nodeIndex] = function () {
- return ({
- sourceSpan: ast.sourceSpan,
- nodeFlags: 1 /* TypeElement */ | flags,
- nodeDef: importExpr(Identifiers.anchorDef).callFn([
- literal(flags),
- queryMatchesExpr,
- literal(ast.ngContentIndex),
- literal(childCount),
- _this._createElementHandleEventFn(nodeIndex, hostEvents),
- variable(childVisitor.viewName),
- ])
- });
- };
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitElement = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var _this = this;
- var /** @type {?} */ nodeIndex = this.nodes.length;
- // reserve the space in the nodeDefs array so we can add children
- this.nodes.push(/** @type {?} */ ((null)));
- // Using a null element name creates an anchor.
- var /** @type {?} */ elName = isNgContainer(ast.name) ? null : ast.name;
- var _a = this._visitElementOrTemplate(nodeIndex, ast), flags = _a.flags, usedEvents = _a.usedEvents, queryMatchesExpr = _a.queryMatchesExpr, dirHostBindings = _a.hostBindings, hostEvents = _a.hostEvents;
- var /** @type {?} */ inputDefs = [];
- var /** @type {?} */ updateRendererExpressions = [];
- var /** @type {?} */ outputDefs = [];
- if (elName) {
- var /** @type {?} */ hostBindings = ast.inputs
- .map(function (inputAst) {
- return ({
- context: /** @type {?} */ (COMP_VAR),
- inputAst: inputAst,
- dirAst: /** @type {?} */ (null),
- });
- })
- .concat(dirHostBindings);
- if (hostBindings.length) {
- updateRendererExpressions =
- hostBindings.map(function (hostBinding, bindingIndex) {
- return _this._preprocessUpdateExpression({
- context: hostBinding.context,
- nodeIndex: nodeIndex,
- bindingIndex: bindingIndex,
- sourceSpan: hostBinding.inputAst.sourceSpan,
- value: hostBinding.inputAst.value
- });
- });
- inputDefs = hostBindings.map(function (hostBinding) { return elementBindingDef(hostBinding.inputAst, hostBinding.dirAst); });
- }
- outputDefs = usedEvents.map(function (_a) {
- var target = _a[0], eventName = _a[1];
- return literalArr([literal(target), literal(eventName)]);
- });
- }
- templateVisitAll(this, ast.children);
- var /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1;
- var /** @type {?} */ compAst = ast.directives.find(function (dirAst) { return dirAst.directive.isComponent; });
- var /** @type {?} */ compRendererType = /** @type {?} */ (NULL_EXPR);
- var /** @type {?} */ compView = /** @type {?} */ (NULL_EXPR);
- if (compAst) {
- compView = this.outputCtx.importExpr(compAst.directive.componentViewType);
- compRendererType = this.outputCtx.importExpr(compAst.directive.rendererType);
- }
- // Check index is the same as the node index during compilation
- // They might only differ at runtime
- var /** @type {?} */ checkIndex = nodeIndex;
- this.nodes[nodeIndex] = function () {
- return ({
- sourceSpan: ast.sourceSpan,
- nodeFlags: 1 /* TypeElement */ | flags,
- nodeDef: importExpr(Identifiers.elementDef).callFn([
- literal(checkIndex),
- literal(flags),
- queryMatchesExpr,
- literal(ast.ngContentIndex),
- literal(childCount),
- literal(elName),
- elName ? fixedAttrsDef(ast) : NULL_EXPR,
- inputDefs.length ? literalArr(inputDefs) : NULL_EXPR,
- outputDefs.length ? literalArr(outputDefs) : NULL_EXPR,
- _this._createElementHandleEventFn(nodeIndex, hostEvents),
- compView,
- compRendererType,
- ]),
- updateRenderer: updateRendererExpressions
- });
- };
- };
- /**
- * @param {?} nodeIndex
- * @param {?} ast
- * @return {?}
- */
- ViewBuilder.prototype._visitElementOrTemplate = /**
- * @param {?} nodeIndex
- * @param {?} ast
- * @return {?}
- */
- function (nodeIndex, ast) {
- var _this = this;
- var /** @type {?} */ flags = 0;
- if (ast.hasViewContainer) {
- flags |= 16777216 /* EmbeddedViews */;
- }
- var /** @type {?} */ usedEvents = new Map();
- ast.outputs.forEach(function (event) {
- var _a = elementEventNameAndTarget(event, null), name = _a.name, target = _a.target;
- usedEvents.set(elementEventFullName(target, name), [target, name]);
- });
- ast.directives.forEach(function (dirAst) {
- dirAst.hostEvents.forEach(function (event) {
- var _a = elementEventNameAndTarget(event, dirAst), name = _a.name, target = _a.target;
- usedEvents.set(elementEventFullName(target, name), [target, name]);
- });
- });
- var /** @type {?} */ hostBindings = [];
- var /** @type {?} */ hostEvents = [];
- this._visitComponentFactoryResolverProvider(ast.directives);
- ast.providers.forEach(function (providerAst, providerIndex) {
- var /** @type {?} */ dirAst = /** @type {?} */ ((undefined));
- var /** @type {?} */ dirIndex = /** @type {?} */ ((undefined));
- ast.directives.forEach(function (localDirAst, i) {
- if (localDirAst.directive.type.reference === tokenReference(providerAst.token)) {
- dirAst = localDirAst;
- dirIndex = i;
- }
- });
- if (dirAst) {
- 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;
- hostBindings.push.apply(hostBindings, dirHostBindings);
- hostEvents.push.apply(hostEvents, dirHostEvents);
- }
- else {
- _this._visitProvider(providerAst, ast.queryMatches);
- }
- });
- var /** @type {?} */ queryMatchExprs = [];
- ast.queryMatches.forEach(function (match) {
- var /** @type {?} */ valueType = /** @type {?} */ ((undefined));
- if (tokenReference(match.value) ===
- _this.reflector.resolveExternalReference(Identifiers.ElementRef)) {
- valueType = 0 /* ElementRef */;
- }
- else if (tokenReference(match.value) ===
- _this.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) {
- valueType = 3 /* ViewContainerRef */;
- }
- else if (tokenReference(match.value) ===
- _this.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
- valueType = 2 /* TemplateRef */;
- }
- if (valueType != null) {
- queryMatchExprs.push(literalArr([literal(match.queryId), literal(valueType)]));
- }
- });
- ast.references.forEach(function (ref) {
- var /** @type {?} */ valueType = /** @type {?} */ ((undefined));
- if (!ref.value) {
- valueType = 1 /* RenderElement */;
- }
- else if (tokenReference(ref.value) ===
- _this.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
- valueType = 2 /* TemplateRef */;
- }
- if (valueType != null) {
- _this.refNodeIndices[ref.name] = nodeIndex;
- queryMatchExprs.push(literalArr([literal(ref.name), literal(valueType)]));
- }
- });
- ast.outputs.forEach(function (outputAst) {
- hostEvents.push({ context: COMP_VAR, eventAst: outputAst, dirAst: /** @type {?} */ ((null)) });
- });
- return {
- flags: flags,
- usedEvents: Array.from(usedEvents.values()),
- queryMatchesExpr: queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR,
- hostBindings: hostBindings,
- hostEvents: hostEvents
- };
- };
- /**
- * @param {?} providerAst
- * @param {?} dirAst
- * @param {?} directiveIndex
- * @param {?} elementNodeIndex
- * @param {?} refs
- * @param {?} queryMatches
- * @param {?} usedEvents
- * @param {?} queryIds
- * @return {?}
- */
- ViewBuilder.prototype._visitDirective = /**
- * @param {?} providerAst
- * @param {?} dirAst
- * @param {?} directiveIndex
- * @param {?} elementNodeIndex
- * @param {?} refs
- * @param {?} queryMatches
- * @param {?} usedEvents
- * @param {?} queryIds
- * @return {?}
- */
- function (providerAst, dirAst, directiveIndex, elementNodeIndex, refs, queryMatches, usedEvents, queryIds) {
- var _this = this;
- var /** @type {?} */ nodeIndex = this.nodes.length;
- // reserve the space in the nodeDefs array so we can add children
- this.nodes.push(/** @type {?} */ ((null)));
- dirAst.directive.queries.forEach(function (query, queryIndex) {
- var /** @type {?} */ queryId = dirAst.contentQueryStartId + queryIndex;
- var /** @type {?} */ flags = 67108864 /* TypeContentQuery */ | calcStaticDynamicQueryFlags(queryIds, queryId, query.first);
- var /** @type {?} */ bindingType = query.first ? 0 /* First */ : 1;
- _this.nodes.push(function () {
- return ({
- sourceSpan: dirAst.sourceSpan,
- nodeFlags: flags,
- nodeDef: importExpr(Identifiers.queryDef).callFn([
- literal(flags), literal(queryId),
- new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])
- ]),
- });
- });
- });
- // Note: the operation below might also create new nodeDefs,
- // but we don't want them to be a child of a directive,
- // as they might be a provider/pipe on their own.
- // I.e. we only allow queries as children of directives nodes.
- var /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1;
- var _a = this._visitProviderOrDirective(providerAst, queryMatches), flags = _a.flags, queryMatchExprs = _a.queryMatchExprs, providerExpr = _a.providerExpr, depsExpr = _a.depsExpr;
- refs.forEach(function (ref) {
- if (ref.value && tokenReference(ref.value) === tokenReference(providerAst.token)) {
- _this.refNodeIndices[ref.name] = nodeIndex;
- queryMatchExprs.push(literalArr([literal(ref.name), literal(4 /* Provider */)]));
- }
- });
- if (dirAst.directive.isComponent) {
- flags |= 32768 /* Component */;
- }
- var /** @type {?} */ inputDefs = dirAst.inputs.map(function (inputAst, inputIndex) {
- var /** @type {?} */ mapValue = literalArr([literal(inputIndex), literal(inputAst.directiveName)]);
- // Note: it's important to not quote the key so that we can capture renames by minifiers!
- return new LiteralMapEntry(inputAst.directiveName, mapValue, false);
- });
- var /** @type {?} */ outputDefs = [];
- var /** @type {?} */ dirMeta = dirAst.directive;
- Object.keys(dirMeta.outputs).forEach(function (propName) {
- var /** @type {?} */ eventName = dirMeta.outputs[propName];
- if (usedEvents.has(eventName)) {
- // Note: it's important to not quote the key so that we can capture renames by minifiers!
- outputDefs.push(new LiteralMapEntry(propName, literal(eventName), false));
- }
- });
- var /** @type {?} */ updateDirectiveExpressions = [];
- if (dirAst.inputs.length || (flags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0) {
- updateDirectiveExpressions =
- dirAst.inputs.map(function (input, bindingIndex) {
- return _this._preprocessUpdateExpression({
- nodeIndex: nodeIndex,
- bindingIndex: bindingIndex,
- sourceSpan: input.sourceSpan,
- context: COMP_VAR,
- value: input.value
- });
- });
- }
- var /** @type {?} */ dirContextExpr = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]);
- var /** @type {?} */ hostBindings = dirAst.hostProperties.map(function (inputAst) {
- return ({
- context: dirContextExpr,
- dirAst: dirAst,
- inputAst: inputAst,
- });
- });
- var /** @type {?} */ hostEvents = dirAst.hostEvents.map(function (hostEventAst) {
- return ({
- context: dirContextExpr,
- eventAst: hostEventAst, dirAst: dirAst,
- });
- });
- // Check index is the same as the node index during compilation
- // They might only differ at runtime
- var /** @type {?} */ checkIndex = nodeIndex;
- this.nodes[nodeIndex] = function () {
- return ({
- sourceSpan: dirAst.sourceSpan,
- nodeFlags: 16384 /* TypeDirective */ | flags,
- nodeDef: importExpr(Identifiers.directiveDef).callFn([
- literal(checkIndex),
- literal(flags),
- queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR,
- literal(childCount),
- providerExpr,
- depsExpr,
- inputDefs.length ? new LiteralMapExpr(inputDefs) : NULL_EXPR,
- outputDefs.length ? new LiteralMapExpr(outputDefs) : NULL_EXPR,
- ]),
- updateDirectives: updateDirectiveExpressions,
- directive: dirAst.directive.type,
- });
- };
- return { hostBindings: hostBindings, hostEvents: hostEvents };
- };
- /**
- * @param {?} providerAst
- * @param {?} queryMatches
- * @return {?}
- */
- ViewBuilder.prototype._visitProvider = /**
- * @param {?} providerAst
- * @param {?} queryMatches
- * @return {?}
- */
- function (providerAst, queryMatches) {
- this._addProviderNode(this._visitProviderOrDirective(providerAst, queryMatches));
- };
- /**
- * @param {?} directives
- * @return {?}
- */
- ViewBuilder.prototype._visitComponentFactoryResolverProvider = /**
- * @param {?} directives
- * @return {?}
- */
- function (directives) {
- var /** @type {?} */ componentDirMeta = directives.find(function (dirAst) { return dirAst.directive.isComponent; });
- if (componentDirMeta && componentDirMeta.directive.entryComponents.length) {
- var _a = componentFactoryResolverProviderDef(this.reflector, this.outputCtx, 8192 /* PrivateProvider */, componentDirMeta.directive.entryComponents), providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, flags = _a.flags, tokenExpr = _a.tokenExpr;
- this._addProviderNode({
- providerExpr: providerExpr,
- depsExpr: depsExpr,
- flags: flags,
- tokenExpr: tokenExpr,
- queryMatchExprs: [],
- sourceSpan: componentDirMeta.sourceSpan
- });
- }
- };
- /**
- * @param {?} data
- * @return {?}
- */
- ViewBuilder.prototype._addProviderNode = /**
- * @param {?} data
- * @return {?}
- */
- function (data) {
- var /** @type {?} */ nodeIndex = this.nodes.length;
- // providerDef(
- // flags: NodeFlags, matchedQueries: [string, QueryValueType][], token:any,
- // value: any, deps: ([DepFlags, any] | any)[]): NodeDef;
- this.nodes.push(function () {
- return ({
- sourceSpan: data.sourceSpan,
- nodeFlags: data.flags,
- nodeDef: importExpr(Identifiers.providerDef).callFn([
- literal(data.flags),
- data.queryMatchExprs.length ? literalArr(data.queryMatchExprs) : NULL_EXPR,
- data.tokenExpr, data.providerExpr, data.depsExpr
- ])
- });
- });
- };
- /**
- * @param {?} providerAst
- * @param {?} queryMatches
- * @return {?}
- */
- ViewBuilder.prototype._visitProviderOrDirective = /**
- * @param {?} providerAst
- * @param {?} queryMatches
- * @return {?}
- */
- function (providerAst, queryMatches) {
- var /** @type {?} */ flags = 0;
- var /** @type {?} */ queryMatchExprs = [];
- queryMatches.forEach(function (match) {
- if (tokenReference(match.value) === tokenReference(providerAst.token)) {
- queryMatchExprs.push(literalArr([literal(match.queryId), literal(4 /* Provider */)]));
- }
- });
- var _a = providerDef(this.outputCtx, providerAst), providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, providerFlags = _a.flags, tokenExpr = _a.tokenExpr;
- return {
- flags: flags | providerFlags,
- queryMatchExprs: queryMatchExprs,
- providerExpr: providerExpr,
- depsExpr: depsExpr,
- tokenExpr: tokenExpr,
- sourceSpan: providerAst.sourceSpan
- };
- };
- /**
- * @param {?} name
- * @return {?}
- */
- ViewBuilder.prototype.getLocal = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- if (name == EventHandlerVars.event.name) {
- return EventHandlerVars.event;
- }
- var /** @type {?} */ currViewExpr = VIEW_VAR;
- for (var /** @type {?} */ currBuilder = this; currBuilder; currBuilder = currBuilder.parent,
- currViewExpr = currViewExpr.prop('parent').cast(DYNAMIC_TYPE)) {
- // check references
- var /** @type {?} */ refNodeIndex = currBuilder.refNodeIndices[name];
- if (refNodeIndex != null) {
- return importExpr(Identifiers.nodeValue).callFn([currViewExpr, literal(refNodeIndex)]);
- }
- // check variables
- var /** @type {?} */ varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; });
- if (varAst) {
- var /** @type {?} */ varValue = varAst.value || IMPLICIT_TEMPLATE_VAR;
- return currViewExpr.prop('context').prop(varValue);
- }
- }
- return null;
- };
- /**
- * @param {?} sourceSpan
- * @param {?} argCount
- * @return {?}
- */
- ViewBuilder.prototype._createLiteralArrayConverter = /**
- * @param {?} sourceSpan
- * @param {?} argCount
- * @return {?}
- */
- function (sourceSpan, argCount) {
- if (argCount === 0) {
- var /** @type {?} */ valueExpr_1 = importExpr(Identifiers.EMPTY_ARRAY);
- return function () { return valueExpr_1; };
- }
- var /** @type {?} */ checkIndex = this.nodes.length;
- this.nodes.push(function () {
- return ({
- sourceSpan: sourceSpan,
- nodeFlags: 32 /* TypePureArray */,
- nodeDef: importExpr(Identifiers.pureArrayDef).callFn([
- literal(checkIndex),
- literal(argCount),
- ])
- });
- });
- return function (args) { return callCheckStmt(checkIndex, args); };
- };
- /**
- * @param {?} sourceSpan
- * @param {?} keys
- * @return {?}
- */
- ViewBuilder.prototype._createLiteralMapConverter = /**
- * @param {?} sourceSpan
- * @param {?} keys
- * @return {?}
- */
- function (sourceSpan, keys) {
- if (keys.length === 0) {
- var /** @type {?} */ valueExpr_2 = importExpr(Identifiers.EMPTY_MAP);
- return function () { return valueExpr_2; };
- }
- var /** @type {?} */ map = literalMap(keys.map(function (e, i) { return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, e, { value: literal(i) })); }));
- var /** @type {?} */ checkIndex = this.nodes.length;
- this.nodes.push(function () {
- return ({
- sourceSpan: sourceSpan,
- nodeFlags: 64 /* TypePureObject */,
- nodeDef: importExpr(Identifiers.pureObjectDef).callFn([
- literal(checkIndex),
- map,
- ])
- });
- });
- return function (args) { return callCheckStmt(checkIndex, args); };
- };
- /**
- * @param {?} expression
- * @param {?} name
- * @param {?} argCount
- * @return {?}
- */
- ViewBuilder.prototype._createPipeConverter = /**
- * @param {?} expression
- * @param {?} name
- * @param {?} argCount
- * @return {?}
- */
- function (expression, name, argCount) {
- var /** @type {?} */ pipe = /** @type {?} */ ((this.usedPipes.find(function (pipeSummary) { return pipeSummary.name === name; })));
- if (pipe.pure) {
- var /** @type {?} */ checkIndex_1 = this.nodes.length;
- this.nodes.push(function () {
- return ({
- sourceSpan: expression.sourceSpan,
- nodeFlags: 128 /* TypePurePipe */,
- nodeDef: importExpr(Identifiers.purePipeDef).callFn([
- literal(checkIndex_1),
- literal(argCount),
- ])
- });
- });
- // find underlying pipe in the component view
- var /** @type {?} */ compViewExpr = VIEW_VAR;
- var /** @type {?} */ compBuilder = this;
- while (compBuilder.parent) {
- compBuilder = compBuilder.parent;
- compViewExpr = compViewExpr.prop('parent').cast(DYNAMIC_TYPE);
- }
- var /** @type {?} */ pipeNodeIndex = compBuilder.purePipeNodeIndices[name];
- var /** @type {?} */ pipeValueExpr_1 = importExpr(Identifiers.nodeValue).callFn([compViewExpr, literal(pipeNodeIndex)]);
- return function (args) {
- return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, callCheckStmt(checkIndex_1, [pipeValueExpr_1].concat(args)));
- };
- }
- else {
- var /** @type {?} */ nodeIndex = this._createPipe(expression.sourceSpan, pipe);
- var /** @type {?} */ nodeValueExpr_1 = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]);
- return function (args) {
- return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, nodeValueExpr_1.callMethod('transform', args));
- };
- }
- };
- /**
- * @param {?} sourceSpan
- * @param {?} pipe
- * @return {?}
- */
- ViewBuilder.prototype._createPipe = /**
- * @param {?} sourceSpan
- * @param {?} pipe
- * @return {?}
- */
- function (sourceSpan, pipe) {
- var _this = this;
- var /** @type {?} */ nodeIndex = this.nodes.length;
- var /** @type {?} */ flags = 0;
- pipe.type.lifecycleHooks.forEach(function (lifecycleHook) {
- // for pipes, we only support ngOnDestroy
- if (lifecycleHook === LifecycleHooks.OnDestroy) {
- flags |= lifecycleHookToNodeFlag(lifecycleHook);
- }
- });
- var /** @type {?} */ depExprs = pipe.type.diDeps.map(function (diDep) { return depDef(_this.outputCtx, diDep); });
- // function pipeDef(
- // flags: NodeFlags, ctor: any, deps: ([DepFlags, any] | any)[]): NodeDef
- this.nodes.push(function () {
- return ({
- sourceSpan: sourceSpan,
- nodeFlags: 16 /* TypePipe */,
- nodeDef: importExpr(Identifiers.pipeDef).callFn([
- literal(flags), _this.outputCtx.importExpr(pipe.type.reference), literalArr(depExprs)
- ])
- });
- });
- return nodeIndex;
- };
- /**
- * For the AST in `UpdateExpression.value`:
- * - create nodes for pipes, literal arrays and, literal maps,
- * - update the AST to replace pipes, literal arrays and, literal maps with calls to check fn.
- *
- * WARNING: This might create new nodeDefs (for pipes and literal arrays and literal maps)!
- * @param {?} expression
- * @return {?}
- */
- ViewBuilder.prototype._preprocessUpdateExpression = /**
- * For the AST in `UpdateExpression.value`:
- * - create nodes for pipes, literal arrays and, literal maps,
- * - update the AST to replace pipes, literal arrays and, literal maps with calls to check fn.
- *
- * WARNING: This might create new nodeDefs (for pipes and literal arrays and literal maps)!
- * @param {?} expression
- * @return {?}
- */
- function (expression) {
- var _this = this;
- return {
- nodeIndex: expression.nodeIndex,
- bindingIndex: expression.bindingIndex,
- sourceSpan: expression.sourceSpan,
- context: expression.context,
- value: convertPropertyBindingBuiltins({
- createLiteralArrayConverter: function (argCount) {
- return _this._createLiteralArrayConverter(expression.sourceSpan, argCount);
- },
- createLiteralMapConverter: function (keys) {
- return _this._createLiteralMapConverter(expression.sourceSpan, keys);
- },
- createPipeConverter: function (name, argCount) {
- return _this._createPipeConverter(expression, name, argCount);
- }
- }, expression.value)
- };
- };
- /**
- * @return {?}
- */
- ViewBuilder.prototype._createNodeExpressions = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ self = this;
- var /** @type {?} */ updateBindingCount = 0;
- var /** @type {?} */ updateRendererStmts = [];
- var /** @type {?} */ updateDirectivesStmts = [];
- var /** @type {?} */ nodeDefExprs = this.nodes.map(function (factory, nodeIndex) {
- var _a = factory(), nodeDef = _a.nodeDef, nodeFlags = _a.nodeFlags, updateDirectives = _a.updateDirectives, updateRenderer = _a.updateRenderer, sourceSpan = _a.sourceSpan;
- if (updateRenderer) {
- updateRendererStmts.push.apply(updateRendererStmts, createUpdateStatements(nodeIndex, sourceSpan, updateRenderer, false));
- }
- if (updateDirectives) {
- updateDirectivesStmts.push.apply(updateDirectivesStmts, createUpdateStatements(nodeIndex, sourceSpan, updateDirectives, (nodeFlags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0));
- }
- // We use a comma expression to call the log function before
- // the nodeDef function, but still use the result of the nodeDef function
- // as the value.
- // Note: We only add the logger to elements / text nodes,
- // so we don't generate too much code.
- var /** @type {?} */ logWithNodeDef = nodeFlags & 3 /* CatRenderNode */ ?
- new CommaExpr([LOG_VAR$1.callFn([]).callFn([]), nodeDef]) :
- nodeDef;
- return applySourceSpanToExpressionIfNeeded(logWithNodeDef, sourceSpan);
- });
- return { updateRendererStmts: updateRendererStmts, updateDirectivesStmts: updateDirectivesStmts, nodeDefExprs: nodeDefExprs };
- /**
- * @param {?} nodeIndex
- * @param {?} sourceSpan
- * @param {?} expressions
- * @param {?} allowEmptyExprs
- * @return {?}
- */
- function createUpdateStatements(nodeIndex, sourceSpan, expressions, allowEmptyExprs) {
- var /** @type {?} */ updateStmts = [];
- var /** @type {?} */ exprs = expressions.map(function (_a) {
- var sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
- var /** @type {?} */ bindingId = "" + updateBindingCount++;
- var /** @type {?} */ nameResolver = context === COMP_VAR ? self : null;
- var _b = convertPropertyBinding(nameResolver, context, value, bindingId, BindingForm.General), stmts = _b.stmts, currValExpr = _b.currValExpr;
- updateStmts.push.apply(updateStmts, stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }));
- return applySourceSpanToExpressionIfNeeded(currValExpr, sourceSpan);
- });
- if (expressions.length || allowEmptyExprs) {
- updateStmts.push(applySourceSpanToStatementIfNeeded(callCheckStmt(nodeIndex, exprs).toStmt(), sourceSpan));
- }
- return updateStmts;
- }
- };
- /**
- * @param {?} nodeIndex
- * @param {?} handlers
- * @return {?}
- */
- ViewBuilder.prototype._createElementHandleEventFn = /**
- * @param {?} nodeIndex
- * @param {?} handlers
- * @return {?}
- */
- function (nodeIndex, handlers) {
- var _this = this;
- var /** @type {?} */ handleEventStmts = [];
- var /** @type {?} */ handleEventBindingCount = 0;
- handlers.forEach(function (_a) {
- var context = _a.context, eventAst = _a.eventAst, dirAst = _a.dirAst;
- var /** @type {?} */ bindingId = "" + handleEventBindingCount++;
- var /** @type {?} */ nameResolver = context === COMP_VAR ? _this : null;
- var _b = convertActionBinding(nameResolver, context, eventAst.handler, bindingId), stmts = _b.stmts, allowDefault = _b.allowDefault;
- var /** @type {?} */ trueStmts = stmts;
- if (allowDefault) {
- trueStmts.push(ALLOW_DEFAULT_VAR.set(allowDefault.and(ALLOW_DEFAULT_VAR)).toStmt());
- }
- var _c = elementEventNameAndTarget(eventAst, dirAst), eventTarget = _c.target, eventName = _c.name;
- var /** @type {?} */ fullEventName = elementEventFullName(eventTarget, eventName);
- handleEventStmts.push(applySourceSpanToStatementIfNeeded(new IfStmt(literal(fullEventName).identical(EVENT_NAME_VAR), trueStmts), eventAst.sourceSpan));
- });
- var /** @type {?} */ handleEventFn;
- if (handleEventStmts.length > 0) {
- var /** @type {?} */ preStmts = [ALLOW_DEFAULT_VAR.set(literal(true)).toDeclStmt(BOOL_TYPE)];
- if (!this.component.isHost && findReadVarNames(handleEventStmts).has(/** @type {?} */ ((COMP_VAR.name)))) {
- preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType));
- }
- handleEventFn = fn([
- new FnParam(/** @type {?} */ ((VIEW_VAR.name)), INFERRED_TYPE),
- new FnParam(/** @type {?} */ ((EVENT_NAME_VAR.name)), INFERRED_TYPE),
- new FnParam(/** @type {?} */ ((EventHandlerVars.event.name)), INFERRED_TYPE)
- ], preStmts.concat(handleEventStmts, [new ReturnStatement(ALLOW_DEFAULT_VAR)]), INFERRED_TYPE);
- }
- else {
- handleEventFn = NULL_EXPR;
- }
- return handleEventFn;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitDirective = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitDirectiveProperty = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitReference = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitVariable = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitEvent = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitElementProperty = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- ViewBuilder.prototype.visitAttr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) { };
- return ViewBuilder;
- }());
- /**
- * @param {?} astNodes
- * @return {?}
- */
- function needsAdditionalRootNode(astNodes) {
- var /** @type {?} */ lastAstNode = astNodes[astNodes.length - 1];
- if (lastAstNode instanceof EmbeddedTemplateAst) {
- return lastAstNode.hasViewContainer;
- }
- if (lastAstNode instanceof ElementAst) {
- if (isNgContainer(lastAstNode.name) && lastAstNode.children.length) {
- return needsAdditionalRootNode(lastAstNode.children);
- }
- return lastAstNode.hasViewContainer;
- }
- return lastAstNode instanceof NgContentAst;
- }
- /**
- * @param {?} inputAst
- * @param {?} dirAst
- * @return {?}
- */
- function elementBindingDef(inputAst, dirAst) {
- switch (inputAst.type) {
- case PropertyBindingType.Attribute:
- return literalArr([
- literal(1 /* TypeElementAttribute */), literal(inputAst.name),
- literal(inputAst.securityContext)
- ]);
- case PropertyBindingType.Property:
- return literalArr([
- literal(8 /* TypeProperty */), literal(inputAst.name),
- literal(inputAst.securityContext)
- ]);
- case PropertyBindingType.Animation:
- var /** @type {?} */ bindingType = 8 /* TypeProperty */ |
- (dirAst && dirAst.directive.isComponent ? 32 /* SyntheticHostProperty */ :
- 16 /* SyntheticProperty */);
- return literalArr([
- literal(bindingType), literal('@' + inputAst.name), literal(inputAst.securityContext)
- ]);
- case PropertyBindingType.Class:
- return literalArr([literal(2 /* TypeElementClass */), literal(inputAst.name), NULL_EXPR]);
- case PropertyBindingType.Style:
- return literalArr([
- literal(4 /* TypeElementStyle */), literal(inputAst.name), literal(inputAst.unit)
- ]);
- }
- }
- /**
- * @param {?} elementAst
- * @return {?}
- */
- function fixedAttrsDef(elementAst) {
- var /** @type {?} */ mapResult = Object.create(null);
- elementAst.attrs.forEach(function (attrAst) { mapResult[attrAst.name] = attrAst.value; });
- elementAst.directives.forEach(function (dirAst) {
- Object.keys(dirAst.directive.hostAttributes).forEach(function (name) {
- var /** @type {?} */ value = dirAst.directive.hostAttributes[name];
- var /** @type {?} */ prevValue = mapResult[name];
- mapResult[name] = prevValue != null ? mergeAttributeValue(name, prevValue, value) : value;
- });
- });
- // Note: We need to sort to get a defined output order
- // for tests and for caching generated artifacts...
- return literalArr(Object.keys(mapResult).sort().map(function (attrName) { return literalArr([literal(attrName), literal(mapResult[attrName])]); }));
- }
- /**
- * @param {?} attrName
- * @param {?} attrValue1
- * @param {?} attrValue2
- * @return {?}
- */
- function mergeAttributeValue(attrName, attrValue1, attrValue2) {
- if (attrName == CLASS_ATTR$1 || attrName == STYLE_ATTR) {
- return attrValue1 + " " + attrValue2;
- }
- else {
- return attrValue2;
- }
- }
- /**
- * @param {?} nodeIndex
- * @param {?} exprs
- * @return {?}
- */
- function callCheckStmt(nodeIndex, exprs) {
- if (exprs.length > 10) {
- return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(1 /* Dynamic */), literalArr(exprs)]);
- }
- else {
- return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(0 /* Inline */)].concat(exprs));
- }
- }
- /**
- * @param {?} nodeIndex
- * @param {?} bindingIdx
- * @param {?} expr
- * @return {?}
- */
- function callUnwrapValue(nodeIndex, bindingIdx, expr) {
- return importExpr(Identifiers.unwrapValue).callFn([
- VIEW_VAR, literal(nodeIndex), literal(bindingIdx), expr
- ]);
- }
- /**
- * @param {?} nodes
- * @param {?=} result
- * @return {?}
- */
- function findStaticQueryIds(nodes, result) {
- if (result === void 0) { result = new Map(); }
- nodes.forEach(function (node) {
- var /** @type {?} */ staticQueryIds = new Set();
- var /** @type {?} */ dynamicQueryIds = new Set();
- var /** @type {?} */ queryMatches = /** @type {?} */ ((undefined));
- if (node instanceof ElementAst) {
- findStaticQueryIds(node.children, result);
- node.children.forEach(function (child) {
- var /** @type {?} */ childData = /** @type {?} */ ((result.get(child)));
- childData.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); });
- childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
- });
- queryMatches = node.queryMatches;
- }
- else if (node instanceof EmbeddedTemplateAst) {
- findStaticQueryIds(node.children, result);
- node.children.forEach(function (child) {
- var /** @type {?} */ childData = /** @type {?} */ ((result.get(child)));
- childData.staticQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
- childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
- });
- queryMatches = node.queryMatches;
- }
- if (queryMatches) {
- queryMatches.forEach(function (match) { return staticQueryIds.add(match.queryId); });
- }
- dynamicQueryIds.forEach(function (queryId) { return staticQueryIds.delete(queryId); });
- result.set(node, { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds });
- });
- return result;
- }
- /**
- * @param {?} nodeStaticQueryIds
- * @return {?}
- */
- function staticViewQueryIds(nodeStaticQueryIds) {
- var /** @type {?} */ staticQueryIds = new Set();
- var /** @type {?} */ dynamicQueryIds = new Set();
- Array.from(nodeStaticQueryIds.values()).forEach(function (entry) {
- entry.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); });
- entry.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
- });
- dynamicQueryIds.forEach(function (queryId) { return staticQueryIds.delete(queryId); });
- return { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds };
- }
- /**
- * @param {?} eventAst
- * @param {?} dirAst
- * @return {?}
- */
- function elementEventNameAndTarget(eventAst, dirAst) {
- if (eventAst.isAnimation) {
- return {
- name: "@" + eventAst.name + "." + eventAst.phase,
- target: dirAst && dirAst.directive.isComponent ? 'component' : null
- };
- }
- else {
- return eventAst;
- }
- }
- /**
- * @param {?} queryIds
- * @param {?} queryId
- * @param {?} isFirst
- * @return {?}
- */
- function calcStaticDynamicQueryFlags(queryIds, queryId, isFirst) {
- var /** @type {?} */ flags = 0;
- // Note: We only make queries static that query for a single item.
- // This is because of backwards compatibility with the old view compiler...
- if (isFirst && (queryIds.staticQueryIds.has(queryId) || !queryIds.dynamicQueryIds.has(queryId))) {
- flags |= 268435456 /* StaticQuery */;
- }
- else {
- flags |= 536870912 /* DynamicQuery */;
- }
- return flags;
- }
- /**
- * @param {?} target
- * @param {?} name
- * @return {?}
- */
- function elementEventFullName(target, name) {
- return target ? target + ":" + name : name;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A container for message extracted from the templates.
- */
- var MessageBundle = /** @class */ (function () {
- function MessageBundle(_htmlParser, _implicitTags, _implicitAttrs, _locale) {
- if (_locale === void 0) { _locale = null; }
- this._htmlParser = _htmlParser;
- this._implicitTags = _implicitTags;
- this._implicitAttrs = _implicitAttrs;
- this._locale = _locale;
- this._messages = [];
- }
- /**
- * @param {?} html
- * @param {?} url
- * @param {?} interpolationConfig
- * @return {?}
- */
- MessageBundle.prototype.updateFromTemplate = /**
- * @param {?} html
- * @param {?} url
- * @param {?} interpolationConfig
- * @return {?}
- */
- function (html, url, interpolationConfig) {
- var /** @type {?} */ htmlParserResult = this._htmlParser.parse(html, url, true, interpolationConfig);
- if (htmlParserResult.errors.length) {
- return htmlParserResult.errors;
- }
- var /** @type {?} */ i18nParserResult = extractMessages(htmlParserResult.rootNodes, interpolationConfig, this._implicitTags, this._implicitAttrs);
- if (i18nParserResult.errors.length) {
- return i18nParserResult.errors;
- }
- (_a = this._messages).push.apply(_a, i18nParserResult.messages);
- return [];
- var _a;
- };
- // Return the message in the internal format
- // The public (serialized) format might be different, see the `write` method.
- /**
- * @return {?}
- */
- MessageBundle.prototype.getMessages = /**
- * @return {?}
- */
- function () { return this._messages; };
- /**
- * @param {?} serializer
- * @param {?=} filterSources
- * @return {?}
- */
- MessageBundle.prototype.write = /**
- * @param {?} serializer
- * @param {?=} filterSources
- * @return {?}
- */
- function (serializer, filterSources) {
- var /** @type {?} */ messages = {};
- var /** @type {?} */ mapperVisitor = new MapPlaceholderNames();
- // Deduplicate messages based on their ID
- this._messages.forEach(function (message) {
- var /** @type {?} */ id = serializer.digest(message);
- if (!messages.hasOwnProperty(id)) {
- messages[id] = message;
- }
- else {
- (_a = messages[id].sources).push.apply(_a, message.sources);
- }
- var _a;
- });
- // Transform placeholder names using the serializer mapping
- var /** @type {?} */ msgList = Object.keys(messages).map(function (id) {
- var /** @type {?} */ mapper = serializer.createNameMapper(messages[id]);
- var /** @type {?} */ src = messages[id];
- var /** @type {?} */ nodes = mapper ? mapperVisitor.convert(src.nodes, mapper) : src.nodes;
- var /** @type {?} */ transformedMessage = new Message(nodes, {}, {}, src.meaning, src.description, id);
- transformedMessage.sources = src.sources;
- if (filterSources) {
- transformedMessage.sources.forEach(function (source) { return source.filePath = filterSources(source.filePath); });
- }
- return transformedMessage;
- });
- return serializer.write(msgList, this._locale);
- };
- return MessageBundle;
- }());
- var MapPlaceholderNames = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(MapPlaceholderNames, _super);
- function MapPlaceholderNames() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} nodes
- * @param {?} mapper
- * @return {?}
- */
- MapPlaceholderNames.prototype.convert = /**
- * @param {?} nodes
- * @param {?} mapper
- * @return {?}
- */
- function (nodes, mapper) {
- var _this = this;
- return mapper ? nodes.map(function (n) { return n.visit(_this, mapper); }) : nodes;
- };
- /**
- * @param {?} ph
- * @param {?} mapper
- * @return {?}
- */
- MapPlaceholderNames.prototype.visitTagPlaceholder = /**
- * @param {?} ph
- * @param {?} mapper
- * @return {?}
- */
- function (ph, mapper) {
- var _this = this;
- var /** @type {?} */ startName = /** @type {?} */ ((mapper.toPublicName(ph.startName)));
- var /** @type {?} */ closeName = ph.closeName ? /** @type {?} */ ((mapper.toPublicName(ph.closeName))) : ph.closeName;
- var /** @type {?} */ children = ph.children.map(function (n) { return n.visit(_this, mapper); });
- return new TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan);
- };
- /**
- * @param {?} ph
- * @param {?} mapper
- * @return {?}
- */
- MapPlaceholderNames.prototype.visitPlaceholder = /**
- * @param {?} ph
- * @param {?} mapper
- * @return {?}
- */
- function (ph, mapper) {
- return new Placeholder(ph.value, /** @type {?} */ ((mapper.toPublicName(ph.name))), ph.sourceSpan);
- };
- /**
- * @param {?} ph
- * @param {?} mapper
- * @return {?}
- */
- MapPlaceholderNames.prototype.visitIcuPlaceholder = /**
- * @param {?} ph
- * @param {?} mapper
- * @return {?}
- */
- function (ph, mapper) {
- return new IcuPlaceholder(ph.value, /** @type {?} */ ((mapper.toPublicName(ph.name))), ph.sourceSpan);
- };
- return MapPlaceholderNames;
- }(CloneVisitor));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var GeneratedFile = /** @class */ (function () {
- function GeneratedFile(srcFileUrl, genFileUrl, sourceOrStmts) {
- this.srcFileUrl = srcFileUrl;
- this.genFileUrl = genFileUrl;
- if (typeof sourceOrStmts === 'string') {
- this.source = sourceOrStmts;
- this.stmts = null;
- }
- else {
- this.source = null;
- this.stmts = sourceOrStmts;
- }
- }
- /**
- * @param {?} other
- * @return {?}
- */
- GeneratedFile.prototype.isEquivalent = /**
- * @param {?} other
- * @return {?}
- */
- function (other) {
- if (this.genFileUrl !== other.genFileUrl) {
- return false;
- }
- if (this.source) {
- return this.source === other.source;
- }
- if (other.stmts == null) {
- return false;
- }
- // Note: the constructor guarantees that if this.source is not filled,
- // then this.stmts is.
- return areAllEquivalent(/** @type {?} */ ((this.stmts)), /** @type {?} */ ((other.stmts)));
- };
- return GeneratedFile;
- }());
- /**
- * @param {?} file
- * @param {?=} preamble
- * @return {?}
- */
- function toTypeScript(file, preamble) {
- if (preamble === void 0) { preamble = ''; }
- if (!file.stmts) {
- throw new Error("Illegal state: No stmts present on GeneratedFile " + file.genFileUrl);
- }
- return new TypeScriptEmitter().emitStatements(file.genFileUrl, file.stmts, preamble);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @record
- */
- /**
- * @param {?} moduleMeta
- * @param {?} reflector
- * @return {?}
- */
- function listLazyRoutes(moduleMeta, reflector) {
- var /** @type {?} */ allLazyRoutes = [];
- for (var _i = 0, _a = moduleMeta.transitiveModule.providers; _i < _a.length; _i++) {
- var _b = _a[_i], provider = _b.provider, module = _b.module;
- if (tokenReference(provider.token) === reflector.ROUTES) {
- var /** @type {?} */ loadChildren = _collectLoadChildren(provider.useValue);
- for (var _c = 0, loadChildren_1 = loadChildren; _c < loadChildren_1.length; _c++) {
- var route = loadChildren_1[_c];
- allLazyRoutes.push(parseLazyRoute(route, reflector, module.reference));
- }
- }
- }
- return allLazyRoutes;
- }
- /**
- * @param {?} routes
- * @param {?=} target
- * @return {?}
- */
- function _collectLoadChildren(routes, target) {
- if (target === void 0) { target = []; }
- if (typeof routes === 'string') {
- target.push(routes);
- }
- else if (Array.isArray(routes)) {
- for (var _i = 0, routes_1 = routes; _i < routes_1.length; _i++) {
- var route = routes_1[_i];
- _collectLoadChildren(route, target);
- }
- }
- else if (routes.loadChildren) {
- _collectLoadChildren(routes.loadChildren, target);
- }
- else if (routes.children) {
- _collectLoadChildren(routes.children, target);
- }
- return target;
- }
- /**
- * @param {?} route
- * @param {?} reflector
- * @param {?=} module
- * @return {?}
- */
- function parseLazyRoute(route, reflector, module) {
- var _a = route.split('#'), routePath = _a[0], routeName = _a[1];
- var /** @type {?} */ referencedModule = reflector.resolveExternalReference({
- moduleName: routePath,
- name: routeName,
- }, module ? module.filePath : undefined);
- return { route: route, module: module || referencedModule, referencedModule: referencedModule };
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ResolvedStaticSymbol = /** @class */ (function () {
- function ResolvedStaticSymbol(symbol, metadata) {
- this.symbol = symbol;
- this.metadata = metadata;
- }
- return ResolvedStaticSymbol;
- }());
- /**
- * The host of the SymbolResolverHost disconnects the implementation from TypeScript / other
- * language
- * services and from underlying file systems.
- * @record
- */
- var SUPPORTED_SCHEMA_VERSION = 4;
- /**
- * This class is responsible for loading metadata per symbol,
- * and normalizing references between symbols.
- *
- * Internally, it only uses symbols without members,
- * and deduces the values for symbols with members based
- * on these symbols.
- */
- var StaticSymbolResolver = /** @class */ (function () {
- function StaticSymbolResolver(host, staticSymbolCache, summaryResolver, errorRecorder) {
- this.host = host;
- this.staticSymbolCache = staticSymbolCache;
- this.summaryResolver = summaryResolver;
- this.errorRecorder = errorRecorder;
- this.metadataCache = new Map();
- this.resolvedSymbols = new Map();
- this.resolvedFilePaths = new Set();
- this.importAs = new Map();
- this.symbolResourcePaths = new Map();
- this.symbolFromFile = new Map();
- this.knownFileNameToModuleNames = new Map();
- }
- /**
- * @param {?} staticSymbol
- * @return {?}
- */
- StaticSymbolResolver.prototype.resolveSymbol = /**
- * @param {?} staticSymbol
- * @return {?}
- */
- function (staticSymbol) {
- if (staticSymbol.members.length > 0) {
- return /** @type {?} */ ((this._resolveSymbolMembers(staticSymbol)));
- }
- // Note: always ask for a summary first,
- // as we might have read shallow metadata via a .d.ts file
- // for the symbol.
- var /** @type {?} */ resultFromSummary = /** @type {?} */ ((this._resolveSymbolFromSummary(staticSymbol)));
- if (resultFromSummary) {
- return resultFromSummary;
- }
- var /** @type {?} */ resultFromCache = this.resolvedSymbols.get(staticSymbol);
- if (resultFromCache) {
- return resultFromCache;
- }
- // Note: Some users use libraries that were not compiled with ngc, i.e. they don't
- // have summaries, only .d.ts files. So we always need to check both, the summary
- // and metadata.
- this._createSymbolsOf(staticSymbol.filePath);
- return /** @type {?} */ ((this.resolvedSymbols.get(staticSymbol)));
- };
- /**
- * getImportAs produces a symbol that can be used to import the given symbol.
- * The import might be different than the symbol if the symbol is exported from
- * a library with a summary; in which case we want to import the symbol from the
- * ngfactory re-export instead of directly to avoid introducing a direct dependency
- * on an otherwise indirect dependency.
- *
- * @param staticSymbol the symbol for which to generate a import symbol
- */
- /**
- * getImportAs produces a symbol that can be used to import the given symbol.
- * The import might be different than the symbol if the symbol is exported from
- * a library with a summary; in which case we want to import the symbol from the
- * ngfactory re-export instead of directly to avoid introducing a direct dependency
- * on an otherwise indirect dependency.
- *
- * @param {?} staticSymbol the symbol for which to generate a import symbol
- * @param {?=} useSummaries
- * @return {?}
- */
- StaticSymbolResolver.prototype.getImportAs = /**
- * getImportAs produces a symbol that can be used to import the given symbol.
- * The import might be different than the symbol if the symbol is exported from
- * a library with a summary; in which case we want to import the symbol from the
- * ngfactory re-export instead of directly to avoid introducing a direct dependency
- * on an otherwise indirect dependency.
- *
- * @param {?} staticSymbol the symbol for which to generate a import symbol
- * @param {?=} useSummaries
- * @return {?}
- */
- function (staticSymbol, useSummaries) {
- if (useSummaries === void 0) { useSummaries = true; }
- if (staticSymbol.members.length) {
- var /** @type {?} */ baseSymbol = this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name);
- var /** @type {?} */ baseImportAs = this.getImportAs(baseSymbol, useSummaries);
- return baseImportAs ?
- this.getStaticSymbol(baseImportAs.filePath, baseImportAs.name, staticSymbol.members) :
- null;
- }
- var /** @type {?} */ summarizedFileName = stripSummaryForJitFileSuffix(staticSymbol.filePath);
- if (summarizedFileName !== staticSymbol.filePath) {
- var /** @type {?} */ summarizedName = stripSummaryForJitNameSuffix(staticSymbol.name);
- var /** @type {?} */ baseSymbol = this.getStaticSymbol(summarizedFileName, summarizedName, staticSymbol.members);
- var /** @type {?} */ baseImportAs = this.getImportAs(baseSymbol, useSummaries);
- return baseImportAs ?
- this.getStaticSymbol(summaryForJitFileName(baseImportAs.filePath), summaryForJitName(baseImportAs.name), baseSymbol.members) :
- null;
- }
- var /** @type {?} */ result = (useSummaries && this.summaryResolver.getImportAs(staticSymbol)) || null;
- if (!result) {
- result = /** @type {?} */ ((this.importAs.get(staticSymbol)));
- }
- return result;
- };
- /**
- * getResourcePath produces the path to the original location of the symbol and should
- * be used to determine the relative location of resource references recorded in
- * symbol metadata.
- */
- /**
- * getResourcePath produces the path to the original location of the symbol and should
- * be used to determine the relative location of resource references recorded in
- * symbol metadata.
- * @param {?} staticSymbol
- * @return {?}
- */
- StaticSymbolResolver.prototype.getResourcePath = /**
- * getResourcePath produces the path to the original location of the symbol and should
- * be used to determine the relative location of resource references recorded in
- * symbol metadata.
- * @param {?} staticSymbol
- * @return {?}
- */
- function (staticSymbol) {
- return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath;
- };
- /**
- * getTypeArity returns the number of generic type parameters the given symbol
- * has. If the symbol is not a type the result is null.
- */
- /**
- * getTypeArity returns the number of generic type parameters the given symbol
- * has. If the symbol is not a type the result is null.
- * @param {?} staticSymbol
- * @return {?}
- */
- StaticSymbolResolver.prototype.getTypeArity = /**
- * getTypeArity returns the number of generic type parameters the given symbol
- * has. If the symbol is not a type the result is null.
- * @param {?} staticSymbol
- * @return {?}
- */
- function (staticSymbol) {
- // If the file is a factory/ngsummary file, don't resolve the symbol as doing so would
- // cause the metadata for an factory/ngsummary file to be loaded which doesn't exist.
- // All references to generated classes must include the correct arity whenever
- // generating code.
- if (isGeneratedFile(staticSymbol.filePath)) {
- return null;
- }
- var /** @type {?} */ resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(staticSymbol));
- while (resolvedSymbol && resolvedSymbol.metadata instanceof StaticSymbol) {
- resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(resolvedSymbol.metadata));
- }
- return (resolvedSymbol && resolvedSymbol.metadata && resolvedSymbol.metadata.arity) || null;
- };
- /**
- * @param {?} filePath
- * @return {?}
- */
- StaticSymbolResolver.prototype.getKnownModuleName = /**
- * @param {?} filePath
- * @return {?}
- */
- function (filePath) {
- return this.knownFileNameToModuleNames.get(filePath) || null;
- };
- /**
- * @param {?} sourceSymbol
- * @param {?} targetSymbol
- * @return {?}
- */
- StaticSymbolResolver.prototype.recordImportAs = /**
- * @param {?} sourceSymbol
- * @param {?} targetSymbol
- * @return {?}
- */
- function (sourceSymbol, targetSymbol) {
- sourceSymbol.assertNoMembers();
- targetSymbol.assertNoMembers();
- this.importAs.set(sourceSymbol, targetSymbol);
- };
- /**
- * @param {?} fileName
- * @param {?} moduleName
- * @return {?}
- */
- StaticSymbolResolver.prototype.recordModuleNameForFileName = /**
- * @param {?} fileName
- * @param {?} moduleName
- * @return {?}
- */
- function (fileName, moduleName) {
- this.knownFileNameToModuleNames.set(fileName, moduleName);
- };
- /**
- * Invalidate all information derived from the given file.
- *
- * @param fileName the file to invalidate
- */
- /**
- * Invalidate all information derived from the given file.
- *
- * @param {?} fileName the file to invalidate
- * @return {?}
- */
- StaticSymbolResolver.prototype.invalidateFile = /**
- * Invalidate all information derived from the given file.
- *
- * @param {?} fileName the file to invalidate
- * @return {?}
- */
- function (fileName) {
- this.metadataCache.delete(fileName);
- this.resolvedFilePaths.delete(fileName);
- var /** @type {?} */ symbols = this.symbolFromFile.get(fileName);
- if (symbols) {
- this.symbolFromFile.delete(fileName);
- for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
- var symbol = symbols_1[_i];
- this.resolvedSymbols.delete(symbol);
- this.importAs.delete(symbol);
- this.symbolResourcePaths.delete(symbol);
- }
- }
- };
- /* @internal */
- /**
- * @template T
- * @param {?} cb
- * @return {?}
- */
- StaticSymbolResolver.prototype.ignoreErrorsFor = /**
- * @template T
- * @param {?} cb
- * @return {?}
- */
- function (cb) {
- var /** @type {?} */ recorder = this.errorRecorder;
- this.errorRecorder = function () { };
- try {
- return cb();
- }
- finally {
- this.errorRecorder = recorder;
- }
- };
- /**
- * @param {?} staticSymbol
- * @return {?}
- */
- StaticSymbolResolver.prototype._resolveSymbolMembers = /**
- * @param {?} staticSymbol
- * @return {?}
- */
- function (staticSymbol) {
- var /** @type {?} */ members = staticSymbol.members;
- var /** @type {?} */ baseResolvedSymbol = this.resolveSymbol(this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name));
- if (!baseResolvedSymbol) {
- return null;
- }
- var /** @type {?} */ baseMetadata = unwrapResolvedMetadata(baseResolvedSymbol.metadata);
- if (baseMetadata instanceof StaticSymbol) {
- return new ResolvedStaticSymbol(staticSymbol, this.getStaticSymbol(baseMetadata.filePath, baseMetadata.name, members));
- }
- else if (baseMetadata && baseMetadata.__symbolic === 'class') {
- if (baseMetadata.statics && members.length === 1) {
- return new ResolvedStaticSymbol(staticSymbol, baseMetadata.statics[members[0]]);
- }
- }
- else {
- var /** @type {?} */ value = baseMetadata;
- for (var /** @type {?} */ i = 0; i < members.length && value; i++) {
- value = value[members[i]];
- }
- return new ResolvedStaticSymbol(staticSymbol, value);
- }
- return null;
- };
- /**
- * @param {?} staticSymbol
- * @return {?}
- */
- StaticSymbolResolver.prototype._resolveSymbolFromSummary = /**
- * @param {?} staticSymbol
- * @return {?}
- */
- function (staticSymbol) {
- var /** @type {?} */ summary = this.summaryResolver.resolveSummary(staticSymbol);
- return summary ? new ResolvedStaticSymbol(staticSymbol, summary.metadata) : null;
- };
- /**
- * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
- * All types passed to the StaticResolver should be pseudo-types returned by this method.
- *
- * @param declarationFile the absolute path of the file where the symbol is declared
- * @param name the name of the type.
- * @param members a symbol for a static member of the named type
- */
- /**
- * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
- * All types passed to the StaticResolver should be pseudo-types returned by this method.
- *
- * @param {?} declarationFile the absolute path of the file where the symbol is declared
- * @param {?} name the name of the type.
- * @param {?=} members a symbol for a static member of the named type
- * @return {?}
- */
- StaticSymbolResolver.prototype.getStaticSymbol = /**
- * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
- * All types passed to the StaticResolver should be pseudo-types returned by this method.
- *
- * @param {?} declarationFile the absolute path of the file where the symbol is declared
- * @param {?} name the name of the type.
- * @param {?=} members a symbol for a static member of the named type
- * @return {?}
- */
- function (declarationFile, name, members) {
- return this.staticSymbolCache.get(declarationFile, name, members);
- };
- /**
- * hasDecorators checks a file's metadata for the presense of decorators without evalutating the
- * metadata.
- *
- * @param filePath the absolute path to examine for decorators.
- * @returns true if any class in the file has a decorator.
- */
- /**
- * hasDecorators checks a file's metadata for the presense of decorators without evalutating the
- * metadata.
- *
- * @param {?} filePath the absolute path to examine for decorators.
- * @return {?} true if any class in the file has a decorator.
- */
- StaticSymbolResolver.prototype.hasDecorators = /**
- * hasDecorators checks a file's metadata for the presense of decorators without evalutating the
- * metadata.
- *
- * @param {?} filePath the absolute path to examine for decorators.
- * @return {?} true if any class in the file has a decorator.
- */
- function (filePath) {
- var /** @type {?} */ metadata = this.getModuleMetadata(filePath);
- if (metadata['metadata']) {
- return Object.keys(metadata['metadata']).some(function (metadataKey) {
- var /** @type {?} */ entry = metadata['metadata'][metadataKey];
- return entry && entry.__symbolic === 'class' && entry.decorators;
- });
- }
- return false;
- };
- /**
- * @param {?} filePath
- * @return {?}
- */
- StaticSymbolResolver.prototype.getSymbolsOf = /**
- * @param {?} filePath
- * @return {?}
- */
- function (filePath) {
- var /** @type {?} */ summarySymbols = this.summaryResolver.getSymbolsOf(filePath);
- if (summarySymbols) {
- return summarySymbols;
- }
- // Note: Some users use libraries that were not compiled with ngc, i.e. they don't
- // have summaries, only .d.ts files, but `summaryResolver.isLibraryFile` returns true.
- this._createSymbolsOf(filePath);
- var /** @type {?} */ metadataSymbols = [];
- this.resolvedSymbols.forEach(function (resolvedSymbol) {
- if (resolvedSymbol.symbol.filePath === filePath) {
- metadataSymbols.push(resolvedSymbol.symbol);
- }
- });
- return metadataSymbols;
- };
- /**
- * @param {?} filePath
- * @return {?}
- */
- StaticSymbolResolver.prototype._createSymbolsOf = /**
- * @param {?} filePath
- * @return {?}
- */
- function (filePath) {
- var _this = this;
- if (this.resolvedFilePaths.has(filePath)) {
- return;
- }
- this.resolvedFilePaths.add(filePath);
- var /** @type {?} */ resolvedSymbols = [];
- var /** @type {?} */ metadata = this.getModuleMetadata(filePath);
- if (metadata['importAs']) {
- // Index bundle indices should use the importAs module name defined
- // in the bundle.
- this.knownFileNameToModuleNames.set(filePath, metadata['importAs']);
- }
- // handle the symbols in one of the re-export location
- if (metadata['exports']) {
- var _loop_1 = function (moduleExport) {
- // handle the symbols in the list of explicitly re-exported symbols.
- if (moduleExport.export) {
- moduleExport.export.forEach(function (exportSymbol) {
- var /** @type {?} */ symbolName;
- if (typeof exportSymbol === 'string') {
- symbolName = exportSymbol;
- }
- else {
- symbolName = exportSymbol.as;
- }
- symbolName = unescapeIdentifier(symbolName);
- var /** @type {?} */ symName = symbolName;
- if (typeof exportSymbol !== 'string') {
- symName = unescapeIdentifier(exportSymbol.name);
- }
- var /** @type {?} */ resolvedModule = _this.resolveModule(moduleExport.from, filePath);
- if (resolvedModule) {
- var /** @type {?} */ targetSymbol = _this.getStaticSymbol(resolvedModule, symName);
- var /** @type {?} */ sourceSymbol = _this.getStaticSymbol(filePath, symbolName);
- resolvedSymbols.push(_this.createExport(sourceSymbol, targetSymbol));
- }
- });
- }
- else {
- // handle the symbols via export * directives.
- var /** @type {?} */ resolvedModule = this_1.resolveModule(moduleExport.from, filePath);
- if (resolvedModule) {
- var /** @type {?} */ nestedExports = this_1.getSymbolsOf(resolvedModule);
- nestedExports.forEach(function (targetSymbol) {
- var /** @type {?} */ sourceSymbol = _this.getStaticSymbol(filePath, targetSymbol.name);
- resolvedSymbols.push(_this.createExport(sourceSymbol, targetSymbol));
- });
- }
- }
- };
- var this_1 = this;
- for (var _i = 0, _a = metadata['exports']; _i < _a.length; _i++) {
- var moduleExport = _a[_i];
- _loop_1(moduleExport);
- }
- }
- // handle the actual metadata. Has to be after the exports
- // as there migth be collisions in the names, and we want the symbols
- // of the current module to win ofter reexports.
- if (metadata['metadata']) {
- // handle direct declarations of the symbol
- var /** @type {?} */ topLevelSymbolNames_1 = new Set(Object.keys(metadata['metadata']).map(unescapeIdentifier));
- var /** @type {?} */ origins_1 = metadata['origins'] || {};
- Object.keys(metadata['metadata']).forEach(function (metadataKey) {
- var /** @type {?} */ symbolMeta = metadata['metadata'][metadataKey];
- var /** @type {?} */ name = unescapeIdentifier(metadataKey);
- var /** @type {?} */ symbol = _this.getStaticSymbol(filePath, name);
- var /** @type {?} */ origin = origins_1.hasOwnProperty(metadataKey) && origins_1[metadataKey];
- if (origin) {
- // If the symbol is from a bundled index, use the declaration location of the
- // symbol so relative references (such as './my.html') will be calculated
- // correctly.
- var /** @type {?} */ originFilePath = _this.resolveModule(origin, filePath);
- if (!originFilePath) {
- _this.reportError(new Error("Couldn't resolve original symbol for " + origin + " from " + filePath));
- }
- else {
- _this.symbolResourcePaths.set(symbol, originFilePath);
- }
- }
- resolvedSymbols.push(_this.createResolvedSymbol(symbol, filePath, topLevelSymbolNames_1, symbolMeta));
- });
- }
- resolvedSymbols.forEach(function (resolvedSymbol) { return _this.resolvedSymbols.set(resolvedSymbol.symbol, resolvedSymbol); });
- this.symbolFromFile.set(filePath, resolvedSymbols.map(function (resolvedSymbol) { return resolvedSymbol.symbol; }));
- };
- /**
- * @param {?} sourceSymbol
- * @param {?} topLevelPath
- * @param {?} topLevelSymbolNames
- * @param {?} metadata
- * @return {?}
- */
- StaticSymbolResolver.prototype.createResolvedSymbol = /**
- * @param {?} sourceSymbol
- * @param {?} topLevelPath
- * @param {?} topLevelSymbolNames
- * @param {?} metadata
- * @return {?}
- */
- function (sourceSymbol, topLevelPath, topLevelSymbolNames, metadata) {
- var _this = this;
- // For classes that don't have Angular summaries / metadata,
- // we only keep their arity, but nothing else
- // (e.g. their constructor parameters).
- // We do this to prevent introducing deep imports
- // as we didn't generate .ngfactory.ts files with proper reexports.
- if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) && metadata &&
- metadata['__symbolic'] === 'class') {
- var /** @type {?} */ transformedMeta_1 = { __symbolic: 'class', arity: metadata.arity };
- return new ResolvedStaticSymbol(sourceSymbol, transformedMeta_1);
- }
- var /** @type {?} */ _originalFileMemo;
- var /** @type {?} */ getOriginalName = function () {
- if (!_originalFileMemo) {
- // Guess what hte original file name is from the reference. If it has a `.d.ts` extension
- // replace it with `.ts`. If it already has `.ts` just leave it in place. If it doesn't have
- // .ts or .d.ts, append `.ts'. Also, if it is in `node_modules`, trim the `node_module`
- // location as it is not important to finding the file.
- _originalFileMemo =
- _this.host.getOutputName(topLevelPath.replace(/((\.ts)|(\.d\.ts)|)$/, '.ts')
- .replace(/^.*node_modules[/\\]/, ''));
- }
- return _originalFileMemo;
- };
- var /** @type {?} */ self = this;
- var ReferenceTransformer = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReferenceTransformer, _super);
- function ReferenceTransformer() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} map
- * @param {?} functionParams
- * @return {?}
- */
- ReferenceTransformer.prototype.visitStringMap = /**
- * @param {?} map
- * @param {?} functionParams
- * @return {?}
- */
- function (map, functionParams) {
- var /** @type {?} */ symbolic = map['__symbolic'];
- if (symbolic === 'function') {
- var /** @type {?} */ oldLen = functionParams.length;
- functionParams.push.apply(functionParams, (map['parameters'] || []));
- var /** @type {?} */ result = _super.prototype.visitStringMap.call(this, map, functionParams);
- functionParams.length = oldLen;
- return result;
- }
- else if (symbolic === 'reference') {
- var /** @type {?} */ module = map['module'];
- var /** @type {?} */ name_1 = map['name'] ? unescapeIdentifier(map['name']) : map['name'];
- if (!name_1) {
- return null;
- }
- var /** @type {?} */ filePath = void 0;
- if (module) {
- filePath = /** @type {?} */ ((self.resolveModule(module, sourceSymbol.filePath)));
- if (!filePath) {
- return {
- __symbolic: 'error',
- message: "Could not resolve " + module + " relative to " + sourceSymbol.filePath + ".",
- line: map["line"],
- character: map["character"],
- fileName: getOriginalName()
- };
- }
- return {
- __symbolic: 'resolved',
- symbol: self.getStaticSymbol(filePath, name_1),
- line: map["line"],
- character: map["character"],
- fileName: getOriginalName()
- };
- }
- else if (functionParams.indexOf(name_1) >= 0) {
- // reference to a function parameter
- return { __symbolic: 'reference', name: name_1 };
- }
- else {
- if (topLevelSymbolNames.has(name_1)) {
- return self.getStaticSymbol(topLevelPath, name_1);
- }
- // ambient value
- null;
- }
- }
- else if (symbolic === 'error') {
- return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, map, { fileName: getOriginalName() });
- }
- else {
- return _super.prototype.visitStringMap.call(this, map, functionParams);
- }
- };
- return ReferenceTransformer;
- }(ValueTransformer));
- var /** @type {?} */ transformedMeta = visitValue(metadata, new ReferenceTransformer(), []);
- var /** @type {?} */ unwrappedTransformedMeta = unwrapResolvedMetadata(transformedMeta);
- if (unwrappedTransformedMeta instanceof StaticSymbol) {
- return this.createExport(sourceSymbol, unwrappedTransformedMeta);
- }
- return new ResolvedStaticSymbol(sourceSymbol, transformedMeta);
- };
- /**
- * @param {?} sourceSymbol
- * @param {?} targetSymbol
- * @return {?}
- */
- StaticSymbolResolver.prototype.createExport = /**
- * @param {?} sourceSymbol
- * @param {?} targetSymbol
- * @return {?}
- */
- function (sourceSymbol, targetSymbol) {
- sourceSymbol.assertNoMembers();
- targetSymbol.assertNoMembers();
- if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) &&
- this.summaryResolver.isLibraryFile(targetSymbol.filePath)) {
- // This case is for an ng library importing symbols from a plain ts library
- // transitively.
- // Note: We rely on the fact that we discover symbols in the direction
- // from source files to library files
- this.importAs.set(targetSymbol, this.getImportAs(sourceSymbol) || sourceSymbol);
- }
- return new ResolvedStaticSymbol(sourceSymbol, targetSymbol);
- };
- /**
- * @param {?} error
- * @param {?=} context
- * @param {?=} path
- * @return {?}
- */
- StaticSymbolResolver.prototype.reportError = /**
- * @param {?} error
- * @param {?=} context
- * @param {?=} path
- * @return {?}
- */
- function (error, context, path) {
- if (this.errorRecorder) {
- this.errorRecorder(error, (context && context.filePath) || path);
- }
- else {
- throw error;
- }
- };
- /**
- * @param {?} module an absolute path to a module file.
- * @return {?}
- */
- StaticSymbolResolver.prototype.getModuleMetadata = /**
- * @param {?} module an absolute path to a module file.
- * @return {?}
- */
- function (module) {
- var /** @type {?} */ moduleMetadata = this.metadataCache.get(module);
- if (!moduleMetadata) {
- var /** @type {?} */ moduleMetadatas = this.host.getMetadataFor(module);
- if (moduleMetadatas) {
- var /** @type {?} */ maxVersion_1 = -1;
- moduleMetadatas.forEach(function (md) {
- if (md && md['version'] > maxVersion_1) {
- maxVersion_1 = md['version'];
- moduleMetadata = md;
- }
- });
- }
- if (!moduleMetadata) {
- moduleMetadata =
- { __symbolic: 'module', version: SUPPORTED_SCHEMA_VERSION, module: module, metadata: {} };
- }
- if (moduleMetadata['version'] != SUPPORTED_SCHEMA_VERSION) {
- var /** @type {?} */ errorMessage = moduleMetadata['version'] == 2 ?
- "Unsupported metadata version " + moduleMetadata['version'] + " for module " + module + ". This module should be compiled with a newer version of ngc" :
- "Metadata version mismatch for module " + module + ", found version " + moduleMetadata['version'] + ", expected " + SUPPORTED_SCHEMA_VERSION;
- this.reportError(new Error(errorMessage));
- }
- this.metadataCache.set(module, moduleMetadata);
- }
- return moduleMetadata;
- };
- /**
- * @param {?} module
- * @param {?} symbolName
- * @param {?=} containingFile
- * @return {?}
- */
- StaticSymbolResolver.prototype.getSymbolByModule = /**
- * @param {?} module
- * @param {?} symbolName
- * @param {?=} containingFile
- * @return {?}
- */
- function (module, symbolName, containingFile) {
- var /** @type {?} */ filePath = this.resolveModule(module, containingFile);
- if (!filePath) {
- this.reportError(new Error("Could not resolve module " + module + (containingFile ? ' relative to ' +
- containingFile : '')));
- return this.getStaticSymbol("ERROR:" + module, symbolName);
- }
- return this.getStaticSymbol(filePath, symbolName);
- };
- /**
- * @param {?} module
- * @param {?=} containingFile
- * @return {?}
- */
- StaticSymbolResolver.prototype.resolveModule = /**
- * @param {?} module
- * @param {?=} containingFile
- * @return {?}
- */
- function (module, containingFile) {
- try {
- return this.host.moduleNameToFileName(module, containingFile);
- }
- catch (/** @type {?} */ e) {
- console.error("Could not resolve module '" + module + "' relative to file " + containingFile);
- this.reportError(e, undefined, containingFile);
- }
- return null;
- };
- return StaticSymbolResolver;
- }());
- /**
- * @param {?} identifier
- * @return {?}
- */
- function unescapeIdentifier(identifier) {
- return identifier.startsWith('___') ? identifier.substr(1) : identifier;
- }
- /**
- * @param {?} metadata
- * @return {?}
- */
- function unwrapResolvedMetadata(metadata) {
- if (metadata && metadata.__symbolic === 'resolved') {
- return metadata.symbol;
- }
- return metadata;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @param {?} srcFileName
- * @param {?} forJitCtx
- * @param {?} summaryResolver
- * @param {?} symbolResolver
- * @param {?} symbols
- * @param {?} types
- * @return {?}
- */
- function serializeSummaries(srcFileName, forJitCtx, summaryResolver, symbolResolver, symbols, types) {
- var /** @type {?} */ toJsonSerializer = new ToJsonSerializer(symbolResolver, summaryResolver, srcFileName);
- // for symbols, we use everything except for the class metadata itself
- // (we keep the statics though), as the class metadata is contained in the
- // CompileTypeSummary.
- symbols.forEach(function (resolvedSymbol) {
- return toJsonSerializer.addSummary({ symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata });
- });
- // Add type summaries.
- types.forEach(function (_a) {
- var summary = _a.summary, metadata = _a.metadata;
- toJsonSerializer.addSummary({ symbol: summary.type.reference, metadata: undefined, type: summary });
- });
- var _a = toJsonSerializer.serialize(), json = _a.json, exportAs = _a.exportAs;
- if (forJitCtx) {
- var /** @type {?} */ forJitSerializer_1 = new ForJitSerializer(forJitCtx, symbolResolver, summaryResolver);
- types.forEach(function (_a) {
- var summary = _a.summary, metadata = _a.metadata;
- forJitSerializer_1.addSourceType(summary, metadata);
- });
- toJsonSerializer.unprocessedSymbolSummariesBySymbol.forEach(function (summary) {
- if (summaryResolver.isLibraryFile(summary.symbol.filePath) && summary.type) {
- forJitSerializer_1.addLibType(summary.type);
- }
- });
- forJitSerializer_1.serialize(exportAs);
- }
- return { json: json, exportAs: exportAs };
- }
- /**
- * @param {?} symbolCache
- * @param {?} summaryResolver
- * @param {?} libraryFileName
- * @param {?} json
- * @return {?}
- */
- function deserializeSummaries(symbolCache, summaryResolver, libraryFileName, json) {
- var /** @type {?} */ deserializer = new FromJsonDeserializer(symbolCache, summaryResolver);
- return deserializer.deserialize(libraryFileName, json);
- }
- /**
- * @param {?} outputCtx
- * @param {?} reference
- * @return {?}
- */
- function createForJitStub(outputCtx, reference) {
- return createSummaryForJitFunction(outputCtx, reference, NULL_EXPR);
- }
- /**
- * @param {?} outputCtx
- * @param {?} reference
- * @param {?} value
- * @return {?}
- */
- function createSummaryForJitFunction(outputCtx, reference, value) {
- var /** @type {?} */ fnName = summaryForJitName(reference.name);
- outputCtx.statements.push(fn([], [new ReturnStatement(value)], new ArrayType(DYNAMIC_TYPE)).toDeclStmt(fnName, [
- StmtModifier.Final, StmtModifier.Exported
- ]));
- }
- var ToJsonSerializer = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ToJsonSerializer, _super);
- function ToJsonSerializer(symbolResolver, summaryResolver, srcFileName) {
- var _this = _super.call(this) || this;
- _this.symbolResolver = symbolResolver;
- _this.summaryResolver = summaryResolver;
- _this.srcFileName = srcFileName;
- _this.symbols = [];
- _this.indexBySymbol = new Map();
- _this.reexportedBy = new Map();
- _this.processedSummaryBySymbol = new Map();
- _this.processedSummaries = [];
- _this.unprocessedSymbolSummariesBySymbol = new Map();
- _this.moduleName = symbolResolver.getKnownModuleName(srcFileName);
- return _this;
- }
- /**
- * @param {?} summary
- * @return {?}
- */
- ToJsonSerializer.prototype.addSummary = /**
- * @param {?} summary
- * @return {?}
- */
- function (summary) {
- var _this = this;
- var /** @type {?} */ unprocessedSummary = this.unprocessedSymbolSummariesBySymbol.get(summary.symbol);
- var /** @type {?} */ processedSummary = this.processedSummaryBySymbol.get(summary.symbol);
- if (!unprocessedSummary) {
- unprocessedSummary = { symbol: summary.symbol, metadata: undefined };
- this.unprocessedSymbolSummariesBySymbol.set(summary.symbol, unprocessedSummary);
- processedSummary = { symbol: this.processValue(summary.symbol, 0 /* None */) };
- this.processedSummaries.push(processedSummary);
- this.processedSummaryBySymbol.set(summary.symbol, processedSummary);
- }
- if (!unprocessedSummary.metadata && summary.metadata) {
- var /** @type {?} */ metadata_1 = summary.metadata || {};
- if (metadata_1.__symbolic === 'class') {
- // For classes, we keep everything except their class decorators.
- // We need to keep e.g. the ctor args, method names, method decorators
- // so that the class can be extended in another compilation unit.
- // We don't keep the class decorators as
- // 1) they refer to data
- // that should not cause a rebuild of downstream compilation units
- // (e.g. inline templates of @Component, or @NgModule.declarations)
- // 2) their data is already captured in TypeSummaries, e.g. DirectiveSummary.
- var /** @type {?} */ clone_1 = {};
- Object.keys(metadata_1).forEach(function (propName) {
- if (propName !== 'decorators') {
- clone_1[propName] = metadata_1[propName];
- }
- });
- metadata_1 = clone_1;
- }
- else if (isCall(metadata_1)) {
- if (!isFunctionCall(metadata_1) && !isMethodCallOnVariable(metadata_1)) {
- // Don't store complex calls as we won't be able to simplify them anyways later on.
- // Don't store complex calls as we won't be able to simplify them anyways later on.
- metadata_1 = {
- __symbolic: 'error',
- message: 'Complex function calls are not supported.',
- };
- }
- }
- // Note: We need to keep storing ctor calls for e.g.
- // `export const x = new InjectionToken(...)`
- unprocessedSummary.metadata = metadata_1;
- processedSummary.metadata = this.processValue(metadata_1, 1 /* ResolveValue */);
- if (metadata_1 instanceof StaticSymbol &&
- this.summaryResolver.isLibraryFile(metadata_1.filePath)) {
- var /** @type {?} */ declarationSymbol = this.symbols[/** @type {?} */ ((this.indexBySymbol.get(metadata_1)))];
- if (!isLoweredSymbol(declarationSymbol.name)) {
- // Note: symbols that were introduced during codegen in the user file can have a reexport
- // if a user used `export *`. However, we can't rely on this as tsickle will change
- // `export *` into named exports, using only the information from the typechecker.
- // As we introduce the new symbols after typecheck, Tsickle does not know about them,
- // and omits them when expanding `export *`.
- // So we have to keep reexporting these symbols manually via .ngfactory files.
- this.reexportedBy.set(declarationSymbol, summary.symbol);
- }
- }
- }
- if (!unprocessedSummary.type && summary.type) {
- unprocessedSummary.type = summary.type;
- // Note: We don't add the summaries of all referenced symbols as for the ResolvedSymbols,
- // as the type summaries already contain the transitive data that they require
- // (in a minimal way).
- processedSummary.type = this.processValue(summary.type, 0 /* None */);
- // except for reexported directives / pipes, so we need to store
- // their summaries explicitly.
- if (summary.type.summaryKind === CompileSummaryKind.NgModule) {
- var /** @type {?} */ ngModuleSummary = /** @type {?} */ (summary.type);
- ngModuleSummary.exportedDirectives.concat(ngModuleSummary.exportedPipes).forEach(function (id) {
- var /** @type {?} */ symbol = id.reference;
- if (_this.summaryResolver.isLibraryFile(symbol.filePath) &&
- !_this.unprocessedSymbolSummariesBySymbol.has(symbol)) {
- var /** @type {?} */ summary_1 = _this.summaryResolver.resolveSummary(symbol);
- if (summary_1) {
- _this.addSummary(summary_1);
- }
- }
- });
- }
- }
- };
- /**
- * @return {?}
- */
- ToJsonSerializer.prototype.serialize = /**
- * @return {?}
- */
- function () {
- var _this = this;
- var /** @type {?} */ exportAs = [];
- var /** @type {?} */ json = JSON.stringify({
- moduleName: this.moduleName,
- summaries: this.processedSummaries,
- symbols: this.symbols.map(function (symbol, index) {
- symbol.assertNoMembers();
- var /** @type {?} */ importAs = /** @type {?} */ ((undefined));
- if (_this.summaryResolver.isLibraryFile(symbol.filePath)) {
- var /** @type {?} */ reexportSymbol = _this.reexportedBy.get(symbol);
- if (reexportSymbol) {
- importAs = /** @type {?} */ ((_this.indexBySymbol.get(reexportSymbol)));
- }
- else {
- var /** @type {?} */ summary = _this.unprocessedSymbolSummariesBySymbol.get(symbol);
- if (!summary || !summary.metadata || summary.metadata.__symbolic !== 'interface') {
- importAs = symbol.name + "_" + index;
- exportAs.push({ symbol: symbol, exportAs: importAs });
- }
- }
- }
- return {
- __symbol: index,
- name: symbol.name,
- filePath: _this.summaryResolver.toSummaryFileName(symbol.filePath, _this.srcFileName),
- importAs: importAs
- };
- })
- });
- return { json: json, exportAs: exportAs };
- };
- /**
- * @param {?} value
- * @param {?} flags
- * @return {?}
- */
- ToJsonSerializer.prototype.processValue = /**
- * @param {?} value
- * @param {?} flags
- * @return {?}
- */
- function (value, flags) {
- return visitValue(value, this, flags);
- };
- /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- ToJsonSerializer.prototype.visitOther = /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- function (value, context) {
- if (value instanceof StaticSymbol) {
- var /** @type {?} */ baseSymbol = this.symbolResolver.getStaticSymbol(value.filePath, value.name);
- var /** @type {?} */ index = this.visitStaticSymbol(baseSymbol, context);
- return { __symbol: index, members: value.members };
- }
- };
- /**
- * Returns null if the options.resolveValue is true, and the summary for the symbol
- * resolved to a type or could not be resolved.
- * @param {?} baseSymbol
- * @param {?} flags
- * @return {?}
- */
- ToJsonSerializer.prototype.visitStaticSymbol = /**
- * Returns null if the options.resolveValue is true, and the summary for the symbol
- * resolved to a type or could not be resolved.
- * @param {?} baseSymbol
- * @param {?} flags
- * @return {?}
- */
- function (baseSymbol, flags) {
- var /** @type {?} */ index = this.indexBySymbol.get(baseSymbol);
- var /** @type {?} */ summary = null;
- if (flags & 1 /* ResolveValue */ &&
- this.summaryResolver.isLibraryFile(baseSymbol.filePath)) {
- if (this.unprocessedSymbolSummariesBySymbol.has(baseSymbol)) {
- // the summary for this symbol was already added
- // -> nothing to do.
- return /** @type {?} */ ((index));
- }
- summary = this.loadSummary(baseSymbol);
- if (summary && summary.metadata instanceof StaticSymbol) {
- // The summary is a reexport
- index = this.visitStaticSymbol(summary.metadata, flags);
- // reset the summary as it is just a reexport, so we don't want to store it.
- summary = null;
- }
- }
- else if (index != null) {
- // Note: == on purpose to compare with undefined!
- // No summary and the symbol is already added -> nothing to do.
- return index;
- }
- // Note: == on purpose to compare with undefined!
- if (index == null) {
- index = this.symbols.length;
- this.symbols.push(baseSymbol);
- }
- this.indexBySymbol.set(baseSymbol, index);
- if (summary) {
- this.addSummary(summary);
- }
- return index;
- };
- /**
- * @param {?} symbol
- * @return {?}
- */
- ToJsonSerializer.prototype.loadSummary = /**
- * @param {?} symbol
- * @return {?}
- */
- function (symbol) {
- var /** @type {?} */ summary = this.summaryResolver.resolveSummary(symbol);
- if (!summary) {
- // some symbols might originate from a plain typescript library
- // that just exported .d.ts and .metadata.json files, i.e. where no summary
- // files were created.
- var /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(symbol);
- if (resolvedSymbol) {
- summary = { symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata };
- }
- }
- return summary;
- };
- return ToJsonSerializer;
- }(ValueTransformer));
- var ForJitSerializer = /** @class */ (function () {
- function ForJitSerializer(outputCtx, symbolResolver, summaryResolver) {
- this.outputCtx = outputCtx;
- this.symbolResolver = symbolResolver;
- this.summaryResolver = summaryResolver;
- this.data = [];
- }
- /**
- * @param {?} summary
- * @param {?} metadata
- * @return {?}
- */
- ForJitSerializer.prototype.addSourceType = /**
- * @param {?} summary
- * @param {?} metadata
- * @return {?}
- */
- function (summary, metadata) {
- this.data.push({ summary: summary, metadata: metadata, isLibrary: false });
- };
- /**
- * @param {?} summary
- * @return {?}
- */
- ForJitSerializer.prototype.addLibType = /**
- * @param {?} summary
- * @return {?}
- */
- function (summary) {
- this.data.push({ summary: summary, metadata: null, isLibrary: true });
- };
- /**
- * @param {?} exportAsArr
- * @return {?}
- */
- ForJitSerializer.prototype.serialize = /**
- * @param {?} exportAsArr
- * @return {?}
- */
- function (exportAsArr) {
- var _this = this;
- var /** @type {?} */ exportAsBySymbol = new Map();
- for (var _i = 0, exportAsArr_1 = exportAsArr; _i < exportAsArr_1.length; _i++) {
- var _a = exportAsArr_1[_i], symbol = _a.symbol, exportAs = _a.exportAs;
- exportAsBySymbol.set(symbol, exportAs);
- }
- var /** @type {?} */ ngModuleSymbols = new Set();
- for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
- var _d = _c[_b], summary = _d.summary, metadata = _d.metadata, isLibrary = _d.isLibrary;
- if (summary.summaryKind === CompileSummaryKind.NgModule) {
- // collect the symbols that refer to NgModule classes.
- // Note: we can't just rely on `summary.type.summaryKind` to determine this as
- // we don't add the summaries of all referenced symbols when we serialize type summaries.
- // See serializeSummaries for details.
- ngModuleSymbols.add(summary.type.reference);
- var /** @type {?} */ modSummary = /** @type {?} */ (summary);
- for (var _e = 0, _f = modSummary.modules; _e < _f.length; _e++) {
- var mod = _f[_e];
- ngModuleSymbols.add(mod.reference);
- }
- }
- if (!isLibrary) {
- var /** @type {?} */ fnName = summaryForJitName(summary.type.reference.name);
- createSummaryForJitFunction(this.outputCtx, summary.type.reference, this.serializeSummaryWithDeps(summary, /** @type {?} */ ((metadata))));
- }
- }
- ngModuleSymbols.forEach(function (ngModuleSymbol) {
- if (_this.summaryResolver.isLibraryFile(ngModuleSymbol.filePath)) {
- var /** @type {?} */ exportAs = exportAsBySymbol.get(ngModuleSymbol) || ngModuleSymbol.name;
- var /** @type {?} */ jitExportAsName = summaryForJitName(exportAs);
- _this.outputCtx.statements.push(variable(jitExportAsName)
- .set(_this.serializeSummaryRef(ngModuleSymbol))
- .toDeclStmt(null, [StmtModifier.Exported]));
- }
- });
- };
- /**
- * @param {?} summary
- * @param {?} metadata
- * @return {?}
- */
- ForJitSerializer.prototype.serializeSummaryWithDeps = /**
- * @param {?} summary
- * @param {?} metadata
- * @return {?}
- */
- function (summary, metadata) {
- var _this = this;
- var /** @type {?} */ expressions = [this.serializeSummary(summary)];
- var /** @type {?} */ providers = [];
- if (metadata instanceof CompileNgModuleMetadata) {
- expressions.push.apply(expressions,
- // For directives / pipes, we only add the declared ones,
- // and rely on transitively importing NgModules to get the transitive
- // summaries.
- metadata.declaredDirectives.concat(metadata.declaredPipes)
- .map(function (type) { return type.reference; })
- .concat(metadata.transitiveModule.modules.map(function (type) { return type.reference; })
- .filter(function (ref) { return ref !== metadata.type.reference; }))
- .map(function (ref) { return _this.serializeSummaryRef(ref); }));
- // Note: We don't use `NgModuleSummary.providers`, as that one is transitive,
- // and we already have transitive modules.
- providers = metadata.providers;
- }
- else if (summary.summaryKind === CompileSummaryKind.Directive) {
- var /** @type {?} */ dirSummary = /** @type {?} */ (summary);
- providers = dirSummary.providers.concat(dirSummary.viewProviders);
- }
- // Note: We can't just refer to the `ngsummary.ts` files for `useClass` providers (as we do for
- // declaredDirectives / declaredPipes), as we allow
- // providers without ctor arguments to skip the `@Injectable` decorator,
- // i.e. we didn't generate .ngsummary.ts files for these.
- expressions.push.apply(expressions, providers.filter(function (provider) { return !!provider.useClass; }).map(function (provider) {
- return _this.serializeSummary(/** @type {?} */ ({
- summaryKind: CompileSummaryKind.Injectable, type: provider.useClass
- }));
- }));
- return literalArr(expressions);
- };
- /**
- * @param {?} typeSymbol
- * @return {?}
- */
- ForJitSerializer.prototype.serializeSummaryRef = /**
- * @param {?} typeSymbol
- * @return {?}
- */
- function (typeSymbol) {
- var /** @type {?} */ jitImportedSymbol = this.symbolResolver.getStaticSymbol(summaryForJitFileName(typeSymbol.filePath), summaryForJitName(typeSymbol.name));
- return this.outputCtx.importExpr(jitImportedSymbol);
- };
- /**
- * @param {?} data
- * @return {?}
- */
- ForJitSerializer.prototype.serializeSummary = /**
- * @param {?} data
- * @return {?}
- */
- function (data) {
- var /** @type {?} */ outputCtx = this.outputCtx;
- var Transformer = /** @class */ (function () {
- function Transformer() {
- }
- /**
- * @param {?} arr
- * @param {?} context
- * @return {?}
- */
- Transformer.prototype.visitArray = /**
- * @param {?} arr
- * @param {?} context
- * @return {?}
- */
- function (arr, context) {
- var _this = this;
- return literalArr(arr.map(function (entry) { return visitValue(entry, _this, context); }));
- };
- /**
- * @param {?} map
- * @param {?} context
- * @return {?}
- */
- Transformer.prototype.visitStringMap = /**
- * @param {?} map
- * @param {?} context
- * @return {?}
- */
- function (map, context) {
- var _this = this;
- return new LiteralMapExpr(Object.keys(map).map(function (key) { return new LiteralMapEntry(key, visitValue(map[key], _this, context), false); }));
- };
- /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- Transformer.prototype.visitPrimitive = /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- function (value, context) { return literal(value); };
- /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- Transformer.prototype.visitOther = /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- function (value, context) {
- if (value instanceof StaticSymbol) {
- return outputCtx.importExpr(value);
- }
- else {
- throw new Error("Illegal State: Encountered value " + value);
- }
- };
- return Transformer;
- }());
- return visitValue(data, new Transformer(), null);
- };
- return ForJitSerializer;
- }());
- var FromJsonDeserializer = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FromJsonDeserializer, _super);
- function FromJsonDeserializer(symbolCache, summaryResolver) {
- var _this = _super.call(this) || this;
- _this.symbolCache = symbolCache;
- _this.summaryResolver = summaryResolver;
- return _this;
- }
- /**
- * @param {?} libraryFileName
- * @param {?} json
- * @return {?}
- */
- FromJsonDeserializer.prototype.deserialize = /**
- * @param {?} libraryFileName
- * @param {?} json
- * @return {?}
- */
- function (libraryFileName, json) {
- var _this = this;
- var /** @type {?} */ data = JSON.parse(json);
- var /** @type {?} */ allImportAs = [];
- this.symbols = data.symbols.map(function (serializedSymbol) {
- return _this.symbolCache.get(_this.summaryResolver.fromSummaryFileName(serializedSymbol.filePath, libraryFileName), serializedSymbol.name);
- });
- data.symbols.forEach(function (serializedSymbol, index) {
- var /** @type {?} */ symbol = _this.symbols[index];
- var /** @type {?} */ importAs = serializedSymbol.importAs;
- if (typeof importAs === 'number') {
- allImportAs.push({ symbol: symbol, importAs: _this.symbols[importAs] });
- }
- else if (typeof importAs === 'string') {
- allImportAs.push({ symbol: symbol, importAs: _this.symbolCache.get(ngfactoryFilePath(libraryFileName), importAs) });
- }
- });
- var /** @type {?} */ summaries = /** @type {?} */ (visitValue(data.summaries, this, null));
- return { moduleName: data.moduleName, summaries: summaries, importAs: allImportAs };
- };
- /**
- * @param {?} map
- * @param {?} context
- * @return {?}
- */
- FromJsonDeserializer.prototype.visitStringMap = /**
- * @param {?} map
- * @param {?} context
- * @return {?}
- */
- function (map, context) {
- if ('__symbol' in map) {
- var /** @type {?} */ baseSymbol = this.symbols[map['__symbol']];
- var /** @type {?} */ members = map['members'];
- return members.length ? this.symbolCache.get(baseSymbol.filePath, baseSymbol.name, members) :
- baseSymbol;
- }
- else {
- return _super.prototype.visitStringMap.call(this, map, context);
- }
- };
- return FromJsonDeserializer;
- }(ValueTransformer));
- /**
- * @param {?} metadata
- * @return {?}
- */
- function isCall(metadata) {
- return metadata && metadata.__symbolic === 'call';
- }
- /**
- * @param {?} metadata
- * @return {?}
- */
- function isFunctionCall(metadata) {
- return isCall(metadata) && unwrapResolvedMetadata(metadata.expression) instanceof StaticSymbol;
- }
- /**
- * @param {?} metadata
- * @return {?}
- */
- function isMethodCallOnVariable(metadata) {
- return isCall(metadata) && metadata.expression && metadata.expression.__symbolic === 'select' &&
- unwrapResolvedMetadata(metadata.expression.expression) instanceof StaticSymbol;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var StubEmitFlags = {
- Basic: 1,
- TypeCheck: 2,
- All: 3,
- };
- StubEmitFlags[StubEmitFlags.Basic] = "Basic";
- StubEmitFlags[StubEmitFlags.TypeCheck] = "TypeCheck";
- StubEmitFlags[StubEmitFlags.All] = "All";
- var AotCompiler = /** @class */ (function () {
- function AotCompiler(_config, _options, _host, _reflector, _metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _typeCheckCompiler, _ngModuleCompiler, _outputEmitter, _summaryResolver, _symbolResolver) {
- this._config = _config;
- this._options = _options;
- this._host = _host;
- this._reflector = _reflector;
- this._metadataResolver = _metadataResolver;
- this._templateParser = _templateParser;
- this._styleCompiler = _styleCompiler;
- this._viewCompiler = _viewCompiler;
- this._typeCheckCompiler = _typeCheckCompiler;
- this._ngModuleCompiler = _ngModuleCompiler;
- this._outputEmitter = _outputEmitter;
- this._summaryResolver = _summaryResolver;
- this._symbolResolver = _symbolResolver;
- this._templateAstCache = new Map();
- this._analyzedFiles = new Map();
- }
- /**
- * @return {?}
- */
- AotCompiler.prototype.clearCache = /**
- * @return {?}
- */
- function () { this._metadataResolver.clearCache(); };
- /**
- * @param {?} rootFiles
- * @return {?}
- */
- AotCompiler.prototype.analyzeModulesSync = /**
- * @param {?} rootFiles
- * @return {?}
- */
- function (rootFiles) {
- var _this = this;
- var /** @type {?} */ analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
- analyzeResult.ngModules.forEach(function (ngModule) {
- return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true);
- });
- return analyzeResult;
- };
- /**
- * @param {?} rootFiles
- * @return {?}
- */
- AotCompiler.prototype.analyzeModulesAsync = /**
- * @param {?} rootFiles
- * @return {?}
- */
- function (rootFiles) {
- var _this = this;
- var /** @type {?} */ analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
- return Promise
- .all(analyzeResult.ngModules.map(function (ngModule) {
- return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false);
- }))
- .then(function () { return analyzeResult; });
- };
- /**
- * @param {?} fileName
- * @return {?}
- */
- AotCompiler.prototype._analyzeFile = /**
- * @param {?} fileName
- * @return {?}
- */
- function (fileName) {
- var /** @type {?} */ analyzedFile = this._analyzedFiles.get(fileName);
- if (!analyzedFile) {
- analyzedFile =
- analyzeFile(this._host, this._symbolResolver, this._metadataResolver, fileName);
- this._analyzedFiles.set(fileName, analyzedFile);
- }
- return analyzedFile;
- };
- /**
- * @param {?} fileName
- * @return {?}
- */
- AotCompiler.prototype.findGeneratedFileNames = /**
- * @param {?} fileName
- * @return {?}
- */
- function (fileName) {
- var _this = this;
- var /** @type {?} */ genFileNames = [];
- var /** @type {?} */ file = this._analyzeFile(fileName);
- // Make sure we create a .ngfactory if we have a injectable/directive/pipe/NgModule
- // or a reference to a non source file.
- // Note: This is overestimating the required .ngfactory files as the real calculation is harder.
- // Only do this for StubEmitFlags.Basic, as adding a type check block
- // does not change this file (as we generate type check blocks based on NgModules).
- if (this._options.allowEmptyCodegenFiles || file.directives.length || file.pipes.length ||
- file.injectables.length || file.ngModules.length || file.exportsNonSourceFiles) {
- genFileNames.push(ngfactoryFilePath(file.fileName, true));
- if (this._options.enableSummariesForJit) {
- genFileNames.push(summaryForJitFileName(file.fileName, true));
- }
- }
- var /** @type {?} */ fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(file.fileName, true)[1]);
- file.directives.forEach(function (dirSymbol) {
- var /** @type {?} */ compMeta = /** @type {?} */ ((_this._metadataResolver.getNonNormalizedDirectiveMetadata(dirSymbol))).metadata;
- if (!compMeta.isComponent) {
- return;
- } /** @type {?} */
- ((
- // Note: compMeta is a component and therefore template is non null.
- compMeta.template)).styleUrls.forEach(function (styleUrl) {
- var /** @type {?} */ normalizedUrl = _this._host.resourceNameToFileName(styleUrl, file.fileName);
- if (!normalizedUrl) {
- throw syntaxError("Couldn't resolve resource " + styleUrl + " relative to " + file.fileName);
- }
- var /** @type {?} */ needsShim = (/** @type {?} */ ((compMeta.template)).encapsulation || _this._config.defaultEncapsulation) === ViewEncapsulation.Emulated;
- genFileNames.push(_stylesModuleUrl(normalizedUrl, needsShim, fileSuffix));
- if (_this._options.allowEmptyCodegenFiles) {
- genFileNames.push(_stylesModuleUrl(normalizedUrl, !needsShim, fileSuffix));
- }
- });
- });
- return genFileNames;
- };
- /**
- * @param {?} genFileName
- * @param {?=} originalFileName
- * @return {?}
- */
- AotCompiler.prototype.emitBasicStub = /**
- * @param {?} genFileName
- * @param {?=} originalFileName
- * @return {?}
- */
- function (genFileName, originalFileName) {
- var /** @type {?} */ outputCtx = this._createOutputContext(genFileName);
- if (genFileName.endsWith('.ngfactory.ts')) {
- if (!originalFileName) {
- throw new Error("Assertion error: require the original file for .ngfactory.ts stubs. File: " + genFileName);
- }
- var /** @type {?} */ originalFile = this._analyzeFile(originalFileName);
- this._createNgFactoryStub(outputCtx, originalFile, StubEmitFlags.Basic);
- }
- else if (genFileName.endsWith('.ngsummary.ts')) {
- if (this._options.enableSummariesForJit) {
- if (!originalFileName) {
- throw new Error("Assertion error: require the original file for .ngsummary.ts stubs. File: " + genFileName);
- }
- var /** @type {?} */ originalFile = this._analyzeFile(originalFileName);
- _createEmptyStub(outputCtx);
- originalFile.ngModules.forEach(function (ngModule) {
- // create exports that user code can reference
- createForJitStub(outputCtx, ngModule.type.reference);
- });
- }
- }
- else if (genFileName.endsWith('.ngstyle.ts')) {
- _createEmptyStub(outputCtx);
- }
- // Note: for the stubs, we don't need a property srcFileUrl,
- // as lateron in emitAllImpls we will create the proper GeneratedFiles with the
- // correct srcFileUrl.
- // This is good as e.g. for .ngstyle.ts files we can't derive
- // the url of components based on the genFileUrl.
- return this._codegenSourceModule('unknown', outputCtx);
- };
- /**
- * @param {?} genFileName
- * @param {?} originalFileName
- * @return {?}
- */
- AotCompiler.prototype.emitTypeCheckStub = /**
- * @param {?} genFileName
- * @param {?} originalFileName
- * @return {?}
- */
- function (genFileName, originalFileName) {
- var /** @type {?} */ originalFile = this._analyzeFile(originalFileName);
- var /** @type {?} */ outputCtx = this._createOutputContext(genFileName);
- if (genFileName.endsWith('.ngfactory.ts')) {
- this._createNgFactoryStub(outputCtx, originalFile, StubEmitFlags.TypeCheck);
- }
- return outputCtx.statements.length > 0 ?
- this._codegenSourceModule(originalFile.fileName, outputCtx) :
- null;
- };
- /**
- * @param {?} fileNames
- * @return {?}
- */
- AotCompiler.prototype.loadFilesAsync = /**
- * @param {?} fileNames
- * @return {?}
- */
- function (fileNames) {
- var _this = this;
- var /** @type {?} */ files = fileNames.map(function (fileName) { return _this._analyzeFile(fileName); });
- var /** @type {?} */ loadingPromises = [];
- files.forEach(function (file) {
- return file.ngModules.forEach(function (ngModule) {
- return loadingPromises.push(_this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false));
- });
- });
- return Promise.all(loadingPromises).then(function (_) { return mergeAndValidateNgFiles(files); });
- };
- /**
- * @param {?} fileNames
- * @return {?}
- */
- AotCompiler.prototype.loadFilesSync = /**
- * @param {?} fileNames
- * @return {?}
- */
- function (fileNames) {
- var _this = this;
- var /** @type {?} */ files = fileNames.map(function (fileName) { return _this._analyzeFile(fileName); });
- files.forEach(function (file) {
- return file.ngModules.forEach(function (ngModule) {
- return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true);
- });
- });
- return mergeAndValidateNgFiles(files);
- };
- /**
- * @param {?} outputCtx
- * @param {?} file
- * @param {?} emitFlags
- * @return {?}
- */
- AotCompiler.prototype._createNgFactoryStub = /**
- * @param {?} outputCtx
- * @param {?} file
- * @param {?} emitFlags
- * @return {?}
- */
- function (outputCtx, file, emitFlags) {
- var _this = this;
- var /** @type {?} */ componentId = 0;
- file.ngModules.forEach(function (ngModuleMeta, ngModuleIndex) {
- // Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
- // so we don't change the .ngfactory file too much when adding the typecheck block.
- // create exports that user code can reference
- // Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
- // so we don't change the .ngfactory file too much when adding the typecheck block.
- // create exports that user code can reference
- _this._ngModuleCompiler.createStub(outputCtx, ngModuleMeta.type.reference);
- // add references to the symbols from the metadata.
- // These can be used by the type check block for components,
- // and they also cause TypeScript to include these files into the program too,
- // which will make them part of the analyzedFiles.
- 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]));
- var /** @type {?} */ externalReferenceVars = new Map();
- externalReferences.forEach(function (ref, typeIndex) {
- externalReferenceVars.set(ref, "_decl" + ngModuleIndex + "_" + typeIndex);
- });
- externalReferenceVars.forEach(function (varName, reference) {
- outputCtx.statements.push(variable(varName)
- .set(NULL_EXPR.cast(DYNAMIC_TYPE))
- .toDeclStmt(expressionType(outputCtx.importExpr(reference, /* typeParams */ null, /* useSummaries */ /* useSummaries */ false))));
- });
- if (emitFlags & StubEmitFlags.TypeCheck) {
- // add the typecheck block for all components of the NgModule
- ngModuleMeta.declaredDirectives.forEach(function (dirId) {
- var /** @type {?} */ compMeta = _this._metadataResolver.getDirectiveMetadata(dirId.reference);
- if (!compMeta.isComponent) {
- return;
- }
- componentId++;
- _this._createTypeCheckBlock(outputCtx, compMeta.type.reference.name + "_Host_" + componentId, ngModuleMeta, _this._metadataResolver.getHostComponentMetadata(compMeta), [compMeta.type], externalReferenceVars);
- _this._createTypeCheckBlock(outputCtx, compMeta.type.reference.name + "_" + componentId, ngModuleMeta, compMeta, ngModuleMeta.transitiveModule.directives, externalReferenceVars);
- });
- }
- });
- if (outputCtx.statements.length === 0) {
- _createEmptyStub(outputCtx);
- }
- };
- /**
- * @param {?} references
- * @return {?}
- */
- AotCompiler.prototype._externalIdentifierReferences = /**
- * @param {?} references
- * @return {?}
- */
- function (references) {
- var /** @type {?} */ result = [];
- for (var _i = 0, references_1 = references; _i < references_1.length; _i++) {
- var reference = references_1[_i];
- var /** @type {?} */ token = createTokenForExternalReference(this._reflector, reference);
- if (token.identifier) {
- result.push(token.identifier.reference);
- }
- }
- return result;
- };
- /**
- * @param {?} ctx
- * @param {?} componentId
- * @param {?} moduleMeta
- * @param {?} compMeta
- * @param {?} directives
- * @param {?} externalReferenceVars
- * @return {?}
- */
- AotCompiler.prototype._createTypeCheckBlock = /**
- * @param {?} ctx
- * @param {?} componentId
- * @param {?} moduleMeta
- * @param {?} compMeta
- * @param {?} directives
- * @param {?} externalReferenceVars
- * @return {?}
- */
- function (ctx, componentId, moduleMeta, compMeta, directives, externalReferenceVars) {
- var _a = this._parseTemplate(compMeta, moduleMeta, directives), parsedTemplate = _a.template, usedPipes = _a.pipes;
- (_b = ctx.statements).push.apply(_b, this._typeCheckCompiler.compileComponent(componentId, compMeta, parsedTemplate, usedPipes, externalReferenceVars, ctx));
- var _b;
- };
- /**
- * @param {?} analyzeResult
- * @param {?} locale
- * @return {?}
- */
- AotCompiler.prototype.emitMessageBundle = /**
- * @param {?} analyzeResult
- * @param {?} locale
- * @return {?}
- */
- function (analyzeResult, locale) {
- var _this = this;
- var /** @type {?} */ errors = [];
- var /** @type {?} */ htmlParser = new HtmlParser();
- // TODO(vicb): implicit tags & attributes
- var /** @type {?} */ messageBundle = new MessageBundle(htmlParser, [], {}, locale);
- analyzeResult.files.forEach(function (file) {
- var /** @type {?} */ compMetas = [];
- file.directives.forEach(function (directiveType) {
- var /** @type {?} */ dirMeta = _this._metadataResolver.getDirectiveMetadata(directiveType);
- if (dirMeta && dirMeta.isComponent) {
- compMetas.push(dirMeta);
- }
- });
- compMetas.forEach(function (compMeta) {
- var /** @type {?} */ html = /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).template));
- var /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((compMeta.template)).interpolation);
- errors.push.apply(errors, /** @type {?} */ ((messageBundle.updateFromTemplate(html, file.fileName, interpolationConfig))));
- });
- });
- if (errors.length) {
- throw new Error(errors.map(function (e) { return e.toString(); }).join('\n'));
- }
- return messageBundle;
- };
- /**
- * @param {?} analyzeResult
- * @return {?}
- */
- AotCompiler.prototype.emitAllImpls = /**
- * @param {?} analyzeResult
- * @return {?}
- */
- function (analyzeResult) {
- var _this = this;
- var ngModuleByPipeOrDirective = analyzeResult.ngModuleByPipeOrDirective, files = analyzeResult.files;
- var /** @type {?} */ sourceModules = files.map(function (file) {
- return _this._compileImplFile(file.fileName, ngModuleByPipeOrDirective, file.directives, file.pipes, file.ngModules, file.injectables);
- });
- return flatten(sourceModules);
- };
- /**
- * @param {?} srcFileUrl
- * @param {?} ngModuleByPipeOrDirective
- * @param {?} directives
- * @param {?} pipes
- * @param {?} ngModules
- * @param {?} injectables
- * @return {?}
- */
- AotCompiler.prototype._compileImplFile = /**
- * @param {?} srcFileUrl
- * @param {?} ngModuleByPipeOrDirective
- * @param {?} directives
- * @param {?} pipes
- * @param {?} ngModules
- * @param {?} injectables
- * @return {?}
- */
- function (srcFileUrl, ngModuleByPipeOrDirective, directives, pipes, ngModules, injectables) {
- var _this = this;
- var /** @type {?} */ fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(srcFileUrl, true)[1]);
- var /** @type {?} */ generatedFiles = [];
- var /** @type {?} */ outputCtx = this._createOutputContext(ngfactoryFilePath(srcFileUrl, true));
- generatedFiles.push.apply(generatedFiles, this._createSummary(srcFileUrl, directives, pipes, ngModules, injectables, outputCtx));
- // compile all ng modules
- ngModules.forEach(function (ngModuleMeta) { return _this._compileModule(outputCtx, ngModuleMeta); });
- // compile components
- directives.forEach(function (dirType) {
- var /** @type {?} */ compMeta = _this._metadataResolver.getDirectiveMetadata(/** @type {?} */ (dirType));
- if (!compMeta.isComponent) {
- return;
- }
- var /** @type {?} */ ngModule = ngModuleByPipeOrDirective.get(dirType);
- if (!ngModule) {
- throw new Error("Internal Error: cannot determine the module for component " + identifierName(compMeta.type) + "!");
- }
- // compile styles
- var /** @type {?} */ componentStylesheet = _this._styleCompiler.compileComponent(outputCtx, compMeta); /** @type {?} */
- ((
- // Note: compMeta is a component and therefore template is non null.
- compMeta.template)).externalStylesheets.forEach(function (stylesheetMeta) {
- // Note: fill non shim and shim style files as they might
- // be shared by component with and without ViewEncapsulation.
- var /** @type {?} */ shim = _this._styleCompiler.needsStyleShim(compMeta);
- generatedFiles.push(_this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, shim, fileSuffix));
- if (_this._options.allowEmptyCodegenFiles) {
- generatedFiles.push(_this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, !shim, fileSuffix));
- }
- });
- // compile components
- var /** @type {?} */ compViewVars = _this._compileComponent(outputCtx, compMeta, ngModule, ngModule.transitiveModule.directives, componentStylesheet, fileSuffix);
- _this._compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix);
- });
- if (outputCtx.statements.length > 0 || this._options.allowEmptyCodegenFiles) {
- var /** @type {?} */ srcModule = this._codegenSourceModule(srcFileUrl, outputCtx);
- generatedFiles.unshift(srcModule);
- }
- return generatedFiles;
- };
- /**
- * @param {?} srcFileName
- * @param {?} directives
- * @param {?} pipes
- * @param {?} ngModules
- * @param {?} injectables
- * @param {?} ngFactoryCtx
- * @return {?}
- */
- AotCompiler.prototype._createSummary = /**
- * @param {?} srcFileName
- * @param {?} directives
- * @param {?} pipes
- * @param {?} ngModules
- * @param {?} injectables
- * @param {?} ngFactoryCtx
- * @return {?}
- */
- function (srcFileName, directives, pipes, ngModules, injectables, ngFactoryCtx) {
- var _this = this;
- var /** @type {?} */ symbolSummaries = this._symbolResolver.getSymbolsOf(srcFileName)
- .map(function (symbol) { return _this._symbolResolver.resolveSymbol(symbol); });
- var /** @type {?} */ typeData = ngModules.map(function (meta) {
- return ({
- summary: /** @type {?} */ ((_this._metadataResolver.getNgModuleSummary(meta.type.reference))),
- metadata: /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(meta.type.reference)))
- });
- }).concat(directives.map(function (ref) {
- return ({
- summary: /** @type {?} */ ((_this._metadataResolver.getDirectiveSummary(ref))),
- metadata: /** @type {?} */ ((_this._metadataResolver.getDirectiveMetadata(ref)))
- });
- }), pipes.map(function (ref) {
- return ({
- summary: /** @type {?} */ ((_this._metadataResolver.getPipeSummary(ref))),
- metadata: /** @type {?} */ ((_this._metadataResolver.getPipeMetadata(ref)))
- });
- }), injectables.map(function (ref) {
- return ({
- summary: /** @type {?} */ ((_this._metadataResolver.getInjectableSummary(ref))),
- metadata: /** @type {?} */ ((_this._metadataResolver.getInjectableSummary(ref))).type
- });
- }));
- var /** @type {?} */ forJitOutputCtx = this._options.enableSummariesForJit ?
- this._createOutputContext(summaryForJitFileName(srcFileName, true)) :
- null;
- var _a = serializeSummaries(srcFileName, forJitOutputCtx, this._summaryResolver, this._symbolResolver, symbolSummaries, typeData), json = _a.json, exportAs = _a.exportAs;
- exportAs.forEach(function (entry) {
- ngFactoryCtx.statements.push(variable(entry.exportAs).set(ngFactoryCtx.importExpr(entry.symbol)).toDeclStmt(null, [
- StmtModifier.Exported
- ]));
- });
- var /** @type {?} */ summaryJson = new GeneratedFile(srcFileName, summaryFileName(srcFileName), json);
- var /** @type {?} */ result = [summaryJson];
- if (forJitOutputCtx) {
- result.push(this._codegenSourceModule(srcFileName, forJitOutputCtx));
- }
- return result;
- };
- /**
- * @param {?} outputCtx
- * @param {?} ngModule
- * @return {?}
- */
- AotCompiler.prototype._compileModule = /**
- * @param {?} outputCtx
- * @param {?} ngModule
- * @return {?}
- */
- function (outputCtx, ngModule) {
- var /** @type {?} */ providers = [];
- if (this._options.locale) {
- var /** @type {?} */ normalizedLocale = this._options.locale.replace(/_/g, '-');
- providers.push({
- token: createTokenForExternalReference(this._reflector, Identifiers.LOCALE_ID),
- useValue: normalizedLocale,
- });
- }
- if (this._options.i18nFormat) {
- providers.push({
- token: createTokenForExternalReference(this._reflector, Identifiers.TRANSLATIONS_FORMAT),
- useValue: this._options.i18nFormat
- });
- }
- this._ngModuleCompiler.compile(outputCtx, ngModule, providers);
- };
- /**
- * @param {?} outputCtx
- * @param {?} compMeta
- * @param {?} ngModule
- * @param {?} fileSuffix
- * @return {?}
- */
- AotCompiler.prototype._compileComponentFactory = /**
- * @param {?} outputCtx
- * @param {?} compMeta
- * @param {?} ngModule
- * @param {?} fileSuffix
- * @return {?}
- */
- function (outputCtx, compMeta, ngModule, fileSuffix) {
- var /** @type {?} */ hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta);
- var /** @type {?} */ hostViewFactoryVar = this._compileComponent(outputCtx, hostMeta, ngModule, [compMeta.type], null, fileSuffix)
- .viewClassVar;
- var /** @type {?} */ compFactoryVar = componentFactoryName(compMeta.type.reference);
- var /** @type {?} */ inputsExprs = [];
- for (var /** @type {?} */ propName in compMeta.inputs) {
- var /** @type {?} */ templateName = compMeta.inputs[propName];
- // Don't quote so that the key gets minified...
- inputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false));
- }
- var /** @type {?} */ outputsExprs = [];
- for (var /** @type {?} */ propName in compMeta.outputs) {
- var /** @type {?} */ templateName = compMeta.outputs[propName];
- // Don't quote so that the key gets minified...
- outputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false));
- }
- outputCtx.statements.push(variable(compFactoryVar)
- .set(importExpr(Identifiers.createComponentFactory).callFn([
- literal(compMeta.selector), outputCtx.importExpr(compMeta.type.reference),
- variable(hostViewFactoryVar), new LiteralMapExpr(inputsExprs),
- new LiteralMapExpr(outputsExprs),
- literalArr(/** @type {?} */ ((compMeta.template)).ngContentSelectors.map(function (selector) { return literal(selector); }))
- ]))
- .toDeclStmt(importType(Identifiers.ComponentFactory, [/** @type {?} */ ((expressionType(outputCtx.importExpr(compMeta.type.reference))))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]));
- };
- /**
- * @param {?} outputCtx
- * @param {?} compMeta
- * @param {?} ngModule
- * @param {?} directiveIdentifiers
- * @param {?} componentStyles
- * @param {?} fileSuffix
- * @return {?}
- */
- AotCompiler.prototype._compileComponent = /**
- * @param {?} outputCtx
- * @param {?} compMeta
- * @param {?} ngModule
- * @param {?} directiveIdentifiers
- * @param {?} componentStyles
- * @param {?} fileSuffix
- * @return {?}
- */
- function (outputCtx, compMeta, ngModule, directiveIdentifiers, componentStyles, fileSuffix) {
- var _a = this._parseTemplate(compMeta, ngModule, directiveIdentifiers), parsedTemplate = _a.template, usedPipes = _a.pipes;
- var /** @type {?} */ stylesExpr = componentStyles ? variable(componentStyles.stylesVar) : literalArr([]);
- var /** @type {?} */ viewResult = this._viewCompiler.compileComponent(outputCtx, compMeta, parsedTemplate, stylesExpr, usedPipes);
- if (componentStyles) {
- _resolveStyleStatements(this._symbolResolver, componentStyles, this._styleCompiler.needsStyleShim(compMeta), fileSuffix);
- }
- return viewResult;
- };
- /**
- * @param {?} compMeta
- * @param {?} ngModule
- * @param {?} directiveIdentifiers
- * @return {?}
- */
- AotCompiler.prototype._parseTemplate = /**
- * @param {?} compMeta
- * @param {?} ngModule
- * @param {?} directiveIdentifiers
- * @return {?}
- */
- function (compMeta, ngModule, directiveIdentifiers) {
- var _this = this;
- if (this._templateAstCache.has(compMeta.type.reference)) {
- return /** @type {?} */ ((this._templateAstCache.get(compMeta.type.reference)));
- }
- var /** @type {?} */ preserveWhitespaces = /** @type {?} */ ((/** @type {?} */ ((compMeta)).template)).preserveWhitespaces;
- var /** @type {?} */ directives = directiveIdentifiers.map(function (dir) { return _this._metadataResolver.getDirectiveSummary(dir.reference); });
- var /** @type {?} */ pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
- var /** @type {?} */ result = this._templateParser.parse(compMeta, /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).htmlAst)), directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, /** @type {?} */ ((compMeta.template))), preserveWhitespaces);
- this._templateAstCache.set(compMeta.type.reference, result);
- return result;
- };
- /**
- * @param {?} genFilePath
- * @return {?}
- */
- AotCompiler.prototype._createOutputContext = /**
- * @param {?} genFilePath
- * @return {?}
- */
- function (genFilePath) {
- var _this = this;
- var /** @type {?} */ importExpr$$1 = function (symbol, typeParams, useSummaries) {
- if (typeParams === void 0) { typeParams = null; }
- if (useSummaries === void 0) { useSummaries = true; }
- if (!(symbol instanceof StaticSymbol)) {
- throw new Error("Internal error: unknown identifier " + JSON.stringify(symbol));
- }
- var /** @type {?} */ arity = _this._symbolResolver.getTypeArity(symbol) || 0;
- var _a = _this._symbolResolver.getImportAs(symbol, useSummaries) || symbol, filePath = _a.filePath, name = _a.name, members = _a.members;
- var /** @type {?} */ importModule = _this._fileNameToModuleName(filePath, genFilePath);
- // It should be good enough to compare filePath to genFilePath and if they are equal
- // there is a self reference. However, ngfactory files generate to .ts but their
- // symbols have .d.ts so a simple compare is insufficient. They should be canonical
- // and is tracked by #17705.
- var /** @type {?} */ selfReference = _this._fileNameToModuleName(genFilePath, genFilePath);
- var /** @type {?} */ moduleName = importModule === selfReference ? null : importModule;
- // If we are in a type expression that refers to a generic type then supply
- // the required type parameters. If there were not enough type parameters
- // supplied, supply any as the type. Outside a type expression the reference
- // should not supply type parameters and be treated as a simple value reference
- // to the constructor function itself.
- var /** @type {?} */ suppliedTypeParams = typeParams || [];
- var /** @type {?} */ missingTypeParamsCount = arity - suppliedTypeParams.length;
- var /** @type {?} */ allTypeParams = suppliedTypeParams.concat(new Array(missingTypeParamsCount).fill(DYNAMIC_TYPE));
- return members.reduce(function (expr, memberName) { return expr.prop(memberName); }, /** @type {?} */ (importExpr(new ExternalReference(moduleName, name, null), allTypeParams)));
- };
- return { statements: [], genFilePath: genFilePath, importExpr: importExpr$$1 };
- };
- /**
- * @param {?} importedFilePath
- * @param {?} containingFilePath
- * @return {?}
- */
- AotCompiler.prototype._fileNameToModuleName = /**
- * @param {?} importedFilePath
- * @param {?} containingFilePath
- * @return {?}
- */
- function (importedFilePath, containingFilePath) {
- return this._summaryResolver.getKnownModuleName(importedFilePath) ||
- this._symbolResolver.getKnownModuleName(importedFilePath) ||
- this._host.fileNameToModuleName(importedFilePath, containingFilePath);
- };
- /**
- * @param {?} srcFileUrl
- * @param {?} compMeta
- * @param {?} stylesheetMetadata
- * @param {?} isShimmed
- * @param {?} fileSuffix
- * @return {?}
- */
- AotCompiler.prototype._codegenStyles = /**
- * @param {?} srcFileUrl
- * @param {?} compMeta
- * @param {?} stylesheetMetadata
- * @param {?} isShimmed
- * @param {?} fileSuffix
- * @return {?}
- */
- function (srcFileUrl, compMeta, stylesheetMetadata, isShimmed, fileSuffix) {
- var /** @type {?} */ outputCtx = this._createOutputContext(_stylesModuleUrl(/** @type {?} */ ((stylesheetMetadata.moduleUrl)), isShimmed, fileSuffix));
- var /** @type {?} */ compiledStylesheet = this._styleCompiler.compileStyles(outputCtx, compMeta, stylesheetMetadata, isShimmed);
- _resolveStyleStatements(this._symbolResolver, compiledStylesheet, isShimmed, fileSuffix);
- return this._codegenSourceModule(srcFileUrl, outputCtx);
- };
- /**
- * @param {?} srcFileUrl
- * @param {?} ctx
- * @return {?}
- */
- AotCompiler.prototype._codegenSourceModule = /**
- * @param {?} srcFileUrl
- * @param {?} ctx
- * @return {?}
- */
- function (srcFileUrl, ctx) {
- return new GeneratedFile(srcFileUrl, ctx.genFilePath, ctx.statements);
- };
- /**
- * @param {?=} entryRoute
- * @param {?=} analyzedModules
- * @return {?}
- */
- AotCompiler.prototype.listLazyRoutes = /**
- * @param {?=} entryRoute
- * @param {?=} analyzedModules
- * @return {?}
- */
- function (entryRoute, analyzedModules) {
- var /** @type {?} */ self = this;
- if (entryRoute) {
- var /** @type {?} */ symbol = parseLazyRoute(entryRoute, this._reflector).referencedModule;
- return visitLazyRoute(symbol);
- }
- else if (analyzedModules) {
- var /** @type {?} */ allLazyRoutes = [];
- for (var _i = 0, _a = analyzedModules.ngModules; _i < _a.length; _i++) {
- var ngModule = _a[_i];
- var /** @type {?} */ lazyRoutes = listLazyRoutes(ngModule, this._reflector);
- for (var _b = 0, lazyRoutes_1 = lazyRoutes; _b < lazyRoutes_1.length; _b++) {
- var lazyRoute = lazyRoutes_1[_b];
- allLazyRoutes.push(lazyRoute);
- }
- }
- return allLazyRoutes;
- }
- else {
- throw new Error("Either route or analyzedModules has to be specified!");
- }
- /**
- * @param {?} symbol
- * @param {?=} seenRoutes
- * @param {?=} allLazyRoutes
- * @return {?}
- */
- function visitLazyRoute(symbol, seenRoutes, allLazyRoutes) {
- if (seenRoutes === void 0) { seenRoutes = new Set(); }
- if (allLazyRoutes === void 0) { allLazyRoutes = []; }
- // Support pointing to default exports, but stop recursing there,
- // as the StaticReflector does not yet support default exports.
- if (seenRoutes.has(symbol) || !symbol.name) {
- return allLazyRoutes;
- }
- seenRoutes.add(symbol);
- var /** @type {?} */ lazyRoutes = listLazyRoutes(/** @type {?} */ ((self._metadataResolver.getNgModuleMetadata(symbol, true))), self._reflector);
- for (var _i = 0, lazyRoutes_2 = lazyRoutes; _i < lazyRoutes_2.length; _i++) {
- var lazyRoute = lazyRoutes_2[_i];
- allLazyRoutes.push(lazyRoute);
- visitLazyRoute(lazyRoute.referencedModule, seenRoutes, allLazyRoutes);
- }
- return allLazyRoutes;
- }
- };
- return AotCompiler;
- }());
- /**
- * @param {?} outputCtx
- * @return {?}
- */
- function _createEmptyStub(outputCtx) {
- // Note: We need to produce at least one import statement so that
- // TypeScript knows that the file is an es6 module. Otherwise our generated
- // exports / imports won't be emitted properly by TypeScript.
- outputCtx.statements.push(importExpr(Identifiers.ComponentFactory).toStmt());
- }
- /**
- * @param {?} symbolResolver
- * @param {?} compileResult
- * @param {?} needsShim
- * @param {?} fileSuffix
- * @return {?}
- */
- function _resolveStyleStatements(symbolResolver, compileResult, needsShim, fileSuffix) {
- compileResult.dependencies.forEach(function (dep) {
- dep.setValue(symbolResolver.getStaticSymbol(_stylesModuleUrl(dep.moduleUrl, needsShim, fileSuffix), dep.name));
- });
- }
- /**
- * @param {?} stylesheetUrl
- * @param {?} shim
- * @param {?} suffix
- * @return {?}
- */
- function _stylesModuleUrl(stylesheetUrl, shim, suffix) {
- return "" + stylesheetUrl + (shim ? '.shim' : '') + ".ngstyle" + suffix;
- }
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @param {?} fileNames
- * @param {?} host
- * @param {?} staticSymbolResolver
- * @param {?} metadataResolver
- * @return {?}
- */
- function analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
- var /** @type {?} */ files = _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver);
- return mergeAnalyzedFiles(files);
- }
- /**
- * @param {?} fileNames
- * @param {?} host
- * @param {?} staticSymbolResolver
- * @param {?} metadataResolver
- * @return {?}
- */
- function analyzeAndValidateNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
- return validateAnalyzedModules(analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver));
- }
- /**
- * @param {?} analyzedModules
- * @return {?}
- */
- function validateAnalyzedModules(analyzedModules) {
- if (analyzedModules.symbolsMissingModule && analyzedModules.symbolsMissingModule.length) {
- var /** @type {?} */ messages = analyzedModules.symbolsMissingModule.map(function (s) {
- return "Cannot determine the module for class " + s.name + " in " + s.filePath + "! Add " + s.name + " to the NgModule to fix it.";
- });
- throw syntaxError(messages.join('\n'));
- }
- return analyzedModules;
- }
- /**
- * @param {?} fileNames
- * @param {?} host
- * @param {?} staticSymbolResolver
- * @param {?} metadataResolver
- * @return {?}
- */
- function _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver) {
- var /** @type {?} */ seenFiles = new Set();
- var /** @type {?} */ files = [];
- var /** @type {?} */ visitFile = function (fileName) {
- if (seenFiles.has(fileName) || !host.isSourceFile(fileName)) {
- return false;
- }
- seenFiles.add(fileName);
- var /** @type {?} */ analyzedFile = analyzeFile(host, staticSymbolResolver, metadataResolver, fileName);
- files.push(analyzedFile);
- analyzedFile.ngModules.forEach(function (ngModule) {
- ngModule.transitiveModule.modules.forEach(function (modMeta) { return visitFile(modMeta.reference.filePath); });
- });
- };
- fileNames.forEach(function (fileName) { return visitFile(fileName); });
- return files;
- }
- /**
- * @param {?} host
- * @param {?} staticSymbolResolver
- * @param {?} metadataResolver
- * @param {?} fileName
- * @return {?}
- */
- function analyzeFile(host, staticSymbolResolver, metadataResolver, fileName) {
- var /** @type {?} */ directives = [];
- var /** @type {?} */ pipes = [];
- var /** @type {?} */ injectables = [];
- var /** @type {?} */ ngModules = [];
- var /** @type {?} */ hasDecorators = staticSymbolResolver.hasDecorators(fileName);
- var /** @type {?} */ exportsNonSourceFiles = false;
- // Don't analyze .d.ts files that have no decorators as a shortcut
- // to speed up the analysis. This prevents us from
- // resolving the references in these files.
- // Note: exportsNonSourceFiles is only needed when compiling with summaries,
- // which is not the case when .d.ts files are treated as input files.
- if (!fileName.endsWith('.d.ts') || hasDecorators) {
- staticSymbolResolver.getSymbolsOf(fileName).forEach(function (symbol) {
- var /** @type {?} */ resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol);
- var /** @type {?} */ symbolMeta = resolvedSymbol.metadata;
- if (!symbolMeta || symbolMeta.__symbolic === 'error') {
- return;
- }
- var /** @type {?} */ isNgSymbol = false;
- if (symbolMeta.__symbolic === 'class') {
- if (metadataResolver.isDirective(symbol)) {
- isNgSymbol = true;
- directives.push(symbol);
- }
- else if (metadataResolver.isPipe(symbol)) {
- isNgSymbol = true;
- pipes.push(symbol);
- }
- else if (metadataResolver.isNgModule(symbol)) {
- var /** @type {?} */ ngModule = metadataResolver.getNgModuleMetadata(symbol, false);
- if (ngModule) {
- isNgSymbol = true;
- ngModules.push(ngModule);
- }
- }
- else if (metadataResolver.isInjectable(symbol)) {
- isNgSymbol = true;
- injectables.push(symbol);
- }
- }
- if (!isNgSymbol) {
- exportsNonSourceFiles =
- exportsNonSourceFiles || isValueExportingNonSourceFile(host, symbolMeta);
- }
- });
- }
- return {
- fileName: fileName, directives: directives, pipes: pipes, ngModules: ngModules, injectables: injectables, exportsNonSourceFiles: exportsNonSourceFiles,
- };
- }
- /**
- * @param {?} host
- * @param {?} metadata
- * @return {?}
- */
- function isValueExportingNonSourceFile(host, metadata) {
- var /** @type {?} */ exportsNonSourceFiles = false;
- var Visitor = /** @class */ (function () {
- function Visitor() {
- }
- /**
- * @param {?} arr
- * @param {?} context
- * @return {?}
- */
- Visitor.prototype.visitArray = /**
- * @param {?} arr
- * @param {?} context
- * @return {?}
- */
- function (arr, context) {
- var _this = this;
- arr.forEach(function (v) { return visitValue(v, _this, context); });
- };
- /**
- * @param {?} map
- * @param {?} context
- * @return {?}
- */
- Visitor.prototype.visitStringMap = /**
- * @param {?} map
- * @param {?} context
- * @return {?}
- */
- function (map, context) {
- var _this = this;
- Object.keys(map).forEach(function (key) { return visitValue(map[key], _this, context); });
- };
- /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- Visitor.prototype.visitPrimitive = /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- function (value, context) { };
- /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- Visitor.prototype.visitOther = /**
- * @param {?} value
- * @param {?} context
- * @return {?}
- */
- function (value, context) {
- if (value instanceof StaticSymbol && !host.isSourceFile(value.filePath)) {
- exportsNonSourceFiles = true;
- }
- };
- return Visitor;
- }());
- visitValue(metadata, new Visitor(), null);
- return exportsNonSourceFiles;
- }
- /**
- * @param {?} analyzedFiles
- * @return {?}
- */
- function mergeAnalyzedFiles(analyzedFiles) {
- var /** @type {?} */ allNgModules = [];
- var /** @type {?} */ ngModuleByPipeOrDirective = new Map();
- var /** @type {?} */ allPipesAndDirectives = new Set();
- analyzedFiles.forEach(function (af) {
- af.ngModules.forEach(function (ngModule) {
- allNgModules.push(ngModule);
- ngModule.declaredDirectives.forEach(function (d) { return ngModuleByPipeOrDirective.set(d.reference, ngModule); });
- ngModule.declaredPipes.forEach(function (p) { return ngModuleByPipeOrDirective.set(p.reference, ngModule); });
- });
- af.directives.forEach(function (d) { return allPipesAndDirectives.add(d); });
- af.pipes.forEach(function (p) { return allPipesAndDirectives.add(p); });
- });
- var /** @type {?} */ symbolsMissingModule = [];
- allPipesAndDirectives.forEach(function (ref) {
- if (!ngModuleByPipeOrDirective.has(ref)) {
- symbolsMissingModule.push(ref);
- }
- });
- return {
- ngModules: allNgModules,
- ngModuleByPipeOrDirective: ngModuleByPipeOrDirective,
- symbolsMissingModule: symbolsMissingModule,
- files: analyzedFiles
- };
- }
- /**
- * @param {?} files
- * @return {?}
- */
- function mergeAndValidateNgFiles(files) {
- return validateAnalyzedModules(mergeAnalyzedFiles(files));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @record
- */
- /**
- * @record
- */
- var FORMATTED_MESSAGE = 'ngFormattedMessage';
- /**
- * @param {?} level
- * @return {?}
- */
- function indentStr(level) {
- if (level <= 0)
- return '';
- if (level < 6)
- return ['', ' ', ' ', ' ', ' ', ' '][level];
- var /** @type {?} */ half = indentStr(Math.floor(level / 2));
- return half + half + (level % 2 === 1 ? ' ' : '');
- }
- /**
- * @param {?} chain
- * @param {?=} indent
- * @return {?}
- */
- function formatChain(chain, indent) {
- if (indent === void 0) { indent = 0; }
- if (!chain)
- return '';
- var /** @type {?} */ position = chain.position ?
- chain.position.fileName + "(" + (chain.position.line + 1) + "," + (chain.position.column + 1) + ")" :
- '';
- var /** @type {?} */ prefix = position && indent === 0 ? position + ": " : '';
- var /** @type {?} */ postfix = position && indent !== 0 ? " at " + position : '';
- var /** @type {?} */ message = "" + prefix + chain.message + postfix;
- return "" + indentStr(indent) + message + ((chain.next && ('\n' + formatChain(chain.next, indent + 2))) || '');
- }
- /**
- * @param {?} chain
- * @return {?}
- */
- function formattedError(chain) {
- var /** @type {?} */ message = formatChain(chain) + '.';
- var /** @type {?} */ error = /** @type {?} */ (syntaxError(message));
- (/** @type {?} */ (error))[FORMATTED_MESSAGE] = true;
- error.chain = chain;
- error.position = chain.position;
- return error;
- }
- /**
- * @param {?} error
- * @return {?}
- */
- function isFormattedError(error) {
- return !!(/** @type {?} */ (error))[FORMATTED_MESSAGE];
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ANGULAR_CORE = '@angular/core';
- var ANGULAR_ROUTER = '@angular/router';
- var HIDDEN_KEY = /^\$.*\$$/;
- var IGNORE = {
- __symbolic: 'ignore'
- };
- var USE_VALUE = 'useValue';
- var PROVIDE = 'provide';
- var REFERENCE_SET = new Set([USE_VALUE, 'useFactory', 'data']);
- var TYPEGUARD_POSTFIX = 'TypeGuard';
- var USE_IF = 'UseIf';
- /**
- * @param {?} value
- * @return {?}
- */
- function shouldIgnore(value) {
- return value && value.__symbolic == 'ignore';
- }
- /**
- * A static reflector implements enough of the Reflector API that is necessary to compile
- * templates statically.
- */
- var StaticReflector = /** @class */ (function () {
- function StaticReflector(summaryResolver, symbolResolver, knownMetadataClasses, knownMetadataFunctions, errorRecorder) {
- if (knownMetadataClasses === void 0) { knownMetadataClasses = []; }
- if (knownMetadataFunctions === void 0) { knownMetadataFunctions = []; }
- var _this = this;
- this.summaryResolver = summaryResolver;
- this.symbolResolver = symbolResolver;
- this.errorRecorder = errorRecorder;
- this.annotationCache = new Map();
- this.propertyCache = new Map();
- this.parameterCache = new Map();
- this.methodCache = new Map();
- this.staticCache = new Map();
- this.conversionMap = new Map();
- this.resolvedExternalReferences = new Map();
- this.annotationForParentClassWithSummaryKind = new Map();
- this.initializeConversionMap();
- knownMetadataClasses.forEach(function (kc) {
- return _this._registerDecoratorOrConstructor(_this.getStaticSymbol(kc.filePath, kc.name), kc.ctor);
- });
- knownMetadataFunctions.forEach(function (kf) { return _this._registerFunction(_this.getStaticSymbol(kf.filePath, kf.name), kf.fn); });
- this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Directive, [createDirective, createComponent]);
- this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Pipe, [createPipe]);
- this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.NgModule, [createNgModule]);
- this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Injectable, [createInjectable, createPipe, createDirective, createComponent, createNgModule]);
- }
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- StaticReflector.prototype.componentModuleUrl = /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (typeOrFunc) {
- var /** @type {?} */ staticSymbol = this.findSymbolDeclaration(typeOrFunc);
- return this.symbolResolver.getResourcePath(staticSymbol);
- };
- /**
- * @param {?} ref
- * @param {?=} containingFile
- * @return {?}
- */
- StaticReflector.prototype.resolveExternalReference = /**
- * @param {?} ref
- * @param {?=} containingFile
- * @return {?}
- */
- function (ref, containingFile) {
- var /** @type {?} */ key = undefined;
- if (!containingFile) {
- key = ref.moduleName + ":" + ref.name;
- var /** @type {?} */ declarationSymbol_1 = this.resolvedExternalReferences.get(key);
- if (declarationSymbol_1)
- return declarationSymbol_1;
- }
- var /** @type {?} */ refSymbol = this.symbolResolver.getSymbolByModule(/** @type {?} */ ((ref.moduleName)), /** @type {?} */ ((ref.name)), containingFile);
- var /** @type {?} */ declarationSymbol = this.findSymbolDeclaration(refSymbol);
- if (!containingFile) {
- this.symbolResolver.recordModuleNameForFileName(refSymbol.filePath, /** @type {?} */ ((ref.moduleName)));
- this.symbolResolver.recordImportAs(declarationSymbol, refSymbol);
- }
- if (key) {
- this.resolvedExternalReferences.set(key, declarationSymbol);
- }
- return declarationSymbol;
- };
- /**
- * @param {?} moduleUrl
- * @param {?} name
- * @param {?=} containingFile
- * @return {?}
- */
- StaticReflector.prototype.findDeclaration = /**
- * @param {?} moduleUrl
- * @param {?} name
- * @param {?=} containingFile
- * @return {?}
- */
- function (moduleUrl, name, containingFile) {
- return this.findSymbolDeclaration(this.symbolResolver.getSymbolByModule(moduleUrl, name, containingFile));
- };
- /**
- * @param {?} moduleUrl
- * @param {?} name
- * @return {?}
- */
- StaticReflector.prototype.tryFindDeclaration = /**
- * @param {?} moduleUrl
- * @param {?} name
- * @return {?}
- */
- function (moduleUrl, name) {
- var _this = this;
- return this.symbolResolver.ignoreErrorsFor(function () { return _this.findDeclaration(moduleUrl, name); });
- };
- /**
- * @param {?} symbol
- * @return {?}
- */
- StaticReflector.prototype.findSymbolDeclaration = /**
- * @param {?} symbol
- * @return {?}
- */
- function (symbol) {
- var /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(symbol);
- if (resolvedSymbol) {
- var /** @type {?} */ resolvedMetadata = resolvedSymbol.metadata;
- if (resolvedMetadata && resolvedMetadata.__symbolic === 'resolved') {
- resolvedMetadata = resolvedMetadata.symbol;
- }
- if (resolvedMetadata instanceof StaticSymbol) {
- return this.findSymbolDeclaration(resolvedSymbol.metadata);
- }
- }
- return symbol;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- StaticReflector.prototype.annotations = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var /** @type {?} */ annotations = this.annotationCache.get(type);
- if (!annotations) {
- annotations = [];
- var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
- var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
- if (parentType) {
- var /** @type {?} */ parentAnnotations = this.annotations(parentType);
- annotations.push.apply(annotations, parentAnnotations);
- }
- var /** @type {?} */ ownAnnotations_1 = [];
- if (classMetadata['decorators']) {
- ownAnnotations_1 = this.simplify(type, classMetadata['decorators']);
- annotations.push.apply(annotations, ownAnnotations_1);
- }
- if (parentType && !this.summaryResolver.isLibraryFile(type.filePath) &&
- this.summaryResolver.isLibraryFile(parentType.filePath)) {
- var /** @type {?} */ summary = this.summaryResolver.resolveSummary(parentType);
- if (summary && summary.type) {
- var /** @type {?} */ requiredAnnotationTypes = /** @type {?} */ ((this.annotationForParentClassWithSummaryKind.get(/** @type {?} */ ((summary.type.summaryKind)))));
- var /** @type {?} */ typeHasRequiredAnnotation = requiredAnnotationTypes.some(function (requiredType) { return ownAnnotations_1.some(function (ann) { return requiredType.isTypeOf(ann); }); });
- if (!typeHasRequiredAnnotation) {
- 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);
- }
- }
- }
- this.annotationCache.set(type, annotations.filter(function (ann) { return !!ann; }));
- }
- return annotations;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- StaticReflector.prototype.propMetadata = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var _this = this;
- var /** @type {?} */ propMetadata = this.propertyCache.get(type);
- if (!propMetadata) {
- var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
- propMetadata = {};
- var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
- if (parentType) {
- var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentType);
- Object.keys(parentPropMetadata_1).forEach(function (parentProp) {
- /** @type {?} */ ((propMetadata))[parentProp] = parentPropMetadata_1[parentProp];
- });
- }
- var /** @type {?} */ members_1 = classMetadata['members'] || {};
- Object.keys(members_1).forEach(function (propName) {
- var /** @type {?} */ propData = members_1[propName];
- var /** @type {?} */ prop = (/** @type {?} */ (propData))
- .find(function (a) { return a['__symbolic'] == 'property' || a['__symbolic'] == 'method'; });
- var /** @type {?} */ decorators = [];
- if (/** @type {?} */ ((propMetadata))[propName]) {
- decorators.push.apply(decorators, /** @type {?} */ ((propMetadata))[propName]);
- } /** @type {?} */
- ((propMetadata))[propName] = decorators;
- if (prop && prop['decorators']) {
- decorators.push.apply(decorators, _this.simplify(type, prop['decorators']));
- }
- });
- this.propertyCache.set(type, propMetadata);
- }
- return propMetadata;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- StaticReflector.prototype.parameters = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var _this = this;
- if (!(type instanceof StaticSymbol)) {
- this.reportError(new Error("parameters received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
- return [];
- }
- try {
- var /** @type {?} */ parameters_1 = this.parameterCache.get(type);
- if (!parameters_1) {
- var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
- var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
- var /** @type {?} */ members = classMetadata ? classMetadata['members'] : null;
- var /** @type {?} */ ctorData = members ? members['__ctor__'] : null;
- if (ctorData) {
- var /** @type {?} */ ctor = (/** @type {?} */ (ctorData)).find(function (a) { return a['__symbolic'] == 'constructor'; });
- var /** @type {?} */ rawParameterTypes = /** @type {?} */ (ctor['parameters']) || [];
- var /** @type {?} */ parameterDecorators_1 = /** @type {?} */ (this.simplify(type, ctor['parameterDecorators'] || []));
- parameters_1 = [];
- rawParameterTypes.forEach(function (rawParamType, index) {
- var /** @type {?} */ nestedResult = [];
- var /** @type {?} */ paramType = _this.trySimplify(type, rawParamType);
- if (paramType)
- nestedResult.push(paramType);
- var /** @type {?} */ decorators = parameterDecorators_1 ? parameterDecorators_1[index] : null;
- if (decorators) {
- nestedResult.push.apply(nestedResult, decorators);
- } /** @type {?} */
- ((parameters_1)).push(nestedResult);
- });
- }
- else if (parentType) {
- parameters_1 = this.parameters(parentType);
- }
- if (!parameters_1) {
- parameters_1 = [];
- }
- this.parameterCache.set(type, parameters_1);
- }
- return parameters_1;
- }
- catch (/** @type {?} */ e) {
- console.error("Failed on type " + JSON.stringify(type) + " with error " + e);
- throw e;
- }
- };
- /**
- * @param {?} type
- * @return {?}
- */
- StaticReflector.prototype._methodNames = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var /** @type {?} */ methodNames = this.methodCache.get(type);
- if (!methodNames) {
- var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
- methodNames = {};
- var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
- if (parentType) {
- var /** @type {?} */ parentMethodNames_1 = this._methodNames(parentType);
- Object.keys(parentMethodNames_1).forEach(function (parentProp) {
- /** @type {?} */ ((methodNames))[parentProp] = parentMethodNames_1[parentProp];
- });
- }
- var /** @type {?} */ members_2 = classMetadata['members'] || {};
- Object.keys(members_2).forEach(function (propName) {
- var /** @type {?} */ propData = members_2[propName];
- var /** @type {?} */ isMethod = (/** @type {?} */ (propData)).some(function (a) { return a['__symbolic'] == 'method'; }); /** @type {?} */
- ((methodNames))[propName] = /** @type {?} */ ((methodNames))[propName] || isMethod;
- });
- this.methodCache.set(type, methodNames);
- }
- return methodNames;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- StaticReflector.prototype._staticMembers = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var /** @type {?} */ staticMembers = this.staticCache.get(type);
- if (!staticMembers) {
- var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
- var /** @type {?} */ staticMemberData = classMetadata['statics'] || {};
- staticMembers = Object.keys(staticMemberData);
- this.staticCache.set(type, staticMembers);
- }
- return staticMembers;
- };
- /**
- * @param {?} type
- * @param {?} classMetadata
- * @return {?}
- */
- StaticReflector.prototype.findParentType = /**
- * @param {?} type
- * @param {?} classMetadata
- * @return {?}
- */
- function (type, classMetadata) {
- var /** @type {?} */ parentType = this.trySimplify(type, classMetadata['extends']);
- if (parentType instanceof StaticSymbol) {
- return parentType;
- }
- };
- /**
- * @param {?} type
- * @param {?} lcProperty
- * @return {?}
- */
- StaticReflector.prototype.hasLifecycleHook = /**
- * @param {?} type
- * @param {?} lcProperty
- * @return {?}
- */
- function (type, lcProperty) {
- if (!(type instanceof StaticSymbol)) {
- this.reportError(new Error("hasLifecycleHook received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
- }
- try {
- return !!this._methodNames(type)[lcProperty];
- }
- catch (/** @type {?} */ e) {
- console.error("Failed on type " + JSON.stringify(type) + " with error " + e);
- throw e;
- }
- };
- /**
- * @param {?} type
- * @return {?}
- */
- StaticReflector.prototype.guards = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- if (!(type instanceof StaticSymbol)) {
- this.reportError(new Error("guards received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
- return {};
- }
- var /** @type {?} */ staticMembers = this._staticMembers(type);
- var /** @type {?} */ result = {};
- for (var _i = 0, staticMembers_1 = staticMembers; _i < staticMembers_1.length; _i++) {
- var name_1 = staticMembers_1[_i];
- if (name_1.endsWith(TYPEGUARD_POSTFIX)) {
- var /** @type {?} */ property = name_1.substr(0, name_1.length - TYPEGUARD_POSTFIX.length);
- var /** @type {?} */ value = void 0;
- if (property.endsWith(USE_IF)) {
- property = name_1.substr(0, property.length - USE_IF.length);
- value = USE_IF;
- }
- else {
- value = this.getStaticSymbol(type.filePath, type.name, [name_1]);
- }
- result[property] = value;
- }
- }
- return result;
- };
- /**
- * @param {?} type
- * @param {?} ctor
- * @return {?}
- */
- StaticReflector.prototype._registerDecoratorOrConstructor = /**
- * @param {?} type
- * @param {?} ctor
- * @return {?}
- */
- function (type, ctor) {
- this.conversionMap.set(type, function (context, args) { return new (ctor.bind.apply(ctor, [void 0].concat(args)))(); });
- };
- /**
- * @param {?} type
- * @param {?} fn
- * @return {?}
- */
- StaticReflector.prototype._registerFunction = /**
- * @param {?} type
- * @param {?} fn
- * @return {?}
- */
- function (type, fn) {
- this.conversionMap.set(type, function (context, args) { return fn.apply(undefined, args); });
- };
- /**
- * @return {?}
- */
- StaticReflector.prototype.initializeConversionMap = /**
- * @return {?}
- */
- function () {
- this.injectionToken = this.findDeclaration(ANGULAR_CORE, 'InjectionToken');
- this.opaqueToken = this.findDeclaration(ANGULAR_CORE, 'OpaqueToken');
- this.ROUTES = this.tryFindDeclaration(ANGULAR_ROUTER, 'ROUTES');
- this.ANALYZE_FOR_ENTRY_COMPONENTS =
- this.findDeclaration(ANGULAR_CORE, 'ANALYZE_FOR_ENTRY_COMPONENTS');
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Injectable'), createInjectable);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Inject'), createInject);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Attribute'), createAttribute);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChild'), createContentChild);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChildren'), createContentChildren);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChild'), createViewChild);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChildren'), createViewChildren);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Input'), createInput);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Output'), createOutput);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Pipe'), createPipe);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostBinding'), createHostBinding);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostListener'), createHostListener);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Directive'), createDirective);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Component'), createComponent);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'NgModule'), createNgModule);
- // Note: Some metadata classes can be used directly with Provider.deps.
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
- this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
- };
- /**
- * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
- * All types passed to the StaticResolver should be pseudo-types returned by this method.
- *
- * @param declarationFile the absolute path of the file where the symbol is declared
- * @param name the name of the type.
- */
- /**
- * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
- * All types passed to the StaticResolver should be pseudo-types returned by this method.
- *
- * @param {?} declarationFile the absolute path of the file where the symbol is declared
- * @param {?} name the name of the type.
- * @param {?=} members
- * @return {?}
- */
- StaticReflector.prototype.getStaticSymbol = /**
- * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
- * All types passed to the StaticResolver should be pseudo-types returned by this method.
- *
- * @param {?} declarationFile the absolute path of the file where the symbol is declared
- * @param {?} name the name of the type.
- * @param {?=} members
- * @return {?}
- */
- function (declarationFile, name, members) {
- return this.symbolResolver.getStaticSymbol(declarationFile, name, members);
- };
- /**
- * Simplify but discard any errors
- * @param {?} context
- * @param {?} value
- * @return {?}
- */
- StaticReflector.prototype.trySimplify = /**
- * Simplify but discard any errors
- * @param {?} context
- * @param {?} value
- * @return {?}
- */
- function (context, value) {
- var /** @type {?} */ originalRecorder = this.errorRecorder;
- this.errorRecorder = function (error, fileName) { };
- var /** @type {?} */ result = this.simplify(context, value);
- this.errorRecorder = originalRecorder;
- return result;
- };
- /**
- * \@internal
- * @param {?} context
- * @param {?} value
- * @return {?}
- */
- StaticReflector.prototype.simplify = /**
- * \@internal
- * @param {?} context
- * @param {?} value
- * @return {?}
- */
- function (context, value) {
- var /** @type {?} */ self = this;
- var /** @type {?} */ scope = BindingScope.empty;
- var /** @type {?} */ calling = new Map();
- var /** @type {?} */ rootContext = context;
- /**
- * @param {?} context
- * @param {?} value
- * @param {?} depth
- * @param {?} references
- * @return {?}
- */
- function simplifyInContext(context, value, depth, references) {
- /**
- * @param {?} staticSymbol
- * @return {?}
- */
- function resolveReferenceValue(staticSymbol) {
- var /** @type {?} */ resolvedSymbol = self.symbolResolver.resolveSymbol(staticSymbol);
- return resolvedSymbol ? resolvedSymbol.metadata : null;
- }
- /**
- * @param {?} value
- * @return {?}
- */
- function simplifyEagerly(value) {
- return simplifyInContext(context, value, depth, 0);
- }
- /**
- * @param {?} value
- * @return {?}
- */
- function simplifyLazily(value) {
- return simplifyInContext(context, value, depth, references + 1);
- }
- /**
- * @param {?} nestedContext
- * @param {?} value
- * @return {?}
- */
- function simplifyNested(nestedContext, value) {
- if (nestedContext === context) {
- // If the context hasn't changed let the exception propagate unmodified.
- return simplifyInContext(nestedContext, value, depth + 1, references);
- }
- try {
- return simplifyInContext(nestedContext, value, depth + 1, references);
- }
- catch (/** @type {?} */ e) {
- if (isMetadataError(e)) {
- // Propagate the message text up but add a message to the chain that explains how we got
- // here.
- // e.chain implies e.symbol
- var /** @type {?} */ summaryMsg = e.chain ? 'references \'' + /** @type {?} */ ((e.symbol)).name + '\'' : errorSummary(e);
- var /** @type {?} */ summary = "'" + nestedContext.name + "' " + summaryMsg;
- var /** @type {?} */ chain = { message: summary, position: e.position, next: e.chain };
- // TODO(chuckj): retrieve the position information indirectly from the collectors node
- // map if the metadata is from a .ts file.
- self.error({
- message: e.message,
- advise: e.advise,
- context: e.context, chain: chain,
- symbol: nestedContext
- }, context);
- }
- else {
- // It is probably an internal error.
- throw e;
- }
- }
- }
- /**
- * @param {?} functionSymbol
- * @param {?} targetFunction
- * @param {?} args
- * @param {?} targetExpression
- * @return {?}
- */
- function simplifyCall(functionSymbol, targetFunction, args, targetExpression) {
- if (targetFunction && targetFunction['__symbolic'] == 'function') {
- if (calling.get(functionSymbol)) {
- self.error({
- message: 'Recursion is not supported',
- summary: "called '" + functionSymbol.name + "' recursively",
- value: targetFunction
- }, functionSymbol);
- }
- try {
- var /** @type {?} */ value_1 = targetFunction['value'];
- if (value_1 && (depth != 0 || value_1.__symbolic != 'error')) {
- var /** @type {?} */ parameters = targetFunction['parameters'];
- var /** @type {?} */ defaults = targetFunction.defaults;
- args = args.map(function (arg) { return simplifyNested(context, arg); })
- .map(function (arg) { return shouldIgnore(arg) ? undefined : arg; });
- if (defaults && defaults.length > args.length) {
- args.push.apply(args, defaults.slice(args.length).map(function (value) { return simplify(value); }));
- }
- calling.set(functionSymbol, true);
- var /** @type {?} */ functionScope = BindingScope.build();
- for (var /** @type {?} */ i = 0; i < parameters.length; i++) {
- functionScope.define(parameters[i], args[i]);
- }
- var /** @type {?} */ oldScope = scope;
- var /** @type {?} */ result_1;
- try {
- scope = functionScope.done();
- result_1 = simplifyNested(functionSymbol, value_1);
- }
- finally {
- scope = oldScope;
- }
- return result_1;
- }
- }
- finally {
- calling.delete(functionSymbol);
- }
- }
- if (depth === 0) {
- // If depth is 0 we are evaluating the top level expression that is describing element
- // decorator. In this case, it is a decorator we don't understand, such as a custom
- // non-angular decorator, and we should just ignore it.
- return IGNORE;
- }
- var /** @type {?} */ position = undefined;
- if (targetExpression && targetExpression.__symbolic == 'resolved') {
- var /** @type {?} */ line = targetExpression.line;
- var /** @type {?} */ character = targetExpression.character;
- var /** @type {?} */ fileName = targetExpression.fileName;
- if (fileName != null && line != null && character != null) {
- position = { fileName: fileName, line: line, column: character };
- }
- }
- self.error({
- message: FUNCTION_CALL_NOT_SUPPORTED,
- context: functionSymbol,
- value: targetFunction, position: position
- }, context);
- }
- /**
- * @param {?} expression
- * @return {?}
- */
- function simplify(expression) {
- if (isPrimitive(expression)) {
- return expression;
- }
- if (expression instanceof Array) {
- var /** @type {?} */ result_2 = [];
- for (var _i = 0, _a = (/** @type {?} */ (expression)); _i < _a.length; _i++) {
- var item = _a[_i];
- // Check for a spread expression
- if (item && item.__symbolic === 'spread') {
- // We call with references as 0 because we require the actual value and cannot
- // tolerate a reference here.
- var /** @type {?} */ spreadArray = simplifyEagerly(item.expression);
- if (Array.isArray(spreadArray)) {
- for (var _b = 0, spreadArray_1 = spreadArray; _b < spreadArray_1.length; _b++) {
- var spreadItem = spreadArray_1[_b];
- result_2.push(spreadItem);
- }
- continue;
- }
- }
- var /** @type {?} */ value_2 = simplify(item);
- if (shouldIgnore(value_2)) {
- continue;
- }
- result_2.push(value_2);
- }
- return result_2;
- }
- if (expression instanceof StaticSymbol) {
- // Stop simplification at builtin symbols or if we are in a reference context and
- // the symbol doesn't have members.
- if (expression === self.injectionToken || self.conversionMap.has(expression) ||
- (references > 0 && !expression.members.length)) {
- return expression;
- }
- else {
- var /** @type {?} */ staticSymbol = expression;
- var /** @type {?} */ declarationValue = resolveReferenceValue(staticSymbol);
- if (declarationValue != null) {
- return simplifyNested(staticSymbol, declarationValue);
- }
- else {
- return staticSymbol;
- }
- }
- }
- if (expression) {
- if (expression['__symbolic']) {
- var /** @type {?} */ staticSymbol = void 0;
- switch (expression['__symbolic']) {
- case 'binop':
- var /** @type {?} */ left = simplify(expression['left']);
- if (shouldIgnore(left))
- return left;
- var /** @type {?} */ right = simplify(expression['right']);
- if (shouldIgnore(right))
- return right;
- switch (expression['operator']) {
- case '&&':
- return left && right;
- case '||':
- return left || right;
- case '|':
- return left | right;
- case '^':
- return left ^ right;
- case '&':
- return left & right;
- case '==':
- return left == right;
- case '!=':
- return left != right;
- case '===':
- return left === right;
- case '!==':
- return left !== right;
- case '<':
- return left < right;
- case '>':
- return left > right;
- case '<=':
- return left <= right;
- case '>=':
- return left >= right;
- case '<<':
- return left << right;
- case '>>':
- return left >> right;
- case '+':
- return left + right;
- case '-':
- return left - right;
- case '*':
- return left * right;
- case '/':
- return left / right;
- case '%':
- return left % right;
- }
- return null;
- case 'if':
- var /** @type {?} */ condition = simplify(expression['condition']);
- return condition ? simplify(expression['thenExpression']) :
- simplify(expression['elseExpression']);
- case 'pre':
- var /** @type {?} */ operand = simplify(expression['operand']);
- if (shouldIgnore(operand))
- return operand;
- switch (expression['operator']) {
- case '+':
- return operand;
- case '-':
- return -operand;
- case '!':
- return !operand;
- case '~':
- return ~operand;
- }
- return null;
- case 'index':
- var /** @type {?} */ indexTarget = simplifyEagerly(expression['expression']);
- var /** @type {?} */ index = simplifyEagerly(expression['index']);
- if (indexTarget && isPrimitive(index))
- return indexTarget[index];
- return null;
- case 'select':
- var /** @type {?} */ member = expression['member'];
- var /** @type {?} */ selectContext = context;
- var /** @type {?} */ selectTarget = simplify(expression['expression']);
- if (selectTarget instanceof StaticSymbol) {
- var /** @type {?} */ members = selectTarget.members.concat(member);
- selectContext =
- self.getStaticSymbol(selectTarget.filePath, selectTarget.name, members);
- var /** @type {?} */ declarationValue = resolveReferenceValue(selectContext);
- if (declarationValue != null) {
- return simplifyNested(selectContext, declarationValue);
- }
- else {
- return selectContext;
- }
- }
- if (selectTarget && isPrimitive(member))
- return simplifyNested(selectContext, selectTarget[member]);
- return null;
- case 'reference':
- // Note: This only has to deal with variable references, as symbol references have
- // been converted into 'resolved'
- // in the StaticSymbolResolver.
- var /** @type {?} */ name_2 = expression['name'];
- var /** @type {?} */ localValue = scope.resolve(name_2);
- if (localValue != BindingScope.missing) {
- return localValue;
- }
- break;
- case 'resolved':
- try {
- return simplify(expression.symbol);
- }
- catch (/** @type {?} */ e) {
- // If an error is reported evaluating the symbol record the position of the
- // reference in the error so it can
- // be reported in the error message generated from the exception.
- if (isMetadataError(e) && expression.fileName != null &&
- expression.line != null && expression.character != null) {
- e.position = {
- fileName: expression.fileName,
- line: expression.line,
- column: expression.character
- };
- }
- throw e;
- }
- case 'class':
- return context;
- case 'function':
- return context;
- case 'new':
- case 'call':
- // Determine if the function is a built-in conversion
- staticSymbol = simplifyInContext(context, expression['expression'], depth + 1, /* references */ 0);
- if (staticSymbol instanceof StaticSymbol) {
- if (staticSymbol === self.injectionToken || staticSymbol === self.opaqueToken) {
- // if somebody calls new InjectionToken, don't create an InjectionToken,
- // but rather return the symbol to which the InjectionToken is assigned to.
- // OpaqueToken is supported too as it is required by the language service to
- // support v4 and prior versions of Angular.
- return context;
- }
- var /** @type {?} */ argExpressions = expression['arguments'] || [];
- var /** @type {?} */ converter = self.conversionMap.get(staticSymbol);
- if (converter) {
- var /** @type {?} */ args = argExpressions.map(function (arg) { return simplifyNested(context, arg); })
- .map(function (arg) { return shouldIgnore(arg) ? undefined : arg; });
- return converter(context, args);
- }
- else {
- // Determine if the function is one we can simplify.
- var /** @type {?} */ targetFunction = resolveReferenceValue(staticSymbol);
- return simplifyCall(staticSymbol, targetFunction, argExpressions, expression['expression']);
- }
- }
- return IGNORE;
- case 'error':
- var /** @type {?} */ message = expression.message;
- if (expression['line'] != null) {
- self.error({
- message: message,
- context: expression.context,
- value: expression,
- position: {
- fileName: expression['fileName'],
- line: expression['line'],
- column: expression['character']
- }
- }, context);
- }
- else {
- self.error({ message: message, context: expression.context }, context);
- }
- return IGNORE;
- case 'ignore':
- return expression;
- }
- return null;
- }
- return mapStringMap(expression, function (value, name) {
- if (REFERENCE_SET.has(name)) {
- if (name === USE_VALUE && PROVIDE in expression) {
- // If this is a provider expression, check for special tokens that need the value
- // during analysis.
- var /** @type {?} */ provide = simplify(expression.provide);
- if (provide === self.ROUTES || provide == self.ANALYZE_FOR_ENTRY_COMPONENTS) {
- return simplify(value);
- }
- }
- return simplifyLazily(value);
- }
- return simplify(value);
- });
- }
- return IGNORE;
- }
- return simplify(value);
- }
- var /** @type {?} */ result;
- try {
- result = simplifyInContext(context, value, 0, 0);
- }
- catch (/** @type {?} */ e) {
- if (this.errorRecorder) {
- this.reportError(e, context);
- }
- else {
- throw formatMetadataError(e, context);
- }
- }
- if (shouldIgnore(result)) {
- return undefined;
- }
- return result;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- StaticReflector.prototype.getTypeMetadata = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- var /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(type);
- return resolvedSymbol && resolvedSymbol.metadata ? resolvedSymbol.metadata :
- { __symbolic: 'class' };
- };
- /**
- * @param {?} error
- * @param {?} context
- * @param {?=} path
- * @return {?}
- */
- StaticReflector.prototype.reportError = /**
- * @param {?} error
- * @param {?} context
- * @param {?=} path
- * @return {?}
- */
- function (error, context, path) {
- if (this.errorRecorder) {
- this.errorRecorder(formatMetadataError(error, context), (context && context.filePath) || path);
- }
- else {
- throw error;
- }
- };
- /**
- * @param {?} __0
- * @param {?} reportingContext
- * @return {?}
- */
- StaticReflector.prototype.error = /**
- * @param {?} __0
- * @param {?} reportingContext
- * @return {?}
- */
- function (_a, reportingContext) {
- 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;
- this.reportError(metadataError(message, summary, advise, position, symbol, context, chain), reportingContext);
- };
- return StaticReflector;
- }());
- var METADATA_ERROR = 'ngMetadataError';
- /**
- * @param {?} message
- * @param {?=} summary
- * @param {?=} advise
- * @param {?=} position
- * @param {?=} symbol
- * @param {?=} context
- * @param {?=} chain
- * @return {?}
- */
- function metadataError(message, summary, advise, position, symbol, context, chain) {
- var /** @type {?} */ error = /** @type {?} */ (syntaxError(message));
- (/** @type {?} */ (error))[METADATA_ERROR] = true;
- if (advise)
- error.advise = advise;
- if (position)
- error.position = position;
- if (summary)
- error.summary = summary;
- if (context)
- error.context = context;
- if (chain)
- error.chain = chain;
- if (symbol)
- error.symbol = symbol;
- return error;
- }
- /**
- * @param {?} error
- * @return {?}
- */
- function isMetadataError(error) {
- return !!(/** @type {?} */ (error))[METADATA_ERROR];
- }
- var REFERENCE_TO_NONEXPORTED_CLASS = 'Reference to non-exported class';
- var VARIABLE_NOT_INITIALIZED = 'Variable not initialized';
- var DESTRUCTURE_NOT_SUPPORTED = 'Destructuring not supported';
- var COULD_NOT_RESOLVE_TYPE = 'Could not resolve type';
- var FUNCTION_CALL_NOT_SUPPORTED = 'Function call not supported';
- var REFERENCE_TO_LOCAL_SYMBOL = 'Reference to a local symbol';
- var LAMBDA_NOT_SUPPORTED = 'Lambda not supported';
- /**
- * @param {?} message
- * @param {?} context
- * @return {?}
- */
- function expandedMessage(message, context) {
- switch (message) {
- case REFERENCE_TO_NONEXPORTED_CLASS:
- if (context && context.className) {
- return "References to a non-exported class are not supported in decorators but " + context.className + " was referenced.";
- }
- break;
- case VARIABLE_NOT_INITIALIZED:
- return 'Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler';
- case DESTRUCTURE_NOT_SUPPORTED:
- return 'Referencing an exported destructured variable or constant is not supported in decorators and this value is needed by the template compiler';
- case COULD_NOT_RESOLVE_TYPE:
- if (context && context.typeName) {
- return "Could not resolve type " + context.typeName;
- }
- break;
- case FUNCTION_CALL_NOT_SUPPORTED:
- if (context && context.name) {
- return "Function calls are not supported in decorators but '" + context.name + "' was called";
- }
- return 'Function calls are not supported in decorators';
- case REFERENCE_TO_LOCAL_SYMBOL:
- if (context && context.name) {
- return "Reference to a local (non-exported) symbols are not supported in decorators but '" + context.name + "' was referenced";
- }
- break;
- case LAMBDA_NOT_SUPPORTED:
- return "Function expressions are not supported in decorators";
- }
- return message;
- }
- /**
- * @param {?} message
- * @param {?} context
- * @return {?}
- */
- function messageAdvise(message, context) {
- switch (message) {
- case REFERENCE_TO_NONEXPORTED_CLASS:
- if (context && context.className) {
- return "Consider exporting '" + context.className + "'";
- }
- break;
- case DESTRUCTURE_NOT_SUPPORTED:
- return 'Consider simplifying to avoid destructuring';
- case REFERENCE_TO_LOCAL_SYMBOL:
- if (context && context.name) {
- return "Consider exporting '" + context.name + "'";
- }
- break;
- case LAMBDA_NOT_SUPPORTED:
- return "Consider changing the function expression into an exported function";
- }
- return undefined;
- }
- /**
- * @param {?} error
- * @return {?}
- */
- function errorSummary(error) {
- if (error.summary) {
- return error.summary;
- }
- switch (error.message) {
- case REFERENCE_TO_NONEXPORTED_CLASS:
- if (error.context && error.context.className) {
- return "references non-exported class " + error.context.className;
- }
- break;
- case VARIABLE_NOT_INITIALIZED:
- return 'is not initialized';
- case DESTRUCTURE_NOT_SUPPORTED:
- return 'is a destructured variable';
- case COULD_NOT_RESOLVE_TYPE:
- return 'could not be resolved';
- case FUNCTION_CALL_NOT_SUPPORTED:
- if (error.context && error.context.name) {
- return "calls '" + error.context.name + "'";
- }
- return "calls a function";
- case REFERENCE_TO_LOCAL_SYMBOL:
- if (error.context && error.context.name) {
- return "references local variable " + error.context.name;
- }
- return "references a local variable";
- }
- return 'contains the error';
- }
- /**
- * @param {?} input
- * @param {?} transform
- * @return {?}
- */
- function mapStringMap(input, transform) {
- if (!input)
- return {};
- var /** @type {?} */ result = {};
- Object.keys(input).forEach(function (key) {
- var /** @type {?} */ value = transform(input[key], key);
- if (!shouldIgnore(value)) {
- if (HIDDEN_KEY.test(key)) {
- Object.defineProperty(result, key, { enumerable: false, configurable: true, value: value });
- }
- else {
- result[key] = value;
- }
- }
- });
- return result;
- }
- /**
- * @param {?} o
- * @return {?}
- */
- function isPrimitive(o) {
- return o === null || (typeof o !== 'function' && typeof o !== 'object');
- }
- /**
- * @abstract
- */
- var BindingScope = /** @class */ (function () {
- function BindingScope() {
- }
- /**
- * @return {?}
- */
- BindingScope.build = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ current = new Map();
- return {
- define: function (name, value) {
- current.set(name, value);
- return this;
- },
- done: function () {
- return current.size > 0 ? new PopulatedScope(current) : BindingScope.empty;
- }
- };
- };
- BindingScope.missing = {};
- BindingScope.empty = { resolve: function (name) { return BindingScope.missing; } };
- return BindingScope;
- }());
- var PopulatedScope = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PopulatedScope, _super);
- function PopulatedScope(bindings) {
- var _this = _super.call(this) || this;
- _this.bindings = bindings;
- return _this;
- }
- /**
- * @param {?} name
- * @return {?}
- */
- PopulatedScope.prototype.resolve = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- return this.bindings.has(name) ? this.bindings.get(name) : BindingScope.missing;
- };
- return PopulatedScope;
- }(BindingScope));
- /**
- * @param {?} chain
- * @param {?} advise
- * @return {?}
- */
- function formatMetadataMessageChain(chain, advise) {
- var /** @type {?} */ expanded = expandedMessage(chain.message, chain.context);
- var /** @type {?} */ nesting = chain.symbol ? " in '" + chain.symbol.name + "'" : '';
- var /** @type {?} */ message = "" + expanded + nesting;
- var /** @type {?} */ position = chain.position;
- var /** @type {?} */ next = chain.next ?
- formatMetadataMessageChain(chain.next, advise) :
- advise ? { message: advise } : undefined;
- return { message: message, position: position, next: next };
- }
- /**
- * @param {?} e
- * @param {?} context
- * @return {?}
- */
- function formatMetadataError(e, context) {
- if (isMetadataError(e)) {
- // Produce a formatted version of the and leaving enough information in the original error
- // to recover the formatting information to eventually produce a diagnostic error message.
- var /** @type {?} */ position = e.position;
- var /** @type {?} */ chain = {
- message: "Error during template compile of '" + context.name + "'",
- position: position,
- next: { message: e.message, next: e.chain, context: e.context, symbol: e.symbol }
- };
- var /** @type {?} */ advise = e.advise || messageAdvise(e.message, e.context);
- return formattedError(formatMetadataMessageChain(chain, advise));
- }
- return e;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @record
- */
- var AotSummaryResolver = /** @class */ (function () {
- function AotSummaryResolver(host, staticSymbolCache) {
- this.host = host;
- this.staticSymbolCache = staticSymbolCache;
- this.summaryCache = new Map();
- this.loadedFilePaths = new Map();
- this.importAs = new Map();
- this.knownFileNameToModuleNames = new Map();
- }
- /**
- * @param {?} filePath
- * @return {?}
- */
- AotSummaryResolver.prototype.isLibraryFile = /**
- * @param {?} filePath
- * @return {?}
- */
- function (filePath) {
- // Note: We need to strip the .ngfactory. file path,
- // so this method also works for generated files
- // (for which host.isSourceFile will always return false).
- return !this.host.isSourceFile(stripGeneratedFileSuffix(filePath));
- };
- /**
- * @param {?} filePath
- * @param {?} referringSrcFileName
- * @return {?}
- */
- AotSummaryResolver.prototype.toSummaryFileName = /**
- * @param {?} filePath
- * @param {?} referringSrcFileName
- * @return {?}
- */
- function (filePath, referringSrcFileName) {
- return this.host.toSummaryFileName(filePath, referringSrcFileName);
- };
- /**
- * @param {?} fileName
- * @param {?} referringLibFileName
- * @return {?}
- */
- AotSummaryResolver.prototype.fromSummaryFileName = /**
- * @param {?} fileName
- * @param {?} referringLibFileName
- * @return {?}
- */
- function (fileName, referringLibFileName) {
- return this.host.fromSummaryFileName(fileName, referringLibFileName);
- };
- /**
- * @param {?} staticSymbol
- * @return {?}
- */
- AotSummaryResolver.prototype.resolveSummary = /**
- * @param {?} staticSymbol
- * @return {?}
- */
- function (staticSymbol) {
- var /** @type {?} */ rootSymbol = staticSymbol.members.length ?
- this.staticSymbolCache.get(staticSymbol.filePath, staticSymbol.name) :
- staticSymbol;
- var /** @type {?} */ summary = this.summaryCache.get(rootSymbol);
- if (!summary) {
- this._loadSummaryFile(staticSymbol.filePath);
- summary = /** @type {?} */ ((this.summaryCache.get(staticSymbol)));
- }
- return (rootSymbol === staticSymbol && summary) || null;
- };
- /**
- * @param {?} filePath
- * @return {?}
- */
- AotSummaryResolver.prototype.getSymbolsOf = /**
- * @param {?} filePath
- * @return {?}
- */
- function (filePath) {
- if (this._loadSummaryFile(filePath)) {
- return Array.from(this.summaryCache.keys()).filter(function (symbol) { return symbol.filePath === filePath; });
- }
- return null;
- };
- /**
- * @param {?} staticSymbol
- * @return {?}
- */
- AotSummaryResolver.prototype.getImportAs = /**
- * @param {?} staticSymbol
- * @return {?}
- */
- function (staticSymbol) {
- staticSymbol.assertNoMembers();
- return /** @type {?} */ ((this.importAs.get(staticSymbol)));
- };
- /**
- * Converts a file path to a module name that can be used as an `import`.
- */
- /**
- * Converts a file path to a module name that can be used as an `import`.
- * @param {?} importedFilePath
- * @return {?}
- */
- AotSummaryResolver.prototype.getKnownModuleName = /**
- * Converts a file path to a module name that can be used as an `import`.
- * @param {?} importedFilePath
- * @return {?}
- */
- function (importedFilePath) {
- return this.knownFileNameToModuleNames.get(importedFilePath) || null;
- };
- /**
- * @param {?} summary
- * @return {?}
- */
- AotSummaryResolver.prototype.addSummary = /**
- * @param {?} summary
- * @return {?}
- */
- function (summary) { this.summaryCache.set(summary.symbol, summary); };
- /**
- * @param {?} filePath
- * @return {?}
- */
- AotSummaryResolver.prototype._loadSummaryFile = /**
- * @param {?} filePath
- * @return {?}
- */
- function (filePath) {
- var _this = this;
- var /** @type {?} */ hasSummary = this.loadedFilePaths.get(filePath);
- if (hasSummary != null) {
- return hasSummary;
- }
- var /** @type {?} */ json = null;
- if (this.isLibraryFile(filePath)) {
- var /** @type {?} */ summaryFilePath = summaryFileName(filePath);
- try {
- json = this.host.loadSummary(summaryFilePath);
- }
- catch (/** @type {?} */ e) {
- console.error("Error loading summary file " + summaryFilePath);
- throw e;
- }
- }
- hasSummary = json != null;
- this.loadedFilePaths.set(filePath, hasSummary);
- if (json) {
- var _a = deserializeSummaries(this.staticSymbolCache, this, filePath, json), moduleName = _a.moduleName, summaries = _a.summaries, importAs = _a.importAs;
- summaries.forEach(function (summary) { return _this.summaryCache.set(summary.symbol, summary); });
- if (moduleName) {
- this.knownFileNameToModuleNames.set(filePath, moduleName);
- }
- importAs.forEach(function (importAs) { _this.importAs.set(importAs.symbol, importAs.importAs); });
- }
- return hasSummary;
- };
- return AotSummaryResolver;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} host
- * @return {?}
- */
- function createAotUrlResolver(host) {
- return {
- resolve: function (basePath, url) {
- var /** @type {?} */ filePath = host.resourceNameToFileName(url, basePath);
- if (!filePath) {
- throw syntaxError("Couldn't resolve resource " + url + " from " + basePath);
- }
- return filePath;
- }
- };
- }
- /**
- * Creates a new AotCompiler based on options and a host.
- * @param {?} compilerHost
- * @param {?} options
- * @param {?=} errorCollector
- * @return {?}
- */
- function createAotCompiler(compilerHost, options, errorCollector) {
- var /** @type {?} */ translations = options.translations || '';
- var /** @type {?} */ urlResolver = createAotUrlResolver(compilerHost);
- var /** @type {?} */ symbolCache = new StaticSymbolCache();
- var /** @type {?} */ summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);
- var /** @type {?} */ symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);
- var /** @type {?} */ staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);
- var /** @type {?} */ htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);
- var /** @type {?} */ config = new CompilerConfig({
- defaultEncapsulation: ViewEncapsulation.Emulated,
- useJit: false,
- enableLegacyTemplate: options.enableLegacyTemplate === true,
- missingTranslation: options.missingTranslation,
- preserveWhitespaces: options.preserveWhitespaces,
- strictInjectionParameters: options.strictInjectionParameters,
- });
- var /** @type {?} */ normalizer = new DirectiveNormalizer({ get: function (url) { return compilerHost.loadResource(url); } }, urlResolver, htmlParser, config);
- var /** @type {?} */ expressionParser = new Parser(new Lexer());
- var /** @type {?} */ elementSchemaRegistry = new DomElementSchemaRegistry();
- var /** @type {?} */ tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);
- var /** @type {?} */ resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);
- // TODO(vicb): do not pass options.i18nFormat here
- var /** @type {?} */ viewCompiler = new ViewCompiler(staticReflector);
- var /** @type {?} */ typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);
- var /** @type {?} */ compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new TypeScriptEmitter(), summaryResolver, symbolResolver);
- return { compiler: compiler, reflector: staticReflector };
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @record
- */
- /**
- * @abstract
- */
- var SummaryResolver = /** @class */ (function () {
- function SummaryResolver() {
- }
- return SummaryResolver;
- }());
- var JitSummaryResolver = /** @class */ (function () {
- function JitSummaryResolver() {
- this._summaries = new Map();
- }
- /**
- * @return {?}
- */
- JitSummaryResolver.prototype.isLibraryFile = /**
- * @return {?}
- */
- function () { return false; };
- /**
- * @param {?} fileName
- * @return {?}
- */
- JitSummaryResolver.prototype.toSummaryFileName = /**
- * @param {?} fileName
- * @return {?}
- */
- function (fileName) { return fileName; };
- /**
- * @param {?} fileName
- * @return {?}
- */
- JitSummaryResolver.prototype.fromSummaryFileName = /**
- * @param {?} fileName
- * @return {?}
- */
- function (fileName) { return fileName; };
- /**
- * @param {?} reference
- * @return {?}
- */
- JitSummaryResolver.prototype.resolveSummary = /**
- * @param {?} reference
- * @return {?}
- */
- function (reference) {
- return this._summaries.get(reference) || null;
- };
- /**
- * @return {?}
- */
- JitSummaryResolver.prototype.getSymbolsOf = /**
- * @return {?}
- */
- function () { return []; };
- /**
- * @param {?} reference
- * @return {?}
- */
- JitSummaryResolver.prototype.getImportAs = /**
- * @param {?} reference
- * @return {?}
- */
- function (reference) { return reference; };
- /**
- * @param {?} fileName
- * @return {?}
- */
- JitSummaryResolver.prototype.getKnownModuleName = /**
- * @param {?} fileName
- * @return {?}
- */
- function (fileName) { return null; };
- /**
- * @param {?} summary
- * @return {?}
- */
- JitSummaryResolver.prototype.addSummary = /**
- * @param {?} summary
- * @return {?}
- */
- function (summary) { this._summaries.set(summary.symbol, summary); };
- return JitSummaryResolver;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} statements
- * @param {?} reflector
- * @return {?}
- */
- function interpretStatements(statements, reflector) {
- var /** @type {?} */ ctx = new _ExecutionContext(null, null, null, new Map());
- var /** @type {?} */ visitor = new StatementInterpreter(reflector);
- visitor.visitAllStatements(statements, ctx);
- var /** @type {?} */ result = {};
- ctx.exports.forEach(function (exportName) { result[exportName] = ctx.vars.get(exportName); });
- return result;
- }
- /**
- * @param {?} varNames
- * @param {?} varValues
- * @param {?} statements
- * @param {?} ctx
- * @param {?} visitor
- * @return {?}
- */
- function _executeFunctionStatements(varNames, varValues, statements, ctx, visitor) {
- var /** @type {?} */ childCtx = ctx.createChildWihtLocalVars();
- for (var /** @type {?} */ i = 0; i < varNames.length; i++) {
- childCtx.vars.set(varNames[i], varValues[i]);
- }
- var /** @type {?} */ result = visitor.visitAllStatements(statements, childCtx);
- return result ? result.value : null;
- }
- var _ExecutionContext = /** @class */ (function () {
- function _ExecutionContext(parent, instance, className, vars) {
- this.parent = parent;
- this.instance = instance;
- this.className = className;
- this.vars = vars;
- this.exports = [];
- }
- /**
- * @return {?}
- */
- _ExecutionContext.prototype.createChildWihtLocalVars = /**
- * @return {?}
- */
- function () {
- return new _ExecutionContext(this, this.instance, this.className, new Map());
- };
- return _ExecutionContext;
- }());
- var ReturnValue = /** @class */ (function () {
- function ReturnValue(value) {
- this.value = value;
- }
- return ReturnValue;
- }());
- /**
- * @param {?} _classStmt
- * @param {?} _ctx
- * @param {?} _visitor
- * @return {?}
- */
- function createDynamicClass(_classStmt, _ctx, _visitor) {
- var /** @type {?} */ propertyDescriptors = {};
- _classStmt.getters.forEach(function (getter) {
- // Note: use `function` instead of arrow function to capture `this`
- propertyDescriptors[getter.name] = {
- configurable: false,
- get: function () {
- var /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
- return _executeFunctionStatements([], [], getter.body, instanceCtx, _visitor);
- }
- };
- });
- _classStmt.methods.forEach(function (method) {
- var /** @type {?} */ paramNames = method.params.map(function (param) { return param.name; });
- // Note: use `function` instead of arrow function to capture `this`
- propertyDescriptors[/** @type {?} */ ((method.name))] = {
- writable: false,
- configurable: false,
- value: function () {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
- return _executeFunctionStatements(paramNames, args, method.body, instanceCtx, _visitor);
- }
- };
- });
- var /** @type {?} */ ctorParamNames = _classStmt.constructorMethod.params.map(function (param) { return param.name; });
- // Note: use `function` instead of arrow function to capture `this`
- var /** @type {?} */ ctor = function () {
- var _this = this;
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- var /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
- _classStmt.fields.forEach(function (field) { _this[field.name] = undefined; });
- _executeFunctionStatements(ctorParamNames, args, _classStmt.constructorMethod.body, instanceCtx, _visitor);
- };
- var /** @type {?} */ superClass = _classStmt.parent ? _classStmt.parent.visitExpression(_visitor, _ctx) : Object;
- ctor.prototype = Object.create(superClass.prototype, propertyDescriptors);
- return ctor;
- }
- var StatementInterpreter = /** @class */ (function () {
- function StatementInterpreter(reflector) {
- this.reflector = reflector;
- }
- /**
- * @param {?} ast
- * @return {?}
- */
- StatementInterpreter.prototype.debugAst = /**
- * @param {?} ast
- * @return {?}
- */
- function (ast) { return debugOutputAstAsTypeScript(ast); };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitDeclareVarStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.vars.set(stmt.name, stmt.value.visitExpression(this, ctx));
- if (stmt.hasModifier(StmtModifier.Exported)) {
- ctx.exports.push(stmt.name);
- }
- return null;
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitWriteVarExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- var /** @type {?} */ value = expr.value.visitExpression(this, ctx);
- var /** @type {?} */ currCtx = ctx;
- while (currCtx != null) {
- if (currCtx.vars.has(expr.name)) {
- currCtx.vars.set(expr.name, value);
- return value;
- }
- currCtx = /** @type {?} */ ((currCtx.parent));
- }
- throw new Error("Not declared variable " + expr.name);
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitReadVarExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ varName = /** @type {?} */ ((ast.name));
- if (ast.builtin != null) {
- switch (ast.builtin) {
- case BuiltinVar.Super:
- return ctx.instance.__proto__;
- case BuiltinVar.This:
- return ctx.instance;
- case BuiltinVar.CatchError:
- varName = CATCH_ERROR_VAR$2;
- break;
- case BuiltinVar.CatchStack:
- varName = CATCH_STACK_VAR$2;
- break;
- default:
- throw new Error("Unknown builtin variable " + ast.builtin);
- }
- }
- var /** @type {?} */ currCtx = ctx;
- while (currCtx != null) {
- if (currCtx.vars.has(varName)) {
- return currCtx.vars.get(varName);
- }
- currCtx = /** @type {?} */ ((currCtx.parent));
- }
- throw new Error("Not declared variable " + varName);
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitWriteKeyExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- var /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx);
- var /** @type {?} */ index = expr.index.visitExpression(this, ctx);
- var /** @type {?} */ value = expr.value.visitExpression(this, ctx);
- receiver[index] = value;
- return value;
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitWritePropExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- var /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx);
- var /** @type {?} */ value = expr.value.visitExpression(this, ctx);
- receiver[expr.name] = value;
- return value;
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitInvokeMethodExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- var /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx);
- var /** @type {?} */ args = this.visitAllExpressions(expr.args, ctx);
- var /** @type {?} */ result;
- if (expr.builtin != null) {
- switch (expr.builtin) {
- case BuiltinMethod.ConcatArray:
- result = receiver.concat.apply(receiver, args);
- break;
- case BuiltinMethod.SubscribeObservable:
- result = receiver.subscribe({ next: args[0] });
- break;
- case BuiltinMethod.Bind:
- result = receiver.bind.apply(receiver, args);
- break;
- default:
- throw new Error("Unknown builtin method " + expr.builtin);
- }
- }
- else {
- result = receiver[/** @type {?} */ ((expr.name))].apply(receiver, args);
- }
- return result;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitInvokeFunctionExpr = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- var /** @type {?} */ args = this.visitAllExpressions(stmt.args, ctx);
- var /** @type {?} */ fnExpr = stmt.fn;
- if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) {
- ctx.instance.constructor.prototype.constructor.apply(ctx.instance, args);
- return null;
- }
- else {
- var /** @type {?} */ fn$$1 = stmt.fn.visitExpression(this, ctx);
- return fn$$1.apply(null, args);
- }
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitReturnStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- return new ReturnValue(stmt.value.visitExpression(this, ctx));
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitDeclareClassStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- var /** @type {?} */ clazz = createDynamicClass(stmt, ctx, this);
- ctx.vars.set(stmt.name, clazz);
- if (stmt.hasModifier(StmtModifier.Exported)) {
- ctx.exports.push(stmt.name);
- }
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitExpressionStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- return stmt.expr.visitExpression(this, ctx);
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitIfStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- var /** @type {?} */ condition = stmt.condition.visitExpression(this, ctx);
- if (condition) {
- return this.visitAllStatements(stmt.trueCase, ctx);
- }
- else if (stmt.falseCase != null) {
- return this.visitAllStatements(stmt.falseCase, ctx);
- }
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitTryCatchStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- try {
- return this.visitAllStatements(stmt.bodyStmts, ctx);
- }
- catch (/** @type {?} */ e) {
- var /** @type {?} */ childCtx = ctx.createChildWihtLocalVars();
- childCtx.vars.set(CATCH_ERROR_VAR$2, e);
- childCtx.vars.set(CATCH_STACK_VAR$2, e.stack);
- return this.visitAllStatements(stmt.catchStmts, childCtx);
- }
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitThrowStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- throw stmt.error.visitExpression(this, ctx);
- };
- /**
- * @param {?} stmt
- * @param {?=} context
- * @return {?}
- */
- StatementInterpreter.prototype.visitCommentStmt = /**
- * @param {?} stmt
- * @param {?=} context
- * @return {?}
- */
- function (stmt, context) { return null; };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitInstantiateExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ args = this.visitAllExpressions(ast.args, ctx);
- var /** @type {?} */ clazz = ast.classExpr.visitExpression(this, ctx);
- return new (clazz.bind.apply(clazz, [void 0].concat(args)))();
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitLiteralExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) { return ast.value; };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitExternalExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- return this.reflector.resolveExternalReference(ast.value);
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitConditionalExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- if (ast.condition.visitExpression(this, ctx)) {
- return ast.trueCase.visitExpression(this, ctx);
- }
- else if (ast.falseCase != null) {
- return ast.falseCase.visitExpression(this, ctx);
- }
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitNotExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- return !ast.condition.visitExpression(this, ctx);
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitAssertNotNullExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- return ast.condition.visitExpression(this, ctx);
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitCastExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- return ast.value.visitExpression(this, ctx);
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitFunctionExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ paramNames = ast.params.map(function (param) { return param.name; });
- return _declareFn(paramNames, ast.statements, ctx, this);
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitDeclareFunctionStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- var /** @type {?} */ paramNames = stmt.params.map(function (param) { return param.name; });
- ctx.vars.set(stmt.name, _declareFn(paramNames, stmt.statements, ctx, this));
- if (stmt.hasModifier(StmtModifier.Exported)) {
- ctx.exports.push(stmt.name);
- }
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitBinaryOperatorExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var _this = this;
- var /** @type {?} */ lhs = function () { return ast.lhs.visitExpression(_this, ctx); };
- var /** @type {?} */ rhs = function () { return ast.rhs.visitExpression(_this, ctx); };
- switch (ast.operator) {
- case BinaryOperator.Equals:
- return lhs() == rhs();
- case BinaryOperator.Identical:
- return lhs() === rhs();
- case BinaryOperator.NotEquals:
- return lhs() != rhs();
- case BinaryOperator.NotIdentical:
- return lhs() !== rhs();
- case BinaryOperator.And:
- return lhs() && rhs();
- case BinaryOperator.Or:
- return lhs() || rhs();
- case BinaryOperator.Plus:
- return lhs() + rhs();
- case BinaryOperator.Minus:
- return lhs() - rhs();
- case BinaryOperator.Divide:
- return lhs() / rhs();
- case BinaryOperator.Multiply:
- return lhs() * rhs();
- case BinaryOperator.Modulo:
- return lhs() % rhs();
- case BinaryOperator.Lower:
- return lhs() < rhs();
- case BinaryOperator.LowerEquals:
- return lhs() <= rhs();
- case BinaryOperator.Bigger:
- return lhs() > rhs();
- case BinaryOperator.BiggerEquals:
- return lhs() >= rhs();
- default:
- throw new Error("Unknown operator " + ast.operator);
- }
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitReadPropExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ result;
- var /** @type {?} */ receiver = ast.receiver.visitExpression(this, ctx);
- result = receiver[ast.name];
- return result;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitReadKeyExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ receiver = ast.receiver.visitExpression(this, ctx);
- var /** @type {?} */ prop = ast.index.visitExpression(this, ctx);
- return receiver[prop];
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitLiteralArrayExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- return this.visitAllExpressions(ast.entries, ctx);
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitLiteralMapExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var _this = this;
- var /** @type {?} */ result = {};
- ast.entries.forEach(function (entry) { return result[entry.key] = entry.value.visitExpression(_this, ctx); });
- return result;
- };
- /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- StatementInterpreter.prototype.visitCommaExpr = /**
- * @param {?} ast
- * @param {?} context
- * @return {?}
- */
- function (ast, context) {
- var /** @type {?} */ values = this.visitAllExpressions(ast.parts, context);
- return values[values.length - 1];
- };
- /**
- * @param {?} expressions
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitAllExpressions = /**
- * @param {?} expressions
- * @param {?} ctx
- * @return {?}
- */
- function (expressions, ctx) {
- var _this = this;
- return expressions.map(function (expr) { return expr.visitExpression(_this, ctx); });
- };
- /**
- * @param {?} statements
- * @param {?} ctx
- * @return {?}
- */
- StatementInterpreter.prototype.visitAllStatements = /**
- * @param {?} statements
- * @param {?} ctx
- * @return {?}
- */
- function (statements, ctx) {
- for (var /** @type {?} */ i = 0; i < statements.length; i++) {
- var /** @type {?} */ stmt = statements[i];
- var /** @type {?} */ val = stmt.visitStatement(this, ctx);
- if (val instanceof ReturnValue) {
- return val;
- }
- }
- return null;
- };
- return StatementInterpreter;
- }());
- /**
- * @param {?} varNames
- * @param {?} statements
- * @param {?} ctx
- * @param {?} visitor
- * @return {?}
- */
- function _declareFn(varNames, statements, ctx, visitor) {
- return function () {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- return _executeFunctionStatements(varNames, args, statements, ctx, visitor);
- };
- }
- var CATCH_ERROR_VAR$2 = 'error';
- var CATCH_STACK_VAR$2 = 'stack';
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @abstract
- */
- var AbstractJsEmitterVisitor = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(AbstractJsEmitterVisitor, _super);
- function AbstractJsEmitterVisitor() {
- return _super.call(this, false) || this;
- }
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype.visitDeclareClassStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- var _this = this;
- ctx.pushClass(stmt);
- this._visitClassConstructor(stmt, ctx);
- if (stmt.parent != null) {
- ctx.print(stmt, stmt.name + ".prototype = Object.create(");
- stmt.parent.visitExpression(this, ctx);
- ctx.println(stmt, ".prototype);");
- }
- stmt.getters.forEach(function (getter) { return _this._visitClassGetter(stmt, getter, ctx); });
- stmt.methods.forEach(function (method) { return _this._visitClassMethod(stmt, method, ctx); });
- ctx.popClass();
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype._visitClassConstructor = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.print(stmt, "function " + stmt.name + "(");
- if (stmt.constructorMethod != null) {
- this._visitParams(stmt.constructorMethod.params, ctx);
- }
- ctx.println(stmt, ") {");
- ctx.incIndent();
- if (stmt.constructorMethod != null) {
- if (stmt.constructorMethod.body.length > 0) {
- ctx.println(stmt, "var self = this;");
- this.visitAllStatements(stmt.constructorMethod.body, ctx);
- }
- }
- ctx.decIndent();
- ctx.println(stmt, "}");
- };
- /**
- * @param {?} stmt
- * @param {?} getter
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype._visitClassGetter = /**
- * @param {?} stmt
- * @param {?} getter
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, getter, ctx) {
- ctx.println(stmt, "Object.defineProperty(" + stmt.name + ".prototype, '" + getter.name + "', { get: function() {");
- ctx.incIndent();
- if (getter.body.length > 0) {
- ctx.println(stmt, "var self = this;");
- this.visitAllStatements(getter.body, ctx);
- }
- ctx.decIndent();
- ctx.println(stmt, "}});");
- };
- /**
- * @param {?} stmt
- * @param {?} method
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype._visitClassMethod = /**
- * @param {?} stmt
- * @param {?} method
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, method, ctx) {
- ctx.print(stmt, stmt.name + ".prototype." + method.name + " = function(");
- this._visitParams(method.params, ctx);
- ctx.println(stmt, ") {");
- ctx.incIndent();
- if (method.body.length > 0) {
- ctx.println(stmt, "var self = this;");
- this.visitAllStatements(method.body, ctx);
- }
- ctx.decIndent();
- ctx.println(stmt, "};");
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype.visitReadVarExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- if (ast.builtin === BuiltinVar.This) {
- ctx.print(ast, 'self');
- }
- else if (ast.builtin === BuiltinVar.Super) {
- throw new Error("'super' needs to be handled at a parent ast node, not at the variable level!");
- }
- else {
- _super.prototype.visitReadVarExpr.call(this, ast, ctx);
- }
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype.visitDeclareVarStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.print(stmt, "var " + stmt.name + " = ");
- stmt.value.visitExpression(this, ctx);
- ctx.println(stmt, ";");
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype.visitCastExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ast.value.visitExpression(this, ctx);
- return null;
- };
- /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype.visitInvokeFunctionExpr = /**
- * @param {?} expr
- * @param {?} ctx
- * @return {?}
- */
- function (expr, ctx) {
- var /** @type {?} */ fnExpr = expr.fn;
- if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) {
- /** @type {?} */ ((/** @type {?} */ ((ctx.currentClass)).parent)).visitExpression(this, ctx);
- ctx.print(expr, ".call(this");
- if (expr.args.length > 0) {
- ctx.print(expr, ", ");
- this.visitAllExpressions(expr.args, ctx, ',');
- }
- ctx.print(expr, ")");
- }
- else {
- _super.prototype.visitInvokeFunctionExpr.call(this, expr, ctx);
- }
- return null;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype.visitFunctionExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- ctx.print(ast, "function(");
- this._visitParams(ast.params, ctx);
- ctx.println(ast, ") {");
- ctx.incIndent();
- this.visitAllStatements(ast.statements, ctx);
- ctx.decIndent();
- ctx.print(ast, "}");
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype.visitDeclareFunctionStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.print(stmt, "function " + stmt.name + "(");
- this._visitParams(stmt.params, ctx);
- ctx.println(stmt, ") {");
- ctx.incIndent();
- this.visitAllStatements(stmt.statements, ctx);
- ctx.decIndent();
- ctx.println(stmt, "}");
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype.visitTryCatchStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- ctx.println(stmt, "try {");
- ctx.incIndent();
- this.visitAllStatements(stmt.bodyStmts, ctx);
- ctx.decIndent();
- ctx.println(stmt, "} catch (" + CATCH_ERROR_VAR$1.name + ") {");
- ctx.incIndent();
- var /** @type {?} */ catchStmts = [/** @type {?} */ (CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack')).toDeclStmt(null, [
- StmtModifier.Final
- ]))].concat(stmt.catchStmts);
- this.visitAllStatements(catchStmts, ctx);
- ctx.decIndent();
- ctx.println(stmt, "}");
- return null;
- };
- /**
- * @param {?} params
- * @param {?} ctx
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype._visitParams = /**
- * @param {?} params
- * @param {?} ctx
- * @return {?}
- */
- function (params, ctx) {
- this.visitAllObjects(function (param) { return ctx.print(null, param.name); }, params, ctx, ',');
- };
- /**
- * @param {?} method
- * @return {?}
- */
- AbstractJsEmitterVisitor.prototype.getBuiltinMethodName = /**
- * @param {?} method
- * @return {?}
- */
- function (method) {
- var /** @type {?} */ name;
- switch (method) {
- case BuiltinMethod.ConcatArray:
- name = 'concat';
- break;
- case BuiltinMethod.SubscribeObservable:
- name = 'subscribe';
- break;
- case BuiltinMethod.Bind:
- name = 'bind';
- break;
- default:
- throw new Error("Unknown builtin method: " + method);
- }
- return name;
- };
- return AbstractJsEmitterVisitor;
- }(AbstractEmitterVisitor));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} sourceUrl
- * @param {?} ctx
- * @param {?} vars
- * @param {?} createSourceMap
- * @return {?}
- */
- function evalExpression(sourceUrl, ctx, vars, createSourceMap) {
- var /** @type {?} */ fnBody = ctx.toSource() + "\n//# sourceURL=" + sourceUrl;
- var /** @type {?} */ fnArgNames = [];
- var /** @type {?} */ fnArgValues = [];
- for (var /** @type {?} */ argName in vars) {
- fnArgNames.push(argName);
- fnArgValues.push(vars[argName]);
- }
- if (createSourceMap) {
- // using `new Function(...)` generates a header, 1 line of no arguments, 2 lines otherwise
- // E.g. ```
- // function anonymous(a,b,c
- // /**/) { ... }```
- // We don't want to hard code this fact, so we auto detect it via an empty function first.
- var /** @type {?} */ emptyFn = new (Function.bind.apply(Function, [void 0].concat(fnArgNames.concat('return null;'))))().toString();
- var /** @type {?} */ headerLines = emptyFn.slice(0, emptyFn.indexOf('return null;')).split('\n').length - 1;
- fnBody += "\n" + ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment();
- }
- return new (Function.bind.apply(Function, [void 0].concat(fnArgNames.concat(fnBody))))().apply(void 0, fnArgValues);
- }
- /**
- * @param {?} sourceUrl
- * @param {?} statements
- * @param {?} reflector
- * @param {?} createSourceMaps
- * @return {?}
- */
- function jitStatements(sourceUrl, statements, reflector, createSourceMaps) {
- var /** @type {?} */ converter = new JitEmitterVisitor(reflector);
- var /** @type {?} */ ctx = EmitterVisitorContext.createRoot();
- converter.visitAllStatements(statements, ctx);
- converter.createReturnStmt(ctx);
- return evalExpression(sourceUrl, ctx, converter.getArgs(), createSourceMaps);
- }
- var JitEmitterVisitor = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(JitEmitterVisitor, _super);
- function JitEmitterVisitor(reflector) {
- var _this = _super.call(this) || this;
- _this.reflector = reflector;
- _this._evalArgNames = [];
- _this._evalArgValues = [];
- _this._evalExportedVars = [];
- return _this;
- }
- /**
- * @param {?} ctx
- * @return {?}
- */
- JitEmitterVisitor.prototype.createReturnStmt = /**
- * @param {?} ctx
- * @return {?}
- */
- function (ctx) {
- var /** @type {?} */ stmt = new ReturnStatement(new LiteralMapExpr(this._evalExportedVars.map(function (resultVar) { return new LiteralMapEntry(resultVar, variable(resultVar), false); })));
- stmt.visitStatement(this, ctx);
- };
- /**
- * @return {?}
- */
- JitEmitterVisitor.prototype.getArgs = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ result = {};
- for (var /** @type {?} */ i = 0; i < this._evalArgNames.length; i++) {
- result[this._evalArgNames[i]] = this._evalArgValues[i];
- }
- return result;
- };
- /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- JitEmitterVisitor.prototype.visitExternalExpr = /**
- * @param {?} ast
- * @param {?} ctx
- * @return {?}
- */
- function (ast, ctx) {
- var /** @type {?} */ value = this.reflector.resolveExternalReference(ast.value);
- var /** @type {?} */ id = this._evalArgValues.indexOf(value);
- if (id === -1) {
- id = this._evalArgValues.length;
- this._evalArgValues.push(value);
- var /** @type {?} */ name_1 = identifierName({ reference: value }) || 'val';
- this._evalArgNames.push("jit_" + name_1 + "_" + id);
- }
- ctx.print(ast, this._evalArgNames[id]);
- return null;
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- JitEmitterVisitor.prototype.visitDeclareVarStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- if (stmt.hasModifier(StmtModifier.Exported)) {
- this._evalExportedVars.push(stmt.name);
- }
- return _super.prototype.visitDeclareVarStmt.call(this, stmt, ctx);
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- JitEmitterVisitor.prototype.visitDeclareFunctionStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- if (stmt.hasModifier(StmtModifier.Exported)) {
- this._evalExportedVars.push(stmt.name);
- }
- return _super.prototype.visitDeclareFunctionStmt.call(this, stmt, ctx);
- };
- /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- JitEmitterVisitor.prototype.visitDeclareClassStmt = /**
- * @param {?} stmt
- * @param {?} ctx
- * @return {?}
- */
- function (stmt, ctx) {
- if (stmt.hasModifier(StmtModifier.Exported)) {
- this._evalExportedVars.push(stmt.name);
- }
- return _super.prototype.visitDeclareClassStmt.call(this, stmt, ctx);
- };
- return JitEmitterVisitor;
- }(AbstractJsEmitterVisitor));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @record
- */
- /**
- * An internal module of the Angular compiler that begins with component types,
- * extracts templates, and eventually produces a compiled version of the component
- * ready for linking into an application.
- *
- * \@security When compiling templates at runtime, you must ensure that the entire template comes
- * from a trusted source. Attacker-controlled data introduced by a template could expose your
- * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
- */
- var JitCompiler = /** @class */ (function () {
- function JitCompiler(_metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _ngModuleCompiler, _summaryResolver, _reflector, _compilerConfig, _console, getExtraNgModuleProviders) {
- this._metadataResolver = _metadataResolver;
- this._templateParser = _templateParser;
- this._styleCompiler = _styleCompiler;
- this._viewCompiler = _viewCompiler;
- this._ngModuleCompiler = _ngModuleCompiler;
- this._summaryResolver = _summaryResolver;
- this._reflector = _reflector;
- this._compilerConfig = _compilerConfig;
- this._console = _console;
- this.getExtraNgModuleProviders = getExtraNgModuleProviders;
- this._compiledTemplateCache = new Map();
- this._compiledHostTemplateCache = new Map();
- this._compiledDirectiveWrapperCache = new Map();
- this._compiledNgModuleCache = new Map();
- this._sharedStylesheetCount = 0;
- this._addedAotSummaries = new Set();
- }
- /**
- * @param {?} moduleType
- * @return {?}
- */
- JitCompiler.prototype.compileModuleSync = /**
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- return SyncAsync.assertSync(this._compileModuleAndComponents(moduleType, true));
- };
- /**
- * @param {?} moduleType
- * @return {?}
- */
- JitCompiler.prototype.compileModuleAsync = /**
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- return Promise.resolve(this._compileModuleAndComponents(moduleType, false));
- };
- /**
- * @param {?} moduleType
- * @return {?}
- */
- JitCompiler.prototype.compileModuleAndAllComponentsSync = /**
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- return SyncAsync.assertSync(this._compileModuleAndAllComponents(moduleType, true));
- };
- /**
- * @param {?} moduleType
- * @return {?}
- */
- JitCompiler.prototype.compileModuleAndAllComponentsAsync = /**
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- return Promise.resolve(this._compileModuleAndAllComponents(moduleType, false));
- };
- /**
- * @param {?} component
- * @return {?}
- */
- JitCompiler.prototype.getComponentFactory = /**
- * @param {?} component
- * @return {?}
- */
- function (component) {
- var /** @type {?} */ summary = this._metadataResolver.getDirectiveSummary(component);
- return /** @type {?} */ (summary.componentFactory);
- };
- /**
- * @param {?} summaries
- * @return {?}
- */
- JitCompiler.prototype.loadAotSummaries = /**
- * @param {?} summaries
- * @return {?}
- */
- function (summaries) {
- this.clearCache();
- this._addAotSummaries(summaries);
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- JitCompiler.prototype._addAotSummaries = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn$$1) {
- if (this._addedAotSummaries.has(fn$$1)) {
- return;
- }
- this._addedAotSummaries.add(fn$$1);
- var /** @type {?} */ summaries = fn$$1();
- for (var /** @type {?} */ i = 0; i < summaries.length; i++) {
- var /** @type {?} */ entry = summaries[i];
- if (typeof entry === 'function') {
- this._addAotSummaries(entry);
- }
- else {
- var /** @type {?} */ summary = /** @type {?} */ (entry);
- this._summaryResolver.addSummary({ symbol: summary.type.reference, metadata: null, type: summary });
- }
- }
- };
- /**
- * @param {?} ref
- * @return {?}
- */
- JitCompiler.prototype.hasAotSummary = /**
- * @param {?} ref
- * @return {?}
- */
- function (ref) { return !!this._summaryResolver.resolveSummary(ref); };
- /**
- * @param {?} ids
- * @return {?}
- */
- JitCompiler.prototype._filterJitIdentifiers = /**
- * @param {?} ids
- * @return {?}
- */
- function (ids) {
- var _this = this;
- return ids.map(function (mod) { return mod.reference; }).filter(function (ref) { return !_this.hasAotSummary(ref); });
- };
- /**
- * @param {?} moduleType
- * @param {?} isSync
- * @return {?}
- */
- JitCompiler.prototype._compileModuleAndComponents = /**
- * @param {?} moduleType
- * @param {?} isSync
- * @return {?}
- */
- function (moduleType, isSync) {
- var _this = this;
- return SyncAsync.then(this._loadModules(moduleType, isSync), function () {
- _this._compileComponents(moduleType, null);
- return _this._compileModule(moduleType);
- });
- };
- /**
- * @param {?} moduleType
- * @param {?} isSync
- * @return {?}
- */
- JitCompiler.prototype._compileModuleAndAllComponents = /**
- * @param {?} moduleType
- * @param {?} isSync
- * @return {?}
- */
- function (moduleType, isSync) {
- var _this = this;
- return SyncAsync.then(this._loadModules(moduleType, isSync), function () {
- var /** @type {?} */ componentFactories = [];
- _this._compileComponents(moduleType, componentFactories);
- return {
- ngModuleFactory: _this._compileModule(moduleType),
- componentFactories: componentFactories
- };
- });
- };
- /**
- * @param {?} mainModule
- * @param {?} isSync
- * @return {?}
- */
- JitCompiler.prototype._loadModules = /**
- * @param {?} mainModule
- * @param {?} isSync
- * @return {?}
- */
- function (mainModule, isSync) {
- var _this = this;
- var /** @type {?} */ loading = [];
- var /** @type {?} */ mainNgModule = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(mainModule)));
- // Note: for runtime compilation, we want to transitively compile all modules,
- // so we also need to load the declared directives / pipes for all nested modules.
- this._filterJitIdentifiers(mainNgModule.transitiveModule.modules).forEach(function (nestedNgModule) {
- // getNgModuleMetadata only returns null if the value passed in is not an NgModule
- var /** @type {?} */ moduleMeta = /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(nestedNgModule)));
- _this._filterJitIdentifiers(moduleMeta.declaredDirectives).forEach(function (ref) {
- var /** @type {?} */ promise = _this._metadataResolver.loadDirectiveMetadata(moduleMeta.type.reference, ref, isSync);
- if (promise) {
- loading.push(promise);
- }
- });
- _this._filterJitIdentifiers(moduleMeta.declaredPipes)
- .forEach(function (ref) { return _this._metadataResolver.getOrLoadPipeMetadata(ref); });
- });
- return SyncAsync.all(loading);
- };
- /**
- * @param {?} moduleType
- * @return {?}
- */
- JitCompiler.prototype._compileModule = /**
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- var /** @type {?} */ ngModuleFactory = /** @type {?} */ ((this._compiledNgModuleCache.get(moduleType)));
- if (!ngModuleFactory) {
- var /** @type {?} */ moduleMeta = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(moduleType)));
- // Always provide a bound Compiler
- var /** @type {?} */ extraProviders = this.getExtraNgModuleProviders(moduleMeta.type.reference);
- var /** @type {?} */ outputCtx = createOutputContext();
- var /** @type {?} */ compileResult = this._ngModuleCompiler.compile(outputCtx, moduleMeta, extraProviders);
- ngModuleFactory = this._interpretOrJit(ngModuleJitUrl(moduleMeta), outputCtx.statements)[compileResult.ngModuleFactoryVar];
- this._compiledNgModuleCache.set(moduleMeta.type.reference, ngModuleFactory);
- }
- return ngModuleFactory;
- };
- /**
- * @internal
- */
- /**
- * \@internal
- * @param {?} mainModule
- * @param {?} allComponentFactories
- * @return {?}
- */
- JitCompiler.prototype._compileComponents = /**
- * \@internal
- * @param {?} mainModule
- * @param {?} allComponentFactories
- * @return {?}
- */
- function (mainModule, allComponentFactories) {
- var _this = this;
- var /** @type {?} */ ngModule = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(mainModule)));
- var /** @type {?} */ moduleByJitDirective = new Map();
- var /** @type {?} */ templates = new Set();
- var /** @type {?} */ transJitModules = this._filterJitIdentifiers(ngModule.transitiveModule.modules);
- transJitModules.forEach(function (localMod) {
- var /** @type {?} */ localModuleMeta = /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(localMod)));
- _this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) {
- moduleByJitDirective.set(dirRef, localModuleMeta);
- var /** @type {?} */ dirMeta = _this._metadataResolver.getDirectiveMetadata(dirRef);
- if (dirMeta.isComponent) {
- templates.add(_this._createCompiledTemplate(dirMeta, localModuleMeta));
- if (allComponentFactories) {
- var /** @type {?} */ template = _this._createCompiledHostTemplate(dirMeta.type.reference, localModuleMeta);
- templates.add(template);
- allComponentFactories.push(/** @type {?} */ (dirMeta.componentFactory));
- }
- }
- });
- });
- transJitModules.forEach(function (localMod) {
- var /** @type {?} */ localModuleMeta = /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(localMod)));
- _this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) {
- var /** @type {?} */ dirMeta = _this._metadataResolver.getDirectiveMetadata(dirRef);
- if (dirMeta.isComponent) {
- dirMeta.entryComponents.forEach(function (entryComponentType) {
- var /** @type {?} */ moduleMeta = /** @type {?} */ ((moduleByJitDirective.get(entryComponentType.componentType)));
- templates.add(_this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
- });
- }
- });
- localModuleMeta.entryComponents.forEach(function (entryComponentType) {
- if (!_this.hasAotSummary(entryComponentType.componentType.reference)) {
- var /** @type {?} */ moduleMeta = /** @type {?} */ ((moduleByJitDirective.get(entryComponentType.componentType)));
- templates.add(_this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
- }
- });
- });
- templates.forEach(function (template) { return _this._compileTemplate(template); });
- };
- /**
- * @param {?} type
- * @return {?}
- */
- JitCompiler.prototype.clearCacheFor = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- this._compiledNgModuleCache.delete(type);
- this._metadataResolver.clearCacheFor(type);
- this._compiledHostTemplateCache.delete(type);
- var /** @type {?} */ compiledTemplate = this._compiledTemplateCache.get(type);
- if (compiledTemplate) {
- this._compiledTemplateCache.delete(type);
- }
- };
- /**
- * @return {?}
- */
- JitCompiler.prototype.clearCache = /**
- * @return {?}
- */
- function () {
- // Note: don't clear the _addedAotSummaries, as they don't change!
- this._metadataResolver.clearCache();
- this._compiledTemplateCache.clear();
- this._compiledHostTemplateCache.clear();
- this._compiledNgModuleCache.clear();
- };
- /**
- * @param {?} compType
- * @param {?} ngModule
- * @return {?}
- */
- JitCompiler.prototype._createCompiledHostTemplate = /**
- * @param {?} compType
- * @param {?} ngModule
- * @return {?}
- */
- function (compType, ngModule) {
- if (!ngModule) {
- throw new Error("Component " + stringify(compType) + " is not part of any NgModule or the module has not been imported into your module.");
- }
- var /** @type {?} */ compiledTemplate = this._compiledHostTemplateCache.get(compType);
- if (!compiledTemplate) {
- var /** @type {?} */ compMeta = this._metadataResolver.getDirectiveMetadata(compType);
- assertComponent(compMeta);
- var /** @type {?} */ hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta, (/** @type {?} */ (compMeta.componentFactory)).viewDefFactory);
- compiledTemplate =
- new CompiledTemplate(true, compMeta.type, hostMeta, ngModule, [compMeta.type]);
- this._compiledHostTemplateCache.set(compType, compiledTemplate);
- }
- return compiledTemplate;
- };
- /**
- * @param {?} compMeta
- * @param {?} ngModule
- * @return {?}
- */
- JitCompiler.prototype._createCompiledTemplate = /**
- * @param {?} compMeta
- * @param {?} ngModule
- * @return {?}
- */
- function (compMeta, ngModule) {
- var /** @type {?} */ compiledTemplate = this._compiledTemplateCache.get(compMeta.type.reference);
- if (!compiledTemplate) {
- assertComponent(compMeta);
- compiledTemplate = new CompiledTemplate(false, compMeta.type, compMeta, ngModule, ngModule.transitiveModule.directives);
- this._compiledTemplateCache.set(compMeta.type.reference, compiledTemplate);
- }
- return compiledTemplate;
- };
- /**
- * @param {?} template
- * @return {?}
- */
- JitCompiler.prototype._compileTemplate = /**
- * @param {?} template
- * @return {?}
- */
- function (template) {
- var _this = this;
- if (template.isCompiled) {
- return;
- }
- var /** @type {?} */ compMeta = template.compMeta;
- var /** @type {?} */ externalStylesheetsByModuleUrl = new Map();
- var /** @type {?} */ outputContext = createOutputContext();
- var /** @type {?} */ componentStylesheet = this._styleCompiler.compileComponent(outputContext, compMeta); /** @type {?} */
- ((compMeta.template)).externalStylesheets.forEach(function (stylesheetMeta) {
- var /** @type {?} */ compiledStylesheet = _this._styleCompiler.compileStyles(createOutputContext(), compMeta, stylesheetMeta);
- externalStylesheetsByModuleUrl.set(/** @type {?} */ ((stylesheetMeta.moduleUrl)), compiledStylesheet);
- });
- this._resolveStylesCompileResult(componentStylesheet, externalStylesheetsByModuleUrl);
- var /** @type {?} */ pipes = template.ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
- var _a = this._parseTemplate(compMeta, template.ngModule, template.directives), parsedTemplate = _a.template, usedPipes = _a.pipes;
- var /** @type {?} */ compileResult = this._viewCompiler.compileComponent(outputContext, compMeta, parsedTemplate, variable(componentStylesheet.stylesVar), usedPipes);
- var /** @type {?} */ evalResult = this._interpretOrJit(templateJitUrl(template.ngModule.type, template.compMeta), outputContext.statements);
- var /** @type {?} */ viewClass = evalResult[compileResult.viewClassVar];
- var /** @type {?} */ rendererType = evalResult[compileResult.rendererTypeVar];
- template.compiled(viewClass, rendererType);
- };
- /**
- * @param {?} compMeta
- * @param {?} ngModule
- * @param {?} directiveIdentifiers
- * @return {?}
- */
- JitCompiler.prototype._parseTemplate = /**
- * @param {?} compMeta
- * @param {?} ngModule
- * @param {?} directiveIdentifiers
- * @return {?}
- */
- function (compMeta, ngModule, directiveIdentifiers) {
- var _this = this;
- // Note: ! is ok here as components always have a template.
- var /** @type {?} */ preserveWhitespaces = /** @type {?} */ ((compMeta.template)).preserveWhitespaces;
- var /** @type {?} */ directives = directiveIdentifiers.map(function (dir) { return _this._metadataResolver.getDirectiveSummary(dir.reference); });
- var /** @type {?} */ pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
- return this._templateParser.parse(compMeta, /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).htmlAst)), directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, /** @type {?} */ ((compMeta.template))), preserveWhitespaces);
- };
- /**
- * @param {?} result
- * @param {?} externalStylesheetsByModuleUrl
- * @return {?}
- */
- JitCompiler.prototype._resolveStylesCompileResult = /**
- * @param {?} result
- * @param {?} externalStylesheetsByModuleUrl
- * @return {?}
- */
- function (result, externalStylesheetsByModuleUrl) {
- var _this = this;
- result.dependencies.forEach(function (dep, i) {
- var /** @type {?} */ nestedCompileResult = /** @type {?} */ ((externalStylesheetsByModuleUrl.get(dep.moduleUrl)));
- var /** @type {?} */ nestedStylesArr = _this._resolveAndEvalStylesCompileResult(nestedCompileResult, externalStylesheetsByModuleUrl);
- dep.setValue(nestedStylesArr);
- });
- };
- /**
- * @param {?} result
- * @param {?} externalStylesheetsByModuleUrl
- * @return {?}
- */
- JitCompiler.prototype._resolveAndEvalStylesCompileResult = /**
- * @param {?} result
- * @param {?} externalStylesheetsByModuleUrl
- * @return {?}
- */
- function (result, externalStylesheetsByModuleUrl) {
- this._resolveStylesCompileResult(result, externalStylesheetsByModuleUrl);
- return this._interpretOrJit(sharedStylesheetJitUrl(result.meta, this._sharedStylesheetCount++), result.outputCtx.statements)[result.stylesVar];
- };
- /**
- * @param {?} sourceUrl
- * @param {?} statements
- * @return {?}
- */
- JitCompiler.prototype._interpretOrJit = /**
- * @param {?} sourceUrl
- * @param {?} statements
- * @return {?}
- */
- function (sourceUrl, statements) {
- if (!this._compilerConfig.useJit) {
- return interpretStatements(statements, this._reflector);
- }
- else {
- return jitStatements(sourceUrl, statements, this._reflector, this._compilerConfig.jitDevMode);
- }
- };
- return JitCompiler;
- }());
- var CompiledTemplate = /** @class */ (function () {
- function CompiledTemplate(isHost, compType, compMeta, ngModule, directives) {
- this.isHost = isHost;
- this.compType = compType;
- this.compMeta = compMeta;
- this.ngModule = ngModule;
- this.directives = directives;
- this._viewClass = /** @type {?} */ ((null));
- this.isCompiled = false;
- }
- /**
- * @param {?} viewClass
- * @param {?} rendererType
- * @return {?}
- */
- CompiledTemplate.prototype.compiled = /**
- * @param {?} viewClass
- * @param {?} rendererType
- * @return {?}
- */
- function (viewClass, rendererType) {
- this._viewClass = viewClass;
- (/** @type {?} */ (this.compMeta.componentViewType)).setDelegate(viewClass);
- for (var /** @type {?} */ prop in rendererType) {
- (/** @type {?} */ (this.compMeta.rendererType))[prop] = rendererType[prop];
- }
- this.isCompiled = true;
- };
- return CompiledTemplate;
- }());
- /**
- * @param {?} meta
- * @return {?}
- */
- function assertComponent(meta) {
- if (!meta.isComponent) {
- throw new Error("Could not compile '" + identifierName(meta.type) + "' because it is not a component.");
- }
- }
- /**
- * @return {?}
- */
- function createOutputContext() {
- var /** @type {?} */ importExpr$$1 = function (symbol) {
- return importExpr({ name: identifierName(symbol), moduleName: null, runtime: symbol });
- };
- return { statements: [], genFilePath: '', importExpr: importExpr$$1 };
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Provides access to reflection data about symbols that the compiler needs.
- * @abstract
- */
- var CompileReflector = /** @class */ (function () {
- function CompileReflector() {
- }
- return CompileReflector;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Create a {\@link UrlResolver} with no package prefix.
- * @return {?}
- */
- function createUrlResolverWithoutPackagePrefix() {
- return new UrlResolver();
- }
- /**
- * @return {?}
- */
- function createOfflineCompileUrlResolver() {
- return new UrlResolver('.');
- }
- /**
- * @record
- */
- var UrlResolver = /** @class */ (function () {
- function UrlResolverImpl(_packagePrefix) {
- if (_packagePrefix === void 0) { _packagePrefix = null; }
- this._packagePrefix = _packagePrefix;
- }
- /**
- * Resolves the `url` given the `baseUrl`:
- * - when the `url` is null, the `baseUrl` is returned,
- * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
- * `baseUrl` and `url`,
- * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
- * returned as is (ignoring the `baseUrl`)
- */
- /**
- * Resolves the `url` given the `baseUrl`:
- * - when the `url` is null, the `baseUrl` is returned,
- * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
- * `baseUrl` and `url`,
- * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
- * returned as is (ignoring the `baseUrl`)
- * @param {?} baseUrl
- * @param {?} url
- * @return {?}
- */
- UrlResolverImpl.prototype.resolve = /**
- * Resolves the `url` given the `baseUrl`:
- * - when the `url` is null, the `baseUrl` is returned,
- * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
- * `baseUrl` and `url`,
- * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
- * returned as is (ignoring the `baseUrl`)
- * @param {?} baseUrl
- * @param {?} url
- * @return {?}
- */
- function (baseUrl, url) {
- var /** @type {?} */ resolvedUrl = url;
- if (baseUrl != null && baseUrl.length > 0) {
- resolvedUrl = _resolveUrl(baseUrl, resolvedUrl);
- }
- var /** @type {?} */ resolvedParts = _split(resolvedUrl);
- var /** @type {?} */ prefix = this._packagePrefix;
- if (prefix != null && resolvedParts != null &&
- resolvedParts[_ComponentIndex.Scheme] == 'package') {
- var /** @type {?} */ path = resolvedParts[_ComponentIndex.Path];
- prefix = prefix.replace(/\/+$/, '');
- path = path.replace(/^\/+/, '');
- return prefix + "/" + path;
- }
- return resolvedUrl;
- };
- return UrlResolverImpl;
- }());
- /**
- * Extract the scheme of a URL.
- * @param {?} url
- * @return {?}
- */
- function getUrlScheme(url) {
- var /** @type {?} */ match = _split(url);
- return (match && match[_ComponentIndex.Scheme]) || '';
- }
- /**
- * Builds a URI string from already-encoded parts.
- *
- * No encoding is performed. Any component may be omitted as either null or
- * undefined.
- *
- * @param {?=} opt_scheme The scheme such as 'http'.
- * @param {?=} opt_userInfo The user name before the '\@'.
- * @param {?=} opt_domain The domain such as 'www.google.com', already
- * URI-encoded.
- * @param {?=} opt_port The port number.
- * @param {?=} opt_path The path, already URI-encoded. If it is not
- * empty, it must begin with a slash.
- * @param {?=} opt_queryData The URI-encoded query data.
- * @param {?=} opt_fragment The URI-encoded fragment identifier.
- * @return {?} The fully combined URI.
- */
- function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
- var /** @type {?} */ out = [];
- if (opt_scheme != null) {
- out.push(opt_scheme + ':');
- }
- if (opt_domain != null) {
- out.push('//');
- if (opt_userInfo != null) {
- out.push(opt_userInfo + '@');
- }
- out.push(opt_domain);
- if (opt_port != null) {
- out.push(':' + opt_port);
- }
- }
- if (opt_path != null) {
- out.push(opt_path);
- }
- if (opt_queryData != null) {
- out.push('?' + opt_queryData);
- }
- if (opt_fragment != null) {
- out.push('#' + opt_fragment);
- }
- return out.join('');
- }
- /**
- * A regular expression for breaking a URI into its component parts.
- *
- * {\@link http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#RFC2234} says
- * As the "first-match-wins" algorithm is identical to the "greedy"
- * disambiguation method used by POSIX regular expressions, it is natural and
- * commonplace to use a regular expression for parsing the potential five
- * components of a URI reference.
- *
- * The following line is the regular expression for breaking-down a
- * well-formed URI reference into its components.
- *
- * <pre>
- * ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
- * 12 3 4 5 6 7 8 9
- * </pre>
- *
- * The numbers in the second line above are only to assist readability; they
- * indicate the reference points for each subexpression (i.e., each paired
- * parenthesis). We refer to the value matched for subexpression <n> as $<n>.
- * For example, matching the above expression to
- * <pre>
- * http://www.ics.uci.edu/pub/ietf/uri/#Related
- * </pre>
- * results in the following subexpression matches:
- * <pre>
- * $1 = http:
- * $2 = http
- * $3 = //www.ics.uci.edu
- * $4 = www.ics.uci.edu
- * $5 = /pub/ietf/uri/
- * $6 = <undefined>
- * $7 = <undefined>
- * $8 = #Related
- * $9 = Related
- * </pre>
- * where <undefined> indicates that the component is not present, as is the
- * case for the query component in the above example. Therefore, we can
- * determine the value of the five components as
- * <pre>
- * scheme = $2
- * authority = $4
- * path = $5
- * query = $7
- * fragment = $9
- * </pre>
- *
- * The regular expression has been modified slightly to expose the
- * userInfo, domain, and port separately from the authority.
- * The modified version yields
- * <pre>
- * $1 = http scheme
- * $2 = <undefined> userInfo -\
- * $3 = www.ics.uci.edu domain | authority
- * $4 = <undefined> port -/
- * $5 = /pub/ietf/uri/ path
- * $6 = <undefined> query without ?
- * $7 = Related fragment without #
- * </pre>
- * \@internal
- */
- var _splitRe = new RegExp('^' +
- '(?:' +
- '([^:/?#.]+)' + // scheme - ignore special characters
- ':)?' +
- '(?://' +
- '(?:([^/?#]*)@)?' + // userInfo
- '([\\w\\d\\-\\u0100-\\uffff.%]*)' + // domain - restrict to letters,
- '(?::([0-9]+))?' + // port
- ')?' +
- '([^?#]+)?' + // path
- '(?:\\?([^#]*))?' + // query
- '(?:#(.*))?' + // fragment
- '$');
- /** @enum {number} */
- var _ComponentIndex = {
- Scheme: 1,
- UserInfo: 2,
- Domain: 3,
- Port: 4,
- Path: 5,
- QueryData: 6,
- Fragment: 7,
- };
- _ComponentIndex[_ComponentIndex.Scheme] = "Scheme";
- _ComponentIndex[_ComponentIndex.UserInfo] = "UserInfo";
- _ComponentIndex[_ComponentIndex.Domain] = "Domain";
- _ComponentIndex[_ComponentIndex.Port] = "Port";
- _ComponentIndex[_ComponentIndex.Path] = "Path";
- _ComponentIndex[_ComponentIndex.QueryData] = "QueryData";
- _ComponentIndex[_ComponentIndex.Fragment] = "Fragment";
- /**
- * Splits a URI into its component parts.
- *
- * Each component can be accessed via the component indices; for example:
- * <pre>
- * goog.uri.utils.split(someStr)[goog.uri.utils.CompontentIndex.QUERY_DATA];
- * </pre>
- *
- * @param {?} uri The URI string to examine.
- * @return {?} Each component still URI-encoded.
- * Each component that is present will contain the encoded value, whereas
- * components that are not present will be undefined or empty, depending
- * on the browser's regular expression implementation. Never null, since
- * arbitrary strings may still look like path names.
- */
- function _split(uri) {
- return /** @type {?} */ ((uri.match(_splitRe)));
- }
- /**
- * Removes dot segments in given path component, as described in
- * RFC 3986, section 5.2.4.
- *
- * @param {?} path A non-empty path component.
- * @return {?} Path component with removed dot segments.
- */
- function _removeDotSegments(path) {
- if (path == '/')
- return '/';
- var /** @type {?} */ leadingSlash = path[0] == '/' ? '/' : '';
- var /** @type {?} */ trailingSlash = path[path.length - 1] === '/' ? '/' : '';
- var /** @type {?} */ segments = path.split('/');
- var /** @type {?} */ out = [];
- var /** @type {?} */ up = 0;
- for (var /** @type {?} */ pos = 0; pos < segments.length; pos++) {
- var /** @type {?} */ segment = segments[pos];
- switch (segment) {
- case '':
- case '.':
- break;
- case '..':
- if (out.length > 0) {
- out.pop();
- }
- else {
- up++;
- }
- break;
- default:
- out.push(segment);
- }
- }
- if (leadingSlash == '') {
- while (up-- > 0) {
- out.unshift('..');
- }
- if (out.length === 0)
- out.push('.');
- }
- return leadingSlash + out.join('/') + trailingSlash;
- }
- /**
- * Takes an array of the parts from split and canonicalizes the path part
- * and then joins all the parts.
- * @param {?} parts
- * @return {?}
- */
- function _joinAndCanonicalizePath(parts) {
- var /** @type {?} */ path = parts[_ComponentIndex.Path];
- path = path == null ? '' : _removeDotSegments(path);
- parts[_ComponentIndex.Path] = path;
- return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);
- }
- /**
- * Resolves a URL.
- * @param {?} base The URL acting as the base URL.
- * @param {?} url
- * @return {?}
- */
- function _resolveUrl(base, url) {
- var /** @type {?} */ parts = _split(encodeURI(url));
- var /** @type {?} */ baseParts = _split(base);
- if (parts[_ComponentIndex.Scheme] != null) {
- return _joinAndCanonicalizePath(parts);
- }
- else {
- parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme];
- }
- for (var /** @type {?} */ i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) {
- if (parts[i] == null) {
- parts[i] = baseParts[i];
- }
- }
- if (parts[_ComponentIndex.Path][0] == '/') {
- return _joinAndCanonicalizePath(parts);
- }
- var /** @type {?} */ path = baseParts[_ComponentIndex.Path];
- if (path == null)
- path = '/';
- var /** @type {?} */ index = path.lastIndexOf('/');
- path = path.substring(0, index + 1) + parts[_ComponentIndex.Path];
- parts[_ComponentIndex.Path] = path;
- return _joinAndCanonicalizePath(parts);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An interface for retrieving documents by URL that the compiler uses
- * to load templates.
- */
- var ResourceLoader = /** @class */ (function () {
- function ResourceLoader() {
- }
- /**
- * @param {?} url
- * @return {?}
- */
- ResourceLoader.prototype.get = /**
- * @param {?} url
- * @return {?}
- */
- function (url) { return ''; };
- return ResourceLoader;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * The host of the Extractor disconnects the implementation from TypeScript / other language
- * services and from underlying file systems.
- * @record
- */
- var Extractor = /** @class */ (function () {
- function Extractor(host, staticSymbolResolver, messageBundle, metadataResolver) {
- this.host = host;
- this.staticSymbolResolver = staticSymbolResolver;
- this.messageBundle = messageBundle;
- this.metadataResolver = metadataResolver;
- }
- /**
- * @param {?} rootFiles
- * @return {?}
- */
- Extractor.prototype.extract = /**
- * @param {?} rootFiles
- * @return {?}
- */
- function (rootFiles) {
- var _this = this;
- var _a = analyzeAndValidateNgModules(rootFiles, this.host, this.staticSymbolResolver, this.metadataResolver), files = _a.files, ngModules = _a.ngModules;
- return Promise
- .all(ngModules.map(function (ngModule) {
- return _this.metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false);
- }))
- .then(function () {
- var /** @type {?} */ errors = [];
- files.forEach(function (file) {
- var /** @type {?} */ compMetas = [];
- file.directives.forEach(function (directiveType) {
- var /** @type {?} */ dirMeta = _this.metadataResolver.getDirectiveMetadata(directiveType);
- if (dirMeta && dirMeta.isComponent) {
- compMetas.push(dirMeta);
- }
- });
- compMetas.forEach(function (compMeta) {
- var /** @type {?} */ html = /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).template));
- var /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((compMeta.template)).interpolation);
- errors.push.apply(errors, /** @type {?} */ ((_this.messageBundle.updateFromTemplate(html, file.fileName, interpolationConfig))));
- });
- });
- if (errors.length) {
- throw new Error(errors.map(function (e) { return e.toString(); }).join('\n'));
- }
- return _this.messageBundle;
- });
- };
- /**
- * @param {?} host
- * @param {?} locale
- * @return {?}
- */
- Extractor.create = /**
- * @param {?} host
- * @param {?} locale
- * @return {?}
- */
- function (host, locale) {
- var /** @type {?} */ htmlParser = new HtmlParser();
- var /** @type {?} */ urlResolver = createAotUrlResolver(host);
- var /** @type {?} */ symbolCache = new StaticSymbolCache();
- var /** @type {?} */ summaryResolver = new AotSummaryResolver(host, symbolCache);
- var /** @type {?} */ staticSymbolResolver = new StaticSymbolResolver(host, symbolCache, summaryResolver);
- var /** @type {?} */ staticReflector = new StaticReflector(summaryResolver, staticSymbolResolver);
- var /** @type {?} */ config = new CompilerConfig({ defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false });
- var /** @type {?} */ normalizer = new DirectiveNormalizer({ get: function (url) { return host.loadResource(url); } }, urlResolver, htmlParser, config);
- var /** @type {?} */ elementSchemaRegistry = new DomElementSchemaRegistry();
- var /** @type {?} */ resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector);
- // TODO(vicb): implicit tags & attributes
- var /** @type {?} */ messageBundle = new MessageBundle(htmlParser, [], {}, locale);
- var /** @type {?} */ extractor = new Extractor(host, staticSymbolResolver, messageBundle, resolver);
- return { extractor: extractor, staticReflector: staticReflector };
- };
- return Extractor;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // This file only reexports content of the `src` folder. Keep it that way.
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @module
- * @description
- * Entry point for all public APIs of this package.
- */
- // This file only reexports content of the `src` folder. Keep it that way.
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // This file is not used to build this module. It is only used during editing
- // by the TypeScript language service and during build for verification. `ngc`
- // replaces this file with production index.ts when it rewrites private symbol
- // names.
- //# sourceMappingURL=compiler.js.map
- /***/ }),
- /***/ "./node_modules/@angular/core/esm5/core.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/* unused harmony export createPlatform */
- /* unused harmony export assertPlatform */
- /* unused harmony export destroyPlatform */
- /* unused harmony export getPlatform */
- /* unused harmony export PlatformRef */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return ApplicationRef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_6", function() { return enableProdMode; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_8", function() { return isDevMode; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_5", function() { return createPlatformFactory; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return NgProbeToken; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return APP_ID; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return PACKAGE_ROOT_URL; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return PLATFORM_INITIALIZER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return PLATFORM_ID; });
- /* unused harmony export APP_BOOTSTRAP_LISTENER */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return APP_INITIALIZER; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ApplicationInitStatus; });
- /* unused harmony export DebugElement */
- /* unused harmony export DebugNode */
- /* unused harmony export asNativeElements */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_7", function() { return getDebugNode; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_0", function() { return Testability; });
- /* unused harmony export TestabilityRegistry */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_10", function() { return setTestabilityGetter; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return TRANSLATIONS; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return TRANSLATIONS_FORMAT; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return LOCALE_ID; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return MissingTranslationStrategy; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ApplicationModule; });
- /* unused harmony export wtfCreateScope */
- /* unused harmony export wtfLeave */
- /* unused harmony export wtfStartTimeRange */
- /* unused harmony export wtfEndTimeRange */
- /* unused harmony export Type */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return EventEmitter; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return ErrorHandler; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return Sanitizer; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return SecurityContext; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ANALYZE_FOR_ENTRY_COMPONENTS; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return Attribute; });
- /* unused harmony export ContentChild */
- /* unused harmony export ContentChildren */
- /* unused harmony export Query */
- /* unused harmony export ViewChild */
- /* unused harmony export ViewChildren */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return Component; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return Directive; });
- /* unused harmony export HostBinding */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return HostListener; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return Input; });
- /* unused harmony export Output */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return Pipe; });
- /* unused harmony export CUSTOM_ELEMENTS_SCHEMA */
- /* unused harmony export NO_ERRORS_SCHEMA */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return NgModule; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_3", function() { return ViewEncapsulation; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_1", function() { return Version; });
- /* unused harmony export VERSION */
- /* unused harmony export forwardRef */
- /* unused harmony export resolveForwardRef */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return Injector; });
- /* unused harmony export ReflectiveInjector */
- /* unused harmony export ResolvedReflectiveFactory */
- /* unused harmony export ReflectiveKey */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return InjectionToken; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return Inject; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return Optional; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return Injectable; });
- /* unused harmony export Self */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return SkipSelf; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return Host; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return NgZone; });
- /* unused harmony export RenderComponentType */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return Renderer; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return Renderer2; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return RendererFactory2; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return RendererStyleFlags2; });
- /* unused harmony export RootRenderer */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return COMPILER_OPTIONS; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return Compiler; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return CompilerFactory; });
- /* unused harmony export ModuleWithComponentFactories */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return ComponentFactory; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return ComponentRef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return ComponentFactoryResolver; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return ElementRef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return NgModuleFactory; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return NgModuleRef; });
- /* unused harmony export NgModuleFactoryLoader */
- /* unused harmony export getModuleFactory */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return QueryList; });
- /* unused harmony export SystemJsNgModuleLoader */
- /* unused harmony export SystemJsNgModuleLoaderConfig */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return TemplateRef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_2", function() { return ViewContainerRef; });
- /* unused harmony export EmbeddedViewRef */
- /* unused harmony export ViewRef */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return ChangeDetectionStrategy; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return ChangeDetectorRef; });
- /* unused harmony export DefaultIterableDiffer */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return IterableDiffers; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return KeyValueDiffers; });
- /* unused harmony export SimpleChange */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_4", function() { return WrappedValue; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_9", function() { return platformCore; });
- /* unused harmony export ɵALLOW_MULTIPLE_PLATFORMS */
- /* unused harmony export ɵAPP_ID_RANDOM_PROVIDER */
- /* unused harmony export ɵdevModeEqual */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_25", function() { return isListLikeIterable; });
- /* unused harmony export ɵChangeDetectorStatus */
- /* unused harmony export ɵisDefaultChangeDetectionStrategy */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_12", function() { return Console; });
- /* unused harmony export ɵComponentFactory */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_11", function() { return CodegenComponentFactoryResolver; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_15", function() { return ReflectionCapabilities; });
- /* unused harmony export ɵRenderDebugInfo */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_22", function() { return _global; });
- /* unused harmony export ɵlooseIdentical */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_39", function() { return stringify; });
- /* unused harmony export ɵmakeDecorator */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_26", function() { return isObservable; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_27", function() { return isPromise; });
- /* unused harmony export ɵclearOverrides */
- /* unused harmony export ɵoverrideComponentView */
- /* unused harmony export ɵoverrideProvider */
- /* unused harmony export ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR */
- /* unused harmony export ɵdefineComponent */
- /* unused harmony export ɵdetectChanges */
- /* unused harmony export ɵrenderComponent */
- /* unused harmony export ɵC */
- /* unused harmony export ɵD */
- /* unused harmony export ɵE */
- /* unused harmony export ɵT */
- /* unused harmony export ɵV */
- /* unused harmony export ɵb */
- /* unused harmony export ɵb1 */
- /* unused harmony export ɵc */
- /* unused harmony export ɵcR */
- /* unused harmony export ɵcr */
- /* unused harmony export ɵe */
- /* unused harmony export ɵp */
- /* unused harmony export ɵs */
- /* unused harmony export ɵt */
- /* unused harmony export ɵv */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_38", function() { return registerModuleFactory; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_13", function() { return EMPTY_ARRAY; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_14", function() { return EMPTY_MAP; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_16", function() { return anchorDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_17", function() { return createComponentFactory; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_18", function() { return createNgModuleFactory; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_19", function() { return createRendererType2; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_20", function() { return directiveDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_21", function() { return elementDef; });
- /* unused harmony export ɵelementEventFullName */
- /* unused harmony export ɵgetComponentViewDefinitionFactory */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_23", function() { return inlineInterpolate; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_24", function() { return interpolate; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_28", function() { return moduleDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_29", function() { return moduleProvideDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_30", function() { return ngContentDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_31", function() { return nodeValue; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_33", function() { return pipeDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_36", function() { return providerDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_32", function() { return pureArrayDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_34", function() { return pureObjectDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_35", function() { return purePipeDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_37", function() { return queryDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_40", function() { return textDef; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_41", function() { return unwrapValue; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_42", function() { return viewDef; });
- /* unused harmony export AUTO_STYLE */
- /* unused harmony export trigger */
- /* unused harmony export animate */
- /* unused harmony export group */
- /* unused harmony export sequence */
- /* unused harmony export style */
- /* unused harmony export state */
- /* unused harmony export keyframes */
- /* unused harmony export transition */
- /* unused harmony export ɵbf */
- /* unused harmony export ɵbg */
- /* unused harmony export ɵbk */
- /* unused harmony export ɵbh */
- /* unused harmony export ɵbj */
- /* unused harmony export ɵbi */
- /* unused harmony export ɵbl */
- /* unused harmony export ɵbe */
- /* unused harmony export ɵn */
- /* unused harmony export ɵo */
- /* unused harmony export ɵq */
- /* unused harmony export ɵi */
- /* unused harmony export ɵj */
- /* unused harmony export ɵk */
- /* unused harmony export ɵl */
- /* unused harmony export ɵm */
- /* unused harmony export ɵf */
- /* unused harmony export ɵg */
- /* unused harmony export ɵh */
- /* unused harmony export ɵr */
- /* unused harmony export ɵw */
- /* unused harmony export ɵu */
- /* unused harmony export ɵz */
- /* unused harmony export ɵx */
- /* unused harmony export ɵy */
- /* unused harmony export ɵbc */
- /* unused harmony export ɵa */
- /* unused harmony export ɵd */
- /* unused harmony export ɵba */
- /* unused harmony export ɵbb */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_observable_merge__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/merge.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_share__ = __webpack_require__("./node_modules/rxjs/_esm5/operator/share.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__ = __webpack_require__("./node_modules/rxjs/_esm5/Subject.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_rxjs_Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
- /**
- * @license Angular v5.2.9
- * (c) 2010-2018 Google, Inc. https://angular.io/
- * License: MIT
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Creates a token that can be used in a DI Provider.
- *
- * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a
- * runtime representation) such as when injecting an interface, callable type, array or
- * parametrized type.
- *
- * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
- * the `Injector`. This provides additional level of type safety.
- *
- * ```
- * interface MyInterface {...}
- * var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken'));
- * // myInterface is inferred to be MyInterface.
- * ```
- *
- * ### Example
- *
- * {\@example core/di/ts/injector_spec.ts region='InjectionToken'}
- *
- * \@stable
- */
- var InjectionToken = /** @class */ (function () {
- function InjectionToken(_desc) {
- this._desc = _desc;
- /**
- * \@internal
- */
- this.ngMetadataName = 'InjectionToken';
- }
- /**
- * @return {?}
- */
- InjectionToken.prototype.toString = /**
- * @return {?}
- */
- function () { return "InjectionToken " + this._desc; };
- return InjectionToken;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An interface implemented by all Angular type decorators, which allows them to be used as ES7
- * decorators as well as
- * Angular DSL syntax.
- *
- * ES7 syntax:
- *
- * ```
- * \@ng.Component({...})
- * class MyClass {...}
- * ```
- * \@stable
- * @record
- */
- var ANNOTATIONS = '__annotations__';
- var PARAMETERS = '__paramaters__';
- var PROP_METADATA = '__prop__metadata__';
- /**
- * @suppress {globalThis}
- * @param {?} name
- * @param {?=} props
- * @param {?=} parentClass
- * @param {?=} chainFn
- * @return {?}
- */
- function makeDecorator(name, props, parentClass, chainFn) {
- var /** @type {?} */ metaCtor = makeMetadataCtor(props);
- /**
- * @param {?} objOrType
- * @return {?}
- */
- function DecoratorFactory(objOrType) {
- if (this instanceof DecoratorFactory) {
- metaCtor.call(this, objOrType);
- return this;
- }
- var /** @type {?} */ annotationInstance = new (/** @type {?} */ (DecoratorFactory))(objOrType);
- var /** @type {?} */ TypeDecorator = /** @type {?} */ (function TypeDecorator(cls) {
- // Use of Object.defineProperty is important since it creates non-enumerable property which
- // prevents the property is copied during subclassing.
- var /** @type {?} */ annotations = cls.hasOwnProperty(ANNOTATIONS) ?
- (/** @type {?} */ (cls))[ANNOTATIONS] :
- Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
- annotations.push(annotationInstance);
- return cls;
- });
- if (chainFn)
- chainFn(TypeDecorator);
- return TypeDecorator;
- }
- if (parentClass) {
- DecoratorFactory.prototype = Object.create(parentClass.prototype);
- }
- DecoratorFactory.prototype.ngMetadataName = name;
- (/** @type {?} */ (DecoratorFactory)).annotationCls = DecoratorFactory;
- return /** @type {?} */ (DecoratorFactory);
- }
- /**
- * @param {?=} props
- * @return {?}
- */
- function makeMetadataCtor(props) {
- return function ctor() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- if (props) {
- var /** @type {?} */ values = props.apply(void 0, args);
- for (var /** @type {?} */ propName in values) {
- this[propName] = values[propName];
- }
- }
- };
- }
- /**
- * @param {?} name
- * @param {?=} props
- * @param {?=} parentClass
- * @return {?}
- */
- function makeParamDecorator(name, props, parentClass) {
- var /** @type {?} */ metaCtor = makeMetadataCtor(props);
- /**
- * @param {...?} args
- * @return {?}
- */
- function ParamDecoratorFactory() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- if (this instanceof ParamDecoratorFactory) {
- metaCtor.apply(this, args);
- return this;
- }
- var /** @type {?} */ annotationInstance = new ((_a = (/** @type {?} */ (ParamDecoratorFactory))).bind.apply(_a, [void 0].concat(args)))();
- (/** @type {?} */ (ParamDecorator)).annotation = annotationInstance;
- return ParamDecorator;
- /**
- * @param {?} cls
- * @param {?} unusedKey
- * @param {?} index
- * @return {?}
- */
- function ParamDecorator(cls, unusedKey, index) {
- // Use of Object.defineProperty is important since it creates non-enumerable property which
- // prevents the property is copied during subclassing.
- var /** @type {?} */ parameters = cls.hasOwnProperty(PARAMETERS) ?
- (/** @type {?} */ (cls))[PARAMETERS] :
- Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
- // there might be gaps if some in between parameters do not have annotations.
- // we pad with nulls.
- while (parameters.length <= index) {
- parameters.push(null);
- }
- (parameters[index] = parameters[index] || []).push(annotationInstance);
- return cls;
- }
- var _a;
- }
- if (parentClass) {
- ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
- }
- ParamDecoratorFactory.prototype.ngMetadataName = name;
- (/** @type {?} */ (ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory;
- return ParamDecoratorFactory;
- }
- /**
- * @param {?} name
- * @param {?=} props
- * @param {?=} parentClass
- * @return {?}
- */
- function makePropDecorator(name, props, parentClass) {
- var /** @type {?} */ metaCtor = makeMetadataCtor(props);
- /**
- * @param {...?} args
- * @return {?}
- */
- function PropDecoratorFactory() {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- if (this instanceof PropDecoratorFactory) {
- metaCtor.apply(this, args);
- return this;
- }
- var /** @type {?} */ decoratorInstance = new ((_a = (/** @type {?} */ (PropDecoratorFactory))).bind.apply(_a, [void 0].concat(args)))();
- return function PropDecorator(target, name) {
- var /** @type {?} */ constructor = target.constructor;
- // Use of Object.defineProperty is important since it creates non-enumerable property which
- // prevents the property is copied during subclassing.
- var /** @type {?} */ meta = constructor.hasOwnProperty(PROP_METADATA) ?
- (/** @type {?} */ (constructor))[PROP_METADATA] :
- Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA];
- meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
- meta[name].unshift(decoratorInstance);
- };
- var _a;
- }
- if (parentClass) {
- PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
- }
- PropDecoratorFactory.prototype.ngMetadataName = name;
- (/** @type {?} */ (PropDecoratorFactory)).annotationCls = PropDecoratorFactory;
- return PropDecoratorFactory;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * This token can be used to create a virtual provider that will populate the
- * `entryComponents` fields of components and ng modules based on its `useValue`.
- * All components that are referenced in the `useValue` value (either directly
- * or in a nested array or map) will be added to the `entryComponents` property.
- *
- * ### Example
- * The following example shows how the router can populate the `entryComponents`
- * field of an NgModule based on the router configuration which refers
- * to components.
- *
- * ```typescript
- * // helper function inside the router
- * function provideRoutes(routes) {
- * return [
- * {provide: ROUTES, useValue: routes},
- * {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
- * ];
- * }
- *
- * // user code
- * let routes = [
- * {path: '/root', component: RootComp},
- * {path: '/teams', component: TeamsComp}
- * ];
- *
- * \@NgModule({
- * providers: [provideRoutes(routes)]
- * })
- * class ModuleWithRoutes {}
- * ```
- *
- * \@experimental
- */
- var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
- /**
- * Type of the Attribute decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Attribute decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Attribute = makeParamDecorator('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
- /**
- * Base class for query metadata.
- *
- * See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for
- * more information.
- *
- * \@stable
- * @abstract
- */
- var Query = /** @class */ (function () {
- function Query() {
- }
- return Query;
- }());
- /**
- * Type of the ContentChildren decorator / constructor function.
- *
- * See {\@link ContentChildren}.
- *
- * \@stable
- * @record
- */
- /**
- * ContentChildren decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var ContentChildren = makePropDecorator('ContentChildren', function (selector, data) {
- if (data === void 0) { data = {}; }
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
- }, Query);
- /**
- * Type of the ContentChild decorator / constructor function.
- *
- *
- * \@stable
- * @record
- */
- /**
- * ContentChild decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var ContentChild = makePropDecorator('ContentChild', function (selector, data) {
- if (data === void 0) { data = {}; }
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
- }, Query);
- /**
- * Type of the ViewChildren decorator / constructor function.
- *
- * See {\@link ViewChildren}.
- *
- * \@stable
- * @record
- */
- /**
- * ViewChildren decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var ViewChildren = makePropDecorator('ViewChildren', function (selector, data) {
- if (data === void 0) { data = {}; }
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
- }, Query);
- /**
- * Type of the ViewChild decorator / constructor function.
- *
- * See {\@link ViewChild}
- *
- * \@stable
- * @record
- */
- /**
- * ViewChild decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var ViewChild = makePropDecorator('ViewChild', function (selector, data) {
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
- }, Query);
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var ChangeDetectionStrategy = {
- /**
- * `OnPush` means that the change detector's mode will be initially set to `CheckOnce`.
- */
- OnPush: 0,
- /**
- * `Default` means that the change detector's mode will be initially set to `CheckAlways`.
- */
- Default: 1,
- };
- ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
- ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
- /** @enum {number} */
- var ChangeDetectorStatus = {
- /**
- * `CheckOnce` means that after calling detectChanges the mode of the change detector
- * will become `Checked`.
- */
- CheckOnce: 0,
- /**
- * `Checked` means that the change detector should be skipped until its mode changes to
- * `CheckOnce`.
- */
- Checked: 1,
- /**
- * `CheckAlways` means that after calling detectChanges the mode of the change detector
- * will remain `CheckAlways`.
- */
- CheckAlways: 2,
- /**
- * `Detached` means that the change detector sub tree is not a part of the main tree and
- * should be skipped.
- */
- Detached: 3,
- /**
- * `Errored` means that the change detector encountered an error checking a binding
- * or calling a directive lifecycle method and is now in an inconsistent state. Change
- * detectors in this state will no longer detect changes.
- */
- Errored: 4,
- /**
- * `Destroyed` means that the change detector is destroyed.
- */
- Destroyed: 5,
- };
- ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce";
- ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked";
- ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways";
- ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached";
- ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored";
- ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed";
- /**
- * @param {?} changeDetectionStrategy
- * @return {?}
- */
- function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
- return changeDetectionStrategy == null ||
- changeDetectionStrategy === ChangeDetectionStrategy.Default;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Type of the Directive decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Directive decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Directive = makeDecorator('Directive', function (dir) {
- if (dir === void 0) { dir = {}; }
- return dir;
- });
- /**
- * Type of the Component decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Component decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Component = makeDecorator('Component', function (c) {
- if (c === void 0) { c = {}; }
- return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ changeDetection: ChangeDetectionStrategy.Default }, c));
- }, Directive);
- /**
- * Type of the Pipe decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Pipe decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Pipe = makeDecorator('Pipe', function (p) { return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ pure: true }, p)); });
- /**
- * Type of the Input decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Input decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Input = makePropDecorator('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
- /**
- * Type of the Output decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Output decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Output = makePropDecorator('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
- /**
- * Type of the HostBinding decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * HostBinding decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var HostBinding = makePropDecorator('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
- /**
- * Type of the HostListener decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * HostListener decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var HostListener = makePropDecorator('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A wrapper around a module that also includes the providers.
- *
- * \@stable
- * @record
- */
- /**
- * Interface for schema definitions in \@NgModules.
- *
- * \@experimental
- * @record
- */
- /**
- * Defines a schema that will allow:
- * - any non-Angular elements with a `-` in their name,
- * - any properties on elements with a `-` in their name which is the common rule for custom
- * elements.
- *
- * \@stable
- */
- var CUSTOM_ELEMENTS_SCHEMA = {
- name: 'custom-elements'
- };
- /**
- * Defines a schema that will allow any property on any element.
- *
- * \@experimental
- */
- var NO_ERRORS_SCHEMA = {
- name: 'no-errors-schema'
- };
- /**
- * Type of the NgModule decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * NgModule decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule; });
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var ViewEncapsulation = {
- /**
- * Emulate `Native` scoping of styles by adding an attribute containing surrogate id to the Host
- * Element and pre-processing the style rules provided via {@link Component#styles styles} or
- * {@link Component#styleUrls styleUrls}, and adding the new Host Element attribute to all
- * selectors.
- *
- * This is the default option.
- */
- Emulated: 0,
- /**
- * Use the native encapsulation mechanism of the renderer.
- *
- * For the DOM this means using [Shadow DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
- * creating a ShadowRoot for Component's Host Element.
- */
- Native: 1,
- /**
- * Don't provide any template or style encapsulation.
- */
- None: 2,
- };
- ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
- ViewEncapsulation[ViewEncapsulation.Native] = "Native";
- ViewEncapsulation[ViewEncapsulation.None] = "None";
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@whatItDoes Represents the version of Angular
- *
- * \@stable
- */
- var Version = /** @class */ (function () {
- function Version(full) {
- this.full = full;
- this.major = full.split('.')[0];
- this.minor = full.split('.')[1];
- this.patch = full.split('.').slice(2).join('.');
- }
- return Version;
- }());
- /**
- * \@stable
- */
- var VERSION = new Version('5.2.9');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Type of the Inject decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Inject decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Inject = makeParamDecorator('Inject', function (token) { return ({ token: token }); });
- /**
- * Type of the Optional decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Optional decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Optional = makeParamDecorator('Optional');
- /**
- * Type of the Injectable decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Injectable decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Injectable = makeDecorator('Injectable');
- /**
- * Type of the Self decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Self decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Self = makeParamDecorator('Self');
- /**
- * Type of the SkipSelf decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * SkipSelf decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var SkipSelf = makeParamDecorator('SkipSelf');
- /**
- * Type of the Host decorator / constructor function.
- *
- * \@stable
- * @record
- */
- /**
- * Host decorator and metadata.
- *
- * \@stable
- * \@Annotation
- */
- var Host = makeParamDecorator('Host');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var __window = typeof window !== 'undefined' && window;
- var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
- self instanceof WorkerGlobalScope && self;
- var __global = typeof global !== 'undefined' && global;
- var _global = __window || __global || __self;
- var promise = Promise.resolve(0);
- var _symbolIterator = null;
- /**
- * @return {?}
- */
- function getSymbolIterator() {
- if (!_symbolIterator) {
- var /** @type {?} */ Symbol_1 = _global['Symbol'];
- if (Symbol_1 && Symbol_1.iterator) {
- _symbolIterator = Symbol_1.iterator;
- }
- else {
- // es6-shim specific logic
- var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype);
- for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
- var /** @type {?} */ key = keys[i];
- if (key !== 'entries' && key !== 'size' &&
- (/** @type {?} */ (Map)).prototype[key] === Map.prototype['entries']) {
- _symbolIterator = key;
- }
- }
- }
- }
- return _symbolIterator;
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- function scheduleMicroTask(fn) {
- if (typeof Zone === 'undefined') {
- // use promise to schedule microTask instead of use Zone
- promise.then(function () { fn && fn.apply(null, null); });
- }
- else {
- Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
- }
- }
- /**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function looseIdentical(a, b) {
- return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
- }
- /**
- * @param {?} token
- * @return {?}
- */
- function stringify(token) {
- if (typeof token === 'string') {
- return token;
- }
- if (token instanceof Array) {
- return '[' + token.map(stringify).join(', ') + ']';
- }
- if (token == null) {
- return '' + token;
- }
- if (token.overriddenName) {
- return "" + token.overriddenName;
- }
- if (token.name) {
- return "" + token.name;
- }
- var /** @type {?} */ res = token.toString();
- if (res == null) {
- return '' + res;
- }
- var /** @type {?} */ newLineIndex = res.indexOf('\n');
- return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An interface that a function passed into {\@link forwardRef} has to implement.
- *
- * ### Example
- *
- * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref_fn'}
- * \@experimental
- * @record
- */
- /**
- * Allows to refer to references which are not yet defined.
- *
- * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
- * DI is declared,
- * but not yet defined. It is also used when the `token` which we use when creating a query is not
- * yet defined.
- *
- * ### Example
- * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
- * \@experimental
- * @param {?} forwardRefFn
- * @return {?}
- */
- function forwardRef(forwardRefFn) {
- (/** @type {?} */ (forwardRefFn)).__forward_ref__ = forwardRef;
- (/** @type {?} */ (forwardRefFn)).toString = function () { return stringify(this()); };
- return (/** @type {?} */ (/** @type {?} */ (forwardRefFn)));
- }
- /**
- * Lazily retrieves the reference value from a forwardRef.
- *
- * Acts as the identity function when given a non-forward-ref value.
- *
- * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview))
- *
- * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
- *
- * See: {\@link forwardRef}
- * \@experimental
- * @param {?} type
- * @return {?}
- */
- function resolveForwardRef(type) {
- if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
- type.__forward_ref__ === forwardRef) {
- return (/** @type {?} */ (type))();
- }
- else {
- return type;
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var SOURCE = '__source';
- var _THROW_IF_NOT_FOUND = new Object();
- var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
- var _NullInjector = /** @class */ (function () {
- function _NullInjector() {
- }
- /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- _NullInjector.prototype.get = /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- function (token, notFoundValue) {
- if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; }
- if (notFoundValue === _THROW_IF_NOT_FOUND) {
- throw new Error("NullInjectorError: No provider for " + stringify(token) + "!");
- }
- return notFoundValue;
- };
- return _NullInjector;
- }());
- /**
- * \@whatItDoes Injector interface
- * \@howToUse
- * ```
- * const injector: Injector = ...;
- * injector.get(...);
- * ```
- *
- * \@description
- * For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}.
- *
- * ### Example
- *
- * {\@example core/di/ts/injector_spec.ts region='Injector'}
- *
- * `Injector` returns itself when given `Injector` as a token:
- * {\@example core/di/ts/injector_spec.ts region='injectInjector'}
- *
- * \@stable
- * @abstract
- */
- var Injector = /** @class */ (function () {
- function Injector() {
- }
- /**
- * Create a new Injector which is configure using `StaticProvider`s.
- *
- * ### Example
- *
- * {@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
- */
- /**
- * Create a new Injector which is configure using `StaticProvider`s.
- *
- * ### Example
- *
- * {\@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
- * @param {?} options
- * @param {?=} parent
- * @return {?}
- */
- Injector.create = /**
- * Create a new Injector which is configure using `StaticProvider`s.
- *
- * ### Example
- *
- * {\@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
- * @param {?} options
- * @param {?=} parent
- * @return {?}
- */
- function (options, parent) {
- if (Array.isArray(options)) {
- return new StaticInjector(options, parent);
- }
- else {
- return new StaticInjector(options.providers, options.parent, options.name || null);
- }
- };
- Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
- Injector.NULL = new _NullInjector();
- return Injector;
- }());
- var IDENT = function (value) {
- return value;
- };
- var EMPTY = /** @type {?} */ ([]);
- var CIRCULAR = IDENT;
- var MULTI_PROVIDER_FN = function () {
- return Array.prototype.slice.call(arguments);
- };
- var GET_PROPERTY_NAME = /** @type {?} */ ({});
- var ɵ2 = GET_PROPERTY_NAME;
- var USE_VALUE = getClosureSafeProperty({ provide: String, useValue: ɵ2 });
- var NG_TOKEN_PATH = 'ngTokenPath';
- var NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';
- var NULL_INJECTOR = Injector.NULL;
- var NEW_LINE = /\n/gm;
- var NO_NEW_LINE = 'ɵ';
- var StaticInjector = /** @class */ (function () {
- function StaticInjector(providers, parent, source) {
- if (parent === void 0) { parent = NULL_INJECTOR; }
- if (source === void 0) { source = null; }
- this.parent = parent;
- this.source = source;
- var /** @type {?} */ records = this._records = new Map();
- records.set(Injector, /** @type {?} */ ({ token: Injector, fn: IDENT, deps: EMPTY, value: this, useNew: false }));
- recursivelyProcessProviders(records, providers);
- }
- /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- StaticInjector.prototype.get = /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- function (token, notFoundValue) {
- var /** @type {?} */ record = this._records.get(token);
- try {
- return tryResolveToken(token, record, this._records, this.parent, notFoundValue);
- }
- catch (/** @type {?} */ e) {
- var /** @type {?} */ tokenPath = e[NG_TEMP_TOKEN_PATH];
- if (token[SOURCE]) {
- tokenPath.unshift(token[SOURCE]);
- }
- e.message = formatError('\n' + e.message, tokenPath, this.source);
- e[NG_TOKEN_PATH] = tokenPath;
- e[NG_TEMP_TOKEN_PATH] = null;
- throw e;
- }
- };
- /**
- * @return {?}
- */
- StaticInjector.prototype.toString = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ tokens = /** @type {?} */ ([]), /** @type {?} */ records = this._records;
- records.forEach(function (v, token) { return tokens.push(stringify(token)); });
- return "StaticInjector[" + tokens.join(', ') + "]";
- };
- return StaticInjector;
- }());
- /**
- * @param {?} provider
- * @return {?}
- */
- function resolveProvider(provider) {
- var /** @type {?} */ deps = computeDeps(provider);
- var /** @type {?} */ fn = IDENT;
- var /** @type {?} */ value = EMPTY;
- var /** @type {?} */ useNew = false;
- var /** @type {?} */ provide = resolveForwardRef(provider.provide);
- if (USE_VALUE in provider) {
- // We need to use USE_VALUE in provider since provider.useValue could be defined as undefined.
- value = (/** @type {?} */ (provider)).useValue;
- }
- else if ((/** @type {?} */ (provider)).useFactory) {
- fn = (/** @type {?} */ (provider)).useFactory;
- }
- else if ((/** @type {?} */ (provider)).useExisting) {
- // Just use IDENT
- }
- else if ((/** @type {?} */ (provider)).useClass) {
- useNew = true;
- fn = resolveForwardRef((/** @type {?} */ (provider)).useClass);
- }
- else if (typeof provide == 'function') {
- useNew = true;
- fn = provide;
- }
- else {
- throw staticError('StaticProvider does not have [useValue|useFactory|useExisting|useClass] or [provide] is not newable', provider);
- }
- return { deps: deps, fn: fn, useNew: useNew, value: value };
- }
- /**
- * @param {?} token
- * @return {?}
- */
- function multiProviderMixError(token) {
- return staticError('Cannot mix multi providers and regular providers', token);
- }
- /**
- * @param {?} records
- * @param {?} provider
- * @return {?}
- */
- function recursivelyProcessProviders(records, provider) {
- if (provider) {
- provider = resolveForwardRef(provider);
- if (provider instanceof Array) {
- // if we have an array recurse into the array
- for (var /** @type {?} */ i = 0; i < provider.length; i++) {
- recursivelyProcessProviders(records, provider[i]);
- }
- }
- else if (typeof provider === 'function') {
- // Functions were supported in ReflectiveInjector, but are not here. For safety give useful
- // error messages
- throw staticError('Function/Class not supported', provider);
- }
- else if (provider && typeof provider === 'object' && provider.provide) {
- // At this point we have what looks like a provider: {provide: ?, ....}
- var /** @type {?} */ token = resolveForwardRef(provider.provide);
- var /** @type {?} */ resolvedProvider = resolveProvider(provider);
- if (provider.multi === true) {
- // This is a multi provider.
- var /** @type {?} */ multiProvider = records.get(token);
- if (multiProvider) {
- if (multiProvider.fn !== MULTI_PROVIDER_FN) {
- throw multiProviderMixError(token);
- }
- }
- else {
- // Create a placeholder factory which will look up the constituents of the multi provider.
- records.set(token, multiProvider = /** @type {?} */ ({
- token: provider.provide,
- deps: [],
- useNew: false,
- fn: MULTI_PROVIDER_FN,
- value: EMPTY
- }));
- }
- // Treat the provider as the token.
- token = provider;
- multiProvider.deps.push({ token: token, options: 6 /* Default */ });
- }
- var /** @type {?} */ record = records.get(token);
- if (record && record.fn == MULTI_PROVIDER_FN) {
- throw multiProviderMixError(token);
- }
- records.set(token, resolvedProvider);
- }
- else {
- throw staticError('Unexpected provider', provider);
- }
- }
- }
- /**
- * @param {?} token
- * @param {?} record
- * @param {?} records
- * @param {?} parent
- * @param {?} notFoundValue
- * @return {?}
- */
- function tryResolveToken(token, record, records, parent, notFoundValue) {
- try {
- return resolveToken(token, record, records, parent, notFoundValue);
- }
- catch (/** @type {?} */ e) {
- // ensure that 'e' is of type Error.
- if (!(e instanceof Error)) {
- e = new Error(e);
- }
- var /** @type {?} */ path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
- path.unshift(token);
- if (record && record.value == CIRCULAR) {
- // Reset the Circular flag.
- record.value = EMPTY;
- }
- throw e;
- }
- }
- /**
- * @param {?} token
- * @param {?} record
- * @param {?} records
- * @param {?} parent
- * @param {?} notFoundValue
- * @return {?}
- */
- function resolveToken(token, record, records, parent, notFoundValue) {
- var /** @type {?} */ value;
- if (record) {
- // If we don't have a record, this implies that we don't own the provider hence don't know how
- // to resolve it.
- value = record.value;
- if (value == CIRCULAR) {
- throw Error(NO_NEW_LINE + 'Circular dependency');
- }
- else if (value === EMPTY) {
- record.value = CIRCULAR;
- var /** @type {?} */ obj = undefined;
- var /** @type {?} */ useNew = record.useNew;
- var /** @type {?} */ fn = record.fn;
- var /** @type {?} */ depRecords = record.deps;
- var /** @type {?} */ deps = EMPTY;
- if (depRecords.length) {
- deps = [];
- for (var /** @type {?} */ i = 0; i < depRecords.length; i++) {
- var /** @type {?} */ depRecord = depRecords[i];
- var /** @type {?} */ options = depRecord.options;
- var /** @type {?} */ childRecord = options & 2 /* CheckSelf */ ? records.get(depRecord.token) : undefined;
- deps.push(tryResolveToken(
- // Current Token to resolve
- depRecord.token, childRecord, records,
- // If we don't know how to resolve dependency and we should not check parent for it,
- // than pass in Null injector.
- !childRecord && !(options & 4 /* CheckParent */) ? NULL_INJECTOR : parent, options & 1 /* Optional */ ? null : Injector.THROW_IF_NOT_FOUND));
- }
- }
- record.value = value = useNew ? new ((_a = (/** @type {?} */ (fn))).bind.apply(_a, [void 0].concat(deps)))() : fn.apply(obj, deps);
- }
- }
- else {
- value = parent.get(token, notFoundValue);
- }
- return value;
- var _a;
- }
- /**
- * @param {?} provider
- * @return {?}
- */
- function computeDeps(provider) {
- var /** @type {?} */ deps = EMPTY;
- var /** @type {?} */ providerDeps = (/** @type {?} */ (provider)).deps;
- if (providerDeps && providerDeps.length) {
- deps = [];
- for (var /** @type {?} */ i = 0; i < providerDeps.length; i++) {
- var /** @type {?} */ options = 6;
- var /** @type {?} */ token = resolveForwardRef(providerDeps[i]);
- if (token instanceof Array) {
- for (var /** @type {?} */ j = 0, /** @type {?} */ annotations = token; j < annotations.length; j++) {
- var /** @type {?} */ annotation = annotations[j];
- if (annotation instanceof Optional || annotation == Optional) {
- options = options | 1 /* Optional */;
- }
- else if (annotation instanceof SkipSelf || annotation == SkipSelf) {
- options = options & ~2 /* CheckSelf */;
- }
- else if (annotation instanceof Self || annotation == Self) {
- options = options & ~4 /* CheckParent */;
- }
- else if (annotation instanceof Inject) {
- token = (/** @type {?} */ (annotation)).token;
- }
- else {
- token = resolveForwardRef(annotation);
- }
- }
- }
- deps.push({ token: token, options: options });
- }
- }
- else if ((/** @type {?} */ (provider)).useExisting) {
- var /** @type {?} */ token = resolveForwardRef((/** @type {?} */ (provider)).useExisting);
- deps = [{ token: token, options: 6 /* Default */ }];
- }
- else if (!providerDeps && !(USE_VALUE in provider)) {
- // useValue & useExisting are the only ones which are exempt from deps all others need it.
- throw staticError('\'deps\' required', provider);
- }
- return deps;
- }
- /**
- * @param {?} text
- * @param {?} obj
- * @param {?=} source
- * @return {?}
- */
- function formatError(text, obj, source) {
- if (source === void 0) { source = null; }
- text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.substr(2) : text;
- var /** @type {?} */ context = stringify(obj);
- if (obj instanceof Array) {
- context = obj.map(stringify).join(' -> ');
- }
- else if (typeof obj === 'object') {
- var /** @type {?} */ parts = /** @type {?} */ ([]);
- for (var /** @type {?} */ key in obj) {
- if (obj.hasOwnProperty(key)) {
- var /** @type {?} */ value = obj[key];
- parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));
- }
- }
- context = "{" + parts.join(', ') + "}";
- }
- return "StaticInjectorError" + (source ? '(' + source + ')' : '') + "[" + context + "]: " + text.replace(NEW_LINE, '\n ');
- }
- /**
- * @param {?} text
- * @param {?} obj
- * @return {?}
- */
- function staticError(text, obj) {
- return new Error(formatError(text, obj));
- }
- /**
- * @template T
- * @param {?} objWithPropertyToExtract
- * @return {?}
- */
- function getClosureSafeProperty(objWithPropertyToExtract) {
- for (var /** @type {?} */ key in objWithPropertyToExtract) {
- if (objWithPropertyToExtract[key] === GET_PROPERTY_NAME) {
- return key;
- }
- }
- throw Error('!prop');
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ERROR_DEBUG_CONTEXT = 'ngDebugContext';
- var ERROR_ORIGINAL_ERROR = 'ngOriginalError';
- var ERROR_LOGGER = 'ngErrorLogger';
- /**
- * @param {?} error
- * @return {?}
- */
- /**
- * @param {?} error
- * @return {?}
- */
- function getDebugContext(error) {
- return (/** @type {?} */ (error))[ERROR_DEBUG_CONTEXT];
- }
- /**
- * @param {?} error
- * @return {?}
- */
- function getOriginalError(error) {
- return (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR];
- }
- /**
- * @param {?} error
- * @return {?}
- */
- function getErrorLogger(error) {
- return (/** @type {?} */ (error))[ERROR_LOGGER] || defaultErrorLogger;
- }
- /**
- * @param {?} console
- * @param {...?} values
- * @return {?}
- */
- function defaultErrorLogger(console) {
- var values = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- values[_i - 1] = arguments[_i];
- }
- console.error.apply(console, values);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@whatItDoes Provides a hook for centralized exception handling.
- *
- * \@description
- *
- * The default implementation of `ErrorHandler` prints error messages to the `console`. To
- * intercept error handling, write a custom exception handler that replaces this default as
- * appropriate for your app.
- *
- * ### Example
- *
- * ```
- * class MyErrorHandler implements ErrorHandler {
- * handleError(error) {
- * // do something with the exception
- * }
- * }
- *
- * \@NgModule({
- * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
- * })
- * class MyModule {}
- * ```
- *
- * \@stable
- */
- var ErrorHandler = /** @class */ (function () {
- function ErrorHandler() {
- /**
- * \@internal
- */
- this._console = console;
- }
- /**
- * @param {?} error
- * @return {?}
- */
- ErrorHandler.prototype.handleError = /**
- * @param {?} error
- * @return {?}
- */
- function (error) {
- var /** @type {?} */ originalError = this._findOriginalError(error);
- var /** @type {?} */ context = this._findContext(error);
- // Note: Browser consoles show the place from where console.error was called.
- // We can use this to give users additional information about the error.
- var /** @type {?} */ errorLogger = getErrorLogger(error);
- errorLogger(this._console, "ERROR", error);
- if (originalError) {
- errorLogger(this._console, "ORIGINAL ERROR", originalError);
- }
- if (context) {
- errorLogger(this._console, 'ERROR CONTEXT', context);
- }
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} error
- * @return {?}
- */
- ErrorHandler.prototype._findContext = /**
- * \@internal
- * @param {?} error
- * @return {?}
- */
- function (error) {
- if (error) {
- return getDebugContext(error) ? getDebugContext(error) :
- this._findContext(getOriginalError(error));
- }
- return null;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} error
- * @return {?}
- */
- ErrorHandler.prototype._findOriginalError = /**
- * \@internal
- * @param {?} error
- * @return {?}
- */
- function (error) {
- var /** @type {?} */ e = getOriginalError(error);
- while (e && getOriginalError(e)) {
- e = getOriginalError(e);
- }
- return e;
- };
- return ErrorHandler;
- }());
- /**
- * @param {?} message
- * @param {?} originalError
- * @return {?}
- */
- function wrappedError(message, originalError) {
- var /** @type {?} */ msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);
- var /** @type {?} */ error = Error(msg);
- (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR] = originalError;
- return error;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} keys
- * @return {?}
- */
- function findFirstClosedCycle(keys) {
- var /** @type {?} */ res = [];
- for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
- if (res.indexOf(keys[i]) > -1) {
- res.push(keys[i]);
- return res;
- }
- res.push(keys[i]);
- }
- return res;
- }
- /**
- * @param {?} keys
- * @return {?}
- */
- function constructResolvingPath(keys) {
- if (keys.length > 1) {
- var /** @type {?} */ reversed = findFirstClosedCycle(keys.slice().reverse());
- var /** @type {?} */ tokenStrs = reversed.map(function (k) { return stringify(k.token); });
- return ' (' + tokenStrs.join(' -> ') + ')';
- }
- return '';
- }
- /**
- * @record
- */
- /**
- * @param {?} injector
- * @param {?} key
- * @param {?} constructResolvingMessage
- * @param {?=} originalError
- * @return {?}
- */
- function injectionError(injector, key, constructResolvingMessage, originalError) {
- var /** @type {?} */ keys = [key];
- var /** @type {?} */ errMsg = constructResolvingMessage(keys);
- var /** @type {?} */ error = /** @type {?} */ ((originalError ? wrappedError(errMsg, originalError) : Error(errMsg)));
- error.addKey = addKey;
- error.keys = keys;
- error.injectors = [injector];
- error.constructResolvingMessage = constructResolvingMessage;
- (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR] = originalError;
- return error;
- }
- /**
- * @this {?}
- * @param {?} injector
- * @param {?} key
- * @return {?}
- */
- function addKey(injector, key) {
- this.injectors.push(injector);
- this.keys.push(key);
- // Note: This updated message won't be reflected in the `.stack` property
- this.message = this.constructResolvingMessage(this.keys);
- }
- /**
- * Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the
- * {\@link Injector} does not have a {\@link Provider} for the given key.
- *
- * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview))
- *
- * ```typescript
- * class A {
- * constructor(b:B) {}
- * }
- *
- * expect(() => Injector.resolveAndCreate([A])).toThrowError();
- * ```
- * @param {?} injector
- * @param {?} key
- * @return {?}
- */
- function noProviderError(injector, key) {
- return injectionError(injector, key, function (keys) {
- var /** @type {?} */ first = stringify(keys[0].token);
- return "No provider for " + first + "!" + constructResolvingPath(keys);
- });
- }
- /**
- * Thrown when dependencies form a cycle.
- *
- * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info))
- *
- * ```typescript
- * var injector = Injector.resolveAndCreate([
- * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]},
- * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]}
- * ]);
- *
- * expect(() => injector.get("one")).toThrowError();
- * ```
- *
- * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
- * @param {?} injector
- * @param {?} key
- * @return {?}
- */
- function cyclicDependencyError(injector, key) {
- return injectionError(injector, key, function (keys) {
- return "Cannot instantiate cyclic dependency!" + constructResolvingPath(keys);
- });
- }
- /**
- * Thrown when a constructing type returns with an Error.
- *
- * The `InstantiationError` class contains the original error plus the dependency graph which caused
- * this object to be instantiated.
- *
- * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview))
- *
- * ```typescript
- * class A {
- * constructor() {
- * throw new Error('message');
- * }
- * }
- *
- * var injector = Injector.resolveAndCreate([A]);
- * try {
- * injector.get(A);
- * } catch (e) {
- * expect(e instanceof InstantiationError).toBe(true);
- * expect(e.originalException.message).toEqual("message");
- * expect(e.originalStack).toBeDefined();
- * }
- * ```
- * @param {?} injector
- * @param {?} originalException
- * @param {?} originalStack
- * @param {?} key
- * @return {?}
- */
- function instantiationError(injector, originalException, originalStack, key) {
- return injectionError(injector, key, function (keys) {
- var /** @type {?} */ first = stringify(keys[0].token);
- return originalException.message + ": Error during instantiation of " + first + "!" + constructResolvingPath(keys) + ".";
- }, originalException);
- }
- /**
- * Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector}
- * creation.
- *
- * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview))
- *
- * ```typescript
- * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
- * ```
- * @param {?} provider
- * @return {?}
- */
- function invalidProviderError(provider) {
- return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider);
- }
- /**
- * Thrown when the class has no annotation information.
- *
- * Lack of annotation information prevents the {\@link Injector} from determining which dependencies
- * need to be injected into the constructor.
- *
- * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview))
- *
- * ```typescript
- * class A {
- * constructor(b) {}
- * }
- *
- * expect(() => Injector.resolveAndCreate([A])).toThrowError();
- * ```
- *
- * This error is also thrown when the class not marked with {\@link Injectable} has parameter types.
- *
- * ```typescript
- * class B {}
- *
- * class A {
- * constructor(b:B) {} // no information about the parameter types of A is available at runtime.
- * }
- *
- * expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
- * ```
- * \@stable
- * @param {?} typeOrFunc
- * @param {?} params
- * @return {?}
- */
- function noAnnotationError(typeOrFunc, params) {
- var /** @type {?} */ signature = [];
- for (var /** @type {?} */ i = 0, /** @type {?} */ ii = params.length; i < ii; i++) {
- var /** @type {?} */ parameter = params[i];
- if (!parameter || parameter.length == 0) {
- signature.push('?');
- }
- else {
- signature.push(parameter.map(stringify).join(' '));
- }
- }
- return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
- signature.join(', ') + '). ' +
- 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
- stringify(typeOrFunc) + '\' is decorated with Injectable.');
- }
- /**
- * Thrown when getting an object by index.
- *
- * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview))
- *
- * ```typescript
- * class A {}
- *
- * var injector = Injector.resolveAndCreate([A]);
- *
- * expect(() => injector.getAt(100)).toThrowError();
- * ```
- * \@stable
- * @param {?} index
- * @return {?}
- */
- function outOfBoundsError(index) {
- return Error("Index " + index + " is out-of-bounds.");
- }
- /**
- * Thrown when a multi provider and a regular provider are bound to the same token.
- *
- * ### Example
- *
- * ```typescript
- * expect(() => Injector.resolveAndCreate([
- * { provide: "Strings", useValue: "string1", multi: true},
- * { provide: "Strings", useValue: "string2", multi: false}
- * ])).toThrowError();
- * ```
- * @param {?} provider1
- * @param {?} provider2
- * @return {?}
- */
- function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
- return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A unique object used for retrieving items from the {\@link ReflectiveInjector}.
- *
- * Keys have:
- * - a system-wide unique `id`.
- * - a `token`.
- *
- * `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows
- * the
- * injector to store created objects in a more efficient way.
- *
- * `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when
- * resolving
- * providers.
- * @deprecated No replacement
- */
- var ReflectiveKey = /** @class */ (function () {
- /**
- * Private
- */
- function ReflectiveKey(token, id) {
- this.token = token;
- this.id = id;
- if (!token) {
- throw new Error('Token must be defined!');
- }
- this.displayName = stringify(this.token);
- }
- /**
- * Retrieves a `Key` for a token.
- */
- /**
- * Retrieves a `Key` for a token.
- * @param {?} token
- * @return {?}
- */
- ReflectiveKey.get = /**
- * Retrieves a `Key` for a token.
- * @param {?} token
- * @return {?}
- */
- function (token) {
- return _globalKeyRegistry.get(resolveForwardRef(token));
- };
- Object.defineProperty(ReflectiveKey, "numberOfKeys", {
- /**
- * @returns the number of keys registered in the system.
- */
- get: /**
- * @return {?} the number of keys registered in the system.
- */
- function () { return _globalKeyRegistry.numberOfKeys; },
- enumerable: true,
- configurable: true
- });
- return ReflectiveKey;
- }());
- var KeyRegistry = /** @class */ (function () {
- function KeyRegistry() {
- this._allKeys = new Map();
- }
- /**
- * @param {?} token
- * @return {?}
- */
- KeyRegistry.prototype.get = /**
- * @param {?} token
- * @return {?}
- */
- function (token) {
- if (token instanceof ReflectiveKey)
- return token;
- if (this._allKeys.has(token)) {
- return /** @type {?} */ ((this._allKeys.get(token)));
- }
- var /** @type {?} */ newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
- this._allKeys.set(token, newKey);
- return newKey;
- };
- Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", {
- get: /**
- * @return {?}
- */
- function () { return this._allKeys.size; },
- enumerable: true,
- configurable: true
- });
- return KeyRegistry;
- }());
- var _globalKeyRegistry = new KeyRegistry();
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@whatItDoes Represents a type that a Component or other object is instances of.
- *
- * \@description
- *
- * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
- * the `MyCustomComponent` constructor function.
- *
- * \@stable
- */
- var Type = Function;
- /**
- * @param {?} v
- * @return {?}
- */
- function isType(v) {
- return typeof v === 'function';
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Attention: These regex has to hold even if the code is minified!
- */
- var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/;
- var INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{/;
- var INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{[\s\S]*constructor\s*\(/;
- var ReflectionCapabilities = /** @class */ (function () {
- function ReflectionCapabilities(reflect) {
- this._reflect = reflect || _global['Reflect'];
- }
- /**
- * @return {?}
- */
- ReflectionCapabilities.prototype.isReflectionEnabled = /**
- * @return {?}
- */
- function () { return true; };
- /**
- * @template T
- * @param {?} t
- * @return {?}
- */
- ReflectionCapabilities.prototype.factory = /**
- * @template T
- * @param {?} t
- * @return {?}
- */
- function (t) { return function () {
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- return new (t.bind.apply(t, [void 0].concat(args)))();
- }; };
- /** @internal */
- /**
- * \@internal
- * @param {?} paramTypes
- * @param {?} paramAnnotations
- * @return {?}
- */
- ReflectionCapabilities.prototype._zipTypesAndAnnotations = /**
- * \@internal
- * @param {?} paramTypes
- * @param {?} paramAnnotations
- * @return {?}
- */
- function (paramTypes, paramAnnotations) {
- var /** @type {?} */ result;
- if (typeof paramTypes === 'undefined') {
- result = new Array(paramAnnotations.length);
- }
- else {
- result = new Array(paramTypes.length);
- }
- for (var /** @type {?} */ i = 0; i < result.length; i++) {
- // TS outputs Object for parameters without types, while Traceur omits
- // the annotations. For now we preserve the Traceur behavior to aid
- // migration, but this can be revisited.
- if (typeof paramTypes === 'undefined') {
- result[i] = [];
- }
- else if (paramTypes[i] != Object) {
- result[i] = [paramTypes[i]];
- }
- else {
- result[i] = [];
- }
- if (paramAnnotations && paramAnnotations[i] != null) {
- result[i] = result[i].concat(paramAnnotations[i]);
- }
- }
- return result;
- };
- /**
- * @param {?} type
- * @param {?} parentCtor
- * @return {?}
- */
- ReflectionCapabilities.prototype._ownParameters = /**
- * @param {?} type
- * @param {?} parentCtor
- * @return {?}
- */
- function (type, parentCtor) {
- var /** @type {?} */ typeStr = type.toString();
- // If we have no decorators, we only have function.length as metadata.
- // In that case, to detect whether a child class declared an own constructor or not,
- // we need to look inside of that constructor to check whether it is
- // just calling the parent.
- // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439
- // that sets 'design:paramtypes' to []
- // if a class inherits from another class but has no ctor declared itself.
- if (DELEGATE_CTOR.exec(typeStr) ||
- (INHERITED_CLASS.exec(typeStr) && !INHERITED_CLASS_WITH_CTOR.exec(typeStr))) {
- return null;
- }
- // Prefer the direct API.
- if ((/** @type {?} */ (type)).parameters && (/** @type {?} */ (type)).parameters !== parentCtor.parameters) {
- return (/** @type {?} */ (type)).parameters;
- }
- // API of tsickle for lowering decorators to properties on the class.
- var /** @type {?} */ tsickleCtorParams = (/** @type {?} */ (type)).ctorParameters;
- if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
- // Newer tsickle uses a function closure
- // Retain the non-function case for compatibility with older tsickle
- var /** @type {?} */ ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
- var /** @type {?} */ paramTypes_1 = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
- var /** @type {?} */ paramAnnotations_1 = ctorParameters.map(function (ctorParam) {
- return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators);
- });
- return this._zipTypesAndAnnotations(paramTypes_1, paramAnnotations_1);
- }
- // API for metadata created by invoking the decorators.
- var /** @type {?} */ paramAnnotations = type.hasOwnProperty(PARAMETERS) && (/** @type {?} */ (type))[PARAMETERS];
- var /** @type {?} */ paramTypes = this._reflect && this._reflect.getOwnMetadata &&
- this._reflect.getOwnMetadata('design:paramtypes', type);
- if (paramTypes || paramAnnotations) {
- return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
- }
- // If a class has no decorators, at least create metadata
- // based on function.length.
- // Note: We know that this is a real constructor as we checked
- // the content of the constructor above.
- return new Array((/** @type {?} */ (type.length))).fill(undefined);
- };
- /**
- * @param {?} type
- * @return {?}
- */
- ReflectionCapabilities.prototype.parameters = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- // Note: only report metadata if we have at least one class decorator
- // to stay in sync with the static reflector.
- if (!isType(type)) {
- return [];
- }
- var /** @type {?} */ parentCtor = getParentCtor(type);
- var /** @type {?} */ parameters = this._ownParameters(type, parentCtor);
- if (!parameters && parentCtor !== Object) {
- parameters = this.parameters(parentCtor);
- }
- return parameters || [];
- };
- /**
- * @param {?} typeOrFunc
- * @param {?} parentCtor
- * @return {?}
- */
- ReflectionCapabilities.prototype._ownAnnotations = /**
- * @param {?} typeOrFunc
- * @param {?} parentCtor
- * @return {?}
- */
- function (typeOrFunc, parentCtor) {
- // Prefer the direct API.
- if ((/** @type {?} */ (typeOrFunc)).annotations && (/** @type {?} */ (typeOrFunc)).annotations !== parentCtor.annotations) {
- var /** @type {?} */ annotations = (/** @type {?} */ (typeOrFunc)).annotations;
- if (typeof annotations === 'function' && annotations.annotations) {
- annotations = annotations.annotations;
- }
- return annotations;
- }
- // API of tsickle for lowering decorators to properties on the class.
- if ((/** @type {?} */ (typeOrFunc)).decorators && (/** @type {?} */ (typeOrFunc)).decorators !== parentCtor.decorators) {
- return convertTsickleDecoratorIntoMetadata((/** @type {?} */ (typeOrFunc)).decorators);
- }
- // API for metadata created by invoking the decorators.
- if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {
- return (/** @type {?} */ (typeOrFunc))[ANNOTATIONS];
- }
- return null;
- };
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- ReflectionCapabilities.prototype.annotations = /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (typeOrFunc) {
- if (!isType(typeOrFunc)) {
- return [];
- }
- var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
- var /** @type {?} */ ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
- var /** @type {?} */ parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
- return parentAnnotations.concat(ownAnnotations);
- };
- /**
- * @param {?} typeOrFunc
- * @param {?} parentCtor
- * @return {?}
- */
- ReflectionCapabilities.prototype._ownPropMetadata = /**
- * @param {?} typeOrFunc
- * @param {?} parentCtor
- * @return {?}
- */
- function (typeOrFunc, parentCtor) {
- // Prefer the direct API.
- if ((/** @type {?} */ (typeOrFunc)).propMetadata &&
- (/** @type {?} */ (typeOrFunc)).propMetadata !== parentCtor.propMetadata) {
- var /** @type {?} */ propMetadata = (/** @type {?} */ (typeOrFunc)).propMetadata;
- if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
- propMetadata = propMetadata.propMetadata;
- }
- return propMetadata;
- }
- // API of tsickle for lowering decorators to properties on the class.
- if ((/** @type {?} */ (typeOrFunc)).propDecorators &&
- (/** @type {?} */ (typeOrFunc)).propDecorators !== parentCtor.propDecorators) {
- var /** @type {?} */ propDecorators_1 = (/** @type {?} */ (typeOrFunc)).propDecorators;
- var /** @type {?} */ propMetadata_1 = /** @type {?} */ ({});
- Object.keys(propDecorators_1).forEach(function (prop) {
- propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
- });
- return propMetadata_1;
- }
- // API for metadata created by invoking the decorators.
- if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
- return (/** @type {?} */ (typeOrFunc))[PROP_METADATA];
- }
- return null;
- };
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- ReflectionCapabilities.prototype.propMetadata = /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (typeOrFunc) {
- if (!isType(typeOrFunc)) {
- return {};
- }
- var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
- var /** @type {?} */ propMetadata = {};
- if (parentCtor !== Object) {
- var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentCtor);
- Object.keys(parentPropMetadata_1).forEach(function (propName) {
- propMetadata[propName] = parentPropMetadata_1[propName];
- });
- }
- var /** @type {?} */ ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
- if (ownPropMetadata) {
- Object.keys(ownPropMetadata).forEach(function (propName) {
- var /** @type {?} */ decorators = [];
- if (propMetadata.hasOwnProperty(propName)) {
- decorators.push.apply(decorators, propMetadata[propName]);
- }
- decorators.push.apply(decorators, ownPropMetadata[propName]);
- propMetadata[propName] = decorators;
- });
- }
- return propMetadata;
- };
- /**
- * @param {?} type
- * @param {?} lcProperty
- * @return {?}
- */
- ReflectionCapabilities.prototype.hasLifecycleHook = /**
- * @param {?} type
- * @param {?} lcProperty
- * @return {?}
- */
- function (type, lcProperty) {
- return type instanceof Type && lcProperty in type.prototype;
- };
- /**
- * @param {?} type
- * @return {?}
- */
- ReflectionCapabilities.prototype.guards = /**
- * @param {?} type
- * @return {?}
- */
- function (type) { return {}; };
- /**
- * @param {?} name
- * @return {?}
- */
- ReflectionCapabilities.prototype.getter = /**
- * @param {?} name
- * @return {?}
- */
- function (name) { return /** @type {?} */ (new Function('o', 'return o.' + name + ';')); };
- /**
- * @param {?} name
- * @return {?}
- */
- ReflectionCapabilities.prototype.setter = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- return /** @type {?} */ (new Function('o', 'v', 'return o.' + name + ' = v;'));
- };
- /**
- * @param {?} name
- * @return {?}
- */
- ReflectionCapabilities.prototype.method = /**
- * @param {?} name
- * @return {?}
- */
- function (name) {
- var /** @type {?} */ functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
- return /** @type {?} */ (new Function('o', 'args', functionBody));
- };
- // There is not a concept of import uri in Js, but this is useful in developing Dart applications.
- /**
- * @param {?} type
- * @return {?}
- */
- ReflectionCapabilities.prototype.importUri = /**
- * @param {?} type
- * @return {?}
- */
- function (type) {
- // StaticSymbol
- if (typeof type === 'object' && type['filePath']) {
- return type['filePath'];
- }
- // Runtime type
- return "./" + stringify(type);
- };
- /**
- * @param {?} type
- * @return {?}
- */
- ReflectionCapabilities.prototype.resourceUri = /**
- * @param {?} type
- * @return {?}
- */
- function (type) { return "./" + stringify(type); };
- /**
- * @param {?} name
- * @param {?} moduleUrl
- * @param {?} members
- * @param {?} runtime
- * @return {?}
- */
- ReflectionCapabilities.prototype.resolveIdentifier = /**
- * @param {?} name
- * @param {?} moduleUrl
- * @param {?} members
- * @param {?} runtime
- * @return {?}
- */
- function (name, moduleUrl, members, runtime) {
- return runtime;
- };
- /**
- * @param {?} enumIdentifier
- * @param {?} name
- * @return {?}
- */
- ReflectionCapabilities.prototype.resolveEnum = /**
- * @param {?} enumIdentifier
- * @param {?} name
- * @return {?}
- */
- function (enumIdentifier, name) { return enumIdentifier[name]; };
- return ReflectionCapabilities;
- }());
- /**
- * @param {?} decoratorInvocations
- * @return {?}
- */
- function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
- if (!decoratorInvocations) {
- return [];
- }
- return decoratorInvocations.map(function (decoratorInvocation) {
- var /** @type {?} */ decoratorType = decoratorInvocation.type;
- var /** @type {?} */ annotationCls = decoratorType.annotationCls;
- var /** @type {?} */ annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
- return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))();
- });
- }
- /**
- * @param {?} ctor
- * @return {?}
- */
- function getParentCtor(ctor) {
- var /** @type {?} */ parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
- var /** @type {?} */ parentCtor = parentProto ? parentProto.constructor : null;
- // Note: We always use `Object` as the null value
- // to simplify checking later on.
- return parentCtor || Object;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Provides access to reflection data about symbols. Used internally by Angular
- * to power dependency injection and compilation.
- */
- var Reflector = /** @class */ (function () {
- function Reflector(reflectionCapabilities) {
- this.reflectionCapabilities = reflectionCapabilities;
- }
- /**
- * @param {?} caps
- * @return {?}
- */
- Reflector.prototype.updateCapabilities = /**
- * @param {?} caps
- * @return {?}
- */
- function (caps) { this.reflectionCapabilities = caps; };
- /**
- * @param {?} type
- * @return {?}
- */
- Reflector.prototype.factory = /**
- * @param {?} type
- * @return {?}
- */
- function (type) { return this.reflectionCapabilities.factory(type); };
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- Reflector.prototype.parameters = /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (typeOrFunc) {
- return this.reflectionCapabilities.parameters(typeOrFunc);
- };
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- Reflector.prototype.annotations = /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (typeOrFunc) {
- return this.reflectionCapabilities.annotations(typeOrFunc);
- };
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- Reflector.prototype.propMetadata = /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (typeOrFunc) {
- return this.reflectionCapabilities.propMetadata(typeOrFunc);
- };
- /**
- * @param {?} type
- * @param {?} lcProperty
- * @return {?}
- */
- Reflector.prototype.hasLifecycleHook = /**
- * @param {?} type
- * @param {?} lcProperty
- * @return {?}
- */
- function (type, lcProperty) {
- return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
- };
- /**
- * @param {?} name
- * @return {?}
- */
- Reflector.prototype.getter = /**
- * @param {?} name
- * @return {?}
- */
- function (name) { return this.reflectionCapabilities.getter(name); };
- /**
- * @param {?} name
- * @return {?}
- */
- Reflector.prototype.setter = /**
- * @param {?} name
- * @return {?}
- */
- function (name) { return this.reflectionCapabilities.setter(name); };
- /**
- * @param {?} name
- * @return {?}
- */
- Reflector.prototype.method = /**
- * @param {?} name
- * @return {?}
- */
- function (name) { return this.reflectionCapabilities.method(name); };
- /**
- * @param {?} type
- * @return {?}
- */
- Reflector.prototype.importUri = /**
- * @param {?} type
- * @return {?}
- */
- function (type) { return this.reflectionCapabilities.importUri(type); };
- /**
- * @param {?} type
- * @return {?}
- */
- Reflector.prototype.resourceUri = /**
- * @param {?} type
- * @return {?}
- */
- function (type) { return this.reflectionCapabilities.resourceUri(type); };
- /**
- * @param {?} name
- * @param {?} moduleUrl
- * @param {?} members
- * @param {?} runtime
- * @return {?}
- */
- Reflector.prototype.resolveIdentifier = /**
- * @param {?} name
- * @param {?} moduleUrl
- * @param {?} members
- * @param {?} runtime
- * @return {?}
- */
- function (name, moduleUrl, members, runtime) {
- return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
- };
- /**
- * @param {?} identifier
- * @param {?} name
- * @return {?}
- */
- Reflector.prototype.resolveEnum = /**
- * @param {?} identifier
- * @param {?} name
- * @return {?}
- */
- function (identifier, name) {
- return this.reflectionCapabilities.resolveEnum(identifier, name);
- };
- return Reflector;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * The {\@link Reflector} used internally in Angular to access metadata
- * about symbols.
- */
- var reflector = new Reflector(new ReflectionCapabilities());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * `Dependency` is used by the framework to extend DI.
- * This is internal to Angular and should not be used directly.
- */
- var ReflectiveDependency = /** @class */ (function () {
- function ReflectiveDependency(key, optional, visibility) {
- this.key = key;
- this.optional = optional;
- this.visibility = visibility;
- }
- /**
- * @param {?} key
- * @return {?}
- */
- ReflectiveDependency.fromKey = /**
- * @param {?} key
- * @return {?}
- */
- function (key) {
- return new ReflectiveDependency(key, false, null);
- };
- return ReflectiveDependency;
- }());
- var _EMPTY_LIST = [];
- /**
- * An internal resolved representation of a {\@link Provider} used by the {\@link Injector}.
- *
- * It is usually created automatically by `Injector.resolveAndCreate`.
- *
- * It can be created manually, as follows:
- *
- * ### Example ([live demo](http://plnkr.co/edit/RfEnhh8kUEI0G3qsnIeT?p%3Dpreview&p=preview))
- *
- * ```typescript
- * var resolvedProviders = Injector.resolve([{ provide: 'message', useValue: 'Hello' }]);
- * var injector = Injector.fromResolvedProviders(resolvedProviders);
- *
- * expect(injector.get('message')).toEqual('Hello');
- * ```
- *
- * \@experimental
- * @record
- */
- var ResolvedReflectiveProvider_ = /** @class */ (function () {
- function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) {
- this.key = key;
- this.resolvedFactories = resolvedFactories;
- this.multiProvider = multiProvider;
- this.resolvedFactory = this.resolvedFactories[0];
- }
- return ResolvedReflectiveProvider_;
- }());
- /**
- * An internal resolved representation of a factory function created by resolving {\@link
- * Provider}.
- * \@experimental
- */
- var ResolvedReflectiveFactory = /** @class */ (function () {
- function ResolvedReflectiveFactory(factory, dependencies) {
- this.factory = factory;
- this.dependencies = dependencies;
- }
- return ResolvedReflectiveFactory;
- }());
- /**
- * Resolve a single provider.
- * @param {?} provider
- * @return {?}
- */
- function resolveReflectiveFactory(provider) {
- var /** @type {?} */ factoryFn;
- var /** @type {?} */ resolvedDeps;
- if (provider.useClass) {
- var /** @type {?} */ useClass = resolveForwardRef(provider.useClass);
- factoryFn = reflector.factory(useClass);
- resolvedDeps = _dependenciesFor(useClass);
- }
- else if (provider.useExisting) {
- factoryFn = function (aliasInstance) { return aliasInstance; };
- resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
- }
- else if (provider.useFactory) {
- factoryFn = provider.useFactory;
- resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
- }
- else {
- factoryFn = function () { return provider.useValue; };
- resolvedDeps = _EMPTY_LIST;
- }
- return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
- }
- /**
- * Converts the {\@link Provider} into {\@link ResolvedProvider}.
- *
- * {\@link Injector} internally only uses {\@link ResolvedProvider}, {\@link Provider} contains
- * convenience provider syntax.
- * @param {?} provider
- * @return {?}
- */
- function resolveReflectiveProvider(provider) {
- return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
- }
- /**
- * Resolve a list of Providers.
- * @param {?} providers
- * @return {?}
- */
- function resolveReflectiveProviders(providers) {
- var /** @type {?} */ normalized = _normalizeProviders(providers, []);
- var /** @type {?} */ resolved = normalized.map(resolveReflectiveProvider);
- var /** @type {?} */ resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
- return Array.from(resolvedProviderMap.values());
- }
- /**
- * Merges a list of ResolvedProviders into a list where
- * each key is contained exactly once and multi providers
- * have been merged.
- * @param {?} providers
- * @param {?} normalizedProvidersMap
- * @return {?}
- */
- function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
- for (var /** @type {?} */ i = 0; i < providers.length; i++) {
- var /** @type {?} */ provider = providers[i];
- var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id);
- if (existing) {
- if (provider.multiProvider !== existing.multiProvider) {
- throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
- }
- if (provider.multiProvider) {
- for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) {
- existing.resolvedFactories.push(provider.resolvedFactories[j]);
- }
- }
- else {
- normalizedProvidersMap.set(provider.key.id, provider);
- }
- }
- else {
- var /** @type {?} */ resolvedProvider = void 0;
- if (provider.multiProvider) {
- resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
- }
- else {
- resolvedProvider = provider;
- }
- normalizedProvidersMap.set(provider.key.id, resolvedProvider);
- }
- }
- return normalizedProvidersMap;
- }
- /**
- * @param {?} providers
- * @param {?} res
- * @return {?}
- */
- function _normalizeProviders(providers, res) {
- providers.forEach(function (b) {
- if (b instanceof Type) {
- res.push({ provide: b, useClass: b });
- }
- else if (b && typeof b == 'object' && (/** @type {?} */ (b)).provide !== undefined) {
- res.push(/** @type {?} */ (b));
- }
- else if (b instanceof Array) {
- _normalizeProviders(b, res);
- }
- else {
- throw invalidProviderError(b);
- }
- });
- return res;
- }
- /**
- * @param {?} typeOrFunc
- * @param {?=} dependencies
- * @return {?}
- */
- function constructDependencies(typeOrFunc, dependencies) {
- if (!dependencies) {
- return _dependenciesFor(typeOrFunc);
- }
- else {
- var /** @type {?} */ params_1 = dependencies.map(function (t) { return [t]; });
- return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); });
- }
- }
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function _dependenciesFor(typeOrFunc) {
- var /** @type {?} */ params = reflector.parameters(typeOrFunc);
- if (!params)
- return [];
- if (params.some(function (p) { return p == null; })) {
- throw noAnnotationError(typeOrFunc, params);
- }
- return params.map(function (p) { return _extractToken(typeOrFunc, p, params); });
- }
- /**
- * @param {?} typeOrFunc
- * @param {?} metadata
- * @param {?} params
- * @return {?}
- */
- function _extractToken(typeOrFunc, metadata, params) {
- var /** @type {?} */ token = null;
- var /** @type {?} */ optional = false;
- if (!Array.isArray(metadata)) {
- if (metadata instanceof Inject) {
- return _createDependency(metadata.token, optional, null);
- }
- else {
- return _createDependency(metadata, optional, null);
- }
- }
- var /** @type {?} */ visibility = null;
- for (var /** @type {?} */ i = 0; i < metadata.length; ++i) {
- var /** @type {?} */ paramMetadata = metadata[i];
- if (paramMetadata instanceof Type) {
- token = paramMetadata;
- }
- else if (paramMetadata instanceof Inject) {
- token = paramMetadata.token;
- }
- else if (paramMetadata instanceof Optional) {
- optional = true;
- }
- else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
- visibility = paramMetadata;
- }
- else if (paramMetadata instanceof InjectionToken) {
- token = paramMetadata;
- }
- }
- token = resolveForwardRef(token);
- if (token != null) {
- return _createDependency(token, optional, visibility);
- }
- else {
- throw noAnnotationError(typeOrFunc, params);
- }
- }
- /**
- * @param {?} token
- * @param {?} optional
- * @param {?} visibility
- * @return {?}
- */
- function _createDependency(token, optional, visibility) {
- return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // Threshold for the dynamic version
- var UNDEFINED = new Object();
- /**
- * A ReflectiveDependency injection container used for instantiating objects and resolving
- * dependencies.
- *
- * An `Injector` is a replacement for a `new` operator, which can automatically resolve the
- * constructor dependencies.
- *
- * In typical use, application code asks for the dependencies in the constructor and they are
- * resolved by the `Injector`.
- *
- * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview))
- *
- * The following example creates an `Injector` configured to create `Engine` and `Car`.
- *
- * ```typescript
- * \@Injectable()
- * class Engine {
- * }
- *
- * \@Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
- * var car = injector.get(Car);
- * expect(car instanceof Car).toBe(true);
- * expect(car.engine instanceof Engine).toBe(true);
- * ```
- *
- * Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
- * resolve all of the object's dependencies automatically.
- *
- * @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead.
- * @abstract
- */
- var ReflectiveInjector = /** @class */ (function () {
- function ReflectiveInjector() {
- }
- /**
- * Turns an array of provider definitions into an array of resolved providers.
- *
- * A resolution is a process of flattening multiple nested arrays and converting individual
- * providers into an array of {@link ResolvedReflectiveProvider}s.
- *
- * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
- *
- * ```typescript
- * @Injectable()
- * class Engine {
- * }
- *
- * @Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
- *
- * expect(providers.length).toEqual(2);
- *
- * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
- * expect(providers[0].key.displayName).toBe("Car");
- * expect(providers[0].dependencies.length).toEqual(1);
- * expect(providers[0].factory).toBeDefined();
- *
- * expect(providers[1].key.displayName).toBe("Engine");
- * });
- * ```
- *
- * See {@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
- */
- /**
- * Turns an array of provider definitions into an array of resolved providers.
- *
- * A resolution is a process of flattening multiple nested arrays and converting individual
- * providers into an array of {\@link ResolvedReflectiveProvider}s.
- *
- * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
- *
- * ```typescript
- * \@Injectable()
- * class Engine {
- * }
- *
- * \@Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
- *
- * expect(providers.length).toEqual(2);
- *
- * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
- * expect(providers[0].key.displayName).toBe("Car");
- * expect(providers[0].dependencies.length).toEqual(1);
- * expect(providers[0].factory).toBeDefined();
- *
- * expect(providers[1].key.displayName).toBe("Engine");
- * });
- * ```
- *
- * See {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
- * @param {?} providers
- * @return {?}
- */
- ReflectiveInjector.resolve = /**
- * Turns an array of provider definitions into an array of resolved providers.
- *
- * A resolution is a process of flattening multiple nested arrays and converting individual
- * providers into an array of {\@link ResolvedReflectiveProvider}s.
- *
- * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
- *
- * ```typescript
- * \@Injectable()
- * class Engine {
- * }
- *
- * \@Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
- *
- * expect(providers.length).toEqual(2);
- *
- * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
- * expect(providers[0].key.displayName).toBe("Car");
- * expect(providers[0].dependencies.length).toEqual(1);
- * expect(providers[0].factory).toBeDefined();
- *
- * expect(providers[1].key.displayName).toBe("Engine");
- * });
- * ```
- *
- * See {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
- * @param {?} providers
- * @return {?}
- */
- function (providers) {
- return resolveReflectiveProviders(providers);
- };
- /**
- * Resolves an array of providers and creates an injector from those providers.
- *
- * The passed-in providers can be an array of `Type`, {@link Provider},
- * or a recursive array of more providers.
- *
- * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
- *
- * ```typescript
- * @Injectable()
- * class Engine {
- * }
- *
- * @Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
- * expect(injector.get(Car) instanceof Car).toBe(true);
- * ```
- *
- * This function is slower than the corresponding `fromResolvedProviders`
- * because it needs to resolve the passed-in providers first.
- * See {@link ReflectiveInjector#resolve resolve} and
- * {@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
- */
- /**
- * Resolves an array of providers and creates an injector from those providers.
- *
- * The passed-in providers can be an array of `Type`, {\@link Provider},
- * or a recursive array of more providers.
- *
- * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
- *
- * ```typescript
- * \@Injectable()
- * class Engine {
- * }
- *
- * \@Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
- * expect(injector.get(Car) instanceof Car).toBe(true);
- * ```
- *
- * This function is slower than the corresponding `fromResolvedProviders`
- * because it needs to resolve the passed-in providers first.
- * See {\@link ReflectiveInjector#resolve resolve} and
- * {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
- * @param {?} providers
- * @param {?=} parent
- * @return {?}
- */
- ReflectiveInjector.resolveAndCreate = /**
- * Resolves an array of providers and creates an injector from those providers.
- *
- * The passed-in providers can be an array of `Type`, {\@link Provider},
- * or a recursive array of more providers.
- *
- * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
- *
- * ```typescript
- * \@Injectable()
- * class Engine {
- * }
- *
- * \@Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
- * expect(injector.get(Car) instanceof Car).toBe(true);
- * ```
- *
- * This function is slower than the corresponding `fromResolvedProviders`
- * because it needs to resolve the passed-in providers first.
- * See {\@link ReflectiveInjector#resolve resolve} and
- * {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
- * @param {?} providers
- * @param {?=} parent
- * @return {?}
- */
- function (providers, parent) {
- var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
- return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
- };
- /**
- * Creates an injector from previously resolved providers.
- *
- * This API is the recommended way to construct injectors in performance-sensitive parts.
- *
- * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
- *
- * ```typescript
- * @Injectable()
- * class Engine {
- * }
- *
- * @Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var providers = ReflectiveInjector.resolve([Car, Engine]);
- * var injector = ReflectiveInjector.fromResolvedProviders(providers);
- * expect(injector.get(Car) instanceof Car).toBe(true);
- * ```
- * @experimental
- */
- /**
- * Creates an injector from previously resolved providers.
- *
- * This API is the recommended way to construct injectors in performance-sensitive parts.
- *
- * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
- *
- * ```typescript
- * \@Injectable()
- * class Engine {
- * }
- *
- * \@Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var providers = ReflectiveInjector.resolve([Car, Engine]);
- * var injector = ReflectiveInjector.fromResolvedProviders(providers);
- * expect(injector.get(Car) instanceof Car).toBe(true);
- * ```
- * \@experimental
- * @param {?} providers
- * @param {?=} parent
- * @return {?}
- */
- ReflectiveInjector.fromResolvedProviders = /**
- * Creates an injector from previously resolved providers.
- *
- * This API is the recommended way to construct injectors in performance-sensitive parts.
- *
- * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
- *
- * ```typescript
- * \@Injectable()
- * class Engine {
- * }
- *
- * \@Injectable()
- * class Car {
- * constructor(public engine:Engine) {}
- * }
- *
- * var providers = ReflectiveInjector.resolve([Car, Engine]);
- * var injector = ReflectiveInjector.fromResolvedProviders(providers);
- * expect(injector.get(Car) instanceof Car).toBe(true);
- * ```
- * \@experimental
- * @param {?} providers
- * @param {?=} parent
- * @return {?}
- */
- function (providers, parent) {
- return new ReflectiveInjector_(providers, parent);
- };
- return ReflectiveInjector;
- }());
- var ReflectiveInjector_ = /** @class */ (function () {
- /**
- * Private
- */
- function ReflectiveInjector_(_providers, _parent) {
- /**
- * \@internal
- */
- this._constructionCounter = 0;
- this._providers = _providers;
- this.parent = _parent || null;
- var /** @type {?} */ len = _providers.length;
- this.keyIds = new Array(len);
- this.objs = new Array(len);
- for (var /** @type {?} */ i = 0; i < len; i++) {
- this.keyIds[i] = _providers[i].key.id;
- this.objs[i] = UNDEFINED;
- }
- }
- /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- ReflectiveInjector_.prototype.get = /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- function (token, notFoundValue) {
- if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
- return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
- };
- /**
- * @param {?} providers
- * @return {?}
- */
- ReflectiveInjector_.prototype.resolveAndCreateChild = /**
- * @param {?} providers
- * @return {?}
- */
- function (providers) {
- var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
- return this.createChildFromResolved(ResolvedReflectiveProviders);
- };
- /**
- * @param {?} providers
- * @return {?}
- */
- ReflectiveInjector_.prototype.createChildFromResolved = /**
- * @param {?} providers
- * @return {?}
- */
- function (providers) {
- var /** @type {?} */ inj = new ReflectiveInjector_(providers);
- (/** @type {?} */ (inj)).parent = this;
- return inj;
- };
- /**
- * @param {?} provider
- * @return {?}
- */
- ReflectiveInjector_.prototype.resolveAndInstantiate = /**
- * @param {?} provider
- * @return {?}
- */
- function (provider) {
- return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
- };
- /**
- * @param {?} provider
- * @return {?}
- */
- ReflectiveInjector_.prototype.instantiateResolved = /**
- * @param {?} provider
- * @return {?}
- */
- function (provider) {
- return this._instantiateProvider(provider);
- };
- /**
- * @param {?} index
- * @return {?}
- */
- ReflectiveInjector_.prototype.getProviderAtIndex = /**
- * @param {?} index
- * @return {?}
- */
- function (index) {
- if (index < 0 || index >= this._providers.length) {
- throw outOfBoundsError(index);
- }
- return this._providers[index];
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} provider
- * @return {?}
- */
- ReflectiveInjector_.prototype._new = /**
- * \@internal
- * @param {?} provider
- * @return {?}
- */
- function (provider) {
- if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
- throw cyclicDependencyError(this, provider.key);
- }
- return this._instantiateProvider(provider);
- };
- /**
- * @return {?}
- */
- ReflectiveInjector_.prototype._getMaxNumberOfObjects = /**
- * @return {?}
- */
- function () { return this.objs.length; };
- /**
- * @param {?} provider
- * @return {?}
- */
- ReflectiveInjector_.prototype._instantiateProvider = /**
- * @param {?} provider
- * @return {?}
- */
- function (provider) {
- if (provider.multiProvider) {
- var /** @type {?} */ res = new Array(provider.resolvedFactories.length);
- for (var /** @type {?} */ i = 0; i < provider.resolvedFactories.length; ++i) {
- res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
- }
- return res;
- }
- else {
- return this._instantiate(provider, provider.resolvedFactories[0]);
- }
- };
- /**
- * @param {?} provider
- * @param {?} ResolvedReflectiveFactory
- * @return {?}
- */
- ReflectiveInjector_.prototype._instantiate = /**
- * @param {?} provider
- * @param {?} ResolvedReflectiveFactory
- * @return {?}
- */
- function (provider, ResolvedReflectiveFactory$$1) {
- var _this = this;
- var /** @type {?} */ factory = ResolvedReflectiveFactory$$1.factory;
- var /** @type {?} */ deps;
- try {
- deps =
- ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); });
- }
- catch (/** @type {?} */ e) {
- if (e.addKey) {
- e.addKey(this, provider.key);
- }
- throw e;
- }
- var /** @type {?} */ obj;
- try {
- obj = factory.apply(void 0, deps);
- }
- catch (/** @type {?} */ e) {
- throw instantiationError(this, e, e.stack, provider.key);
- }
- return obj;
- };
- /**
- * @param {?} dep
- * @return {?}
- */
- ReflectiveInjector_.prototype._getByReflectiveDependency = /**
- * @param {?} dep
- * @return {?}
- */
- function (dep) {
- return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
- };
- /**
- * @param {?} key
- * @param {?} visibility
- * @param {?} notFoundValue
- * @return {?}
- */
- ReflectiveInjector_.prototype._getByKey = /**
- * @param {?} key
- * @param {?} visibility
- * @param {?} notFoundValue
- * @return {?}
- */
- function (key, visibility, notFoundValue) {
- if (key === ReflectiveInjector_.INJECTOR_KEY) {
- return this;
- }
- if (visibility instanceof Self) {
- return this._getByKeySelf(key, notFoundValue);
- }
- else {
- return this._getByKeyDefault(key, notFoundValue, visibility);
- }
- };
- /**
- * @param {?} keyId
- * @return {?}
- */
- ReflectiveInjector_.prototype._getObjByKeyId = /**
- * @param {?} keyId
- * @return {?}
- */
- function (keyId) {
- for (var /** @type {?} */ i = 0; i < this.keyIds.length; i++) {
- if (this.keyIds[i] === keyId) {
- if (this.objs[i] === UNDEFINED) {
- this.objs[i] = this._new(this._providers[i]);
- }
- return this.objs[i];
- }
- }
- return UNDEFINED;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} key
- * @param {?} notFoundValue
- * @return {?}
- */
- ReflectiveInjector_.prototype._throwOrNull = /**
- * \@internal
- * @param {?} key
- * @param {?} notFoundValue
- * @return {?}
- */
- function (key, notFoundValue) {
- if (notFoundValue !== THROW_IF_NOT_FOUND) {
- return notFoundValue;
- }
- else {
- throw noProviderError(this, key);
- }
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} key
- * @param {?} notFoundValue
- * @return {?}
- */
- ReflectiveInjector_.prototype._getByKeySelf = /**
- * \@internal
- * @param {?} key
- * @param {?} notFoundValue
- * @return {?}
- */
- function (key, notFoundValue) {
- var /** @type {?} */ obj = this._getObjByKeyId(key.id);
- return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} key
- * @param {?} notFoundValue
- * @param {?} visibility
- * @return {?}
- */
- ReflectiveInjector_.prototype._getByKeyDefault = /**
- * \@internal
- * @param {?} key
- * @param {?} notFoundValue
- * @param {?} visibility
- * @return {?}
- */
- function (key, notFoundValue, visibility) {
- var /** @type {?} */ inj;
- if (visibility instanceof SkipSelf) {
- inj = this.parent;
- }
- else {
- inj = this;
- }
- while (inj instanceof ReflectiveInjector_) {
- var /** @type {?} */ inj_ = /** @type {?} */ (inj);
- var /** @type {?} */ obj = inj_._getObjByKeyId(key.id);
- if (obj !== UNDEFINED)
- return obj;
- inj = inj_.parent;
- }
- if (inj !== null) {
- return inj.get(key.token, notFoundValue);
- }
- else {
- return this._throwOrNull(key, notFoundValue);
- }
- };
- Object.defineProperty(ReflectiveInjector_.prototype, "displayName", {
- get: /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; })
- .join(', ');
- return "ReflectiveInjector(providers: [" + providers + "])";
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- ReflectiveInjector_.prototype.toString = /**
- * @return {?}
- */
- function () { return this.displayName; };
- ReflectiveInjector_.INJECTOR_KEY = ReflectiveKey.get(Injector);
- return ReflectiveInjector_;
- }());
- /**
- * @param {?} injector
- * @param {?} fn
- * @return {?}
- */
- function _mapProviders(injector, fn) {
- var /** @type {?} */ res = new Array(injector._providers.length);
- for (var /** @type {?} */ i = 0; i < injector._providers.length; ++i) {
- res[i] = fn(injector.getProviderAtIndex(i));
- }
- return res;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @module
- * @description
- * The `di` module provides dependency injection container services.
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Determine if the argument is shaped like a Promise
- * @param {?} obj
- * @return {?}
- */
- function isPromise(obj) {
- // allow any Promise/A+ compliant thenable.
- // It's up to the caller to ensure that obj.then conforms to the spec
- return !!obj && typeof obj.then === 'function';
- }
- /**
- * Determine if the argument is an Observable
- * @param {?} obj
- * @return {?}
- */
- function isObservable(obj) {
- // TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
- return !!obj && typeof obj.subscribe === 'function';
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A function that will be executed when an application is initialized.
- * \@experimental
- */
- var APP_INITIALIZER = new InjectionToken('Application Initializer');
- /**
- * A class that reflects the state of running {\@link APP_INITIALIZER}s.
- *
- * \@experimental
- */
- var ApplicationInitStatus = /** @class */ (function () {
- function ApplicationInitStatus(appInits) {
- var _this = this;
- this.appInits = appInits;
- this.initialized = false;
- this.done = false;
- this.donePromise = new Promise(function (res, rej) {
- _this.resolve = res;
- _this.reject = rej;
- });
- }
- /** @internal */
- /**
- * \@internal
- * @return {?}
- */
- ApplicationInitStatus.prototype.runInitializers = /**
- * \@internal
- * @return {?}
- */
- function () {
- var _this = this;
- if (this.initialized) {
- return;
- }
- var /** @type {?} */ asyncInitPromises = [];
- var /** @type {?} */ complete = function () {
- (/** @type {?} */ (_this)).done = true;
- _this.resolve();
- };
- if (this.appInits) {
- for (var /** @type {?} */ i = 0; i < this.appInits.length; i++) {
- var /** @type {?} */ initResult = this.appInits[i]();
- if (isPromise(initResult)) {
- asyncInitPromises.push(initResult);
- }
- }
- }
- Promise.all(asyncInitPromises).then(function () { complete(); }).catch(function (e) { _this.reject(e); });
- if (asyncInitPromises.length === 0) {
- complete();
- }
- this.initialized = true;
- };
- ApplicationInitStatus.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- ApplicationInitStatus.ctorParameters = function () { return [
- { type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] },
- ]; };
- return ApplicationInitStatus;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A DI Token representing a unique string id assigned to the application by Angular and used
- * primarily for prefixing application attributes and CSS styles when
- * {\@link ViewEncapsulation#Emulated ViewEncapsulation.Emulated} is being used.
- *
- * If you need to avoid randomly generated value to be used as an application id, you can provide
- * a custom value via a DI provider <!-- TODO: provider --> configuring the root {\@link Injector}
- * using this token.
- * \@experimental
- */
- var APP_ID = new InjectionToken('AppId');
- /**
- * @return {?}
- */
- function _appIdRandomProviderFactory() {
- return "" + _randomChar() + _randomChar() + _randomChar();
- }
- /**
- * Providers that will generate a random APP_ID_TOKEN.
- * \@experimental
- */
- var APP_ID_RANDOM_PROVIDER = {
- provide: APP_ID,
- useFactory: _appIdRandomProviderFactory,
- deps: /** @type {?} */ ([]),
- };
- /**
- * @return {?}
- */
- function _randomChar() {
- return String.fromCharCode(97 + Math.floor(Math.random() * 25));
- }
- /**
- * A function that will be executed when a platform is initialized.
- * \@experimental
- */
- var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
- /**
- * A token that indicates an opaque platform id.
- * \@experimental
- */
- var PLATFORM_ID = new InjectionToken('Platform ID');
- /**
- * All callbacks provided via this token will be called for every component that is bootstrapped.
- * Signature of the callback:
- *
- * `(componentRef: ComponentRef) => void`.
- *
- * \@experimental
- */
- var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
- /**
- * A token which indicates the root directory of the application
- * \@experimental
- */
- var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var Console = /** @class */ (function () {
- function Console() {
- }
- /**
- * @param {?} message
- * @return {?}
- */
- Console.prototype.log = /**
- * @param {?} message
- * @return {?}
- */
- function (message) {
- // tslint:disable-next-line:no-console
- console.log(message);
- };
- // Note: for reporting errors use `DOM.logError()` as it is platform specific
- /**
- * @param {?} message
- * @return {?}
- */
- Console.prototype.warn = /**
- * @param {?} message
- * @return {?}
- */
- function (message) {
- // tslint:disable-next-line:no-console
- console.warn(message);
- };
- Console.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- Console.ctorParameters = function () { return []; };
- return Console;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Combination of NgModuleFactory and ComponentFactorys.
- *
- * \@experimental
- */
- var ModuleWithComponentFactories = /** @class */ (function () {
- function ModuleWithComponentFactories(ngModuleFactory, componentFactories) {
- this.ngModuleFactory = ngModuleFactory;
- this.componentFactories = componentFactories;
- }
- return ModuleWithComponentFactories;
- }());
- /**
- * @return {?}
- */
- function _throwError() {
- throw new Error("Runtime compiler is not loaded");
- }
- /**
- * Low-level service for running the angular compiler during runtime
- * to create {\@link ComponentFactory}s, which
- * can later be used to create and render a Component instance.
- *
- * Each `\@NgModule` provides an own `Compiler` to its injector,
- * that will use the directives/pipes of the ng module for compilation
- * of components.
- * \@stable
- */
- var Compiler = /** @class */ (function () {
- function Compiler() {
- }
- /**
- * Compiles the given NgModule and all of its components. All templates of the components listed
- * in `entryComponents` have to be inlined.
- */
- /**
- * Compiles the given NgModule and all of its components. All templates of the components listed
- * in `entryComponents` have to be inlined.
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- Compiler.prototype.compileModuleSync = /**
- * Compiles the given NgModule and all of its components. All templates of the components listed
- * in `entryComponents` have to be inlined.
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) { throw _throwError(); };
- /**
- * Compiles the given NgModule and all of its components
- */
- /**
- * Compiles the given NgModule and all of its components
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- Compiler.prototype.compileModuleAsync = /**
- * Compiles the given NgModule and all of its components
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) { throw _throwError(); };
- /**
- * Same as {@link #compileModuleSync} but also creates ComponentFactories for all components.
- */
- /**
- * Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components.
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- Compiler.prototype.compileModuleAndAllComponentsSync = /**
- * Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components.
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- throw _throwError();
- };
- /**
- * Same as {@link #compileModuleAsync} but also creates ComponentFactories for all components.
- */
- /**
- * Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components.
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- Compiler.prototype.compileModuleAndAllComponentsAsync = /**
- * Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components.
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- throw _throwError();
- };
- /**
- * Clears all caches.
- */
- /**
- * Clears all caches.
- * @return {?}
- */
- Compiler.prototype.clearCache = /**
- * Clears all caches.
- * @return {?}
- */
- function () { };
- /**
- * Clears the cache for the given component/ngModule.
- */
- /**
- * Clears the cache for the given component/ngModule.
- * @param {?} type
- * @return {?}
- */
- Compiler.prototype.clearCacheFor = /**
- * Clears the cache for the given component/ngModule.
- * @param {?} type
- * @return {?}
- */
- function (type) { };
- Compiler.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- Compiler.ctorParameters = function () { return []; };
- return Compiler;
- }());
- /**
- * Token to provide CompilerOptions in the platform injector.
- *
- * \@experimental
- */
- var COMPILER_OPTIONS = new InjectionToken('compilerOptions');
- /**
- * A factory for creating a Compiler
- *
- * \@experimental
- * @abstract
- */
- var CompilerFactory = /** @class */ (function () {
- function CompilerFactory() {
- }
- return CompilerFactory;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Represents an instance of a Component created via a {\@link ComponentFactory}.
- *
- * `ComponentRef` provides access to the Component Instance as well other objects related to this
- * Component Instance and allows you to destroy the Component Instance via the {\@link #destroy}
- * method.
- * \@stable
- * @abstract
- */
- var ComponentRef = /** @class */ (function () {
- function ComponentRef() {
- }
- return ComponentRef;
- }());
- /**
- * \@stable
- * @abstract
- */
- var ComponentFactory = /** @class */ (function () {
- function ComponentFactory() {
- }
- return ComponentFactory;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} component
- * @return {?}
- */
- function noComponentFactoryError(component) {
- var /** @type {?} */ error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?");
- (/** @type {?} */ (error))[ERROR_COMPONENT] = component;
- return error;
- }
- var ERROR_COMPONENT = 'ngComponent';
- /**
- * @param {?} error
- * @return {?}
- */
- var _NullComponentFactoryResolver = /** @class */ (function () {
- function _NullComponentFactoryResolver() {
- }
- /**
- * @template T
- * @param {?} component
- * @return {?}
- */
- _NullComponentFactoryResolver.prototype.resolveComponentFactory = /**
- * @template T
- * @param {?} component
- * @return {?}
- */
- function (component) {
- throw noComponentFactoryError(component);
- };
- return _NullComponentFactoryResolver;
- }());
- /**
- * \@stable
- * @abstract
- */
- var ComponentFactoryResolver = /** @class */ (function () {
- function ComponentFactoryResolver() {
- }
- ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
- return ComponentFactoryResolver;
- }());
- var CodegenComponentFactoryResolver = /** @class */ (function () {
- function CodegenComponentFactoryResolver(factories, _parent, _ngModule) {
- this._parent = _parent;
- this._ngModule = _ngModule;
- this._factories = new Map();
- for (var /** @type {?} */ i = 0; i < factories.length; i++) {
- var /** @type {?} */ factory = factories[i];
- this._factories.set(factory.componentType, factory);
- }
- }
- /**
- * @template T
- * @param {?} component
- * @return {?}
- */
- CodegenComponentFactoryResolver.prototype.resolveComponentFactory = /**
- * @template T
- * @param {?} component
- * @return {?}
- */
- function (component) {
- var /** @type {?} */ factory = this._factories.get(component);
- if (!factory && this._parent) {
- factory = this._parent.resolveComponentFactory(component);
- }
- if (!factory) {
- throw noComponentFactoryError(component);
- }
- return new ComponentFactoryBoundToModule(factory, this._ngModule);
- };
- return CodegenComponentFactoryResolver;
- }());
- var ComponentFactoryBoundToModule = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ComponentFactoryBoundToModule, _super);
- function ComponentFactoryBoundToModule(factory, ngModule) {
- var _this = _super.call(this) || this;
- _this.factory = factory;
- _this.ngModule = ngModule;
- _this.selector = factory.selector;
- _this.componentType = factory.componentType;
- _this.ngContentSelectors = factory.ngContentSelectors;
- _this.inputs = factory.inputs;
- _this.outputs = factory.outputs;
- return _this;
- }
- /**
- * @param {?} injector
- * @param {?=} projectableNodes
- * @param {?=} rootSelectorOrNode
- * @param {?=} ngModule
- * @return {?}
- */
- ComponentFactoryBoundToModule.prototype.create = /**
- * @param {?} injector
- * @param {?=} projectableNodes
- * @param {?=} rootSelectorOrNode
- * @param {?=} ngModule
- * @return {?}
- */
- function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
- return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
- };
- return ComponentFactoryBoundToModule;
- }(ComponentFactory));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Represents an instance of an NgModule created via a {\@link NgModuleFactory}.
- *
- * `NgModuleRef` provides access to the NgModule Instance as well other objects related to this
- * NgModule Instance.
- *
- * \@stable
- * @abstract
- */
- var NgModuleRef = /** @class */ (function () {
- function NgModuleRef() {
- }
- return NgModuleRef;
- }());
- /**
- * @record
- */
- /**
- * \@experimental
- * @abstract
- */
- var NgModuleFactory = /** @class */ (function () {
- function NgModuleFactory() {
- }
- return NgModuleFactory;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A scope function for the Web Tracing Framework (WTF).
- *
- * \@experimental
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- var trace;
- var events;
- /**
- * @return {?}
- */
- function detectWTF() {
- var /** @type {?} */ wtf = (/** @type {?} */ (_global /** TODO #9100 */) /** TODO #9100 */)['wtf'];
- if (wtf) {
- trace = wtf['trace'];
- if (trace) {
- events = trace['events'];
- return true;
- }
- }
- return false;
- }
- /**
- * @param {?} signature
- * @param {?=} flags
- * @return {?}
- */
- function createScope(signature, flags) {
- if (flags === void 0) { flags = null; }
- return events.createScope(signature, flags);
- }
- /**
- * @template T
- * @param {?} scope
- * @param {?=} returnValue
- * @return {?}
- */
- function leave(scope, returnValue) {
- trace.leaveScope(scope, returnValue);
- return returnValue;
- }
- /**
- * @param {?} rangeType
- * @param {?} action
- * @return {?}
- */
- function startTimeRange(rangeType, action) {
- return trace.beginTimeRange(rangeType, action);
- }
- /**
- * @param {?} range
- * @return {?}
- */
- function endTimeRange(range) {
- trace.endTimeRange(range);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * True if WTF is enabled.
- */
- var wtfEnabled = detectWTF();
- /**
- * @param {?=} arg0
- * @param {?=} arg1
- * @return {?}
- */
- function noopScope(arg0, arg1) {
- return null;
- }
- /**
- * Create trace scope.
- *
- * Scopes must be strictly nested and are analogous to stack frames, but
- * do not have to follow the stack frames. Instead it is recommended that they follow logical
- * nesting. You may want to use
- * [Event
- * Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events)
- * as they are defined in WTF.
- *
- * Used to mark scope entry. The return value is used to leave the scope.
- *
- * var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
- *
- * someMethod() {
- * var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
- * // DO SOME WORK HERE
- * return wtfLeave(s, 123); // Return value 123
- * }
- *
- * Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can
- * negatively impact the performance of your application. For this reason we recommend that
- * you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and
- * so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to
- * exception, will produce incorrect trace, but presence of exception signifies logic error which
- * needs to be fixed before the app should be profiled. Add try-finally only when you expect that
- * an exception is expected during normal execution while profiling.
- *
- * \@experimental
- */
- var wtfCreateScope = wtfEnabled ? createScope : function (signature, flags) { return noopScope; };
- /**
- * Used to mark end of Scope.
- *
- * - `scope` to end.
- * - `returnValue` (optional) to be passed to the WTF.
- *
- * Returns the `returnValue for easy chaining.
- * \@experimental
- */
- var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; };
- /**
- * Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
- * The return value is used in the call to [endAsync]. Async ranges only work if WTF has been
- * enabled.
- *
- * someMethod() {
- * var s = wtfStartTimeRange('HTTP:GET', 'some.url');
- * var future = new Future.delay(5).then((_) {
- * wtfEndTimeRange(s);
- * });
- * }
- * \@experimental
- */
- var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; };
- /**
- * Ends a async time range operation.
- * [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
- * enabled.
- * \@experimental
- */
- var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Use by directives and components to emit custom Events.
- *
- * ### Examples
- *
- * In the following example, `Zippy` alternatively emits `open` and `close` events when its
- * title gets clicked:
- *
- * ```
- * \@Component({
- * selector: 'zippy',
- * template: `
- * <div class="zippy">
- * <div (click)="toggle()">Toggle</div>
- * <div [hidden]="!visible">
- * <ng-content></ng-content>
- * </div>
- * </div>`})
- * export class Zippy {
- * visible: boolean = true;
- * \@Output() open: EventEmitter<any> = new EventEmitter();
- * \@Output() close: EventEmitter<any> = new EventEmitter();
- *
- * toggle() {
- * this.visible = !this.visible;
- * if (this.visible) {
- * this.open.emit(null);
- * } else {
- * this.close.emit(null);
- * }
- * }
- * }
- * ```
- *
- * The events payload can be accessed by the parameter `$event` on the components output event
- * handler:
- *
- * ```
- * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
- * ```
- *
- * Uses Rx.Observable but provides an adapter to make it work as specified here:
- * https://github.com/jhusain/observable-spec
- *
- * Once a reference implementation of the spec is available, switch to it.
- * \@stable
- */
- var EventEmitter = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(EventEmitter, _super);
- /**
- * Creates an instance of {@link EventEmitter}, which depending on `isAsync`,
- * delivers events synchronously or asynchronously.
- *
- * @param isAsync By default, events are delivered synchronously (default value: `false`).
- * Set to `true` for asynchronous event delivery.
- */
- function EventEmitter(isAsync) {
- if (isAsync === void 0) { isAsync = false; }
- var _this = _super.call(this) || this;
- _this.__isAsync = isAsync;
- return _this;
- }
- /**
- * @param {?=} value
- * @return {?}
- */
- EventEmitter.prototype.emit = /**
- * @param {?=} value
- * @return {?}
- */
- function (value) { _super.prototype.next.call(this, value); };
- /**
- * @param {?=} generatorOrNext
- * @param {?=} error
- * @param {?=} complete
- * @return {?}
- */
- EventEmitter.prototype.subscribe = /**
- * @param {?=} generatorOrNext
- * @param {?=} error
- * @param {?=} complete
- * @return {?}
- */
- function (generatorOrNext, error, complete) {
- var /** @type {?} */ schedulerFn;
- var /** @type {?} */ errorFn = function (err) { return null; };
- var /** @type {?} */ completeFn = function () { return null; };
- if (generatorOrNext && typeof generatorOrNext === 'object') {
- schedulerFn = this.__isAsync ? function (value) {
- setTimeout(function () { return generatorOrNext.next(value); });
- } : function (value) { generatorOrNext.next(value); };
- if (generatorOrNext.error) {
- errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
- function (err) { generatorOrNext.error(err); };
- }
- if (generatorOrNext.complete) {
- completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
- function () { generatorOrNext.complete(); };
- }
- }
- else {
- schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
- function (value) { generatorOrNext(value); };
- if (error) {
- errorFn =
- this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
- }
- if (complete) {
- completeFn =
- this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
- }
- }
- var /** @type {?} */ sink = _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
- if (generatorOrNext instanceof __WEBPACK_IMPORTED_MODULE_5_rxjs_Subscription__["a" /* Subscription */]) {
- generatorOrNext.add(sink);
- }
- return sink;
- };
- return EventEmitter;
- }(__WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__["a" /* Subject */]));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An injectable service for executing work inside or outside of the Angular zone.
- *
- * The most common use of this service is to optimize performance when starting a work consisting of
- * one or more asynchronous tasks that don't require UI updates or error handling to be handled by
- * Angular. Such tasks can be kicked off via {\@link #runOutsideAngular} and if needed, these tasks
- * can reenter the Angular zone via {\@link #run}.
- *
- * <!-- TODO: add/fix links to:
- * - docs explaining zones and the use of zones in Angular and change-detection
- * - link to runOutsideAngular/run (throughout this file!)
- * -->
- *
- * ### Example
- *
- * ```
- * import {Component, NgZone} from '\@angular/core';
- * import {NgIf} from '\@angular/common';
- *
- * \@Component({
- * selector: 'ng-zone-demo',
- * template: `
- * <h2>Demo: NgZone</h2>
- *
- * <p>Progress: {{progress}}%</p>
- * <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p>
- *
- * <button (click)="processWithinAngularZone()">Process within Angular zone</button>
- * <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button>
- * `,
- * })
- * export class NgZoneDemo {
- * progress: number = 0;
- * label: string;
- *
- * constructor(private _ngZone: NgZone) {}
- *
- * // Loop inside the Angular zone
- * // so the UI DOES refresh after each setTimeout cycle
- * processWithinAngularZone() {
- * this.label = 'inside';
- * this.progress = 0;
- * this._increaseProgress(() => console.log('Inside Done!'));
- * }
- *
- * // Loop outside of the Angular zone
- * // so the UI DOES NOT refresh after each setTimeout cycle
- * processOutsideOfAngularZone() {
- * this.label = 'outside';
- * this.progress = 0;
- * this._ngZone.runOutsideAngular(() => {
- * this._increaseProgress(() => {
- * // reenter the Angular zone and display done
- * this._ngZone.run(() => { console.log('Outside Done!'); });
- * });
- * });
- * }
- *
- * _increaseProgress(doneCallback: () => void) {
- * this.progress += 1;
- * console.log(`Current progress: ${this.progress}%`);
- *
- * if (this.progress < 100) {
- * window.setTimeout(() => this._increaseProgress(doneCallback), 10);
- * } else {
- * doneCallback();
- * }
- * }
- * }
- * ```
- *
- * \@experimental
- */
- var NgZone = /** @class */ (function () {
- function NgZone(_a) {
- var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b;
- this.hasPendingMicrotasks = false;
- this.hasPendingMacrotasks = false;
- /**
- * Whether there are no outstanding microtasks or macrotasks.
- */
- this.isStable = true;
- /**
- * Notifies when code enters Angular Zone. This gets fired first on VM Turn.
- */
- this.onUnstable = new EventEmitter(false);
- /**
- * Notifies when there is no more microtasks enqueued in the current VM Turn.
- * This is a hint for Angular to do change detection, which may enqueue more microtasks.
- * For this reason this event can fire multiple times per VM Turn.
- */
- this.onMicrotaskEmpty = new EventEmitter(false);
- /**
- * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
- * implies we are about to relinquish VM turn.
- * This event gets called just once.
- */
- this.onStable = new EventEmitter(false);
- /**
- * Notifies that an error has been delivered.
- */
- this.onError = new EventEmitter(false);
- if (typeof Zone == 'undefined') {
- throw new Error("In this configuration Angular requires Zone.js");
- }
- Zone.assertZonePatched();
- var /** @type {?} */ self = /** @type {?} */ ((this));
- self._nesting = 0;
- self._outer = self._inner = Zone.current;
- if ((/** @type {?} */ (Zone))['wtfZoneSpec']) {
- self._inner = self._inner.fork((/** @type {?} */ (Zone))['wtfZoneSpec']);
- }
- if (enableLongStackTrace && (/** @type {?} */ (Zone))['longStackTraceZoneSpec']) {
- self._inner = self._inner.fork((/** @type {?} */ (Zone))['longStackTraceZoneSpec']);
- }
- forkInnerZoneWithAngularBehavior(self);
- }
- /**
- * @return {?}
- */
- NgZone.isInAngularZone = /**
- * @return {?}
- */
- function () { return Zone.current.get('isAngularZone') === true; };
- /**
- * @return {?}
- */
- NgZone.assertInAngularZone = /**
- * @return {?}
- */
- function () {
- if (!NgZone.isInAngularZone()) {
- throw new Error('Expected to be in Angular Zone, but it is not!');
- }
- };
- /**
- * @return {?}
- */
- NgZone.assertNotInAngularZone = /**
- * @return {?}
- */
- function () {
- if (NgZone.isInAngularZone()) {
- throw new Error('Expected to not be in Angular Zone, but it is!');
- }
- };
- /**
- * Executes the `fn` function synchronously within the Angular zone and returns value returned by
- * the function.
- *
- * Running functions via `run` allows you to reenter Angular zone from a task that was executed
- * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * within the Angular zone.
- *
- * If a synchronous error happens it will be rethrown and not reported via `onError`.
- */
- /**
- * Executes the `fn` function synchronously within the Angular zone and returns value returned by
- * the function.
- *
- * Running functions via `run` allows you to reenter Angular zone from a task that was executed
- * outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * within the Angular zone.
- *
- * If a synchronous error happens it will be rethrown and not reported via `onError`.
- * @template T
- * @param {?} fn
- * @param {?=} applyThis
- * @param {?=} applyArgs
- * @return {?}
- */
- NgZone.prototype.run = /**
- * Executes the `fn` function synchronously within the Angular zone and returns value returned by
- * the function.
- *
- * Running functions via `run` allows you to reenter Angular zone from a task that was executed
- * outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * within the Angular zone.
- *
- * If a synchronous error happens it will be rethrown and not reported via `onError`.
- * @template T
- * @param {?} fn
- * @param {?=} applyThis
- * @param {?=} applyArgs
- * @return {?}
- */
- function (fn, applyThis, applyArgs) {
- return /** @type {?} */ ((/** @type {?} */ ((this)))._inner.run(fn, applyThis, applyArgs));
- };
- /**
- * Executes the `fn` function synchronously within the Angular zone as a task and returns value
- * returned by the function.
- *
- * Running functions via `run` allows you to reenter Angular zone from a task that was executed
- * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * within the Angular zone.
- *
- * If a synchronous error happens it will be rethrown and not reported via `onError`.
- */
- /**
- * Executes the `fn` function synchronously within the Angular zone as a task and returns value
- * returned by the function.
- *
- * Running functions via `run` allows you to reenter Angular zone from a task that was executed
- * outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * within the Angular zone.
- *
- * If a synchronous error happens it will be rethrown and not reported via `onError`.
- * @template T
- * @param {?} fn
- * @param {?=} applyThis
- * @param {?=} applyArgs
- * @param {?=} name
- * @return {?}
- */
- NgZone.prototype.runTask = /**
- * Executes the `fn` function synchronously within the Angular zone as a task and returns value
- * returned by the function.
- *
- * Running functions via `run` allows you to reenter Angular zone from a task that was executed
- * outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * within the Angular zone.
- *
- * If a synchronous error happens it will be rethrown and not reported via `onError`.
- * @template T
- * @param {?} fn
- * @param {?=} applyThis
- * @param {?=} applyArgs
- * @param {?=} name
- * @return {?}
- */
- function (fn, applyThis, applyArgs, name) {
- var /** @type {?} */ zone = (/** @type {?} */ ((this)))._inner;
- var /** @type {?} */ task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop, noop);
- try {
- return /** @type {?} */ (zone.runTask(task, applyThis, applyArgs));
- }
- finally {
- zone.cancelTask(task);
- }
- };
- /**
- * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
- * rethrown.
- */
- /**
- * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
- * rethrown.
- * @template T
- * @param {?} fn
- * @param {?=} applyThis
- * @param {?=} applyArgs
- * @return {?}
- */
- NgZone.prototype.runGuarded = /**
- * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
- * rethrown.
- * @template T
- * @param {?} fn
- * @param {?=} applyThis
- * @param {?=} applyArgs
- * @return {?}
- */
- function (fn, applyThis, applyArgs) {
- return /** @type {?} */ ((/** @type {?} */ ((this)))._inner.runGuarded(fn, applyThis, applyArgs));
- };
- /**
- * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
- * the function.
- *
- * Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do
- * work that
- * doesn't trigger Angular change-detection or is subject to Angular's error handling.
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * outside of the Angular zone.
- *
- * Use {@link #run} to reenter the Angular zone and do work that updates the application model.
- */
- /**
- * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
- * the function.
- *
- * Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do
- * work that
- * doesn't trigger Angular change-detection or is subject to Angular's error handling.
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * outside of the Angular zone.
- *
- * Use {\@link #run} to reenter the Angular zone and do work that updates the application model.
- * @template T
- * @param {?} fn
- * @return {?}
- */
- NgZone.prototype.runOutsideAngular = /**
- * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
- * the function.
- *
- * Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do
- * work that
- * doesn't trigger Angular change-detection or is subject to Angular's error handling.
- *
- * Any future tasks or microtasks scheduled from within this function will continue executing from
- * outside of the Angular zone.
- *
- * Use {\@link #run} to reenter the Angular zone and do work that updates the application model.
- * @template T
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- return /** @type {?} */ ((/** @type {?} */ ((this)))._outer.run(fn));
- };
- return NgZone;
- }());
- /**
- * @return {?}
- */
- function noop() { }
- var EMPTY_PAYLOAD = {};
- /**
- * @param {?} zone
- * @return {?}
- */
- function checkStable(zone) {
- if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
- try {
- zone._nesting++;
- zone.onMicrotaskEmpty.emit(null);
- }
- finally {
- zone._nesting--;
- if (!zone.hasPendingMicrotasks) {
- try {
- zone.runOutsideAngular(function () { return zone.onStable.emit(null); });
- }
- finally {
- zone.isStable = true;
- }
- }
- }
- }
- }
- /**
- * @param {?} zone
- * @return {?}
- */
- function forkInnerZoneWithAngularBehavior(zone) {
- zone._inner = zone._inner.fork({
- name: 'angular',
- properties: /** @type {?} */ ({ 'isAngularZone': true }),
- onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
- try {
- onEnter(zone);
- return delegate.invokeTask(target, task, applyThis, applyArgs);
- }
- finally {
- onLeave(zone);
- }
- },
- onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
- try {
- onEnter(zone);
- return delegate.invoke(target, callback, applyThis, applyArgs, source);
- }
- finally {
- onLeave(zone);
- }
- },
- onHasTask: function (delegate, current, target, hasTaskState) {
- delegate.hasTask(target, hasTaskState);
- if (current === target) {
- // We are only interested in hasTask events which originate from our zone
- // (A child hasTask event is not interesting to us)
- if (hasTaskState.change == 'microTask') {
- zone.hasPendingMicrotasks = hasTaskState.microTask;
- checkStable(zone);
- }
- else if (hasTaskState.change == 'macroTask') {
- zone.hasPendingMacrotasks = hasTaskState.macroTask;
- }
- }
- },
- onHandleError: function (delegate, current, target, error) {
- delegate.handleError(target, error);
- zone.runOutsideAngular(function () { return zone.onError.emit(error); });
- return false;
- }
- });
- }
- /**
- * @param {?} zone
- * @return {?}
- */
- function onEnter(zone) {
- zone._nesting++;
- if (zone.isStable) {
- zone.isStable = false;
- zone.onUnstable.emit(null);
- }
- }
- /**
- * @param {?} zone
- * @return {?}
- */
- function onLeave(zone) {
- zone._nesting--;
- checkStable(zone);
- }
- /**
- * Provides a noop implementation of `NgZone` which does nothing. This zone requires explicit calls
- * to framework to perform rendering.
- */
- var NoopNgZone = /** @class */ (function () {
- function NoopNgZone() {
- this.hasPendingMicrotasks = false;
- this.hasPendingMacrotasks = false;
- this.isStable = true;
- this.onUnstable = new EventEmitter();
- this.onMicrotaskEmpty = new EventEmitter();
- this.onStable = new EventEmitter();
- this.onError = new EventEmitter();
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- NoopNgZone.prototype.run = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) { return fn(); };
- /**
- * @param {?} fn
- * @return {?}
- */
- NoopNgZone.prototype.runGuarded = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) { return fn(); };
- /**
- * @param {?} fn
- * @return {?}
- */
- NoopNgZone.prototype.runOutsideAngular = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) { return fn(); };
- /**
- * @template T
- * @param {?} fn
- * @return {?}
- */
- NoopNgZone.prototype.runTask = /**
- * @template T
- * @param {?} fn
- * @return {?}
- */
- function (fn) { return fn(); };
- return NoopNgZone;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * The Testability service provides testing hooks that can be accessed from
- * the browser and by services such as Protractor. Each bootstrapped Angular
- * application on the page will have an instance of Testability.
- * \@experimental
- */
- var Testability = /** @class */ (function () {
- function Testability(_ngZone) {
- this._ngZone = _ngZone;
- /**
- * \@internal
- */
- this._pendingCount = 0;
- /**
- * \@internal
- */
- this._isZoneStable = true;
- /**
- * Whether any work was done since the last 'whenStable' callback. This is
- * useful to detect if this could have potentially destabilized another
- * component while it is stabilizing.
- * \@internal
- */
- this._didWork = false;
- /**
- * \@internal
- */
- this._callbacks = [];
- this._watchAngularEvents();
- }
- /** @internal */
- /**
- * \@internal
- * @return {?}
- */
- Testability.prototype._watchAngularEvents = /**
- * \@internal
- * @return {?}
- */
- function () {
- var _this = this;
- this._ngZone.onUnstable.subscribe({
- next: function () {
- _this._didWork = true;
- _this._isZoneStable = false;
- }
- });
- this._ngZone.runOutsideAngular(function () {
- _this._ngZone.onStable.subscribe({
- next: function () {
- NgZone.assertNotInAngularZone();
- scheduleMicroTask(function () {
- _this._isZoneStable = true;
- _this._runCallbacksIfReady();
- });
- }
- });
- });
- };
- /**
- * Increases the number of pending request
- */
- /**
- * Increases the number of pending request
- * @return {?}
- */
- Testability.prototype.increasePendingRequestCount = /**
- * Increases the number of pending request
- * @return {?}
- */
- function () {
- this._pendingCount += 1;
- this._didWork = true;
- return this._pendingCount;
- };
- /**
- * Decreases the number of pending request
- */
- /**
- * Decreases the number of pending request
- * @return {?}
- */
- Testability.prototype.decreasePendingRequestCount = /**
- * Decreases the number of pending request
- * @return {?}
- */
- function () {
- this._pendingCount -= 1;
- if (this._pendingCount < 0) {
- throw new Error('pending async requests below zero');
- }
- this._runCallbacksIfReady();
- return this._pendingCount;
- };
- /**
- * Whether an associated application is stable
- */
- /**
- * Whether an associated application is stable
- * @return {?}
- */
- Testability.prototype.isStable = /**
- * Whether an associated application is stable
- * @return {?}
- */
- function () {
- return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks;
- };
- /** @internal */
- /**
- * \@internal
- * @return {?}
- */
- Testability.prototype._runCallbacksIfReady = /**
- * \@internal
- * @return {?}
- */
- function () {
- var _this = this;
- if (this.isStable()) {
- // Schedules the call backs in a new frame so that it is always async.
- scheduleMicroTask(function () {
- while (_this._callbacks.length !== 0) {
- (/** @type {?} */ ((_this._callbacks.pop())))(_this._didWork);
- }
- _this._didWork = false;
- });
- }
- else {
- // Not Ready
- this._didWork = true;
- }
- };
- /**
- * Run callback when the application is stable
- * @param callback function to be called after the application is stable
- */
- /**
- * Run callback when the application is stable
- * @param {?} callback function to be called after the application is stable
- * @return {?}
- */
- Testability.prototype.whenStable = /**
- * Run callback when the application is stable
- * @param {?} callback function to be called after the application is stable
- * @return {?}
- */
- function (callback) {
- this._callbacks.push(callback);
- this._runCallbacksIfReady();
- };
- /**
- * Get the number of pending requests
- */
- /**
- * Get the number of pending requests
- * @return {?}
- */
- Testability.prototype.getPendingRequestCount = /**
- * Get the number of pending requests
- * @return {?}
- */
- function () { return this._pendingCount; };
- /**
- * Find providers by name
- * @param using The root element to search from
- * @param provider The name of binding variable
- * @param exactMatch Whether using exactMatch
- */
- /**
- * Find providers by name
- * @param {?} using The root element to search from
- * @param {?} provider The name of binding variable
- * @param {?} exactMatch Whether using exactMatch
- * @return {?}
- */
- Testability.prototype.findProviders = /**
- * Find providers by name
- * @param {?} using The root element to search from
- * @param {?} provider The name of binding variable
- * @param {?} exactMatch Whether using exactMatch
- * @return {?}
- */
- function (using, provider, exactMatch) {
- // TODO(juliemr): implement.
- return [];
- };
- Testability.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- Testability.ctorParameters = function () { return [
- { type: NgZone, },
- ]; };
- return Testability;
- }());
- /**
- * A global registry of {\@link Testability} instances for specific elements.
- * \@experimental
- */
- var TestabilityRegistry = /** @class */ (function () {
- function TestabilityRegistry() {
- /**
- * \@internal
- */
- this._applications = new Map();
- _testabilityGetter.addToWindow(this);
- }
- /**
- * Registers an application with a testability hook so that it can be tracked
- * @param token token of application, root element
- * @param testability Testability hook
- */
- /**
- * Registers an application with a testability hook so that it can be tracked
- * @param {?} token token of application, root element
- * @param {?} testability Testability hook
- * @return {?}
- */
- TestabilityRegistry.prototype.registerApplication = /**
- * Registers an application with a testability hook so that it can be tracked
- * @param {?} token token of application, root element
- * @param {?} testability Testability hook
- * @return {?}
- */
- function (token, testability) {
- this._applications.set(token, testability);
- };
- /**
- * Unregisters an application.
- * @param token token of application, root element
- */
- /**
- * Unregisters an application.
- * @param {?} token token of application, root element
- * @return {?}
- */
- TestabilityRegistry.prototype.unregisterApplication = /**
- * Unregisters an application.
- * @param {?} token token of application, root element
- * @return {?}
- */
- function (token) { this._applications.delete(token); };
- /**
- * Unregisters all applications
- */
- /**
- * Unregisters all applications
- * @return {?}
- */
- TestabilityRegistry.prototype.unregisterAllApplications = /**
- * Unregisters all applications
- * @return {?}
- */
- function () { this._applications.clear(); };
- /**
- * Get a testability hook associated with the application
- * @param elem root element
- */
- /**
- * Get a testability hook associated with the application
- * @param {?} elem root element
- * @return {?}
- */
- TestabilityRegistry.prototype.getTestability = /**
- * Get a testability hook associated with the application
- * @param {?} elem root element
- * @return {?}
- */
- function (elem) { return this._applications.get(elem) || null; };
- /**
- * Get all registered testabilities
- */
- /**
- * Get all registered testabilities
- * @return {?}
- */
- TestabilityRegistry.prototype.getAllTestabilities = /**
- * Get all registered testabilities
- * @return {?}
- */
- function () { return Array.from(this._applications.values()); };
- /**
- * Get all registered applications(root elements)
- */
- /**
- * Get all registered applications(root elements)
- * @return {?}
- */
- TestabilityRegistry.prototype.getAllRootElements = /**
- * Get all registered applications(root elements)
- * @return {?}
- */
- function () { return Array.from(this._applications.keys()); };
- /**
- * Find testability of a node in the Tree
- * @param elem node
- * @param findInAncestors whether finding testability in ancestors if testability was not found in
- * current node
- */
- /**
- * Find testability of a node in the Tree
- * @param {?} elem node
- * @param {?=} findInAncestors whether finding testability in ancestors if testability was not found in
- * current node
- * @return {?}
- */
- TestabilityRegistry.prototype.findTestabilityInTree = /**
- * Find testability of a node in the Tree
- * @param {?} elem node
- * @param {?=} findInAncestors whether finding testability in ancestors if testability was not found in
- * current node
- * @return {?}
- */
- function (elem, findInAncestors) {
- if (findInAncestors === void 0) { findInAncestors = true; }
- return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
- };
- TestabilityRegistry.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- TestabilityRegistry.ctorParameters = function () { return []; };
- return TestabilityRegistry;
- }());
- /**
- * Adapter interface for retrieving the `Testability` service associated for a
- * particular context.
- *
- * \@experimental Testability apis are primarily intended to be used by e2e test tool vendors like
- * the Protractor team.
- * @record
- */
- var _NoopGetTestability = /** @class */ (function () {
- function _NoopGetTestability() {
- }
- /**
- * @param {?} registry
- * @return {?}
- */
- _NoopGetTestability.prototype.addToWindow = /**
- * @param {?} registry
- * @return {?}
- */
- function (registry) { };
- /**
- * @param {?} registry
- * @param {?} elem
- * @param {?} findInAncestors
- * @return {?}
- */
- _NoopGetTestability.prototype.findTestabilityInTree = /**
- * @param {?} registry
- * @param {?} elem
- * @param {?} findInAncestors
- * @return {?}
- */
- function (registry, elem, findInAncestors) {
- return null;
- };
- return _NoopGetTestability;
- }());
- /**
- * Set the {\@link GetTestability} implementation used by the Angular testing framework.
- * \@experimental
- * @param {?} getter
- * @return {?}
- */
- function setTestabilityGetter(getter) {
- _testabilityGetter = getter;
- }
- var _testabilityGetter = new _NoopGetTestability();
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _devMode = true;
- var _runModeLocked = false;
- var _platform;
- var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
- /**
- * Disable Angular's development mode, which turns off assertions and other
- * checks within the framework.
- *
- * One important assertion this disables verifies that a change detection pass
- * does not result in additional changes to any bindings (also known as
- * unidirectional data flow).
- *
- * \@stable
- * @return {?}
- */
- function enableProdMode() {
- if (_runModeLocked) {
- throw new Error('Cannot enable prod mode after platform setup.');
- }
- _devMode = false;
- }
- /**
- * Returns whether Angular is in development mode. After called once,
- * the value is locked and won't change any more.
- *
- * By default, this is true, unless a user calls `enableProdMode` before calling this.
- *
- * \@experimental APIs related to application bootstrap are currently under review.
- * @return {?}
- */
- function isDevMode() {
- _runModeLocked = true;
- return _devMode;
- }
- /**
- * A token for third-party components that can register themselves with NgProbe.
- *
- * \@experimental
- */
- var NgProbeToken = /** @class */ (function () {
- function NgProbeToken(name, token) {
- this.name = name;
- this.token = token;
- }
- return NgProbeToken;
- }());
- /**
- * Creates a platform.
- * Platforms have to be eagerly created via this function.
- *
- * \@experimental APIs related to application bootstrap are currently under review.
- * @param {?} injector
- * @return {?}
- */
- function createPlatform(injector) {
- if (_platform && !_platform.destroyed &&
- !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
- throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
- }
- _platform = injector.get(PlatformRef);
- var /** @type {?} */ inits = injector.get(PLATFORM_INITIALIZER, null);
- if (inits)
- inits.forEach(function (init) { return init(); });
- return _platform;
- }
- /**
- * Creates a factory for a platform
- *
- * \@experimental APIs related to application bootstrap are currently under review.
- * @param {?} parentPlatformFactory
- * @param {?} name
- * @param {?=} providers
- * @return {?}
- */
- function createPlatformFactory(parentPlatformFactory, name, providers) {
- if (providers === void 0) { providers = []; }
- var /** @type {?} */ desc = "Platform: " + name;
- var /** @type {?} */ marker = new InjectionToken(desc);
- return function (extraProviders) {
- if (extraProviders === void 0) { extraProviders = []; }
- var /** @type {?} */ platform = getPlatform();
- if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
- if (parentPlatformFactory) {
- parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
- }
- else {
- var /** @type {?} */ injectedProviders = providers.concat(extraProviders).concat({ provide: marker, useValue: true });
- createPlatform(Injector.create({ providers: injectedProviders, name: desc }));
- }
- }
- return assertPlatform(marker);
- };
- }
- /**
- * Checks that there currently is a platform which contains the given token as a provider.
- *
- * \@experimental APIs related to application bootstrap are currently under review.
- * @param {?} requiredToken
- * @return {?}
- */
- function assertPlatform(requiredToken) {
- var /** @type {?} */ platform = getPlatform();
- if (!platform) {
- throw new Error('No platform exists!');
- }
- if (!platform.injector.get(requiredToken, null)) {
- throw new Error('A platform with a different configuration has been created. Please destroy it first.');
- }
- return platform;
- }
- /**
- * Destroy the existing platform.
- *
- * \@experimental APIs related to application bootstrap are currently under review.
- * @return {?}
- */
- function destroyPlatform() {
- if (_platform && !_platform.destroyed) {
- _platform.destroy();
- }
- }
- /**
- * Returns the current platform.
- *
- * \@experimental APIs related to application bootstrap are currently under review.
- * @return {?}
- */
- function getPlatform() {
- return _platform && !_platform.destroyed ? _platform : null;
- }
- /**
- * Provides additional options to the bootstraping process.
- *
- * \@stable
- * @record
- */
- /**
- * The Angular platform is the entry point for Angular on a web page. Each page
- * has exactly one platform, and services (such as reflection) which are common
- * to every Angular application running on the page are bound in its scope.
- *
- * A page's platform is initialized implicitly when a platform is created via a platform factory
- * (e.g. {\@link platformBrowser}), or explicitly by calling the {\@link createPlatform} function.
- *
- * \@stable
- */
- var PlatformRef = /** @class */ (function () {
- /** @internal */
- function PlatformRef(_injector) {
- this._injector = _injector;
- this._modules = [];
- this._destroyListeners = [];
- this._destroyed = false;
- }
- /**
- * Creates an instance of an `@NgModule` for the given platform
- * for offline compilation.
- *
- * ## Simple Example
- *
- * ```typescript
- * my_module.ts:
- *
- * @NgModule({
- * imports: [BrowserModule]
- * })
- * class MyModule {}
- *
- * main.ts:
- * import {MyModuleNgFactory} from './my_module.ngfactory';
- * import {platformBrowser} from '@angular/platform-browser';
- *
- * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
- * ```
- *
- * @experimental APIs related to application bootstrap are currently under review.
- */
- /**
- * Creates an instance of an `\@NgModule` for the given platform
- * for offline compilation.
- *
- * ## Simple Example
- *
- * ```typescript
- * my_module.ts:
- *
- * \@NgModule({
- * imports: [BrowserModule]
- * })
- * class MyModule {}
- *
- * main.ts:
- * import {MyModuleNgFactory} from './my_module.ngfactory';
- * import {platformBrowser} from '\@angular/platform-browser';
- *
- * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
- * ```
- *
- * \@experimental APIs related to application bootstrap are currently under review.
- * @template M
- * @param {?} moduleFactory
- * @param {?=} options
- * @return {?}
- */
- PlatformRef.prototype.bootstrapModuleFactory = /**
- * Creates an instance of an `\@NgModule` for the given platform
- * for offline compilation.
- *
- * ## Simple Example
- *
- * ```typescript
- * my_module.ts:
- *
- * \@NgModule({
- * imports: [BrowserModule]
- * })
- * class MyModule {}
- *
- * main.ts:
- * import {MyModuleNgFactory} from './my_module.ngfactory';
- * import {platformBrowser} from '\@angular/platform-browser';
- *
- * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
- * ```
- *
- * \@experimental APIs related to application bootstrap are currently under review.
- * @template M
- * @param {?} moduleFactory
- * @param {?=} options
- * @return {?}
- */
- function (moduleFactory, options) {
- var _this = this;
- // Note: We need to create the NgZone _before_ we instantiate the module,
- // as instantiating the module creates some providers eagerly.
- // So we create a mini parent injector that just contains the new NgZone and
- // pass that as parent to the NgModuleFactory.
- var /** @type {?} */ ngZoneOption = options ? options.ngZone : undefined;
- var /** @type {?} */ ngZone = getNgZone(ngZoneOption);
- var /** @type {?} */ providers = [{ provide: NgZone, useValue: ngZone }];
- // Attention: Don't use ApplicationRef.run here,
- // as we want to be sure that all possible constructor calls are inside `ngZone.run`!
- return ngZone.run(function () {
- var /** @type {?} */ ngZoneInjector = Injector.create({ providers: providers, parent: _this.injector, name: moduleFactory.moduleType.name });
- var /** @type {?} */ moduleRef = /** @type {?} */ (moduleFactory.create(ngZoneInjector));
- var /** @type {?} */ exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
- if (!exceptionHandler) {
- throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
- }
- moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); }); /** @type {?} */
- ((ngZone)).runOutsideAngular(function () { return ((ngZone)).onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } }); });
- return _callAndReportToErrorHandler(exceptionHandler, /** @type {?} */ ((ngZone)), function () {
- var /** @type {?} */ initStatus = moduleRef.injector.get(ApplicationInitStatus);
- initStatus.runInitializers();
- return initStatus.donePromise.then(function () {
- _this._moduleDoBootstrap(moduleRef);
- return moduleRef;
- });
- });
- });
- };
- /**
- * Creates an instance of an `@NgModule` for a given platform using the given runtime compiler.
- *
- * ## Simple Example
- *
- * ```typescript
- * @NgModule({
- * imports: [BrowserModule]
- * })
- * class MyModule {}
- *
- * let moduleRef = platformBrowser().bootstrapModule(MyModule);
- * ```
- * @stable
- */
- /**
- * Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler.
- *
- * ## Simple Example
- *
- * ```typescript
- * \@NgModule({
- * imports: [BrowserModule]
- * })
- * class MyModule {}
- *
- * let moduleRef = platformBrowser().bootstrapModule(MyModule);
- * ```
- * \@stable
- * @template M
- * @param {?} moduleType
- * @param {?=} compilerOptions
- * @return {?}
- */
- PlatformRef.prototype.bootstrapModule = /**
- * Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler.
- *
- * ## Simple Example
- *
- * ```typescript
- * \@NgModule({
- * imports: [BrowserModule]
- * })
- * class MyModule {}
- *
- * let moduleRef = platformBrowser().bootstrapModule(MyModule);
- * ```
- * \@stable
- * @template M
- * @param {?} moduleType
- * @param {?=} compilerOptions
- * @return {?}
- */
- function (moduleType, compilerOptions) {
- var _this = this;
- if (compilerOptions === void 0) { compilerOptions = []; }
- var /** @type {?} */ compilerFactory = this.injector.get(CompilerFactory);
- var /** @type {?} */ options = optionsReducer({}, compilerOptions);
- var /** @type {?} */ compiler = compilerFactory.createCompiler([options]);
- return compiler.compileModuleAsync(moduleType)
- .then(function (moduleFactory) { return _this.bootstrapModuleFactory(moduleFactory, options); });
- };
- /**
- * @param {?} moduleRef
- * @return {?}
- */
- PlatformRef.prototype._moduleDoBootstrap = /**
- * @param {?} moduleRef
- * @return {?}
- */
- function (moduleRef) {
- var /** @type {?} */ appRef = /** @type {?} */ (moduleRef.injector.get(ApplicationRef));
- if (moduleRef._bootstrapComponents.length > 0) {
- moduleRef._bootstrapComponents.forEach(function (f) { return appRef.bootstrap(f); });
- }
- else if (moduleRef.instance.ngDoBootstrap) {
- moduleRef.instance.ngDoBootstrap(appRef);
- }
- else {
- throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " +
- "Please define one of these.");
- }
- this._modules.push(moduleRef);
- };
- /**
- * Register a listener to be called when the platform is disposed.
- */
- /**
- * Register a listener to be called when the platform is disposed.
- * @param {?} callback
- * @return {?}
- */
- PlatformRef.prototype.onDestroy = /**
- * Register a listener to be called when the platform is disposed.
- * @param {?} callback
- * @return {?}
- */
- function (callback) { this._destroyListeners.push(callback); };
- Object.defineProperty(PlatformRef.prototype, "injector", {
- /**
- * Retrieve the platform {@link Injector}, which is the parent injector for
- * every Angular application on the page and provides singleton providers.
- */
- get: /**
- * Retrieve the platform {\@link Injector}, which is the parent injector for
- * every Angular application on the page and provides singleton providers.
- * @return {?}
- */
- function () { return this._injector; },
- enumerable: true,
- configurable: true
- });
- /**
- * Destroy the Angular platform and all Angular applications on the page.
- */
- /**
- * Destroy the Angular platform and all Angular applications on the page.
- * @return {?}
- */
- PlatformRef.prototype.destroy = /**
- * Destroy the Angular platform and all Angular applications on the page.
- * @return {?}
- */
- function () {
- if (this._destroyed) {
- throw new Error('The platform has already been destroyed!');
- }
- this._modules.slice().forEach(function (module) { return module.destroy(); });
- this._destroyListeners.forEach(function (listener) { return listener(); });
- this._destroyed = true;
- };
- Object.defineProperty(PlatformRef.prototype, "destroyed", {
- get: /**
- * @return {?}
- */
- function () { return this._destroyed; },
- enumerable: true,
- configurable: true
- });
- PlatformRef.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- PlatformRef.ctorParameters = function () { return [
- { type: Injector, },
- ]; };
- return PlatformRef;
- }());
- /**
- * @param {?=} ngZoneOption
- * @return {?}
- */
- function getNgZone(ngZoneOption) {
- var /** @type {?} */ ngZone;
- if (ngZoneOption === 'noop') {
- ngZone = new NoopNgZone();
- }
- else {
- ngZone = (ngZoneOption === 'zone.js' ? undefined : ngZoneOption) ||
- new NgZone({ enableLongStackTrace: isDevMode() });
- }
- return ngZone;
- }
- /**
- * @param {?} errorHandler
- * @param {?} ngZone
- * @param {?} callback
- * @return {?}
- */
- function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
- try {
- var /** @type {?} */ result = callback();
- if (isPromise(result)) {
- return result.catch(function (e) {
- ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
- // rethrow as the exception handler might not do it
- throw e;
- });
- }
- return result;
- }
- catch (/** @type {?} */ e) {
- ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
- // rethrow as the exception handler might not do it
- throw e;
- }
- }
- /**
- * @template T
- * @param {?} dst
- * @param {?} objs
- * @return {?}
- */
- function optionsReducer(dst, objs) {
- if (Array.isArray(objs)) {
- dst = objs.reduce(optionsReducer, dst);
- }
- else {
- dst = Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, dst, (/** @type {?} */ (objs)));
- }
- return dst;
- }
- /**
- * A reference to an Angular application running on a page.
- *
- * \@stable
- */
- var ApplicationRef = /** @class */ (function () {
- /** @internal */
- function ApplicationRef(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
- var _this = this;
- this._zone = _zone;
- this._console = _console;
- this._injector = _injector;
- this._exceptionHandler = _exceptionHandler;
- this._componentFactoryResolver = _componentFactoryResolver;
- this._initStatus = _initStatus;
- this._bootstrapListeners = [];
- this._views = [];
- this._runningTick = false;
- this._enforceNoNewChanges = false;
- this._stable = true;
- /**
- * Get a list of component types registered to this application.
- * This list is populated even before the component is created.
- */
- this.componentTypes = [];
- /**
- * Get a list of components registered to this application.
- */
- this.components = [];
- this._enforceNoNewChanges = isDevMode();
- this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } });
- var /** @type {?} */ isCurrentlyStable = new __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__["a" /* Observable */](function (observer) {
- _this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks &&
- !_this._zone.hasPendingMicrotasks;
- _this._zone.runOutsideAngular(function () {
- observer.next(_this._stable);
- observer.complete();
- });
- });
- var /** @type {?} */ isStable = new __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__["a" /* Observable */](function (observer) {
- // Create the subscription to onStable outside the Angular Zone so that
- // the callback is run outside the Angular Zone.
- var /** @type {?} */ stableSub;
- _this._zone.runOutsideAngular(function () {
- stableSub = _this._zone.onStable.subscribe(function () {
- NgZone.assertNotInAngularZone();
- // Check whether there are no pending macro/micro tasks in the next tick
- // to allow for NgZone to update the state.
- scheduleMicroTask(function () {
- if (!_this._stable && !_this._zone.hasPendingMacrotasks &&
- !_this._zone.hasPendingMicrotasks) {
- _this._stable = true;
- observer.next(true);
- }
- });
- });
- });
- var /** @type {?} */ unstableSub = _this._zone.onUnstable.subscribe(function () {
- NgZone.assertInAngularZone();
- if (_this._stable) {
- _this._stable = false;
- _this._zone.runOutsideAngular(function () { observer.next(false); });
- }
- });
- return function () {
- stableSub.unsubscribe();
- unstableSub.unsubscribe();
- };
- });
- (/** @type {?} */ (this)).isStable =
- Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_observable_merge__["a" /* merge */])(isCurrentlyStable, __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_share__["a" /* share */].call(isStable));
- }
- /**
- * Bootstrap a new component at the root level of the application.
- *
- * ### Bootstrap process
- *
- * When bootstrapping a new root component into an application, Angular mounts the
- * specified application component onto DOM elements identified by the [componentType]'s
- * selector and kicks off automatic change detection to finish initializing the component.
- *
- * Optionally, a component can be mounted onto a DOM element that does not match the
- * [componentType]'s selector.
- *
- * ### Example
- * {@example core/ts/platform/platform.ts region='longform'}
- */
- /**
- * Bootstrap a new component at the root level of the application.
- *
- * ### Bootstrap process
- *
- * When bootstrapping a new root component into an application, Angular mounts the
- * specified application component onto DOM elements identified by the [componentType]'s
- * selector and kicks off automatic change detection to finish initializing the component.
- *
- * Optionally, a component can be mounted onto a DOM element that does not match the
- * [componentType]'s selector.
- *
- * ### Example
- * {\@example core/ts/platform/platform.ts region='longform'}
- * @template C
- * @param {?} componentOrFactory
- * @param {?=} rootSelectorOrNode
- * @return {?}
- */
- ApplicationRef.prototype.bootstrap = /**
- * Bootstrap a new component at the root level of the application.
- *
- * ### Bootstrap process
- *
- * When bootstrapping a new root component into an application, Angular mounts the
- * specified application component onto DOM elements identified by the [componentType]'s
- * selector and kicks off automatic change detection to finish initializing the component.
- *
- * Optionally, a component can be mounted onto a DOM element that does not match the
- * [componentType]'s selector.
- *
- * ### Example
- * {\@example core/ts/platform/platform.ts region='longform'}
- * @template C
- * @param {?} componentOrFactory
- * @param {?=} rootSelectorOrNode
- * @return {?}
- */
- function (componentOrFactory, rootSelectorOrNode) {
- var _this = this;
- if (!this._initStatus.done) {
- throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
- }
- var /** @type {?} */ componentFactory;
- if (componentOrFactory instanceof ComponentFactory) {
- componentFactory = componentOrFactory;
- }
- else {
- componentFactory =
- /** @type {?} */ ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory)));
- }
- this.componentTypes.push(componentFactory.componentType);
- // Create a factory associated with the current module if it's not bound to some other
- var /** @type {?} */ ngModule = componentFactory instanceof ComponentFactoryBoundToModule ?
- null :
- this._injector.get(NgModuleRef);
- var /** @type {?} */ selectorOrNode = rootSelectorOrNode || componentFactory.selector;
- var /** @type {?} */ compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
- compRef.onDestroy(function () { _this._unloadComponent(compRef); });
- var /** @type {?} */ testability = compRef.injector.get(Testability, null);
- if (testability) {
- compRef.injector.get(TestabilityRegistry)
- .registerApplication(compRef.location.nativeElement, testability);
- }
- this._loadComponent(compRef);
- if (isDevMode()) {
- this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode.");
- }
- return compRef;
- };
- /**
- * Invoke this method to explicitly process change detection and its side-effects.
- *
- * In development mode, `tick()` also performs a second change detection cycle to ensure that no
- * further changes are detected. If additional changes are picked up during this second cycle,
- * bindings in the app have side-effects that cannot be resolved in a single change detection
- * pass.
- * In this case, Angular throws an error, since an Angular application can only have one change
- * detection pass during which all change detection must complete.
- */
- /**
- * Invoke this method to explicitly process change detection and its side-effects.
- *
- * In development mode, `tick()` also performs a second change detection cycle to ensure that no
- * further changes are detected. If additional changes are picked up during this second cycle,
- * bindings in the app have side-effects that cannot be resolved in a single change detection
- * pass.
- * In this case, Angular throws an error, since an Angular application can only have one change
- * detection pass during which all change detection must complete.
- * @return {?}
- */
- ApplicationRef.prototype.tick = /**
- * Invoke this method to explicitly process change detection and its side-effects.
- *
- * In development mode, `tick()` also performs a second change detection cycle to ensure that no
- * further changes are detected. If additional changes are picked up during this second cycle,
- * bindings in the app have side-effects that cannot be resolved in a single change detection
- * pass.
- * In this case, Angular throws an error, since an Angular application can only have one change
- * detection pass during which all change detection must complete.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._runningTick) {
- throw new Error('ApplicationRef.tick is called recursively');
- }
- var /** @type {?} */ scope = ApplicationRef._tickScope();
- try {
- this._runningTick = true;
- this._views.forEach(function (view) { return view.detectChanges(); });
- if (this._enforceNoNewChanges) {
- this._views.forEach(function (view) { return view.checkNoChanges(); });
- }
- }
- catch (/** @type {?} */ e) {
- // Attention: Don't rethrow as it could cancel subscriptions to Observables!
- this._zone.runOutsideAngular(function () { return _this._exceptionHandler.handleError(e); });
- }
- finally {
- this._runningTick = false;
- wtfLeave(scope);
- }
- };
- /**
- * Attaches a view so that it will be dirty checked.
- * The view will be automatically detached when it is destroyed.
- * This will throw if the view is already attached to a ViewContainer.
- */
- /**
- * Attaches a view so that it will be dirty checked.
- * The view will be automatically detached when it is destroyed.
- * This will throw if the view is already attached to a ViewContainer.
- * @param {?} viewRef
- * @return {?}
- */
- ApplicationRef.prototype.attachView = /**
- * Attaches a view so that it will be dirty checked.
- * The view will be automatically detached when it is destroyed.
- * This will throw if the view is already attached to a ViewContainer.
- * @param {?} viewRef
- * @return {?}
- */
- function (viewRef) {
- var /** @type {?} */ view = (/** @type {?} */ (viewRef));
- this._views.push(view);
- view.attachToAppRef(this);
- };
- /**
- * Detaches a view from dirty checking again.
- */
- /**
- * Detaches a view from dirty checking again.
- * @param {?} viewRef
- * @return {?}
- */
- ApplicationRef.prototype.detachView = /**
- * Detaches a view from dirty checking again.
- * @param {?} viewRef
- * @return {?}
- */
- function (viewRef) {
- var /** @type {?} */ view = (/** @type {?} */ (viewRef));
- remove(this._views, view);
- view.detachFromAppRef();
- };
- /**
- * @param {?} componentRef
- * @return {?}
- */
- ApplicationRef.prototype._loadComponent = /**
- * @param {?} componentRef
- * @return {?}
- */
- function (componentRef) {
- this.attachView(componentRef.hostView);
- this.tick();
- this.components.push(componentRef);
- // Get the listeners lazily to prevent DI cycles.
- var /** @type {?} */ listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
- listeners.forEach(function (listener) { return listener(componentRef); });
- };
- /**
- * @param {?} componentRef
- * @return {?}
- */
- ApplicationRef.prototype._unloadComponent = /**
- * @param {?} componentRef
- * @return {?}
- */
- function (componentRef) {
- this.detachView(componentRef.hostView);
- remove(this.components, componentRef);
- };
- /** @internal */
- /**
- * \@internal
- * @return {?}
- */
- ApplicationRef.prototype.ngOnDestroy = /**
- * \@internal
- * @return {?}
- */
- function () {
- // TODO(alxhub): Dispose of the NgZone.
- this._views.slice().forEach(function (view) { return view.destroy(); });
- };
- Object.defineProperty(ApplicationRef.prototype, "viewCount", {
- /**
- * Returns the number of attached views.
- */
- get: /**
- * Returns the number of attached views.
- * @return {?}
- */
- function () { return this._views.length; },
- enumerable: true,
- configurable: true
- });
- /**
- * \@internal
- */
- ApplicationRef._tickScope = wtfCreateScope('ApplicationRef#tick()');
- ApplicationRef.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- ApplicationRef.ctorParameters = function () { return [
- { type: NgZone, },
- { type: Console, },
- { type: Injector, },
- { type: ErrorHandler, },
- { type: ComponentFactoryResolver, },
- { type: ApplicationInitStatus, },
- ]; };
- return ApplicationRef;
- }());
- /**
- * @template T
- * @param {?} list
- * @param {?} el
- * @return {?}
- */
- function remove(list, el) {
- var /** @type {?} */ index = list.indexOf(el);
- if (index > -1) {
- list.splice(index, 1);
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @deprecated Use `RendererType2` (and `Renderer2`) instead.
- */
- var RenderComponentType = /** @class */ (function () {
- function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) {
- this.id = id;
- this.templateUrl = templateUrl;
- this.slotCount = slotCount;
- this.encapsulation = encapsulation;
- this.styles = styles;
- this.animations = animations;
- }
- return RenderComponentType;
- }());
- /**
- * @deprecated Debug info is handeled internally in the view engine now.
- * @abstract
- */
- var RenderDebugInfo = /** @class */ (function () {
- function RenderDebugInfo() {
- }
- return RenderDebugInfo;
- }());
- /**
- * @deprecated Use the `Renderer2` instead.
- * @record
- */
- /**
- * @deprecated Use the `Renderer2` instead.
- * @abstract
- */
- var Renderer = /** @class */ (function () {
- function Renderer() {
- }
- return Renderer;
- }());
- var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
- /**
- * Injectable service that provides a low-level interface for modifying the UI.
- *
- * Use this service to bypass Angular's templating and make custom UI changes that can't be
- * expressed declaratively. For example if you need to set a property or an attribute whose name is
- * not statically known, use {\@link Renderer#setElementProperty setElementProperty} or
- * {\@link Renderer#setElementAttribute setElementAttribute} respectively.
- *
- * If you are implementing a custom renderer, you must implement this interface.
- *
- * The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
- *
- * @deprecated Use `RendererFactory2` instead.
- * @abstract
- */
- var RootRenderer = /** @class */ (function () {
- function RootRenderer() {
- }
- return RootRenderer;
- }());
- /**
- * \@experimental
- * @record
- */
- /**
- * \@experimental
- * @abstract
- */
- var RendererFactory2 = /** @class */ (function () {
- function RendererFactory2() {
- }
- return RendererFactory2;
- }());
- /** @enum {number} */
- var RendererStyleFlags2 = {
- Important: 1,
- DashCase: 2,
- };
- RendererStyleFlags2[RendererStyleFlags2.Important] = "Important";
- RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase";
- /**
- * \@experimental
- * @abstract
- */
- var Renderer2 = /** @class */ (function () {
- function Renderer2() {
- }
- return Renderer2;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A wrapper around a native element inside of a View.
- *
- * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
- * element.
- *
- * \@security Permitting direct access to the DOM can make your application more vulnerable to
- * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
- * [Security Guide](http://g.co/ng/security).
- *
- * \@stable
- */
- var ElementRef = /** @class */ (function () {
- function ElementRef(nativeElement) {
- this.nativeElement = nativeElement;
- }
- return ElementRef;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Used to load ng module factories.
- * \@stable
- * @abstract
- */
- var NgModuleFactoryLoader = /** @class */ (function () {
- function NgModuleFactoryLoader() {
- }
- return NgModuleFactoryLoader;
- }());
- var moduleFactories = new Map();
- /**
- * Registers a loaded module. Should only be called from generated NgModuleFactory code.
- * \@experimental
- * @param {?} id
- * @param {?} factory
- * @return {?}
- */
- function registerModuleFactory(id, factory) {
- var /** @type {?} */ existing = moduleFactories.get(id);
- if (existing) {
- throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
- }
- moduleFactories.set(id, factory);
- }
- /**
- * @return {?}
- */
- /**
- * Returns the NgModuleFactory with the given id, if it exists and has been loaded.
- * Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module
- * cannot be found.
- * \@experimental
- * @param {?} id
- * @return {?}
- */
- function getModuleFactory(id) {
- var /** @type {?} */ factory = moduleFactories.get(id);
- if (!factory)
- throw new Error("No module with ID " + id + " loaded");
- return factory;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An unmodifiable list of items that Angular keeps up to date when the state
- * of the application changes.
- *
- * The type of object that {\@link ViewChildren}, {\@link ContentChildren}, and {\@link QueryList}
- * provide.
- *
- * Implements an iterable interface, therefore it can be used in both ES6
- * javascript `for (var i of items)` loops as well as in Angular templates with
- * `*ngFor="let i of myList"`.
- *
- * Changes can be observed by subscribing to the changes `Observable`.
- *
- * NOTE: In the future this class will implement an `Observable` interface.
- *
- * ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview))
- * ```typescript
- * \@Component({...})
- * class Container {
- * \@ViewChildren(Item) items:QueryList<Item>;
- * }
- * ```
- * \@stable
- */
- var QueryList = /** @class */ (function () {
- function QueryList() {
- this.dirty = true;
- this._results = [];
- this.changes = new EventEmitter();
- this.length = 0;
- }
- /**
- * See
- * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
- */
- /**
- * See
- * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
- * @template U
- * @param {?} fn
- * @return {?}
- */
- QueryList.prototype.map = /**
- * See
- * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
- * @template U
- * @param {?} fn
- * @return {?}
- */
- function (fn) { return this._results.map(fn); };
- /**
- * See
- * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
- */
- /**
- * See
- * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
- * @param {?} fn
- * @return {?}
- */
- QueryList.prototype.filter = /**
- * See
- * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- return this._results.filter(fn);
- };
- /**
- * See
- * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
- */
- /**
- * See
- * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
- * @param {?} fn
- * @return {?}
- */
- QueryList.prototype.find = /**
- * See
- * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- return this._results.find(fn);
- };
- /**
- * See
- * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
- */
- /**
- * See
- * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
- * @template U
- * @param {?} fn
- * @param {?} init
- * @return {?}
- */
- QueryList.prototype.reduce = /**
- * See
- * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
- * @template U
- * @param {?} fn
- * @param {?} init
- * @return {?}
- */
- function (fn, init) {
- return this._results.reduce(fn, init);
- };
- /**
- * See
- * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
- */
- /**
- * See
- * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
- * @param {?} fn
- * @return {?}
- */
- QueryList.prototype.forEach = /**
- * See
- * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
- * @param {?} fn
- * @return {?}
- */
- function (fn) { this._results.forEach(fn); };
- /**
- * See
- * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
- */
- /**
- * See
- * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
- * @param {?} fn
- * @return {?}
- */
- QueryList.prototype.some = /**
- * See
- * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- return this._results.some(fn);
- };
- /**
- * @return {?}
- */
- QueryList.prototype.toArray = /**
- * @return {?}
- */
- function () { return this._results.slice(); };
- /**
- * @return {?}
- */
- QueryList.prototype[getSymbolIterator()] = /**
- * @return {?}
- */
- function () { return (/** @type {?} */ (this._results))[getSymbolIterator()](); };
- /**
- * @return {?}
- */
- QueryList.prototype.toString = /**
- * @return {?}
- */
- function () { return this._results.toString(); };
- /**
- * @param {?} res
- * @return {?}
- */
- QueryList.prototype.reset = /**
- * @param {?} res
- * @return {?}
- */
- function (res) {
- this._results = flatten(res);
- (/** @type {?} */ (this)).dirty = false;
- (/** @type {?} */ (this)).length = this._results.length;
- (/** @type {?} */ (this)).last = this._results[this.length - 1];
- (/** @type {?} */ (this)).first = this._results[0];
- };
- /**
- * @return {?}
- */
- QueryList.prototype.notifyOnChanges = /**
- * @return {?}
- */
- function () { (/** @type {?} */ (this.changes)).emit(this); };
- /** internal */
- /**
- * internal
- * @return {?}
- */
- QueryList.prototype.setDirty = /**
- * internal
- * @return {?}
- */
- function () { (/** @type {?} */ (this)).dirty = true; };
- /** internal */
- /**
- * internal
- * @return {?}
- */
- QueryList.prototype.destroy = /**
- * internal
- * @return {?}
- */
- function () {
- (/** @type {?} */ (this.changes)).complete();
- (/** @type {?} */ (this.changes)).unsubscribe();
- };
- return QueryList;
- }());
- /**
- * @template T
- * @param {?} list
- * @return {?}
- */
- function flatten(list) {
- return list.reduce(function (flat, item) {
- var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item;
- return (/** @type {?} */ (flat)).concat(flatItem);
- }, []);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _SEPARATOR = '#';
- var FACTORY_CLASS_SUFFIX = 'NgFactory';
- /**
- * Configuration for SystemJsNgModuleLoader.
- * token.
- *
- * \@experimental
- * @abstract
- */
- var SystemJsNgModuleLoaderConfig = /** @class */ (function () {
- function SystemJsNgModuleLoaderConfig() {
- }
- return SystemJsNgModuleLoaderConfig;
- }());
- var DEFAULT_CONFIG = {
- factoryPathPrefix: '',
- factoryPathSuffix: '.ngfactory',
- };
- /**
- * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
- * \@experimental
- */
- var SystemJsNgModuleLoader = /** @class */ (function () {
- function SystemJsNgModuleLoader(_compiler, config) {
- this._compiler = _compiler;
- this._config = config || DEFAULT_CONFIG;
- }
- /**
- * @param {?} path
- * @return {?}
- */
- SystemJsNgModuleLoader.prototype.load = /**
- * @param {?} path
- * @return {?}
- */
- function (path) {
- var /** @type {?} */ offlineMode = this._compiler instanceof Compiler;
- return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path);
- };
- /**
- * @param {?} path
- * @return {?}
- */
- SystemJsNgModuleLoader.prototype.loadAndCompile = /**
- * @param {?} path
- * @return {?}
- */
- function (path) {
- var _this = this;
- var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
- if (exportName === undefined) {
- exportName = 'default';
- }
- return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(module)
- .then(function (module) { return module[exportName]; })
- .then(function (type) { return checkNotEmpty(type, module, exportName); })
- .then(function (type) { return _this._compiler.compileModuleAsync(type); });
- };
- /**
- * @param {?} path
- * @return {?}
- */
- SystemJsNgModuleLoader.prototype.loadFactory = /**
- * @param {?} path
- * @return {?}
- */
- function (path) {
- var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
- var /** @type {?} */ factoryClassSuffix = FACTORY_CLASS_SUFFIX;
- if (exportName === undefined) {
- exportName = 'default';
- factoryClassSuffix = '';
- }
- return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
- .then(function (module) { return module[exportName + factoryClassSuffix]; })
- .then(function (factory) { return checkNotEmpty(factory, module, exportName); });
- };
- SystemJsNgModuleLoader.decorators = [
- { type: Injectable },
- ];
- /** @nocollapse */
- SystemJsNgModuleLoader.ctorParameters = function () { return [
- { type: Compiler, },
- { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] },
- ]; };
- return SystemJsNgModuleLoader;
- }());
- /**
- * @param {?} value
- * @param {?} modulePath
- * @param {?} exportName
- * @return {?}
- */
- function checkNotEmpty(value, modulePath, exportName) {
- if (!value) {
- throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'");
- }
- return value;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Represents an Embedded Template that can be used to instantiate Embedded Views.
- *
- * You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element
- * (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into
- * the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for
- * the `TemplateRef` from a Component or a Directive via {\@link Query}.
- *
- * To instantiate Embedded Views based on a Template, use {\@link ViewContainerRef#
- * createEmbeddedView}, which will create the View and attach it to the View Container.
- * \@stable
- * @abstract
- */
- var TemplateRef = /** @class */ (function () {
- function TemplateRef() {
- }
- return TemplateRef;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Represents a container where one or more Views can be attached.
- *
- * The container can contain two kinds of Views. Host Views, created by instantiating a
- * {\@link Component} via {\@link #createComponent}, and Embedded Views, created by instantiating an
- * {\@link TemplateRef Embedded Template} via {\@link #createEmbeddedView}.
- *
- * The location of the View Container within the containing View is specified by the Anchor
- * `element`. Each View Container can have only one Anchor Element and each Anchor Element can only
- * have a single View Container.
- *
- * Root elements of Views attached to this container become siblings of the Anchor Element in
- * the Rendered View.
- *
- * To access a `ViewContainerRef` of an Element, you can either place a {\@link Directive} injected
- * with `ViewContainerRef` on the Element, or you obtain it via a {\@link ViewChild} query.
- * \@stable
- * @abstract
- */
- var ViewContainerRef = /** @class */ (function () {
- function ViewContainerRef() {
- }
- return ViewContainerRef;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- * @abstract
- */
- var ChangeDetectorRef = /** @class */ (function () {
- function ChangeDetectorRef() {
- }
- return ChangeDetectorRef;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- * @abstract
- */
- var ViewRef = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ViewRef, _super);
- function ViewRef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- return ViewRef;
- }(ChangeDetectorRef));
- /**
- * Represents an Angular View.
- *
- * <!-- TODO: move the next two paragraphs to the dev guide -->
- * A View is a fundamental building block of the application UI. It is the smallest grouping of
- * Elements which are created and destroyed together.
- *
- * Properties of elements in a View can change, but the structure (number and order) of elements in
- * a View cannot. Changing the structure of Elements can only be done by inserting, moving or
- * removing nested Views via a {\@link ViewContainerRef}. Each View can contain many View Containers.
- * <!-- /TODO -->
- *
- * ### Example
- *
- * Given this template...
- *
- * ```
- * Count: {{items.length}}
- * <ul>
- * <li *ngFor="let item of items">{{item}}</li>
- * </ul>
- * ```
- *
- * We have two {\@link TemplateRef}s:
- *
- * Outer {\@link TemplateRef}:
- * ```
- * Count: {{items.length}}
- * <ul>
- * <ng-template ngFor let-item [ngForOf]="items"></ng-template>
- * </ul>
- * ```
- *
- * Inner {\@link TemplateRef}:
- * ```
- * <li>{{item}}</li>
- * ```
- *
- * Notice that the original template is broken down into two separate {\@link TemplateRef}s.
- *
- * The outer/inner {\@link TemplateRef}s are then assembled into views like so:
- *
- * ```
- * <!-- ViewRef: outer-0 -->
- * Count: 2
- * <ul>
- * <ng-template view-container-ref></ng-template>
- * <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 -->
- * <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 -->
- * </ul>
- * <!-- /ViewRef: outer-0 -->
- * ```
- * \@experimental
- * @abstract
- */
- var EmbeddedViewRef = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(EmbeddedViewRef, _super);
- function EmbeddedViewRef() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- return EmbeddedViewRef;
- }(ViewRef));
- /**
- * @record
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var EventListener = /** @class */ (function () {
- function EventListener(name, callback) {
- this.name = name;
- this.callback = callback;
- }
- return EventListener;
- }());
- /**
- * \@experimental All debugging apis are currently experimental.
- */
- var DebugNode = /** @class */ (function () {
- function DebugNode(nativeNode, parent, _debugContext) {
- this._debugContext = _debugContext;
- this.nativeNode = nativeNode;
- if (parent && parent instanceof DebugElement) {
- parent.addChild(this);
- }
- else {
- this.parent = null;
- }
- this.listeners = [];
- }
- Object.defineProperty(DebugNode.prototype, "injector", {
- get: /**
- * @return {?}
- */
- function () { return this._debugContext.injector; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugNode.prototype, "componentInstance", {
- get: /**
- * @return {?}
- */
- function () { return this._debugContext.component; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugNode.prototype, "context", {
- get: /**
- * @return {?}
- */
- function () { return this._debugContext.context; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugNode.prototype, "references", {
- get: /**
- * @return {?}
- */
- function () { return this._debugContext.references; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugNode.prototype, "providerTokens", {
- get: /**
- * @return {?}
- */
- function () { return this._debugContext.providerTokens; },
- enumerable: true,
- configurable: true
- });
- return DebugNode;
- }());
- /**
- * \@experimental All debugging apis are currently experimental.
- */
- var DebugElement = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DebugElement, _super);
- function DebugElement(nativeNode, parent, _debugContext) {
- var _this = _super.call(this, nativeNode, parent, _debugContext) || this;
- _this.properties = {};
- _this.attributes = {};
- _this.classes = {};
- _this.styles = {};
- _this.childNodes = [];
- _this.nativeElement = nativeNode;
- return _this;
- }
- /**
- * @param {?} child
- * @return {?}
- */
- DebugElement.prototype.addChild = /**
- * @param {?} child
- * @return {?}
- */
- function (child) {
- if (child) {
- this.childNodes.push(child);
- child.parent = this;
- }
- };
- /**
- * @param {?} child
- * @return {?}
- */
- DebugElement.prototype.removeChild = /**
- * @param {?} child
- * @return {?}
- */
- function (child) {
- var /** @type {?} */ childIndex = this.childNodes.indexOf(child);
- if (childIndex !== -1) {
- child.parent = null;
- this.childNodes.splice(childIndex, 1);
- }
- };
- /**
- * @param {?} child
- * @param {?} newChildren
- * @return {?}
- */
- DebugElement.prototype.insertChildrenAfter = /**
- * @param {?} child
- * @param {?} newChildren
- * @return {?}
- */
- function (child, newChildren) {
- var _this = this;
- var /** @type {?} */ siblingIndex = this.childNodes.indexOf(child);
- if (siblingIndex !== -1) {
- (_a = this.childNodes).splice.apply(_a, [siblingIndex + 1, 0].concat(newChildren));
- newChildren.forEach(function (c) {
- if (c.parent) {
- c.parent.removeChild(c);
- }
- c.parent = _this;
- });
- }
- var _a;
- };
- /**
- * @param {?} refChild
- * @param {?} newChild
- * @return {?}
- */
- DebugElement.prototype.insertBefore = /**
- * @param {?} refChild
- * @param {?} newChild
- * @return {?}
- */
- function (refChild, newChild) {
- var /** @type {?} */ refIndex = this.childNodes.indexOf(refChild);
- if (refIndex === -1) {
- this.addChild(newChild);
- }
- else {
- if (newChild.parent) {
- newChild.parent.removeChild(newChild);
- }
- newChild.parent = this;
- this.childNodes.splice(refIndex, 0, newChild);
- }
- };
- /**
- * @param {?} predicate
- * @return {?}
- */
- DebugElement.prototype.query = /**
- * @param {?} predicate
- * @return {?}
- */
- function (predicate) {
- var /** @type {?} */ results = this.queryAll(predicate);
- return results[0] || null;
- };
- /**
- * @param {?} predicate
- * @return {?}
- */
- DebugElement.prototype.queryAll = /**
- * @param {?} predicate
- * @return {?}
- */
- function (predicate) {
- var /** @type {?} */ matches = [];
- _queryElementChildren(this, predicate, matches);
- return matches;
- };
- /**
- * @param {?} predicate
- * @return {?}
- */
- DebugElement.prototype.queryAllNodes = /**
- * @param {?} predicate
- * @return {?}
- */
- function (predicate) {
- var /** @type {?} */ matches = [];
- _queryNodeChildren(this, predicate, matches);
- return matches;
- };
- Object.defineProperty(DebugElement.prototype, "children", {
- get: /**
- * @return {?}
- */
- function () {
- return /** @type {?} */ (this.childNodes.filter(function (node) { return node instanceof DebugElement; }));
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} eventName
- * @param {?} eventObj
- * @return {?}
- */
- DebugElement.prototype.triggerEventHandler = /**
- * @param {?} eventName
- * @param {?} eventObj
- * @return {?}
- */
- function (eventName, eventObj) {
- this.listeners.forEach(function (listener) {
- if (listener.name == eventName) {
- listener.callback(eventObj);
- }
- });
- };
- return DebugElement;
- }(DebugNode));
- /**
- * \@experimental
- * @param {?} debugEls
- * @return {?}
- */
- function asNativeElements(debugEls) {
- return debugEls.map(function (el) { return el.nativeElement; });
- }
- /**
- * @param {?} element
- * @param {?} predicate
- * @param {?} matches
- * @return {?}
- */
- function _queryElementChildren(element, predicate, matches) {
- element.childNodes.forEach(function (node) {
- if (node instanceof DebugElement) {
- if (predicate(node)) {
- matches.push(node);
- }
- _queryElementChildren(node, predicate, matches);
- }
- });
- }
- /**
- * @param {?} parentNode
- * @param {?} predicate
- * @param {?} matches
- * @return {?}
- */
- function _queryNodeChildren(parentNode, predicate, matches) {
- if (parentNode instanceof DebugElement) {
- parentNode.childNodes.forEach(function (node) {
- if (predicate(node)) {
- matches.push(node);
- }
- if (node instanceof DebugElement) {
- _queryNodeChildren(node, predicate, matches);
- }
- });
- }
- }
- // Need to keep the nodes in a global Map so that multiple angular apps are supported.
- var _nativeNodeToDebugNode = new Map();
- /**
- * \@experimental
- * @param {?} nativeNode
- * @return {?}
- */
- function getDebugNode(nativeNode) {
- return _nativeNodeToDebugNode.get(nativeNode) || null;
- }
- /**
- * @return {?}
- */
- /**
- * @param {?} node
- * @return {?}
- */
- function indexDebugNode(node) {
- _nativeNodeToDebugNode.set(node.nativeNode, node);
- }
- /**
- * @param {?} node
- * @return {?}
- */
- function removeDebugNodeFromIndex(node) {
- _nativeNodeToDebugNode.delete(node.nativeNode);
- }
- /**
- * A boolean-valued function over a value, possibly including context information
- * regarding that value's position in an array.
- *
- * \@experimental All debugging apis are currently experimental.
- * @record
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function devModeEqual(a, b) {
- var /** @type {?} */ isListLikeIterableA = isListLikeIterable(a);
- var /** @type {?} */ isListLikeIterableB = isListLikeIterable(b);
- if (isListLikeIterableA && isListLikeIterableB) {
- return areIterablesEqual(a, b, devModeEqual);
- }
- else {
- var /** @type {?} */ isAObject = a && (typeof a === 'object' || typeof a === 'function');
- var /** @type {?} */ isBObject = b && (typeof b === 'object' || typeof b === 'function');
- if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
- return true;
- }
- else {
- return looseIdentical(a, b);
- }
- }
- }
- /**
- * Indicates that the result of a {\@link Pipe} transformation has changed even though the
- * reference has not changed.
- *
- * Wrapped values are unwrapped automatically during the change detection, and the unwrapped value
- * is stored.
- *
- * Example:
- *
- * ```
- * if (this._latestValue === this._latestReturnedValue) {
- * return this._latestReturnedValue;
- * } else {
- * this._latestReturnedValue = this._latestValue;
- * return WrappedValue.wrap(this._latestValue); // this will force update
- * }
- * ```
- * \@stable
- */
- var WrappedValue = /** @class */ (function () {
- function WrappedValue(value) {
- this.wrapped = value;
- }
- /** Creates a wrapped value. */
- /**
- * Creates a wrapped value.
- * @param {?} value
- * @return {?}
- */
- WrappedValue.wrap = /**
- * Creates a wrapped value.
- * @param {?} value
- * @return {?}
- */
- function (value) { return new WrappedValue(value); };
- /**
- * Returns the underlying value of a wrapped value.
- * Returns the given `value` when it is not wrapped.
- **/
- /**
- * Returns the underlying value of a wrapped value.
- * Returns the given `value` when it is not wrapped.
- *
- * @param {?} value
- * @return {?}
- */
- WrappedValue.unwrap = /**
- * Returns the underlying value of a wrapped value.
- * Returns the given `value` when it is not wrapped.
- *
- * @param {?} value
- * @return {?}
- */
- function (value) { return WrappedValue.isWrapped(value) ? value.wrapped : value; };
- /** Returns true if `value` is a wrapped value. */
- /**
- * Returns true if `value` is a wrapped value.
- * @param {?} value
- * @return {?}
- */
- WrappedValue.isWrapped = /**
- * Returns true if `value` is a wrapped value.
- * @param {?} value
- * @return {?}
- */
- function (value) { return value instanceof WrappedValue; };
- return WrappedValue;
- }());
- /**
- * Represents a basic change from a previous to a new value.
- * \@stable
- */
- var SimpleChange = /** @class */ (function () {
- function SimpleChange(previousValue, currentValue, firstChange) {
- this.previousValue = previousValue;
- this.currentValue = currentValue;
- this.firstChange = firstChange;
- }
- /**
- * Check whether the new value is the first value assigned.
- */
- /**
- * Check whether the new value is the first value assigned.
- * @return {?}
- */
- SimpleChange.prototype.isFirstChange = /**
- * Check whether the new value is the first value assigned.
- * @return {?}
- */
- function () { return this.firstChange; };
- return SimpleChange;
- }());
- /**
- * @param {?} obj
- * @return {?}
- */
- function isListLikeIterable(obj) {
- if (!isJsObject(obj))
- return false;
- return Array.isArray(obj) ||
- (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
- // JS Map are iterables but return entries as [k, v]
- getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
- }
- /**
- * @param {?} a
- * @param {?} b
- * @param {?} comparator
- * @return {?}
- */
- function areIterablesEqual(a, b, comparator) {
- var /** @type {?} */ iterator1 = a[getSymbolIterator()]();
- var /** @type {?} */ iterator2 = b[getSymbolIterator()]();
- while (true) {
- var /** @type {?} */ item1 = iterator1.next();
- var /** @type {?} */ item2 = iterator2.next();
- if (item1.done && item2.done)
- return true;
- if (item1.done || item2.done)
- return false;
- if (!comparator(item1.value, item2.value))
- return false;
- }
- }
- /**
- * @param {?} obj
- * @param {?} fn
- * @return {?}
- */
- function iterateListLike(obj, fn) {
- if (Array.isArray(obj)) {
- for (var /** @type {?} */ i = 0; i < obj.length; i++) {
- fn(obj[i]);
- }
- }
- else {
- var /** @type {?} */ iterator = obj[getSymbolIterator()]();
- var /** @type {?} */ item = void 0;
- while (!((item = iterator.next()).done)) {
- fn(item.value);
- }
- }
- }
- /**
- * @param {?} o
- * @return {?}
- */
- function isJsObject(o) {
- return o !== null && (typeof o === 'function' || typeof o === 'object');
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var DefaultIterableDifferFactory = /** @class */ (function () {
- function DefaultIterableDifferFactory() {
- }
- /**
- * @param {?} obj
- * @return {?}
- */
- DefaultIterableDifferFactory.prototype.supports = /**
- * @param {?} obj
- * @return {?}
- */
- function (obj) { return isListLikeIterable(obj); };
- /**
- * @template V
- * @param {?=} trackByFn
- * @return {?}
- */
- DefaultIterableDifferFactory.prototype.create = /**
- * @template V
- * @param {?=} trackByFn
- * @return {?}
- */
- function (trackByFn) {
- return new DefaultIterableDiffer(trackByFn);
- };
- return DefaultIterableDifferFactory;
- }());
- var trackByIdentity = function (index, item) { return item; };
- /**
- * @deprecated v4.0.0 - Should not be part of public API.
- */
- var DefaultIterableDiffer = /** @class */ (function () {
- function DefaultIterableDiffer(trackByFn) {
- this.length = 0;
- this._linkedRecords = null;
- this._unlinkedRecords = null;
- this._previousItHead = null;
- this._itHead = null;
- this._itTail = null;
- this._additionsHead = null;
- this._additionsTail = null;
- this._movesHead = null;
- this._movesTail = null;
- this._removalsHead = null;
- this._removalsTail = null;
- this._identityChangesHead = null;
- this._identityChangesTail = null;
- this._trackByFn = trackByFn || trackByIdentity;
- }
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultIterableDiffer.prototype.forEachItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._itHead; record !== null; record = record._next) {
- fn(record);
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultIterableDiffer.prototype.forEachOperation = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ nextIt = this._itHead;
- var /** @type {?} */ nextRemove = this._removalsHead;
- var /** @type {?} */ addRemoveOffset = 0;
- var /** @type {?} */ moveOffsets = null;
- while (nextIt || nextRemove) {
- // Figure out which is the next record to process
- // Order: remove, add, move
- var /** @type {?} */ record = !nextRemove ||
- nextIt && /** @type {?} */ ((nextIt.currentIndex)) < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? /** @type {?} */
- ((nextIt)) :
- nextRemove;
- var /** @type {?} */ adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
- var /** @type {?} */ currentIndex = record.currentIndex;
- // consume the item, and adjust the addRemoveOffset and update moveDistance if necessary
- if (record === nextRemove) {
- addRemoveOffset--;
- nextRemove = nextRemove._nextRemoved;
- }
- else {
- nextIt = /** @type {?} */ ((nextIt))._next;
- if (record.previousIndex == null) {
- addRemoveOffset++;
- }
- else {
- // INVARIANT: currentIndex < previousIndex
- if (!moveOffsets)
- moveOffsets = [];
- var /** @type {?} */ localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
- var /** @type {?} */ localCurrentIndex = /** @type {?} */ ((currentIndex)) - addRemoveOffset;
- if (localMovePreviousIndex != localCurrentIndex) {
- for (var /** @type {?} */ i = 0; i < localMovePreviousIndex; i++) {
- var /** @type {?} */ offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
- var /** @type {?} */ index = offset + i;
- if (localCurrentIndex <= index && index < localMovePreviousIndex) {
- moveOffsets[i] = offset + 1;
- }
- }
- var /** @type {?} */ previousIndex = record.previousIndex;
- moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
- }
- }
- }
- if (adjPreviousIndex !== currentIndex) {
- fn(record, adjPreviousIndex, currentIndex);
- }
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultIterableDiffer.prototype.forEachPreviousItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
- fn(record);
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultIterableDiffer.prototype.forEachAddedItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._additionsHead; record !== null; record = record._nextAdded) {
- fn(record);
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultIterableDiffer.prototype.forEachMovedItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._movesHead; record !== null; record = record._nextMoved) {
- fn(record);
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultIterableDiffer.prototype.forEachRemovedItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
- fn(record);
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultIterableDiffer.prototype.forEachIdentityChange = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
- fn(record);
- }
- };
- /**
- * @param {?} collection
- * @return {?}
- */
- DefaultIterableDiffer.prototype.diff = /**
- * @param {?} collection
- * @return {?}
- */
- function (collection) {
- if (collection == null)
- collection = [];
- if (!isListLikeIterable(collection)) {
- throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed");
- }
- if (this.check(collection)) {
- return this;
- }
- else {
- return null;
- }
- };
- /**
- * @return {?}
- */
- DefaultIterableDiffer.prototype.onDestroy = /**
- * @return {?}
- */
- function () { };
- /**
- * @param {?} collection
- * @return {?}
- */
- DefaultIterableDiffer.prototype.check = /**
- * @param {?} collection
- * @return {?}
- */
- function (collection) {
- var _this = this;
- this._reset();
- var /** @type {?} */ record = this._itHead;
- var /** @type {?} */ mayBeDirty = false;
- var /** @type {?} */ index;
- var /** @type {?} */ item;
- var /** @type {?} */ itemTrackBy;
- if (Array.isArray(collection)) {
- (/** @type {?} */ (this)).length = collection.length;
- for (var /** @type {?} */ index_1 = 0; index_1 < this.length; index_1++) {
- item = collection[index_1];
- itemTrackBy = this._trackByFn(index_1, item);
- if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
- record = this._mismatch(record, item, itemTrackBy, index_1);
- mayBeDirty = true;
- }
- else {
- if (mayBeDirty) {
- // TODO(misko): can we limit this to duplicates only?
- record = this._verifyReinsertion(record, item, itemTrackBy, index_1);
- }
- if (!looseIdentical(record.item, item))
- this._addIdentityChange(record, item);
- }
- record = record._next;
- }
- }
- else {
- index = 0;
- iterateListLike(collection, function (item) {
- itemTrackBy = _this._trackByFn(index, item);
- if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
- record = _this._mismatch(record, item, itemTrackBy, index);
- mayBeDirty = true;
- }
- else {
- if (mayBeDirty) {
- // TODO(misko): can we limit this to duplicates only?
- record = _this._verifyReinsertion(record, item, itemTrackBy, index);
- }
- if (!looseIdentical(record.item, item))
- _this._addIdentityChange(record, item);
- }
- record = record._next;
- index++;
- });
- (/** @type {?} */ (this)).length = index;
- }
- this._truncate(record);
- (/** @type {?} */ (this)).collection = collection;
- return this.isDirty;
- };
- Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", {
- /* CollectionChanges is considered dirty if it has any additions, moves, removals, or identity
- * changes.
- */
- get: /**
- * @return {?}
- */
- function () {
- return this._additionsHead !== null || this._movesHead !== null ||
- this._removalsHead !== null || this._identityChangesHead !== null;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Reset the state of the change objects to show no changes. This means set previousKey to
- * currentKey, and clear all of the queues (additions, moves, removals).
- * Set the previousIndexes of moved and added items to their currentIndexes
- * Reset the list of additions, moves and removals
- *
- * @internal
- */
- /**
- * Reset the state of the change objects to show no changes. This means set previousKey to
- * currentKey, and clear all of the queues (additions, moves, removals).
- * Set the previousIndexes of moved and added items to their currentIndexes
- * Reset the list of additions, moves and removals
- *
- * \@internal
- * @return {?}
- */
- DefaultIterableDiffer.prototype._reset = /**
- * Reset the state of the change objects to show no changes. This means set previousKey to
- * currentKey, and clear all of the queues (additions, moves, removals).
- * Set the previousIndexes of moved and added items to their currentIndexes
- * Reset the list of additions, moves and removals
- *
- * \@internal
- * @return {?}
- */
- function () {
- if (this.isDirty) {
- var /** @type {?} */ record = void 0;
- var /** @type {?} */ nextRecord = void 0;
- for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
- record._nextPrevious = record._next;
- }
- for (record = this._additionsHead; record !== null; record = record._nextAdded) {
- record.previousIndex = record.currentIndex;
- }
- this._additionsHead = this._additionsTail = null;
- for (record = this._movesHead; record !== null; record = nextRecord) {
- record.previousIndex = record.currentIndex;
- nextRecord = record._nextMoved;
- }
- this._movesHead = this._movesTail = null;
- this._removalsHead = this._removalsTail = null;
- this._identityChangesHead = this._identityChangesTail = null;
- // todo(vicb) when assert gets supported
- // assert(!this.isDirty);
- }
- };
- /**
- * This is the core function which handles differences between collections.
- *
- * - `record` is the record which we saw at this position last time. If null then it is a new
- * item.
- * - `item` is the current item in the collection
- * - `index` is the position of the item in the collection
- *
- * @internal
- */
- /**
- * This is the core function which handles differences between collections.
- *
- * - `record` is the record which we saw at this position last time. If null then it is a new
- * item.
- * - `item` is the current item in the collection
- * - `index` is the position of the item in the collection
- *
- * \@internal
- * @param {?} record
- * @param {?} item
- * @param {?} itemTrackBy
- * @param {?} index
- * @return {?}
- */
- DefaultIterableDiffer.prototype._mismatch = /**
- * This is the core function which handles differences between collections.
- *
- * - `record` is the record which we saw at this position last time. If null then it is a new
- * item.
- * - `item` is the current item in the collection
- * - `index` is the position of the item in the collection
- *
- * \@internal
- * @param {?} record
- * @param {?} item
- * @param {?} itemTrackBy
- * @param {?} index
- * @return {?}
- */
- function (record, item, itemTrackBy, index) {
- // The previous record after which we will append the current one.
- var /** @type {?} */ previousRecord;
- if (record === null) {
- previousRecord = this._itTail;
- }
- else {
- previousRecord = record._prev;
- // Remove the record from the collection since we know it does not match the item.
- this._remove(record);
- }
- // Attempt to see if we have seen the item before.
- record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
- if (record !== null) {
- // We have seen this before, we need to move it forward in the collection.
- // But first we need to check if identity changed, so we can update in view if necessary
- if (!looseIdentical(record.item, item))
- this._addIdentityChange(record, item);
- this._moveAfter(record, previousRecord, index);
- }
- else {
- // Never seen it, check evicted list.
- record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
- if (record !== null) {
- // It is an item which we have evicted earlier: reinsert it back into the list.
- // But first we need to check if identity changed, so we can update in view if necessary
- if (!looseIdentical(record.item, item))
- this._addIdentityChange(record, item);
- this._reinsertAfter(record, previousRecord, index);
- }
- else {
- // It is a new item: add it.
- record =
- this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
- }
- }
- return record;
- };
- /**
- * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
- *
- * Use case: `[a, a]` => `[b, a, a]`
- *
- * If we did not have this check then the insertion of `b` would:
- * 1) evict first `a`
- * 2) insert `b` at `0` index.
- * 3) leave `a` at index `1` as is. <-- this is wrong!
- * 3) reinsert `a` at index 2. <-- this is wrong!
- *
- * The correct behavior is:
- * 1) evict first `a`
- * 2) insert `b` at `0` index.
- * 3) reinsert `a` at index 1.
- * 3) move `a` at from `1` to `2`.
- *
- *
- * Double check that we have not evicted a duplicate item. We need to check if the item type may
- * have already been removed:
- * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
- * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
- * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
- * at the end.
- *
- * @internal
- */
- /**
- * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
- *
- * Use case: `[a, a]` => `[b, a, a]`
- *
- * If we did not have this check then the insertion of `b` would:
- * 1) evict first `a`
- * 2) insert `b` at `0` index.
- * 3) leave `a` at index `1` as is. <-- this is wrong!
- * 3) reinsert `a` at index 2. <-- this is wrong!
- *
- * The correct behavior is:
- * 1) evict first `a`
- * 2) insert `b` at `0` index.
- * 3) reinsert `a` at index 1.
- * 3) move `a` at from `1` to `2`.
- *
- *
- * Double check that we have not evicted a duplicate item. We need to check if the item type may
- * have already been removed:
- * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
- * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
- * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
- * at the end.
- *
- * \@internal
- * @param {?} record
- * @param {?} item
- * @param {?} itemTrackBy
- * @param {?} index
- * @return {?}
- */
- DefaultIterableDiffer.prototype._verifyReinsertion = /**
- * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
- *
- * Use case: `[a, a]` => `[b, a, a]`
- *
- * If we did not have this check then the insertion of `b` would:
- * 1) evict first `a`
- * 2) insert `b` at `0` index.
- * 3) leave `a` at index `1` as is. <-- this is wrong!
- * 3) reinsert `a` at index 2. <-- this is wrong!
- *
- * The correct behavior is:
- * 1) evict first `a`
- * 2) insert `b` at `0` index.
- * 3) reinsert `a` at index 1.
- * 3) move `a` at from `1` to `2`.
- *
- *
- * Double check that we have not evicted a duplicate item. We need to check if the item type may
- * have already been removed:
- * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
- * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
- * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
- * at the end.
- *
- * \@internal
- * @param {?} record
- * @param {?} item
- * @param {?} itemTrackBy
- * @param {?} index
- * @return {?}
- */
- function (record, item, itemTrackBy, index) {
- var /** @type {?} */ reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
- if (reinsertRecord !== null) {
- record = this._reinsertAfter(reinsertRecord, /** @type {?} */ ((record._prev)), index);
- }
- else if (record.currentIndex != index) {
- record.currentIndex = index;
- this._addToMoves(record, index);
- }
- return record;
- };
- /**
- * Get rid of any excess {@link IterableChangeRecord_}s from the previous collection
- *
- * - `record` The first excess {@link IterableChangeRecord_}.
- *
- * @internal
- */
- /**
- * Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection
- *
- * - `record` The first excess {\@link IterableChangeRecord_}.
- *
- * \@internal
- * @param {?} record
- * @return {?}
- */
- DefaultIterableDiffer.prototype._truncate = /**
- * Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection
- *
- * - `record` The first excess {\@link IterableChangeRecord_}.
- *
- * \@internal
- * @param {?} record
- * @return {?}
- */
- function (record) {
- // Anything after that needs to be removed;
- while (record !== null) {
- var /** @type {?} */ nextRecord = record._next;
- this._addToRemovals(this._unlink(record));
- record = nextRecord;
- }
- if (this._unlinkedRecords !== null) {
- this._unlinkedRecords.clear();
- }
- if (this._additionsTail !== null) {
- this._additionsTail._nextAdded = null;
- }
- if (this._movesTail !== null) {
- this._movesTail._nextMoved = null;
- }
- if (this._itTail !== null) {
- this._itTail._next = null;
- }
- if (this._removalsTail !== null) {
- this._removalsTail._nextRemoved = null;
- }
- if (this._identityChangesTail !== null) {
- this._identityChangesTail._nextIdentityChange = null;
- }
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} record
- * @param {?} prevRecord
- * @param {?} index
- * @return {?}
- */
- DefaultIterableDiffer.prototype._reinsertAfter = /**
- * \@internal
- * @param {?} record
- * @param {?} prevRecord
- * @param {?} index
- * @return {?}
- */
- function (record, prevRecord, index) {
- if (this._unlinkedRecords !== null) {
- this._unlinkedRecords.remove(record);
- }
- var /** @type {?} */ prev = record._prevRemoved;
- var /** @type {?} */ next = record._nextRemoved;
- if (prev === null) {
- this._removalsHead = next;
- }
- else {
- prev._nextRemoved = next;
- }
- if (next === null) {
- this._removalsTail = prev;
- }
- else {
- next._prevRemoved = prev;
- }
- this._insertAfter(record, prevRecord, index);
- this._addToMoves(record, index);
- return record;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} record
- * @param {?} prevRecord
- * @param {?} index
- * @return {?}
- */
- DefaultIterableDiffer.prototype._moveAfter = /**
- * \@internal
- * @param {?} record
- * @param {?} prevRecord
- * @param {?} index
- * @return {?}
- */
- function (record, prevRecord, index) {
- this._unlink(record);
- this._insertAfter(record, prevRecord, index);
- this._addToMoves(record, index);
- return record;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} record
- * @param {?} prevRecord
- * @param {?} index
- * @return {?}
- */
- DefaultIterableDiffer.prototype._addAfter = /**
- * \@internal
- * @param {?} record
- * @param {?} prevRecord
- * @param {?} index
- * @return {?}
- */
- function (record, prevRecord, index) {
- this._insertAfter(record, prevRecord, index);
- if (this._additionsTail === null) {
- // todo(vicb)
- // assert(this._additionsHead === null);
- this._additionsTail = this._additionsHead = record;
- }
- else {
- // todo(vicb)
- // assert(_additionsTail._nextAdded === null);
- // assert(record._nextAdded === null);
- this._additionsTail = this._additionsTail._nextAdded = record;
- }
- return record;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} record
- * @param {?} prevRecord
- * @param {?} index
- * @return {?}
- */
- DefaultIterableDiffer.prototype._insertAfter = /**
- * \@internal
- * @param {?} record
- * @param {?} prevRecord
- * @param {?} index
- * @return {?}
- */
- function (record, prevRecord, index) {
- // todo(vicb)
- // assert(record != prevRecord);
- // assert(record._next === null);
- // assert(record._prev === null);
- var /** @type {?} */ next = prevRecord === null ? this._itHead : prevRecord._next;
- // todo(vicb)
- // assert(next != record);
- // assert(prevRecord != record);
- record._next = next;
- record._prev = prevRecord;
- if (next === null) {
- this._itTail = record;
- }
- else {
- next._prev = record;
- }
- if (prevRecord === null) {
- this._itHead = record;
- }
- else {
- prevRecord._next = record;
- }
- if (this._linkedRecords === null) {
- this._linkedRecords = new _DuplicateMap();
- }
- this._linkedRecords.put(record);
- record.currentIndex = index;
- return record;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} record
- * @return {?}
- */
- DefaultIterableDiffer.prototype._remove = /**
- * \@internal
- * @param {?} record
- * @return {?}
- */
- function (record) {
- return this._addToRemovals(this._unlink(record));
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} record
- * @return {?}
- */
- DefaultIterableDiffer.prototype._unlink = /**
- * \@internal
- * @param {?} record
- * @return {?}
- */
- function (record) {
- if (this._linkedRecords !== null) {
- this._linkedRecords.remove(record);
- }
- var /** @type {?} */ prev = record._prev;
- var /** @type {?} */ next = record._next;
- // todo(vicb)
- // assert((record._prev = null) === null);
- // assert((record._next = null) === null);
- if (prev === null) {
- this._itHead = next;
- }
- else {
- prev._next = next;
- }
- if (next === null) {
- this._itTail = prev;
- }
- else {
- next._prev = prev;
- }
- return record;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} record
- * @param {?} toIndex
- * @return {?}
- */
- DefaultIterableDiffer.prototype._addToMoves = /**
- * \@internal
- * @param {?} record
- * @param {?} toIndex
- * @return {?}
- */
- function (record, toIndex) {
- // todo(vicb)
- // assert(record._nextMoved === null);
- if (record.previousIndex === toIndex) {
- return record;
- }
- if (this._movesTail === null) {
- // todo(vicb)
- // assert(_movesHead === null);
- this._movesTail = this._movesHead = record;
- }
- else {
- // todo(vicb)
- // assert(_movesTail._nextMoved === null);
- this._movesTail = this._movesTail._nextMoved = record;
- }
- return record;
- };
- /**
- * @param {?} record
- * @return {?}
- */
- DefaultIterableDiffer.prototype._addToRemovals = /**
- * @param {?} record
- * @return {?}
- */
- function (record) {
- if (this._unlinkedRecords === null) {
- this._unlinkedRecords = new _DuplicateMap();
- }
- this._unlinkedRecords.put(record);
- record.currentIndex = null;
- record._nextRemoved = null;
- if (this._removalsTail === null) {
- // todo(vicb)
- // assert(_removalsHead === null);
- this._removalsTail = this._removalsHead = record;
- record._prevRemoved = null;
- }
- else {
- // todo(vicb)
- // assert(_removalsTail._nextRemoved === null);
- // assert(record._nextRemoved === null);
- record._prevRemoved = this._removalsTail;
- this._removalsTail = this._removalsTail._nextRemoved = record;
- }
- return record;
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} record
- * @param {?} item
- * @return {?}
- */
- DefaultIterableDiffer.prototype._addIdentityChange = /**
- * \@internal
- * @param {?} record
- * @param {?} item
- * @return {?}
- */
- function (record, item) {
- record.item = item;
- if (this._identityChangesTail === null) {
- this._identityChangesTail = this._identityChangesHead = record;
- }
- else {
- this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
- }
- return record;
- };
- return DefaultIterableDiffer;
- }());
- /**
- * \@stable
- */
- var IterableChangeRecord_ = /** @class */ (function () {
- function IterableChangeRecord_(item, trackById) {
- this.item = item;
- this.trackById = trackById;
- this.currentIndex = null;
- this.previousIndex = null;
- /**
- * \@internal
- */
- this._nextPrevious = null;
- /**
- * \@internal
- */
- this._prev = null;
- /**
- * \@internal
- */
- this._next = null;
- /**
- * \@internal
- */
- this._prevDup = null;
- /**
- * \@internal
- */
- this._nextDup = null;
- /**
- * \@internal
- */
- this._prevRemoved = null;
- /**
- * \@internal
- */
- this._nextRemoved = null;
- /**
- * \@internal
- */
- this._nextAdded = null;
- /**
- * \@internal
- */
- this._nextMoved = null;
- /**
- * \@internal
- */
- this._nextIdentityChange = null;
- }
- return IterableChangeRecord_;
- }());
- var _DuplicateItemRecordList = /** @class */ (function () {
- function _DuplicateItemRecordList() {
- /**
- * \@internal
- */
- this._head = null;
- /**
- * \@internal
- */
- this._tail = null;
- }
- /**
- * Append the record to the list of duplicates.
- *
- * Note: by design all records in the list of duplicates hold the same value in record.item.
- */
- /**
- * Append the record to the list of duplicates.
- *
- * Note: by design all records in the list of duplicates hold the same value in record.item.
- * @param {?} record
- * @return {?}
- */
- _DuplicateItemRecordList.prototype.add = /**
- * Append the record to the list of duplicates.
- *
- * Note: by design all records in the list of duplicates hold the same value in record.item.
- * @param {?} record
- * @return {?}
- */
- function (record) {
- if (this._head === null) {
- this._head = this._tail = record;
- record._nextDup = null;
- record._prevDup = null;
- }
- else {
- /** @type {?} */ ((
- // todo(vicb)
- // assert(record.item == _head.item ||
- // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
- this._tail))._nextDup = record;
- record._prevDup = this._tail;
- record._nextDup = null;
- this._tail = record;
- }
- };
- // Returns a IterableChangeRecord_ having IterableChangeRecord_.trackById == trackById and
- // IterableChangeRecord_.currentIndex >= atOrAfterIndex
- /**
- * @param {?} trackById
- * @param {?} atOrAfterIndex
- * @return {?}
- */
- _DuplicateItemRecordList.prototype.get = /**
- * @param {?} trackById
- * @param {?} atOrAfterIndex
- * @return {?}
- */
- function (trackById, atOrAfterIndex) {
- var /** @type {?} */ record;
- for (record = this._head; record !== null; record = record._nextDup) {
- if ((atOrAfterIndex === null || atOrAfterIndex <= /** @type {?} */ ((record.currentIndex))) &&
- looseIdentical(record.trackById, trackById)) {
- return record;
- }
- }
- return null;
- };
- /**
- * Remove one {@link IterableChangeRecord_} from the list of duplicates.
- *
- * Returns whether the list of duplicates is empty.
- */
- /**
- * Remove one {\@link IterableChangeRecord_} from the list of duplicates.
- *
- * Returns whether the list of duplicates is empty.
- * @param {?} record
- * @return {?}
- */
- _DuplicateItemRecordList.prototype.remove = /**
- * Remove one {\@link IterableChangeRecord_} from the list of duplicates.
- *
- * Returns whether the list of duplicates is empty.
- * @param {?} record
- * @return {?}
- */
- function (record) {
- // todo(vicb)
- // assert(() {
- // // verify that the record being removed is in the list.
- // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) {
- // if (identical(cursor, record)) return true;
- // }
- // return false;
- //});
- var /** @type {?} */ prev = record._prevDup;
- var /** @type {?} */ next = record._nextDup;
- if (prev === null) {
- this._head = next;
- }
- else {
- prev._nextDup = next;
- }
- if (next === null) {
- this._tail = prev;
- }
- else {
- next._prevDup = prev;
- }
- return this._head === null;
- };
- return _DuplicateItemRecordList;
- }());
- var _DuplicateMap = /** @class */ (function () {
- function _DuplicateMap() {
- this.map = new Map();
- }
- /**
- * @param {?} record
- * @return {?}
- */
- _DuplicateMap.prototype.put = /**
- * @param {?} record
- * @return {?}
- */
- function (record) {
- var /** @type {?} */ key = record.trackById;
- var /** @type {?} */ duplicates = this.map.get(key);
- if (!duplicates) {
- duplicates = new _DuplicateItemRecordList();
- this.map.set(key, duplicates);
- }
- duplicates.add(record);
- };
- /**
- * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
- * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
- *
- * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
- * have any more `a`s needs to return the second `a`.
- */
- /**
- * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
- * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
- *
- * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
- * have any more `a`s needs to return the second `a`.
- * @param {?} trackById
- * @param {?} atOrAfterIndex
- * @return {?}
- */
- _DuplicateMap.prototype.get = /**
- * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
- * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
- *
- * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
- * have any more `a`s needs to return the second `a`.
- * @param {?} trackById
- * @param {?} atOrAfterIndex
- * @return {?}
- */
- function (trackById, atOrAfterIndex) {
- var /** @type {?} */ key = trackById;
- var /** @type {?} */ recordList = this.map.get(key);
- return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
- };
- /**
- * Removes a {@link IterableChangeRecord_} from the list of duplicates.
- *
- * The list of duplicates also is removed from the map if it gets empty.
- */
- /**
- * Removes a {\@link IterableChangeRecord_} from the list of duplicates.
- *
- * The list of duplicates also is removed from the map if it gets empty.
- * @param {?} record
- * @return {?}
- */
- _DuplicateMap.prototype.remove = /**
- * Removes a {\@link IterableChangeRecord_} from the list of duplicates.
- *
- * The list of duplicates also is removed from the map if it gets empty.
- * @param {?} record
- * @return {?}
- */
- function (record) {
- var /** @type {?} */ key = record.trackById;
- var /** @type {?} */ recordList = /** @type {?} */ ((this.map.get(key)));
- // Remove the list of duplicates when it gets empty
- if (recordList.remove(record)) {
- this.map.delete(key);
- }
- return record;
- };
- Object.defineProperty(_DuplicateMap.prototype, "isEmpty", {
- get: /**
- * @return {?}
- */
- function () { return this.map.size === 0; },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- _DuplicateMap.prototype.clear = /**
- * @return {?}
- */
- function () { this.map.clear(); };
- return _DuplicateMap;
- }());
- /**
- * @param {?} item
- * @param {?} addRemoveOffset
- * @param {?} moveOffsets
- * @return {?}
- */
- function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
- var /** @type {?} */ previousIndex = item.previousIndex;
- if (previousIndex === null)
- return previousIndex;
- var /** @type {?} */ moveOffset = 0;
- if (moveOffsets && previousIndex < moveOffsets.length) {
- moveOffset = moveOffsets[previousIndex];
- }
- return previousIndex + addRemoveOffset + moveOffset;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var DefaultKeyValueDifferFactory = /** @class */ (function () {
- function DefaultKeyValueDifferFactory() {
- }
- /**
- * @param {?} obj
- * @return {?}
- */
- DefaultKeyValueDifferFactory.prototype.supports = /**
- * @param {?} obj
- * @return {?}
- */
- function (obj) { return obj instanceof Map || isJsObject(obj); };
- /**
- * @template K, V
- * @return {?}
- */
- DefaultKeyValueDifferFactory.prototype.create = /**
- * @template K, V
- * @return {?}
- */
- function () { return new DefaultKeyValueDiffer(); };
- return DefaultKeyValueDifferFactory;
- }());
- var DefaultKeyValueDiffer = /** @class */ (function () {
- function DefaultKeyValueDiffer() {
- this._records = new Map();
- this._mapHead = null;
- this._appendAfter = null;
- this._previousMapHead = null;
- this._changesHead = null;
- this._changesTail = null;
- this._additionsHead = null;
- this._additionsTail = null;
- this._removalsHead = null;
- this._removalsTail = null;
- }
- Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
- get: /**
- * @return {?}
- */
- function () {
- return this._additionsHead !== null || this._changesHead !== null ||
- this._removalsHead !== null;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype.forEachItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._mapHead; record !== null; record = record._next) {
- fn(record);
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype.forEachPreviousItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
- fn(record);
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype.forEachChangedItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._changesHead; record !== null; record = record._nextChanged) {
- fn(record);
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype.forEachAddedItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._additionsHead; record !== null; record = record._nextAdded) {
- fn(record);
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype.forEachRemovedItem = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- var /** @type {?} */ record;
- for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
- fn(record);
- }
- };
- /**
- * @param {?=} map
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype.diff = /**
- * @param {?=} map
- * @return {?}
- */
- function (map) {
- if (!map) {
- map = new Map();
- }
- else if (!(map instanceof Map || isJsObject(map))) {
- throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed");
- }
- return this.check(map) ? this : null;
- };
- /**
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype.onDestroy = /**
- * @return {?}
- */
- function () { };
- /**
- * Check the current state of the map vs the previous.
- * The algorithm is optimised for when the keys do no change.
- */
- /**
- * Check the current state of the map vs the previous.
- * The algorithm is optimised for when the keys do no change.
- * @param {?} map
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype.check = /**
- * Check the current state of the map vs the previous.
- * The algorithm is optimised for when the keys do no change.
- * @param {?} map
- * @return {?}
- */
- function (map) {
- var _this = this;
- this._reset();
- var /** @type {?} */ insertBefore = this._mapHead;
- this._appendAfter = null;
- this._forEach(map, function (value, key) {
- if (insertBefore && insertBefore.key === key) {
- _this._maybeAddToChanges(insertBefore, value);
- _this._appendAfter = insertBefore;
- insertBefore = insertBefore._next;
- }
- else {
- var /** @type {?} */ record = _this._getOrCreateRecordForKey(key, value);
- insertBefore = _this._insertBeforeOrAppend(insertBefore, record);
- }
- });
- // Items remaining at the end of the list have been deleted
- if (insertBefore) {
- if (insertBefore._prev) {
- insertBefore._prev._next = null;
- }
- this._removalsHead = insertBefore;
- for (var /** @type {?} */ record = insertBefore; record !== null; record = record._nextRemoved) {
- if (record === this._mapHead) {
- this._mapHead = null;
- }
- this._records.delete(record.key);
- record._nextRemoved = record._next;
- record.previousValue = record.currentValue;
- record.currentValue = null;
- record._prev = null;
- record._next = null;
- }
- }
- // Make sure tails have no next records from previous runs
- if (this._changesTail)
- this._changesTail._nextChanged = null;
- if (this._additionsTail)
- this._additionsTail._nextAdded = null;
- return this.isDirty;
- };
- /**
- * Inserts a record before `before` or append at the end of the list when `before` is null.
- *
- * Notes:
- * - This method appends at `this._appendAfter`,
- * - This method updates `this._appendAfter`,
- * - The return value is the new value for the insertion pointer.
- * @param {?} before
- * @param {?} record
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = /**
- * Inserts a record before `before` or append at the end of the list when `before` is null.
- *
- * Notes:
- * - This method appends at `this._appendAfter`,
- * - This method updates `this._appendAfter`,
- * - The return value is the new value for the insertion pointer.
- * @param {?} before
- * @param {?} record
- * @return {?}
- */
- function (before, record) {
- if (before) {
- var /** @type {?} */ prev = before._prev;
- record._next = before;
- record._prev = prev;
- before._prev = record;
- if (prev) {
- prev._next = record;
- }
- if (before === this._mapHead) {
- this._mapHead = record;
- }
- this._appendAfter = before;
- return before;
- }
- if (this._appendAfter) {
- this._appendAfter._next = record;
- record._prev = this._appendAfter;
- }
- else {
- this._mapHead = record;
- }
- this._appendAfter = record;
- return null;
- };
- /**
- * @param {?} key
- * @param {?} value
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = /**
- * @param {?} key
- * @param {?} value
- * @return {?}
- */
- function (key, value) {
- if (this._records.has(key)) {
- var /** @type {?} */ record_1 = /** @type {?} */ ((this._records.get(key)));
- this._maybeAddToChanges(record_1, value);
- var /** @type {?} */ prev = record_1._prev;
- var /** @type {?} */ next = record_1._next;
- if (prev) {
- prev._next = next;
- }
- if (next) {
- next._prev = prev;
- }
- record_1._next = null;
- record_1._prev = null;
- return record_1;
- }
- var /** @type {?} */ record = new KeyValueChangeRecord_(key);
- this._records.set(key, record);
- record.currentValue = value;
- this._addToAdditions(record);
- return record;
- };
- /** @internal */
- /**
- * \@internal
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype._reset = /**
- * \@internal
- * @return {?}
- */
- function () {
- if (this.isDirty) {
- var /** @type {?} */ record = void 0;
- // let `_previousMapHead` contain the state of the map before the changes
- this._previousMapHead = this._mapHead;
- for (record = this._previousMapHead; record !== null; record = record._next) {
- record._nextPrevious = record._next;
- }
- // Update `record.previousValue` with the value of the item before the changes
- // We need to update all changed items (that's those which have been added and changed)
- for (record = this._changesHead; record !== null; record = record._nextChanged) {
- record.previousValue = record.currentValue;
- }
- for (record = this._additionsHead; record != null; record = record._nextAdded) {
- record.previousValue = record.currentValue;
- }
- this._changesHead = this._changesTail = null;
- this._additionsHead = this._additionsTail = null;
- this._removalsHead = null;
- }
- };
- /**
- * @param {?} record
- * @param {?} newValue
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype._maybeAddToChanges = /**
- * @param {?} record
- * @param {?} newValue
- * @return {?}
- */
- function (record, newValue) {
- if (!looseIdentical(newValue, record.currentValue)) {
- record.previousValue = record.currentValue;
- record.currentValue = newValue;
- this._addToChanges(record);
- }
- };
- /**
- * @param {?} record
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype._addToAdditions = /**
- * @param {?} record
- * @return {?}
- */
- function (record) {
- if (this._additionsHead === null) {
- this._additionsHead = this._additionsTail = record;
- }
- else {
- /** @type {?} */ ((this._additionsTail))._nextAdded = record;
- this._additionsTail = record;
- }
- };
- /**
- * @param {?} record
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype._addToChanges = /**
- * @param {?} record
- * @return {?}
- */
- function (record) {
- if (this._changesHead === null) {
- this._changesHead = this._changesTail = record;
- }
- else {
- /** @type {?} */ ((this._changesTail))._nextChanged = record;
- this._changesTail = record;
- }
- };
- /**
- * \@internal
- * @template K, V
- * @param {?} obj
- * @param {?} fn
- * @return {?}
- */
- DefaultKeyValueDiffer.prototype._forEach = /**
- * \@internal
- * @template K, V
- * @param {?} obj
- * @param {?} fn
- * @return {?}
- */
- function (obj, fn) {
- if (obj instanceof Map) {
- obj.forEach(fn);
- }
- else {
- Object.keys(obj).forEach(function (k) { return fn(obj[k], k); });
- }
- };
- return DefaultKeyValueDiffer;
- }());
- /**
- * \@stable
- */
- var KeyValueChangeRecord_ = /** @class */ (function () {
- function KeyValueChangeRecord_(key) {
- this.key = key;
- this.previousValue = null;
- this.currentValue = null;
- /**
- * \@internal
- */
- this._nextPrevious = null;
- /**
- * \@internal
- */
- this._next = null;
- /**
- * \@internal
- */
- this._prev = null;
- /**
- * \@internal
- */
- this._nextAdded = null;
- /**
- * \@internal
- */
- this._nextRemoved = null;
- /**
- * \@internal
- */
- this._nextChanged = null;
- }
- return KeyValueChangeRecord_;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A strategy for tracking changes over time to an iterable. Used by {\@link NgForOf} to
- * respond to changes in an iterable by effecting equivalent changes in the DOM.
- *
- * \@stable
- * @record
- */
- /**
- * An object describing the changes in the `Iterable` collection since last time
- * `IterableDiffer#diff()` was invoked.
- *
- * \@stable
- * @record
- */
- /**
- * Record representing the item change information.
- *
- * \@stable
- * @record
- */
- /**
- * @deprecated v4.0.0 - Use IterableChangeRecord instead.
- * @record
- */
- /**
- * An optional function passed into {\@link NgForOf} that defines how to track
- * items in an iterable (e.g. fby index or id)
- *
- * \@stable
- * @record
- */
- /**
- * Provides a factory for {\@link IterableDiffer}.
- *
- * \@stable
- * @record
- */
- /**
- * A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
- * \@stable
- */
- var IterableDiffers = /** @class */ (function () {
- function IterableDiffers(factories) {
- this.factories = factories;
- }
- /**
- * @param {?} factories
- * @param {?=} parent
- * @return {?}
- */
- IterableDiffers.create = /**
- * @param {?} factories
- * @param {?=} parent
- * @return {?}
- */
- function (factories, parent) {
- if (parent != null) {
- var /** @type {?} */ copied = parent.factories.slice();
- factories = factories.concat(copied);
- return new IterableDiffers(factories);
- }
- else {
- return new IterableDiffers(factories);
- }
- };
- /**
- * Takes an array of {@link IterableDifferFactory} and returns a provider used to extend the
- * inherited {@link IterableDiffers} instance with the provided factories and return a new
- * {@link IterableDiffers} instance.
- *
- * The following example shows how to extend an existing list of factories,
- * which will only be applied to the injector for this component and its children.
- * This step is all that's required to make a new {@link IterableDiffer} available.
- *
- * ### Example
- *
- * ```
- * @Component({
- * viewProviders: [
- * IterableDiffers.extend([new ImmutableListDiffer()])
- * ]
- * })
- * ```
- */
- /**
- * Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the
- * inherited {\@link IterableDiffers} instance with the provided factories and return a new
- * {\@link IterableDiffers} instance.
- *
- * The following example shows how to extend an existing list of factories,
- * which will only be applied to the injector for this component and its children.
- * This step is all that's required to make a new {\@link IterableDiffer} available.
- *
- * ### Example
- *
- * ```
- * \@Component({
- * viewProviders: [
- * IterableDiffers.extend([new ImmutableListDiffer()])
- * ]
- * })
- * ```
- * @param {?} factories
- * @return {?}
- */
- IterableDiffers.extend = /**
- * Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the
- * inherited {\@link IterableDiffers} instance with the provided factories and return a new
- * {\@link IterableDiffers} instance.
- *
- * The following example shows how to extend an existing list of factories,
- * which will only be applied to the injector for this component and its children.
- * This step is all that's required to make a new {\@link IterableDiffer} available.
- *
- * ### Example
- *
- * ```
- * \@Component({
- * viewProviders: [
- * IterableDiffers.extend([new ImmutableListDiffer()])
- * ]
- * })
- * ```
- * @param {?} factories
- * @return {?}
- */
- function (factories) {
- return {
- provide: IterableDiffers,
- useFactory: function (parent) {
- if (!parent) {
- // Typically would occur when calling IterableDiffers.extend inside of dependencies passed
- // to
- // bootstrap(), which would override default pipes instead of extending them.
- throw new Error('Cannot extend IterableDiffers without a parent injector');
- }
- return IterableDiffers.create(factories, parent);
- },
- // Dependency technically isn't optional, but we can provide a better error message this way.
- deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
- };
- };
- /**
- * @param {?} iterable
- * @return {?}
- */
- IterableDiffers.prototype.find = /**
- * @param {?} iterable
- * @return {?}
- */
- function (iterable) {
- var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(iterable); });
- if (factory != null) {
- return factory;
- }
- else {
- throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
- }
- };
- return IterableDiffers;
- }());
- /**
- * @param {?} type
- * @return {?}
- */
- function getTypeNameForDebugging(type) {
- return type['name'] || typeof type;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A differ that tracks changes made to an object over time.
- *
- * \@stable
- * @record
- */
- /**
- * An object describing the changes in the `Map` or `{[k:string]: string}` since last time
- * `KeyValueDiffer#diff()` was invoked.
- *
- * \@stable
- * @record
- */
- /**
- * Record representing the item change information.
- *
- * \@stable
- * @record
- */
- /**
- * Provides a factory for {\@link KeyValueDiffer}.
- *
- * \@stable
- * @record
- */
- /**
- * A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
- * \@stable
- */
- var KeyValueDiffers = /** @class */ (function () {
- function KeyValueDiffers(factories) {
- this.factories = factories;
- }
- /**
- * @template S
- * @param {?} factories
- * @param {?=} parent
- * @return {?}
- */
- KeyValueDiffers.create = /**
- * @template S
- * @param {?} factories
- * @param {?=} parent
- * @return {?}
- */
- function (factories, parent) {
- if (parent) {
- var /** @type {?} */ copied = parent.factories.slice();
- factories = factories.concat(copied);
- }
- return new KeyValueDiffers(factories);
- };
- /**
- * Takes an array of {@link KeyValueDifferFactory} and returns a provider used to extend the
- * inherited {@link KeyValueDiffers} instance with the provided factories and return a new
- * {@link KeyValueDiffers} instance.
- *
- * The following example shows how to extend an existing list of factories,
- * which will only be applied to the injector for this component and its children.
- * This step is all that's required to make a new {@link KeyValueDiffer} available.
- *
- * ### Example
- *
- * ```
- * @Component({
- * viewProviders: [
- * KeyValueDiffers.extend([new ImmutableMapDiffer()])
- * ]
- * })
- * ```
- */
- /**
- * Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the
- * inherited {\@link KeyValueDiffers} instance with the provided factories and return a new
- * {\@link KeyValueDiffers} instance.
- *
- * The following example shows how to extend an existing list of factories,
- * which will only be applied to the injector for this component and its children.
- * This step is all that's required to make a new {\@link KeyValueDiffer} available.
- *
- * ### Example
- *
- * ```
- * \@Component({
- * viewProviders: [
- * KeyValueDiffers.extend([new ImmutableMapDiffer()])
- * ]
- * })
- * ```
- * @template S
- * @param {?} factories
- * @return {?}
- */
- KeyValueDiffers.extend = /**
- * Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the
- * inherited {\@link KeyValueDiffers} instance with the provided factories and return a new
- * {\@link KeyValueDiffers} instance.
- *
- * The following example shows how to extend an existing list of factories,
- * which will only be applied to the injector for this component and its children.
- * This step is all that's required to make a new {\@link KeyValueDiffer} available.
- *
- * ### Example
- *
- * ```
- * \@Component({
- * viewProviders: [
- * KeyValueDiffers.extend([new ImmutableMapDiffer()])
- * ]
- * })
- * ```
- * @template S
- * @param {?} factories
- * @return {?}
- */
- function (factories) {
- return {
- provide: KeyValueDiffers,
- useFactory: function (parent) {
- if (!parent) {
- // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed
- // to bootstrap(), which would override default pipes instead of extending them.
- throw new Error('Cannot extend KeyValueDiffers without a parent injector');
- }
- return KeyValueDiffers.create(factories, parent);
- },
- // Dependency technically isn't optional, but we can provide a better error message this way.
- deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
- };
- };
- /**
- * @param {?} kv
- * @return {?}
- */
- KeyValueDiffers.prototype.find = /**
- * @param {?} kv
- * @return {?}
- */
- function (kv) {
- var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(kv); });
- if (factory) {
- return factory;
- }
- throw new Error("Cannot find a differ supporting object '" + kv + "'");
- };
- return KeyValueDiffers;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Structural diffing for `Object`s and `Map`s.
- */
- var keyValDiff = [new DefaultKeyValueDifferFactory()];
- /**
- * Structural diffing for `Iterable` types such as `Array`s.
- */
- var iterableDiff = [new DefaultIterableDifferFactory()];
- var defaultIterableDiffers = new IterableDiffers(iterableDiff);
- var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _CORE_PLATFORM_PROVIDERS = [
- // Set a default platform name for platforms that don't set it explicitly.
- { provide: PLATFORM_ID, useValue: 'unknown' },
- { provide: PlatformRef, deps: [Injector] },
- { provide: TestabilityRegistry, deps: [] },
- { provide: Console, deps: [] },
- ];
- /**
- * This platform has to be included in any other platform
- *
- * \@experimental
- */
- var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Provide this token to set the locale of your application.
- * It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe,
- * DecimalPipe and PercentPipe) and by ICU expressions.
- *
- * See the {\@linkDocs guide/i18n#setting-up-locale i18n guide} for more information.
- *
- * ### Example
- *
- * ```typescript
- * import { LOCALE_ID } from '\@angular/core';
- * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic';
- * import { AppModule } from './app/app.module';
- *
- * platformBrowserDynamic().bootstrapModule(AppModule, {
- * providers: [{provide: LOCALE_ID, useValue: 'en-US' }]
- * });
- * ```
- *
- * \@experimental i18n support is experimental.
- */
- var LOCALE_ID = new InjectionToken('LocaleId');
- /**
- * Use this token at bootstrap to provide the content of your translation file (`xtb`,
- * `xlf` or `xlf2`) when you want to translate your application in another language.
- *
- * See the {\@linkDocs guide/i18n#merge i18n guide} for more information.
- *
- * ### Example
- *
- * ```typescript
- * import { TRANSLATIONS } from '\@angular/core';
- * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic';
- * import { AppModule } from './app/app.module';
- *
- * // content of your translation file
- * const translations = '....';
- *
- * platformBrowserDynamic().bootstrapModule(AppModule, {
- * providers: [{provide: TRANSLATIONS, useValue: translations }]
- * });
- * ```
- *
- * \@experimental i18n support is experimental.
- */
- var TRANSLATIONS = new InjectionToken('Translations');
- /**
- * Provide this token at bootstrap to set the format of your {\@link TRANSLATIONS}: `xtb`,
- * `xlf` or `xlf2`.
- *
- * See the {\@linkDocs guide/i18n#merge i18n guide} for more information.
- *
- * ### Example
- *
- * ```typescript
- * import { TRANSLATIONS_FORMAT } from '\@angular/core';
- * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic';
- * import { AppModule } from './app/app.module';
- *
- * platformBrowserDynamic().bootstrapModule(AppModule, {
- * providers: [{provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }]
- * });
- * ```
- *
- * \@experimental i18n support is experimental.
- */
- var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
- /** @enum {number} */
- var MissingTranslationStrategy = {
- Error: 0,
- Warning: 1,
- Ignore: 2,
- };
- MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
- MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
- MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @return {?}
- */
- function _iterableDiffersFactory() {
- return defaultIterableDiffers;
- }
- /**
- * @return {?}
- */
- function _keyValueDiffersFactory() {
- return defaultKeyValueDiffers;
- }
- /**
- * @param {?=} locale
- * @return {?}
- */
- function _localeFactory(locale) {
- return locale || 'en-US';
- }
- /**
- * This module includes the providers of \@angular/core that are needed
- * to bootstrap components via `ApplicationRef`.
- *
- * \@experimental
- */
- var ApplicationModule = /** @class */ (function () {
- // Inject ApplicationRef to make it eager...
- function ApplicationModule(appRef) {
- }
- ApplicationModule.decorators = [
- { type: NgModule, args: [{
- providers: [
- ApplicationRef,
- ApplicationInitStatus,
- Compiler,
- APP_ID_RANDOM_PROVIDER,
- { provide: IterableDiffers, useFactory: _iterableDiffersFactory },
- { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory },
- {
- provide: LOCALE_ID,
- useFactory: _localeFactory,
- deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
- },
- ]
- },] },
- ];
- /** @nocollapse */
- ApplicationModule.ctorParameters = function () { return [
- { type: ApplicationRef, },
- ]; };
- return ApplicationModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var SecurityContext = {
- NONE: 0,
- HTML: 1,
- STYLE: 2,
- SCRIPT: 3,
- URL: 4,
- RESOURCE_URL: 5,
- };
- SecurityContext[SecurityContext.NONE] = "NONE";
- SecurityContext[SecurityContext.HTML] = "HTML";
- SecurityContext[SecurityContext.STYLE] = "STYLE";
- SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
- SecurityContext[SecurityContext.URL] = "URL";
- SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
- /**
- * Sanitizer is used by the views to sanitize potentially dangerous values.
- *
- * \@stable
- * @abstract
- */
- var Sanitizer = /** @class */ (function () {
- function Sanitizer() {
- }
- return Sanitizer;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Factory for ViewDefinitions/NgModuleDefinitions.
- * We use a function so we can reexeute it in case an error happens and use the given logger
- * function to log the error from the definition of the node, which is shown in all browser
- * logs.
- * @record
- */
- /**
- * Function to call console.error at the right source location. This is an indirection
- * via another function as browser will log the location that actually called
- * `console.error`.
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * A node definition in the view.
- *
- * Note: We use one type for all nodes so that loops that loop over all nodes
- * of a ViewDefinition stay monomorphic!
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * View instance data.
- * Attention: Adding fields to this is performance sensitive!
- * @record
- */
- /**
- * @param {?} view
- * @param {?} priorInitState
- * @param {?} newInitState
- * @return {?}
- */
- function shiftInitState(view, priorInitState, newInitState) {
- // Only update the InitState if we are currently in the prior state.
- // For example, only move into CallingInit if we are in BeforeInit. Only
- // move into CallingContentInit if we are in CallingInit. Normally this will
- // always be true because of how checkCycle is called in checkAndUpdateView.
- // However, if checkAndUpdateView is called recursively or if an exception is
- // thrown while checkAndUpdateView is running, checkAndUpdateView starts over
- // from the beginning. This ensures the state is monotonically increasing,
- // terminating in the AfterInit state, which ensures the Init methods are called
- // at least once and only once.
- var /** @type {?} */ state = view.state;
- var /** @type {?} */ initState = state & 1792;
- if (initState === priorInitState) {
- view.state = (state & ~1792 /* InitState_Mask */) | newInitState;
- view.initIndex = -1;
- return true;
- }
- return initState === newInitState;
- }
- /**
- * @param {?} view
- * @param {?} initState
- * @param {?} index
- * @return {?}
- */
- function shouldCallLifecycleInitHook(view, initState, index) {
- if ((view.state & 1792 /* InitState_Mask */) === initState && view.initIndex <= index) {
- view.initIndex = index + 1;
- return true;
- }
- return false;
- }
- /**
- * @record
- */
- /**
- * Data for an instantiated NodeType.Text.
- *
- * Attention: Adding fields to this is performance sensitive!
- * @record
- */
- /**
- * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
- * @param {?} view
- * @param {?} index
- * @return {?}
- */
- function asTextData(view, index) {
- return /** @type {?} */ (view.nodes[index]);
- }
- /**
- * Data for an instantiated NodeType.Element.
- *
- * Attention: Adding fields to this is performance sensitive!
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
- * @param {?} view
- * @param {?} index
- * @return {?}
- */
- function asElementData(view, index) {
- return /** @type {?} */ (view.nodes[index]);
- }
- /**
- * Data for an instantiated NodeType.Provider.
- *
- * Attention: Adding fields to this is performance sensitive!
- * @record
- */
- /**
- * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
- * @param {?} view
- * @param {?} index
- * @return {?}
- */
- function asProviderData(view, index) {
- return /** @type {?} */ (view.nodes[index]);
- }
- /**
- * Data for an instantiated NodeType.PureExpression.
- *
- * Attention: Adding fields to this is performance sensitive!
- * @record
- */
- /**
- * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
- * @param {?} view
- * @param {?} index
- * @return {?}
- */
- function asPureExpressionData(view, index) {
- return /** @type {?} */ (view.nodes[index]);
- }
- /**
- * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
- * @param {?} view
- * @param {?} index
- * @return {?}
- */
- function asQueryList(view, index) {
- return /** @type {?} */ (view.nodes[index]);
- }
- /**
- * @record
- */
- /**
- * @abstract
- */
- var DebugContext = /** @class */ (function () {
- function DebugContext() {
- }
- return DebugContext;
- }());
- /**
- * @record
- */
- /**
- * This object is used to prevent cycles in the source files and to have a place where
- * debug mode can hook it. It is lazily filled when `isDevMode` is known.
- */
- var Services = {
- setCurrentNode: /** @type {?} */ ((undefined)),
- createRootView: /** @type {?} */ ((undefined)),
- createEmbeddedView: /** @type {?} */ ((undefined)),
- createComponentView: /** @type {?} */ ((undefined)),
- createNgModuleRef: /** @type {?} */ ((undefined)),
- overrideProvider: /** @type {?} */ ((undefined)),
- overrideComponentView: /** @type {?} */ ((undefined)),
- clearOverrides: /** @type {?} */ ((undefined)),
- checkAndUpdateView: /** @type {?} */ ((undefined)),
- checkNoChangesView: /** @type {?} */ ((undefined)),
- destroyView: /** @type {?} */ ((undefined)),
- resolveDep: /** @type {?} */ ((undefined)),
- createDebugContext: /** @type {?} */ ((undefined)),
- handleEvent: /** @type {?} */ ((undefined)),
- updateDirectives: /** @type {?} */ ((undefined)),
- updateRenderer: /** @type {?} */ ((undefined)),
- dirtyParentQueries: /** @type {?} */ ((undefined)),
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} context
- * @param {?} oldValue
- * @param {?} currValue
- * @param {?} isFirstCheck
- * @return {?}
- */
- function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
- var /** @type {?} */ msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
- if (isFirstCheck) {
- msg +=
- " It seems like the view has been created after its parent and its children have been dirty checked." +
- " Has it been created in a change detection hook ?";
- }
- return viewDebugError(msg, context);
- }
- /**
- * @param {?} err
- * @param {?} context
- * @return {?}
- */
- function viewWrappedDebugError(err, context) {
- if (!(err instanceof Error)) {
- // errors that are not Error instances don't have a stack,
- // so it is ok to wrap them into a new Error object...
- err = new Error(err.toString());
- }
- _addDebugContext(err, context);
- return err;
- }
- /**
- * @param {?} msg
- * @param {?} context
- * @return {?}
- */
- function viewDebugError(msg, context) {
- var /** @type {?} */ err = new Error(msg);
- _addDebugContext(err, context);
- return err;
- }
- /**
- * @param {?} err
- * @param {?} context
- * @return {?}
- */
- function _addDebugContext(err, context) {
- (/** @type {?} */ (err))[ERROR_DEBUG_CONTEXT] = context;
- (/** @type {?} */ (err))[ERROR_LOGGER] = context.logError.bind(context);
- }
- /**
- * @param {?} err
- * @return {?}
- */
- function isViewDebugError(err) {
- return !!getDebugContext(err);
- }
- /**
- * @param {?} action
- * @return {?}
- */
- function viewDestroyedError(action) {
- return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var NOOP = function () { };
- var _tokenKeyCache = new Map();
- /**
- * @param {?} token
- * @return {?}
- */
- function tokenKey(token) {
- var /** @type {?} */ key = _tokenKeyCache.get(token);
- if (!key) {
- key = stringify(token) + '_' + _tokenKeyCache.size;
- _tokenKeyCache.set(token, key);
- }
- return key;
- }
- /**
- * @param {?} view
- * @param {?} nodeIdx
- * @param {?} bindingIdx
- * @param {?} value
- * @return {?}
- */
- function unwrapValue(view, nodeIdx, bindingIdx, value) {
- if (WrappedValue.isWrapped(value)) {
- value = WrappedValue.unwrap(value);
- var /** @type {?} */ globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx;
- var /** @type {?} */ oldValue = WrappedValue.unwrap(view.oldValues[globalBindingIdx]);
- view.oldValues[globalBindingIdx] = new WrappedValue(oldValue);
- }
- return value;
- }
- var UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
- var EMPTY_RENDERER_TYPE_ID = '$$empty';
- /**
- * @param {?} values
- * @return {?}
- */
- function createRendererType2(values) {
- return {
- id: UNDEFINED_RENDERER_TYPE_ID,
- styles: values.styles,
- encapsulation: values.encapsulation,
- data: values.data
- };
- }
- var _renderCompCount = 0;
- /**
- * @param {?=} type
- * @return {?}
- */
- function resolveRendererType2(type) {
- if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
- // first time we see this RendererType2. Initialize it...
- var /** @type {?} */ isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) ||
- type.styles.length || Object.keys(type.data).length);
- if (isFilled) {
- type.id = "c" + _renderCompCount++;
- }
- else {
- type.id = EMPTY_RENDERER_TYPE_ID;
- }
- }
- if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
- type = null;
- }
- return type || null;
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} bindingIdx
- * @param {?} value
- * @return {?}
- */
- function checkBinding(view, def, bindingIdx, value) {
- var /** @type {?} */ oldValues = view.oldValues;
- if ((view.state & 2 /* FirstCheck */) ||
- !looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) {
- return true;
- }
- return false;
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} bindingIdx
- * @param {?} value
- * @return {?}
- */
- function checkAndUpdateBinding(view, def, bindingIdx, value) {
- if (checkBinding(view, def, bindingIdx, value)) {
- view.oldValues[def.bindingIndex + bindingIdx] = value;
- return true;
- }
- return false;
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} bindingIdx
- * @param {?} value
- * @return {?}
- */
- function checkBindingNoChanges(view, def, bindingIdx, value) {
- var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx];
- if ((view.state & 1 /* BeforeFirstCheck */) || !devModeEqual(oldValue, value)) {
- var /** @type {?} */ bindingName = def.bindings[bindingIdx].name;
- throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.nodeIndex), bindingName + ": " + oldValue, bindingName + ": " + value, (view.state & 1 /* BeforeFirstCheck */) !== 0);
- }
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function markParentViewsForCheck(view) {
- var /** @type {?} */ currView = view;
- while (currView) {
- if (currView.def.flags & 2 /* OnPush */) {
- currView.state |= 8 /* ChecksEnabled */;
- }
- currView = currView.viewContainerParent || currView.parent;
- }
- }
- /**
- * @param {?} view
- * @param {?} endView
- * @return {?}
- */
- function markParentViewsForCheckProjectedViews(view, endView) {
- var /** @type {?} */ currView = view;
- while (currView && currView !== endView) {
- currView.state |= 64 /* CheckProjectedViews */;
- currView = currView.viewContainerParent || currView.parent;
- }
- }
- /**
- * @param {?} view
- * @param {?} nodeIndex
- * @param {?} eventName
- * @param {?} event
- * @return {?}
- */
- function dispatchEvent(view, nodeIndex, eventName, event) {
- try {
- var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
- var /** @type {?} */ startView = nodeDef.flags & 33554432 /* ComponentView */ ?
- asElementData(view, nodeIndex).componentView :
- view;
- markParentViewsForCheck(startView);
- return Services.handleEvent(view, nodeIndex, eventName, event);
- }
- catch (/** @type {?} */ e) {
- // Attention: Don't rethrow, as it would cancel Observable subscriptions!
- view.root.errorHandler.handleError(e);
- }
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function declaredViewContainer(view) {
- if (view.parent) {
- var /** @type {?} */ parentView = view.parent;
- return asElementData(parentView, /** @type {?} */ ((view.parentNodeDef)).nodeIndex);
- }
- return null;
- }
- /**
- * for component views, this is the host element.
- * for embedded views, this is the index of the parent node
- * that contains the view container.
- * @param {?} view
- * @return {?}
- */
- function viewParentEl(view) {
- var /** @type {?} */ parentView = view.parent;
- if (parentView) {
- return /** @type {?} */ ((view.parentNodeDef)).parent;
- }
- else {
- return null;
- }
- }
- /**
- * @param {?} view
- * @param {?} def
- * @return {?}
- */
- function renderNode(view, def) {
- switch (def.flags & 201347067 /* Types */) {
- case 1 /* TypeElement */:
- return asElementData(view, def.nodeIndex).renderElement;
- case 2 /* TypeText */:
- return asTextData(view, def.nodeIndex).renderText;
- }
- }
- /**
- * @param {?} target
- * @param {?} name
- * @return {?}
- */
- function elementEventFullName(target, name) {
- return target ? target + ":" + name : name;
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function isComponentView(view) {
- return !!view.parent && !!(/** @type {?} */ ((view.parentNodeDef)).flags & 32768 /* Component */);
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function isEmbeddedView(view) {
- return !!view.parent && !(/** @type {?} */ ((view.parentNodeDef)).flags & 32768 /* Component */);
- }
- /**
- * @param {?} queryId
- * @return {?}
- */
- function filterQueryId(queryId) {
- return 1 << (queryId % 32);
- }
- /**
- * @param {?} matchedQueriesDsl
- * @return {?}
- */
- function splitMatchedQueriesDsl(matchedQueriesDsl) {
- var /** @type {?} */ matchedQueries = {};
- var /** @type {?} */ matchedQueryIds = 0;
- var /** @type {?} */ references = {};
- if (matchedQueriesDsl) {
- matchedQueriesDsl.forEach(function (_a) {
- var queryId = _a[0], valueType = _a[1];
- if (typeof queryId === 'number') {
- matchedQueries[queryId] = valueType;
- matchedQueryIds |= filterQueryId(queryId);
- }
- else {
- references[queryId] = valueType;
- }
- });
- }
- return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds };
- }
- /**
- * @param {?} deps
- * @param {?=} sourceName
- * @return {?}
- */
- function splitDepsDsl(deps, sourceName) {
- return deps.map(function (value) {
- var /** @type {?} */ token;
- var /** @type {?} */ flags;
- if (Array.isArray(value)) {
- flags = value[0], token = value[1];
- }
- else {
- flags = 0 /* None */;
- token = value;
- }
- if (token && (typeof token === 'function' || typeof token === 'object') && sourceName) {
- Object.defineProperty(token, SOURCE, { value: sourceName, configurable: true });
- }
- return { flags: flags, token: token, tokenKey: tokenKey(token) };
- });
- }
- /**
- * @param {?} view
- * @param {?} renderHost
- * @param {?} def
- * @return {?}
- */
- function getParentRenderElement(view, renderHost, def) {
- var /** @type {?} */ renderParent = def.renderParent;
- if (renderParent) {
- if ((renderParent.flags & 1 /* TypeElement */) === 0 ||
- (renderParent.flags & 33554432 /* ComponentView */) === 0 ||
- (/** @type {?} */ ((renderParent.element)).componentRendererType && /** @type {?} */ ((/** @type {?} */ ((renderParent.element)).componentRendererType)).encapsulation === ViewEncapsulation.Native)) {
- // only children of non components, or children of components with native encapsulation should
- // be attached.
- return asElementData(view, /** @type {?} */ ((def.renderParent)).nodeIndex).renderElement;
- }
- }
- else {
- return renderHost;
- }
- }
- var DEFINITION_CACHE = new WeakMap();
- /**
- * @template D
- * @param {?} factory
- * @return {?}
- */
- function resolveDefinition(factory) {
- var /** @type {?} */ value = /** @type {?} */ (((DEFINITION_CACHE.get(factory))));
- if (!value) {
- value = factory(function () { return NOOP; });
- value.factory = factory;
- DEFINITION_CACHE.set(factory, value);
- }
- return value;
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function rootRenderNodes(view) {
- var /** @type {?} */ renderNodes = [];
- visitRootRenderNodes(view, 0 /* Collect */, undefined, undefined, renderNodes);
- return renderNodes;
- }
- /**
- * @param {?} view
- * @param {?} action
- * @param {?} parentNode
- * @param {?} nextSibling
- * @param {?=} target
- * @return {?}
- */
- function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
- // We need to re-compute the parent node in case the nodes have been moved around manually
- if (action === 3 /* RemoveChild */) {
- parentNode = view.renderer.parentNode(renderNode(view, /** @type {?} */ ((view.def.lastRenderRootNode))));
- }
- visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
- }
- /**
- * @param {?} view
- * @param {?} action
- * @param {?} startIndex
- * @param {?} endIndex
- * @param {?} parentNode
- * @param {?} nextSibling
- * @param {?=} target
- * @return {?}
- */
- function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
- for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
- var /** @type {?} */ nodeDef = view.def.nodes[i];
- if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 8 /* TypeNgContent */)) {
- visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
- }
- // jump to next sibling
- i += nodeDef.childCount;
- }
- }
- /**
- * @param {?} view
- * @param {?} ngContentIndex
- * @param {?} action
- * @param {?} parentNode
- * @param {?} nextSibling
- * @param {?=} target
- * @return {?}
- */
- function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
- var /** @type {?} */ compView = view;
- while (compView && !isComponentView(compView)) {
- compView = compView.parent;
- }
- var /** @type {?} */ hostView = /** @type {?} */ ((compView)).parent;
- var /** @type {?} */ hostElDef = viewParentEl(/** @type {?} */ ((compView)));
- var /** @type {?} */ startIndex = /** @type {?} */ ((hostElDef)).nodeIndex + 1;
- var /** @type {?} */ endIndex = /** @type {?} */ ((hostElDef)).nodeIndex + /** @type {?} */ ((hostElDef)).childCount;
- for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
- var /** @type {?} */ nodeDef = /** @type {?} */ ((hostView)).def.nodes[i];
- if (nodeDef.ngContentIndex === ngContentIndex) {
- visitRenderNode(/** @type {?} */ ((hostView)), nodeDef, action, parentNode, nextSibling, target);
- }
- // jump to next sibling
- i += nodeDef.childCount;
- }
- if (!/** @type {?} */ ((hostView)).parent) {
- // a root view
- var /** @type {?} */ projectedNodes = view.root.projectableNodes[ngContentIndex];
- if (projectedNodes) {
- for (var /** @type {?} */ i = 0; i < projectedNodes.length; i++) {
- execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
- }
- }
- }
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} action
- * @param {?} parentNode
- * @param {?} nextSibling
- * @param {?=} target
- * @return {?}
- */
- function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
- if (nodeDef.flags & 8 /* TypeNgContent */) {
- visitProjectedRenderNodes(view, /** @type {?} */ ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target);
- }
- else {
- var /** @type {?} */ rn = renderNode(view, nodeDef);
- if (action === 3 /* RemoveChild */ && (nodeDef.flags & 33554432 /* ComponentView */) &&
- (nodeDef.bindingFlags & 48 /* CatSyntheticProperty */)) {
- // Note: we might need to do both actions.
- if (nodeDef.bindingFlags & (16 /* SyntheticProperty */)) {
- execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
- }
- if (nodeDef.bindingFlags & (32 /* SyntheticHostProperty */)) {
- var /** @type {?} */ compView = asElementData(view, nodeDef.nodeIndex).componentView;
- execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
- }
- }
- else {
- execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
- }
- if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
- var /** @type {?} */ embeddedViews = /** @type {?} */ ((asElementData(view, nodeDef.nodeIndex).viewContainer))._embeddedViews;
- for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
- visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
- }
- }
- if (nodeDef.flags & 1 /* TypeElement */ && !/** @type {?} */ ((nodeDef.element)).name) {
- visitSiblingRenderNodes(view, action, nodeDef.nodeIndex + 1, nodeDef.nodeIndex + nodeDef.childCount, parentNode, nextSibling, target);
- }
- }
- }
- /**
- * @param {?} view
- * @param {?} renderNode
- * @param {?} action
- * @param {?} parentNode
- * @param {?} nextSibling
- * @param {?=} target
- * @return {?}
- */
- function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
- var /** @type {?} */ renderer = view.renderer;
- switch (action) {
- case 1 /* AppendChild */:
- renderer.appendChild(parentNode, renderNode);
- break;
- case 2 /* InsertBefore */:
- renderer.insertBefore(parentNode, renderNode, nextSibling);
- break;
- case 3 /* RemoveChild */:
- renderer.removeChild(parentNode, renderNode);
- break;
- case 0 /* Collect */:
- /** @type {?} */ ((target)).push(renderNode);
- break;
- }
- }
- var NS_PREFIX_RE = /^:([^:]+):(.+)$/;
- /**
- * @param {?} name
- * @return {?}
- */
- function splitNamespace(name) {
- if (name[0] === ':') {
- var /** @type {?} */ match = /** @type {?} */ ((name.match(NS_PREFIX_RE)));
- return [match[1], match[2]];
- }
- return ['', name];
- }
- /**
- * @param {?} bindings
- * @return {?}
- */
- function calcBindingFlags(bindings) {
- var /** @type {?} */ flags = 0;
- for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
- flags |= bindings[i].flags;
- }
- return flags;
- }
- /**
- * @param {?} valueCount
- * @param {?} constAndInterp
- * @return {?}
- */
- function interpolate(valueCount, constAndInterp) {
- var /** @type {?} */ result = '';
- for (var /** @type {?} */ i = 0; i < valueCount * 2; i = i + 2) {
- result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
- }
- return result + constAndInterp[valueCount * 2];
- }
- /**
- * @param {?} valueCount
- * @param {?} c0
- * @param {?} a1
- * @param {?} c1
- * @param {?=} a2
- * @param {?=} c2
- * @param {?=} a3
- * @param {?=} c3
- * @param {?=} a4
- * @param {?=} c4
- * @param {?=} a5
- * @param {?=} c5
- * @param {?=} a6
- * @param {?=} c6
- * @param {?=} a7
- * @param {?=} c7
- * @param {?=} a8
- * @param {?=} c8
- * @param {?=} a9
- * @param {?=} c9
- * @return {?}
- */
- function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
- switch (valueCount) {
- case 1:
- return c0 + _toStringWithNull(a1) + c1;
- case 2:
- return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
- case 3:
- return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
- c3;
- case 4:
- return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
- c3 + _toStringWithNull(a4) + c4;
- case 5:
- return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
- c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
- case 6:
- return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
- c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
- case 7:
- return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
- c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
- c6 + _toStringWithNull(a7) + c7;
- case 8:
- return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
- c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
- c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
- case 9:
- return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
- c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
- c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
- default:
- throw new Error("Does not support more than 9 expressions");
- }
- }
- /**
- * @param {?} v
- * @return {?}
- */
- function _toStringWithNull(v) {
- return v != null ? v.toString() : '';
- }
- var EMPTY_ARRAY = [];
- var EMPTY_MAP = {};
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} flags
- * @param {?} matchedQueriesDsl
- * @param {?} ngContentIndex
- * @param {?} childCount
- * @param {?=} handleEvent
- * @param {?=} templateFactory
- * @return {?}
- */
- function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
- flags |= 1 /* TypeElement */;
- var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
- var /** @type {?} */ template = templateFactory ? resolveDefinition(templateFactory) : null;
- return {
- // will bet set by the view definition
- nodeIndex: -1,
- parent: null,
- renderParent: null,
- bindingIndex: -1,
- outputIndex: -1,
- // regular values
- flags: flags,
- checkIndex: -1,
- childFlags: 0,
- directChildFlags: 0,
- childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
- bindings: [],
- bindingFlags: 0,
- outputs: [],
- element: {
- ns: null,
- name: null,
- attrs: null, template: template,
- componentProvider: null,
- componentView: null,
- componentRendererType: null,
- publicProviders: null,
- allProviders: null,
- handleEvent: handleEvent || NOOP
- },
- provider: null,
- text: null,
- query: null,
- ngContent: null
- };
- }
- /**
- * @param {?} checkIndex
- * @param {?} flags
- * @param {?} matchedQueriesDsl
- * @param {?} ngContentIndex
- * @param {?} childCount
- * @param {?} namespaceAndName
- * @param {?=} fixedAttrs
- * @param {?=} bindings
- * @param {?=} outputs
- * @param {?=} handleEvent
- * @param {?=} componentView
- * @param {?=} componentRendererType
- * @return {?}
- */
- function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) {
- if (fixedAttrs === void 0) { fixedAttrs = []; }
- if (!handleEvent) {
- handleEvent = NOOP;
- }
- var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
- var /** @type {?} */ ns = /** @type {?} */ ((null));
- var /** @type {?} */ name = /** @type {?} */ ((null));
- if (namespaceAndName) {
- _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
- }
- bindings = bindings || [];
- var /** @type {?} */ bindingDefs = new Array(bindings.length);
- for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
- var _c = bindings[i], bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
- var _d = splitNamespace(namespaceAndName_1), ns_1 = _d[0], name_1 = _d[1];
- var /** @type {?} */ securityContext = /** @type {?} */ ((undefined));
- var /** @type {?} */ suffix = /** @type {?} */ ((undefined));
- switch (bindingFlags & 15 /* Types */) {
- case 4 /* TypeElementStyle */:
- suffix = /** @type {?} */ (suffixOrSecurityContext);
- break;
- case 1 /* TypeElementAttribute */:
- case 8 /* TypeProperty */:
- securityContext = /** @type {?} */ (suffixOrSecurityContext);
- break;
- }
- bindingDefs[i] =
- { flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix };
- }
- outputs = outputs || [];
- var /** @type {?} */ outputDefs = new Array(outputs.length);
- for (var /** @type {?} */ i = 0; i < outputs.length; i++) {
- var _e = outputs[i], target = _e[0], eventName = _e[1];
- outputDefs[i] = {
- type: 0 /* ElementOutput */,
- target: /** @type {?} */ (target), eventName: eventName,
- propName: null
- };
- }
- fixedAttrs = fixedAttrs || [];
- var /** @type {?} */ attrs = /** @type {?} */ (fixedAttrs.map(function (_a) {
- var namespaceAndName = _a[0], value = _a[1];
- var _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
- return [ns, name, value];
- }));
- componentRendererType = resolveRendererType2(componentRendererType);
- if (componentView) {
- flags |= 33554432 /* ComponentView */;
- }
- flags |= 1 /* TypeElement */;
- return {
- // will bet set by the view definition
- nodeIndex: -1,
- parent: null,
- renderParent: null,
- bindingIndex: -1,
- outputIndex: -1,
- // regular values
- checkIndex: checkIndex,
- flags: flags,
- childFlags: 0,
- directChildFlags: 0,
- childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
- bindings: bindingDefs,
- bindingFlags: calcBindingFlags(bindingDefs),
- outputs: outputDefs,
- element: {
- ns: ns,
- name: name,
- attrs: attrs,
- template: null,
- // will bet set by the view definition
- componentProvider: null,
- componentView: componentView || null,
- componentRendererType: componentRendererType,
- publicProviders: null,
- allProviders: null,
- handleEvent: handleEvent || NOOP,
- },
- provider: null,
- text: null,
- query: null,
- ngContent: null
- };
- var _b;
- }
- /**
- * @param {?} view
- * @param {?} renderHost
- * @param {?} def
- * @return {?}
- */
- function createElement(view, renderHost, def) {
- var /** @type {?} */ elDef = /** @type {?} */ ((def.element));
- var /** @type {?} */ rootSelectorOrNode = view.root.selectorOrNode;
- var /** @type {?} */ renderer = view.renderer;
- var /** @type {?} */ el;
- if (view.parent || !rootSelectorOrNode) {
- if (elDef.name) {
- el = renderer.createElement(elDef.name, elDef.ns);
- }
- else {
- el = renderer.createComment('');
- }
- var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
- if (parentEl) {
- renderer.appendChild(parentEl, el);
- }
- }
- else {
- el = renderer.selectRootElement(rootSelectorOrNode);
- }
- if (elDef.attrs) {
- for (var /** @type {?} */ i = 0; i < elDef.attrs.length; i++) {
- var _a = elDef.attrs[i], ns = _a[0], name_2 = _a[1], value = _a[2];
- renderer.setAttribute(el, name_2, value, ns);
- }
- }
- return el;
- }
- /**
- * @param {?} view
- * @param {?} compView
- * @param {?} def
- * @param {?} el
- * @return {?}
- */
- function listenToElementOutputs(view, compView, def, el) {
- for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
- var /** @type {?} */ output = def.outputs[i];
- var /** @type {?} */ handleEventClosure = renderEventHandlerClosure(view, def.nodeIndex, elementEventFullName(output.target, output.eventName));
- var /** @type {?} */ listenTarget = output.target;
- var /** @type {?} */ listenerView = view;
- if (output.target === 'component') {
- listenTarget = null;
- listenerView = compView;
- }
- var /** @type {?} */ disposable = /** @type {?} */ (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure)); /** @type {?} */
- ((view.disposables))[def.outputIndex + i] = disposable;
- }
- }
- /**
- * @param {?} view
- * @param {?} index
- * @param {?} eventName
- * @return {?}
- */
- function renderEventHandlerClosure(view, index, eventName) {
- return function (event) { return dispatchEvent(view, index, eventName, event); };
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} v0
- * @param {?} v1
- * @param {?} v2
- * @param {?} v3
- * @param {?} v4
- * @param {?} v5
- * @param {?} v6
- * @param {?} v7
- * @param {?} v8
- * @param {?} v9
- * @return {?}
- */
- function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- var /** @type {?} */ bindLen = def.bindings.length;
- var /** @type {?} */ changed = false;
- if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
- changed = true;
- if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
- changed = true;
- if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
- changed = true;
- if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
- changed = true;
- if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
- changed = true;
- if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
- changed = true;
- if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
- changed = true;
- if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
- changed = true;
- if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
- changed = true;
- if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
- changed = true;
- return changed;
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} values
- * @return {?}
- */
- function checkAndUpdateElementDynamic(view, def, values) {
- var /** @type {?} */ changed = false;
- for (var /** @type {?} */ i = 0; i < values.length; i++) {
- if (checkAndUpdateElementValue(view, def, i, values[i]))
- changed = true;
- }
- return changed;
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} bindingIdx
- * @param {?} value
- * @return {?}
- */
- function checkAndUpdateElementValue(view, def, bindingIdx, value) {
- if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
- return false;
- }
- var /** @type {?} */ binding = def.bindings[bindingIdx];
- var /** @type {?} */ elData = asElementData(view, def.nodeIndex);
- var /** @type {?} */ renderNode$$1 = elData.renderElement;
- var /** @type {?} */ name = /** @type {?} */ ((binding.name));
- switch (binding.flags & 15 /* Types */) {
- case 1 /* TypeElementAttribute */:
- setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value);
- break;
- case 2 /* TypeElementClass */:
- setElementClass(view, renderNode$$1, name, value);
- break;
- case 4 /* TypeElementStyle */:
- setElementStyle(view, binding, renderNode$$1, name, value);
- break;
- case 8 /* TypeProperty */:
- var /** @type {?} */ bindView = (def.flags & 33554432 /* ComponentView */ &&
- binding.flags & 32 /* SyntheticHostProperty */) ?
- elData.componentView :
- view;
- setElementProperty(bindView, binding, renderNode$$1, name, value);
- break;
- }
- return true;
- }
- /**
- * @param {?} view
- * @param {?} binding
- * @param {?} renderNode
- * @param {?} ns
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function setElementAttribute(view, binding, renderNode$$1, ns, name, value) {
- var /** @type {?} */ securityContext = binding.securityContext;
- var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
- renderValue = renderValue != null ? renderValue.toString() : null;
- var /** @type {?} */ renderer = view.renderer;
- if (value != null) {
- renderer.setAttribute(renderNode$$1, name, renderValue, ns);
- }
- else {
- renderer.removeAttribute(renderNode$$1, name, ns);
- }
- }
- /**
- * @param {?} view
- * @param {?} renderNode
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function setElementClass(view, renderNode$$1, name, value) {
- var /** @type {?} */ renderer = view.renderer;
- if (value) {
- renderer.addClass(renderNode$$1, name);
- }
- else {
- renderer.removeClass(renderNode$$1, name);
- }
- }
- /**
- * @param {?} view
- * @param {?} binding
- * @param {?} renderNode
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function setElementStyle(view, binding, renderNode$$1, name, value) {
- var /** @type {?} */ renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, /** @type {?} */ (value));
- if (renderValue != null) {
- renderValue = renderValue.toString();
- var /** @type {?} */ unit = binding.suffix;
- if (unit != null) {
- renderValue = renderValue + unit;
- }
- }
- else {
- renderValue = null;
- }
- var /** @type {?} */ renderer = view.renderer;
- if (renderValue != null) {
- renderer.setStyle(renderNode$$1, name, renderValue);
- }
- else {
- renderer.removeStyle(renderNode$$1, name);
- }
- }
- /**
- * @param {?} view
- * @param {?} binding
- * @param {?} renderNode
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function setElementProperty(view, binding, renderNode$$1, name, value) {
- var /** @type {?} */ securityContext = binding.securityContext;
- var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
- view.renderer.setProperty(renderNode$$1, name, renderValue);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var UNDEFINED_VALUE = new Object();
- var InjectorRefTokenKey$1 = tokenKey(Injector);
- var NgModuleRefTokenKey = tokenKey(NgModuleRef);
- /**
- * @param {?} flags
- * @param {?} token
- * @param {?} value
- * @param {?} deps
- * @return {?}
- */
- function moduleProvideDef(flags, token, value, deps) {
- // Need to resolve forwardRefs as e.g. for `useValue` we
- // lowered the expression and then stopped evaluating it,
- // i.e. also didn't unwrap it.
- value = resolveForwardRef(value);
- var /** @type {?} */ depDefs = splitDepsDsl(deps, stringify(token));
- return {
- // will bet set by the module definition
- index: -1,
- deps: depDefs, flags: flags, token: token, value: value
- };
- }
- /**
- * @param {?} providers
- * @return {?}
- */
- function moduleDef(providers) {
- var /** @type {?} */ providersByKey = {};
- for (var /** @type {?} */ i = 0; i < providers.length; i++) {
- var /** @type {?} */ provider = providers[i];
- provider.index = i;
- providersByKey[tokenKey(provider.token)] = provider;
- }
- return {
- // Will be filled later...
- factory: null,
- providersByKey: providersByKey,
- providers: providers
- };
- }
- /**
- * @param {?} data
- * @return {?}
- */
- function initNgModule(data) {
- var /** @type {?} */ def = data._def;
- var /** @type {?} */ providers = data._providers = new Array(def.providers.length);
- for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
- var /** @type {?} */ provDef = def.providers[i];
- if (!(provDef.flags & 4096 /* LazyProvider */)) {
- providers[i] = _createProviderInstance$1(data, provDef);
- }
- }
- }
- /**
- * @param {?} data
- * @param {?} depDef
- * @param {?=} notFoundValue
- * @return {?}
- */
- function resolveNgModuleDep(data, depDef, notFoundValue) {
- if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
- if (depDef.flags & 8 /* Value */) {
- return depDef.token;
- }
- if (depDef.flags & 2 /* Optional */) {
- notFoundValue = null;
- }
- if (depDef.flags & 1 /* SkipSelf */) {
- return data._parent.get(depDef.token, notFoundValue);
- }
- var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
- switch (tokenKey$$1) {
- case InjectorRefTokenKey$1:
- case NgModuleRefTokenKey:
- return data;
- }
- var /** @type {?} */ providerDef = data._def.providersByKey[tokenKey$$1];
- if (providerDef) {
- var /** @type {?} */ providerInstance = data._providers[providerDef.index];
- if (providerInstance === undefined) {
- providerInstance = data._providers[providerDef.index] =
- _createProviderInstance$1(data, providerDef);
- }
- return providerInstance === UNDEFINED_VALUE ? undefined : providerInstance;
- }
- return data._parent.get(depDef.token, notFoundValue);
- }
- /**
- * @param {?} ngModule
- * @param {?} providerDef
- * @return {?}
- */
- function _createProviderInstance$1(ngModule, providerDef) {
- var /** @type {?} */ injectable;
- switch (providerDef.flags & 201347067 /* Types */) {
- case 512 /* TypeClassProvider */:
- injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
- break;
- case 1024 /* TypeFactoryProvider */:
- injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
- break;
- case 2048 /* TypeUseExistingProvider */:
- injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
- break;
- case 256 /* TypeValueProvider */:
- injectable = providerDef.value;
- break;
- }
- return injectable === undefined ? UNDEFINED_VALUE : injectable;
- }
- /**
- * @param {?} ngModule
- * @param {?} ctor
- * @param {?} deps
- * @return {?}
- */
- function _createClass(ngModule, ctor, deps) {
- var /** @type {?} */ len = deps.length;
- switch (len) {
- case 0:
- return new ctor();
- case 1:
- return new ctor(resolveNgModuleDep(ngModule, deps[0]));
- case 2:
- return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
- case 3:
- return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
- default:
- var /** @type {?} */ depValues = new Array(len);
- for (var /** @type {?} */ i = 0; i < len; i++) {
- depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
- }
- return new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
- }
- }
- /**
- * @param {?} ngModule
- * @param {?} factory
- * @param {?} deps
- * @return {?}
- */
- function _callFactory(ngModule, factory, deps) {
- var /** @type {?} */ len = deps.length;
- switch (len) {
- case 0:
- return factory();
- case 1:
- return factory(resolveNgModuleDep(ngModule, deps[0]));
- case 2:
- return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
- case 3:
- return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
- default:
- var /** @type {?} */ depValues = Array(len);
- for (var /** @type {?} */ i = 0; i < len; i++) {
- depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
- }
- return factory.apply(void 0, depValues);
- }
- }
- /**
- * @param {?} ngModule
- * @param {?} lifecycles
- * @return {?}
- */
- function callNgModuleLifecycle(ngModule, lifecycles) {
- var /** @type {?} */ def = ngModule._def;
- for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
- var /** @type {?} */ provDef = def.providers[i];
- if (provDef.flags & 131072 /* OnDestroy */) {
- var /** @type {?} */ instance = ngModule._providers[i];
- if (instance && instance !== UNDEFINED_VALUE) {
- instance.ngOnDestroy();
- }
- }
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} parentView
- * @param {?} elementData
- * @param {?} viewIndex
- * @param {?} view
- * @return {?}
- */
- function attachEmbeddedView(parentView, elementData, viewIndex, view) {
- var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
- if (viewIndex === null || viewIndex === undefined) {
- viewIndex = embeddedViews.length;
- }
- view.viewContainerParent = parentView;
- addToArray(embeddedViews, /** @type {?} */ ((viewIndex)), view);
- attachProjectedView(elementData, view);
- Services.dirtyParentQueries(view);
- var /** @type {?} */ prevView = /** @type {?} */ ((viewIndex)) > 0 ? embeddedViews[/** @type {?} */ ((viewIndex)) - 1] : null;
- renderAttachEmbeddedView(elementData, prevView, view);
- }
- /**
- * @param {?} vcElementData
- * @param {?} view
- * @return {?}
- */
- function attachProjectedView(vcElementData, view) {
- var /** @type {?} */ dvcElementData = declaredViewContainer(view);
- if (!dvcElementData || dvcElementData === vcElementData ||
- view.state & 16 /* IsProjectedView */) {
- return;
- }
- // Note: For performance reasons, we
- // - add a view to template._projectedViews only 1x throughout its lifetime,
- // and remove it not until the view is destroyed.
- // (hard, as when a parent view is attached/detached we would need to attach/detach all
- // nested projected views as well, even accross component boundaries).
- // - don't track the insertion order of views in the projected views array
- // (hard, as when the views of the same template are inserted different view containers)
- view.state |= 16 /* IsProjectedView */;
- var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
- if (!projectedViews) {
- projectedViews = dvcElementData.template._projectedViews = [];
- }
- projectedViews.push(view);
- // Note: we are changing the NodeDef here as we cannot calculate
- // the fact whether a template is used for projection during compilation.
- markNodeAsProjectedTemplate(/** @type {?} */ ((view.parent)).def, /** @type {?} */ ((view.parentNodeDef)));
- }
- /**
- * @param {?} viewDef
- * @param {?} nodeDef
- * @return {?}
- */
- function markNodeAsProjectedTemplate(viewDef, nodeDef) {
- if (nodeDef.flags & 4 /* ProjectedTemplate */) {
- return;
- }
- viewDef.nodeFlags |= 4 /* ProjectedTemplate */;
- nodeDef.flags |= 4 /* ProjectedTemplate */;
- var /** @type {?} */ parentNodeDef = nodeDef.parent;
- while (parentNodeDef) {
- parentNodeDef.childFlags |= 4 /* ProjectedTemplate */;
- parentNodeDef = parentNodeDef.parent;
- }
- }
- /**
- * @param {?} elementData
- * @param {?=} viewIndex
- * @return {?}
- */
- function detachEmbeddedView(elementData, viewIndex) {
- var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
- if (viewIndex == null || viewIndex >= embeddedViews.length) {
- viewIndex = embeddedViews.length - 1;
- }
- if (viewIndex < 0) {
- return null;
- }
- var /** @type {?} */ view = embeddedViews[viewIndex];
- view.viewContainerParent = null;
- removeFromArray(embeddedViews, viewIndex);
- // See attachProjectedView for why we don't update projectedViews here.
- Services.dirtyParentQueries(view);
- renderDetachView(view);
- return view;
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function detachProjectedView(view) {
- if (!(view.state & 16 /* IsProjectedView */)) {
- return;
- }
- var /** @type {?} */ dvcElementData = declaredViewContainer(view);
- if (dvcElementData) {
- var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
- if (projectedViews) {
- removeFromArray(projectedViews, projectedViews.indexOf(view));
- Services.dirtyParentQueries(view);
- }
- }
- }
- /**
- * @param {?} elementData
- * @param {?} oldViewIndex
- * @param {?} newViewIndex
- * @return {?}
- */
- function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
- var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
- var /** @type {?} */ view = embeddedViews[oldViewIndex];
- removeFromArray(embeddedViews, oldViewIndex);
- if (newViewIndex == null) {
- newViewIndex = embeddedViews.length;
- }
- addToArray(embeddedViews, newViewIndex, view);
- // Note: Don't need to change projectedViews as the order in there
- // as always invalid...
- Services.dirtyParentQueries(view);
- renderDetachView(view);
- var /** @type {?} */ prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
- renderAttachEmbeddedView(elementData, prevView, view);
- return view;
- }
- /**
- * @param {?} elementData
- * @param {?} prevView
- * @param {?} view
- * @return {?}
- */
- function renderAttachEmbeddedView(elementData, prevView, view) {
- var /** @type {?} */ prevRenderNode = prevView ? renderNode(prevView, /** @type {?} */ ((prevView.def.lastRenderRootNode))) :
- elementData.renderElement;
- var /** @type {?} */ parentNode = view.renderer.parentNode(prevRenderNode);
- var /** @type {?} */ nextSibling = view.renderer.nextSibling(prevRenderNode);
- // Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be!
- // However, browsers automatically do `appendChild` when there is no `nextSibling`.
- visitRootRenderNodes(view, 2 /* InsertBefore */, parentNode, nextSibling, undefined);
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function renderDetachView(view) {
- visitRootRenderNodes(view, 3 /* RemoveChild */, null, null, undefined);
- }
- /**
- * @param {?} arr
- * @param {?} index
- * @param {?} value
- * @return {?}
- */
- function addToArray(arr, index, value) {
- // perf: array.push is faster than array.splice!
- if (index >= arr.length) {
- arr.push(value);
- }
- else {
- arr.splice(index, 0, value);
- }
- }
- /**
- * @param {?} arr
- * @param {?} index
- * @return {?}
- */
- function removeFromArray(arr, index) {
- // perf: array.pop is faster than array.splice!
- if (index >= arr.length - 1) {
- arr.pop();
- }
- else {
- arr.splice(index, 1);
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var EMPTY_CONTEXT = new Object();
- /**
- * @param {?} selector
- * @param {?} componentType
- * @param {?} viewDefFactory
- * @param {?} inputs
- * @param {?} outputs
- * @param {?} ngContentSelectors
- * @return {?}
- */
- function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
- return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
- }
- /**
- * @param {?} componentFactory
- * @return {?}
- */
- function getComponentViewDefinitionFactory(componentFactory) {
- return (/** @type {?} */ (componentFactory)).viewDefFactory;
- }
- var ComponentFactory_ = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ComponentFactory_, _super);
- function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
- var _this =
- // Attention: this ctor is called as top level function.
- // Putting any logic in here will destroy closure tree shaking!
- _super.call(this) || this;
- _this.selector = selector;
- _this.componentType = componentType;
- _this._inputs = _inputs;
- _this._outputs = _outputs;
- _this.ngContentSelectors = ngContentSelectors;
- _this.viewDefFactory = viewDefFactory;
- return _this;
- }
- Object.defineProperty(ComponentFactory_.prototype, "inputs", {
- get: /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ inputsArr = [];
- var /** @type {?} */ inputs = /** @type {?} */ ((this._inputs));
- for (var /** @type {?} */ propName in inputs) {
- var /** @type {?} */ templateName = inputs[propName];
- inputsArr.push({ propName: propName, templateName: templateName });
- }
- return inputsArr;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ComponentFactory_.prototype, "outputs", {
- get: /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ outputsArr = [];
- for (var /** @type {?} */ propName in this._outputs) {
- var /** @type {?} */ templateName = this._outputs[propName];
- outputsArr.push({ propName: propName, templateName: templateName });
- }
- return outputsArr;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * Creates a new component.
- */
- /**
- * Creates a new component.
- * @param {?} injector
- * @param {?=} projectableNodes
- * @param {?=} rootSelectorOrNode
- * @param {?=} ngModule
- * @return {?}
- */
- ComponentFactory_.prototype.create = /**
- * Creates a new component.
- * @param {?} injector
- * @param {?=} projectableNodes
- * @param {?=} rootSelectorOrNode
- * @param {?=} ngModule
- * @return {?}
- */
- function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
- if (!ngModule) {
- throw new Error('ngModule should be provided');
- }
- var /** @type {?} */ viewDef = resolveDefinition(this.viewDefFactory);
- var /** @type {?} */ componentNodeIndex = /** @type {?} */ ((/** @type {?} */ ((viewDef.nodes[0].element)).componentProvider)).nodeIndex;
- var /** @type {?} */ view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
- var /** @type {?} */ component = asProviderData(view, componentNodeIndex).instance;
- if (rootSelectorOrNode) {
- view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
- }
- return new ComponentRef_(view, new ViewRef_(view), component);
- };
- return ComponentFactory_;
- }(ComponentFactory));
- var ComponentRef_ = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ComponentRef_, _super);
- function ComponentRef_(_view, _viewRef, _component) {
- var _this = _super.call(this) || this;
- _this._view = _view;
- _this._viewRef = _viewRef;
- _this._component = _component;
- _this._elDef = _this._view.def.nodes[0];
- _this.hostView = _viewRef;
- _this.changeDetectorRef = _viewRef;
- _this.instance = _component;
- return _this;
- }
- Object.defineProperty(ComponentRef_.prototype, "location", {
- get: /**
- * @return {?}
- */
- function () {
- return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ComponentRef_.prototype, "injector", {
- get: /**
- * @return {?}
- */
- function () { return new Injector_(this._view, this._elDef); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ComponentRef_.prototype, "componentType", {
- get: /**
- * @return {?}
- */
- function () { return /** @type {?} */ (this._component.constructor); },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- ComponentRef_.prototype.destroy = /**
- * @return {?}
- */
- function () { this._viewRef.destroy(); };
- /**
- * @param {?} callback
- * @return {?}
- */
- ComponentRef_.prototype.onDestroy = /**
- * @param {?} callback
- * @return {?}
- */
- function (callback) { this._viewRef.onDestroy(callback); };
- return ComponentRef_;
- }(ComponentRef));
- /**
- * @param {?} view
- * @param {?} elDef
- * @param {?} elData
- * @return {?}
- */
- function createViewContainerData(view, elDef, elData) {
- return new ViewContainerRef_(view, elDef, elData);
- }
- var ViewContainerRef_ = /** @class */ (function () {
- function ViewContainerRef_(_view, _elDef, _data) {
- this._view = _view;
- this._elDef = _elDef;
- this._data = _data;
- /**
- * \@internal
- */
- this._embeddedViews = [];
- }
- Object.defineProperty(ViewContainerRef_.prototype, "element", {
- get: /**
- * @return {?}
- */
- function () { return new ElementRef(this._data.renderElement); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ViewContainerRef_.prototype, "injector", {
- get: /**
- * @return {?}
- */
- function () { return new Injector_(this._view, this._elDef); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", {
- get: /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ view = this._view;
- var /** @type {?} */ elDef = this._elDef.parent;
- while (!elDef && view) {
- elDef = viewParentEl(view);
- view = /** @type {?} */ ((view.parent));
- }
- return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- ViewContainerRef_.prototype.clear = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ len = this._embeddedViews.length;
- for (var /** @type {?} */ i = len - 1; i >= 0; i--) {
- var /** @type {?} */ view = /** @type {?} */ ((detachEmbeddedView(this._data, i)));
- Services.destroyView(view);
- }
- };
- /**
- * @param {?} index
- * @return {?}
- */
- ViewContainerRef_.prototype.get = /**
- * @param {?} index
- * @return {?}
- */
- function (index) {
- var /** @type {?} */ view = this._embeddedViews[index];
- if (view) {
- var /** @type {?} */ ref = new ViewRef_(view);
- ref.attachToViewContainerRef(this);
- return ref;
- }
- return null;
- };
- Object.defineProperty(ViewContainerRef_.prototype, "length", {
- get: /**
- * @return {?}
- */
- function () { return this._embeddedViews.length; },
- enumerable: true,
- configurable: true
- });
- /**
- * @template C
- * @param {?} templateRef
- * @param {?=} context
- * @param {?=} index
- * @return {?}
- */
- ViewContainerRef_.prototype.createEmbeddedView = /**
- * @template C
- * @param {?} templateRef
- * @param {?=} context
- * @param {?=} index
- * @return {?}
- */
- function (templateRef, context, index) {
- var /** @type {?} */ viewRef = templateRef.createEmbeddedView(context || /** @type {?} */ ({}));
- this.insert(viewRef, index);
- return viewRef;
- };
- /**
- * @template C
- * @param {?} componentFactory
- * @param {?=} index
- * @param {?=} injector
- * @param {?=} projectableNodes
- * @param {?=} ngModuleRef
- * @return {?}
- */
- ViewContainerRef_.prototype.createComponent = /**
- * @template C
- * @param {?} componentFactory
- * @param {?=} index
- * @param {?=} injector
- * @param {?=} projectableNodes
- * @param {?=} ngModuleRef
- * @return {?}
- */
- function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
- var /** @type {?} */ contextInjector = injector || this.parentInjector;
- if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
- ngModuleRef = contextInjector.get(NgModuleRef);
- }
- var /** @type {?} */ componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
- this.insert(componentRef.hostView, index);
- return componentRef;
- };
- /**
- * @param {?} viewRef
- * @param {?=} index
- * @return {?}
- */
- ViewContainerRef_.prototype.insert = /**
- * @param {?} viewRef
- * @param {?=} index
- * @return {?}
- */
- function (viewRef, index) {
- if (viewRef.destroyed) {
- throw new Error('Cannot insert a destroyed View in a ViewContainer!');
- }
- var /** @type {?} */ viewRef_ = /** @type {?} */ (viewRef);
- var /** @type {?} */ viewData = viewRef_._view;
- attachEmbeddedView(this._view, this._data, index, viewData);
- viewRef_.attachToViewContainerRef(this);
- return viewRef;
- };
- /**
- * @param {?} viewRef
- * @param {?} currentIndex
- * @return {?}
- */
- ViewContainerRef_.prototype.move = /**
- * @param {?} viewRef
- * @param {?} currentIndex
- * @return {?}
- */
- function (viewRef, currentIndex) {
- if (viewRef.destroyed) {
- throw new Error('Cannot move a destroyed View in a ViewContainer!');
- }
- var /** @type {?} */ previousIndex = this._embeddedViews.indexOf(viewRef._view);
- moveEmbeddedView(this._data, previousIndex, currentIndex);
- return viewRef;
- };
- /**
- * @param {?} viewRef
- * @return {?}
- */
- ViewContainerRef_.prototype.indexOf = /**
- * @param {?} viewRef
- * @return {?}
- */
- function (viewRef) {
- return this._embeddedViews.indexOf((/** @type {?} */ (viewRef))._view);
- };
- /**
- * @param {?=} index
- * @return {?}
- */
- ViewContainerRef_.prototype.remove = /**
- * @param {?=} index
- * @return {?}
- */
- function (index) {
- var /** @type {?} */ viewData = detachEmbeddedView(this._data, index);
- if (viewData) {
- Services.destroyView(viewData);
- }
- };
- /**
- * @param {?=} index
- * @return {?}
- */
- ViewContainerRef_.prototype.detach = /**
- * @param {?=} index
- * @return {?}
- */
- function (index) {
- var /** @type {?} */ view = detachEmbeddedView(this._data, index);
- return view ? new ViewRef_(view) : null;
- };
- return ViewContainerRef_;
- }());
- /**
- * @param {?} view
- * @return {?}
- */
- function createChangeDetectorRef(view) {
- return new ViewRef_(view);
- }
- var ViewRef_ = /** @class */ (function () {
- function ViewRef_(_view) {
- this._view = _view;
- this._viewContainerRef = null;
- this._appRef = null;
- }
- Object.defineProperty(ViewRef_.prototype, "rootNodes", {
- get: /**
- * @return {?}
- */
- function () { return rootRenderNodes(this._view); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ViewRef_.prototype, "context", {
- get: /**
- * @return {?}
- */
- function () { return this._view.context; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ViewRef_.prototype, "destroyed", {
- get: /**
- * @return {?}
- */
- function () { return (this._view.state & 128 /* Destroyed */) !== 0; },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- ViewRef_.prototype.markForCheck = /**
- * @return {?}
- */
- function () { markParentViewsForCheck(this._view); };
- /**
- * @return {?}
- */
- ViewRef_.prototype.detach = /**
- * @return {?}
- */
- function () { this._view.state &= ~4 /* Attached */; };
- /**
- * @return {?}
- */
- ViewRef_.prototype.detectChanges = /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ fs = this._view.root.rendererFactory;
- if (fs.begin) {
- fs.begin();
- }
- try {
- Services.checkAndUpdateView(this._view);
- }
- finally {
- if (fs.end) {
- fs.end();
- }
- }
- };
- /**
- * @return {?}
- */
- ViewRef_.prototype.checkNoChanges = /**
- * @return {?}
- */
- function () { Services.checkNoChangesView(this._view); };
- /**
- * @return {?}
- */
- ViewRef_.prototype.reattach = /**
- * @return {?}
- */
- function () { this._view.state |= 4 /* Attached */; };
- /**
- * @param {?} callback
- * @return {?}
- */
- ViewRef_.prototype.onDestroy = /**
- * @param {?} callback
- * @return {?}
- */
- function (callback) {
- if (!this._view.disposables) {
- this._view.disposables = [];
- }
- this._view.disposables.push(/** @type {?} */ (callback));
- };
- /**
- * @return {?}
- */
- ViewRef_.prototype.destroy = /**
- * @return {?}
- */
- function () {
- if (this._appRef) {
- this._appRef.detachView(this);
- }
- else if (this._viewContainerRef) {
- this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
- }
- Services.destroyView(this._view);
- };
- /**
- * @return {?}
- */
- ViewRef_.prototype.detachFromAppRef = /**
- * @return {?}
- */
- function () {
- this._appRef = null;
- renderDetachView(this._view);
- Services.dirtyParentQueries(this._view);
- };
- /**
- * @param {?} appRef
- * @return {?}
- */
- ViewRef_.prototype.attachToAppRef = /**
- * @param {?} appRef
- * @return {?}
- */
- function (appRef) {
- if (this._viewContainerRef) {
- throw new Error('This view is already attached to a ViewContainer!');
- }
- this._appRef = appRef;
- };
- /**
- * @param {?} vcRef
- * @return {?}
- */
- ViewRef_.prototype.attachToViewContainerRef = /**
- * @param {?} vcRef
- * @return {?}
- */
- function (vcRef) {
- if (this._appRef) {
- throw new Error('This view is already attached directly to the ApplicationRef!');
- }
- this._viewContainerRef = vcRef;
- };
- return ViewRef_;
- }());
- /**
- * @param {?} view
- * @param {?} def
- * @return {?}
- */
- function createTemplateData(view, def) {
- return new TemplateRef_(view, def);
- }
- var TemplateRef_ = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TemplateRef_, _super);
- function TemplateRef_(_parentView, _def) {
- var _this = _super.call(this) || this;
- _this._parentView = _parentView;
- _this._def = _def;
- return _this;
- }
- /**
- * @param {?} context
- * @return {?}
- */
- TemplateRef_.prototype.createEmbeddedView = /**
- * @param {?} context
- * @return {?}
- */
- function (context) {
- return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, /** @type {?} */ ((/** @type {?} */ ((this._def.element)).template)), context));
- };
- Object.defineProperty(TemplateRef_.prototype, "elementRef", {
- get: /**
- * @return {?}
- */
- function () {
- return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement);
- },
- enumerable: true,
- configurable: true
- });
- return TemplateRef_;
- }(TemplateRef));
- /**
- * @param {?} view
- * @param {?} elDef
- * @return {?}
- */
- function createInjector(view, elDef) {
- return new Injector_(view, elDef);
- }
- var Injector_ = /** @class */ (function () {
- function Injector_(view, elDef) {
- this.view = view;
- this.elDef = elDef;
- }
- /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- Injector_.prototype.get = /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- function (token, notFoundValue) {
- if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
- var /** @type {?} */ allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 /* ComponentView */) !== 0 : false;
- return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */, token: token, tokenKey: tokenKey(token) }, notFoundValue);
- };
- return Injector_;
- }());
- /**
- * @param {?} view
- * @param {?} index
- * @return {?}
- */
- function nodeValue(view, index) {
- var /** @type {?} */ def = view.def.nodes[index];
- if (def.flags & 1 /* TypeElement */) {
- var /** @type {?} */ elData = asElementData(view, def.nodeIndex);
- return /** @type {?} */ ((def.element)).template ? elData.template : elData.renderElement;
- }
- else if (def.flags & 2 /* TypeText */) {
- return asTextData(view, def.nodeIndex).renderText;
- }
- else if (def.flags & (20224 /* CatProvider */ | 16 /* TypePipe */)) {
- return asProviderData(view, def.nodeIndex).instance;
- }
- throw new Error("Illegal state: read nodeValue for node index " + index);
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function createRendererV1(view) {
- return new RendererAdapter(view.renderer);
- }
- var RendererAdapter = /** @class */ (function () {
- function RendererAdapter(delegate) {
- this.delegate = delegate;
- }
- /**
- * @param {?} selectorOrNode
- * @return {?}
- */
- RendererAdapter.prototype.selectRootElement = /**
- * @param {?} selectorOrNode
- * @return {?}
- */
- function (selectorOrNode) {
- return this.delegate.selectRootElement(selectorOrNode);
- };
- /**
- * @param {?} parent
- * @param {?} namespaceAndName
- * @return {?}
- */
- RendererAdapter.prototype.createElement = /**
- * @param {?} parent
- * @param {?} namespaceAndName
- * @return {?}
- */
- function (parent, namespaceAndName) {
- var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
- var /** @type {?} */ el = this.delegate.createElement(name, ns);
- if (parent) {
- this.delegate.appendChild(parent, el);
- }
- return el;
- };
- /**
- * @param {?} hostElement
- * @return {?}
- */
- RendererAdapter.prototype.createViewRoot = /**
- * @param {?} hostElement
- * @return {?}
- */
- function (hostElement) { return hostElement; };
- /**
- * @param {?} parentElement
- * @return {?}
- */
- RendererAdapter.prototype.createTemplateAnchor = /**
- * @param {?} parentElement
- * @return {?}
- */
- function (parentElement) {
- var /** @type {?} */ comment = this.delegate.createComment('');
- if (parentElement) {
- this.delegate.appendChild(parentElement, comment);
- }
- return comment;
- };
- /**
- * @param {?} parentElement
- * @param {?} value
- * @return {?}
- */
- RendererAdapter.prototype.createText = /**
- * @param {?} parentElement
- * @param {?} value
- * @return {?}
- */
- function (parentElement, value) {
- var /** @type {?} */ node = this.delegate.createText(value);
- if (parentElement) {
- this.delegate.appendChild(parentElement, node);
- }
- return node;
- };
- /**
- * @param {?} parentElement
- * @param {?} nodes
- * @return {?}
- */
- RendererAdapter.prototype.projectNodes = /**
- * @param {?} parentElement
- * @param {?} nodes
- * @return {?}
- */
- function (parentElement, nodes) {
- for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
- this.delegate.appendChild(parentElement, nodes[i]);
- }
- };
- /**
- * @param {?} node
- * @param {?} viewRootNodes
- * @return {?}
- */
- RendererAdapter.prototype.attachViewAfter = /**
- * @param {?} node
- * @param {?} viewRootNodes
- * @return {?}
- */
- function (node, viewRootNodes) {
- var /** @type {?} */ parentElement = this.delegate.parentNode(node);
- var /** @type {?} */ nextSibling = this.delegate.nextSibling(node);
- for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
- this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling);
- }
- };
- /**
- * @param {?} viewRootNodes
- * @return {?}
- */
- RendererAdapter.prototype.detachView = /**
- * @param {?} viewRootNodes
- * @return {?}
- */
- function (viewRootNodes) {
- for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
- var /** @type {?} */ node = viewRootNodes[i];
- var /** @type {?} */ parentElement = this.delegate.parentNode(node);
- this.delegate.removeChild(parentElement, node);
- }
- };
- /**
- * @param {?} hostElement
- * @param {?} viewAllNodes
- * @return {?}
- */
- RendererAdapter.prototype.destroyView = /**
- * @param {?} hostElement
- * @param {?} viewAllNodes
- * @return {?}
- */
- function (hostElement, viewAllNodes) {
- for (var /** @type {?} */ i = 0; i < viewAllNodes.length; i++) {
- /** @type {?} */ ((this.delegate.destroyNode))(viewAllNodes[i]);
- }
- };
- /**
- * @param {?} renderElement
- * @param {?} name
- * @param {?} callback
- * @return {?}
- */
- RendererAdapter.prototype.listen = /**
- * @param {?} renderElement
- * @param {?} name
- * @param {?} callback
- * @return {?}
- */
- function (renderElement, name, callback) {
- return this.delegate.listen(renderElement, name, /** @type {?} */ (callback));
- };
- /**
- * @param {?} target
- * @param {?} name
- * @param {?} callback
- * @return {?}
- */
- RendererAdapter.prototype.listenGlobal = /**
- * @param {?} target
- * @param {?} name
- * @param {?} callback
- * @return {?}
- */
- function (target, name, callback) {
- return this.delegate.listen(target, name, /** @type {?} */ (callback));
- };
- /**
- * @param {?} renderElement
- * @param {?} propertyName
- * @param {?} propertyValue
- * @return {?}
- */
- RendererAdapter.prototype.setElementProperty = /**
- * @param {?} renderElement
- * @param {?} propertyName
- * @param {?} propertyValue
- * @return {?}
- */
- function (renderElement, propertyName, propertyValue) {
- this.delegate.setProperty(renderElement, propertyName, propertyValue);
- };
- /**
- * @param {?} renderElement
- * @param {?} namespaceAndName
- * @param {?} attributeValue
- * @return {?}
- */
- RendererAdapter.prototype.setElementAttribute = /**
- * @param {?} renderElement
- * @param {?} namespaceAndName
- * @param {?} attributeValue
- * @return {?}
- */
- function (renderElement, namespaceAndName, attributeValue) {
- var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
- if (attributeValue != null) {
- this.delegate.setAttribute(renderElement, name, attributeValue, ns);
- }
- else {
- this.delegate.removeAttribute(renderElement, name, ns);
- }
- };
- /**
- * @param {?} renderElement
- * @param {?} propertyName
- * @param {?} propertyValue
- * @return {?}
- */
- RendererAdapter.prototype.setBindingDebugInfo = /**
- * @param {?} renderElement
- * @param {?} propertyName
- * @param {?} propertyValue
- * @return {?}
- */
- function (renderElement, propertyName, propertyValue) { };
- /**
- * @param {?} renderElement
- * @param {?} className
- * @param {?} isAdd
- * @return {?}
- */
- RendererAdapter.prototype.setElementClass = /**
- * @param {?} renderElement
- * @param {?} className
- * @param {?} isAdd
- * @return {?}
- */
- function (renderElement, className, isAdd) {
- if (isAdd) {
- this.delegate.addClass(renderElement, className);
- }
- else {
- this.delegate.removeClass(renderElement, className);
- }
- };
- /**
- * @param {?} renderElement
- * @param {?} styleName
- * @param {?} styleValue
- * @return {?}
- */
- RendererAdapter.prototype.setElementStyle = /**
- * @param {?} renderElement
- * @param {?} styleName
- * @param {?} styleValue
- * @return {?}
- */
- function (renderElement, styleName, styleValue) {
- if (styleValue != null) {
- this.delegate.setStyle(renderElement, styleName, styleValue);
- }
- else {
- this.delegate.removeStyle(renderElement, styleName);
- }
- };
- /**
- * @param {?} renderElement
- * @param {?} methodName
- * @param {?} args
- * @return {?}
- */
- RendererAdapter.prototype.invokeElementMethod = /**
- * @param {?} renderElement
- * @param {?} methodName
- * @param {?} args
- * @return {?}
- */
- function (renderElement, methodName, args) {
- (/** @type {?} */ (renderElement))[methodName].apply(renderElement, args);
- };
- /**
- * @param {?} renderNode
- * @param {?} text
- * @return {?}
- */
- RendererAdapter.prototype.setText = /**
- * @param {?} renderNode
- * @param {?} text
- * @return {?}
- */
- function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); };
- /**
- * @return {?}
- */
- RendererAdapter.prototype.animate = /**
- * @return {?}
- */
- function () { throw new Error('Renderer.animate is no longer supported!'); };
- return RendererAdapter;
- }());
- /**
- * @param {?} moduleType
- * @param {?} parent
- * @param {?} bootstrapComponents
- * @param {?} def
- * @return {?}
- */
- function createNgModuleRef(moduleType, parent, bootstrapComponents, def) {
- return new NgModuleRef_(moduleType, parent, bootstrapComponents, def);
- }
- var NgModuleRef_ = /** @class */ (function () {
- function NgModuleRef_(_moduleType, _parent, _bootstrapComponents, _def) {
- this._moduleType = _moduleType;
- this._parent = _parent;
- this._bootstrapComponents = _bootstrapComponents;
- this._def = _def;
- this._destroyListeners = [];
- this._destroyed = false;
- this.injector = this;
- initNgModule(this);
- }
- /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- NgModuleRef_.prototype.get = /**
- * @param {?} token
- * @param {?=} notFoundValue
- * @return {?}
- */
- function (token, notFoundValue) {
- if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
- return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: 0 /* None */ }, notFoundValue);
- };
- Object.defineProperty(NgModuleRef_.prototype, "instance", {
- get: /**
- * @return {?}
- */
- function () { return this.get(this._moduleType); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(NgModuleRef_.prototype, "componentFactoryResolver", {
- get: /**
- * @return {?}
- */
- function () { return this.get(ComponentFactoryResolver); },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- NgModuleRef_.prototype.destroy = /**
- * @return {?}
- */
- function () {
- if (this._destroyed) {
- throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed.");
- }
- this._destroyed = true;
- callNgModuleLifecycle(this, 131072 /* OnDestroy */);
- this._destroyListeners.forEach(function (listener) { return listener(); });
- };
- /**
- * @param {?} callback
- * @return {?}
- */
- NgModuleRef_.prototype.onDestroy = /**
- * @param {?} callback
- * @return {?}
- */
- function (callback) { this._destroyListeners.push(callback); };
- return NgModuleRef_;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var RendererV1TokenKey = tokenKey(Renderer);
- var Renderer2TokenKey = tokenKey(Renderer2);
- var ElementRefTokenKey = tokenKey(ElementRef);
- var ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
- var TemplateRefTokenKey = tokenKey(TemplateRef);
- var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
- var InjectorRefTokenKey = tokenKey(Injector);
- /**
- * @param {?} checkIndex
- * @param {?} flags
- * @param {?} matchedQueries
- * @param {?} childCount
- * @param {?} ctor
- * @param {?} deps
- * @param {?=} props
- * @param {?=} outputs
- * @return {?}
- */
- function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps, props, outputs) {
- var /** @type {?} */ bindings = [];
- if (props) {
- for (var /** @type {?} */ prop in props) {
- var _a = props[prop], bindingIndex = _a[0], nonMinifiedName = _a[1];
- bindings[bindingIndex] = {
- flags: 8 /* TypeProperty */,
- name: prop, nonMinifiedName: nonMinifiedName,
- ns: null,
- securityContext: null,
- suffix: null
- };
- }
- }
- var /** @type {?} */ outputDefs = [];
- if (outputs) {
- for (var /** @type {?} */ propName in outputs) {
- outputDefs.push({ type: 1 /* DirectiveOutput */, propName: propName, target: null, eventName: outputs[propName] });
- }
- }
- flags |= 16384 /* TypeDirective */;
- return _def(checkIndex, flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
- }
- /**
- * @param {?} flags
- * @param {?} ctor
- * @param {?} deps
- * @return {?}
- */
- function pipeDef(flags, ctor, deps) {
- flags |= 16 /* TypePipe */;
- return _def(-1, flags, null, 0, ctor, ctor, deps);
- }
- /**
- * @param {?} flags
- * @param {?} matchedQueries
- * @param {?} token
- * @param {?} value
- * @param {?} deps
- * @return {?}
- */
- function providerDef(flags, matchedQueries, token, value, deps) {
- return _def(-1, flags, matchedQueries, 0, token, value, deps);
- }
- /**
- * @param {?} checkIndex
- * @param {?} flags
- * @param {?} matchedQueriesDsl
- * @param {?} childCount
- * @param {?} token
- * @param {?} value
- * @param {?} deps
- * @param {?=} bindings
- * @param {?=} outputs
- * @return {?}
- */
- function _def(checkIndex, flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
- var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
- if (!outputs) {
- outputs = [];
- }
- if (!bindings) {
- bindings = [];
- }
- // Need to resolve forwardRefs as e.g. for `useValue` we
- // lowered the expression and then stopped evaluating it,
- // i.e. also didn't unwrap it.
- value = resolveForwardRef(value);
- var /** @type {?} */ depDefs = splitDepsDsl(deps, stringify(token));
- return {
- // will bet set by the view definition
- nodeIndex: -1,
- parent: null,
- renderParent: null,
- bindingIndex: -1,
- outputIndex: -1,
- // regular values
- checkIndex: checkIndex,
- flags: flags,
- childFlags: 0,
- directChildFlags: 0,
- childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references,
- ngContentIndex: -1, childCount: childCount, bindings: bindings,
- bindingFlags: calcBindingFlags(bindings), outputs: outputs,
- element: null,
- provider: { token: token, value: value, deps: depDefs },
- text: null,
- query: null,
- ngContent: null
- };
- }
- /**
- * @param {?} view
- * @param {?} def
- * @return {?}
- */
- function createProviderInstance(view, def) {
- return _createProviderInstance(view, def);
- }
- /**
- * @param {?} view
- * @param {?} def
- * @return {?}
- */
- function createPipeInstance(view, def) {
- // deps are looked up from component.
- var /** @type {?} */ compView = view;
- while (compView.parent && !isComponentView(compView)) {
- compView = compView.parent;
- }
- // pipes can see the private services of the component
- var /** @type {?} */ allowPrivateServices = true;
- // pipes are always eager and classes!
- return createClass(/** @type {?} */ ((compView.parent)), /** @type {?} */ ((viewParentEl(compView))), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
- }
- /**
- * @param {?} view
- * @param {?} def
- * @return {?}
- */
- function createDirectiveInstance(view, def) {
- // components can see other private services, other directives can't.
- var /** @type {?} */ allowPrivateServices = (def.flags & 32768 /* Component */) > 0;
- // directives are always eager and classes!
- var /** @type {?} */ instance = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
- if (def.outputs.length) {
- for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
- var /** @type {?} */ output = def.outputs[i];
- var /** @type {?} */ subscription = instance[/** @type {?} */ ((output.propName))].subscribe(eventHandlerClosure(view, /** @type {?} */ ((def.parent)).nodeIndex, output.eventName)); /** @type {?} */
- ((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
- }
- }
- return instance;
- }
- /**
- * @param {?} view
- * @param {?} index
- * @param {?} eventName
- * @return {?}
- */
- function eventHandlerClosure(view, index, eventName) {
- return function (event) { return dispatchEvent(view, index, eventName, event); };
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} v0
- * @param {?} v1
- * @param {?} v2
- * @param {?} v3
- * @param {?} v4
- * @param {?} v5
- * @param {?} v6
- * @param {?} v7
- * @param {?} v8
- * @param {?} v9
- * @return {?}
- */
- function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- var /** @type {?} */ providerData = asProviderData(view, def.nodeIndex);
- var /** @type {?} */ directive = providerData.instance;
- var /** @type {?} */ changed = false;
- var /** @type {?} */ changes = /** @type {?} */ ((undefined));
- var /** @type {?} */ bindLen = def.bindings.length;
- if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
- changed = true;
- changes = updateProp(view, providerData, def, 0, v0, changes);
- }
- if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
- changed = true;
- changes = updateProp(view, providerData, def, 1, v1, changes);
- }
- if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
- changed = true;
- changes = updateProp(view, providerData, def, 2, v2, changes);
- }
- if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
- changed = true;
- changes = updateProp(view, providerData, def, 3, v3, changes);
- }
- if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
- changed = true;
- changes = updateProp(view, providerData, def, 4, v4, changes);
- }
- if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
- changed = true;
- changes = updateProp(view, providerData, def, 5, v5, changes);
- }
- if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
- changed = true;
- changes = updateProp(view, providerData, def, 6, v6, changes);
- }
- if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
- changed = true;
- changes = updateProp(view, providerData, def, 7, v7, changes);
- }
- if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
- changed = true;
- changes = updateProp(view, providerData, def, 8, v8, changes);
- }
- if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
- changed = true;
- changes = updateProp(view, providerData, def, 9, v9, changes);
- }
- if (changes) {
- directive.ngOnChanges(changes);
- }
- if ((def.flags & 65536 /* OnInit */) &&
- shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */, def.nodeIndex)) {
- directive.ngOnInit();
- }
- if (def.flags & 262144 /* DoCheck */) {
- directive.ngDoCheck();
- }
- return changed;
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} values
- * @return {?}
- */
- function checkAndUpdateDirectiveDynamic(view, def, values) {
- var /** @type {?} */ providerData = asProviderData(view, def.nodeIndex);
- var /** @type {?} */ directive = providerData.instance;
- var /** @type {?} */ changed = false;
- var /** @type {?} */ changes = /** @type {?} */ ((undefined));
- for (var /** @type {?} */ i = 0; i < values.length; i++) {
- if (checkBinding(view, def, i, values[i])) {
- changed = true;
- changes = updateProp(view, providerData, def, i, values[i], changes);
- }
- }
- if (changes) {
- directive.ngOnChanges(changes);
- }
- if ((def.flags & 65536 /* OnInit */) &&
- shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */, def.nodeIndex)) {
- directive.ngOnInit();
- }
- if (def.flags & 262144 /* DoCheck */) {
- directive.ngDoCheck();
- }
- return changed;
- }
- /**
- * @param {?} view
- * @param {?} def
- * @return {?}
- */
- function _createProviderInstance(view, def) {
- // private services can see other private services
- var /** @type {?} */ allowPrivateServices = (def.flags & 8192 /* PrivateProvider */) > 0;
- var /** @type {?} */ providerDef = def.provider;
- switch (def.flags & 201347067 /* Types */) {
- case 512 /* TypeClassProvider */:
- return createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
- case 1024 /* TypeFactoryProvider */:
- return callFactory(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
- case 2048 /* TypeUseExistingProvider */:
- return resolveDep(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).deps[0]);
- case 256 /* TypeValueProvider */:
- return /** @type {?} */ ((providerDef)).value;
- }
- }
- /**
- * @param {?} view
- * @param {?} elDef
- * @param {?} allowPrivateServices
- * @param {?} ctor
- * @param {?} deps
- * @return {?}
- */
- function createClass(view, elDef, allowPrivateServices, ctor, deps) {
- var /** @type {?} */ len = deps.length;
- switch (len) {
- case 0:
- return new ctor();
- case 1:
- return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
- case 2:
- return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
- case 3:
- return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
- default:
- var /** @type {?} */ depValues = new Array(len);
- for (var /** @type {?} */ i = 0; i < len; i++) {
- depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
- }
- return new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
- }
- }
- /**
- * @param {?} view
- * @param {?} elDef
- * @param {?} allowPrivateServices
- * @param {?} factory
- * @param {?} deps
- * @return {?}
- */
- function callFactory(view, elDef, allowPrivateServices, factory, deps) {
- var /** @type {?} */ len = deps.length;
- switch (len) {
- case 0:
- return factory();
- case 1:
- return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
- case 2:
- return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
- case 3:
- return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
- default:
- var /** @type {?} */ depValues = Array(len);
- for (var /** @type {?} */ i = 0; i < len; i++) {
- depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
- }
- return factory.apply(void 0, depValues);
- }
- }
- // This default value is when checking the hierarchy for a token.
- //
- // It means both:
- // - the token is not provided by the current injector,
- // - only the element injectors should be checked (ie do not check module injectors
- //
- // mod1
- // /
- // el1 mod2
- // \ /
- // el2
- //
- // When requesting el2.injector.get(token), we should check in the following order and return the
- // first found value:
- // - el2.injector.get(token, default)
- // - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module
- // - mod2.injector.get(token, default)
- var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
- /**
- * @param {?} view
- * @param {?} elDef
- * @param {?} allowPrivateServices
- * @param {?} depDef
- * @param {?=} notFoundValue
- * @return {?}
- */
- function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) {
- if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
- if (depDef.flags & 8 /* Value */) {
- return depDef.token;
- }
- var /** @type {?} */ startView = view;
- if (depDef.flags & 2 /* Optional */) {
- notFoundValue = null;
- }
- var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
- if (tokenKey$$1 === ChangeDetectorRefTokenKey) {
- // directives on the same element as a component should be able to control the change detector
- // of that component as well.
- allowPrivateServices = !!(elDef && /** @type {?} */ ((elDef.element)).componentView);
- }
- if (elDef && (depDef.flags & 1 /* SkipSelf */)) {
- allowPrivateServices = false;
- elDef = /** @type {?} */ ((elDef.parent));
- }
- while (view) {
- if (elDef) {
- switch (tokenKey$$1) {
- case RendererV1TokenKey: {
- var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
- return createRendererV1(compView);
- }
- case Renderer2TokenKey: {
- var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
- return compView.renderer;
- }
- case ElementRefTokenKey:
- return new ElementRef(asElementData(view, elDef.nodeIndex).renderElement);
- case ViewContainerRefTokenKey:
- return asElementData(view, elDef.nodeIndex).viewContainer;
- case TemplateRefTokenKey: {
- if (/** @type {?} */ ((elDef.element)).template) {
- return asElementData(view, elDef.nodeIndex).template;
- }
- break;
- }
- case ChangeDetectorRefTokenKey: {
- var /** @type {?} */ cdView = findCompView(view, elDef, allowPrivateServices);
- return createChangeDetectorRef(cdView);
- }
- case InjectorRefTokenKey:
- return createInjector(view, elDef);
- default:
- var /** @type {?} */ providerDef_1 = /** @type {?} */ (((allowPrivateServices ? /** @type {?} */ ((elDef.element)).allProviders : /** @type {?} */ ((elDef.element)).publicProviders)))[tokenKey$$1];
- if (providerDef_1) {
- var /** @type {?} */ providerData = asProviderData(view, providerDef_1.nodeIndex);
- if (!providerData) {
- providerData = { instance: _createProviderInstance(view, providerDef_1) };
- view.nodes[providerDef_1.nodeIndex] = /** @type {?} */ (providerData);
- }
- return providerData.instance;
- }
- }
- }
- allowPrivateServices = isComponentView(view);
- elDef = /** @type {?} */ ((viewParentEl(view)));
- view = /** @type {?} */ ((view.parent));
- }
- var /** @type {?} */ value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
- if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
- notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
- // Return the value from the root element injector when
- // - it provides it
- // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
- // - the module injector should not be checked
- // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
- return value;
- }
- return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
- }
- /**
- * @param {?} view
- * @param {?} elDef
- * @param {?} allowPrivateServices
- * @return {?}
- */
- function findCompView(view, elDef, allowPrivateServices) {
- var /** @type {?} */ compView;
- if (allowPrivateServices) {
- compView = asElementData(view, elDef.nodeIndex).componentView;
- }
- else {
- compView = view;
- while (compView.parent && !isComponentView(compView)) {
- compView = compView.parent;
- }
- }
- return compView;
- }
- /**
- * @param {?} view
- * @param {?} providerData
- * @param {?} def
- * @param {?} bindingIdx
- * @param {?} value
- * @param {?} changes
- * @return {?}
- */
- function updateProp(view, providerData, def, bindingIdx, value, changes) {
- if (def.flags & 32768 /* Component */) {
- var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((def.parent)).nodeIndex).componentView;
- if (compView.def.flags & 2 /* OnPush */) {
- compView.state |= 8 /* ChecksEnabled */;
- }
- }
- var /** @type {?} */ binding = def.bindings[bindingIdx];
- var /** @type {?} */ propName = /** @type {?} */ ((binding.name));
- // Note: This is still safe with Closure Compiler as
- // the user passed in the property name as an object has to `providerDef`,
- // so Closure Compiler will have renamed the property correctly already.
- providerData.instance[propName] = value;
- if (def.flags & 524288 /* OnChanges */) {
- changes = changes || {};
- var /** @type {?} */ oldValue = WrappedValue.unwrap(view.oldValues[def.bindingIndex + bindingIdx]);
- var /** @type {?} */ binding_1 = def.bindings[bindingIdx];
- changes[/** @type {?} */ ((binding_1.nonMinifiedName))] =
- new SimpleChange(oldValue, value, (view.state & 2 /* FirstCheck */) !== 0);
- }
- view.oldValues[def.bindingIndex + bindingIdx] = value;
- return changes;
- }
- /**
- * @param {?} view
- * @param {?} lifecycles
- * @return {?}
- */
- function callLifecycleHooksChildrenFirst(view, lifecycles) {
- if (!(view.def.nodeFlags & lifecycles)) {
- return;
- }
- var /** @type {?} */ nodes = view.def.nodes;
- var /** @type {?} */ initIndex = 0;
- for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
- var /** @type {?} */ nodeDef = nodes[i];
- var /** @type {?} */ parent_1 = nodeDef.parent;
- if (!parent_1 && nodeDef.flags & lifecycles) {
- // matching root node (e.g. a pipe)
- callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
- }
- if ((nodeDef.childFlags & lifecycles) === 0) {
- // no child matches one of the lifecycles
- i += nodeDef.childCount;
- }
- while (parent_1 && (parent_1.flags & 1 /* TypeElement */) &&
- i === parent_1.nodeIndex + parent_1.childCount) {
- // last child of an element
- if (parent_1.directChildFlags & lifecycles) {
- initIndex = callElementProvidersLifecycles(view, parent_1, lifecycles, initIndex);
- }
- parent_1 = parent_1.parent;
- }
- }
- }
- /**
- * @param {?} view
- * @param {?} elDef
- * @param {?} lifecycles
- * @param {?} initIndex
- * @return {?}
- */
- function callElementProvidersLifecycles(view, elDef, lifecycles, initIndex) {
- for (var /** @type {?} */ i = elDef.nodeIndex + 1; i <= elDef.nodeIndex + elDef.childCount; i++) {
- var /** @type {?} */ nodeDef = view.def.nodes[i];
- if (nodeDef.flags & lifecycles) {
- callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
- }
- // only visit direct children
- i += nodeDef.childCount;
- }
- return initIndex;
- }
- /**
- * @param {?} view
- * @param {?} index
- * @param {?} lifecycles
- * @param {?} initIndex
- * @return {?}
- */
- function callProviderLifecycles(view, index, lifecycles, initIndex) {
- var /** @type {?} */ providerData = asProviderData(view, index);
- if (!providerData) {
- return;
- }
- var /** @type {?} */ provider = providerData.instance;
- if (!provider) {
- return;
- }
- Services.setCurrentNode(view, index);
- if (lifecycles & 1048576 /* AfterContentInit */ &&
- shouldCallLifecycleInitHook(view, 512 /* InitState_CallingAfterContentInit */, initIndex)) {
- provider.ngAfterContentInit();
- }
- if (lifecycles & 2097152 /* AfterContentChecked */) {
- provider.ngAfterContentChecked();
- }
- if (lifecycles & 4194304 /* AfterViewInit */ &&
- shouldCallLifecycleInitHook(view, 768 /* InitState_CallingAfterViewInit */, initIndex)) {
- provider.ngAfterViewInit();
- }
- if (lifecycles & 8388608 /* AfterViewChecked */) {
- provider.ngAfterViewChecked();
- }
- if (lifecycles & 131072 /* OnDestroy */) {
- provider.ngOnDestroy();
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} flags
- * @param {?} id
- * @param {?} bindings
- * @return {?}
- */
- function queryDef(flags, id, bindings) {
- var /** @type {?} */ bindingDefs = [];
- for (var /** @type {?} */ propName in bindings) {
- var /** @type {?} */ bindingType = bindings[propName];
- bindingDefs.push({ propName: propName, bindingType: bindingType });
- }
- return {
- // will bet set by the view definition
- nodeIndex: -1,
- parent: null,
- renderParent: null,
- bindingIndex: -1,
- outputIndex: -1,
- // regular values
- // TODO(vicb): check
- checkIndex: -1, flags: flags,
- childFlags: 0,
- directChildFlags: 0,
- childMatchedQueries: 0,
- ngContentIndex: -1,
- matchedQueries: {},
- matchedQueryIds: 0,
- references: {},
- childCount: 0,
- bindings: [],
- bindingFlags: 0,
- outputs: [],
- element: null,
- provider: null,
- text: null,
- query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs },
- ngContent: null
- };
- }
- /**
- * @return {?}
- */
- function createQuery() {
- return new QueryList();
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function dirtyParentQueries(view) {
- var /** @type {?} */ queryIds = view.def.nodeMatchedQueries;
- while (view.parent && isEmbeddedView(view)) {
- var /** @type {?} */ tplDef = /** @type {?} */ ((view.parentNodeDef));
- view = view.parent;
- // content queries
- var /** @type {?} */ end = tplDef.nodeIndex + tplDef.childCount;
- for (var /** @type {?} */ i = 0; i <= end; i++) {
- var /** @type {?} */ nodeDef = view.def.nodes[i];
- if ((nodeDef.flags & 67108864 /* TypeContentQuery */) &&
- (nodeDef.flags & 536870912 /* DynamicQuery */) &&
- (/** @type {?} */ ((nodeDef.query)).filterId & queryIds) === /** @type {?} */ ((nodeDef.query)).filterId) {
- asQueryList(view, i).setDirty();
- }
- if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.nodeIndex) ||
- !(nodeDef.childFlags & 67108864 /* TypeContentQuery */) ||
- !(nodeDef.childFlags & 536870912 /* DynamicQuery */)) {
- // skip elements that don't contain the template element or no query.
- i += nodeDef.childCount;
- }
- }
- }
- // view queries
- if (view.def.nodeFlags & 134217728 /* TypeViewQuery */) {
- for (var /** @type {?} */ i = 0; i < view.def.nodes.length; i++) {
- var /** @type {?} */ nodeDef = view.def.nodes[i];
- if ((nodeDef.flags & 134217728 /* TypeViewQuery */) && (nodeDef.flags & 536870912 /* DynamicQuery */)) {
- asQueryList(view, i).setDirty();
- }
- // only visit the root nodes
- i += nodeDef.childCount;
- }
- }
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @return {?}
- */
- function checkAndUpdateQuery(view, nodeDef) {
- var /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex);
- if (!queryList.dirty) {
- return;
- }
- var /** @type {?} */ directiveInstance;
- var /** @type {?} */ newValues = /** @type {?} */ ((undefined));
- if (nodeDef.flags & 67108864 /* TypeContentQuery */) {
- var /** @type {?} */ elementDef = /** @type {?} */ ((/** @type {?} */ ((nodeDef.parent)).parent));
- newValues = calcQueryValues(view, elementDef.nodeIndex, elementDef.nodeIndex + elementDef.childCount, /** @type {?} */ ((nodeDef.query)), []);
- directiveInstance = asProviderData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).instance;
- }
- else if (nodeDef.flags & 134217728 /* TypeViewQuery */) {
- newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, /** @type {?} */ ((nodeDef.query)), []);
- directiveInstance = view.component;
- }
- queryList.reset(newValues);
- var /** @type {?} */ bindings = /** @type {?} */ ((nodeDef.query)).bindings;
- var /** @type {?} */ notify = false;
- for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
- var /** @type {?} */ binding = bindings[i];
- var /** @type {?} */ boundValue = void 0;
- switch (binding.bindingType) {
- case 0 /* First */:
- boundValue = queryList.first;
- break;
- case 1 /* All */:
- boundValue = queryList;
- notify = true;
- break;
- }
- directiveInstance[binding.propName] = boundValue;
- }
- if (notify) {
- queryList.notifyOnChanges();
- }
- }
- /**
- * @param {?} view
- * @param {?} startIndex
- * @param {?} endIndex
- * @param {?} queryDef
- * @param {?} values
- * @return {?}
- */
- function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
- for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
- var /** @type {?} */ nodeDef = view.def.nodes[i];
- var /** @type {?} */ valueType = nodeDef.matchedQueries[queryDef.id];
- if (valueType != null) {
- values.push(getQueryValue(view, nodeDef, valueType));
- }
- if (nodeDef.flags & 1 /* TypeElement */ && /** @type {?} */ ((nodeDef.element)).template &&
- (/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) ===
- queryDef.filterId) {
- var /** @type {?} */ elementData = asElementData(view, i);
- // check embedded views that were attached at the place of their template,
- // but process child nodes first if some match the query (see issue #16568)
- if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) {
- calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values);
- i += nodeDef.childCount;
- }
- if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
- var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
- for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
- var /** @type {?} */ embeddedView = embeddedViews[k];
- var /** @type {?} */ dvc = declaredViewContainer(embeddedView);
- if (dvc && dvc === elementData) {
- calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
- }
- }
- }
- var /** @type {?} */ projectedViews = elementData.template._projectedViews;
- if (projectedViews) {
- for (var /** @type {?} */ k = 0; k < projectedViews.length; k++) {
- var /** @type {?} */ projectedView = projectedViews[k];
- calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
- }
- }
- }
- if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
- // if no child matches the query, skip the children.
- i += nodeDef.childCount;
- }
- }
- return values;
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} queryValueType
- * @return {?}
- */
- function getQueryValue(view, nodeDef, queryValueType) {
- if (queryValueType != null) {
- // a match
- switch (queryValueType) {
- case 1 /* RenderElement */:
- return asElementData(view, nodeDef.nodeIndex).renderElement;
- case 0 /* ElementRef */:
- return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement);
- case 2 /* TemplateRef */:
- return asElementData(view, nodeDef.nodeIndex).template;
- case 3 /* ViewContainerRef */:
- return asElementData(view, nodeDef.nodeIndex).viewContainer;
- case 4 /* Provider */:
- return asProviderData(view, nodeDef.nodeIndex).instance;
- }
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} ngContentIndex
- * @param {?} index
- * @return {?}
- */
- function ngContentDef(ngContentIndex, index) {
- return {
- // will bet set by the view definition
- nodeIndex: -1,
- parent: null,
- renderParent: null,
- bindingIndex: -1,
- outputIndex: -1,
- // regular values
- checkIndex: -1,
- flags: 8 /* TypeNgContent */,
- childFlags: 0,
- directChildFlags: 0,
- childMatchedQueries: 0,
- matchedQueries: {},
- matchedQueryIds: 0,
- references: {}, ngContentIndex: ngContentIndex,
- childCount: 0,
- bindings: [],
- bindingFlags: 0,
- outputs: [],
- element: null,
- provider: null,
- text: null,
- query: null,
- ngContent: { index: index }
- };
- }
- /**
- * @param {?} view
- * @param {?} renderHost
- * @param {?} def
- * @return {?}
- */
- function appendNgContent(view, renderHost, def) {
- var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
- if (!parentEl) {
- // Nothing to do if there is no parent element.
- return;
- }
- var /** @type {?} */ ngContentIndex = /** @type {?} */ ((def.ngContent)).index;
- visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */, parentEl, null, undefined);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} checkIndex
- * @param {?} argCount
- * @return {?}
- */
- function purePipeDef(checkIndex, argCount) {
- // argCount + 1 to include the pipe as first arg
- return _pureExpressionDef(128 /* TypePurePipe */, checkIndex, new Array(argCount + 1));
- }
- /**
- * @param {?} checkIndex
- * @param {?} argCount
- * @return {?}
- */
- function pureArrayDef(checkIndex, argCount) {
- return _pureExpressionDef(32 /* TypePureArray */, checkIndex, new Array(argCount));
- }
- /**
- * @param {?} checkIndex
- * @param {?} propToIndex
- * @return {?}
- */
- function pureObjectDef(checkIndex, propToIndex) {
- var /** @type {?} */ keys = Object.keys(propToIndex);
- var /** @type {?} */ nbKeys = keys.length;
- var /** @type {?} */ propertyNames = new Array(nbKeys);
- for (var /** @type {?} */ i = 0; i < nbKeys; i++) {
- var /** @type {?} */ key = keys[i];
- var /** @type {?} */ index = propToIndex[key];
- propertyNames[index] = key;
- }
- return _pureExpressionDef(64 /* TypePureObject */, checkIndex, propertyNames);
- }
- /**
- * @param {?} flags
- * @param {?} checkIndex
- * @param {?} propertyNames
- * @return {?}
- */
- function _pureExpressionDef(flags, checkIndex, propertyNames) {
- var /** @type {?} */ bindings = new Array(propertyNames.length);
- for (var /** @type {?} */ i = 0; i < propertyNames.length; i++) {
- var /** @type {?} */ prop = propertyNames[i];
- bindings[i] = {
- flags: 8 /* TypeProperty */,
- name: prop,
- ns: null,
- nonMinifiedName: prop,
- securityContext: null,
- suffix: null
- };
- }
- return {
- // will bet set by the view definition
- nodeIndex: -1,
- parent: null,
- renderParent: null,
- bindingIndex: -1,
- outputIndex: -1,
- // regular values
- checkIndex: checkIndex,
- flags: flags,
- childFlags: 0,
- directChildFlags: 0,
- childMatchedQueries: 0,
- matchedQueries: {},
- matchedQueryIds: 0,
- references: {},
- ngContentIndex: -1,
- childCount: 0, bindings: bindings,
- bindingFlags: calcBindingFlags(bindings),
- outputs: [],
- element: null,
- provider: null,
- text: null,
- query: null,
- ngContent: null
- };
- }
- /**
- * @param {?} view
- * @param {?} def
- * @return {?}
- */
- function createPureExpression(view, def) {
- return { value: undefined };
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} v0
- * @param {?} v1
- * @param {?} v2
- * @param {?} v3
- * @param {?} v4
- * @param {?} v5
- * @param {?} v6
- * @param {?} v7
- * @param {?} v8
- * @param {?} v9
- * @return {?}
- */
- function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- var /** @type {?} */ bindings = def.bindings;
- var /** @type {?} */ changed = false;
- var /** @type {?} */ bindLen = bindings.length;
- if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
- changed = true;
- if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
- changed = true;
- if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
- changed = true;
- if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
- changed = true;
- if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
- changed = true;
- if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
- changed = true;
- if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
- changed = true;
- if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
- changed = true;
- if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
- changed = true;
- if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
- changed = true;
- if (changed) {
- var /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex);
- var /** @type {?} */ value = void 0;
- switch (def.flags & 201347067 /* Types */) {
- case 32 /* TypePureArray */:
- value = new Array(bindings.length);
- if (bindLen > 0)
- value[0] = v0;
- if (bindLen > 1)
- value[1] = v1;
- if (bindLen > 2)
- value[2] = v2;
- if (bindLen > 3)
- value[3] = v3;
- if (bindLen > 4)
- value[4] = v4;
- if (bindLen > 5)
- value[5] = v5;
- if (bindLen > 6)
- value[6] = v6;
- if (bindLen > 7)
- value[7] = v7;
- if (bindLen > 8)
- value[8] = v8;
- if (bindLen > 9)
- value[9] = v9;
- break;
- case 64 /* TypePureObject */:
- value = {};
- if (bindLen > 0)
- value[/** @type {?} */ ((bindings[0].name))] = v0;
- if (bindLen > 1)
- value[/** @type {?} */ ((bindings[1].name))] = v1;
- if (bindLen > 2)
- value[/** @type {?} */ ((bindings[2].name))] = v2;
- if (bindLen > 3)
- value[/** @type {?} */ ((bindings[3].name))] = v3;
- if (bindLen > 4)
- value[/** @type {?} */ ((bindings[4].name))] = v4;
- if (bindLen > 5)
- value[/** @type {?} */ ((bindings[5].name))] = v5;
- if (bindLen > 6)
- value[/** @type {?} */ ((bindings[6].name))] = v6;
- if (bindLen > 7)
- value[/** @type {?} */ ((bindings[7].name))] = v7;
- if (bindLen > 8)
- value[/** @type {?} */ ((bindings[8].name))] = v8;
- if (bindLen > 9)
- value[/** @type {?} */ ((bindings[9].name))] = v9;
- break;
- case 128 /* TypePurePipe */:
- var /** @type {?} */ pipe = v0;
- switch (bindLen) {
- case 1:
- value = pipe.transform(v0);
- break;
- case 2:
- value = pipe.transform(v1);
- break;
- case 3:
- value = pipe.transform(v1, v2);
- break;
- case 4:
- value = pipe.transform(v1, v2, v3);
- break;
- case 5:
- value = pipe.transform(v1, v2, v3, v4);
- break;
- case 6:
- value = pipe.transform(v1, v2, v3, v4, v5);
- break;
- case 7:
- value = pipe.transform(v1, v2, v3, v4, v5, v6);
- break;
- case 8:
- value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
- break;
- case 9:
- value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
- break;
- case 10:
- value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
- break;
- }
- break;
- }
- data.value = value;
- }
- return changed;
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} values
- * @return {?}
- */
- function checkAndUpdatePureExpressionDynamic(view, def, values) {
- var /** @type {?} */ bindings = def.bindings;
- var /** @type {?} */ changed = false;
- for (var /** @type {?} */ i = 0; i < values.length; i++) {
- // Note: We need to loop over all values, so that
- // the old values are updates as well!
- if (checkAndUpdateBinding(view, def, i, values[i])) {
- changed = true;
- }
- }
- if (changed) {
- var /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex);
- var /** @type {?} */ value = void 0;
- switch (def.flags & 201347067 /* Types */) {
- case 32 /* TypePureArray */:
- value = values;
- break;
- case 64 /* TypePureObject */:
- value = {};
- for (var /** @type {?} */ i = 0; i < values.length; i++) {
- value[/** @type {?} */ ((bindings[i].name))] = values[i];
- }
- break;
- case 128 /* TypePurePipe */:
- var /** @type {?} */ pipe = values[0];
- var /** @type {?} */ params = values.slice(1);
- value = pipe.transform.apply(pipe, params);
- break;
- }
- data.value = value;
- }
- return changed;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} checkIndex
- * @param {?} ngContentIndex
- * @param {?} staticText
- * @return {?}
- */
- function textDef(checkIndex, ngContentIndex, staticText) {
- var /** @type {?} */ bindings = new Array(staticText.length - 1);
- for (var /** @type {?} */ i = 1; i < staticText.length; i++) {
- bindings[i - 1] = {
- flags: 8 /* TypeProperty */,
- name: null,
- ns: null,
- nonMinifiedName: null,
- securityContext: null,
- suffix: staticText[i],
- };
- }
- return {
- // will bet set by the view definition
- nodeIndex: -1,
- parent: null,
- renderParent: null,
- bindingIndex: -1,
- outputIndex: -1,
- // regular values
- checkIndex: checkIndex,
- flags: 2 /* TypeText */,
- childFlags: 0,
- directChildFlags: 0,
- childMatchedQueries: 0,
- matchedQueries: {},
- matchedQueryIds: 0,
- references: {}, ngContentIndex: ngContentIndex,
- childCount: 0, bindings: bindings,
- bindingFlags: 8 /* TypeProperty */,
- outputs: [],
- element: null,
- provider: null,
- text: { prefix: staticText[0] },
- query: null,
- ngContent: null,
- };
- }
- /**
- * @param {?} view
- * @param {?} renderHost
- * @param {?} def
- * @return {?}
- */
- function createText(view, renderHost, def) {
- var /** @type {?} */ renderNode$$1;
- var /** @type {?} */ renderer = view.renderer;
- renderNode$$1 = renderer.createText(/** @type {?} */ ((def.text)).prefix);
- var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
- if (parentEl) {
- renderer.appendChild(parentEl, renderNode$$1);
- }
- return { renderText: renderNode$$1 };
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} v0
- * @param {?} v1
- * @param {?} v2
- * @param {?} v3
- * @param {?} v4
- * @param {?} v5
- * @param {?} v6
- * @param {?} v7
- * @param {?} v8
- * @param {?} v9
- * @return {?}
- */
- function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- var /** @type {?} */ changed = false;
- var /** @type {?} */ bindings = def.bindings;
- var /** @type {?} */ bindLen = bindings.length;
- if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
- changed = true;
- if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
- changed = true;
- if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
- changed = true;
- if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
- changed = true;
- if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
- changed = true;
- if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
- changed = true;
- if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
- changed = true;
- if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
- changed = true;
- if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
- changed = true;
- if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
- changed = true;
- if (changed) {
- var /** @type {?} */ value = /** @type {?} */ ((def.text)).prefix;
- if (bindLen > 0)
- value += _addInterpolationPart(v0, bindings[0]);
- if (bindLen > 1)
- value += _addInterpolationPart(v1, bindings[1]);
- if (bindLen > 2)
- value += _addInterpolationPart(v2, bindings[2]);
- if (bindLen > 3)
- value += _addInterpolationPart(v3, bindings[3]);
- if (bindLen > 4)
- value += _addInterpolationPart(v4, bindings[4]);
- if (bindLen > 5)
- value += _addInterpolationPart(v5, bindings[5]);
- if (bindLen > 6)
- value += _addInterpolationPart(v6, bindings[6]);
- if (bindLen > 7)
- value += _addInterpolationPart(v7, bindings[7]);
- if (bindLen > 8)
- value += _addInterpolationPart(v8, bindings[8]);
- if (bindLen > 9)
- value += _addInterpolationPart(v9, bindings[9]);
- var /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
- view.renderer.setValue(renderNode$$1, value);
- }
- return changed;
- }
- /**
- * @param {?} view
- * @param {?} def
- * @param {?} values
- * @return {?}
- */
- function checkAndUpdateTextDynamic(view, def, values) {
- var /** @type {?} */ bindings = def.bindings;
- var /** @type {?} */ changed = false;
- for (var /** @type {?} */ i = 0; i < values.length; i++) {
- // Note: We need to loop over all values, so that
- // the old values are updates as well!
- if (checkAndUpdateBinding(view, def, i, values[i])) {
- changed = true;
- }
- }
- if (changed) {
- var /** @type {?} */ value = '';
- for (var /** @type {?} */ i = 0; i < values.length; i++) {
- value = value + _addInterpolationPart(values[i], bindings[i]);
- }
- value = /** @type {?} */ ((def.text)).prefix + value;
- var /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
- view.renderer.setValue(renderNode$$1, value);
- }
- return changed;
- }
- /**
- * @param {?} value
- * @param {?} binding
- * @return {?}
- */
- function _addInterpolationPart(value, binding) {
- var /** @type {?} */ valueStr = value != null ? value.toString() : '';
- return valueStr + binding.suffix;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} flags
- * @param {?} nodes
- * @param {?=} updateDirectives
- * @param {?=} updateRenderer
- * @return {?}
- */
- function viewDef(flags, nodes, updateDirectives, updateRenderer) {
- // clone nodes and set auto calculated values
- var /** @type {?} */ viewBindingCount = 0;
- var /** @type {?} */ viewDisposableCount = 0;
- var /** @type {?} */ viewNodeFlags = 0;
- var /** @type {?} */ viewRootNodeFlags = 0;
- var /** @type {?} */ viewMatchedQueries = 0;
- var /** @type {?} */ currentParent = null;
- var /** @type {?} */ currentRenderParent = null;
- var /** @type {?} */ currentElementHasPublicProviders = false;
- var /** @type {?} */ currentElementHasPrivateProviders = false;
- var /** @type {?} */ lastRenderRootNode = null;
- for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
- var /** @type {?} */ node = nodes[i];
- node.nodeIndex = i;
- node.parent = currentParent;
- node.bindingIndex = viewBindingCount;
- node.outputIndex = viewDisposableCount;
- node.renderParent = currentRenderParent;
- viewNodeFlags |= node.flags;
- viewMatchedQueries |= node.matchedQueryIds;
- if (node.element) {
- var /** @type {?} */ elDef = node.element;
- elDef.publicProviders =
- currentParent ? /** @type {?} */ ((currentParent.element)).publicProviders : Object.create(null);
- elDef.allProviders = elDef.publicProviders;
- // Note: We assume that all providers of an element are before any child element!
- currentElementHasPublicProviders = false;
- currentElementHasPrivateProviders = false;
- if (node.element.template) {
- viewMatchedQueries |= node.element.template.nodeMatchedQueries;
- }
- }
- validateNode(currentParent, node, nodes.length);
- viewBindingCount += node.bindings.length;
- viewDisposableCount += node.outputs.length;
- if (!currentRenderParent && (node.flags & 3 /* CatRenderNode */)) {
- lastRenderRootNode = node;
- }
- if (node.flags & 20224 /* CatProvider */) {
- if (!currentElementHasPublicProviders) {
- currentElementHasPublicProviders = true; /** @type {?} */
- ((/** @type {?} */ ((currentParent)).element)).publicProviders = Object.create(/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders); /** @type {?} */
- ((/** @type {?} */ ((currentParent)).element)).allProviders = /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders;
- }
- var /** @type {?} */ isPrivateService = (node.flags & 8192 /* PrivateProvider */) !== 0;
- var /** @type {?} */ isComponent = (node.flags & 32768 /* Component */) !== 0;
- if (!isPrivateService || isComponent) {
- /** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
- }
- else {
- if (!currentElementHasPrivateProviders) {
- currentElementHasPrivateProviders = true; /** @type {?} */
- ((/** @type {?} */ ((currentParent)).element)).allProviders = Object.create(/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders);
- } /** @type {?} */
- ((/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).allProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
- }
- if (isComponent) {
- /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).componentProvider = node;
- }
- }
- if (currentParent) {
- currentParent.childFlags |= node.flags;
- currentParent.directChildFlags |= node.flags;
- currentParent.childMatchedQueries |= node.matchedQueryIds;
- if (node.element && node.element.template) {
- currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
- }
- }
- else {
- viewRootNodeFlags |= node.flags;
- }
- if (node.childCount > 0) {
- currentParent = node;
- if (!isNgContainer(node)) {
- currentRenderParent = node;
- }
- }
- else {
- // When the current node has no children, check if it is the last children of its parent.
- // When it is, propagate the flags up.
- // The loop is required because an element could be the last transitive children of several
- // elements. We loop to either the root or the highest opened element (= with remaining
- // children)
- while (currentParent && i === currentParent.nodeIndex + currentParent.childCount) {
- var /** @type {?} */ newParent = currentParent.parent;
- if (newParent) {
- newParent.childFlags |= currentParent.childFlags;
- newParent.childMatchedQueries |= currentParent.childMatchedQueries;
- }
- currentParent = newParent;
- // We also need to update the render parent & account for ng-container
- if (currentParent && isNgContainer(currentParent)) {
- currentRenderParent = currentParent.renderParent;
- }
- else {
- currentRenderParent = currentParent;
- }
- }
- }
- }
- var /** @type {?} */ handleEvent = function (view, nodeIndex, eventName, event) { return ((/** @type {?} */ ((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); };
- return {
- // Will be filled later...
- factory: null,
- nodeFlags: viewNodeFlags,
- rootNodeFlags: viewRootNodeFlags,
- nodeMatchedQueries: viewMatchedQueries, flags: flags,
- nodes: nodes,
- updateDirectives: updateDirectives || NOOP,
- updateRenderer: updateRenderer || NOOP, handleEvent: handleEvent,
- bindingCount: viewBindingCount,
- outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode
- };
- }
- /**
- * @param {?} node
- * @return {?}
- */
- function isNgContainer(node) {
- return (node.flags & 1 /* TypeElement */) !== 0 && /** @type {?} */ ((node.element)).name === null;
- }
- /**
- * @param {?} parent
- * @param {?} node
- * @param {?} nodeCount
- * @return {?}
- */
- function validateNode(parent, node, nodeCount) {
- var /** @type {?} */ template = node.element && node.element.template;
- if (template) {
- if (!template.lastRenderRootNode) {
- throw new Error("Illegal State: Embedded templates without nodes are not allowed!");
- }
- if (template.lastRenderRootNode &&
- template.lastRenderRootNode.flags & 16777216 /* EmbeddedViews */) {
- throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.nodeIndex + "!");
- }
- }
- if (node.flags & 20224 /* CatProvider */) {
- var /** @type {?} */ parentFlags = parent ? parent.flags : 0;
- if ((parentFlags & 1 /* TypeElement */) === 0) {
- throw new Error("Illegal State: StaticProvider/Directive nodes need to be children of elements or anchors, at index " + node.nodeIndex + "!");
- }
- }
- if (node.query) {
- if (node.flags & 67108864 /* TypeContentQuery */ &&
- (!parent || (parent.flags & 16384 /* TypeDirective */) === 0)) {
- throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.nodeIndex + "!");
- }
- if (node.flags & 134217728 /* TypeViewQuery */ && parent) {
- throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.nodeIndex + "!");
- }
- }
- if (node.childCount) {
- var /** @type {?} */ parentEnd = parent ? parent.nodeIndex + parent.childCount : nodeCount - 1;
- if (node.nodeIndex <= parentEnd && node.nodeIndex + node.childCount > parentEnd) {
- throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.nodeIndex + "!");
- }
- }
- }
- /**
- * @param {?} parent
- * @param {?} anchorDef
- * @param {?} viewDef
- * @param {?=} context
- * @return {?}
- */
- function createEmbeddedView(parent, anchorDef$$1, viewDef, context) {
- // embedded views are seen as siblings to the anchor, so we need
- // to get the parent of the anchor and use it as parentIndex.
- var /** @type {?} */ view = createView(parent.root, parent.renderer, parent, anchorDef$$1, viewDef);
- initView(view, parent.component, context);
- createViewNodes(view);
- return view;
- }
- /**
- * @param {?} root
- * @param {?} def
- * @param {?=} context
- * @return {?}
- */
- function createRootView(root, def, context) {
- var /** @type {?} */ view = createView(root, root.renderer, null, null, def);
- initView(view, context, context);
- createViewNodes(view);
- return view;
- }
- /**
- * @param {?} parentView
- * @param {?} nodeDef
- * @param {?} viewDef
- * @param {?} hostElement
- * @return {?}
- */
- function createComponentView(parentView, nodeDef, viewDef, hostElement) {
- var /** @type {?} */ rendererType = /** @type {?} */ ((nodeDef.element)).componentRendererType;
- var /** @type {?} */ compRenderer;
- if (!rendererType) {
- compRenderer = parentView.root.renderer;
- }
- else {
- compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType);
- }
- return createView(parentView.root, compRenderer, parentView, /** @type {?} */ ((nodeDef.element)).componentProvider, viewDef);
- }
- /**
- * @param {?} root
- * @param {?} renderer
- * @param {?} parent
- * @param {?} parentNodeDef
- * @param {?} def
- * @return {?}
- */
- function createView(root, renderer, parent, parentNodeDef, def) {
- var /** @type {?} */ nodes = new Array(def.nodes.length);
- var /** @type {?} */ disposables = def.outputCount ? new Array(def.outputCount) : null;
- var /** @type {?} */ view = {
- def: def,
- parent: parent,
- viewContainerParent: null, parentNodeDef: parentNodeDef,
- context: null,
- component: null, nodes: nodes,
- state: 13 /* CatInit */, root: root, renderer: renderer,
- oldValues: new Array(def.bindingCount), disposables: disposables,
- initIndex: -1
- };
- return view;
- }
- /**
- * @param {?} view
- * @param {?} component
- * @param {?} context
- * @return {?}
- */
- function initView(view, component, context) {
- view.component = component;
- view.context = context;
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function createViewNodes(view) {
- var /** @type {?} */ renderHost;
- if (isComponentView(view)) {
- var /** @type {?} */ hostDef = view.parentNodeDef;
- renderHost = asElementData(/** @type {?} */ ((view.parent)), /** @type {?} */ ((/** @type {?} */ ((hostDef)).parent)).nodeIndex).renderElement;
- }
- var /** @type {?} */ def = view.def;
- var /** @type {?} */ nodes = view.nodes;
- for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
- var /** @type {?} */ nodeDef = def.nodes[i];
- Services.setCurrentNode(view, i);
- var /** @type {?} */ nodeData = void 0;
- switch (nodeDef.flags & 201347067 /* Types */) {
- case 1 /* TypeElement */:
- var /** @type {?} */ el = /** @type {?} */ (createElement(view, renderHost, nodeDef));
- var /** @type {?} */ componentView = /** @type {?} */ ((undefined));
- if (nodeDef.flags & 33554432 /* ComponentView */) {
- var /** @type {?} */ compViewDef = resolveDefinition(/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).componentView)));
- componentView = Services.createComponentView(view, nodeDef, compViewDef, el);
- }
- listenToElementOutputs(view, componentView, nodeDef, el);
- nodeData = /** @type {?} */ ({
- renderElement: el,
- componentView: componentView,
- viewContainer: null,
- template: /** @type {?} */ ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined
- });
- if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
- nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
- }
- break;
- case 2 /* TypeText */:
- nodeData = /** @type {?} */ (createText(view, renderHost, nodeDef));
- break;
- case 512 /* TypeClassProvider */:
- case 1024 /* TypeFactoryProvider */:
- case 2048 /* TypeUseExistingProvider */:
- case 256 /* TypeValueProvider */: {
- nodeData = nodes[i];
- if (!nodeData && !(nodeDef.flags & 4096 /* LazyProvider */)) {
- var /** @type {?} */ instance = createProviderInstance(view, nodeDef);
- nodeData = /** @type {?} */ ({ instance: instance });
- }
- break;
- }
- case 16 /* TypePipe */: {
- var /** @type {?} */ instance = createPipeInstance(view, nodeDef);
- nodeData = /** @type {?} */ ({ instance: instance });
- break;
- }
- case 16384 /* TypeDirective */: {
- nodeData = nodes[i];
- if (!nodeData) {
- var /** @type {?} */ instance = createDirectiveInstance(view, nodeDef);
- nodeData = /** @type {?} */ ({ instance: instance });
- }
- if (nodeDef.flags & 32768 /* Component */) {
- var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).componentView;
- initView(compView, nodeData.instance, nodeData.instance);
- }
- break;
- }
- case 32 /* TypePureArray */:
- case 64 /* TypePureObject */:
- case 128 /* TypePurePipe */:
- nodeData = /** @type {?} */ (createPureExpression(view, nodeDef));
- break;
- case 67108864 /* TypeContentQuery */:
- case 134217728 /* TypeViewQuery */:
- nodeData = /** @type {?} */ (createQuery());
- break;
- case 8 /* TypeNgContent */:
- appendNgContent(view, renderHost, nodeDef);
- // no runtime data needed for NgContent...
- nodeData = undefined;
- break;
- }
- nodes[i] = nodeData;
- }
- // Create the ViewData.nodes of component views after we created everything else,
- // so that e.g. ng-content works
- execComponentViewsAction(view, ViewAction.CreateViewNodes);
- // fill static content and view queries
- execQueriesAction(view, 67108864 /* TypeContentQuery */ | 134217728 /* TypeViewQuery */, 268435456 /* StaticQuery */, 0 /* CheckAndUpdate */);
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function checkNoChangesView(view) {
- markProjectedViewsForCheck(view);
- Services.updateDirectives(view, 1 /* CheckNoChanges */);
- execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
- Services.updateRenderer(view, 1 /* CheckNoChanges */);
- execComponentViewsAction(view, ViewAction.CheckNoChanges);
- // Note: We don't check queries for changes as we didn't do this in v2.x.
- // TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message.
- view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function checkAndUpdateView(view) {
- if (view.state & 1 /* BeforeFirstCheck */) {
- view.state &= ~1 /* BeforeFirstCheck */;
- view.state |= 2 /* FirstCheck */;
- }
- else {
- view.state &= ~2 /* FirstCheck */;
- }
- shiftInitState(view, 0 /* InitState_BeforeInit */, 256 /* InitState_CallingOnInit */);
- markProjectedViewsForCheck(view);
- Services.updateDirectives(view, 0 /* CheckAndUpdate */);
- execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
- execQueriesAction(view, 67108864 /* TypeContentQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
- var /** @type {?} */ callInit = shiftInitState(view, 256 /* InitState_CallingOnInit */, 512 /* InitState_CallingAfterContentInit */);
- callLifecycleHooksChildrenFirst(view, 2097152 /* AfterContentChecked */ | (callInit ? 1048576 /* AfterContentInit */ : 0));
- Services.updateRenderer(view, 0 /* CheckAndUpdate */);
- execComponentViewsAction(view, ViewAction.CheckAndUpdate);
- execQueriesAction(view, 134217728 /* TypeViewQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
- callInit = shiftInitState(view, 512 /* InitState_CallingAfterContentInit */, 768 /* InitState_CallingAfterViewInit */);
- callLifecycleHooksChildrenFirst(view, 8388608 /* AfterViewChecked */ | (callInit ? 4194304 /* AfterViewInit */ : 0));
- if (view.def.flags & 2 /* OnPush */) {
- view.state &= ~8 /* ChecksEnabled */;
- }
- view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
- shiftInitState(view, 768 /* InitState_CallingAfterViewInit */, 1024 /* InitState_AfterInit */);
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} argStyle
- * @param {?=} v0
- * @param {?=} v1
- * @param {?=} v2
- * @param {?=} v3
- * @param {?=} v4
- * @param {?=} v5
- * @param {?=} v6
- * @param {?=} v7
- * @param {?=} v8
- * @param {?=} v9
- * @return {?}
- */
- function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- if (argStyle === 0 /* Inline */) {
- return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
- }
- else {
- return checkAndUpdateNodeDynamic(view, nodeDef, v0);
- }
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function markProjectedViewsForCheck(view) {
- var /** @type {?} */ def = view.def;
- if (!(def.nodeFlags & 4 /* ProjectedTemplate */)) {
- return;
- }
- for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
- var /** @type {?} */ nodeDef = def.nodes[i];
- if (nodeDef.flags & 4 /* ProjectedTemplate */) {
- var /** @type {?} */ projectedViews = asElementData(view, i).template._projectedViews;
- if (projectedViews) {
- for (var /** @type {?} */ i_1 = 0; i_1 < projectedViews.length; i_1++) {
- var /** @type {?} */ projectedView = projectedViews[i_1];
- projectedView.state |= 32 /* CheckProjectedView */;
- markParentViewsForCheckProjectedViews(projectedView, view);
- }
- }
- }
- else if ((nodeDef.childFlags & 4 /* ProjectedTemplate */) === 0) {
- // a parent with leafs
- // no child is a component,
- // then skip the children
- i += nodeDef.childCount;
- }
- }
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?=} v0
- * @param {?=} v1
- * @param {?=} v2
- * @param {?=} v3
- * @param {?=} v4
- * @param {?=} v5
- * @param {?=} v6
- * @param {?=} v7
- * @param {?=} v8
- * @param {?=} v9
- * @return {?}
- */
- function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- switch (nodeDef.flags & 201347067 /* Types */) {
- case 1 /* TypeElement */:
- return checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
- case 2 /* TypeText */:
- return checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
- case 16384 /* TypeDirective */:
- return checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
- case 32 /* TypePureArray */:
- case 64 /* TypePureObject */:
- case 128 /* TypePurePipe */:
- return checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
- default:
- throw 'unreachable';
- }
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} values
- * @return {?}
- */
- function checkAndUpdateNodeDynamic(view, nodeDef, values) {
- switch (nodeDef.flags & 201347067 /* Types */) {
- case 1 /* TypeElement */:
- return checkAndUpdateElementDynamic(view, nodeDef, values);
- case 2 /* TypeText */:
- return checkAndUpdateTextDynamic(view, nodeDef, values);
- case 16384 /* TypeDirective */:
- return checkAndUpdateDirectiveDynamic(view, nodeDef, values);
- case 32 /* TypePureArray */:
- case 64 /* TypePureObject */:
- case 128 /* TypePurePipe */:
- return checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
- default:
- throw 'unreachable';
- }
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} argStyle
- * @param {?=} v0
- * @param {?=} v1
- * @param {?=} v2
- * @param {?=} v3
- * @param {?=} v4
- * @param {?=} v5
- * @param {?=} v6
- * @param {?=} v7
- * @param {?=} v8
- * @param {?=} v9
- * @return {?}
- */
- function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- if (argStyle === 0 /* Inline */) {
- checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
- }
- else {
- checkNoChangesNodeDynamic(view, nodeDef, v0);
- }
- // Returning false is ok here as we would have thrown in case of a change.
- return false;
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} v0
- * @param {?} v1
- * @param {?} v2
- * @param {?} v3
- * @param {?} v4
- * @param {?} v5
- * @param {?} v6
- * @param {?} v7
- * @param {?} v8
- * @param {?} v9
- * @return {?}
- */
- function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- var /** @type {?} */ bindLen = nodeDef.bindings.length;
- if (bindLen > 0)
- checkBindingNoChanges(view, nodeDef, 0, v0);
- if (bindLen > 1)
- checkBindingNoChanges(view, nodeDef, 1, v1);
- if (bindLen > 2)
- checkBindingNoChanges(view, nodeDef, 2, v2);
- if (bindLen > 3)
- checkBindingNoChanges(view, nodeDef, 3, v3);
- if (bindLen > 4)
- checkBindingNoChanges(view, nodeDef, 4, v4);
- if (bindLen > 5)
- checkBindingNoChanges(view, nodeDef, 5, v5);
- if (bindLen > 6)
- checkBindingNoChanges(view, nodeDef, 6, v6);
- if (bindLen > 7)
- checkBindingNoChanges(view, nodeDef, 7, v7);
- if (bindLen > 8)
- checkBindingNoChanges(view, nodeDef, 8, v8);
- if (bindLen > 9)
- checkBindingNoChanges(view, nodeDef, 9, v9);
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} values
- * @return {?}
- */
- function checkNoChangesNodeDynamic(view, nodeDef, values) {
- for (var /** @type {?} */ i = 0; i < values.length; i++) {
- checkBindingNoChanges(view, nodeDef, i, values[i]);
- }
- }
- /**
- * Workaround https://github.com/angular/tsickle/issues/497
- * @suppress {misplacedTypeAnnotation}
- * @param {?} view
- * @param {?} nodeDef
- * @return {?}
- */
- function checkNoChangesQuery(view, nodeDef) {
- var /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex);
- if (queryList.dirty) {
- 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);
- }
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function destroyView(view) {
- if (view.state & 128 /* Destroyed */) {
- return;
- }
- execEmbeddedViewsAction(view, ViewAction.Destroy);
- execComponentViewsAction(view, ViewAction.Destroy);
- callLifecycleHooksChildrenFirst(view, 131072 /* OnDestroy */);
- if (view.disposables) {
- for (var /** @type {?} */ i = 0; i < view.disposables.length; i++) {
- view.disposables[i]();
- }
- }
- detachProjectedView(view);
- if (view.renderer.destroyNode) {
- destroyViewNodes(view);
- }
- if (isComponentView(view)) {
- view.renderer.destroy();
- }
- view.state |= 128 /* Destroyed */;
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function destroyViewNodes(view) {
- var /** @type {?} */ len = view.def.nodes.length;
- for (var /** @type {?} */ i = 0; i < len; i++) {
- var /** @type {?} */ def = view.def.nodes[i];
- if (def.flags & 1 /* TypeElement */) {
- /** @type {?} */ ((view.renderer.destroyNode))(asElementData(view, i).renderElement);
- }
- else if (def.flags & 2 /* TypeText */) {
- /** @type {?} */ ((view.renderer.destroyNode))(asTextData(view, i).renderText);
- }
- else if (def.flags & 67108864 /* TypeContentQuery */ || def.flags & 134217728 /* TypeViewQuery */) {
- asQueryList(view, i).destroy();
- }
- }
- }
- /** @enum {number} */
- var ViewAction = {
- CreateViewNodes: 0,
- CheckNoChanges: 1,
- CheckNoChangesProjectedViews: 2,
- CheckAndUpdate: 3,
- CheckAndUpdateProjectedViews: 4,
- Destroy: 5,
- };
- ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes";
- ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges";
- ViewAction[ViewAction.CheckNoChangesProjectedViews] = "CheckNoChangesProjectedViews";
- ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate";
- ViewAction[ViewAction.CheckAndUpdateProjectedViews] = "CheckAndUpdateProjectedViews";
- ViewAction[ViewAction.Destroy] = "Destroy";
- /**
- * @param {?} view
- * @param {?} action
- * @return {?}
- */
- function execComponentViewsAction(view, action) {
- var /** @type {?} */ def = view.def;
- if (!(def.nodeFlags & 33554432 /* ComponentView */)) {
- return;
- }
- for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
- var /** @type {?} */ nodeDef = def.nodes[i];
- if (nodeDef.flags & 33554432 /* ComponentView */) {
- // a leaf
- callViewAction(asElementData(view, i).componentView, action);
- }
- else if ((nodeDef.childFlags & 33554432 /* ComponentView */) === 0) {
- // a parent with leafs
- // no child is a component,
- // then skip the children
- i += nodeDef.childCount;
- }
- }
- }
- /**
- * @param {?} view
- * @param {?} action
- * @return {?}
- */
- function execEmbeddedViewsAction(view, action) {
- var /** @type {?} */ def = view.def;
- if (!(def.nodeFlags & 16777216 /* EmbeddedViews */)) {
- return;
- }
- for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
- var /** @type {?} */ nodeDef = def.nodes[i];
- if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
- // a leaf
- var /** @type {?} */ embeddedViews = /** @type {?} */ ((asElementData(view, i).viewContainer))._embeddedViews;
- for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
- callViewAction(embeddedViews[k], action);
- }
- }
- else if ((nodeDef.childFlags & 16777216 /* EmbeddedViews */) === 0) {
- // a parent with leafs
- // no child is a component,
- // then skip the children
- i += nodeDef.childCount;
- }
- }
- }
- /**
- * @param {?} view
- * @param {?} action
- * @return {?}
- */
- function callViewAction(view, action) {
- var /** @type {?} */ viewState = view.state;
- switch (action) {
- case ViewAction.CheckNoChanges:
- if ((viewState & 128 /* Destroyed */) === 0) {
- if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
- checkNoChangesView(view);
- }
- else if (viewState & 64 /* CheckProjectedViews */) {
- execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews);
- }
- }
- break;
- case ViewAction.CheckNoChangesProjectedViews:
- if ((viewState & 128 /* Destroyed */) === 0) {
- if (viewState & 32 /* CheckProjectedView */) {
- checkNoChangesView(view);
- }
- else if (viewState & 64 /* CheckProjectedViews */) {
- execProjectedViewsAction(view, action);
- }
- }
- break;
- case ViewAction.CheckAndUpdate:
- if ((viewState & 128 /* Destroyed */) === 0) {
- if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
- checkAndUpdateView(view);
- }
- else if (viewState & 64 /* CheckProjectedViews */) {
- execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews);
- }
- }
- break;
- case ViewAction.CheckAndUpdateProjectedViews:
- if ((viewState & 128 /* Destroyed */) === 0) {
- if (viewState & 32 /* CheckProjectedView */) {
- checkAndUpdateView(view);
- }
- else if (viewState & 64 /* CheckProjectedViews */) {
- execProjectedViewsAction(view, action);
- }
- }
- break;
- case ViewAction.Destroy:
- // Note: destroyView recurses over all views,
- // so we don't need to special case projected views here.
- destroyView(view);
- break;
- case ViewAction.CreateViewNodes:
- createViewNodes(view);
- break;
- }
- }
- /**
- * @param {?} view
- * @param {?} action
- * @return {?}
- */
- function execProjectedViewsAction(view, action) {
- execEmbeddedViewsAction(view, action);
- execComponentViewsAction(view, action);
- }
- /**
- * @param {?} view
- * @param {?} queryFlags
- * @param {?} staticDynamicQueryFlag
- * @param {?} checkType
- * @return {?}
- */
- function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
- if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
- return;
- }
- var /** @type {?} */ nodeCount = view.def.nodes.length;
- for (var /** @type {?} */ i = 0; i < nodeCount; i++) {
- var /** @type {?} */ nodeDef = view.def.nodes[i];
- if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
- Services.setCurrentNode(view, nodeDef.nodeIndex);
- switch (checkType) {
- case 0 /* CheckAndUpdate */:
- checkAndUpdateQuery(view, nodeDef);
- break;
- case 1 /* CheckNoChanges */:
- checkNoChangesQuery(view, nodeDef);
- break;
- }
- }
- if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
- // no child has a matching query
- // then skip the children
- i += nodeDef.childCount;
- }
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var initialized = false;
- /**
- * @return {?}
- */
- function initServicesIfNeeded() {
- if (initialized) {
- return;
- }
- initialized = true;
- var /** @type {?} */ services = isDevMode() ? createDebugServices() : createProdServices();
- Services.setCurrentNode = services.setCurrentNode;
- Services.createRootView = services.createRootView;
- Services.createEmbeddedView = services.createEmbeddedView;
- Services.createComponentView = services.createComponentView;
- Services.createNgModuleRef = services.createNgModuleRef;
- Services.overrideProvider = services.overrideProvider;
- Services.overrideComponentView = services.overrideComponentView;
- Services.clearOverrides = services.clearOverrides;
- Services.checkAndUpdateView = services.checkAndUpdateView;
- Services.checkNoChangesView = services.checkNoChangesView;
- Services.destroyView = services.destroyView;
- Services.resolveDep = resolveDep;
- Services.createDebugContext = services.createDebugContext;
- Services.handleEvent = services.handleEvent;
- Services.updateDirectives = services.updateDirectives;
- Services.updateRenderer = services.updateRenderer;
- Services.dirtyParentQueries = dirtyParentQueries;
- }
- /**
- * @return {?}
- */
- function createProdServices() {
- return {
- setCurrentNode: function () { },
- createRootView: createProdRootView,
- createEmbeddedView: createEmbeddedView,
- createComponentView: createComponentView,
- createNgModuleRef: createNgModuleRef,
- overrideProvider: NOOP,
- overrideComponentView: NOOP,
- clearOverrides: NOOP,
- checkAndUpdateView: checkAndUpdateView,
- checkNoChangesView: checkNoChangesView,
- destroyView: destroyView,
- createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
- handleEvent: function (view, nodeIndex, eventName, event) {
- return view.def.handleEvent(view, nodeIndex, eventName, event);
- },
- updateDirectives: function (view, checkType) {
- return view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
- prodCheckNoChangesNode, view);
- },
- updateRenderer: function (view, checkType) {
- return view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
- prodCheckNoChangesNode, view);
- },
- };
- }
- /**
- * @return {?}
- */
- function createDebugServices() {
- return {
- setCurrentNode: debugSetCurrentNode,
- createRootView: debugCreateRootView,
- createEmbeddedView: debugCreateEmbeddedView,
- createComponentView: debugCreateComponentView,
- createNgModuleRef: debugCreateNgModuleRef,
- overrideProvider: debugOverrideProvider,
- overrideComponentView: debugOverrideComponentView,
- clearOverrides: debugClearOverrides,
- checkAndUpdateView: debugCheckAndUpdateView,
- checkNoChangesView: debugCheckNoChangesView,
- destroyView: debugDestroyView,
- createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
- handleEvent: debugHandleEvent,
- updateDirectives: debugUpdateDirectives,
- updateRenderer: debugUpdateRenderer,
- };
- }
- /**
- * @param {?} elInjector
- * @param {?} projectableNodes
- * @param {?} rootSelectorOrNode
- * @param {?} def
- * @param {?} ngModule
- * @param {?=} context
- * @return {?}
- */
- function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
- var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
- return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
- }
- /**
- * @param {?} elInjector
- * @param {?} projectableNodes
- * @param {?} rootSelectorOrNode
- * @param {?} def
- * @param {?} ngModule
- * @param {?=} context
- * @return {?}
- */
- function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
- var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
- var /** @type {?} */ root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
- var /** @type {?} */ defWithOverride = applyProviderOverridesToView(def);
- return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]);
- }
- /**
- * @param {?} elInjector
- * @param {?} ngModule
- * @param {?} rendererFactory
- * @param {?} projectableNodes
- * @param {?} rootSelectorOrNode
- * @return {?}
- */
- function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
- var /** @type {?} */ sanitizer = ngModule.injector.get(Sanitizer);
- var /** @type {?} */ errorHandler = ngModule.injector.get(ErrorHandler);
- var /** @type {?} */ renderer = rendererFactory.createRenderer(null, null);
- return {
- ngModule: ngModule,
- injector: elInjector, projectableNodes: projectableNodes,
- selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler
- };
- }
- /**
- * @param {?} parentView
- * @param {?} anchorDef
- * @param {?} viewDef
- * @param {?=} context
- * @return {?}
- */
- function debugCreateEmbeddedView(parentView, anchorDef, viewDef$$1, context) {
- var /** @type {?} */ defWithOverride = applyProviderOverridesToView(viewDef$$1);
- return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]);
- }
- /**
- * @param {?} parentView
- * @param {?} nodeDef
- * @param {?} viewDef
- * @param {?} hostElement
- * @return {?}
- */
- function debugCreateComponentView(parentView, nodeDef, viewDef$$1, hostElement) {
- var /** @type {?} */ overrideComponentView = viewDefOverrides.get(/** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).componentProvider)).provider)).token);
- if (overrideComponentView) {
- viewDef$$1 = overrideComponentView;
- }
- else {
- viewDef$$1 = applyProviderOverridesToView(viewDef$$1);
- }
- return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, viewDef$$1, hostElement]);
- }
- /**
- * @param {?} moduleType
- * @param {?} parentInjector
- * @param {?} bootstrapComponents
- * @param {?} def
- * @return {?}
- */
- function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) {
- var /** @type {?} */ defWithOverride = applyProviderOverridesToNgModule(def);
- return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
- }
- var providerOverrides = new Map();
- var viewDefOverrides = new Map();
- /**
- * @param {?} override
- * @return {?}
- */
- function debugOverrideProvider(override) {
- providerOverrides.set(override.token, override);
- }
- /**
- * @param {?} comp
- * @param {?} compFactory
- * @return {?}
- */
- function debugOverrideComponentView(comp, compFactory) {
- var /** @type {?} */ hostViewDef = resolveDefinition(getComponentViewDefinitionFactory(compFactory));
- var /** @type {?} */ compViewDef = resolveDefinition(/** @type {?} */ ((/** @type {?} */ ((hostViewDef.nodes[0].element)).componentView)));
- viewDefOverrides.set(comp, compViewDef);
- }
- /**
- * @return {?}
- */
- function debugClearOverrides() {
- providerOverrides.clear();
- viewDefOverrides.clear();
- }
- /**
- * @param {?} def
- * @return {?}
- */
- function applyProviderOverridesToView(def) {
- if (providerOverrides.size === 0) {
- return def;
- }
- var /** @type {?} */ elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
- if (elementIndicesWithOverwrittenProviders.length === 0) {
- return def;
- }
- // clone the whole view definition,
- // as it maintains references between the nodes that are hard to update.
- def = /** @type {?} */ ((def.factory))(function () { return NOOP; });
- for (var /** @type {?} */ i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
- applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
- }
- return def;
- /**
- * @param {?} def
- * @return {?}
- */
- function findElementIndicesWithOverwrittenProviders(def) {
- var /** @type {?} */ elIndicesWithOverwrittenProviders = [];
- var /** @type {?} */ lastElementDef = null;
- for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
- var /** @type {?} */ nodeDef = def.nodes[i];
- if (nodeDef.flags & 1 /* TypeElement */) {
- lastElementDef = nodeDef;
- }
- if (lastElementDef && nodeDef.flags & 3840 /* CatProviderNoDirective */ &&
- providerOverrides.has(/** @type {?} */ ((nodeDef.provider)).token)) {
- elIndicesWithOverwrittenProviders.push(/** @type {?} */ ((lastElementDef)).nodeIndex);
- lastElementDef = null;
- }
- }
- return elIndicesWithOverwrittenProviders;
- }
- /**
- * @param {?} viewDef
- * @param {?} elIndex
- * @return {?}
- */
- function applyProviderOverridesToElement(viewDef$$1, elIndex) {
- for (var /** @type {?} */ i = elIndex + 1; i < viewDef$$1.nodes.length; i++) {
- var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
- if (nodeDef.flags & 1 /* TypeElement */) {
- // stop at the next element
- return;
- }
- if (nodeDef.flags & 3840 /* CatProviderNoDirective */) {
- var /** @type {?} */ provider = /** @type {?} */ ((nodeDef.provider));
- var /** @type {?} */ override = providerOverrides.get(provider.token);
- if (override) {
- nodeDef.flags = (nodeDef.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
- provider.deps = splitDepsDsl(override.deps);
- provider.value = override.value;
- }
- }
- }
- }
- }
- /**
- * @param {?} def
- * @return {?}
- */
- function applyProviderOverridesToNgModule(def) {
- var _a = calcHasOverrides(def), hasOverrides = _a.hasOverrides, hasDeprecatedOverrides = _a.hasDeprecatedOverrides;
- if (!hasOverrides) {
- return def;
- }
- // clone the whole view definition,
- // as it maintains references between the nodes that are hard to update.
- def = /** @type {?} */ ((def.factory))(function () { return NOOP; });
- applyProviderOverrides(def);
- return def;
- /**
- * @param {?} def
- * @return {?}
- */
- function calcHasOverrides(def) {
- var /** @type {?} */ hasOverrides = false;
- var /** @type {?} */ hasDeprecatedOverrides = false;
- if (providerOverrides.size === 0) {
- return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
- }
- def.providers.forEach(function (node) {
- var /** @type {?} */ override = providerOverrides.get(node.token);
- if ((node.flags & 3840 /* CatProviderNoDirective */) && override) {
- hasOverrides = true;
- hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
- }
- });
- return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
- }
- /**
- * @param {?} def
- * @return {?}
- */
- function applyProviderOverrides(def) {
- for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
- var /** @type {?} */ provider = def.providers[i];
- if (hasDeprecatedOverrides) {
- // We had a bug where me made
- // all providers lazy. Keep this logic behind a flag
- // for migrating existing users.
- provider.flags |= 4096 /* LazyProvider */;
- }
- var /** @type {?} */ override = providerOverrides.get(provider.token);
- if (override) {
- provider.flags = (provider.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
- provider.deps = splitDepsDsl(override.deps);
- provider.value = override.value;
- }
- }
- }
- }
- /**
- * @param {?} view
- * @param {?} checkIndex
- * @param {?} argStyle
- * @param {?=} v0
- * @param {?=} v1
- * @param {?=} v2
- * @param {?=} v3
- * @param {?=} v4
- * @param {?=} v5
- * @param {?=} v6
- * @param {?=} v7
- * @param {?=} v8
- * @param {?=} v9
- * @return {?}
- */
- function prodCheckAndUpdateNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- var /** @type {?} */ nodeDef = view.def.nodes[checkIndex];
- checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
- return (nodeDef.flags & 224 /* CatPureExpression */) ?
- asPureExpressionData(view, checkIndex).value :
- undefined;
- }
- /**
- * @param {?} view
- * @param {?} checkIndex
- * @param {?} argStyle
- * @param {?=} v0
- * @param {?=} v1
- * @param {?=} v2
- * @param {?=} v3
- * @param {?=} v4
- * @param {?=} v5
- * @param {?=} v6
- * @param {?=} v7
- * @param {?=} v8
- * @param {?=} v9
- * @return {?}
- */
- function prodCheckNoChangesNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
- var /** @type {?} */ nodeDef = view.def.nodes[checkIndex];
- checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
- return (nodeDef.flags & 224 /* CatPureExpression */) ?
- asPureExpressionData(view, checkIndex).value :
- undefined;
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function debugCheckAndUpdateView(view) {
- return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function debugCheckNoChangesView(view) {
- return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function debugDestroyView(view) {
- return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
- }
- /** @enum {number} */
- var DebugAction = {
- create: 0,
- detectChanges: 1,
- checkNoChanges: 2,
- destroy: 3,
- handleEvent: 4,
- };
- DebugAction[DebugAction.create] = "create";
- DebugAction[DebugAction.detectChanges] = "detectChanges";
- DebugAction[DebugAction.checkNoChanges] = "checkNoChanges";
- DebugAction[DebugAction.destroy] = "destroy";
- DebugAction[DebugAction.handleEvent] = "handleEvent";
- var _currentAction;
- var _currentView;
- var _currentNodeIndex;
- /**
- * @param {?} view
- * @param {?} nodeIndex
- * @return {?}
- */
- function debugSetCurrentNode(view, nodeIndex) {
- _currentView = view;
- _currentNodeIndex = nodeIndex;
- }
- /**
- * @param {?} view
- * @param {?} nodeIndex
- * @param {?} eventName
- * @param {?} event
- * @return {?}
- */
- function debugHandleEvent(view, nodeIndex, eventName, event) {
- debugSetCurrentNode(view, nodeIndex);
- return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
- }
- /**
- * @param {?} view
- * @param {?} checkType
- * @return {?}
- */
- function debugUpdateDirectives(view, checkType) {
- if (view.state & 128 /* Destroyed */) {
- throw viewDestroyedError(DebugAction[_currentAction]);
- }
- debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
- return view.def.updateDirectives(debugCheckDirectivesFn, view);
- /**
- * @param {?} view
- * @param {?} nodeIndex
- * @param {?} argStyle
- * @param {...?} values
- * @return {?}
- */
- function debugCheckDirectivesFn(view, nodeIndex, argStyle) {
- var values = [];
- for (var _i = 3; _i < arguments.length; _i++) {
- values[_i - 3] = arguments[_i];
- }
- var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
- if (checkType === 0 /* CheckAndUpdate */) {
- debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
- }
- else {
- debugCheckNoChangesNode(view, nodeDef, argStyle, values);
- }
- if (nodeDef.flags & 16384 /* TypeDirective */) {
- debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
- }
- return (nodeDef.flags & 224 /* CatPureExpression */) ?
- asPureExpressionData(view, nodeDef.nodeIndex).value :
- undefined;
- }
- }
- /**
- * @param {?} view
- * @param {?} checkType
- * @return {?}
- */
- function debugUpdateRenderer(view, checkType) {
- if (view.state & 128 /* Destroyed */) {
- throw viewDestroyedError(DebugAction[_currentAction]);
- }
- debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
- return view.def.updateRenderer(debugCheckRenderNodeFn, view);
- /**
- * @param {?} view
- * @param {?} nodeIndex
- * @param {?} argStyle
- * @param {...?} values
- * @return {?}
- */
- function debugCheckRenderNodeFn(view, nodeIndex, argStyle) {
- var values = [];
- for (var _i = 3; _i < arguments.length; _i++) {
- values[_i - 3] = arguments[_i];
- }
- var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
- if (checkType === 0 /* CheckAndUpdate */) {
- debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
- }
- else {
- debugCheckNoChangesNode(view, nodeDef, argStyle, values);
- }
- if (nodeDef.flags & 3 /* CatRenderNode */) {
- debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
- }
- return (nodeDef.flags & 224 /* CatPureExpression */) ?
- asPureExpressionData(view, nodeDef.nodeIndex).value :
- undefined;
- }
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} argStyle
- * @param {?} givenValues
- * @return {?}
- */
- function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
- var /** @type {?} */ changed = (/** @type {?} */ (checkAndUpdateNode)).apply(void 0, [view, nodeDef, argStyle].concat(givenValues));
- if (changed) {
- var /** @type {?} */ values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues;
- if (nodeDef.flags & 16384 /* TypeDirective */) {
- var /** @type {?} */ bindingValues = {};
- for (var /** @type {?} */ i = 0; i < nodeDef.bindings.length; i++) {
- var /** @type {?} */ binding = nodeDef.bindings[i];
- var /** @type {?} */ value = values[i];
- if (binding.flags & 8 /* TypeProperty */) {
- bindingValues[normalizeDebugBindingName(/** @type {?} */ ((binding.nonMinifiedName)))] =
- normalizeDebugBindingValue(value);
- }
- }
- var /** @type {?} */ elDef = /** @type {?} */ ((nodeDef.parent));
- var /** @type {?} */ el = asElementData(view, elDef.nodeIndex).renderElement;
- if (!/** @type {?} */ ((elDef.element)).name) {
- // a comment.
- view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
- }
- else {
- // a regular element.
- for (var /** @type {?} */ attr in bindingValues) {
- var /** @type {?} */ value = bindingValues[attr];
- if (value != null) {
- view.renderer.setAttribute(el, attr, value);
- }
- else {
- view.renderer.removeAttribute(el, attr);
- }
- }
- }
- }
- }
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} argStyle
- * @param {?} values
- * @return {?}
- */
- function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
- (/** @type {?} */ (checkNoChangesNode)).apply(void 0, [view, nodeDef, argStyle].concat(values));
- }
- /**
- * @param {?} name
- * @return {?}
- */
- function normalizeDebugBindingName(name) {
- // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
- name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
- return "ng-reflect-" + name;
- }
- var CAMEL_CASE_REGEXP = /([A-Z])/g;
- /**
- * @param {?} input
- * @return {?}
- */
- function camelCaseToDashCase(input) {
- return input.replace(CAMEL_CASE_REGEXP, function () {
- var m = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- m[_i] = arguments[_i];
- }
- return '-' + m[1].toLowerCase();
- });
- }
- /**
- * @param {?} value
- * @return {?}
- */
- function normalizeDebugBindingValue(value) {
- try {
- // Limit the size of the value as otherwise the DOM just gets polluted.
- return value != null ? value.toString().slice(0, 30) : value;
- }
- catch (/** @type {?} */ e) {
- return '[ERROR] Exception while trying to serialize the value';
- }
- }
- /**
- * @param {?} view
- * @param {?} nodeIndex
- * @return {?}
- */
- function nextDirectiveWithBinding(view, nodeIndex) {
- for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
- var /** @type {?} */ nodeDef = view.def.nodes[i];
- if (nodeDef.flags & 16384 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) {
- return i;
- }
- }
- return null;
- }
- /**
- * @param {?} view
- * @param {?} nodeIndex
- * @return {?}
- */
- function nextRenderNodeWithBinding(view, nodeIndex) {
- for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
- var /** @type {?} */ nodeDef = view.def.nodes[i];
- if ((nodeDef.flags & 3 /* CatRenderNode */) && nodeDef.bindings && nodeDef.bindings.length) {
- return i;
- }
- }
- return null;
- }
- var DebugContext_ = /** @class */ (function () {
- function DebugContext_(view, nodeIndex) {
- this.view = view;
- this.nodeIndex = nodeIndex;
- if (nodeIndex == null) {
- this.nodeIndex = nodeIndex = 0;
- }
- this.nodeDef = view.def.nodes[nodeIndex];
- var /** @type {?} */ elDef = this.nodeDef;
- var /** @type {?} */ elView = view;
- while (elDef && (elDef.flags & 1 /* TypeElement */) === 0) {
- elDef = /** @type {?} */ ((elDef.parent));
- }
- if (!elDef) {
- while (!elDef && elView) {
- elDef = /** @type {?} */ ((viewParentEl(elView)));
- elView = /** @type {?} */ ((elView.parent));
- }
- }
- this.elDef = elDef;
- this.elView = elView;
- }
- Object.defineProperty(DebugContext_.prototype, "elOrCompView", {
- get: /**
- * @return {?}
- */
- function () {
- // Has to be done lazily as we use the DebugContext also during creation of elements...
- return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugContext_.prototype, "injector", {
- get: /**
- * @return {?}
- */
- function () { return createInjector(this.elView, this.elDef); },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugContext_.prototype, "component", {
- get: /**
- * @return {?}
- */
- function () { return this.elOrCompView.component; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugContext_.prototype, "context", {
- get: /**
- * @return {?}
- */
- function () { return this.elOrCompView.context; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugContext_.prototype, "providerTokens", {
- get: /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ tokens = [];
- if (this.elDef) {
- for (var /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
- var /** @type {?} */ childDef = this.elView.def.nodes[i];
- if (childDef.flags & 20224 /* CatProvider */) {
- tokens.push(/** @type {?} */ ((childDef.provider)).token);
- }
- i += childDef.childCount;
- }
- }
- return tokens;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugContext_.prototype, "references", {
- get: /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ references = {};
- if (this.elDef) {
- collectReferences(this.elView, this.elDef, references);
- for (var /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
- var /** @type {?} */ childDef = this.elView.def.nodes[i];
- if (childDef.flags & 20224 /* CatProvider */) {
- collectReferences(this.elView, childDef, references);
- }
- i += childDef.childCount;
- }
- }
- return references;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugContext_.prototype, "componentRenderElement", {
- get: /**
- * @return {?}
- */
- function () {
- var /** @type {?} */ elData = findHostElement(this.elOrCompView);
- return elData ? elData.renderElement : undefined;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DebugContext_.prototype, "renderNode", {
- get: /**
- * @return {?}
- */
- function () {
- return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) :
- renderNode(this.elView, this.elDef);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} console
- * @param {...?} values
- * @return {?}
- */
- DebugContext_.prototype.logError = /**
- * @param {?} console
- * @param {...?} values
- * @return {?}
- */
- function (console) {
- var values = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- values[_i - 1] = arguments[_i];
- }
- var /** @type {?} */ logViewDef;
- var /** @type {?} */ logNodeIndex;
- if (this.nodeDef.flags & 2 /* TypeText */) {
- logViewDef = this.view.def;
- logNodeIndex = this.nodeDef.nodeIndex;
- }
- else {
- logViewDef = this.elView.def;
- logNodeIndex = this.elDef.nodeIndex;
- }
- // Note: we only generate a log function for text and element nodes
- // to make the generated code as small as possible.
- var /** @type {?} */ renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
- var /** @type {?} */ currRenderNodeIndex = -1;
- var /** @type {?} */ nodeLogger = function () {
- currRenderNodeIndex++;
- if (currRenderNodeIndex === renderNodeIndex) {
- return (_a = console.error).bind.apply(_a, [console].concat(values));
- }
- else {
- return NOOP;
- }
- var _a;
- }; /** @type {?} */
- ((logViewDef.factory))(nodeLogger);
- if (currRenderNodeIndex < renderNodeIndex) {
- console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
- console.error.apply(console, values);
- }
- };
- return DebugContext_;
- }());
- /**
- * @param {?} viewDef
- * @param {?} nodeIndex
- * @return {?}
- */
- function getRenderNodeIndex(viewDef$$1, nodeIndex) {
- var /** @type {?} */ renderNodeIndex = -1;
- for (var /** @type {?} */ i = 0; i <= nodeIndex; i++) {
- var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
- if (nodeDef.flags & 3 /* CatRenderNode */) {
- renderNodeIndex++;
- }
- }
- return renderNodeIndex;
- }
- /**
- * @param {?} view
- * @return {?}
- */
- function findHostElement(view) {
- while (view && !isComponentView(view)) {
- view = /** @type {?} */ ((view.parent));
- }
- if (view.parent) {
- return asElementData(view.parent, /** @type {?} */ ((viewParentEl(view))).nodeIndex);
- }
- return null;
- }
- /**
- * @param {?} view
- * @param {?} nodeDef
- * @param {?} references
- * @return {?}
- */
- function collectReferences(view, nodeDef, references) {
- for (var /** @type {?} */ refName in nodeDef.references) {
- references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
- }
- }
- /**
- * @param {?} action
- * @param {?} fn
- * @param {?} self
- * @param {?} args
- * @return {?}
- */
- function callWithDebugContext(action, fn, self, args) {
- var /** @type {?} */ oldAction = _currentAction;
- var /** @type {?} */ oldView = _currentView;
- var /** @type {?} */ oldNodeIndex = _currentNodeIndex;
- try {
- _currentAction = action;
- var /** @type {?} */ result = fn.apply(self, args);
- _currentView = oldView;
- _currentNodeIndex = oldNodeIndex;
- _currentAction = oldAction;
- return result;
- }
- catch (/** @type {?} */ e) {
- if (isViewDebugError(e) || !_currentView) {
- throw e;
- }
- throw viewWrappedDebugError(e, /** @type {?} */ ((getCurrentDebugContext())));
- }
- }
- /**
- * @return {?}
- */
- function getCurrentDebugContext() {
- return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
- }
- var DebugRendererFactory2 = /** @class */ (function () {
- function DebugRendererFactory2(delegate) {
- this.delegate = delegate;
- }
- /**
- * @param {?} element
- * @param {?} renderData
- * @return {?}
- */
- DebugRendererFactory2.prototype.createRenderer = /**
- * @param {?} element
- * @param {?} renderData
- * @return {?}
- */
- function (element, renderData) {
- return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
- };
- /**
- * @return {?}
- */
- DebugRendererFactory2.prototype.begin = /**
- * @return {?}
- */
- function () {
- if (this.delegate.begin) {
- this.delegate.begin();
- }
- };
- /**
- * @return {?}
- */
- DebugRendererFactory2.prototype.end = /**
- * @return {?}
- */
- function () {
- if (this.delegate.end) {
- this.delegate.end();
- }
- };
- /**
- * @return {?}
- */
- DebugRendererFactory2.prototype.whenRenderingDone = /**
- * @return {?}
- */
- function () {
- if (this.delegate.whenRenderingDone) {
- return this.delegate.whenRenderingDone();
- }
- return Promise.resolve(null);
- };
- return DebugRendererFactory2;
- }());
- var DebugRenderer2 = /** @class */ (function () {
- function DebugRenderer2(delegate) {
- this.delegate = delegate;
- this.data = this.delegate.data;
- }
- /**
- * @param {?} node
- * @return {?}
- */
- DebugRenderer2.prototype.destroyNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- removeDebugNodeFromIndex(/** @type {?} */ ((getDebugNode(node))));
- if (this.delegate.destroyNode) {
- this.delegate.destroyNode(node);
- }
- };
- /**
- * @return {?}
- */
- DebugRenderer2.prototype.destroy = /**
- * @return {?}
- */
- function () { this.delegate.destroy(); };
- /**
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- DebugRenderer2.prototype.createElement = /**
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- function (name, namespace) {
- var /** @type {?} */ el = this.delegate.createElement(name, namespace);
- var /** @type {?} */ debugCtx = getCurrentDebugContext();
- if (debugCtx) {
- var /** @type {?} */ debugEl = new DebugElement(el, null, debugCtx);
- debugEl.name = name;
- indexDebugNode(debugEl);
- }
- return el;
- };
- /**
- * @param {?} value
- * @return {?}
- */
- DebugRenderer2.prototype.createComment = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var /** @type {?} */ comment = this.delegate.createComment(value);
- var /** @type {?} */ debugCtx = getCurrentDebugContext();
- if (debugCtx) {
- indexDebugNode(new DebugNode(comment, null, debugCtx));
- }
- return comment;
- };
- /**
- * @param {?} value
- * @return {?}
- */
- DebugRenderer2.prototype.createText = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var /** @type {?} */ text = this.delegate.createText(value);
- var /** @type {?} */ debugCtx = getCurrentDebugContext();
- if (debugCtx) {
- indexDebugNode(new DebugNode(text, null, debugCtx));
- }
- return text;
- };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- DebugRenderer2.prototype.appendChild = /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- function (parent, newChild) {
- var /** @type {?} */ debugEl = getDebugNode(parent);
- var /** @type {?} */ debugChildEl = getDebugNode(newChild);
- if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
- debugEl.addChild(debugChildEl);
- }
- this.delegate.appendChild(parent, newChild);
- };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- DebugRenderer2.prototype.insertBefore = /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- function (parent, newChild, refChild) {
- var /** @type {?} */ debugEl = getDebugNode(parent);
- var /** @type {?} */ debugChildEl = getDebugNode(newChild);
- var /** @type {?} */ debugRefEl = /** @type {?} */ ((getDebugNode(refChild)));
- if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
- debugEl.insertBefore(debugRefEl, debugChildEl);
- }
- this.delegate.insertBefore(parent, newChild, refChild);
- };
- /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- DebugRenderer2.prototype.removeChild = /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- function (parent, oldChild) {
- var /** @type {?} */ debugEl = getDebugNode(parent);
- var /** @type {?} */ debugChildEl = getDebugNode(oldChild);
- if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
- debugEl.removeChild(debugChildEl);
- }
- this.delegate.removeChild(parent, oldChild);
- };
- /**
- * @param {?} selectorOrNode
- * @return {?}
- */
- DebugRenderer2.prototype.selectRootElement = /**
- * @param {?} selectorOrNode
- * @return {?}
- */
- function (selectorOrNode) {
- var /** @type {?} */ el = this.delegate.selectRootElement(selectorOrNode);
- var /** @type {?} */ debugCtx = getCurrentDebugContext();
- if (debugCtx) {
- indexDebugNode(new DebugElement(el, null, debugCtx));
- }
- return el;
- };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @param {?=} namespace
- * @return {?}
- */
- DebugRenderer2.prototype.setAttribute = /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @param {?=} namespace
- * @return {?}
- */
- function (el, name, value, namespace) {
- var /** @type {?} */ debugEl = getDebugNode(el);
- if (debugEl && debugEl instanceof DebugElement) {
- var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
- debugEl.attributes[fullName] = value;
- }
- this.delegate.setAttribute(el, name, value, namespace);
- };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- DebugRenderer2.prototype.removeAttribute = /**
- * @param {?} el
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- function (el, name, namespace) {
- var /** @type {?} */ debugEl = getDebugNode(el);
- if (debugEl && debugEl instanceof DebugElement) {
- var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
- debugEl.attributes[fullName] = null;
- }
- this.delegate.removeAttribute(el, name, namespace);
- };
- /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- DebugRenderer2.prototype.addClass = /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- function (el, name) {
- var /** @type {?} */ debugEl = getDebugNode(el);
- if (debugEl && debugEl instanceof DebugElement) {
- debugEl.classes[name] = true;
- }
- this.delegate.addClass(el, name);
- };
- /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- DebugRenderer2.prototype.removeClass = /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- function (el, name) {
- var /** @type {?} */ debugEl = getDebugNode(el);
- if (debugEl && debugEl instanceof DebugElement) {
- debugEl.classes[name] = false;
- }
- this.delegate.removeClass(el, name);
- };
- /**
- * @param {?} el
- * @param {?} style
- * @param {?} value
- * @param {?} flags
- * @return {?}
- */
- DebugRenderer2.prototype.setStyle = /**
- * @param {?} el
- * @param {?} style
- * @param {?} value
- * @param {?} flags
- * @return {?}
- */
- function (el, style, value, flags) {
- var /** @type {?} */ debugEl = getDebugNode(el);
- if (debugEl && debugEl instanceof DebugElement) {
- debugEl.styles[style] = value;
- }
- this.delegate.setStyle(el, style, value, flags);
- };
- /**
- * @param {?} el
- * @param {?} style
- * @param {?} flags
- * @return {?}
- */
- DebugRenderer2.prototype.removeStyle = /**
- * @param {?} el
- * @param {?} style
- * @param {?} flags
- * @return {?}
- */
- function (el, style, flags) {
- var /** @type {?} */ debugEl = getDebugNode(el);
- if (debugEl && debugEl instanceof DebugElement) {
- debugEl.styles[style] = null;
- }
- this.delegate.removeStyle(el, style, flags);
- };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- DebugRenderer2.prototype.setProperty = /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (el, name, value) {
- var /** @type {?} */ debugEl = getDebugNode(el);
- if (debugEl && debugEl instanceof DebugElement) {
- debugEl.properties[name] = value;
- }
- this.delegate.setProperty(el, name, value);
- };
- /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} callback
- * @return {?}
- */
- DebugRenderer2.prototype.listen = /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} callback
- * @return {?}
- */
- function (target, eventName, callback) {
- if (typeof target !== 'string') {
- var /** @type {?} */ debugEl = getDebugNode(target);
- if (debugEl) {
- debugEl.listeners.push(new EventListener(eventName, callback));
- }
- }
- return this.delegate.listen(target, eventName, callback);
- };
- /**
- * @param {?} node
- * @return {?}
- */
- DebugRenderer2.prototype.parentNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return this.delegate.parentNode(node); };
- /**
- * @param {?} node
- * @return {?}
- */
- DebugRenderer2.prototype.nextSibling = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return this.delegate.nextSibling(node); };
- /**
- * @param {?} node
- * @param {?} value
- * @return {?}
- */
- DebugRenderer2.prototype.setValue = /**
- * @param {?} node
- * @param {?} value
- * @return {?}
- */
- function (node, value) { return this.delegate.setValue(node, value); };
- return DebugRenderer2;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} override
- * @return {?}
- */
- function overrideProvider(override) {
- initServicesIfNeeded();
- return Services.overrideProvider(override);
- }
- /**
- * @param {?} comp
- * @param {?} componentFactory
- * @return {?}
- */
- function overrideComponentView(comp, componentFactory) {
- initServicesIfNeeded();
- return Services.overrideComponentView(comp, componentFactory);
- }
- /**
- * @return {?}
- */
- function clearOverrides() {
- initServicesIfNeeded();
- return Services.clearOverrides();
- }
- /**
- * @param {?} ngModuleType
- * @param {?} bootstrapComponents
- * @param {?} defFactory
- * @return {?}
- */
- function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
- return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
- }
- var NgModuleFactory_ = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NgModuleFactory_, _super);
- function NgModuleFactory_(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
- var _this =
- // Attention: this ctor is called as top level function.
- // Putting any logic in here will destroy closure tree shaking!
- _super.call(this) || this;
- _this.moduleType = moduleType;
- _this._bootstrapComponents = _bootstrapComponents;
- _this._ngModuleDefFactory = _ngModuleDefFactory;
- return _this;
- }
- /**
- * @param {?} parentInjector
- * @return {?}
- */
- NgModuleFactory_.prototype.create = /**
- * @param {?} parentInjector
- * @return {?}
- */
- function (parentInjector) {
- initServicesIfNeeded();
- var /** @type {?} */ def = resolveDefinition(this._ngModuleDefFactory);
- return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def);
- };
- return NgModuleFactory_;
- }(NgModuleFactory));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // The functions in this file verify that the assumptions we are making
- // about state in an instruction are correct before implementing any logic.
- // They are meant only to be called in dev mode as sanity checks.
- /**
- * Stringifies values such that strings are wrapped in explicit quotation marks and
- * other types are stringified normally. Used in error messages (e.g. assertThrow)
- * to make it clear that certain values are of the string type when comparing.
- *
- * e.g. `expected "3" to be 3` is easier to understand than `expected 3 to be 3`.
- *
- * @param {?} value The value to be stringified
- * @return {?} The stringified value
- */
- function stringifyValueForError(value) {
- return typeof value === 'string' ? "\"" + value + "\"" : '' + value;
- }
- /**
- * @param {?} actual
- * @param {?} name
- * @return {?}
- */
- /**
- * @template T
- * @param {?} actual
- * @param {?} expected
- * @param {?} name
- * @param {?=} serializer
- * @return {?}
- */
- function assertEqual(actual, expected, name, serializer) {
- (actual != expected) && assertThrow(actual, expected, name, '==', serializer);
- }
- /**
- * @template T
- * @param {?} actual
- * @param {?} expected
- * @param {?} name
- * @return {?}
- */
- function assertLessThan(actual, expected, name) {
- (actual < expected) && assertThrow(actual, expected, name, '>');
- }
- /**
- * @template T
- * @param {?} actual
- * @param {?} name
- * @return {?}
- */
- function assertNotNull(actual, name) {
- assertNotEqual(actual, null, name);
- }
- /**
- * @template T
- * @param {?} actual
- * @param {?} expected
- * @param {?} name
- * @return {?}
- */
- function assertNotEqual(actual, expected, name) {
- (actual == expected) && assertThrow(actual, expected, name, '!=');
- }
- /**
- * Throws an error with a message constructed from the arguments.
- *
- * @template T
- * @param {?} actual The actual value (e.g. 3)
- * @param {?} expected The expected value (e.g. 5)
- * @param {?} name The name of the value being checked (e.g. attrs.length)
- * @param {?} operator The comparison operator (e.g. <, >, ==)
- * @param {?=} serializer Function that maps a value to its display value
- * @return {?}
- */
- function assertThrow(actual, expected, name, operator, serializer) {
- if (serializer === void 0) { serializer = stringifyValueForError; }
- throw new Error("ASSERT: expected " + name + " " + operator + " " + serializer(expected) + " but was " + serializer(actual) + "!");
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- if (typeof ngDevMode == 'undefined') {
- if (typeof window != 'undefined')
- (/** @type {?} */ (window)).ngDevMode = true;
- if (typeof self != 'undefined')
- (/** @type {?} */ (self)).ngDevMode = true;
- if (typeof global != 'undefined')
- (/** @type {?} */ (global)).ngDevMode = true;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} node
- * @param {?} type
- * @return {?}
- */
- function assertNodeType(node, type) {
- assertNotEqual(node, null, 'node');
- assertEqual(node.flags & 3 /* TYPE_MASK */, type, 'Node.type', typeSerializer);
- }
- /**
- * @param {?} node
- * @param {...?} types
- * @return {?}
- */
- /**
- * @param {?} type
- * @return {?}
- */
- function typeSerializer(type) {
- if (type == 1 /* Projection */)
- return 'Projection';
- if (type == 0 /* Container */)
- return 'Container';
- if (type == 2 /* View */)
- return 'View';
- if (type == 3 /* Element */)
- return 'Element';
- return '??? ' + type + ' ???';
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Finds the closest DOM node above a given container in the hierarchy.
- *
- * This is necessary to add or remove elements from the DOM when a view
- * is added or removed from the container. e.g. parent.removeChild(...)
- *
- * @param {?} containerNode The container node whose parent must be found
- * @return {?} Closest DOM node above the container
- */
- function findNativeParent(containerNode) {
- var /** @type {?} */ container = containerNode;
- while (container) {
- ngDevMode && assertNodeType(container, 0 /* Container */);
- var /** @type {?} */ renderParent = container.data.renderParent;
- if (renderParent !== null) {
- return renderParent.native;
- }
- var /** @type {?} */ viewOrElement = /** @type {?} */ ((container.parent));
- ngDevMode && assertNotNull(viewOrElement, 'container.parent');
- if ((viewOrElement.flags & 3 /* TYPE_MASK */) === 3 /* Element */) {
- // we are an LElement, which means we are past the last LContainer.
- // This means than we have not been projected so just ignore.
- return null;
- }
- ngDevMode && assertNodeType(viewOrElement, 2 /* View */);
- container = (/** @type {?} */ (viewOrElement)).parent;
- }
- return null;
- }
- /**
- * Finds the DOM element before which a certain view should be inserting its
- * child elements.
- *
- * If the view has a next (e.g. for loop), elements should be inserted before
- * the next view's first child element. Otherwise, the container's comment
- * anchor is the marker.
- *
- * @param {?} index The index of the view to check
- * @param {?} state ContainerState of the parent container
- * @param {?} native Comment anchor for container
- * @return {?} The DOM element for which the view should insert elements
- */
- function findBeforeNode(index, state, native) {
- var /** @type {?} */ views = state.views;
- // Find the node to insert in front of
- return index + 1 < views.length ?
- (/** @type {?} */ (views[index + 1].child)).native :
- native;
- }
- /**
- * @param {?} container
- * @param {?} rootNode
- * @param {?} insertMode
- * @param {?=} beforeNode
- * @return {?}
- */
- function addRemoveViewFromContainer(container, rootNode, insertMode, beforeNode) {
- ngDevMode && assertNodeType(container, 0 /* Container */);
- ngDevMode && assertNodeType(rootNode, 2 /* View */);
- var /** @type {?} */ parent = findNativeParent(container);
- var /** @type {?} */ node = rootNode.child;
- if (parent) {
- while (node) {
- var /** @type {?} */ type = node.flags & 3;
- var /** @type {?} */ nextNode = null;
- var /** @type {?} */ renderer = container.view.renderer;
- var /** @type {?} */ isFnRenderer = (/** @type {?} */ (renderer)).listen;
- if (type === 3 /* Element */) {
- insertMode ? (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer))
- .insertBefore))(parent, /** @type {?} */ ((node.native)), /** @type {?} */ (beforeNode)) :
- parent.insertBefore(/** @type {?} */ ((node.native)), /** @type {?} */ (beforeNode), true)) :
- (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer))
- .removeChild))(/** @type {?} */ (parent), /** @type {?} */ ((node.native))) :
- parent.removeChild(/** @type {?} */ ((node.native))));
- nextNode = node.next;
- }
- else if (type === 0 /* Container */) {
- // if we get to a container, it must be a root node of a view because we are only
- // propagating down into child views / containers and not child elements
- var /** @type {?} */ childContainerData = (/** @type {?} */ (node)).data;
- insertMode ? (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer))
- .appendChild))(/** @type {?} */ (parent), /** @type {?} */ ((node.native))) :
- parent.appendChild(/** @type {?} */ ((node.native)))) :
- (isFnRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer))
- .removeChild))(/** @type {?} */ (parent), /** @type {?} */ ((node.native))) :
- parent.removeChild(/** @type {?} */ ((node.native))));
- nextNode = childContainerData.views.length ? childContainerData.views[0].child : null;
- }
- else if (type === 1 /* Projection */) {
- nextNode = (/** @type {?} */ (node)).data[0];
- }
- else {
- nextNode = (/** @type {?} */ (node)).child;
- }
- if (nextNode === null) {
- while (node && !node.next) {
- node = node.parent;
- if (node === rootNode)
- node = null;
- }
- node = node && node.next;
- }
- else {
- node = nextNode;
- }
- }
- }
- }
- /**
- * Traverses the tree of component views and containers to remove listeners and
- * call onDestroy callbacks.
- *
- * Notes:
- * - Because it's used for onDestroy calls, it needs to be bottom-up.
- * - Must process containers instead of their views to avoid splicing
- * when views are destroyed and re-added.
- * - Using a while loop because it's faster than recursion
- * - Destroy only called on movement to sibling or movement to parent (laterally or up)
- *
- * \@param rootView The view to destroy
- * @param {?} rootView
- * @return {?}
- */
- function destroyViewTree(rootView) {
- var /** @type {?} */ viewOrContainerState = rootView;
- while (viewOrContainerState) {
- var /** @type {?} */ next = null;
- if (viewOrContainerState.views && viewOrContainerState.views.length) {
- next = viewOrContainerState.views[0].data;
- }
- else if (viewOrContainerState.child) {
- next = viewOrContainerState.child;
- }
- else if (viewOrContainerState.next) {
- cleanUpView(/** @type {?} */ (viewOrContainerState));
- next = viewOrContainerState.next;
- }
- if (next == null) {
- while (viewOrContainerState && !/** @type {?} */ ((viewOrContainerState)).next) {
- cleanUpView(/** @type {?} */ (viewOrContainerState));
- viewOrContainerState = getParentState(viewOrContainerState, rootView);
- }
- cleanUpView(/** @type {?} */ (viewOrContainerState) || rootView);
- next = viewOrContainerState && viewOrContainerState.next;
- }
- viewOrContainerState = next;
- }
- }
- /**
- * Inserts a view into a container.
- *
- * This adds the view to the container's array of active views in the correct
- * position. It also adds the view's elements to the DOM if the container isn't a
- * root node of another view (in that case, the view's elements will be added when
- * the container's parent view is added later).
- *
- * @param {?} container The container into which the view should be inserted
- * @param {?} newView The view to insert
- * @param {?} index The index at which to insert the view
- * @return {?} The inserted view
- */
- function insertView(container, newView, index) {
- var /** @type {?} */ state = container.data;
- var /** @type {?} */ views = state.views;
- if (index > 0) {
- // This is a new view, we need to add it to the children.
- setViewNext(views[index - 1], newView);
- }
- if (index < views.length && views[index].data.id !== newView.data.id) {
- // View ID change replace the view.
- setViewNext(newView, views[index]);
- views.splice(index, 0, newView);
- }
- else if (index >= views.length) {
- views.push(newView);
- }
- if (state.nextIndex <= index) {
- state.nextIndex++;
- }
- // If the container's renderParent is null, we know that it is a root node of its own parent view
- // and we should wait until that parent processes its nodes (otherwise, we will insert this view's
- // nodes twice - once now and once when its parent inserts its views).
- if (container.data.renderParent !== null) {
- addRemoveViewFromContainer(container, newView, true, findBeforeNode(index, state, container.native));
- }
- // Notify query that view has been inserted
- container.query && container.query.insertView(container, newView, index);
- return newView;
- }
- /**
- * Removes a view from a container.
- *
- * This method splices the view from the container's array of active views. It also
- * removes the view's elements from the DOM and conducts cleanup (e.g. removing
- * listeners, calling onDestroys).
- *
- * @param {?} container The container from which to remove a view
- * @param {?} removeIndex The index of the view to remove
- * @return {?} The removed view
- */
- function removeView(container, removeIndex) {
- var /** @type {?} */ views = container.data.views;
- var /** @type {?} */ viewNode = views[removeIndex];
- if (removeIndex > 0) {
- setViewNext(views[removeIndex - 1], viewNode.next);
- }
- views.splice(removeIndex, 1);
- destroyViewTree(viewNode.data);
- addRemoveViewFromContainer(container, viewNode, false);
- // Notify query that view has been removed
- container.query && container.query.removeView(container, viewNode, removeIndex);
- return viewNode;
- }
- /**
- * Sets a next on the view node, so views in for loops can easily jump from
- * one view to the next to add/remove elements. Also adds the ViewState (view.data)
- * to the view tree for easy traversal when cleaning up the view.
- *
- * @param {?} view The view to set up
- * @param {?} next The view's new next
- * @return {?}
- */
- function setViewNext(view, next) {
- view.next = next;
- view.data.next = next ? next.data : null;
- }
- /**
- * Determines which ViewOrContainerState to jump to when traversing back up the
- * tree in destroyViewTree.
- *
- * Normally, the view's parent ViewState should be checked, but in the case of
- * embedded views, the container (which is the view node's parent, but not the
- * ViewState's parent) needs to be checked for a possible next property.
- *
- * @param {?} state The ViewOrContainerState for which we need a parent state
- * @param {?} rootView The rootView, so we don't propagate too far up the view tree
- * @return {?} The correct parent ViewOrContainerState
- */
- function getParentState(state, rootView) {
- var /** @type {?} */ node;
- if ((node = /** @type {?} */ (((/** @type {?} */ (state)))).node) &&
- (node.flags & 3 /* TYPE_MASK */) === 2 /* View */) {
- // if it's an embedded view, the state needs to go up to the container, in case the
- // container has a next
- return /** @type {?} */ (((node.parent)).data);
- }
- else {
- // otherwise, use parent view for containers or component views
- return state.parent === rootView ? null : state.parent;
- }
- }
- /**
- * Removes all listeners and call all onDestroys in a given view.
- *
- * @param {?} viewState The ViewState of the view to clean up
- * @return {?}
- */
- function cleanUpView(viewState) {
- if (!viewState.cleanup)
- return;
- var /** @type {?} */ cleanup = /** @type {?} */ ((viewState.cleanup));
- for (var /** @type {?} */ i = 0; i < cleanup.length - 1; i += 2) {
- if (typeof cleanup[i] === 'string') {
- /** @type {?} */ ((cleanup))[i + 1].removeEventListener(cleanup[i], cleanup[i + 2], cleanup[i + 3]);
- i += 2;
- }
- else {
- cleanup[i].call(cleanup[i + 1]);
- }
- }
- viewState.cleanup = null;
- }
- /**
- * Appends the provided child element to the provided parent, if appropriate.
- *
- * If the parent is a view, the element will be appended as part of viewEnd(), so
- * the element should not be appended now. Similarly, if the child is a content child
- * of a parent component, the child will be appended to the right position later by
- * the content projection system. Otherwise, append normally.
- *
- * @param {?} parent The parent to which to append the child
- * @param {?} child The child that should be appended
- * @param {?} currentView The current view's ViewState
- * @return {?} Whether or not the child was appended
- */
- function appendChild(parent, child, currentView) {
- // Only add native child element to parent element if the parent element is regular Element.
- // If parent is:
- // - Regular element => add child
- // - Component host element =>
- // - Current View, and parent view same => content => don't add -> parent component will
- // re-project if needed.
- // - Current View, and parent view different => view => add Child
- // - View element => View's get added separately.
- if (child !== null && (parent.flags & 3 /* TYPE_MASK */) === 3 /* Element */ &&
- (parent.view !==
- currentView /* Crossing View Boundaries, it is Component, but add Element of View */
- || parent.data === null /* Regular Element. */)) {
- // We only add element if not in View or not projected.
- var /** @type {?} */ renderer = currentView.renderer;
- (/** @type {?} */ (renderer)).listen ? /** @type {?} */ (((/** @type {?} */ (renderer)).appendChild))(/** @type {?} */ (((parent.native))), child) : /** @type {?} */ ((parent.native)).appendChild(child);
- return true;
- }
- return false;
- }
- /**
- * Inserts the provided node before the correct element in the DOM, if appropriate.
- *
- * If the parent is a view, the element will be inserted as part of viewEnd(), so
- * the element should not be inserted now. Similarly, if the child is a content child
- * of a parent component, the child will be inserted to the right position later by
- * the content projection system. Otherwise, insertBefore normally.
- *
- * @param {?} node Node to insert
- * @param {?} currentView The current view's ViewState
- * @return {?}
- */
- function insertChild(node, currentView) {
- var /** @type {?} */ parent = /** @type {?} */ ((node.parent));
- // Only add child element to parent element if the parent element is regular Element.
- // If parent is:
- // - Normal element => add child
- // - Component element =>
- // - Current View, and parent view same => content don't add -> parent component will
- // re-project if needed.
- // - Current View, and parent view different => view => add Child
- // - View element => View's get added separately.
- if ((parent.flags & 3 /* TYPE_MASK */) === 3 /* Element */ &&
- (parent.view !==
- currentView /* Crossing View Boundaries, its Component, but add Element of View */
- || parent.data === null /* Regular Element. */)) {
- // We only add element if not in View or not projected.
- var /** @type {?} */ sibling = node.next;
- var /** @type {?} */ nativeSibling = null;
- while (sibling && (nativeSibling = sibling.native) === null) {
- sibling = sibling.next;
- }
- var /** @type {?} */ renderer = currentView.renderer;
- (/** @type {?} */ (renderer)).listen ? /** @type {?} */ (((/** @type {?} */ (renderer))
- .insertBefore))(/** @type {?} */ ((parent.native)), /** @type {?} */ ((node.native)), nativeSibling) : /** @type {?} */ ((parent.native)).insertBefore(/** @type {?} */ ((node.native)), nativeSibling, false);
- }
- }
- /**
- * Appends a projected node to the DOM, or in the case of a projected container,
- * appends the nodes from all of the container's active views to the DOM. Also stores the
- * node in the given projectedNodes array.
- *
- * @param {?} projectedNodes Array to store the projected node
- * @param {?} node The node to process
- * @param {?} currentParent The last parent element to be processed
- * @param {?} currentView The current view's ViewState
- * @return {?}
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A utility function to match an Ivy node static data against a simple CSS selector
- *
- * @param {?} lNodeStaticData
- * @param {?} selector
- * @return {?} true if node matches the selector.
- */
- /**
- * @param {?} lNodeStaticData
- * @param {?} selector
- * @return {?}
- */
- /**
- * @param {?} lNodeStaticData
- * @param {?} selector
- * @return {?}
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Must use this method for CD (instead of === ) since NaN !== NaN
- * @param {?} a
- * @param {?} b
- * @return {?}
- */
- function isDifferent(a, b) {
- // NaN is the only value that is not equal to itself so the first
- // test checks if both a and b are not NaN
- return !(a !== a && b !== b) && a !== b;
- }
- /**
- * @param {?} value
- * @return {?}
- */
- function stringify$1(value) {
- if (typeof value == 'function')
- return value.name || value;
- if (typeof value == 'string')
- return value;
- if (value == null)
- return '';
- return '' + value;
- }
- /**
- * Function that throws a "not implemented" error so it's clear certain
- * behaviors/methods aren't yet ready.
- *
- * @return {?} Not implemented error
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * If a directive is diPublic, bloomAdd sets a property on the instance with this constant as
- * the key and the directive's unique ID as the value. This allows us to map directives to their
- * bloom filter bit for DI.
- */
- var NG_ELEMENT_ID = '__NG_ELEMENT_ID__';
- /**
- * The number of slots in each bloom filter (used by DI). The larger this number, the fewer
- * directives that will share slots, and thus, the fewer false positives when checking for
- * the existence of a directive.
- */
- var BLOOM_SIZE = 128;
- /**
- * Registers this directive as present in its node's injector by flipping the directive's
- * corresponding bit in the injector's bloom filter.
- *
- * @param {?} injector The node injector in which the directive should be registered
- * @param {?} type The directive to register
- * @return {?}
- */
- /**
- * Creates (or gets an existing) injector for a given element or container.
- *
- * @param {?} node for which an injector should be retrieved / created.
- * @return {?} Node injector
- */
- /**
- * Constructs an injection error with the given text and token.
- *
- * @param {?} text The text of the error
- * @param {?} token The token associated with the error
- * @return {?} The error that was created
- */
- function createInjectionError(text, token) {
- return new Error("ElementInjector: " + text + " [" + stringify$1(token) + "]");
- }
- /**
- * Makes a directive public to the DI system by adding it to an injector's bloom filter.
- *
- * @param {?} di The node injector in which a directive will be added
- * @param {?} def The definition of the directive to be made public
- * @return {?}
- */
- /**
- * Searches for an instance of the given directive type up the injector tree and returns
- * that instance if found.
- *
- * Specifically, it gets the bloom filter bit associated with the directive (see bloomHashBit),
- * checks that bit against the bloom filter structure to identify an injector that might have
- * the directive (see bloomFindPossibleInjector), then searches the directives on that injector
- * for a match.
- *
- * If not found, it will propagate up to the next parent injector until the token
- * is found or the top is reached.
- *
- * @template T
- * @param {?} di Node injector where the search should start
- * @param {?} token The directive type to search for
- * @param {?=} flags Injection flags (e.g. CheckParent)
- * @return {?} The instance found
- */
- /**
- * Given a directive type, this function returns the bit in an injector's bloom filter
- * that should be used to determine whether or not the directive is present.
- *
- * When the directive was added to the bloom filter, it was given a unique ID that can be
- * retrieved on the class. Since there are only BLOOM_SIZE slots per bloom filter, the directive's
- * ID must be modulo-ed by BLOOM_SIZE to get the correct bloom bit (directives share slots after
- * BLOOM_SIZE is reached).
- *
- * @param {?} type The directive type
- * @return {?} The bloom bit to check for the directive
- */
- function bloomHashBit(type) {
- var /** @type {?} */ id = (/** @type {?} */ (type))[NG_ELEMENT_ID];
- return typeof id === 'number' ? id % BLOOM_SIZE : null;
- }
- /**
- * Finds the closest injector that might have a certain directive.
- *
- * Each directive corresponds to a bit in an injector's bloom filter. Given the bloom bit to
- * check and a starting injector, this function traverses up injectors until it finds an
- * injector that contains a 1 for that bit in its bloom filter. A 1 indicates that the
- * injector may have that directive. It only *may* have the directive because directives begin
- * to share bloom filter bits after the BLOOM_SIZE is reached, and it could correspond to a
- * different directive sharing the bit.
- *
- * Note: We can skip checking further injectors up the tree if an injector's cbf structure
- * has a 0 for that bloom bit. Since cbf contains the merged value of all the parent
- * injectors, a 0 in the bloom bit indicates that the parents definitely do not contain
- * the directive and do not need to be checked.
- *
- * @param {?} startInjector
- * @param {?} bloomBit The bit to check in each injector's bloom filter
- * @return {?} An injector that might have the directive
- */
- function bloomFindPossibleInjector(startInjector, bloomBit) {
- // Create a mask that targets the specific bit associated with the directive we're looking for.
- // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding
- // to bit positions 0 - 31 in a 32 bit integer.
- var /** @type {?} */ mask = 1 << bloomBit;
- // Traverse up the injector tree until we find a potential match or until we know there *isn't* a
- // match.
- var /** @type {?} */ injector = startInjector;
- while (injector) {
- // Our bloom filter size is 128 bits, which is four 32-bit bloom filter buckets:
- // bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127]
- // Get the bloom filter value from the appropriate bucket based on the directive's bloomBit.
- var /** @type {?} */ value = bloomBit < 64 ? (bloomBit < 32 ? injector.bf0 : injector.bf1) :
- (bloomBit < 96 ? injector.bf2 : injector.bf3);
- // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,
- // this injector is a potential match.
- if ((value & mask) === mask) {
- return injector;
- }
- // If the current injector does not have the directive, check the bloom filters for the ancestor
- // injectors (cbf0 - cbf3). These filters capture *all* ancestor injectors.
- value = bloomBit < 64 ? (bloomBit < 32 ? injector.cbf0 : injector.cbf1) :
- (bloomBit < 96 ? injector.cbf2 : injector.cbf3);
- // If the ancestor bloom filter value has the bit corresponding to the directive, traverse up to
- // find the specific injector. If the ancestor bloom filter does not have the bit, we can abort.
- injector = (value & mask) ? injector.parent : null;
- }
- return null;
- }
- /**
- * Creates an ElementRef for a given node injector and stores it on the injector.
- * Or, if the ElementRef already exists, retrieves the existing ElementRef.
- *
- * @param {?} di The node injector where we should store a created ElementRef
- * @return {?} The ElementRef instance to use
- */
- /**
- * Creates a TemplateRef and stores it on the injector. Or, if the TemplateRef already
- * exists, retrieves the existing TemplateRef.
- *
- * @template T
- * @param {?} di The node injector where we should store a created TemplateRef
- * @return {?} The TemplateRef instance to use
- */
- /**
- * Creates a ViewContainerRef and stores it on the injector. Or, if the ViewContainerRef
- * already exists, retrieves the existing ViewContainerRef.
- *
- * @param {?} di
- * @return {?} The ViewContainerRef instance to use
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A predicate which determines if a given element/directive should be included in the query
- * @record
- */
- var QueryList_ = /** @class */ (function () {
- function QueryList_() {
- this.dirty = false;
- /**
- * \@internal
- */
- this._valuesTree = null;
- /**
- * \@internal
- */
- this._values = null;
- }
- Object.defineProperty(QueryList_.prototype, "length", {
- get: /**
- * @return {?}
- */
- function () {
- ngDevMode && assertNotNull(this._values, 'refreshed');
- return /** @type {?} */ ((this._values)).length;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(QueryList_.prototype, "first", {
- get: /**
- * @return {?}
- */
- function () {
- ngDevMode && assertNotNull(this._values, 'refreshed');
- var /** @type {?} */ values = /** @type {?} */ ((this._values));
- return values.length ? values[0] : null;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(QueryList_.prototype, "last", {
- get: /**
- * @return {?}
- */
- function () {
- ngDevMode && assertNotNull(this._values, 'refreshed');
- var /** @type {?} */ values = /** @type {?} */ ((this._values));
- return values.length ? values[values.length - 1] : null;
- },
- enumerable: true,
- configurable: true
- });
- /** @internal */
- /**
- * \@internal
- * @return {?}
- */
- QueryList_.prototype._refresh = /**
- * \@internal
- * @return {?}
- */
- function () {
- // TODO(misko): needs more logic to flatten tree.
- if (this._values === null) {
- this._values = this._valuesTree;
- return true;
- }
- return false;
- };
- /**
- * @template U
- * @param {?} fn
- * @return {?}
- */
- QueryList_.prototype.map = /**
- * @template U
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- throw new Error('Method not implemented.');
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- QueryList_.prototype.filter = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- throw new Error('Method not implemented.');
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- QueryList_.prototype.find = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- throw new Error('Method not implemented.');
- };
- /**
- * @template U
- * @param {?} fn
- * @param {?} init
- * @return {?}
- */
- QueryList_.prototype.reduce = /**
- * @template U
- * @param {?} fn
- * @param {?} init
- * @return {?}
- */
- function (fn, init) {
- throw new Error('Method not implemented.');
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- QueryList_.prototype.forEach = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- throw new Error('Method not implemented.');
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- QueryList_.prototype.some = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- throw new Error('Method not implemented.');
- };
- /**
- * @return {?}
- */
- QueryList_.prototype.toArray = /**
- * @return {?}
- */
- function () {
- ngDevMode && assertNotNull(this._values, 'refreshed');
- return /** @type {?} */ ((this._values));
- };
- /**
- * @return {?}
- */
- QueryList_.prototype.toString = /**
- * @return {?}
- */
- function () { throw new Error('Method not implemented.'); };
- /**
- * @param {?} res
- * @return {?}
- */
- QueryList_.prototype.reset = /**
- * @param {?} res
- * @return {?}
- */
- function (res) { throw new Error('Method not implemented.'); };
- /**
- * @return {?}
- */
- QueryList_.prototype.notifyOnChanges = /**
- * @return {?}
- */
- function () { throw new Error('Method not implemented.'); };
- /**
- * @return {?}
- */
- QueryList_.prototype.setDirty = /**
- * @return {?}
- */
- function () { throw new Error('Method not implemented.'); };
- /**
- * @return {?}
- */
- QueryList_.prototype.destroy = /**
- * @return {?}
- */
- function () { throw new Error('Method not implemented.'); };
- return QueryList_;
- }());
- /**
- * @param {?} query
- * @return {?}
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /** @enum {number} */
- var RendererStyleFlags3 = {
- Important: 1,
- DashCase: 2,
- };
- RendererStyleFlags3[RendererStyleFlags3.Important] = "Important";
- RendererStyleFlags3[RendererStyleFlags3.DashCase] = "DashCase";
- /**
- * Object Oriented style of API needed to create elements and text nodes.
- *
- * This is the native browser API style, e.g. operations are methods on individual objects
- * like HTMLElement. With this style, no additional code is needed as a facade
- * (reducing payload size).
- *
- * @record
- */
- /**
- * Procedural style of API needed to create elements and text nodes.
- *
- * In non-native browser environments (e.g. platforms such as web-workers), this is the
- * facade that enables element manipulation. This also facilitates backwards compatibility
- * with Renderer2.
- * @record
- */
- /**
- * @record
- */
- var domRendererFactory3 = {
- createRenderer: function (hostElement, rendererType) { return document; }
- };
- /**
- * Subset of API needed for appending elements and text nodes.
- * @record
- */
- /**
- * Subset of API needed for writing attributes, properties, and setting up
- * listeners on Element.
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @record
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Directive (D) sets a property on all component instances using this constant as a key and the
- * component's host node (LElement) as the value. This is used in methods like detectChanges to
- * facilitate jumping from an instance to the host node.
- */
- var NG_HOST_SYMBOL = '__ngHostLNode__';
- /**
- * This property gets set before entering a template.
- *
- * This renderer can be one of two varieties of Renderer3:
- *
- * - ObjectedOrientedRenderer3
- *
- * This is the native browser API style, e.g. operations are methods on individual objects
- * like HTMLElement. With this style, no additional code is needed as a facade (reducing payload
- * size).
- *
- * - ProceduralRenderer3
- *
- * In non-native browser environments (e.g. platforms such as web-workers), this is the facade
- * that enables element manipulation. This also facilitates backwards compatibility with
- * Renderer2.
- */
- var renderer;
- var rendererFactory;
- /**
- * Used to set the parent property when nodes are created.
- */
- var previousOrParentNode;
- /**
- * If `isParent` is:
- * - `true`: then `previousOrParentNode` points to a parent node.
- * - `false`: then `previousOrParentNode` points to previous node (sibling).
- */
- var isParent;
- /**
- * The current template's static data (shared between all templates of a
- * given type).
- *
- * Each node's static data is stored at the same index that it's stored
- * in the data array. Any nodes that do not have static data store a null
- * value to avoid a sparse array.
- */
- var ngStaticData;
- /**
- * State of the current view being processed.
- */
- var currentView;
- // The initialization has to be after the `let`, otherwise `createViewState` can't see `let`.
- currentView = createViewState(/** @type {?} */ ((null)), /** @type {?} */ ((null)), []);
- var currentQuery;
- /**
- * This property gets set before entering a template.
- */
- var creationMode;
- /**
- * An array of nodes (text, element, container, etc), their bindings, and
- * any local variables that need to be stored between invocations.
- */
- var data;
- /**
- * Points to the next binding index to read or write to.
- */
- var bindingIndex;
- /**
- * When a view is destroyed, listeners need to be released
- * and onDestroy callbacks need to be called. This cleanup array
- * stores both listener data (in chunks of 4) and onDestroy data
- * (in chunks of 2), as they'll be processed at the same time.
- *
- * If it's a listener being stored:
- * 1st index is: event name to remove
- * 2nd index is: native element
- * 3rd index is: listener function
- * 4th index is: useCapture boolean
- *
- * If it's an onDestroy function:
- * 1st index is: onDestroy function
- * 2nd index is: context for function
- */
- var cleanup;
- /**
- * Index in the data array at which view hooks begin to be stored.
- */
- var viewHookStartIndex;
- /**
- * Swap the current state with a new state.
- *
- * For performance reasons we store the state in the top level of the module.
- * This way we minimize the number of properties to read. Whenever a new view
- * is entered we have to store the state for later, and when the view is
- * exited the state has to be restored
- *
- * @param {?} newViewState New state to become active
- * @param {?} host Element to which the View is a child of
- * @return {?} the previous state;
- */
- function enterView(newViewState, host) {
- var /** @type {?} */ oldViewState = currentView;
- data = newViewState.data;
- bindingIndex = newViewState.bindingStartIndex || 0;
- ngStaticData = newViewState.ngStaticData;
- creationMode = newViewState.creationMode;
- viewHookStartIndex = newViewState.viewHookStartIndex;
- cleanup = newViewState.cleanup;
- renderer = newViewState.renderer;
- if (host != null) {
- previousOrParentNode = host;
- isParent = true;
- }
- currentView = newViewState;
- return /** @type {?} */ ((oldViewState));
- }
- /**
- * Used in lieu of enterView to make it clear when we are exiting a child view. This makes
- * the direction of traversal (up or down the view tree) a bit clearer.
- * @param {?} newViewState
- * @return {?}
- */
- function leaveView(newViewState) {
- executeViewHooks();
- enterView(newViewState, null);
- }
- /**
- * @param {?} viewId
- * @param {?} renderer
- * @param {?} ngStaticData
- * @return {?}
- */
- function createViewState(viewId, renderer, ngStaticData) {
- var /** @type {?} */ newView = {
- parent: currentView,
- id: viewId,
- // -1 for component views
- node: /** @type {?} */ ((null)),
- // until we initialize it in createNode.
- data: [],
- ngStaticData: ngStaticData,
- cleanup: null,
- renderer: renderer,
- child: null,
- tail: null,
- next: null,
- bindingStartIndex: null,
- creationMode: true,
- viewHookStartIndex: null
- };
- return newView;
- }
- /**
- * @param {?} index
- * @param {?} type
- * @param {?} native
- * @param {?=} state
- * @return {?}
- */
- function createLNode(index, type, native, state) {
- var /** @type {?} */ parent = isParent ? previousOrParentNode :
- previousOrParentNode && /** @type {?} */ (previousOrParentNode.parent);
- var /** @type {?} */ query = (isParent ? currentQuery : previousOrParentNode && previousOrParentNode.query) ||
- parent && parent.query && parent.query.child();
- var /** @type {?} */ isState = state != null;
- var /** @type {?} */ node = {
- flags: type,
- native: /** @type {?} */ (native),
- view: currentView,
- parent: /** @type {?} */ (parent),
- child: null,
- next: null,
- nodeInjector: parent ? parent.nodeInjector : null,
- data: isState ? /** @type {?} */ (state) : null,
- query: query,
- staticData: null
- };
- if ((type & 2 /* ViewOrElement */) === 2 /* ViewOrElement */ && isState) {
- // Bit of a hack to bust through the readonly because there is a circular dep between
- // ViewState and LNode.
- ngDevMode && assertEqual((/** @type {?} */ (state)).node, null, 'viewState.node');
- (/** @type {?} */ ((state))).node = node;
- }
- if (index != null) {
- // We are Element or Container
- ngDevMode && assertEqual(data.length, index, 'data.length not in sequence');
- data[index] = node;
- // Every node adds a value to the static data array to avoid a sparse array
- if (index >= ngStaticData.length) {
- ngStaticData[index] = null;
- }
- else {
- node.staticData = /** @type {?} */ (ngStaticData[index]);
- }
- // Now link ourselves into the tree.
- if (isParent) {
- currentQuery = null;
- if (previousOrParentNode.view === currentView ||
- (previousOrParentNode.flags & 3 /* TYPE_MASK */) === 2 /* View */) {
- // We are in the same view, which means we are adding content node to the parent View.
- ngDevMode && assertEqual(previousOrParentNode.child, null, 'previousNode.child');
- previousOrParentNode.child = node;
- }
- else {
- // We are adding component view, so we don't link parent node child to this node.
- }
- }
- else if (previousOrParentNode) {
- ngDevMode && assertEqual(previousOrParentNode.next, null, 'previousNode.next');
- previousOrParentNode.next = node;
- }
- }
- previousOrParentNode = node;
- isParent = true;
- return node;
- }
- /**
- * Resets the application state.
- * @return {?}
- */
- function resetApplicationState() {
- isParent = false;
- previousOrParentNode = /** @type {?} */ ((null));
- }
- /**
- *
- * @template T
- * @param {?} hostNode
- * @param {?} template Template function with the instructions.
- * @param {?} context to pass into the template.
- * @param {?} providedRendererFactory
- * @param {?} host Existing node to render into.
- * @return {?}
- */
- /**
- * @template T
- * @param {?} node
- * @param {?} viewState
- * @param {?} componentOrContext
- * @param {?=} template
- * @return {?}
- */
- function renderComponentOrTemplate(node, viewState, componentOrContext, template) {
- var /** @type {?} */ oldView = enterView(viewState, node);
- try {
- if (rendererFactory.begin) {
- rendererFactory.begin();
- }
- if (template) {
- ngStaticData = template.ngStaticData || (template.ngStaticData = /** @type {?} */ ([]));
- template(/** @type {?} */ ((componentOrContext)), creationMode);
- }
- else {
- // Element was stored at 0 and directive was stored at 1 in renderComponent
- // so to refresh the component, r() needs to be called with (1, 0)
- (/** @type {?} */ (componentOrContext.constructor)).ngComponentDef.r(1, 0);
- }
- }
- finally {
- if (rendererFactory.end) {
- rendererFactory.end();
- }
- viewState.creationMode = false;
- leaveView(oldView);
- }
- }
- /**
- * @return {?}
- */
- /**
- * Makes a directive public to the DI system by adding it to an injector's bloom filter.
- *
- * @param {?} def The definition of the directive to be made public
- * @return {?}
- */
- /**
- * Searches for an instance of the given directive type up the injector tree and returns
- * that instance if found.
- *
- * If not found, it will propagate up to the next parent injector until the token
- * is found or the top is reached.
- *
- * Usage example (in factory function):
- *
- * class SomeDirective {
- * constructor(directive: DirectiveA) {}
- *
- * static ngDirectiveDef = defineDirective({
- * type: SomeDirective,
- * factory: () => new SomeDirective(inject(DirectiveA))
- * });
- * }
- *
- * @template T
- * @param {?} token The directive type to search for
- * @param {?=} flags Injection flags (e.g. CheckParent)
- * @return {?} The instance found
- */
- /**
- * Creates an ElementRef and stores it on the injector.
- * Or, if the ElementRef already exists, retrieves the existing ElementRef.
- *
- * @return {?} The ElementRef instance to use
- */
- /**
- * Creates a TemplateRef and stores it on the injector. Or, if the TemplateRef already
- * exists, retrieves the existing TemplateRef.
- *
- * @template T
- * @return {?} The TemplateRef instance to use
- */
- /**
- * Creates a ViewContainerRef and stores it on the injector. Or, if the ViewContainerRef
- * already exists, retrieves the existing ViewContainerRef.
- *
- * @return {?} The ViewContainerRef instance to use
- */
- /**
- * Create DOM element. The instruction must later be followed by `elementEnd()` call.
- *
- * @param {?} index Index of the element in the data array
- * @param {?=} nameOrComponentDef Name of the DOM Node or `ComponentDef`.
- * @param {?=} attrs Statically bound set of attributes to be written into the DOM element on creation.
- * @param {?=} localName A name under which a given element is exported.
- *
- * Attributes are passed as an array of strings where elements with an even index hold an attribute
- * name and elements with an odd index hold an attribute value, ex.:
- * ['id', 'warning5', 'class', 'alert']
- * @return {?}
- */
- function elementStart(index, nameOrComponentDef, attrs, localName) {
- var /** @type {?} */ node;
- var /** @type {?} */ native;
- if (nameOrComponentDef == null) {
- // native node retrieval - used for exporting elements as tpl local variables (<div #foo>)
- var /** @type {?} */ node_1 = /** @type {?} */ ((data[index]));
- native = node_1 && (/** @type {?} */ (node_1)).native;
- }
- else {
- ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex');
- var /** @type {?} */ isHostElement = typeof nameOrComponentDef !== 'string';
- var /** @type {?} */ name_1 = isHostElement ? (/** @type {?} */ (nameOrComponentDef)).tag : /** @type {?} */ (nameOrComponentDef);
- if (name_1 === null) {
- // TODO: future support for nameless components.
- throw 'for now name is required';
- }
- else {
- native = renderer.createElement(name_1);
- var /** @type {?} */ componentView = null;
- if (isHostElement) {
- var /** @type {?} */ ngStaticData_1 = getTemplateStatic((/** @type {?} */ (nameOrComponentDef)).template);
- componentView = addToViewTree(createViewState(-1, rendererFactory.createRenderer(native, (/** @type {?} */ (nameOrComponentDef)).rendererType), ngStaticData_1));
- }
- // Only component views should be added to the view tree directly. Embedded views are
- // accessed through their containers because they may be removed / re-added later.
- node = createLNode(index, 3 /* Element */, native, componentView);
- if (node.staticData == null) {
- ngDevMode && assertDataInRange(index - 1);
- node.staticData = ngStaticData[index] =
- createNodeStatic(name_1, attrs || null, null, localName || null);
- }
- if (attrs)
- setUpAttributes(native, attrs);
- appendChild(/** @type {?} */ ((node.parent)), native, currentView);
- }
- }
- return native;
- }
- /**
- * Gets static data from a template function or creates a new static
- * data array if it doesn't already exist.
- *
- * @param {?} template The template from which to get static data
- * @return {?} NgStaticData
- */
- function getTemplateStatic(template) {
- return template.ngStaticData || (template.ngStaticData = /** @type {?} */ ([]));
- }
- /**
- * @param {?} native
- * @param {?} attrs
- * @return {?}
- */
- function setUpAttributes(native, attrs) {
- ngDevMode && assertEqual(attrs.length % 2, 0, 'attrs.length % 2');
- var /** @type {?} */ isProceduralRenderer = (/** @type {?} */ (renderer)).setAttribute;
- for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
- isProceduralRenderer ? /** @type {?} */ (((/** @type {?} */ (renderer)).setAttribute))(native, attrs[i], attrs[i | 1]) :
- native.setAttribute(attrs[i], attrs[i | 1]);
- }
- }
- /**
- * @param {?} text
- * @param {?} token
- * @return {?}
- */
- function createError(text, token) {
- return new Error("Renderer: " + text + " [" + stringify$1(token) + "]");
- }
- /**
- * Locates the host native element, used for bootstrapping existing nodes into rendering pipeline.
- *
- * @param {?} factory
- * @param {?} elementOrSelector Render element or CSS selector to locate the element.
- * @return {?}
- */
- function locateHostElement(factory, elementOrSelector) {
- ngDevMode && assertDataInRange(-1);
- rendererFactory = factory;
- var /** @type {?} */ defaultRenderer = factory.createRenderer(null, null);
- var /** @type {?} */ rNode = typeof elementOrSelector === 'string' ?
- ((/** @type {?} */ (defaultRenderer)).selectRootElement ?
- (/** @type {?} */ (defaultRenderer)).selectRootElement(elementOrSelector) : /** @type {?} */ (((/** @type {?} */ (defaultRenderer)).querySelector))(elementOrSelector)) :
- elementOrSelector;
- if (ngDevMode && !rNode) {
- if (typeof elementOrSelector === 'string') {
- throw createError('Host node with selector not found:', elementOrSelector);
- }
- else {
- throw createError('Host node is required:', elementOrSelector);
- }
- }
- return rNode;
- }
- /**
- * Creates the host LNode..
- *
- * @param {?} rNode Render host element.
- * @param {?} def
- * @return {?}
- */
- function hostElement(rNode, def) {
- resetApplicationState();
- createLNode(0, 3 /* Element */, rNode, createViewState(-1, renderer, getTemplateStatic(def.template)));
- }
- /**
- * Adds an event listener to the current node.
- *
- * If an output exists on one of the node's directives, it also subscribes to the output
- * and saves the subscription for later cleanup.
- *
- * @param {?} eventName Name of the event
- * @param {?} listener The function to be called when event emits
- * @param {?=} useCapture Whether or not to use capture in event listener.
- * @return {?}
- */
- /**
- * Mark the end of the element.
- * @return {?}
- */
- function elementEnd() {
- if (isParent) {
- isParent = false;
- }
- else {
- ngDevMode && assertHasParent();
- previousOrParentNode = /** @type {?} */ ((previousOrParentNode.parent));
- }
- ngDevMode && assertNodeType(previousOrParentNode, 3 /* Element */);
- var /** @type {?} */ query = previousOrParentNode.query;
- query && query.addNode(previousOrParentNode);
- }
- /**
- * Update an attribute on an Element. This is used with a `bind` instruction.
- *
- * @param {?} index The index of the element to update in the data array
- * @param {?} attrName Name of attribute. Because it is going to DOM, this is not subject to
- * renaming as port of minification.
- * @param {?} value Value to write. This value will go through stringification.
- * @return {?}
- */
- /**
- * Update a property on an Element.
- *
- * If the property name also exists as an input property on one of the element's directives,
- * the component property will be set instead of the element property. This check must
- * be conducted at runtime so child components that add new \@Inputs don't have to be re-compiled.
- *
- * @template T
- * @param {?} index The index of the element to update in the data array
- * @param {?} propName Name of property. Because it is going to DOM, this is not subject to
- * renaming as part of minification.
- * @param {?} value New value to write.
- * @return {?}
- */
- function elementProperty(index, propName, value) {
- if (value === NO_CHANGE)
- return;
- var /** @type {?} */ node = /** @type {?} */ (data[index]);
- var /** @type {?} */ staticData = /** @type {?} */ ((node.staticData));
- // if staticData.inputs is undefined, a listener has created output staticData, but inputs haven't
- // yet been checked
- if (staticData.inputs === undefined) {
- // mark inputs as checked
- staticData.inputs = null;
- staticData = generatePropertyAliases(node.flags, staticData, true);
- }
- var /** @type {?} */ inputData = staticData.inputs;
- var /** @type {?} */ dataValue;
- if (inputData && (dataValue = inputData[propName])) {
- setInputsForProperty(dataValue, value);
- }
- else {
- var /** @type {?} */ native = node.native;
- (/** @type {?} */ (renderer)).setProperty ?
- (/** @type {?} */ (renderer)).setProperty(native, propName, value) :
- native.setProperty ? native.setProperty(propName, value) :
- (/** @type {?} */ (native))[propName] = value;
- }
- }
- /**
- * Constructs a LNodeStatic object from the arguments.
- *
- * @param {?} tagName
- * @param {?} attrs
- * @param {?} containerStatic
- * @param {?} localName
- * @return {?} the LNodeStatic object
- */
- function createNodeStatic(tagName, attrs, containerStatic, localName) {
- return {
- tagName: tagName,
- attrs: attrs,
- localNames: localName ? [localName, -1] : null,
- initialInputs: undefined,
- inputs: undefined,
- outputs: undefined,
- containerStatic: containerStatic
- };
- }
- /**
- * Given a list of directive indices and minified input names, sets the
- * input properties on the corresponding directives.
- * @param {?} inputs
- * @param {?} value
- * @return {?}
- */
- function setInputsForProperty(inputs, value) {
- for (var /** @type {?} */ i = 0; i < inputs.length; i += 2) {
- ngDevMode && assertDataInRange(/** @type {?} */ (inputs[i]));
- data[/** @type {?} */ (inputs[i])][inputs[i | 1]] = value;
- }
- }
- /**
- * This function consolidates all the inputs or outputs defined by directives
- * on this node into one object and stores it in ngStaticData so it can
- * be shared between all templates of this type.
- *
- * @param {?} flags
- * @param {?} data
- * @param {?=} isInputData
- * @return {?}
- */
- function generatePropertyAliases(flags, data, isInputData) {
- if (isInputData === void 0) { isInputData = false; }
- var /** @type {?} */ start = flags >> 12;
- var /** @type {?} */ size = (flags & 4092 /* SIZE_MASK */) >> 2;
- for (var /** @type {?} */ i = start, /** @type {?} */ ii = start + size; i < ii; i++) {
- var /** @type {?} */ directiveDef = /** @type {?} */ (((ngStaticData))[i]);
- var /** @type {?} */ propertyAliasMap = isInputData ? directiveDef.inputs : directiveDef.outputs;
- for (var /** @type {?} */ publicName in propertyAliasMap) {
- if (propertyAliasMap.hasOwnProperty(publicName)) {
- var /** @type {?} */ internalName = propertyAliasMap[publicName];
- var /** @type {?} */ staticDirData = isInputData ? (data.inputs || (data.inputs = {})) :
- (data.outputs || (data.outputs = {}));
- var /** @type {?} */ hasProperty = staticDirData.hasOwnProperty(publicName);
- hasProperty ? staticDirData[publicName].push(i, internalName) :
- (staticDirData[publicName] = [i, internalName]);
- }
- }
- }
- return data;
- }
- /**
- * Add or remove a class in a classList.
- *
- * This instruction is meant to handle the [class.foo]="exp" case
- *
- * @template T
- * @param {?} index The index of the element to update in the data array
- * @param {?} className Name of class to toggle. Because it is going to DOM, this is not subject to
- * renaming as part of minification.
- * @param {?} value A value indicating if a given class should be added or removed.
- * @return {?}
- */
- /**
- * Update a given style on an Element.
- *
- * @template T
- * @param {?} index Index of the element to change in the data array
- * @param {?} styleName Name of property. Because it is going to DOM this is not subject to
- * renaming as part of minification.
- * @param {?} value New value to write (null to remove).
- * @param {?=} suffix Suffix to add to style's value (optional).
- * @return {?}
- */
- function elementStyle(index, styleName, value, suffix) {
- if (value !== NO_CHANGE) {
- var /** @type {?} */ lElement = /** @type {?} */ (data[index]);
- if (value == null) {
- (/** @type {?} */ (renderer)).removeStyle ?
- (/** @type {?} */ (renderer))
- .removeStyle(lElement.native, styleName, RendererStyleFlags3.DashCase) :
- lElement.native.style.removeProperty(styleName);
- }
- else {
- (/** @type {?} */ (renderer)).setStyle ?
- (/** @type {?} */ (renderer))
- .setStyle(lElement.native, styleName, suffix ? stringify$1(value) + suffix : stringify$1(value), RendererStyleFlags3.DashCase) :
- lElement.native.style.setProperty(styleName, suffix ? stringify$1(value) + suffix : stringify$1(value));
- }
- }
- }
- /**
- * Create static text node
- *
- * @param {?} index Index of the node in the data array.
- * @param {?=} value Value to write. This value will be stringified.
- * If value is not provided than the actual creation of the text node is delayed.
- * @return {?}
- */
- function text(index, value) {
- ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex');
- var /** @type {?} */ textNode = value != null ?
- ((/** @type {?} */ (renderer)).createText ?
- (/** @type {?} */ (renderer)).createText(stringify$1(value)) : /** @type {?} */ (((/** @type {?} */ (renderer)).createTextNode))(stringify$1(value))) :
- null;
- var /** @type {?} */ node = createLNode(index, 3 /* Element */, textNode);
- // Text nodes are self closing.
- isParent = false;
- appendChild(/** @type {?} */ ((node.parent)), textNode, currentView);
- }
- /**
- * Create text node with binding
- * Bindings should be handled externally with the proper bind(1-8) method
- *
- * @template T
- * @param {?} index Index of the node in the data array.
- * @param {?} value Stringified value to write.
- * @return {?}
- */
- function textBinding(index, value) {
- // TODO(misko): I don't think index < nodes.length check is needed here.
- var /** @type {?} */ existingNode = index < data.length && /** @type {?} */ (data[index]);
- if (existingNode && existingNode.native) {
- // If DOM node exists and value changed, update textContent
- value !== NO_CHANGE &&
- ((/** @type {?} */ (renderer)).setValue ?
- (/** @type {?} */ (renderer)).setValue(existingNode.native, stringify$1(value)) :
- existingNode.native.textContent = stringify$1(value));
- }
- else if (existingNode) {
- // Node was created but DOM node creation was delayed. Create and append now.
- existingNode.native =
- ((/** @type {?} */ (renderer)).createText ?
- (/** @type {?} */ (renderer)).createText(stringify$1(value)) : /** @type {?} */ (((/** @type {?} */ (renderer)).createTextNode))(stringify$1(value)));
- insertChild(existingNode, currentView);
- }
- else {
- text(index, value);
- }
- }
- /**
- * @template T
- * @param {?} index
- * @param {?=} directive
- * @param {?=} directiveDef
- * @param {?=} localName
- * @return {?}
- */
- function directive(index, directive, directiveDef, localName) {
- var /** @type {?} */ instance;
- if (directive == null) {
- // return existing
- ngDevMode && assertDataInRange(index);
- instance = data[index];
- }
- else {
- ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex');
- ngDevMode && assertPreviousIsParent();
- var /** @type {?} */ flags = /** @type {?} */ ((previousOrParentNode)).flags;
- var /** @type {?} */ size = flags & 4092;
- if (size === 0) {
- flags =
- (index << 12 /* INDX_SHIFT */) | 4 /* SIZE_SKIP */ | flags & 3 /* TYPE_MASK */;
- }
- else {
- flags += 4 /* SIZE_SKIP */;
- } /** @type {?} */
- ((previousOrParentNode)).flags = flags;
- ngDevMode && assertDataInRange(index - 1);
- Object.defineProperty(directive, NG_HOST_SYMBOL, { enumerable: false, value: previousOrParentNode });
- data[index] = instance = directive;
- if (index >= ngStaticData.length) {
- ngStaticData[index] = /** @type {?} */ ((directiveDef));
- if (localName) {
- ngDevMode &&
- assertNotNull(previousOrParentNode.staticData, 'previousOrParentNode.staticData');
- var /** @type {?} */ nodeStaticData = /** @type {?} */ ((/** @type {?} */ ((previousOrParentNode)).staticData));
- (nodeStaticData.localNames || (nodeStaticData.localNames = [])).push(localName, index);
- }
- }
- var /** @type {?} */ diPublic_1 = /** @type {?} */ ((directiveDef)).diPublic;
- if (diPublic_1) {
- diPublic_1(/** @type {?} */ ((directiveDef)));
- }
- var /** @type {?} */ staticData = /** @type {?} */ ((previousOrParentNode.staticData));
- if (staticData && staticData.attrs) {
- setInputsFromAttrs(instance, /** @type {?} */ ((directiveDef)).inputs, staticData);
- }
- }
- return instance;
- }
- /**
- * Sets initial input properties on directive instances from attribute data
- *
- * @template T
- * @param {?} instance Instance of the directive on which to set the initial inputs
- * @param {?} inputs The list of inputs from the directive def
- * @param {?} staticData The static data for this node
- * @return {?}
- */
- function setInputsFromAttrs(instance, inputs, staticData) {
- var /** @type {?} */ directiveIndex = ((previousOrParentNode.flags & 4092 /* SIZE_MASK */) >> 2 /* SIZE_SHIFT */) - 1;
- var /** @type {?} */ initialInputData = /** @type {?} */ (staticData.initialInputs);
- if (initialInputData === undefined || directiveIndex >= initialInputData.length) {
- initialInputData = generateInitialInputs(directiveIndex, inputs, staticData);
- }
- var /** @type {?} */ initialInputs = initialInputData[directiveIndex];
- if (initialInputs) {
- for (var /** @type {?} */ i = 0; i < initialInputs.length; i += 2) {
- (/** @type {?} */ (instance))[initialInputs[i]] = initialInputs[i | 1];
- }
- }
- }
- /**
- * Generates initialInputData for a node and stores it in the template's static storage
- * so subsequent template invocations don't have to recalculate it.
- *
- * initialInputData is an array containing values that need to be set as input properties
- * for directives on this node, but only once on creation. We need this array to support
- * the case where you set an \@Input property of a directive using attribute-like syntax.
- * e.g. if you have a `name` \@Input, you can set it once like this:
- *
- * <my-component name="Bess"></my-component>
- *
- * @param {?} directiveIndex Index to store the initial input data
- * @param {?} inputs The list of inputs from the directive def
- * @param {?} staticData The static data on this node
- * @return {?}
- */
- function generateInitialInputs(directiveIndex, inputs, staticData) {
- var /** @type {?} */ initialInputData = staticData.initialInputs || (staticData.initialInputs = []);
- initialInputData[directiveIndex] = null;
- var /** @type {?} */ attrs = /** @type {?} */ ((staticData.attrs));
- for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
- var /** @type {?} */ attrName = attrs[i];
- var /** @type {?} */ minifiedInputName = inputs[attrName];
- if (minifiedInputName !== undefined) {
- var /** @type {?} */ inputsToStore = initialInputData[directiveIndex] || (initialInputData[directiveIndex] = []);
- inputsToStore.push(minifiedInputName, attrs[i | 1]);
- }
- }
- return initialInputData;
- }
- /**
- * @param {?} lifecycle
- * @param {?=} self
- * @param {?=} method
- * @return {?}
- */
- /**
- * Iterates over view hook functions and calls them.
- * @return {?}
- */
- function executeViewHooks() {
- if (viewHookStartIndex == null)
- return;
- // Instead of using splice to remove init hooks after their first run (expensive), we
- // shift over the AFTER_CHECKED hooks as we call them and truncate once at the end.
- var /** @type {?} */ checkIndex = /** @type {?} */ (viewHookStartIndex);
- var /** @type {?} */ writeIndex = checkIndex;
- while (checkIndex < data.length) {
- // Call lifecycle hook with its context
- data[checkIndex + 1].call(data[checkIndex + 2]);
- if (data[checkIndex] === 16 /* AFTER_VIEW_CHECKED */) {
- // We know if the writeIndex falls behind that there is an init that needs to
- // be overwritten.
- if (writeIndex < checkIndex) {
- data[writeIndex] = data[checkIndex];
- data[writeIndex + 1] = data[checkIndex + 1];
- data[writeIndex + 2] = data[checkIndex + 2];
- }
- writeIndex += 3;
- }
- checkIndex += 3;
- }
- // Truncate once at the writeIndex
- data.length = writeIndex;
- }
- /**
- * Creates an LContainer.
- *
- * Only `LView`s can go into `LContainer`.
- *
- * @param {?} index The index of the container in the data array
- * @param {?=} template Optional inline template
- * @param {?=} tagName The name of the container element, if applicable
- * @param {?=} attrs The attrs attached to the container, if applicable
- * @param {?=} localName
- * @return {?}
- */
- function containerStart(index, template, tagName, attrs, localName) {
- ngDevMode && assertEqual(currentView.bindingStartIndex, null, 'bindingStartIndex');
- // If the direct parent of the container is a view, its views (including its comment)
- // will need to be added through insertView() when its parent view is being inserted.
- // For now, it is marked "headless" so we know to append its views later.
- var /** @type {?} */ comment = renderer.createComment(ngDevMode ? 'container' : '');
- var /** @type {?} */ renderParent = null;
- var /** @type {?} */ currentParent = isParent ? previousOrParentNode : /** @type {?} */ ((previousOrParentNode.parent));
- ngDevMode && assertNotEqual(currentParent, null, 'currentParent');
- if (appendChild(currentParent, comment, currentView)) {
- // we are adding to an Element which is either:
- // - Not a component (will not be re-projected, just added)
- // - View of the Component
- renderParent = /** @type {?} */ (currentParent);
- }
- var /** @type {?} */ node = createLNode(index, 0 /* Container */, comment, /** @type {?} */ ({
- views: [],
- nextIndex: 0, renderParent: renderParent,
- template: template == null ? null : template,
- next: null,
- parent: currentView
- }));
- if (node.staticData == null) {
- node.staticData = ngStaticData[index] =
- createNodeStatic(tagName || null, attrs || null, [], localName || null);
- }
- // Containers are added to the current view tree instead of their embedded views
- // because views can be removed and re-inserted.
- addToViewTree(node.data);
- }
- /**
- * @return {?}
- */
- function containerEnd() {
- if (isParent) {
- isParent = false;
- }
- else {
- ngDevMode && assertHasParent();
- previousOrParentNode = /** @type {?} */ ((previousOrParentNode.parent));
- }
- ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */);
- var /** @type {?} */ query = previousOrParentNode.query;
- query && query.addNode(previousOrParentNode);
- }
- /**
- * Sets a container up to receive views.
- *
- * @param {?} index The index of the container in the data array
- * @return {?}
- */
- function containerRefreshStart(index) {
- ngDevMode && assertDataInRange(index);
- previousOrParentNode = /** @type {?} */ (data[index]);
- ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */);
- isParent = true;
- (/** @type {?} */ (previousOrParentNode)).data.nextIndex = 0;
- }
- /**
- * Marks the end of the LContainer.
- *
- * Marking the end of ViewContainer is the time when to child Views get inserted or removed.
- * @return {?}
- */
- function containerRefreshEnd() {
- if (isParent) {
- isParent = false;
- }
- else {
- ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
- ngDevMode && assertHasParent();
- previousOrParentNode = /** @type {?} */ ((previousOrParentNode.parent));
- }
- ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */);
- var /** @type {?} */ container = /** @type {?} */ (previousOrParentNode);
- ngDevMode && assertNodeType(container, 0 /* Container */);
- var /** @type {?} */ nextIndex = container.data.nextIndex;
- while (nextIndex < container.data.views.length) {
- // remove extra view.
- removeView(container, nextIndex);
- }
- }
- /**
- * Creates an LView.
- *
- * @param {?} viewBlockId The ID of this view
- * @return {?} Whether or not this view is in creation mode
- */
- function viewStart(viewBlockId) {
- var /** @type {?} */ container = /** @type {?} */ ((isParent ? previousOrParentNode : /** @type {?} */ ((previousOrParentNode.parent))));
- ngDevMode && assertNodeType(container, 0 /* Container */);
- var /** @type {?} */ containerState = container.data;
- var /** @type {?} */ views = containerState.views;
- var /** @type {?} */ existingView = !creationMode && containerState.nextIndex < views.length && views[containerState.nextIndex];
- var /** @type {?} */ viewUpdateMode = existingView && viewBlockId === (/** @type {?} */ (existingView)).data.id;
- if (viewUpdateMode) {
- previousOrParentNode = views[containerState.nextIndex++];
- ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
- isParent = true;
- enterView((/** @type {?} */ (existingView)).data, /** @type {?} */ (previousOrParentNode));
- }
- else {
- // When we create a new View, we always reset the state of the instructions.
- var /** @type {?} */ newViewState = createViewState(viewBlockId, renderer, initViewStaticData(viewBlockId, container));
- enterView(newViewState, createLNode(null, 2 /* View */, null, newViewState));
- containerState.nextIndex++;
- }
- return !viewUpdateMode;
- }
- /**
- * Initialize the static data for the active view.
- *
- * Each embedded view needs to set the global ngStaticData variable to the static data for
- * that view. Otherwise, the view's static data for a particular node would overwrite
- * the staticdata for a node in the view above it with the same index (since it's in the
- * same template).
- *
- * @param {?} viewIndex The index of the view's static data in containerStatic
- * @param {?} parent The parent container in which to look for the view's static data
- * @return {?} NgStaticData
- */
- function initViewStaticData(viewIndex, parent) {
- ngDevMode && assertNodeType(parent, 0 /* Container */);
- var /** @type {?} */ containerStatic = (/** @type {?} */ (((parent)).staticData)).containerStatic;
- if (viewIndex >= containerStatic.length || containerStatic[viewIndex] == null) {
- containerStatic[viewIndex] = [];
- }
- return containerStatic[viewIndex];
- }
- /**
- * Marks the end of the LView.
- * @return {?}
- */
- function viewEnd() {
- isParent = false;
- var /** @type {?} */ viewNode = previousOrParentNode = /** @type {?} */ (currentView.node);
- var /** @type {?} */ container = /** @type {?} */ (previousOrParentNode.parent);
- ngDevMode && assertNodeType(viewNode, 2 /* View */);
- ngDevMode && assertNodeType(container, 0 /* Container */);
- var /** @type {?} */ containerState = container.data;
- var /** @type {?} */ previousView = containerState.nextIndex <= containerState.views.length ? /** @type {?} */ (containerState.views[containerState.nextIndex - 1]) :
- null;
- var /** @type {?} */ viewIdChanged = previousView == null ? true : previousView.data.id !== viewNode.data.id;
- if (viewIdChanged) {
- insertView(container, viewNode, containerState.nextIndex - 1);
- currentView.creationMode = false;
- }
- leaveView(/** @type {?} */ ((/** @type {?} */ ((currentView)).parent)));
- ngDevMode && assertEqual(isParent, false, 'isParent');
- ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
- }
- /**
- * Refreshes the component view.
- *
- * In other words, enters the component's view and processes it to update bindings, queries, etc.
- *
- * @param directiveIndex
- * @param elementIndex
- * @param template
- */
- var componentRefresh = function (directiveIndex, elementIndex, template) {
- ngDevMode && assertDataInRange(elementIndex);
- var /** @type {?} */ element = /** @type {?} */ (((data))[elementIndex]);
- ngDevMode && assertNodeType(element, 3 /* Element */);
- ngDevMode && assertNotEqual(element.data, null, 'isComponent');
- ngDevMode && assertDataInRange(directiveIndex);
- var /** @type {?} */ hostView = /** @type {?} */ ((element.data));
- ngDevMode && assertNotEqual(hostView, null, 'hostView');
- var /** @type {?} */ directive = data[directiveIndex];
- var /** @type {?} */ oldView = enterView(hostView, element);
- try {
- template(directive, creationMode);
- }
- finally {
- hostView.creationMode = false;
- leaveView(oldView);
- }
- };
- /**
- * Instruction to distribute projectable nodes among <ng-content> occurrences in a given template.
- * It takes all the selectors from the entire component's template and decides where
- * each projected node belongs (it re-distributes nodes among "buckets" where each "bucket" is
- * backed by a selector).
- *
- * @param {?=} selectors
- * @return {?}
- */
- /**
- * Inserts previously re-distributed projected nodes. This instruction must be preceded by a call
- * to the projectionDef instruction.
- *
- * @param {?} nodeIndex
- * @param {?} localIndex - index under which distribution of projected nodes was memorized
- * @param {?=} selectorIndex - 0 means <ng-content> without any selector
- * @return {?}
- */
- /**
- * Adds a ViewState or a ContainerState to the end of the current view tree.
- *
- * This structure will be used to traverse through nested views to remove listeners
- * and call onDestroy callbacks.
- *
- * @template T
- * @param {?} state The ViewState or ContainerState to add to the view tree
- * @return {?} The state passed in
- */
- function addToViewTree(state) {
- currentView.tail ? (currentView.tail.next = state) : (currentView.child = state);
- currentView.tail = state;
- return state;
- }
- /**
- * A special value which designates that a value has not changed.
- */
- var NO_CHANGE = /** @type {?} */ ({});
- /**
- * Create interpolation bindings with variable number of arguments.
- *
- * If any of the arguments change, then the interpolation is concatenated
- * and causes an update.
- *
- * @param {?} values an array of values to diff.
- * @return {?}
- */
- /**
- * Create a single value binding without interpolation.
- *
- * @template T
- * @param {?} value Value to diff
- * @return {?}
- */
- function bind(value) {
- var /** @type {?} */ different;
- if (different = creationMode) {
- if (typeof currentView.bindingStartIndex !== 'number') {
- bindingIndex = currentView.bindingStartIndex = data.length;
- }
- data[bindingIndex++] = value;
- }
- else {
- if (different = value !== NO_CHANGE && isDifferent(data[bindingIndex], value)) {
- data[bindingIndex] = value;
- }
- bindingIndex++;
- }
- return different ? value : NO_CHANGE;
- }
- /**
- * Create an interpolation bindings with 1 arguments.
- *
- * @param {?} prefix static value used for concatenation only.
- * @param {?} value value checked for change.
- * @param {?} suffix static value used for concatenation only.
- * @return {?}
- */
- function bind1(prefix, value, suffix) {
- return bind(value) === NO_CHANGE ? NO_CHANGE : prefix + stringify$1(value) + suffix;
- }
- /**
- * Create an interpolation bindings with 2 arguments.
- *
- * @param {?} prefix
- * @param {?} v0 value checked for change
- * @param {?} i0
- * @param {?} v1 value checked for change
- * @param {?} suffix
- * @return {?}
- */
- /**
- * Create an interpolation bindings with 3 arguments.
- *
- * @param {?} prefix
- * @param {?} v0
- * @param {?} i0
- * @param {?} v1
- * @param {?} i1
- * @param {?} v2
- * @param {?} suffix
- * @return {?}
- */
- /**
- * Create an interpolation binding with 4 arguments.
- *
- * @param {?} prefix
- * @param {?} v0
- * @param {?} i0
- * @param {?} v1
- * @param {?} i1
- * @param {?} v2
- * @param {?} i2
- * @param {?} v3
- * @param {?} suffix
- * @return {?}
- */
- /**
- * Create an interpolation binding with 5 arguments.
- *
- * @param {?} prefix
- * @param {?} v0
- * @param {?} i0
- * @param {?} v1
- * @param {?} i1
- * @param {?} v2
- * @param {?} i2
- * @param {?} v3
- * @param {?} i3
- * @param {?} v4
- * @param {?} suffix
- * @return {?}
- */
- /**
- * Create an interpolation binding with 6 arguments.
- *
- * @param {?} prefix
- * @param {?} v0
- * @param {?} i0
- * @param {?} v1
- * @param {?} i1
- * @param {?} v2
- * @param {?} i2
- * @param {?} v3
- * @param {?} i3
- * @param {?} v4
- * @param {?} i4
- * @param {?} v5
- * @param {?} suffix
- * @return {?}
- */
- /**
- * Create an interpolation binding with 7 arguments.
- *
- * @param {?} prefix
- * @param {?} v0
- * @param {?} i0
- * @param {?} v1
- * @param {?} i1
- * @param {?} v2
- * @param {?} i2
- * @param {?} v3
- * @param {?} i3
- * @param {?} v4
- * @param {?} i4
- * @param {?} v5
- * @param {?} i5
- * @param {?} v6
- * @param {?} suffix
- * @return {?}
- */
- /**
- * Create an interpolation binding with 8 arguments.
- *
- * @param {?} prefix
- * @param {?} v0
- * @param {?} i0
- * @param {?} v1
- * @param {?} i1
- * @param {?} v2
- * @param {?} i2
- * @param {?} v3
- * @param {?} i3
- * @param {?} v4
- * @param {?} i4
- * @param {?} v5
- * @param {?} i5
- * @param {?} v6
- * @param {?} i6
- * @param {?} v7
- * @param {?} suffix
- * @return {?}
- */
- /**
- * @template T
- * @param {?} index
- * @param {?=} value
- * @return {?}
- */
- /**
- * @template T
- * @param {?} predicate
- * @param {?=} descend
- * @param {?=} read
- * @return {?}
- */
- /**
- * @return {?}
- */
- function assertPreviousIsParent() {
- assertEqual(isParent, true, 'isParent');
- }
- /**
- * @return {?}
- */
- function assertHasParent() {
- assertNotEqual(previousOrParentNode.parent, null, 'isParent');
- }
- /**
- * @param {?} index
- * @param {?=} arr
- * @return {?}
- */
- function assertDataInRange(index, arr) {
- if (arr == null)
- arr = data;
- assertLessThan(arr ? arr.length : 0, index, 'data.length');
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Options that control how the component should be bootstrapped.
- * @record
- */
- /**
- * Bootstraps a component, then creates and returns a `ComponentRef` for that component.
- *
- * @template T
- * @param {?} componentType Component to bootstrap
- * @param {?} opts
- * @return {?}
- */
- // TODO: A hack to not pull in the NullInjector from @angular/core.
- /**
- * Bootstraps a Component into an existing host element and returns an instance
- * of the component.
- *
- * @template T
- * @param {?} componentType Component to bootstrap
- * @param {?=} opts
- * @return {?}
- */
- function renderComponent(componentType, opts) {
- if (opts === void 0) { opts = {}; }
- var /** @type {?} */ rendererFactory = opts.rendererFactory || domRendererFactory3;
- var /** @type {?} */ componentDef = componentType.ngComponentDef;
- var /** @type {?} */ component;
- var /** @type {?} */ hostNode = locateHostElement(rendererFactory, opts.host || componentDef.tag);
- var /** @type {?} */ oldView = enterView(createViewState(-1, rendererFactory.createRenderer(hostNode, componentDef.rendererType), []), /** @type {?} */ ((null)));
- try {
- // Create element node at index 0 in data array
- hostElement(hostNode, componentDef);
- // Create directive instance with n() and store at index 1 in data array (el is 0)
- component = directive(1, componentDef.n(), componentDef);
- }
- finally {
- leaveView(oldView);
- }
- opts.features && opts.features.forEach(function (feature) { return feature(component, componentDef); });
- detectChanges(component);
- return component;
- }
- /**
- * @template T
- * @param {?} component
- * @return {?}
- */
- function detectChanges(component) {
- ngDevMode && assertNotNull(component, 'component');
- var /** @type {?} */ hostNode = /** @type {?} */ ((/** @type {?} */ (component))[NG_HOST_SYMBOL]);
- if (ngDevMode && !hostNode) {
- createError('Not a directive instance', component);
- }
- ngDevMode && assertNotNull(hostNode.data, 'hostNode.data');
- renderComponentOrTemplate(hostNode, hostNode.view, component);
- isDirty = false;
- }
- var isDirty = false;
- /**
- * @template T
- * @param {?} component
- * @param {?=} scheduler
- * @return {?}
- */
- /**
- * @template T
- * @param {?} component
- * @return {?}
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Create a component definition object.
- *
- *
- * # Example
- * ```
- * class MyDirective {
- * // Generated by Angular Template Compiler
- * // [Symbol] syntax will not be supported by TypeScript until v2.7
- * static [COMPONENT_DEF_SYMBOL] = defineComponent({
- * ...
- * });
- * }
- * ```
- * @template T
- * @param {?} componentDefinition
- * @return {?}
- */
- function defineComponent(componentDefinition) {
- var /** @type {?} */ def = /** @type {?} */ ({
- type: componentDefinition.type,
- diPublic: null,
- n: componentDefinition.factory,
- tag: (/** @type {?} */ (componentDefinition)).tag || /** @type {?} */ ((null)),
- template: (/** @type {?} */ (componentDefinition)).template || /** @type {?} */ ((null)),
- r: componentDefinition.refresh ||
- function (d, e) { componentRefresh(d, e, componentDefinition.template); },
- h: componentDefinition.hostBindings || noop$1,
- inputs: invertObject(componentDefinition.inputs),
- outputs: invertObject(componentDefinition.outputs),
- methods: invertObject(componentDefinition.methods),
- rendererType: resolveRendererType2(componentDefinition.rendererType) || null,
- });
- var /** @type {?} */ feature = componentDefinition.features;
- feature && feature.forEach(function (fn) { return fn(def); });
- return def;
- }
- /**
- * @template T
- * @param {?} definition
- * @return {?}
- */
- /**
- * @template T
- * @param {?} definition
- * @return {?}
- */
- var EMPTY$1 = {};
- /**
- * @return {?}
- */
- function noop$1() { }
- /**
- * Swaps the keys and values of an object.
- * @param {?} obj
- * @return {?}
- */
- function invertObject(obj) {
- if (obj == null)
- return EMPTY$1;
- var /** @type {?} */ newObj = {};
- for (var /** @type {?} */ minifiedKey in obj) {
- newObj[obj[minifiedKey]] = minifiedKey;
- }
- return newObj;
- }
- /**
- * Create a directive definition object.
- *
- * # Example
- * ```
- * class MyDirective {
- * // Generated by Angular Template Compiler
- * // [Symbol] syntax will not be supported by TypeScript until v2.7
- * static [DIRECTIVE_DEF_SYMBOL] = defineDirective({
- * ...
- * });
- * }
- * ```
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- // clang-format on
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- * @record
- */
- /**
- * \@experimental Animation support is experimental.
- */
- /**
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link trigger trigger animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link state state animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link transition transition animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link keyframes keyframes animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link style style animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link animate animate animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link animateChild animateChild animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link useAnimation useAnimation animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link sequence sequence animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link group group animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * Metadata representing the entry of animations. Instances of this interface are provided via the
- * animation DSL when the {\@link stagger stagger animation function} is called.
- *
- * \@experimental Animation support is experimental.
- * @record
- */
- /**
- * `trigger` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. If this information is new, please navigate to the
- * {\@link Component#animations component animations metadata page} to gain a better
- * understanding of how animations in Angular are used.
- *
- * `trigger` Creates an animation trigger which will a list of {\@link state state} and
- * {\@link transition transition} entries that will be evaluated when the expression
- * bound to the trigger changes.
- *
- * Triggers are registered within the component annotation data under the
- * {\@link Component#animations animations section}. An animation trigger can be placed on an element
- * within a template by referencing the name of the trigger followed by the expression value that
- * the
- * trigger is bound to (in the form of `[\@triggerName]="expression"`.
- *
- * Animation trigger bindings strigify values and then match the previous and current values against
- * any linked transitions. If a boolean value is provided into the trigger binding then it will both
- * be represented as `1` or `true` and `0` or `false` for a true and false boolean values
- * respectively.
- *
- * ### Usage
- *
- * `trigger` will create an animation trigger reference based on the provided `name` value. The
- * provided `animation` value is expected to be an array consisting of {\@link state state} and
- * {\@link transition transition} declarations.
- *
- * ```typescript
- * \@Component({
- * selector: 'my-component',
- * templateUrl: 'my-component-tpl.html',
- * animations: [
- * trigger("myAnimationTrigger", [
- * state(...),
- * state(...),
- * transition(...),
- * transition(...)
- * ])
- * ]
- * })
- * class MyComponent {
- * myStatusExp = "something";
- * }
- * ```
- *
- * The template associated with this component will make use of the `myAnimationTrigger` animation
- * trigger by binding to an element within its template code.
- *
- * ```html
- * <!-- somewhere inside of my-component-tpl.html -->
- * <div [\@myAnimationTrigger]="myStatusExp">...</div>
- * ```
- *
- * ## Disable Animations
- * A special animation control binding called `\@.disabled` can be placed on an element which will
- * then disable animations for any inner animation triggers situated within the element as well as
- * any animations on the element itself.
- *
- * When true, the `\@.disabled` binding will prevent all animations from rendering. The example
- * below shows how to use this feature:
- *
- * ```ts
- * \@Component({
- * selector: 'my-component',
- * template: `
- * <div [\@.disabled]="isDisabled">
- * <div [\@childAnimation]="exp"></div>
- * </div>
- * `,
- * animations: [
- * trigger("childAnimation", [
- * // ...
- * ])
- * ]
- * })
- * class MyComponent {
- * isDisabled = true;
- * exp = '...';
- * }
- * ```
- *
- * The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening
- * (when true).
- *
- * Note that `\@.disabled` will only disable all animations (this means any animations running on
- * the same element will also be disabled).
- *
- * ### Disabling Animations Application-wide
- * When an area of the template is set to have animations disabled, **all** inner components will
- * also have their animations disabled as well. This means that all animations for an angular
- * application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular
- * component.
- *
- * ```ts
- * import {Component, HostBinding} from '\@angular/core';
- *
- * \@Component({
- * selector: 'app-component',
- * templateUrl: 'app.component.html',
- * })
- * class AppComponent {
- * \@HostBinding('\@.disabled')
- * public animationsDisabled = true;
- * }
- * ```
- *
- * ### What about animations that us `query()` and `animateChild()`?
- * Despite inner animations being disabled, a parent animation can {\@link query query} for inner
- * elements located in disabled areas of the template and still animate them as it sees fit. This is
- * also the case for when a sub animation is queried by a parent and then later animated using {\@link
- * animateChild animateChild}.
- *
- * \@experimental Animation support is experimental.
- * @param {?} name
- * @param {?} definitions
- * @return {?}
- */
- function trigger$1(name, definitions) {
- return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} };
- }
- /**
- * `animate` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. If this information is new, please navigate to the {\@link
- * Component#animations component animations metadata page} to gain a better understanding of
- * how animations in Angular are used.
- *
- * `animate` specifies an animation step that will apply the provided `styles` data for a given
- * amount of time based on the provided `timing` expression value. Calls to `animate` are expected
- * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link
- * transition transition}.
- *
- * ### Usage
- *
- * The `animate` function accepts two input parameters: `timing` and `styles`:
- *
- * - `timing` is a string based value that can be a combination of a duration with optional delay
- * and easing values. The format for the expression breaks down to `duration delay easing`
- * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
- * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the
- * `duration` value in millisecond form.
- * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link
- * keyframes keyframes}. If left empty then the styles from the destination state will be collected
- * and used (this is useful when describing an animation step that will complete an animation by
- * {\@link transition#the-final-animate-call animating to the final state}).
- *
- * ```typescript
- * // various functions for specifying timing data
- * animate(500, style(...))
- * animate("1s", style(...))
- * animate("100ms 0.5s", style(...))
- * animate("5s ease", style(...))
- * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
- *
- * // either style() of keyframes() can be used
- * animate(500, style({ background: "red" }))
- * animate(500, keyframes([
- * style({ background: "blue" })),
- * style({ background: "red" }))
- * ])
- * ```
- *
- * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
- *
- * \@experimental Animation support is experimental.
- * @param {?} timings
- * @param {?=} styles
- * @return {?}
- */
- function animate$1(timings, styles) {
- if (styles === void 0) { styles = null; }
- return { type: 4 /* Animate */, styles: styles, timings: timings };
- }
- /**
- * `group` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. If this information is new, please navigate to the {\@link
- * Component#animations component animations metadata page} to gain a better understanding of
- * how animations in Angular are used.
- *
- * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are
- * useful when a series of styles must be animated/closed off at different starting/ending times.
- *
- * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition
- * transition} and it will only continue to the next instruction once all of the inner animation
- * steps have completed.
- *
- * ### Usage
- *
- * The `steps` data that is passed into the `group` animation function can either consist of {\@link
- * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()`
- * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link
- * animate#usage animate() with a delay value} to offset styles to be applied at a later time).
- *
- * ```typescript
- * group([
- * animate("1s", { background: "black" }))
- * animate("2s", { color: "white" }))
- * ])
- * ```
- *
- * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
- *
- * \@experimental Animation support is experimental.
- * @param {?} steps
- * @param {?=} options
- * @return {?}
- */
- function group$1(steps, options) {
- if (options === void 0) { options = null; }
- return { type: 3 /* Group */, steps: steps, options: options };
- }
- /**
- * `sequence` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. If this information is new, please navigate to the {\@link
- * Component#animations component animations metadata page} to gain a better understanding of
- * how animations in Angular are used.
- *
- * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by
- * default when an array is passed as animation data into {\@link transition transition}.)
- *
- * The `sequence` function can either be used within a {\@link group group} or a {\@link transition
- * transition} and it will only continue to the next instruction once each of the inner animation
- * steps have completed.
- *
- * To perform animation styling in parallel with other animation steps then have a look at the
- * {\@link group group} animation function.
- *
- * ### Usage
- *
- * The `steps` data that is passed into the `sequence` animation function can either consist of
- * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the
- * provided styling data immediately while a call to `animate()` will apply its styling data over a
- * given time depending on its timing data.
- *
- * ```typescript
- * sequence([
- * style({ opacity: 0 })),
- * animate("1s", { opacity: 1 }))
- * ])
- * ```
- *
- * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
- *
- * \@experimental Animation support is experimental.
- * @param {?} steps
- * @param {?=} options
- * @return {?}
- */
- function sequence$1(steps, options) {
- if (options === void 0) { options = null; }
- return { type: 2 /* Sequence */, steps: steps, options: options };
- }
- /**
- * `style` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. If this information is new, please navigate to the {\@link
- * Component#animations component animations metadata page} to gain a better understanding of
- * how animations in Angular are used.
- *
- * `style` declares a key/value object containing CSS properties/styles that can then be used for
- * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data
- * for both {\@link animate animate} and {\@link keyframes keyframes}.
- *
- * ### Usage
- *
- * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs
- * to be defined.
- *
- * ```typescript
- * // string values are used for css properties
- * style({ background: "red", color: "blue" })
- *
- * // numerical (pixel) values are also supported
- * style({ width: 100, height: 0 })
- * ```
- *
- * #### Auto-styles (using `*`)
- *
- * When an asterix (`*`) character is used as a value then it will be detected from the element
- * being animated and applied as animation data when the animation starts.
- *
- * This feature proves useful for a state depending on layout and/or environment factors; in such
- * cases the styles are calculated just before the animation starts.
- *
- * ```typescript
- * // the steps below will animate from 0 to the
- * // actual height of the element
- * style({ height: 0 }),
- * animate("1s", style({ height: "*" }))
- * ```
- *
- * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
- *
- * \@experimental Animation support is experimental.
- * @param {?} tokens
- * @return {?}
- */
- function style$1(tokens) {
- return { type: 6 /* Style */, styles: tokens, offset: null };
- }
- /**
- * `state` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. If this information is new, please navigate to the {\@link
- * Component#animations component animations metadata page} to gain a better understanding of
- * how animations in Angular are used.
- *
- * `state` declares an animation state within the given trigger. When a state is active within a
- * component then its associated styles will persist on the element that the trigger is attached to
- * (even when the animation ends).
- *
- * To animate between states, have a look at the animation {\@link transition transition} DSL
- * function. To register states to an animation trigger please have a look at the {\@link trigger
- * trigger} function.
- *
- * #### The `void` state
- *
- * The `void` state value is a reserved word that angular uses to determine when the element is not
- * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
- * associated element is void).
- *
- * #### The `*` (default) state
- *
- * The `*` state (when styled) is a fallback state that will be used if the state that is being
- * animated is not declared within the trigger.
- *
- * ### Usage
- *
- * `state` will declare an animation state with its associated styles
- * within the given trigger.
- *
- * - `stateNameExpr` can be one or more state names separated by commas.
- * - `styles` refers to the {\@link style styling data} that will be persisted on the element once
- * the state has been reached.
- *
- * ```typescript
- * // "void" is a reserved name for a state and is used to represent
- * // the state in which an element is detached from from the application.
- * state("void", style({ height: 0 }))
- *
- * // user-defined states
- * state("closed", style({ height: 0 }))
- * state("open, visible", style({ height: "*" }))
- * ```
- *
- * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
- *
- * \@experimental Animation support is experimental.
- * @param {?} name
- * @param {?} styles
- * @param {?=} options
- * @return {?}
- */
- function state$1(name, styles, options) {
- return { type: 0 /* State */, name: name, styles: styles, options: options };
- }
- /**
- * `keyframes` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. If this information is new, please navigate to the {\@link
- * Component#animations component animations metadata page} to gain a better understanding of
- * how animations in Angular are used.
- *
- * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized
- * by an `offset` value.
- *
- * ### Usage
- *
- * The `keyframes` animation function is designed to be used alongside the {\@link animate animate}
- * animation function. Instead of applying animations from where they are currently to their
- * destination, keyframes can describe how each style entry is applied and at what point within the
- * animation arc (much like CSS Keyframe Animations do).
- *
- * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what
- * percentage of the animate time the styles will be applied.
- *
- * ```typescript
- * // the provided offset values describe when each backgroundColor value is applied.
- * animate("5s", keyframes([
- * style({ backgroundColor: "red", offset: 0 }),
- * style({ backgroundColor: "blue", offset: 0.2 }),
- * style({ backgroundColor: "orange", offset: 0.3 }),
- * style({ backgroundColor: "black", offset: 1 })
- * ]))
- * ```
- *
- * Alternatively, if there are no `offset` values used within the style entries then the offsets
- * will be calculated automatically.
- *
- * ```typescript
- * animate("5s", keyframes([
- * style({ backgroundColor: "red" }) // offset = 0
- * style({ backgroundColor: "blue" }) // offset = 0.33
- * style({ backgroundColor: "orange" }) // offset = 0.66
- * style({ backgroundColor: "black" }) // offset = 1
- * ]))
- * ```
- *
- * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
- *
- * \@experimental Animation support is experimental.
- * @param {?} steps
- * @return {?}
- */
- function keyframes$1(steps) {
- return { type: 5 /* Keyframes */, steps: steps };
- }
- /**
- * `transition` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. If this information is new, please navigate to the {\@link
- * Component#animations component animations metadata page} to gain a better understanding of
- * how animations in Angular are used.
- *
- * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the
- * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 =>
- * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting
- * and/or ending state).
- *
- * A function can also be provided as the `stateChangeExpr` argument for a transition and this
- * function will be executed each time a state change occurs. If the value returned within the
- * function is true then the associated animation will be run.
- *
- * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition
- * to animate to a state value and persist its styles then one or more {\@link state animation
- * states} is expected to be defined.
- *
- * ### Usage
- *
- * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
- * what the previous state is and what the current state has become. In other words, if a transition
- * is defined that matches the old/current state criteria then the associated animation will be
- * triggered.
- *
- * ```typescript
- * // all transition/state changes are defined within an animation trigger
- * trigger("myAnimationTrigger", [
- * // if a state is defined then its styles will be persisted when the
- * // animation has fully completed itself
- * state("on", style({ background: "green" })),
- * state("off", style({ background: "grey" })),
- *
- * // a transition animation that will be kicked off when the state value
- * // bound to "myAnimationTrigger" changes from "on" to "off"
- * transition("on => off", animate(500)),
- *
- * // it is also possible to do run the same animation for both directions
- * transition("on <=> off", animate(500)),
- *
- * // or to define multiple states pairs separated by commas
- * transition("on => off, off => void", animate(500)),
- *
- * // this is a catch-all state change for when an element is inserted into
- * // the page and the destination state is unknown
- * transition("void => *", [
- * style({ opacity: 0 }),
- * animate(500)
- * ]),
- *
- * // this will capture a state change between any states
- * transition("* => *", animate("1s 0s")),
- *
- * // you can also go full out and include a function
- * transition((fromState, toState) => {
- * // when `true` then it will allow the animation below to be invoked
- * return fromState == "off" && toState == "on";
- * }, animate("1s 0s"))
- * ])
- * ```
- *
- * The template associated with this component will make use of the `myAnimationTrigger` animation
- * trigger by binding to an element within its template code.
- *
- * ```html
- * <!-- somewhere inside of my-component-tpl.html -->
- * <div [\@myAnimationTrigger]="myStatusExp">...</div>
- * ```
- *
- * #### The final `animate` call
- *
- * If the final step within the transition steps is a call to `animate()` that **only** uses a
- * timing value with **no style data** then it will be automatically used as the final animation arc
- * for the element to animate itself to the final state. This involves an automatic mix of
- * adding/removing CSS styles so that the element will be in the exact state it should be for the
- * applied state to be presented correctly.
- *
- * ```
- * // start off by hiding the element, but make sure that it animates properly to whatever state
- * // is currently active for "myAnimationTrigger"
- * transition("void => *", [
- * style({ opacity: 0 }),
- * animate(500)
- * ])
- * ```
- *
- * ### Using :enter and :leave
- *
- * Given that enter (insertion) and leave (removal) animations are so common, the `transition`
- * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `*
- * => void` state changes.
- *
- * ```
- * transition(":enter", [
- * style({ opacity: 0 }),
- * animate(500, style({ opacity: 1 }))
- * ]),
- * transition(":leave", [
- * animate(500, style({ opacity: 0 }))
- * ])
- * ```
- *
- * ### Boolean values
- * if a trigger binding value is a boolean value then it can be matched using a transition
- * expression that compares `true` and `false` or `1` and `0`.
- *
- * ```
- * // in the template
- * <div [\@openClose]="open ? true : false">...</div>
- *
- * // in the component metadata
- * trigger('openClose', [
- * state('true', style({ height: '*' })),
- * state('false', style({ height: '0px' })),
- * transition('false <=> true', animate(500))
- * ])
- * ```
- *
- * ### Using :increment and :decrement
- * In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases
- * can be used to kick off a transition when a numeric value has increased or decreased in value.
- *
- * ```
- * import {group, animate, query, transition, style, trigger} from '\@angular/animations';
- * import {Component} from '\@angular/core';
- *
- * \@Component({
- * selector: 'banner-carousel-component',
- * styles: [`
- * .banner-container {
- * position:relative;
- * height:500px;
- * overflow:hidden;
- * }
- * .banner-container > .banner {
- * position:absolute;
- * left:0;
- * top:0;
- * font-size:200px;
- * line-height:500px;
- * font-weight:bold;
- * text-align:center;
- * width:100%;
- * }
- * `],
- * template: `
- * <button (click)="previous()">Previous</button>
- * <button (click)="next()">Next</button>
- * <hr>
- * <div [\@bannerAnimation]="selectedIndex" class="banner-container">
- * <div class="banner" *ngFor="let banner of banners"> {{ banner }} </div>
- * </div>
- * `,
- * animations: [
- * trigger('bannerAnimation', [
- * transition(":increment", group([
- * query(':enter', [
- * style({ left: '100%' }),
- * animate('0.5s ease-out', style('*'))
- * ]),
- * query(':leave', [
- * animate('0.5s ease-out', style({ left: '-100%' }))
- * ])
- * ])),
- * transition(":decrement", group([
- * query(':enter', [
- * style({ left: '-100%' }),
- * animate('0.5s ease-out', style('*'))
- * ]),
- * query(':leave', [
- * animate('0.5s ease-out', style({ left: '100%' }))
- * ])
- * ]))
- * ])
- * ]
- * })
- * class BannerCarouselComponent {
- * allBanners: string[] = ['1', '2', '3', '4'];
- * selectedIndex: number = 0;
- *
- * get banners() {
- * return [this.allBanners[this.selectedIndex]];
- * }
- *
- * previous() {
- * this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
- * }
- *
- * next() {
- * this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1);
- * }
- * }
- * ```
- *
- * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
- *
- * \@experimental Animation support is experimental.
- * @param {?} stateChangeExpr
- * @param {?} steps
- * @param {?=} options
- * @return {?}
- */
- function transition$1(stateChangeExpr, steps, options) {
- if (options === void 0) { options = null; }
- return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options };
- }
- /**
- * `animation` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language.
- *
- * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later
- * invoked in another animation or sequence. Reusable animations are designed to make use of
- * animation parameters and the produced animation can be used via the `useAnimation` method.
- *
- * ```
- * var fadeAnimation = animation([
- * style({ opacity: '{{ start }}' }),
- * animate('{{ time }}',
- * style({ opacity: '{{ end }}'}))
- * ], { params: { time: '1000ms', start: 0, end: 1 }});
- * ```
- *
- * If parameters are attached to an animation then they act as **default parameter values**. When an
- * animation is invoked via `useAnimation` then parameter values are allowed to be passed in
- * directly. If any of the passed in parameter values are missing then the default values will be
- * used.
- *
- * ```
- * useAnimation(fadeAnimation, {
- * params: {
- * time: '2s',
- * start: 1,
- * end: 0
- * }
- * })
- * ```
- *
- * If one or more parameter values are missing before animated then an error will be thrown.
- *
- * \@experimental Animation support is experimental.
- * @param {?} steps
- * @param {?=} options
- * @return {?}
- */
- /**
- * `animateChild` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. It works by allowing a queried element to execute its own
- * animation within the animation sequence.
- *
- * Each time an animation is triggered in angular, the parent animation
- * will always get priority and any child animations will be blocked. In order
- * for a child animation to run, the parent animation must query each of the elements
- * containing child animations and then allow the animations to run using `animateChild`.
- *
- * The example HTML code below shows both parent and child elements that have animation
- * triggers that will execute at the same time.
- *
- * ```html
- * <!-- parent-child.component.html -->
- * <button (click)="exp =! exp">Toggle</button>
- * <hr>
- *
- * <div [\@parentAnimation]="exp">
- * <header>Hello</header>
- * <div [\@childAnimation]="exp">
- * one
- * </div>
- * <div [\@childAnimation]="exp">
- * two
- * </div>
- * <div [\@childAnimation]="exp">
- * three
- * </div>
- * </div>
- * ```
- *
- * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate
- * because it has priority. However, using `query` and `animateChild` each of the inner animations
- * can also fire:
- *
- * ```ts
- * // parent-child.component.ts
- * import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations';
- * \@Component({
- * selector: 'parent-child-component',
- * animations: [
- * trigger('parentAnimation', [
- * transition('false => true', [
- * query('header', [
- * style({ opacity: 0 }),
- * animate(500, style({ opacity: 1 }))
- * ]),
- * query('\@childAnimation', [
- * animateChild()
- * ])
- * ])
- * ]),
- * trigger('childAnimation', [
- * transition('false => true', [
- * style({ opacity: 0 }),
- * animate(500, style({ opacity: 1 }))
- * ])
- * ])
- * ]
- * })
- * class ParentChildCmp {
- * exp: boolean = false;
- * }
- * ```
- *
- * In the animation code above, when the `parentAnimation` transition kicks off it first queries to
- * find the header element and fades it in. It then finds each of the sub elements that contain the
- * `\@childAnimation` trigger and then allows for their animations to fire.
- *
- * This example can be further extended by using stagger:
- *
- * ```ts
- * query('\@childAnimation', stagger(100, [
- * animateChild()
- * ]))
- * ```
- *
- * Now each of the sub animations start off with respect to the `100ms` staggering step.
- *
- * ## The first frame of child animations
- * When sub animations are executed using `animateChild` the animation engine will always apply the
- * first frame of every sub animation immediately at the start of the animation sequence. This way
- * the parent animation does not need to set any initial styling data on the sub elements before the
- * sub animations kick off.
- *
- * In the example above the first frame of the `childAnimation`'s `false => true` transition
- * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation`
- * animation transition sequence starts. Only then when the `\@childAnimation` is queried and called
- * with `animateChild` will it then animate to its destination of `opacity: 1`.
- *
- * Note that this feature designed to be used alongside {\@link query query()} and it will only work
- * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes
- * and transitions are not handled by this API).
- *
- * \@experimental Animation support is experimental.
- * @param {?=} options
- * @return {?}
- */
- /**
- * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. It is used to kick off a reusable animation that is created using {\@link
- * animation animation()}.
- *
- * \@experimental Animation support is experimental.
- * @param {?} animation
- * @param {?=} options
- * @return {?}
- */
- /**
- * `query` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language.
- *
- * query() is used to find one or more inner elements within the current element that is
- * being animated within the sequence. The provided animation steps are applied
- * to the queried element (by default, an array is provided, then this will be
- * treated as an animation sequence).
- *
- * ### Usage
- *
- * query() is designed to collect mutiple elements and works internally by using
- * `element.querySelectorAll`. An additional options object can be provided which
- * can be used to limit the total amount of items to be collected.
- *
- * ```js
- * query('div', [
- * animate(...),
- * animate(...)
- * ], { limit: 1 })
- * ```
- *
- * query(), by default, will throw an error when zero items are found. If a query
- * has the `optional` flag set to true then this error will be ignored.
- *
- * ```js
- * query('.some-element-that-may-not-be-there', [
- * animate(...),
- * animate(...)
- * ], { optional: true })
- * ```
- *
- * ### Special Selector Values
- *
- * The selector value within a query can collect elements that contain angular-specific
- * characteristics
- * using special pseudo-selectors tokens.
- *
- * These include:
- *
- * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")`
- * - Querying all currently animating elements using `query(":animating")`
- * - Querying elements that contain an animation trigger using `query("\@triggerName")`
- * - Querying all elements that contain an animation triggers using `query("\@*")`
- * - Including the current element into the animation sequence using `query(":self")`
- *
- *
- * Each of these pseudo-selector tokens can be merged together into a combined query selector
- * string:
- *
- * ```
- * query(':self, .record:enter, .record:leave, \@subTrigger', [...])
- * ```
- *
- * ### Demo
- *
- * ```
- * \@Component({
- * selector: 'inner',
- * template: `
- * <div [\@queryAnimation]="exp">
- * <h1>Title</h1>
- * <div class="content">
- * Blah blah blah
- * </div>
- * </div>
- * `,
- * animations: [
- * trigger('queryAnimation', [
- * transition('* => goAnimate', [
- * // hide the inner elements
- * query('h1', style({ opacity: 0 })),
- * query('.content', style({ opacity: 0 })),
- *
- * // animate the inner elements in, one by one
- * query('h1', animate(1000, style({ opacity: 1 })),
- * query('.content', animate(1000, style({ opacity: 1 })),
- * ])
- * ])
- * ]
- * })
- * class Cmp {
- * exp = '';
- *
- * goAnimate() {
- * this.exp = 'goAnimate';
- * }
- * }
- * ```
- *
- * \@experimental Animation support is experimental.
- * @param {?} selector
- * @param {?} animation
- * @param {?=} options
- * @return {?}
- */
- /**
- * `stagger` is an animation-specific function that is designed to be used inside of Angular's
- * animation DSL language. It is designed to be used inside of an animation {\@link query query()}
- * and works by issuing a timing gap between after each queried item is animated.
- *
- * ### Usage
- *
- * In the example below there is a container element that wraps a list of items stamped out
- * by an ngFor. The container element contains an animation trigger that will later be set
- * to query for each of the inner items.
- *
- * ```html
- * <!-- list.component.html -->
- * <button (click)="toggle()">Show / Hide Items</button>
- * <hr />
- * <div [\@listAnimation]="items.length">
- * <div *ngFor="let item of items">
- * {{ item }}
- * </div>
- * </div>
- * ```
- *
- * The component code for this looks as such:
- *
- * ```ts
- * import {trigger, transition, style, animate, query, stagger} from '\@angular/animations';
- * \@Component({
- * templateUrl: 'list.component.html',
- * animations: [
- * trigger('listAnimation', [
- * //...
- * ])
- * ]
- * })
- * class ListComponent {
- * items = [];
- *
- * showItems() {
- * this.items = [0,1,2,3,4];
- * }
- *
- * hideItems() {
- * this.items = [];
- * }
- *
- * toggle() {
- * this.items.length ? this.hideItems() : this.showItems();
- * }
- * }
- * ```
- *
- * And now for the animation trigger code:
- *
- * ```ts
- * trigger('listAnimation', [
- * transition('* => *', [ // each time the binding value changes
- * query(':leave', [
- * stagger(100, [
- * animate('0.5s', style({ opacity: 0 }))
- * ])
- * ]),
- * query(':enter', [
- * style({ opacity: 0 }),
- * stagger(100, [
- * animate('0.5s', style({ opacity: 1 }))
- * ])
- * ])
- * ])
- * ])
- * ```
- *
- * Now each time the items are added/removed then either the opacity
- * fade-in animation will run or each removed item will be faded out.
- * When either of these animations occur then a stagger effect will be
- * applied after each item's animation is started.
- *
- * \@experimental Animation support is experimental.
- * @param {?} timings
- * @param {?} animation
- * @return {?}
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- */
- var AUTO_STYLE = '*';
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @record
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @record
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @record
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @record
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @record
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @record
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @record
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @record
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @record
- */
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @param {?} name
- * @param {?} definitions
- * @return {?}
- */
- function trigger$$1(name, definitions) {
- return trigger$1(name, definitions);
- }
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @param {?} timings
- * @param {?=} styles
- * @return {?}
- */
- function animate$$1(timings, styles) {
- return animate$1(timings, styles);
- }
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @param {?} steps
- * @return {?}
- */
- function group$$1(steps) {
- return group$1(steps);
- }
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @param {?} steps
- * @return {?}
- */
- function sequence$$1(steps) {
- return sequence$1(steps);
- }
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @param {?} tokens
- * @return {?}
- */
- function style$$1(tokens) {
- return style$1(tokens);
- }
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @param {?} name
- * @param {?} styles
- * @return {?}
- */
- function state$$1(name, styles) {
- return state$1(name, styles);
- }
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @param {?} steps
- * @return {?}
- */
- function keyframes$$1(steps) {
- return keyframes$1(steps);
- }
- /**
- * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
- * @param {?} stateChangeExpr
- * @param {?} steps
- * @return {?}
- */
- function transition$$1(stateChangeExpr, steps) {
- return transition$1(stateChangeExpr, steps);
- }
- /**
- * @deprecated This has been renamed to `AnimationEvent`. Please import it from \@angular/animations.
- * @record
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @module
- * @description
- * Entry point from which you should import all public core APIs.
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @module
- * @description
- * Entry point for all public APIs of this package.
- */
- // This file only reexports content of the `src` folder. Keep it that way.
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * Generated bundle index. Do not edit.
- */
- //# sourceMappingURL=core.js.map
- /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("./node_modules/webpack/buildin/global.js")))
- /***/ }),
- /***/ "./node_modules/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export VERSION */
- /* unused harmony export JitCompilerFactory */
- /* unused harmony export RESOURCE_CACHE_PROVIDER */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return platformBrowserDynamic; });
- /* unused harmony export ɵCompilerImpl */
- /* unused harmony export ɵplatformCoreDynamic */
- /* unused harmony export ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS */
- /* unused harmony export ɵResourceLoaderImpl */
- /* unused harmony export ɵa */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_compiler__ = __webpack_require__("./node_modules/@angular/compiler/esm5/compiler.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm5/common.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_platform_browser__ = __webpack_require__("./node_modules/@angular/platform-browser/esm5/platform-browser.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
- /**
- * @license Angular v5.2.9
- * (c) 2010-2018 Google, Inc. https://angular.io/
- * License: MIT
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var MODULE_SUFFIX = '';
- var builtinExternalReferences = createBuiltinExternalReferencesMap();
- var JitReflector = /** @class */ (function () {
- function JitReflector() {
- this.builtinExternalReferences = new Map();
- this.reflectionCapabilities = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_15" /* ɵReflectionCapabilities */]();
- }
- /**
- * @param {?} type
- * @param {?} cmpMetadata
- * @return {?}
- */
- JitReflector.prototype.componentModuleUrl = /**
- * @param {?} type
- * @param {?} cmpMetadata
- * @return {?}
- */
- function (type, cmpMetadata) {
- var /** @type {?} */ moduleId = cmpMetadata.moduleId;
- if (typeof moduleId === 'string') {
- var /** @type {?} */ scheme = Object(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["z" /* getUrlScheme */])(moduleId);
- return scheme ? moduleId : "package:" + moduleId + MODULE_SUFFIX;
- }
- else if (moduleId !== null && moduleId !== void 0) {
- 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" +
- "If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.");
- }
- return "./" + Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_39" /* ɵstringify */])(type);
- };
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- JitReflector.prototype.parameters = /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (typeOrFunc) {
- return this.reflectionCapabilities.parameters(typeOrFunc);
- };
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- JitReflector.prototype.annotations = /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (typeOrFunc) {
- return this.reflectionCapabilities.annotations(typeOrFunc);
- };
- /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- JitReflector.prototype.propMetadata = /**
- * @param {?} typeOrFunc
- * @return {?}
- */
- function (typeOrFunc) {
- return this.reflectionCapabilities.propMetadata(typeOrFunc);
- };
- /**
- * @param {?} type
- * @param {?} lcProperty
- * @return {?}
- */
- JitReflector.prototype.hasLifecycleHook = /**
- * @param {?} type
- * @param {?} lcProperty
- * @return {?}
- */
- function (type, lcProperty) {
- return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
- };
- /**
- * @param {?} type
- * @return {?}
- */
- JitReflector.prototype.guards = /**
- * @param {?} type
- * @return {?}
- */
- function (type) { return this.reflectionCapabilities.guards(type); };
- /**
- * @param {?} ref
- * @return {?}
- */
- JitReflector.prototype.resolveExternalReference = /**
- * @param {?} ref
- * @return {?}
- */
- function (ref) {
- return builtinExternalReferences.get(ref) || ref.runtime;
- };
- return JitReflector;
- }());
- /**
- * @return {?}
- */
- function createBuiltinExternalReferencesMap() {
- var /** @type {?} */ map = new Map();
- 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 */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ElementRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["r" /* ElementRef */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].NgModuleRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["H" /* NgModuleRef */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ViewContainerRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_2" /* ViewContainerRef */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ChangeDetectorRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["j" /* ChangeDetectorRef */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].QueryList, __WEBPACK_IMPORTED_MODULE_1__angular_core__["P" /* QueryList */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].TemplateRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Z" /* TemplateRef */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].CodegenComponentFactoryResolver, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_11" /* ɵCodegenComponentFactoryResolver */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentFactoryResolver, __WEBPACK_IMPORTED_MODULE_1__angular_core__["o" /* ComponentFactoryResolver */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* ComponentFactory */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["p" /* ComponentRef */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].NgModuleFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["G" /* NgModuleFactory */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createModuleFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_18" /* ɵcmf */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].moduleDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_28" /* ɵmod */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].moduleProviderDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_29" /* ɵmpd */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].RegisterModuleFactoryFn, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_38" /* ɵregisterModuleFactory */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].Injector, __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Injector */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ViewEncapsulation, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_3" /* ViewEncapsulation */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ChangeDetectionStrategy, __WEBPACK_IMPORTED_MODULE_1__angular_core__["i" /* ChangeDetectionStrategy */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].SecurityContext, __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].LOCALE_ID, __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* LOCALE_ID */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].TRANSLATIONS_FORMAT, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Y" /* TRANSLATIONS_FORMAT */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].inlineInterpolate, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_23" /* ɵinlineInterpolate */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].interpolate, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_24" /* ɵinterpolate */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].EMPTY_ARRAY, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_13" /* ɵEMPTY_ARRAY */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].EMPTY_MAP, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* ɵEMPTY_MAP */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].Renderer, __WEBPACK_IMPORTED_MODULE_1__angular_core__["Q" /* Renderer */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].viewDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_42" /* ɵvid */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].elementDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_21" /* ɵeld */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].anchorDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_16" /* ɵand */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].textDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_40" /* ɵted */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].directiveDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_20" /* ɵdid */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].providerDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_36" /* ɵprd */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].queryDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_37" /* ɵqud */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pureArrayDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_32" /* ɵpad */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pureObjectDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_34" /* ɵpod */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].purePipeDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_35" /* ɵppd */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pipeDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_33" /* ɵpid */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].nodeValue, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_31" /* ɵnov */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ngContentDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵncd */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].unwrapValue, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_41" /* ɵunv */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createRendererType2, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_19" /* ɵcrt */]);
- map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createComponentFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_17" /* ɵccf */]);
- return map;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ERROR_COLLECTOR_TOKEN = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('ErrorCollector');
- /**
- * A default provider for {\@link PACKAGE_ROOT_URL} that maps to '/'.
- */
- var DEFAULT_PACKAGE_URL_PROVIDER = {
- provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["L" /* PACKAGE_ROOT_URL */],
- useValue: '/'
- };
- var _NO_RESOURCE_LOADER = {
- get: /**
- * @param {?} url
- * @return {?}
- */
- function (url) {
- throw new Error("No ResourceLoader implementation has been provided. Can't read the url \"" + url + "\"");
- }
- };
- var baseHtmlParser = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('HtmlParser');
- var CompilerImpl = /** @class */ (function () {
- function CompilerImpl(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console) {
- this._metadataResolver = _metadataResolver;
- this._delegate = new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["k" /* JitCompiler */](_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console, this.getExtraNgModuleProviders.bind(this));
- this.injector = injector;
- }
- /**
- * @return {?}
- */
- CompilerImpl.prototype.getExtraNgModuleProviders = /**
- * @return {?}
- */
- function () {
- return [this._metadataResolver.getProviderMetadata(new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["r" /* ProviderMeta */](__WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Compiler */], { useValue: this }))];
- };
- /**
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- CompilerImpl.prototype.compileModuleSync = /**
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- return /** @type {?} */ (this._delegate.compileModuleSync(moduleType));
- };
- /**
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- CompilerImpl.prototype.compileModuleAsync = /**
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- return /** @type {?} */ (this._delegate.compileModuleAsync(moduleType));
- };
- /**
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- CompilerImpl.prototype.compileModuleAndAllComponentsSync = /**
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- var /** @type {?} */ result = this._delegate.compileModuleAndAllComponentsSync(moduleType);
- return {
- ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
- componentFactories: /** @type {?} */ (result.componentFactories),
- };
- };
- /**
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- CompilerImpl.prototype.compileModuleAndAllComponentsAsync = /**
- * @template T
- * @param {?} moduleType
- * @return {?}
- */
- function (moduleType) {
- return this._delegate.compileModuleAndAllComponentsAsync(moduleType)
- .then(function (result) {
- return ({
- ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
- componentFactories: /** @type {?} */ (result.componentFactories),
- });
- });
- };
- /**
- * @param {?} summaries
- * @return {?}
- */
- CompilerImpl.prototype.loadAotSummaries = /**
- * @param {?} summaries
- * @return {?}
- */
- function (summaries) { this._delegate.loadAotSummaries(summaries); };
- /**
- * @param {?} ref
- * @return {?}
- */
- CompilerImpl.prototype.hasAotSummary = /**
- * @param {?} ref
- * @return {?}
- */
- function (ref) { return this._delegate.hasAotSummary(ref); };
- /**
- * @template T
- * @param {?} component
- * @return {?}
- */
- CompilerImpl.prototype.getComponentFactory = /**
- * @template T
- * @param {?} component
- * @return {?}
- */
- function (component) {
- return /** @type {?} */ (this._delegate.getComponentFactory(component));
- };
- /**
- * @return {?}
- */
- CompilerImpl.prototype.clearCache = /**
- * @return {?}
- */
- function () { this._delegate.clearCache(); };
- /**
- * @param {?} type
- * @return {?}
- */
- CompilerImpl.prototype.clearCacheFor = /**
- * @param {?} type
- * @return {?}
- */
- function (type) { this._delegate.clearCacheFor(type); };
- return CompilerImpl;
- }());
- /**
- * A set of providers that provide `JitCompiler` and its dependencies to use for
- * template compilation.
- */
- var COMPILER_PROVIDERS = /** @type {?} */ ([
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], useValue: new JitReflector() },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useValue: _NO_RESOURCE_LOADER },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["l" /* JitSummaryResolver */], deps: [] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */], useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["l" /* JitSummaryResolver */] },
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */], deps: [] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["m" /* Lexer */], deps: [] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["p" /* Parser */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["m" /* Lexer */]] },
- {
- provide: baseHtmlParser,
- useClass: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */],
- deps: [],
- },
- {
- provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */],
- useFactory: function (parser, translations, format, config, console) {
- translations = translations || '';
- var /** @type {?} */ missingTranslation = translations ? /** @type {?} */ ((config.missingTranslation)) : __WEBPACK_IMPORTED_MODULE_1__angular_core__["E" /* MissingTranslationStrategy */].Ignore;
- return new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */](parser, translations, format, missingTranslation, console);
- },
- deps: [
- baseHtmlParser,
- [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 */])],
- [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 */])],
- [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]],
- [__WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */]],
- ]
- },
- {
- provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */],
- useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */],
- },
- {
- 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 */],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["p" /* Parser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */]]
- },
- { 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 */]] },
- { 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 */],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["e" /* DirectiveResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["q" /* PipeResolver */],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["d" /* DirectiveNormalizer */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */],
- [__WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["t" /* StaticSymbolCache */]],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */],
- [__WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */], ERROR_COLLECTOR_TOKEN]] },
- DEFAULT_PACKAGE_URL_PROVIDER,
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["u" /* StyleCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */]] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["y" /* ViewCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["n" /* NgModuleCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], useValue: new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]() },
- { 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 */],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["w" /* TemplateParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["u" /* StyleCompiler */],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["y" /* ViewCompiler */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["n" /* NgModuleCompiler */],
- __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */],
- __WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* ɵConsole */]] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["f" /* DomElementSchemaRegistry */], deps: [] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */], useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["f" /* DomElementSchemaRegistry */] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */], deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["L" /* PACKAGE_ROOT_URL */]] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["e" /* DirectiveResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["q" /* PipeResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["o" /* NgModuleResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
- ]);
- /**
- * \@experimental
- */
- var JitCompilerFactory = /** @class */ (function () {
- /* @internal */
- function JitCompilerFactory(defaultOptions) {
- var /** @type {?} */ compilerOptions = {
- useJit: true,
- defaultEncapsulation: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_3" /* ViewEncapsulation */].Emulated,
- missingTranslation: __WEBPACK_IMPORTED_MODULE_1__angular_core__["E" /* MissingTranslationStrategy */].Warning,
- enableLegacyTemplate: false,
- };
- this._defaultOptions = [compilerOptions].concat(defaultOptions);
- }
- /**
- * @param {?=} options
- * @return {?}
- */
- JitCompilerFactory.prototype.createCompiler = /**
- * @param {?=} options
- * @return {?}
- */
- function (options) {
- if (options === void 0) { options = []; }
- var /** @type {?} */ opts = _mergeOptions(this._defaultOptions.concat(options));
- var /** @type {?} */ injector = __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Injector */].create([
- COMPILER_PROVIDERS, {
- provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */],
- useFactory: function () {
- return new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]({
- // let explicit values from the compiler options overwrite options
- // from the app providers
- useJit: opts.useJit,
- jitDevMode: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* isDevMode */])(),
- // let explicit values from the compiler options overwrite options
- // from the app providers
- defaultEncapsulation: opts.defaultEncapsulation,
- missingTranslation: opts.missingTranslation,
- enableLegacyTemplate: opts.enableLegacyTemplate,
- preserveWhitespaces: opts.preserveWhitespaces,
- });
- },
- deps: []
- },
- /** @type {?} */ ((opts.providers))
- ]);
- return injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Compiler */]);
- };
- return JitCompilerFactory;
- }());
- /**
- * @param {?} optionsArr
- * @return {?}
- */
- function _mergeOptions(optionsArr) {
- return {
- useJit: _lastDefined(optionsArr.map(function (options) { return options.useJit; })),
- defaultEncapsulation: _lastDefined(optionsArr.map(function (options) { return options.defaultEncapsulation; })),
- providers: _mergeArrays(optionsArr.map(function (options) { return ((options.providers)); })),
- missingTranslation: _lastDefined(optionsArr.map(function (options) { return options.missingTranslation; })),
- enableLegacyTemplate: _lastDefined(optionsArr.map(function (options) { return options.enableLegacyTemplate; })),
- preserveWhitespaces: _lastDefined(optionsArr.map(function (options) { return options.preserveWhitespaces; })),
- };
- }
- /**
- * @template T
- * @param {?} args
- * @return {?}
- */
- function _lastDefined(args) {
- for (var /** @type {?} */ i = args.length - 1; i >= 0; i--) {
- if (args[i] !== undefined) {
- return args[i];
- }
- }
- return undefined;
- }
- /**
- * @param {?} parts
- * @return {?}
- */
- function _mergeArrays(parts) {
- var /** @type {?} */ result = [];
- parts.forEach(function (part) { return part && result.push.apply(result, part); });
- return result;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A platform that included corePlatform and the compiler.
- *
- * \@experimental
- */
- var platformCoreDynamic = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_5" /* createPlatformFactory */])(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_9" /* platformCore */], 'coreDynamic', [
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* COMPILER_OPTIONS */], useValue: {}, multi: true },
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["l" /* CompilerFactory */], useClass: JitCompilerFactory, deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* COMPILER_OPTIONS */]] },
- ]);
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- var ResourceLoaderImpl = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_4_tslib__["b" /* __extends */])(ResourceLoaderImpl, _super);
- function ResourceLoaderImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} url
- * @return {?}
- */
- ResourceLoaderImpl.prototype.get = /**
- * @param {?} url
- * @return {?}
- */
- function (url) {
- var /** @type {?} */ resolve;
- var /** @type {?} */ reject;
- var /** @type {?} */ promise = new Promise(function (res, rej) {
- resolve = res;
- reject = rej;
- });
- var /** @type {?} */ xhr = new XMLHttpRequest();
- xhr.open('GET', url, true);
- xhr.responseType = 'text';
- xhr.onload = function () {
- // responseText is the old-school way of retrieving response (supported by IE8 & 9)
- // response/responseType properties were introduced in ResourceLoader Level2 spec (supported
- // by IE10)
- var /** @type {?} */ response = xhr.response || xhr.responseText;
- // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
- var /** @type {?} */ status = xhr.status === 1223 ? 204 : xhr.status;
- // fix status code when it is 0 (0 status is undocumented).
- // Occurs when accessing file resources or on Android 4.1 stock browser
- // while retrieving files from application cache.
- if (status === 0) {
- status = response ? 200 : 0;
- }
- if (200 <= status && status <= 300) {
- resolve(response);
- }
- else {
- reject("Failed to load " + url);
- }
- };
- xhr.onerror = function () { reject("Failed to load " + url); };
- xhr.send();
- return promise;
- };
- ResourceLoaderImpl.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- ResourceLoaderImpl.ctorParameters = function () { return []; };
- return ResourceLoaderImpl;
- }(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */]));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [
- __WEBPACK_IMPORTED_MODULE_3__angular_platform_browser__["b" /* ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS */],
- {
- provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* COMPILER_OPTIONS */],
- useValue: { providers: [{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useClass: ResourceLoaderImpl, deps: [] }] },
- multi: true
- },
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["M" /* PLATFORM_ID */], useValue: __WEBPACK_IMPORTED_MODULE_2__angular_common__["d" /* ɵPLATFORM_BROWSER_ID */] },
- ];
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An implementation of ResourceLoader that uses a template cache to avoid doing an actual
- * ResourceLoader.
- *
- * The template cache needs to be built and loaded into window.$templateCache
- * via a separate mechanism.
- */
- var CachedResourceLoader = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_4_tslib__["b" /* __extends */])(CachedResourceLoader, _super);
- function CachedResourceLoader() {
- var _this = _super.call(this) || this;
- _this._cache = (/** @type {?} */ (__WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */])).$templateCache;
- if (_this._cache == null) {
- throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.');
- }
- return _this;
- }
- /**
- * @param {?} url
- * @return {?}
- */
- CachedResourceLoader.prototype.get = /**
- * @param {?} url
- * @return {?}
- */
- function (url) {
- if (this._cache.hasOwnProperty(url)) {
- return Promise.resolve(this._cache[url]);
- }
- else {
- return /** @type {?} */ (Promise.reject('CachedResourceLoader: Did not find cached template for ' + url));
- }
- };
- return CachedResourceLoader;
- }(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */]));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- */
- var VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Version */]('5.2.9');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@experimental
- */
- var RESOURCE_CACHE_PROVIDER = [{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useClass: CachedResourceLoader, deps: [] }];
- /**
- * \@stable
- */
- var platformBrowserDynamic = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_5" /* createPlatformFactory */])(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @module
- * @description
- * Entry point for all public APIs of this package.
- */
- // This file only reexports content of the `src` folder. Keep it that way.
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * Generated bundle index. Do not edit.
- */
- //# sourceMappingURL=platform-browser-dynamic.js.map
- /***/ }),
- /***/ "./node_modules/@angular/platform-browser/esm5/platform-browser.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BrowserModule; });
- /* unused harmony export platformBrowser */
- /* unused harmony export Meta */
- /* unused harmony export Title */
- /* unused harmony export disableDebugTools */
- /* unused harmony export enableDebugTools */
- /* unused harmony export BrowserTransferStateModule */
- /* unused harmony export TransferState */
- /* unused harmony export makeStateKey */
- /* unused harmony export By */
- /* unused harmony export DOCUMENT */
- /* unused harmony export EVENT_MANAGER_PLUGINS */
- /* unused harmony export EventManager */
- /* unused harmony export HAMMER_GESTURE_CONFIG */
- /* unused harmony export HammerGestureConfig */
- /* unused harmony export DomSanitizer */
- /* unused harmony export VERSION */
- /* unused harmony export ɵBROWSER_SANITIZATION_PROVIDERS */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return INTERNAL_BROWSER_PLATFORM_PROVIDERS; });
- /* unused harmony export ɵinitDomAdapter */
- /* unused harmony export ɵBrowserDomAdapter */
- /* unused harmony export ɵBrowserPlatformLocation */
- /* unused harmony export ɵTRANSITION_ID */
- /* unused harmony export ɵBrowserGetTestability */
- /* unused harmony export ɵescapeHtml */
- /* unused harmony export ɵELEMENT_PROBE_PROVIDERS */
- /* unused harmony export ɵDomAdapter */
- /* unused harmony export ɵgetDOM */
- /* unused harmony export ɵsetRootDomAdapter */
- /* unused harmony export ɵDomRendererFactory2 */
- /* unused harmony export ɵNAMESPACE_URIS */
- /* unused harmony export ɵflattenStyles */
- /* unused harmony export ɵshimContentAttribute */
- /* unused harmony export ɵshimHostAttribute */
- /* unused harmony export ɵDomEventsPlugin */
- /* unused harmony export ɵHammerGesturesPlugin */
- /* unused harmony export ɵKeyEventsPlugin */
- /* unused harmony export ɵDomSharedStylesHost */
- /* unused harmony export ɵSharedStylesHost */
- /* unused harmony export ɵb */
- /* unused harmony export ɵa */
- /* unused harmony export ɵi */
- /* unused harmony export ɵg */
- /* unused harmony export ɵf */
- /* unused harmony export ɵc */
- /* unused harmony export ɵh */
- /* unused harmony export ɵd */
- /* unused harmony export ɵe */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm5/common.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js");
- /**
- * @license Angular v5.2.9
- * (c) 2010-2018 Google, Inc. https://angular.io/
- * License: MIT
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _DOM = /** @type {?} */ ((null));
- /**
- * @return {?}
- */
- function getDOM() {
- return _DOM;
- }
- /**
- * @param {?} adapter
- * @return {?}
- */
- /**
- * @param {?} adapter
- * @return {?}
- */
- function setRootDomAdapter(adapter) {
- if (!_DOM) {
- _DOM = adapter;
- }
- }
- /**
- * Provides DOM operations in an environment-agnostic way.
- *
- * \@security Tread carefully! Interacting with the DOM directly is dangerous and
- * can introduce XSS risks.
- * @abstract
- */
- var DomAdapter = /** @class */ (function () {
- function DomAdapter() {
- this.resourceLoaderType = /** @type {?} */ ((null));
- }
- Object.defineProperty(DomAdapter.prototype, "attrToPropMap", {
- /**
- * Maps attribute names to their corresponding property names for cases
- * where attribute name doesn't match property name.
- */
- get: /**
- * Maps attribute names to their corresponding property names for cases
- * where attribute name doesn't match property name.
- * @return {?}
- */
- function () { return this._attrToPropMap; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._attrToPropMap = value; },
- enumerable: true,
- configurable: true
- });
- return DomAdapter;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Provides DOM operations in any browser environment.
- *
- * \@security Tread carefully! Interacting with the DOM directly is dangerous and
- * can introduce XSS risks.
- * @abstract
- */
- var GenericBrowserDomAdapter = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(GenericBrowserDomAdapter, _super);
- function GenericBrowserDomAdapter() {
- var _this = _super.call(this) || this;
- _this._animationPrefix = null;
- _this._transitionEnd = null;
- try {
- var /** @type {?} */ element_1 = _this.createElement('div', document);
- if (_this.getStyle(element_1, 'animationName') != null) {
- _this._animationPrefix = '';
- }
- else {
- var /** @type {?} */ domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
- for (var /** @type {?} */ i = 0; i < domPrefixes.length; i++) {
- if (_this.getStyle(element_1, domPrefixes[i] + 'AnimationName') != null) {
- _this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
- break;
- }
- }
- }
- var /** @type {?} */ transEndEventNames_1 = {
- WebkitTransition: 'webkitTransitionEnd',
- MozTransition: 'transitionend',
- OTransition: 'oTransitionEnd otransitionend',
- transition: 'transitionend'
- };
- Object.keys(transEndEventNames_1).forEach(function (key) {
- if (_this.getStyle(element_1, key) != null) {
- _this._transitionEnd = transEndEventNames_1[key];
- }
- });
- }
- catch (/** @type {?} */ e) {
- _this._animationPrefix = null;
- _this._transitionEnd = null;
- }
- return _this;
- }
- /**
- * @param {?} el
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.getDistributedNodes = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return (/** @type {?} */ (el)).getDistributedNodes(); };
- /**
- * @param {?} el
- * @param {?} baseUrl
- * @param {?} href
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.resolveAndSetHref = /**
- * @param {?} el
- * @param {?} baseUrl
- * @param {?} href
- * @return {?}
- */
- function (el, baseUrl, href) {
- el.href = href == null ? baseUrl : baseUrl + '/../' + href;
- };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.supportsDOMEvents = /**
- * @return {?}
- */
- function () { return true; };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = /**
- * @return {?}
- */
- function () {
- return typeof (/** @type {?} */ (document.body)).createShadowRoot === 'function';
- };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.getAnimationPrefix = /**
- * @return {?}
- */
- function () { return this._animationPrefix ? this._animationPrefix : ''; };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.getTransitionEnd = /**
- * @return {?}
- */
- function () { return this._transitionEnd ? this._transitionEnd : ''; };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.supportsAnimation = /**
- * @return {?}
- */
- function () {
- return this._animationPrefix != null && this._transitionEnd != null;
- };
- return GenericBrowserDomAdapter;
- }(DomAdapter));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _attrToPropMap = {
- 'class': 'className',
- 'innerHtml': 'innerHTML',
- 'readonly': 'readOnly',
- 'tabindex': 'tabIndex',
- };
- var DOM_KEY_LOCATION_NUMPAD = 3;
- // Map to convert some key or keyIdentifier values to what will be returned by getEventKey
- var _keyMap = {
- // The following values are here for cross-browser compatibility and to match the W3C standard
- // cf http://www.w3.org/TR/DOM-Level-3-Events-key/
- '\b': 'Backspace',
- '\t': 'Tab',
- '\x7F': 'Delete',
- '\x1B': 'Escape',
- 'Del': 'Delete',
- 'Esc': 'Escape',
- 'Left': 'ArrowLeft',
- 'Right': 'ArrowRight',
- 'Up': 'ArrowUp',
- 'Down': 'ArrowDown',
- 'Menu': 'ContextMenu',
- 'Scroll': 'ScrollLock',
- 'Win': 'OS'
- };
- // There is a bug in Chrome for numeric keypad keys:
- // https://code.google.com/p/chromium/issues/detail?id=155654
- // 1, 2, 3 ... are reported as A, B, C ...
- var _chromeNumKeyPadMap = {
- 'A': '1',
- 'B': '2',
- 'C': '3',
- 'D': '4',
- 'E': '5',
- 'F': '6',
- 'G': '7',
- 'H': '8',
- 'I': '9',
- 'J': '*',
- 'K': '+',
- 'M': '-',
- 'N': '.',
- 'O': '/',
- '\x60': '0',
- '\x90': 'NumLock'
- };
- var nodeContains;
- if (__WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['Node']) {
- nodeContains = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['Node'].prototype.contains || function (node) {
- return !!(this.compareDocumentPosition(node) & 16);
- };
- }
- /**
- * A `DomAdapter` powered by full browser DOM APIs.
- *
- * \@security Tread carefully! Interacting with the DOM directly is dangerous and
- * can introduce XSS risks.
- */
- var BrowserDomAdapter = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(BrowserDomAdapter, _super);
- function BrowserDomAdapter() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} templateHtml
- * @return {?}
- */
- BrowserDomAdapter.prototype.parse = /**
- * @param {?} templateHtml
- * @return {?}
- */
- function (templateHtml) { throw new Error('parse not implemented'); };
- /**
- * @return {?}
- */
- BrowserDomAdapter.makeCurrent = /**
- * @return {?}
- */
- function () { setRootDomAdapter(new BrowserDomAdapter()); };
- /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasProperty = /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- function (element, name) { return name in element; };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setProperty = /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (el, name, value) { (/** @type {?} */ (el))[name] = value; };
- /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getProperty = /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- function (el, name) { return (/** @type {?} */ (el))[name]; };
- /**
- * @param {?} el
- * @param {?} methodName
- * @param {?} args
- * @return {?}
- */
- BrowserDomAdapter.prototype.invoke = /**
- * @param {?} el
- * @param {?} methodName
- * @param {?} args
- * @return {?}
- */
- function (el, methodName, args) {
- (_a = (/** @type {?} */ (el)))[methodName].apply(_a, args);
- var _a;
- };
- // TODO(tbosch): move this into a separate environment class once we have it
- /**
- * @param {?} error
- * @return {?}
- */
- BrowserDomAdapter.prototype.logError = /**
- * @param {?} error
- * @return {?}
- */
- function (error) {
- if (window.console) {
- if (console.error) {
- console.error(error);
- }
- else {
- console.log(error);
- }
- }
- };
- /**
- * @param {?} error
- * @return {?}
- */
- BrowserDomAdapter.prototype.log = /**
- * @param {?} error
- * @return {?}
- */
- function (error) {
- if (window.console) {
- window.console.log && window.console.log(error);
- }
- };
- /**
- * @param {?} error
- * @return {?}
- */
- BrowserDomAdapter.prototype.logGroup = /**
- * @param {?} error
- * @return {?}
- */
- function (error) {
- if (window.console) {
- window.console.group && window.console.group(error);
- }
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.logGroupEnd = /**
- * @return {?}
- */
- function () {
- if (window.console) {
- window.console.groupEnd && window.console.groupEnd();
- }
- };
- Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", {
- get: /**
- * @return {?}
- */
- function () { return _attrToPropMap; },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} nodeA
- * @param {?} nodeB
- * @return {?}
- */
- BrowserDomAdapter.prototype.contains = /**
- * @param {?} nodeA
- * @param {?} nodeB
- * @return {?}
- */
- function (nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); };
- /**
- * @param {?} el
- * @param {?} selector
- * @return {?}
- */
- BrowserDomAdapter.prototype.querySelector = /**
- * @param {?} el
- * @param {?} selector
- * @return {?}
- */
- function (el, selector) { return el.querySelector(selector); };
- /**
- * @param {?} el
- * @param {?} selector
- * @return {?}
- */
- BrowserDomAdapter.prototype.querySelectorAll = /**
- * @param {?} el
- * @param {?} selector
- * @return {?}
- */
- function (el, selector) { return el.querySelectorAll(selector); };
- /**
- * @param {?} el
- * @param {?} evt
- * @param {?} listener
- * @return {?}
- */
- BrowserDomAdapter.prototype.on = /**
- * @param {?} el
- * @param {?} evt
- * @param {?} listener
- * @return {?}
- */
- function (el, evt, listener) { el.addEventListener(evt, listener, false); };
- /**
- * @param {?} el
- * @param {?} evt
- * @param {?} listener
- * @return {?}
- */
- BrowserDomAdapter.prototype.onAndCancel = /**
- * @param {?} el
- * @param {?} evt
- * @param {?} listener
- * @return {?}
- */
- function (el, evt, listener) {
- el.addEventListener(evt, listener, false);
- // Needed to follow Dart's subscription semantic, until fix of
- // https://code.google.com/p/dart/issues/detail?id=17406
- return function () { el.removeEventListener(evt, listener, false); };
- };
- /**
- * @param {?} el
- * @param {?} evt
- * @return {?}
- */
- BrowserDomAdapter.prototype.dispatchEvent = /**
- * @param {?} el
- * @param {?} evt
- * @return {?}
- */
- function (el, evt) { el.dispatchEvent(evt); };
- /**
- * @param {?} eventType
- * @return {?}
- */
- BrowserDomAdapter.prototype.createMouseEvent = /**
- * @param {?} eventType
- * @return {?}
- */
- function (eventType) {
- var /** @type {?} */ evt = this.getDefaultDocument().createEvent('MouseEvent');
- evt.initEvent(eventType, true, true);
- return evt;
- };
- /**
- * @param {?} eventType
- * @return {?}
- */
- BrowserDomAdapter.prototype.createEvent = /**
- * @param {?} eventType
- * @return {?}
- */
- function (eventType) {
- var /** @type {?} */ evt = this.getDefaultDocument().createEvent('Event');
- evt.initEvent(eventType, true, true);
- return evt;
- };
- /**
- * @param {?} evt
- * @return {?}
- */
- BrowserDomAdapter.prototype.preventDefault = /**
- * @param {?} evt
- * @return {?}
- */
- function (evt) {
- evt.preventDefault();
- evt.returnValue = false;
- };
- /**
- * @param {?} evt
- * @return {?}
- */
- BrowserDomAdapter.prototype.isPrevented = /**
- * @param {?} evt
- * @return {?}
- */
- function (evt) {
- return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getInnerHTML = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.innerHTML; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getTemplateContent = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- return 'content' in el && this.isTemplateElement(el) ? (/** @type {?} */ (el)).content : null;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getOuterHTML = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.outerHTML; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.nodeName = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeName; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.nodeValue = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeValue; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.type = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.type; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.content = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- if (this.hasProperty(node, 'content')) {
- return (/** @type {?} */ (node)).content;
- }
- else {
- return node;
- }
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.firstChild = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.firstChild; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.nextSibling = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.nextSibling; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.parentElement = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.parentNode; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.childNodes = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.childNodes; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.childNodesAsList = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- var /** @type {?} */ childNodes = el.childNodes;
- var /** @type {?} */ res = new Array(childNodes.length);
- for (var /** @type {?} */ i = 0; i < childNodes.length; i++) {
- res[i] = childNodes[i];
- }
- return res;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.clearNodes = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- while (el.firstChild) {
- el.removeChild(el.firstChild);
- }
- };
- /**
- * @param {?} el
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.appendChild = /**
- * @param {?} el
- * @param {?} node
- * @return {?}
- */
- function (el, node) { el.appendChild(node); };
- /**
- * @param {?} el
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeChild = /**
- * @param {?} el
- * @param {?} node
- * @return {?}
- */
- function (el, node) { el.removeChild(node); };
- /**
- * @param {?} el
- * @param {?} newChild
- * @param {?} oldChild
- * @return {?}
- */
- BrowserDomAdapter.prototype.replaceChild = /**
- * @param {?} el
- * @param {?} newChild
- * @param {?} oldChild
- * @return {?}
- */
- function (el, newChild, oldChild) { el.replaceChild(newChild, oldChild); };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.remove = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- if (node.parentNode) {
- node.parentNode.removeChild(node);
- }
- return node;
- };
- /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.insertBefore = /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} node
- * @return {?}
- */
- function (parent, ref, node) { parent.insertBefore(node, ref); };
- /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} nodes
- * @return {?}
- */
- BrowserDomAdapter.prototype.insertAllBefore = /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} nodes
- * @return {?}
- */
- function (parent, ref, nodes) {
- nodes.forEach(function (n) { return parent.insertBefore(n, ref); });
- };
- /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.insertAfter = /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} node
- * @return {?}
- */
- function (parent, ref, node) { parent.insertBefore(node, ref.nextSibling); };
- /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setInnerHTML = /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- function (el, value) { el.innerHTML = value; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getText = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.textContent; };
- /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setText = /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- function (el, value) { el.textContent = value; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getValue = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.value; };
- /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setValue = /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- function (el, value) { el.value = value; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getChecked = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.checked; };
- /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setChecked = /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- function (el, value) { el.checked = value; };
- /**
- * @param {?} text
- * @return {?}
- */
- BrowserDomAdapter.prototype.createComment = /**
- * @param {?} text
- * @return {?}
- */
- function (text) { return this.getDefaultDocument().createComment(text); };
- /**
- * @param {?} html
- * @return {?}
- */
- BrowserDomAdapter.prototype.createTemplate = /**
- * @param {?} html
- * @return {?}
- */
- function (html) {
- var /** @type {?} */ t = this.getDefaultDocument().createElement('template');
- t.innerHTML = html;
- return t;
- };
- /**
- * @param {?} tagName
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createElement = /**
- * @param {?} tagName
- * @param {?=} doc
- * @return {?}
- */
- function (tagName, doc) {
- doc = doc || this.getDefaultDocument();
- return doc.createElement(tagName);
- };
- /**
- * @param {?} ns
- * @param {?} tagName
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createElementNS = /**
- * @param {?} ns
- * @param {?} tagName
- * @param {?=} doc
- * @return {?}
- */
- function (ns, tagName, doc) {
- doc = doc || this.getDefaultDocument();
- return doc.createElementNS(ns, tagName);
- };
- /**
- * @param {?} text
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createTextNode = /**
- * @param {?} text
- * @param {?=} doc
- * @return {?}
- */
- function (text, doc) {
- doc = doc || this.getDefaultDocument();
- return doc.createTextNode(text);
- };
- /**
- * @param {?} attrName
- * @param {?} attrValue
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createScriptTag = /**
- * @param {?} attrName
- * @param {?} attrValue
- * @param {?=} doc
- * @return {?}
- */
- function (attrName, attrValue, doc) {
- doc = doc || this.getDefaultDocument();
- var /** @type {?} */ el = /** @type {?} */ (doc.createElement('SCRIPT'));
- el.setAttribute(attrName, attrValue);
- return el;
- };
- /**
- * @param {?} css
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createStyleElement = /**
- * @param {?} css
- * @param {?=} doc
- * @return {?}
- */
- function (css, doc) {
- doc = doc || this.getDefaultDocument();
- var /** @type {?} */ style = /** @type {?} */ (doc.createElement('style'));
- this.appendChild(style, this.createTextNode(css, doc));
- return style;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.createShadowRoot = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return (/** @type {?} */ (el)).createShadowRoot(); };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getShadowRoot = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return (/** @type {?} */ (el)).shadowRoot; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getHost = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return (/** @type {?} */ (el)).host; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.clone = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.cloneNode(true); };
- /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getElementsByClassName = /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- function (element, name) {
- return element.getElementsByClassName(name);
- };
- /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getElementsByTagName = /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- function (element, name) {
- return element.getElementsByTagName(name);
- };
- /**
- * @param {?} element
- * @return {?}
- */
- BrowserDomAdapter.prototype.classList = /**
- * @param {?} element
- * @return {?}
- */
- function (element) { return Array.prototype.slice.call(element.classList, 0); };
- /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- BrowserDomAdapter.prototype.addClass = /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- function (element, className) { element.classList.add(className); };
- /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeClass = /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- function (element, className) { element.classList.remove(className); };
- /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasClass = /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- function (element, className) {
- return element.classList.contains(className);
- };
- /**
- * @param {?} element
- * @param {?} styleName
- * @param {?} styleValue
- * @return {?}
- */
- BrowserDomAdapter.prototype.setStyle = /**
- * @param {?} element
- * @param {?} styleName
- * @param {?} styleValue
- * @return {?}
- */
- function (element, styleName, styleValue) {
- element.style[styleName] = styleValue;
- };
- /**
- * @param {?} element
- * @param {?} stylename
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeStyle = /**
- * @param {?} element
- * @param {?} stylename
- * @return {?}
- */
- function (element, stylename) {
- // IE requires '' instead of null
- // see https://github.com/angular/angular/issues/7916
- element.style[stylename] = '';
- };
- /**
- * @param {?} element
- * @param {?} stylename
- * @return {?}
- */
- BrowserDomAdapter.prototype.getStyle = /**
- * @param {?} element
- * @param {?} stylename
- * @return {?}
- */
- function (element, stylename) { return element.style[stylename]; };
- /**
- * @param {?} element
- * @param {?} styleName
- * @param {?=} styleValue
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasStyle = /**
- * @param {?} element
- * @param {?} styleName
- * @param {?=} styleValue
- * @return {?}
- */
- function (element, styleName, styleValue) {
- var /** @type {?} */ value = this.getStyle(element, styleName) || '';
- return styleValue ? value == styleValue : value.length > 0;
- };
- /**
- * @param {?} element
- * @return {?}
- */
- BrowserDomAdapter.prototype.tagName = /**
- * @param {?} element
- * @return {?}
- */
- function (element) { return element.tagName; };
- /**
- * @param {?} element
- * @return {?}
- */
- BrowserDomAdapter.prototype.attributeMap = /**
- * @param {?} element
- * @return {?}
- */
- function (element) {
- var /** @type {?} */ res = new Map();
- var /** @type {?} */ elAttrs = element.attributes;
- for (var /** @type {?} */ i = 0; i < elAttrs.length; i++) {
- var /** @type {?} */ attrib = elAttrs.item(i);
- res.set(attrib.name, attrib.value);
- }
- return res;
- };
- /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasAttribute = /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- function (element, attribute) {
- return element.hasAttribute(attribute);
- };
- /**
- * @param {?} element
- * @param {?} ns
- * @param {?} attribute
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasAttributeNS = /**
- * @param {?} element
- * @param {?} ns
- * @param {?} attribute
- * @return {?}
- */
- function (element, ns, attribute) {
- return element.hasAttributeNS(ns, attribute);
- };
- /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- BrowserDomAdapter.prototype.getAttribute = /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- function (element, attribute) {
- return element.getAttribute(attribute);
- };
- /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getAttributeNS = /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @return {?}
- */
- function (element, ns, name) {
- return element.getAttributeNS(ns, name);
- };
- /**
- * @param {?} element
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setAttribute = /**
- * @param {?} element
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (element, name, value) { element.setAttribute(name, value); };
- /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setAttributeNS = /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (element, ns, name, value) {
- element.setAttributeNS(ns, name, value);
- };
- /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeAttribute = /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- function (element, attribute) { element.removeAttribute(attribute); };
- /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeAttributeNS = /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @return {?}
- */
- function (element, ns, name) {
- element.removeAttributeNS(ns, name);
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.templateAwareRoot = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return this.isTemplateElement(el) ? this.content(el) : el; };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.createHtmlDocument = /**
- * @return {?}
- */
- function () {
- return document.implementation.createHTMLDocument('fakeTitle');
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.getDefaultDocument = /**
- * @return {?}
- */
- function () { return document; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getBoundingClientRect = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- try {
- return el.getBoundingClientRect();
- }
- catch (/** @type {?} */ e) {
- return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
- }
- };
- /**
- * @param {?} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.getTitle = /**
- * @param {?} doc
- * @return {?}
- */
- function (doc) { return doc.title; };
- /**
- * @param {?} doc
- * @param {?} newTitle
- * @return {?}
- */
- BrowserDomAdapter.prototype.setTitle = /**
- * @param {?} doc
- * @param {?} newTitle
- * @return {?}
- */
- function (doc, newTitle) { doc.title = newTitle || ''; };
- /**
- * @param {?} n
- * @param {?} selector
- * @return {?}
- */
- BrowserDomAdapter.prototype.elementMatches = /**
- * @param {?} n
- * @param {?} selector
- * @return {?}
- */
- function (n, selector) {
- if (this.isElementNode(n)) {
- return n.matches && n.matches(selector) ||
- n.msMatchesSelector && n.msMatchesSelector(selector) ||
- n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
- }
- return false;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.isTemplateElement = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- return this.isElementNode(el) && el.nodeName === 'TEMPLATE';
- };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.isTextNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeType === Node.TEXT_NODE; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.isCommentNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeType === Node.COMMENT_NODE; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.isElementNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeType === Node.ELEMENT_NODE; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasShadowRoot = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- return node.shadowRoot != null && node instanceof HTMLElement;
- };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.isShadowRoot = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node instanceof DocumentFragment; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.importIntoDoc = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return document.importNode(this.templateAwareRoot(node), true); };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.adoptNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return document.adoptNode(node); };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getHref = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return /** @type {?} */ ((el.getAttribute('href'))); };
- /**
- * @param {?} event
- * @return {?}
- */
- BrowserDomAdapter.prototype.getEventKey = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- var /** @type {?} */ key = event.key;
- if (key == null) {
- key = event.keyIdentifier;
- // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
- // Safari cf
- // http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
- if (key == null) {
- return 'Unidentified';
- }
- if (key.startsWith('U+')) {
- key = String.fromCharCode(parseInt(key.substring(2), 16));
- if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
- // There is a bug in Chrome for numeric keypad keys:
- // https://code.google.com/p/chromium/issues/detail?id=155654
- // 1, 2, 3 ... are reported as A, B, C ...
- key = (/** @type {?} */ (_chromeNumKeyPadMap))[key];
- }
- }
- }
- return _keyMap[key] || key;
- };
- /**
- * @param {?} doc
- * @param {?} target
- * @return {?}
- */
- BrowserDomAdapter.prototype.getGlobalEventTarget = /**
- * @param {?} doc
- * @param {?} target
- * @return {?}
- */
- function (doc, target) {
- if (target === 'window') {
- return window;
- }
- if (target === 'document') {
- return doc;
- }
- if (target === 'body') {
- return doc.body;
- }
- return null;
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.getHistory = /**
- * @return {?}
- */
- function () { return window.history; };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.getLocation = /**
- * @return {?}
- */
- function () { return window.location; };
- /**
- * @param {?} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.getBaseHref = /**
- * @param {?} doc
- * @return {?}
- */
- function (doc) {
- var /** @type {?} */ href = getBaseElementHref();
- return href == null ? null : relativePath(href);
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.resetBaseElement = /**
- * @return {?}
- */
- function () { baseElement = null; };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.getUserAgent = /**
- * @return {?}
- */
- function () { return window.navigator.userAgent; };
- /**
- * @param {?} element
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setData = /**
- * @param {?} element
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (element, name, value) {
- this.setAttribute(element, 'data-' + name, value);
- };
- /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getData = /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- function (element, name) {
- return this.getAttribute(element, 'data-' + name);
- };
- /**
- * @param {?} element
- * @return {?}
- */
- BrowserDomAdapter.prototype.getComputedStyle = /**
- * @param {?} element
- * @return {?}
- */
- function (element) { return getComputedStyle(element); };
- // TODO(tbosch): move this into a separate environment class once we have it
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.supportsWebAnimation = /**
- * @return {?}
- */
- function () {
- return typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function';
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.performanceNow = /**
- * @return {?}
- */
- function () {
- // performance.now() is not available in all browsers, see
- // http://caniuse.com/#search=performance.now
- return window.performance && window.performance.now ? window.performance.now() :
- new Date().getTime();
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.supportsCookies = /**
- * @return {?}
- */
- function () { return true; };
- /**
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getCookie = /**
- * @param {?} name
- * @return {?}
- */
- function (name) { return Object(__WEBPACK_IMPORTED_MODULE_0__angular_common__["e" /* ɵparseCookieValue */])(document.cookie, name); };
- /**
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setCookie = /**
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (name, value) {
- // document.cookie is magical, assigning into it assigns/overrides one cookie value, but does
- // not clear other cookies.
- document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
- };
- return BrowserDomAdapter;
- }(GenericBrowserDomAdapter));
- var baseElement = null;
- /**
- * @return {?}
- */
- function getBaseElementHref() {
- if (!baseElement) {
- baseElement = /** @type {?} */ ((document.querySelector('base')));
- if (!baseElement) {
- return null;
- }
- }
- return baseElement.getAttribute('href');
- }
- // based on urlUtils.js in AngularJS 1
- var urlParsingNode;
- /**
- * @param {?} url
- * @return {?}
- */
- function relativePath(url) {
- if (!urlParsingNode) {
- urlParsingNode = document.createElement('a');
- }
- urlParsingNode.setAttribute('href', url);
- return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
- '/' + urlParsingNode.pathname;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A DI Token representing the main rendering context. In a browser this is the DOM Document.
- *
- * Note: Document might not be available in the Application Context when Application and Rendering
- * Contexts are not the same (e.g. when running the application into a Web Worker).
- *
- * @deprecated import from `\@angular/common` instead.
- */
- var DOCUMENT$1 = __WEBPACK_IMPORTED_MODULE_0__angular_common__["b" /* DOCUMENT */];
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @return {?}
- */
- function supportsState() {
- return !!window.history.pushState;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * `PlatformLocation` encapsulates all of the direct calls to platform APIs.
- * This class should not be used directly by an application developer. Instead, use
- * {\@link Location}.
- */
- var BrowserPlatformLocation = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(BrowserPlatformLocation, _super);
- function BrowserPlatformLocation(_doc) {
- var _this = _super.call(this) || this;
- _this._doc = _doc;
- _this._init();
- return _this;
- }
- // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
- /** @internal */
- /**
- * \@internal
- * @return {?}
- */
- BrowserPlatformLocation.prototype._init = /**
- * \@internal
- * @return {?}
- */
- function () {
- (/** @type {?} */ (this)).location = getDOM().getLocation();
- this._history = getDOM().getHistory();
- };
- /**
- * @return {?}
- */
- BrowserPlatformLocation.prototype.getBaseHrefFromDOM = /**
- * @return {?}
- */
- function () { return /** @type {?} */ ((getDOM().getBaseHref(this._doc))); };
- /**
- * @param {?} fn
- * @return {?}
- */
- BrowserPlatformLocation.prototype.onPopState = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false);
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- BrowserPlatformLocation.prototype.onHashChange = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false);
- };
- Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", {
- get: /**
- * @return {?}
- */
- function () { return this.location.pathname; },
- set: /**
- * @param {?} newPath
- * @return {?}
- */
- function (newPath) { this.location.pathname = newPath; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BrowserPlatformLocation.prototype, "search", {
- get: /**
- * @return {?}
- */
- function () { return this.location.search; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BrowserPlatformLocation.prototype, "hash", {
- get: /**
- * @return {?}
- */
- function () { return this.location.hash; },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @return {?}
- */
- BrowserPlatformLocation.prototype.pushState = /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @return {?}
- */
- function (state, title, url) {
- if (supportsState()) {
- this._history.pushState(state, title, url);
- }
- else {
- this.location.hash = url;
- }
- };
- /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @return {?}
- */
- BrowserPlatformLocation.prototype.replaceState = /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @return {?}
- */
- function (state, title, url) {
- if (supportsState()) {
- this._history.replaceState(state, title, url);
- }
- else {
- this.location.hash = url;
- }
- };
- /**
- * @return {?}
- */
- BrowserPlatformLocation.prototype.forward = /**
- * @return {?}
- */
- function () { this._history.forward(); };
- /**
- * @return {?}
- */
- BrowserPlatformLocation.prototype.back = /**
- * @return {?}
- */
- function () { this._history.back(); };
- BrowserPlatformLocation.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- BrowserPlatformLocation.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
- ]; };
- return BrowserPlatformLocation;
- }(__WEBPACK_IMPORTED_MODULE_0__angular_common__["c" /* PlatformLocation */]));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A service that can be used to get and add meta tags.
- *
- * \@experimental
- */
- var Meta = /** @class */ (function () {
- function Meta(_doc) {
- this._doc = _doc;
- this._dom = getDOM();
- }
- /**
- * @param {?} tag
- * @param {?=} forceCreation
- * @return {?}
- */
- Meta.prototype.addTag = /**
- * @param {?} tag
- * @param {?=} forceCreation
- * @return {?}
- */
- function (tag, forceCreation) {
- if (forceCreation === void 0) { forceCreation = false; }
- if (!tag)
- return null;
- return this._getOrCreateElement(tag, forceCreation);
- };
- /**
- * @param {?} tags
- * @param {?=} forceCreation
- * @return {?}
- */
- Meta.prototype.addTags = /**
- * @param {?} tags
- * @param {?=} forceCreation
- * @return {?}
- */
- function (tags, forceCreation) {
- var _this = this;
- if (forceCreation === void 0) { forceCreation = false; }
- if (!tags)
- return [];
- return tags.reduce(function (result, tag) {
- if (tag) {
- result.push(_this._getOrCreateElement(tag, forceCreation));
- }
- return result;
- }, []);
- };
- /**
- * @param {?} attrSelector
- * @return {?}
- */
- Meta.prototype.getTag = /**
- * @param {?} attrSelector
- * @return {?}
- */
- function (attrSelector) {
- if (!attrSelector)
- return null;
- return this._dom.querySelector(this._doc, "meta[" + attrSelector + "]") || null;
- };
- /**
- * @param {?} attrSelector
- * @return {?}
- */
- Meta.prototype.getTags = /**
- * @param {?} attrSelector
- * @return {?}
- */
- function (attrSelector) {
- if (!attrSelector)
- return [];
- var /** @type {?} */ list = this._dom.querySelectorAll(this._doc, "meta[" + attrSelector + "]");
- return list ? [].slice.call(list) : [];
- };
- /**
- * @param {?} tag
- * @param {?=} selector
- * @return {?}
- */
- Meta.prototype.updateTag = /**
- * @param {?} tag
- * @param {?=} selector
- * @return {?}
- */
- function (tag, selector) {
- if (!tag)
- return null;
- selector = selector || this._parseSelector(tag);
- var /** @type {?} */ meta = /** @type {?} */ ((this.getTag(selector)));
- if (meta) {
- return this._setMetaElementAttributes(tag, meta);
- }
- return this._getOrCreateElement(tag, true);
- };
- /**
- * @param {?} attrSelector
- * @return {?}
- */
- Meta.prototype.removeTag = /**
- * @param {?} attrSelector
- * @return {?}
- */
- function (attrSelector) { this.removeTagElement(/** @type {?} */ ((this.getTag(attrSelector)))); };
- /**
- * @param {?} meta
- * @return {?}
- */
- Meta.prototype.removeTagElement = /**
- * @param {?} meta
- * @return {?}
- */
- function (meta) {
- if (meta) {
- this._dom.remove(meta);
- }
- };
- /**
- * @param {?} meta
- * @param {?=} forceCreation
- * @return {?}
- */
- Meta.prototype._getOrCreateElement = /**
- * @param {?} meta
- * @param {?=} forceCreation
- * @return {?}
- */
- function (meta, forceCreation) {
- if (forceCreation === void 0) { forceCreation = false; }
- if (!forceCreation) {
- var /** @type {?} */ selector = this._parseSelector(meta);
- var /** @type {?} */ elem = /** @type {?} */ ((this.getTag(selector)));
- // It's allowed to have multiple elements with the same name so it's not enough to
- // just check that element with the same name already present on the page. We also need to
- // check if element has tag attributes
- if (elem && this._containsAttributes(meta, elem))
- return elem;
- }
- var /** @type {?} */ element = /** @type {?} */ (this._dom.createElement('meta'));
- this._setMetaElementAttributes(meta, element);
- var /** @type {?} */ head = this._dom.getElementsByTagName(this._doc, 'head')[0];
- this._dom.appendChild(head, element);
- return element;
- };
- /**
- * @param {?} tag
- * @param {?} el
- * @return {?}
- */
- Meta.prototype._setMetaElementAttributes = /**
- * @param {?} tag
- * @param {?} el
- * @return {?}
- */
- function (tag, el) {
- var _this = this;
- Object.keys(tag).forEach(function (prop) { return _this._dom.setAttribute(el, prop, tag[prop]); });
- return el;
- };
- /**
- * @param {?} tag
- * @return {?}
- */
- Meta.prototype._parseSelector = /**
- * @param {?} tag
- * @return {?}
- */
- function (tag) {
- var /** @type {?} */ attr = tag.name ? 'name' : 'property';
- return attr + "=\"" + tag[attr] + "\"";
- };
- /**
- * @param {?} tag
- * @param {?} elem
- * @return {?}
- */
- Meta.prototype._containsAttributes = /**
- * @param {?} tag
- * @param {?} elem
- * @return {?}
- */
- function (tag, elem) {
- var _this = this;
- return Object.keys(tag).every(function (key) { return _this._dom.getAttribute(elem, key) === tag[key]; });
- };
- Meta.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- Meta.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
- ]; };
- return Meta;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An id that identifies a particular application being bootstrapped, that should
- * match across the client/server boundary.
- */
- var TRANSITION_ID = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('TRANSITION_ID');
- /**
- * @param {?} transitionId
- * @param {?} document
- * @param {?} injector
- * @return {?}
- */
- function appInitializerFactory(transitionId, document, injector) {
- return function () {
- // Wait for all application initializers to be completed before removing the styles set by
- // the server.
- injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["d" /* ApplicationInitStatus */]).donePromise.then(function () {
- var /** @type {?} */ dom = getDOM();
- var /** @type {?} */ styles = Array.prototype.slice.apply(dom.querySelectorAll(document, "style[ng-transition]"));
- styles.filter(function (el) { return dom.getAttribute(el, 'ng-transition') === transitionId; })
- .forEach(function (el) { return dom.remove(el); });
- });
- };
- }
- var SERVER_TRANSITION_PROVIDERS = [
- {
- provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* APP_INITIALIZER */],
- useFactory: appInitializerFactory,
- deps: [TRANSITION_ID, DOCUMENT$1, __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Injector */]],
- multi: true
- },
- ];
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var BrowserGetTestability = /** @class */ (function () {
- function BrowserGetTestability() {
- }
- /**
- * @return {?}
- */
- BrowserGetTestability.init = /**
- * @return {?}
- */
- function () { Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_10" /* setTestabilityGetter */])(new BrowserGetTestability()); };
- /**
- * @param {?} registry
- * @return {?}
- */
- BrowserGetTestability.prototype.addToWindow = /**
- * @param {?} registry
- * @return {?}
- */
- function (registry) {
- __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['getAngularTestability'] = function (elem, findInAncestors) {
- if (findInAncestors === void 0) { findInAncestors = true; }
- var /** @type {?} */ testability = registry.findTestabilityInTree(elem, findInAncestors);
- if (testability == null) {
- throw new Error('Could not find testability for element.');
- }
- return testability;
- };
- __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
- __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
- var /** @type {?} */ whenAllStable = function (callback /** TODO #9100 */) {
- var /** @type {?} */ testabilities = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['getAllAngularTestabilities']();
- var /** @type {?} */ count = testabilities.length;
- var /** @type {?} */ didWork = false;
- var /** @type {?} */ decrement = function (didWork_ /** TODO #9100 */) {
- didWork = didWork || didWork_;
- count--;
- if (count == 0) {
- callback(didWork);
- }
- };
- testabilities.forEach(function (testability /** TODO #9100 */) {
- testability.whenStable(decrement);
- });
- };
- if (!__WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['frameworkStabilizers']) {
- __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['frameworkStabilizers'] = [];
- }
- __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['frameworkStabilizers'].push(whenAllStable);
- };
- /**
- * @param {?} registry
- * @param {?} elem
- * @param {?} findInAncestors
- * @return {?}
- */
- BrowserGetTestability.prototype.findTestabilityInTree = /**
- * @param {?} registry
- * @param {?} elem
- * @param {?} findInAncestors
- * @return {?}
- */
- function (registry, elem, findInAncestors) {
- if (elem == null) {
- return null;
- }
- var /** @type {?} */ t = registry.getTestability(elem);
- if (t != null) {
- return t;
- }
- else if (!findInAncestors) {
- return null;
- }
- if (getDOM().isShadowRoot(elem)) {
- return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
- }
- return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
- };
- return BrowserGetTestability;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A service that can be used to get and set the title of a current HTML document.
- *
- * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
- * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
- * (representing the `<title>` tag). Instead, this service can be used to set and get the current
- * title value.
- *
- * \@experimental
- */
- var Title = /** @class */ (function () {
- function Title(_doc) {
- this._doc = _doc;
- }
- /**
- * Get the title of the current HTML document.
- */
- /**
- * Get the title of the current HTML document.
- * @return {?}
- */
- Title.prototype.getTitle = /**
- * Get the title of the current HTML document.
- * @return {?}
- */
- function () { return getDOM().getTitle(this._doc); };
- /**
- * Set the title of the current HTML document.
- * @param newTitle
- */
- /**
- * Set the title of the current HTML document.
- * @param {?} newTitle
- * @return {?}
- */
- Title.prototype.setTitle = /**
- * Set the title of the current HTML document.
- * @param {?} newTitle
- * @return {?}
- */
- function (newTitle) { getDOM().setTitle(this._doc, newTitle); };
- Title.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- Title.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
- ]; };
- return Title;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} input
- * @return {?}
- */
- /**
- * @param {?} input
- * @return {?}
- */
- /**
- * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
- * `name` is `'probe'`.
- * @param {?} name Name under which it will be exported. Keep in mind this will be a property of the
- * global `ng` object.
- * @param {?} value The value to export.
- * @return {?}
- */
- function exportNgVar(name, value) {
- if (typeof COMPILED === 'undefined' || !COMPILED) {
- // Note: we can't export `ng` when using closure enhanced optimization as:
- // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
- // - we can't declare a closure extern as the namespace `ng` is already used within Google
- // for typings for angularJS (via `goog.provide('ng....')`).
- var /** @type {?} */ ng = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['ng'] = (/** @type {?} */ (__WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵglobal */]['ng'])) || {};
- ng[name] = value;
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var CORE_TOKENS = {
- 'ApplicationRef': __WEBPACK_IMPORTED_MODULE_1__angular_core__["f" /* ApplicationRef */],
- 'NgZone': __WEBPACK_IMPORTED_MODULE_1__angular_core__["J" /* NgZone */],
- };
- var INSPECT_GLOBAL_NAME = 'probe';
- var CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
- /**
- * Returns a {\@link DebugElement} for the given native DOM element, or
- * null if the given native element does not have an Angular view associated
- * with it.
- * @param {?} element
- * @return {?}
- */
- function inspectNativeElement(element) {
- return Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_7" /* getDebugNode */])(element);
- }
- /**
- * @param {?} coreTokens
- * @return {?}
- */
- function _createNgProbe(coreTokens) {
- exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
- exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["a" /* __assign */])({}, CORE_TOKENS, _ngProbeTokensToMap(coreTokens || [])));
- return function () { return inspectNativeElement; };
- }
- /**
- * @param {?} tokens
- * @return {?}
- */
- function _ngProbeTokensToMap(tokens) {
- return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {});
- }
- /**
- * Providers which support debugging Angular applications (e.g. via `ng.probe`).
- */
- var ELEMENT_PROBE_PROVIDERS = [
- {
- provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* APP_INITIALIZER */],
- useFactory: _createNgProbe,
- deps: [
- [__WEBPACK_IMPORTED_MODULE_1__angular_core__["I" /* NgProbeToken */], new __WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */]()],
- ],
- multi: true,
- },
- ];
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- */
- var EVENT_MANAGER_PLUGINS = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('EventManagerPlugins');
- /**
- * \@stable
- */
- var EventManager = /** @class */ (function () {
- function EventManager(plugins, _zone) {
- var _this = this;
- this._zone = _zone;
- this._eventNameToPlugin = new Map();
- plugins.forEach(function (p) { return p.manager = _this; });
- this._plugins = plugins.slice().reverse();
- }
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- EventManager.prototype.addEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var /** @type {?} */ plugin = this._findPluginFor(eventName);
- return plugin.addEventListener(element, eventName, handler);
- };
- /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- EventManager.prototype.addGlobalEventListener = /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (target, eventName, handler) {
- var /** @type {?} */ plugin = this._findPluginFor(eventName);
- return plugin.addGlobalEventListener(target, eventName, handler);
- };
- /**
- * @return {?}
- */
- EventManager.prototype.getZone = /**
- * @return {?}
- */
- function () { return this._zone; };
- /** @internal */
- /**
- * \@internal
- * @param {?} eventName
- * @return {?}
- */
- EventManager.prototype._findPluginFor = /**
- * \@internal
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) {
- var /** @type {?} */ plugin = this._eventNameToPlugin.get(eventName);
- if (plugin) {
- return plugin;
- }
- var /** @type {?} */ plugins = this._plugins;
- for (var /** @type {?} */ i = 0; i < plugins.length; i++) {
- var /** @type {?} */ plugin_1 = plugins[i];
- if (plugin_1.supports(eventName)) {
- this._eventNameToPlugin.set(eventName, plugin_1);
- return plugin_1;
- }
- }
- throw new Error("No event manager plugin found for event " + eventName);
- };
- EventManager.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- EventManager.ctorParameters = function () { return [
- { type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [EVENT_MANAGER_PLUGINS,] },] },
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["J" /* NgZone */], },
- ]; };
- return EventManager;
- }());
- /**
- * @abstract
- */
- var EventManagerPlugin = /** @class */ (function () {
- function EventManagerPlugin(_doc) {
- this._doc = _doc;
- }
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- EventManagerPlugin.prototype.addGlobalEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var /** @type {?} */ target = getDOM().getGlobalEventTarget(this._doc, element);
- if (!target) {
- throw new Error("Unsupported event target " + target + " for event " + eventName);
- }
- return this.addEventListener(target, eventName, handler);
- };
- return EventManagerPlugin;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var SharedStylesHost = /** @class */ (function () {
- function SharedStylesHost() {
- /**
- * \@internal
- */
- this._stylesSet = new Set();
- }
- /**
- * @param {?} styles
- * @return {?}
- */
- SharedStylesHost.prototype.addStyles = /**
- * @param {?} styles
- * @return {?}
- */
- function (styles) {
- var _this = this;
- var /** @type {?} */ additions = new Set();
- styles.forEach(function (style) {
- if (!_this._stylesSet.has(style)) {
- _this._stylesSet.add(style);
- additions.add(style);
- }
- });
- this.onStylesAdded(additions);
- };
- /**
- * @param {?} additions
- * @return {?}
- */
- SharedStylesHost.prototype.onStylesAdded = /**
- * @param {?} additions
- * @return {?}
- */
- function (additions) { };
- /**
- * @return {?}
- */
- SharedStylesHost.prototype.getAllStyles = /**
- * @return {?}
- */
- function () { return Array.from(this._stylesSet); };
- SharedStylesHost.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- SharedStylesHost.ctorParameters = function () { return []; };
- return SharedStylesHost;
- }());
- var DomSharedStylesHost = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(DomSharedStylesHost, _super);
- function DomSharedStylesHost(_doc) {
- var _this = _super.call(this) || this;
- _this._doc = _doc;
- _this._hostNodes = new Set();
- _this._styleNodes = new Set();
- _this._hostNodes.add(_doc.head);
- return _this;
- }
- /**
- * @param {?} styles
- * @param {?} host
- * @return {?}
- */
- DomSharedStylesHost.prototype._addStylesToHost = /**
- * @param {?} styles
- * @param {?} host
- * @return {?}
- */
- function (styles, host) {
- var _this = this;
- styles.forEach(function (style) {
- var /** @type {?} */ styleEl = _this._doc.createElement('style');
- styleEl.textContent = style;
- _this._styleNodes.add(host.appendChild(styleEl));
- });
- };
- /**
- * @param {?} hostNode
- * @return {?}
- */
- DomSharedStylesHost.prototype.addHost = /**
- * @param {?} hostNode
- * @return {?}
- */
- function (hostNode) {
- this._addStylesToHost(this._stylesSet, hostNode);
- this._hostNodes.add(hostNode);
- };
- /**
- * @param {?} hostNode
- * @return {?}
- */
- DomSharedStylesHost.prototype.removeHost = /**
- * @param {?} hostNode
- * @return {?}
- */
- function (hostNode) { this._hostNodes.delete(hostNode); };
- /**
- * @param {?} additions
- * @return {?}
- */
- DomSharedStylesHost.prototype.onStylesAdded = /**
- * @param {?} additions
- * @return {?}
- */
- function (additions) {
- var _this = this;
- this._hostNodes.forEach(function (hostNode) { return _this._addStylesToHost(additions, hostNode); });
- };
- /**
- * @return {?}
- */
- DomSharedStylesHost.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () { this._styleNodes.forEach(function (styleNode) { return getDOM().remove(styleNode); }); };
- DomSharedStylesHost.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- DomSharedStylesHost.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
- ]; };
- return DomSharedStylesHost;
- }(SharedStylesHost));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var NAMESPACE_URIS = {
- 'svg': 'http://www.w3.org/2000/svg',
- 'xhtml': 'http://www.w3.org/1999/xhtml',
- 'xlink': 'http://www.w3.org/1999/xlink',
- 'xml': 'http://www.w3.org/XML/1998/namespace',
- 'xmlns': 'http://www.w3.org/2000/xmlns/',
- };
- var COMPONENT_REGEX = /%COMP%/g;
- var COMPONENT_VARIABLE = '%COMP%';
- var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
- var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
- /**
- * @param {?} componentShortId
- * @return {?}
- */
- function shimContentAttribute(componentShortId) {
- return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
- }
- /**
- * @param {?} componentShortId
- * @return {?}
- */
- function shimHostAttribute(componentShortId) {
- return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
- }
- /**
- * @param {?} compId
- * @param {?} styles
- * @param {?} target
- * @return {?}
- */
- function flattenStyles(compId, styles, target) {
- for (var /** @type {?} */ i = 0; i < styles.length; i++) {
- var /** @type {?} */ style = styles[i];
- if (Array.isArray(style)) {
- flattenStyles(compId, style, target);
- }
- else {
- style = style.replace(COMPONENT_REGEX, compId);
- target.push(style);
- }
- }
- return target;
- }
- /**
- * @param {?} eventHandler
- * @return {?}
- */
- function decoratePreventDefault(eventHandler) {
- return function (event) {
- var /** @type {?} */ allowDefaultBehavior = eventHandler(event);
- if (allowDefaultBehavior === false) {
- // TODO(tbosch): move preventDefault into event plugins...
- event.preventDefault();
- event.returnValue = false;
- }
- };
- }
- var DomRendererFactory2 = /** @class */ (function () {
- function DomRendererFactory2(eventManager, sharedStylesHost) {
- this.eventManager = eventManager;
- this.sharedStylesHost = sharedStylesHost;
- this.rendererByCompId = new Map();
- this.defaultRenderer = new DefaultDomRenderer2(eventManager);
- }
- /**
- * @param {?} element
- * @param {?} type
- * @return {?}
- */
- DomRendererFactory2.prototype.createRenderer = /**
- * @param {?} element
- * @param {?} type
- * @return {?}
- */
- function (element, type) {
- if (!element || !type) {
- return this.defaultRenderer;
- }
- switch (type.encapsulation) {
- case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_3" /* ViewEncapsulation */].Emulated: {
- var /** @type {?} */ renderer = this.rendererByCompId.get(type.id);
- if (!renderer) {
- renderer =
- new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type);
- this.rendererByCompId.set(type.id, renderer);
- }
- (/** @type {?} */ (renderer)).applyToHost(element);
- return renderer;
- }
- case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_3" /* ViewEncapsulation */].Native:
- return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
- default: {
- if (!this.rendererByCompId.has(type.id)) {
- var /** @type {?} */ styles = flattenStyles(type.id, type.styles, []);
- this.sharedStylesHost.addStyles(styles);
- this.rendererByCompId.set(type.id, this.defaultRenderer);
- }
- return this.defaultRenderer;
- }
- }
- };
- /**
- * @return {?}
- */
- DomRendererFactory2.prototype.begin = /**
- * @return {?}
- */
- function () { };
- /**
- * @return {?}
- */
- DomRendererFactory2.prototype.end = /**
- * @return {?}
- */
- function () { };
- DomRendererFactory2.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- DomRendererFactory2.ctorParameters = function () { return [
- { type: EventManager, },
- { type: DomSharedStylesHost, },
- ]; };
- return DomRendererFactory2;
- }());
- var DefaultDomRenderer2 = /** @class */ (function () {
- function DefaultDomRenderer2(eventManager) {
- this.eventManager = eventManager;
- this.data = Object.create(null);
- }
- /**
- * @return {?}
- */
- DefaultDomRenderer2.prototype.destroy = /**
- * @return {?}
- */
- function () { };
- /**
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- DefaultDomRenderer2.prototype.createElement = /**
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- function (name, namespace) {
- if (namespace) {
- return document.createElementNS(NAMESPACE_URIS[namespace], name);
- }
- return document.createElement(name);
- };
- /**
- * @param {?} value
- * @return {?}
- */
- DefaultDomRenderer2.prototype.createComment = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return document.createComment(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DefaultDomRenderer2.prototype.createText = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return document.createTextNode(value); };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- DefaultDomRenderer2.prototype.appendChild = /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- function (parent, newChild) { parent.appendChild(newChild); };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- DefaultDomRenderer2.prototype.insertBefore = /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- function (parent, newChild, refChild) {
- if (parent) {
- parent.insertBefore(newChild, refChild);
- }
- };
- /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- DefaultDomRenderer2.prototype.removeChild = /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- function (parent, oldChild) {
- if (parent) {
- parent.removeChild(oldChild);
- }
- };
- /**
- * @param {?} selectorOrNode
- * @return {?}
- */
- DefaultDomRenderer2.prototype.selectRootElement = /**
- * @param {?} selectorOrNode
- * @return {?}
- */
- function (selectorOrNode) {
- var /** @type {?} */ el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
- selectorOrNode;
- if (!el) {
- throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
- }
- el.textContent = '';
- return el;
- };
- /**
- * @param {?} node
- * @return {?}
- */
- DefaultDomRenderer2.prototype.parentNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.parentNode; };
- /**
- * @param {?} node
- * @return {?}
- */
- DefaultDomRenderer2.prototype.nextSibling = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nextSibling; };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @param {?=} namespace
- * @return {?}
- */
- DefaultDomRenderer2.prototype.setAttribute = /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @param {?=} namespace
- * @return {?}
- */
- function (el, name, value, namespace) {
- if (namespace) {
- name = namespace + ":" + name;
- var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
- if (namespaceUri) {
- el.setAttributeNS(namespaceUri, name, value);
- }
- else {
- el.setAttribute(name, value);
- }
- }
- else {
- el.setAttribute(name, value);
- }
- };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- DefaultDomRenderer2.prototype.removeAttribute = /**
- * @param {?} el
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- function (el, name, namespace) {
- if (namespace) {
- var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
- if (namespaceUri) {
- el.removeAttributeNS(namespaceUri, name);
- }
- else {
- el.removeAttribute(namespace + ":" + name);
- }
- }
- else {
- el.removeAttribute(name);
- }
- };
- /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- DefaultDomRenderer2.prototype.addClass = /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- function (el, name) { el.classList.add(name); };
- /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- DefaultDomRenderer2.prototype.removeClass = /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- function (el, name) { el.classList.remove(name); };
- /**
- * @param {?} el
- * @param {?} style
- * @param {?} value
- * @param {?} flags
- * @return {?}
- */
- DefaultDomRenderer2.prototype.setStyle = /**
- * @param {?} el
- * @param {?} style
- * @param {?} value
- * @param {?} flags
- * @return {?}
- */
- function (el, style, value, flags) {
- if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["T" /* RendererStyleFlags2 */].DashCase) {
- el.style.setProperty(style, value, !!(flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["T" /* RendererStyleFlags2 */].Important) ? 'important' : '');
- }
- else {
- el.style[style] = value;
- }
- };
- /**
- * @param {?} el
- * @param {?} style
- * @param {?} flags
- * @return {?}
- */
- DefaultDomRenderer2.prototype.removeStyle = /**
- * @param {?} el
- * @param {?} style
- * @param {?} flags
- * @return {?}
- */
- function (el, style, flags) {
- if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["T" /* RendererStyleFlags2 */].DashCase) {
- el.style.removeProperty(style);
- }
- else {
- // IE requires '' instead of null
- // see https://github.com/angular/angular/issues/7916
- el.style[style] = '';
- }
- };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- DefaultDomRenderer2.prototype.setProperty = /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (el, name, value) {
- checkNoSyntheticProp(name, 'property');
- el[name] = value;
- };
- /**
- * @param {?} node
- * @param {?} value
- * @return {?}
- */
- DefaultDomRenderer2.prototype.setValue = /**
- * @param {?} node
- * @param {?} value
- * @return {?}
- */
- function (node, value) { node.nodeValue = value; };
- /**
- * @param {?} target
- * @param {?} event
- * @param {?} callback
- * @return {?}
- */
- DefaultDomRenderer2.prototype.listen = /**
- * @param {?} target
- * @param {?} event
- * @param {?} callback
- * @return {?}
- */
- function (target, event, callback) {
- checkNoSyntheticProp(event, 'listener');
- if (typeof target === 'string') {
- return /** @type {?} */ (this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback)));
- }
- return /** @type {?} */ ((this.eventManager.addEventListener(target, event, decoratePreventDefault(callback))));
- };
- return DefaultDomRenderer2;
- }());
- var AT_CHARCODE = '@'.charCodeAt(0);
- /**
- * @param {?} name
- * @param {?} nameKind
- * @return {?}
- */
- function checkNoSyntheticProp(name, nameKind) {
- if (name.charCodeAt(0) === AT_CHARCODE) {
- throw new Error("Found the synthetic " + nameKind + " " + name + ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application.");
- }
- }
- var EmulatedEncapsulationDomRenderer2 = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(EmulatedEncapsulationDomRenderer2, _super);
- function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component) {
- var _this = _super.call(this, eventManager) || this;
- _this.component = component;
- var /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
- sharedStylesHost.addStyles(styles);
- _this.contentAttr = shimContentAttribute(component.id);
- _this.hostAttr = shimHostAttribute(component.id);
- return _this;
- }
- /**
- * @param {?} element
- * @return {?}
- */
- EmulatedEncapsulationDomRenderer2.prototype.applyToHost = /**
- * @param {?} element
- * @return {?}
- */
- function (element) { _super.prototype.setAttribute.call(this, element, this.hostAttr, ''); };
- /**
- * @param {?} parent
- * @param {?} name
- * @return {?}
- */
- EmulatedEncapsulationDomRenderer2.prototype.createElement = /**
- * @param {?} parent
- * @param {?} name
- * @return {?}
- */
- function (parent, name) {
- var /** @type {?} */ el = _super.prototype.createElement.call(this, parent, name);
- _super.prototype.setAttribute.call(this, el, this.contentAttr, '');
- return el;
- };
- return EmulatedEncapsulationDomRenderer2;
- }(DefaultDomRenderer2));
- var ShadowDomRenderer = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(ShadowDomRenderer, _super);
- function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) {
- var _this = _super.call(this, eventManager) || this;
- _this.sharedStylesHost = sharedStylesHost;
- _this.hostEl = hostEl;
- _this.component = component;
- _this.shadowRoot = (/** @type {?} */ (hostEl)).createShadowRoot();
- _this.sharedStylesHost.addHost(_this.shadowRoot);
- var /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
- for (var /** @type {?} */ i = 0; i < styles.length; i++) {
- var /** @type {?} */ styleEl = document.createElement('style');
- styleEl.textContent = styles[i];
- _this.shadowRoot.appendChild(styleEl);
- }
- return _this;
- }
- /**
- * @param {?} node
- * @return {?}
- */
- ShadowDomRenderer.prototype.nodeOrShadowRoot = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node === this.hostEl ? this.shadowRoot : node; };
- /**
- * @return {?}
- */
- ShadowDomRenderer.prototype.destroy = /**
- * @return {?}
- */
- function () { this.sharedStylesHost.removeHost(this.shadowRoot); };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- ShadowDomRenderer.prototype.appendChild = /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- function (parent, newChild) {
- return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild);
- };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- ShadowDomRenderer.prototype.insertBefore = /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- function (parent, newChild, refChild) {
- return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild);
- };
- /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- ShadowDomRenderer.prototype.removeChild = /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- function (parent, oldChild) {
- return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild);
- };
- /**
- * @param {?} node
- * @return {?}
- */
- ShadowDomRenderer.prototype.parentNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node)));
- };
- return ShadowDomRenderer;
- }(DefaultDomRenderer2));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ɵ0 = function (v) {
- return '__zone_symbol__' + v;
- };
- /**
- * Detect if Zone is present. If it is then use simple zone aware 'addEventListener'
- * since Angular can do much more
- * efficient bookkeeping than Zone can, because we have additional information. This speeds up
- * addEventListener by 3x.
- */
- var __symbol__ = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))['__symbol__'] || ɵ0;
- var ADD_EVENT_LISTENER = __symbol__('addEventListener');
- var REMOVE_EVENT_LISTENER = __symbol__('removeEventListener');
- var symbolNames = {};
- var FALSE = 'FALSE';
- var ANGULAR = 'ANGULAR';
- var NATIVE_ADD_LISTENER = 'addEventListener';
- var NATIVE_REMOVE_LISTENER = 'removeEventListener';
- // use the same symbol string which is used in zone.js
- var stopSymbol = '__zone_symbol__propagationStopped';
- var stopMethodSymbol = '__zone_symbol__stopImmediatePropagation';
- var blackListedEvents = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))[__symbol__('BLACK_LISTED_EVENTS')];
- var blackListedMap;
- if (blackListedEvents) {
- blackListedMap = {};
- blackListedEvents.forEach(function (eventName) { blackListedMap[eventName] = eventName; });
- }
- var isBlackListedEvent = function (eventName) {
- if (!blackListedMap) {
- return false;
- }
- return blackListedMap.hasOwnProperty(eventName);
- };
- // a global listener to handle all dom event,
- // so we do not need to create a closure everytime
- var globalListener = function (event) {
- var /** @type {?} */ symbolName = symbolNames[event.type];
- if (!symbolName) {
- return;
- }
- var /** @type {?} */ taskDatas = this[symbolName];
- if (!taskDatas) {
- return;
- }
- var /** @type {?} */ args = [event];
- if (taskDatas.length === 1) {
- // if taskDatas only have one element, just invoke it
- var /** @type {?} */ taskData = taskDatas[0];
- if (taskData.zone !== Zone.current) {
- // only use Zone.run when Zone.current not equals to stored zone
- return taskData.zone.run(taskData.handler, this, args);
- }
- else {
- return taskData.handler.apply(this, args);
- }
- }
- else {
- // copy tasks as a snapshot to avoid event handlers remove
- // itself or others
- var /** @type {?} */ copiedTasks = taskDatas.slice();
- for (var /** @type {?} */ i = 0; i < copiedTasks.length; i++) {
- // if other listener call event.stopImmediatePropagation
- // just break
- if ((/** @type {?} */ (event))[stopSymbol] === true) {
- break;
- }
- var /** @type {?} */ taskData = copiedTasks[i];
- if (taskData.zone !== Zone.current) {
- // only use Zone.run when Zone.current not equals to stored zone
- taskData.zone.run(taskData.handler, this, args);
- }
- else {
- taskData.handler.apply(this, args);
- }
- }
- }
- };
- var DomEventsPlugin = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(DomEventsPlugin, _super);
- function DomEventsPlugin(doc, ngZone) {
- var _this = _super.call(this, doc) || this;
- _this.ngZone = ngZone;
- _this.patchEvent();
- return _this;
- }
- /**
- * @return {?}
- */
- DomEventsPlugin.prototype.patchEvent = /**
- * @return {?}
- */
- function () {
- if (!Event || !Event.prototype) {
- return;
- }
- if ((/** @type {?} */ (Event.prototype))[stopMethodSymbol]) {
- // already patched by zone.js
- return;
- }
- var /** @type {?} */ delegate = (/** @type {?} */ (Event.prototype))[stopMethodSymbol] =
- Event.prototype.stopImmediatePropagation;
- Event.prototype.stopImmediatePropagation = function () {
- if (this) {
- this[stopSymbol] = true;
- }
- // should call native delegate in case
- // in some enviroment part of the application
- // will not use the patched Event
- delegate && delegate.apply(this, arguments);
- };
- };
- // This plugin should come last in the list of plugins, because it accepts all
- // events.
- /**
- * @param {?} eventName
- * @return {?}
- */
- DomEventsPlugin.prototype.supports = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) { return true; };
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- DomEventsPlugin.prototype.addEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var _this = this;
- /**
- * This code is about to add a listener to the DOM. If Zone.js is present, than
- * `addEventListener` has been patched. The patched code adds overhead in both
- * memory and speed (3x slower) than native. For this reason if we detect that
- * Zone.js is present we use a simple version of zone aware addEventListener instead.
- * The result is faster registration and the zone will be restored.
- * But ZoneSpec.onScheduleTask, ZoneSpec.onInvokeTask, ZoneSpec.onCancelTask
- * will not be invoked
- * We also do manual zone restoration in element.ts renderEventHandlerClosure method.
- *
- * NOTE: it is possible that the element is from different iframe, and so we
- * have to check before we execute the method.
- */
- var /** @type {?} */ self = this;
- var /** @type {?} */ zoneJsLoaded = element[ADD_EVENT_LISTENER];
- var /** @type {?} */ callback = /** @type {?} */ (handler);
- // if zonejs is loaded and current zone is not ngZone
- // we keep Zone.current on target for later restoration.
- if (zoneJsLoaded && (!__WEBPACK_IMPORTED_MODULE_1__angular_core__["J" /* NgZone */].isInAngularZone() || isBlackListedEvent(eventName))) {
- var /** @type {?} */ symbolName = symbolNames[eventName];
- if (!symbolName) {
- symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE);
- }
- var /** @type {?} */ taskDatas = (/** @type {?} */ (element))[symbolName];
- var /** @type {?} */ globalListenerRegistered = taskDatas && taskDatas.length > 0;
- if (!taskDatas) {
- taskDatas = (/** @type {?} */ (element))[symbolName] = [];
- }
- var /** @type {?} */ zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current;
- if (taskDatas.length === 0) {
- taskDatas.push({ zone: zone, handler: callback });
- }
- else {
- var /** @type {?} */ callbackRegistered = false;
- for (var /** @type {?} */ i = 0; i < taskDatas.length; i++) {
- if (taskDatas[i].handler === callback) {
- callbackRegistered = true;
- break;
- }
- }
- if (!callbackRegistered) {
- taskDatas.push({ zone: zone, handler: callback });
- }
- }
- if (!globalListenerRegistered) {
- element[ADD_EVENT_LISTENER](eventName, globalListener, false);
- }
- }
- else {
- element[NATIVE_ADD_LISTENER](eventName, callback, false);
- }
- return function () { return _this.removeEventListener(element, eventName, callback); };
- };
- /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} callback
- * @return {?}
- */
- DomEventsPlugin.prototype.removeEventListener = /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} callback
- * @return {?}
- */
- function (target, eventName, callback) {
- var /** @type {?} */ underlyingRemove = target[REMOVE_EVENT_LISTENER];
- // zone.js not loaded, use native removeEventListener
- if (!underlyingRemove) {
- return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
- }
- var /** @type {?} */ symbolName = symbolNames[eventName];
- var /** @type {?} */ taskDatas = symbolName && target[symbolName];
- if (!taskDatas) {
- // addEventListener not using patched version
- // just call native removeEventListener
- return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
- }
- // fix issue 20532, should be able to remove
- // listener which was added inside of ngZone
- var /** @type {?} */ found = false;
- for (var /** @type {?} */ i = 0; i < taskDatas.length; i++) {
- // remove listener from taskDatas if the callback equals
- if (taskDatas[i].handler === callback) {
- found = true;
- taskDatas.splice(i, 1);
- break;
- }
- }
- if (found) {
- if (taskDatas.length === 0) {
- // all listeners are removed, we can remove the globalListener from target
- underlyingRemove.apply(target, [eventName, globalListener, false]);
- }
- }
- else {
- // not found in taskDatas, the callback may be added inside of ngZone
- // use native remove listener to remove the calback
- target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
- }
- };
- DomEventsPlugin.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- DomEventsPlugin.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["J" /* NgZone */], },
- ]; };
- return DomEventsPlugin;
- }(EventManagerPlugin));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var EVENT_NAMES = {
- // pan
- 'pan': true,
- 'panstart': true,
- 'panmove': true,
- 'panend': true,
- 'pancancel': true,
- 'panleft': true,
- 'panright': true,
- 'panup': true,
- 'pandown': true,
- // pinch
- 'pinch': true,
- 'pinchstart': true,
- 'pinchmove': true,
- 'pinchend': true,
- 'pinchcancel': true,
- 'pinchin': true,
- 'pinchout': true,
- // press
- 'press': true,
- 'pressup': true,
- // rotate
- 'rotate': true,
- 'rotatestart': true,
- 'rotatemove': true,
- 'rotateend': true,
- 'rotatecancel': true,
- // swipe
- 'swipe': true,
- 'swipeleft': true,
- 'swiperight': true,
- 'swipeup': true,
- 'swipedown': true,
- // tap
- 'tap': true,
- };
- /**
- * A DI token that you can use to provide{\@link HammerGestureConfig} to Angular. Use it to configure
- * Hammer gestures.
- *
- * \@experimental
- */
- var HAMMER_GESTURE_CONFIG = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* InjectionToken */]('HammerGestureConfig');
- /**
- * @record
- */
- /**
- * \@experimental
- */
- var HammerGestureConfig = /** @class */ (function () {
- function HammerGestureConfig() {
- this.events = [];
- this.overrides = {};
- }
- /**
- * @param {?} element
- * @return {?}
- */
- HammerGestureConfig.prototype.buildHammer = /**
- * @param {?} element
- * @return {?}
- */
- function (element) {
- var /** @type {?} */ mc = new Hammer(element);
- mc.get('pinch').set({ enable: true });
- mc.get('rotate').set({ enable: true });
- for (var /** @type {?} */ eventName in this.overrides) {
- mc.get(eventName).set(this.overrides[eventName]);
- }
- return mc;
- };
- HammerGestureConfig.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- HammerGestureConfig.ctorParameters = function () { return []; };
- return HammerGestureConfig;
- }());
- var HammerGesturesPlugin = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(HammerGesturesPlugin, _super);
- function HammerGesturesPlugin(doc, _config) {
- var _this = _super.call(this, doc) || this;
- _this._config = _config;
- return _this;
- }
- /**
- * @param {?} eventName
- * @return {?}
- */
- HammerGesturesPlugin.prototype.supports = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) {
- if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
- return false;
- }
- if (!(/** @type {?} */ (window)).Hammer) {
- throw new Error("Hammer.js is not loaded, can not bind " + eventName + " event");
- }
- return true;
- };
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- HammerGesturesPlugin.prototype.addEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var _this = this;
- var /** @type {?} */ zone = this.manager.getZone();
- eventName = eventName.toLowerCase();
- return zone.runOutsideAngular(function () {
- // Creating the manager bind events, must be done outside of angular
- var /** @type {?} */ mc = _this._config.buildHammer(element);
- var /** @type {?} */ callback = function (eventObj) {
- zone.runGuarded(function () { handler(eventObj); });
- };
- mc.on(eventName, callback);
- return function () { return mc.off(eventName, callback); };
- });
- };
- /**
- * @param {?} eventName
- * @return {?}
- */
- HammerGesturesPlugin.prototype.isCustomEvent = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) { return this._config.events.indexOf(eventName) > -1; };
- HammerGesturesPlugin.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- HammerGesturesPlugin.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
- { type: HammerGestureConfig, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [HAMMER_GESTURE_CONFIG,] },] },
- ]; };
- return HammerGesturesPlugin;
- }(EventManagerPlugin));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
- var ɵ0$1 = function (event) { return event.altKey; };
- var ɵ1$1 = function (event) { return event.ctrlKey; };
- var ɵ2$1 = function (event) { return event.metaKey; };
- var ɵ3 = function (event) { return event.shiftKey; };
- var MODIFIER_KEY_GETTERS = {
- 'alt': ɵ0$1,
- 'control': ɵ1$1,
- 'meta': ɵ2$1,
- 'shift': ɵ3
- };
- /**
- * \@experimental
- */
- var KeyEventsPlugin = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(KeyEventsPlugin, _super);
- function KeyEventsPlugin(doc) {
- return _super.call(this, doc) || this;
- }
- /**
- * @param {?} eventName
- * @return {?}
- */
- KeyEventsPlugin.prototype.supports = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) { return KeyEventsPlugin.parseEventName(eventName) != null; };
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- KeyEventsPlugin.prototype.addEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var /** @type {?} */ parsedEvent = /** @type {?} */ ((KeyEventsPlugin.parseEventName(eventName)));
- var /** @type {?} */ outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
- return this.manager.getZone().runOutsideAngular(function () {
- return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
- });
- };
- /**
- * @param {?} eventName
- * @return {?}
- */
- KeyEventsPlugin.parseEventName = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) {
- var /** @type {?} */ parts = eventName.toLowerCase().split('.');
- var /** @type {?} */ domEventName = parts.shift();
- if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
- return null;
- }
- var /** @type {?} */ key = KeyEventsPlugin._normalizeKey(/** @type {?} */ ((parts.pop())));
- var /** @type {?} */ fullKey = '';
- MODIFIER_KEYS.forEach(function (modifierName) {
- var /** @type {?} */ index = parts.indexOf(modifierName);
- if (index > -1) {
- parts.splice(index, 1);
- fullKey += modifierName + '.';
- }
- });
- fullKey += key;
- if (parts.length != 0 || key.length === 0) {
- // returning null instead of throwing to let another plugin process the event
- return null;
- }
- var /** @type {?} */ result = {};
- result['domEventName'] = domEventName;
- result['fullKey'] = fullKey;
- return result;
- };
- /**
- * @param {?} event
- * @return {?}
- */
- KeyEventsPlugin.getEventFullKey = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- var /** @type {?} */ fullKey = '';
- var /** @type {?} */ key = getDOM().getEventKey(event);
- key = key.toLowerCase();
- if (key === ' ') {
- key = 'space'; // for readability
- }
- else if (key === '.') {
- key = 'dot'; // because '.' is used as a separator in event names
- }
- MODIFIER_KEYS.forEach(function (modifierName) {
- if (modifierName != key) {
- var /** @type {?} */ modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
- if (modifierGetter(event)) {
- fullKey += modifierName + '.';
- }
- }
- });
- fullKey += key;
- return fullKey;
- };
- /**
- * @param {?} fullKey
- * @param {?} handler
- * @param {?} zone
- * @return {?}
- */
- KeyEventsPlugin.eventCallback = /**
- * @param {?} fullKey
- * @param {?} handler
- * @param {?} zone
- * @return {?}
- */
- function (fullKey, handler, zone) {
- return function (event /** TODO #9100 */) {
- if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
- zone.runGuarded(function () { return handler(event); });
- }
- };
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} keyName
- * @return {?}
- */
- KeyEventsPlugin._normalizeKey = /**
- * \@internal
- * @param {?} keyName
- * @return {?}
- */
- function (keyName) {
- // TODO: switch to a Map if the mapping grows too much
- switch (keyName) {
- case 'esc':
- return 'escape';
- default:
- return keyName;
- }
- };
- KeyEventsPlugin.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- KeyEventsPlugin.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
- ]; };
- return KeyEventsPlugin;
- }(EventManagerPlugin));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * This helper class is used to get hold of an inert tree of DOM elements containing dirty HTML
- * that needs sanitizing.
- * Depending upon browser support we must use one of three strategies for doing this.
- * Support: Safari 10.x -> XHR strategy
- * Support: Firefox -> DomParser strategy
- * Default: InertDocument strategy
- */
- var InertBodyHelper = /** @class */ (function () {
- function InertBodyHelper(defaultDoc, DOM) {
- this.defaultDoc = defaultDoc;
- this.DOM = DOM;
- var /** @type {?} */ inertDocument = this.DOM.createHtmlDocument();
- this.inertBodyElement = inertDocument.body;
- if (this.inertBodyElement == null) {
- // usually there should be only one body element in the document, but IE doesn't have any, so
- // we need to create one.
- var /** @type {?} */ inertHtml = this.DOM.createElement('html', inertDocument);
- this.inertBodyElement = this.DOM.createElement('body', inertDocument);
- this.DOM.appendChild(inertHtml, this.inertBodyElement);
- this.DOM.appendChild(inertDocument, inertHtml);
- }
- this.DOM.setInnerHTML(this.inertBodyElement, '<svg><g onload="this.parentNode.remove()"></g></svg>');
- if (this.inertBodyElement.querySelector && !this.inertBodyElement.querySelector('svg')) {
- // We just hit the Safari 10.1 bug - which allows JS to run inside the SVG G element
- // so use the XHR strategy.
- this.getInertBodyElement = this.getInertBodyElement_XHR;
- return;
- }
- this.DOM.setInnerHTML(this.inertBodyElement, '<svg><p><style><img src="</style><img src=x onerror=alert(1)//">');
- if (this.inertBodyElement.querySelector && this.inertBodyElement.querySelector('svg img')) {
- // We just hit the Firefox bug - which prevents the inner img JS from being sanitized
- // so use the DOMParser strategy, if it is available.
- // If the DOMParser is not available then we are not in Firefox (Server/WebWorker?) so we
- // fall through to the default strategy below.
- if (isDOMParserAvailable()) {
- this.getInertBodyElement = this.getInertBodyElement_DOMParser;
- return;
- }
- }
- // None of the bugs were hit so it is safe for us to use the default InertDocument strategy
- this.getInertBodyElement = this.getInertBodyElement_InertDocument;
- }
- /**
- * Use XHR to create and fill an inert body element (on Safari 10.1)
- * See
- * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449
- * @param {?} html
- * @return {?}
- */
- InertBodyHelper.prototype.getInertBodyElement_XHR = /**
- * Use XHR to create and fill an inert body element (on Safari 10.1)
- * See
- * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449
- * @param {?} html
- * @return {?}
- */
- function (html) {
- // We add these extra elements to ensure that the rest of the content is parsed as expected
- // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the
- // `<head>` tag.
- html = '<body><remove></remove>' + html + '</body>';
- try {
- html = encodeURI(html);
- }
- catch (/** @type {?} */ e) {
- return null;
- }
- var /** @type {?} */ xhr = new XMLHttpRequest();
- xhr.responseType = 'document';
- xhr.open('GET', 'data:text/html;charset=utf-8,' + html, false);
- xhr.send(null);
- var /** @type {?} */ body = xhr.response.body;
- body.removeChild(/** @type {?} */ ((body.firstChild)));
- return body;
- };
- /**
- * Use DOMParser to create and fill an inert body element (on Firefox)
- * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7
- *
- * @param {?} html
- * @return {?}
- */
- InertBodyHelper.prototype.getInertBodyElement_DOMParser = /**
- * Use DOMParser to create and fill an inert body element (on Firefox)
- * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7
- *
- * @param {?} html
- * @return {?}
- */
- function (html) {
- // We add these extra elements to ensure that the rest of the content is parsed as expected
- // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the
- // `<head>` tag.
- html = '<body><remove></remove>' + html + '</body>';
- try {
- var /** @type {?} */ body = /** @type {?} */ (new (/** @type {?} */ (window))
- .DOMParser()
- .parseFromString(html, 'text/html')
- .body);
- body.removeChild(/** @type {?} */ ((body.firstChild)));
- return body;
- }
- catch (/** @type {?} */ e) {
- return null;
- }
- };
- /**
- * Use an HTML5 `template` element, if supported, or an inert body element created via
- * `createHtmlDocument` to create and fill an inert DOM element.
- * This is the default sane strategy to use if the browser does not require one of the specialised
- * strategies above.
- * @param {?} html
- * @return {?}
- */
- InertBodyHelper.prototype.getInertBodyElement_InertDocument = /**
- * Use an HTML5 `template` element, if supported, or an inert body element created via
- * `createHtmlDocument` to create and fill an inert DOM element.
- * This is the default sane strategy to use if the browser does not require one of the specialised
- * strategies above.
- * @param {?} html
- * @return {?}
- */
- function (html) {
- // Prefer using <template> element if supported.
- var /** @type {?} */ templateEl = this.DOM.createElement('template');
- if ('content' in templateEl) {
- this.DOM.setInnerHTML(templateEl, html);
- return templateEl;
- }
- this.DOM.setInnerHTML(this.inertBodyElement, html);
- // Support: IE 9-11 only
- // strip custom-namespaced attributes on IE<=11
- if (this.defaultDoc.documentMode) {
- this.stripCustomNsAttrs(this.inertBodyElement);
- }
- return this.inertBodyElement;
- };
- /**
- * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
- * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g.
- * 'ns1:xlink:foo').
- *
- * This is undesirable since we don't want to allow any of these custom attributes. This method
- * strips them all.
- * @param {?} el
- * @return {?}
- */
- InertBodyHelper.prototype.stripCustomNsAttrs = /**
- * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
- * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g.
- * 'ns1:xlink:foo').
- *
- * This is undesirable since we don't want to allow any of these custom attributes. This method
- * strips them all.
- * @param {?} el
- * @return {?}
- */
- function (el) {
- var _this = this;
- this.DOM.attributeMap(el).forEach(function (_, attrName) {
- if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
- _this.DOM.removeAttribute(el, attrName);
- }
- });
- for (var _i = 0, _a = this.DOM.childNodesAsList(el); _i < _a.length; _i++) {
- var n = _a[_i];
- if (this.DOM.isElementNode(n))
- this.stripCustomNsAttrs(/** @type {?} */ (n));
- }
- };
- return InertBodyHelper;
- }());
- /**
- * We need to determine whether the DOMParser exists in the global context.
- * The try-catch is because, on some browsers, trying to access this property
- * on window can actually throw an error.
- *
- * @suppress {uselessCode}
- * @return {?}
- */
- function isDOMParserAvailable() {
- try {
- return !!(/** @type {?} */ (window)).DOMParser;
- }
- catch (/** @type {?} */ e) {
- return false;
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A pattern that recognizes a commonly useful subset of URLs that are safe.
- *
- * This regular expression matches a subset of URLs that will not cause script
- * execution if used in URL context within a HTML document. Specifically, this
- * regular expression matches if (comment from here on and regex copied from
- * Soy's EscapingConventions):
- * (1) Either a protocol in a whitelist (http, https, mailto or ftp).
- * (2) or no protocol. A protocol must be followed by a colon. The below
- * allows that by allowing colons only after one of the characters [/?#].
- * A colon after a hash (#) must be in the fragment.
- * Otherwise, a colon after a (?) must be in a query.
- * Otherwise, a colon after a single solidus (/) must be in a path.
- * Otherwise, a colon after a double solidus (//) must be in the authority
- * (before port).
- *
- * The pattern disallows &, used in HTML entity declarations before
- * one of the characters in [/?#]. This disallows HTML entities used in the
- * protocol name, which should never happen, e.g. "http" for "http".
- * It also disallows HTML entities in the first path part of a relative path,
- * e.g. "foo<bar/baz". Our existing escaping functions should not produce
- * that. More importantly, it disallows masking of a colon,
- * e.g. "javascript:...".
- *
- * This regular expression was taken from the Closure sanitization library.
- */
- var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
- /**
- * A pattern that matches safe data URLs. Only matches image, video and audio types.
- */
- 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;
- /**
- * @param {?} url
- * @return {?}
- */
- function sanitizeUrl(url) {
- url = String(url);
- if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN))
- return url;
- if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* isDevMode */])()) {
- getDOM().log("WARNING: sanitizing unsafe URL value " + url + " (see http://g.co/ng/security#xss)");
- }
- return 'unsafe:' + url;
- }
- /**
- * @param {?} srcset
- * @return {?}
- */
- function sanitizeSrcset(srcset) {
- srcset = String(srcset);
- return srcset.split(',').map(function (srcset) { return sanitizeUrl(srcset.trim()); }).join(', ');
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} tags
- * @return {?}
- */
- function tagSet(tags) {
- var /** @type {?} */ res = {};
- for (var _i = 0, _a = tags.split(','); _i < _a.length; _i++) {
- var t = _a[_i];
- res[t] = true;
- }
- return res;
- }
- /**
- * @param {...?} sets
- * @return {?}
- */
- function merge() {
- var sets = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- sets[_i] = arguments[_i];
- }
- var /** @type {?} */ res = {};
- for (var _a = 0, sets_1 = sets; _a < sets_1.length; _a++) {
- var s = sets_1[_a];
- for (var /** @type {?} */ v in s) {
- if (s.hasOwnProperty(v))
- res[v] = true;
- }
- }
- return res;
- }
- // Good source of info about elements and attributes
- // http://dev.w3.org/html5/spec/Overview.html#semantics
- // http://simon.html5.org/html-elements
- // Safe Void Elements - HTML5
- // http://dev.w3.org/html5/spec/Overview.html#void-elements
- var VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr');
- // Elements that you can, intentionally, leave open (and which close themselves)
- // http://dev.w3.org/html5/spec/Overview.html#optional-tags
- var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr');
- var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt');
- var OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
- // Safe Block Elements - HTML5
- var BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' +
- 'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
- 'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul'));
- // Inline Elements - HTML5
- var INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' +
- 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' +
- 'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video'));
- var VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
- // Attributes that have href and hence need to be sanitized
- var URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href');
- // Attributes that have special href set hence need to be sanitized
- var SRCSET_ATTRS = tagSet('srcset');
- var HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +
- 'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +
- 'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +
- 'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +
- 'valign,value,vspace,width');
- // NB: This currently consciously doesn't support SVG. SVG sanitization has had several security
- // issues in the past, so it seems safer to leave it out if possible. If support for binding SVG via
- // innerHTML is required, SVG attributes should be added here.
- // NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those
- // can be sanitized, but they increase security surface area without a legitimate use case, so they
- // are left out here.
- var VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS);
- /**
- * SanitizingHtmlSerializer serializes a DOM fragment, stripping out any unsafe elements and unsafe
- * attributes.
- */
- var SanitizingHtmlSerializer = /** @class */ (function () {
- function SanitizingHtmlSerializer() {
- this.sanitizedSomething = false;
- this.buf = [];
- this.DOM = getDOM();
- }
- /**
- * @param {?} el
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.sanitizeChildren = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- // This cannot use a TreeWalker, as it has to run on Angular's various DOM adapters.
- // However this code never accesses properties off of `document` before deleting its contents
- // again, so it shouldn't be vulnerable to DOM clobbering.
- var /** @type {?} */ current = /** @type {?} */ ((this.DOM.firstChild(el)));
- while (current) {
- if (this.DOM.isElementNode(current)) {
- this.startElement(/** @type {?} */ (current));
- }
- else if (this.DOM.isTextNode(current)) {
- this.chars(/** @type {?} */ ((this.DOM.nodeValue(current))));
- }
- else {
- // Strip non-element, non-text nodes.
- this.sanitizedSomething = true;
- }
- if (this.DOM.firstChild(current)) {
- current = /** @type {?} */ ((this.DOM.firstChild(current)));
- continue;
- }
- while (current) {
- // Leaving the element. Walk up and to the right, closing tags as we go.
- if (this.DOM.isElementNode(current)) {
- this.endElement(/** @type {?} */ (current));
- }
- var /** @type {?} */ next = this.checkClobberedElement(current, /** @type {?} */ ((this.DOM.nextSibling(current))));
- if (next) {
- current = next;
- break;
- }
- current = this.checkClobberedElement(current, /** @type {?} */ ((this.DOM.parentElement(current))));
- }
- }
- return this.buf.join('');
- };
- /**
- * @param {?} element
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.startElement = /**
- * @param {?} element
- * @return {?}
- */
- function (element) {
- var _this = this;
- var /** @type {?} */ tagName = this.DOM.nodeName(element).toLowerCase();
- if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
- this.sanitizedSomething = true;
- return;
- }
- this.buf.push('<');
- this.buf.push(tagName);
- this.DOM.attributeMap(element).forEach(function (value, attrName) {
- var /** @type {?} */ lower = attrName.toLowerCase();
- if (!VALID_ATTRS.hasOwnProperty(lower)) {
- _this.sanitizedSomething = true;
- return;
- }
- // TODO(martinprobst): Special case image URIs for data:image/...
- if (URI_ATTRS[lower])
- value = sanitizeUrl(value);
- if (SRCSET_ATTRS[lower])
- value = sanitizeSrcset(value);
- _this.buf.push(' ');
- _this.buf.push(attrName);
- _this.buf.push('="');
- _this.buf.push(encodeEntities(value));
- _this.buf.push('"');
- });
- this.buf.push('>');
- };
- /**
- * @param {?} current
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.endElement = /**
- * @param {?} current
- * @return {?}
- */
- function (current) {
- var /** @type {?} */ tagName = this.DOM.nodeName(current).toLowerCase();
- if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
- this.buf.push('</');
- this.buf.push(tagName);
- this.buf.push('>');
- }
- };
- /**
- * @param {?} chars
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.chars = /**
- * @param {?} chars
- * @return {?}
- */
- function (chars) { this.buf.push(encodeEntities(chars)); };
- /**
- * @param {?} node
- * @param {?} nextNode
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.checkClobberedElement = /**
- * @param {?} node
- * @param {?} nextNode
- * @return {?}
- */
- function (node, nextNode) {
- if (nextNode && this.DOM.contains(node, nextNode)) {
- throw new Error("Failed to sanitize html because the element is clobbered: " + this.DOM.getOuterHTML(node));
- }
- return nextNode;
- };
- return SanitizingHtmlSerializer;
- }());
- // Regular Expressions for parsing tags and attributes
- var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
- // ! to ~ is the ASCII range.
- var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
- /**
- * Escapes all potentially dangerous characters, so that the
- * resulting string can be safely inserted into attribute or
- * element text.
- * @param {?} value
- * @return {?}
- */
- function encodeEntities(value) {
- return value.replace(/&/g, '&')
- .replace(SURROGATE_PAIR_REGEXP, function (match) {
- var /** @type {?} */ hi = match.charCodeAt(0);
- var /** @type {?} */ low = match.charCodeAt(1);
- return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
- })
- .replace(NON_ALPHANUMERIC_REGEXP, function (match) { return '&#' + match.charCodeAt(0) + ';'; })
- .replace(/</g, '<')
- .replace(/>/g, '>');
- }
- var inertBodyHelper;
- /**
- * Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to
- * the DOM in a browser environment.
- * @param {?} defaultDoc
- * @param {?} unsafeHtmlInput
- * @return {?}
- */
- function sanitizeHtml(defaultDoc, unsafeHtmlInput) {
- var /** @type {?} */ DOM = getDOM();
- var /** @type {?} */ inertBodyElement = null;
- try {
- inertBodyHelper = inertBodyHelper || new InertBodyHelper(defaultDoc, DOM);
- // Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime).
- var /** @type {?} */ unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : '';
- inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
- // mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser
- // trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous.
- var /** @type {?} */ mXSSAttempts = 5;
- var /** @type {?} */ parsedHtml = unsafeHtml;
- do {
- if (mXSSAttempts === 0) {
- throw new Error('Failed to sanitize html because the input is unstable');
- }
- mXSSAttempts--;
- unsafeHtml = parsedHtml;
- parsedHtml = DOM.getInnerHTML(inertBodyElement);
- inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
- } while (unsafeHtml !== parsedHtml);
- var /** @type {?} */ sanitizer = new SanitizingHtmlSerializer();
- var /** @type {?} */ safeHtml = sanitizer.sanitizeChildren(DOM.getTemplateContent(inertBodyElement) || inertBodyElement);
- if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* isDevMode */])() && sanitizer.sanitizedSomething) {
- DOM.log('WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).');
- }
- return safeHtml;
- }
- finally {
- // In case anything goes wrong, clear out inertElement to reset the entire DOM structure.
- if (inertBodyElement) {
- var /** @type {?} */ parent_1 = DOM.getTemplateContent(inertBodyElement) || inertBodyElement;
- for (var _i = 0, _a = DOM.childNodesAsList(parent_1); _i < _a.length; _i++) {
- var child = _a[_i];
- DOM.removeChild(parent_1, child);
- }
- }
- }
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Regular expression for safe style values.
- *
- * Quotes (" and ') are allowed, but a check must be done elsewhere to ensure they're balanced.
- *
- * ',' allows multiple values to be assigned to the same property (e.g. background-attachment or
- * font-family) and hence could allow multiple values to get injected, but that should pose no risk
- * of XSS.
- *
- * The function expression checks only for XSS safety, not for CSS validity.
- *
- * This regular expression was taken from the Closure sanitization library, and augmented for
- * transformation values.
- */
- var VALUES = '[-,."\'%_!# a-zA-Z0-9]+';
- var TRANSFORMATION_FNS = '(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|3d)?';
- var COLOR_FNS = '(?:rgb|hsl)a?';
- var GRADIENTS = '(?:repeating-)?(?:linear|radial)-gradient';
- var CSS3_FNS = '(?:calc|attr)';
- var FN_ARGS = '\\([-0-9.%, #a-zA-Z]+\\)';
- var SAFE_STYLE_VALUE = new RegExp("^(" + VALUES + "|" +
- ("(?:" + TRANSFORMATION_FNS + "|" + COLOR_FNS + "|" + GRADIENTS + "|" + CSS3_FNS + ")") +
- (FN_ARGS + ")$"), 'g');
- /**
- * Matches a `url(...)` value with an arbitrary argument as long as it does
- * not contain parentheses.
- *
- * The URL value still needs to be sanitized separately.
- *
- * `url(...)` values are a very common use case, e.g. for `background-image`. With carefully crafted
- * CSS style rules, it is possible to construct an information leak with `url` values in CSS, e.g.
- * by observing whether scroll bars are displayed, or character ranges used by a font face
- * definition.
- *
- * Angular only allows binding CSS values (as opposed to entire CSS rules), so it is unlikely that
- * binding a URL value without further cooperation from the page will cause an information leak, and
- * if so, it is just a leak, not a full blown XSS vulnerability.
- *
- * Given the common use case, low likelihood of attack vector, and low impact of an attack, this
- * code is permissive and allows URLs that sanitize otherwise.
- */
- var URL_RE = /^url\(([^)]+)\)$/;
- /**
- * Checks that quotes (" and ') are properly balanced inside a string. Assumes
- * that neither escape (\) nor any other character that could result in
- * breaking out of a string parsing context are allowed;
- * see http://www.w3.org/TR/css3-syntax/#string-token-diagram.
- *
- * This code was taken from the Closure sanitization library.
- * @param {?} value
- * @return {?}
- */
- function hasBalancedQuotes(value) {
- var /** @type {?} */ outsideSingle = true;
- var /** @type {?} */ outsideDouble = true;
- for (var /** @type {?} */ i = 0; i < value.length; i++) {
- var /** @type {?} */ c = value.charAt(i);
- if (c === '\'' && outsideDouble) {
- outsideSingle = !outsideSingle;
- }
- else if (c === '"' && outsideSingle) {
- outsideDouble = !outsideDouble;
- }
- }
- return outsideSingle && outsideDouble;
- }
- /**
- * Sanitizes the given untrusted CSS style property value (i.e. not an entire object, just a single
- * value) and returns a value that is safe to use in a browser environment.
- * @param {?} value
- * @return {?}
- */
- function sanitizeStyle(value) {
- value = String(value).trim(); // Make sure it's actually a string.
- if (!value)
- return '';
- // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for
- // reasoning behind this.
- var /** @type {?} */ urlMatch = value.match(URL_RE);
- if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) ||
- value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) {
- return value; // Safe style values.
- }
- if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* isDevMode */])()) {
- getDOM().log("WARNING: sanitizing unsafe style value " + value + " (see http://g.co/ng/security#xss).");
- }
- return 'unsafe';
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Marker interface for a value that's safe to use in a particular context.
- *
- * \@stable
- * @record
- */
- /**
- * Marker interface for a value that's safe to use as HTML.
- *
- * \@stable
- * @record
- */
- /**
- * Marker interface for a value that's safe to use as style (CSS).
- *
- * \@stable
- * @record
- */
- /**
- * Marker interface for a value that's safe to use as JavaScript.
- *
- * \@stable
- * @record
- */
- /**
- * Marker interface for a value that's safe to use as a URL linking to a document.
- *
- * \@stable
- * @record
- */
- /**
- * Marker interface for a value that's safe to use as a URL to load executable code from.
- *
- * \@stable
- * @record
- */
- /**
- * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
- * values to be safe to use in the different DOM contexts.
- *
- * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
- * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
- * the website.
- *
- * In specific situations, it might be necessary to disable sanitization, for example if the
- * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
- * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
- * methods, and then binding to that value from the template.
- *
- * These situations should be very rare, and extraordinary care must be taken to avoid creating a
- * Cross Site Scripting (XSS) security bug!
- *
- * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
- * close as possible to the source of the value, to make it easy to verify no security bug is
- * created by its use.
- *
- * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
- * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
- * code. The sanitizer leaves safe values intact.
- *
- * \@security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
- * sanitization for the value passed in. Carefully check and audit all values and code paths going
- * into this call. Make sure any user data is appropriately escaped for this security context.
- * For more detail, see the [Security Guide](http://g.co/ng/security).
- *
- * \@stable
- * @abstract
- */
- var DomSanitizer = /** @class */ (function () {
- function DomSanitizer() {
- }
- return DomSanitizer;
- }());
- var DomSanitizerImpl = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(DomSanitizerImpl, _super);
- function DomSanitizerImpl(_doc) {
- var _this = _super.call(this) || this;
- _this._doc = _doc;
- return _this;
- }
- /**
- * @param {?} ctx
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.sanitize = /**
- * @param {?} ctx
- * @param {?} value
- * @return {?}
- */
- function (ctx, value) {
- if (value == null)
- return null;
- switch (ctx) {
- case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].NONE:
- return /** @type {?} */ (value);
- case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].HTML:
- if (value instanceof SafeHtmlImpl)
- return value.changingThisBreaksApplicationSecurity;
- this.checkNotSafeValue(value, 'HTML');
- return sanitizeHtml(this._doc, String(value));
- case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].STYLE:
- if (value instanceof SafeStyleImpl)
- return value.changingThisBreaksApplicationSecurity;
- this.checkNotSafeValue(value, 'Style');
- return sanitizeStyle(/** @type {?} */ (value));
- case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].SCRIPT:
- if (value instanceof SafeScriptImpl)
- return value.changingThisBreaksApplicationSecurity;
- this.checkNotSafeValue(value, 'Script');
- throw new Error('unsafe value used in a script context');
- case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].URL:
- if (value instanceof SafeResourceUrlImpl || value instanceof SafeUrlImpl) {
- // Allow resource URLs in URL contexts, they are strictly more trusted.
- return value.changingThisBreaksApplicationSecurity;
- }
- this.checkNotSafeValue(value, 'URL');
- return sanitizeUrl(String(value));
- case __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* SecurityContext */].RESOURCE_URL:
- if (value instanceof SafeResourceUrlImpl) {
- return value.changingThisBreaksApplicationSecurity;
- }
- this.checkNotSafeValue(value, 'ResourceURL');
- throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)');
- default:
- throw new Error("Unexpected SecurityContext " + ctx + " (see http://g.co/ng/security#xss)");
- }
- };
- /**
- * @param {?} value
- * @param {?} expectedType
- * @return {?}
- */
- DomSanitizerImpl.prototype.checkNotSafeValue = /**
- * @param {?} value
- * @param {?} expectedType
- * @return {?}
- */
- function (value, expectedType) {
- if (value instanceof SafeValueImpl) {
- throw new Error("Required a safe " + expectedType + ", got a " + value.getTypeName() + " " +
- "(see http://g.co/ng/security#xss)");
- }
- };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustHtml = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return new SafeHtmlImpl(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustStyle = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return new SafeStyleImpl(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustScript = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return new SafeScriptImpl(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustUrl = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return new SafeUrlImpl(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- return new SafeResourceUrlImpl(value);
- };
- DomSanitizerImpl.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- DomSanitizerImpl.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Inject */], args: [DOCUMENT$1,] },] },
- ]; };
- return DomSanitizerImpl;
- }(DomSanitizer));
- /**
- * @abstract
- */
- var SafeValueImpl = /** @class */ (function () {
- function SafeValueImpl(changingThisBreaksApplicationSecurity) {
- // empty
- this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
- }
- /**
- * @return {?}
- */
- SafeValueImpl.prototype.toString = /**
- * @return {?}
- */
- function () {
- return "SafeValue must use [property]=binding: " + this.changingThisBreaksApplicationSecurity +
- " (see http://g.co/ng/security#xss)";
- };
- return SafeValueImpl;
- }());
- var SafeHtmlImpl = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeHtmlImpl, _super);
- function SafeHtmlImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeHtmlImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'HTML'; };
- return SafeHtmlImpl;
- }(SafeValueImpl));
- var SafeStyleImpl = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeStyleImpl, _super);
- function SafeStyleImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeStyleImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'Style'; };
- return SafeStyleImpl;
- }(SafeValueImpl));
- var SafeScriptImpl = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeScriptImpl, _super);
- function SafeScriptImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeScriptImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'Script'; };
- return SafeScriptImpl;
- }(SafeValueImpl));
- var SafeUrlImpl = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeUrlImpl, _super);
- function SafeUrlImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeUrlImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'URL'; };
- return SafeUrlImpl;
- }(SafeValueImpl));
- var SafeResourceUrlImpl = /** @class */ (function (_super) {
- Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeResourceUrlImpl, _super);
- function SafeResourceUrlImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeResourceUrlImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'ResourceURL'; };
- return SafeResourceUrlImpl;
- }(SafeValueImpl));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["M" /* PLATFORM_ID */], useValue: __WEBPACK_IMPORTED_MODULE_0__angular_common__["d" /* ɵPLATFORM_BROWSER_ID */] },
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* PLATFORM_INITIALIZER */], useValue: initDomAdapter, multi: true },
- { provide: __WEBPACK_IMPORTED_MODULE_0__angular_common__["c" /* PlatformLocation */], useClass: BrowserPlatformLocation, deps: [DOCUMENT$1] },
- { provide: DOCUMENT$1, useFactory: _document, deps: [] },
- ];
- /**
- * \@security Replacing built-in sanitization providers exposes the application to XSS risks.
- * Attacker-controlled data introduced by an unsanitized provider could expose your
- * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
- * \@experimental
- */
- var BROWSER_SANITIZATION_PROVIDERS = [
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["U" /* Sanitizer */], useExisting: DomSanitizer },
- { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [DOCUMENT$1] },
- ];
- /**
- * \@stable
- */
- var platformBrowser = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_5" /* createPlatformFactory */])(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_9" /* platformCore */], 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
- /**
- * @return {?}
- */
- function initDomAdapter() {
- BrowserDomAdapter.makeCurrent();
- BrowserGetTestability.init();
- }
- /**
- * @return {?}
- */
- function errorHandler() {
- return new __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* ErrorHandler */]();
- }
- /**
- * @return {?}
- */
- function _document() {
- return document;
- }
- /**
- * The ng module for the browser.
- *
- * \@stable
- */
- var BrowserModule = /** @class */ (function () {
- function BrowserModule(parentModule) {
- if (parentModule) {
- 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.");
- }
- }
- /**
- * Configures a browser-based application to transition from a server-rendered app, if
- * one is present on the page. The specified parameters must include an application id,
- * which must match between the client and server applications.
- *
- * @experimental
- */
- /**
- * Configures a browser-based application to transition from a server-rendered app, if
- * one is present on the page. The specified parameters must include an application id,
- * which must match between the client and server applications.
- *
- * \@experimental
- * @param {?} params
- * @return {?}
- */
- BrowserModule.withServerTransition = /**
- * Configures a browser-based application to transition from a server-rendered app, if
- * one is present on the page. The specified parameters must include an application id,
- * which must match between the client and server applications.
- *
- * \@experimental
- * @param {?} params
- * @return {?}
- */
- function (params) {
- return {
- ngModule: BrowserModule,
- providers: [
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* APP_ID */], useValue: params.appId },
- { provide: TRANSITION_ID, useExisting: __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* APP_ID */] },
- SERVER_TRANSITION_PROVIDERS,
- ],
- };
- };
- BrowserModule.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["F" /* NgModule */], args: [{
- providers: [
- BROWSER_SANITIZATION_PROVIDERS,
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* ErrorHandler */], useFactory: errorHandler, deps: [] },
- { provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true },
- { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true },
- { provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true },
- { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig },
- DomRendererFactory2,
- { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["S" /* RendererFactory2 */], useExisting: DomRendererFactory2 },
- { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
- DomSharedStylesHost,
- __WEBPACK_IMPORTED_MODULE_1__angular_core__["_0" /* Testability */],
- EventManager,
- ELEMENT_PROBE_PROVIDERS,
- Meta,
- Title,
- ],
- exports: [__WEBPACK_IMPORTED_MODULE_0__angular_common__["a" /* CommonModule */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["e" /* ApplicationModule */]]
- },] },
- ];
- /** @nocollapse */
- BrowserModule.ctorParameters = function () { return [
- { type: BrowserModule, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* SkipSelf */] },] },
- ]; };
- return BrowserModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var win = typeof window !== 'undefined' && window || /** @type {?} */ ({});
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ChangeDetectionPerfRecord = /** @class */ (function () {
- function ChangeDetectionPerfRecord(msPerTick, numTicks) {
- this.msPerTick = msPerTick;
- this.numTicks = numTicks;
- }
- return ChangeDetectionPerfRecord;
- }());
- /**
- * Entry point for all Angular profiling-related debug tools. This object
- * corresponds to the `ng.profiler` in the dev console.
- */
- var AngularProfiler = /** @class */ (function () {
- function AngularProfiler(ref) {
- this.appRef = ref.injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["f" /* ApplicationRef */]);
- }
- // tslint:disable:no-console
- /**
- * Exercises change detection in a loop and then prints the average amount of
- * time in milliseconds how long a single round of change detection takes for
- * the current state of the UI. It runs a minimum of 5 rounds for a minimum
- * of 500 milliseconds.
- *
- * Optionally, a user may pass a `config` parameter containing a map of
- * options. Supported options are:
- *
- * `record` (boolean) - causes the profiler to record a CPU profile while
- * it exercises the change detector. Example:
- *
- * ```
- * ng.profiler.timeChangeDetection({record: true})
- * ```
- */
- /**
- * Exercises change detection in a loop and then prints the average amount of
- * time in milliseconds how long a single round of change detection takes for
- * the current state of the UI. It runs a minimum of 5 rounds for a minimum
- * of 500 milliseconds.
- *
- * Optionally, a user may pass a `config` parameter containing a map of
- * options. Supported options are:
- *
- * `record` (boolean) - causes the profiler to record a CPU profile while
- * it exercises the change detector. Example:
- *
- * ```
- * ng.profiler.timeChangeDetection({record: true})
- * ```
- * @param {?} config
- * @return {?}
- */
- AngularProfiler.prototype.timeChangeDetection = /**
- * Exercises change detection in a loop and then prints the average amount of
- * time in milliseconds how long a single round of change detection takes for
- * the current state of the UI. It runs a minimum of 5 rounds for a minimum
- * of 500 milliseconds.
- *
- * Optionally, a user may pass a `config` parameter containing a map of
- * options. Supported options are:
- *
- * `record` (boolean) - causes the profiler to record a CPU profile while
- * it exercises the change detector. Example:
- *
- * ```
- * ng.profiler.timeChangeDetection({record: true})
- * ```
- * @param {?} config
- * @return {?}
- */
- function (config) {
- var /** @type {?} */ record = config && config['record'];
- var /** @type {?} */ profileName = 'Change Detection';
- // Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
- var /** @type {?} */ isProfilerAvailable = win.console.profile != null;
- if (record && isProfilerAvailable) {
- win.console.profile(profileName);
- }
- var /** @type {?} */ start = getDOM().performanceNow();
- var /** @type {?} */ numTicks = 0;
- while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
- this.appRef.tick();
- numTicks++;
- }
- var /** @type {?} */ end = getDOM().performanceNow();
- if (record && isProfilerAvailable) {
- // need to cast to <any> because type checker thinks there's no argument
- // while in fact there is:
- //
- // https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd
- (/** @type {?} */ (win.console.profileEnd))(profileName);
- }
- var /** @type {?} */ msPerTick = (end - start) / numTicks;
- win.console.log("ran " + numTicks + " change detection cycles");
- win.console.log(msPerTick.toFixed(2) + " ms per check");
- return new ChangeDetectionPerfRecord(msPerTick, numTicks);
- };
- return AngularProfiler;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var PROFILER_GLOBAL_NAME = 'profiler';
- /**
- * Enabled Angular debug tools that are accessible via your browser's
- * developer console.
- *
- * Usage:
- *
- * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
- * 1. Type `ng.` (usually the console will show auto-complete suggestion)
- * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
- * then hit Enter.
- *
- * \@experimental All debugging apis are currently experimental.
- * @template T
- * @param {?} ref
- * @return {?}
- */
- function enableDebugTools(ref) {
- exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
- return ref;
- }
- /**
- * Disables Angular tools.
- *
- * \@experimental All debugging apis are currently experimental.
- * @return {?}
- */
- function disableDebugTools() {
- exportNgVar(PROFILER_GLOBAL_NAME, null);
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} text
- * @return {?}
- */
- function escapeHtml(text) {
- var /** @type {?} */ escapedText = {
- '&': '&a;',
- '"': '&q;',
- '\'': '&s;',
- '<': '&l;',
- '>': '&g;',
- };
- return text.replace(/[&"'<>]/g, function (s) { return escapedText[s]; });
- }
- /**
- * @param {?} text
- * @return {?}
- */
- function unescapeHtml(text) {
- var /** @type {?} */ unescapedText = {
- '&a;': '&',
- '&q;': '"',
- '&s;': '\'',
- '&l;': '<',
- '&g;': '>',
- };
- return text.replace(/&[^;]+;/g, function (s) { return unescapedText[s]; });
- }
- /**
- * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
- *
- * Example:
- *
- * ```
- * const COUNTER_KEY = makeStateKey<number>('counter');
- * let value = 10;
- *
- * transferState.set(COUNTER_KEY, value);
- * ```
- *
- * \@experimental
- * @template T
- * @param {?} key
- * @return {?}
- */
- function makeStateKey(key) {
- return /** @type {?} */ (key);
- }
- /**
- * A key value store that is transferred from the application on the server side to the application
- * on the client side.
- *
- * `TransferState` will be available as an injectable token. To use it import
- * `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client.
- *
- * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
- * boolean, number, string, null and non-class objects will be serialized and deserialzied in a
- * non-lossy manner.
- *
- * \@experimental
- */
- var TransferState = /** @class */ (function () {
- function TransferState() {
- this.store = {};
- this.onSerializeCallbacks = {};
- }
- /** @internal */
- /**
- * \@internal
- * @param {?} initState
- * @return {?}
- */
- TransferState.init = /**
- * \@internal
- * @param {?} initState
- * @return {?}
- */
- function (initState) {
- var /** @type {?} */ transferState = new TransferState();
- transferState.store = initState;
- return transferState;
- };
- /**
- * Get the value corresponding to a key. Return `defaultValue` if key is not found.
- */
- /**
- * Get the value corresponding to a key. Return `defaultValue` if key is not found.
- * @template T
- * @param {?} key
- * @param {?} defaultValue
- * @return {?}
- */
- TransferState.prototype.get = /**
- * Get the value corresponding to a key. Return `defaultValue` if key is not found.
- * @template T
- * @param {?} key
- * @param {?} defaultValue
- * @return {?}
- */
- function (key, defaultValue) {
- return this.store[key] !== undefined ? /** @type {?} */ (this.store[key]) : defaultValue;
- };
- /**
- * Set the value corresponding to a key.
- */
- /**
- * Set the value corresponding to a key.
- * @template T
- * @param {?} key
- * @param {?} value
- * @return {?}
- */
- TransferState.prototype.set = /**
- * Set the value corresponding to a key.
- * @template T
- * @param {?} key
- * @param {?} value
- * @return {?}
- */
- function (key, value) { this.store[key] = value; };
- /**
- * Remove a key from the store.
- */
- /**
- * Remove a key from the store.
- * @template T
- * @param {?} key
- * @return {?}
- */
- TransferState.prototype.remove = /**
- * Remove a key from the store.
- * @template T
- * @param {?} key
- * @return {?}
- */
- function (key) { delete this.store[key]; };
- /**
- * Test whether a key exists in the store.
- */
- /**
- * Test whether a key exists in the store.
- * @template T
- * @param {?} key
- * @return {?}
- */
- TransferState.prototype.hasKey = /**
- * Test whether a key exists in the store.
- * @template T
- * @param {?} key
- * @return {?}
- */
- function (key) { return this.store.hasOwnProperty(key); };
- /**
- * Register a callback to provide the value for a key when `toJson` is called.
- */
- /**
- * Register a callback to provide the value for a key when `toJson` is called.
- * @template T
- * @param {?} key
- * @param {?} callback
- * @return {?}
- */
- TransferState.prototype.onSerialize = /**
- * Register a callback to provide the value for a key when `toJson` is called.
- * @template T
- * @param {?} key
- * @param {?} callback
- * @return {?}
- */
- function (key, callback) {
- this.onSerializeCallbacks[key] = callback;
- };
- /**
- * Serialize the current state of the store to JSON.
- */
- /**
- * Serialize the current state of the store to JSON.
- * @return {?}
- */
- TransferState.prototype.toJson = /**
- * Serialize the current state of the store to JSON.
- * @return {?}
- */
- function () {
- // Call the onSerialize callbacks and put those values into the store.
- for (var /** @type {?} */ key in this.onSerializeCallbacks) {
- if (this.onSerializeCallbacks.hasOwnProperty(key)) {
- try {
- this.store[key] = this.onSerializeCallbacks[key]();
- }
- catch (/** @type {?} */ e) {
- console.warn('Exception in onSerialize callback: ', e);
- }
- }
- }
- return JSON.stringify(this.store);
- };
- TransferState.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["x" /* Injectable */] },
- ];
- /** @nocollapse */
- TransferState.ctorParameters = function () { return []; };
- return TransferState;
- }());
- /**
- * @param {?} doc
- * @param {?} appId
- * @return {?}
- */
- function initTransferState(doc, appId) {
- // Locate the script tag with the JSON data transferred from the server.
- // The id of the script tag is set to the Angular appId + 'state'.
- var /** @type {?} */ script = doc.getElementById(appId + '-state');
- var /** @type {?} */ initialState = {};
- if (script && script.textContent) {
- try {
- initialState = JSON.parse(unescapeHtml(script.textContent));
- }
- catch (/** @type {?} */ e) {
- console.warn('Exception while restoring TransferState for app ' + appId, e);
- }
- }
- return TransferState.init(initialState);
- }
- /**
- * NgModule to install on the client side while using the `TransferState` to transfer state from
- * server to client.
- *
- * \@experimental
- */
- var BrowserTransferStateModule = /** @class */ (function () {
- function BrowserTransferStateModule() {
- }
- BrowserTransferStateModule.decorators = [
- { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["F" /* NgModule */], args: [{
- providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT$1, __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* APP_ID */]] }],
- },] },
- ];
- /** @nocollapse */
- BrowserTransferStateModule.ctorParameters = function () { return []; };
- return BrowserTransferStateModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Predicates for use with {\@link DebugElement}'s query functions.
- *
- * \@experimental All debugging apis are currently experimental.
- */
- var By = /** @class */ (function () {
- function By() {
- }
- /**
- * Match all elements.
- *
- * ## Example
- *
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
- */
- /**
- * Match all elements.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
- * @return {?}
- */
- By.all = /**
- * Match all elements.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
- * @return {?}
- */
- function () { return function (debugElement) { return true; }; };
- /**
- * Match elements by the given CSS selector.
- *
- * ## Example
- *
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
- */
- /**
- * Match elements by the given CSS selector.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
- * @param {?} selector
- * @return {?}
- */
- By.css = /**
- * Match elements by the given CSS selector.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
- * @param {?} selector
- * @return {?}
- */
- function (selector) {
- return function (debugElement) {
- return debugElement.nativeElement != null ?
- getDOM().elementMatches(debugElement.nativeElement, selector) :
- false;
- };
- };
- /**
- * Match elements that have the given directive present.
- *
- * ## Example
- *
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
- */
- /**
- * Match elements that have the given directive present.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
- * @param {?} type
- * @return {?}
- */
- By.directive = /**
- * Match elements that have the given directive present.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
- * @param {?} type
- * @return {?}
- */
- function (type) {
- return function (debugElement) { return ((debugElement.providerTokens)).indexOf(type) !== -1; };
- };
- return By;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- */
- var VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Version */]('5.2.9');
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @module
- * @description
- * Entry point for all public APIs of this package.
- */
- // This file only reexports content of the `src` folder. Keep it that way.
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * Generated bundle index. Do not edit.
- */
- //# sourceMappingURL=platform-browser.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/InnerSubscriber.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InnerSubscriber; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
- /** PURE_IMPORTS_START ._Subscriber PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * We need this JSDoc comment for affecting ESDoc.
- * @ignore
- * @extends {Ignored}
- */
- var InnerSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(InnerSubscriber, _super);
- function InnerSubscriber(parent, outerValue, outerIndex) {
- _super.call(this);
- this.parent = parent;
- this.outerValue = outerValue;
- this.outerIndex = outerIndex;
- this.index = 0;
- }
- InnerSubscriber.prototype._next = function (value) {
- this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);
- };
- InnerSubscriber.prototype._error = function (error) {
- this.parent.notifyError(error, this);
- this.unsubscribe();
- };
- InnerSubscriber.prototype._complete = function () {
- this.parent.notifyComplete(this);
- this.unsubscribe();
- };
- return InnerSubscriber;
- }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */]));
- //# sourceMappingURL=InnerSubscriber.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/Observable.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Observable; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/util/toSubscriber.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__symbol_observable__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/observable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_pipe__ = __webpack_require__("./node_modules/rxjs/_esm5/util/pipe.js");
- /** PURE_IMPORTS_START ._util_root,._util_toSubscriber,._symbol_observable,._util_pipe PURE_IMPORTS_END */
- /**
- * A representation of any set of values over any amount of time. This is the most basic building block
- * of RxJS.
- *
- * @class Observable<T>
- */
- var Observable = /*@__PURE__*/ (/*@__PURE__*/ function () {
- /**
- * @constructor
- * @param {Function} subscribe the function that is called when the Observable is
- * initially subscribed to. This function is given a Subscriber, to which new values
- * can be `next`ed, or an `error` method can be called to raise an error, or
- * `complete` can be called to notify of a successful completion.
- */
- function Observable(subscribe) {
- this._isScalar = false;
- if (subscribe) {
- this._subscribe = subscribe;
- }
- }
- /**
- * Creates a new Observable, with this Observable as the source, and the passed
- * operator defined as the new observable's operator.
- * @method lift
- * @param {Operator} operator the operator defining the operation to take on the observable
- * @return {Observable} a new observable with the Operator applied
- */
- Observable.prototype.lift = function (operator) {
- var observable = new Observable();
- observable.source = this;
- observable.operator = operator;
- return observable;
- };
- /**
- * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.
- *
- * <span class="informal">Use it when you have all these Observables, but still nothing is happening.</span>
- *
- * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It
- * might be for example a function that you passed to a {@link create} static factory, but most of the time it is
- * a library implementation, which defines what and when will be emitted by an Observable. This means that calling
- * `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often
- * thought.
- *
- * Apart from starting the execution of an Observable, this method allows you to listen for values
- * that an Observable emits, as well as for when it completes or errors. You can achieve this in two
- * following ways.
- *
- * The first way is creating an object that implements {@link Observer} interface. It should have methods
- * defined by that interface, but note that it should be just a regular JavaScript object, which you can create
- * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular do
- * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also
- * that your object does not have to implement all methods. If you find yourself creating a method that doesn't
- * do anything, you can simply omit it. Note however, that if `error` method is not provided, all errors will
- * be left uncaught.
- *
- * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.
- * This means you can provide three functions as arguments to `subscribe`, where first function is equivalent
- * of a `next` method, second of an `error` method and third of a `complete` method. Just as in case of Observer,
- * if you do not need to listen for something, you can omit a function, preferably by passing `undefined` or `null`,
- * since `subscribe` recognizes these functions by where they were placed in function call. When it comes
- * to `error` function, just as before, if not provided, errors emitted by an Observable will be thrown.
- *
- * Whatever style of calling `subscribe` you use, in both cases it returns a Subscription object.
- * This object allows you to call `unsubscribe` on it, which in turn will stop work that an Observable does and will clean
- * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback
- * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.
- *
- * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.
- * It is an Observable itself that decides when these functions will be called. For example {@link of}
- * by default emits all its values synchronously. Always check documentation for how given Observable
- * will behave when subscribed and if its default behavior can be modified with a {@link Scheduler}.
- *
- * @example <caption>Subscribe with an Observer</caption>
- * const sumObserver = {
- * sum: 0,
- * next(value) {
- * console.log('Adding: ' + value);
- * this.sum = this.sum + value;
- * },
- * error() { // We actually could just remove this method,
- * }, // since we do not really care about errors right now.
- * complete() {
- * console.log('Sum equals: ' + this.sum);
- * }
- * };
- *
- * Rx.Observable.of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.
- * .subscribe(sumObserver);
- *
- * // Logs:
- * // "Adding: 1"
- * // "Adding: 2"
- * // "Adding: 3"
- * // "Sum equals: 6"
- *
- *
- * @example <caption>Subscribe with functions</caption>
- * let sum = 0;
- *
- * Rx.Observable.of(1, 2, 3)
- * .subscribe(
- * function(value) {
- * console.log('Adding: ' + value);
- * sum = sum + value;
- * },
- * undefined,
- * function() {
- * console.log('Sum equals: ' + sum);
- * }
- * );
- *
- * // Logs:
- * // "Adding: 1"
- * // "Adding: 2"
- * // "Adding: 3"
- * // "Sum equals: 6"
- *
- *
- * @example <caption>Cancel a subscription</caption>
- * const subscription = Rx.Observable.interval(1000).subscribe(
- * num => console.log(num),
- * undefined,
- * () => console.log('completed!') // Will not be called, even
- * ); // when cancelling subscription
- *
- *
- * setTimeout(() => {
- * subscription.unsubscribe();
- * console.log('unsubscribed!');
- * }, 2500);
- *
- * // Logs:
- * // 0 after 1s
- * // 1 after 2s
- * // "unsubscribed!" after 2.5s
- *
- *
- * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,
- * or the first of three possible handlers, which is the handler for each value emitted from the subscribed
- * Observable.
- * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,
- * the error will be thrown as unhandled.
- * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.
- * @return {ISubscription} a subscription reference to the registered handlers
- * @method subscribe
- */
- Observable.prototype.subscribe = function (observerOrNext, error, complete) {
- var operator = this.operator;
- var sink = Object(__WEBPACK_IMPORTED_MODULE_1__util_toSubscriber__["a" /* toSubscriber */])(observerOrNext, error, complete);
- if (operator) {
- operator.call(sink, this.source);
- }
- else {
- sink.add(this.source || !sink.syncErrorThrowable ? this._subscribe(sink) : this._trySubscribe(sink));
- }
- if (sink.syncErrorThrowable) {
- sink.syncErrorThrowable = false;
- if (sink.syncErrorThrown) {
- throw sink.syncErrorValue;
- }
- }
- return sink;
- };
- Observable.prototype._trySubscribe = function (sink) {
- try {
- return this._subscribe(sink);
- }
- catch (err) {
- sink.syncErrorThrown = true;
- sink.syncErrorValue = err;
- sink.error(err);
- }
- };
- /**
- * @method forEach
- * @param {Function} next a handler for each value emitted by the observable
- * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise
- * @return {Promise} a promise that either resolves on observable completion or
- * rejects with the handled error
- */
- Observable.prototype.forEach = function (next, PromiseCtor) {
- var _this = this;
- if (!PromiseCtor) {
- 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) {
- PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise;
- }
- else if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise) {
- PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise;
- }
- }
- if (!PromiseCtor) {
- throw new Error('no Promise impl found');
- }
- return new PromiseCtor(function (resolve, reject) {
- // Must be declared in a separate statement to avoid a RefernceError when
- // accessing subscription below in the closure due to Temporal Dead Zone.
- var subscription;
- subscription = _this.subscribe(function (value) {
- if (subscription) {
- // if there is a subscription, then we can surmise
- // the next handling is asynchronous. Any errors thrown
- // need to be rejected explicitly and unsubscribe must be
- // called manually
- try {
- next(value);
- }
- catch (err) {
- reject(err);
- subscription.unsubscribe();
- }
- }
- else {
- // if there is NO subscription, then we're getting a nexted
- // value synchronously during subscription. We can just call it.
- // If it errors, Observable's `subscribe` will ensure the
- // unsubscription logic is called, then synchronously rethrow the error.
- // After that, Promise will trap the error and send it
- // down the rejection path.
- next(value);
- }
- }, reject, resolve);
- });
- };
- Observable.prototype._subscribe = function (subscriber) {
- return this.source.subscribe(subscriber);
- };
- /**
- * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable
- * @method Symbol.observable
- * @return {Observable} this instance of the observable
- */
- Observable.prototype[__WEBPACK_IMPORTED_MODULE_2__symbol_observable__["a" /* observable */]] = function () {
- return this;
- };
- /* tslint:enable:max-line-length */
- /**
- * Used to stitch together functional operators into a chain.
- * @method pipe
- * @return {Observable} the Observable result of all of the operators having
- * been called in the order they were passed in.
- *
- * @example
- *
- * import { map, filter, scan } from 'rxjs/operators';
- *
- * Rx.Observable.interval(1000)
- * .pipe(
- * filter(x => x % 2 === 0),
- * map(x => x + x),
- * scan((acc, x) => acc + x)
- * )
- * .subscribe(x => console.log(x))
- */
- Observable.prototype.pipe = function () {
- var operations = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- operations[_i - 0] = arguments[_i];
- }
- if (operations.length === 0) {
- return this;
- }
- return Object(__WEBPACK_IMPORTED_MODULE_3__util_pipe__["a" /* pipeFromArray */])(operations)(this);
- };
- /* tslint:enable:max-line-length */
- Observable.prototype.toPromise = function (PromiseCtor) {
- var _this = this;
- if (!PromiseCtor) {
- 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) {
- PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Rx.config.Promise;
- }
- else if (__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise) {
- PromiseCtor = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Promise;
- }
- }
- if (!PromiseCtor) {
- throw new Error('no Promise impl found');
- }
- return new PromiseCtor(function (resolve, reject) {
- var value;
- _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
- });
- };
- // HACK: Since TypeScript inherits static properties too, we have to
- // fight against TypeScript here so Subject can have a different static create signature
- /**
- * Creates a new cold Observable by calling the Observable constructor
- * @static true
- * @owner Observable
- * @method create
- * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
- * @return {Observable} a new cold observable
- */
- Observable.create = function (subscribe) {
- return new Observable(subscribe);
- };
- return Observable;
- }());
- //# sourceMappingURL=Observable.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/Observer.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return empty; });
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- var empty = {
- closed: true,
- next: function (value) { },
- error: function (err) { throw err; },
- complete: function () { }
- };
- //# sourceMappingURL=Observer.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/OuterSubscriber.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OuterSubscriber; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
- /** PURE_IMPORTS_START ._Subscriber PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * We need this JSDoc comment for affecting ESDoc.
- * @ignore
- * @extends {Ignored}
- */
- var OuterSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(OuterSubscriber, _super);
- function OuterSubscriber() {
- _super.apply(this, arguments);
- }
- OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
- this.destination.next(innerValue);
- };
- OuterSubscriber.prototype.notifyError = function (error, innerSub) {
- this.destination.error(error);
- };
- OuterSubscriber.prototype.notifyComplete = function (innerSub) {
- this.destination.complete();
- };
- return OuterSubscriber;
- }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */]));
- //# sourceMappingURL=OuterSubscriber.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/Subject.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SubjectSubscriber; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subject; });
- /* unused harmony export AnonymousSubject */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__ = __webpack_require__("./node_modules/rxjs/_esm5/util/ObjectUnsubscribedError.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__SubjectSubscription__ = __webpack_require__("./node_modules/rxjs/_esm5/SubjectSubscription.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__symbol_rxSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/rxSubscriber.js");
- /** PURE_IMPORTS_START ._Observable,._Subscriber,._Subscription,._util_ObjectUnsubscribedError,._SubjectSubscription,._symbol_rxSubscriber PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * @class SubjectSubscriber<T>
- */
- var SubjectSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(SubjectSubscriber, _super);
- function SubjectSubscriber(destination) {
- _super.call(this, destination);
- this.destination = destination;
- }
- return SubjectSubscriber;
- }(__WEBPACK_IMPORTED_MODULE_1__Subscriber__["a" /* Subscriber */]));
- /**
- * @class Subject<T>
- */
- var Subject = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(Subject, _super);
- function Subject() {
- _super.call(this);
- this.observers = [];
- this.closed = false;
- this.isStopped = false;
- this.hasError = false;
- this.thrownError = null;
- }
- Subject.prototype[__WEBPACK_IMPORTED_MODULE_5__symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () {
- return new SubjectSubscriber(this);
- };
- Subject.prototype.lift = function (operator) {
- var subject = new AnonymousSubject(this, this);
- subject.operator = operator;
- return subject;
- };
- Subject.prototype.next = function (value) {
- if (this.closed) {
- throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
- }
- if (!this.isStopped) {
- var observers = this.observers;
- var len = observers.length;
- var copy = observers.slice();
- for (var i = 0; i < len; i++) {
- copy[i].next(value);
- }
- }
- };
- Subject.prototype.error = function (err) {
- if (this.closed) {
- throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
- }
- this.hasError = true;
- this.thrownError = err;
- this.isStopped = true;
- var observers = this.observers;
- var len = observers.length;
- var copy = observers.slice();
- for (var i = 0; i < len; i++) {
- copy[i].error(err);
- }
- this.observers.length = 0;
- };
- Subject.prototype.complete = function () {
- if (this.closed) {
- throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
- }
- this.isStopped = true;
- var observers = this.observers;
- var len = observers.length;
- var copy = observers.slice();
- for (var i = 0; i < len; i++) {
- copy[i].complete();
- }
- this.observers.length = 0;
- };
- Subject.prototype.unsubscribe = function () {
- this.isStopped = true;
- this.closed = true;
- this.observers = null;
- };
- Subject.prototype._trySubscribe = function (subscriber) {
- if (this.closed) {
- throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
- }
- else {
- return _super.prototype._trySubscribe.call(this, subscriber);
- }
- };
- Subject.prototype._subscribe = function (subscriber) {
- if (this.closed) {
- throw new __WEBPACK_IMPORTED_MODULE_3__util_ObjectUnsubscribedError__["a" /* ObjectUnsubscribedError */]();
- }
- else if (this.hasError) {
- subscriber.error(this.thrownError);
- return __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY;
- }
- else if (this.isStopped) {
- subscriber.complete();
- return __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY;
- }
- else {
- this.observers.push(subscriber);
- return new __WEBPACK_IMPORTED_MODULE_4__SubjectSubscription__["a" /* SubjectSubscription */](this, subscriber);
- }
- };
- Subject.prototype.asObservable = function () {
- var observable = new __WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]();
- observable.source = this;
- return observable;
- };
- Subject.create = function (destination, source) {
- return new AnonymousSubject(destination, source);
- };
- return Subject;
- }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]));
- /**
- * @class AnonymousSubject<T>
- */
- var AnonymousSubject = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(AnonymousSubject, _super);
- function AnonymousSubject(destination, source) {
- _super.call(this);
- this.destination = destination;
- this.source = source;
- }
- AnonymousSubject.prototype.next = function (value) {
- var destination = this.destination;
- if (destination && destination.next) {
- destination.next(value);
- }
- };
- AnonymousSubject.prototype.error = function (err) {
- var destination = this.destination;
- if (destination && destination.error) {
- this.destination.error(err);
- }
- };
- AnonymousSubject.prototype.complete = function () {
- var destination = this.destination;
- if (destination && destination.complete) {
- this.destination.complete();
- }
- };
- AnonymousSubject.prototype._subscribe = function (subscriber) {
- var source = this.source;
- if (source) {
- return this.source.subscribe(subscriber);
- }
- else {
- return __WEBPACK_IMPORTED_MODULE_2__Subscription__["a" /* Subscription */].EMPTY;
- }
- };
- return AnonymousSubject;
- }(Subject));
- //# sourceMappingURL=Subject.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/SubjectSubscription.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SubjectSubscription; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
- /** PURE_IMPORTS_START ._Subscription PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * We need this JSDoc comment for affecting ESDoc.
- * @ignore
- * @extends {Ignored}
- */
- var SubjectSubscription = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(SubjectSubscription, _super);
- function SubjectSubscription(subject, subscriber) {
- _super.call(this);
- this.subject = subject;
- this.subscriber = subscriber;
- this.closed = false;
- }
- SubjectSubscription.prototype.unsubscribe = function () {
- if (this.closed) {
- return;
- }
- this.closed = true;
- var subject = this.subject;
- var observers = subject.observers;
- this.subject = null;
- if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
- return;
- }
- var subscriberIndex = observers.indexOf(this.subscriber);
- if (subscriberIndex !== -1) {
- observers.splice(subscriberIndex, 1);
- }
- };
- return SubjectSubscription;
- }(__WEBPACK_IMPORTED_MODULE_0__Subscription__["a" /* Subscription */]));
- //# sourceMappingURL=SubjectSubscription.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/Subscriber.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscriber; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isFunction__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isFunction.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observer__ = __webpack_require__("./node_modules/rxjs/_esm5/Observer.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__symbol_rxSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/rxSubscriber.js");
- /** PURE_IMPORTS_START ._util_isFunction,._Subscription,._Observer,._symbol_rxSubscriber PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * Implements the {@link Observer} interface and extends the
- * {@link Subscription} class. While the {@link Observer} is the public API for
- * consuming the values of an {@link Observable}, all Observers get converted to
- * a Subscriber, in order to provide Subscription-like capabilities such as
- * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
- * implementing operators, but it is rarely used as a public API.
- *
- * @class Subscriber<T>
- */
- var Subscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(Subscriber, _super);
- /**
- * @param {Observer|function(value: T): void} [destinationOrNext] A partially
- * defined Observer or a `next` callback function.
- * @param {function(e: ?any): void} [error] The `error` callback of an
- * Observer.
- * @param {function(): void} [complete] The `complete` callback of an
- * Observer.
- */
- function Subscriber(destinationOrNext, error, complete) {
- _super.call(this);
- this.syncErrorValue = null;
- this.syncErrorThrown = false;
- this.syncErrorThrowable = false;
- this.isStopped = false;
- switch (arguments.length) {
- case 0:
- this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */];
- break;
- case 1:
- if (!destinationOrNext) {
- this.destination = __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */];
- break;
- }
- if (typeof destinationOrNext === 'object') {
- if (destinationOrNext instanceof Subscriber) {
- this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
- this.destination = destinationOrNext;
- this.destination.add(this);
- }
- else {
- this.syncErrorThrowable = true;
- this.destination = new SafeSubscriber(this, destinationOrNext);
- }
- break;
- }
- default:
- this.syncErrorThrowable = true;
- this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);
- break;
- }
- }
- Subscriber.prototype[__WEBPACK_IMPORTED_MODULE_3__symbol_rxSubscriber__["a" /* rxSubscriber */]] = function () { return this; };
- /**
- * A static factory for a Subscriber, given a (potentially partial) definition
- * of an Observer.
- * @param {function(x: ?T): void} [next] The `next` callback of an Observer.
- * @param {function(e: ?any): void} [error] The `error` callback of an
- * Observer.
- * @param {function(): void} [complete] The `complete` callback of an
- * Observer.
- * @return {Subscriber<T>} A Subscriber wrapping the (partially defined)
- * Observer represented by the given arguments.
- */
- Subscriber.create = function (next, error, complete) {
- var subscriber = new Subscriber(next, error, complete);
- subscriber.syncErrorThrowable = false;
- return subscriber;
- };
- /**
- * The {@link Observer} callback to receive notifications of type `next` from
- * the Observable, with a value. The Observable may call this method 0 or more
- * times.
- * @param {T} [value] The `next` value.
- * @return {void}
- */
- Subscriber.prototype.next = function (value) {
- if (!this.isStopped) {
- this._next(value);
- }
- };
- /**
- * The {@link Observer} callback to receive notifications of type `error` from
- * the Observable, with an attached {@link Error}. Notifies the Observer that
- * the Observable has experienced an error condition.
- * @param {any} [err] The `error` exception.
- * @return {void}
- */
- Subscriber.prototype.error = function (err) {
- if (!this.isStopped) {
- this.isStopped = true;
- this._error(err);
- }
- };
- /**
- * The {@link Observer} callback to receive a valueless notification of type
- * `complete` from the Observable. Notifies the Observer that the Observable
- * has finished sending push-based notifications.
- * @return {void}
- */
- Subscriber.prototype.complete = function () {
- if (!this.isStopped) {
- this.isStopped = true;
- this._complete();
- }
- };
- Subscriber.prototype.unsubscribe = function () {
- if (this.closed) {
- return;
- }
- this.isStopped = true;
- _super.prototype.unsubscribe.call(this);
- };
- Subscriber.prototype._next = function (value) {
- this.destination.next(value);
- };
- Subscriber.prototype._error = function (err) {
- this.destination.error(err);
- this.unsubscribe();
- };
- Subscriber.prototype._complete = function () {
- this.destination.complete();
- this.unsubscribe();
- };
- Subscriber.prototype._unsubscribeAndRecycle = function () {
- var _a = this, _parent = _a._parent, _parents = _a._parents;
- this._parent = null;
- this._parents = null;
- this.unsubscribe();
- this.closed = false;
- this.isStopped = false;
- this._parent = _parent;
- this._parents = _parents;
- return this;
- };
- return Subscriber;
- }(__WEBPACK_IMPORTED_MODULE_1__Subscription__["a" /* Subscription */]));
- /**
- * We need this JSDoc comment for affecting ESDoc.
- * @ignore
- * @extends {Ignored}
- */
- var SafeSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(SafeSubscriber, _super);
- function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
- _super.call(this);
- this._parentSubscriber = _parentSubscriber;
- var next;
- var context = this;
- if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isFunction__["a" /* isFunction */])(observerOrNext)) {
- next = observerOrNext;
- }
- else if (observerOrNext) {
- next = observerOrNext.next;
- error = observerOrNext.error;
- complete = observerOrNext.complete;
- if (observerOrNext !== __WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]) {
- context = Object.create(observerOrNext);
- if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isFunction__["a" /* isFunction */])(context.unsubscribe)) {
- this.add(context.unsubscribe.bind(context));
- }
- context.unsubscribe = this.unsubscribe.bind(this);
- }
- }
- this._context = context;
- this._next = next;
- this._error = error;
- this._complete = complete;
- }
- SafeSubscriber.prototype.next = function (value) {
- if (!this.isStopped && this._next) {
- var _parentSubscriber = this._parentSubscriber;
- if (!_parentSubscriber.syncErrorThrowable) {
- this.__tryOrUnsub(this._next, value);
- }
- else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
- this.unsubscribe();
- }
- }
- };
- SafeSubscriber.prototype.error = function (err) {
- if (!this.isStopped) {
- var _parentSubscriber = this._parentSubscriber;
- if (this._error) {
- if (!_parentSubscriber.syncErrorThrowable) {
- this.__tryOrUnsub(this._error, err);
- this.unsubscribe();
- }
- else {
- this.__tryOrSetError(_parentSubscriber, this._error, err);
- this.unsubscribe();
- }
- }
- else if (!_parentSubscriber.syncErrorThrowable) {
- this.unsubscribe();
- throw err;
- }
- else {
- _parentSubscriber.syncErrorValue = err;
- _parentSubscriber.syncErrorThrown = true;
- this.unsubscribe();
- }
- }
- };
- SafeSubscriber.prototype.complete = function () {
- var _this = this;
- if (!this.isStopped) {
- var _parentSubscriber = this._parentSubscriber;
- if (this._complete) {
- var wrappedComplete = function () { return _this._complete.call(_this._context); };
- if (!_parentSubscriber.syncErrorThrowable) {
- this.__tryOrUnsub(wrappedComplete);
- this.unsubscribe();
- }
- else {
- this.__tryOrSetError(_parentSubscriber, wrappedComplete);
- this.unsubscribe();
- }
- }
- else {
- this.unsubscribe();
- }
- }
- };
- SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
- try {
- fn.call(this._context, value);
- }
- catch (err) {
- this.unsubscribe();
- throw err;
- }
- };
- SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
- try {
- fn.call(this._context, value);
- }
- catch (err) {
- parent.syncErrorValue = err;
- parent.syncErrorThrown = true;
- return true;
- }
- return false;
- };
- SafeSubscriber.prototype._unsubscribe = function () {
- var _parentSubscriber = this._parentSubscriber;
- this._context = null;
- this._parentSubscriber = null;
- _parentSubscriber.unsubscribe();
- };
- return SafeSubscriber;
- }(Subscriber));
- //# sourceMappingURL=Subscriber.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/Subscription.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Subscription; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_isArray__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isArray.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_isObject__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isObject.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isFunction__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isFunction.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_tryCatch__ = __webpack_require__("./node_modules/rxjs/_esm5/util/tryCatch.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_errorObject__ = __webpack_require__("./node_modules/rxjs/_esm5/util/errorObject.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__ = __webpack_require__("./node_modules/rxjs/_esm5/util/UnsubscriptionError.js");
- /** PURE_IMPORTS_START ._util_isArray,._util_isObject,._util_isFunction,._util_tryCatch,._util_errorObject,._util_UnsubscriptionError PURE_IMPORTS_END */
- /**
- * Represents a disposable resource, such as the execution of an Observable. A
- * Subscription has one important method, `unsubscribe`, that takes no argument
- * and just disposes the resource held by the subscription.
- *
- * Additionally, subscriptions may be grouped together through the `add()`
- * method, which will attach a child Subscription to the current Subscription.
- * When a Subscription is unsubscribed, all its children (and its grandchildren)
- * will be unsubscribed as well.
- *
- * @class Subscription
- */
- var Subscription = /*@__PURE__*/ (/*@__PURE__*/ function () {
- /**
- * @param {function(): void} [unsubscribe] A function describing how to
- * perform the disposal of resources when the `unsubscribe` method is called.
- */
- function Subscription(unsubscribe) {
- /**
- * A flag to indicate whether this Subscription has already been unsubscribed.
- * @type {boolean}
- */
- this.closed = false;
- this._parent = null;
- this._parents = null;
- this._subscriptions = null;
- if (unsubscribe) {
- this._unsubscribe = unsubscribe;
- }
- }
- /**
- * Disposes the resources held by the subscription. May, for instance, cancel
- * an ongoing Observable execution or cancel any other type of work that
- * started when the Subscription was created.
- * @return {void}
- */
- Subscription.prototype.unsubscribe = function () {
- var hasErrors = false;
- var errors;
- if (this.closed) {
- return;
- }
- var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
- this.closed = true;
- this._parent = null;
- this._parents = null;
- // null out _subscriptions first so any child subscriptions that attempt
- // to remove themselves from this subscription will noop
- this._subscriptions = null;
- var index = -1;
- var len = _parents ? _parents.length : 0;
- // if this._parent is null, then so is this._parents, and we
- // don't have to remove ourselves from any parent subscriptions.
- while (_parent) {
- _parent.remove(this);
- // if this._parents is null or index >= len,
- // then _parent is set to null, and the loop exits
- _parent = ++index < len && _parents[index] || null;
- }
- if (Object(__WEBPACK_IMPORTED_MODULE_2__util_isFunction__["a" /* isFunction */])(_unsubscribe)) {
- var trial = Object(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(_unsubscribe).call(this);
- if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) {
- hasErrors = true;
- errors = errors || (__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */] ?
- flattenUnsubscriptionErrors(__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e.errors) : [__WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e]);
- }
- }
- if (Object(__WEBPACK_IMPORTED_MODULE_0__util_isArray__["a" /* isArray */])(_subscriptions)) {
- index = -1;
- len = _subscriptions.length;
- while (++index < len) {
- var sub = _subscriptions[index];
- if (Object(__WEBPACK_IMPORTED_MODULE_1__util_isObject__["a" /* isObject */])(sub)) {
- var trial = Object(__WEBPACK_IMPORTED_MODULE_3__util_tryCatch__["a" /* tryCatch */])(sub.unsubscribe).call(sub);
- if (trial === __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */]) {
- hasErrors = true;
- errors = errors || [];
- var err = __WEBPACK_IMPORTED_MODULE_4__util_errorObject__["a" /* errorObject */].e;
- if (err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) {
- errors = errors.concat(flattenUnsubscriptionErrors(err.errors));
- }
- else {
- errors.push(err);
- }
- }
- }
- }
- }
- if (hasErrors) {
- throw new __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */](errors);
- }
- };
- /**
- * Adds a tear down to be called during the unsubscribe() of this
- * Subscription.
- *
- * If the tear down being added is a subscription that is already
- * unsubscribed, is the same reference `add` is being called on, or is
- * `Subscription.EMPTY`, it will not be added.
- *
- * If this subscription is already in an `closed` state, the passed
- * tear down logic will be executed immediately.
- *
- * @param {TeardownLogic} teardown The additional logic to execute on
- * teardown.
- * @return {Subscription} Returns the Subscription used or created to be
- * added to the inner subscriptions list. This Subscription can be used with
- * `remove()` to remove the passed teardown logic from the inner subscriptions
- * list.
- */
- Subscription.prototype.add = function (teardown) {
- if (!teardown || (teardown === Subscription.EMPTY)) {
- return Subscription.EMPTY;
- }
- if (teardown === this) {
- return this;
- }
- var subscription = teardown;
- switch (typeof teardown) {
- case 'function':
- subscription = new Subscription(teardown);
- case 'object':
- if (subscription.closed || typeof subscription.unsubscribe !== 'function') {
- return subscription;
- }
- else if (this.closed) {
- subscription.unsubscribe();
- return subscription;
- }
- else if (typeof subscription._addParent !== 'function' /* quack quack */) {
- var tmp = subscription;
- subscription = new Subscription();
- subscription._subscriptions = [tmp];
- }
- break;
- default:
- throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
- }
- var subscriptions = this._subscriptions || (this._subscriptions = []);
- subscriptions.push(subscription);
- subscription._addParent(this);
- return subscription;
- };
- /**
- * Removes a Subscription from the internal list of subscriptions that will
- * unsubscribe during the unsubscribe process of this Subscription.
- * @param {Subscription} subscription The subscription to remove.
- * @return {void}
- */
- Subscription.prototype.remove = function (subscription) {
- var subscriptions = this._subscriptions;
- if (subscriptions) {
- var subscriptionIndex = subscriptions.indexOf(subscription);
- if (subscriptionIndex !== -1) {
- subscriptions.splice(subscriptionIndex, 1);
- }
- }
- };
- Subscription.prototype._addParent = function (parent) {
- var _a = this, _parent = _a._parent, _parents = _a._parents;
- if (!_parent || _parent === parent) {
- // If we don't have a parent, or the new parent is the same as the
- // current parent, then set this._parent to the new parent.
- this._parent = parent;
- }
- else if (!_parents) {
- // If there's already one parent, but not multiple, allocate an Array to
- // store the rest of the parent Subscriptions.
- this._parents = [parent];
- }
- else if (_parents.indexOf(parent) === -1) {
- // Only add the new parent to the _parents list if it's not already there.
- _parents.push(parent);
- }
- };
- Subscription.EMPTY = (function (empty) {
- empty.closed = true;
- return empty;
- }(new Subscription()));
- return Subscription;
- }());
- function flattenUnsubscriptionErrors(errors) {
- return errors.reduce(function (errs, err) { return errs.concat((err instanceof __WEBPACK_IMPORTED_MODULE_5__util_UnsubscriptionError__["a" /* UnsubscriptionError */]) ? err.errors : err); }, []);
- }
- //# sourceMappingURL=Subscription.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/observable/ArrayObservable.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayObservable; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ScalarObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/ScalarObservable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__EmptyObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/EmptyObservable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_isScheduler__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isScheduler.js");
- /** PURE_IMPORTS_START .._Observable,._ScalarObservable,._EmptyObservable,.._util_isScheduler PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * We need this JSDoc comment for affecting ESDoc.
- * @extends {Ignored}
- * @hide true
- */
- var ArrayObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(ArrayObservable, _super);
- function ArrayObservable(array, scheduler) {
- _super.call(this);
- this.array = array;
- this.scheduler = scheduler;
- if (!scheduler && array.length === 1) {
- this._isScalar = true;
- this.value = array[0];
- }
- }
- ArrayObservable.create = function (array, scheduler) {
- return new ArrayObservable(array, scheduler);
- };
- /**
- * Creates an Observable that emits some values you specify as arguments,
- * immediately one after the other, and then emits a complete notification.
- *
- * <span class="informal">Emits the arguments you provide, then completes.
- * </span>
- *
- * <img src="./img/of.png" width="100%">
- *
- * This static operator is useful for creating a simple Observable that only
- * emits the arguments given, and the complete notification thereafter. It can
- * be used for composing with other Observables, such as with {@link concat}.
- * By default, it uses a `null` IScheduler, which means the `next`
- * notifications are sent synchronously, although with a different IScheduler
- * it is possible to determine when those notifications will be delivered.
- *
- * @example <caption>Emit 10, 20, 30, then 'a', 'b', 'c', then start ticking every second.</caption>
- * var numbers = Rx.Observable.of(10, 20, 30);
- * var letters = Rx.Observable.of('a', 'b', 'c');
- * var interval = Rx.Observable.interval(1000);
- * var result = numbers.concat(letters).concat(interval);
- * result.subscribe(x => console.log(x));
- *
- * @see {@link create}
- * @see {@link empty}
- * @see {@link never}
- * @see {@link throw}
- *
- * @param {...T} values Arguments that represent `next` values to be emitted.
- * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
- * the emissions of the `next` notifications.
- * @return {Observable<T>} An Observable that emits each given input value.
- * @static true
- * @name of
- * @owner Observable
- */
- ArrayObservable.of = function () {
- var array = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- array[_i - 0] = arguments[_i];
- }
- var scheduler = array[array.length - 1];
- if (Object(__WEBPACK_IMPORTED_MODULE_3__util_isScheduler__["a" /* isScheduler */])(scheduler)) {
- array.pop();
- }
- else {
- scheduler = null;
- }
- var len = array.length;
- if (len > 1) {
- return new ArrayObservable(array, scheduler);
- }
- else if (len === 1) {
- return new __WEBPACK_IMPORTED_MODULE_1__ScalarObservable__["a" /* ScalarObservable */](array[0], scheduler);
- }
- else {
- return new __WEBPACK_IMPORTED_MODULE_2__EmptyObservable__["a" /* EmptyObservable */](scheduler);
- }
- };
- ArrayObservable.dispatch = function (state) {
- var array = state.array, index = state.index, count = state.count, subscriber = state.subscriber;
- if (index >= count) {
- subscriber.complete();
- return;
- }
- subscriber.next(array[index]);
- if (subscriber.closed) {
- return;
- }
- state.index = index + 1;
- this.schedule(state);
- };
- ArrayObservable.prototype._subscribe = function (subscriber) {
- var index = 0;
- var array = this.array;
- var count = array.length;
- var scheduler = this.scheduler;
- if (scheduler) {
- return scheduler.schedule(ArrayObservable.dispatch, 0, {
- array: array, index: index, count: count, subscriber: subscriber
- });
- }
- else {
- for (var i = 0; i < count && !subscriber.closed; i++) {
- subscriber.next(array[i]);
- }
- subscriber.complete();
- }
- };
- return ArrayObservable;
- }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]));
- //# sourceMappingURL=ArrayObservable.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/observable/ConnectableObservable.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export ConnectableObservable */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return connectableObservableDescriptor; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subject__ = __webpack_require__("./node_modules/rxjs/_esm5/Subject.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Subscription__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscription.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__operators_refCount__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/refCount.js");
- /** PURE_IMPORTS_START .._Subject,.._Observable,.._Subscriber,.._Subscription,.._operators_refCount PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * @class ConnectableObservable<T>
- */
- var ConnectableObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(ConnectableObservable, _super);
- function ConnectableObservable(source, subjectFactory) {
- _super.call(this);
- this.source = source;
- this.subjectFactory = subjectFactory;
- this._refCount = 0;
- this._isComplete = false;
- }
- ConnectableObservable.prototype._subscribe = function (subscriber) {
- return this.getSubject().subscribe(subscriber);
- };
- ConnectableObservable.prototype.getSubject = function () {
- var subject = this._subject;
- if (!subject || subject.isStopped) {
- this._subject = this.subjectFactory();
- }
- return this._subject;
- };
- ConnectableObservable.prototype.connect = function () {
- var connection = this._connection;
- if (!connection) {
- this._isComplete = false;
- connection = this._connection = new __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */]();
- connection.add(this.source
- .subscribe(new ConnectableSubscriber(this.getSubject(), this)));
- if (connection.closed) {
- this._connection = null;
- connection = __WEBPACK_IMPORTED_MODULE_3__Subscription__["a" /* Subscription */].EMPTY;
- }
- else {
- this._connection = connection;
- }
- }
- return connection;
- };
- ConnectableObservable.prototype.refCount = function () {
- return Object(__WEBPACK_IMPORTED_MODULE_4__operators_refCount__["a" /* refCount */])()(this);
- };
- return ConnectableObservable;
- }(__WEBPACK_IMPORTED_MODULE_1__Observable__["a" /* Observable */]));
- var connectableProto = ConnectableObservable.prototype;
- var connectableObservableDescriptor = {
- operator: { value: null },
- _refCount: { value: 0, writable: true },
- _subject: { value: null, writable: true },
- _connection: { value: null, writable: true },
- _subscribe: { value: connectableProto._subscribe },
- _isComplete: { value: connectableProto._isComplete, writable: true },
- getSubject: { value: connectableProto.getSubject },
- connect: { value: connectableProto.connect },
- refCount: { value: connectableProto.refCount }
- };
- var ConnectableSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(ConnectableSubscriber, _super);
- function ConnectableSubscriber(destination, connectable) {
- _super.call(this, destination);
- this.connectable = connectable;
- }
- ConnectableSubscriber.prototype._error = function (err) {
- this._unsubscribe();
- _super.prototype._error.call(this, err);
- };
- ConnectableSubscriber.prototype._complete = function () {
- this.connectable._isComplete = true;
- this._unsubscribe();
- _super.prototype._complete.call(this);
- };
- ConnectableSubscriber.prototype._unsubscribe = function () {
- var connectable = this.connectable;
- if (connectable) {
- this.connectable = null;
- var connection = connectable._connection;
- connectable._refCount = 0;
- connectable._subject = null;
- connectable._connection = null;
- if (connection) {
- connection.unsubscribe();
- }
- }
- };
- return ConnectableSubscriber;
- }(__WEBPACK_IMPORTED_MODULE_0__Subject__["b" /* SubjectSubscriber */]));
- var RefCountOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
- function RefCountOperator(connectable) {
- this.connectable = connectable;
- }
- RefCountOperator.prototype.call = function (subscriber, source) {
- var connectable = this.connectable;
- connectable._refCount++;
- var refCounter = new RefCountSubscriber(subscriber, connectable);
- var subscription = source.subscribe(refCounter);
- if (!refCounter.closed) {
- refCounter.connection = connectable.connect();
- }
- return subscription;
- };
- return RefCountOperator;
- }());
- var RefCountSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(RefCountSubscriber, _super);
- function RefCountSubscriber(destination, connectable) {
- _super.call(this, destination);
- this.connectable = connectable;
- }
- RefCountSubscriber.prototype._unsubscribe = function () {
- var connectable = this.connectable;
- if (!connectable) {
- this.connection = null;
- return;
- }
- this.connectable = null;
- var refCount = connectable._refCount;
- if (refCount <= 0) {
- this.connection = null;
- return;
- }
- connectable._refCount = refCount - 1;
- if (refCount > 1) {
- this.connection = null;
- return;
- }
- ///
- // Compare the local RefCountSubscriber's connection Subscription to the
- // connection Subscription on the shared ConnectableObservable. In cases
- // where the ConnectableObservable source synchronously emits values, and
- // the RefCountSubscriber's downstream Observers synchronously unsubscribe,
- // execution continues to here before the RefCountOperator has a chance to
- // supply the RefCountSubscriber with the shared connection Subscription.
- // For example:
- // ```
- // Observable.range(0, 10)
- // .publish()
- // .refCount()
- // .take(5)
- // .subscribe();
- // ```
- // In order to account for this case, RefCountSubscriber should only dispose
- // the ConnectableObservable's shared connection Subscription if the
- // connection Subscription exists, *and* either:
- // a. RefCountSubscriber doesn't have a reference to the shared connection
- // Subscription yet, or,
- // b. RefCountSubscriber's connection Subscription reference is identical
- // to the shared connection Subscription
- ///
- var connection = this.connection;
- var sharedConnection = connectable._connection;
- this.connection = null;
- if (sharedConnection && (!connection || sharedConnection === connection)) {
- sharedConnection.unsubscribe();
- }
- };
- return RefCountSubscriber;
- }(__WEBPACK_IMPORTED_MODULE_2__Subscriber__["a" /* Subscriber */]));
- //# sourceMappingURL=ConnectableObservable.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/observable/EmptyObservable.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EmptyObservable; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
- /** PURE_IMPORTS_START .._Observable PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * We need this JSDoc comment for affecting ESDoc.
- * @extends {Ignored}
- * @hide true
- */
- var EmptyObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(EmptyObservable, _super);
- function EmptyObservable(scheduler) {
- _super.call(this);
- this.scheduler = scheduler;
- }
- /**
- * Creates an Observable that emits no items to the Observer and immediately
- * emits a complete notification.
- *
- * <span class="informal">Just emits 'complete', and nothing else.
- * </span>
- *
- * <img src="./img/empty.png" width="100%">
- *
- * This static operator is useful for creating a simple Observable that only
- * emits the complete notification. It can be used for composing with other
- * Observables, such as in a {@link mergeMap}.
- *
- * @example <caption>Emit the number 7, then complete.</caption>
- * var result = Rx.Observable.empty().startWith(7);
- * result.subscribe(x => console.log(x));
- *
- * @example <caption>Map and flatten only odd numbers to the sequence 'a', 'b', 'c'</caption>
- * var interval = Rx.Observable.interval(1000);
- * var result = interval.mergeMap(x =>
- * x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty()
- * );
- * result.subscribe(x => console.log(x));
- *
- * // Results in the following to the console:
- * // x is equal to the count on the interval eg(0,1,2,3,...)
- * // x will occur every 1000ms
- * // if x % 2 is equal to 1 print abc
- * // if x % 2 is not equal to 1 nothing will be output
- *
- * @see {@link create}
- * @see {@link never}
- * @see {@link of}
- * @see {@link throw}
- *
- * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
- * the emission of the complete notification.
- * @return {Observable} An "empty" Observable: emits only the complete
- * notification.
- * @static true
- * @name empty
- * @owner Observable
- */
- EmptyObservable.create = function (scheduler) {
- return new EmptyObservable(scheduler);
- };
- EmptyObservable.dispatch = function (arg) {
- var subscriber = arg.subscriber;
- subscriber.complete();
- };
- EmptyObservable.prototype._subscribe = function (subscriber) {
- var scheduler = this.scheduler;
- if (scheduler) {
- return scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber: subscriber });
- }
- else {
- subscriber.complete();
- }
- };
- return EmptyObservable;
- }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]));
- //# sourceMappingURL=EmptyObservable.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/observable/ScalarObservable.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ScalarObservable; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
- /** PURE_IMPORTS_START .._Observable PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * We need this JSDoc comment for affecting ESDoc.
- * @extends {Ignored}
- * @hide true
- */
- var ScalarObservable = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(ScalarObservable, _super);
- function ScalarObservable(value, scheduler) {
- _super.call(this);
- this.value = value;
- this.scheduler = scheduler;
- this._isScalar = true;
- if (scheduler) {
- this._isScalar = false;
- }
- }
- ScalarObservable.create = function (value, scheduler) {
- return new ScalarObservable(value, scheduler);
- };
- ScalarObservable.dispatch = function (state) {
- var done = state.done, value = state.value, subscriber = state.subscriber;
- if (done) {
- subscriber.complete();
- return;
- }
- subscriber.next(value);
- if (subscriber.closed) {
- return;
- }
- state.done = true;
- this.schedule(state);
- };
- ScalarObservable.prototype._subscribe = function (subscriber) {
- var value = this.value;
- var scheduler = this.scheduler;
- if (scheduler) {
- return scheduler.schedule(ScalarObservable.dispatch, 0, {
- done: false, value: value, subscriber: subscriber
- });
- }
- else {
- subscriber.next(value);
- if (!subscriber.closed) {
- subscriber.complete();
- }
- }
- };
- return ScalarObservable;
- }(__WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]));
- //# sourceMappingURL=ScalarObservable.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/observable/merge.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = merge;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ArrayObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/ArrayObservable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_isScheduler__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isScheduler.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__operators_mergeAll__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/mergeAll.js");
- /** PURE_IMPORTS_START .._Observable,._ArrayObservable,.._util_isScheduler,.._operators_mergeAll PURE_IMPORTS_END */
- /* tslint:enable:max-line-length */
- /**
- * Creates an output Observable which concurrently emits all values from every
- * given input Observable.
- *
- * <span class="informal">Flattens multiple Observables together by blending
- * their values into one Observable.</span>
- *
- * <img src="./img/merge.png" width="100%">
- *
- * `merge` subscribes to each given input Observable (as arguments), and simply
- * forwards (without doing any transformation) all the values from all the input
- * Observables to the output Observable. The output Observable only completes
- * once all input Observables have completed. Any error delivered by an input
- * Observable will be immediately emitted on the output Observable.
- *
- * @example <caption>Merge together two Observables: 1s interval and clicks</caption>
- * var clicks = Rx.Observable.fromEvent(document, 'click');
- * var timer = Rx.Observable.interval(1000);
- * var clicksOrTimer = Rx.Observable.merge(clicks, timer);
- * clicksOrTimer.subscribe(x => console.log(x));
- *
- * // Results in the following:
- * // timer will emit ascending values, one every second(1000ms) to console
- * // clicks logs MouseEvents to console everytime the "document" is clicked
- * // Since the two streams are merged you see these happening
- * // as they occur.
- *
- * @example <caption>Merge together 3 Observables, but only 2 run concurrently</caption>
- * var timer1 = Rx.Observable.interval(1000).take(10);
- * var timer2 = Rx.Observable.interval(2000).take(6);
- * var timer3 = Rx.Observable.interval(500).take(10);
- * var concurrent = 2; // the argument
- * var merged = Rx.Observable.merge(timer1, timer2, timer3, concurrent);
- * merged.subscribe(x => console.log(x));
- *
- * // Results in the following:
- * // - First timer1 and timer2 will run concurrently
- * // - timer1 will emit a value every 1000ms for 10 iterations
- * // - timer2 will emit a value every 2000ms for 6 iterations
- * // - after timer1 hits it's max iteration, timer2 will
- * // continue, and timer3 will start to run concurrently with timer2
- * // - when timer2 hits it's max iteration it terminates, and
- * // timer3 will continue to emit a value every 500ms until it is complete
- *
- * @see {@link mergeAll}
- * @see {@link mergeMap}
- * @see {@link mergeMapTo}
- * @see {@link mergeScan}
- *
- * @param {...ObservableInput} observables Input Observables to merge together.
- * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
- * Observables being subscribed to concurrently.
- * @param {Scheduler} [scheduler=null] The IScheduler to use for managing
- * concurrency of input Observables.
- * @return {Observable} an Observable that emits items that are the result of
- * every input Observable.
- * @static true
- * @name merge
- * @owner Observable
- */
- function merge() {
- var observables = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- observables[_i - 0] = arguments[_i];
- }
- var concurrent = Number.POSITIVE_INFINITY;
- var scheduler = null;
- var last = observables[observables.length - 1];
- if (Object(__WEBPACK_IMPORTED_MODULE_2__util_isScheduler__["a" /* isScheduler */])(last)) {
- scheduler = observables.pop();
- if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
- concurrent = observables.pop();
- }
- }
- else if (typeof last === 'number') {
- concurrent = observables.pop();
- }
- if (scheduler === null && observables.length === 1 && observables[0] instanceof __WEBPACK_IMPORTED_MODULE_0__Observable__["a" /* Observable */]) {
- return observables[0];
- }
- return Object(__WEBPACK_IMPORTED_MODULE_3__operators_mergeAll__["a" /* mergeAll */])(concurrent)(new __WEBPACK_IMPORTED_MODULE_1__ArrayObservable__["a" /* ArrayObservable */](observables, scheduler));
- }
- //# sourceMappingURL=merge.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/observable/of.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return of; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ArrayObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/ArrayObservable.js");
- /** PURE_IMPORTS_START ._ArrayObservable PURE_IMPORTS_END */
- var of = __WEBPACK_IMPORTED_MODULE_0__ArrayObservable__["a" /* ArrayObservable */].of;
- //# sourceMappingURL=of.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/operator/share.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = share;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__operators_share__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/share.js");
- /** PURE_IMPORTS_START .._operators_share PURE_IMPORTS_END */
- /**
- * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
- * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
- * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
- *
- * This behaves similarly to .publish().refCount(), with a behavior difference when the source observable emits complete.
- * .publish().refCount() will not resubscribe to the original source, however .share() will resubscribe to the original source.
- * Observable.of("test").publish().refCount() will not re-emit "test" on new subscriptions, Observable.of("test").share() will
- * re-emit "test" to new subscriptions.
- *
- * <img src="./img/share.png" width="100%">
- *
- * @return {Observable<T>} An Observable that upon connection causes the source Observable to emit items to its Observers.
- * @method share
- * @owner Observable
- */
- function share() {
- return Object(__WEBPACK_IMPORTED_MODULE_0__operators_share__["a" /* share */])()(this);
- }
- ;
- //# sourceMappingURL=share.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/operators/mergeAll.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = mergeAll;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mergeMap__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/mergeMap.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_identity__ = __webpack_require__("./node_modules/rxjs/_esm5/util/identity.js");
- /** PURE_IMPORTS_START ._mergeMap,.._util_identity PURE_IMPORTS_END */
- /**
- * Converts a higher-order Observable into a first-order Observable which
- * concurrently delivers all values that are emitted on the inner Observables.
- *
- * <span class="informal">Flattens an Observable-of-Observables.</span>
- *
- * <img src="./img/mergeAll.png" width="100%">
- *
- * `mergeAll` subscribes to an Observable that emits Observables, also known as
- * a higher-order Observable. Each time it observes one of these emitted inner
- * Observables, it subscribes to that and delivers all the values from the
- * inner Observable on the output Observable. The output Observable only
- * completes once all inner Observables have completed. Any error delivered by
- * a inner Observable will be immediately emitted on the output Observable.
- *
- * @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption>
- * var clicks = Rx.Observable.fromEvent(document, 'click');
- * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));
- * var firstOrder = higherOrder.mergeAll();
- * firstOrder.subscribe(x => console.log(x));
- *
- * @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption>
- * var clicks = Rx.Observable.fromEvent(document, 'click');
- * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10));
- * var firstOrder = higherOrder.mergeAll(2);
- * firstOrder.subscribe(x => console.log(x));
- *
- * @see {@link combineAll}
- * @see {@link concatAll}
- * @see {@link exhaust}
- * @see {@link merge}
- * @see {@link mergeMap}
- * @see {@link mergeMapTo}
- * @see {@link mergeScan}
- * @see {@link switch}
- * @see {@link zipAll}
- *
- * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner
- * Observables being subscribed to concurrently.
- * @return {Observable} An Observable that emits values coming from all the
- * inner Observables emitted by the source Observable.
- * @method mergeAll
- * @owner Observable
- */
- function mergeAll(concurrent) {
- if (concurrent === void 0) {
- concurrent = Number.POSITIVE_INFINITY;
- }
- return Object(__WEBPACK_IMPORTED_MODULE_0__mergeMap__["a" /* mergeMap */])(__WEBPACK_IMPORTED_MODULE_1__util_identity__["a" /* identity */], null, concurrent);
- }
- //# sourceMappingURL=mergeAll.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/operators/mergeMap.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = mergeMap;
- /* unused harmony export MergeMapOperator */
- /* unused harmony export MergeMapSubscriber */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_subscribeToResult__ = __webpack_require__("./node_modules/rxjs/_esm5/util/subscribeToResult.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__OuterSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/OuterSubscriber.js");
- /** PURE_IMPORTS_START .._util_subscribeToResult,.._OuterSubscriber PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /* tslint:enable:max-line-length */
- /**
- * Projects each source value to an Observable which is merged in the output
- * Observable.
- *
- * <span class="informal">Maps each value to an Observable, then flattens all of
- * these inner Observables using {@link mergeAll}.</span>
- *
- * <img src="./img/mergeMap.png" width="100%">
- *
- * Returns an Observable that emits items based on applying a function that you
- * supply to each item emitted by the source Observable, where that function
- * returns an Observable, and then merging those resulting Observables and
- * emitting the results of this merger.
- *
- * @example <caption>Map and flatten each letter to an Observable ticking every 1 second</caption>
- * var letters = Rx.Observable.of('a', 'b', 'c');
- * var result = letters.mergeMap(x =>
- * Rx.Observable.interval(1000).map(i => x+i)
- * );
- * result.subscribe(x => console.log(x));
- *
- * // Results in the following:
- * // a0
- * // b0
- * // c0
- * // a1
- * // b1
- * // c1
- * // continues to list a,b,c with respective ascending integers
- *
- * @see {@link concatMap}
- * @see {@link exhaustMap}
- * @see {@link merge}
- * @see {@link mergeAll}
- * @see {@link mergeMapTo}
- * @see {@link mergeScan}
- * @see {@link switchMap}
- *
- * @param {function(value: T, ?index: number): ObservableInput} project A function
- * that, when applied to an item emitted by the source Observable, returns an
- * Observable.
- * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
- * A function to produce the value on the output Observable based on the values
- * and the indices of the source (outer) emission and the inner Observable
- * emission. The arguments passed to this function are:
- * - `outerValue`: the value that came from the source
- * - `innerValue`: the value that came from the projected Observable
- * - `outerIndex`: the "index" of the value that came from the source
- * - `innerIndex`: the "index" of the value from the projected Observable
- * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
- * Observables being subscribed to concurrently.
- * @return {Observable} An Observable that emits the result of applying the
- * projection function (and the optional `resultSelector`) to each item emitted
- * by the source Observable and merging the results of the Observables obtained
- * from this transformation.
- * @method mergeMap
- * @owner Observable
- */
- function mergeMap(project, resultSelector, concurrent) {
- if (concurrent === void 0) {
- concurrent = Number.POSITIVE_INFINITY;
- }
- return function mergeMapOperatorFunction(source) {
- if (typeof resultSelector === 'number') {
- concurrent = resultSelector;
- resultSelector = null;
- }
- return source.lift(new MergeMapOperator(project, resultSelector, concurrent));
- };
- }
- var MergeMapOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
- function MergeMapOperator(project, resultSelector, concurrent) {
- if (concurrent === void 0) {
- concurrent = Number.POSITIVE_INFINITY;
- }
- this.project = project;
- this.resultSelector = resultSelector;
- this.concurrent = concurrent;
- }
- MergeMapOperator.prototype.call = function (observer, source) {
- return source.subscribe(new MergeMapSubscriber(observer, this.project, this.resultSelector, this.concurrent));
- };
- return MergeMapOperator;
- }());
- /**
- * We need this JSDoc comment for affecting ESDoc.
- * @ignore
- * @extends {Ignored}
- */
- var MergeMapSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(MergeMapSubscriber, _super);
- function MergeMapSubscriber(destination, project, resultSelector, concurrent) {
- if (concurrent === void 0) {
- concurrent = Number.POSITIVE_INFINITY;
- }
- _super.call(this, destination);
- this.project = project;
- this.resultSelector = resultSelector;
- this.concurrent = concurrent;
- this.hasCompleted = false;
- this.buffer = [];
- this.active = 0;
- this.index = 0;
- }
- MergeMapSubscriber.prototype._next = function (value) {
- if (this.active < this.concurrent) {
- this._tryNext(value);
- }
- else {
- this.buffer.push(value);
- }
- };
- MergeMapSubscriber.prototype._tryNext = function (value) {
- var result;
- var index = this.index++;
- try {
- result = this.project(value, index);
- }
- catch (err) {
- this.destination.error(err);
- return;
- }
- this.active++;
- this._innerSub(result, value, index);
- };
- MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {
- this.add(Object(__WEBPACK_IMPORTED_MODULE_0__util_subscribeToResult__["a" /* subscribeToResult */])(this, ish, value, index));
- };
- MergeMapSubscriber.prototype._complete = function () {
- this.hasCompleted = true;
- if (this.active === 0 && this.buffer.length === 0) {
- this.destination.complete();
- }
- };
- MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
- if (this.resultSelector) {
- this._notifyResultSelector(outerValue, innerValue, outerIndex, innerIndex);
- }
- else {
- this.destination.next(innerValue);
- }
- };
- MergeMapSubscriber.prototype._notifyResultSelector = function (outerValue, innerValue, outerIndex, innerIndex) {
- var result;
- try {
- result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex);
- }
- catch (err) {
- this.destination.error(err);
- return;
- }
- this.destination.next(result);
- };
- MergeMapSubscriber.prototype.notifyComplete = function (innerSub) {
- var buffer = this.buffer;
- this.remove(innerSub);
- this.active--;
- if (buffer.length > 0) {
- this._next(buffer.shift());
- }
- else if (this.active === 0 && this.hasCompleted) {
- this.destination.complete();
- }
- };
- return MergeMapSubscriber;
- }(__WEBPACK_IMPORTED_MODULE_1__OuterSubscriber__["a" /* OuterSubscriber */]));
- //# sourceMappingURL=mergeMap.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/operators/multicast.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = multicast;
- /* unused harmony export MulticastOperator */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observable_ConnectableObservable__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/ConnectableObservable.js");
- /** PURE_IMPORTS_START .._observable_ConnectableObservable PURE_IMPORTS_END */
- /* tslint:enable:max-line-length */
- /**
- * Returns an Observable that emits the results of invoking a specified selector on items
- * emitted by a ConnectableObservable that shares a single subscription to the underlying stream.
- *
- * <img src="./img/multicast.png" width="100%">
- *
- * @param {Function|Subject} subjectOrSubjectFactory - Factory function to create an intermediate subject through
- * which the source sequence's elements will be multicast to the selector function
- * or Subject to push source elements into.
- * @param {Function} [selector] - Optional selector function that can use the multicasted source stream
- * as many times as needed, without causing multiple subscriptions to the source stream.
- * Subscribers to the given source will receive all notifications of the source from the
- * time of the subscription forward.
- * @return {Observable} An Observable that emits the results of invoking the selector
- * on the items emitted by a `ConnectableObservable` that shares a single subscription to
- * the underlying stream.
- * @method multicast
- * @owner Observable
- */
- function multicast(subjectOrSubjectFactory, selector) {
- return function multicastOperatorFunction(source) {
- var subjectFactory;
- if (typeof subjectOrSubjectFactory === 'function') {
- subjectFactory = subjectOrSubjectFactory;
- }
- else {
- subjectFactory = function subjectFactory() {
- return subjectOrSubjectFactory;
- };
- }
- if (typeof selector === 'function') {
- return source.lift(new MulticastOperator(subjectFactory, selector));
- }
- var connectable = Object.create(source, __WEBPACK_IMPORTED_MODULE_0__observable_ConnectableObservable__["a" /* connectableObservableDescriptor */]);
- connectable.source = source;
- connectable.subjectFactory = subjectFactory;
- return connectable;
- };
- }
- var MulticastOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
- function MulticastOperator(subjectFactory, selector) {
- this.subjectFactory = subjectFactory;
- this.selector = selector;
- }
- MulticastOperator.prototype.call = function (subscriber, source) {
- var selector = this.selector;
- var subject = this.subjectFactory();
- var subscription = selector(subject).subscribe(subscriber);
- subscription.add(source.subscribe(subject));
- return subscription;
- };
- return MulticastOperator;
- }());
- //# sourceMappingURL=multicast.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/operators/refCount.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = refCount;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
- /** PURE_IMPORTS_START .._Subscriber PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- function refCount() {
- return function refCountOperatorFunction(source) {
- return source.lift(new RefCountOperator(source));
- };
- }
- var RefCountOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
- function RefCountOperator(connectable) {
- this.connectable = connectable;
- }
- RefCountOperator.prototype.call = function (subscriber, source) {
- var connectable = this.connectable;
- connectable._refCount++;
- var refCounter = new RefCountSubscriber(subscriber, connectable);
- var subscription = source.subscribe(refCounter);
- if (!refCounter.closed) {
- refCounter.connection = connectable.connect();
- }
- return subscription;
- };
- return RefCountOperator;
- }());
- var RefCountSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(RefCountSubscriber, _super);
- function RefCountSubscriber(destination, connectable) {
- _super.call(this, destination);
- this.connectable = connectable;
- }
- RefCountSubscriber.prototype._unsubscribe = function () {
- var connectable = this.connectable;
- if (!connectable) {
- this.connection = null;
- return;
- }
- this.connectable = null;
- var refCount = connectable._refCount;
- if (refCount <= 0) {
- this.connection = null;
- return;
- }
- connectable._refCount = refCount - 1;
- if (refCount > 1) {
- this.connection = null;
- return;
- }
- ///
- // Compare the local RefCountSubscriber's connection Subscription to the
- // connection Subscription on the shared ConnectableObservable. In cases
- // where the ConnectableObservable source synchronously emits values, and
- // the RefCountSubscriber's downstream Observers synchronously unsubscribe,
- // execution continues to here before the RefCountOperator has a chance to
- // supply the RefCountSubscriber with the shared connection Subscription.
- // For example:
- // ```
- // Observable.range(0, 10)
- // .publish()
- // .refCount()
- // .take(5)
- // .subscribe();
- // ```
- // In order to account for this case, RefCountSubscriber should only dispose
- // the ConnectableObservable's shared connection Subscription if the
- // connection Subscription exists, *and* either:
- // a. RefCountSubscriber doesn't have a reference to the shared connection
- // Subscription yet, or,
- // b. RefCountSubscriber's connection Subscription reference is identical
- // to the shared connection Subscription
- ///
- var connection = this.connection;
- var sharedConnection = connectable._connection;
- this.connection = null;
- if (sharedConnection && (!connection || sharedConnection === connection)) {
- sharedConnection.unsubscribe();
- }
- };
- return RefCountSubscriber;
- }(__WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */]));
- //# sourceMappingURL=refCount.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/operators/share.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = share;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__multicast__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/multicast.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__refCount__ = __webpack_require__("./node_modules/rxjs/_esm5/operators/refCount.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Subject__ = __webpack_require__("./node_modules/rxjs/_esm5/Subject.js");
- /** PURE_IMPORTS_START ._multicast,._refCount,.._Subject PURE_IMPORTS_END */
- function shareSubjectFactory() {
- return new __WEBPACK_IMPORTED_MODULE_2__Subject__["a" /* Subject */]();
- }
- /**
- * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
- * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
- * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
- * This is an alias for .multicast(() => new Subject()).refCount().
- *
- * <img src="./img/share.png" width="100%">
- *
- * @return {Observable<T>} An Observable that upon connection causes the source Observable to emit items to its Observers.
- * @method share
- * @owner Observable
- */
- function share() {
- return function (source) { return Object(__WEBPACK_IMPORTED_MODULE_1__refCount__["a" /* refCount */])()(Object(__WEBPACK_IMPORTED_MODULE_0__multicast__["a" /* multicast */])(shareSubjectFactory)(source)); };
- }
- ;
- //# sourceMappingURL=share.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/symbol/iterator.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export symbolIteratorPonyfill */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return iterator; });
- /* unused harmony export $$iterator */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
- /** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */
- function symbolIteratorPonyfill(root) {
- var Symbol = root.Symbol;
- if (typeof Symbol === 'function') {
- if (!Symbol.iterator) {
- Symbol.iterator = Symbol('iterator polyfill');
- }
- return Symbol.iterator;
- }
- else {
- // [for Mozilla Gecko 27-35:](https://mzl.la/2ewE1zC)
- var Set_1 = root.Set;
- if (Set_1 && typeof new Set_1()['@@iterator'] === 'function') {
- return '@@iterator';
- }
- var Map_1 = root.Map;
- // required for compatability with es6-shim
- if (Map_1) {
- var keys = Object.getOwnPropertyNames(Map_1.prototype);
- for (var i = 0; i < keys.length; ++i) {
- var key = keys[i];
- // according to spec, Map.prototype[@@iterator] and Map.orototype.entries must be equal.
- if (key !== 'entries' && key !== 'size' && Map_1.prototype[key] === Map_1.prototype['entries']) {
- return key;
- }
- }
- }
- return '@@iterator';
- }
- }
- var iterator = /*@__PURE__*/ symbolIteratorPonyfill(__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */]);
- /**
- * @deprecated use iterator instead
- */
- var $$iterator = iterator;
- //# sourceMappingURL=iterator.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/symbol/observable.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export getSymbolObservable */
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return observable; });
- /* unused harmony export $$observable */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
- /** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */
- function getSymbolObservable(context) {
- var $$observable;
- var Symbol = context.Symbol;
- if (typeof Symbol === 'function') {
- if (Symbol.observable) {
- $$observable = Symbol.observable;
- }
- else {
- $$observable = Symbol('observable');
- Symbol.observable = $$observable;
- }
- }
- else {
- $$observable = '@@observable';
- }
- return $$observable;
- }
- var observable = /*@__PURE__*/ getSymbolObservable(__WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */]);
- /**
- * @deprecated use observable instead
- */
- var $$observable = observable;
- //# sourceMappingURL=observable.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/symbol/rxSubscriber.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return rxSubscriber; });
- /* unused harmony export $$rxSubscriber */
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
- /** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */
- var Symbol = __WEBPACK_IMPORTED_MODULE_0__util_root__["a" /* root */].Symbol;
- var rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ?
- /*@__PURE__*/ Symbol.for('rxSubscriber') : '@@rxSubscriber';
- /**
- * @deprecated use rxSubscriber instead
- */
- var $$rxSubscriber = rxSubscriber;
- //# sourceMappingURL=rxSubscriber.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/ObjectUnsubscribedError.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ObjectUnsubscribedError; });
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * An error thrown when an action is invalid because the object has been
- * unsubscribed.
- *
- * @see {@link Subject}
- * @see {@link BehaviorSubject}
- *
- * @class ObjectUnsubscribedError
- */
- var ObjectUnsubscribedError = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(ObjectUnsubscribedError, _super);
- function ObjectUnsubscribedError() {
- var err = _super.call(this, 'object unsubscribed');
- this.name = err.name = 'ObjectUnsubscribedError';
- this.stack = err.stack;
- this.message = err.message;
- }
- return ObjectUnsubscribedError;
- }(Error));
- //# sourceMappingURL=ObjectUnsubscribedError.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/UnsubscriptionError.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnsubscriptionError; });
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- var __extends = (this && this.__extends) || function (d, b) {
- for (var p in b)
- if (b.hasOwnProperty(p))
- d[p] = b[p];
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- /**
- * An error thrown when one or more errors have occurred during the
- * `unsubscribe` of a {@link Subscription}.
- */
- var UnsubscriptionError = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
- __extends(UnsubscriptionError, _super);
- function UnsubscriptionError(errors) {
- _super.call(this);
- this.errors = errors;
- var err = Error.call(this, errors ?
- errors.length + " errors occurred during unsubscription:\n " + errors.map(function (err, i) { return ((i + 1) + ") " + err.toString()); }).join('\n ') : '');
- this.name = err.name = 'UnsubscriptionError';
- this.stack = err.stack;
- this.message = err.message;
- }
- return UnsubscriptionError;
- }(Error));
- //# sourceMappingURL=UnsubscriptionError.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/errorObject.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return errorObject; });
- // typeof any so that it we don't have to cast when comparing a result to the error object
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- var errorObject = { e: {} };
- //# sourceMappingURL=errorObject.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/identity.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = identity;
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- function identity(x) {
- return x;
- }
- //# sourceMappingURL=identity.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/isArray.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isArray; });
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- var isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; });
- //# sourceMappingURL=isArray.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/isArrayLike.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isArrayLike; });
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- var isArrayLike = (function (x) { return x && typeof x.length === 'number'; });
- //# sourceMappingURL=isArrayLike.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/isFunction.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isFunction;
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- function isFunction(x) {
- return typeof x === 'function';
- }
- //# sourceMappingURL=isFunction.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/isObject.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- function isObject(x) {
- return x != null && typeof x === 'object';
- }
- //# sourceMappingURL=isObject.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/isPromise.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isPromise;
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- function isPromise(value) {
- return value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
- }
- //# sourceMappingURL=isPromise.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/isScheduler.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = isScheduler;
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- function isScheduler(value) {
- return value && typeof value.schedule === 'function';
- }
- //# sourceMappingURL=isScheduler.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/noop.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = noop;
- /* tslint:disable:no-empty */
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- function noop() { }
- //# sourceMappingURL=noop.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/pipe.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* unused harmony export pipe */
- /* harmony export (immutable) */ __webpack_exports__["a"] = pipeFromArray;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop__ = __webpack_require__("./node_modules/rxjs/_esm5/util/noop.js");
- /** PURE_IMPORTS_START ._noop PURE_IMPORTS_END */
- /* tslint:enable:max-line-length */
- function pipe() {
- var fns = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- fns[_i - 0] = arguments[_i];
- }
- return pipeFromArray(fns);
- }
- /* @internal */
- function pipeFromArray(fns) {
- if (!fns) {
- return __WEBPACK_IMPORTED_MODULE_0__noop__["a" /* noop */];
- }
- if (fns.length === 1) {
- return fns[0];
- }
- return function piped(input) {
- return fns.reduce(function (prev, fn) { return fn(prev); }, input);
- };
- }
- //# sourceMappingURL=pipe.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/root.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _root; });
- // CommonJS / Node have global context exposed as "global" variable.
- // We don't want to include the whole node.d.ts this this compilation unit so we'll just fake
- // the global "global" var for now.
- /** PURE_IMPORTS_START PURE_IMPORTS_END */
- var __window = typeof window !== 'undefined' && window;
- var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
- self instanceof WorkerGlobalScope && self;
- var __global = typeof global !== 'undefined' && global;
- var _root = __window || __global || __self;
- // Workaround Closure Compiler restriction: The body of a goog.module cannot use throw.
- // This is needed when used with angular/tsickle which inserts a goog.module statement.
- // Wrap in IIFE
- /*@__PURE__*/ (function () {
- if (!_root) {
- throw new Error('RxJS could not find any global context (window, self, global)');
- }
- })();
- //# sourceMappingURL=root.js.map
- /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("./node_modules/webpack/buildin/global.js")))
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/subscribeToResult.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = subscribeToResult;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__root__ = __webpack_require__("./node_modules/rxjs/_esm5/util/root.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isArrayLike.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isPromise__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isPromise.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isObject__ = __webpack_require__("./node_modules/rxjs/_esm5/util/isObject.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__symbol_iterator__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/iterator.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__InnerSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/InnerSubscriber.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__symbol_observable__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/observable.js");
- /** PURE_IMPORTS_START ._root,._isArrayLike,._isPromise,._isObject,.._Observable,.._symbol_iterator,.._InnerSubscriber,.._symbol_observable PURE_IMPORTS_END */
- function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) {
- var destination = new __WEBPACK_IMPORTED_MODULE_6__InnerSubscriber__["a" /* InnerSubscriber */](outerSubscriber, outerValue, outerIndex);
- if (destination.closed) {
- return null;
- }
- if (result instanceof __WEBPACK_IMPORTED_MODULE_4__Observable__["a" /* Observable */]) {
- if (result._isScalar) {
- destination.next(result.value);
- destination.complete();
- return null;
- }
- else {
- destination.syncErrorThrowable = true;
- return result.subscribe(destination);
- }
- }
- else if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike__["a" /* isArrayLike */])(result)) {
- for (var i = 0, len = result.length; i < len && !destination.closed; i++) {
- destination.next(result[i]);
- }
- if (!destination.closed) {
- destination.complete();
- }
- }
- else if (Object(__WEBPACK_IMPORTED_MODULE_2__isPromise__["a" /* isPromise */])(result)) {
- result.then(function (value) {
- if (!destination.closed) {
- destination.next(value);
- destination.complete();
- }
- }, function (err) { return destination.error(err); })
- .then(null, function (err) {
- // Escaping the Promise trap: globally throw unhandled errors
- __WEBPACK_IMPORTED_MODULE_0__root__["a" /* root */].setTimeout(function () { throw err; });
- });
- return destination;
- }
- else if (result && typeof result[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* iterator */]] === 'function') {
- var iterator = result[__WEBPACK_IMPORTED_MODULE_5__symbol_iterator__["a" /* iterator */]]();
- do {
- var item = iterator.next();
- if (item.done) {
- destination.complete();
- break;
- }
- destination.next(item.value);
- if (destination.closed) {
- break;
- }
- } while (true);
- }
- else if (result && typeof result[__WEBPACK_IMPORTED_MODULE_7__symbol_observable__["a" /* observable */]] === 'function') {
- var obs = result[__WEBPACK_IMPORTED_MODULE_7__symbol_observable__["a" /* observable */]]();
- if (typeof obs.subscribe !== 'function') {
- destination.error(new TypeError('Provided object does not correctly implement Symbol.observable'));
- }
- else {
- return obs.subscribe(new __WEBPACK_IMPORTED_MODULE_6__InnerSubscriber__["a" /* InnerSubscriber */](outerSubscriber, outerValue, outerIndex));
- }
- }
- else {
- var value = Object(__WEBPACK_IMPORTED_MODULE_3__isObject__["a" /* isObject */])(result) ? 'an invalid object' : "'" + result + "'";
- var msg = ("You provided " + value + " where a stream was expected.")
- + ' You can provide an Observable, Promise, Array, or Iterable.';
- destination.error(new TypeError(msg));
- }
- return null;
- }
- //# sourceMappingURL=subscribeToResult.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/toSubscriber.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = toSubscriber;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Subscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/Subscriber.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__symbol_rxSubscriber__ = __webpack_require__("./node_modules/rxjs/_esm5/symbol/rxSubscriber.js");
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Observer__ = __webpack_require__("./node_modules/rxjs/_esm5/Observer.js");
- /** PURE_IMPORTS_START .._Subscriber,.._symbol_rxSubscriber,.._Observer PURE_IMPORTS_END */
- function toSubscriber(nextOrObserver, error, complete) {
- if (nextOrObserver) {
- if (nextOrObserver instanceof __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */]) {
- return nextOrObserver;
- }
- if (nextOrObserver[__WEBPACK_IMPORTED_MODULE_1__symbol_rxSubscriber__["a" /* rxSubscriber */]]) {
- return nextOrObserver[__WEBPACK_IMPORTED_MODULE_1__symbol_rxSubscriber__["a" /* rxSubscriber */]]();
- }
- }
- if (!nextOrObserver && !error && !complete) {
- return new __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */](__WEBPACK_IMPORTED_MODULE_2__Observer__["a" /* empty */]);
- }
- return new __WEBPACK_IMPORTED_MODULE_0__Subscriber__["a" /* Subscriber */](nextOrObserver, error, complete);
- }
- //# sourceMappingURL=toSubscriber.js.map
- /***/ }),
- /***/ "./node_modules/rxjs/_esm5/util/tryCatch.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["a"] = tryCatch;
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__errorObject__ = __webpack_require__("./node_modules/rxjs/_esm5/util/errorObject.js");
- /** PURE_IMPORTS_START ._errorObject PURE_IMPORTS_END */
- var tryCatchTarget;
- function tryCatcher() {
- try {
- return tryCatchTarget.apply(this, arguments);
- }
- catch (e) {
- __WEBPACK_IMPORTED_MODULE_0__errorObject__["a" /* errorObject */].e = e;
- return __WEBPACK_IMPORTED_MODULE_0__errorObject__["a" /* errorObject */];
- }
- }
- function tryCatch(fn) {
- tryCatchTarget = fn;
- return tryCatcher;
- }
- ;
- //# sourceMappingURL=tryCatch.js.map
- /***/ }),
- /***/ "./node_modules/tslib/tslib.es6.js":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (immutable) */ __webpack_exports__["b"] = __extends;
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __assign; });
- /* unused harmony export __rest */
- /* unused harmony export __decorate */
- /* unused harmony export __param */
- /* unused harmony export __metadata */
- /* unused harmony export __awaiter */
- /* unused harmony export __generator */
- /* unused harmony export __exportStar */
- /* unused harmony export __values */
- /* unused harmony export __read */
- /* unused harmony export __spread */
- /* unused harmony export __await */
- /* unused harmony export __asyncGenerator */
- /* unused harmony export __asyncDelegator */
- /* unused harmony export __asyncValues */
- /* unused harmony export __makeTemplateObject */
- /* unused harmony export __importStar */
- /* unused harmony export __importDefault */
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
- /* global Reflect, Promise */
- var extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- function __extends(d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
- var __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- }
- function __rest(s, e) {
- var t = {};
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
- t[p] = s[p];
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
- t[p[i]] = s[p[i]];
- return t;
- }
- function __decorate(decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- 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;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
- }
- function __param(paramIndex, decorator) {
- return function (target, key) { decorator(target, key, paramIndex); }
- }
- function __metadata(metadataKey, metadataValue) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
- }
- function __awaiter(thisArg, _arguments, P, generator) {
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- }
- function __generator(thisArg, body) {
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
- function verb(n) { return function (v) { return step([n, v]); }; }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_) try {
- if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
- if (y = 0, t) op = [0, t.value];
- switch (op[0]) {
- case 0: case 1: t = op; break;
- case 4: _.label++; return { value: op[1], done: false };
- case 5: _.label++; y = op[1]; op = [0]; continue;
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
- default:
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
- if (t[2]) _.ops.pop();
- _.trys.pop(); continue;
- }
- op = body.call(thisArg, _);
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
- }
- }
- function __exportStar(m, exports) {
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
- }
- function __values(o) {
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
- if (m) return m.call(o);
- return {
- next: function () {
- if (o && i >= o.length) o = void 0;
- return { value: o && o[i++], done: !o };
- }
- };
- }
- function __read(o, n) {
- var m = typeof Symbol === "function" && o[Symbol.iterator];
- if (!m) return o;
- var i = m.call(o), r, ar = [], e;
- try {
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
- }
- catch (error) { e = { error: error }; }
- finally {
- try {
- if (r && !r.done && (m = i["return"])) m.call(i);
- }
- finally { if (e) throw e.error; }
- }
- return ar;
- }
- function __spread() {
- for (var ar = [], i = 0; i < arguments.length; i++)
- ar = ar.concat(__read(arguments[i]));
- return ar;
- }
- function __await(v) {
- return this instanceof __await ? (this.v = v, this) : new __await(v);
- }
- function __asyncGenerator(thisArg, _arguments, generator) {
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
- 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); }); }; }
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
- function fulfill(value) { resume("next", value); }
- function reject(value) { resume("throw", value); }
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
- }
- function __asyncDelegator(o) {
- var i, p;
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
- 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; }; }
- }
- function __asyncValues(o) {
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
- var m = o[Symbol.asyncIterator];
- return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
- }
- function __makeTemplateObject(cooked, raw) {
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
- return cooked;
- };
- function __importStar(mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
- result.default = mod;
- return result;
- }
- function __importDefault(mod) {
- return (mod && mod.__esModule) ? mod : { default: mod };
- }
- /***/ }),
- /***/ "./node_modules/webpack/buildin/global.js":
- /***/ (function(module, exports) {
- var g;
- // This works in non-strict mode
- g = (function() {
- return this;
- })();
- try {
- // This works if eval is allowed (see CSP)
- g = g || Function("return this")() || (1,eval)("this");
- } catch(e) {
- // This works if the window reference is available
- if(typeof window === "object")
- g = window;
- }
- // g can still be undefined, but nothing to do about it...
- // We return undefined, instead of nothing here, so it's
- // easier to handle this case. if(!global) { ...}
- module.exports = g;
- /***/ })
- });
- //# sourceMappingURL=vendor.bundle.js.map
|