!function(a){"use strict";varb=a.prototype,c=b.parseFromString;try{if((newa).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){vard,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";functiong(){returnthisinstanceofg?void0:newg}functionh(){returnthisinstanceofh?(g.call(this),void0):newh}functioni(b,d){vare;returnd.element===f&&(d.element=a.createElement("div")),(newc.Queue).push(function(){returno.declareGadgetKlass(b)}).push(function(a){varb,f=a.template_element.body.childNodes;for(m=a,e=newa,e.element=d.element,b=0;b<f.length;b+=1)e.element.appendChild(f[b].cloneNode(!0));returnc.all([e.getRequiredJSList(),e.getRequiredCSSList()])}).push(function(a){varb,d=[];for(b=0;b<a[0].length;b+=1)d.push(o.declareJS(a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(o.declareCSS(a[1][b]));returnc.all(d)}).push(function(){returne})}functionj(){returnthisinstanceofj?(g.call(this),void0):newj}functionk(b,d){varg,h,i,k=c.defer();if(d.element===f)thrownewError("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)thrownewError("The parent element is not attached to the DOM for "+b);returng=newj,h=a.createElement("iframe"),h.setAttribute("src",b),g.path=b,g.element=d.element,d.element.appendChild(h),g.chan=e.build({window:h.contentWindow,origin:"*",scope:"renderJS"}),g.chan.bind("declareMethod",function(a,b){returng[b]=function(){vara=arguments;returnnewc.Promise(function(c,d){g.chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})})},"OK"}),g.chan.bind("ready",function(){returnk.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){returnk.reject(b),"OK"}),c.any([k.promise,c.timeout(5e3)])}functionl(){vard,i,j,k,l,s=b.location.href,t=0,u=!1;if(p.hasOwnProperty(s))thrownewError("bootstrap should not be called twice");n=newc.Promise(function(n,v){functionw(){varb,e,g=o.parseGadgetHTMLDocument(a);for(eing)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){functionb(){returni}vare,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=newc.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]),g.push(b);returng.push(n,function(a){throwv(a),a}),g}).fail(function(a){v(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=newg,d.prototype.constructor=d,d.prototype.path=s,p[s]=d,i=newp[s]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=newh,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===t&&u===!0&&j.notify({method:"ready"})},l=function(a){t+=1,j.call({method:"declareMethod",params:a,success:function(){t-=1,k()},error:function(){t-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){varc=g.declareMethod.apply(this,[a,b]);returnl(a),c}),m=d,a.addEventListener("DOMContentLoaded",w,!1)}),b.self!==b.top&&n.then(function(){u=!0,k()}).fail(function(a){throwj.notify({method:"failed",params:a.toString()}),a})}varm,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],g.ready_list=[],g.ready=function(a){returnthis.ready_list.push(a),this},g.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){returnthis.interface_list}).declareMethod("getRequiredCSSList",function(){returnthis.required_css_list}).declareMethod("getRequiredJSList",function(){returnthis.required_js_list}).declareMethod("getPath",function(){returnthis.path}).declareMethod("getTitle",function(){returnthis.title}).declareMethod("getElement",function(){if(this.element===f)thrownewError("No element defined");returnthis.element}),h.ready_list=[],h.ready=g.ready,h.prototype=newg,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=newg,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){vard,e=n;returnb===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(newc.Queue).push(function(){returne}).push(f,function(){}).push(function(){varc;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)thrownewError("Unsupported sandbox options '"+b.sandbox+"'");c=k}returnc(a,b)}).push(function(a){functionb(){returna}varc;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);returna}).push(f,function(a){throwm=f,a}),n=d},o=function(a){varc;if(a===b?c=m:ainstanceofg&&(c=a),c===f)thrownewError("Unknown selector '"+a+"'");returnc},o.declareJS=function(b){vard;returnd=q.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){vard;returnd=r.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){functionb(){varb,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=newg,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(newd).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(cine)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}returnp[a]}functione(c,d){functione(){vara;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=newXMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}functionh(){j!==f&&j.readyState!==j.DONE&&j.abort()}vari,j;returni=p.hasOwnProperty(a)?c.resolve(p[a]):newc.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){varb,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));returnd},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
!function(a){"use strict";varb=a.prototype,c=b.parseFromString;try{if((newa).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){vard,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";functiong(){returnthisinstanceofg?void0:newg}functionh(){returnthisinstanceofh?(g.call(this),void0):newh}functioni(b,d){vare;returnd.element===f&&(d.element=a.createElement("div")),(newc.Queue).push(function(){returno.declareGadgetKlass(b)}).push(function(a){varb,f=a.template_element.body.childNodes;for(m=a,e=newa,e.element=d.element,b=0;b<f.length;b+=1)e.element.appendChild(f[b].cloneNode(!0));returnc.all([e.getRequiredJSList(),e.getRequiredCSSList()])}).push(function(a){varb,d=[];for(b=0;b<a[0].length;b+=1)d.push(o.declareJS(a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(o.declareCSS(a[1][b]));returnc.all(d)}).push(function(){returne})}functionj(){returnthisinstanceofj?(g.call(this),void0):newj}functionk(b,d){varg,h,i,k=c.defer();if(d.element===f)thrownewError("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)thrownewError("The parent element is not attached to the DOM for "+b);returng=newj,h=a.createElement("iframe"),h.setAttribute("src",b),g.path=b,g.element=d.element,d.element.appendChild(h),g.chan=e.build({window:h.contentWindow,origin:"*",scope:"renderJS"}),g.chan.bind("declareMethod",function(a,b){returng[b]=function(){vara=arguments;returnnewc.Promise(function(c,d){g.chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})})},"OK"}),g.chan.bind("ready",function(){returnk.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){returnk.reject(b),"OK"}),c.any([k.promise,c.timeout(5e3)])}functionl(){vard,i,j,k,l,s=b.location.href,t=0,u=!1;if(p.hasOwnProperty(s))thrownewError("bootstrap should not be called twice");n=newc.Promise(function(n,v){functionw(){varb,e,g=o.parseGadgetHTMLDocument(a);for(eing)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){functionb(){returni}vare,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=newc.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]),g.push(b);returng.push(n,function(a){throwv(a),a}),g}).fail(function(a){v(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=newg,d.prototype.constructor=d,d.prototype.path=s,p[s]=d,i=newp[s]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=newh,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===t&&u===!0&&j.notify({method:"ready"})},l=function(a){t+=1,j.call({method:"declareMethod",params:a,success:function(){t-=1,k()},error:function(){t-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){varc=g.declareMethod.apply(this,[a,b]);returnl(a),c}),m=d,a.addEventListener("DOMContentLoaded",w,!1)}),b.self!==b.top&&n.then(function(){u=!0,k()}).fail(function(a){throwj.notify({method:"failed",params:a.toString()}),a})}varm,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],g.ready_list=[],g.ready=function(a){returnthis.ready_list.push(a),this},g.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){returnthis.interface_list}).declareMethod("getRequiredCSSList",function(){returnthis.required_css_list}).declareMethod("getRequiredJSList",function(){returnthis.required_js_list}).declareMethod("getPath",function(){returnthis.path}).declareMethod("getTitle",function(){returnthis.title}).declareMethod("getElement",function(){if(this.element===f)thrownewError("No element defined");returnthis.element}),h.ready_list=[],h.ready=g.ready,h.prototype=newg,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=newg,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){vard,e=n;returnb===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(newc.Queue).push(function(){returne}).push(function(){varc;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)thrownewError("Unsupported sandbox options '"+b.sandbox+"'");c=k}returnc(a,b)}).push(function(a){functionb(){returna}varc;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);returna}).push(f,function(a){throwm=f,a}),n=d},o=function(a){varc;if(a===b?c=m:ainstanceofg&&(c=a),c===f)thrownewError("Unknown selector '"+a+"'");returnc},o.declareJS=function(b){vard;returnd=q.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){vard;returnd=r.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){functionb(){varb,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=newg,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(newd).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(cine)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}returnp[a]}functione(c,d){functione(){vara;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=newXMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}functionh(){j!==f&&j.readyState!==j.DONE&&j.abort()}vari,j;returni=p.hasOwnProperty(a)?c.resolve(p[a]):newc.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){varb,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));returnd},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
!function(a){"use strict";varb=a.prototype,c=b.parseFromString;try{if((newa).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){vard,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";functiong(){returnthisinstanceofg?void0:newg}functionh(){returnthisinstanceofh?(g.call(this),void0):newh}functioni(b,d){vare;returnd.element===f&&(d.element=a.createElement("div")),(newc.Queue).push(function(){returno.declareGadgetKlass(b)}).push(function(a){varb,f=a.template_element.body.childNodes;for(m=a,e=newa,e.element=d.element,b=0;b<f.length;b+=1)e.element.appendChild(f[b].cloneNode(!0));returnc.all([e.getRequiredJSList(),e.getRequiredCSSList()])}).push(function(a){varb,d=[];for(b=0;b<a[0].length;b+=1)d.push(o.declareJS(a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(o.declareCSS(a[1][b]));returnc.all(d)}).push(function(){returne})}functionj(){returnthisinstanceofj?(g.call(this),void0):newj}functionk(b,d){varg,h,i,k=c.defer();if(d.element===f)thrownewError("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)thrownewError("The parent element is not attached to the DOM for "+b);returng=newj,h=a.createElement("iframe"),h.setAttribute("src",b),g.path=b,g.element=d.element,d.element.appendChild(h),g.chan=e.build({window:h.contentWindow,origin:"*",scope:"renderJS"}),g.chan.bind("declareMethod",function(a,b){returng[b]=function(){vara=arguments;returnnewc.Promise(function(c,d){g.chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})})},"OK"}),g.chan.bind("ready",function(){returnk.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){returnk.reject(b),"OK"}),c.any([k.promise,c.timeout(5e3)])}functionl(){vard,i,j,k,l,s=b.location.href,t=0,u=!1;if(p.hasOwnProperty(s))thrownewError("bootstrap should not be called twice");n=newc.Promise(function(n,v){functionw(){varb,e,g=o.parseGadgetHTMLDocument(a);for(eing)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){functionb(){returni}vare,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=newc.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]),g.push(b);returng.push(n,function(a){throwv(a),a}),g}).fail(function(a){v(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=newg,d.prototype.constructor=d,d.prototype.path=s,p[s]=d,i=newp[s]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=newh,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===t&&u===!0&&j.notify({method:"ready"})},l=function(a){t+=1,j.call({method:"declareMethod",params:a,success:function(){t-=1,k()},error:function(){t-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){varc=g.declareMethod.apply(this,[a,b]);returnl(a),c}),m=d,a.addEventListener("DOMContentLoaded",w,!1)}),b.self!==b.top&&n.then(function(){u=!0,k()}).fail(function(a){throwj.notify({method:"failed",params:a.toString()}),a})}varm,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],g.ready_list=[],g.ready=function(a){returnthis.ready_list.push(a),this},g.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){returnthis.interface_list}).declareMethod("getRequiredCSSList",function(){returnthis.required_css_list}).declareMethod("getRequiredJSList",function(){returnthis.required_js_list}).declareMethod("getPath",function(){returnthis.path}).declareMethod("getTitle",function(){returnthis.title}).declareMethod("getElement",function(){if(this.element===f)thrownewError("No element defined");returnthis.element}),h.ready_list=[],h.ready=g.ready,h.prototype=newg,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=newg,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){vard,e=n;returnb===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(newc.Queue).push(function(){returne}).push(f,function(){}).push(function(){varc;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)thrownewError("Unsupported sandbox options '"+b.sandbox+"'");c=k}returnc(a,b)}).push(function(a){functionb(){returna}varc;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);returna}).push(f,function(a){throwm=f,a}),n=d},o=function(a){varc;if(a===b?c=m:ainstanceofg&&(c=a),c===f)thrownewError("Unknown selector '"+a+"'");returnc},o.declareJS=function(b){vard;returnd=q.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){vard;returnd=r.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){functionb(){varb,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=newg,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(newd).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(cine)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}returnp[a]}functione(c,d){functione(){vara;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=newXMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}functionh(){j!==f&&j.readyState!==j.DONE&&j.abort()}vari,j;returni=p.hasOwnProperty(a)?c.resolve(p[a]):newc.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){varb,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));returnd},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);