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){"use strict";functionb(b,c){vard,e,f,g="<!doctype><html><head></head></html>";returnb&&c?(d=(newa).parseFromString(g,"text/html"),e=d.createElement("base"),f=d.createElement("link"),d.head.appendChild(e),d.head.appendChild(f),e.href=c,f.href=b,f.href):b}functionc(a,c){if(void0!==c){if(!e.test(c))thrownewTypeError("Failed to construct 'URL': Invalid base URL");a=b(a,c)}if(!e.test(a))thrownewTypeError("Failed to construct 'URL': Invalid URL");this.href=a}try{if("https://example.com/a"===newwindow.URL("../a","https://example.com/").href)return}catch(d){}vare=/^(?:[a-z]+:)?\/\/|data:/i;c.prototype.href="",window.URL&&window.URL.createObjectURL&&(c.createObjectURL=window.URL.createObjectURL),window.URL&&window.URL.revokeObjectURL&&(c.revokeObjectURL=window.URL.revokeObjectURL),window.URL=c}(DOMParser),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";functionm(a){if(this.name="scopeerror",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Scope Error"}functionn(a,b,d){vare;try{e=a.apply(d,b)}catch(f){return(newc.Queue).push(function(){returnc.reject(f)})}returneinstanceofc.Queue?e:(newc.Queue).push(function(){returne})}functiono(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()})}functionp(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)}functionq(){functiona(){b.cancelAnimationFrame(e)}functiond(a){e=b.requestAnimationFrame(a)}vare;returnnewc.Promise(d,a)}functionr(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)}functions(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functiont(c){vard,e,f,g,h,i;if(aa)returnconsole.info("-- Error dropped, as page is unloaded"),voidconsole.info(c);for(ba.push(c),ba.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<ba.length;d+=1){if(i=ba[d],iinstanceofk&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void0!==i.target&&ba.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)}functionu(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functionv(){returnthisinstanceofv?void0:newv}functionw(a){a.hasOwnProperty("__monitor")&&(a.__monitor.cancel(),deletea.__monitor,a.__job_list=[])}functionx(a){a.__monitor=newT,a.__job_dict={},a.__job_triggered=!1,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(t)}functiony(a){a.__sub_gadget_dict={},a.__job_list=[],void0!==a.__json_state&&(a.state=JSON.parse(a.__json_state))}functionz(){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)}functionA(a,b,d,e){varf=n(d,e,a);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}))}functionB(a){(0!==a.constructor.__service_list.length||a.constructor.__job_declared)&&(x(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)A(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0})))}functionC(a,b,c){vard,e,f=this,g=f.__acquired_method_dict||{};if(!g.hasOwnProperty(b))returnf.__aq_parent(b,c);for(dinf.__sub_gadget_dict)f.__sub_gadget_dict.hasOwnProperty(d)&&f.__sub_gadget_dict[d]===a&&(e=d);returnn(g[b],[c,e],f).push(void0,function(a){if(ainstanceofS.AcquisitionError)returnf.__aq_parent(b,c);throwa})}functionD(a,b){a.__aq_parent=function(c,d){returnC.apply(b,[a,c,d])}}functionE(){returnthisinstanceofE?voidv.call(this):newE}functionF(b,c,d){void0===c.element&&(c.element=a.createElement("div"));vare,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=newb,f.element=c.element,f.state={},e=0;e<g.length;e+=1)h.appendChild(g[e].cloneNode(!0));returnf.element.appendChild(h),D(f,d),f}functionG(a,b,c){vard=S.declareGadgetKlass(a);return"function"==typeofd.then?d.then(function(a){returnF(a,b,c)}):F(d,b,c)}functionH(){returnthisinstanceofH?voidv.call(this):newH}functionI(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=newH,D(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:c,error:d})});returnn(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){(newc.Queue).push(function(){returng.__aq_parent.apply(g,b)}).then(a.complete).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}functionJ(a,b,e){return(newc.Queue).push(function(){returnr(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"}),o(c)}).push(function(a){returnI(a,b,e)})}functionK(b,d,e,f){functiong(a){returnfunction(){returna.call(b,b)}}functionh(){returna.contains(b.element)&&B(b),b}vari,j,k;if(y(b),j=d.scope,void0===j)for(j="RJS_"+$,$+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+$,$+=1;if(e.__sub_gadget_dict[j]=b,b.element.setAttribute("data-gadget-scope",j),b.element.setAttribute("data-gadget-url",f),b.element.setAttribute("data-gadget-sandbox",d.sandbox),b.element._gadget=b,b.constructor.__ready_list.length){for(k=newc.Queue,i=0;i<b.constructor.__ready_list.length;i+=1)k.push(g(b.constructor.__ready_list[i]));returnk.push(h),k}returnh()}functionL(a,b){varc,e,f;c=function(){v.call(this)},c.__ready_list=[],c.__service_list=v.__service_list.slice(),c.declareMethod=v.declareMethod,c.declareJob=v.declareJob,c.declareAcquiredMethod=v.declareAcquiredMethod,c.allowPublicAcquisition=v.allowPublicAcquisition,c.ready=v.ready,c.setState=v.setState,c.onStateChange=v.onStateChange,c.declareService=v.declareService,c.onEvent=v.onEvent,c.onLoop=v.onLoop,c.prototype=newv,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(newd).parseFromString(a.responseText,"text/html"),f=S.parseGadgetHTMLDocument(c.__template_element,b);for(einf)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);returnc.__template_element.querySelectorAll("[data-gadget-url]").length&&c.__ready_list.push(z),c}functionM(b,d,e){varh,i,j=S.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(iinj)j.hasOwnProperty(i)&&(b.prototype["__"+i]=j[i]);for(b.__template_element=a.createElement("div"),e.element=a.body,e.state={},h=0;h<e.element.childNodes.length;h+=1)k.appendChild(e.element.childNodes[h].cloneNode(!0));returnb.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)X[c[b]]=null;for(b=0;b<d.length;b+=1)Y[d[b]]=null;Z.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&&w(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&w(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)&&B(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&&B(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),e})}functionN(){vara=newv;returna.__acquired_method_dict={reportServiceError:function(a){t(a[0])}},a.__aq_parent=function(a){thrownewS.AcquisitionError("No gadget provides "+a)},a}functionO(a){vard,f,g,h,i,j,k,l;if(W.hasOwnProperty(a))thrownewError("bootstrap should not be called twice");returnd=E,d.__ready_list=[],d.__service_list=v.__service_list.slice(),d.prototype.__path=a,f=newE,D(f,N()),i=["getInterfaceList","getRequiredCSSList","getRequiredJSList","getPath","getTitle"],h=function(a){i.push(a)},l=[d,f,g,i],b.self===b.top?j=l:(k=c.defer(),j=c.any([k.promise,(newc.Queue).push(function(){returnc.delay(1e3)}).push(function(){returnl[2]=void0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){vara,b;for(h=function(a){i.push(newc.Promise(function(b,c){g.call({method:"declareMethod",params:a,success:b,error:c})}))},b=i.length,a=0;b>a;a+=1)h(i[a]);k.resolve(l)}}),l[2]=g),d.declareMethod=function(a,b){varc=v.declareMethod.apply(this,[a,b]);returnh(a),c},d.declareService=v.declareService,d.declareJob=v.declareJob,d.onEvent=v.onEvent,d.onLoop=v.onLoop,d.declareAcquiredMethod=v.declareAcquiredMethod,d.allowPublicAcquisition=v.allowPublicAcquisition,d.prototype.__acquired_method_dict={},Z.push(d),j}functionP(a,b){functiond(a){returnfunction(){returna.call(b,b)}}vare,f=newc.Queue;for(a.ready(function(){returnB(b)}),e=0;e<a.__ready_list.length;e+=1)f.push(d(a.__ready_list[e]));returnf}functionQ(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){returnnewc.Promise(function(c,f){d.call({method:"acquire",params:[a,b],success:c,error:f,timeout:e})})},d.bind("methodCall",function(a,c){b[c[0]].apply(b,c[1]).push(a.complete,function(b){a.error(b.toString())}),a.delayReturn(!0)})}functionR(a){varb,d,e,f,g=O(a);return(newc.Queue).push(function(){returng}).push(function(a){returnb=a[0],d=a[1],e=a[2],f=a[3],V.promise}).push(function(){returnc.all(f)}).push(function(c){returnvoid0!==e&&Q(b,d,e),M(b,a,d)}).push(function(){returny(d),b.__ready_list.unshift(z),P(b,d)}).push(function(){void0!==e&&e.notify({method:"ready"})}).push(void0,function(a){throwt(a),void0!==e&&e.notify({method:"failed",params:a.toString()}),a})}m.prototype=newError,m.prototype.constructor=m;varS,T,U,V,W={},X={},Y={},Z=[],$=0,_=newRegExp("^(?:[a-z]+:)?//|data:","i"),aa=!1,ba=[];b.addEventListener("error",function(a){ba.push(a)}),b.addEventListener("beforeunload",function(){aa=!0}),U=function(){returnthisinstanceofU?void(this._latest_promise=null):newU},U.prototype={constructor:U,lockAndRun:function(a){varb=this._latest_promise;returnnull===b?this._latest_promise=c.resolve(a()):this._latest_promise=this._latest_promise.always(function(){returna()}),this._latest_promise}},u.prototype=newError,u.prototype.constructor=u,T=function(){functiona(){vara,b=g.length;for(a=0;b>a;a+=1)g[a].cancel();g=[]}varb,d,e,f=this,g=[];returnthisinstanceofT?(b=newc.Promise(function(b,c){d=function(b){returne?void0:(f.isRejected=!0,f.rejectedReason=b,e=!0,a(),c(b))}},a),f.cancel=function(){e||(e=!0,b.cancel(),b.fail(function(a){f.isRejected=!0,f.rejectedReason=a}))},f.then=b.then.bind(b),f.fail=b.fail.bind(b),void(f.monitor=function(a){if(e)thrownewu;varb=(newc.Queue).push(function(){returna}).push(function(a){varb,c,d=g.length,e=[];for(c=0;d>c;c+=1)b=g[c],b.isFulfilled||b.isRejected||e.push(b);g=e},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b});returng.push(b),this})):newT},T.prototype=Object.create(c.Promise.prototype),T.prototype.constructor=T,v.prototype.__title="",v.prototype.__interface_list=[],v.prototype.__path="",v.prototype.__html="",v.prototype.__required_css_list=[],v.prototype.__required_js_list=[],v.__ready_list=[],v.ready=function(a){returnthis.__ready_list.push(a),this},v.setState=function(a){returnthis.prototype.__json_state=JSON.stringify(a),this},v.onStateChange=function(a){returnthis.prototype.__state_change_callback=a,this},v.__service_list=[],v.declareService=function(a){returnthis.__service_list.push(a),this},v.onEvent=function(a,b,c,d){returnthis.__service_list.push(function(){returnp(this.element,a,c,b.bind(this),d)}),this},v.onLoop=function(a,b){returnvoid0===b&&(b=0),this.__service_list.push(function(){vard=newc.Queue,e=this,f=function(){d.push(function(){returnc.delay(b)}).push(function(){returnq()}).push(function(){returna.apply(e,[])}).push(f)};returnf(),d}),this},v.declareJob=function(a,b){returnthis.__job_declared=!0,this.prototype[a]=function(){varc=this,d=arguments;c.__job_triggered?A(c,a,b,d):c.__job_list.push([a,b,d])},this},v.declareMethod=function(a,b,c){returnthis.prototype[a]=function(){functiona(){returnb.apply(e,f)}vard,e=this,f=arguments;returnvoid0!==c&&c.hasOwnProperty("mutex")?(d="__mutex_"+c.mutex,e.hasOwnProperty(d)||(e[d]=newU),n(e[d].lockAndRun,[a],e[d])):n(b,f,e)},this},v.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,c,d=this,e=!1,f=d.hasOwnProperty("__modification_dict");f?(c=d.__modification_dict,e=!0):c={};for(bina)a.hasOwnProperty(b)&&a[b]!==d.state[b]&&(d.state[b]=a[b],c[b]=a[b],e=!0);returne&&void0!==d.__state_change_callback?(d.__modification_dict=c,n(d.__state_change_callback,[c],d).push(function(a){returndeleted.__modification_dict,a})):void0},{mutex:"changestate"}),v.declareAcquiredMethod=function(a,b){returnthis.prototype[a]=function(){vara=Array.prototype.slice.call(arguments,0),c=this;returnn(c.__aq_parent,[b,a],c)},this},v.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),v.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),v.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},E.__ready_list=[],E.__service_list=v.__service_list.slice(),E.ready=v.ready,E.setState=v.setState,E.onStateChange=v.onStateChange,E.declareService=v.declareService,E.onEvent=v.onEvent,E.onLoop=v.onLoop,E.prototype=newv,E.prototype.constructor=E,H.__ready_list=[],H.ready=v.ready,H.setState=v.setState,H.onStateChange=v.onStateChange,H.__service_list=[],H.declareService=v.declareService,H.onEvent=v.onEvent,H.onLoop=v.onLoop,H.prototype=newv,H.prototype.constructor=H,v.declareMethod("declareGadget",function(a,b){vard,e,f=this;if(void0===b&&(b={}),void0===b.sandbox&&(b.sandbox="public"),a=S.getAbsoluteURL(a,this.__path),"public"===b.sandbox)d=G;elseif("iframe"===b.sandbox)d=I;else{if("dataurl"!==b.sandbox)thrownewError("Unsupported sandbox options '"+b.sandbox+"'");d=J}returne=d(a,b,f),"function"==typeofe.then?(newc.Queue).push(function(){returne}).push(function(c){returnK(c,b,f,a)}):K(e,b,f,a)}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewm("Gadget scope '"+a+"' is not known.");returnthis.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewm("Gadget scope '"+a+"' is not known.");deletethis.__sub_gadget_dict[a]}),S=function(a){varc;if(a===b&&(c=Z[0]),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},S.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},S.AcquisitionError.prototype=newError,S.AcquisitionError.prototype.constructor=S.AcquisitionError,S.getAbsoluteURL=function(a,b){returnb&&a?newl(a,b).href:a},S.declareJS=function(b,d,e){varf;returnX.hasOwnProperty(b)?f=c.resolve():(X[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&&Z.shift(),c()},g.onerror=function(a){e===!0&&Z.shift(),f(a)},g.src=b,d.appendChild(g)})),f},S.declareCSS=function(b,d){vare;returne=Y.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(){Y[b]=null,c()},f.onerror=e,d.appendChild(f)})},S.declareGadgetKlass=function(b){vard,e;if(W.hasOwnProperty(b)){if(W[b].hasOwnProperty("defer_list"))returne=c.defer(),W[b].defer_list.push(e),e.promise;if(W[b].is_resolved)returnW[b].result;throwW[b].result}returnW[b]={defer_list:[]},(newc.Queue).push(function(){returnr(b)}).push(function(e){d=L(e,b);varf,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(Z.push(d),f=0;f<i.length-1;f+=1)h.push(S.declareJS(i[f],g));h.push(S.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(S.declareCSS(j[f],g));returna.head.appendChild(g),c.all(h)}).push(function(){vara,c=W[b].defer_list.length;for(a=0;c>a;a+=1)W[b].defer_list[a].resolve(d);returndeleteW[b].defer_list,W[b].result=d,W[b].is_resolved=!0,d}).push(void0,function(a){varc,d=W[b].defer_list.length;for(c=0;d>c;c+=1)W[b].defer_list[c].reject(a);throwdeleteW[b].defer_list,W[b].result=a,W[b].is_resolved=!1,a})},S.clearGadgetKlassList=function(){W={},X={},Y={}},S.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!_.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(S.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(S.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(S.getAbsoluteURL(d.getAttribute("src"),b)));returne},S.Mutex=U,S.ScopeError=m,b.rJS=b.renderJS=S,b.__RenderJSGadget=v,b.__RenderJSEmbeddedGadget=E,b.__RenderJSIframeGadget=H,V=newc.defer,S.manualBootstrap=function(){V.resolve()},a.addEventListener("DOMContentLoaded",V.resolve,!1),R(s(b.location.href))}(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){"use strict";functionb(b,c){vard,e,f,g="<!doctype><html><head></head></html>";returnb&&c?(d=(newa).parseFromString(g,"text/html"),e=d.createElement("base"),f=d.createElement("link"),d.head.appendChild(e),d.head.appendChild(f),e.href=c,f.href=b,f.href):b}functionc(a,c){if(void0!==c){if(!e.test(c))thrownewTypeError("Failed to construct 'URL': Invalid base URL");a=b(a,c)}if(!e.test(a))thrownewTypeError("Failed to construct 'URL': Invalid URL");this.href=a}try{if("https://example.com/a"===newwindow.URL("../a","https://example.com/").href)return}catch(d){}vare=/^(?:[a-z]+:)?\/\/|data:/i;c.prototype.href="",window.URL&&window.URL.createObjectURL&&(c.createObjectURL=window.URL.createObjectURL),window.URL&&window.URL.revokeObjectURL&&(c.revokeObjectURL=window.URL.revokeObjectURL),window.URL=c}(DOMParser),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";functionm(a,b,d){vare;try{e=a.apply(d,b)}catch(f){return(newc.Queue).push(function(){returnc.reject(f)})}returneinstanceofc.Queue?e:(newc.Queue).push(function(){returne})}functionn(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()})}functiono(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)}functionp(){functiona(){b.cancelAnimationFrame(e)}functiond(a){e=b.requestAnimationFrame(a)}vare;returnnewc.Promise(d,a)}functionq(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)}functionr(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functions(c){vard,e,f,g,h,i;if(_)returnconsole.info("-- Error dropped, as page is unloaded"),voidconsole.info(c);for(aa.push(c),aa.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<aa.length;d+=1){if(i=aa[d],iinstanceofk&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void0!==i.target&&aa.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)}functiont(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functionu(){returnthisinstanceofu?void0:newu}functionv(a){a.hasOwnProperty("__monitor")&&(a.__monitor.cancel(),deletea.__monitor,a.__job_list=[])}functionw(a){a.__monitor=newS,a.__job_dict={},a.__job_triggered=!1,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(s)}functionx(a){a.__sub_gadget_dict={},a.__job_list=[],void0!==a.__json_state&&(a.state=JSON.parse(a.__json_state))}functiony(){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)}functionz(a,b,d,e){varf=m(d,e,a);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}))}functionA(a){(0!==a.constructor.__service_list.length||a.constructor.__job_declared)&&(w(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)z(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0})))}functionB(a,b,c){vard,e,f=this,g=f.__acquired_method_dict||{};if(!g.hasOwnProperty(b))returnf.__aq_parent(b,c);for(dinf.__sub_gadget_dict)f.__sub_gadget_dict.hasOwnProperty(d)&&f.__sub_gadget_dict[d]===a&&(e=d);returnm(g[b],[c,e],f).push(void0,function(a){if(ainstanceofR.AcquisitionError)returnf.__aq_parent(b,c);throwa})}functionC(a,b){a.__aq_parent=function(c,d){returnB.apply(b,[a,c,d])}}functionD(){returnthisinstanceofD?voidu.call(this):newD}functionE(b,c,d){void0===c.element&&(c.element=a.createElement("div"));vare,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=newb,f.element=c.element,f.state={},e=0;e<g.length;e+=1)h.appendChild(g[e].cloneNode(!0));returnf.element.appendChild(h),C(f,d),f}functionF(a,b,c){vard=R.declareGadgetKlass(a);return"function"==typeofd.then?d.then(function(a){returnE(a,b,c)}):E(d,b,c)}functionG(){returnthisinstanceofG?voidu.call(this):newG}functionH(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=newG,C(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:c,error:d})});returnm(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){(newc.Queue).push(function(){returng.__aq_parent.apply(g,b)}).then(a.complete).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}functionI(a,b,e){return(newc.Queue).push(function(){returnq(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"}),n(c)}).push(function(a){returnH(a,b,e)})}functionJ(b,d,e,f){functiong(a){returnfunction(){returna.call(b,b)}}functionh(){returna.contains(b.element)&&A(b),b}vari,j,k;if(x(b),j=d.scope,void0===j)for(j="RJS_"+Z,Z+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+Z,Z+=1;if(e.__sub_gadget_dict[j]=b,b.element.setAttribute("data-gadget-scope",j),b.element.setAttribute("data-gadget-url",f),b.element.setAttribute("data-gadget-sandbox",d.sandbox),b.element._gadget=b,b.constructor.__ready_list.length){for(k=newc.Queue,i=0;i<b.constructor.__ready_list.length;i+=1)k.push(g(b.constructor.__ready_list[i]));returnk.push(h),k}returnh()}functionK(a,b){varc,e,f;c=function(){u.call(this)},c.__ready_list=[],c.__service_list=u.__service_list.slice(),c.declareMethod=u.declareMethod,c.declareJob=u.declareJob,c.declareAcquiredMethod=u.declareAcquiredMethod,c.allowPublicAcquisition=u.allowPublicAcquisition,c.ready=u.ready,c.setState=u.setState,c.onStateChange=u.onStateChange,c.declareService=u.declareService,c.onEvent=u.onEvent,c.onLoop=u.onLoop,c.prototype=newu,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(newd).parseFromString(a.responseText,"text/html"),f=R.parseGadgetHTMLDocument(c.__template_element,b);for(einf)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);returnc.__template_element.querySelectorAll("[data-gadget-url]").length&&c.__ready_list.push(y),c}functionL(b,d,e){varh,i,j=R.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(iinj)j.hasOwnProperty(i)&&(b.prototype["__"+i]=j[i]);for(b.__template_element=a.createElement("div"),e.element=a.body,e.state={},h=0;h<e.element.childNodes.length;h+=1)k.appendChild(e.element.childNodes[h].cloneNode(!0));returnb.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)W[c[b]]=null;for(b=0;b<d.length;b+=1)X[d[b]]=null;Y.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&&v(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&v(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)&&A(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&&A(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),e})}functionM(){vara=newu;returna.__acquired_method_dict={reportServiceError:function(a){s(a[0])}},a.__aq_parent=function(a){thrownewR.AcquisitionError("No gadget provides "+a)},a}functionN(a){vard,f,g,h,i,j,k,l;if(V.hasOwnProperty(a))thrownewError("bootstrap should not be called twice");returnd=D,d.__ready_list=[],d.__service_list=u.__service_list.slice(),d.prototype.__path=a,f=newD,C(f,M()),i=["getInterfaceList","getRequiredCSSList","getRequiredJSList","getPath","getTitle"],h=function(a){i.push(a)},l=[d,f,g,i],b.self===b.top?j=l:(k=c.defer(),j=c.any([k.promise,(newc.Queue).push(function(){returnc.delay(1e3)}).push(function(){returnl[2]=void0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){vara,b;for(h=function(a){i.push(newc.Promise(function(b,c){g.call({method:"declareMethod",params:a,success:b,error:c})}))},b=i.length,a=0;b>a;a+=1)h(i[a]);k.resolve(l)}}),l[2]=g),d.declareMethod=function(a,b){varc=u.declareMethod.apply(this,[a,b]);returnh(a),c},d.declareService=u.declareService,d.declareJob=u.declareJob,d.onEvent=u.onEvent,d.onLoop=u.onLoop,d.declareAcquiredMethod=u.declareAcquiredMethod,d.allowPublicAcquisition=u.allowPublicAcquisition,d.prototype.__acquired_method_dict={},Y.push(d),j}functionO(a,b){functiond(a){returnfunction(){returna.call(b,b)}}vare,f=newc.Queue;for(a.ready(function(){returnA(b)}),e=0;e<a.__ready_list.length;e+=1)f.push(d(a.__ready_list[e]));returnf}functionP(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){returnnewc.Promise(function(c,f){d.call({method:"acquire",params:[a,b],success:c,error:f,timeout:e})})},d.bind("methodCall",function(a,c){b[c[0]].apply(b,c[1]).push(a.complete,function(b){a.error(b.toString())}),a.delayReturn(!0)})}functionQ(a){varb,d,e,f,g=N(a);return(newc.Queue).push(function(){returng}).push(function(a){returnb=a[0],d=a[1],e=a[2],f=a[3],U.promise}).push(function(){returnc.all(f)}).push(function(c){returnvoid0!==e&&P(b,d,e),L(b,a,d)}).push(function(){returnx(d),b.__ready_list.unshift(y),O(b,d)}).push(function(){void0!==e&&e.notify({method:"ready"})}).push(void0,function(a){throws(a),void0!==e&&e.notify({method:"failed",params:a.toString()}),a})}varR,S,T,U,V={},W={},X={},Y=[],Z=0,$=newRegExp("^(?:[a-z]+:)?//|data:","i"),_=!1,aa=[];b.addEventListener("error",function(a){aa.push(a)}),b.addEventListener("beforeunload",function(){_=!0}),T=function(){returnthisinstanceofT?void(this._latest_promise=null):newT},T.prototype={constructor:T,lockAndRun:function(a){varb=this._latest_promise;returnnull===b?this._latest_promise=c.resolve(a()):this._latest_promise=this._latest_promise.always(function(){returna()}),this._latest_promise}},t.prototype=newError,t.prototype.constructor=t,S=function(){functiona(){vara,b=g.length;for(a=0;b>a;a+=1)g[a].cancel();g=[]}varb,d,e,f=this,g=[];returnthisinstanceofS?(b=newc.Promise(function(b,c){d=function(b){returne?void0:(f.isRejected=!0,f.rejectedReason=b,e=!0,a(),c(b))}},a),f.cancel=function(){e||(e=!0,b.cancel(),b.fail(function(a){f.isRejected=!0,f.rejectedReason=a}))},f.then=b.then.bind(b),f.fail=b.fail.bind(b),void(f.monitor=function(a){if(e)thrownewt;varb=(newc.Queue).push(function(){returna}).push(function(a){varb,c,d=g.length,e=[];for(c=0;d>c;c+=1)b=g[c],b.isFulfilled||b.isRejected||e.push(b);g=e},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b});returng.push(b),this})):newS},S.prototype=Object.create(c.Promise.prototype),S.prototype.constructor=S,u.prototype.__title="",u.prototype.__interface_list=[],u.prototype.__path="",u.prototype.__html="",u.prototype.__required_css_list=[],u.prototype.__required_js_list=[],u.__ready_list=[],u.ready=function(a){returnthis.__ready_list.push(a),this},u.setState=function(a){returnthis.prototype.__json_state=JSON.stringify(a),this},u.onStateChange=function(a){returnthis.prototype.__state_change_callback=a,this},u.__service_list=[],u.declareService=function(a){returnthis.__service_list.push(a),this},u.onEvent=function(a,b,c,d){returnthis.__service_list.push(function(){returno(this.element,a,c,b.bind(this),d)}),this},u.onLoop=function(a,b){returnvoid0===b&&(b=0),this.__service_list.push(function(){vard=newc.Queue,e=this,f=function(){d.push(function(){returnc.delay(b)}).push(function(){returnp()}).push(function(){returna.apply(e,[])}).push(f)};returnf(),d}),this},u.declareJob=function(a,b){returnthis.__job_declared=!0,this.prototype[a]=function(){varc=this,d=arguments;c.__job_triggered?z(c,a,b,d):c.__job_list.push([a,b,d])},this},u.declareMethod=function(a,b,c){returnthis.prototype[a]=function(){functiona(){returnb.apply(e,f)}vard,e=this,f=arguments;returnvoid0!==c&&c.hasOwnProperty("mutex")?(d="__mutex_"+c.mutex,e.hasOwnProperty(d)||(e[d]=newT),m(e[d].lockAndRun,[a],e[d])):m(b,f,e)},this},u.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,c,d=this,e=!1,f=d.hasOwnProperty("__modification_dict");f?(c=d.__modification_dict,e=!0):c={};for(bina)a.hasOwnProperty(b)&&a[b]!==d.state[b]&&(d.state[b]=a[b],c[b]=a[b],e=!0);returne&&void0!==d.__state_change_callback?(d.__modification_dict=c,m(d.__state_change_callback,[c],d).push(function(a){returndeleted.__modification_dict,a})):void0},{mutex:"changestate"}),u.declareAcquiredMethod=function(a,b){returnthis.prototype[a]=function(){vara=Array.prototype.slice.call(arguments,0),c=this;returnm(c.__aq_parent,[b,a],c)},this},u.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),u.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),u.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},D.__ready_list=[],D.__service_list=u.__service_list.slice(),D.ready=u.ready,D.setState=u.setState,D.onStateChange=u.onStateChange,D.declareService=u.declareService,D.onEvent=u.onEvent,D.onLoop=u.onLoop,D.prototype=newu,D.prototype.constructor=D,G.__ready_list=[],G.ready=u.ready,G.setState=u.setState,G.onStateChange=u.onStateChange,G.__service_list=[],G.declareService=u.declareService,G.onEvent=u.onEvent,G.onLoop=u.onLoop,G.prototype=newu,G.prototype.constructor=G,u.declareMethod("declareGadget",function(a,b){vard,e,f=this;if(void0===b&&(b={}),void0===b.sandbox&&(b.sandbox="public"),a=R.getAbsoluteURL(a,this.__path),"public"===b.sandbox)d=F;elseif("iframe"===b.sandbox)d=H;else{if("dataurl"!==b.sandbox)thrownewError("Unsupported sandbox options '"+b.sandbox+"'");d=I}returne=d(a,b,f),"function"==typeofe.then?(newc.Queue).push(function(){returne}).push(function(c){returnJ(c,b,f,a)}):J(e,b,f,a)}).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]}),R=function(a){varc;if(a===b&&(c=Y[0]),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},R.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},R.AcquisitionError.prototype=newError,R.AcquisitionError.prototype.constructor=R.AcquisitionError,R.getAbsoluteURL=function(a,b){returnb&&a?newl(a,b).href:a},R.declareJS=function(b,d,e){varf;returnW.hasOwnProperty(b)?f=c.resolve():(W[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&&Y.shift(),c()},g.onerror=function(a){e===!0&&Y.shift(),f(a)},g.src=b,d.appendChild(g)})),f},R.declareCSS=function(b,d){vare;returne=X.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(){X[b]=null,c()},f.onerror=e,d.appendChild(f)})},R.declareGadgetKlass=function(b){vard,e;if(V.hasOwnProperty(b)){if(V[b].hasOwnProperty("defer_list"))returne=c.defer(),V[b].defer_list.push(e),e.promise;if(V[b].is_resolved)returnV[b].result;throwV[b].result}returnV[b]={defer_list:[]},(newc.Queue).push(function(){returnq(b)}).push(function(e){d=K(e,b);varf,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(Y.push(d),f=0;f<i.length-1;f+=1)h.push(R.declareJS(i[f],g));h.push(R.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(R.declareCSS(j[f],g));returna.head.appendChild(g),c.all(h)}).push(function(){vara,c=V[b].defer_list.length;for(a=0;c>a;a+=1)V[b].defer_list[a].resolve(d);returndeleteV[b].defer_list,V[b].result=d,V[b].is_resolved=!0,d}).push(void0,function(a){varc,d=V[b].defer_list.length;for(c=0;d>c;c+=1)V[b].defer_list[c].reject(a);throwdeleteV[b].defer_list,V[b].result=a,V[b].is_resolved=!1,a})},R.clearGadgetKlassList=function(){V={},W={},X={}},R.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!$.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(R.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(R.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(R.getAbsoluteURL(d.getAttribute("src"),b)));returne},R.Mutex=T,b.rJS=b.renderJS=R,b.__RenderJSGadget=u,b.__RenderJSEmbeddedGadget=D,b.__RenderJSIframeGadget=G,U=newc.defer,R.manualBootstrap=function(){U.resolve()},a.addEventListener("DOMContentLoaded",U.resolve,!1),Q(r(b.location.href))}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
\ No newline at end of file
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){"use strict";functionb(b,c){vard,e,f,g="<!doctype><html><head></head></html>";returnb&&c?(d=(newa).parseFromString(g,"text/html"),e=d.createElement("base"),f=d.createElement("link"),d.head.appendChild(e),d.head.appendChild(f),e.href=c,f.href=b,f.href):b}functionc(a,c){if(void0!==c){if(!e.test(c))thrownewTypeError("Failed to construct 'URL': Invalid base URL");a=b(a,c)}if(!e.test(a))thrownewTypeError("Failed to construct 'URL': Invalid URL");this.href=a}try{if("https://example.com/a"===newwindow.URL("../a","https://example.com/").href)return}catch(d){}vare=/^(?:[a-z]+:)?\/\/|data:/i;c.prototype.href="",window.URL&&window.URL.createObjectURL&&(c.createObjectURL=window.URL.createObjectURL),window.URL&&window.URL.revokeObjectURL&&(c.revokeObjectURL=window.URL.revokeObjectURL),window.URL=c}(DOMParser),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";functionm(a){if(this.name="scopeerror",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Scope Error"}functionn(a,b,d){vare;try{e=a.apply(d,b)}catch(f){return(newc.Queue).push(function(){returnc.reject(f)})}returneinstanceofc.Queue?e:(newc.Queue).push(function(){returne})}functiono(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()})}functionp(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)}functionq(){functiona(){b.cancelAnimationFrame(e)}functiond(a){e=b.requestAnimationFrame(a)}vare;returnnewc.Promise(d,a)}functionr(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)}functions(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functiont(c){vard,e,f,g,h,i;if(aa)returnconsole.info("-- Error dropped, as page is unloaded"),voidconsole.info(c);for(ba.push(c),ba.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<ba.length;d+=1){if(i=ba[d],iinstanceofk&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void0!==i.target&&ba.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)}functionu(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functionv(){returnthisinstanceofv?void0:newv}functionw(a){a.hasOwnProperty("__monitor")&&(a.__monitor.cancel(),deletea.__monitor,a.__job_list=[])}functionx(a){a.__monitor=newT,a.__job_dict={},a.__job_triggered=!1,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(t)}functiony(a){a.__sub_gadget_dict={},a.__job_list=[],void0!==a.__json_state&&(a.state=JSON.parse(a.__json_state))}functionz(){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)}functionA(a,b,d,e){varf=n(d,e,a);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}))}functionB(a){(0!==a.constructor.__service_list.length||a.constructor.__job_declared)&&(x(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)A(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0})))}functionC(a,b,c){vard,e,f=this,g=f.__acquired_method_dict||{};if(!g.hasOwnProperty(b))returnf.__aq_parent(b,c);for(dinf.__sub_gadget_dict)f.__sub_gadget_dict.hasOwnProperty(d)&&f.__sub_gadget_dict[d]===a&&(e=d);returnn(g[b],[c,e],f).push(void0,function(a){if(ainstanceofS.AcquisitionError)returnf.__aq_parent(b,c);throwa})}functionD(a,b){a.__aq_parent=function(c,d){returnC.apply(b,[a,c,d])}}functionE(){returnthisinstanceofE?voidv.call(this):newE}functionF(b,c,d){void0===c.element&&(c.element=a.createElement("div"));vare,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=newb,f.element=c.element,f.state={},e=0;e<g.length;e+=1)h.appendChild(g[e].cloneNode(!0));returnf.element.appendChild(h),D(f,d),f}functionG(a,b,c){vard=S.declareGadgetKlass(a);return"function"==typeofd.then?d.then(function(a){returnF(a,b,c)}):F(d,b,c)}functionH(){returnthisinstanceofH?voidv.call(this):newH}functionI(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=newH,D(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:c,error:d})});returnn(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){(newc.Queue).push(function(){returng.__aq_parent.apply(g,b)}).then(a.complete).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}functionJ(a,b,e){return(newc.Queue).push(function(){returnr(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"}),o(c)}).push(function(a){returnI(a,b,e)})}functionK(b,d,e,f){functiong(a){returnfunction(){returna.call(b,b)}}functionh(){returna.contains(b.element)&&B(b),b}vari,j,k;if(y(b),j=d.scope,void0===j)for(j="RJS_"+$,$+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+$,$+=1;if(e.__sub_gadget_dict[j]=b,b.element.setAttribute("data-gadget-scope",j),b.element.setAttribute("data-gadget-url",f),b.element.setAttribute("data-gadget-sandbox",d.sandbox),b.element._gadget=b,b.constructor.__ready_list.length){for(k=newc.Queue,i=0;i<b.constructor.__ready_list.length;i+=1)k.push(g(b.constructor.__ready_list[i]));returnk.push(h),k}returnh()}functionL(a,b){varc,e,f;c=function(){v.call(this)},c.__ready_list=[],c.__service_list=v.__service_list.slice(),c.declareMethod=v.declareMethod,c.declareJob=v.declareJob,c.declareAcquiredMethod=v.declareAcquiredMethod,c.allowPublicAcquisition=v.allowPublicAcquisition,c.ready=v.ready,c.setState=v.setState,c.onStateChange=v.onStateChange,c.declareService=v.declareService,c.onEvent=v.onEvent,c.onLoop=v.onLoop,c.prototype=newv,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(newd).parseFromString(a.responseText,"text/html"),f=S.parseGadgetHTMLDocument(c.__template_element,b);for(einf)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);returnc.__template_element.querySelectorAll("[data-gadget-url]").length&&c.__ready_list.push(z),c}functionM(b,d,e){varh,i,j=S.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(iinj)j.hasOwnProperty(i)&&(b.prototype["__"+i]=j[i]);for(b.__template_element=a.createElement("div"),e.element=a.body,e.state={},h=0;h<e.element.childNodes.length;h+=1)k.appendChild(e.element.childNodes[h].cloneNode(!0));returnb.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)X[c[b]]=null;for(b=0;b<d.length;b+=1)Y[d[b]]=null;Z.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&&w(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&w(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)&&B(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&&B(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),e})}functionN(){vara=newv;returna.__acquired_method_dict={reportServiceError:function(a){t(a[0])}},a.__aq_parent=function(a){thrownewS.AcquisitionError("No gadget provides "+a)},a}functionO(a){vard,f,g,h,i,j,k,l;if(W.hasOwnProperty(a))thrownewError("bootstrap should not be called twice");returnd=E,d.__ready_list=[],d.__service_list=v.__service_list.slice(),d.prototype.__path=a,f=newE,D(f,N()),i=["getInterfaceList","getRequiredCSSList","getRequiredJSList","getPath","getTitle"],h=function(a){i.push(a)},l=[d,f,g,i],b.self===b.top?j=l:(k=c.defer(),j=c.any([k.promise,(newc.Queue).push(function(){returnc.delay(1e3)}).push(function(){returnl[2]=void0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){vara,b;for(h=function(a){i.push(newc.Promise(function(b,c){g.call({method:"declareMethod",params:a,success:b,error:c})}))},b=i.length,a=0;b>a;a+=1)h(i[a]);k.resolve(l)}}),l[2]=g),d.declareMethod=function(a,b){varc=v.declareMethod.apply(this,[a,b]);returnh(a),c},d.declareService=v.declareService,d.declareJob=v.declareJob,d.onEvent=v.onEvent,d.onLoop=v.onLoop,d.declareAcquiredMethod=v.declareAcquiredMethod,d.allowPublicAcquisition=v.allowPublicAcquisition,d.prototype.__acquired_method_dict={},Z.push(d),j}functionP(a,b){functiond(a){returnfunction(){returna.call(b,b)}}vare,f=newc.Queue;for(a.ready(function(){returnB(b)}),e=0;e<a.__ready_list.length;e+=1)f.push(d(a.__ready_list[e]));returnf}functionQ(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){returnnewc.Promise(function(c,f){d.call({method:"acquire",params:[a,b],success:c,error:f,timeout:e})})},d.bind("methodCall",function(a,c){b[c[0]].apply(b,c[1]).push(a.complete,function(b){a.error(b.toString())}),a.delayReturn(!0)})}functionR(a){varb,d,e,f,g=O(a);return(newc.Queue).push(function(){returng}).push(function(a){returnb=a[0],d=a[1],e=a[2],f=a[3],V.promise}).push(function(){returnc.all(f)}).push(function(c){returnvoid0!==e&&Q(b,d,e),M(b,a,d)}).push(function(){returny(d),b.__ready_list.unshift(z),P(b,d)}).push(function(){void0!==e&&e.notify({method:"ready"})}).push(void0,function(a){throwt(a),void0!==e&&e.notify({method:"failed",params:a.toString()}),a})}m.prototype=newError,m.prototype.constructor=m;varS,T,U,V,W={},X={},Y={},Z=[],$=0,_=newRegExp("^(?:[a-z]+:)?//|data:","i"),aa=!1,ba=[];b.addEventListener("error",function(a){ba.push(a)}),b.addEventListener("beforeunload",function(){aa=!0}),U=function(){returnthisinstanceofU?void(this._latest_promise=null):newU},U.prototype={constructor:U,lockAndRun:function(a){varb=this._latest_promise;returnnull===b?this._latest_promise=c.resolve(a()):this._latest_promise=this._latest_promise.always(function(){returna()}),this._latest_promise}},u.prototype=newError,u.prototype.constructor=u,T=function(){functiona(){vara,b=g.length;for(a=0;b>a;a+=1)g[a].cancel();g=[]}varb,d,e,f=this,g=[];returnthisinstanceofT?(b=newc.Promise(function(b,c){d=function(b){returne?void0:(f.isRejected=!0,f.rejectedReason=b,e=!0,a(),c(b))}},a),f.cancel=function(){e||(e=!0,b.cancel(),b.fail(function(a){f.isRejected=!0,f.rejectedReason=a}))},f.then=b.then.bind(b),f.fail=b.fail.bind(b),void(f.monitor=function(a){if(e)thrownewu;varb=(newc.Queue).push(function(){returna}).push(function(a){varb,c,d=g.length,e=[];for(c=0;d>c;c+=1)b=g[c],b.isFulfilled||b.isRejected||e.push(b);g=e},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b});returng.push(b),this})):newT},T.prototype=Object.create(c.Promise.prototype),T.prototype.constructor=T,v.prototype.__title="",v.prototype.__interface_list=[],v.prototype.__path="",v.prototype.__html="",v.prototype.__required_css_list=[],v.prototype.__required_js_list=[],v.__ready_list=[],v.ready=function(a){returnthis.__ready_list.push(a),this},v.setState=function(a){returnthis.prototype.__json_state=JSON.stringify(a),this},v.onStateChange=function(a){returnthis.prototype.__state_change_callback=a,this},v.__service_list=[],v.declareService=function(a){returnthis.__service_list.push(a),this},v.onEvent=function(a,b,c,d){returnthis.__service_list.push(function(){returnp(this.element,a,c,b.bind(this),d)}),this},v.onLoop=function(a,b){returnvoid0===b&&(b=0),this.__service_list.push(function(){vard=newc.Queue,e=this,f=function(){d.push(function(){returnc.delay(b)}).push(function(){returnq()}).push(function(){returna.apply(e,[])}).push(f)};returnf(),d}),this},v.declareJob=function(a,b){returnthis.__job_declared=!0,this.prototype[a]=function(){varc=this,d=arguments;c.__job_triggered?A(c,a,b,d):c.__job_list.push([a,b,d])},this},v.declareMethod=function(a,b,c){returnthis.prototype[a]=function(){functiona(){returnb.apply(e,f)}vard,e=this,f=arguments;returnvoid0!==c&&c.hasOwnProperty("mutex")?(d="__mutex_"+c.mutex,e.hasOwnProperty(d)||(e[d]=newU),n(e[d].lockAndRun,[a],e[d])):n(b,f,e)},this},v.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,c,d=this,e=!1,f=d.hasOwnProperty("__modification_dict");f?(c=d.__modification_dict,e=!0):c={};for(bina)a.hasOwnProperty(b)&&a[b]!==d.state[b]&&(d.state[b]=a[b],c[b]=a[b],e=!0);returne&&void0!==d.__state_change_callback?(d.__modification_dict=c,n(d.__state_change_callback,[c],d).push(function(a){returndeleted.__modification_dict,a})):void0},{mutex:"changestate"}),v.declareAcquiredMethod=function(a,b){returnthis.prototype[a]=function(){vara=Array.prototype.slice.call(arguments,0),c=this;returnn(c.__aq_parent,[b,a],c)},this},v.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),v.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),v.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},E.__ready_list=[],E.__service_list=v.__service_list.slice(),E.ready=v.ready,E.setState=v.setState,E.onStateChange=v.onStateChange,E.declareService=v.declareService,E.onEvent=v.onEvent,E.onLoop=v.onLoop,E.prototype=newv,E.prototype.constructor=E,H.__ready_list=[],H.ready=v.ready,H.setState=v.setState,H.onStateChange=v.onStateChange,H.__service_list=[],H.declareService=v.declareService,H.onEvent=v.onEvent,H.onLoop=v.onLoop,H.prototype=newv,H.prototype.constructor=H,v.declareMethod("declareGadget",function(a,b){vard,e,f=this;if(void0===b&&(b={}),void0===b.sandbox&&(b.sandbox="public"),a=S.getAbsoluteURL(a,this.__path),"public"===b.sandbox)d=G;elseif("iframe"===b.sandbox)d=I;else{if("dataurl"!==b.sandbox)thrownewError("Unsupported sandbox options '"+b.sandbox+"'");d=J}returne=d(a,b,f),"function"==typeofe.then?(newc.Queue).push(function(){returne}).push(function(c){returnK(c,b,f,a)}):K(e,b,f,a)}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewm("Gadget scope '"+a+"' is not known.");returnthis.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewm("Gadget scope '"+a+"' is not known.");deletethis.__sub_gadget_dict[a]}),S=function(a){varc;if(a===b&&(c=Z[0]),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},S.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},S.AcquisitionError.prototype=newError,S.AcquisitionError.prototype.constructor=S.AcquisitionError,S.getAbsoluteURL=function(a,b){returnb&&a?newl(a,b).href:a},S.declareJS=function(b,d,e){varf;returnX.hasOwnProperty(b)?f=c.resolve():(X[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&&Z.shift(),c()},g.onerror=function(a){e===!0&&Z.shift(),f(a)},g.src=b,d.appendChild(g)})),f},S.declareCSS=function(b,d){vare;returne=Y.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(){Y[b]=null,c()},f.onerror=e,d.appendChild(f)})},S.declareGadgetKlass=function(b){vard,e;if(W.hasOwnProperty(b)){if(W[b].hasOwnProperty("defer_list"))returne=c.defer(),W[b].defer_list.push(e),e.promise;if(W[b].is_resolved)returnW[b].result;throwW[b].result}returnW[b]={defer_list:[]},(newc.Queue).push(function(){returnr(b)}).push(function(e){d=L(e,b);varf,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(Z.push(d),f=0;f<i.length-1;f+=1)h.push(S.declareJS(i[f],g));h.push(S.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(S.declareCSS(j[f],g));returna.head.appendChild(g),c.all(h)}).push(function(){vara,c=W[b].defer_list.length;for(a=0;c>a;a+=1)W[b].defer_list[a].resolve(d);returndeleteW[b].defer_list,W[b].result=d,W[b].is_resolved=!0,d}).push(void0,function(a){varc,d=W[b].defer_list.length;for(c=0;d>c;c+=1)W[b].defer_list[c].reject(a);throwdeleteW[b].defer_list,W[b].result=a,W[b].is_resolved=!1,a})},S.clearGadgetKlassList=function(){W={},X={},Y={}},S.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!_.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(S.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(S.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(S.getAbsoluteURL(d.getAttribute("src"),b)));returne},S.Mutex=U,S.ScopeError=m,b.rJS=b.renderJS=S,b.__RenderJSGadget=v,b.__RenderJSEmbeddedGadget=E,b.__RenderJSIframeGadget=H,V=newc.defer,S.manualBootstrap=function(){V.resolve()},a.addEventListener("DOMContentLoaded",V.resolve,!1),R(s(b.location.href))}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);