systemjs/dist/system.min.js
2014-01-19 20:24:16 +02:00

8 lines
10 KiB
JavaScript

/*
* SystemJS
*
* Copyright (c) 2013 Guy Bedford
* MIT License
*/
!function(global){global.upgradeSystemLoader=function(){delete global.upgradeSystemLoader,function(){if("undefined"==typeof System)throw"System not defined. Include the `es6-module-loader.js` polyfill before SystemJS.";var e=function(t){if(!(t instanceof Module)){for(var r=[],n=0;n<t.length;n++)r[n]=e(t[n]);return r}return t.__defaultOnly?t["default"]:t},t=System.get;System.get=function(r){var n=t.call(this,r);return e(n)};var r=System.import;System.import=function(t,n){return new Promise(function(e){e(System.normalize.call(this,t,n&&n.name,n&&n.address))}).then(function(e){return r.call(System,e,n)}).then(function(t){return e(t)})}}(),function(){function __scopedEval(__source,global,__sourceURL){try{eval("with(global) { (function() { "+__source+" \n }).call(global); }"+(__sourceURL&&!__source.match(/\/\/[@#] ?(sourceURL|sourceMappingURL)=([^\n]+)/)?"\n//# sourceURL="+__sourceURL:""))}catch(e){throw"SyntaxError"==e.name&&(e.message="Evaluating "+__sourceURL+"\n "+e.message),e}}!function(e){System.format={},System.formats=[];var t=/(?:^\s*|[}{\(\);,\n]\s*)(import\s+['"]|(import|module)\s+[^"'\(\)\n;]+\s+from\s+['"]|export\s+(\*|\{|default|function|var|const|let|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*))/,r=/^(\s*(\/\*.*\*\/)|(\/\/[^\n]*))*(["']use strict["'];?)?["']([^'"]+)["'][;\n]/,n=System.instantiate;System.instantiate=function(a){function s(){__scopedEval(a.source,e,a.address)}var o=a.name||"";if(!a.source||"traceur"==o)return n.call(this,a);var i=a.metadata.format;if(!i){var u=a.source.match(r);u&&(i=a.metadata.format=u[5])}if("es6"==i||!i&&a.source.match(t))return a.metadata.es6=!0,n.call(System,a);if(!i)for(var l=0;l<this.formats.length;l++){var m=this.formats[l],d=this.format[m];if(d.detect(a)){i=m;break}}var d=this.format[i];if(!i||!d)throw new TypeError("No format found for "+(i?i:a.address));return{deps:d.deps(a,e,s),execute:function(){var t=d.execute.call(this,Array.prototype.splice.call(arguments,0),a,e,s);return t instanceof e.Module?t:new e.Module(t&&t.__module?(delete t.__module,t):{__defaultOnly:!0,"default":t})}}}}("undefined"!=typeof window?window:global)}(),function(){function makeRequire(e,t,r){return function(n,a,s){return"string"==typeof n&&-1!=t.indexOf(n)?System.get(r[t.indexOf(n)]):require(n,a,s,{name:e})}}System.formats.push("amd");var amdRegEx=/(?:^\s*|[}{\(\);,\n\?\&]\s*)define\s*\(\s*("[^"]+"\s*,|'[^']+'\s*,\s*)?(\[(\s*("[^"]+"|'[^']+')\s*,)*(\s*("[^"]+"|'[^']+')\s*)?\]|function\s*|{|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*\))/,require=System.requirejs=function(e,t,r,n){if("object"==typeof e&&!(e instanceof Array))return require.apply(null,Array.prototype.splice.call(arguments,1));if(!(e instanceof Array)){if("string"==typeof e)return System.get(e);throw"Invalid require"}Promise.all(e.map(function(e){return System.import(e,n)})).then(t,r)};System.format.amd={detect:function(e){return!!e.source.match(amdRegEx)},deps:function(load,global,exec){var deps,meta=load.metadata;global.define=function(name,_deps,factory){"string"!=typeof name?(factory=_deps,_deps=name):meta.name=name,_deps instanceof Array||(factory=_deps,_deps=["require","exports","module"].concat(System.format.cjs.deps(load,global,eval))),deps=_deps,meta.factory="function"!=typeof factory?function(){return factory}:factory},global.define.amd={},delete global.module,delete global.exports,exec();var index;return-1!=(index=deps.indexOf("require"))&&(meta.requireIndex=index,deps.splice(index,1)),-1!=(index=deps.indexOf("exports"))&&(meta.exportsIndex=index,deps.splice(index,1)),-1!=(index=deps.indexOf("module"))&&(meta.moduleIndex=index,deps.splice(index,1)),delete global.define,meta.deps=deps,deps},execute:function(e,t,r){for(var n=t.metadata,a=[],s=0;s<e.length;s++)a[s]=System.get(e[s]);var o,i,u={};return void 0!==n.moduleIndex&&a.splice(n.moduleIndex,0,i={id:t.name,uri:t.address,config:function(){return{}},exports:u}),void 0!==n.exportsIndex&&a.splice(n.exportsIndex,0,u),void 0!==n.requireIndex&&a.splice(n.requireIndex,0,o=makeRequire(t.name,n.deps,e)),n.factory.apply(r,a)||i&&i.exports||void 0}}}(),function(){System.formats.push("cjs");var e=/(?:^\s*|[}{\(\);,\n=:\?\&]\s*|module\.)(exports\s*\[\s*('[^']+'|"[^"]+")\s*\]|\exports\s*\.\s*[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*|exports\s*\=)/,t=/(?:^\s*|[}{\(\);,\n=:\?\&]\s*)require\s*\(\s*("([^"]+)"|'([^']+)')\s*\)/g,r=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,n={nextTick:function(e){setTimeout(e,7)}};System.format.cjs={detect:function(r){return e.lastIndex=0,t.lastIndex=0,!(!t.exec(r.source)&&!e.exec(r.source))},deps:function(n){e.lastIndex=0,t.lastIndex=0;for(var a,s=[],o=n.source.replace(r,"");a=t.exec(o);)s.push(a[2]||a[3]);return n.metadata.deps=s,s},execute:function(e,t,r,a){var s=t.address.split("/");s.pop(),s=s.join("/");var o=t.metadata.deps,i=r._g={global:r,exports:{},process:n,require:function(t){var r=o.indexOf(t);return-1!=r?System.get(e[r]):void 0},__filename:t.address,__dirname:s};i.module={exports:i.exports};var u="";for(var l in i)u+="var "+l+" = _g."+l+";";return t.source=u+t.source,a(),delete r._g,i.module.exports}}}(),function(){System.formats.push("global");var e=/(["']global["'];\s*)((['"]import [^'"]+['"];\s*)*)(['"]export ([^'"]+)["'])?/,t=/(["']import [^'"]+)+/g,r={};System.shim={},System.format.global={detect:function(){return!0},deps:function(r){var n,a;if(n=r.source.match(e)){if(a=n[2].match(t))for(var s=0;s<a.length;s++)a[s]=a[s].substr(8);r.metadata.globalExport=n[5]}a=a||[];var o;return(o=System.shim[r.name])&&("object"==typeof o&&(o.exports&&(r.metadata.globalExport=o.exports),o.imports&&(o=o.imports)),o instanceof Array&&(a=a.concat(o))),a},execute:function(e,t,n,a){for(var s=t.metadata.globalExport,o=0;o<e.length;o++){var i=r[e[o]];if(i)for(var u in i)n[u]=i[u]}var l={};for(var m in n)n.hasOwnProperty(m)&&(l[m]=n[m]);s&&(t.source+='\nthis["'+s+'"] = '+s),a();var d,i;if(s){var f=s.split(".")[0];d=eval.call(n,s),i={},i[f]=n[f]}else{i={};for(var m in n)n.hasOwnProperty(m)&&m!=n&&l[m]!=n[m]&&(i[m]=n[m],d?d!==n[m]&&(d=!1):d!==!1&&(d=n[m]))}return r[t.name]=i,d?d:new Module(i)}}}(),function(){var e=System.normalize;System.normalize=function(t,r,n){return"@module"==t?"@module:"+r:e.call(this,t,r,n)};var t=System.locate;System.locate=function(e){return"@module"==e.name.substr(0,7)?(e.metadata.module={name:e.name.substr(8)},""):t.call(this,e)};var r=System.fetch;System.fetch=function(e){return e.metadata.module?"":r.call(this,e)};var n=System.instantiate;System.instantiate=function(e){return e.metadata.module?{deps:[],execute:function(){return new Module(e.metadata.module)}}:n.call(this,e)}}(),function(){var e=System.normalize;System.normalize=function(t,r,n){t=t.trim();var a;r&&-1!=(a=r.indexOf("!"))&&(r=r.substr(0,a));var s=t.lastIndexOf("!");if(-1!=s){var o=t.substr(0,s),i=t.substr(s+1)||o.substr(o.lastIndexOf(".")+1);return new Promise(function(e){e(System.normalize(i))}).then(function(e){return i=e,System.normalize(o,r,n)}).then(function(e){return e+"!"+i})}return e.call(this,t,r,n)};var t=System.locate;System.locate=function(e){var r=e.name,n=r.lastIndexOf("!");if(-1!=n){var a=r.substr(n+1);return e.name=r.substr(0,n),System.load(a).then(function(){var t=System.get(a);return t=t.default||t,e.metadata.plugin=t,e.metadata.pluginName=a,t.locate?t.locate.call(System,e):new Promise(function(t){t(System.locate(e))}).then(function(e){return e.substr(0,e.length-3)})})}return t.call(this,e)};var r=System.fetch;System.fetch=function(e){var t=this;return"function"==typeof e.metadata.plugin?new Promise(function(n,a){e.metadata.plugin(e.name,e.address,function(n,a,s){r.call(t,{name:e.name,address:n,metadata:{}}).then(a,s)},n,a)}):(e.metadata.plugin&&e.metadata.plugin.fetch||r).call(this,e)};var n=System.translate;System.translate=function(e){var t=e.metadata.plugin;return t&&t.translate?t.translate.call(this,e):n.call(this,e)}}(),function(){function e(e,t){var r=t.split("/"),n=e.split("/");if(r.length>n.length)return 0;for(var a=0;a<r.length;a++)if(n[a]!=r[a])return 0;return r.length}function t(t,r){var n,a,s=0,o=0;if(r){for(var i in System.map){var u=System.map[i];if("object"==typeof u&&!(e(r,i)<=o))for(var l in u)e(t,l)<=s||(n=l,s=l.split("/").length,a=i,o=i.split("/").length)}if(n){var m=t.split("/").splice(s).join("/");return System.map[a][n]+(m?"/"+m:"")}}for(var i in System.map){var u=System.map[i];"string"==typeof u&&(e(t,i)<=s||(n=i,s=i.split("/").length))}if(!n)return t;var m=t.split("/").splice(s).join("/");return System.map[n]+(m?"/"+m:"")}System.map={};var r=System.normalize;System.normalize=function(e,n,a){return r(t(e,n),n,a)}}(),function(){var e=/^(\d+)(?:\.(\d+)(?:\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?)?)?$/,t=function(e,t){var r,n=e.split("."),a=t.split(".");n[2]&&-1!=(r=n[2].indexOf("-"))&&n.splice(2,1,n[2].substr(0,r),n[2].substr(r+1)),a[2]&&-1!=(r=a[2].indexOf("-"))&&a.splice(2,1,a[2].substr(0,r),a[2].substr(r+1));for(var s=0;s<Math.max(n.length,a.length);s++){if(!n[s])return!0;if(!a[s])return!1;if(n[s]!=a[s])return n[s]>a[s]}return!0},r=System.normalize;System.versions={},System.normalize=function(n,a,s){var o=System.versions;return Promise.resolve(r.call(this,n,a,s)).then(function(r){var n,a,s,i,u=r.indexOf("@");if(-1==u){for(var l in o)if(i=o[l],"string"==typeof i&&(i=[i]),r.substr(0,l.length)==l&&(s=r.charAt(l.length),!s||"/"==s))return l+"@"+i[i.length-1]+r.substr(l.length);return r}n=r.substr(u+1).split("/")[0];var m;if("^"==n.substr(0,1)&&(n=n.substr(1),m=!0),a=n.match(e),m&&(a[1]>0?(m=n,n=a[0],a=[a[1]]):a[2]>0?(m=n,a=[0,a[2]]):(a=[a[1]],m=!1),n=a.join("."),r=r.substr(0,u+1)+n),!a)return r;var d=r.substr(0,u);if(i=o[d]||[],"string"==typeof i&&(i=[i]),!a[3]||m)for(var f=i.length-1;f>=0;f--){var c=i[f];if(c.substr(0,n.length)==n&&"."==c.charAt(n.length)&&(!m||m&&t(c,m)))return d+"@"+c+r.substr(d.length+n.length+1)}return-1==i.indexOf(n)&&(i.push(n),i.sort(t),o[d]=1==i.length?i[0]:i),r})}}()},function(){if(global.System)global.upgradeSystemLoader();else if("undefined"!=typeof window){var e=document.getElementsByTagName("script"),t=e[e.length-1].src,r=t.substr(0,t.lastIndexOf("/")+1);document.write('<script type="text/javascript" src="'+r+'es6-module-loader.js" data-init="upgradeSystemLoader"></script>')}else{var n=require("es6-module-loader");global.System=n.System,global.Loader=n.Loader,global.Module=n.Module,module.exports=global.System,global.upgradeSystemLoader()}}()}("undefined"!=typeof window?window:global);