diff --git a/package.json b/package.json index d4c50be58..f94aed073 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "steal", "description": "Gets JavaScript.", - "version": "2.1.13", + "version": "2.1.14", "author": { "name": "Bitovi", "email": "contact@bitovi.com", diff --git a/steal-with-promises.production.js b/steal-with-promises.production.js index f9897a940..2253c9689 100644 --- a/steal-with-promises.production.js +++ b/steal-with-promises.production.js @@ -1,7 +1,7 @@ /* - * steal v2.1.12 + * steal v2.1.14 * - * Copyright (c) 2018 Bitovi; Licensed MIT + * Copyright (c) 2019 Bitovi; Licensed MIT */ !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.Promise=e():"undefined"!=typeof global?global.Promise=e():"undefined"!=typeof self&&(self.Promise=e())}(function(){return function e(t,n,r){function a(i,s){if(!n[i]){if(!t[i]){var l="function"==typeof require&&require;if(!s&&l)return l(i,!0);if(o)return o(i,!0);throw new Error("Cannot find module '"+i+"'")}var u=n[i]={exports:{}};t[i][0].call(u.exports,function(e){var n=t[i][1][e];return a(n||e)},u,u.exports,e,t,n,r)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;i=0&&(p.splice(t,1),d("Handled previous rejection ["+e.id+"] "+a.formatObject(e.value)))}function s(e,t){f.push(e,t),null===h&&(h=r(l,0))}function l(){for(h=null;f.length>0;)f.shift()(f.shift())}var u,c=n,d=n;"undefined"!=typeof console&&(u=console,c=void 0!==u.error?function(e){u.error(e)}:function(e){u.log(e)},d=void 0!==u.info?function(e){u.info(e)}:function(e){u.log(e)}),e.onPotentiallyUnhandledRejection=function(e){s(o,e)},e.onPotentiallyUnhandledRejectionHandled=function(e){s(i,e)},e.onFatalRejection=function(e){s(t,e.value)};var f=[],p=[],h=null;return e}})}(function(n){t.exports=n(e)})},{"../env":5,"../format":6}],5:[function(e,t,n){!function(e){"use strict";e(function(e){var t,n="undefined"!=typeof setTimeout&&setTimeout,r=function(e,t){return setTimeout(e,t)},a=function(e){return clearTimeout(e)},o=function(e){return n(e,0)};if("undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))o=function(e){return process.nextTick(e)};else if(t="function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver)o=function(e){var t,n=document.createTextNode("");new e(function(){var e=t;t=void 0,e()}).observe(n,{characterData:!0});var r=0;return function(e){t=e,n.data=r^=1}}(t);else if(!n){var i=e("vertx");r=function(e,t){return i.setTimer(t,e)},a=i.cancelTimer,o=i.runOnLoop||i.runOnContext}return{setTimer:r,clearTimer:a,asap:o}})}(function(n){t.exports=n(e)})},{}],6:[function(e,t,n){!function(e){"use strict";e(function(){function e(e){var n=String(e);return"[object Object]"===n&&"undefined"!=typeof JSON&&(n=t(e,n)),n}function t(e,t){try{return JSON.stringify(e)}catch(e){return t}}return{formatError:function(t){var n="object"==typeof t&&null!==t&&(t.stack||t.message)?t.stack||t.message:e(t);return t instanceof Error?n:n+" (WARNING: non-Error used)"},formatObject:e,tryStringify:t}})}(function(e){t.exports=e()})},{}],7:[function(e,t,n){!function(e){"use strict";e(function(){return function(e){function t(e,t){this._handler=e===m?t:n(e)}function n(e){function t(e){n.reject(e)}var n=new g;try{e(function(e){n.resolve(e)},t,function(e){n.notify(e)})}catch(e){t(e)}return n}function r(e){return L(e)?e:new t(m,new b(f(e)))}function a(e){return new t(m,new b(new _(e)))}function o(){return Q}function i(e,t){return new t(m,new g(e.receiver,e.join().context))}function s(e,n,r){function a(e,t,n){c[e]=t,0==--u&&n.become(new x(c))}for(var o,i="function"==typeof n?function(t,o,i){i.resolved||l(r,a,t,e(n,o,t),i)}:a,s=new g,u=r.length>>>0,c=new Array(u),d=0;d0?t(n,o.value,a):(a.become(o),u(e,n+1,o))}else t(n,r,a)}function u(e,t,n){for(var r=t;r0||"function"!=typeof t&&a<0)return new this.constructor(m,r);var o=this._beget(),i=o._handler;return r.chain(i,r.receiver,e,t,n),o},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype._beget=function(){return i(this._handler,this.constructor)},t.all=function(e){return s(A,null,e)},t.race=function(e){return"object"!=typeof e||null===e?a(new TypeError("non-iterable passed to race()")):0===e.length?o():1===e.length?r(e[0]):d(e)},t._traverse=function(e,t){return s(D,e,t)},t._visitRemaining=u,m.prototype.when=m.prototype.become=m.prototype.notify=m.prototype.fail=m.prototype._unreport=m.prototype._report=z,m.prototype._state=0,m.prototype.state=function(){return this._state},m.prototype.join=function(){for(var e=this;void 0!==e.handler;)e=e.handler;return e},m.prototype.chain=function(e,t,n,r,a){this.when({resolver:e,receiver:t,fulfilled:n,rejected:r,progress:a})},m.prototype.visit=function(e,t,n,r){this.chain(G,e,t,n,r)},m.prototype.fold=function(e,t,n,r){this.when(new k(e,t,n,r))},F(m,v),v.prototype.become=function(e){e.fail()};var G=new v;F(m,g),g.prototype._state=0,g.prototype.resolve=function(e){this.become(f(e))},g.prototype.reject=function(e){this.resolved||this.become(new _(e))},g.prototype.join=function(){if(!this.resolved)return this;for(var e=this;void 0!==e.handler;)if((e=e.handler)===this)return this.handler=S();return e},g.prototype.run=function(){var e=this.consumers,t=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var n=0;n",t.isDeclarative=!0,e.loaderObj.transpile(t).then(function(e){var n=__global.System,r=n.register;n.register=function(e,n,r){var a=r,o=n;"string"!=typeof e&&(a=o,o=e),t.declare=a,t.depsList=o},__eval(e,__global,t),n.register=r});if("object"!=typeof n)throw TypeError("Invalid instantiate return value");t.depsList=n.deps||[],t.execute=n.execute,t.isDeclarative=!1}}).then(function(){if("loading"==t.status&&!o()){t.dependencies=[];for(var r=t.depsList,a=[],i=0,s=r.length;i0)){var n=e.startingLoad;if(!1===e.loader.loaderObj.execute){for(var r=[].concat(e.loads),a=0,o=r.length;a=0;i--){for(var s=r[i],l=0;l");r.address=n&&n.address;var a=u(this._loader,r),i=I.resolve(t),s=this._loader,l=a.done.then(function(){return x(s,r)});return o(s,r,i),l},newModule:function(e){if("object"!=typeof e)throw new TypeError("Expected object");var t,n=new P;if(Object.getOwnPropertyNames&&null!=e)t=Object.getOwnPropertyNames(e);else{t=[];for(var r in e)t.push(r)}for(var a=0;a=0;r-=1){var a=n[r];-1===t.indexOf(a)&&t.unshift(a)}else t=["es2015-no-commonjs","react","stage-0"];return t}function c(e){var t=e.metadata.npmPackage;if(t){var n=t.steal||t.system;if(n&&n.babelOptions)return n.babelOptions}return this.babelOptions||{}}function d(e){return(e.version?+e.version.split(".")[0]:6)||6}function f(e,t){var n=c.call(this,e);return n.sourceMap="inline",n.filename=e.address,n.code=!0,n.ast=!1,d(t)>=6?(delete n.optional,delete n.whitelist,delete n.blacklist,n.presets=u(n.presets),n.plugins=l(n.plugins)):(n.modules="system",n.blacklist||(n.blacklist=["react"])),n}function p(e){var t=e.types;return{visitor:{Program:function(e,n){e.unshiftContainer("body",[t.exportNamedDeclaration(null,[t.exportSpecifier(t.identifier("true"),t.identifier("__esModule"))])])}}}}function h(e){return e.metadata.importSpecifiers=Object.create(null),e.metadata.importNames=Object.create(null),e.metadata.exportNames=Object.create(null),{visitor:{ImportDeclaration:function(t,n){var r=t.node,a=r.source.value,o=r.source.loc;e.metadata.importSpecifiers[a]=o;var i=e.metadata.importNames[a];i||(i=e.metadata.importNames[a]=[]),i.push.apply(i,(r.specifiers||[]).map(function(e){return"ImportDefaultSpecifier"===e.type?"default":e.imported&&e.imported.name}))},ExportDeclaration:function(t,n){var r=t.node;if(r.source){var a=r.source.value,o=e.metadata.exportNames[a];"ExportNamedDeclaration"===r.type?(o||(o=e.metadata.exportNames[a]=new Map),r.specifiers.forEach(function(e){o.set(e.exported.name,e.local.name)})):"ExportAllDeclaration"===r.type&&(e.metadata.exportNames[a]=1)}}}}}function m(e,t){var n=this,r=t.Babel||t.babel||t,a=d(r),o=f.call(n,e,r);return Promise.all([b.call(this,r,o),y.call(this,r,o)]).then(function(t){a>=6&&(o.plugins=[h.bind(null,e),p].concat(t[0]),o.presets=t[1]);try{return r.transform(e.source,o).code+"\n//# sourceURL="+e.address+"!eval"}catch(t){if(t instanceof SyntaxError){var i=new SyntaxError(t.message),s=new n.StackTrace(t.message,[n.StackTrace.item("",e.address,t.loc.line,t.loc.column)]);return i.stack=s.toString(),Promise.reject(i)}return Promise.reject(t)}})}var v=__global,g="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process);e.prototype.transpiler="babel",e.prototype.transpile=function(e){var n=this;return n.transpilerHasRun||(v.traceur&&!n.has("traceur")&&n.set("traceur",t(n,"traceur")),v.Babel&&!n.has("babel")&&n.set("babel",t(n,"Babel")),n.transpilerHasRun=!0),n.import(n.transpiler).then(function(t){var a=t;return a.__useDefault&&(a=a.default),(a.Compiler?r:m).call(n,e,a)}).then(function(t){return'var __moduleAddress = "'+e.address+'";'+t})},e.prototype.instantiate=function(e){var r=this;return Promise.resolve(r.normalize(r.transpiler)).then(function(a){if(e.name===a)return{deps:[],execute:function(){var a=v.System,o=v.Reflect.Loader;return __eval("(function(require,exports,module){"+e.source+"})();",v,e),v.System=a,v.Reflect.Loader=o,t(r,n(e.name))}}})};var b=function(){function e(e,r){var a=[];return(r||[]).forEach(function(r){var o=i(r);if(!s(r)||t(e,o))a.push(r);else if(!t(e,o)){var l=this.configMain||"package.json!npm",u=n(o);a.push(this.import(u,{name:l}).then(function(e){var t=e.__esModule?e.default:e;return"string"==typeof r?t:[t,r[1]]}))}},this),Promise.all(a)}function t(e,t){var n=/^(?:babel-plugin-)/;return!!(e.availablePlugins||{})[n.test(t)?t.replace("babel-plugin-",""):t]}function n(e){var t=/^(?:babel-plugin-)/;return/\//.test(e)||t.test(e)?e:"babel-plugin-"+e}return function(t,n){var r=o.call(this),a=n.env||{},i=[e.call(this,t,n.plugins)];for(var s in a)if(r===s){var l=a[s].plugins||[];i.push(e.call(this,t,l))}return Promise.all(i).then(function(e){var t=[];return e.forEach(function(e){t=t.concat(e)}),t})}}(),y=function(){function e(e,r){var a=[];return(r||[]).forEach(function(r){var o=i(r);if(!s(r)||t(e,o))a.push(r);else if(!t(e,o)){var l=this.configMain||"package.json!npm",u=n(o);a.push(this.import(u,{name:l}).then(function(e){var t=e.__esModule?e.default:e;return"string"==typeof r?t:[t,r[1]]}))}},this),Promise.all(a)}function t(e,t){var n=/^(?:babel-preset-)/;return!!(e.availablePresets||{})[n.test(t)?t.replace("babel-preset-",""):t]}function n(e){var t=/^(?:babel-preset-)/;return/\//.test(e)||t.test(e)?e:"babel-preset-"+e}return function(t,n){var r=o.call(this),a=n.env||{},i=[e.call(this,t,n.presets)];for(var s in a)if(r===s){var l=a[s].presets||[];i.push(e.call(this,t,l))}return Promise.all(i).then(function(e){var t=[];return e.forEach(function(e){t=t.concat(e)}),t})}}();e.prototype._getImportSpecifierPositionsPlugin=h}(__global.LoaderPolyfill),function(){function e(e){var t=String(e).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@\/?#]*(?::[^:@\/?#]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null}function t(e){var t=[];return e.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?t.pop():t.push(e)}),t.join("").replace(/^\//,"/"===e.charAt(0)?"/":"")}function n(n,r){var a=r,i=n;return s.test(r)?"http:"+r:(o&&(a=a.replace(/\\/g,"/")),a=e(a||""),i=e(i||""),a&&i?(a.protocol||i.protocol)+(a.protocol||a.authority?a.authority:i.authority)+t(a.protocol||a.authority||"/"===a.pathname.charAt(0)?a.pathname:a.pathname?(i.authority&&!i.pathname?"/":"")+i.pathname.slice(0,i.pathname.lastIndexOf("/")+1)+a.pathname:i.pathname)+(a.protocol||a.authority||a.pathname?a.search:a.search||i.search)+a.hash:null)}function r(e,t,n){if(void 0===n.getDependants)return i.resolve();var r=n.getDependants(t.name);if(Array.isArray(r)&&r.length){var a=n.StackTrace,o=n.isEnv("production");return i.resolve().then(function(){return o?i.resolve():n.import("@@babel-code-frame")}).then(function(i){var s=n.getModuleLoad(r[0]),l=n.getImportSpecifier(t.name,s)||{line:1,column:0},u="The module ["+n.prettyName(t)+"] couldn't be fetched.\nClicking the link in the stack trace below takes you to the import.\nSee https://stealjs.com/docs/StealJS.error-messages.html#404-not-found for more information.\n",c=e.message+"\n"+u;o||(c+="\n"+i(s.metadata.originalSource||s.source,l.line,l.column)+"\n"),e.message=c;var d=new a(c,[a.item(null,s.address,l.line,l.column)]);e.stack=d.toString()})}return i.resolve()}var a,o="undefined"!=typeof process&&!!process.platform.match(/^win/),i=__global.Promise||require("when/es6-shim/Promise"),s=/^\/\//;if("undefined"!=typeof XMLHttpRequest)a=function(e,t,n){function r(){t(o.responseText)}function a(){var t=o.status,r=t+" "+o.statusText+": "+e+"\n"||"XHR error",a=new Error(r);a.url=e,a.statusCode=t,n(a)}var o=new XMLHttpRequest,i=!0,s=!1;if(!("withCredentials"in o)){var l=/^(\w+:)?\/\/([^\/]+)/.exec(e);l&&(i=l[2]===window.location.host,l[1]&&(i&=l[1]===window.location.protocol))}i||"undefined"==typeof XDomainRequest||((o=new XDomainRequest).onload=r,o.onerror=a,o.ontimeout=a,o.onprogress=function(){},o.timeout=0,s=!0),o.onreadystatechange=function(){4===o.readyState&&(200===o.status||0==o.status&&o.responseText?r():a())},o.open("GET",e,!0),s&&setTimeout(function(){o.send()},0),o.send(null)};else if("undefined"!=typeof require){var l,u,c,d=/ENOENT/;a=function(e,t,n){if("file:"===e.substr(0,5)){l=l||require("fs");var r=e.substr(5);return o&&(r=r.replace(/\//g,"\\")),l.readFile(r,function(r,a){if(r)return d.test(r.message)&&(r.statusCode=404,r.url=e),n(r);t(a+"")})}if("http"===e.substr(0,4)){return("https:"===e.substr(0,6)?c=c||require("https"):u=u||require("http")).get(e,function(e){if(200!==e.statusCode)n(new Error("Request failed. Status: "+e.statusCode));else{var r="";e.setEncoding("utf8"),e.on("data",function(e){r+=e}),e.on("end",function(){t(r)})}})}}}else{if("function"!=typeof fetch)throw new TypeError("No environment fetch API available.");a=function(e,t,n){fetch(e).then(function(e){return e.text()}).then(function(e){t(e)}).then(null,function(e){n(e)})}}var f=new(function(e){function t(t){if(e.call(this,t||{}),"undefined"!=typeof location&&location.href){var n=__global.location.href.split("#")[0].split("?")[0];this.baseURL=n.substring(0,n.lastIndexOf("/")+1)}else{if("undefined"==typeof process||!process.cwd)throw new TypeError("No environment baseURL");this.baseURL="file:"+process.cwd()+"/",o&&(this.baseURL=this.baseURL.replace(/\\/g,"/"))}this.paths={"*":"*.js"}}return t.__proto__=null!==e?e:Function.prototype,t.prototype=$__Object$create(null!==e?e.prototype:null),$__Object$defineProperty(t.prototype,"constructor",{value:t}),$__Object$defineProperty(t.prototype,"global",{get:function(){return isBrowser?window:isWorker?self:__global},enumerable:!1}),$__Object$defineProperty(t.prototype,"strict",{get:function(){return!0},enumerable:!1}),$__Object$defineProperty(t.prototype,"normalize",{value:function(e,t,n){if("string"!=typeof e)throw new TypeError("Module name must be a string");var r=e.split("/");if(0==r.length)throw new TypeError("No module name provided");var a=0,o=!1,i=0;if("."==r[0]){if(++a==r.length)throw new TypeError('Illegal module name "'+e+'"');o=!0}else{for(;".."==r[a];)if(++a==r.length)throw new TypeError('Illegal module name "'+e+'"');a&&(o=!0),i=a}if(!o)return e;var s=[],l=(t||"").split("/");l.length;return s=s.concat(l.splice(0,l.length-1-i)),(s=s.concat(r.splice(a,r.length-a))).join("/")},enumerable:!1,writable:!0}),$__Object$defineProperty(t.prototype,"locate",{value:function(e){var t,r=e.name,a="";for(var o in this.paths){var i=o.split("*");if(i.length>2)throw new TypeError("Only one wildcard in a path is permitted");if(1==i.length){if(r==o&&o.length>a.length){a=o;break}}else r.substr(0,i[0].length)==i[0]&&r.substr(r.length-i[1].length)==i[1]&&(a=o,t=r.substr(i[0].length,r.length-i[1].length-i[0].length))}var s=this.paths[a];return t&&(s=s.replace("*",t)),isBrowser&&(s=s.replace(/#/g,"%23")),n(this.baseURL,s)},enumerable:!1,writable:!0}),$__Object$defineProperty(t.prototype,"fetch",{value:function(e){var t=this;return new i(function(o,i){a(n(t.baseURL,e.address),function(e){o(e)},function(n){var a=i.bind(null,n);r(n,e,t).then(a,a)})})},enumerable:!1,writable:!0}),t}(__global.LoaderPolyfill));"object"==typeof exports&&(module.exports=f),__global.System=f}()}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:global),function(e){e.upgradeSystemLoader=function(){function t(e){var t=String(e).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@\/?#]*(?::[^:@\/?#]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null}function r(e,n){var r=e,a=n;return x&&(a=a.replace(/\\/g,"/")),a=t(a||""),r=t(r||""),a&&r?(a.protocol||r.protocol)+(a.protocol||a.authority?a.authority:r.authority)+function(e){var t=[];return e.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?t.pop():t.push(e)}),t.join("").replace(/^\//,"/"===e.charAt(0)?"/":"")}(a.protocol||a.authority||"/"===a.pathname.charAt(0)?a.pathname:a.pathname?(r.authority&&!r.pathname?"/":"")+r.pathname.slice(0,r.pathname.lastIndexOf("/")+1)+a.pathname:r.pathname)+(a.protocol||a.authority||a.pathname?a.search:a.search||r.search)+a.hash:null}function a(t){var n={};if(("object"==typeof t||"function"==typeof t)&&t!==e)if(_)for(var r in t)"default"!==r&&o(n,t,r);else i(n,t);return n.default=t,w(n,"__useDefault",{value:!0}),n}function o(e,t,n){try{var r;(r=Object.getOwnPropertyDescriptor(t,n))&&w(e,n,r)}catch(r){return e[n]=t[n],!1}}function i(e,t,n){var r=t&&t.hasOwnProperty;for(var a in t)r&&!t.hasOwnProperty(a)||n&&a in e||(e[a]=t[a]);return e}function s(e){function t(e,t){t._extensions=[];for(var n=0,r=e.length;n=0;o--){for(var i=r[o],s=0;st.index)return!0;return!1}a.lastIndex=o.lastIndex=i.lastIndex=0;var n,r=[],s={},l=[],u=[];if(e.length/e.split("\n").length<200){for(;n=i.exec(e);)l.push([n.index,n.index+n[0].length]);for(;n=o.exec(e);)t(l,n)||u.push([n.index,n.index+n[0].length])}for(;n=a.exec(e);)if(!t(l,n)&&!t(u,n)){var c=n[1].substr(1,n[1].length-2);if(c.match(/"|'/))continue;r.push(c),s[c]=n.index}return{deps:r,info:s}}function n(e,t){var n=this;return function(r){var a=t[r];return n._getLineAndColumnFromPosition(e.source,a)}}e._extensions.push(f),e._determineFormat=Function.prototype;var r=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF.])(exports\s*(\[['"]|\.)|module(\.exports|\['exports'\]|\["exports"\])\s*(\[['"]|[=,\.])|Object.defineProperty\(\s*module\s*,\s*(?:'|")exports(?:'|"))/,a=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF."'])require\s*\(\s*("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')\s*\)/g,o=/(^|[^\\])(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,i=/("[^"\\\n\r]*(\\.[^"\\\n\r]*)*"|'[^'\\\n\r]*(\\.[^'\\\n\r]*)*')/g,s=e.instantiate;e.instantiate=function(o){if(o.metadata.format||(r.lastIndex=0,a.lastIndex=0,(a.exec(o.source)||r.exec(o.source))&&(o.metadata.format="cjs",this._determineFormat(o))),"cjs"==o.metadata.format){var i=t(o.source);o.metadata.deps=o.metadata.deps?o.metadata.deps.concat(i.deps):i.deps,o.metadata.getImportPosition=n.call(this,o,i.info),o.metadata.executingRequire=!0,o.metadata.execute=function(t,n,r){var a=(o.address||"").split("/");a.pop(),a=a.join("/"),b._nodeRequire&&(a=a.substr(5));e.global._g={global:e.global,exports:n,module:r,require:t,__filename:b._nodeRequire?o.address.substr(5):o.address,__dirname:a};var i=e.global.define;e.global.define=void 0;var s={name:o.name,source:"(function() {\n(function(global, exports, module, require, __filename, __dirname){\n"+o.source+"\n}).call(_g.exports, _g.global, _g.exports, _g.module, _g.require, _g.__filename, _g.__dirname);})();",address:o.address};try{e.__exec(s)}catch(t){throw e.StackTrace&&(e.StackTrace.parse(t)||(t.stack=new e.StackTrace(t.message,[e.StackTrace.item("",o.address,1,0)]).toString())),t}e.global.define=i,e.global._g=void 0}}return s.call(this,o)}}function p(e){function t(e,t){var n=[],r=(e.match(f)[1].split(",")[t]||"require").replace(h,""),a=m[r]||(m[r]=new RegExp("/\\*|//|\"|'|`|(?:^|\\breturn\\b|[([=,;:?><&|^*%~+-])\\s*(?=/)|\\b"+r+"(?=\\s*\\()","g"));a.lastIndex=0,v[r]=v.require;for(var o,i,s,l;o=a.exec(e);)if(i=o[0],(s=v[i])||(s=v[i="/regexp/"]),s.lastIndex=a.lastIndex,(l=s.exec(e))&&l.index===a.lastIndex){a.lastIndex=s.lastIndex;var u=o.index-1;u>-1&&"."===e.charAt(u)||s!==v.require||l[2]&&n.push(l[2])}return n}function n(e,t,r,a){var o=this;if("object"==typeof e&&!(e instanceof Array))return n.apply(null,Array.prototype.splice.call(arguments,1,arguments.length-1));if(!(e instanceof Array)){if("string"==typeof e){var i=o.get(e);return i.__useDefault?i.default:i}throw new TypeError("Invalid require")}Promise.all(e.map(function(e){return o.import(e,a)})).then(function(e){t&&t.apply(null,e)},r)}function r(e,t,r){return function(a,o,i){return"string"==typeof a?t(a):n.call(r,a,o,i,{name:e})}}function a(e){function n(n,a,o){var i=n,s=a,l=o,u=!1;"string"!=typeof i&&(l=s,s=i,i=null),s instanceof Array||(l=s,s=["require","exports","module"]),"function"!=typeof l&&(l=function(e){return function(){return e}}(l)),void 0===s[s.length-1]&&s.pop();var c,f,p;if(-1!=(c=y.call(s,"require"))){s.splice(c,1);var h=l.toString();s=s.concat(t(h,c))}-1!=(f=y.call(s,"exports"))&&(s.splice(f,1),h||(h=l.toString(),u=g.test(h))),-1!=(p=y.call(s,"module"))&&s.splice(p,1);var m={deps:s,execute:function(t,n,a){for(var o=[],i=0;i=0;a--)e.source=e.source.substr(0,r[a].start)+r[a].postLocate(t[a])+e.source.substr(r[a].end,e.source.length);return o.call(n,e)})}}),v(function(e){e._contextualModules={},e.setContextual=function(e,t){this._contextualModules[e]=t};var t=e.normalize;e.normalize=function(e,n){var r=this,a=r.pluginLoader||r;if(n){var o=this._contextualModules[e];if(o){var i=e+"/"+n;return r.has(i)?Promise.resolve(i):("string"==typeof o&&(o=a.import(o)),Promise.resolve(o).then(function(e){var t=e;return t.default&&(t=t.default),Promise.resolve(t.call(r,n))}).then(function(e){return r.set(i,r.newModule(e)),i}))}}return t.apply(this,arguments)}}),v(function(e){function t(){document.removeEventListener("DOMContentLoaded",t,!1),window.removeEventListener("load",t,!1),n()}function n(){for(var t=document.getElementsByTagName("script"),n=0;n0)return n;var i=o(t.map(r));if(i.length>0)return i;throw new Error("Unknown stack format: "+e)}function r(e){var t=e.match(l);if(!t)return null;var n=t[1]||"";return{method:n,fnName:n,url:t[2]||"",line:parseInt(t[3])||0,column:parseInt(t[4])||0}}function a(e){var t=e.match(u)||e.match(c);if(!t)return null;var n=t[3].match(d);if(!n)return null;var r=t[2]||"";return t[1]&&(r="eval at "+r),{method:r,fnName:r,url:n[1]||"",line:parseInt(n[2])||0,column:parseInt(n[3])||0}}function o(e){var t=[];return e.forEach(function(e){e&&t.push(e)}),t}function i(e){var t=/at position ([0-9]+)/.exec(e);if(t&&t.length>1)return Number(t[1])}function s(e,t){for(var n=0;nt.index)return!0;return!1}function n(e){for(;a=e.exec(r);)if(!t(i,a)){var n=a[1];o.push(n)}}var r=e.replace(c,"");l.lastIndex=c.lastIndex=u.lastIndex=d.lastIndex=0;var a,o=[],i=[];if(e.length/e.split("\n").length<200)for(;a=d.exec(r);)i.push([a.index,a.index+a[0].length]);return n(l),n(u),o}e._traceData={loads:{},parentMap:{}},e.getDependencies=function(e){var t=this.getModuleLoad(e);return t?t.metadata.dependencies:void 0},e.getDependants=function(e){var n=[];return t(this._traceData.parentMap[e]||{},function(e){n.push(e)}),n},e.getModuleLoad=function(e){return this._traceData.loads[e]},e.getBundles=function(e,n){var r=n||{};r[e]=!0;var a=this,o=a._traceData.parentMap[e];if(!o)return[e];var i=[];return t(o,function(e,t){r[e]||(i=i.concat(a.getBundles(e,r)))}),i},e.getImportSpecifier=function(e,t){for(var n,r=0;r-1||o.indexOf("steal-with-promises.production")>-1&&!n.env)&&this.config({env:s+"-production"}),(this.isEnv("production")||this.loadBundles)&&C.call(this),z.stealPath.set.call(this,i,n)}},devBundle:{order:16,set:function(e,t){var n=!0===e?"dev-bundle":e;n&&(this.devBundle=n)}},depsBundle:{order:17,set:function(e,t){var n=!0===e?"dev-bundle":e;n&&(this.depsBundle=n)}}};r(z,function(e,t){e.order?F.splice(e.order,0,t):F.push(t)}),function(e,t,n){var a=e.config;e.config=function(o){var s=i({},o);r(t,function(t){var r=n[t];if(r.set&&s[t]){var a=r.set.call(e,s[t],o);void 0!==a&&(e[t]=a),delete s[t]}}),a.call(this,s)}}(e,F,z),P.config=function(e){if("string"==typeof e)return this.loader[e];this.loader.config(e)},v(function(e){e.getEnv=function(){return(this.env||"").split("-")[1]||this.env},e.getPlatform=function(){var e=(this.env||"").split("-");return 2===e.length?e[0]:void 0},e.isEnv=function(e){return this.getEnv()===e},e.isPlatform=function(e){return this.getPlatform()===e}});var U=function(e){var t={},r=/Url$/,a=e.split("?"),o=a.shift(),i=a.join("?").split("&"),s=o.split("/");s.pop(),s.join("/");if(i.length&&i[0].length)for(var l,u=0;u1){var d=n(c[0]);t[d=d.replace(r,"URL")]=c.slice(1).join("=")}}return t},B=function(e){var t={},a=/Url$/;t.stealURL=e.src,r(e.attributes,function(e){var r=e.nodeName||e.name,o=n(0===r.indexOf("data-")?r.replace("data-",""):r);o=o.replace(a,"URL"),t[o]=""===e.value||e.value});var o=e.innerHTML;/\S/.test(o)&&(t.mainSource=o);var s=i(U(e.src),t);return s.main&&("boolean"==typeof s.main&&delete s.main,s.loadMainOnStartup=!0),s},W=function(){var e=this;return new Promise(function(t,n){if(!h)return y?(e.script=_||x(),void t(B(e.script))):void t({loadMainOnStartup:!0,stealPath:__dirname});t(i({loadMainOnStartup:!0,stealURL:location.href},U(location.href)))})};return P.startup=function(e){var t,n,r=this,o=this.loader;return g=new Promise(function(e,r){t=e,n=r}),O=W.call(this).then(function(s){function l(e){if(404===e.statusCode&&r.script){var t="This page has "+((o.devBundle?"dev-":"deps-")+"bundle")+" enabled but "+e.url+" could not be retrieved.\nDid you forget to generate the bundle first?\nSee https://stealjs.com/docs/StealJS.development-bundles.html for more information.",n=new Error(t);return n.stack=null,Promise.reject(n)}return Promise.reject(e)}var u;return u="object"==typeof e?i(e,s):s,o.config(u),$.call(o),o.loadBundles?(o.main||!o.isEnv("production")||o.stealBundled||w("Attribute 'main' is required in production environment. Please add it to the script tag."),o.import(o.configMain).then(t,n),g.then(function(e){return $.call(o),o._configLoaded=!0,o.main&&u.loadMainOnStartup?o.import(o.main):e})):(o.import(o.devBundle).then(function(){return o.import(o.configMain)},l).then(function(){return o.import(o.depsBundle).then(null,l)}).then(t,n),(S=g.then(function(){return $.call(o),q.call(o),o._configLoaded=!0,u&&o.config(u),o.import("@dev")})).then(function(){if(!o.main||o.localLoader)return g;if(u.loadMainOnStartup){var e=o.main;return"string"==typeof e&&(e=[e]),Promise.all(a(e,function(e){return o.import(e)}))}o._warnNoMain(r._mainWarnMs||2e3)}))}).then(function(e){return o.mainSource?o.module(o.mainSource):(o.loadScriptModules(),e)})},P.done=function(){return O},P.import=function(){var e=arguments,t=this.System;return g||(t.main||(t.main="@empty"),P.startup()),g.then(function(){var n=[];return r(e,function(e){n.push(t.import(e))}),n.length>1?Promise.all(n):n[0]})},P.setContextual=f.call(e.setContextual,e),P.isEnv=f.call(e.isEnv,e),P.isPlatform=f.call(e.isPlatform,e),P};if(!b||v||g){var M=e.steal;e.steal=P(System),e.steal.startup(M&&"object"==typeof M&&M).then(null,function(e){if("undefined"!=typeof console){var t=console;"function"==typeof e.logError?e.logError(t):t[t.error?"error":"log"](e)}}),e.steal.clone=O}else e.steal=P(System),e.steal.System=System,e.steal.dev=require("./ext/dev.js"),steal.clone=O,module.exports=e.steal}("undefined"==typeof window?"undefined"==typeof global?this:global:window); \ No newline at end of file diff --git a/steal.production.js b/steal.production.js index 4055a15e4..3d23c6757 100644 --- a/steal.production.js +++ b/steal.production.js @@ -1,5 +1,5 @@ /* - * steal v2.1.13 + * steal v2.1.14 * * Copyright (c) 2019 Bitovi; Licensed MIT */ diff --git a/test/steal-with-promises.production.js b/test/steal-with-promises.production.js index f9897a940..2253c9689 100644 --- a/test/steal-with-promises.production.js +++ b/test/steal-with-promises.production.js @@ -1,7 +1,7 @@ /* - * steal v2.1.12 + * steal v2.1.14 * - * Copyright (c) 2018 Bitovi; Licensed MIT + * Copyright (c) 2019 Bitovi; Licensed MIT */ !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.Promise=e():"undefined"!=typeof global?global.Promise=e():"undefined"!=typeof self&&(self.Promise=e())}(function(){return function e(t,n,r){function a(i,s){if(!n[i]){if(!t[i]){var l="function"==typeof require&&require;if(!s&&l)return l(i,!0);if(o)return o(i,!0);throw new Error("Cannot find module '"+i+"'")}var u=n[i]={exports:{}};t[i][0].call(u.exports,function(e){var n=t[i][1][e];return a(n||e)},u,u.exports,e,t,n,r)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;i=0&&(p.splice(t,1),d("Handled previous rejection ["+e.id+"] "+a.formatObject(e.value)))}function s(e,t){f.push(e,t),null===h&&(h=r(l,0))}function l(){for(h=null;f.length>0;)f.shift()(f.shift())}var u,c=n,d=n;"undefined"!=typeof console&&(u=console,c=void 0!==u.error?function(e){u.error(e)}:function(e){u.log(e)},d=void 0!==u.info?function(e){u.info(e)}:function(e){u.log(e)}),e.onPotentiallyUnhandledRejection=function(e){s(o,e)},e.onPotentiallyUnhandledRejectionHandled=function(e){s(i,e)},e.onFatalRejection=function(e){s(t,e.value)};var f=[],p=[],h=null;return e}})}(function(n){t.exports=n(e)})},{"../env":5,"../format":6}],5:[function(e,t,n){!function(e){"use strict";e(function(e){var t,n="undefined"!=typeof setTimeout&&setTimeout,r=function(e,t){return setTimeout(e,t)},a=function(e){return clearTimeout(e)},o=function(e){return n(e,0)};if("undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))o=function(e){return process.nextTick(e)};else if(t="function"==typeof MutationObserver&&MutationObserver||"function"==typeof WebKitMutationObserver&&WebKitMutationObserver)o=function(e){var t,n=document.createTextNode("");new e(function(){var e=t;t=void 0,e()}).observe(n,{characterData:!0});var r=0;return function(e){t=e,n.data=r^=1}}(t);else if(!n){var i=e("vertx");r=function(e,t){return i.setTimer(t,e)},a=i.cancelTimer,o=i.runOnLoop||i.runOnContext}return{setTimer:r,clearTimer:a,asap:o}})}(function(n){t.exports=n(e)})},{}],6:[function(e,t,n){!function(e){"use strict";e(function(){function e(e){var n=String(e);return"[object Object]"===n&&"undefined"!=typeof JSON&&(n=t(e,n)),n}function t(e,t){try{return JSON.stringify(e)}catch(e){return t}}return{formatError:function(t){var n="object"==typeof t&&null!==t&&(t.stack||t.message)?t.stack||t.message:e(t);return t instanceof Error?n:n+" (WARNING: non-Error used)"},formatObject:e,tryStringify:t}})}(function(e){t.exports=e()})},{}],7:[function(e,t,n){!function(e){"use strict";e(function(){return function(e){function t(e,t){this._handler=e===m?t:n(e)}function n(e){function t(e){n.reject(e)}var n=new g;try{e(function(e){n.resolve(e)},t,function(e){n.notify(e)})}catch(e){t(e)}return n}function r(e){return L(e)?e:new t(m,new b(f(e)))}function a(e){return new t(m,new b(new _(e)))}function o(){return Q}function i(e,t){return new t(m,new g(e.receiver,e.join().context))}function s(e,n,r){function a(e,t,n){c[e]=t,0==--u&&n.become(new x(c))}for(var o,i="function"==typeof n?function(t,o,i){i.resolved||l(r,a,t,e(n,o,t),i)}:a,s=new g,u=r.length>>>0,c=new Array(u),d=0;d0?t(n,o.value,a):(a.become(o),u(e,n+1,o))}else t(n,r,a)}function u(e,t,n){for(var r=t;r0||"function"!=typeof t&&a<0)return new this.constructor(m,r);var o=this._beget(),i=o._handler;return r.chain(i,r.receiver,e,t,n),o},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype._beget=function(){return i(this._handler,this.constructor)},t.all=function(e){return s(A,null,e)},t.race=function(e){return"object"!=typeof e||null===e?a(new TypeError("non-iterable passed to race()")):0===e.length?o():1===e.length?r(e[0]):d(e)},t._traverse=function(e,t){return s(D,e,t)},t._visitRemaining=u,m.prototype.when=m.prototype.become=m.prototype.notify=m.prototype.fail=m.prototype._unreport=m.prototype._report=z,m.prototype._state=0,m.prototype.state=function(){return this._state},m.prototype.join=function(){for(var e=this;void 0!==e.handler;)e=e.handler;return e},m.prototype.chain=function(e,t,n,r,a){this.when({resolver:e,receiver:t,fulfilled:n,rejected:r,progress:a})},m.prototype.visit=function(e,t,n,r){this.chain(G,e,t,n,r)},m.prototype.fold=function(e,t,n,r){this.when(new k(e,t,n,r))},F(m,v),v.prototype.become=function(e){e.fail()};var G=new v;F(m,g),g.prototype._state=0,g.prototype.resolve=function(e){this.become(f(e))},g.prototype.reject=function(e){this.resolved||this.become(new _(e))},g.prototype.join=function(){if(!this.resolved)return this;for(var e=this;void 0!==e.handler;)if((e=e.handler)===this)return this.handler=S();return e},g.prototype.run=function(){var e=this.consumers,t=this.handler;this.handler=this.handler.join(),this.consumers=void 0;for(var n=0;n",t.isDeclarative=!0,e.loaderObj.transpile(t).then(function(e){var n=__global.System,r=n.register;n.register=function(e,n,r){var a=r,o=n;"string"!=typeof e&&(a=o,o=e),t.declare=a,t.depsList=o},__eval(e,__global,t),n.register=r});if("object"!=typeof n)throw TypeError("Invalid instantiate return value");t.depsList=n.deps||[],t.execute=n.execute,t.isDeclarative=!1}}).then(function(){if("loading"==t.status&&!o()){t.dependencies=[];for(var r=t.depsList,a=[],i=0,s=r.length;i0)){var n=e.startingLoad;if(!1===e.loader.loaderObj.execute){for(var r=[].concat(e.loads),a=0,o=r.length;a=0;i--){for(var s=r[i],l=0;l");r.address=n&&n.address;var a=u(this._loader,r),i=I.resolve(t),s=this._loader,l=a.done.then(function(){return x(s,r)});return o(s,r,i),l},newModule:function(e){if("object"!=typeof e)throw new TypeError("Expected object");var t,n=new P;if(Object.getOwnPropertyNames&&null!=e)t=Object.getOwnPropertyNames(e);else{t=[];for(var r in e)t.push(r)}for(var a=0;a=0;r-=1){var a=n[r];-1===t.indexOf(a)&&t.unshift(a)}else t=["es2015-no-commonjs","react","stage-0"];return t}function c(e){var t=e.metadata.npmPackage;if(t){var n=t.steal||t.system;if(n&&n.babelOptions)return n.babelOptions}return this.babelOptions||{}}function d(e){return(e.version?+e.version.split(".")[0]:6)||6}function f(e,t){var n=c.call(this,e);return n.sourceMap="inline",n.filename=e.address,n.code=!0,n.ast=!1,d(t)>=6?(delete n.optional,delete n.whitelist,delete n.blacklist,n.presets=u(n.presets),n.plugins=l(n.plugins)):(n.modules="system",n.blacklist||(n.blacklist=["react"])),n}function p(e){var t=e.types;return{visitor:{Program:function(e,n){e.unshiftContainer("body",[t.exportNamedDeclaration(null,[t.exportSpecifier(t.identifier("true"),t.identifier("__esModule"))])])}}}}function h(e){return e.metadata.importSpecifiers=Object.create(null),e.metadata.importNames=Object.create(null),e.metadata.exportNames=Object.create(null),{visitor:{ImportDeclaration:function(t,n){var r=t.node,a=r.source.value,o=r.source.loc;e.metadata.importSpecifiers[a]=o;var i=e.metadata.importNames[a];i||(i=e.metadata.importNames[a]=[]),i.push.apply(i,(r.specifiers||[]).map(function(e){return"ImportDefaultSpecifier"===e.type?"default":e.imported&&e.imported.name}))},ExportDeclaration:function(t,n){var r=t.node;if(r.source){var a=r.source.value,o=e.metadata.exportNames[a];"ExportNamedDeclaration"===r.type?(o||(o=e.metadata.exportNames[a]=new Map),r.specifiers.forEach(function(e){o.set(e.exported.name,e.local.name)})):"ExportAllDeclaration"===r.type&&(e.metadata.exportNames[a]=1)}}}}}function m(e,t){var n=this,r=t.Babel||t.babel||t,a=d(r),o=f.call(n,e,r);return Promise.all([b.call(this,r,o),y.call(this,r,o)]).then(function(t){a>=6&&(o.plugins=[h.bind(null,e),p].concat(t[0]),o.presets=t[1]);try{return r.transform(e.source,o).code+"\n//# sourceURL="+e.address+"!eval"}catch(t){if(t instanceof SyntaxError){var i=new SyntaxError(t.message),s=new n.StackTrace(t.message,[n.StackTrace.item("",e.address,t.loc.line,t.loc.column)]);return i.stack=s.toString(),Promise.reject(i)}return Promise.reject(t)}})}var v=__global,g="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process);e.prototype.transpiler="babel",e.prototype.transpile=function(e){var n=this;return n.transpilerHasRun||(v.traceur&&!n.has("traceur")&&n.set("traceur",t(n,"traceur")),v.Babel&&!n.has("babel")&&n.set("babel",t(n,"Babel")),n.transpilerHasRun=!0),n.import(n.transpiler).then(function(t){var a=t;return a.__useDefault&&(a=a.default),(a.Compiler?r:m).call(n,e,a)}).then(function(t){return'var __moduleAddress = "'+e.address+'";'+t})},e.prototype.instantiate=function(e){var r=this;return Promise.resolve(r.normalize(r.transpiler)).then(function(a){if(e.name===a)return{deps:[],execute:function(){var a=v.System,o=v.Reflect.Loader;return __eval("(function(require,exports,module){"+e.source+"})();",v,e),v.System=a,v.Reflect.Loader=o,t(r,n(e.name))}}})};var b=function(){function e(e,r){var a=[];return(r||[]).forEach(function(r){var o=i(r);if(!s(r)||t(e,o))a.push(r);else if(!t(e,o)){var l=this.configMain||"package.json!npm",u=n(o);a.push(this.import(u,{name:l}).then(function(e){var t=e.__esModule?e.default:e;return"string"==typeof r?t:[t,r[1]]}))}},this),Promise.all(a)}function t(e,t){var n=/^(?:babel-plugin-)/;return!!(e.availablePlugins||{})[n.test(t)?t.replace("babel-plugin-",""):t]}function n(e){var t=/^(?:babel-plugin-)/;return/\//.test(e)||t.test(e)?e:"babel-plugin-"+e}return function(t,n){var r=o.call(this),a=n.env||{},i=[e.call(this,t,n.plugins)];for(var s in a)if(r===s){var l=a[s].plugins||[];i.push(e.call(this,t,l))}return Promise.all(i).then(function(e){var t=[];return e.forEach(function(e){t=t.concat(e)}),t})}}(),y=function(){function e(e,r){var a=[];return(r||[]).forEach(function(r){var o=i(r);if(!s(r)||t(e,o))a.push(r);else if(!t(e,o)){var l=this.configMain||"package.json!npm",u=n(o);a.push(this.import(u,{name:l}).then(function(e){var t=e.__esModule?e.default:e;return"string"==typeof r?t:[t,r[1]]}))}},this),Promise.all(a)}function t(e,t){var n=/^(?:babel-preset-)/;return!!(e.availablePresets||{})[n.test(t)?t.replace("babel-preset-",""):t]}function n(e){var t=/^(?:babel-preset-)/;return/\//.test(e)||t.test(e)?e:"babel-preset-"+e}return function(t,n){var r=o.call(this),a=n.env||{},i=[e.call(this,t,n.presets)];for(var s in a)if(r===s){var l=a[s].presets||[];i.push(e.call(this,t,l))}return Promise.all(i).then(function(e){var t=[];return e.forEach(function(e){t=t.concat(e)}),t})}}();e.prototype._getImportSpecifierPositionsPlugin=h}(__global.LoaderPolyfill),function(){function e(e){var t=String(e).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@\/?#]*(?::[^:@\/?#]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null}function t(e){var t=[];return e.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?t.pop():t.push(e)}),t.join("").replace(/^\//,"/"===e.charAt(0)?"/":"")}function n(n,r){var a=r,i=n;return s.test(r)?"http:"+r:(o&&(a=a.replace(/\\/g,"/")),a=e(a||""),i=e(i||""),a&&i?(a.protocol||i.protocol)+(a.protocol||a.authority?a.authority:i.authority)+t(a.protocol||a.authority||"/"===a.pathname.charAt(0)?a.pathname:a.pathname?(i.authority&&!i.pathname?"/":"")+i.pathname.slice(0,i.pathname.lastIndexOf("/")+1)+a.pathname:i.pathname)+(a.protocol||a.authority||a.pathname?a.search:a.search||i.search)+a.hash:null)}function r(e,t,n){if(void 0===n.getDependants)return i.resolve();var r=n.getDependants(t.name);if(Array.isArray(r)&&r.length){var a=n.StackTrace,o=n.isEnv("production");return i.resolve().then(function(){return o?i.resolve():n.import("@@babel-code-frame")}).then(function(i){var s=n.getModuleLoad(r[0]),l=n.getImportSpecifier(t.name,s)||{line:1,column:0},u="The module ["+n.prettyName(t)+"] couldn't be fetched.\nClicking the link in the stack trace below takes you to the import.\nSee https://stealjs.com/docs/StealJS.error-messages.html#404-not-found for more information.\n",c=e.message+"\n"+u;o||(c+="\n"+i(s.metadata.originalSource||s.source,l.line,l.column)+"\n"),e.message=c;var d=new a(c,[a.item(null,s.address,l.line,l.column)]);e.stack=d.toString()})}return i.resolve()}var a,o="undefined"!=typeof process&&!!process.platform.match(/^win/),i=__global.Promise||require("when/es6-shim/Promise"),s=/^\/\//;if("undefined"!=typeof XMLHttpRequest)a=function(e,t,n){function r(){t(o.responseText)}function a(){var t=o.status,r=t+" "+o.statusText+": "+e+"\n"||"XHR error",a=new Error(r);a.url=e,a.statusCode=t,n(a)}var o=new XMLHttpRequest,i=!0,s=!1;if(!("withCredentials"in o)){var l=/^(\w+:)?\/\/([^\/]+)/.exec(e);l&&(i=l[2]===window.location.host,l[1]&&(i&=l[1]===window.location.protocol))}i||"undefined"==typeof XDomainRequest||((o=new XDomainRequest).onload=r,o.onerror=a,o.ontimeout=a,o.onprogress=function(){},o.timeout=0,s=!0),o.onreadystatechange=function(){4===o.readyState&&(200===o.status||0==o.status&&o.responseText?r():a())},o.open("GET",e,!0),s&&setTimeout(function(){o.send()},0),o.send(null)};else if("undefined"!=typeof require){var l,u,c,d=/ENOENT/;a=function(e,t,n){if("file:"===e.substr(0,5)){l=l||require("fs");var r=e.substr(5);return o&&(r=r.replace(/\//g,"\\")),l.readFile(r,function(r,a){if(r)return d.test(r.message)&&(r.statusCode=404,r.url=e),n(r);t(a+"")})}if("http"===e.substr(0,4)){return("https:"===e.substr(0,6)?c=c||require("https"):u=u||require("http")).get(e,function(e){if(200!==e.statusCode)n(new Error("Request failed. Status: "+e.statusCode));else{var r="";e.setEncoding("utf8"),e.on("data",function(e){r+=e}),e.on("end",function(){t(r)})}})}}}else{if("function"!=typeof fetch)throw new TypeError("No environment fetch API available.");a=function(e,t,n){fetch(e).then(function(e){return e.text()}).then(function(e){t(e)}).then(null,function(e){n(e)})}}var f=new(function(e){function t(t){if(e.call(this,t||{}),"undefined"!=typeof location&&location.href){var n=__global.location.href.split("#")[0].split("?")[0];this.baseURL=n.substring(0,n.lastIndexOf("/")+1)}else{if("undefined"==typeof process||!process.cwd)throw new TypeError("No environment baseURL");this.baseURL="file:"+process.cwd()+"/",o&&(this.baseURL=this.baseURL.replace(/\\/g,"/"))}this.paths={"*":"*.js"}}return t.__proto__=null!==e?e:Function.prototype,t.prototype=$__Object$create(null!==e?e.prototype:null),$__Object$defineProperty(t.prototype,"constructor",{value:t}),$__Object$defineProperty(t.prototype,"global",{get:function(){return isBrowser?window:isWorker?self:__global},enumerable:!1}),$__Object$defineProperty(t.prototype,"strict",{get:function(){return!0},enumerable:!1}),$__Object$defineProperty(t.prototype,"normalize",{value:function(e,t,n){if("string"!=typeof e)throw new TypeError("Module name must be a string");var r=e.split("/");if(0==r.length)throw new TypeError("No module name provided");var a=0,o=!1,i=0;if("."==r[0]){if(++a==r.length)throw new TypeError('Illegal module name "'+e+'"');o=!0}else{for(;".."==r[a];)if(++a==r.length)throw new TypeError('Illegal module name "'+e+'"');a&&(o=!0),i=a}if(!o)return e;var s=[],l=(t||"").split("/");l.length;return s=s.concat(l.splice(0,l.length-1-i)),(s=s.concat(r.splice(a,r.length-a))).join("/")},enumerable:!1,writable:!0}),$__Object$defineProperty(t.prototype,"locate",{value:function(e){var t,r=e.name,a="";for(var o in this.paths){var i=o.split("*");if(i.length>2)throw new TypeError("Only one wildcard in a path is permitted");if(1==i.length){if(r==o&&o.length>a.length){a=o;break}}else r.substr(0,i[0].length)==i[0]&&r.substr(r.length-i[1].length)==i[1]&&(a=o,t=r.substr(i[0].length,r.length-i[1].length-i[0].length))}var s=this.paths[a];return t&&(s=s.replace("*",t)),isBrowser&&(s=s.replace(/#/g,"%23")),n(this.baseURL,s)},enumerable:!1,writable:!0}),$__Object$defineProperty(t.prototype,"fetch",{value:function(e){var t=this;return new i(function(o,i){a(n(t.baseURL,e.address),function(e){o(e)},function(n){var a=i.bind(null,n);r(n,e,t).then(a,a)})})},enumerable:!1,writable:!0}),t}(__global.LoaderPolyfill));"object"==typeof exports&&(module.exports=f),__global.System=f}()}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:global),function(e){e.upgradeSystemLoader=function(){function t(e){var t=String(e).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@\/?#]*(?::[^:@\/?#]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null}function r(e,n){var r=e,a=n;return x&&(a=a.replace(/\\/g,"/")),a=t(a||""),r=t(r||""),a&&r?(a.protocol||r.protocol)+(a.protocol||a.authority?a.authority:r.authority)+function(e){var t=[];return e.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?t.pop():t.push(e)}),t.join("").replace(/^\//,"/"===e.charAt(0)?"/":"")}(a.protocol||a.authority||"/"===a.pathname.charAt(0)?a.pathname:a.pathname?(r.authority&&!r.pathname?"/":"")+r.pathname.slice(0,r.pathname.lastIndexOf("/")+1)+a.pathname:r.pathname)+(a.protocol||a.authority||a.pathname?a.search:a.search||r.search)+a.hash:null}function a(t){var n={};if(("object"==typeof t||"function"==typeof t)&&t!==e)if(_)for(var r in t)"default"!==r&&o(n,t,r);else i(n,t);return n.default=t,w(n,"__useDefault",{value:!0}),n}function o(e,t,n){try{var r;(r=Object.getOwnPropertyDescriptor(t,n))&&w(e,n,r)}catch(r){return e[n]=t[n],!1}}function i(e,t,n){var r=t&&t.hasOwnProperty;for(var a in t)r&&!t.hasOwnProperty(a)||n&&a in e||(e[a]=t[a]);return e}function s(e){function t(e,t){t._extensions=[];for(var n=0,r=e.length;n=0;o--){for(var i=r[o],s=0;st.index)return!0;return!1}a.lastIndex=o.lastIndex=i.lastIndex=0;var n,r=[],s={},l=[],u=[];if(e.length/e.split("\n").length<200){for(;n=i.exec(e);)l.push([n.index,n.index+n[0].length]);for(;n=o.exec(e);)t(l,n)||u.push([n.index,n.index+n[0].length])}for(;n=a.exec(e);)if(!t(l,n)&&!t(u,n)){var c=n[1].substr(1,n[1].length-2);if(c.match(/"|'/))continue;r.push(c),s[c]=n.index}return{deps:r,info:s}}function n(e,t){var n=this;return function(r){var a=t[r];return n._getLineAndColumnFromPosition(e.source,a)}}e._extensions.push(f),e._determineFormat=Function.prototype;var r=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF.])(exports\s*(\[['"]|\.)|module(\.exports|\['exports'\]|\["exports"\])\s*(\[['"]|[=,\.])|Object.defineProperty\(\s*module\s*,\s*(?:'|")exports(?:'|"))/,a=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF."'])require\s*\(\s*("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')\s*\)/g,o=/(^|[^\\])(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,i=/("[^"\\\n\r]*(\\.[^"\\\n\r]*)*"|'[^'\\\n\r]*(\\.[^'\\\n\r]*)*')/g,s=e.instantiate;e.instantiate=function(o){if(o.metadata.format||(r.lastIndex=0,a.lastIndex=0,(a.exec(o.source)||r.exec(o.source))&&(o.metadata.format="cjs",this._determineFormat(o))),"cjs"==o.metadata.format){var i=t(o.source);o.metadata.deps=o.metadata.deps?o.metadata.deps.concat(i.deps):i.deps,o.metadata.getImportPosition=n.call(this,o,i.info),o.metadata.executingRequire=!0,o.metadata.execute=function(t,n,r){var a=(o.address||"").split("/");a.pop(),a=a.join("/"),b._nodeRequire&&(a=a.substr(5));e.global._g={global:e.global,exports:n,module:r,require:t,__filename:b._nodeRequire?o.address.substr(5):o.address,__dirname:a};var i=e.global.define;e.global.define=void 0;var s={name:o.name,source:"(function() {\n(function(global, exports, module, require, __filename, __dirname){\n"+o.source+"\n}).call(_g.exports, _g.global, _g.exports, _g.module, _g.require, _g.__filename, _g.__dirname);})();",address:o.address};try{e.__exec(s)}catch(t){throw e.StackTrace&&(e.StackTrace.parse(t)||(t.stack=new e.StackTrace(t.message,[e.StackTrace.item("",o.address,1,0)]).toString())),t}e.global.define=i,e.global._g=void 0}}return s.call(this,o)}}function p(e){function t(e,t){var n=[],r=(e.match(f)[1].split(",")[t]||"require").replace(h,""),a=m[r]||(m[r]=new RegExp("/\\*|//|\"|'|`|(?:^|\\breturn\\b|[([=,;:?><&|^*%~+-])\\s*(?=/)|\\b"+r+"(?=\\s*\\()","g"));a.lastIndex=0,v[r]=v.require;for(var o,i,s,l;o=a.exec(e);)if(i=o[0],(s=v[i])||(s=v[i="/regexp/"]),s.lastIndex=a.lastIndex,(l=s.exec(e))&&l.index===a.lastIndex){a.lastIndex=s.lastIndex;var u=o.index-1;u>-1&&"."===e.charAt(u)||s!==v.require||l[2]&&n.push(l[2])}return n}function n(e,t,r,a){var o=this;if("object"==typeof e&&!(e instanceof Array))return n.apply(null,Array.prototype.splice.call(arguments,1,arguments.length-1));if(!(e instanceof Array)){if("string"==typeof e){var i=o.get(e);return i.__useDefault?i.default:i}throw new TypeError("Invalid require")}Promise.all(e.map(function(e){return o.import(e,a)})).then(function(e){t&&t.apply(null,e)},r)}function r(e,t,r){return function(a,o,i){return"string"==typeof a?t(a):n.call(r,a,o,i,{name:e})}}function a(e){function n(n,a,o){var i=n,s=a,l=o,u=!1;"string"!=typeof i&&(l=s,s=i,i=null),s instanceof Array||(l=s,s=["require","exports","module"]),"function"!=typeof l&&(l=function(e){return function(){return e}}(l)),void 0===s[s.length-1]&&s.pop();var c,f,p;if(-1!=(c=y.call(s,"require"))){s.splice(c,1);var h=l.toString();s=s.concat(t(h,c))}-1!=(f=y.call(s,"exports"))&&(s.splice(f,1),h||(h=l.toString(),u=g.test(h))),-1!=(p=y.call(s,"module"))&&s.splice(p,1);var m={deps:s,execute:function(t,n,a){for(var o=[],i=0;i=0;a--)e.source=e.source.substr(0,r[a].start)+r[a].postLocate(t[a])+e.source.substr(r[a].end,e.source.length);return o.call(n,e)})}}),v(function(e){e._contextualModules={},e.setContextual=function(e,t){this._contextualModules[e]=t};var t=e.normalize;e.normalize=function(e,n){var r=this,a=r.pluginLoader||r;if(n){var o=this._contextualModules[e];if(o){var i=e+"/"+n;return r.has(i)?Promise.resolve(i):("string"==typeof o&&(o=a.import(o)),Promise.resolve(o).then(function(e){var t=e;return t.default&&(t=t.default),Promise.resolve(t.call(r,n))}).then(function(e){return r.set(i,r.newModule(e)),i}))}}return t.apply(this,arguments)}}),v(function(e){function t(){document.removeEventListener("DOMContentLoaded",t,!1),window.removeEventListener("load",t,!1),n()}function n(){for(var t=document.getElementsByTagName("script"),n=0;n0)return n;var i=o(t.map(r));if(i.length>0)return i;throw new Error("Unknown stack format: "+e)}function r(e){var t=e.match(l);if(!t)return null;var n=t[1]||"";return{method:n,fnName:n,url:t[2]||"",line:parseInt(t[3])||0,column:parseInt(t[4])||0}}function a(e){var t=e.match(u)||e.match(c);if(!t)return null;var n=t[3].match(d);if(!n)return null;var r=t[2]||"";return t[1]&&(r="eval at "+r),{method:r,fnName:r,url:n[1]||"",line:parseInt(n[2])||0,column:parseInt(n[3])||0}}function o(e){var t=[];return e.forEach(function(e){e&&t.push(e)}),t}function i(e){var t=/at position ([0-9]+)/.exec(e);if(t&&t.length>1)return Number(t[1])}function s(e,t){for(var n=0;nt.index)return!0;return!1}function n(e){for(;a=e.exec(r);)if(!t(i,a)){var n=a[1];o.push(n)}}var r=e.replace(c,"");l.lastIndex=c.lastIndex=u.lastIndex=d.lastIndex=0;var a,o=[],i=[];if(e.length/e.split("\n").length<200)for(;a=d.exec(r);)i.push([a.index,a.index+a[0].length]);return n(l),n(u),o}e._traceData={loads:{},parentMap:{}},e.getDependencies=function(e){var t=this.getModuleLoad(e);return t?t.metadata.dependencies:void 0},e.getDependants=function(e){var n=[];return t(this._traceData.parentMap[e]||{},function(e){n.push(e)}),n},e.getModuleLoad=function(e){return this._traceData.loads[e]},e.getBundles=function(e,n){var r=n||{};r[e]=!0;var a=this,o=a._traceData.parentMap[e];if(!o)return[e];var i=[];return t(o,function(e,t){r[e]||(i=i.concat(a.getBundles(e,r)))}),i},e.getImportSpecifier=function(e,t){for(var n,r=0;r-1||o.indexOf("steal-with-promises.production")>-1&&!n.env)&&this.config({env:s+"-production"}),(this.isEnv("production")||this.loadBundles)&&C.call(this),z.stealPath.set.call(this,i,n)}},devBundle:{order:16,set:function(e,t){var n=!0===e?"dev-bundle":e;n&&(this.devBundle=n)}},depsBundle:{order:17,set:function(e,t){var n=!0===e?"dev-bundle":e;n&&(this.depsBundle=n)}}};r(z,function(e,t){e.order?F.splice(e.order,0,t):F.push(t)}),function(e,t,n){var a=e.config;e.config=function(o){var s=i({},o);r(t,function(t){var r=n[t];if(r.set&&s[t]){var a=r.set.call(e,s[t],o);void 0!==a&&(e[t]=a),delete s[t]}}),a.call(this,s)}}(e,F,z),P.config=function(e){if("string"==typeof e)return this.loader[e];this.loader.config(e)},v(function(e){e.getEnv=function(){return(this.env||"").split("-")[1]||this.env},e.getPlatform=function(){var e=(this.env||"").split("-");return 2===e.length?e[0]:void 0},e.isEnv=function(e){return this.getEnv()===e},e.isPlatform=function(e){return this.getPlatform()===e}});var U=function(e){var t={},r=/Url$/,a=e.split("?"),o=a.shift(),i=a.join("?").split("&"),s=o.split("/");s.pop(),s.join("/");if(i.length&&i[0].length)for(var l,u=0;u1){var d=n(c[0]);t[d=d.replace(r,"URL")]=c.slice(1).join("=")}}return t},B=function(e){var t={},a=/Url$/;t.stealURL=e.src,r(e.attributes,function(e){var r=e.nodeName||e.name,o=n(0===r.indexOf("data-")?r.replace("data-",""):r);o=o.replace(a,"URL"),t[o]=""===e.value||e.value});var o=e.innerHTML;/\S/.test(o)&&(t.mainSource=o);var s=i(U(e.src),t);return s.main&&("boolean"==typeof s.main&&delete s.main,s.loadMainOnStartup=!0),s},W=function(){var e=this;return new Promise(function(t,n){if(!h)return y?(e.script=_||x(),void t(B(e.script))):void t({loadMainOnStartup:!0,stealPath:__dirname});t(i({loadMainOnStartup:!0,stealURL:location.href},U(location.href)))})};return P.startup=function(e){var t,n,r=this,o=this.loader;return g=new Promise(function(e,r){t=e,n=r}),O=W.call(this).then(function(s){function l(e){if(404===e.statusCode&&r.script){var t="This page has "+((o.devBundle?"dev-":"deps-")+"bundle")+" enabled but "+e.url+" could not be retrieved.\nDid you forget to generate the bundle first?\nSee https://stealjs.com/docs/StealJS.development-bundles.html for more information.",n=new Error(t);return n.stack=null,Promise.reject(n)}return Promise.reject(e)}var u;return u="object"==typeof e?i(e,s):s,o.config(u),$.call(o),o.loadBundles?(o.main||!o.isEnv("production")||o.stealBundled||w("Attribute 'main' is required in production environment. Please add it to the script tag."),o.import(o.configMain).then(t,n),g.then(function(e){return $.call(o),o._configLoaded=!0,o.main&&u.loadMainOnStartup?o.import(o.main):e})):(o.import(o.devBundle).then(function(){return o.import(o.configMain)},l).then(function(){return o.import(o.depsBundle).then(null,l)}).then(t,n),(S=g.then(function(){return $.call(o),q.call(o),o._configLoaded=!0,u&&o.config(u),o.import("@dev")})).then(function(){if(!o.main||o.localLoader)return g;if(u.loadMainOnStartup){var e=o.main;return"string"==typeof e&&(e=[e]),Promise.all(a(e,function(e){return o.import(e)}))}o._warnNoMain(r._mainWarnMs||2e3)}))}).then(function(e){return o.mainSource?o.module(o.mainSource):(o.loadScriptModules(),e)})},P.done=function(){return O},P.import=function(){var e=arguments,t=this.System;return g||(t.main||(t.main="@empty"),P.startup()),g.then(function(){var n=[];return r(e,function(e){n.push(t.import(e))}),n.length>1?Promise.all(n):n[0]})},P.setContextual=f.call(e.setContextual,e),P.isEnv=f.call(e.isEnv,e),P.isPlatform=f.call(e.isPlatform,e),P};if(!b||v||g){var M=e.steal;e.steal=P(System),e.steal.startup(M&&"object"==typeof M&&M).then(null,function(e){if("undefined"!=typeof console){var t=console;"function"==typeof e.logError?e.logError(t):t[t.error?"error":"log"](e)}}),e.steal.clone=O}else e.steal=P(System),e.steal.System=System,e.steal.dev=require("./ext/dev.js"),steal.clone=O,module.exports=e.steal}("undefined"==typeof window?"undefined"==typeof global?this:global:window); \ No newline at end of file