/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
var m=this||self,w=function(a,b){a=a.split(".");var c=m;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var e;a.length&&(e=a.shift());)a.length||void 0===b?c=c[e]&&c[e]!==Object.prototype[e]?c[e]:c[e]={}:c[e]=b},x=function(a,b){function c(){}c.prototype=b.prototype;a.A=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.v=function(e,d,h){for(var l=Array(arguments.length-2),n=2;n<arguments.length;n++)l[n-2]=arguments[n];return b.prototype[d].apply(e,l)}};function y(a){if(Error.captureStackTrace)Error.captureStackTrace(this,y);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}x(y,Error);y.prototype.name="CustomError";var z=function(a,b){a=a.split("%s");for(var c="",e=a.length-1,d=0;d<e;d++)c+=a[d]+(d<b.length?b[d]:"%s");y.call(this,c+a[e])};x(z,y);z.prototype.name="AssertionError";var B=function(a,b,c){if(!a){var e="Assertion failed";if(b){e+=": "+b;var d=Array.prototype.slice.call(arguments,2)}throw new z(""+e,d||[]);}return a};var C=Array.prototype.forEach?function(a,b){B(null!=a.length);Array.prototype.forEach.call(a,b,void 0)}:function(a,b){for(var c=a.length,e="string"===typeof a?a.split(""):a,d=0;d<c;d++)d in e&&b.call(void 0,e[d],d,a)};var D;a:{var F=m.navigator;if(F){var G=F.userAgent;if(G){D=G;break a}}D=""}var H=function(a){return-1!=D.indexOf(a)};var aa=-1!=D.toLowerCase().indexOf("webkit")&&!H("Edge")&&H("Mobile");try{(new self.OffscreenCanvas(0,0)).getContext("2d")}catch(a){};var ba=H("Safari")&&!((H("Chrome")||H("CriOS"))&&!H("Edge")||H("Coast")||H("Opera")||H("Edge")||H("Edg/")||H("OPR")||H("Firefox")||H("FxiOS")||H("Silk")||H("Android"))&&!(H("iPhone")&&!H("iPod")&&!H("iPad")||H("iPad")||H("iPod"));var K=function(a){var b=window;if(aa&&ba&&b){b.focus();var c=0,e=null;e=b.setInterval(function(){a.closed||5==c?(b.clearInterval(e),I(a)):(a.close(),c++)},150)}else a.close(),I(a)},I=function(a){if(!a.closed&&a.document&&a.document.body)if(a=a.document.body,B(null!=a,"goog.dom.setTextContent expects a non-null value for node"),"textContent"in a)a.textContent="Please close this window.";else if(3==a.nodeType)a.data="Please close this window.";else if(a.firstChild&&3==a.firstChild.nodeType){for(;a.lastChild!=
a.firstChild;)a.removeChild(B(a.lastChild));a.firstChild.data="Please close this window."}else{for(var b;b=a.firstChild;)a.removeChild(b);B(a,"Node cannot be null or undefined.");a.appendChild((9==a.nodeType?a:a.ownerDocument||a.document).createTextNode("Please close this window."))}};function ca(){function a(){d[0]=1732584193;d[1]=4023233417;d[2]=2562383102;d[3]=271733878;d[4]=3285377520;u=q=0}function b(g){for(var k=l,f=0;64>f;f+=4)k[f/4]=g[f]<<24|g[f+1]<<16|g[f+2]<<8|g[f+3];for(f=16;80>f;f++)g=k[f-3]^k[f-8]^k[f-14]^k[f-16],k[f]=(g<<1|g>>>31)&4294967295;g=d[0];var p=d[1],r=d[2],t=d[3],J=d[4];for(f=0;80>f;f++){if(40>f)if(20>f){var v=t^p&(r^t);var E=1518500249}else v=p^r^t,E=1859775393;else 60>f?(v=p&r|t&(p|r),E=2400959708):(v=p^r^t,E=3395469782);v=((g<<5|g>>>27)&4294967295)+v+
J+E+k[f]&4294967295;J=t;t=r;r=(p<<30|p>>>2)&4294967295;p=g;g=v}d[0]=d[0]+g&4294967295;d[1]=d[1]+p&4294967295;d[2]=d[2]+r&4294967295;d[3]=d[3]+t&4294967295;d[4]=d[4]+J&4294967295}function c(g,k){if("string"===typeof g){g=unescape(encodeURIComponent(g));for(var f=[],p=0,r=g.length;p<r;++p)f.push(g.charCodeAt(p));g=f}k||(k=g.length);f=0;if(0==q)for(;f+64<k;)b(g.slice(f,f+64)),f+=64,u+=64;for(;f<k;)if(h[q++]=g[f++],u++,64==q)for(q=0,b(h);f+64<k;)b(g.slice(f,f+64)),f+=64,u+=64}function e(){var g=[],k=
8*u;56>q?c(n,56-q):c(n,64-(q-56));for(var f=63;56<=f;f--)h[f]=k&255,k>>>=8;b(h);for(f=k=0;5>f;f++)for(var p=24;0<=p;p-=8)g[k++]=d[f]>>p&255;return g}for(var d=[],h=[],l=[],n=[128],A=1;64>A;++A)n[A]=0;var q,u;a();return{reset:a,update:c,digest:e,digestString:function(){for(var g=e(),k="",f=0;f<g.length;f++)k+="0123456789ABCDEF".charAt(Math.floor(g[f]/16))+"0123456789ABCDEF".charAt(g[f]%16);return k}}};var da=function(a,b,c){var e=[];if(1==(Array.isArray(null)?2:1))return e=[b,a],C(c,function(n){e.push(n)}),L(e.join(" "));var d=[],h=[];C(null,function(n){h.push(n.key);d.push(n.value)});var l=Math.floor((new Date).getTime()/1E3);e=0==d.length?[l,b,a]:[d.join(":"),l,b,a];C(c,function(n){e.push(n)});a=L(e.join(" "));l=[l,a];0==h.length||l.push(h.join(""));return l.join("_")},L=function(a){var b=ca();b.update(a);return b.digestString().toLowerCase()};var M=function(a){a=a||[];for(var b=[],c=0,e=a.length;c<e;++c){var d=String(a[c]||"");d&&b.push(d)}if(2>b.length)return null;a=b[0];c=gadgets.rpc.getOrigin(b[1]);if(c!==b[1])return null;b=b.slice(2);if(c&&a){if(d=c){d=d.split("#")[0].split("?")[0];d=d.toLowerCase();0==d.indexOf("//")&&(d=window.location.protocol+d);/^[\w\-]*:\/\//.test(d)||(d=window.location.href);c=d.substring(d.indexOf("://")+3);e=c.indexOf("/");-1!=e&&(c=c.substring(0,e));e=d.substring(0,d.indexOf("://"));if(!e)throw Error("URI is missing protocol: "+
d);if("http"!==e&&"https"!==e&&"chrome-extension"!==e&&"moz-extension"!==e&&"file"!==e&&"android-app"!==e&&"chrome-search"!==e&&"chrome-untrusted"!==e&&"chrome"!==e&&"app"!==e&&"devtools"!==e)throw Error("Invalid URI scheme in origin: "+e);d="";var h=c.indexOf(":");if(-1!=h){var l=c.substring(h+1);c=c.substring(0,h);if("http"===e&&"80"!==l||"https"===e&&"443"!==l)d=":"+l}c=e+"://"+c+d}else c="";a=["session_state",da(c,a,b||[])].join(" ")}else a=null;return(a=a||"")&&a.substr(14)||null},N=function(a,
b,c){this.o=String(a||"");this.j=String(b||"");this.h=String(c||"");this.g={};this.s=this.u=this.l=this.m="";this.i=null};
N.prototype.evaluate=function(){var a={},b="";try{b=String(document.cookie||"")}catch(l){}b=b.split("; ").join(";").split(";");for(var c=0,e=b.length;c<e;++c){var d=b[c],h=d.indexOf("=");-1!=h?a[d.substr(0,h)]=d.substr(h+1):a[d]=null}this.g=a;if(this.g.SAPISID||this.g.APISID||this.g["__Secure-3PAPISID"]||this.g.SID)if(this.j=this.j.split(".")[0].split("@")[0],this.l=O(this,this.o))if(a=gadgets.rpc.getOrigin(String(window.location.href)),this.m=O(this,a)){b=String(this.g.LSOLH||"").split(":");c=b.length;
if(1==c||4==c)this.u=b[0];if(3==c||4==c)a=String(b[c-3]||""),b=String(b[c-1]||""),c=this.m,a?(e=[a],c&&e.push(c),c=L(e.join(" ")).substr(0,4)):c=null,c===b&&(this.s=a);this.h&&(a=this.h.indexOf("."),-1!=a&&(a=this.h.substr(0,a)||"",this.h=a+"."+M([this.l,this.o,this.j,this.u,this.s,a]).substr(0,4)));a=M([this.l,this.o,this.j,this.h]);this.h&&(a=a+"."+this.h);this.i=a}else this.i="";else this.i=""};
var O=function(a,b){(b=String(a.g[0==b.indexOf("https://")?"SAPISID":"APISID"]||""))||(b=String(a.g["__Secure-3PAPISID"]||""));return b};N.prototype.getVersionInfo=function(a){var b=parseInt(a,10);if(String(b)!=a||!(0<=b))return null;a=this.s;if(!a)return null;a=a.split("|");return a.length<=b?null:a[b]||null};
var P=function(a,b,c){a=new N(a,b,c);a.evaluate();return a},R=function(a,b,c){c=c||Q(this);var e=null;if(a){a=String(a);var d=a.indexOf(".");-1!=d&&(e=a.substr(d+1))}b=P(c,b,e).i;if(null==a||""==a)a=b==a;else if(null==b||b.length!=a.length)a=!1;else{e=c=0;for(d=a.length;e<d;++e)c|=a.charCodeAt(e)^b.charCodeAt(e);a=0==c}return a},S=function(a,b,c){c=c||Q(this);c=P(c);if(String(a)!=c.i)throw Error("Unauthorized request");return c.getVersionInfo(String(b))},Q=function(a){a=String(a.origin||"");if(!a)throw Error("RPC has no origin.");
return a};w("checkSessionState",R);w("getVersionInfo",S);var T,U,V,W,X,Y,ea=window,Z=(window.location.href||ea.location.href).match(/.*(\?|#|&)usegapi=([^&#]+)/)||[];
"1"===decodeURIComponent(Z[Z.length-1]||"")?(V=function(a,b,c,e,d,h){T.send(b,d,e,h||gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)},W=function(a,b){T.register(a,b,gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)},X=function(a){var b=/^(?:https?:\/\/)?[0-9.\-A-Za-z]+(?::\d+)?/.exec(a);b=gapi.iframes.makeWhiteListIframesFilter([b?b[0]:null]);V("..","oauth2callback",gadgets.rpc.getAuthToken(".."),void 0,a,b)},U=function(){fa()},Y=function(){V("..","oauth2relayReady",gadgets.rpc.getAuthToken(".."));W("check_session_state",
ha);W("get_versioninfo",ia)}):(V=function(a,b,c,e,d){gadgets.rpc.call(a,b+":"+c,e,d)},W=function(a,b){gadgets.rpc.register(a,b)},X=function(a){gadgets.rpc.getTargetOrigin("..")==gadgets.rpc.getOrigin(a)&&V("..","oauth2callback",gadgets.rpc.getAuthToken(".."),void 0,a)},U=function(){Y()},Y=function(){V("..","oauth2relayReady",gadgets.rpc.getAuthToken(".."));W("check_session_state",R);W("get_versioninfo",S)});
var fa=function(){var a=Y;window.gapi.load("gapi.iframes",function(){T=gapi.iframes.getContext().getParentIframe();a()})},ja=function(a){window.setTimeout(function(){X(a)},1)},ha=function(a){if(a){var b=a.session_state;var c=a.client_id}return R(b,c,T.getOrigin())},ia=function(a){return S(a.xapisidHash,a.sessionIndex,T.getOrigin())},ka=!1,la=!1,ma=function(){la=!0;ka&&U()};w("oauth2callback",ja);
w("oauth2verify",function(a,b){var c=window.open("about:blank",a),e;if(c&&!c.closed&&(e=c.oauth2callbackUrl))return window.timeoutMap=window.timeoutMap||{},window.realSetTimeout=window.realSetTimeout||window.setTimeout,window.setTimeout=function(d,h){try{var l=d,n=!1;d=function(){if(!n){n=!0;try{window.timeoutMap[String(q)]=void 0,delete window.timeoutMap[String(q)]}catch(u){}return l.call(this)}};var A=c.setTimeout(d,h);var q=window.realSetTimeout(d,h);window.timeoutMap[String(q)]=A;return q}catch(u){}return window.realSetTimeout(d,
h)},window.realClearTimeout=window.realClearTimeout||window.clearTimeout,window.clearTimeout=function(d){try{var h=window.timeoutMap[String(d)];h&&c.clearTimeout(h)}catch(l){}try{window.timeoutMap[String(d)]=void 0,delete window.timeoutMap[String(d)]}catch(l){}window.realClearTimeout(d)},ja(String(e)),"keep_open"!=b&&K(c),!0;c&&!c.closed&&K(c);return!1});w("init",function(){ka=!0;la&&U()});window.addEventListener?window.addEventListener("load",ma,!1):window.attachEvent("onload",ma);
