Commit 01a44e38 authored by Romain Courteaud's avatar Romain Courteaud

Drop minification.

parent 15792ce9
......@@ -24,7 +24,7 @@ module.exports = function (grunt) {
};
grunt.loadNpmTasks("grunt-jslint");
grunt.loadNpmTasks("grunt-contrib-uglify");
// grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-concat');
......@@ -128,11 +128,13 @@ module.exports = function (grunt) {
copy: {
latest: {
files: [{
src: '<%= uglify.renderjs.src %>',
src: '<%= concat.dist.dest %>',
dest: "dist/<%= pkg.name %>-latest.js"
/*
}, {
src: '<%= uglify.renderjs.dest %>',
dest: "dist/<%= pkg.name %>-latest.min.js"
*/
}]
}
},
......@@ -193,6 +195,6 @@ module.exports = function (grunt) {
grunt.registerTask('lint', ['jslint']);
grunt.registerTask('test', ['qunit']);
grunt.registerTask('server', ['connect:client', 'watch']);
grunt.registerTask('build', ['concat', 'uglify', 'copy']);
grunt.registerTask('build', ['concat', 'copy']);
};
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k){"use strict";function l(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function m(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function n(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function o(c){var d,e,f,g,h,i;if(M)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(N.push(c),N.push(new Error("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),e.appendChild(f),d=0;d<N.length;d+=1){if(i=N[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&N.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function p(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function q(){return this instanceof q?void 0:new q}function r(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new G,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return o(a)})}function s(a){a.__sub_gadget_dict={},r(a)}function t(a){var b,d,e,f,g,h=a.__element.querySelectorAll("[data-gadget-url]"),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!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void 0,sandbox:f||void 0}));return c.all(i)}function u(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}function v(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new F.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof F.AcquisitionError)return g.__aq_parent(b,d);throw a})}function w(a,b){a.__aq_parent=function(c,d){return v.apply(b,[a,c,d])}}function x(){return this instanceof x?void q.call(this):new x}function y(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return F.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(D=a,g=new a,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));return w(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(F.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(F.declareCSS,a[1][b]));return d}).push(function(){return g})}function z(){return this instanceof z?void q.call(this):new z}function A(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new z,w(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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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,(new c.Queue).push(function(){return c.timeout(5e3)}).push(void 0,function(){throw new Error("Timeout while loading: "+b)})])}function B(a,b,e){return(new c.Queue).push(function(){return m(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),l(c)}).push(function(a){return A(a,b,e)})}function C(){var d,h,i,j,k,l,m,p,s=n(b.location.href),t=new c.Queue,v=0,y=!1,z=[],A=!1,B=!1;if(H.hasOwnProperty(s))throw new Error("bootstrap should not be called twice");E=new c.Promise(function(n,t){function C(){var b,e,i=F.parseGadgetHTMLDocument(a,s);for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.__element=a.body,b=0;b<h.__element.childNodes.length;b+=1)d.__template_element.appendChild(h.__element.childNodes[b].cloneNode(!0));c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)I[c[b]]=null;for(b=0;b<d.length;b+=1)J[d[b]]=null;D=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&r(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&r(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")&&void 0!==h._gadget&&a.contains(h)&&u(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&u(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(n,function(a){throw t(a),console.error(a),a})}m=new q,m.__acquired_method_dict={reportServiceError:function(a){o(a[0])}},m.__aq_parent=function(a){throw new F.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){q.call(this)},d.declareMethod=q.declareMethod,d.declareAcquiredMethod=q.declareAcquiredMethod,d.allowPublicAcquisition=q.allowPublicAcquisition,d.__ready_list=q.__ready_list.slice(),d.ready=q.ready,d.__service_list=q.__service_list.slice(),d.declareService=q.declareService,d.prototype=new q,d.prototype.constructor=d,d.prototype.__path=s,H[s]=d,h=new H[s],w(h,m)):(d=x,d.__ready_list=q.__ready_list.slice(),d.__service_list=q.__service_list.slice(),d.prototype.__path=s,h=new x,w(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){v+=1,i.call({method:"declareMethod",params:a,success:function(){v-=1,j()},error:function(){v-=1}})},a=0;a<z.length;a+=1)k(z[a]);return z=[],A?void i.notify({method:"failed",params:p}):(B=!0,j(),void i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===v&&y===!0&&i.notify({method:"ready"})},k=function(a){z.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=q.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=q.declareService,d.declareAcquiredMethod=q.declareAcquiredMethod,d.allowPublicAcquisition=q.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},D=d,a.addEventListener("DOMContentLoaded",C,!1)}),t.push(function(){return E}).push(function(a){function b(){return a}var c;for(d.ready(function(a){return u(a)}),t.push(b),c=0;c<d.__ready_list.length;c+=1)t.push(d.__ready_list[c]).push(b)}),b.self===b.top?t.fail(function(a){throw o(a),a}):t.then(function(){y=!0,B&&j()}).fail(function(a){throw l?(A=!0,p=a.toString(),o(a)):i.notify({method:"failed",params:a.toString()}),a})}var D,E,F,G,H={},I={},J={},K=0,L=new RegExp("^(?:[a-z]+:)?//|data:","i"),M=!1,N=[];b.addEventListener("error",function(a){N.push(a)}),b.addEventListener("beforeunload",function(){M=!0}),p.prototype=new Error,p.prototype.constructor=p,G=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof G?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new p;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new G},G.prototype=Object.create(c.Promise.prototype),G.prototype.constructor=G,q.prototype.__title="",q.prototype.__interface_list=[],q.prototype.__path="",q.prototype.__html="",q.prototype.__required_css_list=[],q.prototype.__required_js_list=[],q.__ready_list=[s,t],q.ready=function(a){return this.__ready_list.push(a),this},q.__service_list=[],q.declareService=function(a){return this.__service_list.push(a),this},q.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},q.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.__element)throw new Error("No element defined");return this.__element}),q.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},q.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),q.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},x.__ready_list=q.__ready_list.slice(),x.__service_list=q.__service_list.slice(),x.ready=q.ready,x.declareService=q.declareService,x.prototype=new q,x.prototype.constructor=x,z.__ready_list=q.__ready_list.slice(),z.ready=q.ready,z.__service_list=q.__service_list.slice(),z.declareService=q.declareService,z.prototype=new q,z.prototype.constructor=z,q.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=E;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=F.getAbsoluteURL(b,this.__path),E=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=y;else if("iframe"===d.sandbox)a=A;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=B}return a(b,d,g)}).push(function(a){return D=void 0,a}).push(void 0,function(a){throw D=void 0,a}),f=E,e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}var h,i;for(h=0;h<c.constructor.__ready_list.length;h+=1)e.push(c.constructor.__ready_list[h]),e.push(f);if(i=d.scope,void 0===i)for(i="RJS_"+K,K+=1;g.__sub_gadget_dict.hasOwnProperty(i);)i="RJS_"+K,K+=1;return g.__sub_gadget_dict[i]=c,c.__element.setAttribute("data-gadget-scope",i),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(u),e.push(f),c})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),F=function(a){var c;if(a===b&&(c=D),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},F.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},F.AcquisitionError.prototype=new Error,F.AcquisitionError.prototype.constructor=F.AcquisitionError,F.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>";return a&&b&&!L.test(a)?(c=(new d).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},F.declareJS=function(b){var d;return d=I.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){I[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},F.declareCSS=function(b){var d;return d=J.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){J[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},F.declareGadgetKlass=function(a){function b(b){var c,e,f;if(!H.hasOwnProperty(a)){c=function(){q.call(this)},c.__ready_list=q.__ready_list.slice(),c.__service_list=q.__service_list.slice(),c.declareMethod=q.declareMethod,c.declareAcquiredMethod=q.declareAcquiredMethod,c.allowPublicAcquisition=q.allowPublicAcquisition,c.ready=q.ready,c.declareService=q.declareService,c.prototype=new q,c.prototype.constructor=c,c.prototype.__path=a,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(b.responseText,"text/html"),f=F.parseGadgetHTMLDocument(c.__template_element,a);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);H[a]=c}return H[a]}var e;return e=H.hasOwnProperty(a)?c.resolve(H[a]):(new c.Queue).push(function(){return m(a)}).push(function(a){return b(a)})},F.clearGadgetKlassList=function(){H={},I={},J={}},F.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!L.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(F.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(F.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(F.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=F,b.__RenderJSGadget=q,b.__RenderJSEmbeddedGadget=x,b.__RenderJSIframeGadget=z,C()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k){"use strict";function l(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function m(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function n(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function o(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function p(c){var d,e,f,g,h,i;if(O)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(P.push(c),P.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<P.length;d+=1){if(i=P[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&P.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function q(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function r(){return this instanceof r?void 0:new r}function s(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new I,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return p(a)})}function t(a){a.__sub_gadget_dict={},s(a)}function u(a){var b,d,e,f,g,h=a.element.querySelectorAll("[data-gadget-url]"),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!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void 0,sandbox:f||void 0}));return c.all(i)}function v(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function w(a){a.__monitor.monitor((new c.Queue).push(function(){var b,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)v(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function x(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new H.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof H.AcquisitionError)return g.__aq_parent(b,d);throw a})}function y(a,b){a.__aq_parent=function(c,d){return x.apply(b,[a,c,d])}}function z(){return this instanceof z?void r.call(this):new z}function A(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return H.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(F=a,g=new a,g.element=d.element,g.state={},b=0;b<f.length;b+=1)g.element.appendChild(f[b].cloneNode(!0));return y(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(H.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(H.declareCSS,a[1][b]));return d}).push(function(){return g})}function B(){return this instanceof B?void r.call(this):new B}function C(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new B,y(g,f),h=a.createElement("iframe"),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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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,(new c.Queue).push(function(){return c.timeout(5e3)}).push(void 0,function(){throw new Error("Timeout while loading: "+b)})])}function D(a,b,e){return(new c.Queue).push(function(){return n(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),l(c)}).push(function(a){return C(a,b,e)})}function E(){var d,h,i,j,k,l,m,n,q=o(b.location.href),t=new c.Queue,u=0,v=!1,x=[],A=!1,B=!1;if(J.hasOwnProperty(q))throw new Error("bootstrap should not be called twice");G=new c.Promise(function(o,t){function C(){var b,e,i=H.parseGadgetHTMLDocument(a,q);for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)d.__template_element.appendChild(h.element.childNodes[b].cloneNode(!0));c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)K[c[b]]=null;for(b=0;b<d.length;b+=1)L[d[b]]=null;F=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&s(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&s(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")&&void 0!==h._gadget&&a.contains(h)&&w(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&w(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(o,function(a){throw t(a),console.error(a),a})}m=new r,m.__acquired_method_dict={reportServiceError:function(a){p(a[0])}},m.__aq_parent=function(a){throw new H.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){r.call(this)},d.declareMethod=r.declareMethod,d.declareJob=r.declareJob,d.declareAcquiredMethod=r.declareAcquiredMethod,d.allowPublicAcquisition=r.allowPublicAcquisition,d.__ready_list=r.__ready_list.slice(),d.ready=r.ready,d.setState=r.setState,d.onStateChange=r.onStateChange,d.__service_list=r.__service_list.slice(),d.declareService=r.declareService,d.onEvent=r.onEvent,d.prototype=new r,d.prototype.constructor=d,d.prototype.__path=q,J[q]=d,h=new J[q],y(h,m)):(d=z,d.__ready_list=r.__ready_list.slice(),d.__service_list=r.__service_list.slice(),d.prototype.__path=q,h=new z,y(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){u+=1,i.call({method:"declareMethod",params:a,success:function(){u-=1,j()},error:function(){u-=1}})},a=0;a<x.length;a+=1)k(x[a]);return x=[],A?void i.notify({method:"failed",params:n}):(B=!0,j(),void i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===u&&v===!0&&i.notify({method:"ready"})},k=function(a){x.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=r.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=r.declareService,d.declareJob=r.declareJob,d.onEvent=r.onEvent,d.declareAcquiredMethod=r.declareAcquiredMethod,d.allowPublicAcquisition=r.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},F=d,a.addEventListener("DOMContentLoaded",C,!1)}),t.push(function(){return G}).push(function(a){function b(){return a}function c(a){return function(b){return a.call(b,b)}}var e;for(d.ready(function(a){return w(a)}),t.push(b),e=0;e<d.__ready_list.length;e+=1)t.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?t.fail(function(a){throw p(a),a}):t.then(function(){v=!0,B&&j()}).fail(function(a){throw l?(A=!0,n=a.toString(),p(a)):i.notify({method:"failed",params:a.toString()}),a})}var F,G,H,I,J={},K={},L={},M=0,N=new RegExp("^(?:[a-z]+:)?//|data:","i"),O=!1,P=[];b.addEventListener("error",function(a){P.push(a)}),b.addEventListener("beforeunload",function(){O=!0}),q.prototype=new Error,q.prototype.constructor=q,I=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof I?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new q;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new I},I.prototype=Object.create(c.Promise.prototype),I.prototype.constructor=I,r.prototype.__title="",r.prototype.__interface_list=[],r.prototype.__path="",r.prototype.__html="",r.prototype.__required_css_list=[],r.prototype.__required_js_list=[],r.__ready_list=[t,u],r.ready=function(a){return this.__ready_list.push(a),this},r.setState=function(a){var b=JSON.stringify(a);return this.ready(function(){this.state=JSON.parse(b)})},r.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},r.__service_list=[],r.declareService=function(a){return this.__service_list.push(a),this},r.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return m(this.element,a,c,b.bind(this),d)}),this},r.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?v(c,a,b,d):c.__job_list.push([a,b,d])},this},r.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},r.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,c=!1,d={};for(b in a)a[b]!==this.state[b]&&(this.state[b]=a[b],d[b]=a[b],c=!0);return c&&void 0!==this.__state_change_callback?this.__state_change_callback(d):void 0}),r.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},r.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),r.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},z.__ready_list=r.__ready_list.slice(),z.__service_list=r.__service_list.slice(),z.ready=r.ready,z.setState=r.setState,z.onStateChange=r.onStateChange,z.declareService=r.declareService,z.onEvent=r.onEvent,z.prototype=new r,z.prototype.constructor=z,B.__ready_list=r.__ready_list.slice(),B.ready=r.ready,B.setState=r.setState,B.onStateChange=r.onStateChange,B.__service_list=r.__service_list.slice(),B.declareService=r.declareService,B.onEvent=r.onEvent,B.prototype=new r,B.prototype.constructor=B,r.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=G;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=H.getAbsoluteURL(b,this.__path),G=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=A;else if("iframe"===d.sandbox)a=C;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=D}return a(b,d,g)}).push(function(a){return F=void 0,a}).push(void 0,function(a){throw F=void 0,a}),f=G,e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}function h(a){return function(b){return a.call(b,b)}}var i,j;for(i=0;i<c.constructor.__ready_list.length;i+=1)e.push(h(c.constructor.__ready_list[i])),e.push(f);if(j=d.scope,void 0===j)for(j="RJS_"+M,M+=1;g.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+M,M+=1;return g.__sub_gadget_dict[j]=c,c.element.setAttribute("data-gadget-scope",j),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(w),e.push(f),c})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),H=function(a){var c;if(a===b&&(c=F),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},H.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},H.AcquisitionError.prototype=new Error,H.AcquisitionError.prototype.constructor=H.AcquisitionError,H.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>";return a&&b&&!N.test(a)?(c=(new d).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},H.declareJS=function(b){var d;return d=K.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){K[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},H.declareCSS=function(b){var d;return d=L.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){L[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},H.declareGadgetKlass=function(a){function b(b){var c,e,f;if(!J.hasOwnProperty(a)){c=function(){r.call(this)},c.__ready_list=r.__ready_list.slice(),c.__service_list=r.__service_list.slice(),c.declareMethod=r.declareMethod,c.declareJob=r.declareJob,c.declareAcquiredMethod=r.declareAcquiredMethod,c.allowPublicAcquisition=r.allowPublicAcquisition,c.ready=r.ready,c.setState=r.setState,c.onStateChange=r.onStateChange,c.declareService=r.declareService,c.onEvent=r.onEvent,c.prototype=new r,c.prototype.constructor=c,c.prototype.__path=a,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(b.responseText,"text/html"),f=H.parseGadgetHTMLDocument(c.__template_element,a);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);J[a]=c}return J[a]}var e;return e=J.hasOwnProperty(a)?c.resolve(J[a]):(new c.Queue).push(function(){return n(a)}).push(function(a){return b(a)})},H.clearGadgetKlassList=function(){J={},K={},L={}},H.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!N.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(H.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(H.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(H.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=H,b.__RenderJSGadget=r,b.__RenderJSEmbeddedGadget=z,b.__RenderJSIframeGadget=B,E()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k){"use strict";function l(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function m(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function n(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function o(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function p(c){var d,e,f,g,h,i;if(O)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(P.push(c),P.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<P.length;d+=1){if(i=P[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&P.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function q(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function r(){return this instanceof r?void 0:new r}function s(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new I,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return p(a)})}function t(a){a.__sub_gadget_dict={},s(a)}function u(a){var b,d,e,f,g,h=a.element.querySelectorAll("[data-gadget-url]"),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!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void 0,sandbox:f||void 0}));return c.all(i)}function v(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function w(a){a.__monitor.monitor((new c.Queue).push(function(){var b,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)v(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function x(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new H.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof H.AcquisitionError)return g.__aq_parent(b,d);throw a})}function y(a,b){a.__aq_parent=function(c,d){return x.apply(b,[a,c,d])}}function z(){return this instanceof z?void r.call(this):new z}function A(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return H.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(F=a,g=new a,g.element=d.element,g.state={},b=0;b<f.length;b+=1)g.element.appendChild(f[b].cloneNode(!0));return y(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(H.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(H.declareCSS,a[1][b]));return d}).push(function(){return g})}function B(){return this instanceof B?void r.call(this):new B}function C(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new B,y(g,f),h=a.createElement("iframe"),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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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,(new c.Queue).push(function(){return c.timeout(5e3)}).push(void 0,function(){throw new Error("Timeout while loading: "+b)})])}function D(a,b,e){return(new c.Queue).push(function(){return n(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),l(c)}).push(function(a){return C(a,b,e)})}function E(){var d,h,i,j,k,l,m,n,q=o(b.location.href),t=new c.Queue,u=0,v=!1,x=[],A=!1,B=!1;if(J.hasOwnProperty(q))throw new Error("bootstrap should not be called twice");G=new c.Promise(function(o,t){function C(){var b,e,i=H.parseGadgetHTMLDocument(a,q);for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)d.__template_element.appendChild(h.element.childNodes[b].cloneNode(!0));c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)K[c[b]]=null;for(b=0;b<d.length;b+=1)L[d[b]]=null;F=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&s(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&s(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")&&void 0!==h._gadget&&a.contains(h)&&w(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&w(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(o,function(a){throw t(a),console.error(a),a})}m=new r,m.__acquired_method_dict={reportServiceError:function(a){p(a[0])}},m.__aq_parent=function(a){throw new H.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){r.call(this)},d.declareMethod=r.declareMethod,d.declareJob=r.declareJob,d.declareAcquiredMethod=r.declareAcquiredMethod,d.allowPublicAcquisition=r.allowPublicAcquisition,d.__ready_list=r.__ready_list.slice(),d.ready=r.ready,d.setState=r.setState,d.onStateChange=r.onStateChange,d.__service_list=r.__service_list.slice(),d.declareService=r.declareService,d.onEvent=r.onEvent,d.prototype=new r,d.prototype.constructor=d,d.prototype.__path=q,J[q]=d,h=new J[q],y(h,m)):(d=z,d.__ready_list=r.__ready_list.slice(),d.__service_list=r.__service_list.slice(),d.prototype.__path=q,h=new z,y(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){u+=1,i.call({method:"declareMethod",params:a,success:function(){u-=1,j()},error:function(){u-=1}})},a=0;a<x.length;a+=1)k(x[a]);return x=[],A?void i.notify({method:"failed",params:n}):(B=!0,j(),void i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===u&&v===!0&&i.notify({method:"ready"})},k=function(a){x.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=r.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=r.declareService,d.declareJob=r.declareJob,d.onEvent=r.onEvent,d.declareAcquiredMethod=r.declareAcquiredMethod,d.allowPublicAcquisition=r.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},F=d,a.addEventListener("DOMContentLoaded",C,!1)}),t.push(function(){return G}).push(function(a){function b(){return a}function c(a){return function(b){return a.call(b,b)}}var e;for(d.ready(function(a){return w(a)}),t.push(b),e=0;e<d.__ready_list.length;e+=1)t.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?t.fail(function(a){throw p(a),a}):t.then(function(){v=!0,B&&j()}).fail(function(a){throw l?(A=!0,n=a.toString(),p(a)):i.notify({method:"failed",params:a.toString()}),a})}var F,G,H,I,J={},K={},L={},M=0,N=new RegExp("^(?:[a-z]+:)?//|data:","i"),O=!1,P=[];b.addEventListener("error",function(a){P.push(a)}),b.addEventListener("beforeunload",function(){O=!0}),q.prototype=new Error,q.prototype.constructor=q,I=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof I?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new q;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new I},I.prototype=Object.create(c.Promise.prototype),I.prototype.constructor=I,r.prototype.__title="",r.prototype.__interface_list=[],r.prototype.__path="",r.prototype.__html="",r.prototype.__required_css_list=[],r.prototype.__required_js_list=[],r.__ready_list=[t,u],r.ready=function(a){return this.__ready_list.push(a),this},r.setState=function(a){var b=JSON.stringify(a);return this.prototype.__json_state=b,this.ready(function(){this.state=JSON.parse(b)})},r.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},r.__service_list=[],r.declareService=function(a){return this.__service_list.push(a),this},r.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return m(this.element,a,c,b.bind(this),d)}),this},r.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?v(c,a,b,d):c.__job_list.push([a,b,d])},this},r.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},r.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d=!1,e={},f=this;for(b in a)a[b]!==this.state[b]&&(this.state[b]=a[b],e[b]=a[b],d=!0);return d&&void 0!==this.__state_change_callback?(new c.Queue).push(function(){return f.__state_change_callback(e)}).push(void 0,function(a){throw void 0!==f.__json_state?f.state=JSON.parse(f.__json_state):f.state={},a}):void 0}),r.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},r.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),r.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},z.__ready_list=r.__ready_list.slice(),z.__service_list=r.__service_list.slice(),z.ready=r.ready,z.setState=r.setState,z.onStateChange=r.onStateChange,z.declareService=r.declareService,z.onEvent=r.onEvent,z.prototype=new r,z.prototype.constructor=z,B.__ready_list=r.__ready_list.slice(),B.ready=r.ready,B.setState=r.setState,B.onStateChange=r.onStateChange,B.__service_list=r.__service_list.slice(),B.declareService=r.declareService,B.onEvent=r.onEvent,B.prototype=new r,B.prototype.constructor=B,r.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=G;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=H.getAbsoluteURL(b,this.__path),G=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=A;else if("iframe"===d.sandbox)a=C;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=D}return a(b,d,g)}).push(function(a){return F=void 0,a}).push(void 0,function(a){throw F=void 0,a}),f=G.then(function(a){return a}),e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}function h(a){return function(b){return a.call(b,b)}}var i,j;for(i=0;i<c.constructor.__ready_list.length;i+=1)e.push(h(c.constructor.__ready_list[i])),e.push(f);if(j=d.scope,void 0===j)for(j="RJS_"+M,M+=1;g.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+M,M+=1;return g.__sub_gadget_dict[j]=c,c.element.setAttribute("data-gadget-scope",j),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(w),e.push(f),c})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),H=function(a){var c;if(a===b&&(c=F),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},H.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},H.AcquisitionError.prototype=new Error,H.AcquisitionError.prototype.constructor=H.AcquisitionError,H.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>";return a&&b&&!N.test(a)?(c=(new d).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},H.declareJS=function(b){var d;return d=K.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){K[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},H.declareCSS=function(b){var d;return d=L.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){L[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},H.declareGadgetKlass=function(a){function b(b){var c,e,f;if(!J.hasOwnProperty(a)){c=function(){r.call(this)},c.__ready_list=r.__ready_list.slice(),c.__service_list=r.__service_list.slice(),c.declareMethod=r.declareMethod,c.declareJob=r.declareJob,c.declareAcquiredMethod=r.declareAcquiredMethod,c.allowPublicAcquisition=r.allowPublicAcquisition,c.ready=r.ready,c.setState=r.setState,c.onStateChange=r.onStateChange,c.declareService=r.declareService,c.onEvent=r.onEvent,c.prototype=new r,c.prototype.constructor=c,c.prototype.__path=a,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(b.responseText,"text/html"),f=H.parseGadgetHTMLDocument(c.__template_element,a);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);J[a]=c}return J[a]}var e;return e=J.hasOwnProperty(a)?c.resolve(J[a]):(new c.Queue).push(function(){return n(a)}).push(function(a){return b(a)})},H.clearGadgetKlassList=function(){J={},K={},L={}},H.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!N.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(H.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(H.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(H.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=H,b.__RenderJSGadget=r,b.__RenderJSEmbeddedGadget=z,b.__RenderJSIframeGadget=B,E()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k){"use strict";function l(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function m(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function n(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function o(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function p(c){var d,e,f,g,h,i;if(O)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(P.push(c),P.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<P.length;d+=1){if(i=P[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&P.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function q(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function r(){return this instanceof r?void 0:new r}function s(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new I,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return p(a)})}function t(a){a.__sub_gadget_dict={},s(a)}function u(a){var b,d,e,f,g,h=a.element.querySelectorAll("[data-gadget-url]"),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!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void 0,sandbox:f||void 0}));return c.all(i)}function v(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function w(a){a.__monitor.monitor((new c.Queue).push(function(){var b,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)v(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function x(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new H.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof H.AcquisitionError)return g.__aq_parent(b,d);throw a})}function y(a,b){a.__aq_parent=function(c,d){return x.apply(b,[a,c,d])}}function z(){return this instanceof z?void r.call(this):new z}function A(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return H.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(F=a,g=new a,g.element=d.element,g.state={},b=0;b<f.length;b+=1)g.element.appendChild(f[b].cloneNode(!0));return y(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(H.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(H.declareCSS,a[1][b]));return d}).push(function(){return g})}function B(){return this instanceof B?void r.call(this):new B}function C(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new B,y(g,f),h=a.createElement("iframe"),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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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,(new c.Queue).push(function(){return c.timeout(5e3)}).push(void 0,function(){throw new Error("Timeout while loading: "+b)})])}function D(a,b,e){return(new c.Queue).push(function(){return n(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),l(c)}).push(function(a){return C(a,b,e)})}function E(){var d,h,i,j,k,l,m,n,q=o(b.location.href),t=new c.Queue,u=0,v=!1,x=[],A=!1,B=!1;if(J.hasOwnProperty(q))throw new Error("bootstrap should not be called twice");G=new c.Promise(function(o,t){function C(){var b,e,i=H.parseGadgetHTMLDocument(a,q);for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)d.__template_element.appendChild(h.element.childNodes[b].cloneNode(!0));c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)K[c[b]]=null;for(b=0;b<d.length;b+=1)L[d[b]]=null;F=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&s(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&s(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")&&void 0!==h._gadget&&a.contains(h)&&w(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&w(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(o,function(a){throw t(a),console.error(a),a})}m=new r,m.__acquired_method_dict={reportServiceError:function(a){p(a[0])}},m.__aq_parent=function(a){throw new H.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){r.call(this)},d.declareMethod=r.declareMethod,d.declareJob=r.declareJob,d.declareAcquiredMethod=r.declareAcquiredMethod,d.allowPublicAcquisition=r.allowPublicAcquisition,d.__ready_list=r.__ready_list.slice(),d.ready=r.ready,d.setState=r.setState,d.onStateChange=r.onStateChange,d.__service_list=r.__service_list.slice(),d.declareService=r.declareService,d.onEvent=r.onEvent,d.prototype=new r,d.prototype.constructor=d,d.prototype.__path=q,J[q]=d,h=new J[q],y(h,m)):(d=z,d.__ready_list=r.__ready_list.slice(),d.__service_list=r.__service_list.slice(),d.prototype.__path=q,h=new z,y(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){u+=1,i.call({method:"declareMethod",params:a,success:function(){u-=1,j()},error:function(){u-=1}})},a=0;a<x.length;a+=1)k(x[a]);return x=[],A?void i.notify({method:"failed",params:n}):(B=!0,j(),void i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===u&&v===!0&&i.notify({method:"ready"})},k=function(a){x.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=r.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=r.declareService,d.declareJob=r.declareJob,d.onEvent=r.onEvent,d.declareAcquiredMethod=r.declareAcquiredMethod,d.allowPublicAcquisition=r.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},F=d,a.addEventListener("DOMContentLoaded",C,!1)}),t.push(function(){return G}).push(function(a){function b(){return a}function c(a){return function(b){return a.call(b,b)}}var e;for(d.ready(function(a){return w(a)}),t.push(b),e=0;e<d.__ready_list.length;e+=1)t.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?t.fail(function(a){throw p(a),a}):t.then(function(){v=!0,B&&j()}).fail(function(a){throw l?(A=!0,n=a.toString(),p(a)):i.notify({method:"failed",params:a.toString()}),a})}var F,G,H,I,J={},K={},L={},M=0,N=new RegExp("^(?:[a-z]+:)?//|data:","i"),O=!1,P=[];b.addEventListener("error",function(a){P.push(a)}),b.addEventListener("beforeunload",function(){O=!0}),q.prototype=new Error,q.prototype.constructor=q,I=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof I?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new q;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new I},I.prototype=Object.create(c.Promise.prototype),I.prototype.constructor=I,r.prototype.__title="",r.prototype.__interface_list=[],r.prototype.__path="",r.prototype.__html="",r.prototype.__required_css_list=[],r.prototype.__required_js_list=[],r.__ready_list=[t,u],r.ready=function(a){return this.__ready_list.push(a),this},r.setState=function(a){var b=JSON.stringify(a);return this.ready(function(){this.state=JSON.parse(b)})},r.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},r.__service_list=[],r.declareService=function(a){return this.__service_list.push(a),this},r.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return m(this.element,a,c,b.bind(this),d)}),this},r.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?v(c,a,b,d):c.__job_list.push([a,b,d])},this},r.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},r.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d,e=!1,f=this.hasOwnProperty("__modification_dict"),g=this;f?(d=this.__modification_dict,e=!0):(d={},this.__modification_dict=d);for(b in a)a.hasOwnProperty(b)&&a[b]!==this.state[b]&&(this.state[b]=a[b],d[b]=a[b],e=!0);return e&&void 0!==this.__state_change_callback?(new c.Queue).push(function(){return g.__state_change_callback(d)}).push(function(a){return delete g.__modification_dict,a}):void 0}),r.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},r.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),r.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},z.__ready_list=r.__ready_list.slice(),z.__service_list=r.__service_list.slice(),z.ready=r.ready,z.setState=r.setState,z.onStateChange=r.onStateChange,z.declareService=r.declareService,z.onEvent=r.onEvent,z.prototype=new r,z.prototype.constructor=z,B.__ready_list=r.__ready_list.slice(),B.ready=r.ready,B.setState=r.setState,B.onStateChange=r.onStateChange,B.__service_list=r.__service_list.slice(),B.declareService=r.declareService,B.onEvent=r.onEvent,B.prototype=new r,B.prototype.constructor=B,r.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=G;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=H.getAbsoluteURL(b,this.__path),G=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=A;else if("iframe"===d.sandbox)a=C;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=D}return a(b,d,g)}).push(function(a){return F=void 0,a}).push(void 0,function(a){throw F=void 0,a}),f=G.then(function(a){return a}),e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}function h(a){return function(b){return a.call(b,b)}}var i,j;for(i=0;i<c.constructor.__ready_list.length;i+=1)e.push(h(c.constructor.__ready_list[i])),e.push(f);if(j=d.scope,void 0===j)for(j="RJS_"+M,M+=1;g.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+M,M+=1;return g.__sub_gadget_dict[j]=c,c.element.setAttribute("data-gadget-scope",j),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(w),e.push(f),c})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),H=function(a){var c;if(a===b&&(c=F),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},H.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},H.AcquisitionError.prototype=new Error,H.AcquisitionError.prototype.constructor=H.AcquisitionError,H.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>";return a&&b&&!N.test(a)?(c=(new d).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},H.declareJS=function(b){var d;return d=K.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){K[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},H.declareCSS=function(b){var d;return d=L.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){L[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},H.declareGadgetKlass=function(a){function b(b){var c,e,f;if(!J.hasOwnProperty(a)){c=function(){r.call(this)},c.__ready_list=r.__ready_list.slice(),c.__service_list=r.__service_list.slice(),c.declareMethod=r.declareMethod,c.declareJob=r.declareJob,c.declareAcquiredMethod=r.declareAcquiredMethod,c.allowPublicAcquisition=r.allowPublicAcquisition,c.ready=r.ready,c.setState=r.setState,c.onStateChange=r.onStateChange,c.declareService=r.declareService,c.onEvent=r.onEvent,c.prototype=new r,c.prototype.constructor=c,c.prototype.__path=a,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(b.responseText,"text/html"),f=H.parseGadgetHTMLDocument(c.__template_element,a);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);J[a]=c}return J[a]}var e;return e=J.hasOwnProperty(a)?c.resolve(J[a]):(new c.Queue).push(function(){return n(a)}).push(function(a){return b(a)})},H.clearGadgetKlassList=function(){J={},K={},L={}},H.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!N.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(H.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(H.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(H.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=H,b.__RenderJSGadget=r,b.__RenderJSEmbeddedGadget=z,b.__RenderJSIframeGadget=B,E()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";function m(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function n(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function o(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function p(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function q(c){var d,e,f,g,h,i;if(Q)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(R.push(c),R.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<R.length;d+=1){if(i=R[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&R.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function r(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function s(){return this instanceof s?void 0:new s}function t(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new J,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return q(a)})}function u(a){a.__sub_gadget_dict={},t(a)}function v(a){var b,d,e,f,g,h=a.element.querySelectorAll("[data-gadget-url]"),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!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void 0,sandbox:f||void 0}));return c.all(i)}function w(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function x(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list,d=a.__job_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a));for(b=0;b<d.length;b+=1)w(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function y(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new I.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof I.AcquisitionError)return g.__aq_parent(b,d);throw a})}function z(a,b){a.__aq_parent=function(c,d){return y.apply(b,[a,c,d])}}function A(){return this instanceof A?void s.call(this):new A}function B(b,d,e){return(new c.Queue).push(function(){return I.declareGadgetKlass(b).then(function(a){return a})}).push(function(b){void 0===d.element&&(d.element=a.createElement("div"));var c,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));return f.element.appendChild(h),z(f,e),f})}function C(){return this instanceof C?void s.call(this):new C}function D(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new C,z(g,f),h=a.createElement("iframe"),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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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,(new c.Queue).push(function(){return c.timeout(5e3)}).push(void 0,function(){throw new Error("Timeout while loading: "+b)})])}function E(a,b,e){return(new c.Queue).push(function(){return o(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){return D(a,b,e)})}function F(a,b){var c,e,f;c=function(){s.call(this)},c.__ready_list=s.__ready_list.slice(),c.__service_list=s.__service_list.slice(),c.declareMethod=s.declareMethod,c.declareJob=s.declareJob,c.declareAcquiredMethod=s.declareAcquiredMethod,c.allowPublicAcquisition=s.allowPublicAcquisition,c.ready=s.ready,c.setState=s.setState,c.onStateChange=s.onStateChange,c.declareService=s.declareService,c.onEvent=s.onEvent,c.prototype=new s,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=I.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c}function G(){var d,h,i,j,k,l,m,n,o=p(b.location.href),r=new c.Queue,u=0,v=!1,w=[],y=!1,B=!1;if(K.hasOwnProperty(o))throw new Error("bootstrap should not be called twice");H=new c.Promise(function(p,r){function C(){var b,e,i=I.parseGadgetHTMLDocument(a,o),j=a.createDocumentFragment();for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)j.appendChild(h.element.childNodes[b].cloneNode(!0));d.__template_element.appendChild(j),c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)L[c[b]]=null;for(b=0;b<d.length;b+=1)M[d[b]]=null;N.shift()}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&t(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&t(h._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(h=b.addedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void 0!==h._gadget&&a.contains(h)&&x(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&x(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(p,function(a){throw r(a),console.error(a),a})}m=new s,m.__acquired_method_dict={reportServiceError:function(a){q(a[0])}},m.__aq_parent=function(a){throw new I.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){s.call(this)},d.declareMethod=s.declareMethod,d.declareJob=s.declareJob,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,d.__ready_list=s.__ready_list.slice(),d.ready=s.ready,d.setState=s.setState,d.onStateChange=s.onStateChange,d.__service_list=s.__service_list.slice(),d.declareService=s.declareService,d.onEvent=s.onEvent,d.prototype=new s,d.prototype.constructor=d,d.prototype.__path=o,K[o]={promise:c.resolve(d)},h=new d,z(h,m)):(d=A,d.__ready_list=s.__ready_list.slice(),d.__service_list=s.__service_list.slice(),d.prototype.__path=o,h=new A,z(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){u+=1,i.call({method:"declareMethod",params:a,success:function(){u-=1,j()},error:function(){u-=1}})},a=0;a<w.length;a+=1)k(w[a]);return w=[],y?void i.notify({method:"failed",params:n}):(B=!0,j(),void i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===u&&v===!0&&i.notify({method:"ready"})},k=function(a){w.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=s.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=s.declareService,d.declareJob=s.declareJob,d.onEvent=s.onEvent,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},N.push(d),a.addEventListener("DOMContentLoaded",C,!1)}),r.push(function(){return H}).push(function(a){function b(){return a}function c(a){return function(b){return a.call(b,b)}}var e;for(d.ready(function(a){return x(a)}),r.push(b),e=0;e<d.__ready_list.length;e+=1)r.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?r.fail(function(a){throw q(a),a}):r.then(function(){v=!0,B&&j()}).fail(function(a){throw l?(y=!0,n=a.toString(),q(a)):i.notify({method:"failed",params:a.toString()}),a})}var H,I,J,K={},L={},M={},N=[],O=0,P=new RegExp("^(?:[a-z]+:)?//|data:","i"),Q=!1,R=[];b.addEventListener("error",function(a){R.push(a)}),b.addEventListener("beforeunload",function(){Q=!0}),r.prototype=new Error,r.prototype.constructor=r,J=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof J?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new r;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new J},J.prototype=Object.create(c.Promise.prototype),J.prototype.constructor=J,s.prototype.__title="",s.prototype.__interface_list=[],s.prototype.__path="",s.prototype.__html="",s.prototype.__required_css_list=[],s.prototype.__required_js_list=[],s.__ready_list=[u,v],s.ready=function(a){return this.__ready_list.push(a),this},s.setState=function(a){var b=JSON.stringify(a);return this.ready(function(){this.state=JSON.parse(b)})},s.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},s.__service_list=[],s.declareService=function(a){return this.__service_list.push(a),this},s.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return n(this.element,a,c,b.bind(this),d)}),this},s.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?w(c,a,b,d):c.__job_list.push([a,b,d])},this},s.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},s.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d,e=!1,f=this.hasOwnProperty("__modification_dict"),g=this;f?(d=this.__modification_dict,e=!0):(d={},this.__modification_dict=d);for(b in a)a.hasOwnProperty(b)&&a[b]!==this.state[b]&&(this.state[b]=a[b],d[b]=a[b],e=!0);return e&&void 0!==this.__state_change_callback?(new c.Queue).push(function(){return g.__state_change_callback(d)}).push(function(a){return delete g.__modification_dict,a}):void 0}),s.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},s.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),s.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},A.__ready_list=s.__ready_list.slice(),A.__service_list=s.__service_list.slice(),A.ready=s.ready,A.setState=s.setState,A.onStateChange=s.onStateChange,A.declareService=s.declareService,A.onEvent=s.onEvent,A.prototype=new s,A.prototype.constructor=A,C.__ready_list=s.__ready_list.slice(),C.ready=s.ready,C.setState=s.setState,C.onStateChange=s.onStateChange,C.__service_list=s.__service_list.slice(),C.declareService=s.declareService,C.onEvent=s.onEvent,C.prototype=new s,C.prototype.constructor=C,s.declareMethod("declareGadget",function(b,d){var e=this;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=I.getAbsoluteURL(b,this.__path),(new c.Queue).push(function(){var a;if("public"===d.sandbox)a=B;else if("iframe"===d.sandbox)a=D;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=E}return a(b,d,e)}).push(function(f){function g(){return f}function h(a){return function(){return a.call(f,f)}}var i,j,k=new c.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void 0===j)for(j="RJS_"+O,O+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+O,O+=1;return e.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(x),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),I=function(a){var c;if(a===b&&(c=N[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},I.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},I.AcquisitionError.prototype=new Error,I.AcquisitionError.prototype.constructor=I.AcquisitionError,I.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},I.declareJS=function(b,d,e){var f;return L.hasOwnProperty(b)?f=c.resolve():(L[b]=null,f=new c.Promise(function(c,f){var g;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&N.shift(),c()},g.onerror=function(a){e===!0&&N.shift(),f(a)},g.src=b,d.appendChild(g)})),f},I.declareCSS=function(b,d){var e;return e=M.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){M[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},I.declareGadgetKlass=function(b){if(K.hasOwnProperty(b))return K[b].promise;var d,e=c.defer();return K[b]=e,H=e.promise,(new c.Queue).push(function(){return o(b)}).push(function(e){d=F(e,b);var f,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(N.push(d),f=0;f<i.length-1;f+=1)h.push(I.declareJS(i[f],g));h.push(I.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(I.declareCSS(j[f],g));return a.head.appendChild(g),c.all(h)}).push(function(){return e.resolve(d),d}).push(void 0,function(a){throw e.reject(a),a})},I.clearGadgetKlassList=function(){K={},L={},M={}},I.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!P.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");if(e.title=a.title,null!==a.head)for(c=0;c<a.head.children.length;c+=1)d=a.head.children[c],null!==d.href&&("stylesheet"===d.rel?e.required_css_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):"SCRIPT"!==d.nodeName||"text/javascript"!==d.type&&d.type?"http://www.renderjs.org/rel/interface"===d.rel&&e.interface_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(I.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=I,b.__RenderJSGadget=s,b.__RenderJSEmbeddedGadget=A,b.__RenderJSIframeGadget=C,G()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";function m(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function n(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function o(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function p(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function q(c){var d,e,f,g,h,i;if(Q)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(R.push(c),R.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<R.length;d+=1){if(i=R[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&R.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function r(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function s(){return this instanceof s?void 0:new s}function t(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new J,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return q(a)})}function u(){this.__sub_gadget_dict={},t(this)}function v(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function w(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function x(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list,d=a.__job_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a));for(b=0;b<d.length;b+=1)w(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function y(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new I.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof I.AcquisitionError)return g.__aq_parent(b,d);throw a})}function z(a,b){a.__aq_parent=function(c,d){return y.apply(b,[a,c,d])}}function A(){return this instanceof A?void s.call(this):new A}function B(b,d,e){return(new c.Queue).push(function(){return I.declareGadgetKlass(b).then(function(a){return a})}).push(function(b){void 0===d.element&&(d.element=a.createElement("div"));var c,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));return f.element.appendChild(h),z(f,e),f})}function C(){return this instanceof C?void s.call(this):new C}function D(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new C,z(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function E(a,b,e){return(new c.Queue).push(function(){return o(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){return D(a,b,e)})}function F(a,b){var c,e,f;c=function(){s.call(this)},c.__ready_list=s.__ready_list.slice(),c.__service_list=s.__service_list.slice(),c.declareMethod=s.declareMethod,c.declareJob=s.declareJob,c.declareAcquiredMethod=s.declareAcquiredMethod,c.allowPublicAcquisition=s.allowPublicAcquisition,c.ready=s.ready,c.setState=s.setState,c.onStateChange=s.onStateChange,c.declareService=s.declareService,c.onEvent=s.onEvent,c.prototype=new s,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=I.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c}function G(){var d,h,i,j,k,l,m,n,o=p(b.location.href),r=new c.Queue,u=0,v=!1,w=[],y=!1,B=!1;if(K.hasOwnProperty(o))throw new Error("bootstrap should not be called twice");H=new c.Promise(function(p,r){function C(){var b,e,i=I.parseGadgetHTMLDocument(a,o),j=a.createDocumentFragment();for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)j.appendChild(h.element.childNodes[b].cloneNode(!0));d.__template_element.appendChild(j),c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)L[c[b]]=null;for(b=0;b<d.length;b+=1)M[d[b]]=null;N.shift()}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&t(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&t(h._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(h=b.addedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void 0!==h._gadget&&a.contains(h)&&x(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&x(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(p,function(a){throw r(a),console.error(a),a})}m=new s,m.__acquired_method_dict={reportServiceError:function(a){q(a[0])}},m.__aq_parent=function(a){throw new I.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){s.call(this)},d.declareMethod=s.declareMethod,d.declareJob=s.declareJob,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,d.__ready_list=s.__ready_list.slice(),d.ready=s.ready,d.setState=s.setState,d.onStateChange=s.onStateChange,d.__service_list=s.__service_list.slice(),d.declareService=s.declareService,d.onEvent=s.onEvent,d.prototype=new s,d.prototype.constructor=d,d.prototype.__path=o,K[o]={promise:c.resolve(d)},h=new d,z(h,m)):(d=A,d.__ready_list=s.__ready_list.slice(),d.__service_list=s.__service_list.slice(),d.prototype.__path=o,h=new A,z(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){u+=1,i.call({method:"declareMethod",params:a,success:function(){u-=1,j()},error:function(){u-=1}})},a=0;a<w.length;a+=1)k(w[a]);return w=[],y?void i.notify({method:"failed",params:n}):(B=!0,j(),void i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===u&&v===!0&&i.notify({method:"ready"})},k=function(a){w.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=s.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=s.declareService,d.declareJob=s.declareJob,d.onEvent=s.onEvent,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},N.push(d),a.addEventListener("DOMContentLoaded",C,!1)}),r.push(function(){return H}).push(function(a){function b(){return a}function c(a){return function(b){return a.call(b,b)}}var e;for(d.ready(function(){return x(this)}),r.push(b),e=0;e<d.__ready_list.length;e+=1)r.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?r.fail(function(a){throw q(a),a}):r.then(function(){v=!0,B&&j()}).fail(function(a){throw l?(y=!0,n=a.toString(),q(a)):i.notify({method:"failed",params:a.toString()}),a})}var H,I,J,K={},L={},M={},N=[],O=0,P=new RegExp("^(?:[a-z]+:)?//|data:","i"),Q=!1,R=[];b.addEventListener("error",function(a){R.push(a)}),b.addEventListener("beforeunload",function(){Q=!0}),r.prototype=new Error,r.prototype.constructor=r,J=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof J?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new r;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new J},J.prototype=Object.create(c.Promise.prototype),J.prototype.constructor=J,s.prototype.__title="",s.prototype.__interface_list=[],s.prototype.__path="",s.prototype.__html="",s.prototype.__required_css_list=[],s.prototype.__required_js_list=[],s.__ready_list=[u,v],s.ready=function(a){return this.__ready_list.push(a),this},s.setState=function(a){var b=JSON.stringify(a);return this.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},s.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},s.__service_list=[],s.declareService=function(a){return this.__service_list.push(a),this},s.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return n(this.element,a,c,b.bind(this),d)}),this},s.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?w(c,a,b,d):c.__job_list.push([a,b,d])},this},s.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},s.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d,e=!1,f=this.hasOwnProperty("__modification_dict"),g=this;f?(d=this.__modification_dict,e=!0):(d={},this.__modification_dict=d);for(b in a)a.hasOwnProperty(b)&&a[b]!==this.state[b]&&(this.state[b]=a[b],d[b]=a[b],e=!0);return e&&void 0!==this.__state_change_callback?(new c.Queue).push(function(){return g.__state_change_callback(d)}).push(function(a){return delete g.__modification_dict,a}):void 0}),s.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},s.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),s.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),s.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},A.__ready_list=s.__ready_list.slice(),A.__service_list=s.__service_list.slice(),A.ready=s.ready,A.setState=s.setState,A.onStateChange=s.onStateChange,A.declareService=s.declareService,A.onEvent=s.onEvent,A.prototype=new s,A.prototype.constructor=A,C.__ready_list=s.__ready_list.slice(),C.ready=s.ready,C.setState=s.setState,C.onStateChange=s.onStateChange,C.__service_list=s.__service_list.slice(),C.declareService=s.declareService,C.onEvent=s.onEvent,C.prototype=new s,C.prototype.constructor=C,s.declareMethod("declareGadget",function(b,d){var e=this;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=I.getAbsoluteURL(b,this.__path),(new c.Queue).push(function(){var a;if("public"===d.sandbox)a=B;else if("iframe"===d.sandbox)a=D;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=E}return a(b,d,e)}).push(function(f){function g(){return f}function h(a){return function(){return a.call(f,f)}}var i,j,k=new c.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void 0===j)for(j="RJS_"+O,O+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+O,O+=1;return e.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(x),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),I=function(a){var c;if(a===b&&(c=N[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},I.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},I.AcquisitionError.prototype=new Error,I.AcquisitionError.prototype.constructor=I.AcquisitionError,I.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},I.declareJS=function(b,d,e){var f;return L.hasOwnProperty(b)?f=c.resolve():(L[b]=null,f=new c.Promise(function(c,f){var g;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&N.shift(),c()},g.onerror=function(a){e===!0&&N.shift(),f(a)},g.src=b,d.appendChild(g)})),f},I.declareCSS=function(b,d){var e;return e=M.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){M[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},I.declareGadgetKlass=function(b){if(K.hasOwnProperty(b))return K[b].promise;var d,e=c.defer();return K[b]=e,H=e.promise,(new c.Queue).push(function(){return o(b)}).push(function(e){d=F(e,b);var f,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(N.push(d),f=0;f<i.length-1;f+=1)h.push(I.declareJS(i[f],g));h.push(I.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(I.declareCSS(j[f],g));return a.head.appendChild(g),c.all(h)}).push(function(){return e.resolve(d),d}).push(void 0,function(a){throw e.reject(a),a})},I.clearGadgetKlassList=function(){K={},L={},M={}},I.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!P.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");if(e.title=a.title,null!==a.head)for(c=0;c<a.head.children.length;c+=1)d=a.head.children[c],null!==d.href&&("stylesheet"===d.rel?e.required_css_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):"SCRIPT"!==d.nodeName||"text/javascript"!==d.type&&d.type?"http://www.renderjs.org/rel/interface"===d.rel&&e.interface_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(I.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=I,b.__RenderJSGadget=s,b.__RenderJSEmbeddedGadget=A,b.__RenderJSIframeGadget=C,G()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";function m(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function n(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function o(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function p(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function q(c){var d,e,f,g,h,i;if(Q)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(R.push(c),R.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<R.length;d+=1){if(i=R[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&R.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function r(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function s(){return this instanceof s?void 0:new s}function t(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new J,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return q(a)})}function u(){this.__sub_gadget_dict={},t(this)}function v(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function w(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function x(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list,d=a.__job_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a));for(b=0;b<d.length;b+=1)w(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function y(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new I.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof I.AcquisitionError)return g.__aq_parent(b,d);throw a})}function z(a,b){a.__aq_parent=function(c,d){return y.apply(b,[a,c,d])}}function A(){return this instanceof A?void s.call(this):new A}function B(b,d,e){return(new c.Queue).push(function(){return I.declareGadgetKlass(b).then(function(a){return a})}).push(function(b){void 0===d.element&&(d.element=a.createElement("div"));var c,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));return f.element.appendChild(h),z(f,e),f})}function C(){return this instanceof C?void s.call(this):new C}function D(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new C,z(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function E(a,b,e){return(new c.Queue).push(function(){return o(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){return D(a,b,e)})}function F(a,b){var c,e,f;c=function(){s.call(this)},c.__ready_list=s.__ready_list.slice(),c.__service_list=s.__service_list.slice(),c.declareMethod=s.declareMethod,c.declareJob=s.declareJob,c.declareAcquiredMethod=s.declareAcquiredMethod,c.allowPublicAcquisition=s.allowPublicAcquisition,c.ready=s.ready,c.setState=s.setState,c.onStateChange=s.onStateChange,c.declareService=s.declareService,c.onEvent=s.onEvent,c.prototype=new s,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=I.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c}function G(){var d,h,i,j,k,l,m,n,o=p(b.location.href),r=new c.Queue,u=0,v=!1,w=[],y=!1,B=!1;if(K.hasOwnProperty(o))throw new Error("bootstrap should not be called twice");H=new c.Promise(function(p,r){function C(){var b,e,i=I.parseGadgetHTMLDocument(a,o),j=a.createDocumentFragment();for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)j.appendChild(h.element.childNodes[b].cloneNode(!0));d.__template_element.appendChild(j),c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)L[c[b]]=null;for(b=0;b<d.length;b+=1)M[d[b]]=null;N.shift()}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&t(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&t(h._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(h=b.addedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void 0!==h._gadget&&a.contains(h)&&x(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&x(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(p,function(a){throw r(a),console.error(a),a})}m=new s,m.__acquired_method_dict={reportServiceError:function(a){q(a[0])}},m.__aq_parent=function(a){throw new I.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){s.call(this)},d.declareMethod=s.declareMethod,d.declareJob=s.declareJob,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,d.__ready_list=s.__ready_list.slice(),d.ready=s.ready,d.setState=s.setState,d.onStateChange=s.onStateChange,d.__service_list=s.__service_list.slice(),d.declareService=s.declareService,d.onEvent=s.onEvent,d.prototype=new s,d.prototype.constructor=d,d.prototype.__path=o,K[o]={promise:c.resolve(d)},h=new d,z(h,m)):(d=A,d.__ready_list=s.__ready_list.slice(),d.__service_list=s.__service_list.slice(),d.prototype.__path=o,h=new A,z(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){u+=1,i.call({method:"declareMethod",params:a,success:function(){u-=1,j()},error:function(){u-=1}})},a=0;a<w.length;a+=1)k(w[a]);return w=[],y?void i.notify({method:"failed",params:n}):(B=!0,j(),void i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===u&&v===!0&&i.notify({method:"ready"})},k=function(a){w.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=s.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=s.declareService,d.declareJob=s.declareJob,d.onEvent=s.onEvent,d.declareAcquiredMethod=s.declareAcquiredMethod,d.allowPublicAcquisition=s.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},N.push(d),a.addEventListener("DOMContentLoaded",C,!1)}),r.push(function(){return H}).push(function(a){function b(){return a}function c(a){return function(b){return a.call(b,b)}}var e;for(d.ready(function(){return x(this)}),r.push(b),e=0;e<d.__ready_list.length;e+=1)r.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?r.fail(function(a){throw q(a),a}):r.then(function(){v=!0,B&&j()}).fail(function(a){throw l?(y=!0,n=a.toString(),q(a)):i.notify({method:"failed",params:a.toString()}),a})}var H,I,J,K={},L={},M={},N=[],O=0,P=new RegExp("^(?:[a-z]+:)?//|data:","i"),Q=!1,R=[];b.addEventListener("error",function(a){R.push(a)}),b.addEventListener("beforeunload",function(){Q=!0}),r.prototype=new Error,r.prototype.constructor=r,J=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof J?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new r;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new J},J.prototype=Object.create(c.Promise.prototype),J.prototype.constructor=J,s.prototype.__title="",s.prototype.__interface_list=[],s.prototype.__path="",s.prototype.__html="",s.prototype.__required_css_list=[],s.prototype.__required_js_list=[],s.__ready_list=[u,v],s.ready=function(a){return this.__ready_list.push(a),this},s.setState=function(a){var b=JSON.stringify(a);return this.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},s.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},s.__service_list=[],s.declareService=function(a){return this.__service_list.push(a),this},s.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return n(this.element,a,c,b.bind(this),d)}),this},s.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?w(c,a,b,d):c.__job_list.push([a,b,d])},this},s.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},s.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d=new c.Queue,e=this;return e.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){return b}).push(void 0,function(){})),e.__previous_onStateChange=d,d.push(function(){var b,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(b in a)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);return f&&void 0!==e.__state_change_callback?(e.__modification_dict=d,(new c.Queue).push(function(){return e.__state_change_callback(d)}).push(function(a){return delete e.__modification_dict,a})):void 0})}),s.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},s.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),s.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),s.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},A.__ready_list=s.__ready_list.slice(),A.__service_list=s.__service_list.slice(),A.ready=s.ready,A.setState=s.setState,A.onStateChange=s.onStateChange,A.declareService=s.declareService,A.onEvent=s.onEvent,A.prototype=new s,A.prototype.constructor=A,C.__ready_list=s.__ready_list.slice(),C.ready=s.ready,C.setState=s.setState,C.onStateChange=s.onStateChange,C.__service_list=s.__service_list.slice(),C.declareService=s.declareService,C.onEvent=s.onEvent,C.prototype=new s,C.prototype.constructor=C,s.declareMethod("declareGadget",function(b,d){var e=this;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=I.getAbsoluteURL(b,this.__path),(new c.Queue).push(function(){var a;if("public"===d.sandbox)a=B;else if("iframe"===d.sandbox)a=D;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=E}return a(b,d,e)}).push(function(f){function g(){return f}function h(a){return function(){return a.call(f,f)}}var i,j,k=new c.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void 0===j)for(j="RJS_"+O,O+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+O,O+=1;return e.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(x),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),I=function(a){var c;if(a===b&&(c=N[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},I.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},I.AcquisitionError.prototype=new Error,I.AcquisitionError.prototype.constructor=I.AcquisitionError,I.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},I.declareJS=function(b,d,e){var f;return L.hasOwnProperty(b)?f=c.resolve():(L[b]=null,f=new c.Promise(function(c,f){var g;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&N.shift(),c()},g.onerror=function(a){e===!0&&N.shift(),f(a)},g.src=b,d.appendChild(g)})),f},I.declareCSS=function(b,d){var e;return e=M.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){M[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},I.declareGadgetKlass=function(b){if(K.hasOwnProperty(b))return K[b].promise;var d,e=c.defer();return K[b]=e,H=e.promise,(new c.Queue).push(function(){return o(b)}).push(function(e){d=F(e,b);var f,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(N.push(d),f=0;f<i.length-1;f+=1)h.push(I.declareJS(i[f],g));h.push(I.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(I.declareCSS(j[f],g));return a.head.appendChild(g),c.all(h)}).push(function(){return e.resolve(d),d}).push(void 0,function(a){throw e.reject(a),a})},I.clearGadgetKlassList=function(){K={},L={},M={}},I.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!P.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");if(e.title=a.title,null!==a.head)for(c=0;c<a.head.children.length;c+=1)d=a.head.children[c],null!==d.href&&("stylesheet"===d.rel?e.required_css_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):"SCRIPT"!==d.nodeName||"text/javascript"!==d.type&&d.type?"http://www.renderjs.org/rel/interface"===d.rel&&e.interface_list.push(I.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(I.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=I,b.__RenderJSGadget=s,b.__RenderJSEmbeddedGadget=A,b.__RenderJSIframeGadget=C,G()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";function m(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function n(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function o(){function a(){b.cancelAnimationFrame(e)}function d(a){e=b.requestAnimationFrame(a)}var e;return new c.Promise(d,a)}function p(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function q(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function r(c){var d,e,f,g,h,i;if(R)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(S.push(c),S.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<S.length;d+=1){if(i=S[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&S.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function s(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function t(){return this instanceof t?void 0:new t}function u(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new K,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return r(a)})}function v(){this.__sub_gadget_dict={},u(this)}function w(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function x(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function y(a){a.__monitor.monitor((new c.Queue).push(function(){var b,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)x(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function z(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new J.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof J.AcquisitionError)return g.__aq_parent(b,d);throw a})}function A(a,b){a.__aq_parent=function(c,d){return z.apply(b,[a,c,d])}}function B(){return this instanceof B?void t.call(this):new B}function C(b,d,e){return(new c.Queue).push(function(){return J.declareGadgetKlass(b).then(function(a){return a})}).push(function(b){void 0===d.element&&(d.element=a.createElement("div"));var c,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));return f.element.appendChild(h),A(f,e),f})}function D(){return this instanceof D?void t.call(this):new D}function E(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new D,A(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function F(a,b,e){return(new c.Queue).push(function(){return p(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){return E(a,b,e)})}function G(a,b){var c,e,f;c=function(){t.call(this)},c.__ready_list=t.__ready_list.slice(),c.__service_list=t.__service_list.slice(),c.declareMethod=t.declareMethod,c.declareJob=t.declareJob,c.declareAcquiredMethod=t.declareAcquiredMethod,c.allowPublicAcquisition=t.allowPublicAcquisition,c.ready=t.ready,c.setState=t.setState,c.onStateChange=t.onStateChange,c.declareService=t.declareService,c.onEvent=t.onEvent,c.onLoop=t.onLoop,c.prototype=new t,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=J.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c}function H(){var d,h,i,j,k,l,m,n,o=q(b.location.href),p=new c.Queue,s=0,v=!1,w=[],x=!1,z=!1;if(L.hasOwnProperty(o))throw new Error("bootstrap should not be called twice");I=new c.Promise(function(p,q){function C(){var b,e,i=J.parseGadgetHTMLDocument(a,o),j=a.createDocumentFragment();for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.element=a.body,h.state={},b=0;b<h.element.childNodes.length;b+=1)j.appendChild(h.element.childNodes[b].cloneNode(!0));d.__template_element.appendChild(j),c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)M[c[b]]=null;for(b=0;b<d.length;b+=1)N[d[b]]=null;O.shift()}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&u(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&u(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")&&void 0!==h._gadget&&a.contains(h)&&y(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&y(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(p,function(a){throw q(a),console.error(a),a})}return m=new t,m.__acquired_method_dict={reportServiceError:function(a){r(a[0])}},m.__aq_parent=function(a){throw new J.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){t.call(this)},d.declareMethod=t.declareMethod,d.declareJob=t.declareJob,d.declareAcquiredMethod=t.declareAcquiredMethod,d.allowPublicAcquisition=t.allowPublicAcquisition,d.__ready_list=t.__ready_list.slice(),d.ready=t.ready,d.setState=t.setState,d.onStateChange=t.onStateChange,d.__service_list=t.__service_list.slice(),d.declareService=t.declareService,d.onEvent=t.onEvent,d.onLoop=t.onLoop,d.prototype=new t,d.prototype.constructor=d,d.prototype.__path=o,L[o]={promise:c.resolve(d)},h=new d,A(h,m)):(d=B,d.__ready_list=t.__ready_list.slice(),d.__service_list=t.__service_list.slice(),d.prototype.__path=o,h=new B,A(h,m),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a;for(l=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){s+=1,i.call({method:"declareMethod",params:a,success:function(){s-=1,j()},error:function(){s-=1}})},a=0;a<w.length;a+=1)k(w[a]);return w=[],x?void i.notify({method:"failed",params:n}):(z=!0,j(),void i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===s&&v===!0&&i.notify({method:"ready"})},k=function(a){w.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=t.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=t.declareService,d.declareJob=t.declareJob,d.onEvent=t.onEvent,d.onLoop=t.onLoop,d.declareAcquiredMethod=t.declareAcquiredMethod,d.allowPublicAcquisition=t.allowPublicAcquisition,l=!0),d.prototype.__acquired_method_dict={},O.push(d),a.addEventListener("DOMContentLoaded",T.resolve,!1),(new c.Queue).push(function(){return T.promise}).push(function(){return C()})}),p.push(function(){return I}).push(function(a){function b(){return a}function c(a){return function(b){return a.call(b,b)}}var e;for(d.ready(function(){return y(this)}),p.push(b),e=0;e<d.__ready_list.length;e+=1)p.push(c(d.__ready_list[e])).push(b)}),b.self===b.top?p.fail(function(a){throw r(a),a}):p.then(function(){v=!0,z&&j()}).fail(function(a){throw l?(x=!0,n=a.toString(),r(a)):i.notify({method:"failed",params:a.toString()}),a})}var I,J,K,L={},M={},N={},O=[],P=0,Q=new RegExp("^(?:[a-z]+:)?//|data:","i"),R=!1,S=[],T=new c.defer;b.addEventListener("error",function(a){S.push(a)}),b.addEventListener("beforeunload",function(){R=!0}),s.prototype=new Error,s.prototype.constructor=s,K=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof K?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new s;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new K},K.prototype=Object.create(c.Promise.prototype),K.prototype.constructor=K,t.prototype.__title="",t.prototype.__interface_list=[],t.prototype.__path="",t.prototype.__html="",t.prototype.__required_css_list=[],t.prototype.__required_js_list=[],t.__ready_list=[v,w],t.ready=function(a){return this.__ready_list.push(a),this},t.setState=function(a){var b=JSON.stringify(a);return this.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},t.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},t.__service_list=[],t.declareService=function(a){return this.__service_list.push(a),this},t.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return n(this.element,a,c,b.bind(this),d)}),this},t.onLoop=function(a,b){return void 0===b&&(b=0),this.__service_list.push(function(){var d=new c.Queue,e=function(){d.push(function(){return c.delay(b)}).push(function(){return o()}).push(function(){return a.apply(this,[])}).push(function(){e()})};return e(),d}),this},t.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?x(c,a,b,d):c.__job_list.push([a,b,d])},this},t.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},t.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d=new c.Queue,e=this;return e.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){return b}).push(void 0,function(){})),e.__previous_onStateChange=d,d.push(function(){var b,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(b in a)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);return f&&void 0!==e.__state_change_callback?(e.__modification_dict=d,(new c.Queue).push(function(){return e.__state_change_callback(d)}).push(function(a){return delete e.__modification_dict,a})):void 0})}),t.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},t.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),t.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),t.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},B.__ready_list=t.__ready_list.slice(),B.__service_list=t.__service_list.slice(),B.ready=t.ready,B.setState=t.setState,B.onStateChange=t.onStateChange,B.declareService=t.declareService,B.onEvent=t.onEvent,B.onLoop=t.onLoop,B.prototype=new t,B.prototype.constructor=B,D.__ready_list=t.__ready_list.slice(),D.ready=t.ready,D.setState=t.setState,D.onStateChange=t.onStateChange,D.__service_list=t.__service_list.slice(),D.declareService=t.declareService,D.onEvent=t.onEvent,D.onLoop=t.onLoop,D.prototype=new t,D.prototype.constructor=D,t.declareMethod("declareGadget",function(b,d){var e=this;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=J.getAbsoluteURL(b,this.__path),(new c.Queue).push(function(){var a;if("public"===d.sandbox)a=C;else if("iframe"===d.sandbox)a=E;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=F}return a(b,d,e)}).push(function(f){function g(){return f}function h(a){return function(){return a.call(f,f)}}var i,j,k=new c.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void 0===j)for(j="RJS_"+P,P+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+P,P+=1;return e.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(y),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),J=function(a){var c;if(a===b&&(c=O[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},J.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},J.AcquisitionError.prototype=new Error,J.AcquisitionError.prototype.constructor=J.AcquisitionError,J.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},J.declareJS=function(b,d,e){var f;return M.hasOwnProperty(b)?f=c.resolve():(M[b]=null,f=new c.Promise(function(c,f){var g;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&O.shift(),c()},g.onerror=function(a){e===!0&&O.shift(),f(a)},g.src=b,d.appendChild(g)})),f},J.declareCSS=function(b,d){var e;return e=N.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){N[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},J.declareGadgetKlass=function(b){if(L.hasOwnProperty(b))return L[b].promise;var d,e=c.defer();return L[b]=e,I=e.promise,(new c.Queue).push(function(){return p(b)}).push(function(e){d=G(e,b);var f,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(O.push(d),f=0;f<i.length-1;f+=1)h.push(J.declareJS(i[f],g));h.push(J.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(J.declareCSS(j[f],g));return a.head.appendChild(g),c.all(h)}).push(function(){return e.resolve(d),d}).push(void 0,function(a){throw e.reject(a),a})},J.clearGadgetKlassList=function(){L={},M={},N={}},J.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!Q.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(J.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(J.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(J.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=J,b.__RenderJSGadget=t,b.__RenderJSEmbeddedGadget=B,b.__RenderJSIframeGadget=D,J.manualBootstrap=function(){T.resolve()},H()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";function m(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function n(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function o(){function a(){b.cancelAnimationFrame(e)}function d(a){e=b.requestAnimationFrame(a)}var e;return new c.Promise(d,a)}function p(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function q(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function r(c){var d,e,f,g,h,i;if(W)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(X.push(c),X.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<X.length;d+=1){if(i=X[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&X.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function s(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function t(){return this instanceof t?void 0:new t}function u(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new O,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return r(a)})}function v(){this.__sub_gadget_dict={},u(this)}function w(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function x(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function y(a){a.__monitor.monitor((new c.Queue).push(function(){var b,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)x(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function z(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new N.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof N.AcquisitionError)return g.__aq_parent(b,d);throw a})}function A(a,b){a.__aq_parent=function(c,d){return z.apply(b,[a,c,d])}}function B(){return this instanceof B?void t.call(this):new B}function C(b,d,e){return(new c.Queue).push(function(){return N.declareGadgetKlass(b).then(function(a){return a})}).push(function(b){void 0===d.element&&(d.element=a.createElement("div"));var c,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));return f.element.appendChild(h),A(f,e),f})}function D(){return this instanceof D?void t.call(this):new D}function E(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new D,A(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function F(a,b,e){return(new c.Queue).push(function(){return p(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){return E(a,b,e)})}function G(a,b){var c,e,f;c=function(){t.call(this)},c.__ready_list=t.__ready_list.slice(),c.__service_list=t.__service_list.slice(),c.declareMethod=t.declareMethod,c.declareJob=t.declareJob,c.declareAcquiredMethod=t.declareAcquiredMethod,c.allowPublicAcquisition=t.allowPublicAcquisition,c.ready=t.ready,c.setState=t.setState,c.onStateChange=t.onStateChange,c.declareService=t.declareService,c.onEvent=t.onEvent,c.onLoop=t.onLoop,c.prototype=new t,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=N.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c}function H(b,d,e){var h,i,j=N.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(i in j)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));return b.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)R[c[b]]=null;for(b=0;b<d.length;b+=1)S[d[b]]=null;T.shift()}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&u(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&u(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")&&void 0!==h._gadget&&a.contains(h)&&y(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&y(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),e})}function I(){var a=new t;return a.__acquired_method_dict={reportServiceError:function(a){r(a[0])}},a.__aq_parent=function(a){throw new N.AcquisitionError("No gadget provides "+a)},a}function J(a){var d,f,g,h,i,j,k,l;if(Q.hasOwnProperty(a))throw new Error("bootstrap should not be called twice");return d=B,d.__ready_list=t.__ready_list.slice(),d.__service_list=t.__service_list.slice(),d.prototype.__path=a,f=new B,A(f,I()),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,(new c.Queue).push(function(){return c.delay(1e3)}).push(function(){return l[2]=void 0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a,b;for(h=function(a){i.push(new c.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){var c=t.declareMethod.apply(this,[a,b]);return h(a),c},d.declareService=t.declareService,d.declareJob=t.declareJob,d.onEvent=t.onEvent,d.onLoop=t.onLoop,d.declareAcquiredMethod=t.declareAcquiredMethod,d.allowPublicAcquisition=t.allowPublicAcquisition,d.prototype.__acquired_method_dict={},T.push(d),j}function K(a,b){function d(){return b}function e(a){return function(b){return a.call(b,b)}}var f,g=new c.Queue;for(a.ready(function(){return y(this)}),g.push(d),f=0;f<a.__ready_list.length;f+=1)g.push(e(a.__ready_list[f])).push(d);return g}function L(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){return new c.Promise(function(c,f){d.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){f(a)},timeout:e})})},d.bind("methodCall",function(a,c){b[c[0]].apply(b,c[1]).push(function(b){a.complete(b)},function(b){a.error(b.toString())}),a.delayReturn(!0)})}function M(a){var b,d,e,f,g=J(a);return(new c.Queue).push(function(){return g}).push(function(a){return b=a[0],d=a[1],e=a[2],f=a[3],P.promise}).push(function(){return c.all(f)}).push(function(c){return void 0!==e&&L(b,d,e),H(b,a,d)}).push(function(){return K(b,d)}).push(function(){void 0!==e&&e.notify({method:"ready"})}).push(void 0,function(a){throw r(a),void 0!==e&&e.notify({method:"failed",params:a.toString()}),a})}var N,O,P,Q={},R={},S={},T=[],U=0,V=new RegExp("^(?:[a-z]+:)?//|data:","i"),W=!1,X=[];b.addEventListener("error",function(a){X.push(a)}),b.addEventListener("beforeunload",function(){W=!0}),s.prototype=new Error,s.prototype.constructor=s,O=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof O?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new s;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new O},O.prototype=Object.create(c.Promise.prototype),O.prototype.constructor=O,t.prototype.__title="",t.prototype.__interface_list=[],t.prototype.__path="",t.prototype.__html="",t.prototype.__required_css_list=[],t.prototype.__required_js_list=[],t.__ready_list=[v,w],t.ready=function(a){return this.__ready_list.push(a),this},t.setState=function(a){var b=JSON.stringify(a);return this.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},t.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},t.__service_list=[],t.declareService=function(a){return this.__service_list.push(a),this},t.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return n(this.element,a,c,b.bind(this),d)}),this},t.onLoop=function(a,b){return void 0===b&&(b=0),this.__service_list.push(function(){var d=new c.Queue,e=function(){d.push(function(){return c.delay(b)}).push(function(){return o()}).push(function(){return a.apply(this,[])}).push(function(){e()})};return e(),d}),this},t.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?x(c,a,b,d):c.__job_list.push([a,b,d])},this},t.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},t.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d=new c.Queue,e=this;return e.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){return b}).push(void 0,function(){})),e.__previous_onStateChange=d,d.push(function(){var b,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(b in a)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);return f&&void 0!==e.__state_change_callback?(e.__modification_dict=d,(new c.Queue).push(function(){return e.__state_change_callback(d)}).push(function(a){return delete e.__modification_dict,a})):void 0})}),t.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},t.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),t.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),t.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},B.__ready_list=t.__ready_list.slice(),B.__service_list=t.__service_list.slice(),B.ready=t.ready,B.setState=t.setState,B.onStateChange=t.onStateChange,B.declareService=t.declareService,B.onEvent=t.onEvent,B.onLoop=t.onLoop,B.prototype=new t,B.prototype.constructor=B,D.__ready_list=t.__ready_list.slice(),D.ready=t.ready,D.setState=t.setState,D.onStateChange=t.onStateChange,D.__service_list=t.__service_list.slice(),D.declareService=t.declareService,D.onEvent=t.onEvent,D.onLoop=t.onLoop,D.prototype=new t,D.prototype.constructor=D,t.declareMethod("declareGadget",function(b,d){var e=this;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=N.getAbsoluteURL(b,this.__path),(new c.Queue).push(function(){var a;if("public"===d.sandbox)a=C;else if("iframe"===d.sandbox)a=E;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=F}return a(b,d,e)}).push(function(f){function g(){return f}function h(a){return function(){return a.call(f,f)}}var i,j,k=new c.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void 0===j)for(j="RJS_"+U,U+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+U,U+=1;return e.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(y),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),N=function(a){var c;if(a===b&&(c=T[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},N.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},N.AcquisitionError.prototype=new Error,N.AcquisitionError.prototype.constructor=N.AcquisitionError,N.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},N.declareJS=function(b,d,e){var f;return R.hasOwnProperty(b)?f=c.resolve():(R[b]=null,f=new c.Promise(function(c,f){var g;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&T.shift(),c()},g.onerror=function(a){e===!0&&T.shift(),f(a)},g.src=b,d.appendChild(g)})),f},N.declareCSS=function(b,d){var e;return e=S.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){S[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},N.declareGadgetKlass=function(b){if(Q.hasOwnProperty(b))return Q[b].promise;var d,e=c.defer();return Q[b]=e,(new c.Queue).push(function(){return p(b)}).push(function(e){d=G(e,b);var f,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(T.push(d),f=0;f<i.length-1;f+=1)h.push(N.declareJS(i[f],g));h.push(N.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(N.declareCSS(j[f],g));return a.head.appendChild(g),c.all(h)}).push(function(){return e.resolve(d),d}).push(void 0,function(a){throw e.reject(a),a})},N.clearGadgetKlassList=function(){Q={},R={},S={}},N.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!V.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(N.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(N.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(N.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=N,b.__RenderJSGadget=t,b.__RenderJSEmbeddedGadget=B,b.__RenderJSIframeGadget=D,P=new c.defer,N.manualBootstrap=function(){P.resolve()},a.addEventListener("DOMContentLoaded",P.resolve,!1),M(q(b.location.href))}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";function m(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function n(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function o(){function a(){b.cancelAnimationFrame(e)}function d(a){e=b.requestAnimationFrame(a)}var e;return new c.Promise(d,a)}function p(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function q(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function r(c){var d,e,f,g,h,i;if(W)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(X.push(c),X.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<X.length;d+=1){if(i=X[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&X.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function s(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function t(){return this instanceof t?void 0:new t}function u(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new O,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return r(a)})}function v(){this.__sub_gadget_dict={},u(this)}function w(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function x(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function y(a){a.__monitor.monitor((new c.Queue).push(function(){var b,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)x(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function z(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new N.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof N.AcquisitionError)return g.__aq_parent(b,d);throw a})}function A(a,b){a.__aq_parent=function(c,d){return z.apply(b,[a,c,d])}}function B(){return this instanceof B?void t.call(this):new B}function C(b,d,e){return(new c.Queue).push(function(){return N.declareGadgetKlass(b).then(function(a){return a})}).push(function(b){void 0===d.element&&(d.element=a.createElement("div"));var c,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));return f.element.appendChild(h),A(f,e),f})}function D(){return this instanceof D?void t.call(this):new D}function E(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new D,A(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function F(a,b,e){return(new c.Queue).push(function(){return p(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){return E(a,b,e)})}function G(a,b){var c,e,f;c=function(){t.call(this)},c.__ready_list=t.__ready_list.slice(),c.__service_list=t.__service_list.slice(),c.declareMethod=t.declareMethod,c.declareJob=t.declareJob,c.declareAcquiredMethod=t.declareAcquiredMethod,c.allowPublicAcquisition=t.allowPublicAcquisition,c.ready=t.ready,c.setState=t.setState,c.onStateChange=t.onStateChange,c.declareService=t.declareService,c.onEvent=t.onEvent,c.onLoop=t.onLoop,c.prototype=new t,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=N.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c}function H(b,d,e){var h,i,j=N.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(i in j)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));return b.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)R[c[b]]=null;for(b=0;b<d.length;b+=1)S[d[b]]=null;T.shift()}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&u(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&u(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")&&void 0!==h._gadget&&a.contains(h)&&y(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&y(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),e})}function I(){var a=new t;return a.__acquired_method_dict={reportServiceError:function(a){r(a[0])}},a.__aq_parent=function(a){throw new N.AcquisitionError("No gadget provides "+a)},a}function J(a){var d,f,g,h,i,j,k,l;if(Q.hasOwnProperty(a))throw new Error("bootstrap should not be called twice");return d=B,d.__ready_list=t.__ready_list.slice(),d.__service_list=t.__service_list.slice(),d.prototype.__path=a,f=new B,A(f,I()),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,(new c.Queue).push(function(){return c.delay(1e3)}).push(function(){return l[2]=void 0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a,b;for(h=function(a){i.push(new c.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){var c=t.declareMethod.apply(this,[a,b]);return h(a),c},d.declareService=t.declareService,d.declareJob=t.declareJob,d.onEvent=t.onEvent,d.onLoop=t.onLoop,d.declareAcquiredMethod=t.declareAcquiredMethod,d.allowPublicAcquisition=t.allowPublicAcquisition,d.prototype.__acquired_method_dict={},T.push(d),j}function K(a,b){function d(){return b}function e(a){return function(b){return a.call(b,b)}}var f,g=new c.Queue;for(a.ready(function(){return y(this)}),g.push(d),f=0;f<a.__ready_list.length;f+=1)g.push(e(a.__ready_list[f])).push(d);return g}function L(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){return new c.Promise(function(c,f){d.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){f(a)},timeout:e})})},d.bind("methodCall",function(a,c){b[c[0]].apply(b,c[1]).push(function(b){a.complete(b)},function(b){a.error(b.toString())}),a.delayReturn(!0)})}function M(a){var b,d,e,f,g=J(a);return(new c.Queue).push(function(){return g}).push(function(a){return b=a[0],d=a[1],e=a[2],f=a[3],P.promise}).push(function(){return c.all(f)}).push(function(c){return void 0!==e&&L(b,d,e),H(b,a,d)}).push(function(){return K(b,d)}).push(function(){void 0!==e&&e.notify({method:"ready"})}).push(void 0,function(a){throw r(a),void 0!==e&&e.notify({method:"failed",params:a.toString()}),a})}var N,O,P,Q={},R={},S={},T=[],U=0,V=new RegExp("^(?:[a-z]+:)?//|data:","i"),W=!1,X=[];b.addEventListener("error",function(a){X.push(a)}),b.addEventListener("beforeunload",function(){W=!0}),s.prototype=new Error,s.prototype.constructor=s,O=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof O?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new s;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new O},O.prototype=Object.create(c.Promise.prototype),O.prototype.constructor=O,t.prototype.__title="",t.prototype.__interface_list=[],t.prototype.__path="",t.prototype.__html="",t.prototype.__required_css_list=[],t.prototype.__required_js_list=[],t.__ready_list=[v,w],t.ready=function(a){return this.__ready_list.push(a),this},t.setState=function(a){var b=JSON.stringify(a);return this.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},t.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},t.__service_list=[],t.declareService=function(a){return this.__service_list.push(a),this},t.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return n(this.element,a,c,b.bind(this),d)}),this},t.onLoop=function(a,b){return void 0===b&&(b=0),this.__service_list.push(function(){var d=new c.Queue,e=this,f=function(){d.push(function(){return c.delay(b)}).push(function(){return o()}).push(function(){return a.apply(e,[])}).push(function(){f()})};return f(),d}),this},t.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?x(c,a,b,d):c.__job_list.push([a,b,d])},this},t.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},t.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d=new c.Queue,e=this;return e.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){return b}).push(void 0,function(){})),e.__previous_onStateChange=d,d.push(function(){var b,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(b in a)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);return f&&void 0!==e.__state_change_callback?(e.__modification_dict=d,(new c.Queue).push(function(){return e.__state_change_callback(d)}).push(function(a){return delete e.__modification_dict,a})):void 0})}),t.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},t.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),t.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),t.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},B.__ready_list=t.__ready_list.slice(),B.__service_list=t.__service_list.slice(),B.ready=t.ready,B.setState=t.setState,B.onStateChange=t.onStateChange,B.declareService=t.declareService,B.onEvent=t.onEvent,B.onLoop=t.onLoop,B.prototype=new t,B.prototype.constructor=B,D.__ready_list=t.__ready_list.slice(),D.ready=t.ready,D.setState=t.setState,D.onStateChange=t.onStateChange,D.__service_list=t.__service_list.slice(),D.declareService=t.declareService,D.onEvent=t.onEvent,D.onLoop=t.onLoop,D.prototype=new t,D.prototype.constructor=D,t.declareMethod("declareGadget",function(b,d){var e=this;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=N.getAbsoluteURL(b,this.__path),(new c.Queue).push(function(){var a;if("public"===d.sandbox)a=C;else if("iframe"===d.sandbox)a=E;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=F}return a(b,d,e)}).push(function(f){function g(){return f}function h(a){return function(){return a.call(f,f)}}var i,j,k=new c.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void 0===j)for(j="RJS_"+U,U+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+U,U+=1;return e.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(y),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),N=function(a){var c;if(a===b&&(c=T[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},N.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},N.AcquisitionError.prototype=new Error,N.AcquisitionError.prototype.constructor=N.AcquisitionError,N.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},N.declareJS=function(b,d,e){var f;return R.hasOwnProperty(b)?f=c.resolve():(R[b]=null,f=new c.Promise(function(c,f){var g;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&T.shift(),c()},g.onerror=function(a){e===!0&&T.shift(),f(a)},g.src=b,d.appendChild(g)})),f},N.declareCSS=function(b,d){var e;return e=S.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){S[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},N.declareGadgetKlass=function(b){if(Q.hasOwnProperty(b))return Q[b].promise;var d,e=c.defer();return Q[b]=e,(new c.Queue).push(function(){return p(b)}).push(function(e){d=G(e,b);var f,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(T.push(d),f=0;f<i.length-1;f+=1)h.push(N.declareJS(i[f],g));h.push(N.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(N.declareCSS(j[f],g));return a.head.appendChild(g),c.all(h)}).push(function(){return e.resolve(d),d}).push(void 0,function(a){throw e.reject(a),a})},N.clearGadgetKlassList=function(){Q={},R={},S={}},N.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!V.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(N.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(N.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(N.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=N,b.__RenderJSGadget=t,b.__RenderJSEmbeddedGadget=B,b.__RenderJSIframeGadget=D,P=new c.defer,N.manualBootstrap=function(){P.resolve()},a.addEventListener("DOMContentLoaded",P.resolve,!1),M(q(b.location.href))}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";function m(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function n(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function o(){function a(){b.cancelAnimationFrame(e)}function d(a){e=b.requestAnimationFrame(a)}var e;return new c.Promise(d,a)}function p(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function q(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function r(c){var d,e,f,g,h,i;if(W)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(X.push(c),X.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<X.length;d+=1){if(i=X[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&X.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function s(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function t(){return this instanceof t?void 0:new t}function u(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new O,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(r)}function v(){this.__sub_gadget_dict={},u(this)}function w(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function x(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function y(a){a.__monitor.monitor((new c.Queue).push(function(){var b,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)x(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function z(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new N.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof N.AcquisitionError)return g.__aq_parent(b,d);throw a})}function A(a,b){a.__aq_parent=function(c,d){return z.apply(b,[a,c,d])}}function B(){return this instanceof B?void t.call(this):new B}function C(b,c,d){return N.declareGadgetKlass(b).then(function(b){void 0===c.element&&(c.element=a.createElement("div"));var e,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=c.element,f.state={},e=0;e<g.length;e+=1)h.appendChild(g[e].cloneNode(!0));return f.element.appendChild(h),A(f,d),f})}function D(){return this instanceof D?void t.call(this):new D}function E(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new D,A(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(a.complete).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function F(a,b,e){return(new c.Queue).push(function(){return p(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){return E(a,b,e)})}function G(a,b){var c,e,f;c=function(){t.call(this)},c.__ready_list=t.__ready_list.slice(),c.__service_list=t.__service_list.slice(),c.declareMethod=t.declareMethod,c.declareJob=t.declareJob,c.declareAcquiredMethod=t.declareAcquiredMethod,c.allowPublicAcquisition=t.allowPublicAcquisition,c.ready=t.ready,c.setState=t.setState,c.onStateChange=t.onStateChange,c.declareService=t.declareService,c.onEvent=t.onEvent,c.onLoop=t.onLoop,c.prototype=new t,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=N.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c}function H(b,d,e){var h,i,j=N.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(i in j)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));return b.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)R[c[b]]=null;for(b=0;b<d.length;b+=1)S[d[b]]=null;T.shift()}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&u(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&u(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")&&void 0!==h._gadget&&a.contains(h)&&y(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&y(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),e})}function I(){var a=new t;return a.__acquired_method_dict={reportServiceError:function(a){r(a[0])}},a.__aq_parent=function(a){throw new N.AcquisitionError("No gadget provides "+a)},a}function J(a){var d,f,g,h,i,j,k,l;if(Q.hasOwnProperty(a))throw new Error("bootstrap should not be called twice");return d=B,d.__ready_list=t.__ready_list.slice(),d.__service_list=t.__service_list.slice(),d.prototype.__path=a,f=new B,A(f,I()),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,(new c.Queue).push(function(){return c.delay(1e3)}).push(function(){return l[2]=void 0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a,b;for(h=function(a){i.push(new c.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){var c=t.declareMethod.apply(this,[a,b]);return h(a),c},d.declareService=t.declareService,d.declareJob=t.declareJob,d.onEvent=t.onEvent,d.onLoop=t.onLoop,d.declareAcquiredMethod=t.declareAcquiredMethod,d.allowPublicAcquisition=t.allowPublicAcquisition,d.prototype.__acquired_method_dict={},T.push(d),j}function K(a,b){function d(){return b}function e(a){return function(b){return a.call(b,b)}}var f,g=new c.Queue;for(a.ready(function(){return y(this)}),g.push(d),f=0;f<a.__ready_list.length;f+=1)g.push(e(a.__ready_list[f])).push(d);return g}function L(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){return new c.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)})}function M(a){var b,d,e,f,g=J(a);return(new c.Queue).push(function(){return g}).push(function(a){return b=a[0],d=a[1],e=a[2],f=a[3],P.promise}).push(function(){return c.all(f)}).push(function(c){return void 0!==e&&L(b,d,e),H(b,a,d)}).push(function(){return K(b,d)}).push(function(){void 0!==e&&e.notify({method:"ready"})}).push(void 0,function(a){throw r(a),void 0!==e&&e.notify({method:"failed",params:a.toString()}),a})}var N,O,P,Q={},R={},S={},T=[],U=0,V=new RegExp("^(?:[a-z]+:)?//|data:","i"),W=!1,X=[];b.addEventListener("error",function(a){X.push(a)}),b.addEventListener("beforeunload",function(){W=!0}),s.prototype=new Error,s.prototype.constructor=s,O=function(){function a(){var a,b=g.length;for(a=0;b>a;a+=1)g[a].cancel();g=[]}var b,d,e,f=this,g=[];return this instanceof O?(b=new c.Promise(function(b,c){d=function(b){return e?void 0:(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)throw new s;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,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){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b});return g.push(b),this})):new O},O.prototype=Object.create(c.Promise.prototype),O.prototype.constructor=O,t.prototype.__title="",t.prototype.__interface_list=[],t.prototype.__path="",t.prototype.__html="",t.prototype.__required_css_list=[],t.prototype.__required_js_list=[],t.__ready_list=[v,w],t.ready=function(a){return this.__ready_list.push(a),this},t.setState=function(a){var b=JSON.stringify(a);return this.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},t.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},t.__service_list=[],t.declareService=function(a){return this.__service_list.push(a),this},t.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return n(this.element,a,c,b.bind(this),d)}),this},t.onLoop=function(a,b){return void 0===b&&(b=0),this.__service_list.push(function(){var d=new c.Queue,e=this,f=function(){d.push(function(){return c.delay(b)}).push(function(){return o()}).push(function(){return a.apply(e,[])}).push(f)};return f(),d}),this},t.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?x(c,a,b,d):c.__job_list.push([a,b,d])},this},t.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},t.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d=new c.Queue,e=this;return e.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){return b}).push(void 0,function(){})),e.__previous_onStateChange=d,d.push(function(){var b,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(b in a)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);return f&&void 0!==e.__state_change_callback?(e.__modification_dict=d,(new c.Queue).push(function(){return e.__state_change_callback(d)}).push(function(a){return delete e.__modification_dict,a})):void 0})}),t.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},t.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),t.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),t.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},B.__ready_list=t.__ready_list.slice(),B.__service_list=t.__service_list.slice(),B.ready=t.ready,B.setState=t.setState,B.onStateChange=t.onStateChange,B.declareService=t.declareService,B.onEvent=t.onEvent,B.onLoop=t.onLoop,B.prototype=new t,B.prototype.constructor=B,D.__ready_list=t.__ready_list.slice(),D.ready=t.ready,D.setState=t.setState,D.onStateChange=t.onStateChange,D.__service_list=t.__service_list.slice(),D.declareService=t.declareService,D.onEvent=t.onEvent,D.onLoop=t.onLoop,D.prototype=new t,D.prototype.constructor=D,t.declareMethod("declareGadget",function(b,d){var e=this;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=N.getAbsoluteURL(b,this.__path),(new c.Queue).push(function(){var a;if("public"===d.sandbox)a=C;else if("iframe"===d.sandbox)a=E;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=F}return a(b,d,e)}).push(function(f){function g(){return f}function h(a){return function(){return a.call(f,f)}}var i,j,k=new c.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void 0===j)for(j="RJS_"+U,U+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+U,U+=1;return e.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(y),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),N=function(a){var c;if(a===b&&(c=T[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},N.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},N.AcquisitionError.prototype=new Error,N.AcquisitionError.prototype.constructor=N.AcquisitionError,N.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},N.declareJS=function(b,d,e){var f;return R.hasOwnProperty(b)?f=c.resolve():(R[b]=null,f=new c.Promise(function(c,f){var g;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&T.shift(),c()},g.onerror=function(a){e===!0&&T.shift(),f(a)},g.src=b,d.appendChild(g)})),f},N.declareCSS=function(b,d){var e;return e=S.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){S[b]=null,c()},f.onerror=e,d.appendChild(f)})},N.declareGadgetKlass=function(b){var d,e;return Q.hasOwnProperty(b)?Q[b].hasOwnProperty("defer_list")?(e=c.defer(),Q[b].defer_list.push(e),e.promise):Q[b].is_resolved?c.resolve(Q[b].result):c.reject(Q[b].result):(Q[b]={defer_list:[]},(new c.Queue).push(function(){return p(b)}).push(function(e){d=G(e,b);var f,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(T.push(d),f=0;f<i.length-1;f+=1)h.push(N.declareJS(i[f],g));h.push(N.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(N.declareCSS(j[f],g));return a.head.appendChild(g),c.all(h)}).push(function(){var a,c=Q[b].defer_list.length;for(a=0;c>a;a+=1)Q[b].defer_list[a].resolve(d);return delete Q[b].defer_list,Q[b].result=d,Q[b].is_resolved=!0,d}).push(void 0,function(a){var c,d=Q[b].defer_list.length;for(c=0;d>c;c+=1)Q[b].defer_list[c].reject(a);throw delete Q[b].defer_list,Q[b].result=a,Q[b].is_resolved=!1,a}))},N.clearGadgetKlassList=function(){Q={},R={},S={}},N.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!V.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(N.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(N.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(N.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=N,b.__RenderJSGadget=t,b.__RenderJSEmbeddedGadget=B,b.__RenderJSIframeGadget=D,P=new c.defer,N.manualBootstrap=function(){P.resolve()},a.addEventListener("DOMContentLoaded",P.resolve,!1),M(q(b.location.href))}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a){"use strict";function b(b,c){var d,e,f,g="<!doctype><html><head></head></html>";return b&&c?(d=(new a).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}function c(a,c){if(void 0!==c){if(!e.test(c))throw new TypeError("Failed to construct 'URL': Invalid base URL");a=b(a,c)}if(!e.test(a))throw new TypeError("Failed to construct 'URL': Invalid URL");this.href=a}try{if("https://example.com/a"===new window.URL("../a","https://example.com/").href)return}catch(d){}var e=/^(?:[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";function m(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function n(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function o(){function a(){b.cancelAnimationFrame(e)}function d(a){e=b.requestAnimationFrame(a)}var e;return new c.Promise(d,a)}function p(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function q(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function r(c){var d,e,f,g,h,i;if(X)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(Y.push(c),Y.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<Y.length;d+=1){if(i=Y[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&Y.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function s(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function t(){return this instanceof t?void 0:new t}function u(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new O,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(r)}function v(){this.__sub_gadget_dict={},u(this)}function w(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function x(a,b,d,e){var f=(new c.Queue).push(function(){return d.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function y(a){a.__monitor.monitor((new c.Queue).push(function(){var b,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)x(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}function z(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new N.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof N.AcquisitionError)return g.__aq_parent(b,d);throw a})}function A(a,b){a.__aq_parent=function(c,d){return z.apply(b,[a,c,d])}}function B(){return this instanceof B?void t.call(this):new B}function C(b,c,d){return N.declareGadgetKlass(b).then(function(b){void 0===c.element&&(c.element=a.createElement("div"));var e,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=c.element,f.state={},e=0;e<g.length;e+=1)h.appendChild(g[e].cloneNode(!0));return f.element.appendChild(h),A(f,d),f})}function D(){return this instanceof D?void t.call(this):new D}function E(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new D,A(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(a.complete).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function F(a,b,e){return(new c.Queue).push(function(){return p(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){return E(a,b,e)})}function G(a,b){var c,e,f;c=function(){t.call(this)},c.__ready_list=t.__ready_list.slice(),c.__service_list=t.__service_list.slice(),c.declareMethod=t.declareMethod,c.declareJob=t.declareJob,c.declareAcquiredMethod=t.declareAcquiredMethod,c.allowPublicAcquisition=t.allowPublicAcquisition,c.ready=t.ready,c.setState=t.setState,c.onStateChange=t.onStateChange,c.declareService=t.declareService,c.onEvent=t.onEvent,c.onLoop=t.onLoop,c.prototype=new t,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=N.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c}function H(b,d,e){var h,i,j=N.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(i in j)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));return b.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)S[c[b]]=null;for(b=0;b<d.length;b+=1)T[d[b]]=null;U.shift()}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&u(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&u(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")&&void 0!==h._gadget&&a.contains(h)&&y(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&y(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),e})}function I(){var a=new t;return a.__acquired_method_dict={reportServiceError:function(a){r(a[0])}},a.__aq_parent=function(a){throw new N.AcquisitionError("No gadget provides "+a)},a}function J(a){var d,f,g,h,i,j,k,l;if(R.hasOwnProperty(a))throw new Error("bootstrap should not be called twice");return d=B,d.__ready_list=t.__ready_list.slice(),d.__service_list=t.__service_list.slice(),d.prototype.__path=a,f=new B,A(f,I()),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,(new c.Queue).push(function(){return c.delay(1e3)}).push(function(){return l[2]=void 0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a,b;for(h=function(a){i.push(new c.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){var c=t.declareMethod.apply(this,[a,b]);return h(a),c},d.declareService=t.declareService,d.declareJob=t.declareJob,d.onEvent=t.onEvent,d.onLoop=t.onLoop,d.declareAcquiredMethod=t.declareAcquiredMethod,d.allowPublicAcquisition=t.allowPublicAcquisition,d.prototype.__acquired_method_dict={},U.push(d),j}function K(a,b){function d(){return b}function e(a){return function(b){return a.call(b,b)}}var f,g=new c.Queue;for(a.ready(function(){return y(this)}),g.push(d),f=0;f<a.__ready_list.length;f+=1)g.push(e(a.__ready_list[f])).push(d);return g}function L(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){return new c.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)})}function M(a){var b,d,e,f,g=J(a);return(new c.Queue).push(function(){return g}).push(function(a){return b=a[0],d=a[1],e=a[2],f=a[3],Q.promise}).push(function(){return c.all(f)}).push(function(c){return void 0!==e&&L(b,d,e),H(b,a,d)}).push(function(){return K(b,d)}).push(function(){void 0!==e&&e.notify({method:"ready"})}).push(void 0,function(a){throw r(a),void 0!==e&&e.notify({method:"failed",params:a.toString()}),a})}var N,O,P,Q,R={},S={},T={},U=[],V=0,W=new RegExp("^(?:[a-z]+:)?//|data:","i"),X=!1,Y=[];b.addEventListener("error",function(a){Y.push(a)}),b.addEventListener("beforeunload",function(){X=!0}),P=function(){return this instanceof P?void(this._latest_defer=null):new P},P.prototype={constructor:P,lock:function(){var a=this._latest_defer,b=c.defer(),d=new c.Queue;return this._latest_defer=b,null!==a&&d.push(function(){return a.promise}),d.fail(b.resolve.bind(b)),d.push(function(){return function(a){return(new c.Queue).push(function(){return a()}).push(function(a){return b.resolve(a),a},function(a){throw b.resolve(a),a})}})},lockAndRun:function(a){return this.lock().push(function(b){return b(a)})}},s.prototype=new Error,s.prototype.constructor=s,O=function(){function a(){var a,b=g.length;for(a=0;b>a;a+=1)g[a].cancel();g=[]}var b,d,e,f=this,g=[];return this instanceof O?(b=new c.Promise(function(b,c){d=function(b){return e?void 0:(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)throw new s;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,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){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b});return g.push(b),this})):new O},O.prototype=Object.create(c.Promise.prototype),O.prototype.constructor=O,t.prototype.__title="",t.prototype.__interface_list=[],t.prototype.__path="",t.prototype.__html="",t.prototype.__required_css_list=[],t.prototype.__required_js_list=[],t.__ready_list=[v,w],t.ready=function(a){return this.__ready_list.push(a),this},t.setState=function(a){var b=JSON.stringify(a);return this.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},t.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},t.__service_list=[],t.declareService=function(a){return this.__service_list.push(a),this},t.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return n(this.element,a,c,b.bind(this),d)}),this},t.onLoop=function(a,b){return void 0===b&&(b=0),this.__service_list.push(function(){var d=new c.Queue,e=this,f=function(){d.push(function(){return c.delay(b)}).push(function(){return o()}).push(function(){return a.apply(e,[])}).push(f)};return f(),d}),this},t.declareJob=function(a,b){return this.prototype[a]=function(){var c=this,d=arguments;c.__job_triggered?x(c,a,b,d):c.__job_list.push([a,b,d])},this},t.declareMethod=function(a,b,d){return this.prototype[a]=function(){function a(){return b.apply(f,g)}var e,f=this,g=arguments;return void 0!==d&&d.hasOwnProperty("mutex")?(e="__mutex_"+d.mutex,f.hasOwnProperty(e)||(f[e]=new P),f[e].lockAndRun(a)):(new c.Queue).push(a)},this},t.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,d,e=this,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(b in a)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);return f&&void 0!==e.__state_change_callback?(e.__modification_dict=d,(new c.Queue).push(function(){return e.__state_change_callback(d)}).push(function(a){return delete e.__modification_dict,a})):void 0},{mutex:"changestate"}),t.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},t.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),t.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),t.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},B.__ready_list=t.__ready_list.slice(),B.__service_list=t.__service_list.slice(),B.ready=t.ready,B.setState=t.setState,B.onStateChange=t.onStateChange,B.declareService=t.declareService,B.onEvent=t.onEvent,B.onLoop=t.onLoop,B.prototype=new t,B.prototype.constructor=B,D.__ready_list=t.__ready_list.slice(),D.ready=t.ready,D.setState=t.setState,D.onStateChange=t.onStateChange,D.__service_list=t.__service_list.slice(),D.declareService=t.declareService,D.onEvent=t.onEvent,D.onLoop=t.onLoop,D.prototype=new t,D.prototype.constructor=D,t.declareMethod("declareGadget",function(b,d){var e=this;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=N.getAbsoluteURL(b,this.__path),(new c.Queue).push(function(){var a;if("public"===d.sandbox)a=C;else if("iframe"===d.sandbox)a=E;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=F}return a(b,d,e)}).push(function(f){function g(){return f}function h(a){return function(){return a.call(f,f)}}var i,j,k=new c.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void 0===j)for(j="RJS_"+V,V+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+V,V+=1;return e.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(y),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),N=function(a){var c;if(a===b&&(c=U[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},N.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},N.AcquisitionError.prototype=new Error,N.AcquisitionError.prototype.constructor=N.AcquisitionError,N.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},N.declareJS=function(b,d,e){var f;return S.hasOwnProperty(b)?f=c.resolve():(S[b]=null,f=new c.Promise(function(c,f){var g;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&U.shift(),c()},g.onerror=function(a){e===!0&&U.shift(),f(a)},g.src=b,d.appendChild(g)})),f},N.declareCSS=function(b,d){var e;return e=T.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){T[b]=null,c()},f.onerror=e,d.appendChild(f)})},N.declareGadgetKlass=function(b){var d,e;return R.hasOwnProperty(b)?R[b].hasOwnProperty("defer_list")?(e=c.defer(),R[b].defer_list.push(e),e.promise):R[b].is_resolved?c.resolve(R[b].result):c.reject(R[b].result):(R[b]={defer_list:[]},(new c.Queue).push(function(){return p(b)}).push(function(e){d=G(e,b);var f,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(U.push(d),f=0;f<i.length-1;f+=1)h.push(N.declareJS(i[f],g));h.push(N.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(N.declareCSS(j[f],g));return a.head.appendChild(g),c.all(h)}).push(function(){var a,c=R[b].defer_list.length;for(a=0;c>a;a+=1)R[b].defer_list[a].resolve(d);return delete R[b].defer_list,R[b].result=d,R[b].is_resolved=!0,d}).push(void 0,function(a){var c,d=R[b].defer_list.length;for(c=0;d>c;c+=1)R[b].defer_list[c].reject(a);throw delete R[b].defer_list,R[b].result=a,R[b].is_resolved=!1,a}))},N.clearGadgetKlassList=function(){R={},S={},T={}},N.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!W.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(N.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(N.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(N.getAbsoluteURL(d.getAttribute("src"),b)));return e},N.Mutex=P,b.rJS=b.renderJS=N,b.__RenderJSGadget=t,b.__RenderJSEmbeddedGadget=B,b.__RenderJSIframeGadget=D,Q=new c.defer,N.manualBootstrap=function(){Q.resolve()},a.addEventListener("DOMContentLoaded",Q.resolve,!1),M(q(b.location.href))}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a){"use strict";function b(b,c){var d,e,f,g="<!doctype><html><head></head></html>";return b&&c?(d=(new a).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}function c(a,c){if(void 0!==c){if(!e.test(c))throw new TypeError("Failed to construct 'URL': Invalid base URL");a=b(a,c)}if(!e.test(a))throw new TypeError("Failed to construct 'URL': Invalid URL");this.href=a}try{if("https://example.com/a"===new window.URL("../a","https://example.com/").href)return}catch(d){}var e=/^(?:[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";function m(a,b,d){var e;try{e=a.apply(d,b)}catch(f){return(new c.Queue).push(function(){return c.reject(f)})}return e instanceof c.Queue?e:(new c.Queue).push(function(){return e})}function n(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function o(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function p(){function a(){b.cancelAnimationFrame(e)}function d(a){e=b.requestAnimationFrame(a)}var e;return new c.Promise(d,a)}function q(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function r(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function s(c){var d,e,f,g,h,i;if(_)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(aa.push(c),aa.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<aa.length;d+=1){if(i=aa[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&aa.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function t(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function u(){return this instanceof u?void 0:new u}function v(a){a.hasOwnProperty("__monitor")&&(a.__monitor.cancel(),delete a.__monitor,a.__job_list=[])}function w(a){a.__monitor=new S,a.__job_dict={},a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(s)}function x(a){a.__sub_gadget_dict={},a.__job_list=[],void 0!==a.__json_state&&(a.state=JSON.parse(a.__json_state))}function y(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function z(a,b,d,e){var f=m(d,e,a);a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function A(a){(0!==a.constructor.__service_list.length||a.constructor.__job_declared)&&(w(a),a.__monitor.monitor((new c.Queue).push(function(){var b,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})))}function B(a,b,c){var d,e,f=this,g=f.__acquired_method_dict||{};if(!g.hasOwnProperty(b))return f.__aq_parent(b,c);for(d in f.__sub_gadget_dict)f.__sub_gadget_dict.hasOwnProperty(d)&&f.__sub_gadget_dict[d]===a&&(e=d);return m(g[b],[c,e],f).push(void 0,function(a){if(a instanceof R.AcquisitionError)return f.__aq_parent(b,c);throw a})}function C(a,b){a.__aq_parent=function(c,d){return B.apply(b,[a,c,d])}}function D(){return this instanceof D?void u.call(this):new D}function E(b,c,d){void 0===c.element&&(c.element=a.createElement("div"));var e,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=c.element,f.state={},e=0;e<g.length;e+=1)h.appendChild(g[e].cloneNode(!0));return f.element.appendChild(h),C(f,d),f}function F(a,b,c){var d=R.declareGadgetKlass(a);return"function"==typeof d.then?d.then(function(a){return E(a,b,c)}):E(d,b,c)}function G(){return this instanceof G?void u.call(this):new G}function H(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new G,C(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return m(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){(new c.Queue).push(function(){return g.__aq_parent.apply(g,b)}).then(a.complete).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function I(a,b,e){return(new c.Queue).push(function(){return q(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),n(c)}).push(function(a){return H(a,b,e)})}function J(b,d,e,f){function g(a){return function(){return a.call(b,b)}}function h(){return a.contains(b.element)&&A(b),b}var i,j,k;if(x(b),j=d.scope,void 0===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=new c.Queue,i=0;i<b.constructor.__ready_list.length;i+=1)k.push(g(b.constructor.__ready_list[i]));return k.push(h),k}return h()}function K(a,b){var c,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=new u,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=R.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c.__template_element.querySelectorAll("[data-gadget-url]").length&&c.__ready_list.push(y),c}function L(b,d,e){var h,i,j=R.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(i in j)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));return b.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){var b,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(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&v(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==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")&&void 0!==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)&&void 0!==h._gadget&&A(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),e})}function M(){var a=new u;return a.__acquired_method_dict={reportServiceError:function(a){s(a[0])}},a.__aq_parent=function(a){throw new R.AcquisitionError("No gadget provides "+a)},a}function N(a){var d,f,g,h,i,j,k,l;if(V.hasOwnProperty(a))throw new Error("bootstrap should not be called twice");return d=D,d.__ready_list=[],d.__service_list=u.__service_list.slice(),d.prototype.__path=a,f=new D,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,(new c.Queue).push(function(){return c.delay(1e3)}).push(function(){return l[2]=void 0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a,b;for(h=function(a){i.push(new c.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){var c=u.declareMethod.apply(this,[a,b]);return h(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}function O(a,b){function d(a){return function(){return a.call(b,b)}}var e,f=new c.Queue;for(a.ready(function(){return A(b)}),e=0;e<a.__ready_list.length;e+=1)f.push(d(a.__ready_list[e]));return f}function P(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){return new c.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)})}function Q(a){var b,d,e,f,g=N(a);return(new c.Queue).push(function(){return g}).push(function(a){return b=a[0],d=a[1],e=a[2],f=a[3],U.promise}).push(function(){return c.all(f)}).push(function(c){return void 0!==e&&P(b,d,e),L(b,a,d)}).push(function(){return x(d),b.__ready_list.unshift(y),O(b,d)}).push(function(){void 0!==e&&e.notify({method:"ready"})}).push(void 0,function(a){throw s(a),void 0!==e&&e.notify({method:"failed",params:a.toString()}),a})}var R,S,T,U,V={},W={},X={},Y=[],Z=0,$=new RegExp("^(?:[a-z]+:)?//|data:","i"),_=!1,aa=[];b.addEventListener("error",function(a){aa.push(a)}),b.addEventListener("beforeunload",function(){_=!0}),T=function(){return this instanceof T?void(this._latest_promise=null):new T},T.prototype={constructor:T,lockAndRun:function(a){var b=this._latest_promise;return null===b?this._latest_promise=c.resolve(a()):this._latest_promise=this._latest_promise.always(function(){return a()}),this._latest_promise}},t.prototype=new Error,t.prototype.constructor=t,S=function(){function a(){var a,b=g.length;for(a=0;b>a;a+=1)g[a].cancel();g=[]}var b,d,e,f=this,g=[];return this instanceof S?(b=new c.Promise(function(b,c){d=function(b){return e?void 0:(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)throw new t;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,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){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b});return g.push(b),this})):new S},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){return this.__ready_list.push(a),this},u.setState=function(a){return this.prototype.__json_state=JSON.stringify(a),this},u.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},u.__service_list=[],u.declareService=function(a){return this.__service_list.push(a),this},u.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return o(this.element,a,c,b.bind(this),d)}),this},u.onLoop=function(a,b){return void 0===b&&(b=0),this.__service_list.push(function(){var d=new c.Queue,e=this,f=function(){d.push(function(){return c.delay(b)}).push(function(){return p()}).push(function(){return a.apply(e,[])}).push(f)};return f(),d}),this},u.declareJob=function(a,b){return this.__job_declared=!0,this.prototype[a]=function(){var c=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){return this.prototype[a]=function(){function a(){return b.apply(e,f)}var d,e=this,f=arguments;return void 0!==c&&c.hasOwnProperty("mutex")?(d="__mutex_"+c.mutex,e.hasOwnProperty(d)||(e[d]=new T),m(e[d].lockAndRun,[a],e[d])):m(b,f,e)},this},u.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,c,d=this,e=!1,f=d.hasOwnProperty("__modification_dict");f?(c=d.__modification_dict,e=!0):c={};for(b in a)a.hasOwnProperty(b)&&a[b]!==d.state[b]&&(d.state[b]=a[b],c[b]=a[b],e=!0);return e&&void 0!==d.__state_change_callback?(d.__modification_dict=c,m(d.__state_change_callback,[c],d).push(function(a){return delete d.__modification_dict,a})):void 0},{mutex:"changestate"}),u.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),c=this;return m(c.__aq_parent,[b,a],c)},this},u.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),u.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),u.allowPublicAcquisition=function(a,b){return this.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=new u,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=new u,G.prototype.constructor=G,u.declareMethod("declareGadget",function(a,b){var d,e,f=this;if(void 0===b&&(b={}),void 0===b.sandbox&&(b.sandbox="public"),a=R.getAbsoluteURL(a,this.__path),"public"===b.sandbox)d=F;else if("iframe"===b.sandbox)d=H;else{if("dataurl"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");d=I}return e=d(a,b,f),"function"==typeof e.then?(new c.Queue).push(function(){return e}).push(function(c){return J(c,b,f,a)}):J(e,b,f,a)}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),R=function(a){var c;if(a===b&&(c=Y[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},R.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},R.AcquisitionError.prototype=new Error,R.AcquisitionError.prototype.constructor=R.AcquisitionError,R.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},R.declareJS=function(b,d,e){var f;return W.hasOwnProperty(b)?f=c.resolve():(W[b]=null,f=new c.Promise(function(c,f){var g;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){var e;return e=X.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;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){var d,e;if(V.hasOwnProperty(b)){if(V[b].hasOwnProperty("defer_list"))return e=c.defer(),V[b].defer_list.push(e),e.promise;if(V[b].is_resolved)return V[b].result;throw V[b].result}return V[b]={defer_list:[]},(new c.Queue).push(function(){return q(b)}).push(function(e){d=K(e,b);var f,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));return a.head.appendChild(g),c.all(h)}).push(function(){var a,c=V[b].defer_list.length;for(a=0;c>a;a+=1)V[b].defer_list[a].resolve(d);return delete V[b].defer_list,V[b].result=d,V[b].is_resolved=!0,d}).push(void 0,function(a){var c,d=V[b].defer_list.length;for(c=0;d>c;c+=1)V[b].defer_list[c].reject(a);throw delete V[b].defer_list,V[b].result=a,V[b].is_resolved=!1,a})},R.clearGadgetKlassList=function(){V={},W={},X={}},R.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!$.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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)));return e},R.Mutex=T,b.rJS=b.renderJS=R,b.__RenderJSGadget=u,b.__RenderJSEmbeddedGadget=D,b.__RenderJSIframeGadget=G,U=new c.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
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a){"use strict";function b(b,c){var d,e,f,g="<!doctype><html><head></head></html>";return b&&c?(d=(new a).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}function c(a,c){if(void 0!==c){if(!e.test(c))throw new TypeError("Failed to construct 'URL': Invalid base URL");a=b(a,c)}if(!e.test(a))throw new TypeError("Failed to construct 'URL': Invalid URL");this.href=a}try{if("https://example.com/a"===new window.URL("../a","https://example.com/").href)return}catch(d){}var e=/^(?:[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";function m(a){if(this.name="scopeerror",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Scope Error"}function n(a,b,d){var e;try{e=a.apply(d,b)}catch(f){return(new c.Queue).push(function(){return c.reject(f)})}return e instanceof c.Queue?e:(new c.Queue).push(function(){return e})}function o(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function p(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function q(){function a(){b.cancelAnimationFrame(e)}function d(a){e=b.requestAnimationFrame(a)}var e;return new c.Promise(d,a)}function r(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function s(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function t(c){var d,e,f,g,h,i;if(aa)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(ba.push(c),ba.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<ba.length;d+=1){if(i=ba[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&ba.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function u(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function v(){return this instanceof v?void 0:new v}function w(a){a.hasOwnProperty("__monitor")&&(a.__monitor.cancel(),delete a.__monitor,a.__job_list=[])}function x(a){a.__monitor=new T,a.__job_dict={},a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(t)}function y(a){a.__sub_gadget_dict={},a.__job_list=[],void 0!==a.__json_state&&(a.state=JSON.parse(a.__json_state))}function z(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function A(a,b,d,e){var f=n(d,e,a);a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function B(a){(0!==a.constructor.__service_list.length||a.constructor.__job_declared)&&(x(a),a.__monitor.monitor((new c.Queue).push(function(){var b,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})))}function C(a,b,c){var d,e,f=this,g=f.__acquired_method_dict||{};if(!g.hasOwnProperty(b))return f.__aq_parent(b,c);for(d in f.__sub_gadget_dict)f.__sub_gadget_dict.hasOwnProperty(d)&&f.__sub_gadget_dict[d]===a&&(e=d);return n(g[b],[c,e],f).push(void 0,function(a){if(a instanceof S.AcquisitionError)return f.__aq_parent(b,c);throw a})}function D(a,b){a.__aq_parent=function(c,d){return C.apply(b,[a,c,d])}}function E(){return this instanceof E?void v.call(this):new E}function F(b,c,d){void 0===c.element&&(c.element=a.createElement("div"));var e,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=c.element,f.state={},e=0;e<g.length;e+=1)h.appendChild(g[e].cloneNode(!0));return f.element.appendChild(h),D(f,d),f}function G(a,b,c){var d=S.declareGadgetKlass(a);return"function"==typeof d.then?d.then(function(a){return F(a,b,c)}):F(d,b,c)}function H(){return this instanceof H?void v.call(this):new H}function I(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new H,D(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return n(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){(new c.Queue).push(function(){return g.__aq_parent.apply(g,b)}).then(a.complete).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function J(a,b,e){return(new c.Queue).push(function(){return r(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),o(c)}).push(function(a){return I(a,b,e)})}function K(b,d,e,f){function g(a){return function(){return a.call(b,b)}}function h(){return a.contains(b.element)&&B(b),b}var i,j,k;if(y(b),j=d.scope,void 0===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=new c.Queue,i=0;i<b.constructor.__ready_list.length;i+=1)k.push(g(b.constructor.__ready_list[i]));return k.push(h),k}return h()}function L(a,b){var c,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=new v,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=S.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c.__template_element.querySelectorAll("[data-gadget-url]").length&&c.__ready_list.push(z),c}function M(b,d,e){var h,i,j=S.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(i in j)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));return b.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){var b,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(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&w(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==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")&&void 0!==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)&&void 0!==h._gadget&&B(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),e})}function N(){var a=new v;return a.__acquired_method_dict={reportServiceError:function(a){t(a[0])}},a.__aq_parent=function(a){throw new S.AcquisitionError("No gadget provides "+a)},a}function O(a){var d,f,g,h,i,j,k,l;if(W.hasOwnProperty(a))throw new Error("bootstrap should not be called twice");return d=E,d.__ready_list=[],d.__service_list=v.__service_list.slice(),d.prototype.__path=a,f=new E,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,(new c.Queue).push(function(){return c.delay(1e3)}).push(function(){return l[2]=void 0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a,b;for(h=function(a){i.push(new c.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){var c=v.declareMethod.apply(this,[a,b]);return h(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}function P(a,b){function d(a){return function(){return a.call(b,b)}}var e,f=new c.Queue;for(a.ready(function(){return B(b)}),e=0;e<a.__ready_list.length;e+=1)f.push(d(a.__ready_list[e]));return f}function Q(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){return new c.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)})}function R(a){var b,d,e,f,g=O(a);return(new c.Queue).push(function(){return g}).push(function(a){return b=a[0],d=a[1],e=a[2],f=a[3],V.promise}).push(function(){return c.all(f)}).push(function(c){return void 0!==e&&Q(b,d,e),M(b,a,d)}).push(function(){return y(d),b.__ready_list.unshift(z),P(b,d)}).push(function(){void 0!==e&&e.notify({method:"ready"})}).push(void 0,function(a){throw t(a),void 0!==e&&e.notify({method:"failed",params:a.toString()}),a})}m.prototype=new Error,m.prototype.constructor=m;var S,T,U,V,W={},X={},Y={},Z=[],$=0,_=new RegExp("^(?:[a-z]+:)?//|data:","i"),aa=!1,ba=[];b.addEventListener("error",function(a){ba.push(a)}),b.addEventListener("beforeunload",function(){aa=!0}),U=function(){return this instanceof U?void(this._latest_promise=null):new U},U.prototype={constructor:U,lockAndRun:function(a){var b=this._latest_promise;return null===b?this._latest_promise=c.resolve(a()):this._latest_promise=this._latest_promise.always(function(){return a()}),this._latest_promise}},u.prototype=new Error,u.prototype.constructor=u,T=function(){function a(){var a,b=g.length;for(a=0;b>a;a+=1)g[a].cancel();g=[]}var b,d,e,f=this,g=[];return this instanceof T?(b=new c.Promise(function(b,c){d=function(b){return e?void 0:(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)throw new u;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,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){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b});return g.push(b),this})):new T},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){return this.__ready_list.push(a),this},v.setState=function(a){return this.prototype.__json_state=JSON.stringify(a),this},v.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},v.__service_list=[],v.declareService=function(a){return this.__service_list.push(a),this},v.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return p(this.element,a,c,b.bind(this),d)}),this},v.onLoop=function(a,b){return void 0===b&&(b=0),this.__service_list.push(function(){var d=new c.Queue,e=this,f=function(){d.push(function(){return c.delay(b)}).push(function(){return q()}).push(function(){return a.apply(e,[])}).push(f)};return f(),d}),this},v.declareJob=function(a,b){return this.__job_declared=!0,this.prototype[a]=function(){var c=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){return this.prototype[a]=function(){function a(){return b.apply(e,f)}var d,e=this,f=arguments;return void 0!==c&&c.hasOwnProperty("mutex")?(d="__mutex_"+c.mutex,e.hasOwnProperty(d)||(e[d]=new U),n(e[d].lockAndRun,[a],e[d])):n(b,f,e)},this},v.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,c,d=this,e=!1,f=d.hasOwnProperty("__modification_dict");f?(c=d.__modification_dict,e=!0):c={};for(b in a)a.hasOwnProperty(b)&&a[b]!==d.state[b]&&(d.state[b]=a[b],c[b]=a[b],e=!0);return e&&void 0!==d.__state_change_callback?(d.__modification_dict=c,n(d.__state_change_callback,[c],d).push(function(a){return delete d.__modification_dict,a})):void 0},{mutex:"changestate"}),v.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),c=this;return n(c.__aq_parent,[b,a],c)},this},v.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),v.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),v.allowPublicAcquisition=function(a,b){return this.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=new v,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=new v,H.prototype.constructor=H,v.declareMethod("declareGadget",function(a,b){var d,e,f=this;if(void 0===b&&(b={}),void 0===b.sandbox&&(b.sandbox="public"),a=S.getAbsoluteURL(a,this.__path),"public"===b.sandbox)d=G;else if("iframe"===b.sandbox)d=I;else{if("dataurl"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");d=J}return e=d(a,b,f),"function"==typeof e.then?(new c.Queue).push(function(){return e}).push(function(c){return K(c,b,f,a)}):K(e,b,f,a)}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new m("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new m("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),S=function(a){var c;if(a===b&&(c=Z[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},S.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},S.AcquisitionError.prototype=new Error,S.AcquisitionError.prototype.constructor=S.AcquisitionError,S.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},S.declareJS=function(b,d,e){var f;return X.hasOwnProperty(b)?f=c.resolve():(X[b]=null,f=new c.Promise(function(c,f){var g;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){var e;return e=Y.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;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){var d,e;if(W.hasOwnProperty(b)){if(W[b].hasOwnProperty("defer_list"))return e=c.defer(),W[b].defer_list.push(e),e.promise;if(W[b].is_resolved)return W[b].result;throw W[b].result}return W[b]={defer_list:[]},(new c.Queue).push(function(){return r(b)}).push(function(e){d=L(e,b);var f,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));return a.head.appendChild(g),c.all(h)}).push(function(){var a,c=W[b].defer_list.length;for(a=0;c>a;a+=1)W[b].defer_list[a].resolve(d);return delete W[b].defer_list,W[b].result=d,W[b].is_resolved=!0,d}).push(void 0,function(a){var c,d=W[b].defer_list.length;for(c=0;d>c;c+=1)W[b].defer_list[c].reject(a);throw delete W[b].defer_list,W[b].result=a,W[b].is_resolved=!1,a})},S.clearGadgetKlassList=function(){W={},X={},Y={}},S.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!_.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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)));return e},S.Mutex=U,S.ScopeError=m,b.rJS=b.renderJS=S,b.__RenderJSGadget=v,b.__RenderJSEmbeddedGadget=E,b.__RenderJSIframeGadget=H,V=new c.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);
\ No newline at end of file
!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(){return this instanceof g?void 0:new g}function h(){return this instanceof h?(g.call(this),void 0):new h}function i(b,d){var e;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return o.declareGadgetKlass(b)}).push(function(a){var b,f=a.template_element.body.childNodes;for(m=a,e=new a,e.element=d.element,b=0;b<f.length;b+=1)e.element.appendChild(f[b].cloneNode(!0));return c.all([e.getRequiredJSList(),e.getRequiredCSSList()])}).push(function(a){var b,d=[];for(b=0;b<a[0].length;b+=1)d.push(o.declareJS(a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(o.declareCSS(a[1][b]));return c.all(d)}).push(function(){return e})}function j(){return this instanceof j?(g.call(this),void 0):new j}function k(b,d){var g,h,i,k=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)throw new Error("The parent element is not attached to the DOM for "+b);return g=new j,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){return g[b]=function(){var a=arguments;return new c.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(){return k.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){return k.reject(b),"OK"}),c.any([k.promise,c.timeout(5e3)])}function l(){var d,i,j,k,l,s=b.location.href,t=0,u=!1;if(p.hasOwnProperty(s))throw new Error("bootstrap should not be called twice");n=new c.Promise(function(n,v){function w(){var b,e,g=o.parseGadgetHTMLDocument(a);for(e in g)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){function b(){return i}var e,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=new c.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]),g.push(b);return g.push(n,function(a){throw v(a),a}),g}).fail(function(a){v(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=new g,d.prototype.constructor=d,d.prototype.path=s,p[s]=d,i=new p[s]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=new h,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===t&&u===!0&&j.notify({method:"ready"})},l=function(a){t+=1,j.call({method:"declareMethod",params:a,success:function(){t-=1,k()},error:function(){t-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){var c=g.declareMethod.apply(this,[a,b]);return l(a),c}),m=d,a.addEventListener("DOMContentLoaded",w,!1)}),b.self!==b.top&&n.then(function(){u=!0,k()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var m,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],g.ready_list=[],g.ready=function(a){return this.ready_list.push(a),this},g.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){return this.interface_list}).declareMethod("getRequiredCSSList",function(){return this.required_css_list}).declareMethod("getRequiredJSList",function(){return this.required_js_list}).declareMethod("getPath",function(){return this.path}).declareMethod("getTitle",function(){return this.title}).declareMethod("getElement",function(){if(this.element===f)throw new Error("No element defined");return this.element}),h.ready_list=[],h.ready=g.ready,h.prototype=new g,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=new g,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){var d,e=n;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(new c.Queue).push(function(){return e}).push(function(){var c;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=k}return c(a,b)}).push(function(a){function b(){return a}var c;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);return a}).push(f,function(a){throw m=f,a}),n=d},o=function(a){var c;if(a===b?c=m:a instanceof g&&(c=a),c===f)throw new Error("Unknown selector '"+a+"'");return c},o.declareJS=function(b){var d;return d=q.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){var d;return d=r.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){function b(){var b,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=new g,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(new d).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(c in e)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}return p[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function h(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=p.hasOwnProperty(a)?c.resolve(p[a]):new c.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){var b,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));return d},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(){return this instanceof g?void 0:new g}function h(){return this instanceof h?(g.call(this),void 0):new h}function i(b,d){var e;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return o.declareGadgetKlass(b)}).push(function(a){var b,f=a.template_element.body.childNodes;for(m=a,e=new a,e.element=d.element,b=0;b<f.length;b+=1)e.element.appendChild(f[b].cloneNode(!0));return c.all([e.getRequiredJSList(),e.getRequiredCSSList()])}).push(function(a){var b,d=[];for(b=0;b<a[0].length;b+=1)d.push(o.declareJS(a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(o.declareCSS(a[1][b]));return c.all(d)}).push(function(){return e})}function j(){return this instanceof j?(g.call(this),void 0):new j}function k(b,d){var g,h,i,k=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)throw new Error("The parent element is not attached to the DOM for "+b);return g=new j,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){return g[b]=function(){var a=arguments;return new c.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(){return k.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){return k.reject(b),"OK"}),c.any([k.promise,c.timeout(5e3)])}function l(){var d,i,j,k,l,s=b.location.href,t=0,u=!1;if(p.hasOwnProperty(s))throw new Error("bootstrap should not be called twice");n=new c.Promise(function(n,v){function w(){var b,e,g=o.parseGadgetHTMLDocument(a);for(e in g)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){function b(){return i}var e,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=new c.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]),g.push(b);return g.push(n,function(a){throw v(a),a}),g}).fail(function(a){v(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=new g,d.prototype.constructor=d,d.prototype.path=s,p[s]=d,i=new p[s]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=new h,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===t&&u===!0&&j.notify({method:"ready"})},l=function(a){t+=1,j.call({method:"declareMethod",params:a,success:function(){t-=1,k()},error:function(){t-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){var c=g.declareMethod.apply(this,[a,b]);return l(a),c}),m=d,a.addEventListener("DOMContentLoaded",w,!1)}),b.self!==b.top&&n.then(function(){u=!0,k()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var m,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],g.ready_list=[],g.ready=function(a){return this.ready_list.push(a),this},g.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){return this.interface_list}).declareMethod("getRequiredCSSList",function(){return this.required_css_list}).declareMethod("getRequiredJSList",function(){return this.required_js_list}).declareMethod("getPath",function(){return this.path}).declareMethod("getTitle",function(){return this.title}).declareMethod("getElement",function(){if(this.element===f)throw new Error("No element defined");return this.element}),h.ready_list=[],h.ready=g.ready,h.prototype=new g,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=new g,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){var d,e=n;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(new c.Queue).push(function(){return e}).push(f,function(){}).push(function(){var c;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=k}return c(a,b)}).push(function(a){function b(){return a}var c;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);return a}).push(f,function(a){throw m=f,a}),n=d},o=function(a){var c;if(a===b?c=m:a instanceof g&&(c=a),c===f)throw new Error("Unknown selector '"+a+"'");return c},o.declareJS=function(b){var d;return d=q.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){var d;return d=r.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){function b(){var b,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=new g,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(new d).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(c in e)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}return p[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function h(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=p.hasOwnProperty(a)?c.resolve(p[a]):new c.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){var b,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));return d},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(){return this instanceof g?void 0:new g}function h(){return this instanceof h?(g.call(this),void 0):new h}function i(b,d){var e;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return o.declareGadgetKlass(b)}).push(function(a){var b,f=a.template_element.body.childNodes;for(m=a,e=new a,e.element=d.element,b=0;b<f.length;b+=1)e.element.appendChild(f[b].cloneNode(!0));return c.all([e.getRequiredJSList(),e.getRequiredCSSList()])}).push(function(a){var b,d=[];for(b=0;b<a[0].length;b+=1)d.push(o.declareJS(a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(o.declareCSS(a[1][b]));return c.all(d)}).push(function(){return e})}function j(){return this instanceof j?(g.call(this),void 0):new j}function k(b,d){var g,h,i,k=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)throw new Error("The parent element is not attached to the DOM for "+b);return g=new j,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){return g[b]=function(){var a=arguments;return new c.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(){return k.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){return k.reject(b),"OK"}),g.chan.bind("trigger",function(a,b){return g.trigger(b.event_name,b.options)}),c.any([k.promise,c.timeout(5e3)])}function l(){var d,i,j,k,l,s,t=b.location.href,u=0,v=!1;if(p.hasOwnProperty(t))throw new Error("bootstrap should not be called twice");n=new c.Promise(function(n,w){function x(){var b,e,g=o.parseGadgetHTMLDocument(a);for(e in g)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){function b(){return i}var e,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=new c.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]),g.push(b);return g.push(n,function(a){throw w(a),a}),g}).fail(function(a){w(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=new g,d.prototype.constructor=d,d.prototype.path=t,p[t]=d,i=new p[t]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=new h,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===u&&v===!0&&j.notify({method:"ready"})},l=function(a){u+=1,j.call({method:"declareMethod",params:a,success:function(){u-=1,k()},error:function(){u-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){var c=g.declareMethod.apply(this,[a,b]);return l(a),c},s=function(a,b){j.notify({method:"trigger",params:{event_name:a,options:b}})},d.prototype.trigger=function(a,b){var c=g.prototype.trigger.apply(this,[a,b]);return s(a,b),c}),m=d,a.addEventListener("DOMContentLoaded",x,!1)}),b.self!==b.top&&n.then(function(){v=!0,k()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var m,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],c.EventTarget.mixin(g.prototype),g.ready_list=[],g.ready=function(a){return this.ready_list.push(a),this},g.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){return this.interface_list}).declareMethod("getRequiredCSSList",function(){return this.required_css_list}).declareMethod("getRequiredJSList",function(){return this.required_js_list}).declareMethod("getPath",function(){return this.path}).declareMethod("getTitle",function(){return this.title}).declareMethod("getElement",function(){if(this.element===f)throw new Error("No element defined");return this.element}),h.ready_list=[],h.ready=g.ready,h.prototype=new g,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=new g,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){var d,e=n;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(new c.Queue).push(function(){return e}).push(f,function(){}).push(function(){var c;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=k}return c(a,b)}).push(function(a){function b(){return a}var c;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);return a}).push(f,function(a){throw m=f,a}),n=d},o=function(a){var c;if(a===b?c=m:a instanceof g&&(c=a),c===f)throw new Error("Unknown selector '"+a+"'");return c},o.declareJS=function(b){var d;return d=q.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){var d;return d=r.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){function b(){var b,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=new g,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(new d).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(c in e)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}return p[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function h(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=p.hasOwnProperty(a)?c.resolve(p[a]):new c.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){var b,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));return d},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(){return this instanceof g?void 0:new g}function h(){return this instanceof h?(g.call(this),void 0):new h}function i(b,d){var e;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return o.declareGadgetKlass(b)}).push(function(a){var b,f=a.template_element.body.childNodes;for(m=a,e=new a,e.element=d.element,b=0;b<f.length;b+=1)e.element.appendChild(f[b].cloneNode(!0));return c.all([e.getRequiredJSList(),e.getRequiredCSSList()])}).push(function(a){var b,d=[];for(b=0;b<a[0].length;b+=1)d.push(o.declareJS(a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(o.declareCSS(a[1][b]));return c.all(d)}).push(function(){return e})}function j(){return this instanceof j?(g.call(this),void 0):new j}function k(b,d){var g,h,i,k=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)throw new Error("The parent element is not attached to the DOM for "+b);return g=new j,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){return g[b]=function(){var a=arguments;return new c.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(){return k.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){return k.reject(b),"OK"}),g.chan.bind("trigger",function(a,b){return g.trigger(b.event_name,b.options)}),c.any([k.promise,c.timeout(5e3)])}function l(){var d,i,j,k,l,s,t=b.location.href,u=0,v=!1;if(p.hasOwnProperty(t))throw new Error("bootstrap should not be called twice");n=new c.Promise(function(n,w){function x(){var b,e,g=o.parseGadgetHTMLDocument(a);for(e in g)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){function b(){return i}var e,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=new c.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]),g.push(b);return g.push(n,function(a){throw w(a),a}),g}).fail(function(a){w(a),console.error(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=new g,d.prototype.constructor=d,d.prototype.path=t,p[t]=d,i=new p[t]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=new h,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===u&&v===!0&&j.notify({method:"ready"})},l=function(a){u+=1,j.call({method:"declareMethod",params:a,success:function(){u-=1,k()},error:function(){u-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){var c=g.declareMethod.apply(this,[a,b]);return l(a),c},s=function(a,b){j.notify({method:"trigger",params:{event_name:a,options:b}})},d.prototype.trigger=function(a,b){var c=g.prototype.trigger.apply(this,[a,b]);return s(a,b),c}),m=d,a.addEventListener("DOMContentLoaded",x,!1)}),b.self!==b.top&&n.then(function(){v=!0,k()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var m,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],c.EventTarget.mixin(g.prototype),g.ready_list=[],g.ready=function(a){return this.ready_list.push(a),this},g.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){return this.interface_list}).declareMethod("getRequiredCSSList",function(){return this.required_css_list}).declareMethod("getRequiredJSList",function(){return this.required_js_list}).declareMethod("getPath",function(){return this.path}).declareMethod("getTitle",function(){return this.title}).declareMethod("getElement",function(){if(this.element===f)throw new Error("No element defined");return this.element}),h.ready_list=[],h.ready=g.ready,h.prototype=new g,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=new g,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){var d,e=n;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(new c.Queue).push(function(){return e}).push(f,function(){}).push(function(){var c;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=k}return c(a,b)}).push(function(a){function b(){return a}var c;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);return a}).push(f,function(a){throw m=f,a}),n=d},o=function(a){var c;if(a===b?c=m:a instanceof g&&(c=a),c===f)throw new Error("Unknown selector '"+a+"'");return c},o.declareJS=function(b){var d;return d=q.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){var d;return d=r.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){function b(){var b,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=new g,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(new d).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(c in e)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}return p[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function h(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=p.hasOwnProperty(a)?c.resolve(p[a]):new c.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){var b,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));return d},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(){return this instanceof g?void 0:new g}function h(){return this instanceof h?(g.call(this),void 0):new h}function i(b,d){var e;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return o.declareGadgetKlass(b)}).push(function(a){var b,f=a.template_element.body.childNodes;for(m=a,e=new a,e.element=d.element,b=0;b<f.length;b+=1)e.element.appendChild(f[b].cloneNode(!0));return c.all([e.getRequiredJSList(),e.getRequiredCSSList()])}).push(function(a){var b,d=[];for(b=0;b<a[0].length;b+=1)d.push(o.declareJS(a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(o.declareCSS(a[1][b]));return c.all(d)}).push(function(){return e})}function j(){return this instanceof j?(g.call(this),void 0):new j}function k(b,d){var g,h,i,k=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)throw new Error("The parent element is not attached to the DOM for "+b);return g=new j,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){return g[b]=function(){var a=arguments;return new c.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(){return k.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){return k.reject(b),"OK"}),g.chan.bind("trigger",function(a,b){return g.trigger(b.event_name,b.options)}),c.any([k.promise,c.timeout(5e3)])}function l(){var d,i,j,k,l,s,t=b.location.href,u=0,v=!1;if(p.hasOwnProperty(t))throw new Error("bootstrap should not be called twice");n=new c.Promise(function(n,w){function x(){var b,e,g=o.parseGadgetHTMLDocument(a);for(e in g)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){function b(){return i}var e,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=new c.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]),g.push(b);return g.push(n,function(a){throw w(a),a}),g}).fail(function(a){w(a),console.error(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=new g,d.prototype.constructor=d,d.prototype.path=t,p[t]=d,i=new p[t]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=new h,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===u&&v===!0&&j.notify({method:"ready"})},l=function(a){u+=1,j.call({method:"declareMethod",params:a,success:function(){u-=1,k()},error:function(){u-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){var c=g.declareMethod.apply(this,[a,b]);return l(a),c},s=function(a,b){j.notify({method:"trigger",params:{event_name:a,options:b}})},d.prototype.trigger=function(a,b){var c=g.prototype.trigger.apply(this,[a,b]);return s(a,b),c}),m=d,a.addEventListener("DOMContentLoaded",x,!1)}),b.self!==b.top&&n.then(function(){v=!0,k()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var m,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],c.EventTarget.mixin(g.prototype),g.ready_list=[],g.ready=function(a){return this.ready_list.push(a),this},g.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){return this.interface_list}).declareMethod("getRequiredCSSList",function(){return this.required_css_list}).declareMethod("getRequiredJSList",function(){return this.required_js_list}).declareMethod("getPath",function(){return this.path}).declareMethod("getTitle",function(){return this.title}).declareMethod("getElement",function(){if(this.element===f)throw new Error("No element defined");return this.element}),h.ready_list=[],h.ready=g.ready,h.prototype=new g,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=new g,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){var d,e=n;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(new c.Queue).push(function(){return e}).push(f,function(){}).push(function(){var c;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=k}return c(a,b)}).push(function(a){function b(){return a}var c;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);return a}).push(f,function(a){throw m=f,a}),n=d},o=function(a){var c;if(a===b?c=m:a instanceof g&&(c=a),c===f)throw new Error("Unknown selector '"+a+"'");return c},o.declareJS=function(b){var d;return d=q.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){var d;return d=r.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){function b(){var b,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=new g,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(new d).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(c in e)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}return p[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function h(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=p.hasOwnProperty(a)?c.resolve(p[a]):new c.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){var b,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));return d},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(){return this instanceof g?void 0:new g}function h(){return this instanceof h?(g.call(this),void 0):new h}function i(b,d){function e(a,b){return function(){return a(b)}}var g;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return o.declareGadgetKlass(b)}).push(function(a){var b,e=a.template_element.body.childNodes;for(m=a,g=new a,g.element=d.element,b=0;b<e.length;b+=1)g.element.appendChild(e[b].cloneNode(!0));return c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(e(o.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(e(o.declareCSS,a[1][b]));return d}).push(function(){return g})}function j(){return this instanceof j?(g.call(this),void 0):new j}function k(b,d){var g,h,i,k=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)throw new Error("The parent element is not attached to the DOM for "+b);return g=new j,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){return g[b]=function(){var a=arguments;return new c.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(){return k.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){return k.reject(b),"OK"}),g.chan.bind("trigger",function(a,b){return g.trigger(b.event_name,b.options)}),c.any([k.promise,c.timeout(5e3)])}function l(){var d,i,j,k,l,s,t=b.location.href,u=0,v=!1;if(p.hasOwnProperty(t))throw new Error("bootstrap should not be called twice");n=new c.Promise(function(n,w){function x(){var b,e,g=o.parseGadgetHTMLDocument(a);for(e in g)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){function b(){return i}var e,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=new c.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]).push(b);return g.push(n,function(a){throw w(a),a}),g}).fail(function(a){w(a),console.error(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=new g,d.prototype.constructor=d,d.prototype.path=t,p[t]=d,i=new p[t]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=new h,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===u&&v===!0&&j.notify({method:"ready"})},l=function(a){u+=1,j.call({method:"declareMethod",params:a,success:function(){u-=1,k()},error:function(){u-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){var c=g.declareMethod.apply(this,[a,b]);return l(a),c},s=function(a,b){j.notify({method:"trigger",params:{event_name:a,options:b}})},d.prototype.trigger=function(a,b){var c=g.prototype.trigger.apply(this,[a,b]);return s(a,b),c}),m=d,a.addEventListener("DOMContentLoaded",x,!1)}),b.self!==b.top&&n.then(function(){v=!0,k()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var m,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],c.EventTarget.mixin(g.prototype),g.ready_list=[],g.ready=function(a){return this.ready_list.push(a),this},g.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){return this.interface_list}).declareMethod("getRequiredCSSList",function(){return this.required_css_list}).declareMethod("getRequiredJSList",function(){return this.required_js_list}).declareMethod("getPath",function(){return this.path}).declareMethod("getTitle",function(){return this.title}).declareMethod("getElement",function(){if(this.element===f)throw new Error("No element defined");return this.element}),h.ready_list=[],h.ready=g.ready,h.prototype=new g,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=new g,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){var d,e=n;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(new c.Queue).push(function(){return e}).push(f,function(){}).push(function(){var c;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=k}return c(a,b)}).push(function(a){function b(){return a}var c;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);return a}).push(f,function(a){throw m=f,a}),n=d},o=function(a){var c;if(a===b?c=m:a instanceof g&&(c=a),c===f)throw new Error("Unknown selector '"+a+"'");return c},o.declareJS=function(b){var d;return d=q.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){var d;return d=r.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){function b(){var b,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=new g,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(new d).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(c in e)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}return p[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function h(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=p.hasOwnProperty(a)?c.resolve(p[a]):new c.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){var b,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));return d},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(){return this instanceof g?void 0:new g}function h(){return this instanceof h?(g.call(this),void 0):new h}function i(b,d){function e(a,b){return function(){return a(b)}}var g;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return o.declareGadgetKlass(b)}).push(function(a){var b,e=a.template_element.body.childNodes;for(m=a,g=new a,g.element=d.element,b=0;b<e.length;b+=1)g.element.appendChild(e[b].cloneNode(!0));return c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(e(o.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(e(o.declareCSS,a[1][b]));return d}).push(function(){return g})}function j(){return this instanceof j?(g.call(this),void 0):new j}function k(b,d){var g,h,i,k=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)throw new Error("The parent element is not attached to the DOM for "+b);return g=new j,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){return g[b]=function(){var a=arguments;return new c.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(){return k.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){return k.reject(b),"OK"}),g.chan.bind("trigger",function(a,b){return g.trigger(b.event_name,b.options)}),c.any([k.promise,c.timeout(5e3)])}function l(){var d,i,j,k,l,s,t=b.location.href,u=0,v=!1;if(p.hasOwnProperty(t))throw new Error("bootstrap should not be called twice");n=new c.Promise(function(n,w){function x(){var b,e,g=o.parseGadgetHTMLDocument(a);for(e in g)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){function b(){return i}var e,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=new c.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]).push(b);return g.push(n,function(a){throw w(a),a}),g}).fail(function(a){w(a),console.error(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=new g,d.prototype.constructor=d,d.prototype.path=t,p[t]=d,i=new p[t]):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=new h,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===u&&v===!0&&j.notify({method:"ready"})},l=function(a){u+=1,j.call({method:"declareMethod",params:a,success:function(){u-=1,k()},error:function(){u-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){var c=g.declareMethod.apply(this,[a,b]);return l(a),c},s=function(a,b){j.notify({method:"trigger",params:{event_name:a,options:b}})},d.prototype.trigger=function(a,b){var c=g.prototype.trigger.apply(this,[a,b]);return s(a,b),c}),m=d,a.addEventListener("DOMContentLoaded",x,!1)}),b.self!==b.top&&n.then(function(){v=!0,k()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var m,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],c.EventTarget.mixin(g.prototype),g.ready_list=[],g.ready=function(a){return this.ready_list.push(a),this},g.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){return this.interface_list}).declareMethod("getRequiredCSSList",function(){return this.required_css_list}).declareMethod("getRequiredJSList",function(){return this.required_js_list}).declareMethod("getPath",function(){return this.path}).declareMethod("getTitle",function(){return this.title}).declareMethod("getElement",function(){if(this.element===f)throw new Error("No element defined");return this.element}),h.ready_list=[],h.ready=g.ready,h.prototype=new g,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=new g,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){var d,e=n;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(new c.Queue).push(function(){return e}).push(f,function(){}).push(function(){var c;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=k}return c(a,b)}).push(function(a){function b(){return a}var c;for(m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);return a}).push(f,function(a){throw m=f,a}),n=d},o=function(a){var c;if(a===b&&(c=m),c===f)throw new Error("Unknown selector '"+a+"'");return c},o.declareJS=function(b){var d;return d=q.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){var d;return d=r.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){function b(){var b,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=new g,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(new d).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(c in e)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}return p[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function h(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=p.hasOwnProperty(a)?c.resolve(p[a]):new c.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){var b,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));return d},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(){return this instanceof g?void 0:new g}function h(){return this instanceof h?(g.call(this),void 0):new h}function i(b,d){function e(a,b){return function(){return a(b)}}var g;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return o.declareGadgetKlass(b)}).push(function(a){var b,e=a.template_element.body.childNodes;for(m=a,g=new a,g.element=d.element,b=0;b<e.length;b+=1)g.element.appendChild(e[b].cloneNode(!0));return c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(e(o.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(e(o.declareCSS,a[1][b]));return d}).push(function(){return g})}function j(){return this instanceof j?(g.call(this),void 0):new j}function k(b,d){var g,h,i,k=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(i=d.element.parentNode;null!==i&&i!==a;)i=i.parentNode;if(null===i)throw new Error("The parent element is not attached to the DOM for "+b);return g=new j,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){return g[b]=function(){var a=arguments;return new c.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(){return k.resolve(g),"OK"}),g.chan.bind("failed",function(a,b){return k.reject(b),"OK"}),g.chan.bind("trigger",function(a,b){return g.trigger(b.event_name,b.options)}),g.chan.bind("acquire",function(a,b){g.acquire.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),c.any([k.promise,c.timeout(5e3)])}function l(){var d,i,j,k,l,s,t=b.location.href,u=0,v=!1;if(p.hasOwnProperty(t))throw new Error("bootstrap should not be called twice");n=new c.Promise(function(n,w){function x(){var b,e,g=o.parseGadgetHTMLDocument(a);for(e in g)g.hasOwnProperty(e)&&(d.prototype[e]=g[e]);for(d.template_element=a.createElement("div"),i.element=a.body,b=0;b<i.element.childNodes.length;b+=1)d.template_element.appendChild(i.element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){function b(){return i}var e,g,h=a[0],j=a[1];for(e=0;e<h.length;e+=1)q[h[e]]=null;for(e=0;e<j.length;e+=1)r[j[e]]=null;for(m=f,g=new c.Queue,g.push(b),e=0;e<d.ready_list.length;e+=1)g.push(d.ready_list[e]).push(b);return g.push(n,function(a){throw w(a),a}),g}).fail(function(a){w(a),console.error(a)})}b.self===b.top?(d=function(){g.call(this)},d.declareMethod=g.declareMethod,d.ready_list=[],d.ready=g.ready,d.prototype=new g,d.prototype.constructor=d,d.prototype.path=t,p[t]=d,i=new p[t],i.aq_parent=function(a){throw new o.AcquisitionError("No gadget provides "+a)}):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=h,i=new h,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===u&&v===!0&&j.notify({method:"ready"})},l=function(a){u+=1,j.call({method:"declareMethod",params:a,success:function(){u-=1,k()},error:function(){u-=1}})},l("getInterfaceList"),l("getRequiredCSSList"),l("getRequiredJSList"),l("getPath"),l("getTitle"),d.declareMethod=function(a,b){var c=g.declareMethod.apply(this,[a,b]);return l(a),c},s=function(a,b){j.notify({method:"trigger",params:{event_name:a,options:b}})},d.prototype.trigger=function(a,b){var c=g.prototype.trigger.apply(this,[a,b]);return s(a,b),c},d.prototype.aq_parent=function(a,b){return new c.Promise(function(c,d){j.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){d(a)}})})}),m=d,a.addEventListener("DOMContentLoaded",x,!1)}),b.self!==b.top&&n.then(function(){v=!0,k()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var m,n,o,p={},q={},r={};g.prototype.title="",g.prototype.interface_list=[],g.prototype.path="",g.prototype.html="",g.prototype.required_css_list=[],g.prototype.required_js_list=[],c.EventTarget.mixin(g.prototype),g.ready_list=[],g.ready=function(a){return this.ready_list.push(a),this},g.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},g.declareMethod("getInterfaceList",function(){return this.interface_list}).declareMethod("getRequiredCSSList",function(){return this.required_css_list}).declareMethod("getRequiredJSList",function(){return this.required_js_list}).declareMethod("getPath",function(){return this.path}).declareMethod("getTitle",function(){return this.title}).declareMethod("getElement",function(){if(this.element===f)throw new Error("No element defined");return this.element}).declareMethod("acquire",function(){var a=this,b=arguments;return(new c.Queue).push(function(){var c=a.aq_dynamic;if(c!==f)return c.apply(a,b);throw new o.AcquisitionError("aq_dynamic is not defined")}).push(f,function(c){if(c instanceof o.AcquisitionError)return a.aq_parent.apply(a,b);throw c})}),h.ready_list=[],h.ready=g.ready,h.prototype=new g,h.prototype.constructor=h,j.ready_list=[],j.ready=g.ready,j.prototype=new g,j.prototype.constructor=j,g.prototype.declareGadget=function(a,b){var d,e=this,g=n;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),d=(new c.Queue).push(function(){return g}).push(f,function(){}).push(function(){var c;if("public"===b.sandbox)c=i;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=k}return c(a,b)}).push(function(a){function b(){return a}var c;for(a.aq_parent=function(a,b){return e.acquire(a,b)},m=f,c=0;c<a.constructor.ready_list.length;c+=1)d.push(a.constructor.ready_list[c]),d.push(b);return a}).push(f,function(a){throw m=f,a}),n=d},o=function(a){var c;if(a===b&&(c=m),c===f)throw new Error("Unknown selector '"+a+"'");return c},o.AcquisitionError=function(a){if(this.name="AcquisitionError",a!==f&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},o.AcquisitionError.prototype=new Error,o.AcquisitionError.prototype.constructor=o.AcquisitionError,o.declareJS=function(b){var d;return d=q.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){q[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareCSS=function(b){var d;return d=r.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){r[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},o.declareGadgetKlass=function(a){function b(){var b,c,e;if(!p.hasOwnProperty(a)){b=function(){g.call(this)},b.ready_list=[],b.declareMethod=g.declareMethod,b.ready=g.ready,b.prototype=new g,b.prototype.constructor=b,b.prototype.path=a,b.template_element=(new d).parseFromString(j.responseText,"text/html"),e=o.parseGadgetHTMLDocument(b.template_element);for(c in e)e.hasOwnProperty(c)&&(b.prototype[c]=e[c]);p[a]=b}return p[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function h(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=p.hasOwnProperty(a)?c.resolve(p[a]):new c.Promise(e,h)},o.clearGadgetKlassList=function(){p={},q={},r={}},o.parseGadgetHTMLDocument=function(a){var b,c,d={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(9!==a.nodeType)throw new Error("The first parameter should be an HTMLDocument");for(d.title=a.title,b=0;b<a.head.children.length;b+=1)c=a.head.children[b],null!==c.href&&("stylesheet"===c.rel?d.required_css_list.push(c.getAttribute("href")):"text/javascript"===c.type?d.required_js_list.push(c.getAttribute("src")):"http://www.renderjs.org/rel/interface"===c.rel&&d.interface_list.push(c.getAttribute("href")));return d},b.rJS=b.renderJS=o,b.RenderJSGadget=g,b.RenderJSEmbeddedGadget=h,b.RenderJSIframeGadget=j,l()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function h(){return this instanceof h?void 0:new h}function i(a){a.__sub_gadget_dict={}}function j(a,b,d){var e,g,h=this;for(e in h.__sub_gadget_dict)h.__sub_gadget_dict.hasOwnProperty(e)&&h.__sub_gadget_dict[e]===a&&(g=e);return(new c.Queue).push(function(){var a=h.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(h,[d,g]);throw new s.AcquisitionError("aq_dynamic is not defined")}).push(f,function(a){if(a instanceof s.AcquisitionError)return h.__aq_parent(b,d);throw a})}function k(a,b){a.__aq_parent=function(c,d){return j.apply(b,[a,c,d])}}function l(){return this instanceof l?(h.call(this),void 0):new l}function m(b,d,e){function g(a,b){return function(){return a(b)}}var h;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return s.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(q=a,h=new a,h.__element=d.element,b=0;b<f.length;b+=1)h.__element.appendChild(f[b].cloneNode(!0));return k(h,e),c.all([h.getRequiredJSList(),h.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(g(s.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(g(s.declareCSS,a[1][b]));return d}).push(function(){return h})}function n(){return this instanceof n?(h.call(this),void 0):new n}function o(b,d,g){var h,i,j,l=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(j=d.element.parentNode;null!==j&&j!==a;)j=j.parentNode;if(null===j)throw new Error("The parent element is not attached to the DOM for "+b);return h=new n,k(h,g),i=a.createElement("iframe"),i.setAttribute("src",b),h.__path=b,h.__element=d.element,d.element.appendChild(i),h.__chan=e.build({window:i.contentWindow,origin:"*",scope:"renderJS"}),h.__chan.bind("declareMethod",function(a,b){return h[b]=function(){var a=arguments;return new c.Promise(function(c,d){h.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})})},"OK"}),h.__chan.bind("ready",function(){return l.resolve(h),"OK"}),h.__chan.bind("failed",function(a,b){return l.reject(b),"OK"}),h.__chan.bind("acquire",function(a,b){h.__aq_parent.apply(h,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),c.any([l.promise,c.timeout(5e3)])}function p(){var d,i,j,m,n,o,p=g(b.location.href),w=0,x=!1;if(t.hasOwnProperty(p))throw new Error("bootstrap should not be called twice");r=new c.Promise(function(g,r){function y(){var e,h,j=s.parseGadgetHTMLDocument(a,p);for(h in j)j.hasOwnProperty(h)&&(d.prototype["__"+h]=j[h]);for(d.__template_element=a.createElement("div"),i.__element=a.body,e=0;e<i.__element.childNodes.length;e+=1)d.__template_element.appendChild(i.__element.childNodes[e].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(e){function h(){return i}var j,k,l=e[0],m=e[1];for(j=0;j<l.length;j+=1)u[l[j]]=null;for(j=0;j<m.length;j+=1)v[m[j]]=null;for(q=f,k=new c.Queue,b.top!==b.self&&d.ready(function(){var b=a.createElement("base");return i.__aq_parent("getTopURL",[]).then(function(c){b.href=c,b.target="_top",a.head.appendChild(b)})}),k.push(h),j=0;j<d.__ready_list.length;j+=1)k.push(d.__ready_list[j]).push(h);return k.push(g,function(a){throw r(a),a}),k}).fail(function(a){r(a),console.error(a)})}b.self===b.top?(o=new h,o.__acquired_method_dict={getTopURL:function(){return p}},o.__aq_parent=function(a){throw new s.AcquisitionError("No gadget provides "+a)},d=function(){h.call(this)},d.declareMethod=h.declareMethod,d.declareAcquiredMethod=h.declareAcquiredMethod,d.allowPublicAcquisition=h.allowPublicAcquisition,d.__ready_list=h.__ready_list.slice(),d.ready=h.ready,d.prototype=new h,d.prototype.constructor=d,d.prototype.__path=p,t[p]=d,i=new t[p],k(i,o)):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=l,d.__ready_list=h.__ready_list.slice(),d.prototype.__path=p,i=new l,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),m=function(){0===w&&x===!0&&j.notify({method:"ready"})},n=function(a){w+=1,j.call({method:"declareMethod",params:a,success:function(){w-=1,m()},error:function(){w-=1}})},n("getInterfaceList"),n("getRequiredCSSList"),n("getRequiredJSList"),n("getPath"),n("getTitle"),d.declareMethod=function(a,b){var c=h.declareMethod.apply(this,[a,b]);return n(a),c},d.declareAcquiredMethod=h.declareAcquiredMethod,d.allowPublicAcquisition=h.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b){return new c.Promise(function(c,d){j.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){d(a)}})})}),d.prototype.__acquired_method_dict={},q=d,a.addEventListener("DOMContentLoaded",y,!1)}),b.self!==b.top&&r.then(function(){x=!0,m()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var q,r,s,t={},u={},v={};h.prototype.__title="",h.prototype.__interface_list=[],h.prototype.__path="",h.prototype.__html="",h.prototype.__required_css_list=[],h.prototype.__required_js_list=[],h.__ready_list=[i],h.ready=function(a){return this.__ready_list.push(a),this},h.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},h.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(this.__element===f)throw new Error("No element defined");return this.__element}),h.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},h.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},l.__ready_list=h.__ready_list.slice(),l.ready=h.ready,l.prototype=new h,l.prototype.constructor=l,n.__ready_list=h.__ready_list.slice(),n.ready=h.ready,n.prototype=new h,n.prototype.constructor=n,h.declareMethod("declareGadget",function(a,b){var d,e=this,g=r;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),a=s.getAbsoluteURL(a,this.__path),d=(new c.Queue).push(function(){return g}).push(f,function(){}).push(function(){var c;if("public"===b.sandbox)c=m;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=o}return c(a,b,e)}).push(function(a){function c(){return a}var g;for(q=f,g=0;g<a.constructor.__ready_list.length;g+=1)d.push(a.constructor.__ready_list[g]),d.push(c);return b.scope!==f&&(e.__sub_gadget_dict[b.scope]=a),a}).push(f,function(a){throw q=f,a}),r=d}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),s=function(a){var c;if(a===b&&(c=q),c===f)throw new Error("Unknown selector '"+a+"'");return c},s.AcquisitionError=function(a){if(this.name="AcquisitionError",a!==f&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},s.AcquisitionError.prototype=new Error,s.AcquisitionError.prototype.constructor=s.AcquisitionError,s.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>",h=new RegExp("^(?:[a-z]+:)?//|data:","i");return a&&b&&!h.test(a)?(c=(new d).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},s.declareJS=function(b){var d;return d=u.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){u[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},s.declareCSS=function(b){var d;return d=v.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){v[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},s.declareGadgetKlass=function(a){function b(){var b,c,e;if(!t.hasOwnProperty(a)){b=function(){h.call(this)},b.__ready_list=h.__ready_list.slice(),b.declareMethod=h.declareMethod,b.declareAcquiredMethod=h.declareAcquiredMethod,b.allowPublicAcquisition=h.allowPublicAcquisition,b.ready=h.ready,b.prototype=new h,b.prototype.constructor=b,b.prototype.__path=a,b.prototype.__acquired_method_dict={},b.__template_element=(new d).parseFromString(j.responseText,"text/html"),e=s.parseGadgetHTMLDocument(b.__template_element,a);for(c in e)e.hasOwnProperty(c)&&(b.prototype["__"+c]=e[c]);t[a]=b}return t[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function g(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=t.hasOwnProperty(a)?c.resolve(t[a]):new c.Promise(e,g)},s.clearGadgetKlassList=function(){t={},u={},v={}},s.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]},f=new RegExp("^(?:[a-z]+:)?//","i");if(!b||!f.test(b))throw new Error("The second parameter should be an absolute url");if(9!==a.nodeType)throw new Error("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(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)));return e},b.rJS=b.renderJS=s,b.__RenderJSGadget=h,b.__RenderJSEmbeddedGadget=l,b.__RenderJSIframeGadget=n,p()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),function(a,b,c,d,e,f){"use strict";function g(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function h(){return this instanceof h?void 0:new h}function i(a){a.__sub_gadget_dict={}}function j(a){var b,d,e,g,h,i=a.__element.querySelectorAll("[data-gadget-scope]"),j=[];for(h=0;h<i.length;h+=1)b=i[h],d=b.getAttribute("data-gadget-scope"),e=b.getAttribute("data-gadget-url"),g=b.getAttribute("data-gadget-sandbox"),null!==d&&null!==e&&j.push(a.declareGadget(e,{element:b,scope:d||f,sandbox:g||f}));return c.all(j)}function k(a,b,d){var e,g,h=this;for(e in h.__sub_gadget_dict)h.__sub_gadget_dict.hasOwnProperty(e)&&h.__sub_gadget_dict[e]===a&&(g=e);return(new c.Queue).push(function(){var a=h.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(h,[d,g]);throw new t.AcquisitionError("aq_dynamic is not defined")}).push(f,function(a){if(a instanceof t.AcquisitionError)return h.__aq_parent(b,d);throw a})}function l(a,b){a.__aq_parent=function(c,d){return k.apply(b,[a,c,d])}}function m(){return this instanceof m?(h.call(this),void 0):new m}function n(b,d,e){function g(a,b){return function(){return a(b)}}var h;return d.element===f&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return t.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(r=a,h=new a,h.__element=d.element,b=0;b<f.length;b+=1)h.__element.appendChild(f[b].cloneNode(!0));return l(h,e),c.all([h.getRequiredJSList(),h.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(g(t.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(g(t.declareCSS,a[1][b]));return d}).push(function(){return h})}function o(){return this instanceof o?(h.call(this),void 0):new o}function p(b,d,g){var h,i,j,k=c.defer();if(d.element===f)throw new Error("DOM element is required to create Iframe Gadget "+b);for(j=d.element.parentNode;null!==j&&j!==a;)j=j.parentNode;if(null===j)throw new Error("The parent element is not attached to the DOM for "+b);return h=new o,l(h,g),i=a.createElement("iframe"),i.setAttribute("src",b),h.__path=b,h.__element=d.element,d.element.appendChild(i),h.__chan=e.build({window:i.contentWindow,origin:"*",scope:"renderJS"}),h.__chan.bind("declareMethod",function(a,b){return h[b]=function(){var a=arguments;return new c.Promise(function(c,d){h.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})})},"OK"}),h.__chan.bind("ready",function(){return k.resolve(h),"OK"}),h.__chan.bind("failed",function(a,b){return k.reject(b),"OK"}),h.__chan.bind("acquire",function(a,b){h.__aq_parent.apply(h,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),c.any([k.promise,c.timeout(5e3)])}function q(){var d,i,j,k,n,o,p=g(b.location.href),q=new c.Queue,x=0,y=!1;if(u.hasOwnProperty(p))throw new Error("bootstrap should not be called twice");s=new c.Promise(function(g,q){function s(){var b,e,h=t.parseGadgetHTMLDocument(a,p);for(e in h)h.hasOwnProperty(e)&&(d.prototype["__"+e]=h[e]);for(d.__template_element=a.createElement("div"),i.__element=a.body,b=0;b<i.__element.childNodes.length;b+=1)d.__template_element.appendChild(i.__element.childNodes[b].cloneNode(!0));c.all([i.getRequiredJSList(),i.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)v[c[b]]=null;for(b=0;b<d.length;b+=1)w[d[b]]=null;return r=f,i}).then(g,function(a){throw q(a),console.error(a),a})}b.self===b.top?(o=new h,o.__acquired_method_dict={getTopURL:function(){return p}},o.__aq_parent=function(a){throw new t.AcquisitionError("No gadget provides "+a)},d=function(){h.call(this)},d.declareMethod=h.declareMethod,d.declareAcquiredMethod=h.declareAcquiredMethod,d.allowPublicAcquisition=h.allowPublicAcquisition,d.__ready_list=h.__ready_list.slice(),d.ready=h.ready,d.prototype=new h,d.prototype.constructor=d,d.prototype.__path=p,u[p]=d,i=new u[p],l(i,o)):(j=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=m,d.__ready_list=h.__ready_list.slice(),d.prototype.__path=p,i=new m,j.bind("methodCall",function(a,b){i[b[0]].apply(i,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),k=function(){0===x&&y===!0&&j.notify({method:"ready"})},n=function(a){x+=1,j.call({method:"declareMethod",params:a,success:function(){x-=1,k()},error:function(){x-=1}})},n("getInterfaceList"),n("getRequiredCSSList"),n("getRequiredJSList"),n("getPath"),n("getTitle"),d.declareMethod=function(a,b){var c=h.declareMethod.apply(this,[a,b]);return n(a),c},d.declareAcquiredMethod=h.declareAcquiredMethod,d.allowPublicAcquisition=h.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b){return new c.Promise(function(c,d){j.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){d(a)}})})}),d.prototype.__acquired_method_dict={},r=d,a.addEventListener("DOMContentLoaded",s,!1)}),q.push(function(){return s}).push(function(c){function e(){return c}var f;for(b.top!==b.self&&d.ready(function(){var b=a.createElement("base");return c.__aq_parent("getTopURL",[]).then(function(c){b.href=c,b.target="_top",a.head.appendChild(b)})}),q.push(e),f=0;f<d.__ready_list.length;f+=1)q.push(d.__ready_list[f]).push(e)}),b.self!==b.top&&q.then(function(){y=!0,k()}).fail(function(a){throw j.notify({method:"failed",params:a.toString()}),a})}var r,s,t,u={},v={},w={};h.prototype.__title="",h.prototype.__interface_list=[],h.prototype.__path="",h.prototype.__html="",h.prototype.__required_css_list=[],h.prototype.__required_js_list=[],h.__ready_list=[i,j],h.ready=function(a){return this.__ready_list.push(a),this},h.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},h.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(this.__element===f)throw new Error("No element defined");return this.__element}),h.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},h.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},m.__ready_list=h.__ready_list.slice(),m.ready=h.ready,m.prototype=new h,m.prototype.constructor=m,o.__ready_list=h.__ready_list.slice(),o.ready=h.ready,o.prototype=new h,o.prototype.constructor=o,h.declareMethod("declareGadget",function(a,b){var d,e,g=this,h=s;return b===f&&(b={}),b.sandbox===f&&(b.sandbox="public"),a=t.getAbsoluteURL(a,this.__path),s=(new c.Queue).push(function(){return h}).push(f,function(){}).push(function(){var c;if("public"===b.sandbox)c=n;else{if("iframe"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");c=p}return c(a,b,g)}).push(function(a){return r=f,a}).push(f,function(a){throw r=f,a}),e=s,d=(new c.Queue).push(function(){return e}).push(function(c){function e(){return c}var h;for(h=0;h<c.constructor.__ready_list.length;h+=1)d.push(c.constructor.__ready_list[h]),d.push(e);return b.scope!==f&&(g.__sub_gadget_dict[b.scope]=c,c.__element.setAttribute("data-gadget-scope",b.scope)),c.__element.setAttribute("data-gadget-url",a),c.__element.setAttribute("data-gadget-sandbox",b.sandbox),c})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),t=function(a){var c;if(a===b&&(c=r),c===f)throw new Error("Unknown selector '"+a+"'");return c},t.AcquisitionError=function(a){if(this.name="AcquisitionError",a!==f&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},t.AcquisitionError.prototype=new Error,t.AcquisitionError.prototype.constructor=t.AcquisitionError,t.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>",h=new RegExp("^(?:[a-z]+:)?//|data:","i");return a&&b&&!h.test(a)?(c=(new d).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},t.declareJS=function(b){var d;return d=v.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){v[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},t.declareCSS=function(b){var d;return d=w.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){w[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},t.declareGadgetKlass=function(a){function b(){var b,c,e;if(!u.hasOwnProperty(a)){b=function(){h.call(this)},b.__ready_list=h.__ready_list.slice(),b.declareMethod=h.declareMethod,b.declareAcquiredMethod=h.declareAcquiredMethod,b.allowPublicAcquisition=h.allowPublicAcquisition,b.ready=h.ready,b.prototype=new h,b.prototype.constructor=b,b.prototype.__path=a,b.prototype.__acquired_method_dict={},b.__template_element=(new d).parseFromString(j.responseText,"text/html"),e=t.parseGadgetHTMLDocument(b.__template_element,a);for(c in e)e.hasOwnProperty(c)&&(b.prototype["__"+c]=e[c]);u[a]=b}return u[a]}function e(c,d){function e(){var a;try{0===j.readyState?d(j):4===j.readyState&&(j.status<200||j.status>=300||!/^text\/html[;]?/.test(j.getResponseHeader("Content-Type")||"")?d(j):(a=b(),c(a)))}catch(e){d(e)}}j=new XMLHttpRequest,j.open("GET",a),j.onreadystatechange=e,j.setRequestHeader("Accept","text/html"),j.withCredentials=!0,j.send()}function g(){j!==f&&j.readyState!==j.DONE&&j.abort()}var i,j;return i=u.hasOwnProperty(a)?c.resolve(u[a]):new c.Promise(e,g)},t.clearGadgetKlassList=function(){u={},v={},w={}},t.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]},f=new RegExp("^(?:[a-z]+:)?//","i");if(!b||!f.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(t.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(t.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(t.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=t,b.__RenderJSGadget=h,b.__RenderJSEmbeddedGadget=m,b.__RenderJSIframeGadget=o,q()}(document,window,RSVP,DOMParser,Channel);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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";function i(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function j(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)}function k(a){if(this.name="resolved",a!==h&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function l(){return this instanceof l?void 0:new l}function m(a){a.__monitor!==h&&a.__monitor.cancel(),a.__monitor=new A,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return j(a)})}function n(a){a.__sub_gadget_dict={},m(a)}function o(a){var b,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}));return c.all(j)}function p(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}function q(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new z.AcquisitionError("aq_dynamic is not defined")}).push(h,function(a){if(a instanceof z.AcquisitionError)return g.__aq_parent(b,d);throw a})}function r(a,b){a.__aq_parent=function(c,d){return q.apply(b,[a,c,d])}}function s(){return this instanceof s?(l.call(this),void 0):new s}function t(b,d,e){function f(a,b){return function(){return a(b)}}var g;return d.element===h&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return z.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(x=a,g=new a,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));return r(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.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]));return d}).push(function(){return g})}function u(){return this instanceof u?(l.call(this),void 0):new u}function v(b,d,f){var g,i,j=c.defer();if(d.element===h)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new u,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){return g[b]=function(){var a=arguments;return new c.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(){return j.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return j.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)])}function w(){var d,k,n,o,q,t,u=i(b.location.href),v=new c.Queue,w=0,A=!1;if(B.hasOwnProperty(u))throw new Error("bootstrap should not be called twice");y=new c.Promise(function(i,v){function y(){var b,e,j=z.parseGadgetHTMLDocument(a,u);for(e in j)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){var b,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(){var b=a.querySelector("body"),c=new f(function(b){var c,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};return c.observe(b,d),k}).then(i,function(a){throw v(a),console.error(a),a})}b.self===b.top?(t=new l,t.__acquired_method_dict={getTopURL:function(){return u},reportServiceError:function(a){j(a[0])}},t.__aq_parent=function(a){throw new z.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=new l,d.prototype.constructor=d,d.prototype.__path=u,B[u]=d,k=new B[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=new s,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){var c=l.declareMethod.apply(this,[a,b]);return q(a),c},d.declareService=l.declareService,d.declareAcquiredMethod=l.declareAcquiredMethod,d.allowPublicAcquisition=l.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b){return new c.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(){return y}).push(function(c){function e(){return c}var f;for(b.top!==b.self&&d.ready(function(){var b=a.createElement("base");return c.__aq_parent("getTopURL",[]).then(function(c){b.href=c,b.target="_top",a.head.appendChild(b)})}),d.ready(function(a){return p(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){throw j(a),a}):v.then(function(){A=!0,o()}).fail(function(a){throw n.notify({method:"failed",params:a.toString()}),a})}var x,y,z,A,B={},C={},D={};k.prototype=new Error,k.prototype.constructor=k,A=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof A?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},g.monitor=function(a){if(f)throw new k;var b=(new c.Queue).push(function(){return a}).push(function(){var a,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){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this},void 0):new A},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){return this.__ready_list.push(a),this},l.__service_list=[],l.declareService=function(a){return this.__service_list.push(a),this},l.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},l.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(this.__element===h)throw new Error("No element defined");return this.__element}),l.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},l.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),l.allowPublicAcquisition=function(a,b){return this.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=new l,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=new l,u.prototype.constructor=u,l.declareMethod("declareGadget",function(b,d){var e,f,g=this,i=y;return d===h&&(d={}),d.sandbox===h&&(d.sandbox="public"),b=z.getAbsoluteURL(b,this.__path),y=(new c.Queue).push(function(){return i}).push(h,function(){}).push(function(){var a;if("public"===d.sandbox)a=t;else{if("iframe"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=v}return a(b,d,g)}).push(function(a){return x=h,a}).push(h,function(a){throw x=h,a}),f=y,e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}var i;for(i=0;i<c.constructor.__ready_list.length;i+=1)e.push(c.constructor.__ready_list[i]),e.push(f);return d.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))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),z=function(a){var c;if(a===b&&(c=x),c===h)throw new Error("Unknown selector '"+a+"'");return c},z.AcquisitionError=function(a){if(this.name="AcquisitionError",a!==h&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},z.AcquisitionError.prototype=new Error,z.AcquisitionError.prototype.constructor=z.AcquisitionError,z.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>",h=new RegExp("^(?:[a-z]+:)?//|data:","i");return a&&b&&!h.test(a)?(c=(new d).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){var d;return d=C.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;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){var d;return d=D.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;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){function b(){var b,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=new l,b.prototype.constructor=b,b.prototype.__path=a,b.prototype.__acquired_method_dict={},b.__template_element=(new d).parseFromString(i.responseText,"text/html"),e=z.parseGadgetHTMLDocument(b.__template_element,a);for(c in e)e.hasOwnProperty(c)&&(b.prototype["__"+c]=e[c]);B[a]=b}return B[a]}function e(c,d){function e(){var a;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=new XMLHttpRequest,i.open("GET",a),i.onreadystatechange=e,i.setRequestHeader("Accept","text/html"),i.withCredentials=!0,i.send()}function f(){i!==h&&i.readyState!==i.DONE&&i.abort()}var g,i;return g=B.hasOwnProperty(a)?c.resolve(B[a]):new c.Promise(e,f)},z.clearGadgetKlassList=function(){B={},C={},D={}},z.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]},f=new RegExp("^(?:[a-z]+:)?//","i");if(!b||!f.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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)));return e},b.rJS=b.renderJS=z,b.__RenderJSGadget=l,b.__RenderJSEmbeddedGadget=s,b.__RenderJSIframeGadget=u,w()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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";function h(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function i(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)}function j(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function k(){return this instanceof k?void 0:new k}function l(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new z,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return i(a)})}function m(a){a.__sub_gadget_dict={},l(a)}function n(a){var b,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||void 0,sandbox:f||void 0}));return c.all(i)}function o(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}function p(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new y.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof y.AcquisitionError)return g.__aq_parent(b,d);throw a})}function q(a,b){a.__aq_parent=function(c,d){return p.apply(b,[a,c,d])}}function r(){return this instanceof r?void k.call(this):new r}function s(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return y.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(w=a,g=new a,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));return q(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.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]));return d}).push(function(){return g})}function t(){return this instanceof t?void k.call(this):new t}function u(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new t,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){return g[b]=function(){var a=arguments;return new c.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(){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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)])}function v(){var d,j,m,n,p,s,t,u=h(b.location.href),v=new c.Queue,z=0,D=!1;if(A.hasOwnProperty(u))throw new Error("bootstrap should not be called twice");x=new c.Promise(function(h,s){function v(){var b,e,i=y.parseGadgetHTMLDocument(a,u);for(e in i)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){var b,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=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&l(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==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")&&void 0!==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)&&void 0!==h._gadget&&o(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),j}).then(h,function(a){throw s(a),console.error(a),a})}t=new k,t.__acquired_method_dict={getTopURL:function(){return u},reportServiceError:function(a){i(a[0])}},t.__aq_parent=function(a){throw new y.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=new k,d.prototype.constructor=d,d.prototype.__path=u,A[u]=d,j=new A[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=new r,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){var c=k.declareMethod.apply(this,[a,b]);return p(a),c},d.declareService=k.declareService,d.declareAcquiredMethod=k.declareAcquiredMethod,d.allowPublicAcquisition=k.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b,d){return new c.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(){return x}).push(function(c){function e(){return c}var f;for(b.top!==b.self&&d.__ready_list.splice(1,0,function(){return c.__aq_parent("getTopURL",[],100).then(function(b){var d=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)throw a;s=!0,q(c,t)})}),d.ready(function(a){return o(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){throw i(a),a}):v.then(function(){D=!0,n()}).fail(function(a){throw s?i(a):m.notify({method:"failed",params:a.toString()}),a})}var w,x,y,z,A={},B={},C={};j.prototype=new Error,j.prototype.constructor=j,z=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof z?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new j;var b=(new c.Queue).push(function(){return a}).push(function(){var a,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){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new z},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){return this.__ready_list.push(a),this},k.__service_list=[],k.declareService=function(a){return this.__service_list.push(a),this},k.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},k.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.__element)throw new Error("No element defined");return this.__element}),k.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},k.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),k.allowPublicAcquisition=function(a,b){return this.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=new k,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=new k,t.prototype.constructor=t,k.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=x;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=y.getAbsoluteURL(b,this.__path),x=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=s;else{if("iframe"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=u}return a(b,d,g)}).push(function(a){return w=void 0,a}).push(void 0,function(a){throw w=void 0,a}),f=x,e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}var h;for(h=0;h<c.constructor.__ready_list.length;h+=1)e.push(c.constructor.__ready_list[h]),e.push(f);return void 0!==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))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),y=function(a){var c;if(a===b&&(c=w),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},y.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},y.AcquisitionError.prototype=new Error,y.AcquisitionError.prototype.constructor=y.AcquisitionError,y.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>",h=new RegExp("^(?:[a-z]+:)?//|data:","i");return a&&b&&!h.test(a)?(c=(new d).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){var d;return d=B.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;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){var d;return d=C.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;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){function b(){var b,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=new k,b.prototype.constructor=b,b.prototype.__path=a,b.prototype.__acquired_method_dict={},b.__template_element=(new d).parseFromString(h.responseText,"text/html"),e=y.parseGadgetHTMLDocument(b.__template_element,a);for(c in e)e.hasOwnProperty(c)&&(b.prototype["__"+c]=e[c]);A[a]=b}return A[a]}function e(c,d){function e(){var a;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=new XMLHttpRequest,h.open("GET",a),h.onreadystatechange=e,h.setRequestHeader("Accept","text/html"),h.withCredentials=!0,h.send()}function f(){void 0!==h&&h.readyState!==h.DONE&&h.abort()}var g,h;return g=A.hasOwnProperty(a)?c.resolve(A[a]):new c.Promise(e,f)},y.clearGadgetKlassList=function(){A={},B={},C={}},y.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]},f=new RegExp("^(?:[a-z]+:)?//","i");if(!b||!f.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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)));return e},b.rJS=b.renderJS=y,b.__RenderJSGadget=k,b.__RenderJSEmbeddedGadget=r,b.__RenderJSIframeGadget=t,v()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g){"use strict";function h(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function i(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)}function j(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function k(){return this instanceof k?void 0:new k}function l(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new z,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return i(a)})}function m(a){a.__sub_gadget_dict={},l(a)}function n(a){var b,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||void 0,sandbox:f||void 0}));return c.all(i)}function o(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}function p(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new y.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof y.AcquisitionError)return g.__aq_parent(b,d);throw a})}function q(a,b){a.__aq_parent=function(c,d){return p.apply(b,[a,c,d])}}function r(){return this instanceof r?void k.call(this):new r}function s(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return y.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(w=a,g=new a,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));return q(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.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]));return d}).push(function(){return g})}function t(){return this instanceof t?void k.call(this):new t}function u(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new t,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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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)])}function v(){var d,j,m,n,p,s,t,u=h(b.location.href),v=new c.Queue,z=0,D=!1;if(A.hasOwnProperty(u))throw new Error("bootstrap should not be called twice");x=new c.Promise(function(h,s){function v(){var b,e,i=y.parseGadgetHTMLDocument(a,u);for(e in i)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){var b,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=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&l(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==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")&&void 0!==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)&&void 0!==h._gadget&&o(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),j}).then(h,function(a){throw s(a),console.error(a),a})}t=new k,t.__acquired_method_dict={getTopURL:function(){return u},reportServiceError:function(a){i(a[0])}},t.__aq_parent=function(a){throw new y.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=new k,d.prototype.constructor=d,d.prototype.__path=u,A[u]=d,j=new A[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=new r,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){var c=k.declareMethod.apply(this,[a,b]);return p(a),c},d.declareService=k.declareService,d.declareAcquiredMethod=k.declareAcquiredMethod,d.allowPublicAcquisition=k.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b,d){return new c.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(){return x}).push(function(c){function e(){return c}var f;for(b.top!==b.self&&d.__ready_list.splice(1,0,function(){return c.__aq_parent("getTopURL",[],100).then(function(b){var d=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)throw a;s=!0,q(c,t)})}),d.ready(function(a){return o(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){throw i(a),a}):v.then(function(){D=!0,n()}).fail(function(a){throw s?i(a):m.notify({method:"failed",params:a.toString()}),a})}var w,x,y,z,A={},B={},C={};j.prototype=new Error,j.prototype.constructor=j,z=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof z?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new j;var b=(new c.Queue).push(function(){return a}).push(function(){var a,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){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new z},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){return this.__ready_list.push(a),this},k.__service_list=[],k.declareService=function(a){return this.__service_list.push(a),this},k.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},k.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.__element)throw new Error("No element defined");return this.__element}),k.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},k.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),k.allowPublicAcquisition=function(a,b){return this.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=new k,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=new k,t.prototype.constructor=t,k.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=x;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=y.getAbsoluteURL(b,this.__path),x=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=s;else{if("iframe"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=u}return a(b,d,g)}).push(function(a){return w=void 0,a}).push(void 0,function(a){throw w=void 0,a}),f=x,e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}var h;for(h=0;h<c.constructor.__ready_list.length;h+=1)e.push(c.constructor.__ready_list[h]),e.push(f);return void 0!==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))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),y=function(a){var c;if(a===b&&(c=w),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},y.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},y.AcquisitionError.prototype=new Error,y.AcquisitionError.prototype.constructor=y.AcquisitionError,y.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>",h=new RegExp("^(?:[a-z]+:)?//|data:","i");return a&&b&&!h.test(a)?(c=(new d).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){var d;return d=B.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;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){var d;return d=C.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;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){function b(){var b,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=new k,b.prototype.constructor=b,b.prototype.__path=a,b.prototype.__acquired_method_dict={},b.__template_element=(new d).parseFromString(h.responseText,"text/html"),e=y.parseGadgetHTMLDocument(b.__template_element,a);for(c in e)e.hasOwnProperty(c)&&(b.prototype["__"+c]=e[c]);A[a]=b}return A[a]}function e(c,d){function e(){var a;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=new XMLHttpRequest,h.open("GET",a),h.onreadystatechange=e,h.setRequestHeader("Accept","text/html"),h.withCredentials=!0,h.send()}function f(){void 0!==h&&h.readyState!==h.DONE&&h.abort()}var g,h;return g=A.hasOwnProperty(a)?c.resolve(A[a]):new c.Promise(e,f)},y.clearGadgetKlassList=function(){A={},B={},C={}},y.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]},f=new RegExp("^(?:[a-z]+:)?//","i");if(!b||!f.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(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)));return e},b.rJS=b.renderJS=y,b.__RenderJSGadget=k,b.__RenderJSEmbeddedGadget=r,b.__RenderJSIframeGadget=t,v()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i){"use strict";function j(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function k(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function l(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function m(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)}function n(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function o(){return this instanceof o?void 0:new o}function p(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new E,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return m(a)})}function q(a){a.__sub_gadget_dict={},p(a)}function r(a){var b,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||void 0,sandbox:f||void 0}));return c.all(i)}function s(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}function t(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new D.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof D.AcquisitionError)return g.__aq_parent(b,d);throw a})}function u(a,b){a.__aq_parent=function(c,d){return t.apply(b,[a,c,d])}}function v(){return this instanceof v?void o.call(this):new v}function w(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return D.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(B=a,g=new a,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));return u(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(D.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(D.declareCSS,a[1][b]));return d}).push(function(){return g})}function x(){return this instanceof x?void o.call(this):new x}function y(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new x,u(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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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)])}function z(a,b,e){return(new c.Queue).push(function(){return k(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),j(c)}).push(function(a){return y(a,b,e)})}function A(){var d,h,i,j,k,n,q,r=l(b.location.href),t=new c.Queue,w=0,x=!1;if(F.hasOwnProperty(r))throw new Error("bootstrap should not be called twice");C=new c.Promise(function(l,n){function t(){var b,e,i=D.parseGadgetHTMLDocument(a,r);for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.__element=a.body,b=0;b<h.__element.childNodes.length;b+=1)d.__template_element.appendChild(h.__element.childNodes[b].cloneNode(!0));c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)G[c[b]]=null;for(b=0;b<d.length;b+=1)H[d[b]]=null;B=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&p(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&p(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")&&void 0!==h._gadget&&a.contains(h)&&s(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&s(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(l,function(a){throw n(a),console.error(a),a})}q=new o,q.__acquired_method_dict={getTopURL:function(){return r},reportServiceError:function(a){m(a[0])}},q.__aq_parent=function(a){throw new D.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){o.call(this)},d.declareMethod=o.declareMethod,d.declareAcquiredMethod=o.declareAcquiredMethod,d.allowPublicAcquisition=o.allowPublicAcquisition,d.__ready_list=o.__ready_list.slice(),d.ready=o.ready,d.__service_list=o.__service_list.slice(),d.declareService=o.declareService,d.prototype=new o,d.prototype.constructor=d,d.prototype.__path=r,F[r]=d,h=new F[r],u(h,q)):(i=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=v,d.__ready_list=o.__ready_list.slice(),d.__service_list=o.__service_list.slice(),d.prototype.__path=r,h=new v,j=function(){0===w&&x===!0&&i.notify({method:"ready"})},k=function(a){w+=1,i.call({method:"declareMethod",params:a,success:function(){w-=1,j()},error:function(){w-=1}})},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=o.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=o.declareService,d.declareAcquiredMethod=o.declareAcquiredMethod,d.allowPublicAcquisition=o.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})}),d.prototype.__acquired_method_dict={},B=d,a.addEventListener("DOMContentLoaded",t,!1)}),t.push(function(){return C}).push(function(c){function e(){return c}var f;for(b.top!==b.self&&d.__ready_list.splice(1,0,function(){return c.__aq_parent("getTopURL",[],100).then(function(b){var d=a.createElement("base");d.href=b,d.target="_top",a.head.appendChild(d),i.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)throw a;n=!0,u(c,q)})}),d.ready(function(a){return s(a)}),t.push(e),f=0;f<d.__ready_list.length;f+=1)t.push(d.__ready_list[f]).push(e)}),b.self===b.top?t.fail(function(a){throw m(a),a}):t.then(function(){x=!0,j()}).fail(function(a){throw n?m(a):i.notify({method:"failed",params:a.toString()}),a})}var B,C,D,E,F={},G={},H={},I=new RegExp("^(?:[a-z]+:)?//|data:","i");n.prototype=new Error,n.prototype.constructor=n,E=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof E?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new n;var b=(new c.Queue).push(function(){return a}).push(function(){var a,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){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new E},E.prototype=Object.create(c.Promise.prototype),E.prototype.constructor=E,o.prototype.__title="",o.prototype.__interface_list=[],o.prototype.__path="",o.prototype.__html="",o.prototype.__required_css_list=[],o.prototype.__required_js_list=[],o.__ready_list=[q,r],o.ready=function(a){return this.__ready_list.push(a),this},o.__service_list=[],o.declareService=function(a){return this.__service_list.push(a),this},o.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},o.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.__element)throw new Error("No element defined");return this.__element}),o.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},o.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),o.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},v.__ready_list=o.__ready_list.slice(),v.__service_list=o.__service_list.slice(),v.ready=o.ready,v.declareService=o.declareService,v.prototype=new o,v.prototype.constructor=v,x.__ready_list=o.__ready_list.slice(),x.ready=o.ready,x.__service_list=o.__service_list.slice(),x.declareService=o.declareService,x.prototype=new o,x.prototype.constructor=x,o.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=C;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=D.getAbsoluteURL(b,this.__path),C=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=w;else if("iframe"===d.sandbox)a=y;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=z}return a(b,d,g)}).push(function(a){return B=void 0,a}).push(void 0,function(a){throw B=void 0,a}),f=C,e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}var h;for(h=0;h<c.constructor.__ready_list.length;h+=1)e.push(c.constructor.__ready_list[h]),e.push(f);return void 0!==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(s),e.push(f),c})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),D=function(a){var c;if(a===b&&(c=B),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},D.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},D.AcquisitionError.prototype=new Error,D.AcquisitionError.prototype.constructor=D.AcquisitionError,D.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>";return a&&b&&!I.test(a)?(c=(new d).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},D.declareJS=function(b){var d;return d=G.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){G[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},D.declareCSS=function(b){var d;return d=H.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){H[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},D.declareGadgetKlass=function(a){function b(b){var c,e,f;if(!F.hasOwnProperty(a)){c=function(){o.call(this)},c.__ready_list=o.__ready_list.slice(),c.__service_list=o.__service_list.slice(),c.declareMethod=o.declareMethod,c.declareAcquiredMethod=o.declareAcquiredMethod,c.allowPublicAcquisition=o.allowPublicAcquisition,c.ready=o.ready,c.declareService=o.declareService,c.prototype=new o,c.prototype.constructor=c,c.prototype.__path=a,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(b.responseText,"text/html"),f=D.parseGadgetHTMLDocument(c.__template_element,a);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);F[a]=c}return F[a]}var e;return e=F.hasOwnProperty(a)?c.resolve(F[a]):(new c.Queue).push(function(){return k(a)}).push(function(a){return b(a)})},D.clearGadgetKlassList=function(){F={},G={},H={}},D.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!I.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(D.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(D.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(D.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=D,b.__RenderJSGadget=o,b.__RenderJSEmbeddedGadget=v,b.__RenderJSIframeGadget=x,A()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i){"use strict";function j(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function k(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function l(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function m(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)}function n(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function o(){return this instanceof o?void 0:new o}function p(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new E,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return m(a)})}function q(a){a.__sub_gadget_dict={},p(a)}function r(a){var b,d,e,f,g,h=a.__element.querySelectorAll("[data-gadget-url]"),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!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void 0,sandbox:f||void 0}));return c.all(i)}function s(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}function t(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new D.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof D.AcquisitionError)return g.__aq_parent(b,d);throw a})}function u(a,b){a.__aq_parent=function(c,d){return t.apply(b,[a,c,d])}}function v(){return this instanceof v?void o.call(this):new v}function w(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return D.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(B=a,g=new a,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));return u(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(D.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(D.declareCSS,a[1][b]));return d}).push(function(){return g})}function x(){return this instanceof x?void o.call(this):new x}function y(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new x,u(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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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)])}function z(a,b,e){return(new c.Queue).push(function(){return k(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),j(c)}).push(function(a){return y(a,b,e)})}function A(){var d,h,i,j,k,n,q,r=l(b.location.href),t=new c.Queue,w=0,x=!1;if(F.hasOwnProperty(r))throw new Error("bootstrap should not be called twice");C=new c.Promise(function(l,n){function t(){var b,e,i=D.parseGadgetHTMLDocument(a,r);for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.__element=a.body,b=0;b<h.__element.childNodes.length;b+=1)d.__template_element.appendChild(h.__element.childNodes[b].cloneNode(!0));c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)G[c[b]]=null;for(b=0;b<d.length;b+=1)H[d[b]]=null;B=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&p(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&p(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")&&void 0!==h._gadget&&a.contains(h)&&s(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&s(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(l,function(a){throw n(a),console.error(a),a})}q=new o,q.__acquired_method_dict={getTopURL:function(){return r},reportServiceError:function(a){m(a[0])}},q.__aq_parent=function(a){throw new D.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){o.call(this)},d.declareMethod=o.declareMethod,d.declareAcquiredMethod=o.declareAcquiredMethod,d.allowPublicAcquisition=o.allowPublicAcquisition,d.__ready_list=o.__ready_list.slice(),d.ready=o.ready,d.__service_list=o.__service_list.slice(),d.declareService=o.declareService,d.prototype=new o,d.prototype.constructor=d,d.prototype.__path=r,F[r]=d,h=new F[r],u(h,q)):(i=e.build({window:b.parent,origin:"*",scope:"renderJS"}),d=v,d.__ready_list=o.__ready_list.slice(),d.__service_list=o.__service_list.slice(),d.prototype.__path=r,h=new v,j=function(){0===w&&x===!0&&i.notify({method:"ready"})},k=function(a){w+=1,i.call({method:"declareMethod",params:a,success:function(){w-=1,j()},error:function(){w-=1}})},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=o.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=o.declareService,d.declareAcquiredMethod=o.declareAcquiredMethod,d.allowPublicAcquisition=o.allowPublicAcquisition,d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})}),d.prototype.__acquired_method_dict={},B=d,a.addEventListener("DOMContentLoaded",t,!1)}),t.push(function(){return C}).push(function(c){function e(){return c}var f;for(b.top!==b.self&&d.__ready_list.splice(1,0,function(){return c.__aq_parent("getTopURL",[],100).then(function(b){var d=a.createElement("base");d.href=b,d.target="_top",a.head.appendChild(d),i.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)throw a;n=!0,u(c,q)})}),d.ready(function(a){return s(a)}),t.push(e),f=0;f<d.__ready_list.length;f+=1)t.push(d.__ready_list[f]).push(e)}),b.self===b.top?t.fail(function(a){throw m(a),a}):t.then(function(){x=!0,j()}).fail(function(a){throw n?m(a):i.notify({method:"failed",params:a.toString()}),a})}var B,C,D,E,F={},G={},H={},I=0,J=new RegExp("^(?:[a-z]+:)?//|data:","i");n.prototype=new Error,n.prototype.constructor=n,E=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof E?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new n;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new E},E.prototype=Object.create(c.Promise.prototype),E.prototype.constructor=E,o.prototype.__title="",o.prototype.__interface_list=[],o.prototype.__path="",o.prototype.__html="",o.prototype.__required_css_list=[],o.prototype.__required_js_list=[],o.__ready_list=[q,r],o.ready=function(a){return this.__ready_list.push(a),this},o.__service_list=[],o.declareService=function(a){return this.__service_list.push(a),this},o.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},o.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.__element)throw new Error("No element defined");return this.__element}),o.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},o.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),o.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},v.__ready_list=o.__ready_list.slice(),v.__service_list=o.__service_list.slice(),v.ready=o.ready,v.declareService=o.declareService,v.prototype=new o,v.prototype.constructor=v,x.__ready_list=o.__ready_list.slice(),x.ready=o.ready,x.__service_list=o.__service_list.slice(),x.declareService=o.declareService,x.prototype=new o,x.prototype.constructor=x,o.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=C;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=D.getAbsoluteURL(b,this.__path),C=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=w;else if("iframe"===d.sandbox)a=y;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=z}return a(b,d,g)}).push(function(a){return B=void 0,a}).push(void 0,function(a){throw B=void 0,a}),f=C,e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}var h,i;for(h=0;h<c.constructor.__ready_list.length;h+=1)e.push(c.constructor.__ready_list[h]),e.push(f);if(i=d.scope,void 0===i)for(i="RJS_"+I,I+=1;g.__sub_gadget_dict.hasOwnProperty(i);)i="RJS_"+I,I+=1;return g.__sub_gadget_dict[i]=c,c.__element.setAttribute("data-gadget-scope",i),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(s),e.push(f),c})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),D=function(a){var c;if(a===b&&(c=B),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},D.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},D.AcquisitionError.prototype=new Error,D.AcquisitionError.prototype.constructor=D.AcquisitionError,D.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>";return a&&b&&!J.test(a)?(c=(new d).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},D.declareJS=function(b){var d;return d=G.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){G[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},D.declareCSS=function(b){var d;return d=H.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){H[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},D.declareGadgetKlass=function(a){function b(b){var c,e,f;if(!F.hasOwnProperty(a)){c=function(){o.call(this)},c.__ready_list=o.__ready_list.slice(),c.__service_list=o.__service_list.slice(),c.declareMethod=o.declareMethod,c.declareAcquiredMethod=o.declareAcquiredMethod,c.allowPublicAcquisition=o.allowPublicAcquisition,c.ready=o.ready,c.declareService=o.declareService,c.prototype=new o,c.prototype.constructor=c,c.prototype.__path=a,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(b.responseText,"text/html"),f=D.parseGadgetHTMLDocument(c.__template_element,a);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);F[a]=c}return F[a]}var e;return e=F.hasOwnProperty(a)?c.resolve(F[a]):(new c.Queue).push(function(){return k(a)}).push(function(a){return b(a)})},D.clearGadgetKlassList=function(){F={},G={},H={}},D.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!J.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(D.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(D.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(D.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=D,b.__RenderJSGadget=o,b.__RenderJSEmbeddedGadget=v,b.__RenderJSIframeGadget=x,A()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i){"use strict";function j(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function k(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function l(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function m(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)}function n(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function o(){return this instanceof o?void 0:new o}function p(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new E,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return m(a)})}function q(a){a.__sub_gadget_dict={},p(a)}function r(a){var b,d,e,f,g,h=a.__element.querySelectorAll("[data-gadget-url]"),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!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void 0,sandbox:f||void 0}));return c.all(i)}function s(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}function t(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new D.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof D.AcquisitionError)return g.__aq_parent(b,d);throw a})}function u(a,b){a.__aq_parent=function(c,d){return t.apply(b,[a,c,d])}}function v(){return this instanceof v?void o.call(this):new v}function w(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return D.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(B=a,g=new a,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));return u(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(D.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(D.declareCSS,a[1][b]));return d}).push(function(){return g})}function x(){return this instanceof x?void o.call(this):new x}function y(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new x,u(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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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)])}function z(a,b,e){return(new c.Queue).push(function(){return k(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),j(c)}).push(function(a){return y(a,b,e)})}function A(){var d,h,i,j,k,n,q,r,t=l(b.location.href),w=new c.Queue,x=0,y=!1,z=[],A=!1,E=!1;if(F.hasOwnProperty(t))throw new Error("bootstrap should not be called twice");C=new c.Promise(function(l,w){function C(){var b,e,i=D.parseGadgetHTMLDocument(a,t);for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.__element=a.body,b=0;b<h.__element.childNodes.length;b+=1)d.__template_element.appendChild(h.__element.childNodes[b].cloneNode(!0));c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)G[c[b]]=null;for(b=0;b<d.length;b+=1)H[d[b]]=null;B=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&p(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&p(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")&&void 0!==h._gadget&&a.contains(h)&&s(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&s(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(l,function(a){throw w(a),console.error(a),a})}q=new o,q.__acquired_method_dict={getTopURL:function(){return t},reportServiceError:function(a){m(a[0])}},q.__aq_parent=function(a){throw new D.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){o.call(this)},d.declareMethod=o.declareMethod,d.declareAcquiredMethod=o.declareAcquiredMethod,d.allowPublicAcquisition=o.allowPublicAcquisition,d.__ready_list=o.__ready_list.slice(),d.ready=o.ready,d.__service_list=o.__service_list.slice(),d.declareService=o.declareService,d.prototype=new o,d.prototype.constructor=d,d.prototype.__path=t,F[t]=d,h=new F[t],u(h,q)):(d=v,d.__ready_list=o.__ready_list.slice(),d.__service_list=o.__service_list.slice(),d.prototype.__path=t,h=new v,u(h,q),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var b;for(n=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){x+=1,i.call({method:"declareMethod",params:a,success:function(){x-=1,j()},error:function(){x-=1}})},b=0;b<z.length;b+=1)k(z[b]);return z=[],A?void i.notify({method:"failed",params:r}):d.prototype.__aq_parent("getTopURL",[]).then(function(b){var c=a.createElement("base");c.href=b,c.target="_top",a.head.appendChild(c),E=!0,j(),i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)})}).fail(function(a){throw a})}}),j=function(){0===x&&y===!0&&i.notify({method:"ready"})},k=function(a){z.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=o.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=o.declareService,d.declareAcquiredMethod=o.declareAcquiredMethod,d.allowPublicAcquisition=o.allowPublicAcquisition,n=!0),d.prototype.__acquired_method_dict={},B=d,a.addEventListener("DOMContentLoaded",C,!1)}),w.push(function(){return C}).push(function(a){function b(){return a}var c;for(d.ready(function(a){return s(a)}),w.push(b),c=0;c<d.__ready_list.length;c+=1)w.push(d.__ready_list[c]).push(b)}),b.self===b.top?w.fail(function(a){throw m(a),a}):w.then(function(){y=!0,E&&j()}).fail(function(a){throw n?(A=!0,r=a.toString(),m(a)):i.notify({method:"failed",params:a.toString()}),a})}var B,C,D,E,F={},G={},H={},I=0,J=new RegExp("^(?:[a-z]+:)?//|data:","i");n.prototype=new Error,n.prototype.constructor=n,E=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof E?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new n;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new E},E.prototype=Object.create(c.Promise.prototype),E.prototype.constructor=E,o.prototype.__title="",o.prototype.__interface_list=[],o.prototype.__path="",o.prototype.__html="",o.prototype.__required_css_list=[],o.prototype.__required_js_list=[],o.__ready_list=[q,r],o.ready=function(a){return this.__ready_list.push(a),this},o.__service_list=[],o.declareService=function(a){return this.__service_list.push(a),this},o.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},o.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.__element)throw new Error("No element defined");return this.__element}),o.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},o.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),o.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},v.__ready_list=o.__ready_list.slice(),v.__service_list=o.__service_list.slice(),v.ready=o.ready,v.declareService=o.declareService,v.prototype=new o,v.prototype.constructor=v,x.__ready_list=o.__ready_list.slice(),x.ready=o.ready,x.__service_list=o.__service_list.slice(),x.declareService=o.declareService,x.prototype=new o,x.prototype.constructor=x,o.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=C;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=D.getAbsoluteURL(b,this.__path),C=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=w;else if("iframe"===d.sandbox)a=y;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=z}return a(b,d,g)}).push(function(a){return B=void 0,a}).push(void 0,function(a){throw B=void 0,a}),f=C,e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}var h,i;for(h=0;h<c.constructor.__ready_list.length;h+=1)e.push(c.constructor.__ready_list[h]),e.push(f);if(i=d.scope,void 0===i)for(i="RJS_"+I,I+=1;g.__sub_gadget_dict.hasOwnProperty(i);)i="RJS_"+I,I+=1;return g.__sub_gadget_dict[i]=c,c.__element.setAttribute("data-gadget-scope",i),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(s),e.push(f),c})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),D=function(a){var c;if(a===b&&(c=B),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},D.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},D.AcquisitionError.prototype=new Error,D.AcquisitionError.prototype.constructor=D.AcquisitionError,D.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>";return a&&b&&!J.test(a)?(c=(new d).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},D.declareJS=function(b){var d;return d=G.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){G[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},D.declareCSS=function(b){var d;return d=H.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){H[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},D.declareGadgetKlass=function(a){function b(b){var c,e,f;if(!F.hasOwnProperty(a)){c=function(){o.call(this)},c.__ready_list=o.__ready_list.slice(),c.__service_list=o.__service_list.slice(),c.declareMethod=o.declareMethod,c.declareAcquiredMethod=o.declareAcquiredMethod,c.allowPublicAcquisition=o.allowPublicAcquisition,c.ready=o.ready,c.declareService=o.declareService,c.prototype=new o,c.prototype.constructor=c,c.prototype.__path=a,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(b.responseText,"text/html"),f=D.parseGadgetHTMLDocument(c.__template_element,a);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);F[a]=c}return F[a]}var e;return e=F.hasOwnProperty(a)?c.resolve(F[a]):(new c.Queue).push(function(){return k(a)}).push(function(a){return b(a)})},D.clearGadgetKlassList=function(){F={},G={},H={}},D.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!J.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(D.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(D.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(D.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=D,b.__RenderJSGadget=o,b.__RenderJSEmbeddedGadget=v,b.__RenderJSIframeGadget=x,A()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i){"use strict";function j(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function k(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function l(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function m(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)}function n(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function o(){return this instanceof o?void 0:new o}function p(a){void 0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=new E,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(function(a){return m(a)})}function q(a){a.__sub_gadget_dict={},p(a)}function r(a){var b,d,e,f,g,h=a.__element.querySelectorAll("[data-gadget-url]"),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!==e&&i.push(a.declareGadget(e,{element:b,scope:d||void 0,sandbox:f||void 0}));return c.all(i)}function s(a){a.__monitor.monitor((new c.Queue).push(function(){var b,c=a.constructor.__service_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a))}))}function t(a,b,d){var e,f,g=this;for(e in g.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(new c.Queue).push(function(){var a=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))return a[b].apply(g,[d,f]);throw new D.AcquisitionError("aq_dynamic is not defined")}).push(void 0,function(a){if(a instanceof D.AcquisitionError)return g.__aq_parent(b,d);throw a})}function u(a,b){a.__aq_parent=function(c,d){return t.apply(b,[a,c,d])}}function v(){return this instanceof v?void o.call(this):new v}function w(b,d,e){function f(a,b){return function(){return a(b)}}var g;return void 0===d.element&&(d.element=a.createElement("div")),(new c.Queue).push(function(){return D.declareGadgetKlass(b)}).push(function(a){var b,f=a.__template_element.body.childNodes;for(B=a,g=new a,g.__element=d.element,b=0;b<f.length;b+=1)g.__element.appendChild(f[b].cloneNode(!0));return u(g,e),c.all([g.getRequiredJSList(),g.getRequiredCSSList()])}).push(function(a){var b,d=new c.Queue;for(b=0;b<a[0].length;b+=1)d.push(f(D.declareJS,a[0][b]));for(b=0;b<a[1].length;b+=1)d.push(f(D.declareCSS,a[1][b]));return d}).push(function(){return g})}function x(){return this instanceof x?void o.call(this):new x}function y(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new x,u(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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:function(a){c(a)},error:function(a){d(a)}})});return(new c.Queue).push(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.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)])}function z(a,b,e){return(new c.Queue).push(function(){return k(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),j(c)}).push(function(a){return y(a,b,e)})}function A(){var d,h,i,j,k,n,q,r,t=l(b.location.href),w=new c.Queue,x=0,y=!1,z=[],A=!1,E=!1;if(F.hasOwnProperty(t))throw new Error("bootstrap should not be called twice");C=new c.Promise(function(l,w){function C(){var b,e,i=D.parseGadgetHTMLDocument(a,t);for(e in i)i.hasOwnProperty(e)&&(d.prototype["__"+e]=i[e]);for(d.__template_element=a.createElement("div"),h.__element=a.body,b=0;b<h.__element.childNodes.length;b+=1)d.__template_element.appendChild(h.__element.childNodes[b].cloneNode(!0));c.all([h.getRequiredJSList(),h.getRequiredCSSList()]).then(function(a){var b,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)G[c[b]]=null;for(b=0;b<d.length;b+=1)H[d[b]]=null;B=void 0}).then(function(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&p(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==h._gadget&&p(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")&&void 0!==h._gadget&&a.contains(h)&&s(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void 0!==h._gadget&&s(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),h}).then(l,function(a){throw w(a),console.error(a),a})}q=new o,q.__acquired_method_dict={reportServiceError:function(a){m(a[0])}},q.__aq_parent=function(a){throw new D.AcquisitionError("No gadget provides "+a)},b.self===b.top?(d=function(){o.call(this)},d.declareMethod=o.declareMethod,d.declareAcquiredMethod=o.declareAcquiredMethod,d.allowPublicAcquisition=o.allowPublicAcquisition,d.__ready_list=o.__ready_list.slice(),d.ready=o.ready,d.__service_list=o.__service_list.slice(),d.declareService=o.declareService,d.prototype=new o,d.prototype.constructor=d,d.prototype.__path=t,F[t]=d,h=new F[t],u(h,q)):(d=v,d.__ready_list=o.__ready_list.slice(),d.__service_list=o.__service_list.slice(),d.prototype.__path=t,h=new v,u(h,q),i=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a;for(n=!1,h.__aq_parent=d.prototype.__aq_parent=function(a,b,d){return new c.Promise(function(c,e){i.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){e(a)},timeout:d})})},k=function(a){x+=1,i.call({method:"declareMethod",params:a,success:function(){x-=1,j()},error:function(){x-=1}})},a=0;a<z.length;a+=1)k(z[a]);return z=[],A?void i.notify({method:"failed",params:r}):(E=!0,j(),void i.bind("methodCall",function(a,b){h[b[0]].apply(h,b[1]).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}))}}),j=function(){0===x&&y===!0&&i.notify({method:"ready"})},k=function(a){z.push(a)},k("getInterfaceList"),k("getRequiredCSSList"),k("getRequiredJSList"),k("getPath"),k("getTitle"),d.declareMethod=function(a,b){var c=o.declareMethod.apply(this,[a,b]);return k(a),c},d.declareService=o.declareService,d.declareAcquiredMethod=o.declareAcquiredMethod,d.allowPublicAcquisition=o.allowPublicAcquisition,n=!0),d.prototype.__acquired_method_dict={},B=d,a.addEventListener("DOMContentLoaded",C,!1)}),w.push(function(){return C}).push(function(a){function b(){return a}var c;for(d.ready(function(a){return s(a)}),w.push(b),c=0;c<d.__ready_list.length;c+=1)w.push(d.__ready_list[c]).push(b)}),b.self===b.top?w.fail(function(a){throw m(a),a}):w.then(function(){y=!0,E&&j()}).fail(function(a){throw n?(A=!0,r=a.toString(),m(a)):i.notify({method:"failed",params:a.toString()}),a})}var B,C,D,E,F={},G={},H={},I=0,J=new RegExp("^(?:[a-z]+:)?//|data:","i");n.prototype=new Error,n.prototype.constructor=n,E=function(){function a(){var a,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}var b,d,e,f,g=this,h=[];return this instanceof E?(b=new c.Promise(function(b,c,h){d=function(b){return f?void 0:(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(){return b.then.apply(b,arguments)},g.fail=function(){return b.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)throw new n;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){return e(a),a});return h.push(b),this})):new E},E.prototype=Object.create(c.Promise.prototype),E.prototype.constructor=E,o.prototype.__title="",o.prototype.__interface_list=[],o.prototype.__path="",o.prototype.__html="",o.prototype.__required_css_list=[],o.prototype.__required_js_list=[],o.__ready_list=[q,r],o.ready=function(a){return this.__ready_list.push(a),this},o.__service_list=[],o.declareService=function(a){return this.__service_list.push(a),this},o.declareMethod=function(a,b){return this.prototype[a]=function(){var a=this,d=arguments;return(new c.Queue).push(function(){return b.apply(a,d)})},this},o.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.__element)throw new Error("No element defined");return this.__element}),o.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),d=this;return(new c.Queue).push(function(){return d.__aq_parent(b,a)})},this},o.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),o.allowPublicAcquisition=function(a,b){return this.prototype.__acquired_method_dict[a]=b,this},v.__ready_list=o.__ready_list.slice(),v.__service_list=o.__service_list.slice(),v.ready=o.ready,v.declareService=o.declareService,v.prototype=new o,v.prototype.constructor=v,x.__ready_list=o.__ready_list.slice(),x.ready=o.ready,x.__service_list=o.__service_list.slice(),x.declareService=o.declareService,x.prototype=new o,x.prototype.constructor=x,o.declareMethod("declareGadget",function(b,d){var e,f,g=this,h=C;return void 0===d&&(d={}),void 0===d.sandbox&&(d.sandbox="public"),b=D.getAbsoluteURL(b,this.__path),C=(new c.Queue).push(function(){return h}).push(void 0,function(){}).push(function(){var a;if("public"===d.sandbox)a=w;else if("iframe"===d.sandbox)a=y;else{if("dataurl"!==d.sandbox)throw new Error("Unsupported sandbox options '"+d.sandbox+"'");a=z}return a(b,d,g)}).push(function(a){return B=void 0,a}).push(void 0,function(a){throw B=void 0,a}),f=C,e=(new c.Queue).push(function(){return f}).push(function(c){function f(){return c}var h,i;for(h=0;h<c.constructor.__ready_list.length;h+=1)e.push(c.constructor.__ready_list[h]),e.push(f);if(i=d.scope,void 0===i)for(i="RJS_"+I,I+=1;g.__sub_gadget_dict.hasOwnProperty(i);)i="RJS_"+I,I+=1;return g.__sub_gadget_dict[i]=c,c.__element.setAttribute("data-gadget-scope",i),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(s),e.push(f),c})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new Error("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),D=function(a){var c;if(a===b&&(c=B),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},D.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},D.AcquisitionError.prototype=new Error,D.AcquisitionError.prototype.constructor=D.AcquisitionError,D.getAbsoluteURL=function(a,b){var c,e,f,g="<!doctype><html><head></head></html>";return a&&b&&!J.test(a)?(c=(new d).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},D.declareJS=function(b){var d;return d=G.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("script"),e.type="text/javascript",e.src=b,e.onload=function(){G[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},D.declareCSS=function(b){var d;return d=H.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,d){var e;e=a.createElement("link"),e.rel="stylesheet",e.type="text/css",e.href=b,e.onload=function(){H[b]=null,c()},e.onerror=function(a){d(a)},a.head.appendChild(e)})},D.declareGadgetKlass=function(a){function b(b){var c,e,f;if(!F.hasOwnProperty(a)){c=function(){o.call(this)},c.__ready_list=o.__ready_list.slice(),c.__service_list=o.__service_list.slice(),c.declareMethod=o.declareMethod,c.declareAcquiredMethod=o.declareAcquiredMethod,c.allowPublicAcquisition=o.allowPublicAcquisition,c.ready=o.ready,c.declareService=o.declareService,c.prototype=new o,c.prototype.constructor=c,c.prototype.__path=a,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(b.responseText,"text/html"),f=D.parseGadgetHTMLDocument(c.__template_element,a);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);F[a]=c}return F[a]}var e;return e=F.hasOwnProperty(a)?c.resolve(F[a]):(new c.Queue).push(function(){return k(a)}).push(function(a){return b(a)})},D.clearGadgetKlassList=function(){F={},G={},H={}},D.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!J.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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(D.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(D.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(D.getAbsoluteURL(d.getAttribute("src"),b)));return e},b.rJS=b.renderJS=D,b.__RenderJSGadget=o,b.__RenderJSEmbeddedGadget=v,b.__RenderJSIframeGadget=x,A()}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob);
\ No newline at end of file
var Channel=function(){"use strict";function a(a,b,c,d){function f(b){for(var c=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}var g=!1;if("*"===b){for(var h in e)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeof e[h][c]&&(g=f(e[h][c])))break}else e["*"]&&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"!=typeof e[b]&&(e[b]={}),"object"!=typeof e[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}function b(a,b,c){for(var d=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&delete e[b][c]}function c(a){return Array.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}var d=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{var b=JSON.parse(a.data);if("object"!=typeof b||null===b)throw"malformed"}catch(a){return}var c,d,g,h=a.source,i=a.origin;if("string"==typeof b.method){var j=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeof b.id&&(d=b.id),"string"==typeof g){var k=!1;if(e[i]&&e[i][c])for(var l=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(var l=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeof d&&f[d]&&f[d](i,g,b)};return window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){var g=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeof a&&(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"!=typeof e)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";var h=!1;if("string"==typeof e.origin){var i;"*"===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"!=typeof e.scope){if("string"!=typeof e.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}var j=function(){for(var a="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){var d=!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(var e=!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;delete m[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;delete m[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeof a&&(d=a===!0),d},completed:function(){return e}}},q=function(a,b,c){return window.setTimeout(function(){if(l[a]){var d="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),delete l[a],delete f[a]}},b)},r=function(a,b,d){if("function"==typeof e.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){var i=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(var j=0;j<d.callbacks.length;j++){for(var n=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){var s=q[r];"object"!=typeof o[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){var a=n;return function(b){return i.invoke(a,b)}}()}var t=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){var u="runtime_error",v=null;if("string"==typeof h?v=h:"object"==typeof h&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeof h.error&&(u=h.error,h.message?"string"==typeof h.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeof v&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}else d.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):void 0!==d.result?l[d.id].success(d.result):l[d.id].success(),delete l[d.id],delete f[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeof e.scope?e.scope:"",r);var s=function(a){return"string"==typeof e.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";var c=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeof e.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}else o.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"==typeof e.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!delete k[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeof a)throw"'method' argument to bind must be string";if(!b||"function"!=typeof b)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";return k[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeof a.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeof a.success)throw"'success' callback missing from call";var b={},c=[],e=function(a,d){if("object"==typeof d)for(var f in d)if(d.hasOwnProperty(f)){var g=a+(a.length?"/":"")+f;"function"==typeof d[f]?(b[g]=d[f],c.push(g),delete d[f]):"object"==typeof d[f]&&e(g,d[f])}};e("",a.params);var g={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"!=typeof a.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"==typeof e.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=""}};return v.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";var b=a.prototype,c=b.parseFromString;try{if((new a).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){var d,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"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a){"use strict";function b(b,c){var d,e,f,g="<!doctype><html><head></head></html>";return b&&c?(d=(new a).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}function c(a,c){if(void 0!==c){if(!e.test(c))throw new TypeError("Failed to construct 'URL': Invalid base URL");a=b(a,c)}if(!e.test(a))throw new TypeError("Failed to construct 'URL': Invalid URL");this.href=a}try{if("https://example.com/a"===new window.URL("../a","https://example.com/").href)return}catch(d){}var e=/^(?:[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";function m(a){if(this.name="scopeerror",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Scope Error"}function n(a,b,d){var e;try{e=a.apply(d,b)}catch(f){return(new c.Queue).push(function(){return c.reject(f)})}return e instanceof c.Queue?e:(new c.Queue).push(function(){return e})}function o(a){var b=new h;return new c.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}function p(a,b,d,e,f){function g(){void 0!==k&&"function"==typeof k.cancel&&k.cancel()}function h(){void 0!==j&&a.removeEventListener(b,j,d),g()}function i(i,l){var m;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(new c.Queue).push(function(){return m}).push(void 0,function(a){a instanceof c.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}var j,k;return void 0===f&&(f=!0),new c.Promise(i,h)}function q(){function a(){b.cancelAnimationFrame(e)}function d(a){e=b.requestAnimationFrame(a)}var e;return new c.Promise(d,a)}function r(a){function b(b,c){function d(){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=new XMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}function d(){void 0!==e&&e.readyState!==e.DONE&&e.abort()}var e;return new c.Promise(b,d)}function s(a){var b=a.indexOf("#");return b>0&&(a=a.substring(0,b)),a}function t(c){var d,e,f,g,h,i;if(aa)return console.info("-- Error dropped, as page is unloaded"),void console.info(c);for(ba.push(c),ba.push(new Error("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: "+new Date(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<ba.length;d+=1){if(i=ba[d],i instanceof k&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void 0!==i.target&&ba.splice(d+1,0,i.target)),i instanceof XMLHttpRequest&&(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),void 0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void 0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}function u(a){if(this.name="resolved",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message"}function v(){return this instanceof v?void 0:new v}function w(a){a.hasOwnProperty("__monitor")&&(a.__monitor.cancel(),delete a.__monitor,a.__job_list=[])}function x(a){a.__monitor=new T,a.__job_dict={},a.__job_triggered=!1,a.__monitor.fail(function(b){return b instanceof c.CancellationError?void 0:a.aq_reportServiceError(b)}).fail(t)}function y(a){a.__sub_gadget_dict={},a.__job_list=[],void 0!==a.__json_state&&(a.state=JSON.parse(a.__json_state))}function z(){function a(a){return function(b){var c=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))return c[d].apply(j,[arguments,a]);throw b}}var b,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||void 0,sandbox:f||void 0}).push(void 0,a(d)));return c.all(i)}function A(a,b,d,e){var f=n(d,e,a);a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((new c.Queue).push(function(){return f}).push(void 0,function(a){if(!(a instanceof c.CancellationError))throw a}))}function B(a){(0!==a.constructor.__service_list.length||a.constructor.__job_declared)&&(x(a),a.__monitor.monitor((new c.Queue).push(function(){var b,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})))}function C(a,b,c){var d,e,f=this,g=f.__acquired_method_dict||{};if(!g.hasOwnProperty(b))return f.__aq_parent(b,c);for(d in f.__sub_gadget_dict)f.__sub_gadget_dict.hasOwnProperty(d)&&f.__sub_gadget_dict[d]===a&&(e=d);return n(g[b],[c,e],f).push(void 0,function(a){if(a instanceof S.AcquisitionError)return f.__aq_parent(b,c);throw a})}function D(a,b){a.__aq_parent=function(c,d){return C.apply(b,[a,c,d])}}function E(){return this instanceof E?void v.call(this):new E}function F(b,c,d){void 0===c.element&&(c.element=a.createElement("div"));var e,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=new b,f.element=c.element,f.state={},e=0;e<g.length;e+=1)h.appendChild(g[e].cloneNode(!0));return f.element.appendChild(h),D(f,d),f}function G(a,b,c){var d=S.declareGadgetKlass(a);return"function"==typeof d.then?d.then(function(a){return F(a,b,c)}):F(d,b,c)}function H(){return this instanceof H?void v.call(this):new H}function I(b,d,f){var g,h,i=c.defer();if(void 0===d.element)throw new Error("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))throw new Error("The parent element is not attached to the DOM for "+b);return g=new H,D(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){return c.timeout(5e3).fail(function(){i.reject(new Error("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){return g[b]=function(){var a=arguments,d=new c.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return n(function(){return d})},"OK"}),g.__chan.bind("ready",function(a){return i.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){return i.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){(new c.Queue).push(function(){return g.__aq_parent.apply(g,b)}).then(a.complete).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}function J(a,b,e){return(new c.Queue).push(function(){return r(a)}).push(function(b){var c,e=(new d).parseFromString(b.responseText,"text/html"),f=e.createElement("base");return f.href=a,e.head.insertBefore(f,e.head.firstChild),c=new i([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),o(c)}).push(function(a){return I(a,b,e)})}function K(b,d,e,f){function g(a){return function(){return a.call(b,b)}}function h(){return a.contains(b.element)&&B(b),b}var i,j,k;if(y(b),j=d.scope,void 0===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=new c.Queue,i=0;i<b.constructor.__ready_list.length;i+=1)k.push(g(b.constructor.__ready_list[i]));return k.push(h),k}return h()}function L(a,b){var c,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=new v,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(new d).parseFromString(a.responseText,"text/html"),f=S.parseGadgetHTMLDocument(c.__template_element,b);for(e in f)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);return c.__template_element.querySelectorAll("[data-gadget-url]").length&&c.__ready_list.push(z),c}function M(b,d,e){var h,i,j=S.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(i in j)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));return b.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){var b,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(){var b=a.querySelector("body"),c=new f(function(b){var c,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")&&void 0!==h._gadget&&w(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void 0!==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")&&void 0!==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)&&void 0!==h._gadget&&B(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};return c.observe(b,d),e})}function N(){var a=new v;return a.__acquired_method_dict={reportServiceError:function(a){t(a[0])}},a.__aq_parent=function(a){throw new S.AcquisitionError("No gadget provides "+a)},a}function O(a){var d,f,g,h,i,j,k,l;if(W.hasOwnProperty(a))throw new Error("bootstrap should not be called twice");return d=E,d.__ready_list=[],d.__service_list=v.__service_list.slice(),d.prototype.__path=a,f=new E,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,(new c.Queue).push(function(){return c.delay(1e3)}).push(function(){return l[2]=void 0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){var a,b;for(h=function(a){i.push(new c.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){var c=v.declareMethod.apply(this,[a,b]);return h(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}function P(a,b){function d(a){return function(){return a.call(b,b)}}var e,f=new c.Queue;for(a.ready(function(){return B(b)}),e=0;e<a.__ready_list.length;e+=1)f.push(d(a.__ready_list[e]));return f}function Q(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){return new c.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)})}function R(a){var b,d,e,f,g=O(a);return(new c.Queue).push(function(){return g}).push(function(a){return b=a[0],d=a[1],e=a[2],f=a[3],V.promise}).push(function(){return c.all(f)}).push(function(c){return void 0!==e&&Q(b,d,e),M(b,a,d)}).push(function(){return y(d),b.__ready_list.unshift(z),P(b,d)}).push(function(){void 0!==e&&e.notify({method:"ready"})}).push(void 0,function(a){throw t(a),void 0!==e&&e.notify({method:"failed",params:a.toString()}),a})}m.prototype=new Error,m.prototype.constructor=m;var S,T,U,V,W={},X={},Y={},Z=[],$=0,_=new RegExp("^(?:[a-z]+:)?//|data:","i"),aa=!1,ba=[];b.addEventListener("error",function(a){ba.push(a)}),b.addEventListener("beforeunload",function(){aa=!0}),U=function(){return this instanceof U?void(this._latest_promise=null):new U},U.prototype={constructor:U,lockAndRun:function(a){var b=this._latest_promise;return null===b?this._latest_promise=c.resolve(a()):this._latest_promise=this._latest_promise.always(function(){return a()}),this._latest_promise}},u.prototype=new Error,u.prototype.constructor=u,T=function(){function a(){var a,b=g.length;for(a=0;b>a;a+=1)g[a].cancel();g=[]}var b,d,e,f=this,g=[];return this instanceof T?(b=new c.Promise(function(b,c){d=function(b){return e?void 0:(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)throw new u;var b=(new c.Queue).push(function(){return a}).push(function(a){var b,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){throw b instanceof c.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b});return g.push(b),this})):new T},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){return this.__ready_list.push(a),this},v.setState=function(a){return this.prototype.__json_state=JSON.stringify(a),this},v.onStateChange=function(a){return this.prototype.__state_change_callback=a,this},v.__service_list=[],v.declareService=function(a){return this.__service_list.push(a),this},v.onEvent=function(a,b,c,d){return this.__service_list.push(function(){return p(this.element,a,c,b.bind(this),d)}),this},v.onLoop=function(a,b){return void 0===b&&(b=0),this.__service_list.push(function(){var d=new c.Queue,e=this,f=function(){d.push(function(){return c.delay(b)}).push(function(){return q()}).push(function(){return a.apply(e,[])}).push(f)};return f(),d}),this},v.declareJob=function(a,b){return this.__job_declared=!0,this.prototype[a]=function(){var c=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){return this.prototype[a]=function(){function a(){return b.apply(e,f)}var d,e=this,f=arguments;return void 0!==c&&c.hasOwnProperty("mutex")?(d="__mutex_"+c.mutex,e.hasOwnProperty(d)||(e[d]=new U),n(e[d].lockAndRun,[a],e[d])):n(b,f,e)},this},v.declareMethod("getInterfaceList",function(){return this.__interface_list}).declareMethod("getRequiredCSSList",function(){return this.__required_css_list}).declareMethod("getRequiredJSList",function(){return this.__required_js_list}).declareMethod("getPath",function(){return this.__path}).declareMethod("getTitle",function(){return this.__title}).declareMethod("getElement",function(){if(void 0===this.element)throw new Error("No element defined");return this.element}).declareMethod("changeState",function(a){var b,c,d=this,e=!1,f=d.hasOwnProperty("__modification_dict");f?(c=d.__modification_dict,e=!0):c={};for(b in a)a.hasOwnProperty(b)&&a[b]!==d.state[b]&&(d.state[b]=a[b],c[b]=a[b],e=!0);return e&&void 0!==d.__state_change_callback?(d.__modification_dict=c,n(d.__state_change_callback,[c],d).push(function(a){return delete d.__modification_dict,a})):void 0},{mutex:"changestate"}),v.declareAcquiredMethod=function(a,b){return this.prototype[a]=function(){var a=Array.prototype.slice.call(arguments,0),c=this;return n(c.__aq_parent,[b,a],c)},this},v.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),v.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),v.allowPublicAcquisition=function(a,b){return this.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=new v,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=new v,H.prototype.constructor=H,v.declareMethod("declareGadget",function(a,b){var d,e,f=this;if(void 0===b&&(b={}),void 0===b.sandbox&&(b.sandbox="public"),a=S.getAbsoluteURL(a,this.__path),"public"===b.sandbox)d=G;else if("iframe"===b.sandbox)d=I;else{if("dataurl"!==b.sandbox)throw new Error("Unsupported sandbox options '"+b.sandbox+"'");d=J}return e=d(a,b,f),"function"==typeof e.then?(new c.Queue).push(function(){return e}).push(function(c){return K(c,b,f,a)}):K(e,b,f,a)}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new m("Gadget scope '"+a+"' is not known.");return this.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))throw new m("Gadget scope '"+a+"' is not known.");delete this.__sub_gadget_dict[a]}),S=function(a){var c;if(a===b&&(c=Z[0]),void 0===c)throw new Error("Unknown selector '"+a+"'");return c},S.AcquisitionError=function(a){if(this.name="AcquisitionError",void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Acquisition failed"},S.AcquisitionError.prototype=new Error,S.AcquisitionError.prototype.constructor=S.AcquisitionError,S.getAbsoluteURL=function(a,b){return b&&a?new l(a,b).href:a},S.declareJS=function(b,d,e){var f;return X.hasOwnProperty(b)?f=c.resolve():(X[b]=null,f=new c.Promise(function(c,f){var g;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){var e;return e=Y.hasOwnProperty(b)?c.resolve():new c.Promise(function(c,e){var f;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){var d,e;if(W.hasOwnProperty(b)){if(W[b].hasOwnProperty("defer_list"))return e=c.defer(),W[b].defer_list.push(e),e.promise;if(W[b].is_resolved)return W[b].result;throw W[b].result}return W[b]={defer_list:[]},(new c.Queue).push(function(){return r(b)}).push(function(e){d=L(e,b);var f,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));return a.head.appendChild(g),c.all(h)}).push(function(){var a,c=W[b].defer_list.length;for(a=0;c>a;a+=1)W[b].defer_list[a].resolve(d);return delete W[b].defer_list,W[b].result=d,W[b].is_resolved=!0,d}).push(void 0,function(a){var c,d=W[b].defer_list.length;for(c=0;d>c;c+=1)W[b].defer_list[c].reject(a);throw delete W[b].defer_list,W[b].result=a,W[b].is_resolved=!1,a})},S.clearGadgetKlassList=function(){W={},X={},Y={}},S.parseGadgetHTMLDocument=function(a,b){var c,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!_.test(b))throw new Error("The url should be absolute: "+b);if(9!==a.nodeType)throw new Error("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)));return e},S.Mutex=U,S.ScopeError=m,b.rJS=b.renderJS=S,b.__RenderJSGadget=v,b.__RenderJSEmbeddedGadget=E,b.__RenderJSIframeGadget=H,V=new c.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);
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment