├── README.md
├── css
└── style.css
├── index.html
├── js
├── app.component.ts
├── home
│ └── home.component.ts
├── login
│ └── login.component.ts
└── main.ts
└── libs
├── Rx.js
├── angular2-polyfills.js
├── angular2.dev.js
├── router.dev.js
├── system.js
└── typescript.js
/README.md:
--------------------------------------------------------------------------------
1 | # Superfast Angular 2 setup
2 |
3 | A super simple setup for Angular 2 for prototyping or playing around (built for [Telerik Developer Network article here](http://developer.telerik.com/content-types/tutorials/super-fast-setup-angular-2-components-component-router)). Components, TypeScript and Routing setup. No build processes or messing about.
4 |
5 | > This isn't a boilerplate I'd recommend using to kickstart your next Angular 2 project with, it was built to demonstrate how to create the barebones needed to bootstrap an Angular 2 application with Components, Views and Routing.
6 |
7 | ### Running the app
8 |
9 | Just clone the repo and run a local server with whatever IDE/tool you want, such as Python on the command line:
10 |
11 | ```
12 | cd superfast-angular-2
13 | python -m SimpleHTTPServer
14 | ```
15 |
--------------------------------------------------------------------------------
/css/style.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toddmotto/superfast-angular-2/5bfae91322a8ad5da1cfbc483b974940601b152b/css/style.css
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Superfast Angular 2 setup
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
33 |
34 |
35 |
36 | Loading...
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/js/app.component.ts:
--------------------------------------------------------------------------------
1 | import {Component} from 'angular2/core';
2 | import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
3 | import {Home} from './home/home.component.ts';
4 | import {Login} from './login/login.component.ts';
5 |
6 | @Component({
7 | selector: 'my-app',
8 | template: `
9 |
10 | Hello world!
11 |
12 |
13 |
14 | Home
15 |
16 |
17 | Login
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | `,
26 | directives: [ROUTER_DIRECTIVES]
27 | })
28 | @RouteConfig([
29 | { path: '/', name: 'Home', component: Home, useAsDefault: true },
30 | { path: '/login', name: 'Login', component: Login }
31 | ])
32 | export class AppComponent {
33 |
34 | }
--------------------------------------------------------------------------------
/js/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import {Component} from 'angular2/core';
2 |
3 | @Component({
4 | selector: 'home',
5 | template: `
6 | Home view!
7 | `
8 | })
9 | export class Home {
10 | constructor() {
11 |
12 | }
13 | }
--------------------------------------------------------------------------------
/js/login/login.component.ts:
--------------------------------------------------------------------------------
1 | import {Component} from 'angular2/core';
2 |
3 | @Component({
4 | selector: 'login',
5 | template: `
6 | Login view!
7 | `
8 | })
9 | export class Login {
10 | constructor() {
11 |
12 | }
13 | }
--------------------------------------------------------------------------------
/js/main.ts:
--------------------------------------------------------------------------------
1 | import {bootstrap} from 'angular2/platform/browser';
2 | import {AppComponent} from './app.component';
3 | import {ROUTER_PROVIDERS} from 'angular2/router';
4 |
5 | bootstrap(AppComponent, [
6 | ROUTER_PROVIDERS
7 | ]);
--------------------------------------------------------------------------------
/libs/angular2-polyfills.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | The MIT License
4 |
5 | Copyright (c) 2016 Google, Inc.
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in
15 | all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | THE SOFTWARE.
24 |
25 | */
26 |
27 | /******/ (function(modules) { // webpackBootstrap
28 | /******/ // The module cache
29 | /******/ var installedModules = {};
30 |
31 | /******/ // The require function
32 | /******/ function __webpack_require__(moduleId) {
33 |
34 | /******/ // Check if module is in cache
35 | /******/ if(installedModules[moduleId])
36 | /******/ return installedModules[moduleId].exports;
37 |
38 | /******/ // Create a new module (and put it into the cache)
39 | /******/ var module = installedModules[moduleId] = {
40 | /******/ exports: {},
41 | /******/ id: moduleId,
42 | /******/ loaded: false
43 | /******/ };
44 |
45 | /******/ // Execute the module function
46 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
47 |
48 | /******/ // Flag the module as loaded
49 | /******/ module.loaded = true;
50 |
51 | /******/ // Return the exports of the module
52 | /******/ return module.exports;
53 | /******/ }
54 |
55 |
56 | /******/ // expose the modules object (__webpack_modules__)
57 | /******/ __webpack_require__.m = modules;
58 |
59 | /******/ // expose the module cache
60 | /******/ __webpack_require__.c = installedModules;
61 |
62 | /******/ // __webpack_public_path__
63 | /******/ __webpack_require__.p = "";
64 |
65 | /******/ // Load entry module and return exports
66 | /******/ return __webpack_require__(0);
67 | /******/ })
68 | /************************************************************************/
69 | /******/ ([
70 | /* 0 */
71 | /***/ function(module, exports, __webpack_require__) {
72 |
73 | /* WEBPACK VAR INJECTION */(function(global) {"use strict";
74 | __webpack_require__(1);
75 | var event_target_1 = __webpack_require__(2);
76 | var define_property_1 = __webpack_require__(4);
77 | var register_element_1 = __webpack_require__(5);
78 | var property_descriptor_1 = __webpack_require__(6);
79 | var utils_1 = __webpack_require__(3);
80 | var set = 'set';
81 | var clear = 'clear';
82 | var blockingMethods = ['alert', 'prompt', 'confirm'];
83 | var _global = typeof window == 'undefined' ? global : window;
84 | patchTimer(_global, set, clear, 'Timeout');
85 | patchTimer(_global, set, clear, 'Interval');
86 | patchTimer(_global, set, clear, 'Immediate');
87 | patchTimer(_global, 'request', 'cancelMacroTask', 'AnimationFrame');
88 | patchTimer(_global, 'mozRequest', 'mozCancel', 'AnimationFrame');
89 | patchTimer(_global, 'webkitRequest', 'webkitCancel', 'AnimationFrame');
90 | for (var i = 0; i < blockingMethods.length; i++) {
91 | var name = blockingMethods[i];
92 | utils_1.patchMethod(_global, name, function (delegate, symbol, name) {
93 | return function (s, args) {
94 | return Zone.current.run(delegate, _global, args, name);
95 | };
96 | });
97 | }
98 | event_target_1.eventTargetPatch(_global);
99 | property_descriptor_1.propertyDescriptorPatch(_global);
100 | utils_1.patchClass('MutationObserver');
101 | utils_1.patchClass('WebKitMutationObserver');
102 | utils_1.patchClass('FileReader');
103 | define_property_1.propertyPatch();
104 | register_element_1.registerElementPatch(_global);
105 | /// GEO_LOCATION
106 | if (_global['navigator'] && _global['navigator'].geolocation) {
107 | utils_1.patchPrototype(_global['navigator'].geolocation, [
108 | 'getCurrentPosition',
109 | 'watchPosition'
110 | ]);
111 | }
112 | function patchTimer(window, setName, cancelName, nameSuffix) {
113 | setName += nameSuffix;
114 | cancelName += nameSuffix;
115 | function scheduleTask(task) {
116 | var data = task.data;
117 | data.args[0] = task.invoke;
118 | data.handleId = setNative.apply(window, data.args);
119 | return task;
120 | }
121 | function clearTask(task) {
122 | return clearNative(task.data.handleId);
123 | }
124 | var setNative = utils_1.patchMethod(window, setName, function (delegate) { return function (self, args) {
125 | if (typeof args[0] === 'function') {
126 | var zone = Zone.current;
127 | var options = {
128 | handleId: null,
129 | isPeriodic: nameSuffix == 'Interval',
130 | delay: (nameSuffix == 'Timeout' || nameSuffix == 'Interval') ? args[1] || 0 : null,
131 | args: args
132 | };
133 | return zone.scheduleMacroTask(setName, args[0], options, scheduleTask, clearTask);
134 | }
135 | else {
136 | // cause an error by calling it directly.
137 | return delegate.apply(window, args);
138 | }
139 | }; });
140 | var clearNative = utils_1.patchMethod(window, cancelName, function (delegate) { return function (self, args) {
141 | var task = args[0];
142 | if (task && typeof task.type == 'string') {
143 | if (task.cancelFn) {
144 | // Do not cancel already canceled functions
145 | task.zone.cancelTask(task);
146 | }
147 | }
148 | else {
149 | // cause an error by calling it directly.
150 | delegate.apply(window, args);
151 | }
152 | }; });
153 | }
154 |
155 | /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
156 |
157 | /***/ },
158 | /* 1 */
159 | /***/ function(module, exports) {
160 |
161 | /* WEBPACK VAR INJECTION */(function(global) {;
162 | ;
163 | var Zone = (function (global) {
164 | var Zone = (function () {
165 | function Zone(parent, zoneSpec) {
166 | this._properties = null;
167 | this._parent = parent;
168 | this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '';
169 | this._properties = zoneSpec && zoneSpec.properties || {};
170 | this._zoneDelegate = new ZoneDelegate(this, this._parent && this._parent._zoneDelegate, zoneSpec);
171 | }
172 | Object.defineProperty(Zone, "current", {
173 | get: function () { return _currentZone; },
174 | enumerable: true,
175 | configurable: true
176 | });
177 | ;
178 | Object.defineProperty(Zone, "currentTask", {
179 | get: function () { return _currentTask; },
180 | enumerable: true,
181 | configurable: true
182 | });
183 | ;
184 | Object.defineProperty(Zone.prototype, "parent", {
185 | get: function () { return this._parent; },
186 | enumerable: true,
187 | configurable: true
188 | });
189 | ;
190 | Object.defineProperty(Zone.prototype, "name", {
191 | get: function () { return this._name; },
192 | enumerable: true,
193 | configurable: true
194 | });
195 | ;
196 | Zone.prototype.get = function (key) {
197 | var current = this;
198 | while (current) {
199 | if (current._properties.hasOwnProperty(key)) {
200 | return current._properties[key];
201 | }
202 | current = current._parent;
203 | }
204 | };
205 | Zone.prototype.fork = function (zoneSpec) {
206 | if (!zoneSpec)
207 | throw new Error('ZoneSpec required!');
208 | return this._zoneDelegate.fork(this, zoneSpec);
209 | };
210 | Zone.prototype.wrap = function (callback, source) {
211 | if (typeof callback != 'function') {
212 | throw new Error('Expecting function got: ' + callback);
213 | }
214 | var callback = this._zoneDelegate.intercept(this, callback, source);
215 | var zone = this;
216 | return function () {
217 | return zone.runGuarded(callback, this, arguments, source);
218 | };
219 | };
220 | Zone.prototype.run = function (callback, applyThis, applyArgs, source) {
221 | if (applyThis === void 0) { applyThis = null; }
222 | if (applyArgs === void 0) { applyArgs = null; }
223 | if (source === void 0) { source = null; }
224 | var oldZone = _currentZone;
225 | _currentZone = this;
226 | try {
227 | return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
228 | }
229 | finally {
230 | _currentZone = oldZone;
231 | }
232 | };
233 | Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {
234 | if (applyThis === void 0) { applyThis = null; }
235 | if (applyArgs === void 0) { applyArgs = null; }
236 | if (source === void 0) { source = null; }
237 | var oldZone = _currentZone;
238 | _currentZone = this;
239 | try {
240 | try {
241 | return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
242 | }
243 | catch (error) {
244 | if (this._zoneDelegate.handleError(this, error)) {
245 | throw error;
246 | }
247 | }
248 | }
249 | finally {
250 | _currentZone = oldZone;
251 | }
252 | };
253 | Zone.prototype.runTask = function (task, applyThis, applyArgs) {
254 | if (task.zone != this)
255 | throw new Error('A task can only be run in the zone which created it! (Creation: ' +
256 | task.zone.name + '; Execution: ' + this.name + ')');
257 | var previousTask = _currentTask;
258 | _currentTask = task;
259 | var oldZone = _currentZone;
260 | _currentZone = this;
261 | try {
262 | try {
263 | return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
264 | }
265 | catch (error) {
266 | if (this._zoneDelegate.handleError(this, error)) {
267 | throw error;
268 | }
269 | }
270 | }
271 | finally {
272 | if (task.type == 'macroTask' && task.data && !task.data.isPeriodic) {
273 | task.cancelFn = null;
274 | }
275 | _currentZone = oldZone;
276 | _currentTask = previousTask;
277 | }
278 | };
279 | Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) {
280 | return this._zoneDelegate.scheduleTask(this, new ZoneTask('microTask', this, source, callback, data, customSchedule, null));
281 | };
282 | Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) {
283 | return this._zoneDelegate.scheduleTask(this, new ZoneTask('macroTask', this, source, callback, data, customSchedule, customCancel));
284 | };
285 | Zone.prototype.scheduleEventTask = function (source, callback, data, customSchedule, customCancel) {
286 | return this._zoneDelegate.scheduleTask(this, new ZoneTask('eventTask', this, source, callback, data, customSchedule, customCancel));
287 | };
288 | Zone.prototype.cancelTask = function (task) {
289 | var value = this._zoneDelegate.cancelTask(this, task);
290 | task.cancelFn = null;
291 | return value;
292 | };
293 | Zone.__symbol__ = __symbol__;
294 | return Zone;
295 | }());
296 | ;
297 | var ZoneDelegate = (function () {
298 | function ZoneDelegate(zone, parentDelegate, zoneSpec) {
299 | this._taskCounts = { microTask: 0, macroTask: 0, eventTask: 0 };
300 | this.zone = zone;
301 | this._parentDelegate = parentDelegate;
302 | this._forkZS = zoneSpec && (zoneSpec && zoneSpec.onFork ? zoneSpec : parentDelegate._forkZS);
303 | this._forkDlgt = zoneSpec && (zoneSpec.onFork ? parentDelegate : parentDelegate._forkDlgt);
304 | this._interceptZS = zoneSpec && (zoneSpec.onIntercept ? zoneSpec : parentDelegate._interceptZS);
305 | this._interceptDlgt = zoneSpec && (zoneSpec.onIntercept ? parentDelegate : parentDelegate._interceptDlgt);
306 | this._invokeZS = zoneSpec && (zoneSpec.onInvoke ? zoneSpec : parentDelegate._invokeZS);
307 | this._invokeDlgt = zoneSpec && (zoneSpec.onInvoke ? parentDelegate : parentDelegate._invokeDlgt);
308 | this._handleErrorZS = zoneSpec && (zoneSpec.onHandleError ? zoneSpec : parentDelegate._handleErrorZS);
309 | this._handleErrorDlgt = zoneSpec && (zoneSpec.onHandleError ? parentDelegate : parentDelegate._handleErrorDlgt);
310 | this._scheduleTaskZS = zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
311 | this._scheduleTaskDlgt = zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
312 | this._invokeTaskZS = zoneSpec && (zoneSpec.onInvokeTask ? zoneSpec : parentDelegate._invokeTaskZS);
313 | this._invokeTaskDlgt = zoneSpec && (zoneSpec.onInvokeTask ? parentDelegate : parentDelegate._invokeTaskDlgt);
314 | this._cancelTaskZS = zoneSpec && (zoneSpec.onCancelTask ? zoneSpec : parentDelegate._cancelTaskZS);
315 | this._cancelTaskDlgt = zoneSpec && (zoneSpec.onCancelTask ? parentDelegate : parentDelegate._cancelTaskDlgt);
316 | this._hasTaskZS = zoneSpec && (zoneSpec.onHasTask ? zoneSpec : parentDelegate._hasTaskZS);
317 | this._hasTaskDlgt = zoneSpec && (zoneSpec.onHasTask ? parentDelegate : parentDelegate._hasTaskDlgt);
318 | }
319 | ZoneDelegate.prototype.fork = function (targetZone, zoneSpec) {
320 | return this._forkZS
321 | ? this._forkZS.onFork(this._forkDlgt, this.zone, targetZone, zoneSpec)
322 | : new Zone(targetZone, zoneSpec);
323 | };
324 | ZoneDelegate.prototype.intercept = function (targetZone, callback, source) {
325 | return this._interceptZS
326 | ? this._interceptZS.onIntercept(this._interceptDlgt, this.zone, targetZone, callback, source)
327 | : callback;
328 | };
329 | ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {
330 | return this._invokeZS
331 | ? this._invokeZS.onInvoke(this._invokeDlgt, this.zone, targetZone, callback, applyThis, applyArgs, source)
332 | : callback.apply(applyThis, applyArgs);
333 | };
334 | ZoneDelegate.prototype.handleError = function (targetZone, error) {
335 | return this._handleErrorZS
336 | ? this._handleErrorZS.onHandleError(this._handleErrorDlgt, this.zone, targetZone, error)
337 | : true;
338 | };
339 | ZoneDelegate.prototype.scheduleTask = function (targetZone, task) {
340 | try {
341 | if (this._scheduleTaskZS) {
342 | return this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this.zone, targetZone, task);
343 | }
344 | else if (task.scheduleFn) {
345 | task.scheduleFn(task);
346 | }
347 | else if (task.type == 'microTask') {
348 | scheduleMicroTask(task);
349 | }
350 | else {
351 | throw new Error('Task is missing scheduleFn.');
352 | }
353 | return task;
354 | }
355 | finally {
356 | if (targetZone == this.zone) {
357 | this._updateTaskCount(task.type, 1);
358 | }
359 | }
360 | };
361 | ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
362 | try {
363 | return this._invokeTaskZS
364 | ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this.zone, targetZone, task, applyThis, applyArgs)
365 | : task.callback.apply(applyThis, applyArgs);
366 | }
367 | finally {
368 | if (targetZone == this.zone && (task.type != 'eventTask') && !(task.data && task.data.isPeriodic)) {
369 | this._updateTaskCount(task.type, -1);
370 | }
371 | }
372 | };
373 | ZoneDelegate.prototype.cancelTask = function (targetZone, task) {
374 | var value;
375 | if (this._cancelTaskZS) {
376 | value = this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt, this.zone, targetZone, task);
377 | }
378 | else if (!task.cancelFn) {
379 | throw new Error('Task does not support cancellation, or is already canceled.');
380 | }
381 | else {
382 | value = task.cancelFn(task);
383 | }
384 | if (targetZone == this.zone) {
385 | // this should not be in the finally block, because exceptions assume not canceled.
386 | this._updateTaskCount(task.type, -1);
387 | }
388 | return value;
389 | };
390 | ZoneDelegate.prototype.hasTask = function (targetZone, isEmpty) {
391 | return this._hasTaskZS && this._hasTaskZS.onHasTask(this._hasTaskDlgt, this.zone, targetZone, isEmpty);
392 | };
393 | ZoneDelegate.prototype._updateTaskCount = function (type, count) {
394 | var counts = this._taskCounts;
395 | var prev = counts[type];
396 | var next = counts[type] = prev + count;
397 | if (next < 0) {
398 | throw new Error('More tasks executed then were scheduled.');
399 | }
400 | if (prev == 0 || next == 0) {
401 | var isEmpty = {
402 | microTask: counts.microTask > 0,
403 | macroTask: counts.macroTask > 0,
404 | eventTask: counts.eventTask > 0,
405 | change: type
406 | };
407 | try {
408 | this.hasTask(this.zone, isEmpty);
409 | }
410 | finally {
411 | if (this._parentDelegate) {
412 | this._parentDelegate._updateTaskCount(type, count);
413 | }
414 | }
415 | }
416 | };
417 | return ZoneDelegate;
418 | }());
419 | var ZoneTask = (function () {
420 | function ZoneTask(type, zone, source, callback, options, scheduleFn, cancelFn) {
421 | this.type = type;
422 | this.zone = zone;
423 | this.source = source;
424 | this.data = options;
425 | this.scheduleFn = scheduleFn;
426 | this.cancelFn = cancelFn;
427 | this.callback = callback;
428 | var self = this;
429 | this.invoke = function () {
430 | try {
431 | return zone.runTask(self, this, arguments);
432 | }
433 | finally {
434 | drainMicroTaskQueue();
435 | }
436 | };
437 | }
438 | return ZoneTask;
439 | }());
440 | function __symbol__(name) { return '__zone_symbol__' + name; }
441 | ;
442 | var symbolSetTimeout = __symbol__('setTimeout');
443 | var symbolPromise = __symbol__('Promise');
444 | var symbolThen = __symbol__('then');
445 | var _currentZone = new Zone(null, null);
446 | var _currentTask = null;
447 | var _microTaskQueue = [];
448 | var _isDrainingMicrotaskQueue = false;
449 | var _uncaughtPromiseErrors = [];
450 | var _drainScheduled = false;
451 | function scheduleQueueDrain() {
452 | if (!_drainScheduled && !_currentTask && _microTaskQueue.length == 0) {
453 | // We are not running in Task, so we need to kickstart the microtask queue.
454 | if (global[symbolPromise]) {
455 | global[symbolPromise].resolve(0)[symbolThen](drainMicroTaskQueue);
456 | }
457 | else {
458 | global[symbolSetTimeout](drainMicroTaskQueue, 0);
459 | }
460 | }
461 | }
462 | function scheduleMicroTask(task) {
463 | scheduleQueueDrain();
464 | _microTaskQueue.push(task);
465 | }
466 | function consoleError(e) {
467 | var rejection = e && e.rejection;
468 | if (rejection) {
469 | console.error('Unhandled Promise rejection:', rejection instanceof Error ? rejection.message : rejection, '; Zone:', e.zone.name, '; Task:', e.task && e.task.source, '; Value:', rejection);
470 | }
471 | console.error(e);
472 | }
473 | function drainMicroTaskQueue() {
474 | if (!_isDrainingMicrotaskQueue) {
475 | _isDrainingMicrotaskQueue = true;
476 | while (_microTaskQueue.length) {
477 | var queue = _microTaskQueue;
478 | _microTaskQueue = [];
479 | for (var i = 0; i < queue.length; i++) {
480 | var task = queue[i];
481 | try {
482 | task.zone.runTask(task, null, null);
483 | }
484 | catch (e) {
485 | consoleError(e);
486 | }
487 | }
488 | }
489 | while (_uncaughtPromiseErrors.length) {
490 | var uncaughtPromiseErrors = _uncaughtPromiseErrors;
491 | _uncaughtPromiseErrors = [];
492 | for (var i = 0; i < uncaughtPromiseErrors.length; i++) {
493 | var uncaughtPromiseError = uncaughtPromiseErrors[i];
494 | try {
495 | uncaughtPromiseError.zone.runGuarded(function () { throw uncaughtPromiseError; });
496 | }
497 | catch (e) {
498 | consoleError(e);
499 | }
500 | }
501 | }
502 | _isDrainingMicrotaskQueue = false;
503 | _drainScheduled = false;
504 | }
505 | }
506 | function isThenable(value) {
507 | return value && value.then;
508 | }
509 | function forwardResolution(value) { return value; }
510 | function forwardRejection(rejection) { return ZoneAwarePromise.reject(rejection); }
511 | var symbolState = __symbol__('state');
512 | var symbolValue = __symbol__('value');
513 | var source = 'Promise.then';
514 | var UNRESOLVED = null;
515 | var RESOLVED = true;
516 | var REJECTED = false;
517 | var REJECTED_NO_CATCH = 0;
518 | function makeResolver(promise, state) {
519 | return function (v) {
520 | resolvePromise(promise, state, v);
521 | // Do not return value or you will break the Promise spec.
522 | };
523 | }
524 | function resolvePromise(promise, state, value) {
525 | if (promise[symbolState] === UNRESOLVED) {
526 | if (value instanceof ZoneAwarePromise && value[symbolState] !== UNRESOLVED) {
527 | clearRejectedNoCatch(value);
528 | resolvePromise(promise, value[symbolState], value[symbolValue]);
529 | }
530 | else if (isThenable(value)) {
531 | value.then(makeResolver(promise, state), makeResolver(promise, false));
532 | }
533 | else {
534 | promise[symbolState] = state;
535 | var queue = promise[symbolValue];
536 | promise[symbolValue] = value;
537 | for (var i = 0; i < queue.length;) {
538 | scheduleResolveOrReject(promise, queue[i++], queue[i++], queue[i++], queue[i++]);
539 | }
540 | if (queue.length == 0 && state == REJECTED) {
541 | promise[symbolState] = REJECTED_NO_CATCH;
542 | try {
543 | throw new Error("Uncaught (in promise): " + value);
544 | }
545 | catch (e) {
546 | var error = e;
547 | error.rejection = value;
548 | error.promise = promise;
549 | error.zone = Zone.current;
550 | error.task = Zone.currentTask;
551 | _uncaughtPromiseErrors.push(error);
552 | scheduleQueueDrain();
553 | }
554 | }
555 | }
556 | }
557 | // Resolving an already resolved promise is a noop.
558 | return promise;
559 | }
560 | function clearRejectedNoCatch(promise) {
561 | if (promise[symbolState] === REJECTED_NO_CATCH) {
562 | promise[symbolState] = REJECTED;
563 | for (var i = 0; i < _uncaughtPromiseErrors.length; i++) {
564 | if (promise === _uncaughtPromiseErrors[i].promise) {
565 | _uncaughtPromiseErrors.splice(i, 1);
566 | break;
567 | }
568 | }
569 | }
570 | }
571 | function scheduleResolveOrReject(promise, zone, chainPromise, onFulfilled, onRejected) {
572 | clearRejectedNoCatch(promise);
573 | var delegate = promise[symbolState] ? onFulfilled || forwardResolution : onRejected || forwardRejection;
574 | zone.scheduleMicroTask(source, function () {
575 | try {
576 | resolvePromise(chainPromise, true, zone.run(delegate, null, [promise[symbolValue]]));
577 | }
578 | catch (error) {
579 | resolvePromise(chainPromise, false, error);
580 | }
581 | });
582 | }
583 | var ZoneAwarePromise = (function () {
584 | function ZoneAwarePromise(executor) {
585 | var promise = this;
586 | promise[symbolState] = UNRESOLVED;
587 | promise[symbolValue] = []; // queue;
588 | try {
589 | executor && executor(makeResolver(promise, RESOLVED), makeResolver(promise, REJECTED));
590 | }
591 | catch (e) {
592 | resolvePromise(promise, false, e);
593 | }
594 | }
595 | ZoneAwarePromise.resolve = function (value) {
596 | return resolvePromise(new this(null), RESOLVED, value);
597 | };
598 | ZoneAwarePromise.reject = function (error) {
599 | return resolvePromise(new this(null), REJECTED, error);
600 | };
601 | ZoneAwarePromise.race = function (values) {
602 | var resolve;
603 | var reject;
604 | var promise = new this(function (res, rej) { resolve = res; reject = rej; });
605 | function onResolve(value) { promise && (promise = null || resolve(value)); }
606 | function onReject(error) { promise && (promise = null || reject(error)); }
607 | for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
608 | var value = values_1[_i];
609 | if (!isThenable(value)) {
610 | value = this.resolve(value);
611 | }
612 | value.then(onResolve, onReject);
613 | }
614 | return promise;
615 | };
616 | ZoneAwarePromise.all = function (values) {
617 | var resolve;
618 | var reject;
619 | var promise = new this(function (res, rej) { resolve = res; reject = rej; });
620 | var resolvedValues = [];
621 | var count = 0;
622 | function onReject(error) { promise && reject(error); promise = null; }
623 | for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {
624 | var value = values_2[_i];
625 | if (!isThenable(value)) {
626 | value = this.resolve(value);
627 | }
628 | value.then((function (index) { return function (value) {
629 | resolvedValues[index] = value;
630 | count--;
631 | if (promise && !count) {
632 | resolve(resolvedValues);
633 | }
634 | promise == null;
635 | }; })(count), onReject);
636 | count++;
637 | }
638 | if (!count)
639 | resolve(resolvedValues);
640 | return promise;
641 | };
642 | ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {
643 | var chainPromise = new ZoneAwarePromise(null);
644 | var zone = Zone.current;
645 | if (this[symbolState] == UNRESOLVED) {
646 | this[symbolValue].push(zone, chainPromise, onFulfilled, onRejected);
647 | }
648 | else {
649 | scheduleResolveOrReject(this, zone, chainPromise, onFulfilled, onRejected);
650 | }
651 | return chainPromise;
652 | };
653 | ZoneAwarePromise.prototype.catch = function (onRejected) {
654 | return this.then(null, onRejected);
655 | };
656 | return ZoneAwarePromise;
657 | }());
658 | var NativePromise = global[__symbol__('Promise')] = global.Promise;
659 | global.Promise = ZoneAwarePromise;
660 | if (NativePromise) {
661 | var NativePromiseProtototype = NativePromise.prototype;
662 | var NativePromiseThen = NativePromiseProtototype[__symbol__('then')]
663 | = NativePromiseProtototype.then;
664 | NativePromiseProtototype.then = function (onResolve, onReject) {
665 | var nativePromise = this;
666 | return new ZoneAwarePromise(function (resolve, reject) {
667 | NativePromiseThen.call(nativePromise, resolve, reject);
668 | }).then(onResolve, onReject);
669 | };
670 | }
671 | return global.Zone = Zone;
672 | })(typeof window == 'undefined' ? global : window);
673 |
674 | /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
675 |
676 | /***/ },
677 | /* 2 */
678 | /***/ function(module, exports, __webpack_require__) {
679 |
680 | "use strict";
681 | var utils_1 = __webpack_require__(3);
682 | var WTF_ISSUE_555 = 'Anchor,Area,Audio,BR,Base,BaseFont,Body,Button,Canvas,Content,DList,Directory,Div,Embed,FieldSet,Font,Form,Frame,FrameSet,HR,Head,Heading,Html,IFrame,Image,Input,Keygen,LI,Label,Legend,Link,Map,Marquee,Media,Menu,Meta,Meter,Mod,OList,Object,OptGroup,Option,Output,Paragraph,Pre,Progress,Quote,Script,Select,Source,Span,Style,TableCaption,TableCell,TableCol,Table,TableRow,TableSection,TextArea,Title,Track,UList,Unknown,Video';
683 | var NO_EVENT_TARGET = 'ApplicationCache,EventSource,FileReader,InputMethodContext,MediaController,MessagePort,Node,Performance,SVGElementInstance,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebKitNamedFlow,Worker,WorkerGlobalScope,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload,IDBRequest,IDBOpenDBRequest,IDBDatabase,IDBTransaction,IDBCursor,DBIndex'.split(',');
684 | var EVENT_TARGET = 'EventTarget';
685 | function eventTargetPatch(_global) {
686 | var apis = [];
687 | var isWtf = _global['wtf'];
688 | if (isWtf) {
689 | // Workaround for: https://github.com/google/tracing-framework/issues/555
690 | apis = WTF_ISSUE_555.split(',').map(function (v) { return 'HTML' + v + 'Element'; }).concat(NO_EVENT_TARGET);
691 | }
692 | else if (_global[EVENT_TARGET]) {
693 | apis.push(EVENT_TARGET);
694 | }
695 | else {
696 | // Note: EventTarget is not available in all browsers,
697 | // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget
698 | apis = NO_EVENT_TARGET;
699 | }
700 | for (var i = 0; i < apis.length; i++) {
701 | var type = _global[apis[i]];
702 | utils_1.patchEventTargetMethods(type && type.prototype);
703 | }
704 | }
705 | exports.eventTargetPatch = eventTargetPatch;
706 |
707 |
708 | /***/ },
709 | /* 3 */
710 | /***/ function(module, exports) {
711 |
712 | /* WEBPACK VAR INJECTION */(function(global) {/**
713 | * Suppress closure compiler errors about unknown 'process' variable
714 | * @fileoverview
715 | * @suppress {undefinedVars}
716 | */
717 | "use strict";
718 | exports.zoneSymbol = Zone['__symbol__'];
719 | var _global = typeof window == 'undefined' ? global : window;
720 | function bindArguments(args, source) {
721 | for (var i = args.length - 1; i >= 0; i--) {
722 | if (typeof args[i] === 'function') {
723 | args[i] = Zone.current.wrap(args[i], source + '_' + i);
724 | }
725 | }
726 | return args;
727 | }
728 | exports.bindArguments = bindArguments;
729 | ;
730 | function patchPrototype(prototype, fnNames) {
731 | var source = prototype.constructor['name'];
732 | for (var i = 0; i < fnNames.length; i++) {
733 | var name = fnNames[i];
734 | var delegate = prototype[name];
735 | if (delegate) {
736 | prototype[name] = (function (delegate) {
737 | return function () {
738 | return delegate.apply(this, bindArguments(arguments, source + '.' + name));
739 | };
740 | })(delegate);
741 | }
742 | }
743 | }
744 | exports.patchPrototype = patchPrototype;
745 | ;
746 | exports.isWebWorker = (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope);
747 | exports.isNode = (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]');
748 | exports.isBrowser = !exports.isNode && !exports.isWebWorker && !!(window && window['HTMLElement']);
749 | function patchProperty(obj, prop) {
750 | var desc = Object.getOwnPropertyDescriptor(obj, prop) || {
751 | enumerable: true,
752 | configurable: true
753 | };
754 | // A property descriptor cannot have getter/setter and be writable
755 | // deleting the writable and value properties avoids this error:
756 | //
757 | // TypeError: property descriptors must not specify a value or be writable when a
758 | // getter or setter has been specified
759 | delete desc.writable;
760 | delete desc.value;
761 | // substr(2) cuz 'onclick' -> 'click', etc
762 | var eventName = prop.substr(2);
763 | var _prop = '_' + prop;
764 | desc.set = function (fn) {
765 | if (this[_prop]) {
766 | this.removeEventListener(eventName, this[_prop]);
767 | }
768 | if (typeof fn === 'function') {
769 | var wrapFn = function (event) {
770 | var result;
771 | result = fn.apply(this, arguments);
772 | if (result != undefined && !result)
773 | event.preventDefault();
774 | };
775 | this[_prop] = wrapFn;
776 | this.addEventListener(eventName, wrapFn, false);
777 | }
778 | else {
779 | this[_prop] = null;
780 | }
781 | };
782 | desc.get = function () {
783 | return this[_prop];
784 | };
785 | Object.defineProperty(obj, prop, desc);
786 | }
787 | exports.patchProperty = patchProperty;
788 | ;
789 | function patchOnProperties(obj, properties) {
790 | var onProperties = [];
791 | for (var prop in obj) {
792 | if (prop.substr(0, 2) == 'on') {
793 | onProperties.push(prop);
794 | }
795 | }
796 | for (var j = 0; j < onProperties.length; j++) {
797 | patchProperty(obj, onProperties[j]);
798 | }
799 | if (properties) {
800 | for (var i = 0; i < properties.length; i++) {
801 | patchProperty(obj, 'on' + properties[i]);
802 | }
803 | }
804 | }
805 | exports.patchOnProperties = patchOnProperties;
806 | ;
807 | var EVENT_TASKS = exports.zoneSymbol('eventTasks');
808 | var ADD_EVENT_LISTENER = 'addEventListener';
809 | var REMOVE_EVENT_LISTENER = 'removeEventListener';
810 | var SYMBOL_ADD_EVENT_LISTENER = exports.zoneSymbol(ADD_EVENT_LISTENER);
811 | var SYMBOL_REMOVE_EVENT_LISTENER = exports.zoneSymbol(REMOVE_EVENT_LISTENER);
812 | function findExistingRegisteredTask(target, handler, name, capture, remove) {
813 | var eventTasks = target[EVENT_TASKS];
814 | if (eventTasks) {
815 | for (var i = 0; i < eventTasks.length; i++) {
816 | var eventTask = eventTasks[i];
817 | var data = eventTask.data;
818 | if (data.handler === handler
819 | && data.useCapturing === capture
820 | && data.eventName === name) {
821 | if (remove) {
822 | eventTasks.splice(i, 1);
823 | }
824 | return eventTask;
825 | }
826 | }
827 | }
828 | return null;
829 | }
830 | function attachRegisteredEvent(target, eventTask) {
831 | var eventTasks = target[EVENT_TASKS];
832 | if (!eventTasks) {
833 | eventTasks = target[EVENT_TASKS] = [];
834 | }
835 | eventTasks.push(eventTask);
836 | }
837 | function scheduleEventListener(eventTask) {
838 | var meta = eventTask.data;
839 | attachRegisteredEvent(meta.target, eventTask);
840 | return meta.target[SYMBOL_ADD_EVENT_LISTENER](meta.eventName, eventTask.invoke, meta.useCapturing);
841 | }
842 | function cancelEventListener(eventTask) {
843 | var meta = eventTask.data;
844 | findExistingRegisteredTask(meta.target, eventTask.invoke, meta.eventName, meta.useCapturing, true);
845 | meta.target[SYMBOL_REMOVE_EVENT_LISTENER](meta.eventName, eventTask.invoke, meta.useCapturing);
846 | }
847 | function zoneAwareAddEventListener(self, args) {
848 | var eventName = args[0];
849 | var handler = args[1];
850 | var useCapturing = args[2] || false;
851 | // - Inside a Web Worker, `this` is undefined, the context is `global`
852 | // - When `addEventListener` is called on the global context in strict mode, `this` is undefined
853 | // see https://github.com/angular/zone.js/issues/190
854 | var target = self || _global;
855 | var delegate = null;
856 | if (typeof handler == 'function') {
857 | delegate = handler;
858 | }
859 | else if (handler && handler.handleEvent) {
860 | delegate = function (event) { return handler.handleEvent(event); };
861 | }
862 | // Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150
863 | if (!delegate || handler && handler.toString() === "[object FunctionWrapper]") {
864 | return target[SYMBOL_ADD_EVENT_LISTENER](eventName, handler, useCapturing);
865 | }
866 | var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, false);
867 | if (eventTask) {
868 | // we already registered, so this will have noop.
869 | return target[SYMBOL_ADD_EVENT_LISTENER](eventName, eventTask.invoke, useCapturing);
870 | }
871 | var zone = Zone.current;
872 | var source = target.constructor['name'] + '.addEventListener:' + eventName;
873 | var data = {
874 | target: target,
875 | eventName: eventName,
876 | name: eventName,
877 | useCapturing: useCapturing,
878 | handler: handler
879 | };
880 | zone.scheduleEventTask(source, delegate, data, scheduleEventListener, cancelEventListener);
881 | }
882 | function zoneAwareRemoveEventListener(self, args) {
883 | var eventName = args[0];
884 | var handler = args[1];
885 | var useCapturing = args[2] || false;
886 | // - Inside a Web Worker, `this` is undefined, the context is `global`
887 | // - When `addEventListener` is called on the global context in strict mode, `this` is undefined
888 | // see https://github.com/angular/zone.js/issues/190
889 | var target = self || _global;
890 | var eventTask = findExistingRegisteredTask(target, handler, eventName, useCapturing, true);
891 | if (eventTask) {
892 | eventTask.zone.cancelTask(eventTask);
893 | }
894 | else {
895 | target[SYMBOL_REMOVE_EVENT_LISTENER](eventName, handler, useCapturing);
896 | }
897 | }
898 | function patchEventTargetMethods(obj) {
899 | if (obj && obj.addEventListener) {
900 | patchMethod(obj, ADD_EVENT_LISTENER, function () { return zoneAwareAddEventListener; });
901 | patchMethod(obj, REMOVE_EVENT_LISTENER, function () { return zoneAwareRemoveEventListener; });
902 | return true;
903 | }
904 | else {
905 | return false;
906 | }
907 | }
908 | exports.patchEventTargetMethods = patchEventTargetMethods;
909 | ;
910 | var originalInstanceKey = exports.zoneSymbol('originalInstance');
911 | // wrap some native API on `window`
912 | function patchClass(className) {
913 | var OriginalClass = _global[className];
914 | if (!OriginalClass)
915 | return;
916 | _global[className] = function () {
917 | var a = bindArguments(arguments, className);
918 | switch (a.length) {
919 | case 0:
920 | this[originalInstanceKey] = new OriginalClass();
921 | break;
922 | case 1:
923 | this[originalInstanceKey] = new OriginalClass(a[0]);
924 | break;
925 | case 2:
926 | this[originalInstanceKey] = new OriginalClass(a[0], a[1]);
927 | break;
928 | case 3:
929 | this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2]);
930 | break;
931 | case 4:
932 | this[originalInstanceKey] = new OriginalClass(a[0], a[1], a[2], a[3]);
933 | break;
934 | default: throw new Error('Arg list too long.');
935 | }
936 | };
937 | var instance = new OriginalClass(function () { });
938 | var prop;
939 | for (prop in instance) {
940 | (function (prop) {
941 | if (typeof instance[prop] === 'function') {
942 | _global[className].prototype[prop] = function () {
943 | return this[originalInstanceKey][prop].apply(this[originalInstanceKey], arguments);
944 | };
945 | }
946 | else {
947 | Object.defineProperty(_global[className].prototype, prop, {
948 | set: function (fn) {
949 | if (typeof fn === 'function') {
950 | this[originalInstanceKey][prop] = Zone.current.wrap(fn, className + '.' + prop);
951 | }
952 | else {
953 | this[originalInstanceKey][prop] = fn;
954 | }
955 | },
956 | get: function () {
957 | return this[originalInstanceKey][prop];
958 | }
959 | });
960 | }
961 | }(prop));
962 | }
963 | for (prop in OriginalClass) {
964 | if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) {
965 | _global[className][prop] = OriginalClass[prop];
966 | }
967 | }
968 | }
969 | exports.patchClass = patchClass;
970 | ;
971 | function createNamedFn(name, delegate) {
972 | try {
973 | return (Function('f', "return function " + name + "(){return f(this, arguments)}"))(delegate);
974 | }
975 | catch (e) {
976 | // if we fail, we must be CSP, just return delegate.
977 | return function () {
978 | return delegate(this, arguments);
979 | };
980 | }
981 | }
982 | exports.createNamedFn = createNamedFn;
983 | function patchMethod(target, name, patchFn) {
984 | var proto = target;
985 | while (proto && !proto.hasOwnProperty(name)) {
986 | proto = Object.getPrototypeOf(proto);
987 | }
988 | if (!proto && target[name]) {
989 | // somehow we did not find it, but we can see it. This happens on IE for Window properties.
990 | proto = target;
991 | }
992 | var delegateName = exports.zoneSymbol(name);
993 | var delegate;
994 | if (proto && !(delegate = proto[delegateName])) {
995 | delegate = proto[delegateName] = proto[name];
996 | proto[name] = createNamedFn(name, patchFn(delegate, delegateName, name));
997 | }
998 | return delegate;
999 | }
1000 | exports.patchMethod = patchMethod;
1001 |
1002 | /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
1003 |
1004 | /***/ },
1005 | /* 4 */
1006 | /***/ function(module, exports, __webpack_require__) {
1007 |
1008 | "use strict";
1009 | var utils_1 = __webpack_require__(3);
1010 | // might need similar for object.freeze
1011 | // i regret nothing
1012 | var _defineProperty = Object.defineProperty;
1013 | var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1014 | var _create = Object.create;
1015 | var unconfigurablesKey = utils_1.zoneSymbol('unconfigurables');
1016 | function propertyPatch() {
1017 | Object.defineProperty = function (obj, prop, desc) {
1018 | if (isUnconfigurable(obj, prop)) {
1019 | throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj);
1020 | }
1021 | if (prop !== 'prototype') {
1022 | desc = rewriteDescriptor(obj, prop, desc);
1023 | }
1024 | return _defineProperty(obj, prop, desc);
1025 | };
1026 | Object.defineProperties = function (obj, props) {
1027 | Object.keys(props).forEach(function (prop) {
1028 | Object.defineProperty(obj, prop, props[prop]);
1029 | });
1030 | return obj;
1031 | };
1032 | Object.create = function (obj, proto) {
1033 | if (typeof proto === 'object') {
1034 | Object.keys(proto).forEach(function (prop) {
1035 | proto[prop] = rewriteDescriptor(obj, prop, proto[prop]);
1036 | });
1037 | }
1038 | return _create(obj, proto);
1039 | };
1040 | Object.getOwnPropertyDescriptor = function (obj, prop) {
1041 | var desc = _getOwnPropertyDescriptor(obj, prop);
1042 | if (isUnconfigurable(obj, prop)) {
1043 | desc.configurable = false;
1044 | }
1045 | return desc;
1046 | };
1047 | }
1048 | exports.propertyPatch = propertyPatch;
1049 | ;
1050 | function _redefineProperty(obj, prop, desc) {
1051 | desc = rewriteDescriptor(obj, prop, desc);
1052 | return _defineProperty(obj, prop, desc);
1053 | }
1054 | exports._redefineProperty = _redefineProperty;
1055 | ;
1056 | function isUnconfigurable(obj, prop) {
1057 | return obj && obj[unconfigurablesKey] && obj[unconfigurablesKey][prop];
1058 | }
1059 | function rewriteDescriptor(obj, prop, desc) {
1060 | desc.configurable = true;
1061 | if (!desc.configurable) {
1062 | if (!obj[unconfigurablesKey]) {
1063 | _defineProperty(obj, unconfigurablesKey, { writable: true, value: {} });
1064 | }
1065 | obj[unconfigurablesKey][prop] = true;
1066 | }
1067 | return desc;
1068 | }
1069 |
1070 |
1071 | /***/ },
1072 | /* 5 */
1073 | /***/ function(module, exports, __webpack_require__) {
1074 |
1075 | "use strict";
1076 | var define_property_1 = __webpack_require__(4);
1077 | var utils_1 = __webpack_require__(3);
1078 | function registerElementPatch(_global) {
1079 | if (!utils_1.isBrowser || !('registerElement' in _global.document)) {
1080 | return;
1081 | }
1082 | var _registerElement = document.registerElement;
1083 | var callbacks = [
1084 | 'createdCallback',
1085 | 'attachedCallback',
1086 | 'detachedCallback',
1087 | 'attributeChangedCallback'
1088 | ];
1089 | document.registerElement = function (name, opts) {
1090 | if (opts && opts.prototype) {
1091 | callbacks.forEach(function (callback) {
1092 | var source = 'Document.registerElement::' + callback;
1093 | if (opts.prototype.hasOwnProperty(callback)) {
1094 | var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback);
1095 | if (descriptor && descriptor.value) {
1096 | descriptor.value = Zone.current.wrap(descriptor.value, source);
1097 | define_property_1._redefineProperty(opts.prototype, callback, descriptor);
1098 | }
1099 | else {
1100 | opts.prototype[callback] = Zone.current.wrap(opts.prototype[callback], source);
1101 | }
1102 | }
1103 | else if (opts.prototype[callback]) {
1104 | opts.prototype[callback] = Zone.current.wrap(opts.prototype[callback], source);
1105 | }
1106 | });
1107 | }
1108 | return _registerElement.apply(document, [name, opts]);
1109 | };
1110 | }
1111 | exports.registerElementPatch = registerElementPatch;
1112 |
1113 |
1114 | /***/ },
1115 | /* 6 */
1116 | /***/ function(module, exports, __webpack_require__) {
1117 |
1118 | "use strict";
1119 | var webSocketPatch = __webpack_require__(7);
1120 | var utils_1 = __webpack_require__(3);
1121 | var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' ');
1122 | function propertyDescriptorPatch(_global) {
1123 | if (utils_1.isNode) {
1124 | return;
1125 | }
1126 | var supportsWebSocket = typeof WebSocket !== 'undefined';
1127 | if (canPatchViaPropertyDescriptor()) {
1128 | // for browsers that we can patch the descriptor: Chrome & Firefox
1129 | if (utils_1.isBrowser) {
1130 | utils_1.patchOnProperties(HTMLElement.prototype, eventNames);
1131 | }
1132 | utils_1.patchOnProperties(XMLHttpRequest.prototype, null);
1133 | if (typeof IDBIndex !== 'undefined') {
1134 | utils_1.patchOnProperties(IDBIndex.prototype, null);
1135 | utils_1.patchOnProperties(IDBRequest.prototype, null);
1136 | utils_1.patchOnProperties(IDBOpenDBRequest.prototype, null);
1137 | utils_1.patchOnProperties(IDBDatabase.prototype, null);
1138 | utils_1.patchOnProperties(IDBTransaction.prototype, null);
1139 | utils_1.patchOnProperties(IDBCursor.prototype, null);
1140 | }
1141 | if (supportsWebSocket) {
1142 | utils_1.patchOnProperties(WebSocket.prototype, null);
1143 | }
1144 | }
1145 | else {
1146 | // Safari, Android browsers (Jelly Bean)
1147 | patchViaCapturingAllTheEvents();
1148 | utils_1.patchClass('XMLHttpRequest');
1149 | if (supportsWebSocket) {
1150 | webSocketPatch.apply(_global);
1151 | }
1152 | }
1153 | }
1154 | exports.propertyDescriptorPatch = propertyDescriptorPatch;
1155 | function canPatchViaPropertyDescriptor() {
1156 | if (utils_1.isBrowser && !Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick')
1157 | && typeof Element !== 'undefined') {
1158 | // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364
1159 | // IDL interface attributes are not configurable
1160 | var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick');
1161 | if (desc && !desc.configurable)
1162 | return false;
1163 | }
1164 | Object.defineProperty(XMLHttpRequest.prototype, 'onreadystatechange', {
1165 | get: function () {
1166 | return true;
1167 | }
1168 | });
1169 | var req = new XMLHttpRequest();
1170 | var result = !!req.onreadystatechange;
1171 | Object.defineProperty(XMLHttpRequest.prototype, 'onreadystatechange', {});
1172 | return result;
1173 | }
1174 | ;
1175 | var unboundKey = utils_1.zoneSymbol('unbound');
1176 | // Whenever any eventListener fires, we check the eventListener target and all parents
1177 | // for `onwhatever` properties and replace them with zone-bound functions
1178 | // - Chrome (for now)
1179 | function patchViaCapturingAllTheEvents() {
1180 | for (var i = 0; i < eventNames.length; i++) {
1181 | var property = eventNames[i];
1182 | var onproperty = 'on' + property;
1183 | document.addEventListener(property, function (event) {
1184 | var elt = event.target, bound;
1185 | var source = elt.constructor['name'] + '.' + onproperty;
1186 | while (elt) {
1187 | if (elt[onproperty] && !elt[onproperty][unboundKey]) {
1188 | bound = Zone.current.wrap(elt[onproperty], source);
1189 | bound[unboundKey] = elt[onproperty];
1190 | elt[onproperty] = bound;
1191 | }
1192 | elt = elt.parentElement;
1193 | }
1194 | }, true);
1195 | }
1196 | ;
1197 | }
1198 | ;
1199 |
1200 |
1201 | /***/ },
1202 | /* 7 */
1203 | /***/ function(module, exports, __webpack_require__) {
1204 |
1205 | /* WEBPACK VAR INJECTION */(function(global) {"use strict";
1206 | var utils_1 = __webpack_require__(3);
1207 | // we have to patch the instance since the proto is non-configurable
1208 | function apply(_global) {
1209 | var WS = _global.WebSocket;
1210 | // On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener
1211 | // On older Chrome, no need since EventTarget was already patched
1212 | if (!_global.EventTarget) {
1213 | utils_1.patchEventTargetMethods(WS.prototype);
1214 | }
1215 | _global.WebSocket = function (a, b) {
1216 | var socket = arguments.length > 1 ? new WS(a, b) : new WS(a);
1217 | var proxySocket;
1218 | // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance
1219 | var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage');
1220 | if (onmessageDesc && onmessageDesc.configurable === false) {
1221 | proxySocket = Object.create(socket);
1222 | ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function (propName) {
1223 | proxySocket[propName] = function () {
1224 | return socket[propName].apply(socket, arguments);
1225 | };
1226 | });
1227 | }
1228 | else {
1229 | // we can patch the real socket
1230 | proxySocket = socket;
1231 | }
1232 | utils_1.patchOnProperties(proxySocket, ['close', 'error', 'message', 'open']);
1233 | return proxySocket;
1234 | };
1235 | global.WebSocket.prototype = Object.create(WS.prototype, { constructor: { value: WebSocket } });
1236 | }
1237 | exports.apply = apply;
1238 |
1239 | /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
1240 |
1241 | /***/ }
1242 | /******/ ]);
1243 | /******/ (function(modules) { // webpackBootstrap
1244 | /******/ // The module cache
1245 | /******/ var installedModules = {};
1246 |
1247 | /******/ // The require function
1248 | /******/ function __webpack_require__(moduleId) {
1249 |
1250 | /******/ // Check if module is in cache
1251 | /******/ if(installedModules[moduleId])
1252 | /******/ return installedModules[moduleId].exports;
1253 |
1254 | /******/ // Create a new module (and put it into the cache)
1255 | /******/ var module = installedModules[moduleId] = {
1256 | /******/ exports: {},
1257 | /******/ id: moduleId,
1258 | /******/ loaded: false
1259 | /******/ };
1260 |
1261 | /******/ // Execute the module function
1262 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
1263 |
1264 | /******/ // Flag the module as loaded
1265 | /******/ module.loaded = true;
1266 |
1267 | /******/ // Return the exports of the module
1268 | /******/ return module.exports;
1269 | /******/ }
1270 |
1271 |
1272 | /******/ // expose the modules object (__webpack_modules__)
1273 | /******/ __webpack_require__.m = modules;
1274 |
1275 | /******/ // expose the module cache
1276 | /******/ __webpack_require__.c = installedModules;
1277 |
1278 | /******/ // __webpack_public_path__
1279 | /******/ __webpack_require__.p = "";
1280 |
1281 | /******/ // Load entry module and return exports
1282 | /******/ return __webpack_require__(0);
1283 | /******/ })
1284 | /************************************************************************/
1285 | /******/ ([
1286 | /* 0 */
1287 | /***/ function(module, exports) {
1288 |
1289 | 'use strict';
1290 | (function () {
1291 | var NEWLINE = '\n';
1292 | var SEP = ' ------------- ';
1293 | var IGNORE_FRAMES = [];
1294 | var creationTrace = '__creationTrace__';
1295 | var LongStackTrace = (function () {
1296 | function LongStackTrace() {
1297 | this.error = getStacktrace();
1298 | this.timestamp = new Date();
1299 | }
1300 | return LongStackTrace;
1301 | }());
1302 | function getStacktraceWithUncaughtError() {
1303 | return new Error('STACKTRACE TRACKING');
1304 | }
1305 | function getStacktraceWithCaughtError() {
1306 | try {
1307 | throw getStacktraceWithUncaughtError();
1308 | }
1309 | catch (e) {
1310 | return e;
1311 | }
1312 | }
1313 | // Some implementations of exception handling don't create a stack trace if the exception
1314 | // isn't thrown, however it's faster not to actually throw the exception.
1315 | var error = getStacktraceWithUncaughtError();
1316 | var coughtError = getStacktraceWithCaughtError();
1317 | var getStacktrace = error.stack
1318 | ? getStacktraceWithUncaughtError
1319 | : (coughtError.stack ? getStacktraceWithCaughtError : getStacktraceWithUncaughtError);
1320 | function getFrames(error) {
1321 | return error.stack ? error.stack.split(NEWLINE) : [];
1322 | }
1323 | function addErrorStack(lines, error) {
1324 | var trace;
1325 | trace = getFrames(error);
1326 | for (var i = 0; i < trace.length; i++) {
1327 | var frame = trace[i];
1328 | // Filter out the Frames which are part of stack capturing.
1329 | if (!(i < IGNORE_FRAMES.length && IGNORE_FRAMES[i] === frame)) {
1330 | lines.push(trace[i]);
1331 | }
1332 | }
1333 | }
1334 | function renderLongStackTrace(frames, stack) {
1335 | var longTrace = [stack];
1336 | if (frames) {
1337 | var timestamp = new Date().getTime();
1338 | for (var i = 0; i < frames.length; i++) {
1339 | var traceFrames = frames[i];
1340 | var lastTime = traceFrames.timestamp;
1341 | longTrace.push(SEP + " Elapsed: " + (timestamp - lastTime.getTime()) + " ms; At: " + lastTime + " " + SEP);
1342 | addErrorStack(longTrace, traceFrames.error);
1343 | timestamp = lastTime.getTime();
1344 | }
1345 | }
1346 | return longTrace.join(NEWLINE);
1347 | }
1348 | Zone['longStackTraceZoneSpec'] = {
1349 | name: 'long-stack-trace',
1350 | longStackTraceLimit: 10,
1351 | onScheduleTask: function (parentZoneDelegate, currentZone, targetZone, task) {
1352 | var currentTask = Zone.currentTask;
1353 | var trace = currentTask && currentTask.data && currentTask.data[creationTrace] || [];
1354 | trace = [new LongStackTrace()].concat(trace);
1355 | if (trace.length > this.longStackTraceLimit) {
1356 | trace.length = this.longStackTraceLimit;
1357 | }
1358 | if (!task.data)
1359 | task.data = {};
1360 | task.data[creationTrace] = trace;
1361 | return parentZoneDelegate.scheduleTask(targetZone, task);
1362 | },
1363 | onHandleError: function (parentZoneDelegate, currentZone, targetZone, error) {
1364 | var parentTask = Zone.currentTask;
1365 | if (error instanceof Error && parentTask) {
1366 | var descriptor = Object.getOwnPropertyDescriptor(error, 'stack');
1367 | if (descriptor) {
1368 | var delegateGet = descriptor.get;
1369 | var value = descriptor.value;
1370 | descriptor = {
1371 | get: function () {
1372 | return renderLongStackTrace(parentTask.data && parentTask.data[creationTrace], delegateGet ? delegateGet.apply(this) : value);
1373 | }
1374 | };
1375 | Object.defineProperty(error, 'stack', descriptor);
1376 | }
1377 | else {
1378 | error.stack = renderLongStackTrace(parentTask.data && parentTask.data[creationTrace], error.stack);
1379 | }
1380 | }
1381 | return parentZoneDelegate.handleError(targetZone, error);
1382 | }
1383 | };
1384 | function captureStackTraces(stackTraces, count) {
1385 | if (count > 0) {
1386 | stackTraces.push(getFrames((new LongStackTrace()).error));
1387 | captureStackTraces(stackTraces, count - 1);
1388 | }
1389 | }
1390 | function computeIgnoreFrames() {
1391 | var frames = [];
1392 | captureStackTraces(frames, 2);
1393 | var frames1 = frames[0];
1394 | var frames2 = frames[1];
1395 | for (var i = 0; i < frames1.length; i++) {
1396 | var frame1 = frames1[i];
1397 | var frame2 = frames2[i];
1398 | if (frame1 === frame2) {
1399 | IGNORE_FRAMES.push(frame1);
1400 | }
1401 | else {
1402 | break;
1403 | }
1404 | }
1405 | }
1406 | computeIgnoreFrames();
1407 | })();
1408 |
1409 |
1410 | /***/ }
1411 | /******/ ]);
1412 | /**
1413 | @license
1414 | Apache License
1415 |
1416 | Version 2.0, January 2004
1417 |
1418 | http://www.apache.org/licenses/
1419 |
1420 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1421 |
1422 | 1. Definitions.
1423 |
1424 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
1425 |
1426 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
1427 |
1428 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
1429 |
1430 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
1431 |
1432 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
1433 |
1434 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
1435 |
1436 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
1437 |
1438 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
1439 |
1440 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
1441 |
1442 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
1443 |
1444 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
1445 |
1446 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
1447 |
1448 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
1449 |
1450 | You must give any other recipients of the Work or Derivative Works a copy of this License; and
1451 |
1452 | You must cause any modified files to carry prominent notices stating that You changed the files; and
1453 |
1454 | You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
1455 |
1456 | If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
1457 |
1458 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
1459 |
1460 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
1461 |
1462 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
1463 |
1464 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
1465 |
1466 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
1467 |
1468 | END OF TERMS AND CONDITIONS
1469 | */
1470 |
1471 | /*! *****************************************************************************
1472 | Copyright (C) Microsoft. All rights reserved.
1473 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
1474 | this file except in compliance with the License. You may obtain a copy of the
1475 | License at http://www.apache.org/licenses/LICENSE-2.0
1476 |
1477 | THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1478 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
1479 | WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
1480 | MERCHANTABLITY OR NON-INFRINGEMENT.
1481 |
1482 | See the Apache Version 2.0 License for specific language governing permissions
1483 | and limitations under the License.
1484 | ***************************************************************************** */
1485 | "use strict";
1486 | var Reflect;
1487 | (function (Reflect) {
1488 | // Load global or shim versions of Map, Set, and WeakMap
1489 | var functionPrototype = Object.getPrototypeOf(Function);
1490 | var _Map = typeof Map === "function" ? Map : CreateMapPolyfill();
1491 | var _Set = typeof Set === "function" ? Set : CreateSetPolyfill();
1492 | var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
1493 | // [[Metadata]] internal slot
1494 | var __Metadata__ = new _WeakMap();
1495 | /**
1496 | * Applies a set of decorators to a property of a target object.
1497 | * @param decorators An array of decorators.
1498 | * @param target The target object.
1499 | * @param targetKey (Optional) The property key to decorate.
1500 | * @param targetDescriptor (Optional) The property descriptor for the target key
1501 | * @remarks Decorators are applied in reverse order.
1502 | * @example
1503 | *
1504 | * class C {
1505 | * // property declarations are not part of ES6, though they are valid in TypeScript:
1506 | * // static staticProperty;
1507 | * // property;
1508 | *
1509 | * constructor(p) { }
1510 | * static staticMethod(p) { }
1511 | * method(p) { }
1512 | * }
1513 | *
1514 | * // constructor
1515 | * C = Reflect.decorate(decoratorsArray, C);
1516 | *
1517 | * // property (on constructor)
1518 | * Reflect.decorate(decoratorsArray, C, "staticProperty");
1519 | *
1520 | * // property (on prototype)
1521 | * Reflect.decorate(decoratorsArray, C.prototype, "property");
1522 | *
1523 | * // method (on constructor)
1524 | * Object.defineProperty(C, "staticMethod",
1525 | * Reflect.decorate(decoratorsArray, C, "staticMethod",
1526 | * Object.getOwnPropertyDescriptor(C, "staticMethod")));
1527 | *
1528 | * // method (on prototype)
1529 | * Object.defineProperty(C.prototype, "method",
1530 | * Reflect.decorate(decoratorsArray, C.prototype, "method",
1531 | * Object.getOwnPropertyDescriptor(C.prototype, "method")));
1532 | *
1533 | */
1534 | function decorate(decorators, target, targetKey, targetDescriptor) {
1535 | if (!IsUndefined(targetDescriptor)) {
1536 | if (!IsArray(decorators)) {
1537 | throw new TypeError();
1538 | }
1539 | else if (!IsObject(target)) {
1540 | throw new TypeError();
1541 | }
1542 | else if (IsUndefined(targetKey)) {
1543 | throw new TypeError();
1544 | }
1545 | else if (!IsObject(targetDescriptor)) {
1546 | throw new TypeError();
1547 | }
1548 | targetKey = ToPropertyKey(targetKey);
1549 | return DecoratePropertyWithDescriptor(decorators, target, targetKey, targetDescriptor);
1550 | }
1551 | else if (!IsUndefined(targetKey)) {
1552 | if (!IsArray(decorators)) {
1553 | throw new TypeError();
1554 | }
1555 | else if (!IsObject(target)) {
1556 | throw new TypeError();
1557 | }
1558 | targetKey = ToPropertyKey(targetKey);
1559 | return DecoratePropertyWithoutDescriptor(decorators, target, targetKey);
1560 | }
1561 | else {
1562 | if (!IsArray(decorators)) {
1563 | throw new TypeError();
1564 | }
1565 | else if (!IsConstructor(target)) {
1566 | throw new TypeError();
1567 | }
1568 | return DecorateConstructor(decorators, target);
1569 | }
1570 | }
1571 | Reflect.decorate = decorate;
1572 | /**
1573 | * A default metadata decorator factory that can be used on a class, class member, or parameter.
1574 | * @param metadataKey The key for the metadata entry.
1575 | * @param metadataValue The value for the metadata entry.
1576 | * @returns A decorator function.
1577 | * @remarks
1578 | * If `metadataKey` is already defined for the target and target key, the
1579 | * metadataValue for that key will be overwritten.
1580 | * @example
1581 | *
1582 | * // constructor
1583 | * @Reflect.metadata(key, value)
1584 | * class C {
1585 | * }
1586 | *
1587 | * // property (on constructor, TypeScript only)
1588 | * class C {
1589 | * @Reflect.metadata(key, value)
1590 | * static staticProperty;
1591 | * }
1592 | *
1593 | * // property (on prototype, TypeScript only)
1594 | * class C {
1595 | * @Reflect.metadata(key, value)
1596 | * property;
1597 | * }
1598 | *
1599 | * // method (on constructor)
1600 | * class C {
1601 | * @Reflect.metadata(key, value)
1602 | * static staticMethod() { }
1603 | * }
1604 | *
1605 | * // method (on prototype)
1606 | * class C {
1607 | * @Reflect.metadata(key, value)
1608 | * method() { }
1609 | * }
1610 | *
1611 | */
1612 | function metadata(metadataKey, metadataValue) {
1613 | function decorator(target, targetKey) {
1614 | if (!IsUndefined(targetKey)) {
1615 | if (!IsObject(target)) {
1616 | throw new TypeError();
1617 | }
1618 | targetKey = ToPropertyKey(targetKey);
1619 | OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey);
1620 | }
1621 | else {
1622 | if (!IsConstructor(target)) {
1623 | throw new TypeError();
1624 | }
1625 | OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined);
1626 | }
1627 | }
1628 | return decorator;
1629 | }
1630 | Reflect.metadata = metadata;
1631 | /**
1632 | * Define a unique metadata entry on the target.
1633 | * @param metadataKey A key used to store and retrieve metadata.
1634 | * @param metadataValue A value that contains attached metadata.
1635 | * @param target The target object on which to define metadata.
1636 | * @param targetKey (Optional) The property key for the target.
1637 | * @example
1638 | *
1639 | * class C {
1640 | * // property declarations are not part of ES6, though they are valid in TypeScript:
1641 | * // static staticProperty;
1642 | * // property;
1643 | *
1644 | * constructor(p) { }
1645 | * static staticMethod(p) { }
1646 | * method(p) { }
1647 | * }
1648 | *
1649 | * // constructor
1650 | * Reflect.defineMetadata("custom:annotation", options, C);
1651 | *
1652 | * // property (on constructor)
1653 | * Reflect.defineMetadata("custom:annotation", options, C, "staticProperty");
1654 | *
1655 | * // property (on prototype)
1656 | * Reflect.defineMetadata("custom:annotation", options, C.prototype, "property");
1657 | *
1658 | * // method (on constructor)
1659 | * Reflect.defineMetadata("custom:annotation", options, C, "staticMethod");
1660 | *
1661 | * // method (on prototype)
1662 | * Reflect.defineMetadata("custom:annotation", options, C.prototype, "method");
1663 | *
1664 | * // decorator factory as metadata-producing annotation.
1665 | * function MyAnnotation(options): Decorator {
1666 | * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key);
1667 | * }
1668 | *
1669 | */
1670 | function defineMetadata(metadataKey, metadataValue, target, targetKey) {
1671 | if (!IsObject(target)) {
1672 | throw new TypeError();
1673 | }
1674 | else if (!IsUndefined(targetKey)) {
1675 | targetKey = ToPropertyKey(targetKey);
1676 | }
1677 | return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey);
1678 | }
1679 | Reflect.defineMetadata = defineMetadata;
1680 | /**
1681 | * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
1682 | * @param metadataKey A key used to store and retrieve metadata.
1683 | * @param target The target object on which the metadata is defined.
1684 | * @param targetKey (Optional) The property key for the target.
1685 | * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
1686 | * @example
1687 | *
1688 | * class C {
1689 | * // property declarations are not part of ES6, though they are valid in TypeScript:
1690 | * // static staticProperty;
1691 | * // property;
1692 | *
1693 | * constructor(p) { }
1694 | * static staticMethod(p) { }
1695 | * method(p) { }
1696 | * }
1697 | *
1698 | * // constructor
1699 | * result = Reflect.hasMetadata("custom:annotation", C);
1700 | *
1701 | * // property (on constructor)
1702 | * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty");
1703 | *
1704 | * // property (on prototype)
1705 | * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property");
1706 | *
1707 | * // method (on constructor)
1708 | * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod");
1709 | *
1710 | * // method (on prototype)
1711 | * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method");
1712 | *
1713 | */
1714 | function hasMetadata(metadataKey, target, targetKey) {
1715 | if (!IsObject(target)) {
1716 | throw new TypeError();
1717 | }
1718 | else if (!IsUndefined(targetKey)) {
1719 | targetKey = ToPropertyKey(targetKey);
1720 | }
1721 | return OrdinaryHasMetadata(metadataKey, target, targetKey);
1722 | }
1723 | Reflect.hasMetadata = hasMetadata;
1724 | /**
1725 | * Gets a value indicating whether the target object has the provided metadata key defined.
1726 | * @param metadataKey A key used to store and retrieve metadata.
1727 | * @param target The target object on which the metadata is defined.
1728 | * @param targetKey (Optional) The property key for the target.
1729 | * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
1730 | * @example
1731 | *
1732 | * class C {
1733 | * // property declarations are not part of ES6, though they are valid in TypeScript:
1734 | * // static staticProperty;
1735 | * // property;
1736 | *
1737 | * constructor(p) { }
1738 | * static staticMethod(p) { }
1739 | * method(p) { }
1740 | * }
1741 | *
1742 | * // constructor
1743 | * result = Reflect.hasOwnMetadata("custom:annotation", C);
1744 | *
1745 | * // property (on constructor)
1746 | * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty");
1747 | *
1748 | * // property (on prototype)
1749 | * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property");
1750 | *
1751 | * // method (on constructor)
1752 | * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod");
1753 | *
1754 | * // method (on prototype)
1755 | * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method");
1756 | *
1757 | */
1758 | function hasOwnMetadata(metadataKey, target, targetKey) {
1759 | if (!IsObject(target)) {
1760 | throw new TypeError();
1761 | }
1762 | else if (!IsUndefined(targetKey)) {
1763 | targetKey = ToPropertyKey(targetKey);
1764 | }
1765 | return OrdinaryHasOwnMetadata(metadataKey, target, targetKey);
1766 | }
1767 | Reflect.hasOwnMetadata = hasOwnMetadata;
1768 | /**
1769 | * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
1770 | * @param metadataKey A key used to store and retrieve metadata.
1771 | * @param target The target object on which the metadata is defined.
1772 | * @param targetKey (Optional) The property key for the target.
1773 | * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
1774 | * @example
1775 | *
1776 | * class C {
1777 | * // property declarations are not part of ES6, though they are valid in TypeScript:
1778 | * // static staticProperty;
1779 | * // property;
1780 | *
1781 | * constructor(p) { }
1782 | * static staticMethod(p) { }
1783 | * method(p) { }
1784 | * }
1785 | *
1786 | * // constructor
1787 | * result = Reflect.getMetadata("custom:annotation", C);
1788 | *
1789 | * // property (on constructor)
1790 | * result = Reflect.getMetadata("custom:annotation", C, "staticProperty");
1791 | *
1792 | * // property (on prototype)
1793 | * result = Reflect.getMetadata("custom:annotation", C.prototype, "property");
1794 | *
1795 | * // method (on constructor)
1796 | * result = Reflect.getMetadata("custom:annotation", C, "staticMethod");
1797 | *
1798 | * // method (on prototype)
1799 | * result = Reflect.getMetadata("custom:annotation", C.prototype, "method");
1800 | *
1801 | */
1802 | function getMetadata(metadataKey, target, targetKey) {
1803 | if (!IsObject(target)) {
1804 | throw new TypeError();
1805 | }
1806 | else if (!IsUndefined(targetKey)) {
1807 | targetKey = ToPropertyKey(targetKey);
1808 | }
1809 | return OrdinaryGetMetadata(metadataKey, target, targetKey);
1810 | }
1811 | Reflect.getMetadata = getMetadata;
1812 | /**
1813 | * Gets the metadata value for the provided metadata key on the target object.
1814 | * @param metadataKey A key used to store and retrieve metadata.
1815 | * @param target The target object on which the metadata is defined.
1816 | * @param targetKey (Optional) The property key for the target.
1817 | * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
1818 | * @example
1819 | *
1820 | * class C {
1821 | * // property declarations are not part of ES6, though they are valid in TypeScript:
1822 | * // static staticProperty;
1823 | * // property;
1824 | *
1825 | * constructor(p) { }
1826 | * static staticMethod(p) { }
1827 | * method(p) { }
1828 | * }
1829 | *
1830 | * // constructor
1831 | * result = Reflect.getOwnMetadata("custom:annotation", C);
1832 | *
1833 | * // property (on constructor)
1834 | * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty");
1835 | *
1836 | * // property (on prototype)
1837 | * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property");
1838 | *
1839 | * // method (on constructor)
1840 | * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod");
1841 | *
1842 | * // method (on prototype)
1843 | * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method");
1844 | *
1845 | */
1846 | function getOwnMetadata(metadataKey, target, targetKey) {
1847 | if (!IsObject(target)) {
1848 | throw new TypeError();
1849 | }
1850 | else if (!IsUndefined(targetKey)) {
1851 | targetKey = ToPropertyKey(targetKey);
1852 | }
1853 | return OrdinaryGetOwnMetadata(metadataKey, target, targetKey);
1854 | }
1855 | Reflect.getOwnMetadata = getOwnMetadata;
1856 | /**
1857 | * Gets the metadata keys defined on the target object or its prototype chain.
1858 | * @param target The target object on which the metadata is defined.
1859 | * @param targetKey (Optional) The property key for the target.
1860 | * @returns An array of unique metadata keys.
1861 | * @example
1862 | *
1863 | * class C {
1864 | * // property declarations are not part of ES6, though they are valid in TypeScript:
1865 | * // static staticProperty;
1866 | * // property;
1867 | *
1868 | * constructor(p) { }
1869 | * static staticMethod(p) { }
1870 | * method(p) { }
1871 | * }
1872 | *
1873 | * // constructor
1874 | * result = Reflect.getMetadataKeys(C);
1875 | *
1876 | * // property (on constructor)
1877 | * result = Reflect.getMetadataKeys(C, "staticProperty");
1878 | *
1879 | * // property (on prototype)
1880 | * result = Reflect.getMetadataKeys(C.prototype, "property");
1881 | *
1882 | * // method (on constructor)
1883 | * result = Reflect.getMetadataKeys(C, "staticMethod");
1884 | *
1885 | * // method (on prototype)
1886 | * result = Reflect.getMetadataKeys(C.prototype, "method");
1887 | *
1888 | */
1889 | function getMetadataKeys(target, targetKey) {
1890 | if (!IsObject(target)) {
1891 | throw new TypeError();
1892 | }
1893 | else if (!IsUndefined(targetKey)) {
1894 | targetKey = ToPropertyKey(targetKey);
1895 | }
1896 | return OrdinaryMetadataKeys(target, targetKey);
1897 | }
1898 | Reflect.getMetadataKeys = getMetadataKeys;
1899 | /**
1900 | * Gets the unique metadata keys defined on the target object.
1901 | * @param target The target object on which the metadata is defined.
1902 | * @param targetKey (Optional) The property key for the target.
1903 | * @returns An array of unique metadata keys.
1904 | * @example
1905 | *
1906 | * class C {
1907 | * // property declarations are not part of ES6, though they are valid in TypeScript:
1908 | * // static staticProperty;
1909 | * // property;
1910 | *
1911 | * constructor(p) { }
1912 | * static staticMethod(p) { }
1913 | * method(p) { }
1914 | * }
1915 | *
1916 | * // constructor
1917 | * result = Reflect.getOwnMetadataKeys(C);
1918 | *
1919 | * // property (on constructor)
1920 | * result = Reflect.getOwnMetadataKeys(C, "staticProperty");
1921 | *
1922 | * // property (on prototype)
1923 | * result = Reflect.getOwnMetadataKeys(C.prototype, "property");
1924 | *
1925 | * // method (on constructor)
1926 | * result = Reflect.getOwnMetadataKeys(C, "staticMethod");
1927 | *
1928 | * // method (on prototype)
1929 | * result = Reflect.getOwnMetadataKeys(C.prototype, "method");
1930 | *
1931 | */
1932 | function getOwnMetadataKeys(target, targetKey) {
1933 | if (!IsObject(target)) {
1934 | throw new TypeError();
1935 | }
1936 | else if (!IsUndefined(targetKey)) {
1937 | targetKey = ToPropertyKey(targetKey);
1938 | }
1939 | return OrdinaryOwnMetadataKeys(target, targetKey);
1940 | }
1941 | Reflect.getOwnMetadataKeys = getOwnMetadataKeys;
1942 | /**
1943 | * Deletes the metadata entry from the target object with the provided key.
1944 | * @param metadataKey A key used to store and retrieve metadata.
1945 | * @param target The target object on which the metadata is defined.
1946 | * @param targetKey (Optional) The property key for the target.
1947 | * @returns `true` if the metadata entry was found and deleted; otherwise, false.
1948 | * @example
1949 | *
1950 | * class C {
1951 | * // property declarations are not part of ES6, though they are valid in TypeScript:
1952 | * // static staticProperty;
1953 | * // property;
1954 | *
1955 | * constructor(p) { }
1956 | * static staticMethod(p) { }
1957 | * method(p) { }
1958 | * }
1959 | *
1960 | * // constructor
1961 | * result = Reflect.deleteMetadata("custom:annotation", C);
1962 | *
1963 | * // property (on constructor)
1964 | * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty");
1965 | *
1966 | * // property (on prototype)
1967 | * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property");
1968 | *
1969 | * // method (on constructor)
1970 | * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod");
1971 | *
1972 | * // method (on prototype)
1973 | * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method");
1974 | *
1975 | */
1976 | function deleteMetadata(metadataKey, target, targetKey) {
1977 | if (!IsObject(target)) {
1978 | throw new TypeError();
1979 | }
1980 | else if (!IsUndefined(targetKey)) {
1981 | targetKey = ToPropertyKey(targetKey);
1982 | }
1983 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p-
1984 | var metadataMap = GetOrCreateMetadataMap(target, targetKey, false);
1985 | if (IsUndefined(metadataMap)) {
1986 | return false;
1987 | }
1988 | if (!metadataMap.delete(metadataKey)) {
1989 | return false;
1990 | }
1991 | if (metadataMap.size > 0) {
1992 | return true;
1993 | }
1994 | var targetMetadata = __Metadata__.get(target);
1995 | targetMetadata.delete(targetKey);
1996 | if (targetMetadata.size > 0) {
1997 | return true;
1998 | }
1999 | __Metadata__.delete(target);
2000 | return true;
2001 | }
2002 | Reflect.deleteMetadata = deleteMetadata;
2003 | function DecorateConstructor(decorators, target) {
2004 | for (var i = decorators.length - 1; i >= 0; --i) {
2005 | var decorator = decorators[i];
2006 | var decorated = decorator(target);
2007 | if (!IsUndefined(decorated)) {
2008 | if (!IsConstructor(decorated)) {
2009 | throw new TypeError();
2010 | }
2011 | target = decorated;
2012 | }
2013 | }
2014 | return target;
2015 | }
2016 | function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) {
2017 | for (var i = decorators.length - 1; i >= 0; --i) {
2018 | var decorator = decorators[i];
2019 | var decorated = decorator(target, propertyKey, descriptor);
2020 | if (!IsUndefined(decorated)) {
2021 | if (!IsObject(decorated)) {
2022 | throw new TypeError();
2023 | }
2024 | descriptor = decorated;
2025 | }
2026 | }
2027 | return descriptor;
2028 | }
2029 | function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) {
2030 | for (var i = decorators.length - 1; i >= 0; --i) {
2031 | var decorator = decorators[i];
2032 | decorator(target, propertyKey);
2033 | }
2034 | }
2035 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create-
2036 | function GetOrCreateMetadataMap(target, targetKey, create) {
2037 | var targetMetadata = __Metadata__.get(target);
2038 | if (!targetMetadata) {
2039 | if (!create) {
2040 | return undefined;
2041 | }
2042 | targetMetadata = new _Map();
2043 | __Metadata__.set(target, targetMetadata);
2044 | }
2045 | var keyMetadata = targetMetadata.get(targetKey);
2046 | if (!keyMetadata) {
2047 | if (!create) {
2048 | return undefined;
2049 | }
2050 | keyMetadata = new _Map();
2051 | targetMetadata.set(targetKey, keyMetadata);
2052 | }
2053 | return keyMetadata;
2054 | }
2055 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p-
2056 | function OrdinaryHasMetadata(MetadataKey, O, P) {
2057 | var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
2058 | if (hasOwn) {
2059 | return true;
2060 | }
2061 | var parent = GetPrototypeOf(O);
2062 | if (parent !== null) {
2063 | return OrdinaryHasMetadata(MetadataKey, parent, P);
2064 | }
2065 | return false;
2066 | }
2067 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p-
2068 | function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
2069 | var metadataMap = GetOrCreateMetadataMap(O, P, false);
2070 | if (metadataMap === undefined) {
2071 | return false;
2072 | }
2073 | return Boolean(metadataMap.has(MetadataKey));
2074 | }
2075 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p-
2076 | function OrdinaryGetMetadata(MetadataKey, O, P) {
2077 | var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
2078 | if (hasOwn) {
2079 | return OrdinaryGetOwnMetadata(MetadataKey, O, P);
2080 | }
2081 | var parent = GetPrototypeOf(O);
2082 | if (parent !== null) {
2083 | return OrdinaryGetMetadata(MetadataKey, parent, P);
2084 | }
2085 | return undefined;
2086 | }
2087 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p-
2088 | function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
2089 | var metadataMap = GetOrCreateMetadataMap(O, P, false);
2090 | if (metadataMap === undefined) {
2091 | return undefined;
2092 | }
2093 | return metadataMap.get(MetadataKey);
2094 | }
2095 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p-
2096 | function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
2097 | var metadataMap = GetOrCreateMetadataMap(O, P, true);
2098 | metadataMap.set(MetadataKey, MetadataValue);
2099 | }
2100 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p-
2101 | function OrdinaryMetadataKeys(O, P) {
2102 | var ownKeys = OrdinaryOwnMetadataKeys(O, P);
2103 | var parent = GetPrototypeOf(O);
2104 | if (parent === null) {
2105 | return ownKeys;
2106 | }
2107 | var parentKeys = OrdinaryMetadataKeys(parent, P);
2108 | if (parentKeys.length <= 0) {
2109 | return ownKeys;
2110 | }
2111 | if (ownKeys.length <= 0) {
2112 | return parentKeys;
2113 | }
2114 | var set = new _Set();
2115 | var keys = [];
2116 | for (var _i = 0; _i < ownKeys.length; _i++) {
2117 | var key = ownKeys[_i];
2118 | var hasKey = set.has(key);
2119 | if (!hasKey) {
2120 | set.add(key);
2121 | keys.push(key);
2122 | }
2123 | }
2124 | for (var _a = 0; _a < parentKeys.length; _a++) {
2125 | var key = parentKeys[_a];
2126 | var hasKey = set.has(key);
2127 | if (!hasKey) {
2128 | set.add(key);
2129 | keys.push(key);
2130 | }
2131 | }
2132 | return keys;
2133 | }
2134 | // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p-
2135 | function OrdinaryOwnMetadataKeys(target, targetKey) {
2136 | var metadataMap = GetOrCreateMetadataMap(target, targetKey, false);
2137 | var keys = [];
2138 | if (metadataMap) {
2139 | metadataMap.forEach(function (_, key) { return keys.push(key); });
2140 | }
2141 | return keys;
2142 | }
2143 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type
2144 | function IsUndefined(x) {
2145 | return x === undefined;
2146 | }
2147 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray
2148 | function IsArray(x) {
2149 | return Array.isArray(x);
2150 | }
2151 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type
2152 | function IsObject(x) {
2153 | return typeof x === "object" ? x !== null : typeof x === "function";
2154 | }
2155 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor
2156 | function IsConstructor(x) {
2157 | return typeof x === "function";
2158 | }
2159 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type
2160 | function IsSymbol(x) {
2161 | return typeof x === "symbol";
2162 | }
2163 | // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey
2164 | function ToPropertyKey(value) {
2165 | if (IsSymbol(value)) {
2166 | return value;
2167 | }
2168 | return String(value);
2169 | }
2170 | function GetPrototypeOf(O) {
2171 | var proto = Object.getPrototypeOf(O);
2172 | if (typeof O !== "function" || O === functionPrototype) {
2173 | return proto;
2174 | }
2175 | // TypeScript doesn't set __proto__ in ES5, as it's non-standard.
2176 | // Try to determine the superclass constructor. Compatible implementations
2177 | // must either set __proto__ on a subclass constructor to the superclass constructor,
2178 | // or ensure each class has a valid `constructor` property on its prototype that
2179 | // points back to the constructor.
2180 | // If this is not the same as Function.[[Prototype]], then this is definately inherited.
2181 | // This is the case when in ES6 or when using __proto__ in a compatible browser.
2182 | if (proto !== functionPrototype) {
2183 | return proto;
2184 | }
2185 | // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.
2186 | var prototype = O.prototype;
2187 | var prototypeProto = Object.getPrototypeOf(prototype);
2188 | if (prototypeProto == null || prototypeProto === Object.prototype) {
2189 | return proto;
2190 | }
2191 | // if the constructor was not a function, then we cannot determine the heritage.
2192 | var constructor = prototypeProto.constructor;
2193 | if (typeof constructor !== "function") {
2194 | return proto;
2195 | }
2196 | // if we have some kind of self-reference, then we cannot determine the heritage.
2197 | if (constructor === O) {
2198 | return proto;
2199 | }
2200 | // we have a pretty good guess at the heritage.
2201 | return constructor;
2202 | }
2203 | // naive Map shim
2204 | function CreateMapPolyfill() {
2205 | var cacheSentinel = {};
2206 | function Map() {
2207 | this._keys = [];
2208 | this._values = [];
2209 | this._cache = cacheSentinel;
2210 | }
2211 | Map.prototype = {
2212 | get size() {
2213 | return this._keys.length;
2214 | },
2215 | has: function (key) {
2216 | if (key === this._cache) {
2217 | return true;
2218 | }
2219 | if (this._find(key) >= 0) {
2220 | this._cache = key;
2221 | return true;
2222 | }
2223 | return false;
2224 | },
2225 | get: function (key) {
2226 | var index = this._find(key);
2227 | if (index >= 0) {
2228 | this._cache = key;
2229 | return this._values[index];
2230 | }
2231 | return undefined;
2232 | },
2233 | set: function (key, value) {
2234 | this.delete(key);
2235 | this._keys.push(key);
2236 | this._values.push(value);
2237 | this._cache = key;
2238 | return this;
2239 | },
2240 | delete: function (key) {
2241 | var index = this._find(key);
2242 | if (index >= 0) {
2243 | this._keys.splice(index, 1);
2244 | this._values.splice(index, 1);
2245 | this._cache = cacheSentinel;
2246 | return true;
2247 | }
2248 | return false;
2249 | },
2250 | clear: function () {
2251 | this._keys.length = 0;
2252 | this._values.length = 0;
2253 | this._cache = cacheSentinel;
2254 | },
2255 | forEach: function (callback, thisArg) {
2256 | var size = this.size;
2257 | for (var i = 0; i < size; ++i) {
2258 | var key = this._keys[i];
2259 | var value = this._values[i];
2260 | this._cache = key;
2261 | callback.call(this, value, key, this);
2262 | }
2263 | },
2264 | _find: function (key) {
2265 | var keys = this._keys;
2266 | var size = keys.length;
2267 | for (var i = 0; i < size; ++i) {
2268 | if (keys[i] === key) {
2269 | return i;
2270 | }
2271 | }
2272 | return -1;
2273 | }
2274 | };
2275 | return Map;
2276 | }
2277 | // naive Set shim
2278 | function CreateSetPolyfill() {
2279 | var cacheSentinel = {};
2280 | function Set() {
2281 | this._map = new _Map();
2282 | }
2283 | Set.prototype = {
2284 | get size() {
2285 | return this._map.length;
2286 | },
2287 | has: function (value) {
2288 | return this._map.has(value);
2289 | },
2290 | add: function (value) {
2291 | this._map.set(value, value);
2292 | return this;
2293 | },
2294 | delete: function (value) {
2295 | return this._map.delete(value);
2296 | },
2297 | clear: function () {
2298 | this._map.clear();
2299 | },
2300 | forEach: function (callback, thisArg) {
2301 | this._map.forEach(callback, thisArg);
2302 | }
2303 | };
2304 | return Set;
2305 | }
2306 | // naive WeakMap shim
2307 | function CreateWeakMapPolyfill() {
2308 | var UUID_SIZE = 16;
2309 | var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]';
2310 | var nodeCrypto = isNode && require("crypto");
2311 | var hasOwn = Object.prototype.hasOwnProperty;
2312 | var keys = {};
2313 | var rootKey = CreateUniqueKey();
2314 | function WeakMap() {
2315 | this._key = CreateUniqueKey();
2316 | }
2317 | WeakMap.prototype = {
2318 | has: function (target) {
2319 | var table = GetOrCreateWeakMapTable(target, false);
2320 | if (table) {
2321 | return this._key in table;
2322 | }
2323 | return false;
2324 | },
2325 | get: function (target) {
2326 | var table = GetOrCreateWeakMapTable(target, false);
2327 | if (table) {
2328 | return table[this._key];
2329 | }
2330 | return undefined;
2331 | },
2332 | set: function (target, value) {
2333 | var table = GetOrCreateWeakMapTable(target, true);
2334 | table[this._key] = value;
2335 | return this;
2336 | },
2337 | delete: function (target) {
2338 | var table = GetOrCreateWeakMapTable(target, false);
2339 | if (table && this._key in table) {
2340 | return delete table[this._key];
2341 | }
2342 | return false;
2343 | },
2344 | clear: function () {
2345 | // NOTE: not a real clear, just makes the previous data unreachable
2346 | this._key = CreateUniqueKey();
2347 | }
2348 | };
2349 | function FillRandomBytes(buffer, size) {
2350 | for (var i = 0; i < size; ++i) {
2351 | buffer[i] = Math.random() * 255 | 0;
2352 | }
2353 | }
2354 | function GenRandomBytes(size) {
2355 | if (nodeCrypto) {
2356 | var data = nodeCrypto.randomBytes(size);
2357 | return data;
2358 | }
2359 | else if (typeof Uint8Array === "function") {
2360 | var data = new Uint8Array(size);
2361 | if (typeof crypto !== "undefined") {
2362 | crypto.getRandomValues(data);
2363 | }
2364 | else if (typeof msCrypto !== "undefined") {
2365 | msCrypto.getRandomValues(data);
2366 | }
2367 | else {
2368 | FillRandomBytes(data, size);
2369 | }
2370 | return data;
2371 | }
2372 | else {
2373 | var data = new Array(size);
2374 | FillRandomBytes(data, size);
2375 | return data;
2376 | }
2377 | }
2378 | function CreateUUID() {
2379 | var data = GenRandomBytes(UUID_SIZE);
2380 | // mark as random - RFC 4122 § 4.4
2381 | data[6] = data[6] & 0x4f | 0x40;
2382 | data[8] = data[8] & 0xbf | 0x80;
2383 | var result = "";
2384 | for (var offset = 0; offset < UUID_SIZE; ++offset) {
2385 | var byte = data[offset];
2386 | if (offset === 4 || offset === 6 || offset === 8) {
2387 | result += "-";
2388 | }
2389 | if (byte < 16) {
2390 | result += "0";
2391 | }
2392 | result += byte.toString(16).toLowerCase();
2393 | }
2394 | return result;
2395 | }
2396 | function CreateUniqueKey() {
2397 | var key;
2398 | do {
2399 | key = "@@WeakMap@@" + CreateUUID();
2400 | } while (hasOwn.call(keys, key));
2401 | keys[key] = true;
2402 | return key;
2403 | }
2404 | function GetOrCreateWeakMapTable(target, create) {
2405 | if (!hasOwn.call(target, rootKey)) {
2406 | if (!create) {
2407 | return undefined;
2408 | }
2409 | Object.defineProperty(target, rootKey, { value: Object.create(null) });
2410 | }
2411 | return target[rootKey];
2412 | }
2413 | return WeakMap;
2414 | }
2415 | // hook global Reflect
2416 | (function (__global) {
2417 | if (typeof __global.Reflect !== "undefined") {
2418 | if (__global.Reflect !== Reflect) {
2419 | for (var p in Reflect) {
2420 | __global.Reflect[p] = Reflect[p];
2421 | }
2422 | }
2423 | }
2424 | else {
2425 | __global.Reflect = Reflect;
2426 | }
2427 | })(typeof window !== "undefined" ? window :
2428 | typeof WorkerGlobalScope !== "undefined" ? self :
2429 | typeof global !== "undefined" ? global :
2430 | Function("return this;")());
2431 | })(Reflect || (Reflect = {}));
2432 | //# sourceMappingURLDisabled=Reflect.js.map
--------------------------------------------------------------------------------
/libs/system.js:
--------------------------------------------------------------------------------
1 | /*
2 | * SystemJS v0.19.6
3 | */
4 | !function(){function e(){!function(e){function t(e,t){var n;if(e instanceof Error){var n=new Error(e.message,e.fileName,e.lineNumber);P?(n.message=e.message+"\n "+t,n.stack=e.stack):(n.message=e.message,n.stack=e.stack+"\n "+t)}else n=e+"\n "+t;return n}function n(e,n,r){try{new Function(e).call(r)}catch(a){throw t(a,"Evaluating "+n)}}function r(){}function a(t){this._loader={loaderObj:this,loads:[],modules:{},importPromises:{},moduleRecords:{}},M(this,"global",{get:function(){return e}})}function o(){a.call(this),this.paths={}}function s(e,t){var n,r="",a=0;for(var o in e){var s=o.split("*");if(s.length>2)throw new TypeError("Only one wildcard in a path is permitted");if(1==s.length){if(t==o){r=o;break}}else{var i=s[0].length;i>=a&&t.substr(0,s[0].length)==s[0]&&t.substr(t.length-s[1].length)==s[1]&&(a=i,r=o,n=t.substr(s[0].length,t.length-s[1].length-s[0].length))}}var l=e[r]||t;return"string"==typeof n&&(l=l.replace("*",n)),l}function i(){}function l(){o.call(this),N.call(this)}function u(){}function d(e,t){l.prototype[e]=t(l.prototype[e]||function(){})}function c(e){N=e(N||function(){})}function f(e){for(var t=[],n=[],r=0,a=e.length;a>r;r++){var o=O.call(t,e[r]);-1===o?(t.push(e[r]),n.push([r])):n[o].push(r)}return{names:t,indices:n}}function m(e){var t={};if("object"==typeof e||"function"==typeof e)if(q){var n;for(var r in e)(n=Object.getOwnPropertyDescriptor(e,r))&&M(t,r,n)}else{var a=e&&e.hasOwnProperty;for(var r in e)(!a||e.hasOwnProperty(r))&&(t[r]=e[r])}return t["default"]=e,M(t,"__useDefault",{value:!0}),t}function p(e,t,n){for(var r in t)n&&r in e||(e[r]=t[r]);return e}function h(e,t,n){for(var r in t){var a=t[r];r in e?a instanceof Array&&e[r]instanceof Array?e[r]=[].concat(n?a:e[r]).concat(n?e[r]:a):"object"==typeof a&&"object"==typeof e[r]?e[r]=p(p({},e[r]),a,n):n||(e[r]=a):e[r]=a}}function g(e){this.warnings&&"undefined"!=typeof console&&console.warn}function v(e,t){for(var n=e.split(".");n.length;)t=t[n.shift()];return t}function y(){if(B[this.baseURL])return B[this.baseURL];"/"!=this.baseURL[this.baseURL.length-1]&&(this.baseURL+="/");var e=new L(this.baseURL,z);return this.baseURL=e.href,B[this.baseURL]=e}function b(){return{name:null,deps:null,declare:null,execute:null,executingRequire:!1,declarative:!1,normalizedDeps:null,groupIndex:null,evaluated:!1,module:null,esModule:null,esmExports:!1}}function w(e){var t,n,r,r="~"==e[0],a=e.lastIndexOf("|");return-1!=a?(t=e.substr(a+1),n=e.substr(r,a-r)||"@system-env"):(t=null,n=e.substr(r)),{module:n,prop:t,negate:r}}function x(e){return(e.negate?"~":"")+e.module+(e.prop?"|"+e.prop:"")}function S(e,t,n){return this["import"](e.module,t).then(function(t){return e.prop?t=v(e.prop,t):"object"==typeof t&&t+""=="Module"&&(t=t["default"]),e.negate?!t:t})}function E(e,t){var n=e.match(X);if(!n)return Promise.resolve(e);var r=w(n[0].substr(2,n[0].length-3));return this.builder?this.normalize(r.module,t).then(function(t){return r.module=t,e.replace(X,"#{"+x(r)+"}")}):S.call(this,r,t,!1).then(function(n){if("string"!=typeof n)throw new TypeError("The condition value for "+e+" doesn't resolve to a string.");if(-1!=n.indexOf("/"))throw new TypeError("Unabled to interpolate conditional "+e+(t?" in "+t:"")+"\n The condition value "+n+' cannot contain a "/" separator.');return e.replace(X,n)})}function k(e,t){var n=e.lastIndexOf("#?");if(-1==n)return Promise.resolve(e);var r=w(e.substr(n+2));return this.builder?this.normalize(r.module,t).then(function(t){return r.module=t,e.substr(0,n)+"#?"+x(r)}):S.call(this,r,t,!0).then(function(t){return t?e.substr(0,n):"@empty"})}function _(e,t){for(var n in e.loadedBundles_)if(-1!=O.call(e.bundles[n],t))return Promise.resolve(n);for(var n in e.bundles)if(-1!=O.call(e.bundles[n],t))return e.normalize(n).then(function(t){return e.bundles[t]=e.bundles[n],e.loadedBundles_[t]=!0,t});return Promise.resolve()}var R="undefined"==typeof window&&"undefined"!=typeof self&&"undefined"!=typeof importScripts,P="undefined"!=typeof window&&"undefined"!=typeof document,j="undefined"!=typeof process&&!!process.platform.match(/^win/);e.console||(e.console={assert:function(){}});var M,O=Array.prototype.indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1};!function(){try{Object.defineProperty({},"a",{})&&(M=Object.defineProperty)}catch(e){M=function(e,t,n){try{e[t]=n.value||n.get.call(e)}catch(r){}}}}();var z;if("undefined"!=typeof document&&document.getElementsByTagName){if(z=document.baseURI,!z){var T=document.getElementsByTagName("base");z=T[0]&&T[0].href||window.location.href}z=z.split("#")[0].split("?")[0],z=z.substr(0,z.lastIndexOf("/")+1)}else if("undefined"!=typeof process&&process.cwd)z="file://"+(j?"/":"")+process.cwd()+"/",j&&(z=z.replace(/\\/g,"/"));else{if("undefined"==typeof location)throw new TypeError("No environment baseURI");z=e.location.href}var L=e.URLPolyfill||e.URL;M(r.prototype,"toString",{value:function(){return"Module"}}),function(){function o(e){return{status:"loading",name:e,linkSets:[],dependencies:[],metadata:{}}}function s(e,t,n){return new Promise(c({step:n.address?"fetch":"locate",loader:e,moduleName:t,moduleMetadata:n&&n.metadata||{},moduleSource:n.source,moduleAddress:n.address}))}function i(e,t,n,r){return new Promise(function(a,o){a(e.loaderObj.normalize(t,n,r))}).then(function(t){var n;if(e.modules[t])return n=o(t),n.status="linked",n.module=e.modules[t],n;for(var r=0,a=e.loads.length;a>r;r++)if(n=e.loads[r],n.name==t)return n;return n=o(t),e.loads.push(n),l(e,n),n})}function l(e,t){u(e,t,Promise.resolve().then(function(){return e.loaderObj.locate({name:t.name,metadata:t.metadata})}))}function u(e,t,n){d(e,t,n.then(function(n){return"loading"==t.status?(t.address=n,e.loaderObj.fetch({name:t.name,metadata:t.metadata,address:n})):void 0}))}function d(t,r,a){a.then(function(a){return"loading"==r.status?Promise.resolve(t.loaderObj.translate({name:r.name,metadata:r.metadata,address:r.address,source:a})).then(function(e){return r.source=e,t.loaderObj.instantiate({name:r.name,metadata:r.metadata,address:r.address,source:e})}).then(function(a){if(void 0===a)return r.address=r.address||"",r.isDeclarative=!0,E.call(t.loaderObj,r).then(function(t){var a=e.System,o=a.register;a.register=function(e,t,n){"string"!=typeof e&&(n=t,t=e),r.declare=n,r.depsList=t},n(t,r.address,{}),a.register=o});if("object"!=typeof a)throw TypeError("Invalid instantiate return value");r.depsList=a.deps||[],r.execute=a.execute,r.isDeclarative=!1}).then(function(){r.dependencies=[];for(var e=r.depsList,n=[],a=0,o=e.length;o>a;a++)(function(e,a){n.push(i(t,e,r.name,r.address).then(function(t){if(r.dependencies[a]={key:e,value:t.name},"linked"!=t.status)for(var n=r.linkSets.concat([]),o=0,s=n.length;s>o;o++)m(n[o],t)}))})(e[a],a);return Promise.all(n)}).then(function(){r.status="loaded";for(var e=r.linkSets.concat([]),t=0,n=e.length;n>t;t++)h(e[t],r)}):void 0})["catch"](function(e){r.status="failed",r.exception=e;for(var t=r.linkSets.concat([]),n=0,a=t.length;a>n;n++)g(t[n],r,e)})}function c(e){return function(t,n){var r=e.loader,a=e.moduleName,s=e.step;if(r.modules[a])throw new TypeError('"'+a+'" already exists in the module table');for(var i,c=0,m=r.loads.length;m>c;c++)if(r.loads[c].name==a&&(i=r.loads[c],"translate"!=s||i.source||(i.address=e.moduleAddress,d(r,i,Promise.resolve(e.moduleSource))),i.linkSets.length))return i.linkSets[0].done.then(function(){t(i)});var p=i||o(a);p.metadata=e.moduleMetadata;var h=f(r,p);r.loads.push(p),t(h.done),"locate"==s?l(r,p):"fetch"==s?u(r,p,Promise.resolve(e.moduleAddress)):(p.address=e.moduleAddress,d(r,p,Promise.resolve(e.moduleSource)))}}function f(e,t){var n={loader:e,loads:[],startingLoad:t,loadingCount:0};return n.done=new Promise(function(e,t){n.resolve=e,n.reject=t}),m(n,t),n}function m(e,t){if("failed"!=t.status){for(var n=0,r=e.loads.length;r>n;n++)if(e.loads[n]==t)return;e.loads.push(t),t.linkSets.push(e),"loaded"!=t.status&&e.loadingCount++;for(var a=e.loader,n=0,r=t.dependencies.length;r>n;n++)if(t.dependencies[n]){var o=t.dependencies[n].value;if(!a.modules[o])for(var s=0,i=a.loads.length;i>s;s++)if(a.loads[s].name==o){m(e,a.loads[s]);break}}}}function p(e){var t=!1;try{w(e,function(n,r){g(e,n,r),t=!0})}catch(n){g(e,null,n),t=!0}return t}function h(e,t){if(e.loadingCount--,!(e.loadingCount>0)){var n=e.startingLoad;if(e.loader.loaderObj.execute===!1){for(var r=[].concat(e.loads),a=0,o=r.length;o>a;a++){var t=r[a];t.module=t.isDeclarative?{name:t.name,module:_({}),evaluated:!0}:{module:_({})},t.status="linked",v(e.loader,t)}return e.resolve(n)}var s=p(e);s||e.resolve(n)}}function g(e,n,r){var a=e.loader;e:if(n)if(e.loads[0].name==n.name)r=t(r,"Error loading "+n.name);else{for(var o=0;oo;o++){var n=u[o];a.loaderObj.failed=a.loaderObj.failed||[],-1==O.call(a.loaderObj.failed,n)&&a.loaderObj.failed.push(n);var c=O.call(n.linkSets,e);if(n.linkSets.splice(c,1),0==n.linkSets.length){var f=O.call(e.loader.loads,n);-1!=f&&e.loader.loads.splice(f,1)}}e.reject(r)}function v(e,t){if(e.loaderObj.trace){e.loaderObj.loads||(e.loaderObj.loads={});var n={};t.dependencies.forEach(function(e){n[e.key]=e.value}),e.loaderObj.loads[t.name]={name:t.name,deps:t.dependencies.map(function(e){return e.key}),depMap:n,address:t.address,metadata:t.metadata,source:t.source,kind:t.isDeclarative?"declarative":"dynamic"}}t.name&&(e.modules[t.name]=t.module);var r=O.call(e.loads,t);-1!=r&&e.loads.splice(r,1);for(var a=0,o=t.linkSets.length;o>a;a++)r=O.call(t.linkSets[a].loads,t),-1!=r&&t.linkSets[a].loads.splice(r,1);t.linkSets.splice(0,t.linkSets.length)}function y(e,t,n){try{var a=t.execute()}catch(o){return void n(t,o)}return a&&a instanceof r?a:void n(t,new TypeError("Execution must define a Module instance"))}function b(e,t,n){var r=e._loader.importPromises;return r[t]=n.then(function(e){return r[t]=void 0,e},function(e){throw r[t]=void 0,e})}function w(e,t){var n=e.loader;if(e.loads.length)for(var r=e.loads.concat([]),a=0;ar&&(t=a,r=n));return t}function t(e,t){var n,r=0;for(var a in e)if(t.substr(0,a.length)==a&&(t.length==a.length||"/"==t[a.length])){var o=a.split("/").length;if(r>=o)continue;n=a,r=o}return n}function n(e){var t=e.basePath&&"."!=e.basePath?e.basePath:"";return t&&("./"==t.substr(0,2)&&(t=t.substr(2)),"/"!=t[t.length-1]&&(t+="/")),t}function r(e,t,n,r,o,s,i){var l=!(!i&&-1==o.indexOf("#?")&&!o.match(X));!l&&n.modules&&f(n.modules,t,o,function(e,t,n){(0==n||e.lastIndexOf("*")!=e.length-1)&&(l=!0)});var u=t+"/"+r+o+(l?"":a(n,o));return s?u:k.call(e,u,t+"/").then(function(n){return E.call(e,n,t+"/")})}function a(e,t){if("/"!=t[t.length-1]&&e.defaultExtension!==!1){var n="."+(e.defaultExtension||"js");if(t.substr(t.length-n.length)!=n)return n}return""}function o(e,o,s,i,l){function u(e){return"."==e?o:"./"==e.substr(0,2)?r(d,o,s,c,e.substr(2),i,l):(i?d.normalizeSync:d.normalize).call(d,e)}var d=this,c=n(s);if(o===e&&s.main&&(e+="/"+("./"==s.main.substr(0,2)?s.main.substr(2):s.main)),e.length==o.length+1&&"/"==e[o.length])return e;if(e.length==o.length)return e+(d.defaultJSExtensions&&".js"!=e.substr(e.length-3,3)?".js":"");if(s.map)var f="."+e.substr(o.length),m=t(s.map,f)||!l&&t(s.map,f+=a(s,f.substr(2))),p=s.map[m];return"string"==typeof p?u(p+f.substr(m.length)):i||!p?r(d,o,s,c,e.substr(o.length+1),i,l):d.builder?o+"#:"+m.substr(2):d["import"](s.map["@env"]||"@system-env",o).then(function(e){for(var t in p){var n="~"==t[0],r=v(n?t.substr(1):t,e);if(!n&&r||n&&!r)return p[t]+f.substr(m.length)}}).then(function(t){return t?u(t):r(d,o,s,c,e.substr(o.length+1),i,l)})}function s(r,a){return function(s,l,d){function c(t,n,r){n=n||e.call(b,t);var r=r||n&&b.packages[n];return r?o.call(b,t,n,r,a,d):t+(v?".js":"")}if(d=d===!0,l)var f=e.call(this,l)||this.defaultJSExtensions&&".js"==l.substr(l.length-3,3)&&e.call(this,l.substr(0,l.length-3));if(f){var p=n(this.packages[f]);if(p&&l.substr(f.length+1,p.length)==p&&(l=f+l.substr(f.length+p.length)),"."!==s[0]){var h=this.packages[f].map;if(h){var g=t(h,s);g&&(s=h[g]+s.substr(g.length),"."===s[0]&&(l=f+"/"))}}}var v=this.defaultJSExtensions&&".js"!=s.substr(s.length-3,3),y=r.call(this,s,l);v&&".js"!=y.substr(y.length-3,3)&&(v=!1),v&&(y=y.substr(0,y.length-3)),f&&"."==s[0]&&y==f+"/"&&(y=f);var b=this;if(a)return c(y);var w=e.call(this,y),x=w&&this.packages[w];if(x&&x.configured)return c(y,w,x);var S=i(b,y);return S.pkgName?Promise.resolve(_(b,y)).then(function(e){if(e||m[S.pkgName]){var t=m[S.pkgName]=m[S.pkgName]||{bundles:[],promise:Promise.resolve()};return e&&-1==O.call(t.bundles,e)&&(t.bundles.push(e),t.promise=Promise.all([t.promise,b.load(e)])),t.promise}}).then(function(){return c(y,S.pkgName)}).then(function(e){return e in b.defined?e:u(b,S).then(function(){return c(y)})}):c(y,w,x)}}function i(e,t){for(var n,r=[],a=0;ap&&(p=n),h(m,t,n&&p>n)}),m.alias&&"./"==m.alias.substr(0,2)&&(m.alias=o+m.alias.substr(1)),m.loader&&"./"==m.loader.substr(0,2)&&(m.loader=o+m.loader.substr(1)),h(r.metadata,m)}}return t})}})}(),function(){function t(){if(o&&"interactive"===o.script.readyState)return o.load;for(var e=0;ea;a++){var s=e.normalizedDeps[a],i=n.defined[s];if(i&&!i.evaluated){var l=e.groupIndex+(i.declarative!=e.declarative);if(null===i.groupIndex||i.groupIndex=0;l--){for(var u=a[l],d=0;dr;r++){var o=s.importers[r];if(!o.locked){var l=O.call(o.dependencies,s);o.setters[l](i)}}return s.locked=!1,t});if(s.setters=l.setters,s.execute=l.execute,!s.setters||!s.execute)throw new TypeError("Invalid System.register form for "+t.name);for(var u=0,d=t.normalizedDeps.length;d>u;u++){var c,f=t.normalizedDeps[u],m=n.defined[f],p=r[f];p?c=p.exports:m&&!m.declarative?c=m.esModule:m?(o(m,n),p=m.module,c=p.exports):c=n.get(f),p&&p.importers?(p.importers.push(s),s.dependencies.push(p)):s.dependencies.push(null);for(var h=t.originalIndices[u],g=0,v=h.length;v>g;++g){var y=h[g];s.setters[y]&&s.setters[y](c)}}}}function s(e,t){var n,r=t.defined[e];if(r)r.declarative?u(e,[],t):r.evaluated||i(r,t),n=r.module.exports;else if(n=t.get(e),!n)throw new Error("Unable to load dependency "+e+".");return(!r||r.declarative)&&n&&n.__useDefault?n["default"]:n}function i(t,n){if(!t.module){var r={},a=t.module={exports:r,id:t.name};if(!t.executingRequire)for(var o=0,l=t.normalizedDeps.length;l>o;o++){var u=t.normalizedDeps[o],d=n.defined[u];d&&i(d,n)}t.evaluated=!0;var c=t.execute.call(e,function(e){for(var r=0,a=t.deps.length;a>r;r++)if(t.deps[r]==e)return s(t.normalizedDeps[r],n);throw new Error("Module "+e+" not declared as a dependency.")},r,a);c&&(a.exports=c),r=a.exports,r&&r.__esModule?t.esModule=r:t.esmExports&&r!==e?t.esModule=m(r):t.esModule={"default":r}}}function u(t,n,r){var a=r.defined[t];if(a&&!a.evaluated&&a.declarative){n.push(t);for(var o=0,s=a.normalizedDeps.length;s>o;o++){var i=a.normalizedDeps[o];
5 | -1==O.call(n,i)&&(r.defined[i]?u(i,n,r):r.get(i))}a.evaluated||(a.evaluated=!0,a.module.execute.call(e))}}function p(e){var t=e.match(h);return t&&"System.register"==e.substr(t[0].length,15)}l.prototype.register=function(e,t,n){if("string"!=typeof e&&(n=t,t=e,e=null),"boolean"==typeof n)return this.registerDynamic.apply(this,arguments);var r=b();r.name=e&&(this.normalizeSync||this.normalize).call(this,e),r.declarative=!0,r.deps=t,r.declare=n,this.pushRegister_({amd:!1,entry:r})},l.prototype.registerDynamic=function(e,t,n,r){"string"!=typeof e&&(r=n,n=t,t=e,e=null);var a=b();a.name=e&&(this.normalizeSync||this.normalize).call(this,e),a.deps=t,a.execute=r,a.executingRequire=n,this.pushRegister_({amd:!1,entry:a})},d("reduceRegister_",function(){return function(e,t){if(t){var n=t.entry,r=e&&e.metadata;if(n.name&&(n.name in this.defined||(this.defined[n.name]=n),r&&(r.bundle=!0)),!n.name||e&&n.name==e.name){if(!r)throw new TypeError("Unexpected anonymous System.register call.");if(r.entry)throw"register"==r.format?new Error("Multiple anonymous System.register calls in module "+e.name+". If loading a bundle, ensure all the System.register calls are named."):new Error("Module "+e.name+" interpreted as "+r.format+" module format, but called System.register.");r.format||(r.format="register"),r.entry=n}}}}),c(function(e){return function(){e.call(this),this.defined={},this._loader.moduleRecords={}}}),M(r,"toString",{value:function(){return"Module"}}),d("delete",function(e){return function(t){return delete this._loader.moduleRecords[t],delete this.defined[t],e.call(this,t)}});var h=/^\s*(\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)*\s*/;d("fetch",function(e){return function(t){return this.defined[t.name]?(t.metadata.format="defined",""):("register"!=t.metadata.format||t.metadata.authorization||t.metadata.scriptLoad===!1||(t.metadata.scriptLoad=!0),t.metadata.deps=t.metadata.deps||[],e.call(this,t))}}),d("translate",function(e){return function(t){return t.metadata.deps=t.metadata.deps||[],Promise.resolve(e.call(this,t)).then(function(e){return("register"==t.metadata.format||!t.metadata.format&&p(t.source))&&(t.metadata.format="register"),e})}}),d("instantiate",function(e){return function(e){var t,r=this;if(r.defined[e.name])t=r.defined[e.name],t.deps=t.deps.concat(e.metadata.deps);else if(e.metadata.entry)t=e.metadata.entry,t.deps=t.deps.concat(e.metadata.deps);else if(!(r.builder&&e.metadata.bundle||"register"!=e.metadata.format&&"esm"!=e.metadata.format&&"es6"!=e.metadata.format)){if("undefined"!=typeof U&&U.call(r,e),!e.metadata.entry&&!e.metadata.bundle)throw new Error(e.name+" detected as "+e.metadata.format+" but didn't execute.");t=e.metadata.entry,t&&e.metadata.deps&&(t.deps=t.deps.concat(e.metadata.deps))}t||(t=b(),t.deps=e.metadata.deps,t.execute=function(){}),r.defined[e.name]=t;var a=f(t.deps);t.deps=a.names,t.originalIndices=a.indices,t.name=e.name,t.esmExports=e.metadata.esmExports!==!1;for(var o=[],s=0,i=t.deps.length;i>s;s++)o.push(Promise.resolve(r.normalize(t.deps[s],e.name)));return Promise.all(o).then(function(a){return t.normalizedDeps=a,{deps:t.deps,execute:function(){return n(e.name,r),u(e.name,[],r),r.defined[e.name]=void 0,r.newModule(t.declarative?t.module.exports:t.esModule)}}})}})}(),function(){var t=/(^\s*|[}\);\n]\s*)(import\s+(['"]|(\*\s+as\s+)?[^"'\(\)\n;]+\s+from\s+['"]|\{)|export\s+\*\s+from\s+["']|export\s+(\{|default|function|class|var|const|let|async\s+function))/,n=/\$traceurRuntime\s*\./,r=/babelHelpers\s*\./;d("translate",function(a){return function(o){var s=this;return a.call(s,o).then(function(a){if("esm"==o.metadata.format||"es6"==o.metadata.format||!o.metadata.format&&a.match(t)){if("es6"==o.metadata.format&&g.call(s,"Module "+o.name+' has metadata setting its format to "es6", which is deprecated.\nThis should be updated to "esm".'),o.metadata.format="esm",s.transpiler===!1)throw new TypeError("Unable to dynamically transpile ES module as System.transpiler set to false.");return s.loadedTranspiler_=s.loadedTranspiler_||!1,s.pluginLoader&&(s.pluginLoader.loadedTranspiler_=s.loadedTranspiler_||!1),s.builder&&(o.metadata.originalSource=o.source),C.call(s,o).then(function(e){return o.metadata.sourceMap=void 0,e})}if(s.loadedTranspiler_===!1&&o.name==s.normalizeSync(s.transpiler)&&(g.call(s,"Note that internal transpilation via System.transpiler has been deprecated for transpiler plugins."),a.length>100&&(o.metadata.format=o.metadata.format||"global","traceur"===s.transpiler&&(o.metadata.exports="traceur"),"typescript"===s.transpiler&&(o.metadata.exports="ts")),s.loadedTranspiler_=!0),s.loadedTranspilerRuntime_===!1&&(o.name==s.normalizeSync("traceur-runtime")||o.name==s.normalizeSync("babel/external-helpers*"))&&(a.length>100&&(o.metadata.format=o.metadata.format||"global"),s.loadedTranspilerRuntime_=!0),("register"==o.metadata.format||o.metadata.bundle)&&s.loadedTranspilerRuntime_!==!0){if(!e.$traceurRuntime&&o.source.match(n))return s.loadedTranspilerRuntime_=s.loadedTranspilerRuntime_||!1,s["import"]("traceur-runtime").then(function(){return a});if(!e.babelHelpers&&o.source.match(r))return s.loadedTranspilerRuntime_=s.loadedTranspilerRuntime_||!1,s["import"]("babel/external-helpers").then(function(){return a})}return a})}})}();var W="undefined"!=typeof self?"self":"global";d("reduceRegister_",function(t){return function(n,r){if(r)return t.call(this,n,r);n.metadata.format="global";var a=n.metadata.entry=b(),o=v(n.metadata.exports,e);a.execute=function(){return o}}}),d("fetch",function(e){return function(t){return t.metadata.exports&&!t.metadata.format&&(t.metadata.format="global"),"global"!=t.metadata.format||t.metadata.authorization||!t.metadata.exports||t.metadata.globals||t.metadata.deps&&0!=t.metadata.deps.length||t.metadata.scriptLoad===!1||(t.metadata.scriptLoad=!0),e.call(this,t)}}),d("instantiate",function(e){return function(t){var n=this;if(t.metadata.format||(t.metadata.format="global"),t.metadata.globals&&t.metadata.globals instanceof Array){for(var r={},a=0;at.index+(n?0:t[0].length))return!0;return!1}r.lastIndex=a.lastIndex=o.lastIndex=0;var n,s=[],i=[],l=[];if(e.length/e.split("\n").length<200){for(;n=o.exec(e);)i.push([n.index,n.index+n[0].length]);for(;n=a.exec(e);)t(i,n,!0)||l.push([n.index,n.index+n[0].length])}for(;n=r.exec(e);)t(i,n)||t(l,n)||s.push(n[1].substr(1,n[1].length-2));return s}var n=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF.]|module\.)exports\s*(\[['"]|\.)|(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF.])module\.exports\s*[=,]/,r=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF."'])require\s*\(\s*("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')\s*\)/g,a=/(^|[^\\])(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,o=/(?:"[^"\\\n\r]*(?:\\.[^"\\\n\r]*)*"|'[^'\\\n\r]*(?:\\.[^'\\\n\r]*)*')/g;if("undefined"!=typeof window&&"undefined"!=typeof document&&window.location)var s=location.protocol+"//"+location.hostname+(location.port?":"+location.port:"");"undefined"!=typeof require&&require.resolve&&"undefined"!=typeof process&&(l.prototype._nodeRequire=require);var i=["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","vm","zlib"];d("normalize",function(e){return function(t,n){if("@node/"==t.substr(0,6)&&-1!=i.indexOf(t.substr(6))){if(!this._nodeRequire)throw new TypeError("Can only load node core modules in Node.");this.set(t,this.newModule(m(this._nodeRequire(t.substr(6)))))}return e.apply(this,arguments)}}),d("instantiate",function(a){return function(o){var i=this;if(o.metadata.format||(n.lastIndex=0,r.lastIndex=0,(r.exec(o.source)||n.exec(o.source))&&(o.metadata.format="cjs")),"cjs"==o.metadata.format){var l=o.metadata.deps,u=t(o.source);for(var d in o.metadata.globals)u.push(o.metadata.globals[d]);var c=b();o.metadata.entry=c,c.deps=u,c.executingRequire=!0,c.execute=function(t,n,r){for(var a=0;a1;)r=a.shift(),e=e[r]=e[r]||{};r=a.shift(),r in e||(e[r]=n)}c(function(e){return function(){this.meta={},e.call(this)}}),d("locate",function(e){return function(t){var n,r=this.meta,a=t.name,o=0;for(var s in r)if(n=s.indexOf("*"),-1!==n&&s.substr(0,n)===a.substr(0,n)&&s.substr(n+1)===a.substr(a.length-s.length+n+1)){var i=s.split("/").length;i>o&&(o=i),h(t.metadata,r[s],o!=i)}return r[a]&&h(t.metadata,r[a]),e.call(this,t)}});var t=/^(\s*\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)+/,n=/\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\/\/[^\n]*|"[^"]+"\s*;?|'[^']+'\s*;?/g;d("translate",function(r){return function(a){var o=a.source.match(t);if(o)for(var s=o[0].match(n),i=0;i')}else if("undefined"!=typeof importScripts){var o="";try{throw new Error("_")}catch(n){n.stack.replace(/(?:at|@).*(http.+):[\d]+:[\d]+/,function(e,t){o=t.replace(/\/[^\/]*$/,"/")})}importScripts(o+"system-polyfills.js"),e()}else e()}();
6 | //# sourceMappingURL=system.js.map
--------------------------------------------------------------------------------