varChannel=function(){"use strict";functiona(a,b,c,d){functionf(b){for(varc=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}varg=!1;if("*"===b){for(varhine)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeofe[h][c]&&(g=f(e[h][c])))break}elsee["*"]&&e["*"][c]&&(g=f(e["*"][c])),!g&&e[b]&&e[b][c]&&(g=f(e[b][c]));if(g)throw"A channel is already bound to the same window which overlaps with origin '"+b+"' and has scope '"+c+"'";"object"!=typeofe[b]&&(e[b]={}),"object"!=typeofe[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}functionb(a,b,c){for(vard=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&deletee[b][c]}functionc(a){returnArray.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}vard=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{varb=JSON.parse(a.data);if("object"!=typeofb||null===b)throw"malformed"}catch(a){return}varc,d,g,h=a.source,i=a.origin;if("string"==typeofb.method){varj=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeofb.id&&(d=b.id),"string"==typeofg){vark=!1;if(e[i]&&e[i][c])for(varl=0;l<e[i][c].length;l++)if(e[i][c][l].win===h){e[i][c][l].handler(i,g,b),k=!0;break}if(!k&&e["*"]&&e["*"][c])for(varl=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeofd&&f[d]&&f[d](i,g,b)};returnwindow.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){varg=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeofa&&(a=JSON.stringify(a))}catch(b){}console.log("["+j+"] "+a)}};if(!window.postMessage)throw"jschannel cannot run this browser, no postMessage";if(!window.JSON||!window.JSON.stringify||!window.JSON.parse)throw"jschannel cannot run this browser, no JSON parsing/serialization";if("object"!=typeofe)throw"Channel build invoked without a proper object argument";if(!e.window||!e.window.postMessage)throw"Channel.build() called without a valid window argument";if(window===e.window)throw"target window is same as present window -- not allowed";varh=!1;if("string"==typeofe.origin){vari;"*"===e.origin?h=!0:null!==(i=e.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/))&&(e.origin=i[0].toLowerCase(),h=!0)}if(!h)throw"Channel.build() called with an invalid origin";if("undefined"!=typeofe.scope){if("string"!=typeofe.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}varj=function(){for(vara="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));returna}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){vard=!1,e=!1;return{origin:b,invoke:function(b,d){if(!m[a])throw"attempting to invoke a callback of a nonexistent transaction: "+a;for(vare=!1,f=0;f<c.length;f++)if(b===c[f]){e=!0;break}if(!e)throw"request supports no such callback '"+b+"'";t({id:a,callback:b,params:d})},error:function(b,c){if(e=!0,!m[a])throw"error called for nonexistent message: "+a;deletem[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;deletem[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeofa&&(d=a===!0),d},completed:function(){returne}}},q=function(a,b,c){returnwindow.setTimeout(function(){if(l[a]){vard="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),deletel[a],deletef[a]}},b)},r=function(a,b,d){if("function"==typeofe.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){vari=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(varj=0;j<d.callbacks.length;j++){for(varn=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){vars=q[r];"object"!=typeofo[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){vara=n;returnfunction(b){returni.invoke(a,b)}}()}vart=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){varu="runtime_error",v=null;if("string"==typeofh?v=h:"object"==typeofh&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeofh.error&&(u=h.error,h.message?"string"==typeofh.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeofv&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}elsed.id&&d.callback?l[d.id]&&l[d.id].callbacks&&l[d.id].callbacks[d.callback]?l[d.id].callbacks[d.callback](d.params):g("ignoring invalid callback, id:"+d.id+" ("+d.callback+")"):d.id?l[d.id]?(d.error?l[d.id].error(d.error,d.message):void0!==d.result?l[d.id].success(d.result):l[d.id].success(),deletel[d.id],deletef[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeofe.scope?e.scope:"",r);vars=function(a){return"string"==typeofe.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";varc=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeofe.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}elseo.push(a)},u=function(a,b){if(g("ready msg received"),n)throw"received ready message while in ready state. help!";for(j+="ping"===b?"-R":"-L",v.unbind("__ready"),n=!0,g("ready msg accepted."),"ping"===b&&v.notify({method:"__ready",params:"pong"});o.length;)t(o.pop());"function"==typeofe.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!deletek[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeofa)throw"'method' argument to bind must be string";if(!b||"function"!=typeofb)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";returnk[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeofa.success)throw"'success' callback missing from call";varb={},c=[],e=function(a,d){if("object"==typeofd)for(varfind)if(d.hasOwnProperty(f)){varg=a+(a.length?"/":"")+f;"function"==typeofd[f]?(b[g]=d[f],c.push(g),deleted[f]):"object"==typeofd[f]&&e(g,d[f])}};e("",a.params);varg={id:d,method:s(a.method),params:a.params};c.length&&(g.callbacks=c),a.timeout&&q(d,a.timeout,s(a.method)),l[d]={callbacks:b,error:a.error,success:a.success},f[d]=r,d++,t(g)},notify:function(a){if(!a)throw"missing arguments to notify function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to notify must be string";t({method:s(a.method),params:a.params})},destroy:function(){b(e.window,e.origin,"string"==typeofe.scope?e.scope:""),window.removeEventListener?window.removeEventListener("message",r,!1):window.detachEvent&&window.detachEvent("onmessage",r),n=!1,k={},m={},l={},e.origin=null,o=[],g("channel destroyed"),j=""}};returnv.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!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"!=typeofdocument.contains&&(Document.prototype.contains=function(a){returna===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";functionm(a){varb=newh;returnnewc.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}functionn(a,b,d,e,f){functiong(){void0!==k&&"function"==typeofk.cancel&&k.cancel()}functionh(){void0!==j&&a.removeEventListener(b,j,d),g()}functioni(i,l){varm;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(newc.Queue).push(function(){returnm}).push(void0,function(a){ainstanceofc.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}varj,k;returnvoid0===f&&(f=!0),newc.Promise(i,h)}functiono(a){functionb(b,c){functiond(){try{0===e.readyState?c(e):4===e.readyState&&(e.status<200||e.status>=300||!/^text\/html[;]?/.test(e.getResponseHeader("Content-Type")||"")?c(e):b(e))}catch(a){c(a)}}e=newXMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}functiond(){void0!==e&&e.readyState!==e.DONE&&e.abort()}vare;returnnewc.Promise(b,d)}functionp(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functionq(c){vard,e,f,g,h,i;if(Q)returnconsole.info("-- Error dropped, as page is unloaded"),voidconsole.info(c);for(R.push(c),R.push(newError("stopping renderJS")),e=a.getElementsByTagName("body")[0];e.firstChild;)e.removeChild(e.firstChild);for(f=a.createElement("section"),g=a.createElement("h1"),g.textContent="Unhandled Error",f.appendChild(g),g=a.createElement("p"),g.textContent="Please report this error to the support team",f.appendChild(g),g=a.createElement("p"),g.textContent="Location: ",h=a.createElement("a"),h.href=h.textContent=b.location.toString(),g.appendChild(h),f.appendChild(g),g=a.createElement("p"),g.textContent="User-agent: "+j.userAgent,f.appendChild(g),g=a.createElement("p"),g.textContent="Date: "+newDate(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<R.length;d+=1){if(i=R[d],iinstanceofk&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void0!==i.target&&R.splice(d+1,0,i.target)),iinstanceofXMLHttpRequest&&(i={message:i.toString(),readyState:i.readyState,status:i.status,statusText:i.statusText,response:i.response,responseUrl:i.responseUrl,response_headers:i.getAllResponseHeaders()}),i.constructor===Array||i.constructor===String||i.constructor===Object)try{i=JSON.stringify(i)}catch(l){}f=a.createElement("section"),g=a.createElement("h2"),g.textContent=i.message||i,f.appendChild(g),void0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}functionr(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functions(){returnthisinstanceofs?void0:news}functiont(a){void0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=newJ,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(function(a){returnq(a)})}functionu(){this.__sub_gadget_dict={},t(this)}functionv(){functiona(a){returnfunction(b){varc=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))returnc[d].apply(j,[arguments,a]);throwb}}varb,d,e,f,g,h=this.element.querySelectorAll("[data-gadget-url]"),i=[],j=this;for(g=0;g<h.length;g+=1)b=h[g],d=b.getAttribute("data-gadget-scope"),e=b.getAttribute("data-gadget-url"),f=b.getAttribute("data-gadget-sandbox"),null!==e&&i.push(j.declareGadget(e,{element:b,scope:d||void0,sandbox:f||void0}).push(void0,a(d)));returnc.all(i)}functionw(a,b,d,e){varf=(newc.Queue).push(function(){returnd.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((newc.Queue).push(function(){returnf}).push(void0,function(a){if(!(ainstanceofc.CancellationError))throwa}))}functionx(a){a.__monitor.monitor((newc.Queue).push(function(){varb,c=a.constructor.__service_list,d=a.__job_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a));for(b=0;b<d.length;b+=1)w(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}functiony(a,b,d){vare,f,g=this;for(eing.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(newc.Queue).push(function(){vara=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))returna[b].apply(g,[d,f]);thrownewI.AcquisitionError("aq_dynamic is not defined")}).push(void0,function(a){if(ainstanceofI.AcquisitionError)returng.__aq_parent(b,d);throwa})}functionz(a,b){a.__aq_parent=function(c,d){returny.apply(b,[a,c,d])}}functionA(){returnthisinstanceofA?voids.call(this):newA}functionB(b,d,e){return(newc.Queue).push(function(){returnI.declareGadgetKlass(b).then(function(a){returna})}).push(function(b){void0===d.element&&(d.element=a.createElement("div"));varc,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=newb,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));returnf.element.appendChild(h),z(f,e),f})}functionC(){returnthisinstanceofC?voids.call(this):newC}functionD(b,d,f){varg,h,i=c.defer();if(void0===d.element)thrownewError("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))thrownewError("The parent element is not attached to the DOM for "+b);returng=newC,z(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){returnc.timeout(5e3).fail(function(){i.reject(newError("Timeout while loading: "+b))})}),h.setAttribute("src",b),g.__path=b,g.element=d.element,g.state={},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,d=newc.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)}})});return(newc.Queue).push(function(){returnd})},"OK"}),g.__chan.bind("ready",function(a){returni.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){returni.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}functionE(a,b,e){return(newc.Queue).push(function(){returno(a)}).push(function(b){varc,e=(newd).parseFromString(b.responseText,"text/html"),f=e.createElement("base");returnf.href=a,e.head.insertBefore(f,e.head.firstChild),c=newi([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){returnD(a,b,e)})}functionF(a,b){varc,e,f;c=function(){s.call(this)},c.__ready_list=s.__ready_list.slice(),c.__service_list=s.__service_list.slice(),c.declareMethod=s.declareMethod,c.declareJob=s.declareJob,c.declareAcquiredMethod=s.declareAcquiredMethod,c.allowPublicAcquisition=s.allowPublicAcquisition,c.ready=s.ready,c.setState=s.setState,c.onStateChange=s.onStateChange,c.declareService=s.declareService,c.onEvent=s.onEvent,c.prototype=news,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(newd).parseFromString(a.responseText,"text/html"),f=I.parseGadgetHTMLDocument(c.__template_element,b);for(einf)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);returnc}functionG(){vard,h,i,j,k,l,m,n,o=p(b.location.href),r=newc.Queue,u=0,v=!1,w=[],y=!1,B=!1;if(K.hasOwnProperty(o))thrownewError("bootstrap should not be called twice");H=newc.Promise(function(p,r){functionC(){varb,e,i=I.parseGadgetHTMLDocument(a,o),j=a.createDocumentFragment();for(eini)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)j.appendChild(h.element.childNodes[b].cloneNode(!0));d.__template_element.appendChild(j),c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)L[c[b]]=null;for(b=0;b<d.length;b+=1)M[d[b]]=null;N.shift()}).then(function(){varb=a.querySelector("body"),c=newf(function(b){varc,d,e,f,h,i;b.forEach(function(b){if("childList"===b.type){for(e=b.removedNodes.length,c=0;e>c;c+=1)if(h=b.removedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&t(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&t(h._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(h=b.addedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&a.contains(h)&&x(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void0!==h._gadget&&x(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),h}).then(p,function(a){throwr(a),console.error(a),a})}m=news,m.__acquired_method_dict={reportServiceError:function(a){q(a[0])}},m.__aq_parent=function(a){thrownewI.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){s.call(this)},d.declareMethod=s.declareMethod,d.declareJob=s.declareJob,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,d.__ready_list=s.__ready_list.slice(),d.ready=s.ready,d.setState=s.setState,d.onStateChange=s.onStateChange,d.__service_list=s.__service_list.slice(),d.declareService=s.declareService,d.onEvent=s.onEvent,d.prototype=news,d.prototype.constructor=d,d.prototype.__path=o,K[o]={promise:c.resolve(d)},h=newd,z(h,m)):(d=A,d.__ready_list=s.__ready_list.slice(),d.__service_list=s.__service_list.slice(),d.prototype.__path=o,h=newA,z(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){vara;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){returnnewc.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){u+=1,i.call({method:"declareMethod",params:a,success:function(){u-=1,j()},error:function(){u-=1}})},a=0;a<w.length;a+=1)k(w[a]);returnw=[],y?voidi.notify({method:"failed",params:n}):(B=!0,j(),voidi.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===u&&v===!0&&i.notify({method:"ready"})},k=function(a){w.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){varc=s.declareMethod.apply(this,[a,b]);returnk(a),c},d.declareService=s.declareService,d.declareJob=s.declareJob,d.onEvent=s.onEvent,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},N.push(d),a.addEventListener("DOMContentLoaded",C,!1)}),r.push(function(){returnH}).push(function(a){functionb(){returna}functionc(a){returnfunction(b){returna.call(b,b)}}vare;for(d.ready(function(){returnx(this)}),r.push(b),e=0;e<d.__ready_list.length;e+=1)r.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?r.fail(function(a){throwq(a),a}):r.then(function(){v=!0,B&&j()}).fail(function(a){throwl?(y=!0,n=a.toString(),q(a)):i.notify({method:"failed",params:a.toString()}),a})}varH,I,J,K={},L={},M={},N=[],O=0,P=newRegExp("^(?:[a-z]+:)?//|data:","i"),Q=!1,R=[];b.addEventListener("error",function(a){R.push(a)}),b.addEventListener("beforeunload",function(){Q=!0}),r.prototype=newError,r.prototype.constructor=r,J=function(){functiona(){vara,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}varb,d,e,f,g=this,h=[];returnthisinstanceofJ?(b=newc.Promise(function(b,c,h){d=function(b){returnf?void0:(g.isRejected=!0,g.rejectedReason=b,f=!0,a(),c(b))},e=h},a),g.cancel=function(){f||(f=!0,b.cancel(),b.fail(function(a){g.isRejected=!0,g.rejectedReason=a}))},g.then=function(){returnb.then.apply(b,arguments)},g.fail=function(){returnb.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)thrownewr;varb=(newc.Queue).push(function(){returna}).push(function(a){varb,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){returne(a),a});returnh.push(b),this})):newJ},J.prototype=Object.create(c.Promise.prototype),J.prototype.constructor=J,s.prototype.__title="",s.prototype.__interface_list=[],s.prototype.__path="",s.prototype.__html="",s.prototype.__required_css_list=[],s.prototype.__required_js_list=[],s.__ready_list=[u,v],s.ready=function(a){returnthis.__ready_list.push(a),this},s.setState=function(a){varb=JSON.stringify(a);returnthis.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},s.onStateChange=function(a){returnthis.prototype.__state_change_callback=a,this},s.__service_list=[],s.declareService=function(a){returnthis.__service_list.push(a),this},s.onEvent=function(a,b,c,d){returnthis.__service_list.push(function(){returnn(this.element,a,c,b.bind(this),d)}),this},s.declareJob=function(a,b){returnthis.prototype[a]=function(){varc=this,d=arguments;c.__job_triggered?w(c,a,b,d):c.__job_list.push([a,b,d])},this},s.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},s.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(void0===this.element)thrownewError("No element defined");returnthis.element}).declareMethod("changeState",function(a){varb,d=newc.Queue,e=this;returne.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){returnb}).push(void0,function(){})),e.__previous_onStateChange=d,d.push(function(){varb,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(bina)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);returnf&&void0!==e.__state_change_callback?(e.__modification_dict=d,(newc.Queue).push(function(){returne.__state_change_callback(d)}).push(function(a){returndeletee.__modification_dict,a})):void0})}),s.declareAcquiredMethod=function(a,b){returnthis.prototype[a]=function(){vara=Array.prototype.slice.call(arguments,0),d=this;return(newc.Queue).push(function(){returnd.__aq_parent(b,a)})},this},s.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),s.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),s.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},A.__ready_list=s.__ready_list.slice(),A.__service_list=s.__service_list.slice(),A.ready=s.ready,A.setState=s.setState,A.onStateChange=s.onStateChange,A.declareService=s.declareService,A.onEvent=s.onEvent,A.prototype=news,A.prototype.constructor=A,C.__ready_list=s.__ready_list.slice(),C.ready=s.ready,C.setState=s.setState,C.onStateChange=s.onStateChange,C.__service_list=s.__service_list.slice(),C.declareService=s.declareService,C.onEvent=s.onEvent,C.prototype=news,C.prototype.constructor=C,s.declareMethod("declareGadget",function(b,d){vare=this;returnvoid0===d&&(d={}),void0===d.sandbox&&(d.sandbox="public"),b=I.getAbsoluteURL(b,this.__path),(newc.Queue).push(function(){vara;if("public"===d.sandbox)a=B;elseif("iframe"===d.sandbox)a=D;else{if("dataurl"!==d.sandbox)thrownewError("Unsupported sandbox options '"+d.sandbox+"'");a=E}returna(b,d,e)}).push(function(f){functiong(){returnf}functionh(a){returnfunction(){returna.call(f,f)}}vari,j,k=newc.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void0===j)for(j="RJS_"+O,O+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+O,O+=1;returne.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(x),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");returnthis.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");deletethis.__sub_gadget_dict[a]}),I=function(a){varc;if(a===b&&(c=N[0]),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},I.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},I.AcquisitionError.prototype=newError,I.AcquisitionError.prototype.constructor=I.AcquisitionError,I.getAbsoluteURL=function(a,b){returnb&&a?newl(a,b).href:a},I.declareJS=function(b,d,e){varf;returnL.hasOwnProperty(b)?f=c.resolve():(L[b]=null,f=newc.Promise(function(c,f){varg;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&N.shift(),c()},g.onerror=function(a){e===!0&&N.shift(),f(a)},g.src=b,d.appendChild(g)})),f},I.declareCSS=function(b,d){vare;returne=M.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,e){varf;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){M[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},I.declareGadgetKlass=function(b){if(K.hasOwnProperty(b))returnK[b].promise;vard,e=c.defer();returnK[b]=e,H=e.promise,(newc.Queue).push(function(){returno(b)}).push(function(e){d=F(e,b);varf,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(N.push(d),f=0;f<i.length-1;f+=1)h.push(I.declareJS(i[f],g));h.push(I.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(I.declareCSS(j[f],g));returna.head.appendChild(g),c.all(h)}).push(function(){returne.resolve(d),d}).push(void0,function(a){throwe.reject(a),a})},I.clearGadgetKlassList=function(){K={},L={},M={}},I.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!P.test(b))thrownewError("The url should be absolute: "+b);if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");if(e.title=a.title,null!==a.head)for(c=0;c<a.head.children.length;c+=1)d=a.head.children[c],null!==d.href&&("stylesheet"===d.rel?e.required_css_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):"SCRIPT"!==d.nodeName||"text/javascript"!==d.type&&d.type?"http://www.renderjs.org/rel/interface"===d.rel&&e.interface_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(I.getAbsoluteURL(d.getAttribute("src"),b)));returne},b.rJS=b.renderJS=I,b.__RenderJSGadget=s,b.__RenderJSEmbeddedGadget=A,b.__RenderJSIframeGadget=C,G()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
varChannel=function(){"use strict";functiona(a,b,c,d){functionf(b){for(varc=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}varg=!1;if("*"===b){for(varhine)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeofe[h][c]&&(g=f(e[h][c])))break}elsee["*"]&&e["*"][c]&&(g=f(e["*"][c])),!g&&e[b]&&e[b][c]&&(g=f(e[b][c]));if(g)throw"A channel is already bound to the same window which overlaps with origin '"+b+"' and has scope '"+c+"'";"object"!=typeofe[b]&&(e[b]={}),"object"!=typeofe[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}functionb(a,b,c){for(vard=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&deletee[b][c]}functionc(a){returnArray.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}vard=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{varb=JSON.parse(a.data);if("object"!=typeofb||null===b)throw"malformed"}catch(a){return}varc,d,g,h=a.source,i=a.origin;if("string"==typeofb.method){varj=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeofb.id&&(d=b.id),"string"==typeofg){vark=!1;if(e[i]&&e[i][c])for(varl=0;l<e[i][c].length;l++)if(e[i][c][l].win===h){e[i][c][l].handler(i,g,b),k=!0;break}if(!k&&e["*"]&&e["*"][c])for(varl=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeofd&&f[d]&&f[d](i,g,b)};returnwindow.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){varg=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeofa&&(a=JSON.stringify(a))}catch(b){}console.log("["+j+"] "+a)}};if(!window.postMessage)throw"jschannel cannot run this browser, no postMessage";if(!window.JSON||!window.JSON.stringify||!window.JSON.parse)throw"jschannel cannot run this browser, no JSON parsing/serialization";if("object"!=typeofe)throw"Channel build invoked without a proper object argument";if(!e.window||!e.window.postMessage)throw"Channel.build() called without a valid window argument";if(window===e.window)throw"target window is same as present window -- not allowed";varh=!1;if("string"==typeofe.origin){vari;"*"===e.origin?h=!0:null!==(i=e.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/))&&(e.origin=i[0].toLowerCase(),h=!0)}if(!h)throw"Channel.build() called with an invalid origin";if("undefined"!=typeofe.scope){if("string"!=typeofe.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}varj=function(){for(vara="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));returna}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){vard=!1,e=!1;return{origin:b,invoke:function(b,d){if(!m[a])throw"attempting to invoke a callback of a nonexistent transaction: "+a;for(vare=!1,f=0;f<c.length;f++)if(b===c[f]){e=!0;break}if(!e)throw"request supports no such callback '"+b+"'";t({id:a,callback:b,params:d})},error:function(b,c){if(e=!0,!m[a])throw"error called for nonexistent message: "+a;deletem[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;deletem[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeofa&&(d=a===!0),d},completed:function(){returne}}},q=function(a,b,c){returnwindow.setTimeout(function(){if(l[a]){vard="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),deletel[a],deletef[a]}},b)},r=function(a,b,d){if("function"==typeofe.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){vari=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(varj=0;j<d.callbacks.length;j++){for(varn=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){vars=q[r];"object"!=typeofo[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){vara=n;returnfunction(b){returni.invoke(a,b)}}()}vart=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){varu="runtime_error",v=null;if("string"==typeofh?v=h:"object"==typeofh&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeofh.error&&(u=h.error,h.message?"string"==typeofh.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeofv&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}elsed.id&&d.callback?l[d.id]&&l[d.id].callbacks&&l[d.id].callbacks[d.callback]?l[d.id].callbacks[d.callback](d.params):g("ignoring invalid callback, id:"+d.id+" ("+d.callback+")"):d.id?l[d.id]?(d.error?l[d.id].error(d.error,d.message):void0!==d.result?l[d.id].success(d.result):l[d.id].success(),deletel[d.id],deletef[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeofe.scope?e.scope:"",r);vars=function(a){return"string"==typeofe.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";varc=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeofe.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}elseo.push(a)},u=function(a,b){if(g("ready msg received"),n)throw"received ready message while in ready state. help!";for(j+="ping"===b?"-R":"-L",v.unbind("__ready"),n=!0,g("ready msg accepted."),"ping"===b&&v.notify({method:"__ready",params:"pong"});o.length;)t(o.pop());"function"==typeofe.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!deletek[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeofa)throw"'method' argument to bind must be string";if(!b||"function"!=typeofb)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";returnk[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeofa.success)throw"'success' callback missing from call";varb={},c=[],e=function(a,d){if("object"==typeofd)for(varfind)if(d.hasOwnProperty(f)){varg=a+(a.length?"/":"")+f;"function"==typeofd[f]?(b[g]=d[f],c.push(g),deleted[f]):"object"==typeofd[f]&&e(g,d[f])}};e("",a.params);varg={id:d,method:s(a.method),params:a.params};c.length&&(g.callbacks=c),a.timeout&&q(d,a.timeout,s(a.method)),l[d]={callbacks:b,error:a.error,success:a.success},f[d]=r,d++,t(g)},notify:function(a){if(!a)throw"missing arguments to notify function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to notify must be string";t({method:s(a.method),params:a.params})},destroy:function(){b(e.window,e.origin,"string"==typeofe.scope?e.scope:""),window.removeEventListener?window.removeEventListener("message",r,!1):window.detachEvent&&window.detachEvent("onmessage",r),n=!1,k={},m={},l={},e.origin=null,o=[],g("channel destroyed"),j=""}};returnv.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!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"!=typeofdocument.contains&&(Document.prototype.contains=function(a){returna===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";functionm(a){varb=newh;returnnewc.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}functionn(a,b,d,e,f){functiong(){void0!==k&&"function"==typeofk.cancel&&k.cancel()}functionh(){void0!==j&&a.removeEventListener(b,j,d),g()}functioni(i,l){varm;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(newc.Queue).push(function(){returnm}).push(void0,function(a){ainstanceofc.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}varj,k;returnvoid0===f&&(f=!0),newc.Promise(i,h)}functiono(a){functionb(b,c){functiond(){try{0===e.readyState?c(e):4===e.readyState&&(e.status<200||e.status>=300||!/^text\/html[;]?/.test(e.getResponseHeader("Content-Type")||"")?c(e):b(e))}catch(a){c(a)}}e=newXMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}functiond(){void0!==e&&e.readyState!==e.DONE&&e.abort()}vare;returnnewc.Promise(b,d)}functionp(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functionq(c){vard,e,f,g,h,i;if(Q)returnconsole.info("-- Error dropped, as page is unloaded"),voidconsole.info(c);for(R.push(c),R.push(newError("stopping renderJS")),e=a.getElementsByTagName("body")[0];e.firstChild;)e.removeChild(e.firstChild);for(f=a.createElement("section"),g=a.createElement("h1"),g.textContent="Unhandled Error",f.appendChild(g),g=a.createElement("p"),g.textContent="Please report this error to the support team",f.appendChild(g),g=a.createElement("p"),g.textContent="Location: ",h=a.createElement("a"),h.href=h.textContent=b.location.toString(),g.appendChild(h),f.appendChild(g),g=a.createElement("p"),g.textContent="User-agent: "+j.userAgent,f.appendChild(g),g=a.createElement("p"),g.textContent="Date: "+newDate(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<R.length;d+=1){if(i=R[d],iinstanceofk&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void0!==i.target&&R.splice(d+1,0,i.target)),iinstanceofXMLHttpRequest&&(i={message:i.toString(),readyState:i.readyState,status:i.status,statusText:i.statusText,response:i.response,responseUrl:i.responseUrl,response_headers:i.getAllResponseHeaders()}),i.constructor===Array||i.constructor===String||i.constructor===Object)try{i=JSON.stringify(i)}catch(l){}f=a.createElement("section"),g=a.createElement("h2"),g.textContent=i.message||i,f.appendChild(g),void0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}functionr(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functions(){returnthisinstanceofs?void0:news}functiont(a){void0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=newJ,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(function(a){returnq(a)})}functionu(){this.__sub_gadget_dict={},t(this)}functionv(){functiona(a){returnfunction(b){varc=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))returnc[d].apply(j,[arguments,a]);throwb}}varb,d,e,f,g,h=this.element.querySelectorAll("[data-gadget-url]"),i=[],j=this;for(g=0;g<h.length;g+=1)b=h[g],d=b.getAttribute("data-gadget-scope"),e=b.getAttribute("data-gadget-url"),f=b.getAttribute("data-gadget-sandbox"),null!==e&&i.push(j.declareGadget(e,{element:b,scope:d||void0,sandbox:f||void0}).push(void0,a(d)));returnc.all(i)}functionw(a,b,d,e){varf=(newc.Queue).push(function(){returnd.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((newc.Queue).push(function(){returnf}).push(void0,function(a){if(!(ainstanceofc.CancellationError))throwa}))}functionx(a){a.__monitor.monitor((newc.Queue).push(function(){varb,c=a.constructor.__service_list,d=a.__job_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a));for(b=0;b<d.length;b+=1)w(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}functiony(a,b,d){vare,f,g=this;for(eing.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(newc.Queue).push(function(){vara=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))returna[b].apply(g,[d,f]);thrownewI.AcquisitionError("aq_dynamic is not defined")}).push(void0,function(a){if(ainstanceofI.AcquisitionError)returng.__aq_parent(b,d);throwa})}functionz(a,b){a.__aq_parent=function(c,d){returny.apply(b,[a,c,d])}}functionA(){returnthisinstanceofA?voids.call(this):newA}functionB(b,d,e){return(newc.Queue).push(function(){returnI.declareGadgetKlass(b).then(function(a){returna})}).push(function(b){void0===d.element&&(d.element=a.createElement("div"));varc,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=newb,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));returnf.element.appendChild(h),z(f,e),f})}functionC(){returnthisinstanceofC?voids.call(this):newC}functionD(b,d,f){varg,h,i=c.defer();if(void0===d.element)thrownewError("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))thrownewError("The parent element is not attached to the DOM for "+b);returng=newC,z(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){returnc.timeout(5e3).fail(function(){i.reject(newError("Timeout while loading: "+b))})}),h.setAttribute("src",b),g.__path=b,g.element=d.element,g.state={},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,d=newc.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)}})});return(newc.Queue).push(function(){returnd})},"OK"}),g.__chan.bind("ready",function(a){returni.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){returni.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}functionE(a,b,e){return(newc.Queue).push(function(){returno(a)}).push(function(b){varc,e=(newd).parseFromString(b.responseText,"text/html"),f=e.createElement("base");returnf.href=a,e.head.insertBefore(f,e.head.firstChild),c=newi([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){returnD(a,b,e)})}functionF(a,b){varc,e,f;c=function(){s.call(this)},c.__ready_list=s.__ready_list.slice(),c.__service_list=s.__service_list.slice(),c.declareMethod=s.declareMethod,c.declareJob=s.declareJob,c.declareAcquiredMethod=s.declareAcquiredMethod,c.allowPublicAcquisition=s.allowPublicAcquisition,c.ready=s.ready,c.setState=s.setState,c.onStateChange=s.onStateChange,c.declareService=s.declareService,c.onEvent=s.onEvent,c.prototype=news,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(newd).parseFromString(a.responseText,"text/html"),f=I.parseGadgetHTMLDocument(c.__template_element,b);for(einf)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);returnc}functionG(){vard,h,i,j,k,l,m,n,o=p(b.location.href),r=newc.Queue,u=0,v=!1,w=[],y=!1,B=!1;if(K.hasOwnProperty(o))thrownewError("bootstrap should not be called twice");H=newc.Promise(function(p,r){functionC(){varb,e,i=I.parseGadgetHTMLDocument(a,o),j=a.createDocumentFragment();for(eini)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)j.appendChild(h.element.childNodes[b].cloneNode(!0));d.__template_element.appendChild(j),c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)L[c[b]]=null;for(b=0;b<d.length;b+=1)M[d[b]]=null;N.shift()}).then(function(){varb=a.querySelector("body"),c=newf(function(b){varc,d,e,f,h,i;b.forEach(function(b){if("childList"===b.type){for(e=b.removedNodes.length,c=0;e>c;c+=1)if(h=b.removedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&t(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&t(h._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(h=b.addedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&a.contains(h)&&x(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void0!==h._gadget&&x(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),h}).then(p,function(a){throwr(a),console.error(a),a})}m=news,m.__acquired_method_dict={reportServiceError:function(a){q(a[0])}},m.__aq_parent=function(a){thrownewI.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){s.call(this)},d.declareMethod=s.declareMethod,d.declareJob=s.declareJob,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,d.__ready_list=s.__ready_list.slice(),d.ready=s.ready,d.setState=s.setState,d.onStateChange=s.onStateChange,d.__service_list=s.__service_list.slice(),d.declareService=s.declareService,d.onEvent=s.onEvent,d.prototype=news,d.prototype.constructor=d,d.prototype.__path=o,K[o]={promise:c.resolve(d)},h=newd,z(h,m)):(d=A,d.__ready_list=s.__ready_list.slice(),d.__service_list=s.__service_list.slice(),d.prototype.__path=o,h=newA,z(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){vara;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){returnnewc.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){u+=1,i.call({method:"declareMethod",params:a,success:function(){u-=1,j()},error:function(){u-=1}})},a=0;a<w.length;a+=1)k(w[a]);returnw=[],y?voidi.notify({method:"failed",params:n}):(B=!0,j(),voidi.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===u&&v===!0&&i.notify({method:"ready"})},k=function(a){w.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){varc=s.declareMethod.apply(this,[a,b]);returnk(a),c},d.declareService=s.declareService,d.declareJob=s.declareJob,d.onEvent=s.onEvent,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},N.push(d),a.addEventListener("DOMContentLoaded",C,!1)}),r.push(function(){returnH}).push(function(a){functionb(){returna}functionc(a){returnfunction(b){returna.call(b,b)}}vare;for(d.ready(function(){returnx(this)}),r.push(b),e=0;e<d.__ready_list.length;e+=1)r.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?r.fail(function(a){throwq(a),a}):r.then(function(){v=!0,B&&j()}).fail(function(a){throwl?(y=!0,n=a.toString(),q(a)):i.notify({method:"failed",params:a.toString()}),a})}varH,I,J,K={},L={},M={},N=[],O=0,P=newRegExp("^(?:[a-z]+:)?//|data:","i"),Q=!1,R=[];b.addEventListener("error",function(a){R.push(a)}),b.addEventListener("beforeunload",function(){Q=!0}),r.prototype=newError,r.prototype.constructor=r,J=function(){functiona(){vara,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}varb,d,e,f,g=this,h=[];returnthisinstanceofJ?(b=newc.Promise(function(b,c,h){d=function(b){returnf?void0:(g.isRejected=!0,g.rejectedReason=b,f=!0,a(),c(b))},e=h},a),g.cancel=function(){f||(f=!0,b.cancel(),b.fail(function(a){g.isRejected=!0,g.rejectedReason=a}))},g.then=function(){returnb.then.apply(b,arguments)},g.fail=function(){returnb.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)thrownewr;varb=(newc.Queue).push(function(){returna}).push(function(a){varb,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){returne(a),a});returnh.push(b),this})):newJ},J.prototype=Object.create(c.Promise.prototype),J.prototype.constructor=J,s.prototype.__title="",s.prototype.__interface_list=[],s.prototype.__path="",s.prototype.__html="",s.prototype.__required_css_list=[],s.prototype.__required_js_list=[],s.__ready_list=[u,v],s.ready=function(a){returnthis.__ready_list.push(a),this},s.setState=function(a){varb=JSON.stringify(a);returnthis.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},s.onStateChange=function(a){returnthis.prototype.__state_change_callback=a,this},s.__service_list=[],s.declareService=function(a){returnthis.__service_list.push(a),this},s.onEvent=function(a,b,c,d){returnthis.__service_list.push(function(){returnn(this.element,a,c,b.bind(this),d)}),this},s.declareJob=function(a,b){returnthis.prototype[a]=function(){varc=this,d=arguments;c.__job_triggered?w(c,a,b,d):c.__job_list.push([a,b,d])},this},s.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},s.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(void0===this.element)thrownewError("No element defined");returnthis.element}).declareMethod("changeState",function(a){varb,d,e=!1,f=this.hasOwnProperty("__modification_dict"),g=this;f?(d=this.__modification_dict,e=!0):(d={},this.__modification_dict=d);for(bina)a.hasOwnProperty(b)&&a[b]!==this.state[b]&&(this.state[b]=a[b],d[b]=a[b],e=!0);returne&&void0!==this.__state_change_callback?(newc.Queue).push(function(){returng.__state_change_callback(d)}).push(function(a){returndeleteg.__modification_dict,a}):void0}),s.declareAcquiredMethod=function(a,b){returnthis.prototype[a]=function(){vara=Array.prototype.slice.call(arguments,0),d=this;return(newc.Queue).push(function(){returnd.__aq_parent(b,a)})},this},s.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),s.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),s.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},A.__ready_list=s.__ready_list.slice(),A.__service_list=s.__service_list.slice(),A.ready=s.ready,A.setState=s.setState,A.onStateChange=s.onStateChange,A.declareService=s.declareService,A.onEvent=s.onEvent,A.prototype=news,A.prototype.constructor=A,C.__ready_list=s.__ready_list.slice(),C.ready=s.ready,C.setState=s.setState,C.onStateChange=s.onStateChange,C.__service_list=s.__service_list.slice(),C.declareService=s.declareService,C.onEvent=s.onEvent,C.prototype=news,C.prototype.constructor=C,s.declareMethod("declareGadget",function(b,d){vare=this;returnvoid0===d&&(d={}),void0===d.sandbox&&(d.sandbox="public"),b=I.getAbsoluteURL(b,this.__path),(newc.Queue).push(function(){vara;if("public"===d.sandbox)a=B;elseif("iframe"===d.sandbox)a=D;else{if("dataurl"!==d.sandbox)thrownewError("Unsupported sandbox options '"+d.sandbox+"'");a=E}returna(b,d,e)}).push(function(f){functiong(){returnf}functionh(a){returnfunction(){returna.call(f,f)}}vari,j,k=newc.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void0===j)for(j="RJS_"+O,O+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+O,O+=1;returne.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(x),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");returnthis.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");deletethis.__sub_gadget_dict[a]}),I=function(a){varc;if(a===b&&(c=N[0]),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},I.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},I.AcquisitionError.prototype=newError,I.AcquisitionError.prototype.constructor=I.AcquisitionError,I.getAbsoluteURL=function(a,b){returnb&&a?newl(a,b).href:a},I.declareJS=function(b,d,e){varf;returnL.hasOwnProperty(b)?f=c.resolve():(L[b]=null,f=newc.Promise(function(c,f){varg;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&N.shift(),c()},g.onerror=function(a){e===!0&&N.shift(),f(a)},g.src=b,d.appendChild(g)})),f},I.declareCSS=function(b,d){vare;returne=M.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,e){varf;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){M[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},I.declareGadgetKlass=function(b){if(K.hasOwnProperty(b))returnK[b].promise;vard,e=c.defer();returnK[b]=e,H=e.promise,(newc.Queue).push(function(){returno(b)}).push(function(e){d=F(e,b);varf,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(N.push(d),f=0;f<i.length-1;f+=1)h.push(I.declareJS(i[f],g));h.push(I.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(I.declareCSS(j[f],g));returna.head.appendChild(g),c.all(h)}).push(function(){returne.resolve(d),d}).push(void0,function(a){throwe.reject(a),a})},I.clearGadgetKlassList=function(){K={},L={},M={}},I.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!P.test(b))thrownewError("The url should be absolute: "+b);if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");if(e.title=a.title,null!==a.head)for(c=0;c<a.head.children.length;c+=1)d=a.head.children[c],null!==d.href&&("stylesheet"===d.rel?e.required_css_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):"SCRIPT"!==d.nodeName||"text/javascript"!==d.type&&d.type?"http://www.renderjs.org/rel/interface"===d.rel&&e.interface_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(I.getAbsoluteURL(d.getAttribute("src"),b)));returne},b.rJS=b.renderJS=I,b.__RenderJSGadget=s,b.__RenderJSEmbeddedGadget=A,b.__RenderJSIframeGadget=C,G()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
varChannel=function(){"use strict";functiona(a,b,c,d){functionf(b){for(varc=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}varg=!1;if("*"===b){for(varhine)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeofe[h][c]&&(g=f(e[h][c])))break}elsee["*"]&&e["*"][c]&&(g=f(e["*"][c])),!g&&e[b]&&e[b][c]&&(g=f(e[b][c]));if(g)throw"A channel is already bound to the same window which overlaps with origin '"+b+"' and has scope '"+c+"'";"object"!=typeofe[b]&&(e[b]={}),"object"!=typeofe[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}functionb(a,b,c){for(vard=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&deletee[b][c]}functionc(a){returnArray.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}vard=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{varb=JSON.parse(a.data);if("object"!=typeofb||null===b)throw"malformed"}catch(a){return}varc,d,g,h=a.source,i=a.origin;if("string"==typeofb.method){varj=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeofb.id&&(d=b.id),"string"==typeofg){vark=!1;if(e[i]&&e[i][c])for(varl=0;l<e[i][c].length;l++)if(e[i][c][l].win===h){e[i][c][l].handler(i,g,b),k=!0;break}if(!k&&e["*"]&&e["*"][c])for(varl=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeofd&&f[d]&&f[d](i,g,b)};returnwindow.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){varg=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeofa&&(a=JSON.stringify(a))}catch(b){}console.log("["+j+"] "+a)}};if(!window.postMessage)throw"jschannel cannot run this browser, no postMessage";if(!window.JSON||!window.JSON.stringify||!window.JSON.parse)throw"jschannel cannot run this browser, no JSON parsing/serialization";if("object"!=typeofe)throw"Channel build invoked without a proper object argument";if(!e.window||!e.window.postMessage)throw"Channel.build() called without a valid window argument";if(window===e.window)throw"target window is same as present window -- not allowed";varh=!1;if("string"==typeofe.origin){vari;"*"===e.origin?h=!0:null!==(i=e.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/))&&(e.origin=i[0].toLowerCase(),h=!0)}if(!h)throw"Channel.build() called with an invalid origin";if("undefined"!=typeofe.scope){if("string"!=typeofe.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}varj=function(){for(vara="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));returna}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){vard=!1,e=!1;return{origin:b,invoke:function(b,d){if(!m[a])throw"attempting to invoke a callback of a nonexistent transaction: "+a;for(vare=!1,f=0;f<c.length;f++)if(b===c[f]){e=!0;break}if(!e)throw"request supports no such callback '"+b+"'";t({id:a,callback:b,params:d})},error:function(b,c){if(e=!0,!m[a])throw"error called for nonexistent message: "+a;deletem[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;deletem[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeofa&&(d=a===!0),d},completed:function(){returne}}},q=function(a,b,c){returnwindow.setTimeout(function(){if(l[a]){vard="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),deletel[a],deletef[a]}},b)},r=function(a,b,d){if("function"==typeofe.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){vari=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(varj=0;j<d.callbacks.length;j++){for(varn=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){vars=q[r];"object"!=typeofo[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){vara=n;returnfunction(b){returni.invoke(a,b)}}()}vart=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){varu="runtime_error",v=null;if("string"==typeofh?v=h:"object"==typeofh&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeofh.error&&(u=h.error,h.message?"string"==typeofh.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeofv&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}elsed.id&&d.callback?l[d.id]&&l[d.id].callbacks&&l[d.id].callbacks[d.callback]?l[d.id].callbacks[d.callback](d.params):g("ignoring invalid callback, id:"+d.id+" ("+d.callback+")"):d.id?l[d.id]?(d.error?l[d.id].error(d.error,d.message):void0!==d.result?l[d.id].success(d.result):l[d.id].success(),deletel[d.id],deletef[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeofe.scope?e.scope:"",r);vars=function(a){return"string"==typeofe.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";varc=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeofe.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}elseo.push(a)},u=function(a,b){if(g("ready msg received"),n)throw"received ready message while in ready state. help!";for(j+="ping"===b?"-R":"-L",v.unbind("__ready"),n=!0,g("ready msg accepted."),"ping"===b&&v.notify({method:"__ready",params:"pong"});o.length;)t(o.pop());"function"==typeofe.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!deletek[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeofa)throw"'method' argument to bind must be string";if(!b||"function"!=typeofb)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";returnk[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeofa.success)throw"'success' callback missing from call";varb={},c=[],e=function(a,d){if("object"==typeofd)for(varfind)if(d.hasOwnProperty(f)){varg=a+(a.length?"/":"")+f;"function"==typeofd[f]?(b[g]=d[f],c.push(g),deleted[f]):"object"==typeofd[f]&&e(g,d[f])}};e("",a.params);varg={id:d,method:s(a.method),params:a.params};c.length&&(g.callbacks=c),a.timeout&&q(d,a.timeout,s(a.method)),l[d]={callbacks:b,error:a.error,success:a.success},f[d]=r,d++,t(g)},notify:function(a){if(!a)throw"missing arguments to notify function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to notify must be string";t({method:s(a.method),params:a.params})},destroy:function(){b(e.window,e.origin,"string"==typeofe.scope?e.scope:""),window.removeEventListener?window.removeEventListener("message",r,!1):window.detachEvent&&window.detachEvent("onmessage",r),n=!1,k={},m={},l={},e.origin=null,o=[],g("channel destroyed"),j=""}};returnv.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!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"!=typeofdocument.contains&&(Document.prototype.contains=function(a){returna===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";functionm(a){varb=newh;returnnewc.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}functionn(a,b,d,e,f){functiong(){void0!==k&&"function"==typeofk.cancel&&k.cancel()}functionh(){void0!==j&&a.removeEventListener(b,j,d),g()}functioni(i,l){varm;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(newc.Queue).push(function(){returnm}).push(void0,function(a){ainstanceofc.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}varj,k;returnvoid0===f&&(f=!0),newc.Promise(i,h)}functiono(a){functionb(b,c){functiond(){try{0===e.readyState?c(e):4===e.readyState&&(e.status<200||e.status>=300||!/^text\/html[;]?/.test(e.getResponseHeader("Content-Type")||"")?c(e):b(e))}catch(a){c(a)}}e=newXMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}functiond(){void0!==e&&e.readyState!==e.DONE&&e.abort()}vare;returnnewc.Promise(b,d)}functionp(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functionq(c){vard,e,f,g,h,i;if(Q)returnconsole.info("-- Error dropped, as page is unloaded"),voidconsole.info(c);for(R.push(c),R.push(newError("stopping renderJS")),e=a.getElementsByTagName("body")[0];e.firstChild;)e.removeChild(e.firstChild);for(f=a.createElement("section"),g=a.createElement("h1"),g.textContent="Unhandled Error",f.appendChild(g),g=a.createElement("p"),g.textContent="Please report this error to the support team",f.appendChild(g),g=a.createElement("p"),g.textContent="Location: ",h=a.createElement("a"),h.href=h.textContent=b.location.toString(),g.appendChild(h),f.appendChild(g),g=a.createElement("p"),g.textContent="User-agent: "+j.userAgent,f.appendChild(g),g=a.createElement("p"),g.textContent="Date: "+newDate(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<R.length;d+=1){if(i=R[d],iinstanceofk&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void0!==i.target&&R.splice(d+1,0,i.target)),iinstanceofXMLHttpRequest&&(i={message:i.toString(),readyState:i.readyState,status:i.status,statusText:i.statusText,response:i.response,responseUrl:i.responseUrl,response_headers:i.getAllResponseHeaders()}),i.constructor===Array||i.constructor===String||i.constructor===Object)try{i=JSON.stringify(i)}catch(l){}f=a.createElement("section"),g=a.createElement("h2"),g.textContent=i.message||i,f.appendChild(g),void0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}functionr(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functions(){returnthisinstanceofs?void0:news}functiont(a){void0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=newJ,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(function(a){returnq(a)})}functionu(){this.__sub_gadget_dict={},t(this)}functionv(){functiona(a){returnfunction(b){varc=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))returnc[d].apply(j,[arguments,a]);throwb}}varb,d,e,f,g,h=this.element.querySelectorAll("[data-gadget-url]"),i=[],j=this;for(g=0;g<h.length;g+=1)b=h[g],d=b.getAttribute("data-gadget-scope"),e=b.getAttribute("data-gadget-url"),f=b.getAttribute("data-gadget-sandbox"),null!==e&&i.push(j.declareGadget(e,{element:b,scope:d||void0,sandbox:f||void0}).push(void0,a(d)));returnc.all(i)}functionw(a,b,d,e){varf=(newc.Queue).push(function(){returnd.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((newc.Queue).push(function(){returnf}).push(void0,function(a){if(!(ainstanceofc.CancellationError))throwa}))}functionx(a){a.__monitor.monitor((newc.Queue).push(function(){varb,c=a.constructor.__service_list,d=a.__job_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a));for(b=0;b<d.length;b+=1)w(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}functiony(a,b,d){vare,f,g=this;for(eing.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(newc.Queue).push(function(){vara=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))returna[b].apply(g,[d,f]);thrownewI.AcquisitionError("aq_dynamic is not defined")}).push(void0,function(a){if(ainstanceofI.AcquisitionError)returng.__aq_parent(b,d);throwa})}functionz(a,b){a.__aq_parent=function(c,d){returny.apply(b,[a,c,d])}}functionA(){returnthisinstanceofA?voids.call(this):newA}functionB(b,d,e){return(newc.Queue).push(function(){returnI.declareGadgetKlass(b).then(function(a){returna})}).push(function(b){void0===d.element&&(d.element=a.createElement("div"));varc,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=newb,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));returnf.element.appendChild(h),z(f,e),f})}functionC(){returnthisinstanceofC?voids.call(this):newC}functionD(b,d,f){varg,h,i=c.defer();if(void0===d.element)thrownewError("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))thrownewError("The parent element is not attached to the DOM for "+b);returng=newC,z(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){returnc.timeout(5e3).fail(function(){i.reject(newError("Timeout while loading: "+b))})}),h.setAttribute("src",b),g.__path=b,g.element=d.element,g.state={},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,d=newc.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)}})});return(newc.Queue).push(function(){returnd})},"OK"}),g.__chan.bind("ready",function(a){returni.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){returni.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}functionE(a,b,e){return(newc.Queue).push(function(){returno(a)}).push(function(b){varc,e=(newd).parseFromString(b.responseText,"text/html"),f=e.createElement("base");returnf.href=a,e.head.insertBefore(f,e.head.firstChild),c=newi([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){returnD(a,b,e)})}functionF(a,b){varc,e,f;c=function(){s.call(this)},c.__ready_list=s.__ready_list.slice(),c.__service_list=s.__service_list.slice(),c.declareMethod=s.declareMethod,c.declareJob=s.declareJob,c.declareAcquiredMethod=s.declareAcquiredMethod,c.allowPublicAcquisition=s.allowPublicAcquisition,c.ready=s.ready,c.setState=s.setState,c.onStateChange=s.onStateChange,c.declareService=s.declareService,c.onEvent=s.onEvent,c.prototype=news,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(newd).parseFromString(a.responseText,"text/html"),f=I.parseGadgetHTMLDocument(c.__template_element,b);for(einf)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);returnc}functionG(){vard,h,i,j,k,l,m,n,o=p(b.location.href),r=newc.Queue,u=0,v=!1,w=[],y=!1,B=!1;if(K.hasOwnProperty(o))thrownewError("bootstrap should not be called twice");H=newc.Promise(function(p,r){functionC(){varb,e,i=I.parseGadgetHTMLDocument(a,o),j=a.createDocumentFragment();for(eini)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)j.appendChild(h.element.childNodes[b].cloneNode(!0));d.__template_element.appendChild(j),c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)L[c[b]]=null;for(b=0;b<d.length;b+=1)M[d[b]]=null;N.shift()}).then(function(){varb=a.querySelector("body"),c=newf(function(b){varc,d,e,f,h,i;b.forEach(function(b){if("childList"===b.type){for(e=b.removedNodes.length,c=0;e>c;c+=1)if(h=b.removedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&t(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&t(h._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(h=b.addedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&a.contains(h)&&x(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void0!==h._gadget&&x(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),h}).then(p,function(a){throwr(a),console.error(a),a})}m=news,m.__acquired_method_dict={reportServiceError:function(a){q(a[0])}},m.__aq_parent=function(a){thrownewI.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){s.call(this)},d.declareMethod=s.declareMethod,d.declareJob=s.declareJob,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,d.__ready_list=s.__ready_list.slice(),d.ready=s.ready,d.setState=s.setState,d.onStateChange=s.onStateChange,d.__service_list=s.__service_list.slice(),d.declareService=s.declareService,d.onEvent=s.onEvent,d.prototype=news,d.prototype.constructor=d,d.prototype.__path=o,K[o]={promise:c.resolve(d)},h=newd,z(h,m)):(d=A,d.__ready_list=s.__ready_list.slice(),d.__service_list=s.__service_list.slice(),d.prototype.__path=o,h=newA,z(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){vara;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){returnnewc.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){u+=1,i.call({method:"declareMethod",params:a,success:function(){u-=1,j()},error:function(){u-=1}})},a=0;a<w.length;a+=1)k(w[a]);returnw=[],y?voidi.notify({method:"failed",params:n}):(B=!0,j(),voidi.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===u&&v===!0&&i.notify({method:"ready"})},k=function(a){w.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){varc=s.declareMethod.apply(this,[a,b]);returnk(a),c},d.declareService=s.declareService,d.declareJob=s.declareJob,d.onEvent=s.onEvent,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},N.push(d),a.addEventListener("DOMContentLoaded",C,!1)}),r.push(function(){returnH}).push(function(a){functionb(){returna}functionc(a){returnfunction(b){returna.call(b,b)}}vare;for(d.ready(function(){returnx(this)}),r.push(b),e=0;e<d.__ready_list.length;e+=1)r.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?r.fail(function(a){throwq(a),a}):r.then(function(){v=!0,B&&j()}).fail(function(a){throwl?(y=!0,n=a.toString(),q(a)):i.notify({method:"failed",params:a.toString()}),a})}varH,I,J,K={},L={},M={},N=[],O=0,P=newRegExp("^(?:[a-z]+:)?//|data:","i"),Q=!1,R=[];b.addEventListener("error",function(a){R.push(a)}),b.addEventListener("beforeunload",function(){Q=!0}),r.prototype=newError,r.prototype.constructor=r,J=function(){functiona(){vara,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}varb,d,e,f,g=this,h=[];returnthisinstanceofJ?(b=newc.Promise(function(b,c,h){d=function(b){returnf?void0:(g.isRejected=!0,g.rejectedReason=b,f=!0,a(),c(b))},e=h},a),g.cancel=function(){f||(f=!0,b.cancel(),b.fail(function(a){g.isRejected=!0,g.rejectedReason=a}))},g.then=function(){returnb.then.apply(b,arguments)},g.fail=function(){returnb.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)thrownewr;varb=(newc.Queue).push(function(){returna}).push(function(a){varb,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){returne(a),a});returnh.push(b),this})):newJ},J.prototype=Object.create(c.Promise.prototype),J.prototype.constructor=J,s.prototype.__title="",s.prototype.__interface_list=[],s.prototype.__path="",s.prototype.__html="",s.prototype.__required_css_list=[],s.prototype.__required_js_list=[],s.__ready_list=[u,v],s.ready=function(a){returnthis.__ready_list.push(a),this},s.setState=function(a){varb=JSON.stringify(a);returnthis.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},s.onStateChange=function(a){returnthis.prototype.__state_change_callback=a,this},s.__service_list=[],s.declareService=function(a){returnthis.__service_list.push(a),this},s.onEvent=function(a,b,c,d){returnthis.__service_list.push(function(){returnn(this.element,a,c,b.bind(this),d)}),this},s.declareJob=function(a,b){returnthis.prototype[a]=function(){varc=this,d=arguments;c.__job_triggered?w(c,a,b,d):c.__job_list.push([a,b,d])},this},s.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},s.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(void0===this.element)thrownewError("No element defined");returnthis.element}).declareMethod("changeState",function(a){varb,d=newc.Queue,e=this;returne.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){returnb}).push(void0,function(){})),e.__previous_onStateChange=d,d.push(function(){varb,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(bina)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);returnf&&void0!==e.__state_change_callback?(e.__modification_dict=d,(newc.Queue).push(function(){returne.__state_change_callback(d)}).push(function(a){returndeletee.__modification_dict,a})):void0})}),s.declareAcquiredMethod=function(a,b){returnthis.prototype[a]=function(){vara=Array.prototype.slice.call(arguments,0),d=this;return(newc.Queue).push(function(){returnd.__aq_parent(b,a)})},this},s.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),s.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),s.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},A.__ready_list=s.__ready_list.slice(),A.__service_list=s.__service_list.slice(),A.ready=s.ready,A.setState=s.setState,A.onStateChange=s.onStateChange,A.declareService=s.declareService,A.onEvent=s.onEvent,A.prototype=news,A.prototype.constructor=A,C.__ready_list=s.__ready_list.slice(),C.ready=s.ready,C.setState=s.setState,C.onStateChange=s.onStateChange,C.__service_list=s.__service_list.slice(),C.declareService=s.declareService,C.onEvent=s.onEvent,C.prototype=news,C.prototype.constructor=C,s.declareMethod("declareGadget",function(b,d){vare=this;returnvoid0===d&&(d={}),void0===d.sandbox&&(d.sandbox="public"),b=I.getAbsoluteURL(b,this.__path),(newc.Queue).push(function(){vara;if("public"===d.sandbox)a=B;elseif("iframe"===d.sandbox)a=D;else{if("dataurl"!==d.sandbox)thrownewError("Unsupported sandbox options '"+d.sandbox+"'");a=E}returna(b,d,e)}).push(function(f){functiong(){returnf}functionh(a){returnfunction(){returna.call(f,f)}}vari,j,k=newc.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void0===j)for(j="RJS_"+O,O+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+O,O+=1;returne.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(x),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");returnthis.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");deletethis.__sub_gadget_dict[a]}),I=function(a){varc;if(a===b&&(c=N[0]),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},I.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},I.AcquisitionError.prototype=newError,I.AcquisitionError.prototype.constructor=I.AcquisitionError,I.getAbsoluteURL=function(a,b){returnb&&a?newl(a,b).href:a},I.declareJS=function(b,d,e){varf;returnL.hasOwnProperty(b)?f=c.resolve():(L[b]=null,f=newc.Promise(function(c,f){varg;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&N.shift(),c()},g.onerror=function(a){e===!0&&N.shift(),f(a)},g.src=b,d.appendChild(g)})),f},I.declareCSS=function(b,d){vare;returne=M.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,e){varf;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){M[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},I.declareGadgetKlass=function(b){if(K.hasOwnProperty(b))returnK[b].promise;vard,e=c.defer();returnK[b]=e,H=e.promise,(newc.Queue).push(function(){returno(b)}).push(function(e){d=F(e,b);varf,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(N.push(d),f=0;f<i.length-1;f+=1)h.push(I.declareJS(i[f],g));h.push(I.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(I.declareCSS(j[f],g));returna.head.appendChild(g),c.all(h)}).push(function(){returne.resolve(d),d}).push(void0,function(a){throwe.reject(a),a})},I.clearGadgetKlassList=function(){K={},L={},M={}},I.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!P.test(b))thrownewError("The url should be absolute: "+b);if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");if(e.title=a.title,null!==a.head)for(c=0;c<a.head.children.length;c+=1)d=a.head.children[c],null!==d.href&&("stylesheet"===d.rel?e.required_css_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):"SCRIPT"!==d.nodeName||"text/javascript"!==d.type&&d.type?"http://www.renderjs.org/rel/interface"===d.rel&&e.interface_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(I.getAbsoluteURL(d.getAttribute("src"),b)));returne},b.rJS=b.renderJS=I,b.__RenderJSGadget=s,b.__RenderJSEmbeddedGadget=A,b.__RenderJSIframeGadget=C,G()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);