1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981 |
- /*
- * SystemJS v0.21.6 Production
- */
- (function () {
- 'use strict';
- /*
- * Environment
- */
- var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
- var isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
- var isWindows = typeof process !== 'undefined' && typeof process.platform === 'string' && process.platform.match(/^win/);
- var envGlobal = typeof self !== 'undefined' ? self : global;
- /*
- * Simple Symbol() shim
- */
- var hasSymbol = typeof Symbol !== 'undefined';
- function createSymbol (name) {
- return hasSymbol ? Symbol() : '@@' + name;
- }
- var toStringTag = hasSymbol && Symbol.toStringTag;
- /*
- * Environment baseURI
- */
- var baseURI;
- // environent baseURI detection
- if (typeof document != 'undefined' && document.getElementsByTagName) {
- baseURI = document.baseURI;
- if (!baseURI) {
- var bases = document.getElementsByTagName('base');
- baseURI = bases[0] && bases[0].href || window.location.href;
- }
- }
- else if (typeof location != 'undefined') {
- baseURI = location.href;
- }
- // sanitize out the hash and querystring
- if (baseURI) {
- baseURI = baseURI.split('#')[0].split('?')[0];
- var slashIndex = baseURI.lastIndexOf('/');
- if (slashIndex !== -1)
- baseURI = baseURI.substr(0, slashIndex + 1);
- }
- else if (typeof process !== 'undefined' && process.cwd) {
- baseURI = 'file://' + (isWindows ? '/' : '') + process.cwd();
- if (isWindows)
- baseURI = baseURI.replace(/\\/g, '/');
- }
- else {
- throw new TypeError('No environment baseURI');
- }
- // ensure baseURI has trailing "/"
- if (baseURI[baseURI.length - 1] !== '/')
- baseURI += '/';
- /*
- * LoaderError with chaining for loader stacks
- */
- var errArgs = new Error(0, '_').fileName == '_';
- function LoaderError__Check_error_message_for_loader_stack (childErr, newMessage) {
- // Convert file:/// URLs to paths in Node
- if (!isBrowser)
- newMessage = newMessage.replace(isWindows ? /file:\/\/\//g : /file:\/\//g, '');
- var message = (childErr.message || childErr) + '\n ' + newMessage;
- var err;
- if (errArgs && childErr.fileName)
- err = new Error(message, childErr.fileName, childErr.lineNumber);
- else
- err = new Error(message);
- var stack = childErr.originalErr ? childErr.originalErr.stack : childErr.stack;
- if (isNode)
- // node doesn't show the message otherwise
- err.stack = message + '\n ' + stack;
- else
- err.stack = stack;
- err.originalErr = childErr.originalErr || childErr;
- return err;
- }
- /*
- * Optimized URL normalization assuming a syntax-valid URL parent
- */
- function throwResolveError (relUrl, parentUrl) {
- throw new RangeError('Unable to resolve "' + relUrl + '" to ' + parentUrl);
- }
- var backslashRegEx = /\\/g;
- function resolveIfNotPlain (relUrl, parentUrl) {
- if (relUrl[0] === ' ' || relUrl[relUrl.length - 1] === ' ')
- relUrl = relUrl.trim();
- var parentProtocol = parentUrl && parentUrl.substr(0, parentUrl.indexOf(':') + 1);
- var firstChar = relUrl[0];
- var secondChar = relUrl[1];
- // protocol-relative
- if (firstChar === '/' && secondChar === '/') {
- if (!parentProtocol)
- throwResolveError(relUrl, parentUrl);
- if (relUrl.indexOf('\\') !== -1)
- relUrl = relUrl.replace(backslashRegEx, '/');
- return parentProtocol + relUrl;
- }
- // relative-url
- else if (firstChar === '.' && (secondChar === '/' || secondChar === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
- relUrl.length === 1 && (relUrl += '/')) ||
- firstChar === '/') {
- if (relUrl.indexOf('\\') !== -1)
- relUrl = relUrl.replace(backslashRegEx, '/');
- var parentIsPlain = !parentProtocol || parentUrl[parentProtocol.length] !== '/';
- // read pathname from parent if a URL
- // pathname taken to be part after leading "/"
- var pathname;
- if (parentIsPlain) {
- // resolving to a plain parent -> skip standard URL prefix, and treat entire parent as pathname
- if (parentUrl === undefined)
- throwResolveError(relUrl, parentUrl);
- pathname = parentUrl;
- }
- else if (parentUrl[parentProtocol.length + 1] === '/') {
- // resolving to a :// so we need to read out the auth and host
- if (parentProtocol !== 'file:') {
- pathname = parentUrl.substr(parentProtocol.length + 2);
- pathname = pathname.substr(pathname.indexOf('/') + 1);
- }
- else {
- pathname = parentUrl.substr(8);
- }
- }
- else {
- // resolving to :/ so pathname is the /... part
- pathname = parentUrl.substr(parentProtocol.length + 1);
- }
- if (firstChar === '/') {
- if (parentIsPlain)
- throwResolveError(relUrl, parentUrl);
- else
- return parentUrl.substr(0, parentUrl.length - pathname.length - 1) + relUrl;
- }
- // join together and split for removal of .. and . segments
- // looping the string instead of anything fancy for perf reasons
- // '../../../../../z' resolved to 'x/y' is just 'z' regardless of parentIsPlain
- var segmented = pathname.substr(0, pathname.lastIndexOf('/') + 1) + relUrl;
- var output = [];
- var segmentIndex = -1;
- for (var i = 0; i < segmented.length; i++) {
- // busy reading a segment - only terminate on '/'
- if (segmentIndex !== -1) {
- if (segmented[i] === '/') {
- output.push(segmented.substring(segmentIndex, i + 1));
- segmentIndex = -1;
- }
- continue;
- }
- // new segment - check if it is relative
- if (segmented[i] === '.') {
- // ../ segment
- if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
- output.pop();
- i += 2;
- }
- // ./ segment
- else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
- i += 1;
- }
- else {
- // the start of a new segment as below
- segmentIndex = i;
- continue;
- }
- // this is the plain URI backtracking error (../, package:x -> error)
- if (parentIsPlain && output.length === 0)
- throwResolveError(relUrl, parentUrl);
- continue;
- }
- // it is the start of a new segment
- segmentIndex = i;
- }
- // finish reading out the last segment
- if (segmentIndex !== -1)
- output.push(segmented.substr(segmentIndex));
- return parentUrl.substr(0, parentUrl.length - pathname.length) + output.join('');
- }
- // sanitizes and verifies (by returning undefined if not a valid URL-like form)
- // Windows filepath compatibility is an added convenience here
- var protocolIndex = relUrl.indexOf(':');
- if (protocolIndex !== -1) {
- if (isNode) {
- // C:\x becomes file:///c:/x (we don't support C|\x)
- if (relUrl[1] === ':' && relUrl[2] === '\\' && relUrl[0].match(/[a-z]/i))
- return 'file:///' + relUrl.replace(backslashRegEx, '/');
- }
- return relUrl;
- }
- }
- var resolvedPromise = Promise.resolve();
- /*
- * Simple Array values shim
- */
- function arrayValues (arr) {
- if (arr.values)
- return arr.values();
- if (typeof Symbol === 'undefined' || !Symbol.iterator)
- throw new Error('Symbol.iterator not supported in this browser');
- var iterable = {};
- iterable[Symbol.iterator] = function () {
- var keys = Object.keys(arr);
- var keyIndex = 0;
- return {
- next: function () {
- if (keyIndex < keys.length)
- return {
- value: arr[keys[keyIndex++]],
- done: false
- };
- else
- return {
- value: undefined,
- done: true
- };
- }
- };
- };
- return iterable;
- }
- /*
- * 3. Reflect.Loader
- *
- * We skip the entire native internal pipeline, just providing the bare API
- */
- // 3.1.1
- function Loader () {
- this.registry = new Registry();
- }
- // 3.3.1
- Loader.prototype.constructor = Loader;
- function ensureInstantiated (module) {
- if (module === undefined)
- return;
- if (module instanceof ModuleNamespace === false && module[toStringTag] !== 'module')
- throw new TypeError('Module instantiation did not return a valid namespace object.');
- return module;
- }
- // 3.3.2
- Loader.prototype.import = function (key, parent) {
- if (typeof key !== 'string')
- throw new TypeError('Loader import method must be passed a module key string');
- // custom resolveInstantiate combined hook for better perf
- var loader = this;
- return resolvedPromise
- .then(function () {
- return loader[RESOLVE_INSTANTIATE](key, parent);
- })
- .then(ensureInstantiated)
- //.then(Module.evaluate)
- .catch(function (err) {
- throw LoaderError__Check_error_message_for_loader_stack(err, 'Loading ' + key + (parent ? ' from ' + parent : ''));
- });
- };
- // 3.3.3
- var RESOLVE = Loader.resolve = createSymbol('resolve');
- /*
- * Combined resolve / instantiate hook
- *
- * Not in current reduced spec, but necessary to separate RESOLVE from RESOLVE + INSTANTIATE as described
- * in the spec notes of this repo to ensure that loader.resolve doesn't instantiate when not wanted.
- *
- * We implement RESOLVE_INSTANTIATE as a single hook instead of a separate INSTANTIATE in order to avoid
- * the need for double registry lookups as a performance optimization.
- */
- var RESOLVE_INSTANTIATE = Loader.resolveInstantiate = createSymbol('resolveInstantiate');
- // default resolveInstantiate is just to call resolve and then get from the registry
- // this provides compatibility for the resolveInstantiate optimization
- Loader.prototype[RESOLVE_INSTANTIATE] = function (key, parent) {
- var loader = this;
- return loader.resolve(key, parent)
- .then(function (resolved) {
- return loader.registry.get(resolved);
- });
- };
- function ensureResolution (resolvedKey) {
- if (resolvedKey === undefined)
- throw new RangeError('No resolution found.');
- return resolvedKey;
- }
- Loader.prototype.resolve = function (key, parent) {
- var loader = this;
- return resolvedPromise
- .then(function() {
- return loader[RESOLVE](key, parent);
- })
- .then(ensureResolution)
- .catch(function (err) {
- throw LoaderError__Check_error_message_for_loader_stack(err, 'Resolving ' + key + (parent ? ' to ' + parent : ''));
- });
- };
- // 3.3.4 (import without evaluate)
- // this is not documented because the use of deferred evaluation as in Module.evaluate is not
- // documented, as it is not considered a stable feature to be encouraged
- // Loader.prototype.load may well be deprecated if this stays disabled
- /* Loader.prototype.load = function (key, parent) {
- return Promise.resolve(this[RESOLVE_INSTANTIATE](key, parent || this.key))
- .catch(function (err) {
- throw addToError(err, 'Loading ' + key + (parent ? ' from ' + parent : ''));
- });
- }; */
- /*
- * 4. Registry
- *
- * Instead of structuring through a Map, just use a dictionary object
- * We throw for construction attempts so this doesn't affect the public API
- *
- * Registry has been adjusted to use Namespace objects over ModuleStatus objects
- * as part of simplifying loader API implementation
- */
- var iteratorSupport = typeof Symbol !== 'undefined' && Symbol.iterator;
- var REGISTRY = createSymbol('registry');
- function Registry() {
- this[REGISTRY] = {};
- }
- // 4.4.1
- if (iteratorSupport) {
- // 4.4.2
- Registry.prototype[Symbol.iterator] = function () {
- return this.entries()[Symbol.iterator]();
- };
- // 4.4.3
- Registry.prototype.entries = function () {
- var registry = this[REGISTRY];
- return arrayValues(Object.keys(registry).map(function (key) {
- return [key, registry[key]];
- }));
- };
- }
- // 4.4.4
- Registry.prototype.keys = function () {
- return arrayValues(Object.keys(this[REGISTRY]));
- };
- // 4.4.5
- Registry.prototype.values = function () {
- var registry = this[REGISTRY];
- return arrayValues(Object.keys(registry).map(function (key) {
- return registry[key];
- }));
- };
- // 4.4.6
- Registry.prototype.get = function (key) {
- return this[REGISTRY][key];
- };
- // 4.4.7
- Registry.prototype.set = function (key, namespace) {
- if (!(namespace instanceof ModuleNamespace || namespace[toStringTag] === 'module'))
- throw new Error('Registry must be set with an instance of Module Namespace');
- this[REGISTRY][key] = namespace;
- return this;
- };
- // 4.4.8
- Registry.prototype.has = function (key) {
- return Object.hasOwnProperty.call(this[REGISTRY], key);
- };
- // 4.4.9
- Registry.prototype.delete = function (key) {
- if (Object.hasOwnProperty.call(this[REGISTRY], key)) {
- delete this[REGISTRY][key];
- return true;
- }
- return false;
- };
- /*
- * Simple ModuleNamespace Exotic object based on a baseObject
- * We export this for allowing a fast-path for module namespace creation over Module descriptors
- */
- // var EVALUATE = createSymbol('evaluate');
- var BASE_OBJECT = createSymbol('baseObject');
- // 8.3.1 Reflect.Module
- /*
- * Best-effort simplified non-spec implementation based on
- * a baseObject referenced via getters.
- *
- * Allows:
- *
- * loader.registry.set('x', new Module({ default: 'x' }));
- *
- * Optional evaluation function provides experimental Module.evaluate
- * support for non-executed modules in registry.
- */
- function ModuleNamespace (baseObject/*, evaluate*/) {
- Object.defineProperty(this, BASE_OBJECT, {
- value: baseObject
- });
- // evaluate defers namespace population
- /* if (evaluate) {
- Object.defineProperty(this, EVALUATE, {
- value: evaluate,
- configurable: true,
- writable: true
- });
- }
- else { */
- Object.keys(baseObject).forEach(extendNamespace, this);
- //}
- }// 8.4.2
- ModuleNamespace.prototype = Object.create(null);
- if (toStringTag)
- Object.defineProperty(ModuleNamespace.prototype, toStringTag, {
- value: 'Module'
- });
- function extendNamespace (key) {
- Object.defineProperty(this, key, {
- enumerable: true,
- get: function () {
- return this[BASE_OBJECT][key];
- }
- });
- }
- /* function doEvaluate (evaluate, context) {
- try {
- evaluate.call(context);
- }
- catch (e) {
- return e;
- }
- }
- // 8.4.1 Module.evaluate... not documented or used because this is potentially unstable
- Module.evaluate = function (ns) {
- var evaluate = ns[EVALUATE];
- if (evaluate) {
- ns[EVALUATE] = undefined;
- var err = doEvaluate(evaluate);
- if (err) {
- // cache the error
- ns[EVALUATE] = function () {
- throw err;
- };
- throw err;
- }
- Object.keys(ns[BASE_OBJECT]).forEach(extendNamespace, ns);
- }
- // make chainable
- return ns;
- }; */
- var resolvedPromise$1 = Promise.resolve();
- /*
- * Register Loader
- *
- * Builds directly on top of loader polyfill to provide:
- * - loader.register support
- * - hookable higher-level resolve
- * - instantiate hook returning a ModuleNamespace or undefined for es module loading
- * - loader error behaviour as in HTML and loader specs, caching load and eval errors separately
- * - build tracing support by providing a .trace=true and .loads object format
- */
- var REGISTER_INTERNAL = createSymbol('register-internal');
- function RegisterLoader () {
- Loader.call(this);
- var registryDelete = this.registry.delete;
- this.registry.delete = function (key) {
- var deleted = registryDelete.call(this, key);
- // also delete from register registry if linked
- if (records.hasOwnProperty(key) && !records[key].linkRecord) {
- delete records[key];
- deleted = true;
- }
- return deleted;
- };
- var records = {};
- this[REGISTER_INTERNAL] = {
- // last anonymous System.register call
- lastRegister: undefined,
- // in-flight es module load records
- records: records
- };
- // tracing
- this.trace = false;
- }
- RegisterLoader.prototype = Object.create(Loader.prototype);
- RegisterLoader.prototype.constructor = RegisterLoader;
- var INSTANTIATE = RegisterLoader.instantiate = createSymbol('instantiate');
- // default normalize is the WhatWG style normalizer
- RegisterLoader.prototype[RegisterLoader.resolve = Loader.resolve] = function (key, parentKey) {
- return resolveIfNotPlain(key, parentKey || baseURI);
- };
- RegisterLoader.prototype[INSTANTIATE] = function (key, processAnonRegister) {};
- // once evaluated, the linkRecord is set to undefined leaving just the other load record properties
- // this allows tracking new binding listeners for es modules through importerSetters
- // for dynamic modules, the load record is removed entirely.
- function createLoadRecord (state, key, registration) {
- return state.records[key] = {
- key: key,
- // defined System.register cache
- registration: registration,
- // module namespace object
- module: undefined,
- // es-only
- // this sticks around so new module loads can listen to binding changes
- // for already-loaded modules by adding themselves to their importerSetters
- importerSetters: undefined,
- loadError: undefined,
- evalError: undefined,
- // in-flight linking record
- linkRecord: {
- // promise for instantiated
- instantiatePromise: undefined,
- dependencies: undefined,
- execute: undefined,
- executingRequire: false,
- // underlying module object bindings
- moduleObj: undefined,
- // es only, also indicates if es or not
- setters: undefined,
- // promise for instantiated dependencies (dependencyInstantiations populated)
- depsInstantiatePromise: undefined,
- // will be the array of dependency load record or a module namespace
- dependencyInstantiations: undefined,
- // top-level await!
- evaluatePromise: undefined,
- // NB optimization and way of ensuring module objects in setters
- // indicates setters which should run pre-execution of that dependency
- // setters is then just for completely executed module objects
- // alternatively we just pass the partially filled module objects as
- // arguments into the execute function
- // hoisted: undefined
- }
- };
- }
- RegisterLoader.prototype[Loader.resolveInstantiate] = function (key, parentKey) {
- var loader = this;
- var state = this[REGISTER_INTERNAL];
- var registry = this.registry[REGISTRY];
- return resolveInstantiate(loader, key, parentKey, registry, state)
- .then(function (instantiated) {
- if (instantiated instanceof ModuleNamespace || instantiated[toStringTag] === 'module')
- return instantiated;
- // resolveInstantiate always returns a load record with a link record and no module value
- var link = instantiated.linkRecord;
- // if already beaten to done, return
- if (!link) {
- if (instantiated.module)
- return instantiated.module;
- throw instantiated.evalError;
- }
- return deepInstantiateDeps(loader, instantiated, link, registry, state)
- .then(function () {
- return ensureEvaluate(loader, instantiated, link, registry, state);
- });
- });
- };
- function resolveInstantiate (loader, key, parentKey, registry, state) {
- // normalization shortpath for already-normalized key
- // could add a plain name filter, but doesn't yet seem necessary for perf
- var module = registry[key];
- if (module)
- return Promise.resolve(module);
- var load = state.records[key];
- // already linked but not in main registry is ignored
- if (load && !load.module) {
- if (load.loadError)
- return Promise.reject(load.loadError);
- return instantiate(loader, load, load.linkRecord, registry, state);
- }
- return loader.resolve(key, parentKey)
- .then(function (resolvedKey) {
- // main loader registry always takes preference
- module = registry[resolvedKey];
- if (module)
- return module;
- load = state.records[resolvedKey];
- // already has a module value but not already in the registry (load.module)
- // means it was removed by registry.delete, so we should
- // disgard the current load record creating a new one over it
- // but keep any existing registration
- if (!load || load.module)
- load = createLoadRecord(state, resolvedKey, load && load.registration);
- if (load.loadError)
- return Promise.reject(load.loadError);
- var link = load.linkRecord;
- if (!link)
- return load;
- return instantiate(loader, load, link, registry, state);
- });
- }
- function createProcessAnonRegister (loader, load, state) {
- return function () {
- var lastRegister = state.lastRegister;
- if (!lastRegister)
- return !!load.registration;
- state.lastRegister = undefined;
- load.registration = lastRegister;
- return true;
- };
- }
- function instantiate (loader, load, link, registry, state) {
- return link.instantiatePromise || (link.instantiatePromise =
- // if there is already an existing registration, skip running instantiate
- (load.registration ? resolvedPromise$1 : resolvedPromise$1.then(function () {
- state.lastRegister = undefined;
- return loader[INSTANTIATE](load.key, loader[INSTANTIATE].length > 1 && createProcessAnonRegister(loader, load, state));
- }))
- .then(function (instantiation) {
- // direct module return from instantiate -> we're done
- if (instantiation !== undefined) {
- if (!(instantiation instanceof ModuleNamespace || instantiation[toStringTag] === 'module'))
- throw new TypeError('Instantiate did not return a valid Module object.');
- delete state.records[load.key];
- if (loader.trace)
- traceLoad(loader, load, link);
- return registry[load.key] = instantiation;
- }
- // run the cached loader.register declaration if there is one
- var registration = load.registration;
- // clear to allow new registrations for future loads (combined with registry delete)
- load.registration = undefined;
- if (!registration)
- throw new TypeError('Module instantiation did not call an anonymous or correctly named System.register.');
- link.dependencies = registration[0];
- load.importerSetters = [];
- link.moduleObj = {};
- // process System.registerDynamic declaration
- if (registration[2]) {
- link.moduleObj.default = link.moduleObj.__useDefault = {};
- link.executingRequire = registration[1];
- link.execute = registration[2];
- }
- // process System.register declaration
- else {
- registerDeclarative(loader, load, link, registration[1]);
- }
- return load;
- })
- .catch(function (err) {
- load.linkRecord = undefined;
- throw load.loadError = load.loadError || LoaderError__Check_error_message_for_loader_stack(err, 'Instantiating ' + load.key);
- }));
- }
- // like resolveInstantiate, but returning load records for linking
- function resolveInstantiateDep (loader, key, parentKey, registry, state, traceDepMap) {
- // normalization shortpaths for already-normalized key
- // DISABLED to prioritise consistent resolver calls
- // could add a plain name filter, but doesn't yet seem necessary for perf
- /* var load = state.records[key];
- var module = registry[key];
- if (module) {
- if (traceDepMap)
- traceDepMap[key] = key;
- // registry authority check in case module was deleted or replaced in main registry
- if (load && load.module && load.module === module)
- return load;
- else
- return module;
- }
- // already linked but not in main registry is ignored
- if (load && !load.module) {
- if (traceDepMap)
- traceDepMap[key] = key;
- return instantiate(loader, load, load.linkRecord, registry, state);
- } */
- return loader.resolve(key, parentKey)
- .then(function (resolvedKey) {
- if (traceDepMap)
- traceDepMap[key] = resolvedKey;
- // normalization shortpaths for already-normalized key
- var load = state.records[resolvedKey];
- var module = registry[resolvedKey];
- // main loader registry always takes preference
- if (module && (!load || load.module && module !== load.module))
- return module;
- if (load && load.loadError)
- throw load.loadError;
- // already has a module value but not already in the registry (load.module)
- // means it was removed by registry.delete, so we should
- // disgard the current load record creating a new one over it
- // but keep any existing registration
- if (!load || !module && load.module)
- load = createLoadRecord(state, resolvedKey, load && load.registration);
- var link = load.linkRecord;
- if (!link)
- return load;
- return instantiate(loader, load, link, registry, state);
- });
- }
- function traceLoad (loader, load, link) {
- loader.loads = loader.loads || {};
- loader.loads[load.key] = {
- key: load.key,
- deps: link.dependencies,
- dynamicDeps: [],
- depMap: link.depMap || {}
- };
- }
- /*
- * Convert a CJS module.exports into a valid object for new Module:
- *
- * new Module(getEsModule(module.exports))
- *
- * Sets the default value to the module, while also reading off named exports carefully.
- */
- function registerDeclarative (loader, load, link, declare) {
- var moduleObj = link.moduleObj;
- var importerSetters = load.importerSetters;
- var definedExports = false;
- // closure especially not based on link to allow link record disposal
- var declared = declare.call(envGlobal, function (name, value) {
- if (typeof name === 'object') {
- var changed = false;
- for (var p in name) {
- value = name[p];
- if (p !== '__useDefault' && (!(p in moduleObj) || moduleObj[p] !== value)) {
- changed = true;
- moduleObj[p] = value;
- }
- }
- if (changed === false)
- return value;
- }
- else {
- if ((definedExports || name in moduleObj) && moduleObj[name] === value)
- return value;
- moduleObj[name] = value;
- }
- for (var i = 0; i < importerSetters.length; i++)
- importerSetters[i](moduleObj);
- return value;
- }, new ContextualLoader(loader, load.key));
- link.setters = declared.setters || [];
- link.execute = declared.execute;
- if (declared.exports) {
- link.moduleObj = moduleObj = declared.exports;
- definedExports = true;
- }
- }
- function instantiateDeps (loader, load, link, registry, state) {
- if (link.depsInstantiatePromise)
- return link.depsInstantiatePromise;
- var depsInstantiatePromises = Array(link.dependencies.length);
- for (var i = 0; i < link.dependencies.length; i++)
- depsInstantiatePromises[i] = resolveInstantiateDep(loader, link.dependencies[i], load.key, registry, state, loader.trace && link.depMap || (link.depMap = {}));
- var depsInstantiatePromise = Promise.all(depsInstantiatePromises)
- .then(function (dependencyInstantiations) {
- link.dependencyInstantiations = dependencyInstantiations;
- // run setters to set up bindings to instantiated dependencies
- if (link.setters) {
- for (var i = 0; i < dependencyInstantiations.length; i++) {
- var setter = link.setters[i];
- if (setter) {
- var instantiation = dependencyInstantiations[i];
- if (instantiation instanceof ModuleNamespace || instantiation[toStringTag] === 'module') {
- setter(instantiation);
- }
- else {
- if (instantiation.loadError)
- throw instantiation.loadError;
- setter(instantiation.module || instantiation.linkRecord.moduleObj);
- // this applies to both es and dynamic registrations
- if (instantiation.importerSetters)
- instantiation.importerSetters.push(setter);
- }
- }
- }
- }
- return load;
- });
- if (loader.trace)
- depsInstantiatePromise = depsInstantiatePromise.then(function () {
- traceLoad(loader, load, link);
- return load;
- });
- depsInstantiatePromise = depsInstantiatePromise.catch(function (err) {
- // throw up the instantiateDeps stack
- link.depsInstantiatePromise = undefined;
- throw LoaderError__Check_error_message_for_loader_stack(err, 'Loading ' + load.key);
- });
- depsInstantiatePromise.catch(function () {});
- return link.depsInstantiatePromise = depsInstantiatePromise;
- }
- function deepInstantiateDeps (loader, load, link, registry, state) {
- var seen = [];
- function addDeps (load, link) {
- if (!link)
- return resolvedPromise$1;
- if (seen.indexOf(load) !== -1)
- return resolvedPromise$1;
- seen.push(load);
-
- return instantiateDeps(loader, load, link, registry, state)
- .then(function () {
- var depPromises;
- for (var i = 0; i < link.dependencies.length; i++) {
- var depLoad = link.dependencyInstantiations[i];
- if (!(depLoad instanceof ModuleNamespace || depLoad[toStringTag] === 'module')) {
- depPromises = depPromises || [];
- depPromises.push(addDeps(depLoad, depLoad.linkRecord));
- }
- }
- if (depPromises)
- return Promise.all(depPromises);
- });
- }
- return addDeps(load, link);
- }
- /*
- * System.register
- */
- RegisterLoader.prototype.register = function (key, deps, declare) {
- var state = this[REGISTER_INTERNAL];
- // anonymous modules get stored as lastAnon
- if (declare === undefined) {
- state.lastRegister = [key, deps, undefined];
- }
- // everything else registers into the register cache
- else {
- var load = state.records[key] || createLoadRecord(state, key, undefined);
- load.registration = [deps, declare, undefined];
- }
- };
- /*
- * System.registerDyanmic
- */
- RegisterLoader.prototype.registerDynamic = function (key, deps, executingRequire, execute) {
- var state = this[REGISTER_INTERNAL];
- // anonymous modules get stored as lastAnon
- if (typeof key !== 'string') {
- state.lastRegister = [key, deps, executingRequire];
- }
- // everything else registers into the register cache
- else {
- var load = state.records[key] || createLoadRecord(state, key, undefined);
- load.registration = [deps, executingRequire, execute];
- }
- };
- // ContextualLoader class
- // backwards-compatible with previous System.register context argument by exposing .id, .key
- function ContextualLoader (loader, key) {
- this.loader = loader;
- this.key = this.id = key;
- this.meta = {
- url: key
- // scriptElement: null
- };
- }
- /*ContextualLoader.prototype.constructor = function () {
- throw new TypeError('Cannot subclass the contextual loader only Reflect.Loader.');
- };*/
- ContextualLoader.prototype.import = function (key) {
- if (this.loader.trace)
- this.loader.loads[this.key].dynamicDeps.push(key);
- return this.loader.import(key, this.key);
- };
- /*ContextualLoader.prototype.resolve = function (key) {
- return this.loader.resolve(key, this.key);
- };*/
- function ensureEvaluate (loader, load, link, registry, state) {
- if (load.module)
- return load.module;
- if (load.evalError)
- throw load.evalError;
- if (link.evaluatePromise)
- return link.evaluatePromise;
- if (link.setters) {
- var evaluatePromise = doEvaluateDeclarative(loader, load, link, registry, state, [load]);
- if (evaluatePromise)
- return evaluatePromise;
- }
- else {
- doEvaluateDynamic(loader, load, link, registry, state, [load]);
- }
- return load.module;
- }
- function makeDynamicRequire (loader, key, dependencies, dependencyInstantiations, registry, state, seen) {
- // we can only require from already-known dependencies
- return function (name) {
- for (var i = 0; i < dependencies.length; i++) {
- if (dependencies[i] === name) {
- var depLoad = dependencyInstantiations[i];
- var module;
- if (depLoad instanceof ModuleNamespace || depLoad[toStringTag] === 'module') {
- module = depLoad;
- }
- else {
- if (depLoad.evalError)
- throw depLoad.evalError;
- if (depLoad.module === undefined && seen.indexOf(depLoad) === -1 && !depLoad.linkRecord.evaluatePromise) {
- if (depLoad.linkRecord.setters) {
- doEvaluateDeclarative(loader, depLoad, depLoad.linkRecord, registry, state, [depLoad]);
- }
- else {
- seen.push(depLoad);
- doEvaluateDynamic(loader, depLoad, depLoad.linkRecord, registry, state, seen);
- }
- }
- module = depLoad.module || depLoad.linkRecord.moduleObj;
- }
- return '__useDefault' in module ? module.__useDefault : module;
- }
- }
- throw new Error('Module ' + name + ' not declared as a System.registerDynamic dependency of ' + key);
- };
- }
- function evalError (load, err) {
- load.linkRecord = undefined;
- var evalError = LoaderError__Check_error_message_for_loader_stack(err, 'Evaluating ' + load.key);
- if (load.evalError === undefined)
- load.evalError = evalError;
- throw evalError;
- }
- // es modules evaluate dependencies first
- // returns the error if any
- function doEvaluateDeclarative (loader, load, link, registry, state, seen) {
- var depLoad, depLink;
- var depLoadPromises;
- for (var i = 0; i < link.dependencies.length; i++) {
- var depLoad = link.dependencyInstantiations[i];
- if (depLoad instanceof ModuleNamespace || depLoad[toStringTag] === 'module')
- continue;
- // custom Module returned from instantiate
- depLink = depLoad.linkRecord;
- if (depLink) {
- if (depLoad.evalError) {
- evalError(load, depLoad.evalError);
- }
- else if (depLink.setters) {
- if (seen.indexOf(depLoad) === -1) {
- seen.push(depLoad);
- try {
- var depLoadPromise = doEvaluateDeclarative(loader, depLoad, depLink, registry, state, seen);
- }
- catch (e) {
- evalError(load, e);
- }
- if (depLoadPromise) {
- depLoadPromises = depLoadPromises || [];
- depLoadPromises.push(depLoadPromise.catch(function (err) {
- evalError(load, err);
- }));
- }
- }
- }
- else {
- try {
- doEvaluateDynamic(loader, depLoad, depLink, registry, state, [depLoad]);
- }
- catch (e) {
- evalError(load, e);
- }
- }
- }
- }
- if (depLoadPromises)
- return link.evaluatePromise = Promise.all(depLoadPromises)
- .then(function () {
- if (link.execute) {
- // ES System.register execute
- // "this" is null in ES
- try {
- var execPromise = link.execute.call(nullContext);
- }
- catch (e) {
- evalError(load, e);
- }
- if (execPromise)
- return execPromise.catch(function (e) {
- evalError(load, e);
- })
- .then(function () {
- load.linkRecord = undefined;
- return registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
- });
- }
-
- // dispose link record
- load.linkRecord = undefined;
- registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
- });
- if (link.execute) {
- // ES System.register execute
- // "this" is null in ES
- try {
- var execPromise = link.execute.call(nullContext);
- }
- catch (e) {
- evalError(load, e);
- }
- if (execPromise)
- return link.evaluatePromise = execPromise.catch(function (e) {
- evalError(load, e);
- })
- .then(function () {
- load.linkRecord = undefined;
- return registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
- });
- }
- // dispose link record
- load.linkRecord = undefined;
- registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
- }
- // non es modules explicitly call moduleEvaluate through require
- function doEvaluateDynamic (loader, load, link, registry, state, seen) {
- // System.registerDynamic execute
- // "this" is "exports" in CJS
- var module = { id: load.key };
- var moduleObj = link.moduleObj;
- Object.defineProperty(module, 'exports', {
- configurable: true,
- set: function (exports) {
- moduleObj.default = moduleObj.__useDefault = exports;
- },
- get: function () {
- return moduleObj.__useDefault;
- }
- });
- var require = makeDynamicRequire(loader, load.key, link.dependencies, link.dependencyInstantiations, registry, state, seen);
- // evaluate deps first
- if (!link.executingRequire)
- for (var i = 0; i < link.dependencies.length; i++)
- require(link.dependencies[i]);
- try {
- var output = link.execute.call(envGlobal, require, moduleObj.default, module);
- if (output !== undefined)
- module.exports = output;
- }
- catch (e) {
- evalError(load, e);
- }
- load.linkRecord = undefined;
- // pick up defineProperty calls to module.exports when we can
- if (module.exports !== moduleObj.__useDefault)
- moduleObj.default = moduleObj.__useDefault = module.exports;
- var moduleDefault = moduleObj.default;
- // __esModule flag extension support via lifting
- if (moduleDefault && moduleDefault.__esModule) {
- for (var p in moduleDefault) {
- if (Object.hasOwnProperty.call(moduleDefault, p))
- moduleObj[p] = moduleDefault[p];
- }
- }
- registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
- // run importer setters and clear them
- // this allows dynamic modules to update themselves into es modules
- // as soon as execution has completed
- if (load.importerSetters)
- for (var i = 0; i < load.importerSetters.length; i++)
- load.importerSetters[i](load.module);
- load.importerSetters = undefined;
- }
- // the closest we can get to call(undefined)
- var nullContext = Object.create(null);
- if (Object.freeze)
- Object.freeze(nullContext);
- var resolvedPromise$2 = Promise.resolve();
- function noop () {}
- var emptyModule = new ModuleNamespace({});
- function isModule (m) {
- return m instanceof ModuleNamespace || m[toStringTag] === 'module';
- }
- var CONFIG = createSymbol('loader-config');
- var PLAIN_RESOLVE = createSymbol('plain-resolve');
- var PLAIN_RESOLVE_SYNC = createSymbol('plain-resolve-sync');
- var isWorker = typeof window === 'undefined' && typeof self !== 'undefined' && typeof importScripts !== 'undefined';
- function extend (a, b) {
- for (var p in b) {
- if (!Object.hasOwnProperty.call(b, p))
- continue;
- a[p] = b[p];
- }
- return a;
- }
- var supportsPreload = false, supportsPrefetch = false;
- if (isBrowser)
- (function () {
- var relList = document.createElement('link').relList;
- if (relList && relList.supports) {
- supportsPrefetch = true;
- try {
- supportsPreload = relList.supports('preload');
- }
- catch (e) {}
- }
- })();
- function preloadScript (url) {
- // fallback to old fashioned image technique which still works in safari
- if (!supportsPreload && !supportsPrefetch) {
- var preloadImage = new Image();
- preloadImage.src = url;
- return;
- }
- var link = document.createElement('link');
- if (supportsPreload) {
- link.rel = 'preload';
- link.as = 'script';
- }
- else {
- // this works for all except Safari (detected by relList.supports lacking)
- link.rel = 'prefetch';
- }
- link.href = url;
- document.head.appendChild(link);
- }
- function workerImport (src, resolve, reject) {
- try {
- importScripts(src);
- }
- catch (e) {
- reject(e);
- }
- resolve();
- }
- if (isBrowser) {
- var onerror = window.onerror;
- window.onerror = function globalOnerror (msg, src) {
- if (onerror)
- onerror.apply(this, arguments);
- };
- }
- function scriptLoad (src, crossOrigin, integrity, resolve, reject) {
- // percent encode just "#" for HTTP requests
- src = src.replace(/#/g, '%23');
- // subresource integrity is not supported in web workers
- if (isWorker)
- return workerImport(src, resolve, reject);
- var script = document.createElement('script');
- script.type = 'text/javascript';
- script.charset = 'utf-8';
- script.async = true;
- if (crossOrigin)
- script.crossOrigin = crossOrigin;
- if (integrity)
- script.integrity = integrity;
- script.addEventListener('load', load, false);
- script.addEventListener('error', error, false);
- script.src = src;
- document.head.appendChild(script);
- function load () {
- resolve();
- cleanup();
- }
- // note this does not catch execution errors
- function error (err) {
- cleanup();
- reject(new Error('Fetching ' + src));
- }
- function cleanup () {
- script.removeEventListener('load', load, false);
- script.removeEventListener('error', error, false);
- document.head.removeChild(script);
- }
- }
- // separate out paths cache as a baseURL lock process
- function applyPaths (baseURL, paths, key) {
- var mapMatch = getMapMatch(paths, key);
- if (mapMatch) {
- var target = paths[mapMatch] + key.substr(mapMatch.length);
- var resolved = resolveIfNotPlain(target, baseURI);
- if (resolved !== undefined)
- return resolved;
- return baseURL + target;
- }
- else if (key.indexOf(':') !== -1) {
- return key;
- }
- else {
- return baseURL + key;
- }
- }
- function checkMap (p) {
- var name = this.name;
- // can add ':' here if we want paths to match the behaviour of map
- if (name.substr(0, p.length) === p && (name.length === p.length || name[p.length] === '/' || p[p.length - 1] === '/' || p[p.length - 1] === ':')) {
- var curLen = p.split('/').length;
- if (curLen > this.len) {
- this.match = p;
- this.len = curLen;
- }
- }
- }
- function getMapMatch (map, name) {
- if (Object.hasOwnProperty.call(map, name))
- return name;
- var bestMatch = {
- name: name,
- match: undefined,
- len: 0
- };
- Object.keys(map).forEach(checkMap, bestMatch);
- return bestMatch.match;
- }
- function setAmdHelper (loader) {
- /*
- AMD-compatible require
- To copy RequireJS, set window.require = window.requirejs = loader.amdRequire
- */
- function require (names, callback, errback, referer) {
- // in amd, first arg can be a config object... we just ignore
- if (typeof names === 'object' && !(names instanceof Array))
- return require.apply(null, Array.prototype.splice.call(arguments, 1, arguments.length - 1));
- // amd require
- if (typeof names === 'string' && typeof callback === 'function')
- names = [names];
- if (names instanceof Array) {
- var dynamicRequires = [];
- for (var i = 0; i < names.length; i++)
- dynamicRequires.push(loader.import(names[i], referer));
- Promise.all(dynamicRequires).then(function (modules) {
- if (callback)
- callback.apply(null, modules);
- }, errback);
- }
- // commonjs require
- else if (typeof names === 'string') {
- var normalized = loader.decanonicalize(names, referer);
- var module = loader.get(normalized);
- if (!module)
- throw new Error('Module not already loaded loading "' + names + '" as ' + normalized + (referer ? ' from "' + referer + '".' : '.'));
- return '__useDefault' in module ? module.__useDefault : module;
- }
- else
- throw new TypeError('Invalid require');
- }
- function define (name, deps, factory) {
- if (typeof name !== 'string') {
- factory = deps;
- deps = name;
- name = null;
- }
- if (!(deps instanceof Array)) {
- factory = deps;
- deps = ['require', 'exports', 'module'].splice(0, factory.length);
- }
- if (typeof factory !== 'function')
- factory = (function (factory) {
- return function() { return factory; }
- })(factory);
- if (!name) {
- if (curMetaDeps) {
- deps = deps.concat(curMetaDeps);
- curMetaDeps = undefined;
- }
- }
- // remove system dependencies
- var requireIndex, exportsIndex, moduleIndex;
- if ((requireIndex = deps.indexOf('require')) !== -1) {
- deps.splice(requireIndex, 1);
- // only trace cjs requires for non-named
- // named defines assume the trace has already been done
- if (!name)
- deps = deps.concat(amdGetCJSDeps(factory.toString(), requireIndex));
- }
- if ((exportsIndex = deps.indexOf('exports')) !== -1)
- deps.splice(exportsIndex, 1);
- if ((moduleIndex = deps.indexOf('module')) !== -1)
- deps.splice(moduleIndex, 1);
- function execute (req, exports, module) {
- var depValues = [];
- for (var i = 0; i < deps.length; i++)
- depValues.push(req(deps[i]));
- module.uri = module.id;
- module.config = noop;
- // add back in system dependencies
- if (moduleIndex !== -1)
- depValues.splice(moduleIndex, 0, module);
- if (exportsIndex !== -1)
- depValues.splice(exportsIndex, 0, exports);
- if (requireIndex !== -1) {
- var contextualRequire = function (names, callback, errback) {
- if (typeof names === 'string' && typeof callback !== 'function')
- return req(names);
- return require.call(loader, names, callback, errback, module.id);
- };
- contextualRequire.toUrl = function (name) {
- return loader.normalizeSync(name, module.id);
- };
- depValues.splice(requireIndex, 0, contextualRequire);
- }
- // set global require to AMD require
- var curRequire = envGlobal.require;
- envGlobal.require = require;
- var output = factory.apply(exportsIndex === -1 ? envGlobal : exports, depValues);
- envGlobal.require = curRequire;
- if (typeof output !== 'undefined')
- module.exports = output;
- }
- // anonymous define
- if (!name) {
- loader.registerDynamic(deps, false, curEsModule ? wrapEsModuleExecute(execute) : execute);
- }
- else {
- loader.registerDynamic(name, deps, false, execute);
- // if we don't have any other defines,
- // then let this be an anonymous define
- // this is just to support single modules of the form:
- // define('jquery')
- // still loading anonymously
- // because it is done widely enough to be useful
- // as soon as there is more than one define, this gets removed though
- if (lastNamedDefine) {
- lastNamedDefine = undefined;
- multipleNamedDefines = true;
- }
- else if (!multipleNamedDefines) {
- lastNamedDefine = [deps, execute];
- }
- }
- }
- define.amd = {};
- loader.amdDefine = define;
- loader.amdRequire = require;
- }
- // CJS
- var windowOrigin;
- if (typeof window !== 'undefined' && typeof document !== 'undefined' && window.location)
- windowOrigin = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '');
- var commentRegEx = /(^|[^\\])(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg;
- // Global
- // bare minimum ignores
- var ignoredGlobalProps = ['_g', 'sessionStorage', 'localStorage', 'clipboardData', 'frames', 'frameElement', 'external',
- 'mozAnimationStartTime', 'mozPaintCount', 'webkitStorageInfo', 'webkitIndexedDB', 'mozInnerScreenY', 'mozInnerScreenX'];
- function globalIterator (globalName) {
- if (ignoredGlobalProps.indexOf(globalName) !== -1)
- return;
- try {
- var value = envGlobal[globalName];
- }
- catch (e) {
- ignoredGlobalProps.push(globalName);
- }
- this(globalName, value);
- }
- // AMD
- var cjsRequirePre = "(?:^|[^$_a-zA-Z\\xA0-\\uFFFF.])";
- var cjsRequirePost = "\\s*\\(\\s*(\"([^\"]+)\"|'([^']+)')\\s*\\)";
- var fnBracketRegEx = /\(([^\)]*)\)/;
- var wsRegEx = /^\s+|\s+$/g;
- var requireRegExs = {};
- function amdGetCJSDeps(source, requireIndex) {
- // remove comments
- source = source.replace(commentRegEx, '');
- // determine the require alias
- var params = source.match(fnBracketRegEx);
- var requireAlias = (params[1].split(',')[requireIndex] || 'require').replace(wsRegEx, '');
- // find or generate the regex for this requireAlias
- var requireRegEx = requireRegExs[requireAlias] || (requireRegExs[requireAlias] = new RegExp(cjsRequirePre + requireAlias + cjsRequirePost, 'g'));
- requireRegEx.lastIndex = 0;
- var deps = [];
- var match;
- while (match = requireRegEx.exec(source))
- deps.push(match[2] || match[3]);
- return deps;
- }
- function wrapEsModuleExecute (execute) {
- return function (require, exports, module) {
- execute(require, exports, module);
- exports = module.exports;
- if ((typeof exports === 'object' || typeof exports === 'function') && !('__esModule' in exports))
- Object.defineProperty(module.exports, '__esModule', {
- value: true
- });
- };
- }
- // generate anonymous define from singular named define
- var multipleNamedDefines = false;
- var lastNamedDefine;
- var curMetaDeps;
- var curEsModule = false;
- function registerLastDefine (loader) {
- if (lastNamedDefine)
- loader.registerDynamic(curMetaDeps ? lastNamedDefine[0].concat(curMetaDeps) : lastNamedDefine[0],
- false, curEsModule ? wrapEsModuleExecute(lastNamedDefine[1]) : lastNamedDefine[1]);
- // bundles are an empty module
- else if (multipleNamedDefines)
- loader.registerDynamic([], false, noop);
- }
- function SystemJSProductionLoader () {
- RegisterLoader.call(this);
- // internal configuration
- this[CONFIG] = {
- baseURL: baseURI,
- paths: {},
- map: {},
- submap: {},
- depCache: {}
- };
- setAmdHelper(this);
- if (isBrowser)
- envGlobal.define = this.amdDefine;
- }
- SystemJSProductionLoader.plainResolve = PLAIN_RESOLVE;
- SystemJSProductionLoader.plainResolveSync = PLAIN_RESOLVE_SYNC;
- var systemJSPrototype = SystemJSProductionLoader.prototype = Object.create(RegisterLoader.prototype);
- systemJSPrototype.constructor = SystemJSProductionLoader;
- systemJSPrototype[SystemJSProductionLoader.resolve = RegisterLoader.resolve] = function (key, parentKey) {
- var resolved = resolveIfNotPlain(key, parentKey || baseURI);
- if (resolved !== undefined)
- return Promise.resolve(resolved);
- // plain resolution
- var loader = this;
- return resolvedPromise$2
- .then(function () {
- return loader[PLAIN_RESOLVE](key, parentKey);
- })
- .then(function (resolved) {
- resolved = resolved || key;
- // if in the registry then we are done
- if (loader.registry.has(resolved))
- return resolved;
- // then apply paths
- // baseURL is fallback
- var config = loader[CONFIG];
- return applyPaths(config.baseURL, config.paths, resolved);
- });
- };
- systemJSPrototype.newModule = function (bindings) {
- return new ModuleNamespace(bindings);
- };
- systemJSPrototype.isModule = isModule;
- systemJSPrototype.resolveSync = function (key, parentKey) {
- var resolved = resolveIfNotPlain(key, parentKey || baseURI);
- if (resolved !== undefined)
- return resolved;
- // plain resolution
- resolved = this[PLAIN_RESOLVE_SYNC](key, parentKey) || key;
- if (this.registry.has(resolved))
- return resolved;
- // then apply paths
- var config = this[CONFIG];
- return applyPaths(config.baseURL, config.paths, resolved);
- };
- systemJSPrototype[PLAIN_RESOLVE] = systemJSPrototype[PLAIN_RESOLVE_SYNC] = plainResolve;
- systemJSPrototype[SystemJSProductionLoader.instantiate = RegisterLoader.instantiate] = coreInstantiate;
- systemJSPrototype.config = function (cfg) {
- var config = this[CONFIG];
- if (cfg.baseURL) {
- config.baseURL = resolveIfNotPlain(cfg.baseURL, baseURI) || resolveIfNotPlain('./' + cfg.baseURL, baseURI);
- if (config.baseURL[config.baseURL.length - 1] !== '/')
- config.baseURL += '/';
- }
- if (cfg.paths)
- extend(config.paths, cfg.paths);
- if (cfg.map) {
- var val = cfg.map;
- for (var p in val) {
- if (!Object.hasOwnProperty.call(val, p))
- continue;
- var v = val[p];
- if (typeof v === 'string') {
- config.map[p] = v;
- }
- // object submap
- else {
- // normalize parent with URL and paths only
- var resolvedParent = resolveIfNotPlain(p, baseURI) || applyPaths(config.baseURL, config.paths, p);
- extend(config.submap[resolvedParent] || (config.submap[resolvedParent] = {}), v);
- }
- }
- }
- config.wasm = cfg.wasm === true;
- for (var p in cfg) {
- if (!Object.hasOwnProperty.call(cfg, p))
- continue;
- var val = cfg[p];
- switch (p) {
- case 'baseURL':
- case 'paths':
- case 'map':
- case 'wasm':
- break;
- case 'depCache':
- for (var p in val) {
- if (!Object.hasOwnProperty.call(val, p))
- continue;
- var resolvedParent = this.resolveSync(p, undefined);
- config.depCache[resolvedParent] = (config.depCache[resolvedParent] || []).concat(val[p]);
- }
- break;
- default:
- throw new TypeError('The SystemJS production build does not support the "' + p + '" configuration option.');
- }
- }
- };
- // getConfig configuration cloning
- systemJSPrototype.getConfig = function (name) {
- var config = this[CONFIG];
- var map = {};
- extend(map, config.map);
- for (var p in config.submap) {
- if (!Object.hasOwnProperty.call(config.submap, p))
- continue;
- map[p] = extend({}, config.submap[p]);
- }
- var depCache = {};
- for (var p in config.depCache) {
- if (!Object.hasOwnProperty.call(config.depCache, p))
- continue;
- depCache[p] = [].concat(config.depCache[p]);
- }
- return {
- baseURL: config.baseURL,
- paths: extend({}, config.paths),
- depCache: depCache,
- map: map,
- wasm: config.wasm === true
- };
- };
- // ensure System.register and System.registerDynamic decanonicalize
- systemJSPrototype.register = function (key, deps, declare) {
- if (typeof key === 'string')
- key = this.resolveSync(key, undefined);
- return RegisterLoader.prototype.register.call(this, key, deps, declare);
- };
- systemJSPrototype.registerDynamic = function (key, deps, executingRequire, execute) {
- if (typeof key === 'string')
- key = this.resolveSync(key, undefined);
- return RegisterLoader.prototype.registerDynamic.call(this, key, deps, executingRequire, execute);
- };
- function plainResolve (key, parentKey) {
- var config = this[CONFIG];
- // Apply contextual submap
- if (parentKey) {
- var parent = getMapMatch(config.submap, parentKey);
- var submap = config.submap[parent];
- var mapMatch = submap && getMapMatch(submap, key);
- if (mapMatch) {
- var target = submap[mapMatch] + key.substr(mapMatch.length);
- return resolveIfNotPlain(target, parent) || target;
- }
- }
- // Apply global map
- var map = config.map;
- var mapMatch = getMapMatch(map, key);
- if (mapMatch) {
- var target = map[mapMatch] + key.substr(mapMatch.length);
- return resolveIfNotPlain(target, parentKey || config.baseURL) || target;
- }
- }
- function instantiateWasm (loader, response, processAnonRegister) {
- return WebAssembly.compileStreaming(response).then(function (module) {
- var deps = [];
- var setters = [];
- var importObj = {};
- // we can only set imports if supported (eg early Safari doesnt support)
- if (WebAssembly.Module.imports)
- WebAssembly.Module.imports(module).forEach(function (i) {
- var key = i.module;
- setters.push(function (m) {
- importObj[key] = m;
- });
- if (deps.indexOf(key) === -1)
- deps.push(key);
- });
- loader.register(deps, function (_export) {
- return {
- setters: setters,
- execute: function () {
- _export(new WebAssembly.Instance(module, importObj).exports);
- }
- };
- });
- processAnonRegister();
- });
- }
- function doScriptLoad (loader, url, processAnonRegister) {
- // store a global snapshot in case it turns out to be global
- Object.keys(envGlobal).forEach(globalIterator, function (name, value) {
- globalSnapshot$1[name] = value;
- });
- return new Promise(function (resolve, reject) {
- return scriptLoad(url, 'anonymous', undefined, function () {
- // check for System.register call
- var registered = processAnonRegister();
- if (!registered) {
- // no System.register -> support named AMD as anonymous
- registerLastDefine(loader);
- registered = processAnonRegister();
- // still no registration -> attempt a global detection
- if (!registered) {
- var moduleValue = retrieveGlobal();
- loader.register([], function () {
- return {
- exports: moduleValue
- };
- });
- processAnonRegister();
- }
- }
- resolve();
- }, reject);
- });
- }
- function doEvalLoad (loader, url, source, processAnonRegister) {
- // store a global snapshot in case it turns out to be global
- Object.keys(envGlobal).forEach(globalIterator, function (name, value) {
- globalSnapshot$1[name] = value;
- });
- (0, eval)(source + '\n//# sourceURL=' + url);
- // check for System.register call
- var registered = processAnonRegister();
- if (!registered) {
- // no System.register -> support named AMD as anonymous
- registerLastDefine(loader);
- registered = processAnonRegister();
- // still no registration -> attempt a global detection
- if (!registered) {
- var moduleValue = retrieveGlobal();
- loader.register([], function () {
- return {
- exports: moduleValue
- };
- });
- processAnonRegister();
- }
- }
- }
- var globalSnapshot$1 = {};
- function retrieveGlobal () {
- var globalValue = { default: undefined };
- var multipleGlobals = false;
- var globalName = undefined;
- Object.keys(envGlobal).forEach(globalIterator, function (name, value) {
- if (globalSnapshot$1[name] === value)
- return;
- // update global snapshot as we go
- globalSnapshot$1[name] = value;
- if (value === undefined)
- return;
- if (multipleGlobals) {
- globalValue[name] = value;
- }
- else if (globalName) {
- if (globalValue.default !== value) {
- multipleGlobals = true;
- globalValue.__esModule = true;
- globalValue[globalName] = globalValue.default;
- globalValue[name] = value;
- }
- }
- else {
- globalValue.default = value;
- globalName = name;
- }
- });
- return globalValue;
- }
- function coreInstantiate (key, processAnonRegister) {
- var config = this[CONFIG];
- var depCache = config.depCache[key];
- if (depCache) {
- for (var i = 0; i < depCache.length; i++)
- this.resolve(depCache[i], key).then(preloadScript);
- }
- if (config.wasm) {
- var loader = this;
- return fetch(key)
- .then(function (res) {
- if (!res.ok)
- throw new Error('Fetch error: ' + res.status + ' ' + res.statusText);
- if (res.headers.get('content-type').indexOf('application/wasm') === -1) {
- return res.text()
- .then(function (source) {
- doEvalLoad(loader, key, source, processAnonRegister);
- });
- }
- return instantiateWasm(loader, res, processAnonRegister);
- });
- }
- return doScriptLoad(this, key, processAnonRegister);
- }
- SystemJSProductionLoader.prototype.version = "0.21.6 Production";
- var System = new SystemJSProductionLoader();
- // only set the global System on the global in browsers
- if (isBrowser || isWorker) {
- envGlobal.SystemJS = System;
- // dont override an existing System global
- if (!envGlobal.System) {
- envGlobal.System = System;
- }
- // rather just extend or set a System.register on the existing System global
- else {
- var register = envGlobal.System.register;
- envGlobal.System.register = function () {
- if (register)
- register.apply(this, arguments);
- System.register.apply(System, arguments);
- };
- }
- }
- if (typeof module !== 'undefined' && module.exports)
- module.exports = System;
- }());
- //# sourceMappingURL=system-production.src.js.map
|