UNPKG

34.8 kBJavaScriptView Raw
1/**
2 * @license Angular v9.1.1
3 * (c) 2010-2020 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7(function (global, factory) {
8 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/compiler'), require('@angular/core'), require('@angular/common'), require('@angular/platform-browser')) :
9 typeof define === 'function' && define.amd ? define('@angular/platform-browser-dynamic', ['exports', '@angular/compiler', '@angular/core', '@angular/common', '@angular/platform-browser'], factory) :
10 (global = global || self, factory((global.ng = global.ng || {}, global.ng.platformBrowserDynamic = {}), global.ng.compiler, global.ng.core, global.ng.common, global.ng.platformBrowser));
11}(this, (function (exports, compiler, core, common, platformBrowser) { 'use strict';
12
13 /*! *****************************************************************************
14 Copyright (c) Microsoft Corporation. All rights reserved.
15 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
16 this file except in compliance with the License. You may obtain a copy of the
17 License at http://www.apache.org/licenses/LICENSE-2.0
18
19 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
21 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
22 MERCHANTABLITY OR NON-INFRINGEMENT.
23
24 See the Apache Version 2.0 License for specific language governing permissions
25 and limitations under the License.
26 ***************************************************************************** */
27 /* global Reflect, Promise */
28
29 var extendStatics = function(d, b) {
30 extendStatics = Object.setPrototypeOf ||
31 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
33 return extendStatics(d, b);
34 };
35
36 function __extends(d, b) {
37 extendStatics(d, b);
38 function __() { this.constructor = d; }
39 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40 }
41
42 var __assign = function() {
43 __assign = Object.assign || function __assign(t) {
44 for (var s, i = 1, n = arguments.length; i < n; i++) {
45 s = arguments[i];
46 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
47 }
48 return t;
49 };
50 return __assign.apply(this, arguments);
51 };
52
53 function __rest(s, e) {
54 var t = {};
55 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
56 t[p] = s[p];
57 if (s != null && typeof Object.getOwnPropertySymbols === "function")
58 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
59 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
60 t[p[i]] = s[p[i]];
61 }
62 return t;
63 }
64
65 function __decorate(decorators, target, key, desc) {
66 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
67 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
68 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
69 return c > 3 && r && Object.defineProperty(target, key, r), r;
70 }
71
72 function __param(paramIndex, decorator) {
73 return function (target, key) { decorator(target, key, paramIndex); }
74 }
75
76 function __metadata(metadataKey, metadataValue) {
77 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
78 }
79
80 function __awaiter(thisArg, _arguments, P, generator) {
81 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
82 return new (P || (P = Promise))(function (resolve, reject) {
83 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
84 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
85 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
86 step((generator = generator.apply(thisArg, _arguments || [])).next());
87 });
88 }
89
90 function __generator(thisArg, body) {
91 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
92 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
93 function verb(n) { return function (v) { return step([n, v]); }; }
94 function step(op) {
95 if (f) throw new TypeError("Generator is already executing.");
96 while (_) try {
97 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
98 if (y = 0, t) op = [op[0] & 2, t.value];
99 switch (op[0]) {
100 case 0: case 1: t = op; break;
101 case 4: _.label++; return { value: op[1], done: false };
102 case 5: _.label++; y = op[1]; op = [0]; continue;
103 case 7: op = _.ops.pop(); _.trys.pop(); continue;
104 default:
105 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
106 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
107 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
108 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
109 if (t[2]) _.ops.pop();
110 _.trys.pop(); continue;
111 }
112 op = body.call(thisArg, _);
113 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
114 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
115 }
116 }
117
118 function __exportStar(m, exports) {
119 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
120 }
121
122 function __values(o) {
123 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
124 if (m) return m.call(o);
125 if (o && typeof o.length === "number") return {
126 next: function () {
127 if (o && i >= o.length) o = void 0;
128 return { value: o && o[i++], done: !o };
129 }
130 };
131 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
132 }
133
134 function __read(o, n) {
135 var m = typeof Symbol === "function" && o[Symbol.iterator];
136 if (!m) return o;
137 var i = m.call(o), r, ar = [], e;
138 try {
139 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
140 }
141 catch (error) { e = { error: error }; }
142 finally {
143 try {
144 if (r && !r.done && (m = i["return"])) m.call(i);
145 }
146 finally { if (e) throw e.error; }
147 }
148 return ar;
149 }
150
151 function __spread() {
152 for (var ar = [], i = 0; i < arguments.length; i++)
153 ar = ar.concat(__read(arguments[i]));
154 return ar;
155 }
156
157 function __spreadArrays() {
158 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
159 for (var r = Array(s), k = 0, i = 0; i < il; i++)
160 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
161 r[k] = a[j];
162 return r;
163 };
164
165 function __await(v) {
166 return this instanceof __await ? (this.v = v, this) : new __await(v);
167 }
168
169 function __asyncGenerator(thisArg, _arguments, generator) {
170 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
171 var g = generator.apply(thisArg, _arguments || []), i, q = [];
172 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
173 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
174 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
175 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
176 function fulfill(value) { resume("next", value); }
177 function reject(value) { resume("throw", value); }
178 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
179 }
180
181 function __asyncDelegator(o) {
182 var i, p;
183 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
184 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
185 }
186
187 function __asyncValues(o) {
188 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
189 var m = o[Symbol.asyncIterator], i;
190 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
191 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
192 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
193 }
194
195 function __makeTemplateObject(cooked, raw) {
196 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
197 return cooked;
198 };
199
200 function __importStar(mod) {
201 if (mod && mod.__esModule) return mod;
202 var result = {};
203 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
204 result.default = mod;
205 return result;
206 }
207
208 function __importDefault(mod) {
209 return (mod && mod.__esModule) ? mod : { default: mod };
210 }
211
212 function __classPrivateFieldGet(receiver, privateMap) {
213 if (!privateMap.has(receiver)) {
214 throw new TypeError("attempted to get private field on non-instance");
215 }
216 return privateMap.get(receiver);
217 }
218
219 function __classPrivateFieldSet(receiver, privateMap, value) {
220 if (!privateMap.has(receiver)) {
221 throw new TypeError("attempted to set private field on non-instance");
222 }
223 privateMap.set(receiver, value);
224 return value;
225 }
226
227 /**
228 * @license
229 * Copyright Google Inc. All Rights Reserved.
230 *
231 * Use of this source code is governed by an MIT-style license that can be
232 * found in the LICENSE file at https://angular.io/license
233 */
234 var MODULE_SUFFIX = '';
235 var builtinExternalReferences = createBuiltinExternalReferencesMap();
236 var JitReflector = /** @class */ (function () {
237 function JitReflector() {
238 this.reflectionCapabilities = new core.ɵReflectionCapabilities();
239 }
240 JitReflector.prototype.componentModuleUrl = function (type, cmpMetadata) {
241 var moduleId = cmpMetadata.moduleId;
242 if (typeof moduleId === 'string') {
243 var scheme = compiler.getUrlScheme(moduleId);
244 return scheme ? moduleId : "package:" + moduleId + MODULE_SUFFIX;
245 }
246 else if (moduleId !== null && moduleId !== void 0) {
247 throw compiler.syntaxError("moduleId should be a string in \"" + core.ɵstringify(type) + "\". See https://goo.gl/wIDDiL for more information.\n" +
248 "If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.");
249 }
250 return "./" + core.ɵstringify(type);
251 };
252 JitReflector.prototype.parameters = function (typeOrFunc) {
253 return this.reflectionCapabilities.parameters(typeOrFunc);
254 };
255 JitReflector.prototype.tryAnnotations = function (typeOrFunc) { return this.annotations(typeOrFunc); };
256 JitReflector.prototype.annotations = function (typeOrFunc) {
257 return this.reflectionCapabilities.annotations(typeOrFunc);
258 };
259 JitReflector.prototype.shallowAnnotations = function (typeOrFunc) {
260 throw new Error('Not supported in JIT mode');
261 };
262 JitReflector.prototype.propMetadata = function (typeOrFunc) {
263 return this.reflectionCapabilities.propMetadata(typeOrFunc);
264 };
265 JitReflector.prototype.hasLifecycleHook = function (type, lcProperty) {
266 return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
267 };
268 JitReflector.prototype.guards = function (type) { return this.reflectionCapabilities.guards(type); };
269 JitReflector.prototype.resolveExternalReference = function (ref) {
270 return builtinExternalReferences.get(ref) || ref.runtime;
271 };
272 return JitReflector;
273 }());
274 function createBuiltinExternalReferencesMap() {
275 var map = new Map();
276 map.set(compiler.Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS, core.ANALYZE_FOR_ENTRY_COMPONENTS);
277 map.set(compiler.Identifiers.ElementRef, core.ElementRef);
278 map.set(compiler.Identifiers.NgModuleRef, core.NgModuleRef);
279 map.set(compiler.Identifiers.ViewContainerRef, core.ViewContainerRef);
280 map.set(compiler.Identifiers.ChangeDetectorRef, core.ChangeDetectorRef);
281 map.set(compiler.Identifiers.Renderer2, core.Renderer2);
282 map.set(compiler.Identifiers.QueryList, core.QueryList);
283 map.set(compiler.Identifiers.TemplateRef, core.TemplateRef);
284 map.set(compiler.Identifiers.CodegenComponentFactoryResolver, core.ɵCodegenComponentFactoryResolver);
285 map.set(compiler.Identifiers.ComponentFactoryResolver, core.ComponentFactoryResolver);
286 map.set(compiler.Identifiers.ComponentFactory, core.ComponentFactory);
287 map.set(compiler.Identifiers.ComponentRef, core.ComponentRef);
288 map.set(compiler.Identifiers.NgModuleFactory, core.NgModuleFactory);
289 map.set(compiler.Identifiers.createModuleFactory, core.ɵcmf);
290 map.set(compiler.Identifiers.moduleDef, core.ɵmod);
291 map.set(compiler.Identifiers.moduleProviderDef, core.ɵmpd);
292 map.set(compiler.Identifiers.RegisterModuleFactoryFn, core.ɵregisterModuleFactory);
293 map.set(compiler.Identifiers.Injector, core.Injector);
294 map.set(compiler.Identifiers.ViewEncapsulation, core.ViewEncapsulation);
295 map.set(compiler.Identifiers.ChangeDetectionStrategy, core.ChangeDetectionStrategy);
296 map.set(compiler.Identifiers.SecurityContext, core.SecurityContext);
297 map.set(compiler.Identifiers.LOCALE_ID, core.LOCALE_ID);
298 map.set(compiler.Identifiers.TRANSLATIONS_FORMAT, core.TRANSLATIONS_FORMAT);
299 map.set(compiler.Identifiers.inlineInterpolate, core.ɵinlineInterpolate);
300 map.set(compiler.Identifiers.interpolate, core.ɵinterpolate);
301 map.set(compiler.Identifiers.EMPTY_ARRAY, core.ɵEMPTY_ARRAY);
302 map.set(compiler.Identifiers.EMPTY_MAP, core.ɵEMPTY_MAP);
303 map.set(compiler.Identifiers.viewDef, core.ɵvid);
304 map.set(compiler.Identifiers.elementDef, core.ɵeld);
305 map.set(compiler.Identifiers.anchorDef, core.ɵand);
306 map.set(compiler.Identifiers.textDef, core.ɵted);
307 map.set(compiler.Identifiers.directiveDef, core.ɵdid);
308 map.set(compiler.Identifiers.providerDef, core.ɵprd);
309 map.set(compiler.Identifiers.queryDef, core.ɵqud);
310 map.set(compiler.Identifiers.pureArrayDef, core.ɵpad);
311 map.set(compiler.Identifiers.pureObjectDef, core.ɵpod);
312 map.set(compiler.Identifiers.purePipeDef, core.ɵppd);
313 map.set(compiler.Identifiers.pipeDef, core.ɵpid);
314 map.set(compiler.Identifiers.nodeValue, core.ɵnov);
315 map.set(compiler.Identifiers.ngContentDef, core.ɵncd);
316 map.set(compiler.Identifiers.unwrapValue, core.ɵunv);
317 map.set(compiler.Identifiers.createRendererType2, core.ɵcrt);
318 map.set(compiler.Identifiers.createComponentFactory, core.ɵccf);
319 return map;
320 }
321
322 /**
323 * @license
324 * Copyright Google Inc. All Rights Reserved.
325 *
326 * Use of this source code is governed by an MIT-style license that can be
327 * found in the LICENSE file at https://angular.io/license
328 */
329 var ERROR_COLLECTOR_TOKEN = new core.InjectionToken('ErrorCollector');
330 /**
331 * A default provider for {@link PACKAGE_ROOT_URL} that maps to '/'.
332 */
333 var DEFAULT_PACKAGE_URL_PROVIDER = {
334 provide: core.PACKAGE_ROOT_URL,
335 useValue: '/'
336 };
337 var _NO_RESOURCE_LOADER = {
338 get: function (url) {
339 throw new Error("No ResourceLoader implementation has been provided. Can't read the url \"" + url + "\"");
340 }
341 };
342 var baseHtmlParser = new core.InjectionToken('HtmlParser');
343 var CompilerImpl = /** @class */ (function () {
344 function CompilerImpl(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, jitEvaluator, compilerConfig, console) {
345 this._metadataResolver = _metadataResolver;
346 this._delegate = new compiler.JitCompiler(_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, jitEvaluator, compilerConfig, console, this.getExtraNgModuleProviders.bind(this));
347 this.injector = injector;
348 }
349 CompilerImpl.prototype.getExtraNgModuleProviders = function () {
350 return [this._metadataResolver.getProviderMetadata(new compiler.ProviderMeta(core.Compiler, { useValue: this }))];
351 };
352 CompilerImpl.prototype.compileModuleSync = function (moduleType) {
353 return this._delegate.compileModuleSync(moduleType);
354 };
355 CompilerImpl.prototype.compileModuleAsync = function (moduleType) {
356 return this._delegate.compileModuleAsync(moduleType);
357 };
358 CompilerImpl.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
359 var result = this._delegate.compileModuleAndAllComponentsSync(moduleType);
360 return {
361 ngModuleFactory: result.ngModuleFactory,
362 componentFactories: result.componentFactories,
363 };
364 };
365 CompilerImpl.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
366 return this._delegate.compileModuleAndAllComponentsAsync(moduleType)
367 .then(function (result) { return ({
368 ngModuleFactory: result.ngModuleFactory,
369 componentFactories: result.componentFactories,
370 }); });
371 };
372 CompilerImpl.prototype.loadAotSummaries = function (summaries) { this._delegate.loadAotSummaries(summaries); };
373 CompilerImpl.prototype.hasAotSummary = function (ref) { return this._delegate.hasAotSummary(ref); };
374 CompilerImpl.prototype.getComponentFactory = function (component) {
375 return this._delegate.getComponentFactory(component);
376 };
377 CompilerImpl.prototype.clearCache = function () { this._delegate.clearCache(); };
378 CompilerImpl.prototype.clearCacheFor = function (type) { this._delegate.clearCacheFor(type); };
379 CompilerImpl.prototype.getModuleId = function (moduleType) {
380 var meta = this._metadataResolver.getNgModuleMetadata(moduleType);
381 return meta && meta.id || undefined;
382 };
383 return CompilerImpl;
384 }());
385 var ɵ0 = new JitReflector(), ɵ1 = _NO_RESOURCE_LOADER, ɵ2 = function (parser, translations, format, config, console) {
386 translations = translations || '';
387 var missingTranslation = translations ? config.missingTranslation : core.MissingTranslationStrategy.Ignore;
388 return new compiler.I18NHtmlParser(parser, translations, format, missingTranslation, console);
389 }, ɵ3 = new compiler.CompilerConfig();
390 /**
391 * A set of providers that provide `JitCompiler` and its dependencies to use for
392 * template compilation.
393 */
394 var COMPILER_PROVIDERS__PRE_R3__ = [
395 { provide: compiler.CompileReflector, useValue: ɵ0 },
396 { provide: compiler.ResourceLoader, useValue: ɵ1 },
397 { provide: compiler.JitSummaryResolver, deps: [] },
398 { provide: compiler.SummaryResolver, useExisting: compiler.JitSummaryResolver },
399 { provide: core.ɵConsole, deps: [] },
400 { provide: compiler.Lexer, deps: [] },
401 { provide: compiler.Parser, deps: [compiler.Lexer] },
402 {
403 provide: baseHtmlParser,
404 useClass: compiler.HtmlParser,
405 deps: [],
406 },
407 {
408 provide: compiler.I18NHtmlParser,
409 useFactory: ɵ2,
410 deps: [
411 baseHtmlParser,
412 [new core.Optional(), new core.Inject(core.TRANSLATIONS)],
413 [new core.Optional(), new core.Inject(core.TRANSLATIONS_FORMAT)],
414 [compiler.CompilerConfig],
415 [core.ɵConsole],
416 ]
417 },
418 {
419 provide: compiler.HtmlParser,
420 useExisting: compiler.I18NHtmlParser,
421 },
422 {
423 provide: compiler.TemplateParser, deps: [compiler.CompilerConfig, compiler.CompileReflector,
424 compiler.Parser, compiler.ElementSchemaRegistry,
425 compiler.I18NHtmlParser, core.ɵConsole]
426 },
427 { provide: compiler.JitEvaluator, useClass: compiler.JitEvaluator, deps: [] },
428 { provide: compiler.DirectiveNormalizer, deps: [compiler.ResourceLoader, compiler.UrlResolver, compiler.HtmlParser, compiler.CompilerConfig] },
429 { provide: compiler.CompileMetadataResolver, deps: [compiler.CompilerConfig, compiler.HtmlParser, compiler.NgModuleResolver,
430 compiler.DirectiveResolver, compiler.PipeResolver,
431 compiler.SummaryResolver,
432 compiler.ElementSchemaRegistry,
433 compiler.DirectiveNormalizer, core.ɵConsole,
434 [core.Optional, compiler.StaticSymbolCache],
435 compiler.CompileReflector,
436 [core.Optional, ERROR_COLLECTOR_TOKEN]] },
437 DEFAULT_PACKAGE_URL_PROVIDER,
438 { provide: compiler.StyleCompiler, deps: [compiler.UrlResolver] },
439 { provide: compiler.ViewCompiler, deps: [compiler.CompileReflector] },
440 { provide: compiler.NgModuleCompiler, deps: [compiler.CompileReflector] },
441 { provide: compiler.CompilerConfig, useValue: ɵ3 },
442 { provide: core.Compiler, useClass: CompilerImpl, deps: [core.Injector, compiler.CompileMetadataResolver,
443 compiler.TemplateParser, compiler.StyleCompiler,
444 compiler.ViewCompiler, compiler.NgModuleCompiler,
445 compiler.SummaryResolver, compiler.CompileReflector, compiler.JitEvaluator, compiler.CompilerConfig,
446 core.ɵConsole] },
447 { provide: compiler.DomElementSchemaRegistry, deps: [] },
448 { provide: compiler.ElementSchemaRegistry, useExisting: compiler.DomElementSchemaRegistry },
449 { provide: compiler.UrlResolver, deps: [core.PACKAGE_ROOT_URL] },
450 { provide: compiler.DirectiveResolver, deps: [compiler.CompileReflector] },
451 { provide: compiler.PipeResolver, deps: [compiler.CompileReflector] },
452 { provide: compiler.NgModuleResolver, deps: [compiler.CompileReflector] },
453 ];
454 var COMPILER_PROVIDERS__POST_R3__ = [{ provide: core.Compiler, useFactory: function () { return new core.Compiler(); } }];
455 var COMPILER_PROVIDERS = COMPILER_PROVIDERS__PRE_R3__;
456 /**
457 * @publicApi
458 */
459 var JitCompilerFactory = /** @class */ (function () {
460 /* @internal */
461 function JitCompilerFactory(defaultOptions) {
462 var compilerOptions = {
463 useJit: true,
464 defaultEncapsulation: core.ViewEncapsulation.Emulated,
465 missingTranslation: core.MissingTranslationStrategy.Warning,
466 };
467 this._defaultOptions = __spread([compilerOptions], defaultOptions);
468 }
469 JitCompilerFactory.prototype.createCompiler = function (options) {
470 if (options === void 0) { options = []; }
471 var opts = _mergeOptions(this._defaultOptions.concat(options));
472 var injector = core.Injector.create([
473 COMPILER_PROVIDERS, {
474 provide: compiler.CompilerConfig,
475 useFactory: function () {
476 return new compiler.CompilerConfig({
477 // let explicit values from the compiler options overwrite options
478 // from the app providers
479 useJit: opts.useJit,
480 jitDevMode: core.isDevMode(),
481 // let explicit values from the compiler options overwrite options
482 // from the app providers
483 defaultEncapsulation: opts.defaultEncapsulation,
484 missingTranslation: opts.missingTranslation,
485 preserveWhitespaces: opts.preserveWhitespaces,
486 });
487 },
488 deps: []
489 },
490 opts.providers
491 ]);
492 return injector.get(core.Compiler);
493 };
494 return JitCompilerFactory;
495 }());
496 function _mergeOptions(optionsArr) {
497 return {
498 useJit: _lastDefined(optionsArr.map(function (options) { return options.useJit; })),
499 defaultEncapsulation: _lastDefined(optionsArr.map(function (options) { return options.defaultEncapsulation; })),
500 providers: _mergeArrays(optionsArr.map(function (options) { return options.providers; })),
501 missingTranslation: _lastDefined(optionsArr.map(function (options) { return options.missingTranslation; })),
502 preserveWhitespaces: _lastDefined(optionsArr.map(function (options) { return options.preserveWhitespaces; })),
503 };
504 }
505 function _lastDefined(args) {
506 for (var i = args.length - 1; i >= 0; i--) {
507 if (args[i] !== undefined) {
508 return args[i];
509 }
510 }
511 return undefined;
512 }
513 function _mergeArrays(parts) {
514 var result = [];
515 parts.forEach(function (part) { return part && result.push.apply(result, __spread(part)); });
516 return result;
517 }
518
519 /**
520 * @license
521 * Copyright Google Inc. All Rights Reserved.
522 *
523 * Use of this source code is governed by an MIT-style license that can be
524 * found in the LICENSE file at https://angular.io/license
525 */
526 var ɵ0$1 = {};
527 /**
528 * A platform that included corePlatform and the compiler.
529 *
530 * @publicApi
531 */
532 var platformCoreDynamic = core.createPlatformFactory(core.platformCore, 'coreDynamic', [
533 { provide: core.COMPILER_OPTIONS, useValue: ɵ0$1, multi: true },
534 { provide: core.CompilerFactory, useClass: JitCompilerFactory, deps: [core.COMPILER_OPTIONS] },
535 ]);
536
537 var ResourceLoaderImpl = /** @class */ (function (_super) {
538 __extends(ResourceLoaderImpl, _super);
539 function ResourceLoaderImpl() {
540 return _super !== null && _super.apply(this, arguments) || this;
541 }
542 ResourceLoaderImpl.prototype.get = function (url) {
543 var resolve;
544 var reject;
545 var promise = new Promise(function (res, rej) {
546 resolve = res;
547 reject = rej;
548 });
549 var xhr = new XMLHttpRequest();
550 xhr.open('GET', url, true);
551 xhr.responseType = 'text';
552 xhr.onload = function () {
553 // responseText is the old-school way of retrieving response (supported by IE8 & 9)
554 // response/responseType properties were introduced in ResourceLoader Level2 spec (supported
555 // by IE10)
556 var response = xhr.response || xhr.responseText;
557 // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
558 var status = xhr.status === 1223 ? 204 : xhr.status;
559 // fix status code when it is 0 (0 status is undocumented).
560 // Occurs when accessing file resources or on Android 4.1 stock browser
561 // while retrieving files from application cache.
562 if (status === 0) {
563 status = response ? 200 : 0;
564 }
565 if (200 <= status && status <= 300) {
566 resolve(response);
567 }
568 else {
569 reject("Failed to load " + url);
570 }
571 };
572 xhr.onerror = function () { reject("Failed to load " + url); };
573 xhr.send();
574 return promise;
575 };
576 ResourceLoaderImpl = __decorate([
577 core.Injectable()
578 ], ResourceLoaderImpl);
579 return ResourceLoaderImpl;
580 }(compiler.ResourceLoader));
581
582 /**
583 * @license
584 * Copyright Google Inc. All Rights Reserved.
585 *
586 * Use of this source code is governed by an MIT-style license that can be
587 * found in the LICENSE file at https://angular.io/license
588 */
589 var ɵ0$2 = { providers: [{ provide: compiler.ResourceLoader, useClass: ResourceLoaderImpl, deps: [] }] }, ɵ1$1 = common.ɵPLATFORM_BROWSER_ID;
590 /**
591 * @publicApi
592 */
593 var INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [
594 platformBrowser.ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS,
595 {
596 provide: core.COMPILER_OPTIONS,
597 useValue: ɵ0$2,
598 multi: true
599 },
600 { provide: core.PLATFORM_ID, useValue: ɵ1$1 },
601 ];
602
603 /**
604 * @license
605 * Copyright Google Inc. All Rights Reserved.
606 *
607 * Use of this source code is governed by an MIT-style license that can be
608 * found in the LICENSE file at https://angular.io/license
609 */
610 /**
611 * An implementation of ResourceLoader that uses a template cache to avoid doing an actual
612 * ResourceLoader.
613 *
614 * The template cache needs to be built and loaded into window.$templateCache
615 * via a separate mechanism.
616 *
617 * @publicApi
618 */
619 var CachedResourceLoader = /** @class */ (function (_super) {
620 __extends(CachedResourceLoader, _super);
621 function CachedResourceLoader() {
622 var _this = _super.call(this) || this;
623 _this._cache = core.ɵglobal.$templateCache;
624 if (_this._cache == null) {
625 throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.');
626 }
627 return _this;
628 }
629 CachedResourceLoader.prototype.get = function (url) {
630 if (this._cache.hasOwnProperty(url)) {
631 return Promise.resolve(this._cache[url]);
632 }
633 else {
634 return Promise.reject('CachedResourceLoader: Did not find cached template for ' + url);
635 }
636 };
637 return CachedResourceLoader;
638 }(compiler.ResourceLoader));
639
640 /**
641 * @license
642 * Copyright Google Inc. All Rights Reserved.
643 *
644 * Use of this source code is governed by an MIT-style license that can be
645 * found in the LICENSE file at https://angular.io/license
646 */
647
648 /**
649 * @license
650 * Copyright Google Inc. All Rights Reserved.
651 *
652 * Use of this source code is governed by an MIT-style license that can be
653 * found in the LICENSE file at https://angular.io/license
654 */
655 /**
656 * @publicApi
657 */
658 var VERSION = new core.Version('9.1.1');
659
660 /**
661 * @license
662 * Copyright Google Inc. All Rights Reserved.
663 *
664 * Use of this source code is governed by an MIT-style license that can be
665 * found in the LICENSE file at https://angular.io/license
666 */
667 /**
668 * @publicApi
669 */
670 var RESOURCE_CACHE_PROVIDER = [{ provide: compiler.ResourceLoader, useClass: CachedResourceLoader, deps: [] }];
671 /**
672 * @publicApi
673 */
674 var platformBrowserDynamic = core.createPlatformFactory(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
675
676 /**
677 * @license
678 * Copyright Google Inc. All Rights Reserved.
679 *
680 * Use of this source code is governed by an MIT-style license that can be
681 * found in the LICENSE file at https://angular.io/license
682 */
683 // This file only reexports content of the `src` folder. Keep it that way.
684
685 /**
686 * @license
687 * Copyright Google Inc. All Rights Reserved.
688 *
689 * Use of this source code is governed by an MIT-style license that can be
690 * found in the LICENSE file at https://angular.io/license
691 */
692
693 /**
694 * Generated bundle index. Do not edit.
695 */
696
697 exports.JitCompilerFactory = JitCompilerFactory;
698 exports.RESOURCE_CACHE_PROVIDER = RESOURCE_CACHE_PROVIDER;
699 exports.VERSION = VERSION;
700 exports.platformBrowserDynamic = platformBrowserDynamic;
701 exports.ɵCOMPILER_PROVIDERS__POST_R3__ = COMPILER_PROVIDERS__POST_R3__;
702 exports.ɵCompilerImpl = CompilerImpl;
703 exports.ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS;
704 exports.ɵResourceLoaderImpl = ResourceLoaderImpl;
705 exports.ɵangular_packages_platform_browser_dynamic_platform_browser_dynamic_a = CachedResourceLoader;
706 exports.ɵplatformCoreDynamic = platformCoreDynamic;
707
708 Object.defineProperty(exports, '__esModule', { value: true });
709
710})));
711//# sourceMappingURL=platform-browser-dynamic.umd.js.map