1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392 |
- /**
- * @license Angular v5.2.11
- * (c) 2010-2018 Google, Inc. https://angular.io/
- * License: MIT
- */
- import { CommonModule, DOCUMENT, PlatformLocation, ɵPLATFORM_BROWSER_ID, ɵparseCookieValue } from '@angular/common';
- import { APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, ErrorHandler, Inject, Injectable, InjectionToken, Injector, NgModule, NgProbeToken, NgZone, Optional, PLATFORM_ID, PLATFORM_INITIALIZER, RendererFactory2, RendererStyleFlags2, Sanitizer, SecurityContext, SkipSelf, Testability, Version, ViewEncapsulation, createPlatformFactory, getDebugNode, isDevMode, platformCore, setTestabilityGetter, ɵglobal } from '@angular/core';
- import { __assign, __extends } from 'tslib';
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use 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) {
- __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 (ɵglobal['Node']) {
- nodeContains = ɵ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) {
- __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 ɵ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 = 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) {
- __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: Injectable },
- ];
- /** @nocollapse */
- BrowserPlatformLocation.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
- ]; };
- return BrowserPlatformLocation;
- }(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: Injectable },
- ];
- /** @nocollapse */
- Meta.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: 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 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(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: APP_INITIALIZER,
- useFactory: appInitializerFactory,
- deps: [TRANSITION_ID, DOCUMENT$1, 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 () { setTestabilityGetter(new BrowserGetTestability()); };
- /**
- * @param {?} registry
- * @return {?}
- */
- BrowserGetTestability.prototype.addToWindow = /**
- * @param {?} registry
- * @return {?}
- */
- function (registry) {
- ɵ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;
- };
- ɵglobal['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
- ɵglobal['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
- var /** @type {?} */ whenAllStable = function (callback /** TODO #9100 */) {
- var /** @type {?} */ testabilities = ɵ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 (!ɵglobal['frameworkStabilizers']) {
- ɵglobal['frameworkStabilizers'] = [];
- }
- ɵ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: Injectable },
- ];
- /** @nocollapse */
- Title.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: 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 = ɵglobal['ng'] = (/** @type {?} */ (ɵ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': ApplicationRef,
- 'NgZone': 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 getDebugNode(element);
- }
- /**
- * @param {?} coreTokens
- * @return {?}
- */
- function _createNgProbe(coreTokens) {
- exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
- exportNgVar(CORE_TOKENS_GLOBAL_NAME, __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: APP_INITIALIZER,
- useFactory: _createNgProbe,
- deps: [
- [NgProbeToken, new 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 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: Injectable },
- ];
- /** @nocollapse */
- EventManager.ctorParameters = function () { return [
- { type: Array, decorators: [{ type: Inject, args: [EVENT_MANAGER_PLUGINS,] },] },
- { type: 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: Injectable },
- ];
- /** @nocollapse */
- SharedStylesHost.ctorParameters = function () { return []; };
- return SharedStylesHost;
- }());
- var DomSharedStylesHost = /** @class */ (function (_super) {
- __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: Injectable },
- ];
- /** @nocollapse */
- DomSharedStylesHost.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: 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 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 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: 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 & RendererStyleFlags2.DashCase) {
- el.style.setProperty(style, value, !!(flags & 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 & 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) {
- __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) {
- __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) {
- __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 && (!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: Injectable },
- ];
- /** @nocollapse */
- DomEventsPlugin.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
- { type: 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 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: Injectable },
- ];
- /** @nocollapse */
- HammerGestureConfig.ctorParameters = function () { return []; };
- return HammerGestureConfig;
- }());
- var HammerGesturesPlugin = /** @class */ (function (_super) {
- __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: Injectable },
- ];
- /** @nocollapse */
- HammerGesturesPlugin.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
- { type: HammerGestureConfig, decorators: [{ type: 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) {
- __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: Injectable },
- ];
- /** @nocollapse */
- KeyEventsPlugin.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: 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 (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 (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 (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) {
- __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 SecurityContext.NONE:
- return /** @type {?} */ (value);
- case SecurityContext.HTML:
- if (value instanceof SafeHtmlImpl)
- return value.changingThisBreaksApplicationSecurity;
- this.checkNotSafeValue(value, 'HTML');
- return sanitizeHtml(this._doc, String(value));
- case SecurityContext.STYLE:
- if (value instanceof SafeStyleImpl)
- return value.changingThisBreaksApplicationSecurity;
- this.checkNotSafeValue(value, 'Style');
- return sanitizeStyle(/** @type {?} */ (value));
- case SecurityContext.SCRIPT:
- if (value instanceof SafeScriptImpl)
- return value.changingThisBreaksApplicationSecurity;
- this.checkNotSafeValue(value, 'Script');
- throw new Error('unsafe value used in a script context');
- case 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 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: Injectable },
- ];
- /** @nocollapse */
- DomSanitizerImpl.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: 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) {
- __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) {
- __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) {
- __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) {
- __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) {
- __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: PLATFORM_ID, useValue: ɵPLATFORM_BROWSER_ID },
- { provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
- { provide: 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: Sanitizer, useExisting: DomSanitizer },
- { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [DOCUMENT$1] },
- ];
- /**
- * \@stable
- */
- var platformBrowser = createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
- /**
- * @return {?}
- */
- function initDomAdapter() {
- BrowserDomAdapter.makeCurrent();
- BrowserGetTestability.init();
- }
- /**
- * @return {?}
- */
- function errorHandler() {
- return new 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: APP_ID, useValue: params.appId },
- { provide: TRANSITION_ID, useExisting: APP_ID },
- SERVER_TRANSITION_PROVIDERS,
- ],
- };
- };
- BrowserModule.decorators = [
- { type: NgModule, args: [{
- providers: [
- BROWSER_SANITIZATION_PROVIDERS,
- { provide: 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: RendererFactory2, useExisting: DomRendererFactory2 },
- { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
- DomSharedStylesHost,
- Testability,
- EventManager,
- ELEMENT_PROBE_PROVIDERS,
- Meta,
- Title,
- ],
- exports: [CommonModule, ApplicationModule]
- },] },
- ];
- /** @nocollapse */
- BrowserModule.ctorParameters = function () { return [
- { type: BrowserModule, decorators: [{ type: Optional }, { type: 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(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: 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: NgModule, args: [{
- providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT$1, 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 Version('5.2.11');
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use 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.
- */
-
- export { BrowserModule, platformBrowser, Meta, Title, disableDebugTools, enableDebugTools, BrowserTransferStateModule, TransferState, makeStateKey, By, DOCUMENT$1 as DOCUMENT, EVENT_MANAGER_PLUGINS, EventManager, HAMMER_GESTURE_CONFIG, HammerGestureConfig, DomSanitizer, VERSION, BROWSER_SANITIZATION_PROVIDERS as ɵBROWSER_SANITIZATION_PROVIDERS, INTERNAL_BROWSER_PLATFORM_PROVIDERS as ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS, initDomAdapter as ɵinitDomAdapter, BrowserDomAdapter as ɵBrowserDomAdapter, BrowserPlatformLocation as ɵBrowserPlatformLocation, TRANSITION_ID as ɵTRANSITION_ID, BrowserGetTestability as ɵBrowserGetTestability, escapeHtml as ɵescapeHtml, ELEMENT_PROBE_PROVIDERS as ɵELEMENT_PROBE_PROVIDERS, DomAdapter as ɵDomAdapter, getDOM as ɵgetDOM, setRootDomAdapter as ɵsetRootDomAdapter, DomRendererFactory2 as ɵDomRendererFactory2, NAMESPACE_URIS as ɵNAMESPACE_URIS, flattenStyles as ɵflattenStyles, shimContentAttribute as ɵshimContentAttribute, shimHostAttribute as ɵshimHostAttribute, DomEventsPlugin as ɵDomEventsPlugin, HammerGesturesPlugin as ɵHammerGesturesPlugin, KeyEventsPlugin as ɵKeyEventsPlugin, DomSharedStylesHost as ɵDomSharedStylesHost, SharedStylesHost as ɵSharedStylesHost, _document as ɵb, errorHandler as ɵa, GenericBrowserDomAdapter as ɵi, SERVER_TRANSITION_PROVIDERS as ɵg, appInitializerFactory as ɵf, initTransferState as ɵc, _createNgProbe as ɵh, EventManagerPlugin as ɵd, DomSanitizerImpl as ɵe };
- //# sourceMappingURL=platform-browser.js.map
|