(function(){"use strict";BX.namespace("BX.LoadExt");var t="scheduled";var e="loaded";var i="load";var n="error";function r(t,e){return e.isInternal&&t.push(e.JS),t}function s(t,e){return!e.isInternal&&t.push(e.JS),t}function o(t){return BX.type.isString(t)?BX.processHTML(t):{SCRIPT:[],STYLE:[]}}function a(t){if(BX.type.isArray(t)){return t}if(BX.type.isString(t)){return[t]}return[]}function l(t){t=a(t);if(!t.length){return Promise.resolve()}return new Promise(function(e){BX.load(t,e)}.bind(this))}BX.LoadExt.Extension=function(e){if(!BX.type.isPlainObject(e)){return new TypeError("data is not object")}this.name=e.extension;this.state=e.html?t:n;var i=o(e.html);this.inlineScripts=i.SCRIPT.reduce(r,[]);this.externalScripts=i.SCRIPT.reduce(s,[]);this.externalStyles=i.STYLE};BX.LoadExt.Extension.prototype={load:function(){if(this.state===n){this.loadPromise=this.loadPromise||Promise.resolve(this);console.warn("Extension",this.name,"not found")}if(!this.loadPromise&&this.state){this.state=i;this.inlineScripts.forEach(BX.evalGlobal);this.loadPromise=Promise.all([l(this.externalScripts),l(this.externalStyles)]).then(function(){this.state=e;return this}.bind(this))}return this.loadPromise}}})();