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(a,b,c,d,e,f,g){"use strict";functionh(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functioni(b){if(b.constructor===XMLHttpRequest&&(b={readyState:b.readyState,status:b.status,statusText:b.statusText,response_headers:b.getAllResponseHeaders()}),b.constructor===Array||b.constructor===String||b.constructor===Object)try{b=JSON.stringify(b)}catch(c){}a.getElementsByTagName("body")[0].textContent=b,console.error(b.stack),console.error(b)}functionj(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functionk(){returnthisinstanceofk?void0:newk}functionl(a){void0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=newz,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(function(a){returni(a)})}functionm(a){a.__sub_gadget_dict={},l(a)}functionn(a){varb,d,e,f,g,h=a.__element.querySelectorAll("[data-gadget-scope]"),i=[];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!==d&&null!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void0,sandbox:f||void0}));returnc.all(i)}functiono(a){a.__monitor.monitor((newc.Queue).push(function(){varb,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}functionp(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]);thrownewy.AcquisitionError("aq_dynamic is not defined")}).push(void0,function(a){if(ainstanceofy.AcquisitionError)returng.__aq_parent(b,d);throwa})}functionq(a,b){a.__aq_parent=function(c,d){returnp.apply(b,[a,c,d])}}functionr(){returnthisinstanceofr?voidk.call(this):newr}functions(b,d,e){functionf(a,b){returnfunction(){returna(b)}}varg;returnvoid0===d.element&&(d.element=a.createElement("div")),(newc.Queue).push(function(){returny.declareGadgetKlass(b)}).push(function(a){varb,f=a.__template_element.body.childNodes;for(w=a,g=newa,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));returnq(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){varb,d=newc.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(y.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(y.declareCSS,a[1][b]));returnd}).push(function(){returng})}functiont(){returnthisinstanceoft?voidk.call(this):newt}functionu(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=newt,q(g,f),h=a.createElement("iframe"),h.setAttribute("src",b),g.__path=b,g.__element=d.element,d.element.appendChild(h),g.__chan=e.build({window:h.contentWindow,origin:"*",scope:"renderJS"}),g.__chan.bind("declareMethod",function(a,b){returng[b]=function(){vara=arguments;returnnewc.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})})},"OK"}),g.__chan.bind("ready",function(){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)}),c.any([i.promise,c.timeout(5e3)])}functionv(){vard,j,m,n,p,s,t,u=h(b.location.href),v=newc.Queue,z=0,D=!1;if(A.hasOwnProperty(u))thrownewError("bootstrap should not be called twice");x=newc.Promise(function(h,s){functionv(){varb,e,i=y.parseGadgetHTMLDocument(a,u);for(eini)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),j.__element=a.body,b=0;b<j.__element.childNodes.length;b+=1)d.__template_element.appendChild(j.__element.childNodes[b].cloneNode(!0));c.all([j.getRequiredJSList(),j.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)B[c[b]]=null;for(b=0;b<d.length;b+=1)C[d[b]]=null;w=void0}).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&&l(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&l(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)&&o(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&&o(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),j}).then(h,function(a){throws(a),console.error(a),a})}t=newk,t.__acquired_method_dict={getTopURL:function(){returnu},reportServiceError:function(a){i(a[0])}},t.__aq_parent=function(a){thrownewy.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){k.call(this)},d.declareMethod=k.declareMethod,d.declareAcquiredMethod=k.declareAcquiredMethod,d.allowPublicAcquisition=k.allowPublicAcquisition,d.__ready_list=k.__ready_list.slice(),d.ready=k.ready,d.__service_list=k.__service_list.slice(),d.declareService=k.declareService,d.prototype=newk,d.prototype.constructor=d,d.prototype.__path=u,A[u]=d,j=newA[u],q(j,t)):(m=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=r,d.__ready_list=k.__ready_list.slice(),d.__service_list=k.__service_list.slice(),d.prototype.__path=u,j=newr,n=function(){0===z&&D===!0&&m.notify({method:"ready"})},p=function(a){z+=1,m.call({method:"declareMethod",params:a,success:function(){z-=1,n()},error:function(){z-=1}})},p("getInterfaceList"),p("getRequiredCSSList"),p("getRequiredJSList"),p("getPath"),p("getTitle"),d.declareMethod=function(a,b){varc=k.declareMethod.apply(this,[a,b]);returnp(a),c},d.declareService=k.declareService,d.declareAcquiredMethod=k.declareAcquiredMethod,d.allowPublicAcquisition=k.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b,d){returnnewc.Promise(function(c,e){m.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})}),d.prototype.__acquired_method_dict={},w=d,a.addEventListener("DOMContentLoaded",v,!1)}),v.push(function(){returnx}).push(function(c){functione(){returnc}varf;for(b.top!==b.self&&d.__ready_list.splice(1,0,function(){returnc.__aq_parent("getTopURL",[],100).then(function(b){vard=a.createElement("base");d.href=b,d.target="_top",a.head.appendChild(d),m.bind("methodCall",function(a,b){c[b[0]].apply(c,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)})}).fail(function(a){if("timeout_error"!==a)throwa;s=!0,q(c,t)})}),d.ready(function(a){returno(a)}),v.push(e),f=0;f<d.__ready_list.length;f+=1)v.push(d.__ready_list[f]).push(e)}),b.self===b.top?v.fail(function(a){throwi(a),a}):v.then(function(){D=!0,n()}).fail(function(a){throws?i(a):m.notify({method:"failed",params:a.toString()}),a})}varw,x,y,z,A={},B={},C={};j.prototype=newError,j.prototype.constructor=j,z=function(){functiona(){vara,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}varb,d,e,f,g=this,h=[];returnthisinstanceofz?(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)thrownewj;varb=(newc.Queue).push(function(){returna}).push(function(){vara,b,c=h.length,d=[];for(b=0;c>b;b+=1)a=h[b],a.isFulfilled||a.isRejected||d.push(a);h=d},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){returne(a),a});returnh.push(b),this})):newz},z.prototype=Object.create(c.Promise.prototype),z.prototype.constructor=z,k.prototype.__title="",k.prototype.__interface_list=[],k.prototype.__path="",k.prototype.__html="",k.prototype.__required_css_list=[],k.prototype.__required_js_list=[],k.__ready_list=[m,n],k.ready=function(a){returnthis.__ready_list.push(a),this},k.__service_list=[],k.declareService=function(a){returnthis.__service_list.push(a),this},k.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},k.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}),k.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},k.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),k.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},r.__ready_list=k.__ready_list.slice(),r.__service_list=k.__service_list.slice(),r.ready=k.ready,r.declareService=k.declareService,r.prototype=newk,r.prototype.constructor=r,t.__ready_list=k.__ready_list.slice(),t.ready=k.ready,t.__service_list=k.__service_list.slice(),t.declareService=k.declareService,t.prototype=newk,t.prototype.constructor=t,k.declareMethod("declareGadget",function(b,d){vare,f,g=this,h=x;returnvoid0===d&&(d={}),void0===d.sandbox&&(d.sandbox="public"),b=y.getAbsoluteURL(b,this.__path),x=(newc.Queue).push(function(){returnh}).push(void0,function(){}).push(function(){vara;if("public"===d.sandbox)a=s;else{if("iframe"!==d.sandbox)thrownewError("Unsupported sandbox options '"+d.sandbox+"'");a=u}returna(b,d,g)}).push(function(a){returnw=void0,a}).push(void0,function(a){throww=void0,a}),f=x,e=(newc.Queue).push(function(){returnf}).push(function(c){functionf(){returnc}varh;for(h=0;h<c.constructor.__ready_list.length;h+=1)e.push(c.constructor.__ready_list[h]),e.push(f);returnvoid0!==d.scope&&(g.__sub_gadget_dict[d.scope]=c,c.__element.setAttribute("data-gadget-scope",d.scope)),c.__element.setAttribute("data-gadget-url",b),c.__element.setAttribute("data-gadget-sandbox",d.sandbox),c.__element._gadget=c,a.contains(c.__element)&&e.push(o),e.push(f),c})}).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]}),y=function(a){varc;if(a===b&&(c=w),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},y.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},y.AcquisitionError.prototype=newError,y.AcquisitionError.prototype.constructor=y.AcquisitionError,y.getAbsoluteURL=function(a,b){varc,e,f,g="<!doctype><html><head></head></html>",h=newRegExp("^(?:[a-z]+:)?//|data:","i");returna&&b&&!h.test(a)?(c=(newd).parseFromString(g,"text/html"),e=c.createElement("base"),f=c.createElement("link"),c.head.appendChild(e),c.head.appendChild(f),e.href=b,f.href=a,f.href):a},y.declareJS=function(b){vard;returnd=B.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){B[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},y.declareCSS=function(b){vard;returnd=C.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){C[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},y.declareGadgetKlass=function(a){functionb(){varb,c,e;if(!A.hasOwnProperty(a)){b=function(){k.call(this)},b.__ready_list=k.__ready_list.slice(),b.__service_list=k.__service_list.slice(),b.declareMethod=k.declareMethod,b.declareAcquiredMethod=k.declareAcquiredMethod,b.allowPublicAcquisition=k.allowPublicAcquisition,b.ready=k.ready,b.declareService=k.declareService,b.prototype=newk,b.prototype.constructor=b,b.prototype.__path=a,b.prototype.__acquired_method_dict={},b.__template_element=(newd).parseFromString(h.responseText,"text/html"),e=y.parseGadgetHTMLDocument(b.__template_element,a);for(cine)e.hasOwnProperty(c)&&(b.prototype["__"+c]=e[c]);A[a]=b}returnA[a]}functione(c,d){functione(){vara;try{0===h.readyState?d(h):4===h.readyState&&(h.status<200||h.status>=300||!/^text\/html[;]?/.test(h.getResponseHeader("Content-Type")||"")?d(h):(a=b(),c(a)))}catch(e){d(e)}}h=newXMLHttpRequest,h.open("GET",a),h.onreadystatechange=e,h.setRequestHeader("Accept","text/html"),h.withCredentials=!0,h.send()}functionf(){void0!==h&&h.readyState!==h.DONE&&h.abort()}varg,h;returng=A.hasOwnProperty(a)?c.resolve(A[a]):newc.Promise(e,f)},y.clearGadgetKlassList=function(){A={},B={},C={}},y.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]},f=newRegExp("^(?:[a-z]+:)?//","i");if(!b||!f.test(b))thrownewError("The url should be absolute: "+b);if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");for(e.title=a.title,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(y.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(y.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(y.getAbsoluteURL(d.getAttribute("src"),b)));returne},b.rJS=b.renderJS=y,b.__RenderJSGadget=k,b.__RenderJSEmbeddedGadget=r,b.__RenderJSIframeGadget=t,v()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node);
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(a,b,c,d,e,f,g,h){"use strict";functioni(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functionj(b){if(b.constructor===XMLHttpRequest&&(b={readyState:b.readyState,status:b.status,statusText:b.statusText,response_headers:b.getAllResponseHeaders()}),b.constructor===Array||b.constructor===String||b.constructor===Object)try{b=JSON.stringify(b)}catch(c){}a.getElementsByTagName("body")[0].textContent=b,console.error(b.stack),console.error(b)}functionk(a){if(this.name="resolved",a!==h&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functionl(){returnthisinstanceofl?void0:newl}functionm(a){a.__monitor!==h&&a.__monitor.cancel(),a.__monitor=newA,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(function(a){returnj(a)})}functionn(a){a.__sub_gadget_dict={},m(a)}functiono(a){varb,d,e,f,g,i=a.__element.querySelectorAll("[data-gadget-scope]"),j=[];for(g=0;g<i.length;g+=1)b=i[g],d=b.getAttribute("data-gadget-scope"),e=b.getAttribute("data-gadget-url"),f=b.getAttribute("data-gadget-sandbox"),null!==d&&null!==e&&j.push(a.declareGadget(e,{element:b,scope:d||h,sandbox:f||h}));returnc.all(j)}functionp(a){a.__monitor.monitor((newc.Queue).push(function(){varb,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}functionq(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]);thrownewz.AcquisitionError("aq_dynamic is not defined")}).push(h,function(a){if(ainstanceofz.AcquisitionError)returng.__aq_parent(b,d);throwa})}functionr(a,b){a.__aq_parent=function(c,d){returnq.apply(b,[a,c,d])}}functions(){returnthisinstanceofs?(l.call(this),void0):news}functiont(b,d,e){functionf(a,b){returnfunction(){returna(b)}}varg;returnd.element===h&&(d.element=a.createElement("div")),(newc.Queue).push(function(){returnz.declareGadgetKlass(b)}).push(function(a){varb,f=a.__template_element.body.childNodes;for(x=a,g=newa,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));returnr(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){varb,d=newc.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(z.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(z.declareCSS,a[1][b]));returnd}).push(function(){returng})}functionu(){returnthisinstanceofu?(l.call(this),void0):newu}functionv(b,d,f){varg,i,j=c.defer();if(d.element===h)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=newu,r(g,f),i=a.createElement("iframe"),i.setAttribute("src",b),g.__path=b,g.__element=d.element,d.element.appendChild(i),g.__chan=e.build({window:i.contentWindow,origin:"*",scope:"renderJS"}),g.__chan.bind("declareMethod",function(a,b){returng[b]=function(){vara=arguments;returnnewc.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})})},"OK"}),g.__chan.bind("ready",function(){returnj.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){returnj.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)}),c.any([j.promise,c.timeout(5e3)])}functionw(){vard,k,n,o,q,t,u=i(b.location.href),v=newc.Queue,w=0,A=!1;if(B.hasOwnProperty(u))thrownewError("bootstrap should not be called twice");y=newc.Promise(function(i,v){functiony(){varb,e,j=z.parseGadgetHTMLDocument(a,u);for(einj)j.hasOwnProperty(e)&&(d.prototype["__"+e]=j[e]);for(d.__template_element=a.createElement("div"),k.__element=a.body,b=0;b<k.__element.childNodes.length;b+=1)d.__template_element.appendChild(k.__element.childNodes[b].cloneNode(!0));c.all([k.getRequiredJSList(),k.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)C[c[b]]=null;for(b=0;b<d.length;b+=1)D[d[b]]=null;x=h}).then(function(){varb=a.querySelector("body"),c=newf(function(b){varc,d,e,f,i,j;b.forEach(function(b){if("childList"===b.type){for(e=b.removedNodes.length,c=0;e>c;c+=1)if(i=b.removedNodes[c],i.nodeType===g.ELEMENT_NODE)for(i.hasAttribute("data-gadget-url")&&i._gadget!==h&&m(i._gadget),j=i.querySelectorAll("[data-gadget-url]"),f=j.length,d=0;f>d;d+=1)i=j[d],i._gadget!==h&&m(i._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(i=b.addedNodes[c],i.nodeType===g.ELEMENT_NODE)for(i.hasAttribute("data-gadget-url")&&i._gadget!==h&&a.contains(i)&&p(i._gadget),j=i.querySelectorAll("[data-gadget-url]"),f=j.length,d=0;f>d;d+=1)i=j[d],a.contains(i)&&i._gadget!==h&&p(i._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),k}).then(i,function(a){throwv(a),console.error(a),a})}b.self===b.top?(t=newl,t.__acquired_method_dict={getTopURL:function(){returnu},reportServiceError:function(a){j(a[0])}},t.__aq_parent=function(a){thrownewz.AcquisitionError("No gadget provides "+a)},d=function(){l.call(this)},d.declareMethod=l.declareMethod,d.declareAcquiredMethod=l.declareAcquiredMethod,d.allowPublicAcquisition=l.allowPublicAcquisition,d.__ready_list=l.__ready_list.slice(),d.ready=l.ready,d.__service_list=l.__service_list.slice(),d.declareService=l.declareService,d.prototype=newl,d.prototype.constructor=d,d.prototype.__path=u,B[u]=d,k=newB[u],r(k,t)):(n=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=s,d.__ready_list=l.__ready_list.slice(),d.__service_list=l.__service_list.slice(),d.prototype.__path=u,k=news,n.bind("methodCall",function(a,b){k[b[0]].apply(k,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),o=function(){0===w&&A===!0&&n.notify({method:"ready"})},q=function(a){w+=1,n.call({method:"declareMethod",params:a,success:function(){w-=1,o()},error:function(){w-=1}})},q("getInterfaceList"),q("getRequiredCSSList"),q("getRequiredJSList"),q("getPath"),q("getTitle"),d.declareMethod=function(a,b){varc=l.declareMethod.apply(this,[a,b]);returnq(a),c},d.declareService=l.declareService,d.declareAcquiredMethod=l.declareAcquiredMethod,d.allowPublicAcquisition=l.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b){returnnewc.Promise(function(c,d){n.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){d(a)}})})}),d.prototype.__acquired_method_dict={},x=d,a.addEventListener("DOMContentLoaded",y,!1)}),v.push(function(){returny}).push(function(c){functione(){returnc}varf;for(b.top!==b.self&&d.ready(function(){varb=a.createElement("base");returnc.__aq_parent("getTopURL",[]).then(function(c){b.href=c,b.target="_top",a.head.appendChild(b)})}),d.ready(function(a){returnp(a)}),v.push(e),f=0;f<d.__ready_list.length;f+=1)v.push(d.__ready_list[f]).push(e)}),b.self===b.top?v.fail(function(a){throwj(a),a}):v.then(function(){A=!0,o()}).fail(function(a){thrown.notify({method:"failed",params:a.toString()}),a})}varx,y,z,A,B={},C={},D={};k.prototype=newError,k.prototype.constructor=k,A=function(){functiona(){vara,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}varb,d,e,f,g=this,h=[];returnthisinstanceofA?(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)},g.monitor=function(a){if(f)thrownewk;varb=(newc.Queue).push(function(){returna}).push(function(){vara,b,c=h.length,d=[];for(b=0;c>b;b+=1)a=h[b],a.isFulfilled||a.isRejected||d.push(a);h=d},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){returne(a),a});returnh.push(b),this},void0):newA},A.prototype=Object.create(Promise.prototype),A.prototype.constructor=A,l.prototype.__title="",l.prototype.__interface_list=[],l.prototype.__path="",l.prototype.__html="",l.prototype.__required_css_list=[],l.prototype.__required_js_list=[],l.__ready_list=[n,o],l.ready=function(a){returnthis.__ready_list.push(a),this},l.__service_list=[],l.declareService=function(a){returnthis.__service_list.push(a),this},l.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},l.declareMethod("getInterfaceList",function(){returnthis.__interface_list}).declareMethod("getRequiredCSSList",function(){returnthis.__required_css_list}).declareMethod("getRequiredJSList",function(){returnthis.__required_js_list}).declareMethod("getPath",function(){returnthis.__path}).declareMethod("getTitle",function(){returnthis.__title}).declareMethod("getElement",function(){if(this.__element===h)thrownewError("No element defined");returnthis.__element}),l.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},l.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),l.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},s.__ready_list=l.__ready_list.slice(),s.__service_list=l.__service_list.slice(),s.ready=l.ready,s.declareService=l.declareService,s.prototype=newl,s.prototype.constructor=s,u.__ready_list=l.__ready_list.slice(),u.ready=l.ready,u.__service_list=l.__service_list.slice(),u.declareService=l.declareService,u.prototype=newl,u.prototype.constructor=u,l.declareMethod("declareGadget",function(b,d){vare,f,g=this,i=y;returnd===h&&(d={}),d.sandbox===h&&(d.sandbox="public"),b=z.getAbsoluteURL(b,this.__path),y=(newc.Queue).push(function(){returni}).push(h,function(){}).push(function(){vara;if("public"===d.sandbox)a=t;else{if("iframe"!==d.sandbox)thrownewError("Unsupported sandbox options '"+d.sandbox+"'");a=v}returna(b,d,g)}).push(function(a){returnx=h,a}).push(h,function(a){throwx=h,a}),f=y,e=(newc.Queue).push(function(){returnf}).push(function(c){functionf(){returnc}vari;for(i=0;i<c.constructor.__ready_list.length;i+=1)e.push(c.constructor.__ready_list[i]),e.push(f);returnd.scope!==h&&(g.__sub_gadget_dict[d.scope]=c,c.__element.setAttribute("data-gadget-scope",d.scope)),c.__element.setAttribute("data-gadget-url",b),c.__element.setAttribute("data-gadget-sandbox",d.sandbox),c.__element._gadget=c,a.contains(c.__element)&&e.push(p),e.push(f),c})}).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]}),z=function(a){varc;if(a===b&&(c=x),c===h)thrownewError("Unknown selector '"+a+"'");returnc},z.AcquisitionError=function(a){if(this.name="AcquisitionError",a!==h&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},z.AcquisitionError.prototype=newError,z.AcquisitionError.prototype.constructor=z.AcquisitionError,z.getAbsoluteURL=function(a,b){varc,e,f,g="<!doctype><html><head></head></html>",h=newRegExp("^(?:[a-z]+:)?//|data:","i");returna&&b&&!h.test(a)?(c=(newd).parseFromString(g,"text/html"),e=c.createElement("base"),f=c.createElement("link"),c.head.appendChild(e),c.head.appendChild(f),e.href=b,f.href=a,f.href):a},z.declareJS=function(b){vard;returnd=C.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){C[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},z.declareCSS=function(b){vard;returnd=D.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){D[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},z.declareGadgetKlass=function(a){functionb(){varb,c,e;if(!B.hasOwnProperty(a)){b=function(){l.call(this)},b.__ready_list=l.__ready_list.slice(),b.__service_list=l.__service_list.slice(),b.declareMethod=l.declareMethod,b.declareAcquiredMethod=l.declareAcquiredMethod,b.allowPublicAcquisition=l.allowPublicAcquisition,b.ready=l.ready,b.declareService=l.declareService,b.prototype=newl,b.prototype.constructor=b,b.prototype.__path=a,b.prototype.__acquired_method_dict={},b.__template_element=(newd).parseFromString(i.responseText,"text/html"),e=z.parseGadgetHTMLDocument(b.__template_element,a);for(cine)e.hasOwnProperty(c)&&(b.prototype["__"+c]=e[c]);B[a]=b}returnB[a]}functione(c,d){functione(){vara;try{0===i.readyState?d(i):4===i.readyState&&(i.status<200||i.status>=300||!/^text\/html[;]?/.test(i.getResponseHeader("Content-Type")||"")?d(i):(a=b(),c(a)))}catch(e){d(e)}}i=newXMLHttpRequest,i.open("GET",a),i.onreadystatechange=e,i.setRequestHeader("Accept","text/html"),i.withCredentials=!0,i.send()}functionf(){i!==h&&i.readyState!==i.DONE&&i.abort()}varg,i;returng=B.hasOwnProperty(a)?c.resolve(B[a]):newc.Promise(e,f)},z.clearGadgetKlassList=function(){B={},C={},D={}},z.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]},f=newRegExp("^(?:[a-z]+:)?//","i");if(!b||!f.test(b))thrownewError("The url should be absolute: "+b);if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");for(e.title=a.title,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(z.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(z.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(z.getAbsoluteURL(d.getAttribute("src"),b)));returne},b.rJS=b.renderJS=z,b.__RenderJSGadget=l,b.__RenderJSEmbeddedGadget=s,b.__RenderJSIframeGadget=u,w()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node);
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(a,b,c,d,e,f,g){"use strict";functionh(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functioni(b){if(b.constructor===XMLHttpRequest&&(b={readyState:b.readyState,status:b.status,statusText:b.statusText,response_headers:b.getAllResponseHeaders()}),b.constructor===Array||b.constructor===String||b.constructor===Object)try{b=JSON.stringify(b)}catch(c){}a.getElementsByTagName("body")[0].textContent=b,console.error(b.stack),console.error(b)}functionj(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functionk(){returnthisinstanceofk?void0:newk}functionl(a){void0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=newz,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(function(a){returni(a)})}functionm(a){a.__sub_gadget_dict={},l(a)}functionn(a){varb,d,e,f,g,h=a.__element.querySelectorAll("[data-gadget-scope]"),i=[];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!==d&&null!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void0,sandbox:f||void0}));returnc.all(i)}functiono(a){a.__monitor.monitor((newc.Queue).push(function(){varb,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}functionp(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]);thrownewy.AcquisitionError("aq_dynamic is not defined")}).push(void0,function(a){if(ainstanceofy.AcquisitionError)returng.__aq_parent(b,d);throwa})}functionq(a,b){a.__aq_parent=function(c,d){returnp.apply(b,[a,c,d])}}functionr(){returnthisinstanceofr?voidk.call(this):newr}functions(b,d,e){functionf(a,b){returnfunction(){returna(b)}}varg;returnvoid0===d.element&&(d.element=a.createElement("div")),(newc.Queue).push(function(){returny.declareGadgetKlass(b)}).push(function(a){varb,f=a.__template_element.body.childNodes;for(w=a,g=newa,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));returnq(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){varb,d=newc.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(y.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(y.declareCSS,a[1][b]));returnd}).push(function(){returng})}functiont(){returnthisinstanceoft?voidk.call(this):newt}functionu(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=newt,q(g,f),h=a.createElement("iframe"),h.setAttribute("src",b),g.__path=b,g.__element=d.element,d.element.appendChild(h),g.__chan=e.build({window:h.contentWindow,origin:"*",scope:"renderJS"}),g.__chan.bind("declareMethod",function(a,b){returng[b]=function(){vara=arguments;returnnewc.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})})},"OK"}),g.__chan.bind("ready",function(){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)}),c.any([i.promise,c.timeout(5e3)])}functionv(){vard,j,m,n,p,s,t,u=h(b.location.href),v=newc.Queue,z=0,D=!1;if(A.hasOwnProperty(u))thrownewError("bootstrap should not be called twice");x=newc.Promise(function(h,s){functionv(){varb,e,i=y.parseGadgetHTMLDocument(a,u);for(eini)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),j.__element=a.body,b=0;b<j.__element.childNodes.length;b+=1)d.__template_element.appendChild(j.__element.childNodes[b].cloneNode(!0));c.all([j.getRequiredJSList(),j.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)B[c[b]]=null;for(b=0;b<d.length;b+=1)C[d[b]]=null;w=void0}).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&&l(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&l(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)&&o(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&&o(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),j}).then(h,function(a){throws(a),console.error(a),a})}t=newk,t.__acquired_method_dict={getTopURL:function(){returnu},reportServiceError:function(a){i(a[0])}},t.__aq_parent=function(a){thrownewy.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){k.call(this)},d.declareMethod=k.declareMethod,d.declareAcquiredMethod=k.declareAcquiredMethod,d.allowPublicAcquisition=k.allowPublicAcquisition,d.__ready_list=k.__ready_list.slice(),d.ready=k.ready,d.__service_list=k.__service_list.slice(),d.declareService=k.declareService,d.prototype=newk,d.prototype.constructor=d,d.prototype.__path=u,A[u]=d,j=newA[u],q(j,t)):(m=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=r,d.__ready_list=k.__ready_list.slice(),d.__service_list=k.__service_list.slice(),d.prototype.__path=u,j=newr,n=function(){0===z&&D===!0&&m.notify({method:"ready"})},p=function(a){z+=1,m.call({method:"declareMethod",params:a,success:function(){z-=1,n()},error:function(){z-=1}})},p("getInterfaceList"),p("getRequiredCSSList"),p("getRequiredJSList"),p("getPath"),p("getTitle"),d.declareMethod=function(a,b){varc=k.declareMethod.apply(this,[a,b]);returnp(a),c},d.declareService=k.declareService,d.declareAcquiredMethod=k.declareAcquiredMethod,d.allowPublicAcquisition=k.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b,d){returnnewc.Promise(function(c,e){m.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})}),d.prototype.__acquired_method_dict={},w=d,a.addEventListener("DOMContentLoaded",v,!1)}),v.push(function(){returnx}).push(function(c){functione(){returnc}varf;for(b.top!==b.self&&d.__ready_list.splice(1,0,function(){returnc.__aq_parent("getTopURL",[],100).then(function(b){vard=a.createElement("base");d.href=b,d.target="_top",a.head.appendChild(d),m.bind("methodCall",function(a,b){c[b[0]].apply(c,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)})}).fail(function(a){if("timeout_error"!==a)throwa;s=!0,q(c,t)})}),d.ready(function(a){returno(a)}),v.push(e),f=0;f<d.__ready_list.length;f+=1)v.push(d.__ready_list[f]).push(e)}),b.self===b.top?v.fail(function(a){throwi(a),a}):v.then(function(){D=!0,n()}).fail(function(a){throws?i(a):m.notify({method:"failed",params:a.toString()}),a})}varw,x,y,z,A={},B={},C={};j.prototype=newError,j.prototype.constructor=j,z=function(){functiona(){vara,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}varb,d,e,f,g=this,h=[];returnthisinstanceofz?(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)thrownewj;varb=(newc.Queue).push(function(){returna}).push(function(){vara,b,c=h.length,d=[];for(b=0;c>b;b+=1)a=h[b],a.isFulfilled||a.isRejected||d.push(a);h=d},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){returne(a),a});returnh.push(b),this})):newz},z.prototype=Object.create(c.Promise.prototype),z.prototype.constructor=z,k.prototype.__title="",k.prototype.__interface_list=[],k.prototype.__path="",k.prototype.__html="",k.prototype.__required_css_list=[],k.prototype.__required_js_list=[],k.__ready_list=[m,n],k.ready=function(a){returnthis.__ready_list.push(a),this},k.__service_list=[],k.declareService=function(a){returnthis.__service_list.push(a),this},k.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},k.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}),k.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},k.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),k.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},r.__ready_list=k.__ready_list.slice(),r.__service_list=k.__service_list.slice(),r.ready=k.ready,r.declareService=k.declareService,r.prototype=newk,r.prototype.constructor=r,t.__ready_list=k.__ready_list.slice(),t.ready=k.ready,t.__service_list=k.__service_list.slice(),t.declareService=k.declareService,t.prototype=newk,t.prototype.constructor=t,k.declareMethod("declareGadget",function(b,d){vare,f,g=this,h=x;returnvoid0===d&&(d={}),void0===d.sandbox&&(d.sandbox="public"),b=y.getAbsoluteURL(b,this.__path),x=(newc.Queue).push(function(){returnh}).push(void0,function(){}).push(function(){vara;if("public"===d.sandbox)a=s;else{if("iframe"!==d.sandbox)thrownewError("Unsupported sandbox options '"+d.sandbox+"'");a=u}returna(b,d,g)}).push(function(a){returnw=void0,a}).push(void0,function(a){throww=void0,a}),f=x,e=(newc.Queue).push(function(){returnf}).push(function(c){functionf(){returnc}varh;for(h=0;h<c.constructor.__ready_list.length;h+=1)e.push(c.constructor.__ready_list[h]),e.push(f);returnvoid0!==d.scope&&(g.__sub_gadget_dict[d.scope]=c,c.__element.setAttribute("data-gadget-scope",d.scope)),c.__element.setAttribute("data-gadget-url",b),c.__element.setAttribute("data-gadget-sandbox",d.sandbox),c.__element._gadget=c,a.contains(c.__element)&&e.push(o),e.push(f),c})}).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]}),y=function(a){varc;if(a===b&&(c=w),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},y.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},y.AcquisitionError.prototype=newError,y.AcquisitionError.prototype.constructor=y.AcquisitionError,y.getAbsoluteURL=function(a,b){varc,e,f,g="<!doctype><html><head></head></html>",h=newRegExp("^(?:[a-z]+:)?//|data:","i");returna&&b&&!h.test(a)?(c=(newd).parseFromString(g,"text/html"),e=c.createElement("base"),f=c.createElement("link"),c.head.appendChild(e),c.head.appendChild(f),e.href=b,f.href=a,f.href):a},y.declareJS=function(b){vard;returnd=B.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){B[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},y.declareCSS=function(b){vard;returnd=C.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,d){vare;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){C[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},y.declareGadgetKlass=function(a){functionb(){varb,c,e;if(!A.hasOwnProperty(a)){b=function(){k.call(this)},b.__ready_list=k.__ready_list.slice(),b.__service_list=k.__service_list.slice(),b.declareMethod=k.declareMethod,b.declareAcquiredMethod=k.declareAcquiredMethod,b.allowPublicAcquisition=k.allowPublicAcquisition,b.ready=k.ready,b.declareService=k.declareService,b.prototype=newk,b.prototype.constructor=b,b.prototype.__path=a,b.prototype.__acquired_method_dict={},b.__template_element=(newd).parseFromString(h.responseText,"text/html"),e=y.parseGadgetHTMLDocument(b.__template_element,a);for(cine)e.hasOwnProperty(c)&&(b.prototype["__"+c]=e[c]);A[a]=b}returnA[a]}functione(c,d){functione(){vara;try{0===h.readyState?d(h):4===h.readyState&&(h.status<200||h.status>=300||!/^text\/html[;]?/.test(h.getResponseHeader("Content-Type")||"")?d(h):(a=b(),c(a)))}catch(e){d(e)}}h=newXMLHttpRequest,h.open("GET",a),h.onreadystatechange=e,h.setRequestHeader("Accept","text/html"),h.withCredentials=!0,h.send()}functionf(){void0!==h&&h.readyState!==h.DONE&&h.abort()}varg,h;returng=A.hasOwnProperty(a)?c.resolve(A[a]):newc.Promise(e,f)},y.clearGadgetKlassList=function(){A={},B={},C={}},y.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]},f=newRegExp("^(?:[a-z]+:)?//","i");if(!b||!f.test(b))thrownewError("The url should be absolute: "+b);if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");for(e.title=a.title,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(y.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(y.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(y.getAbsoluteURL(d.getAttribute("src"),b)));returne},b.rJS=b.renderJS=y,b.__RenderJSGadget=k,b.__RenderJSEmbeddedGadget=r,b.__RenderJSIframeGadget=t,v()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node);