'use strict';var yi;var zi=chrome.i18n.getMessage("545449835455981095");y("mr.IssueSeverity",{FA:"fatal",AK:"warning",CE:"notification"});y("mr.IssueAction",{tA:"dismiss",VC:"learn_more"});
var Ai=function(a,b){this.sinkId=this.routeId=null;this.severity=b;this.isBlocking="fatal"==this.severity?!0:!1;this.title=a;this.message=null;this.defaultAction="dismiss";this.helpPageId=this.secondaryActions=null},Ci=function(){var a=new Ai(Bi,"notification");a.helpPageId=6320939;a.defaultAction="learn_more";a.secondaryActions=["dismiss"];return a},Di=function(a,b){a.routeId=b;return a},Ei=function(a,b){a.sinkId=b;return a};var Fi=function(a,b){var c=this;this.h=void 0===b?null:b;this.g=new Promise(function(d,e){var f=function(g){c.h=null;e(g)};c.j=f;a(function(g){c.h=null;d(g)},f)})};Fi.prototype.cancel=function(a){this.j(a);if(this.h){var b=this.h;this.h=null;setTimeout(function(){return b(a)},0)}};var Gi=function(a,b,c){c=void 0===c?null:c;return new Fi(function(d,e){a.g.then(function(f){if(b)try{d(b(f))}catch(g){e(g)}else d(f)},function(f){if(c)try{d(c(f))}catch(g){e(g)}else e(f)})},function(d){a.cancel(d)})};
Fi.prototype.then=function(a,b){return Gi(this,a,void 0===b?null:b)};var Hi=function(a,b){return Gi(a,null,b)},Ii=function(a){return new Fi(function(b){b(a)})},Ji=function(a){return new Fi(function(b,c){c(a)})},Ki=function(a){return new Fi(function(b,c){a.then(b,c)})},Li=function(a,b){var c=!1,d=null;return new Fi(function(e,f){a.then(function(g){c||(d=b(g),d.g.then(e,f))},f)},function(e){d?d.cancel(e):c=!0})};var Mi={Yy:0,Wy:1,az:2,Xy:3,Bx:4,Zy:5,dC:6,YI:7,oA:8,UNKNOWN:9},Ni=function(a,b){a=Error.call(this,a);this.message=a.message;"stack"in a&&(this.stack=a.stack);this.reason=0<=b&&9>=b?b:9};t(Ni,Error);var Oi=function(){var a=n(navigator.userAgent.match(/Windows NT (\d+.\d+)/)||[]);a.next();a=a.next().value;return 6.2<=parseFloat(a)},Pi=function(){var a=navigator.userAgent;return a.includes("CrOS")?"ChromeOS":a.includes("Windows")?"Windows":a.includes("Macintosh")?"Mac":a.includes("Linux")?"Linux":"Other"};var Qi=["ChromeOS","Windows"].includes(Pi());var Ri=function(a,b,c,d){this.h=a;this.g=b;this.j=c||null;this.presentationId=d||null},Ui=function(a,b){if("tab"==a.h)a=Si(a);else if("offscreen_tab"==a.h)b=Si(a),b.presentationId=a.presentationId,a=b;else{var c={audio:!1,video:!1};a.g.shouldCaptureVideo?(c.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:b}},Ti(a,c.video.mandatory),Qi&&a.g.shouldCaptureAudio&&(c.audio={mandatory:{chromeMediaSource:"system",chromeMediaSourceId:b}})):a.g.shouldCaptureAudio&&(c.audio={mandatory:{chromeMediaSource:"system"}});
a=c}return a},Si=function(a){var b={audio:a.g.shouldCaptureAudio,video:a.g.shouldCaptureVideo};a.g.shouldCaptureVideo&&(b.videoConstraints={mandatory:{enableAutoThrottling:!0}},Ti(a,b.videoConstraints.mandatory));return b},Ti=function(a,b){var c=a.g.minWidth,d=a.g.minHeight;if(a.g.senderSideLetterboxing){c=a.g;if(0==c.minHeight||0==c.maxHeight?0:Math.floor(100*c.minWidth/c.minHeight)==Math.floor(100*c.maxWidth/c.maxHeight))c={width:c.minWidth,height:c.minHeight};else{d=c.maxWidth;for(var e=c.maxHeight;0!=
e;){var f=d%e;d=e;e=f}e=c.maxWidth/d;d=c.maxHeight/d;if(e<c.minWidth||d<c.minHeight)if(f=Math.max(c.minWidth/e,c.minHeight/d),e*=f,d*=f,e>c.maxWidth||d>c.maxHeight)e=c.maxWidth,d=c.maxHeight;e=Math.round(e);d=Math.round(d);c={width:e,height:d}}d=c;c=d.width;d=d.height}Object.assign(b,{minWidth:c,minHeight:d,maxWidth:a.g.maxWidth,maxHeight:a.g.maxHeight,minFrameRate:a.g.minFrameRate,maxFrameRate:a.g.maxFrameRate})};var Vi=function(a){this.g=a;this.h=this.zf=null;this.s=$a("mr.mirror.MirrorMediaStream")};Vi.prototype.start=function(){return"tab"==this.g.h?Wi(this):"offscreen_tab"==this.g.h?Xi(this):Yi(this)};var Wi=function(a){var b=Ui(a.g);a.s.info("Starting tab capture with constraints "+JSON.stringify(b));return new Promise(function(c,d){chrome.tabCapture.capture(b,function(e){e?(Zi(a,e),c(a)):d($i())});window.setTimeout(function(){d(new Ni("chrome.tabCapture.capture failed to call its callback",2))},5E3)})};
Vi.prototype.j=function(a){a&&this.s.info(function(){return"Track "+JSON.stringify(a.target)+" ended"});this.stop()};
var $i=function(){return chrome.runtime.lastError&&chrome.runtime.lastError.message?new Ni(chrome.runtime.lastError.message,7):new Ni("empty_stream",0)},aj=function(a){a=void 0===a?!0:a;return new Promise(function(b,c){var d=["screen"];a&&d.push("audio");"Linux"==Pi()&&d.push("window");var e=window.setTimeout(function(){f&&chrome.desktopCapture.cancelChooseDesktopMedia(f);c(new Ni("timeout",1))},6E4);var f=chrome.desktopCapture.chooseDesktopMedia(d,null,function(g){window.clearTimeout(e);g?b(g):c(new Ni("User cancelled capture dialog",
3))})})},bj=function(a,b){return new Promise(function(c,d){a.s.info(function(){return"Starting desktop capture with constraints "+JSON.stringify(b)});navigator.mediaDevices.getUserMedia(b).then(function(e){e||d(new Ni("empty_stream",8));Zi(a,e);c(e)},function(e){var f=8;"NotAllowedError"==e.name&&(f=3);d(new Ni(e.name+" "+e.constraintName+": "+e.message,f))})})},Yi=function(a){return Qi&&a.g.g.shouldCaptureAudio&&!a.g.g.shouldCaptureVideo?bj(a,Ui(a.g)).then(function(){return a}):aj().then(function(b){b=
Ui(a.g,b);return bj(a,b).then(function(){return a})})},Xi=function(a){var b=Ui(a.g);a.s.info(function(){return"Starting offscreen tab capture with constraints "+JSON.stringify(b)});return new Promise(function(c,d){chrome.tabCapture.captureOffscreenTab(a.g.j.toString(),b,function(e){e?(Zi(a,e),c(a)):d($i())})})},Zi=function(a,b){a.h=b;b.getAudioTracks().length||b.getVideoTracks();b.getTracks().forEach(function(c){c.onended=a.j.bind(a)})};
Vi.prototype.stop=function(){this.h&&(this.h.getTracks().forEach(function(a){a.onended=null;a.stop()}),this.h=null,this.zf&&this.zf())};var cj=function(){},gj=function(a){var b=dj.get(a)||null;if(b)return Promise.resolve(b);b=ej.get(a);b||(b=new zb,ej.set(a,b),fj(a,b));return b.g},fj=function(a,b){var c=hj.get(a)||null;if(!c)b.reject(Error("No corresponding bundle for "+a));else if(!ij.has(c)){var d=jj.get(c);d||(kj.info("Loading bundle "+c+" for module "+a),d=lj(c),jj.set(c,d));d.catch(function(e){b.reject(e)})}},lj=function(a){var b=new zb;b.g.then(function(){kj.info("Bundle "+a+" loaded")},function(d){kj.error("Failed to load bundle "+
a);throw d;});var c=document.createElement("script");c.src=chrome.extension.getURL(a);c.setAttribute("type","text/javascript");c.async=!0;c.onload=function(){return b.resolve(void 0)};c.onerror=function(){return b.reject(Error("Failed to load bundle "+a))};document.head.appendChild(c);return b.g},mj=function(a,b){if(dj.has(a))throw Error("Duplicate module "+a);dj.set(a,b);(a=ej.get(a))&&a.resolve(b)};
cj.prototype.handleEvent=function(a,b){for(var c=1;c<arguments.length;++c);throw Error("Not implemented");};
var hj=new Map([["mr.cast.ChannelService","background_script.js"],["mr.cast.SinkDiscoveryService","background_script.js"],["mr.mirror.cast.Service","mirroring_cast_streaming.js"],["mr.cloud.slarti.SinkDiscoveryService","background_script.js"],["mr.mirror.hangouts.HangoutsService","mirroring_hangouts.js"],["mr.mirror.hangouts.MeetingsService","mirroring_hangouts.js"],["mr.ProviderManager","background_script.js"],["mr.mirror.webrtc.WebRtcService","mirroring_webrtc.js"]]),ij=new Set(["background_script.js"]),
kj=$a("mr.Module"),dj=new Map,ej=new Map,jj=new Map;var nj,oj={rD:0,bz:1,cz:2,pA:3,qA:4,lB:5,fC:6,pD:7,qE:8,rE:9,KF:10,AH:11,BH:12,hI:13,XI:14},pj=function(a){void 0==nj&&(ub("MediaRouter.Provider.WakeEvent",a,oj),nj=a)};var qj=function(a){try{var b=new URL(a);return"http:"!=b.protocol&&"https:"!=b.protocol?!1:-1==b.hash.indexOf("__castAppId__")}catch(c){return!1}},rj=["https://docs.google.com","https://meet.google.com"],sj=function(a){return a.startsWith("urn:x-org.chromium.media:source:tab:")||-1!=a.indexOf("0F5096E8")},tj=function(a){return"urn:x-org.chromium.media:source:desktop"==a},uj=function(a){var b=a.search("urn:x-org.chromium.media:source:tab:");return-1==b?null:parseInt(a.substr(b+36),10)||null};var vj=function(a,b){this.Da=a;this.j=b||null;this.h=this.g=null;this.R=$a("mr.mirror.Service."+a);this.Rc=this.xa.bind(this);this.D=!1};t(vj,cj);vj.prototype.qg=function(){};vj.prototype.getName=function(){return this.Da};
vj.prototype.Wj=function(a,b,c,d,e){var f=this;this.R.info("Start mirroring on route "+a.id);if(!this.D)return Ji(Error("Not initialized"));var g=new Promise(function(h,m){f.o().then(function(){var q=wj(b,c,d);return(new Vi(q)).start()}).then(function(q){if(f.h)throw q.stop(),new Ni("Cannot start multiple streams");f.h=q;q=f.G.bind(f);f.h.zf=q;return e?e(a).g:a}).then(function(q){if(f.g)throw new Ni("Cannot start multiple sessions");if(!f.h)throw new Ni("Media stream ended before session could start.");
f.g=f.wh(c,q);q.sb.tc=f.g.tc;q=f.j.L.bind(f.j);f.g.M=q;xj(f.g);return f.g.start(f.h.h)}).then(function(){sj(b)&&!chrome.tabs.onUpdated.hasListener(f.Rc)&&chrome.tabs.onUpdated.addListener(f.Rc);return f.ta(a,b,c)}).then(function(){h(a)}).catch(function(q){yj(f,q);return f.G().then(function(){m(q)})})});return Ki(g)};vj.prototype.pa=function(a,b,c,d,e,f){this.R.info("Update mirroring on route "+a.id);return this.D?Ki(zj(this,a,b,c,d,f)):Ji(Error("Not initialized"))};
var zj=function(a,b,c,d,e,f){if(!a.g)return Promise.reject(new Ni("No session to update streams on",7));if(!a.g.Yo())return Promise.reject(new Ni("Session does not support updating stream",7));var g=!1;return new Promise(function(h,m){var q=wj(c,d,e);(new Vi(q)).start().then(function(r){a.h&&(a.h.zf=null,a.h.stop(),a.Tg());a.h=r;r=a.G.bind(a);a.h.zf=r;g=!0;return f?f(b).g:b}).then(function(){if(!a.g)throw new Ni("Session ended while updating stream");if(!a.h)throw new Ni("Media stream ended before session could be updated.");
return a.g.fp(a.h.h)}).then(a.ta.bind(a,b,c,d)).then(function(){return h(b)}).catch(function(r){yj(a,r);if(g)return a.G().then(function(){m(r)});m(r)})})};
vj.prototype.ta=function(a,b,c){var d=this;return new Promise(function(e,f){if(d.g){sj(b)?(Aj(d.g,a.sb.tabId),d.Ug()):qj(b)?(Aj(d.g,a.sb.tabId),d.Yh()):d.Rg();f=d.h;var g=a.sinkId;c.shouldCaptureAudio&&f.h&&!f.h.getAudioTracks().length&&(f=Ei(new Ai(zi,"notification"),g),d.j.g.onIssue(f));xj(d.g);e()}else f(new Ni("Session gone before executing post-startup steps",7))})};
var yj=function(a,b){b.reason=null!=b.reason?b.reason:9;a.R.error("Failed to start mirroring: "+b.message+(",  reason = "+b.reason+": "+b.stack));a.Ef(b.reason)};vj.prototype.o=function(){var a=this;return this.D?this.G().then(function(b){b&&a.Sg();return b}):Promise.reject("Not initialized")};
vj.prototype.G=function(){var a=this;chrome.tabs.onUpdated.removeListener(this.Rc);var b=this.h;this.h=null;b&&(b.zf=null);var c=this.g;this.g=null;var d;c?d=this.Ii(c).catch(function(e){return a.R.error("Error in before-cleanup steps",e)}).then(function(){return c.stop()}).catch(function(e){return a.R.error("Error stopping session",e)}).then(function(){Bj(a.j,c.h.id)}).catch(function(e){return a.R.error("Error in ended callbacks",e)}).then(function(){return!0}):d=Promise.resolve(!1);b&&(d=d.then(function(e){b.stop();
a.Tg();return e}));return d};vj.prototype.Ii=function(){return Promise.resolve()};vj.prototype.xa=function(a,b,c){pj(14);this.g&&Cj(this.g,a,b,c)};var wj=function(a,b,c){if(sj(a))return new Ri("tab",b);if(tj(a))return new Ri("desktop",b);if(qj(a)){if(!c)throw new Ni("Missing offscreen tab presentation id");return new Ri("offscreen_tab",b,a,c)}throw new Ni("Source URN does not suggest a known capture type.");};k=vj.prototype;k.wh=function(){};k.Ug=function(){};k.Rg=function(){};k.Yh=function(){};
k.Sg=function(){};k.Ef=function(){};k.Tg=function(){};k.Vj=function(){return Xa()};k.createMediaRouteController=function(){return Xa()};var Dj=function(a,b,c){this.h=a;this.l=b;this.g=void 0===c?null:c;this.j=null},Ej=function(a){switch(a.h){case "mirror_tab":return a.g?"Casting tab ("+a.g+")":"Casting tab";case "mirror_desktop":return"Casting desktop";case "mirror_file":return"Casting local content";case "media_remoting":return a.g?"Casting media ("+a.g+")":"Casting media";case "presentation":return"Casting "+(a.g||"site");default:return""}},Fj=function(a){if(a.l)return"Casting active";switch(a.h){case "mirror_tab":return"Casting tab";
case "mirror_desktop":return"Casting desktop";case "mirror_file":return"Casting local content";case "media_remoting":return"Casting media";case "presentation":return"Casting site";default:return""}};var Gj=function(a){return(new Promise(function(b){chrome.tabs.get(a,b)})).then(function(b){if(!b)throw Error("No such tab "+a);return b})};var Hj=function(a,b){this.h=a;this.M=void 0===b?null:b;b=null;var c=a.mediaSource;if(qj(c)){var d="presentation";b=(new URL(c)).origin}else sj(c)?d="mirror_tab":tj(c)&&(d="mirror_desktop");this.tc=new Dj(d,a.offTheRecord,b);this.j=this.tabId=null;this.G=!1},Aj=function(a,b){a.tabId!=b?(a.tabId=b,Gj(b).then(function(c){a.j=c;xj(a)})):Promise.resolve()},Cj=function(a,b,c,d){b==a.tabId&&("complete"==c.status||c.favIconUrl&&"complete"==d.status)&&(a.j=d,xj(a))},xj=function(a){if(a.j){a.tc.j=a.j.title;
a.tc.l=a.j.incognito;var b=new URL(a.j.url);"file:"==b.protocol?(a.tc.h="mirror_file",a.tc.g=null):(a.tc.h=a.G?"media_remoting":"mirror_tab",a.tc.g="https:"==b.protocol?b.origin.substr(8):b.origin)}a.h.description=Ej(a.tc);a.M&&a.M(a.h,a.tc);a.po()};k=Hj.prototype;k.start=function(){};k.Yo=function(){return!1};k.fp=function(){};k.stop=function(){return Promise.resolve()};k.po=function(){};var Lj=function(){var a=this;this.h=1920;this.g=1080;this.maxWidth=this.h;this.maxHeight=this.g;this.minHeight=this.minWidth=180;this.senderSideLetterboxing=!1;this.minFrameRate=0;this.maxFrameRate=30;this.minVideoBitrate=300;this.maxVideoBitrate=5E3;this.audioBitrate=0;this.animatedLatencyMillis=this.minLatencyMillis=this.maxLatencyMillis=400;this.dscpEnabled=["Mac","Linux","ChromeOS"].includes(Pi())||Oi();this.shouldCaptureAudio=this.shouldCaptureVideo=this.enableLogging=!0;var b=window.localStorage?
window.localStorage.getItem(Ij):null;if(b)try{var c=JSON.parse(String(b));if(c instanceof Object)Jj(this,c),$a("mr.mirror.Settings").K(function(){return"Initial mr.mirror.Settings overridden to: "+Kj(a)});else throw Error("localStorage["+Ij+"] does not parse as an Object: "+b);}catch(d){throw $a("mr.mirror.Settings").error(Ij+' must be of the form \'{"maxWidth":640, "maxHeight":360}\'.',d),Error("Overrides not parseable.  See ERROR log for details.");}};
Lj.prototype.clone=function(){var a=new Lj;Jj(a,this);return a};
var Kj=function(a){return JSON.stringify(a,function(b,c){if(0==b.length||!b.endsWith("_"))return c})},Jj=function(a,b){for(var c=n(Object.keys(b)),d=c.next();!d.done;d=c.next())d=d.value,d.endsWith("_")||typeof b[d]!==typeof a[d]||(a[d]=b[d])},Mj=function(a){var b=Math.round(screen.width*window.devicePixelRatio),c=Math.round(screen.height*window.devicePixelRatio);c>b&&(c=n([c,b]),b=c.next().value,c=c.next().value);a.maxHeight*b<a.maxWidth*c?(b=Math.min(a.maxWidth,b),b-=b%160,c=90*b/160):(c=Math.min(a.maxHeight,
c),c-=c%90,b=160*c/90);if(b<Math.max(160,a.minWidth)||c<Math.max(90,a.minHeight))b=Math.max(160,a.minWidth),c=Math.max(90,a.minHeight);a.maxWidth=b;a.maxHeight=c},Ij="mr.mirror.Settings.Overrides";var Oj=function(a,b){this.type=a;this.data=b},Pj=function(a){a=JSON.parse(a);if(!a.type)throw Error("Invalid message");return new Oj(a.type,a.data)},Qj=function(a,b,c,d,e){this.description=a;this.settings=b||null;this.mediaConstraints=c||null;this.presentationUrl=d||null;this.presentationId=e||null};var Tj=function(a,b){this.s=$a("cv2.PeerConnection");this.J=Rj;this.ia=Sj(this,b);this.l=this.ia.createDataChannel(a,{reliable:!1});this.H=new zb;this.o=!1;this.j=0;this.h=null;this.u=this.C=0;this.g=!1;this.G=function(){};this.m=function(){};this.D=function(){};this.F=function(){}},Uj=function(a,b){a.m=b},Vj=function(a,b){a.D=b},Wj=function(a,b){a.F=b},Xj=function(a,b){a.G=b},Yj=function(a,b){a.l.onmessage=function(c){b(c.data)}},Zj=function(a){var b={};b.iceServers=[{url:"stun:stun.l.google.com:19302"}].concat(a);
return b},Sj=function(a,b){var c=Zj(b);b=new webkitRTCPeerConnection(c);b.onicecandidate=a.L.bind(a);b.onicegatheringstatechange=a.X.bind(a);b.oniceconnectionstatechange=a.V.bind(a);a.s.info(function(){return"Created webkitRTCPeerConnnection with config: "+JSON.stringify(c)});return b};Tj.prototype.start=function(){this.g||(this.g=!0,ak(this))};Tj.prototype.stop=function(){this.s.info("Stopping peer connection...");this.g&&(this.g=!1,"closed"!=this.ia.signalingState&&this.ia.close());this.ia=null};
var ak=function(a){a.s.info("Sending offer to peer.");a.C=Date.now();a.ia.createOffer(a.M.bind(a),function(b){a.s.K("Error creating offer.",b)},a.J);a.H.g.then(function(b){a.G(b)})};Tj.prototype.M=function(a){var b=this;this.s.info(function(){return"Setting local description: "+JSON.stringify(a)});this.ia.setLocalDescription(a,function(){b.s.info("Local description set successfully")},function(c){b.s.K("Error setting local description.",c)})};
var bk=function(a,b){gb(a.s,function(){return"<===: "+JSON.stringify(b)});var c=new RTCSessionDescription(b);a.s.info(function(){return"Setting remote description: "+JSON.stringify(c)});a.ia.setRemoteDescription(c,function(){a.s.info("Remote description set successfully.")},function(d){a.s.K("Error setting remote description.",d)})};
Tj.prototype.L=function(a){var b=this;a.candidate?(this.j++,this.u=Date.now(),1==this.j?this.h=setTimeout(function(){b.s.info("ICE candidate gathering timed out.");b.h=null;ck(b)},5E3):this.o&&this.s.K("Received ICE candidate after resolving session description.")):(this.s.info("End of ICE candidates."),mb("MediaRouter.WebRtc.IceCandidateGathering.Duration.Reported",Date.now()-this.C),ck(this),0<this.j&&mb("MediaRouter.WebRtc.IceCandidateGathering.Duration.Real",this.u-this.C))};
Tj.prototype.X=function(){"completed"==this.ia.iceGatheringState&&ck(this)};var ck=function(a){clearTimeout(a.h);a.h=null;if(!a.o){a.s.info("Resolving sesion description after gathering "+a.j+" ICE candidates.");var b=a.ia.localDescription;a.H.resolve({type:b.type,sdp:b.sdp});a.o=!0}};
Tj.prototype.V=function(a){var b=this;if(this.ia){var c=this.ia.iceConnectionState;this.s.info("New ICE connection state: "+c+".");"connected"==c?this.m("iceconnected"):"completed"==c?this.m("icecompleted"):"failed"==c?(this.s.K(function(){return"Ice connection failed: "+JSON.stringify(a)}),this.D("icefailed")):"closed"==c?this.F("iceclosed"):"disconnected"==c&&(this.s.K("Ice connection state is bad."),this.g&&(this.s.info("Restarting ICE."),this.ia.createOffer(this.M.bind(this),function(d){b.s.K("Error creating new offer.",
d)},dk)))}};var Rj={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},dk={mandatory:{IceRestart:!0,OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
var ek=function(){var a=window.crypto.getRandomValues(new Uint8Array(16));return Mb(a,function(b){b=b.toString(16);return 1<b.length?b:"0"+b}).join("")},fk=function(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);128>e?b[c++]=e:(2048>e?b[c++]=e>>6|192:(55296==(e&64512)&&d+1<a.length&&56320==(a.charCodeAt(d+1)&64512)?(e=65536+((e&1023)<<10)+(a.charCodeAt(++d)&1023),b[c++]=e>>18|240,b[c++]=e>>12&63|128):b[c++]=e>>12|224,b[c++]=e>>6&63|128),b[c++]=e&63|128)}return b},gk=function(a){for(var b=
[],c=0,d=0;c<a.length;){var e=a[c++];if(128>e)b[d++]=String.fromCharCode(e);else if(191<e&&224>e){var f=a[c++];b[d++]=String.fromCharCode((e&31)<<6|f&63)}else if(239<e&&365>e){f=a[c++];var g=a[c++],h=a[c++];e=((e&7)<<18|(f&63)<<12|(g&63)<<6|h&63)-65536;b[d++]=String.fromCharCode(55296+(e>>10));b[d++]=String.fromCharCode(56320+(e&1023))}else f=a[c++],g=a[c++],b[d++]=String.fromCharCode((e&15)<<12|(f&63)<<6|g&63)}return b.join("")};var hk=0,ik=0;function jk(a){var b=0>a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));hk=c;ik=a}
function kk(a){var b=0>a?1:0;a=b?-a:a;if(0===a)0<1/a?hk=ik=0:(ik=0,hk=2147483648);else if(isNaN(a))ik=0,hk=2147483647;else if(3.4028234663852886E38<a)ik=0,hk=(b<<31|2139095040)>>>0;else if(1.1754943508222875E-38>a)a=Math.round(a/Math.pow(2,-149)),ik=0,hk=(b<<31|a)>>>0;else{var c=Math.floor(Math.log(a)/Math.LN2);a*=Math.pow(2,-c);a=Math.round(8388608*a)&8388607;ik=0;hk=(b<<31|c+127<<23|a)>>>0}}
function lk(a){var b=0>a?1:0;a=b?-a:a;if(0===a)ik=0<1/a?0:2147483648,hk=0;else if(isNaN(a))ik=2147483647,hk=4294967295;else if(1.7976931348623157E308<a)ik=(b<<31|2146435072)>>>0,hk=0;else if(2.2250738585072014E-308>a)a/=Math.pow(2,-1074),ik=(b<<31|a/4294967296)>>>0,hk=a>>>0;else{var c=a,d=0;if(2<=c)for(;2<=c&&1023>d;)d++,c/=2;else for(;1>c&&-1022<d;)c*=2,d--;a*=Math.pow(2,-d);ik=(b<<31|d+1023<<20|1048576*a&1048575)>>>0;hk=4503599627370496*a>>>0}}function mk(a,b){return 4294967296*b+(a>>>0)}
function nk(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b>>>0,0==a&&(b=b+1>>>0));a=mk(a,b);return c?-a:a}function ok(a,b){function c(e,f){e=e?String(e):"";return f?"0000000".slice(e.length)+e:e}if(2097151>=b)return""+(4294967296*b+a);var d=(a>>>24|b<<8)>>>0&16777215;b=b>>16&65535;a=(a&16777215)+6777216*d+6710656*b;d+=8147497*b;b*=2;1E7<=a&&(d+=Math.floor(a/1E7),a%=1E7);1E7<=d&&(b+=Math.floor(d/1E7),d%=1E7);return c(b,0)+c(d,b)+c(a,1)}
function pk(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b+(0==a?1:0)>>>0);a=ok(a,b);return c?"-"+a:a}function qk(a){if(a.constructor===Uint8Array)return a;if(a.constructor===ArrayBuffer)return new Uint8Array(a);if(a.constructor===Array)return new Uint8Array(a);if(a.constructor===String)return rk(a);Eb("Type not convertible to Uint8Array.");return new Uint8Array(0)};var tk=function(a,b,c){this.h=null;this.g=this.j=this.l=0;this.C=!1;a&&sk(this,a,b,c)},vk=function(a,b,c){if(uk.length){var d=uk.pop();a&&sk(d,a,b,c);return d}return new tk(a,b,c)};tk.prototype.clone=function(){return vk(this.h,this.l,this.j-this.l)};tk.prototype.clear=function(){this.h=null;this.g=this.j=this.l=0;this.C=!1};var sk=function(a,b,c,d){a.h=qk(b);a.l=void 0!==c?c:0;a.j=void 0!==d?a.l+d:a.h.length;a.g=a.l};tk.prototype.reset=function(){this.g=this.l};
var wk=function(a,b){for(var c=128,d=0,e=0,f=0;4>f&&128<=c;f++)c=a.h[a.g++],d|=(c&127)<<7*f;128<=c&&(c=a.h[a.g++],d|=(c&127)<<28,e|=(c&127)>>4);if(128<=c)for(f=0;5>f&&128<=c;f++)c=a.h[a.g++],e|=(c&127)<<7*f+3;if(128>c)return b(d>>>0,e>>>0);Eb("Failed to read varint, encoding is invalid.");a.C=!0},xk=function(a){var b=a.h;var c=b[a.g+0];var d=c&127;if(128>c)return a.g+=1,d;c=b[a.g+1];d|=(c&127)<<7;if(128>c)return a.g+=2,d;c=b[a.g+2];d|=(c&127)<<14;if(128>c)return a.g+=3,d;c=b[a.g+3];d|=(c&127)<<21;
if(128>c)return a.g+=4,d;c=b[a.g+4];d|=(c&15)<<28;if(128>c)return a.g+=5,d>>>0;a.g+=5;128<=b[a.g++]&&128<=b[a.g++]&&128<=b[a.g++]&&128<=b[a.g++]&&a.g++;return d},yk=function(a){var b=a.h[a.g+0];var c=a.h[a.g+1];var d=a.h[a.g+2],e=a.h[a.g+3];a.g+=4;c=(b<<0|c<<8|d<<16|e<<24)>>>0;a=2*(c>>31)+1;b=c>>>23&255;c&=8388607;return 255==b?c?NaN:Infinity*a:0==b?a*Math.pow(2,-149)*c:a*Math.pow(2,b-150)*(c+Math.pow(2,23))};tk.prototype.m=function(){return xk(this)};var uk=[];var zk=function(a){this.g=vk(a,void 0,void 0);this.C=this.g.g;this.j=this.h=-1;this.l=!1},Ak=function(a){return 4==a.j};zk.prototype.reset=function(){this.g.reset();this.j=this.h=-1};
var Bk=function(a){var b=a.g;if(b.g==b.j)return!1;(b=a.l)||(b=a.g,b=b.C||0>b.g||b.g>b.j);if(b)return Eb("Decoder hit an error"),!1;a.C=a.g.g;var c=xk(a.g);b=c>>>3;c&=7;if(0!=c&&5!=c&&1!=c&&2!=c&&3!=c&&4!=c)return Eb("Invalid wire type: %s (at position %s)",c,a.C),a.l=!0,!1;a.h=b;a.j=c;return!0},Ck=function(a){switch(a.j){case 0:if(0!=a.j)Eb("Invalid wire type for skipVarintField"),Ck(a);else{for(a=a.g;a.h[a.g]&128;)a.g++;a.g++}break;case 1:1!=a.j?(Eb("Invalid wire type for skipFixed64Field"),Ck(a)):
(a=a.g,a.g+=8);break;case 2:if(2!=a.j)Eb("Invalid wire type for skipDelimitedField"),Ck(a);else{var b=xk(a.g);a=a.g;a.g+=b}break;case 5:5!=a.j?(Eb("Invalid wire type for skipFixed32Field"),Ck(a)):(a=a.g,a.g+=4);break;case 3:b=a.h;do{if(!Bk(a)){Eb("Unmatched start-group tag: stream EOF");a.l=!0;break}if(4==a.j){a.h!=b&&(Eb("Unmatched end-group tag"),a.l=!0);break}Ck(a)}while(1);break;default:a.l=!0,Eb("Invalid wire encoding for field.")}},Dk=function(a,b,c){var d=a.g.j,e=xk(a.g);e=a.g.g+e;a.g.j=e;
c(b,a);a.g.g=e;a.g.j=d},Ek=function(a){return!!xk(a.g)},Fk=function(a){return wk(a.g,nk)},Gk=function(a){var b=xk(a.g);a=a.g;var c=a.h,d=a.g,e=d+b,f=[];for(b="";d<e;){var g=c[d++];if(128>g)f.push(g);else if(192>g)continue;else if(224>g){var h=c[d++];f.push((g&31)<<6|h&63)}else if(240>g){h=c[d++];var m=c[d++];f.push((g&15)<<12|(h&63)<<6|m&63)}else if(248>g){h=c[d++];m=c[d++];var q=c[d++];g=(g&7)<<18|(h&63)<<12|(m&63)<<6|q&63;g-=65536;f.push((g>>10&1023)+55296,(g&1023)+56320)}8192<=f.length&&(b+=String.fromCharCode.apply(null,
f),f.length=0)}if(8192>=f.length)f=String.fromCharCode.apply(null,f);else{c="";for(e=0;e<f.length;e+=8192)c+=String.fromCharCode.apply(null,ec(f,e,e+8192));f=c}a.g=d;return b+f},Hk=function(a,b){var c=xk(a.g);c=a.g.g+c;for(var d=[];a.g.g<c;)d.push(b.call(a.g));return d};var Ik=function(){this.g=[]};Ik.prototype.length=function(){return this.g.length};Ik.prototype.end=function(){var a=this.g;this.g=[];return a};
var Jk=function(a){for(var b=hk,c=ik;0<c||127<b;)a.g.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.g.push(b)},Kk=function(a,b){for(;127<b;)a.g.push(b&127|128),b>>>=7;a.g.push(b)},Lk=function(a,b){if(0<=b)Kk(a,b);else{for(var c=0;9>c;c++)a.g.push(b&127|128),b>>=7;a.g.push(1)}},Mk=function(a,b){a.g.push(b>>>0&255);a.g.push(b>>>8&255);a.g.push(b>>>16&255);a.g.push(b>>>24&255)};var Nk={},Ok=null,Qk=function(a){var b;void 0===b&&(b=0);Pk();b=Nk[b];for(var c=[],d=0;d<a.length;d+=3){var e=a[d],f=d+1<a.length,g=f?a[d+1]:0,h=d+2<a.length,m=h?a[d+2]:0,q=e>>2;e=(e&3)<<4|g>>4;g=(g&15)<<2|m>>6;m&=63;h||(m=64,f||(g=64));c.push(b[q],b[e],b[g]||"",b[m]||"")}return c.join("")},rk=function(a){var b=a.length,c=3*b/4;c%3?c=Math.floor(c):-1!="=.".indexOf(a[b-1])&&(c=-1!="=.".indexOf(a[b-2])?c-2:c-1);var d=new Uint8Array(c),e=0;Rk(a,function(f){d[e++]=f});return d.subarray(0,e)},Rk=function(a,
b){function c(m){for(;d<a.length;){var q=a.charAt(d++),r=Ok[q];if(null!=r)return r;if(!ld(q))throw Error("Unknown base64 encoding at char: "+q);}return m}Pk();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),h=c(64);if(64===h&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=h&&b(g<<6&192|h))}},Pk=function(){if(!Ok){Ok={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));Nk[c]=d;for(var e=
0;e<d.length;e++){var f=d[e];void 0===Ok[f]&&(Ok[f]=e)}}}};var Sk=function(){this.l=[];this.j=0;this.h=new Ik;this.m=[]},Uk=function(a,b){Tk(a,b,2);b=a.h.end();a.l.push(b);a.j+=b.length;b.push(a.j);return b},Vk=function(a,b){var c=b.pop();for(c=a.j+a.h.length()-c;127<c;)b.push(c&127|128),c>>>=7,a.j++;b.push(c);a.j++};Sk.prototype.reset=function(){this.l=[];this.h.end();this.j=0;this.m=[]};
var Wk=function(a){for(var b=new Uint8Array(a.j+a.h.length()),c=a.l,d=c.length,e=0,f=0;f<d;f++){var g=c[f];b.set(g,e);e+=g.length}c=a.h.end();b.set(c,e);a.l=[b];return b},Tk=function(a,b,c){Kk(a.h,8*b+c)},Xk=function(a,b,c){null!=c&&(Tk(a,b,0),a=a.h,jk(c),Jk(a))};Sk.prototype.g=function(a,b){null!=b&&null!=b&&(Tk(this,a,0),Lk(this.h,b))};var Yk=function(a,b,c){null!=c&&null!=c&&(Tk(a,b,0),a=a.h,jk(c),Jk(a))};Sk.prototype.C=function(a,b){null!=b&&null!=b&&(Tk(this,a,0),Kk(this.h,b))};
var Zk=function(a,b,c){null!=c&&(Tk(a,b,5),Mk(a.h,c))},$k=function(a,b,c){null!=c&&(Tk(a,b,5),a=a.h,kk(c),Mk(a,hk))},E=function(a,b,c){null!=c&&(Tk(a,b,0),a.h.g.push(c?1:0))},F=function(a,b,c){null!=c&&(Tk(a,b,0),Lk(a.h,c))},G=function(a,b,c){if(null!=c){b=Uk(a,b);for(var d=a.h,e=0;e<c.length;e++){var f=c.charCodeAt(e);if(128>f)d.g.push(f);else if(2048>f)d.g.push(f>>6|192),d.g.push(f&63|128);else if(65536>f)if(55296<=f&&56319>=f&&e+1<c.length){var g=c.charCodeAt(e+1);56320<=g&&57343>=g&&(f=1024*(f-
55296)+g-56320+65536,d.g.push(f>>18|240),d.g.push(f>>12&63|128),d.g.push(f>>6&63|128),d.g.push(f&63|128),e++)}else d.g.push(f>>12|224),d.g.push(f>>6&63|128),d.g.push(f&63|128)}Vk(a,b)}},I=function(a,b,c,d){null!=c&&(b=Uk(a,b),d(c,a),Vk(a,b))},al=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++){var e=a,f=c[d];null!=f&&(Tk(e,b,0),Lk(e.h,f))}},bl=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)Zk(a,b,c[d])},cl=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)F(a,b,c[d])},dl=function(a,
b,c){if(null!=c)for(var d=0;d<c.length;d++)G(a,b,c[d])},el=function(a,b,c,d){if(null!=c)for(var e=0;e<c.length;e++){var f=Uk(a,b);d(c[e],a);Vk(a,f)}},fl=function(a,b,c,d){if(null!=c)for(var e=0;e<c.length;e++)Tk(a,b,3),d(c[e],a),Tk(a,b,4)},gl=function(a,b,c){if(null!=c&&c.length){b=Uk(a,b);for(var d=0;d<c.length;d++)Lk(a.h,c[d]);Vk(a,b)}},hl=function(a,b,c){if(null!=c&&c.length)for(Tk(a,b,2),Kk(a.h,4*c.length),b=0;b<c.length;b++){var d=a.h;kk(c[b]);Mk(d,hk)}},il=function(a,b,c){if(null!=c&&c.length){b=
Uk(a,b);for(var d=0;d<c.length;d++)Lk(a.h,c[d]);Vk(a,b)}};var kl=function(a){this.h=a;this.g={};this.j=!0;if(0<this.h.length){for(a=0;a<this.h.length;a++){var b=this.h[a],c=b[0];this.g[c.toString()]=new jl(c,b[1])}this.j=!0}};k=kl.prototype;k.Fc=function(){var a;if(!this.j){this.h.length=0;var b=ll(this);b.sort();for(var c=0;c<b.length;c++){var d=this.g[b[c]];(a=d.g)&&a.Fc();this.h.push([d.key,d.value])}this.j=!0}return this.h};k.clear=function(){this.g={};this.j=!1};
k.entries=function(){var a=[],b=ll(this);b.sort();for(var c=0;c<b.length;c++){var d=this.g[b[c]];a.push([d.key,d.value])}return new ml(a)};k.keys=function(){var a=[],b=ll(this);b.sort();for(var c=0;c<b.length;c++)a.push(this.g[b[c]].key);return new ml(a)};k.values=function(){var a=[],b=ll(this);b.sort();for(var c=0;c<b.length;c++)a.push(this.g[b[c]].value);return new ml(a)};k.forEach=function(a,b){var c=ll(this);c.sort();for(var d=0;d<c.length;d++){var e=this.g[c[d]];a.call(b,e.value,e.key,this)}};
k.set=function(a,b){var c=new jl(a);c.value=b;this.g[a.toString()]=c;this.j=!1;return this};k.get=function(a){if(a=this.g[a.toString()])return a.value};k.has=function(a){return a.toString()in this.g};var ll=function(a){a=a.g;var b=[],c;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b},jl=function(a,b){this.key=a;this.value=b;this.g=void 0},ml=function(a){this.g=0;this.h=a};ml.prototype.next=function(){return this.g<this.h.length?{done:!1,value:this.h[this.g++]}:{done:!0,value:void 0}};
"undefined"!=typeof Symbol&&"undefined"!=typeof Symbol.iterator&&(ml.prototype[Symbol.iterator]=function(){return this});var J=function(){},nl="function"==typeof Uint8Array,K=function(a,b,c,d,e,f){a.g=null;b||(b=c?[c]:[]);a.D=c?String(c):void 0;a.C=0===c?-1:0;a.h=b;a:{c=a.h.length;b=-1;if(c&&(b=c-1,c=a.h[b],!(null===c||"object"!=typeof c||Array.isArray(c)||nl&&c instanceof Uint8Array))){a.m=b-a.C;a.j=c;break a}-1<d?(a.m=Math.max(d,b+1-a.C),a.j=null):a.m=Number.MAX_VALUE}a.o={};if(e)for(d=0;d<e.length;d++)b=e[d],b<a.m?(b+=a.C,a.h[b]=a.h[b]||ol):(pl(a),a.j[b]=a.j[b]||ol);if(f&&f.length)for(d=0;d<f.length;d++)ql(a,f[d])},
ol=Object.freeze?Object.freeze([]):[],pl=function(a){var b=a.m+a.C;a.h[b]||(a.j=a.h[b]={})},L=function(a,b){if(b<a.m){b+=a.C;var c=a.h[b];return c===ol?a.h[b]=[]:c}if(a.j)return c=a.j[b],c===ol?a.j[b]=[]:c},rl=function(a,b){a=L(a,b);return null==a?a:+a},sl=function(a,b){a=L(a,b);return null==a?a:!!a},tl=function(a,b){var c=L(a,b);a.o||(a.o={});if(!a.o[b]){for(var d=0;d<c.length;d++)c[d]=+c[d];a.o[b]=!0}return c},M=function(a,b,c){a=L(a,b);return null==a?c:a},ul=function(a,b,c){a=sl(a,b);return null==
a?c:a},vl=function(a,b){a=rl(a,b);return null==a?0:a},N=function(a,b,c){b<a.m?a.h[b+a.C]=c:(pl(a),a.j[b]=c);return a},P=function(a,b,c){return wl(a,b,c,"")},xl=function(a,b,c){return wl(a,b,c,0)},wl=function(a,b,c,d){c!==d?N(a,b,c):b<a.m?a.h[b+a.C]=null:(pl(a),delete a.j[b]);return a},yl=function(a,b,c,d){(c=ql(a,c))&&c!==b&&void 0!==d&&(a.g&&c in a.g&&(a.g[c]=void 0),N(a,c,void 0));N(a,b,d)},ql=function(a,b){for(var c,d,e=0;e<b.length;e++){var f=b[e],g=L(a,f);null!=g&&(c=f,d=g,N(a,f,void 0))}return c?
(N(a,c,d),c):0},Q=function(a,b,c,d){a.g||(a.g={});if(!a.g[c]){var e=L(a,c);if(d||e)a.g[c]=new b(e)}return a.g[c]},R=function(a,b,c){zl(a,b,c);b=a.g[c];b==ol&&(b=a.g[c]=[]);return b},zl=function(a,b,c){a.g||(a.g={});if(!a.g[c]){for(var d=L(a,c),e=[],f=0;f<d.length;f++)e[f]=new b(d[f]);a.g[c]=e}},S=function(a,b,c){a.g||(a.g={});var d=c?c.Fc():c;a.g[b]=c;return N(a,b,d)},Bl=function(a,b,c){var d=Al[0];a.g||(a.g={});var e=c?c.Fc():c;a.g[b]=c;yl(a,b,d,e)},Cl=function(a,b,c){a.g||(a.g={});c=c||[];for(var d=
[],e=0;e<c.length;e++)d[e]=c[e].Fc();a.g[b]=c;return N(a,b,d)},Dl=function(a,b,c,d){zl(a,d,b);var e=a.g[b];e||(e=a.g[b]=[]);c=c?c:new d;a=L(a,b);e.push(c);a.push(c.Fc());return c},El=function(a){if(a.g)for(var b in a.g){var c=a.g[b];if(Array.isArray(c))for(var d=0;d<c.length;d++)c[d]&&c[d].Fc();else c&&c.Fc()}};J.prototype.Fc=function(){El(this);return this.h};
J.prototype.va=nl?function(){var a=Uint8Array.prototype.toJSON;Uint8Array.prototype.toJSON=function(){return Qk(this)};try{return JSON.stringify(this.h&&this.Fc(),Fl)}finally{Uint8Array.prototype.toJSON=a}}:function(){return JSON.stringify(this.h&&this.Fc(),Fl)};var Fl=function(a,b){return"number"!==typeof b||!isNaN(b)&&Infinity!==b&&-Infinity!==b?b:String(b)};J.prototype.toString=function(){El(this);return this.h.toString()};
var Hl=function(a,b){return a==b||!(!a||!b)&&a instanceof b.constructor&&Gl(a.Fc(),b.Fc())},Il=function(a,b){a=a||{};b=b||{};var c={},d;for(d in a)c[d]=0;for(d in b)c[d]=0;for(d in c)if(!Gl(a[d],b[d]))return!1;return!0},Gl=function(a,b){if(a==b)return!0;if(!Na(a)||!Na(b))return"number"===typeof a&&isNaN(a)||"number"===typeof b&&isNaN(b)?String(a)==String(b):!1;if(a.constructor!=b.constructor)return!1;if(nl&&a.constructor===Uint8Array){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!=
b[c])return!1;return!0}if(a.constructor===Array){var d=void 0,e=void 0,f=Math.max(a.length,b.length);for(c=0;c<f;c++){var g=a[c],h=b[c];g&&g.constructor==Object&&(d=g,g=void 0);h&&h.constructor==Object&&(e=h,h=void 0);if(!Gl(g,h))return!1}return d||e?(d=d||{},e=e||{},Il(d,e)):!0}if(a.constructor===Object)return Il(a,b);throw Error("Invalid type in JSPB array");};J.prototype.clone=function(){return Jl(this)};
var Jl=function(a){return new a.constructor(Kl(a.Fc()))},Kl=function(a){if(Array.isArray(a)){for(var b=Array(a.length),c=0;c<a.length;c++){var d=a[c];null!=d&&(b[c]="object"==typeof d?Kl(d):d)}return b}if(nl&&a instanceof Uint8Array)return new Uint8Array(a);b={};for(c in a)d=a[c],null!=d&&(b[c]="object"==typeof d?Kl(d):d);return b};var Ll=function(a){K(this,a,0,-1,null,null)};B(Ll,J);var Ml=function(a){K(this,a,0,-1,null,null)};B(Ml,J);
var Pl=function(a,b){for(;Bk(b)&&!Ak(b);)switch(b.h){case 1:var c=wk(b.g,nk);Nl(a,c);break;case 2:c=Gk(b);N(a,2,c);break;case 3:c=new Ml;Dk(b,c,Ol);S(a,3,c);break;default:Ck(b)}return a},Rl=function(a,b){var c=L(a,1);null!=c&&Yk(b,1,c);c=L(a,2);null!=c&&G(b,2,c);c=Q(a,Ml,3);null!=c&&I(b,3,c,Ql)},Ol=function(a,b){for(;Bk(b)&&!Ak(b);)switch(b.h){case 1:var c=Gk(b);N(a,1,c);break;case 2:c=wk(b.g,nk);N(a,2,c);break;default:Ck(b)}return a},Ql=function(a,b){var c=L(a,1);null!=c&&G(b,1,c);c=L(a,2);null!=
c&&Yk(b,2,c)};Ll.prototype.ac=function(){return L(this,1)};var Nl=function(a,b){return N(a,1,b)};var Sl=function(a,b){this.type="cast_app";this.originId=window["castApp.eventPage.Message.OriginID"]||void 0;this.subtype=a;this.devices=b;this.logRecord=this.deviceJustSetUp=void 0};y("castApp.eventPage.Message",Sl);var Tl=function(a,b,c){this.ipAddress=a;this.appId=b;this.sessionId=c};Sl.DeviceData=Tl;Sl.DeviceJustSetUp=function(a,b,c,d){this.ipAddress=a;this.name=b;this.udn=c;this.modelName=d};Sl.DeviceCapabilities=function(){};
Sl.LogRecord=function(a,b,c,d){this.levelValue=a;this.msg=b;this.loggerName=c;this.time=d};var Ul=function(a,b){this.type=a;this.entryPoint=b};y("castApp.frontEnd.ExtensionMessage",Ul);var Vl=function(a){return"urn:x-cast:com.google.cast."+a},Wl=Vl("tp.connection"),Xl=Vl("receiver"),Yl=Vl("remoting"),Zl=Vl("media"),$l=Vl("webrtc"),am=Vl("broadcast"),bm=Kc({DJ:Wl,EJ:Vl("tp.heartbeat"),ZF:Xl,uG:Yl,qD:Zl,xD:Vl("media.universalRemote.optIn"),CK:$l,Zx:am});var cm=function(a){return"available"==a||"available_rescan"==a};var dm=function(a,b,c,d,e){this.id=a;this.friendlyName=b;this.iconType=c||"generic";this.description=void 0===d?null:d;this.domain=void 0===e?null:e};var em=window.localStorage,fm=0,hm=function(a){return(a=window.localStorage.getItem(gm(a,!1)))?JSON.parse(a):null},im=function(a){return(a=window.localStorage.getItem(gm(a,!0)))?JSON.parse(a):null},km=function(a){if(jm.has(a.Ua()))throw Error("Duplicate instance name "+a.Ua());jm.set(a.Ua(),a);a.Hb()},qm=function(a){for(var b=0,c=n(Object.keys(em)),d=c.next();!d.done;d=c.next()){d=d.value;var e=d.length+window.localStorage.getItem(d).length;d.startsWith("mr.")?fm+=e:b+=e}lm=a;(window.localStorage.getItem("version")&&
window.localStorage.getItem("version")!==chrome.runtime.getManifest().version||mm(a))&&nm();om.info("initialize: "+fm+" chars used, "+b+" other chars");chrome.runtime.onSuspend.addListener(pm)},lm=null,om=$a("mr.PersistentDataManager"),jm=new Map,gm=function(a,b){return"mr."+(b?"persistent.":"temp.")+a.Ua()},mm=function(a){return!!window.localStorage.getItem("mrInstanceId")&&window.localStorage.getItem("mrInstanceId")!==a},pm=function(){om.info("onSuspend");rm("version",chrome.runtime.getManifest().version);
lm&&rm("mrInstanceId",lm);for(var a=jm.get("LogManager"),b=n(jm),c=b.next();!c.done;c=b.next())c=n(c.value),c.next(),c=c.next().value,c!=a&&sm(c);a&&sm(a)},sm=function(a){try{var b=a.Ib();b&&void 0!=b[0]&&rm(gm(a,!1),JSON.stringify(b[0]));b&&void 0!=b[1]&&rm(gm(a,!0),JSON.stringify(b[1]))}catch(c){om.error("Error while saving data for "+a.Ua()+": "+c.message)}},rm=function(a,b){var c=window.localStorage.getItem(a);c=null!=c?b.length-c.length:a.length+b.length;52E5<fm+c&&(om.K("Unable to write "+c+
" chars"),nm());if(52E5<fm+c)throw om.error("Unable to write "+c+" chars after clearing temporary"),Error("Setting the value of '"+a+"' would exceed the quota, according to accounting.");try{window.localStorage.setItem(a,b)}catch(d){throw Error("Setting the value of '"+a+"' would exceed the quota, according to the browser.");}fm+=c},tm=function(a){a=0==a.size%2?new Blob([a,new Uint8Array([0,0])]):new Blob([a,new Uint8Array([1])]);return new Promise(function(b,c){var d=new FileReader;d.onloadend=function(){if(d.error)c(d.error);
else try{for(var e=d.result,f=[],g=0,h=e.byteLength;g<h;g+=8192)f.push(String.fromCharCode.apply(null,new Uint16Array(e,g,Math.min(h-g,8192)/2)));rm("mr.temp.mirror.cast.Service.eventsBlob",f.join(""));b()}catch(m){c(m)}};d.readAsArrayBuffer(a)})},nm=function(){for(var a=n(Object.keys(em)),b=a.next();!b.done;b=a.next())b=b.value,b.startsWith("mr.temp.")&&(fm-=b.length+window.localStorage.getItem(b).length,delete window.localStorage[b]);om.info("removeTemporary_: "+fm+" chars used")};var um=(new Map).set("+","-").set("/","_").set("=",".");(new Map).set("-","+").set("_","/").set(".","=");function vm(a){return btoa(String.fromCharCode.apply(String,p(a))).replace(/[+/=]/g,function(b){return um.get(b)})};var wm=function(){this.g=[];this.C=[];this.m=[];this.j=[];this.j[0]=128;for(var a=1;64>a;++a)this.j[a]=0;this.l=this.h=0;this.reset()};wm.prototype.reset=function(){this.g[0]=1732584193;this.g[1]=4023233417;this.g[2]=2562383102;this.g[3]=271733878;this.g[4]=3285377520;this.l=this.h=0};
var xm=function(a,b,c){c=void 0===c?0:c;var d=a.m;if("string"===typeof b)for(var e=0;16>e;e++)d[e]=b.charCodeAt(c)<<24|b.charCodeAt(c+1)<<16|b.charCodeAt(c+2)<<8|b.charCodeAt(c+3),c+=4;else for(e=0;16>e;e++)d[e]=b[c]<<24|b[c+1]<<16|b[c+2]<<8|b[c+3],c+=4;for(b=16;80>b;b++)c=d[b-3]^d[b-8]^d[b-14]^d[b-16],d[b]=(c<<1|c>>>31)&4294967295;b=a.g[0];c=a.g[1];e=a.g[2];for(var f=a.g[3],g=a.g[4],h,m,q=0;80>q;q++)40>q?20>q?(h=f^c&(e^f),m=1518500249):(h=c^e^f,m=1859775393):60>q?(h=c&e|f&(c|e),m=2400959708):(h=
c^e^f,m=3395469782),h=(b<<5|b>>>27)+h+g+m+d[q]&4294967295,g=f,f=e,e=(c<<30|c>>>2)&4294967295,c=b,b=h;a.g[0]=a.g[0]+b&4294967295;a.g[1]=a.g[1]+c&4294967295;a.g[2]=a.g[2]+e&4294967295;a.g[3]=a.g[3]+f&4294967295;a.g[4]=a.g[4]+g&4294967295};
wm.prototype.update=function(a,b){b=void 0===b?a.length:b;for(var c=b-64,d=0,e=this.C,f=this.h;d<b;){if(0==f)for(;d<=c;)xm(this,a,d),d+=64;if("string"===typeof a)for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,64==f){xm(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,64==f){xm(this,e);f=0;break}}this.h=f;this.l+=b};
wm.prototype.digest=function(){var a=[],b=8*this.l;56>this.h?this.update(this.j,56-this.h):this.update(this.j,64-(this.h-56));for(var c=63;56<=c;c--)this.C[c]=b&255,b/=256;xm(this,this.C);for(c=b=0;5>c;c++)for(var d=24;0<=d;d-=8)a[b]=this.g[c]>>d&255,++b;return a};var ym=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)};var Am=function(){this.l=ym();this.h=new zm(null,null);this.g=new zm(null,null);this.C=[];this.j=0;km(this)},Cm=function(){Bm||(Bm=new Am);return Bm},Dm=function(a,b){b=b.toLowerCase();var c=new wm;c.update(b);c.update(a.l);return"r"+vm(c.digest())},Em=function(){var a=Cm();return a.h.model?a.h:a.g.model?a.g:new zm(null,null)};Am.prototype.Ua=function(){return"SinkUtils"};
Am.prototype.Ib=function(){return[{recentLaunchedDevice:this.h,recentDiscoveredDevice:this.g},{receiverIdToken:this.l,fixedIpList:this.C.join(","),castControlPort:this.j}]};Am.prototype.Hb=function(){var a=hm(this);a&&(this.h=a.recentLaunchedDevice||new zm(null,null),this.g=a.recentDiscoveredDevice||new zm(null,null));if(a=im(this))this.l=a.receiverIdToken||ym(),this.C=a.fixedIpList&&a.fixedIpList.split(",")||[],this.j=a.castControlPort||0};var Bm=null,zm=function(a,b){this.model=a;this.ip=b};var Fm=function(a,b,c,d,e,f){this.h=new dm(a,b,d&1?"cast":d&32?"cast_audio_group":"cast_audio");this.l=c||null;this.g=d||null;this.C=e||null;this.m=f||null;this.j={};this.Si=!1};Fm.prototype.update=function(a,b,c,d){var e=!1;this.h.friendlyName!=a&&(this.h.friendlyName=a,e=!0);null!=b&&this.C!=b&&(this.C=b,e=!0);null!=c&&this.m!=c&&(this.m=c,e=!0);null!=d&&this.g!=d&&(this.g=d,e=!0);return e};Fm.prototype.getId=function(){return this.h.id};Fm.prototype.Kc=function(){return this.C};
Fm.prototype.Cb=function(){return this.m};var Gm=function(a,b){return a.j[b]||"unknown"};var Hm="StopIteration"in w?w.StopIteration:{message:"StopIteration",stack:""},Im=function(){};Im.prototype.next=function(){throw Hm;};Im.prototype.Tb=function(){return this};
var Jm=function(a){if(a instanceof Im)return a;if("function"==typeof a.Tb)return a.Tb(!1);if(La(a)){var b=0,c=new Im;c.next=function(){for(;;){if(b>=a.length)throw Hm;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");},Km=function(a,b,c){if(La(a))try{Hb(a,b,c)}catch(d){if(d!==Hm)throw d;}else{a=Jm(a);try{for(;;)b.call(c,a.next(),void 0,a)}catch(d){if(d!==Hm)throw d;}}},Lm=function(a,b){a=Jm(a);try{for(;!b.call(void 0,a.next(),void 0,a););}catch(c){if(c!==Hm)throw c;}},Mm=function(a){if(La(a))return cc(a);
a=Jm(a);var b=[];Km(a,function(c){b.push(c)});return b};var Om=function(a,b){this.h={};this.g=[];this.l=this.j=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&Nm(this,a)};Om.prototype.ya=function(){return this.j};Om.prototype.Ma=function(){Pm(this);for(var a=[],b=0;b<this.g.length;b++)a.push(this.h[this.g[b]]);return a};Om.prototype.Pb=function(){Pm(this);return this.g.concat()};var Rm=function(a,b){return Qm(a.h,b)};
Om.prototype.lf=function(a){for(var b=0;b<this.g.length;b++){var c=this.g[b];if(Qm(this.h,c)&&this.h[c]==a)return!0}return!1};Om.prototype.equals=function(a,b){if(this===a)return!0;if(this.j!=a.ya())return!1;b=b||Sm;Pm(this);for(var c,d=0;c=this.g[d];d++)if(!b(this.get(c),a.get(c)))return!1;return!0};var Sm=function(a,b){return a===b};Om.prototype.zc=function(){return 0==this.j};Om.prototype.clear=function(){this.h={};this.l=this.j=this.g.length=0};
Om.prototype.remove=function(a){return Qm(this.h,a)?(delete this.h[a],this.j--,this.l++,this.g.length>2*this.j&&Pm(this),!0):!1};var Pm=function(a){if(a.j!=a.g.length){for(var b=0,c=0;b<a.g.length;){var d=a.g[b];Qm(a.h,d)&&(a.g[c++]=d);b++}a.g.length=c}if(a.j!=a.g.length){var e={};for(c=b=0;b<a.g.length;)d=a.g[b],Qm(e,d)||(a.g[c++]=d,e[d]=1),b++;a.g.length=c}};Om.prototype.get=function(a,b){return Qm(this.h,a)?this.h[a]:b};
Om.prototype.set=function(a,b){Qm(this.h,a)||(this.j++,this.g.push(a),this.l++);this.h[a]=b};var Nm=function(a,b){if(b instanceof Om)for(var c=b.Pb(),d=0;d<c.length;d++)a.set(c[d],b.get(c[d]));else for(c in b)a.set(c,b[c])};Om.prototype.forEach=function(a,b){for(var c=this.Pb(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};Om.prototype.clone=function(){return new Om(this)};var Tm=function(a){Pm(a);for(var b={},c=0;c<a.g.length;c++){var d=a.g[c];b[d]=a.h[d]}return b};
Om.prototype.Tb=function(a){Pm(this);var b=0,c=this.l,d=this,e=new Im;e.next=function(){if(c!=d.l)throw Error("The map has changed since the iterator was created");if(b>=d.g.length)throw Hm;var f=d.g[b++];return a?f:d.h[f]};return e};var Qm=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var Um=function(a,b){this.l=b;this.j=a;this.j.m=this.h.bind(this);this.g=new Om;this.C=new Om;this.s=$a("mr.cast.SinkDiscoveryService");this.Bh={Vl:0,Xm:0}};t(Um,cj);Um.prototype.init=function(){km(this);mj("mr.cast.SinkDiscoveryService",this)};
var bn=function(a,b){a.s.info("addSinks returned "+b.length+" sinks");gb(a.s,function(){return"....the list is: "+JSON.stringify(b)});var c=new Set(a.g.Pb());b.forEach(function(e){var f=e.sink_id;var g=e.extra_data.cast_media_sink,h=g.ip_endpoint?g.ip_endpoint.address:g.ip_address,m=g.ip_endpoint?g.ip_endpoint.port:Cm().j||8009;f=new Fm(f,e.name,g.model_name,g.capabilities,h.address_bytes.join("."),m);g=a.g.get(f.getId());h=a.j;e=e.extra_data.cast_media_sink.cast_channel_id;m=f.getId();var q=h.h.get(m);
if(!q||q.channelId!=e){Vm.info("Added cast channel "+e+" to receiver: "+m);q&&h.g.remove(q.channelId);q={auth:"ssl_verified",ipAddress:f.Kc(),port:f.Cb()};q={channelId:e,readyState:"open",keepAlive:!0,audioOnly:!(f.g&1),connectInfo:q};h.h.set(m,q);h.g.set(e,m);var r=h.l.get(m);r&&r.channelId!=e&&(Vm.info("Re-connected to receiver: "+f.getId()),Wm(h.j,r,q),Xm(h.C.C,f,!0));h.l.set(m,q)}if(g){if(h=g.update(f.h.friendlyName,f.Kc(),f.Cb(),f.g))g.Si=!1;h&&Ym(a.l,g)}else a.s.info("Adding sink "+f.getId()),
Zm(a,f),g=a.l,g.j.onSinkAvailabilityUpdated(g,1),Ym(g,f),Xm(g.C,f),Cm().g=new zm(f.l,f.Kc());c.delete(f.getId())});c.forEach(function(e){var f=a.j,g=f.l.get(e);g&&($m(f.j,g),f.l.remove(e));an(a,e)});var d=a.g.ya();a.Bh={Vl:d,Xm:d}},Zm=function(a,b){var c=a.g.get(b.getId()),d=null,e=b.Kc(),f=b.Cb();null!=e&&null!=f&&(d=a.C.get(e+":"+f));if(c&&!d){var g=b.Kc(),h=b.Cb();g&&h&&a.C.remove(g+":"+h)}d&&!c&&a.g.remove(d.getId());a.g.set(b.getId(),b);null!=e&&null!=f&&a.C.set(e+":"+f,b)},an=function(a,b){var c=
a.g.get(b);if(c){a.s.info("Removing sink "+b);a.g.remove(b);b=c.Kc();var d=c.Cb();null!=b&&null!=d&&a.C.remove(b+":"+d);a=a.l;if(0==a.g.g.ya())a.j.onSinkAvailabilityUpdated(a,0);b=a.C;c=c.getId();(c=cn(b.g,c))&&c.session&&dn(b,c.session.sessionId);en(a.H);fn(a.j)}},hn=function(a){a.s.info("Pruning inactive sinks.");var b=new Set;a.g.forEach(function(c){gn(a.j,c)||b.add(c.getId())});b.forEach(function(c){return an(a,c)})};Um.prototype.h=function(a){return this.g.get(a,null)};
var jn=function(a,b){var c=[];Km(a.g.Tb(!1),function(d){cm(Gm(d,b))&&c.push(d)});return c};Um.prototype.Ua=function(){return"cast.SinkDiscoveryService"};Um.prototype.Ib=function(){var a=this,b={};Km(this.g.Tb(!0),function(c){var d=a.g.get(c);d={id:d.getId(),ip:d.Kc(),port:d.Cb(),friendlyName:d.h.friendlyName,modelName:d.l,capabilities:d.g,discoveredByDial:d.Si,appStatusMap:d.j};b[c]=d});return[new kn(b,this.Bh)]};
Um.prototype.Hb=function(){var a=hm(this);if(a&&4==a.version){this.Bh=a.deviceCounts;a=a.sinkMap;for(var b in a){var c=void 0,d=a[b],e=new Fm("",d.friendlyName,d.modelName,d.capabilities,d.ip,d.port);e.h.id=d.id;e.Si=d.discoveredByDial;e.j=d.appStatusMap;for(c in e.j)"unavailable"==e.j[c]&&(e.j[c]="unavailable_rescan");c=e;this.h(c.getId())||Zm(this,c)}hn(this)}};var kn=function(a,b){this.sinkMap=a;this.deviceCounts=b;this.version=4};var ln={STOP_MEDIA:"STOP",MEDIA_SET_VOLUME:"SET_VOLUME",MEDIA_GET_STATUS:"GET_STATUS"};var mn=function(){this.type="GET_STATUS";this.requestId=0};var nn=function(a,b){this.requestId=a;this.Xe=b;this.Zo=null};nn.prototype.g=function(){};var on=function(){this.g=new Om},pn=function(a,b){a.g.set(b.requestId,b);b.Zo=setTimeout(function(){a.g.remove(b.requestId);b.g()},b.Xe)},qn=function(a,b){var c=a.g.get(b);if(!c)return null;clearTimeout(c.Zo);a.g.remove(b);return c};var rn=function(a,b,c){this.type="APPLICATION_BROADCAST";this.requestId=0;this.appIds=a;this.namespace=b;this.message=c};var sn=function(a){this.type="LAUNCH";this.requestId=0;this.appId=a;this.language=null};var tn=function(a){this.type="STOP";this.requestId=0;this.sessionId=a||null};var un=function(a){this.h=a;this.g=1E3*Math.floor(1E6*Math.random())},vn=function(a){var b=a.g++;0==b&&(b=a.g++);return b};un.prototype.Ua=function(){return"IdGenerator."+this.h};un.prototype.Ib=function(){return[this.g]};un.prototype.Hb=function(){var a=hm(this);a&&(this.g=a)};var wn=function(a,b){this.h=a;this.j=b;this.g=new on;this.l=new un("cast.RequestIdGenerator")};wn.prototype.init=function(){km(this.l)};var yn=function(a,b,c,d){var e=vn(a.l);b.requestId=e;b=new zb;c=new xn(e,b,"number"===typeof c&&0<c?c:6E5,d);pn(a.g,c);return c};
wn.prototype.sendRequest=function(a,b,c,d,e,f){var g=this;if(!bm.hasOwnProperty(c))return Promise.reject(Error("Custom namespace is not supported"));var h=yn(this,a,void 0!==d?d:3E3,e),m=h.Bb;zn(this.h,b,c,a,e||this.j,f).then(null,function(){qn(g.g,h.requestId);m.reject(An)});return m.g};
wn.prototype.sendMessage=function(a,b,c,d,e,f){var g=this,h=yn(this,a,void 0!==d?d:3E3,e),m=h.Bb;zn(this.h,b,c,a,e||this.j,f).then(function(){qn(g.g,h.requestId);m.resolve(!0)},function(){qn(g.g,h.requestId);m.reject(An)});return m.g};
var Bn=function(a,b,c){var d=new sn(b.appId);d.language=b.language?b.language:chrome.i18n.getUILanguage?chrome.i18n.getUILanguage():chrome.runtime.getManifest().default_locale;return a.sendRequest(d,c,Xl,b.requestSessionTimeout)},Cn=Error("Timeout"),An=Error("Failed to send message"),xn=function(a,b,c,d){nn.call(this,a,c);this.Bb=b;this.sourceId=d};t(xn,nn);xn.prototype.g=function(){this.Bb.reject(Cn)};var Dn=function(a){return a.ya&&"function"==typeof a.ya?a.ya():La(a)||"string"===typeof a?a.length:Ac(a)},En=function(a){if(a.Ma&&"function"==typeof a.Ma)return a.Ma();if("string"===typeof a)return a.split("");if(La(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Cc(a)},Fn=function(a){if(a.Pb&&"function"==typeof a.Pb)return a.Pb();if(!a.Ma||"function"!=typeof a.Ma){if(La(a)||"string"===typeof a){var b=[];a=a.length;for(var c=0;c<a;c++)b.push(c);return b}return Dc(a)}},Gn=function(a){return a.zc&&
"function"==typeof a.zc?a.zc():La(a)||"string"===typeof a?0==a.length:Gc(a)},Hn=function(a,b,c){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,c);else if(La(a)||"string"===typeof a)Hb(a,b,c);else for(var d=Fn(a),e=En(a),f=e.length,g=0;g<f;g++)b.call(c,e[g],d&&d[g],a)},In=function(a,b,c){if("function"==typeof a.map)return a.map(b,c);if(La(a)||"string"===typeof a)return Mb(a,b,c);var d=Fn(a),e=En(a),f=e.length;if(d){var g={};for(var h=0;h<f;h++)g[d[h]]=b.call(c,e[h],d[h],a)}else for(g=[],h=
0;h<f;h++)g[h]=b.call(c,e[h],void 0,a);return g},Jn=function(a,b){if("function"==typeof a.every)return a.every(b,void 0);if(La(a)||"string"===typeof a)return Pb(a,b,void 0);for(var c=Fn(a),d=En(a),e=d.length,f=0;f<e;f++)if(!b.call(void 0,d[f],c&&c[f],a))return!1;return!0};var Kn=function(a){this.g=new Om;if(a){a=En(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])}},Ln=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+Qa(a):b.substr(0,1)+a};k=Kn.prototype;k.ya=function(){return this.g.ya()};k.add=function(a){this.g.set(Ln(a),a)};k.removeAll=function(a){a=En(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};k.remove=function(a){return this.g.remove(Ln(a))};k.clear=function(){this.g.clear()};k.zc=function(){return this.g.zc()};
k.contains=function(a){return Rm(this.g,Ln(a))};k.Ma=function(){return this.g.Ma()};k.clone=function(){return new Kn(this)};k.equals=function(a){return this.ya()==Dn(a)&&Mn(this,a)};var Mn=function(a,b){var c=Dn(b);if(a.ya()>c)return!1;!(b instanceof Kn)&&5<c&&(b=new Kn(b));return Jn(a,function(d){var e=b;return e.contains&&"function"==typeof e.contains?e.contains(d):e.lf&&"function"==typeof e.lf?e.lf(d):La(e)||"string"===typeof e?Tb(e,d):Fc(e,d)})};Kn.prototype.Tb=function(){return this.g.Tb(!1)};var On=function(a,b){this.C=a;this.j=b;this.h=new Om;this.g=new Kn;this.l=0;this.u=new Om("serviceCheck",this.Ss.bind(this),"startDeviceMonitor",this.Ts.bind(this),"releaseDeviceMonitor",this.Rs.bind(this),"deviceJustSetUp",this.Ps.bind(this),"logRecord",this.Qs.bind(this));chrome.runtime.onMessage.addListener(this.o.bind(this));chrome.runtime.onMessageExternal.addListener(this.m.bind(this));Nn(this,"serviceReady")};On.prototype.s=$a("castApp.eventPage.Service");
var en=function(a){if(Pn(a)){var b=new Kn;Km(a.C.g.Tb(!1),function(d){var e=d.Kc();b.add(e);Rm(this.h,e)||this.j.sendRequest(new mn,d,Xl)}.bind(a));var c=!1;a.h.Pb().forEach(function(d){b.contains(d)||(this.h.remove(d),c=!0)}.bind(a));c&&Qn(a)}},Pn=function(a){if(0===a.g.ya())return!1;var b=Va();3E4<b-a.l&&(a.l=b,chrome.tabs.query({url:["chrome://cast/*","chrome-extension://"+chrome.runtime.id+"/cast_setup/*"]},function(c){0===c.length?(this.s.info("No tabs found. Clearing device monitor clients."),
this.g.clear()):this.s.info(function(){return"Tab check found active tabs: "+c.map(function(d){return d.id})})}.bind(a)));b=a.g.ya();a.s.info("Monitor client count: "+b);return 0<b};On.prototype.o=function(a,b,c){if("object"!==typeof a||"cast_app"!==a.type)return!1;var d=this.u.get(a.subtype);if(!d)return!1;if(!a.originId)return Eb("Missing origin ID in the incoming message."),!1;try{var e=d(a,b,c);e&&c(e)}catch(f){this.s.error("Error while handling request",f)}return!1};
var Nn=function(a,b,c){var d=new Sl(b,c);gb(a.s,function(){return"Sending message: "+JSON.stringify(d)});chrome.runtime.sendMessage(d)};k=On.prototype;k.Ss=function(){Nn(this,"serviceReady")};k.Ts=function(a){this.g.contains(a.originId)?this.s.info("Client: "+a.originId+"already registered, dispatching current device list."):(this.s.info("Registering monitor client: "+a.originId),this.g.add(a.originId));Qn(this);Rn(this)};k.Rs=function(a){this.s.info("Unregistering monitor client: "+a.originId);this.g.remove(a.originId)};
k.Ps=function(a){a=a.deviceJustSetUp.udn.replace(/-/g,"").toLowerCase();this.s.info("Device just set up: "+a.slice(-4))};k.Qs=function(a){a=a.logRecord;cb({level:jb(a.levelValue),R:a.loggerName,time:a.time,message:a.msg})};var Qn=function(a){var b=a.h.Ma();Nn(a,"devices",b)},Rn=function(a){a.C.g.Ma().forEach(function(b){this.j.sendRequest(new mn,b,Xl)}.bind(a))};
On.prototype.m=function(a,b,c){switch(a.type){case "handshake":c(new Ul("handshake"));break;case "launch":b=b.tab&&"number"===typeof b.tab.id?b.tab.id:null,null===b||"setup"!==a.entryPoint&&"offers"!==a.entryPoint&&"devices"!==a.entryPoint||chrome.tabs.update(b,{url:"chrome://cast#"+a.entryPoint})}};chrome.cast.VERSION=[1,2];y("chrome.cast.VERSION",chrome.cast.VERSION);chrome.cast.Ww=!0;y("chrome.cast.usingPresentationApi",chrome.cast.Ww);chrome.cast.Ap=function(a,b){this.credentials=a;this.credentialsType=void 0===b?"web":b};y("chrome.cast.CredentialsData",chrome.cast.Ap);chrome.cast.Error=function(a,b,c){this.code=a;this.description=b||null;this.details=c||null};y("chrome.cast.Error",chrome.cast.Error);chrome.cast.Gq=function(a){this.platform=a;this.packageId=this.url=null};
y("chrome.cast.SenderApplication",chrome.cast.Gq);chrome.cast.Image=function(a){this.url=a;this.width=this.height=null};y("chrome.cast.Image",chrome.cast.Image);chrome.cast.Volume=function(a,b){this.level=void 0!==a?a:null;this.muted=void 0!==b?b:null};y("chrome.cast.Volume",chrome.cast.Volume);chrome.cast.sd={CUSTOM_CONTROLLER_SCOPED:"custom_controller_scoped",TAB_AND_ORIGIN_SCOPED:"tab_and_origin_scoped",ORIGIN_SCOPED:"origin_scoped",PAGE_SCOPED:"page_scoped"};y("chrome.cast.AutoJoinPolicy",chrome.cast.sd);chrome.cast.hh={CREATE_SESSION:"create_session",CAST_THIS_TAB:"cast_this_tab"};y("chrome.cast.DefaultActionPolicy",chrome.cast.hh);chrome.cast.Md={VIDEO_OUT:"video_out",AUDIO_OUT:"audio_out",VIDEO_IN:"video_in",AUDIO_IN:"audio_in",MULTIZONE_GROUP:"multizone_group"};
y("chrome.cast.Capability",chrome.cast.Md);chrome.cast.wd={CANCEL:"cancel",TIMEOUT:"timeout",API_NOT_INITIALIZED:"api_not_initialized",INVALID_PARAMETER:"invalid_parameter",EXTENSION_NOT_COMPATIBLE:"extension_not_compatible",EXTENSION_MISSING:"extension_missing",RECEIVER_UNAVAILABLE:"receiver_unavailable",SESSION_ERROR:"session_error",CHANNEL_ERROR:"channel_error",LOAD_MEDIA_FAILED:"load_media_failed"};y("chrome.cast.ErrorCode",chrome.cast.wd);chrome.cast.tq={AVAILABLE:"available",UNAVAILABLE:"unavailable"};
y("chrome.cast.ReceiverAvailability",chrome.cast.tq);chrome.cast.Hq={CHROME:"chrome",IOS:"ios",ANDROID:"android"};y("chrome.cast.SenderPlatform",chrome.cast.Hq);chrome.cast.Cl={CAST:"cast",DIAL:"dial",HANGOUT:"hangout",CUSTOM:"custom"};y("chrome.cast.ReceiverType",chrome.cast.Cl);chrome.cast.Fp={RUNNING:"running",STOPPED:"stopped",ERROR:"error"};y("chrome.cast.DialAppState",chrome.cast.Fp);chrome.cast.xi={CAST:"cast",STOP:"stop"};y("chrome.cast.ReceiverAction",chrome.cast.xi);
chrome.cast.Gl={CONNECTED:"connected",DISCONNECTED:"disconnected",STOPPED:"stopped"};y("chrome.cast.SessionStatus",chrome.cast.Gl);chrome.cast.Kl={ATTENUATION:"attenuation",FIXED:"fixed",MASTER:"master"};y("chrome.cast.VolumeControlType",chrome.cast.Kl);chrome.cast.sp=function(a,b,c,d,e){this.sessionRequest=a;this.sessionListener=b;this.receiverListener=c;this.autoJoinPolicy=d||chrome.cast.sd.TAB_AND_ORIGIN_SCOPED;this.defaultActionPolicy=e||chrome.cast.hh.CREATE_SESSION;this.customDialLaunchCallback=null;this.invisibleSender=!1;this.additionalSessionRequests=[]};y("chrome.cast.ApiConfig",chrome.cast.sp);chrome.cast.Ip=function(a,b){this.appName=a;this.launchParameter=b||null};y("chrome.cast.DialRequest",chrome.cast.Ip);
chrome.cast.Gp=function(a,b,c){this.receiver=a;this.appState=b;this.extraData=c||null};y("chrome.cast.DialLaunchData",chrome.cast.Gp);chrome.cast.Hp=function(a,b){this.doLaunch=a;this.launchParameter=b||null};y("chrome.cast.DialLaunchResponse",chrome.cast.Hp);
chrome.cast.Fl=function(a,b,c,d,e){c=void 0===c?chrome.cast.timeout.requestSession:c;d=void 0===d?!1:d;e=void 0===e?null:e;this.appId=a;this.capabilities=Array.isArray(b)?b:[chrome.cast.Md.VIDEO_OUT,chrome.cast.Md.AUDIO_OUT];this.requestSessionTimeout=c;this.dialRequest=this.language=null;this.androidReceiverCompatible=d;this.credentialsData=e};y("chrome.cast.SessionRequest",chrome.cast.Fl);
chrome.cast.Bl=function(a,b,c,d){this.label=a;this.friendlyName=ue(b);this.capabilities=c||[];this.volume=d||null;this.receiverType=chrome.cast.Cl.CAST;this.displayStatus=this.isActiveInput=null};y("chrome.cast.Receiver",chrome.cast.Bl);chrome.cast.uq=function(a,b){this.statusText=a;this.appImages=b;this.showStop=null};y("chrome.cast.ReceiverDisplayStatus",chrome.cast.uq);
chrome.cast.Il=function(){this.requestSession=6E4;this.sendCustomMessage=this.setReceiverVolume=this.stopSession=this.leaveSession=3E3};y("chrome.cast.Timeout",chrome.cast.Il);chrome.cast.timeout=new chrome.cast.Il;y("chrome.cast.timeout",chrome.cast.timeout);chrome.cast.el="auto-join";chrome.cast.zl="cast-session_";chrome.cast.media.Op={SDR:"sdr",HDR:"hdr",DV:"dv"};y("chrome.cast.media.HdrType",chrome.cast.media.Op);chrome.cast.media.Pp={AAC:"aac",AC3:"ac3",MP3:"mp3",TS:"ts",TS_AAC:"ts_aac",E_AC3:"e_ac3",FMP4:"fmp4"};y("chrome.cast.media.HlsSegmentFormat",chrome.cast.media.Pp);chrome.cast.media.Qp={MPEG2_TS:"mpeg2_ts",FMP4:"fmp4"};y("chrome.cast.media.HlsVideoSegmentFormat",chrome.cast.media.Qp);chrome.cast.media.qe={PAUSE:"pause",SEEK:"seek",STREAM_VOLUME:"stream_volume",STREAM_MUTE:"stream_mute"};
y("chrome.cast.media.MediaCommand",chrome.cast.media.qe);chrome.cast.media.qq={ALBUM:"ALBUM",PLAYLIST:"PLAYLIST",AUDIOBOOK:"AUDIOBOOK",RADIO_STATION:"RADIO_STATION",PODCAST_SERIES:"PODCAST_SERIES",TV_SERIES:"TV_SERIES",VIDEO_PLAYLIST:"VIDEO_PLAYLIST",LIVE_TV:"LIVE_TV",MOVIE:"MOVIE"};y("chrome.cast.media.QueueType",chrome.cast.media.qq);chrome.cast.media.si={GENERIC_CONTAINER:0,AUDIOBOOK_CONTAINER:1};y("chrome.cast.media.ContainerType",chrome.cast.media.si);
chrome.cast.media.re={GENERIC:0,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};y("chrome.cast.media.MetadataType",chrome.cast.media.re);chrome.cast.media.ff={IDLE:"IDLE",PLAYING:"PLAYING",PAUSED:"PAUSED",BUFFERING:"BUFFERING"};y("chrome.cast.media.PlayerState",chrome.cast.media.ff);chrome.cast.media.yi={OFF:"REPEAT_OFF",ALL:"REPEAT_ALL",SINGLE:"REPEAT_SINGLE",ALL_AND_SHUFFLE:"REPEAT_ALL_AND_SHUFFLE"};y("chrome.cast.media.RepeatMode",chrome.cast.media.yi);
chrome.cast.media.vq={PLAYBACK_START:"PLAYBACK_START",PLAYBACK_PAUSE:"PLAYBACK_PAUSE"};y("chrome.cast.media.ResumeState",chrome.cast.media.vq);chrome.cast.media.Hl={BUFFERED:"BUFFERED",LIVE:"LIVE",OTHER:"OTHER"};y("chrome.cast.media.StreamType",chrome.cast.media.Hl);chrome.cast.media.Sp={CANCELLED:"CANCELLED",INTERRUPTED:"INTERRUPTED",FINISHED:"FINISHED",ERROR:"ERROR"};y("chrome.cast.media.IdleReason",chrome.cast.media.Sp);chrome.cast.media.Pq={TEXT:"TEXT",AUDIO:"AUDIO",VIDEO:"VIDEO"};
y("chrome.cast.media.TrackType",chrome.cast.media.Pq);chrome.cast.media.Mq={SUBTITLES:"SUBTITLES",CAPTIONS:"CAPTIONS",DESCRIPTIONS:"DESCRIPTIONS",CHAPTERS:"CHAPTERS",METADATA:"METADATA"};y("chrome.cast.media.TextTrackType",chrome.cast.media.Mq);chrome.cast.media.Iq={NONE:"NONE",OUTLINE:"OUTLINE",DROP_SHADOW:"DROP_SHADOW",RAISED:"RAISED",DEPRESSED:"DEPRESSED"};y("chrome.cast.media.TextTrackEdgeType",chrome.cast.media.Iq);chrome.cast.media.Nq={NONE:"NONE",NORMAL:"NORMAL",ROUNDED_CORNERS:"ROUNDED_CORNERS"};
y("chrome.cast.media.TextTrackWindowType",chrome.cast.media.Nq);chrome.cast.media.Jq={SANS_SERIF:"SANS_SERIF",MONOSPACED_SANS_SERIF:"MONOSPACED_SANS_SERIF",SERIF:"SERIF",MONOSPACED_SERIF:"MONOSPACED_SERIF",CASUAL:"CASUAL",CURSIVE:"CURSIVE",SMALL_CAPITALS:"SMALL_CAPITALS"};y("chrome.cast.media.TextTrackFontGenericFamily",chrome.cast.media.Jq);chrome.cast.media.Kq={NORMAL:"NORMAL",BOLD:"BOLD",BOLD_ITALIC:"BOLD_ITALIC",ITALIC:"ITALIC"};y("chrome.cast.media.TextTrackFontStyle",chrome.cast.media.Kq);
chrome.cast.media.Rq={LIKE:"LIKE",DISLIKE:"DISLIKE",FOLLOW:"FOLLOW",UNFOLLOW:"UNFOLLOW"};y("chrome.cast.media.UserAction",chrome.cast.media.Rq);chrome.cast.media.Mp=function(){this.customData=null};y("chrome.cast.media.GetStatusRequest",chrome.cast.media.Mp);chrome.cast.media.fq=function(){this.customData=null};y("chrome.cast.media.PauseRequest",chrome.cast.media.fq);chrome.cast.media.gq=function(){this.customData=null};y("chrome.cast.media.PlayRequest",chrome.cast.media.gq);chrome.cast.media.Fq=function(){this.customData=this.resumeState=this.currentTime=null};y("chrome.cast.media.SeekRequest",chrome.cast.media.Fq);
chrome.cast.media.StopRequest=function(){this.customData=null};y("chrome.cast.media.StopRequest",chrome.cast.media.StopRequest);chrome.cast.media.Vq=function(a){this.volume=a;this.customData=null};y("chrome.cast.media.VolumeRequest",chrome.cast.media.Vq);
chrome.cast.media.Up=function(a){this.type="LOAD";this.requestId=0;this.sessionId=null;this.media=a;this.activeTrackIds=null;this.autoplay=!0;this.atvCredentialsType=this.atvCredentials=this.credentialsType=this.credentials=void 0;this.customData=this.currentTime=null};y("chrome.cast.media.LoadRequest",chrome.cast.media.Up);chrome.cast.media.QF=function(a){this.type="PRECACHE";this.requestId=0;this.precacheData=a};
chrome.cast.media.Lp=function(a,b){this.requestId=0;this.activeTrackIds=a||null;this.textTrackStyle=b||null};y("chrome.cast.media.EditTracksInfoRequest",chrome.cast.media.Lp);chrome.cast.media.ri=function(a){this.containerType=a=void 0===a?chrome.cast.media.si.GENERIC_CONTAINER:a;this.containerDuration=this.containerImages=this.sections=this.title=void 0};y("chrome.cast.media.ContainerMetadata",chrome.cast.media.ri);
chrome.cast.media.sc=function(a){this.metadataType=this.type=a;this.queueItemId=this.sectionStartTimeInContainer=this.sectionStartAbsoluteTime=this.sectionStartTimeInMedia=this.sectionDuration=void 0};y("chrome.cast.media.MediaMetadata",chrome.cast.media.sc);chrome.cast.media.rl=function(){chrome.cast.media.sc.call(this,chrome.cast.media.re.GENERIC);this.releaseDate=this.releaseYear=this.images=this.subtitle=this.title=void 0};t(chrome.cast.media.rl,chrome.cast.media.sc);
y("chrome.cast.media.GenericMediaMetadata",chrome.cast.media.rl);chrome.cast.media.tl=function(){chrome.cast.media.sc.call(this,chrome.cast.media.re.MOVIE);this.releaseDate=this.releaseYear=this.images=this.subtitle=this.studio=this.title=void 0};t(chrome.cast.media.tl,chrome.cast.media.sc);y("chrome.cast.media.MovieMediaMetadata",chrome.cast.media.tl);
chrome.cast.media.Jl=function(){chrome.cast.media.sc.call(this,chrome.cast.media.re.TV_SHOW);this.originalAirdate=this.releaseYear=this.images=this.episode=this.episodeNumber=this.season=this.seasonNumber=this.episodeTitle=this.title=this.seriesTitle=void 0};t(chrome.cast.media.Jl,chrome.cast.media.sc);y("chrome.cast.media.TvShowMediaMetadata",chrome.cast.media.Jl);
chrome.cast.media.ul=function(){chrome.cast.media.sc.call(this,chrome.cast.media.re.MUSIC_TRACK);this.releaseDate=this.releaseYear=this.images=this.discNumber=this.trackNumber=this.artistName=this.songName=this.composer=this.artist=this.albumArtist=this.title=this.albumName=void 0};t(chrome.cast.media.ul,chrome.cast.media.sc);y("chrome.cast.media.MusicTrackMediaMetadata",chrome.cast.media.ul);
chrome.cast.media.Al=function(){chrome.cast.media.sc.call(this,chrome.cast.media.re.PHOTO);this.creationDateTime=this.height=this.width=this.longitude=this.latitude=this.images=this.location=this.artist=this.title=void 0};t(chrome.cast.media.Al,chrome.cast.media.sc);y("chrome.cast.media.PhotoMediaMetadata",chrome.cast.media.Al);chrome.cast.media.il=function(){chrome.cast.media.ri.call(this,chrome.cast.media.si.AUDIOBOOK_CONTAINER);this.releaseDate=this.publisher=this.narrators=this.authors=void 0};
t(chrome.cast.media.il,chrome.cast.media.ri);y("chrome.cast.media.AudiobookContainerMetadata",chrome.cast.media.il);chrome.cast.media.fl=function(){chrome.cast.media.sc.call(this,chrome.cast.media.re.AUDIOBOOK_CHAPTER);this.images=this.subtitle=this.bookTitle=this.chapterNumber=this.title=this.chapterTitle=void 0};t(chrome.cast.media.fl,chrome.cast.media.sc);y("chrome.cast.media.AudiobookChapterMediaMetadata",chrome.cast.media.fl);
chrome.cast.media.Wp=function(a,b){this.contentId=a;this.contentUrl=void 0;this.streamType=chrome.cast.media.Hl.BUFFERED;this.contentType=b;this.metadata=null;this.atvEntity=this.entity=void 0;this.duration=null;this.startAbsoluteTime=void 0;this.customData=this.textTrackStyle=this.tracks=null;this.userActionStates=this.hlsVideoSegmentFormat=this.hlsSegmentFormat=this.vmapAdsRequest=this.breakClips=this.breaks=void 0};y("chrome.cast.media.MediaInfo",chrome.cast.media.Wp);
chrome.cast.media.kq=function(a){this.itemId=null;this.media=a;this.autoplay=!0;this.startTime=0;this.playbackDuration=null;this.preloadTime=0;this.customData=this.activeTrackIds=null};y("chrome.cast.media.QueueItem",chrome.cast.media.kq);chrome.cast.media.Dp="CC1AD845";y("chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID",chrome.cast.media.Dp);chrome.cast.media.timeout={};chrome.cast.media.timeout.load=0;y("chrome.cast.media.timeout.load",chrome.cast.media.timeout.load);
chrome.cast.media.timeout.Ja=0;y("chrome.cast.media.timeout.getStatus",chrome.cast.media.timeout.Ja);chrome.cast.media.timeout.play=0;y("chrome.cast.media.timeout.play",chrome.cast.media.timeout.play);chrome.cast.media.timeout.pause=0;y("chrome.cast.media.timeout.pause",chrome.cast.media.timeout.pause);chrome.cast.media.timeout.seek=0;y("chrome.cast.media.timeout.seek",chrome.cast.media.timeout.seek);chrome.cast.media.timeout.stop=0;y("chrome.cast.media.timeout.stop",chrome.cast.media.timeout.stop);
chrome.cast.media.timeout.Xb=0;y("chrome.cast.media.timeout.setVolume",chrome.cast.media.timeout.Xb);chrome.cast.media.timeout.Ui=0;y("chrome.cast.media.timeout.editTracksInfo",chrome.cast.media.timeout.Ui);chrome.cast.media.timeout.Ev=0;y("chrome.cast.media.timeout.queue",chrome.cast.media.timeout.Ev);chrome.cast.media.Oq=function(a,b){this.trackId=a;this.trackContentType=this.trackContentId=null;this.type=b;this.customData=this.subtype=this.language=this.name=null};y("chrome.cast.media.Track",chrome.cast.media.Oq);
chrome.cast.media.Lq=function(){this.customData=this.fontStyle=this.fontGenericFamily=this.fontFamily=this.fontScale=this.windowRoundedCornerRadius=this.windowColor=this.windowType=this.edgeColor=this.edgeType=this.backgroundColor=this.foregroundColor=null};y("chrome.cast.media.TextTrackStyle",chrome.cast.media.Lq);chrome.cast.media.mq=function(a){this.type="QUEUE_LOAD";this.sessionId=this.requestId=null;this.items=a;this.startIndex=0;this.repeatMode=chrome.cast.media.yi.OFF;this.customData=null};
y("chrome.cast.media.QueueLoadRequest",chrome.cast.media.mq);chrome.cast.media.jq=function(a){this.type="QUEUE_INSERT";this.sessionId=this.requestId=null;this.items=a;this.customData=this.insertBefore=null};y("chrome.cast.media.QueueInsertItemsRequest",chrome.cast.media.jq);chrome.cast.media.rq=function(a){this.type="QUEUE_UPDATE";this.sessionId=this.requestId=null;this.items=a;this.customData=null};y("chrome.cast.media.QueueUpdateItemsRequest",chrome.cast.media.rq);
chrome.cast.media.lq=function(){this.type="QUEUE_UPDATE";this.customData=this.jump=this.currentItemId=this.sessionId=this.requestId=null};y("chrome.cast.media.QueueJumpRequest",chrome.cast.media.lq);chrome.cast.media.pq=function(){this.type="QUEUE_UPDATE";this.customData=this.repeatMode=this.sessionId=this.requestId=null};y("chrome.cast.media.QueueSetPropertiesRequest",chrome.cast.media.pq);
chrome.cast.media.nq=function(a){this.type="QUEUE_REMOVE";this.sessionId=this.requestId=null;this.itemIds=a;this.customData=null};y("chrome.cast.media.QueueRemoveItemsRequest",chrome.cast.media.nq);chrome.cast.media.oq=function(a){this.type="QUEUE_REORDER";this.sessionId=this.requestId=null;this.itemIds=a;this.customData=this.insertBefore=null};y("chrome.cast.media.QueueReorderItemsRequest",chrome.cast.media.oq);
chrome.cast.media.vp=function(a,b,c){this.id=a;this.breakClipIds=b;this.position=c;this.duration=void 0;this.isWatched=!1;this.isEmbedded=void 0};y("chrome.cast.media.Break",chrome.cast.media.vp);chrome.cast.media.wp=function(a){this.id=a;this.vastAdsRequest=this.customData=this.hlsSegmentFormat=this.clickThroughUrl=this.posterUrl=this.whenSkippable=this.duration=this.title=this.contentType=this.contentUrl=this.contentId=void 0};y("chrome.cast.media.BreakClip",chrome.cast.media.wp);
chrome.cast.media.Tq=function(){this.adsResponse=this.adTagUrl=void 0};y("chrome.cast.media.VastAdsRequest",chrome.cast.media.Tq);chrome.cast.media.xp=function(){this.whenSkippable=this.breakClipId=this.breakId=this.currentBreakClipTime=this.currentBreakTime=void 0};y("chrome.cast.media.BreakStatus",chrome.cast.media.xp);chrome.cast.media.Tp=function(a,b,c,d){this.start=a;this.end=b;this.isMovingWindow=c;this.isLiveDone=d};y("chrome.cast.media.LiveSeekableRange",chrome.cast.media.Tp);
chrome.cast.media.iq=function(a,b,c,d,e,f,g){this.id=a;this.queueType=this.entity=void 0;this.name=b;this.description=c;this.repeatMode=d;this.shuffle=!1;this.items=e;this.startIndex=f;this.startTime=g;this.containerMetadata=void 0};y("chrome.cast.media.QueueData",chrome.cast.media.iq);chrome.cast.media.Sq=function(a){this.userAction=a;this.customData=void 0};y("chrome.cast.media.UserActionState",chrome.cast.media.Sq);chrome.cast.media.Uq=function(a,b,c){this.width=a;this.height=b;this.hdrType=c};
y("chrome.cast.media.VideoInformation",chrome.cast.media.Uq);chrome.cast.media.aa=function(a,b){this.sessionId=a;this.mediaSessionId=b;this.media=null;this.videoInfo=this.queueData=void 0;this.playbackRate=1;this.playerState=chrome.cast.media.ff.IDLE;this.currentTime=0;this.supportedMediaCommands=[];this.volume=new chrome.cast.Volume;this.items=this.preloadedItemId=this.loadingItemId=this.currentItemId=this.customData=this.activeTrackIds=this.idleReason=null;this.repeatMode=chrome.cast.media.yi.OFF;this.liveSeekableRange=this.breakStatus=void 0};
y("chrome.cast.media.Media",chrome.cast.media.aa);chrome.cast.media.aa.prototype.Ja=function(){};chrome.cast.media.aa.prototype.getStatus=chrome.cast.media.aa.prototype.Ja;chrome.cast.media.aa.prototype.play=function(){};chrome.cast.media.aa.prototype.play=chrome.cast.media.aa.prototype.play;chrome.cast.media.aa.prototype.Hu=function(){};chrome.cast.media.aa.prototype.playWithContext=chrome.cast.media.aa.prototype.Hu;chrome.cast.media.aa.prototype.pause=function(){};
chrome.cast.media.aa.prototype.pause=chrome.cast.media.aa.prototype.pause;chrome.cast.media.aa.prototype.Gu=function(){};chrome.cast.media.aa.prototype.pauseWithContext=chrome.cast.media.aa.prototype.Gu;chrome.cast.media.aa.prototype.seek=function(){};chrome.cast.media.aa.prototype.seek=chrome.cast.media.aa.prototype.seek;chrome.cast.media.aa.prototype.stop=function(a){a||new chrome.cast.media.StopRequest};chrome.cast.media.aa.prototype.stop=chrome.cast.media.aa.prototype.stop;
chrome.cast.media.aa.prototype.Xb=function(){};chrome.cast.media.aa.prototype.setVolume=chrome.cast.media.aa.prototype.Xb;chrome.cast.media.aa.prototype.Ui=function(){};chrome.cast.media.aa.prototype.editTracksInfo=chrome.cast.media.aa.prototype.Ui;chrome.cast.media.aa.prototype.Gv=function(){};chrome.cast.media.aa.prototype.queueInsertItems=chrome.cast.media.aa.prototype.Gv;chrome.cast.media.aa.prototype.Fv=function(){};chrome.cast.media.aa.prototype.queueAppendItem=chrome.cast.media.aa.prototype.Fv;
chrome.cast.media.aa.prototype.Qv=function(){};chrome.cast.media.aa.prototype.queueUpdateItems=chrome.cast.media.aa.prototype.Qv;chrome.cast.media.aa.prototype.Lv=function(){};chrome.cast.media.aa.prototype.queuePrev=chrome.cast.media.aa.prototype.Lv;chrome.cast.media.aa.prototype.Kv=function(){};chrome.cast.media.aa.prototype.queueNext=chrome.cast.media.aa.prototype.Kv;chrome.cast.media.aa.prototype.Hv=function(a){Sn(this,a)};chrome.cast.media.aa.prototype.queueJumpToItem=chrome.cast.media.aa.prototype.Hv;
chrome.cast.media.aa.prototype.Pv=function(){};chrome.cast.media.aa.prototype.queueSetRepeatMode=chrome.cast.media.aa.prototype.Pv;chrome.cast.media.aa.prototype.Nv=function(){};chrome.cast.media.aa.prototype.queueRemoveItems=chrome.cast.media.aa.prototype.Nv;chrome.cast.media.aa.prototype.Mv=function(a){Sn(this,a)};chrome.cast.media.aa.prototype.queueRemoveItem=chrome.cast.media.aa.prototype.Mv;chrome.cast.media.aa.prototype.Ov=function(){};chrome.cast.media.aa.prototype.queueReorderItems=chrome.cast.media.aa.prototype.Ov;
chrome.cast.media.aa.prototype.Jv=function(a,b,c,d){a=Sn(this,a);0>a||(0>b?d&&d(new chrome.cast.Error(chrome.cast.wd.INVALID_PARAMETER)):a==b&&c&&c())};chrome.cast.media.aa.prototype.queueMoveItemToNewIndex=chrome.cast.media.aa.prototype.Jv;chrome.cast.media.aa.prototype.Kw=function(a){return-1<this.supportedMediaCommands.indexOf(a)};chrome.cast.media.aa.prototype.supportsCommand=chrome.cast.media.aa.prototype.Kw;chrome.cast.media.aa.prototype.Qr=function(){return this.currentTime};
chrome.cast.media.aa.prototype.getEstimatedTime=chrome.cast.media.aa.prototype.Qr;chrome.cast.media.aa.prototype.Or=function(){if(this.breakStatus&&void 0!==this.breakStatus.currentBreakTime)return this.breakStatus.currentBreakTime};chrome.cast.media.aa.prototype.getEstimatedBreakTime=chrome.cast.media.aa.prototype.Or;chrome.cast.media.aa.prototype.Nr=function(){if(this.breakStatus&&void 0!==this.breakStatus.currentBreakClipTime)return this.breakStatus.currentBreakClipTime};
chrome.cast.media.aa.prototype.getEstimatedBreakClipTime=chrome.cast.media.aa.prototype.Nr;chrome.cast.media.aa.prototype.Pr=function(){if(this.liveSeekableRange&&void 0!==this.liveSeekableRange.start&&void 0!==this.liveSeekableRange.end)return this.liveSeekableRange};chrome.cast.media.aa.prototype.getEstimatedLiveSeekableRange=chrome.cast.media.aa.prototype.Pr;chrome.cast.media.aa.prototype.Ai=function(){};chrome.cast.media.aa.prototype.addUpdateListener=chrome.cast.media.aa.prototype.Ai;
chrome.cast.media.aa.prototype.Bi=function(){};chrome.cast.media.aa.prototype.addUpdateListenerWithContext=chrome.cast.media.aa.prototype.Bi;chrome.cast.media.aa.prototype.wk=function(){};chrome.cast.media.aa.prototype.removeUpdateListener=chrome.cast.media.aa.prototype.wk;chrome.cast.media.aa.prototype.xk=function(){};chrome.cast.media.aa.prototype.removeUpdateListenerWithContext=chrome.cast.media.aa.prototype.xk;var Sn=function(a,b){return Qb(a.items,function(c){return c.itemId==b})};var Tn=function(a,b,c){this.sessionId=a;this.namespaceName=b;this.message=c};var Un=function(a,b){this.type="SET_VOLUME";this.requestId=0;this.volume=a;this.expectedVolume=b||null};chrome.cast.ea=function(a,b,c,d,e){this.sessionId=a;this.appId=b;this.displayName=c;this.statusText=null;this.appImages=d;this.receiver=e;this.senderApps=[];this.namespaces=[];this.media=[];this.status=chrome.cast.Gl.CONNECTED;this.transportId=""};y("chrome.cast.Session",chrome.cast.ea);chrome.cast.ea.prototype.yw=function(a,b,c){this.So(null,a,b,c)};chrome.cast.ea.prototype.setReceiverVolumeLevel=chrome.cast.ea.prototype.yw;
chrome.cast.ea.prototype.So=function(a,b,c,d){b=new Un(new chrome.cast.Volume(b,null),this.receiver.volume);a.setReceiverVolume(this.sessionId,b,c,d)};chrome.cast.ea.prototype.setReceiverVolumeLevelWithContext=chrome.cast.ea.prototype.So;chrome.cast.ea.prototype.xw=function(a,b,c){this.Ro(null,a,b,c)};chrome.cast.ea.prototype.setReceiverMuted=chrome.cast.ea.prototype.xw;
chrome.cast.ea.prototype.Ro=function(a,b,c,d){a=new Un(new chrome.cast.Volume(null,b),this.receiver.volume);null.setReceiverVolume(this.sessionId,a,c,d)};chrome.cast.ea.prototype.setReceiverMutedWithContext=chrome.cast.ea.prototype.Ro;chrome.cast.ea.prototype.leave=function(a,b){null.leaveSession(this.sessionId,a,b)};chrome.cast.ea.prototype.leave=chrome.cast.ea.prototype.leave;chrome.cast.ea.prototype.stop=function(){};chrome.cast.ea.prototype.stop=chrome.cast.ea.prototype.stop;
chrome.cast.ea.prototype.Jw=function(){};chrome.cast.ea.prototype.stopWithContext=chrome.cast.ea.prototype.Jw;chrome.cast.ea.prototype.sendMessage=function(){};chrome.cast.ea.prototype.sendMessage=chrome.cast.ea.prototype.sendMessage;chrome.cast.ea.prototype.gw=function(){};chrome.cast.ea.prototype.sendMessageWithContext=chrome.cast.ea.prototype.gw;chrome.cast.ea.prototype.Ai=function(){};chrome.cast.ea.prototype.addUpdateListener=chrome.cast.ea.prototype.Ai;chrome.cast.ea.prototype.Bi=function(){};
chrome.cast.ea.prototype.addUpdateListenerWithContext=chrome.cast.ea.prototype.Bi;chrome.cast.ea.prototype.wk=function(){};chrome.cast.ea.prototype.removeUpdateListener=chrome.cast.ea.prototype.wk;chrome.cast.ea.prototype.xk=function(){};chrome.cast.ea.prototype.removeUpdateListenerWithContext=chrome.cast.ea.prototype.xk;chrome.cast.ea.prototype.br=function(){};chrome.cast.ea.prototype.addMessageListener=chrome.cast.ea.prototype.br;chrome.cast.ea.prototype.cr=function(){};
chrome.cast.ea.prototype.addMessageListenerWithContext=chrome.cast.ea.prototype.cr;chrome.cast.ea.prototype.Zq=function(){};chrome.cast.ea.prototype.addMediaListener=chrome.cast.ea.prototype.Zq;chrome.cast.ea.prototype.ar=function(){};chrome.cast.ea.prototype.addMediaListenerWithContext=chrome.cast.ea.prototype.ar;chrome.cast.ea.prototype.Yv=function(){};chrome.cast.ea.prototype.removeMediaListener=chrome.cast.ea.prototype.Yv;chrome.cast.ea.prototype.Zv=function(){};
chrome.cast.ea.prototype.removeMediaListenerWithContext=chrome.cast.ea.prototype.Zv;chrome.cast.ea.prototype.aw=function(){};chrome.cast.ea.prototype.removeMessageListener=chrome.cast.ea.prototype.aw;chrome.cast.ea.prototype.bw=function(){};chrome.cast.ea.prototype.removeMessageListenerWithContext=chrome.cast.ea.prototype.bw;chrome.cast.ea.prototype.Ot=function(a){a.sessionId=this.sessionId};chrome.cast.ea.prototype.loadMedia=chrome.cast.ea.prototype.Ot;
chrome.cast.ea.prototype.Iv=function(a){a.sessionId=this.sessionId};chrome.cast.ea.prototype.queueLoad=chrome.cast.ea.prototype.Iv;var Xn=function(a,b){if(!b.applications||1!=b.applications.length)return null;var c=b.applications[0];a=Vn(a);a=new chrome.cast.ea(c.sessionId,c.appId,c.displayName,c.appImages,a);a.senderApps=c.senderApps;a.namespaces=c.namespaces||[];a.transportId=c.transportId;a.statusText=c.statusText;if(!a.sessionId||!(a.namespaces&&0!=a.namespaces.length||Wn(a)))return null;a.receiver.volume=b.volume;"boolean"===typeof b.isActiveInput&&(a.receiver.isActiveInput=b.isActiveInput);return a},Yn=function(a){var b=
[];if(!a)return b;a&1&&b.push(chrome.cast.Md.VIDEO_OUT);a&2&&b.push(chrome.cast.Md.VIDEO_IN);a&4&&b.push(chrome.cast.Md.AUDIO_OUT);a&8&&b.push(chrome.cast.Md.AUDIO_IN);a&32&&b.push(chrome.cast.Md.MULTIZONE_GROUP);return b},Vn=function(a){var b=Dm(Cm(),a.getId());return new chrome.cast.Bl(b,a.h.friendlyName,Yn(a.g))},Zn=function(a,b){if(a.statusText!=b.statusText)return!0;var c=a.namespaces||[],d=b.namespaces||[];if(c.length!=d.length)return!0;for(var e={Pf:0};e.Pf<c.length;e={Pf:e.Pf},e.Pf++)if(!d.some(function(f){return function(g){return g.name==
c[f.Pf].name}}(e)))return!0;return a.receiver.volume.level!==b.receiver.volume.level||a.receiver.volume.muted!==b.receiver.volume.muted?!0:!1},$n=function(a){Array.isArray(a)?a.forEach($n):Na(a)&&Object.keys(a).forEach(function(b){null===a[b]?delete a[b]:(Na(a[b])||Array.isArray(a[b]))&&$n(a[b])})},ao=function(a){return a.namespaces.some(function(b){return b.name==Zl})},Wn=function(a){return null!==a&&"MultizoneLeader"==a.appId},bo=function(a){return"E8C28D3C"==a||"00000000-0000-0000-0000-000000000000"==
a};var co=function(a,b,c){this.type=a;this.message=b;this.sequenceNumber=void 0!==c?c:-1;this.timeoutMillis=0;this.clientId=""};var eo=function(a,b){this.l=a;this.g=b;this.j=[];this.h=new on},go=function(a,b){return(a=fo(a.g,b))?a.routeId:null};eo.prototype.listen=function(a,b){this.j[a]=b};var jo=function(a,b,c,d){gb(ho,"Sending to "+c);gb(ho,JSON.stringify(d));d.clientId=c;io(a.l.j,b,d)},ko=function(a,b,c){var d=fo(a.g,b);d&&d.g?jo(a,d.routeId,b,c):a.connect(b).then(function(e){e?(e=go(a,b))?jo(a,e,b,c):ho.K("No route for "+b):ho.K("No connected client "+b)},null)};
eo.prototype.connect=function(a){var b=fo(this.g,a);if(null!=b&&b.g)return Promise.resolve(!0);b=go(this,a);if(!b)return ho.K("No route for client "+a),Promise.resolve(!1);if(a=this.h.g.get(b,null))return a.Bb.g;a=new zb;pn(this.h,new lo(b,a));return a.g};var ho=$a("mr.cast.ApiMessenger"),lo=function(a,b){nn.call(this,a,3E4);this.Bb=b};t(lo,nn);lo.prototype.g=function(){this.Bb.resolve(!1)};var mo=function(a,b,c){this.j=a;this.h=b;this.g=c},no=function(a){var b="cast-dial:"+a.j,c=new URLSearchParams;a.h&&c.set("dialPostData",a.h);a.g&&c.set("clientId",a.g);(a=c.toString())&&(b+="?"+a);return b};var oo=function(a,b,c,d,e,f,g,h,m,q){this.C=a;this.g=b||null;this.h=c||null;this.j=d||null;this.l=void 0!==e?e:null;this.D=f||null;this.G=g||null;this.u=h||!1;this.o=m||null;this.m=q||null;this.H=["WEB"];this.F=null},po=function(a,b){return(a=a.match(b+"=([^/]*)"))?a[1]:null},ro=function(a){a=a.match(/__castAppId__=([^/]*)/g);return null==a?[]:Lb(Mb(a,function(b){b=po(b,"__castAppId__");if(!b)return null;b=b.match(qo);if(!b||0==b.length)return null;var c=[];3==b.length&&b[2]&&(c=b[2].split(","));
return{appId:b[1],capabilities:c}}),function(b){return null!=b})},so=function(a){return Mb(a.C,function(b){return b.appId})},to=function(a){var b={launchCheckerParams:{}};a.F&&(b.launchCheckerParams.credentialsData=a.F);return b},uo=function(a){return a.h?a.h:chrome.cast.sd.TAB_AND_ORIGIN_SCOPED},vo=function(a){var b=a.C.map(function(c){var d="cast:"+c.appId,e=new URLSearchParams;c.capabilities&&0<c.capabilities.length&&e.set("capabilities",c.capabilities.join(","));a.g&&e.set("clientId",a.g);a.h&&
e.set("autoJoinPolicy",a.h);a.j&&e.set("defaultActionPolicy",a.j);null!=a.l&&e.set("launchTimeout",String(a.l));a.u&&e.set("invisibleSender","true");a.o&&(e.set("broadcastNamespace",a.o),e.set("broadcastId",String(Math.random())));a.m&&e.set("broadcastMessage",encodeURIComponent(JSON.stringify(a.m)));e.set("supportedAppTypes",a.H.join(","));e.set("appParams",JSON.stringify(to(a)));return d+"?"+e.toString()});a.D&&b.push(no(new mo(a.D,a.G,a.g)));return b},xo=function(a,b){a=so(a);var c=wo(b);return Ob(a,
function(d){return Tb(c,d)})},yo=function(a){try{var b=new URL(a)}catch(r){return null}if("https:"==b.protocol)if("https:"!=b.protocol||"google.com"!=b.host||"/cast"!=b.pathname)a=null;else{var c=b.hash;if((a=ro(c))&&0!=a.length){b=po(c,"__castClientId__");var d=po(c,"__castAutoJoinPolicy__"),e=po(c,"__castDefaultActionPolicy__");var f=po(c,"__castLaunchTimeout__");null==f?f=null:(f=Number(f),f=!isNaN(f)&&0<f?f:null);var g=po(c,"__dialAppName__"),h=po(c,"__dialPostData__");var m=po(c,"__castInvisibleSender__");
m=null===m?null:"true"==m;var q=po(c,"__castBroadcastNamespace__");c=(c=po(c,"__castBroadcastMessage__"))?JSON.parse(decodeURIComponent(c)):null;a=new oo(a,b,d,e,f,g,h,m,q,c)}else a=null}else if("cast:"==b.protocol){a=b.pathname;d=b.searchParams.get("capabilities");a={appId:a,capabilities:d?d.split(","):[]};h=b.searchParams;b=h.get("clientId");d=h.get("autoJoinPolicy");e=h.get("defaultActionPolicy");c=Number(h.get("launchTimeout"));if(isNaN(c)||0>=c)c=null;f="true"==h.get("invisibleSender");g=h.get("broadcastNamespace");
h=(h=h.get("broadcastMessage"))?JSON.parse(decodeURIComponent(h)):null;a=new oo([a],b,d,e,c,void 0,void 0,f,g,h)}else a=null;return a},wo=function(a){return(a=yo(a))?so(a):null},zo=function(a){return(a=yo(a))?a.g:null},qo=/(^\w+)(?:\(([\w, ]*)\))?$/;var Ao={UC:0,BC:1},Bo={lK:0,sq:1,aG:2},Co={NE:0,TIMEOUT:1,FAILED:2},Do={mC:0,AF:1,SEEK:2,nE:3,iI:4,Cx:5},Eo=function(a){ub("MediaRouter.Cast.Session.Ended",a,Bo)},Fo=function(a){ub("MediaRouter.Cast.Controller.ActionType",a,Do)},Go=function(a){ub("MediaRouter.Cast.Session.Fail",a,Co)};var Ho=function(a,b,c){this.R=$a("mr.MediaRouteController."+a);this.l=new mojo.Binding(mojo.MediaController,this,b);this.h=c;this.g=new mojo.MediaStatus({title:"",description:"",duration:new mojo.TimeDelta({microseconds:0}),current_time:new mojo.TimeDelta({microseconds:0})});this.u=!1;this.l.setConnectionErrorHandler(this.Dn.bind(this));this.h.ptr.setConnectionErrorHandler(this.Dn.bind(this))};k=Ho.prototype;k.Dn=function(){this.dispose();this.Bn()};
k.dispose=function(){this.u||(this.u=!0,this.l&&(this.l.close(),this.l=null),this.h&&(this.h.ptr.reset(),this.h=null))};k.Bn=function(){};k.play=function(){};k.pause=function(){};k.Ik=function(){};k.Xb=function(){};k.seek=function(){};k.wr=function(a){a.close();throw Error("Not implemented");};Ho.prototype.connectHangoutsMediaRouteController=Ho.prototype.wr;Ho.prototype.seek=Ho.prototype.seek;Ho.prototype.setVolume=Ho.prototype.Xb;Ho.prototype.setMute=Ho.prototype.Ik;Ho.prototype.pause=Ho.prototype.pause;
Ho.prototype.play=Ho.prototype.play;var Io=function(a){var b=new URL(a);a={};a.scheme=b.protocol.replace(":","");a.host=b.hostname;b=b.port?Number.parseInt(b.port,10):0;switch(a.scheme){case "http":a.port=b||80;break;case "https":a.port=b||443;break;default:throw Error("Scheme must be http or https");}a.suborigin="";return new mojo.Origin(a)},Jo=function(a){return new mojo.TimeDelta({microseconds:Math.floor(1E6*a)})};var Ko=function(a,b,c,d){this.type=a;this.mediaSessionId=b;this.requestId=0;this.sessionId=c;this.currentTime=d},Mo=function(a,b,c,d,e){Ho.call(this,"CastRouteController",a,b);this.session=c;this.j=d;this.C=e;this.o=new Date;this.m=new Set;Lo(this);Fo(0)};t(Mo,Ho);
var Lo=function(a){var b=No(a);b&&Oo(a,b);b&&a.C||!a.session.statusText||(a.g.title=a.session.statusText.substring(0,256));a.g.volume=null===a.session.receiver.volume.level?0:a.session.receiver.volume.level;a.g.is_muted=!!a.session.receiver.volume.muted;a.g.can_mute=a.session.receiver.volume.controlType!==chrome.cast.Kl.FIXED;a.g.can_set_volume=a.g.can_mute;if(a.h)a.h.onMediaStatusUpdated(a.g)};k=Mo.prototype;k.Bn=function(){Po(this.j.g,this.session.sessionId)};
k.play=function(){var a=No(this);this.g.can_play_pause&&a&&this.g.play_state===mojo.MediaStatus.PlayState.PAUSED&&Qo(this.j,this.session,new Ko("PLAY",a.mediaSessionId,this.session.sessionId));Ro(this,1)};k.pause=function(){var a=No(this);this.g.can_play_pause&&a&&this.g.play_state!==mojo.MediaStatus.PlayState.PAUSED&&Qo(this.j,this.session,new Ko("PAUSE",a.mediaSessionId,this.session.sessionId));Ro(this,1)};
k.seek=function(a){var b=No(this);a=a?a.microseconds/1E6:0;var c;if(c=this.g.can_seek&&b&&0<=a)c=this.g.duration,c=a<=(c?c.microseconds/1E6:0);c&&Qo(this.j,this.session,new Ko("SEEK",b.mediaSessionId,this.session.sessionId,a));Ro(this,2)};k.Ik=function(a){this.g.can_mute&&a!==this.g.is_muted&&So(this.j,this.session,new chrome.cast.Volume(null,a));Ro(this,3)};k.Xb=function(a){this.g.can_set_volume&&0<=a&&1>=a&&So(this.j,this.session,new chrome.cast.Volume(a));Ro(this,4)};
var No=function(a){return a.session.media.find(function(b){return!b.idleReason})||null},Oo=function(a,b){a.C&&b.media&&b.media.metadata&&b.media.metadata.title&&(a.g.title=b.media.metadata.title.substring(0,256));a.g.can_play_pause=b.supportedMediaCommands.includes(chrome.cast.media.qe.PAUSE);a.g.can_seek=b.supportedMediaCommands.includes(chrome.cast.media.qe.SEEK);var c=b.playerState;a.g.play_state=c===chrome.cast.media.ff.PLAYING?mojo.MediaStatus.PlayState.PLAYING:c===chrome.cast.media.ff.PAUSED?
mojo.MediaStatus.PlayState.PAUSED:mojo.MediaStatus.PlayState.BUFFERING;a.g.current_time=b.currentTime?Jo(b.playerState===chrome.cast.media.ff.PLAYING?b.currentTime+(new Date-a.o)/1E3:b.currentTime):Jo(0);a.g.duration=b.media&&b.media.duration?Jo(b.media.duration):Jo(0)},Ro=function(a,b){0==a.m.size&&Fo(5);a.m.has(b)||(Fo(b),a.m.add(b))};Mo.prototype.setVolume=Mo.prototype.Xb;Mo.prototype.setMute=Mo.prototype.Ik;Mo.prototype.seek=Mo.prototype.seek;Mo.prototype.pause=Mo.prototype.pause;
Mo.prototype.play=Mo.prototype.play;var To=function(a){this.h=a;this.s=$a("mr.cast.SessionLauncher")},Uo=function(a,b,c){ub("MediaRouter.Cast.Session.Type",0,Ao);return Bn(a.h,b,c).then(a.g.bind(a,c),function(d){d&&Cn==d?Go(1):Go(0);throw d;})};To.prototype.g=function(a,b){gb(this.s,"Got launch result from "+a.getId());if("LAUNCH_ERROR"==b.type)throw Go(2),Error(b.reason);a=Xn(a,b.status);this.s.info("Launched session: "+a.sessionId);return a};var Vo=function(a){this.g=a;this.s=$a("mr.cast.ReceiverStatusQuerier")},Wo=function(a,b){return(new pf(x(a.h,a,b),3500,5)).start().then(null,function(c){a.s.info("Failed to get receiver status from "+b.getId());throw c;})};Vo.prototype.h=function(a){this.s.info("Query receiver status: "+a.getId());return this.g.sendRequest(new mn,a,Xl)};var Xo=function(a,b,c,d,e,f){this.j=a;this.m=b;this.C=c;this.g=d;this.o=e;this.l=f;this.h=new eo(f,c);this.G=new Vo(this.j);this.H=new To(this.j)};Xo.prototype.init=function(){this.C.init();this.h.listen("v2_message",this.D.bind(this));this.h.listen("app_message",this.u.bind(this));this.h.listen("leave_session",this.F.bind(this))};
var $o=function(a,b,c,d){Yo(a.g,b).slice().forEach(function(e){e!=d&&Zo(a,e,c)})},Zo=function(a,b,c){c.clientId=b;ko(a.h,b,c)},ap=function(a,b,c,d){c={receiver:Vn(c),action:d};Zo(a,b,new co("receiver_action",c))};
Xo.prototype.D=function(a){var b=a.message,c=b.sessionId;if(c){var d=bp(this.g,c);if(d)if(c=cp(this.g,c))if(c=this.m.h(c))switch(b.type){case "STOP":dp(this,a,c);break;case "LOAD":case "PAUSE":case "PLAY":case "SEEK":case "STOP_MEDIA":case "MEDIA_SET_VOLUME":case "MEDIA_GET_STATUS":case "EDIT_TRACKS_INFO":case "QUEUE_LOAD":case "QUEUE_INSERT":case "QUEUE_UPDATE":case "QUEUE_REMOVE":case "QUEUE_REORDER":case "PRECACHE":ep(this,a,c,d);break;case "SET_VOLUME":fp(this,a,c);break;default:gp.K("Unknown request")}else hp(this,
a,chrome.cast.wd.INVALID_PARAMETER,"No receiver");else hp(this,a,chrome.cast.wd.INVALID_PARAMETER,"No sink ID");else hp(this,a,chrome.cast.wd.INVALID_PARAMETER,"Unknown session ID")}else hp(this,a,chrome.cast.wd.INVALID_PARAMETER,"No session ID")};
var hp=function(a,b,c,d){c=new chrome.cast.Error(c,d);ip(a,b,c)},ip=function(a,b,c){ko(a.h,b.clientId,new co("error",c,b.sequenceNumber))},dp=function(a,b,c){var d=b.message;tb("MediaRouter.Cast.Session.End");var e=d.sessionId,f=jp(a.g,e);f&&(f.C=!0);f=function(){dn(a,e,b)};a.j.sendRequest(d,c,Xl,b.timeoutMillis,b.clientId).then(f,f)},ep=function(a,b,c,d){var e=b.message,f=e.type;f in ln&&(e.type=ln[f]);a.j.sendRequest(e,c,Zl,b.timeoutMillis,b.clientId,d.transportId).then(function(g){kp(a,d,g);ko(a.h,
b.clientId,new co("v2_message",g,b.sequenceNumber))},function(g){ip(a,b,g)})},fp=function(a,b,c){var d=b.message;delete d.sessionId;a.j.sendRequest(d,c,Xl,b.timeoutMillis,b.clientId).then(function(){ko(a.h,b.clientId,new co("v2_message",null,b.sequenceNumber))},function(e){ip(a,b,e)})};
Xo.prototype.u=function(a){var b=this,c=a.message,d=c.sessionId;if(d){var e=cp(this.g,d);e?(e=this.m.h(e))?(d=bp(this.g,d),Rb(d.namespaces,function(f){return f.name==c.namespaceName})?zn(this.o,e,c.namespaceName,c.message,a.clientId,d.transportId).then(function(){ko(b.h,a.clientId,new co("app_message",null,a.sequenceNumber))},function(){hp(b,a,chrome.cast.wd.CHANNEL_ERROR,"Channel to receiver not available")}):hp(this,a,chrome.cast.wd.INVALID_PARAMETER,"Invalid namespace")):gp.K("No receiver from sinkId"):
gp.K("No sinkId from sessionId")}else gp.K("No sessionId")};
Xo.prototype.F=function(a){var b=this;gp.info("Leave session");var c=jp(this.g,a.message);if(c){var d=a.clientId,e=fo(this.C,d);if(e){var f=[],g=[],h=e.tabId,m=e.origin,q=e.autoJoinPolicy;c.h.forEach(function(r){var u=fo(b.C,r);q==chrome.cast.sd.TAB_AND_ORIGIN_SCOPED&&h==u.tabId&&m==u.origin||q==chrome.cast.sd.ORIGIN_SCOPED&&m==u.origin?(u.h=!0,f.push(r)):g.push(r)});ko(this.h,d,new co("leave_session",null,a.sequenceNumber));f.forEach(function(r){(r=fo(b.C,r))&&lp(b.l,r.routeId,!0,!0)});c.h=g}else gp.K("No client record")}else gp.K("No session")};
var mp=function(a,b,c){ao(b)&&a.j.sendRequest(new mn,c,Zl,void 0,void 0,b.transportId).catch(Ia)},Xm=function(a,b,c){var d=b.getId();gp.info("Query status for "+d);Wo(a.G,b).then(function(e){np(a,d,e);c&&(e=op(a.g,d))&&mp(a,e,b)},Ia)},pp=function(a,b){if("*"==b.destinationId)return!0;b=b.destinationId;if(b==a.o.o||null!=fo(a.C,b))return!0;gp.info("Invalid destination "+b);return!1},vp=function(a,b,c){gb(gp,function(){return"Cast message: "+JSON.stringify(c)});if(pp(a,c))if(c.namespace_==Yl||c.namespace_==
$l)(b=cn(a.g,b))&&b.g.forEach(function(f){var g=a.l,h=g.h.get(f);h&&h.mf&&qp(g.j.M,new rp(f,c))});else{var d=JSON.parse(c.data),e=sp(a,d);e=e?e.sourceId:void 0;switch(d.type){case "RECEIVER_STATUS":np(a,b,d);break;case "MEDIA_STATUS":tp(a,b,c,e)}}else up(a.o,b,c.destinationId,c.sourceId,!1)},sp=function(a,b){a=qn(a.j.g,b.requestId);if(!a)return null;var c=a.Bb;switch(b.type){case "LAUNCH_ERROR":case "INVALID_REQUEST":case "LOAD_CANCELLED":case "LOAD_FAILED":case "INVALID_PLAYER_STATE":delete b.requestId;
c.reject(new chrome.cast.Error(chrome.cast.wd.SESSION_ERROR,b.reason||b.type,b));break;default:c.resolve(b)}return a},wp=function(a,b,c){gb(gp,function(){return"App message: "+JSON.stringify(c)});if(b=op(a.g,b)){var d;"*"==c.destinationId?d=Yo(a.g,b.sessionId):d=[c.destinationId];var e=new Tn(b.sessionId,c.namespace_,c.data);d.forEach(function(f){ko(a.h,f,new co("app_message",e))})}else gp.K("No session for incoming app message")},xp=function(a,b){a.forEach(function(c){c.sessionId=b;var d=c.supportedMediaCommands,
e=[];d&1&&e.push(chrome.cast.media.qe.PAUSE);d&2&&e.push(chrome.cast.media.qe.SEEK);d&4&&e.push(chrome.cast.media.qe.STREAM_VOLUME);d&8&&e.push(chrome.cast.media.qe.STREAM_MUTE);c.supportedMediaCommands=e});return a},kp=function(a,b,c){b=b.sessionId;c.sessionId=b;c=xp(c.status,b);yp(a.g,b,c);if((a=jp(a.g,b))&&a.controller&&(a=a.controller,a.o=new Date,(c=No(a))?Oo(a,c):(a.C&&(a.g.title=""),a.g.can_play_pause=!1,a.g.can_seek=!1),a.h))a.h.onMediaStatusUpdated(a.g)},zp=function(a,b){if(b=op(a.g,b)){b=
b.sessionId;var c=jp(a.g,b);c&&c.C||dn(a,b)}},dn=function(a,b,c){c&&Zo(a,c.clientId,c);(c=jp(a.g,b))&&c.g.slice().forEach(function(d){lp(a.l,d,!0)});Ap(a.g,b);Bp(a.l)},np=function(a,b,c){gb(gp,"Receiver status for "+b);var d=c.status;if(d)if(c=a.m.h(b)){d=Xn(c,d);var e=cn(a.g,b);e?d?d.sessionId==e.session.sessionId?(b=e.session,Zn(b,d)&&(gb(gp,"Updating session "+d.sessionId),e.j&&(b.statusText=d.statusText),b.namespaces=d.namespaces,b.receiver.volume=d.receiver.volume,Cp(a.l,e),$o(a,b.sessionId,
new co("update_session",b)),e.controller&&Lo(e.controller))):(zp(a,b),Eo(1),Dp(a.l,null,c,null,d)):(zp(a,b),Eo(1)):d&&Dp(a.l,null,c,null,d)}else tb("MediaRouter.Cast.Error.Sink.Missing.From.Discovery.Service"),gp.K("Got message from receiver "+b+", but sink is no longer available.")},tp=function(a,b,c,d){if(b=op(a.g,b))if(c=JSON.parse(c.data))kp(a,b,c),$o(a,c.sessionId,new co("v2_message",c),d)},Ep=function(a,b){var c=Yn(b.g);return(b=Rb(a.C,function(d){return Pb(d.capabilities,function(e){return Tb(c,
e)})}))?b.appId:so(a)[0]},Fp=function(a,b,c){var d=yo(b);if(!d)return Promise.reject(Error("Invalid source "+b));var e=Ep(d,c);b=null==d.l?chrome.cast.timeout.requestSession:d.l;var f=new kb("MediaRouter.Cast.Session.Launch");return Uo(a.H,new chrome.cast.Fl(e,void 0,b),c).then(function(g){gp.info("Launched session "+g.sessionId+" for appId "+e);f.end("Success");return g},function(g){gp.error("Failed to session for appId "+e);f.end("Failure");throw g;})};
Xo.prototype.createMediaRouteController=function(a,b,c){a=Gp(this.g,a);if(!a)return Error("Session not found for the route");var d=a.session;if(a.controller)return Error("Controller already exists for the route");var e=Hp(this,d.sessionId);if(!e)return Error("Sink not found for the route");a.controller=new Mo(b,c,d,this,a.j);mp(this,d,e);return null};
var Qo=function(a,b,c){var d=Hp(a,b.sessionId);d&&a.j.sendRequest(c,d,Zl,0,"",b.transportId).catch(function(e){gp.K("Failed to send a media control request: "+e)})},So=function(a,b,c){c=new Un(c);(b=Hp(a,b.sessionId))&&a.j.sendRequest(c,b,Xl).catch(function(d){gp.K("Failed to send a volume control request: "+d)})},Hp=function(a,b){return(b=cp(a.g,b))?a.m.h(b):null},gp=$a("mr.cast.ApiHandler");var Ip=function(a){return"0F5096E8"==a||"85CDB22F"==a};var Jp=function(a,b,c,d,e){for(var f=[],g=4;g<arguments.length;++g)f[g-4]=arguments[g];var h=this;this.C=a;this.o=b;this.m=c;this.h=d;this.l=f;this.g=!1;this.j=function(m){for(var q=[],r=0;r<arguments.length;++r)q[r-0]=arguments[r];return h.Ar.apply(h,p(q))}};k=Jp.prototype;k.addListener=function(){this.g||(this.g=!0,this.h.addListener.apply(this.h,[this.j].concat(p(this.l))))};k.removeListener=function(){this.g&&(this.h.removeListener(this.j),this.g=!1)};
k.oi=function(a){for(var b=0;b<arguments.length;++b);return!0};k.Ar=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];var d=this;pj(this.C);if(!this.oi.apply(this,p(b)))return!1;gj(this.m).then(function(e){return e.handleEvent.apply(e,[d.h].concat(p(b)))});return this.Pi()};k.Ua=function(){return"mr.EventListener."+this.o};k.Ib=function(){return[this.g]};k.Hb=function(){hm(this)&&this.addListener()};k.Pi=function(){};var Kp=null,Lp=null,Mp=function(){Kp||(Kp=new Jp(2,"CastChannelMessageListener","mr.cast.ChannelService",chrome.cast.channel.onMessage));Lp||(Lp=new Jp(1,"CastChannelErrorListener","mr.cast.ChannelService",chrome.cast.channel.onError));return[Kp,Lp]};var Np=function(){},Op=function(a){if(!a.startsWith("urn:x-org.chromium:media:route:"))return null;var b=a.substring(31);if(!b)return null;var c=b.match(/([^/]*)\/([^-/]*)-([^/]*)\/(.*)/);if(!c)return null;b=new Np;b.h=a;a=n(c);a.next();b.g=a.next().value;b.l=a.next().value;b.C=a.next().value;b.j=a.next().value;return b};var Pp=function(a,b,c,d,e){this.id=a;this.presentationId=b;this.sinkId=c;this.mediaSource=d;this.isLocal=e;this.description="";this.iconUrl=null;this.allowStop=!0;this.customControllerPath=null;this.supportsMediaRouteController=!1;this.controllerType=mojo&&mojo.RouteControllerType&&mojo.RouteControllerType.kNone;this.forDisplay=!0;this.offTheRecord=!1;this.mf=e;this.isOffscreenPresentation=!1},Qp=function(a,b,c,d,e){b=d&&qj(d)?a:"urn:x-org.chromium:media:route:"+a+"/"+b+"-"+c+"/"+d;return new Pp(b,
a,c,d,e)};var Rp=function(a,b,c,d){c=Qp(c,"cast",b.getId(),a,d);c.supportsMediaRouteController=!0;mojo&&mojo.RouteControllerType&&(c.controllerType=d&&sj(a)&&b.g&1&&mojo.RouteControllerType.kMirroring?mojo.RouteControllerType.kMirroring:mojo.RouteControllerType.kGeneric);return c},Sp=function(a,b){var c=b.sb.tc;c&&(b.description=Ej(c),a.displayName="",a.statusText="mirror_desktop"==c.h?"":c.j||"")};var Tp=function(a,b,c,d){return{namespace_:a,data:"string"===typeof b?b:JSON.stringify(b),sourceId:c,destinationId:d}};var Up=function(a){this.type="CLOSE";this.reasonCode=a};var Vp=function(a){return(a=a.exec(Zd))?a[1]:""},Wp=function(){if(hf)return Vp(/Firefox\/([0-9.]+)/);if(Ke||Le||Je)return cf;if(mf)return Ce()?Vp(/CriOS\/([0-9.]+)/):Vp(/Chrome\/([0-9.]+)/);if(nf&&!Ce())return Vp(/Version\/([0-9.]+)/);if(jf||kf){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(Zd);if(a)return a[1]+"."+a[2]}else if(lf)return(a=Vp(/Android\s+([0-9.]+)/))?a:Vp(/Version\/([0-9.]+)/);return""}(),Xp=function(a){return 0<=yd(Wp,a)};var Zp=function(a){this.type="CONNECT";this.origin={};this.userAgent=Zd;var b=this.userAgent.indexOf("(")+1;b=this.userAgent.substr(b,this.userAgent.indexOf(")",b)-1-b+1);this.senderInfo={sdkType:2,version:chrome.runtime.getManifest().version,browserVersion:Wp,platform:Yp(),systemVersion:b,connectionType:1};this.connType=a?0:2},Yp=function(){switch(Pi()){case "ChromeOS":return 5;case "Windows":return 3;case "Mac":return 4;case "Linux":return 6}return 0};var $p=function(a){if(!chrome.runtime.lastError)return null;var b="chrome.cast.channel.send failed, chrome.runtime.lastError: "+(chrome.runtime.lastError.message||"Unknown error");a&&gb(a,b);return Error(b)};var aq=function(){this.g=new Om};aq.prototype.init=function(){km(this)};var bq=function(a,b,c,d,e){if(!Rm(a.g,[b.channelId,c,d].join("#"))){var f=Tp(Wl,new Zp(e),c,d);chrome.cast.channel.send(b,f,a.h.bind(a));a.g.set([b.channelId,c,d].join("#"),e)}};aq.prototype.h=function(){$p(cq)};
var $m=function(a,b){a.g.Pb().forEach(function(c){c.split("#")[0]==b.channelId.toString()&&a.g.remove(c)})},Wm=function(a,b,c){a.g.forEach(function(d,e){var f=e.split("#");f[0]==b.channelId.toString()&&(bq(a,c,f[1],f[2],d),a.g.remove(e))})};aq.prototype.Ua=function(){return"cast.VirtualConnectionManager"};aq.prototype.Ib=function(){var a=Tm(this.g);return[new dq(a)]};aq.prototype.Hb=function(){var a=hm(this);if(a)for(var b in a.g)this.g.set(b,a.g[b])};Ja(aq);
var cq=$a("mr.cast.VirtualConnectionManager"),dq=function(a){this.g=a};var eq=function(a,b){this.C=b;this.o=a;this.h=new Om;this.g=new Om;this.j=aq.Ob();this.m=null;this.l=new Om};t(eq,cj);eq.prototype.handleEvent=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];a==chrome.cast.channel.onMessage?this.F.apply(this,p(c)):a==chrome.cast.channel.onError&&this.u.apply(this,p(c))};eq.prototype.init=function(){this.j.init();km(this);mj("mr.cast.ChannelService",this);Mp().forEach(function(a){return a.addListener()})};
var zn=function(a,b,c,d,e,f){e=e||a.o;f=f||"receiver-0";var g=gn(a,b);return g?fq(a,g,c,d,e,f):Promise.reject("Channel not found for "+b.getId())},up=function(a,b,c,d,e){if(b=a.h.get(b))a=a.j,Rm(a.g,[b.channelId,c,d].join("#"))&&(a.g.remove([b.channelId,c,d].join("#")),c=Tp(Wl,new Up(e?5:0),c,d),chrome.cast.channel.send(b,c,a.h.bind(a)))};
eq.prototype.F=function(a,b){var c=this.g.get(a.channelId);if(c){var d=this.m(c);if(d){if(bm.hasOwnProperty(b.namespace_)){var e=JSON.parse(b.data);switch(e.type){case "CLOSE":this.j.g.remove([a.channelId,b.destinationId,b.sourceId].join("#"));return;case "RPC":break;default:gb(Vm,function(){return"Got message "+(e.type||e.responseType)+" from "+d.getId()})}}else gb(Vm,"Got message in "+b.namespace_+" from "+d.getId());gq(this.C,d,b)}else Vm.K("Got message for unknown receiver (receiverId="+c+").")}else Vm.K("Got message for unknown channel (channelId="+
a.channelId+").")};var hq=function(a,b){var c=a.g.get(b.channelId);c&&(a.g.remove(b.channelId),a.h.remove(c))};eq.prototype.u=function(a,b){Vm.K(function(){return"Channel error: "+JSON.stringify(a)+(b?", "+JSON.stringify(b):"")});hq(this,a)};
var gn=function(a,b){b=b.getId();(a=a.h.get(b))||Vm.info("Channel not found for receiver: "+b);return a},fq=function(a,b,c,d,e,f){bq(a.j,b,e,f,0==f.indexOf("receiver-0"));$n(d);var g=Tp(c,d,e,f);"object"===typeof d&&"RPC"==d.type||gb(Vm,function(){return"Channel is sending message: "+JSON.stringify(g)});return new Promise(function(h,m){chrome.cast.channel.send(b,g,function(q){q?q.errorState?(m(Error("Failed to send message")),hq(a,q)):h(!0):(q=$p(Vm||void 0),m(q))})})};eq.prototype.Ua=function(){return"cast.ChannelService"};
eq.prototype.Ib=function(){return[new iq(Tm(this.h),Tm(this.g),Tm(this.l))]};eq.prototype.Hb=function(){var a=hm(this);a&&(Nm(this.h,a.h),Nm(this.g,a.g),Nm(this.l,a.j))};var Vm=$a("mr.cast.ChannelService"),iq=function(a,b,c){this.h=a;this.g=b;this.j=c};var jq=function(a,b,c,d,e,f){this.routeId=a;this.clientId=b;this.appIds=c;this.autoJoinPolicy=d;this.origin=e;this.tabId=f;this.h=this.g=!1},kq=function(){this.g=[]};kq.prototype.init=function(){km(this)};kq.prototype.ya=function(){return this.g.length};var fo=function(a,b){return Rb(a.g,function(c){return c.clientId==b})},lq=function(a,b){return Rb(a.g,function(c){return c.routeId==b})},mq=function(a,b){a.g=Lb(a.g,function(c){return c.clientId!=b})};kq.prototype.Ua=function(){return"cast.ClientRecords"};
kq.prototype.Ib=function(){return[new nq(this.g)]};kq.prototype.Hb=function(){var a=hm(this);a&&(this.g=a.g)};var nq=function(a){this.g=a};var oq=function(){this.requestId=0;this.type="GET_APP_AVAILABILITY";this.appId=[]};var pq=function(a,b){this.l=a;this.h=b;this.j=new Kn;this.g=new Om};pq.prototype.init=function(){km(this)};var qq=function(a,b){var c=a.g.get(b);c&&(c.uk--,0<c.uk||(Km(a.h.g.Tb(!1),function(d){switch(Gm(d,b)){case "available":d.j[b]="available_rescan";break;case "unavailable":d.j[b]="unavailable_rescan"}}),a.g.remove(b)))};k=pq.prototype;
k.no=function(a){var b=this;Km(this.g.Tb(!0),function(c){a:{switch(Gm(a,c)){case "unknown":case "available_rescan":case "unavailable_rescan":var d=!0;break a}d=!1}if(d){var e=a.getId()+":"+c;b.j.contains(e)||(b.j.add(e),d=function(){b.j.remove(e)},(new pf(b.sr.bind(b,a,c),5500,3)).start().then(b.ep.bind(b,a,c),function(){b.s.error("Failed to get app availability response for "+a.getId()+", appId "+c+" after 3 attempts.");b.ep(a,c,"unknown")}).then(d,d))}})};
k.ep=function(a,b,c){c!=Gm(a,b)&&(this.s.info(b+" on "+a.getId()+" is "+c),a.j[b]=c,Ym(this.h.l,a))};
k.sr=function(a,b){var c=this,d=new oq;d.appId=[b];var e=new kb("MediaRouter.Cast.App.Availability");return this.l.sendRequest(d,a,Xl,5E3).then(function(f){e.end("Success");gb(c.s,function(){return"App availability response "+JSON.stringify(f)});for(var g in f.availability){if("APP_AVAILABLE"==f.availability[g])return"available";if("APP_UNAVAILABLE"==f.availability[g])return"unavailable"}return"unknown"},function(f){e.end("Failure");c.s.error("checkAppAvailability_ failed for "+a.getId()+", appId "+
b);throw f;})};k.Ua=function(){return"cast.AppDiscoveryService"};k.Ib=function(){return[new rq(Tm(this.g))]};k.Hb=function(){var a=hm(this);a&&Nm(this.g,a.g)};k.s=$a("mr.cast.AppDiscoveryService");var rq=function(a){this.g=a};var sq=chrome.i18n.getMessage("4528089202128275824");chrome.i18n.getMessage("2810417817914017289");chrome.i18n.getMessage("3413021810593924462");chrome.i18n.getMessage("7603034707785674700");chrome.i18n.getMessage("8009014317872238527");chrome.i18n.getMessage("8636962961150071298");chrome.i18n.getMessage("1802762746589457177");var tq=function(a,b){this.h=[];this.g=[];this.sinkId=a;this.session=b;this.m=this.l=null;this.offTheRecord=this.C=!1;this.controller=null;this.j=!0},uq=function(){this.s=$a("mr.cast.SessionRecords");this.g=[]};uq.prototype.init=function(){km(this)};
var Ap=function(a,b){a.s.info("Removing session "+b);Po(a,b);a.g=Lb(a.g,function(c){return c.session.sessionId!=b})},Yo=function(a,b){return(a=jp(a,b))?a.h:[]},op=function(a,b){return(a=cn(a,b))?a.session:null},vq=function(a,b){return Rb(a.g,function(c){return Tb(c.h,b)})},Gp=function(a,b){return Rb(a.g,function(c){return Tb(c.g,b)})},wq=function(a,b){return Rb(a.g,function(c){return null!=Rb(c.g,function(d){return Op(d).g==b})})},cn=function(a,b){return Rb(a.g,function(c){return c.sinkId==b||c.l==
b})},jp=function(a,b){return Rb(a.g,function(c){return c.session.sessionId==b})},cp=function(a,b){return(a=jp(a,b))?a.sinkId:null},bp=function(a,b){return(a=jp(a,b))?a.session:null},yp=function(a,b,c){var d=bp(a,b);d&&(a=Lb(c,function(e){return e.playerState!=chrome.cast.media.ff.IDLE}),a.forEach(function(e){if(!e.media){var f=Rb(d.media,function(g){return g.mediaSessionId==e.mediaSessionId});f&&(e.media=f.media)}}),d.media=a)};uq.prototype.Ua=function(){return"cast.SessionRecords"};
uq.prototype.Ib=function(){return[new xq(this.g)]};uq.prototype.Hb=function(){var a=hm(this);if(a)for(var b=0;b<a.g.length;b++){var c=a.g[b],d=new tq(c.sinkId,c.session);d.h=c.h;d.g=c.g;d.C=c.C;d.m=c.m;d.l=c.l;d.j=c.j;this.g.push(d)}};
var Po=function(a,b){(a=jp(a,b))&&a.controller&&(a.controller.dispose(),a.controller=null)},xq=function(a){var b=[];a=n(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=new tq(c.sinkId,c.session);d.h=c.h;d.g=c.g;d.C=c.C;d.m=c.m;d.l=c.l;d.offTheRecord=c.offTheRecord;d.j=c.j;b.push(d)}this.g=b};var yq=function(a,b,c){var d=Error.call(this);this.message=d.message;"stack"in d&&(this.stack=d.stack);this.name="RouteRequestError";this.message=b||"";if(c)this.stack=c;else if(Error.captureStackTrace)Error.captureStackTrace(this,yq);else if(b=Error().stack)this.stack=b;this.errorCode=a};t(yq,Error);var zq=function(a,b){this.sinks=a;this.origins=b||null},Aq=new zq([]);var Bq=function(a){this.D="sender-"+ze();this.h=new Om;this.u=null;km(this);this.j=a;this.o=new kq;this.l=new uq;this.F=new eq(this.D,this);this.g=new Um(this.F,this);this.G=new wn(this.F,this.D);this.m=null;this.C=new Xo(this.G,this.g,this.o,this.l,this.F,this);this.H=new On(this.g,this.G)};k=Bq.prototype;k.getName=function(){return"cast"};
k.tn=function(a){a=a&&"boolean"===typeof a.enable_cast_sink_query?a.enable_cast_sink_query:!0;this.s.info("Query enabled: "+a);this.G.init();this.l.init();this.C.init();this.F.init();this.g.init();a&&(this.m=new pq(this.G,this.g),this.m.init())};k.Jh=function(){return this.h.Ma()};
k.vm=function(a){var b=this;if(null!=Cq(a))return new zq([]);var c=new Kn;Dq(a).forEach(function(d){jn(b.g,d).map(function(e){return e.h}).forEach(function(e){c.add(e)})});return new zq(c.Ma(),-1!=a.indexOf("0F5096E8")?rj:null)};
k.startObservingMediaSinks=function(a){var b=this,c=Cq(a);c?(this.s.info("Received broadcast request "+a),Km(this.g.g.Tb(!1),function(d){b.G.sendMessage(c,d,am).catch(function(e){b.s.error("Broadcast failed "+e.message)})})):this.m&&Dq(a).forEach(function(d){var e=b.m,f=e.g.get(d);f?f.uk++:e.g.set(d,{uk:1});e.s.info("Scanning sinks for app availability");Km(e.h.g.Tb(!1),e.no,e)})};k.stopObservingMediaSinks=function(a){var b=this;null!=Cq(a)||this.m&&Dq(a).forEach(function(c){qq(b.m,c)})};
k.startObservingMediaRoutes=function(){};k.stopObservingMediaRoutes=function(){};k.sn=function(a){return(a=this.g.h(a))?a.h:null};
var Eq=function(a,b,c){a.s.error("Error launching.",c);lp(a,b.id,!1,!0,"error");c=new Ai(sq,"warning");Di(c,b.id);Ei(c,b.sinkId);a.j.g.onIssue(c)},Jq=function(a,b,c,d,e,f,g,h){Cm().h=new zm(c.l,c.Kc());var m=Rp(b,c,d,!0);m.forDisplay=!1;m.offTheRecord=e;a.h.set(m.id,m);Fq(a.j,a,m);Bp(a);(e=yo(b))&&e.g&&Gq(a,e,m.id,g,h);return new Promise(function(q,r){sj(b)||tj(b)||qj(b)?(m.sb={tabId:h,sessionId:"",Yg:c.Kc()||"",ge:c.l||"",Cw:c.h.friendlyName||""},qj(b)&&(m.isOffscreenPresentation=!0),Hq(a.j,a,m,
d,function(u){return Ki(Iq(a,b,c,d,f,g,h,u))}).g.then(function(){var u=Gp(a.l,m.id);u.j=!1;Sp(u.session,m);u.controller&&(u.controller.C=!1,Lo(u.controller));q(m)},function(u){Eq(a,m,u);r(u)})):Iq(a,b,c,d,f,g,h,m).then(function(){q(m)},function(u){Eq(a,m,u);r(u)})})},Iq=function(a,b,c,d,e,f,g,h){return Fp(a.C,Kq(b,c,e),c).then(function(m){Dp(a,b,c,d,m,f,g,h);return h})};
Bq.prototype.createRoute=function(a,b,c,d,e,f,g){var h=this,m=this.g.h(b);if(!m)return Ji(Error("No sink with ID "+b));var q=zo(a);if(q){setTimeout(function(){ap(h.C,q,m,chrome.cast.xi.CAST)},0);var r=function(){return Jq(h,a,m,c,d,e,f,g)},u=fo(this.o,q);if(u)return Ki(this.terminateRoute(u.routeId).then(r,r));if(f&&g&&(b=Lq(this,a,f,g,d,e,b)))return b}return Ki(Jq(this,a,m,c,d,e,f,g))};
var lp=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?"closed":e;a.s.info("Remove route "+b);var f=lq(a.o,b);if(f){c=c||f.h;var g=f.clientId;a.s.info("Remove client "+g);for(var h=a.l,m=0;m<h.g.length;m++)Zb(h.g[m].h,g);mq(a.o,g)}if(g=Gp(a.l,b))Zb(g.g,b),Mq(a,g.g);if(h=a.h.get(b))if(h.mf&&g&&(up(a.F,h.sinkId,f?f.clientId:a.D,g.session.transportId,c),h.forDisplay&&f&&(a.u={kf:f,vo:g})),a.h.remove(b),Nq(a.j,h),Bp(a),d)a.j.onPresentationConnectionClosed(b,e,"Remove route");else a.j.onPresentationConnectionStateChanged(b,
"terminated")},Cp=function(a,b){b.g.forEach(function(c){if(c=a.h.get(c)){var d=b.session;if(c.forDisplay){var e=Ip(d.appId);e&&!c.isLocal?(c.description=d.statusText||"",d.displayName="",d.statusText=""):e||(c.description=d.statusText||d.displayName);b.controller&&Lo(b.controller)}Oq(a.j)}})},Pq=function(a,b){Ob(b,function(c){c=a.h.get(c,null);if(!c||!c.mediaSource)return!1;var d=yo(c.mediaSource);d=d?d.u:!1;return c.isLocal&&!d})&&Hb(b,function(c){if(c=a.h.get(c,null))c.isLocal=!0})},Mq=function(a,
b){var c=[],d=[],e=null;b.forEach(function(f){if(f=a.h.get(f)){f.forDisplay=!1;var g=yo(f.mediaSource);g&&Rb(so(g),bo)||(f.mf?(g=g?uo(g):null,e||g==chrome.cast.sd.CUSTOM_CONTROLLER_SCOPED||(c.push(f),e=f.sinkId)):e&&e!=f.sinkId?c.push(f):d.push(f))}});Hb(0<c.length?c:d,function(f){f.forDisplay=!0})},Gq=function(a,b,c,d,e){var f=b.g;if(f&&!fo(a.o,f)){a.s.info("Add client "+f);var g=so(b);a.o.g.push(new jq(c,f,g,uo(b),d||null,void 0!==e?e:null))}},Dp=function(a,b,c,d,e,f,g,h){var m=cn(a.l,c.getId());
if(!m){var q=a.l;m=c.getId();q.s.info("Adding new session: "+m+", "+e.sessionId);var r=jp(q,e.sessionId);r?(Wn(e)?(r.m=e,r.l=m):Wn(r.session)&&(r.m=r.session,r.l=r.sinkId,r.session=e,r.sinkId=m),m=r):(m=new tq(m,e),q.g.push(m))}h&&h.isLocal&&h.sb&&(m.j=!1);var u=null!=b;if(!u&&bo(e.appId))return null;null==b?(r=new oo([{appId:e.appId,capabilities:e.capabilities}]),b=vo(r)[0]):r=yo(b);if(q=h){if(!a.h.get(q.id))return a.s.K("Route "+q.id+" not added"),q}else q=Rp(b,c,d||e.sessionId,u),a.h.set(q.id,
q);d=q.id;a.s.info("Add route "+d);b=null;r&&(b=r.g,Gq(a,r,d,f,g));Tb(m.g,d)||m.g.push(d);q.mf&&(f=a.F,g=b||a.D,d=e.transportId,r=!(r&&r.u),(u=gn(f,c))&&bq(f.j,u,g,d,r));m.offTheRecord=q.offTheRecord;f=m.g;Pq(a,f);Mq(a,f);f=q;g=e.sessionId;Ip(e.appId)?f.isLocal&&g&&f.sb?f.sb.sessionId=g:(f.description=e.statusText||"",e.displayName="",e.statusText=""):f.description=e.statusText||e.displayName;h?Oq(a.j):Fq(a.j,a,q);Bp(a);if(h=b)Tb(m.h,b)?h=!1:(m.h.push(b),h=!0);h&&(a=a.C,ko(a.h,b,new co("new_session",
e)),mp(a,e,c));return q};
Bq.prototype.terminateRoute=function(a){var b=this,c=this.h.get(a);if(!c)return Promise.reject(new yq(3,"Route in Cast provider not found for routeId  "+a));var d=Gp(this.l,a);if(!d)return lp(this,a,!0),Promise.resolve();var e=d.session.sessionId,f=this.g.h(c.sinkId);if(!f)return dn(this.C,e),Promise.resolve();(a=lq(this.o,a))&&ap(this.C,a.clientId,f,chrome.cast.xi.STOP);Eo(0);return new Promise(function(g){var h=function(){zp(b.C,f.getId());g()};b.G.sendRequest(new tn(e),f,Xl).then(h,h)})};
var Qq=function(a,b){var c=null;Lm(a.h.Tb(!1),function(f){if(!f.mf)return!1;var g=a.g.h(f.sinkId);if(!g||!xo(b,Kq(f.mediaSource,g)))return!1;c=f;return!0});if(!c||!c.mediaSource)return null;var d=zo(c.mediaSource);if(!d)return null;var e=fo(a.o,d);return e?(d=vq(a.l,d))?{kf:e,vo:d}:null:null},Lq=function(a,b,c,d,e,f,g){var h=null;Lm(a.h.Tb(!1),function(q){var r=q.sb;return r&&null!=r.tabId&&r.tabId==d&&sj(q.mediaSource)?(h=q,!0):!1});if(!h)return null;var m=function(){return a.createRoute(b,g||h.sinkId,
"",e,f,c,null==d?void 0:d)};return Ki(a.terminateRoute(h.id).then(m,m))};k=Bq.prototype;k.connectRouteByRouteId=function(a,b,c,d,e){if(!yo(a))return Ji(Error("Unsupported presentation URL"));if(!b)return Ji(Error("No routeId"));b=Op(b);b=jp(this.l,b.g);if(!b)return Ji(Error("No matching route"));var f=this.g.h(b.sinkId);return f?(a=Dp(this,a,f,c,b.session,d,e))?Ii(a):Ji(Error("Failed to create route")):Ji(Error("No sink"))};
k.joinRoute=function(a,b,c,d,e,f){var g=yo(a);if(!g)return Ji(Error("Unsupported presentation URL"));if(b==chrome.cast.el){a:{var h=Qq(this,g);if(!h){if(!this.u||this.u.kf.origin!=e||this.u.kf.tabId!=f){h=null;break a}h=this.u}switch(uo(g)){case chrome.cast.sd.PAGE_SCOPED:h=null;break a;case chrome.cast.sd.ORIGIN_SCOPED:if(e!=h.kf.origin){h=null;break a}break;case chrome.cast.sd.TAB_AND_ORIGIN_SCOPED:if(e!=h.kf.origin||f!=h.kf.tabId){h=null;break a}}h=jp(this.l,h.vo.session.sessionId)}if(!h&&(g.j?
g.j:chrome.cast.hh.CREATE_SESSION)!=chrome.cast.hh.CAST_THIS_TAB&&(d=Lq(this,a,e,f,c,d)))return d}else h=Rq(this,b);if(!h)return Ji(Error("No matching route"));if(h.offTheRecord!=c)return Ji(Error("Off the record mismatch"));d=this.g.h(h.sinkId);if(!d)return Ji(Error("No sink"));a=Dp(this,a,d,b,h.session,e,f);a.offTheRecord=c;return Ii(a)};k.detachRoute=function(a){lp(this,a,!1,!0)};
k.ej=function(a){var b=this.g.h(a);if(!b)throw Error("Cannot mirror with no sink.");var c=new Lj;b=b.g;b&1||(c.shouldCaptureVideo=!1);b&4||(c.shouldCaptureAudio=!1);c.shouldCaptureAudio&&!c.shouldCaptureVideo&&(c.minLatencyMillis=c.maxLatencyMillis,c.animatedLatencyMillis=c.maxLatencyMillis);c.senderSideLetterboxing=!0;Mj(c);Object.freeze(c);this.s.info(function(){return"Settings for "+a+": "+Kj(c)});if(!c.shouldCaptureAudio&&!c.shouldCaptureVideo)throw Error("Cannot start mirroring without video or audio capture");
return c};k.dj=function(){return"cast_streaming"};k.Cn=function(a){var b=this.h.get(a);b&&b.sb&&b.sb.tc&&(a=Gp(this.l,a))&&(Sp(a.session,b),a.controller&&Lo(a.controller))};
k.sendRouteMessage=function(a,b,c){var d=this;if(!c)return new Promise(function(h,m){"string"!==typeof b&&m(Error("Cannot send non-string messages via ApiHandler."));m=d.C.h;gb(ho,"Received: "+b);var q=JSON.parse(b),r=q.clientId;"client_connect"==q.type?(gb(ho,"App "+r),(q=fo(m.g,r))?(q.g=!0,(m=qn(m.h,q.routeId))&&m.Bb.resolve(!0)):ho.K("Client not found "+r)):go(m,r)?(m=m.j[q.type])&&m(q):ho.K("No route for "+r);h()});var e=Gp(this.l,a);if(!e)return Promise.reject(Error("Not managing the route "+
a));var f=this.g.h(e.sinkId);if(!f)return Promise.reject(Error("Sink no longer accessible"));var g=(a=lq(this.o,a))?a.clientId:this.D;return new Promise(function(h){zn(d.F,f,c.namespace,b,g,e.session.transportId).then(h,h)})};k.sendRouteBinaryMessage=function(a){return Promise.reject(Error("Route "+a+" does not support sending binary data."))};k.am=function(a,b){var c=this.g.h(b);if(!c)return!1;if(!this.m)return!0;a=Kq(a,c);return(a=wo(a))&&0!=a.length?Ob(a,function(d){return cm(Gm(c,d))}):!1};
k.Li=function(a,b,c){var d=Dq(a);return d&&0!=d.length?b==chrome.cast.el?!0:c&&c.mediaSource?(a=wo(c.mediaSource),Ob(a,function(e){return Tb(d,e)})):void 0==b||Rq(this,b)?!0:!1:!1};
var Kq=function(a,b,c){return yo(a)?a:sj(a)||tj(a)||qj(a)?(a={appId:0==(b.g&1)?"85CDB22F":"0F5096E8",capabilities:Yn(b.g)},vo(new oo([a],void 0,void 0,void 0,c))[0]):a},Dq=function(a){var b=[],c=yo(a);if(c)b=so(c);else if(sj(a)||tj(a)||qj(a))tj(a)||b.push("85CDB22F"),b.push("0F5096E8");return b},Cq=function(a){var b=yo(a);if(!b)return null;a=Dq(a);var c=b.o||"";b=b.m;return c&&b?new rn(a,c,JSON.stringify(b)):null},Rq=function(a,b){return 0==b.indexOf(chrome.cast.zl)?jp(a.l,b.substr(chrome.cast.zl.length)):
wq(a.l,b)},gq=function(a,b,c){var d=a.H;if(Pn(d)&&bm.hasOwnProperty(c.namespace_)){var e=b.Kc();if(e){var f=JSON.parse(c.data);if("RECEIVER_STATUS"===f.type){var g=f.status&&f.status.applications&&f.status.applications[0],h=f=null;g&&(g.appId&&(f=g.appId),g.sessionId&&(h=g.sessionId));g=d.h.get(e);d.h.set(e,new Tl(e,f,h));g&&g.appId===f||Qn(d)}}}a=a.C;b=b.getId();bm.hasOwnProperty(c.namespace_)?vp(a,b,c):wp(a,b,c)},Ym=function(a,b){a.m&&a.m.no(b);en(a.H);fn(a.j)};k=Bq.prototype;k.Ua=function(){return"cast.Provider"};
k.Ib=function(){return[new Sq(this.D,Tm(this.h),this.u)]};k.Hb=function(){var a=hm(this);a&&(this.D=a.senderId,Nm(this.h,a.h),this.u=a.g)};k.searchSinks=function(){return Xa()};k.createMediaRouteController=function(a,b,c){return(a=this.C.createMediaRouteController(a,b,c))?Promise.reject(a):Promise.resolve()};k.provideSinks=function(a){bn(this.g,a)};var Bp=function(a){var b=a.Jh().some(function(c){return c.isLocal});Tq(a.j,a.Ua(),b)};Bq.prototype.s=$a("mr.CastProvider");
var Sq=function(a,b,c){this.senderId=a;this.h=b;this.g=c};var Uq=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/,Vq=function(a,b){if(a){a=a.split("&");for(var c=0;c<a.length;c++){var d=a[c].indexOf("="),e=null;if(0<=d){var f=a[c].substring(0,d);e=a[c].substring(d+1)}else f=a[c];b(f,e?decodeURIComponent(e.replace(/\+/g," ")):"")}}},Wq=function(a,b){if(!b)return a;var c=a.indexOf("#");0>c&&(c=a.length);var d=a.indexOf("?");if(0>d||d>c){d=c;var e=""}else e=a.substring(d+1,c);a=[a.substr(0,
d),e,a.substr(c)];c=a[1];a[1]=b?c?c+"&"+b:b:c;return a[0]+(a[1]?"?"+a[1]:"")+a[2]},Xq=function(a,b,c){if(Array.isArray(b))for(var d=0;d<b.length;d++)Xq(a,String(b[d]),c);else null!=b&&c.push(a+(""===b?"":"="+encodeURIComponent(String(b))))},Yq=function(a){var b=[],c;for(c in a)Xq(c,a[c],b);return b.join("&")},Zq=function(a,b){b=Yq(b);return Wq(a,b)},$q=function(a,b,c){c=null!=c?"="+encodeURIComponent(String(c)):"";return Wq(a,b+c)},ar=/#|$/,br=function(a,b){var c=a.search(ar);a:{var d=0;for(var e=
b.length;0<=(d=a.indexOf(b,d))&&d<c;){var f=a.charCodeAt(d-1);if(38==f||63==f)if(f=a.charCodeAt(d+e),!f||61==f||38==f||35==f)break a;d+=e+1}d=-1}if(0>d)return null;e=a.indexOf("&",d);if(0>e||e>c)e=c;d+=b.length+1;return decodeURIComponent(a.substr(d,e-d).replace(/\+/g," "))},cr=function(a,b){var c=a.length-1;0<=c&&a.indexOf("/",c)==c&&(a=a.substr(0,a.length-1));jd(b,"/")&&(b=b.substr(1));return ye(a,"/",b)};var dr=function(a){this.ic=this.m=this.j="";this.o=null;this.l=this.g="";this.C=!1;var b;a instanceof dr?(this.C=a.C,er(this,a.j),this.m=a.m,this.ic=a.ic,fr(this,a.Cb()),this.g=a.g,gr(this,a.h.clone()),this.l=a.l):a&&(b=String(a).match(Uq))?(this.C=!1,er(this,b[1]||"",!0),this.m=hr(b[2]||""),this.ic=hr(b[3]||"",!0),fr(this,b[4]),this.g=hr(b[5]||"",!0),gr(this,b[6]||"",!0),this.l=hr(b[7]||"")):(this.C=!1,this.h=new ir(null,this.C))};
dr.prototype.toString=function(){var a=[],b=this.j;b&&a.push(jr(b,kr,!0),":");var c=this.ic;if(c||"file"==b)a.push("//"),(b=this.m)&&a.push(jr(b,kr,!0),"@"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.Cb(),null!=c&&a.push(":",String(c));if(c=this.g)this.ic&&"/"!=c.charAt(0)&&a.push("/"),a.push(jr(c,"/"==c.charAt(0)?lr:nr,!0));(c=this.h.toString())&&a.push("?",c);(c=this.l)&&a.push("#",jr(c,or));return a.join("")};
dr.prototype.resolve=function(a){var b=this.clone(),c=!!a.j;c?er(b,a.j):c=!!a.m;c?b.m=a.m:c=!!a.ic;c?b.ic=a.ic:c=null!=a.o;var d=a.g;if(c)fr(b,a.Cb());else if(c=!!a.g){if("/"!=d.charAt(0))if(this.ic&&!this.g)d="/"+d;else{var e=b.g.lastIndexOf("/");-1!=e&&(d=b.g.substr(0,e+1)+d)}e=d;if(".."==e||"."==e)d="";else if(-1!=e.indexOf("./")||-1!=e.indexOf("/.")){d=jd(e,"/");e=e.split("/");for(var f=[],g=0;g<e.length;){var h=e[g++];"."==h?d&&g==e.length&&f.push(""):".."==h?((1<f.length||1==f.length&&""!=f[0])&&
f.pop(),d&&g==e.length&&f.push("")):(f.push(h),d=!0)}d=f.join("/")}else d=e}c?b.g=d:c=""!==a.h.toString();c?gr(b,a.h.clone()):c=!!a.l;c&&(b.l=a.l);return b};dr.prototype.clone=function(){return new dr(this)};var er=function(a,b,c){a.j=c?hr(b,!0):b;a.j&&(a.j=a.j.replace(/:$/,""))};dr.prototype.Cb=function(){return this.o};
var fr=function(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.o=b}else a.o=null},gr=function(a,b,c){b instanceof ir?(a.h=b,pr(a.h,a.C)):(c||(b=jr(b,qr)),a.h=new ir(b,a.C))},hr=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},jr=function(a,b,c){return"string"===typeof a?(a=encodeURI(a).replace(b,rr),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null},rr=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},
kr=/[#\/\?@]/g,nr=/[#\?:]/g,lr=/[#\?]/g,qr=/[#\?@]/g,or=/#/g,ir=function(a,b){this.h=this.g=null;this.j=a||null;this.l=!!b},sr=function(a){a.g||(a.g=new Om,a.h=0,a.j&&Vq(a.j,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))},ur=function(a){var b=Fn(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new ir(null,void 0);a=En(a);for(var d=0;d<b.length;d++){var e=b[d],f=a[d];Array.isArray(f)?tr(c,e,f):c.add(e,f)}return c};k=ir.prototype;k.ya=function(){sr(this);return this.h};
k.add=function(a,b){sr(this);this.j=null;a=vr(this,a);var c=this.g.get(a);c||this.g.set(a,c=[]);c.push(b);this.h+=1;return this};k.remove=function(a){sr(this);a=vr(this,a);return Rm(this.g,a)?(this.j=null,this.h-=this.g.get(a).length,this.g.remove(a)):!1};k.clear=function(){this.g=this.j=null;this.h=0};k.zc=function(){sr(this);return 0==this.h};var wr=function(a,b){sr(a);b=vr(a,b);return Rm(a.g,b)};k=ir.prototype;k.lf=function(a){var b=this.Ma();return Tb(b,a)};
k.forEach=function(a,b){sr(this);this.g.forEach(function(c,d){Hb(c,function(e){a.call(b,e,d,this)},this)},this)};k.Pb=function(){sr(this);for(var a=this.g.Ma(),b=this.g.Pb(),c=[],d=0;d<b.length;d++)for(var e=a[d],f=0;f<e.length;f++)c.push(b[d]);return c};k.Ma=function(a){sr(this);var b=[];if("string"===typeof a)wr(this,a)&&(b=bc(b,this.g.get(vr(this,a))));else{a=this.g.Ma();for(var c=0;c<a.length;c++)b=bc(b,a[c])}return b};
k.set=function(a,b){sr(this);this.j=null;a=vr(this,a);wr(this,a)&&(this.h-=this.g.get(a).length);this.g.set(a,[b]);this.h+=1;return this};k.get=function(a,b){if(!a)return b;a=this.Ma(a);return 0<a.length?String(a[0]):b};var tr=function(a,b,c){a.remove(b);0<c.length&&(a.j=null,a.g.set(vr(a,b),cc(c)),a.h+=c.length)};
ir.prototype.toString=function(){if(this.j)return this.j;if(!this.g)return"";for(var a=[],b=this.g.Pb(),c=0;c<b.length;c++){var d=b[c],e=encodeURIComponent(String(d));d=this.Ma(d);for(var f=0;f<d.length;f++){var g=e;""!==d[f]&&(g+="="+encodeURIComponent(String(d[f])));a.push(g)}}return this.j=a.join("&")};ir.prototype.clone=function(){var a=new ir;a.j=this.j;this.g&&(a.g=this.g.clone(),a.h=this.h);return a};
var vr=function(a,b){b=String(b);a.l&&(b=b.toLowerCase());return b},pr=function(a,b){b&&!a.l&&(sr(a),a.j=null,a.g.forEach(function(c,d){var e=d.toLowerCase();d!=e&&(this.remove(d),tr(this,e,c))},a));a.l=b};ir.prototype.extend=function(a){for(var b=0;b<arguments.length;b++)Hn(arguments[b],function(c,d){this.add(d,c)},this)};var xr=function(a,b){this.input=a;this.domain=b};var yr=function(a){this.g=a;this.s=$a("mr.ExternalMessageHandler")};
yr.prototype.onMessage=function(a,b,c){var d=this;this.s.info("Received a message from "+b.id+" type: "+a.type);var e=chrome.runtime.id;"start"==a.type?(a=a.message,this.g.searchSinks("pseudo:cloud","urn:x-org.chromium.media:source:desktop",new xr(a.meetingName,a.domain)).then(function(f){var g="PresentationId"+b.id+zr++;d.g.createRoute("urn:x-org.chromium.media:source:desktop",f,g).then(function(h){c(new Af(e,"route",h.id))}).catch(function(h){c(new Af(e,"error",h))})},function(){c(new Af(e,"error",
Error("Failed to find sink.")))})):"stop"==a.type?this.g.terminateRoute(a.message.routeId).then(function(){c(new Af(e,"stopped"))}):"subscribe_log_data"==a.type?(bb.push(function(f){chrome.runtime.sendMessage(b.id,new Af(e,"log_message",f))}),c(new Af(e,"subscribed"))):(c(new Af(e,"error",Error("Unhandled message type"))),this.s.error("Unhandled message type "+a.type))};var zr=0;var Ar=function(){this.g=[];this.h=[]};k=Ar.prototype;k.enqueue=function(a){if(1E3<=this.ya()){if(this.zc())throw Error("Empty queue");0==this.g.length&&(this.g=this.h,this.g.reverse(),this.h=[]);this.g.pop()}this.h.push(a)};k.ya=function(){return this.g.length+this.h.length};k.zc=function(){return 0==this.ya()};k.Ma=function(){var a=this.g.slice();a.reverse();a.push.apply(a,p(this.h));return a};k.clear=function(){this.g=[];this.h=[]};var Br=function(){this.g=new Ar;this.h=Date.now()},Dr=function(){null==Cr&&(Cr=new Br);return Cr};
Br.prototype.init=function(){ab=1;var a=$a("browser"),b=window.onerror;window.onerror=function(d,e,f,g,h){try{var m=h.result.error.errors[0];if("usageLimits"==m.domain&&"accessNotConfigured"==m.reason)return!0}catch(q){}b&&b(d,e,f,g,h);a.error("Error: "+d+" ("+e+" @ Line: "+f+")",h)};bb.push(this.l.bind(this));var c=window.localStorage["debug.logs"];c&&(ab=ib(c.toUpperCase()));(c=window.localStorage["debug.console"])&&"false"!=c.toLowerCase()&&bb.push(this.j.bind(this))};
Br.prototype.l=function(a){this.g.enqueue(Er(this,a,!1));a=a.Ic;a instanceof Error&&a.stack&&this.g.enqueue(a.stack)};Br.prototype.j=function(a){var b=[Er(this,a,!0)];a.Ic&&b.push(a.Ic);switch(a.level){case 3:console.error.apply(console,p(b));break;case 2:console.warn.apply(console,p(b));break;case 1:console.log.apply(console,p(b));break;default:console.debug.apply(console,p(b))}};
var Er=function(a,b,c){var d=["["];if(c)a=(Date.now()-a.h)/1E3,d.push(("       "+a.toFixed(3)).slice(-7));else{a=new Date(b.time);var e=function(f){return 10>f?"0"+f:f};d.push(a.getFullYear().toString(),"-",e(a.getMonth()+1),"-",e(a.getDate())," ",e(a.getHours()),":",e(a.getMinutes()),":",e(a.getSeconds()),".",e(Math.floor(a.getMilliseconds()/10)))}d.push("][",hb[b.level],"][",b.R,"] ",b.message);if(!c&&null!=b.Ic)if(d.push("\n"),b.Ic instanceof Error)d.push(b.Ic.message);else try{d.push(JSON.stringify(b.Ic))}catch(f){d.push(b.Ic.toString())}d.push("\n");
return d.join("")},Fr=function(){var a=Dr();return 0==a.g.ya()?"NA":a.g.Ma().join("")},Gr=function(){var a=Dr();km(a)};Br.prototype.Ua=function(){return"LogManager"};Br.prototype.Ib=function(){return[this.g.Ma()]};Br.prototype.Hb=function(){var a=this.g.Ma();this.g.clear();for(var b=n(hm(this)||[]),c=b.next();!c.done;c=b.next())this.g.enqueue(c.value);a=n(a);for(c=a.next();!c.done;c=a.next())this.g.enqueue(c.value)};var Cr=null;var Hr=function(a){return Promise.all(a.map(function(b){return b.then(function(c){return{Yd:!0,value:c}},function(c){return{Yd:!1,reason:c}})}))};var Ir=function(a){this.g=a;this.s=$a("mr.InternalMessageHandler")};
Ir.prototype.onMessage=function(a,b,c){var d=this;if("retrieve_log_data"!=a.type)c(new Af(chrome.runtime.id,"error",Error("Unhandled message type")));else{var e={logs:Fr(),device:Em()};b=[];var f=zf(e.device.ip).then(function(h){h.g&&(e.device.version=h.g)});b.push(f);var g=this.g.F;g&&(a=Jr(this,g,a.source).then(function(h){h&&(e.castStreamingLogs=h)},function(){d.s.error("Log upload failed for service: "+g)}),b.push(a));this.g.config&&(this.g.config.enable_cast_sink_query?b.push(Kr(this,e)):e.castDeviceCounts=
"See b/151090350");e.dialDeviceCounts="See b/151090350";a=this.g.getMediaSinkServiceStatus().then(function(h){e.mediaSinkServiceStatus=h.status},function(){d.s.error("Failed to get media sink service status")});b.push(a);a=Lr(this.g).then(function(h){e.mediaRouterLogs=h.logs},function(){d.s.error("Failed to get Media Router logs")});b.push(a);this.g.config&&(e.mirroringServiceEnabled=this.g.config.use_mirroring_service,e.nativeCastMrpEnabled=!this.g.config.enable_cast_sink_query,e.nativeDialMrpEnabled=
!this.g.config.enable_dial_sink_query);Hr(b).then(function(){c(e)})}};var Kr=function(a,b){return gj("mr.cast.SinkDiscoveryService").then(function(c){c=c.Bh;b.castDeviceCounts=c.Xm+"."+c.Vl},function(){a.s.error("Failed to get device counts for castDeviceCounts.")})},Jr=function(a,b,c){return Mr(a.g,b).then(function(d){return d.Vj(c)})};var Nr={ACCEPTED:0,nA:1,TIMEOUT:2},Or={SUCCESS:0,EA:1},Pr={Qq:0,sq:1,EK:2,QB:3,PB:4,cE:5,TIMEOUT:6,IF:7},Qr={LB:0,AI:1},Rr=function(a){ub("MediaRouter.Cloud.Knock.Result",a,Nr)},Sr=function(a){ub("MediaRouter.Cloud.Session.Start",a,Or)},Tr=function(a){ub("MediaRouter.Cloud.Session.Type",a,Qr)};var Ur=function(a,b){this.g=a;this.h=b},Vr=new Ur("https://castedumessaging-pa.googleapis.com/v1","AIzaSyAOZM8ZYeov685QMjXT3sC7XNizfrTEKjA"),Wr=new Ur("https://www.googleapis.com/calendar/v3",""),Xr=new Ur("https://www.googleapis.com/hangouts/v1",""),Yr=new Ur("https://networktraversal.googleapis.com/v1alpha","AIzaSyAOZM8ZYeov685QMjXT3sC7XNizfrTEKjA");var Zr=function(a,b,c,d,e,f){c=void 0===c?null:c;a||null==c&&(c="default");this.Sm=a;this.Sa=b;this.ic=c;this.xf=void 0===d?null:d;this.ad=void 0===e?null:e;this.Je=void 0===f?null:f},$r=function(a){var b="";a.ad?b=a.ad:a.xf&&(b=a.xf);return b};Zr.prototype.Fd=function(){return this.Sm};Zr.prototype.getId=function(){return this.Sa};Zr.prototype.merge=function(a){!this.Je&&a.Je&&(this.Je=a.Je);!this.ad&&a.ad&&(this.ad=a.ad);this.ad&&a.ad&&this.Je&&(this.ad=a.ad)};var as=function(a,b){this.h=a;this.j=b;this.s=$a("mr.cloud.calendar.CalendarService")},es=function(a){return bs(a,a.j.h).then(function(b){a.s.info(cs(b.length)+" events discovered before filtering.");return ds(a,b)},function(b){a.s.K("Error getting Hangouts from calendar.",b);return[]})},cs=function(a){return 20<a?"20+":a.toString()},bs=function(a,b){var c=Date.now();return fs(a,b,new Date(c),new Date(c+9E5)).then(function(d){return d.filter(a.g)})};
as.prototype.g=function(a){return!(!a.start||!a.end||a.start.date||a.end.date||!a.start.dateTime||!a.end.dateTime)};
var fs=function(a,b,c,d){b=gs(Wr.g,["calendars",b,"events"],{timeMin:c.toJSON(),timeMax:d.toJSON(),singleEvents:!0});gb(a.s,"Retrieving Hangouts from Calendar: "+b);ub("MediaRouter.Cloud.CalendarApiCaller",vb,wb);null!=xb&&(clearTimeout(xb),xb=null);return hs(a.h,b,"GET").then(function(e){return e.items?e.items:[]})},ds=function(a,b){var c=[];b.filter(function(d){return d.hangoutLink}).forEach(function(d){var e=new dr(d.hangoutLink);if("meet.google.com"==e.ic)c.push(new Zr(!0,e.g.substring(1),void 0,
void 0,d.summary));else if(e=e.g.substring(12).split("/"),2==e.length){var f=n(e);e=f.next().value;f=f.next().value;if(-1!=e.indexOf(".")){var g=f;var h=e}c.push(new Zr(!1,f+"@"+e,h,g,d.summary,void 0))}else a.s.K("Invalid hangout link from calendar event: "+d.hangoutLink)});a.s.info(cs(c.length)+" events discovered with Hangout links.");return c};var is=function(a,b,c,d,e,f,g,h){var m=Dm(Cm(),a);this.Jb=new dm(m,b,g,h,e);this.deviceId=a;this.g=c;this.model=d;this.isAvailable=f};da.Object.defineProperties(is.prototype,{id:{configurable:!0,enumerable:!0,get:function(){return this.Jb.id}},displayName:{configurable:!0,enumerable:!0,set:function(a){this.Jb.friendlyName=a}}});var js=function(a){var b=a.ic,c;a.xf&&$r(a)!=a.xf&&(c=a.xf);is.call(this,a.getId(),$r(a),"mesi","Hangout",b,!1,a.Fd()?"meeting":"hangout",c);this.Fd=a.Fd();this.Vg=a.Je||""};
t(js,is);var ks=function(a,b,c){is.call(this,a,b,"slarti","Cast Receiver for Education","default",c,"education")};t(ks,is);var ls=function(a,b,c){this.u=a;this.m=b;this.g=new Map;this.C=new Map;this.l=null;this.o=c};ls.prototype.j=function(){var a=this.l+this.o;if(null==this.l||a<Date.now())this.l=Date.now(),ms(this);return Array.from(this.g.values())};ls.prototype.h=function(a){return this.g.get(a)||null};
var ms=function(a){a.u().then(function(b){ns(a,b)})},ns=function(a,b){var c=new Map(a.g),d=new Map,e=new Map,f=[],g=[];b.forEach(function(h){var m=h.id;d.set(m,h);e.set(m,h.deviceId);c.has(m)?c.has(m)&&JSON.stringify(c.get(m))!=JSON.stringify(h)&&g.push(h.Jb):f.push(h.Jb);c.delete(m)});b=[].concat(p(c.values())).map(function(h){return h.Jb});a.C.clear();a.C=e;a.g.clear();a.g=d;os(a,f,g,b)},os=function(a,b,c,d){0<b.length&&ps(a.m,b);0<c.length&&qs(a.m,c);0<d.length&&rs(a.m,d)},ts=function(a){for(var b=
{},c=n(a.g.entries()),d=c.next();!d.done;d=c.next()){var e=n(d.value);d=e.next().value;e=e.next().value;b[d]=e}c={};d=n(a.C.entries());for(e=d.next();!e.done;e=d.next()){var f=n(e.value);e=f.next().value;f=f.next().value;c[e]=f}return new ss(b,c,a.l)},us=function(a,b){for(var c in b.sinks){var d=b.sinks[c],e=null;"Hangout"==d.model?e=new js(new Zr(d.Fd,d.deviceId,d.Jb.domain,d.Jb.description,d.Jb.friendlyName,d.Vg)):"Cast Receiver for Education"==d.model&&(e=new ks(d.deviceId,d.Jb.friendlyName,d.isAvailable));
a.g.set(c,e)}for(c in b.g)a.C.set(c,b.g[c]);b.h&&(a.l=b.h)},ss=function(a,b,c){this.sinks=a;this.g=b;this.h=c};var xs=function(a,b,c){if(!vs){Yf();var d=Xf;d.h=Tf;var e=ws;d.g||(d.g=[]);d.g.push(e);vs=!0}this.C=a;this.m=b;this.g=new ls(this.o.bind(this),c,2E4);this.l=new Map;km(this)},ws=function(a){cb({R:a.j,level:jb(a.h.value),time:a.C,message:a.getMessage(),Ic:a.g})};xs.prototype.j=function(){return this.g.j()};xs.prototype.h=function(a){return this.g.h(a)};
xs.prototype.o=function(){var a=this;this.s.info("Fetching hangouts");return Hr([ys(this.m),es(this.C)]).then(function(b){var c=Array.from(a.l.values());b.forEach(function(e){e.Yd?c=c.concat(e.value):a.s.error("Error discovering Hangouts",e.reason)});var d=c.reduce(function(e,f){var g=e[f.getId()];g?g.merge(f):g=f;e[g.getId()]=g;return e},{});return Object.keys(d).map(function(e){e=d[e];tb("MediaRouter.Cloud.Hangout.Sink.Discovered");return new js(e)})})};
var As=function(a,b){return gj("mr.mirror.hangouts.MeetingsService").then(function(c){return c.Qb(b)}).then(function(c){return zs(a,c)},function(){return b.input.match(/^#/)?Promise.reject(Error("Failed to resolve meeting alias.")):zs(a,b.input,b.domain)})},zs=function(a,b,c){c=c||void 0;var d=!c;b=new Zr(d,d?b:b+"@"+c,c,b,void 0,void 0);a.l.set(b.getId(),b);b=new js(b);a.g.g.set(b.id,b);return b.Jb};xs.prototype.Ua=function(){return"HangoutSinkDiscoveryService"};
xs.prototype.Ib=function(){for(var a={},b=n(this.l.entries()),c=b.next();!c.done;c=b.next()){var d=n(c.value);c=d.next().value;d=d.next().value;a[c]=d}return[{cache:ts(this.g),manualHangouts:a}]};xs.prototype.Hb=function(){var a=hm(this);if(a){us(this.g,a.cache);for(var b in a.manualHangouts){var c=a.manualHangouts[b];this.l.set(b,new Zr(c.Sm,c.Sa,c.ic,c.xf,c.ad,c.Je))}}};xs.prototype.s=$a("mr.cloud.discovery.HangoutSinkDiscoveryService");var vs=!1;var T=function(){this.Rc=this.Rc;this.ub=this.ub};T.prototype.Rc=!1;T.prototype.C=function(){return this.Rc};T.prototype.dispose=function(){this.Rc||(this.Rc=!0,this.ba())};T.prototype.T=function(a){Bs(this,Ua(Cs,a))};var Bs=function(a,b){a.Rc?b():(a.ub||(a.ub=[]),a.ub.push(b))};T.prototype.ba=function(){if(this.ub)for(;this.ub.length;)this.ub.shift()()};
var Cs=function(a){a&&"function"==typeof a.dispose&&a.dispose()},Ds=function(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];La(d)?Ds.apply(null,d):Cs(d)}};var Es=w.JSON.parse,Fs=w.JSON.stringify;var Gs=function(a,b){this.j=a;this.l=b;this.h=0;this.g=null};Gs.prototype.get=function(){if(0<this.h){this.h--;var a=this.g;this.g=a.next;a.next=null}else a=this.j();return a};var Hs=function(a,b){a.l(b);100>a.h&&(a.h++,b.next=a.g,a.g=b)};var Is=function(a){w.setTimeout(function(){throw a;},0)},Js,Ks=function(){var a=w.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!be("Presto")&&(a=function(){var e=lg(document,"IFRAME");e.style.display="none";document.documentElement.appendChild(e);var f=e.contentWindow;e=f.document;e.open();e.close();var g="callImmediate"+Math.random(),h="file:"==f.location.protocol?"*":f.location.protocol+"//"+f.location.host;e=x(function(m){if(("*"==
h||m.origin==h)&&m.data==g)this.port1.onmessage()},this);f.addEventListener("message",e,!1);this.port1={};this.port2={postMessage:function(){f.postMessage(g,h)}}});if("undefined"!==typeof a&&!de()){var b=new a,c={},d=c;b.port1.onmessage=function(){if(void 0!==c.next){c=c.next;var e=c.bm;c.bm=null;e()}};return function(e){d.next={bm:e};d=d.next;b.port2.postMessage(0)}}return function(e){w.setTimeout(e,0)}};var Ls=function(){this.h=this.g=null},Ns=new Gs(function(){return new Ms},function(a){a.reset()});Ls.prototype.add=function(a,b){var c=Ns.get();c.set(a,b);this.h?this.h.next=c:this.g=c;this.h=c};Ls.prototype.remove=function(){var a=null;this.g&&(a=this.g,this.g=this.g.next,this.g||(this.h=null),a.next=null);return a};var Ms=function(){this.next=this.scope=this.g=null};Ms.prototype.set=function(a,b){this.g=a;this.scope=b;this.next=null};Ms.prototype.reset=function(){this.next=this.scope=this.g=null};var Ss=function(a,b){Os||Ps();Qs||(Os(),Qs=!0);Rs.add(a,b)},Os,Ps=function(){if(w.Promise&&w.Promise.resolve){var a=w.Promise.resolve(void 0);Os=function(){a.then(Ts)}}else Os=function(){var b=Ts;!Ma(w.setImmediate)||w.Window&&w.Window.prototype&&!be("Edge")&&w.Window.prototype.setImmediate==w.setImmediate?(Js||(Js=Ks()),Js(b)):w.setImmediate(b)}},Qs=!1,Rs=new Ls,Ts=function(){for(var a;a=Rs.remove();){try{a.g.call(a.scope)}catch(b){Is(b)}Hs(Ns,a)}Qs=!1};var Us=function(a){a.prototype.$goog_Thenable=!0},Vs=function(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}};var Ys=function(a,b){this.g=0;this.o=void 0;this.l=this.h=this.j=null;this.C=this.m=!1;if(a!=Ia)try{var c=this;a.call(b,function(d){Ws(c,2,d)},function(d){if(!(d instanceof Xs))try{if(d instanceof Error)throw d;throw Error("Promise rejected.");}catch(e){}Ws(c,3,d)})}catch(d){Ws(this,3,d)}},Zs=function(){this.next=this.context=this.h=this.l=this.g=null;this.j=!1};Zs.prototype.reset=function(){this.context=this.h=this.l=this.g=null;this.j=!1};
var $s=new Gs(function(){return new Zs},function(a){a.reset()}),at=function(a,b,c){var d=$s.get();d.l=a;d.h=b;d.context=c;return d},bt=function(a){if(a instanceof Ys)return a;var b=new Ys(Ia);Ws(b,2,a);return b},ct=function(a){return new Ys(function(b,c){c(a)})},et=function(a,b,c){dt(a,b,c,null)||Ss(Ua(b,a))},ft=function(a){return new Ys(function(b,c){a.length||b(void 0);for(var d=0,e;d<a.length;d++)e=a[d],et(e,b,c)})},gt=function(a){return new Ys(function(b,c){var d=a.length,e=[];if(d)for(var f=
function(q,r){d--;e[q]=r;0==d&&b(e)},g=function(q){c(q)},h=0,m;h<a.length;h++)m=a[h],et(m,Ua(f,h),g);else b(e)})},ht=function(a){return new Ys(function(b){var c=a.length,d=[];if(c)for(var e=function(h,m,q){c--;d[h]=m?{Yd:!0,value:q}:{Yd:!1,reason:q};0==c&&b(d)},f=0,g;f<a.length;f++)g=a[f],et(g,Ua(e,f,!0),Ua(e,f,!1));else b(d)})},jt=function(){var a,b,c=new Ys(function(d,e){a=d;b=e});return new it(c,a,b)};Ys.prototype.then=function(a,b,c){return kt(this,Ma(a)?a:null,Ma(b)?b:null,c)};Us(Ys);
var mt=function(a,b,c){b=at(b,b,c);b.j=!0;lt(a,b);return a},nt=function(a,b){return kt(a,null,b,void 0)};Ys.prototype.cancel=function(a){if(0==this.g){var b=new Xs(a);Ss(function(){ot(this,b)},this)}};
var ot=function(a,b){if(0==a.g)if(a.j){var c=a.j;if(c.h){for(var d=0,e=null,f=null,g=c.h;g&&(g.j||(d++,g.g==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(0==c.g&&1==d?ot(c,b):(f?(d=f,d.next==c.l&&(c.l=d),d.next=d.next.next):pt(c),qt(c,e,3,b)))}a.j=null}else Ws(a,3,b)},lt=function(a,b){a.h||2!=a.g&&3!=a.g||rt(a);a.l?a.l.next=b:a.h=b;a.l=b},kt=function(a,b,c,d){var e=at(null,null,null);e.g=new Ys(function(f,g){e.l=b?function(h){try{var m=b.call(d,h);f(m)}catch(q){g(q)}}:f;e.h=c?function(h){try{var m=c.call(d,
h);void 0===m&&h instanceof Xs?g(h):f(m)}catch(q){g(q)}}:g});e.g.j=a;lt(a,e);return e.g};Ys.prototype.F=function(a){this.g=0;Ws(this,2,a)};Ys.prototype.D=function(a){this.g=0;Ws(this,3,a)};
var Ws=function(a,b,c){0==a.g&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.g=1,dt(c,a.F,a.D,a)||(a.o=c,a.g=b,a.j=null,rt(a),3!=b||c instanceof Xs||st(a,c)))},dt=function(a,b,c,d){if(a instanceof Ys)return lt(a,at(b||Ia,c||null,d)),!0;if(Vs(a))return a.then(b,c,d),!0;if(Na(a))try{var e=a.then;if(Ma(e))return tt(a,e,b,c,d),!0}catch(f){return c.call(d,f),!0}return!1},tt=function(a,b,c,d,e){var f=!1,g=function(m){f||(f=!0,c.call(e,m))},h=function(m){f||(f=!0,d.call(e,m))};try{b.call(a,
g,h)}catch(m){h(m)}},rt=function(a){a.m||(a.m=!0,Ss(a.u,a))},pt=function(a){var b=null;a.h&&(b=a.h,a.h=b.next,b.next=null);a.h||(a.l=null);return b};Ys.prototype.u=function(){for(var a;a=pt(this);)qt(this,a,this.g,this.o);this.m=!1};
var qt=function(a,b,c,d){if(3==c&&b.h&&!b.j)for(;a&&a.C;a=a.j)a.C=!1;if(b.g)b.g.j=null,ut(b,c,d);else try{b.j?b.l.call(b.context):ut(b,c,d)}catch(e){vt.call(null,e)}Hs($s,b)},ut=function(a,b,c){2==b?a.l.call(a.context,c):a.h&&a.h.call(a.context,c)},st=function(a,b){a.C=!0;Ss(function(){a.C&&vt.call(null,b)})},vt=Is,Xs=function(a){Ab.call(this,a)};B(Xs,Ab);Xs.prototype.name="cancel";var it=function(a,b,c){this.fa=a;this.resolve=b;this.reject=c};var wt=function(a,b,c,d,e,f,g,h,m){T.call(this);this.s=Zf("apps.apiary.ApiaryClient");this.h=null;this.D=!1;this.F=jt();this.j=[];this.g=a?encodeURIComponent(String(a)):null;this.G=null;!d&&b&&(this.G=b);this.J=c||null;this.l=!d;this.m=null!=e?e:null;this.u=f||null;this.L=!!g;this.H=h||null;this.o=null!=m?m:null};t(wt,T);
wt.prototype.init=function(){D(this.s,"init - API key: "+this.g);var a=x(function(c){this.h=c;var d=Ha("client.request",c),e=Ha("auth",c);d&&e?this.M():c.load("client",x(this.M,this));D(this.s,"loadCallback - API key: "+this.g+", clientRequest: "+d+", auth: "+e)},this),b=xt("gapi");b?a(b.gapi):yt(this,a);return this.F.fa};
var xt=function(a){for(var b=window,c=Ha(a,b);!c&&b!=window.top&&zt(b.parent,a);)b=b.parent,c=Ha(a,b);return c?b:null},zt=function(a,b){try{return!!a&&null!=a.location.href&&Fe(a,b)}catch(c){return!1}},yt=function(a,b){D(a.s,"loadGapi_ - API key: "+a.g);var c=xt("gapi_onload");if(c){var d=c.gapi_onload;c.gapi_onload=function(){d();b(c.gapi)};D(a.s,"found already loading GAPI - API key: "+a.g)}else{window.gapi_onload=function(){b(window.gapi)};var e=lg(document,"SCRIPT");te(e,At);a.H&&pg(e,Fs(a.H));
document.getElementsByTagName("head")[0].appendChild(e)}};wt.prototype.M=function(){D(this.s,"client loaded - API key: "+this.g);for(var a=0;a<this.j.length;a++)this.j[a].Bb.resolve(Bt(this,this.j[a].requestData));this.D=!0;this.F.resolve(this.h)};wt.prototype.sendRequest=function(a){if(this.D)return Bt(this,a);var b=jt();this.j.push({requestData:a,Bb:b});return b.fa};
var Bt=function(a,b){var c=Ha("config.get",a.h);if(!a.l){var d=c("googleapis.config/auth/useFirstPartyAuth");var e=c("googleapis.config/auth/useOriginToken")}var f;null!=a.m&&(f=c("client/cors"));var g;null!=a.o&&(g=c("client/xd4"));try{var h=Ha("config.update",a.h);a.l||(h("googleapis.config/auth/useFirstPartyAuth",!1),h("googleapis.config/auth/useOriginToken",!1));null!=a.m&&h("client/cors",a.m);null!=a.o&&h("client/xd4",a.o);var m=Ct(a);b.headers&&Mc(m,b.headers);var q={headers:m,root:a.J,path:b.path,
method:b.method,body:b.body},r=b.params||{};a.g&&!a.u?Mc(r,{key:a.g}):a.u&&Mc(r,{key:null});Gc(r)||(q.params=r);var u=bt(Ha("client.request",a.h)(q));b.callback&&u.then(function(A){b.callback.apply(null,[A.result,A])},function(A){b.callback.apply(null,[A.result,A])});return u}finally{c=Ha("config.update",a.h),a.l||(c("googleapis.config/auth/useFirstPartyAuth",d),c("googleapis.config/auth/useOriginToken",e)),null!=a.m&&c("client/cors",f),null!=a.o&&c("client/xd4",g)}},Ct=function(a){if(a.l){if(a.u)return{Authorization:"Bearer "+
a.u};var b=Ha("auth.getAuthHeaderValueForFirstParty",a.h);return{Authorization:a.L?b([]):b(),"X-Goog-AuthUser":a.G}}return{}},At=hd(Tc(new Sc(Qc,"https://apis.google.com/js/client.js")));var Dt=function(a){this.g=a},gs=function(a,b,c){var d="";b.forEach(function(e){d+="/"+encodeURIComponent(e)});a=new dr(a+d);c&&(c=ur(c),gr(a,c));return a},hs=function(a,b,c,d,e){e=void 0===e?1:e;return a.g.getAuthToken().then(function(f){return Et(a,b,c,f,d).catch(function(g){if("INVALID_ACCESS_ERROR"==g&&0<e)return Ft(a,f,b,c,d,e-1);throw g;})})},Ft=function(a,b,c,d,e,f){return Gt(b).then(function(){return hs(a,c,d,e,f)})},Et=function(a,b,c,d,e){var f=Ht;d=new wt(void 0,void 0,void 0,!1,!1,d);d.init();
return f(a,d,b,c,e)},Ht=function(a,b,c,d,e){return new Promise(function(f,g){b.sendRequest(It(c,d,function(h){h&&!h.error?f(h):h&&401==h.error.code?g("INVALID_ACCESS_ERROR"):g(h&&h.error?h.error.errors?h.error.errors[0]:h:Error(h))},e))})},It=function(a,b,c,d){a={callback:c,method:b,path:a.toString()};d&&(a.body=d);return a};var Lt=function(){this.g=!1;this.h=null;this.j=!1;this.s=$a("mr.cloud.identity.IdentityService");km(this);Jt(this);Kt(this)},Mt=function(a){return a.h?a.h.substr(a.h.indexOf("@")+1):""};Lt.prototype.getAuthToken=function(){return chrome.identity?new Promise(function(a,b){chrome.identity.getAuthToken({interactive:!1},function(c){chrome.runtime.lastError?b(Error("Unable to get user auth token: "+chrome.runtime.lastError.message)):null==c?b(Error("User is not logged in (no token found)")):a(c)})}):Promise.reject(Error("chrome.identity permission required for auth."))};
var Gt=function(a){return new Promise(function(b){chrome.identity.removeCachedAuthToken({token:a},function(){b()})})},Kt=function(a){a.getAuthToken().then(function(b){chrome.identity.getProfileUserInfo(function(c){a.g=!!c.email||!!c.id;a.h=c.email||null;b&&!a.g&&(a.j=!0)})},function(b){gb(a.s,"Unable to set sign in and email.",b)})},Jt=function(a){chrome.identity.onSignInChanged.addListener(function(b,c){pj(6);a.g=c;a.s.info("Signed in change: "+a.g);a.g?Kt(a):(a.h=null,a.j=!1)})},Nt=function(a){return a.getAuthToken().then(function(b){var c=
window.gapi;if(!c)return a.s.error("gapi not loaded."),!1;a.s.info("Setting gapi auth token");c.auth.setToken({access_token:b});return!0})};Lt.prototype.Ua=function(){return"IdentityService"};Lt.prototype.Ib=function(){return[null,{signedIn:this.g,userEmail:this.h,kioskAuth:this.j}]};Lt.prototype.Hb=function(){var a=im(this);a&&(a.signedIn&&(this.g=a.signedIn),a.userEmail&&(this.h=a.userEmail),a.kioskAuth&&(this.j=a.kioskAuth))};var Ot="cloudview.test@gmail.com castouts.qa.nohangouts@gmail.com castouts.qa@gmail.com castouts-qa.com castouts-test.com google.com youtube.com nest.com waze.com netflix.com twitter.com yahoo.com salesforce.com whirlpool.com nytimes.com kohls.com squareup.com ivci.com".split(" ");var Pt={Fz:{1E3:{other:"0K"},1E4:{other:"00K"},1E5:{other:"000K"},1E6:{other:"0M"},1E7:{other:"00M"},1E8:{other:"000M"},1E9:{other:"0B"},1E10:{other:"00B"},1E11:{other:"000B"},1E12:{other:"0T"},1E13:{other:"00T"},1E14:{other:"000T"}},Ez:{1E3:{other:"0 thousand"},1E4:{other:"00 thousand"},1E5:{other:"000 thousand"},1E6:{other:"0 million"},1E7:{other:"00 million"},1E8:{other:"000 million"},1E9:{other:"0 billion"},1E10:{other:"00 billion"},1E11:{other:"000 billion"},1E12:{other:"0 trillion"},1E13:{other:"00 trillion"},
1E14:{other:"000 trillion"}}},Qt=Pt;Qt=Pt;var Rt={AED:[2,"dh","\u062f.\u0625."],ALL:[0,"Lek","Lek"],AUD:[2,"$","AU$"],BDT:[2,"\u09f3","Tk"],BGN:[2,"lev","lev"],BRL:[2,"R$","R$"],CAD:[2,"$","C$"],CDF:[2,"FrCD","CDF"],CHF:[2,"CHF","CHF"],CLP:[0,"$","CL$"],CNY:[2,"\u00a5","RMB\u00a5"],COP:[32,"$","COL$"],CRC:[0,"\u20a1","CR\u20a1"],CZK:[50,"K\u010d","K\u010d"],DKK:[50,"kr.","kr."],DOP:[2,"RD$","RD$"],EGP:[2,"\u00a3","LE"],ETB:[2,"Birr","Birr"],EUR:[2,"\u20ac","\u20ac"],GBP:[2,"\u00a3","GB\u00a3"],HKD:[2,"$","HK$"],HRK:[2,"kn","kn"],HUF:[34,
"Ft","Ft"],IDR:[0,"Rp","Rp"],ILS:[34,"\u20aa","IL\u20aa"],INR:[2,"\u20b9","Rs"],IRR:[0,"Rial","IRR"],ISK:[0,"kr","kr"],JMD:[2,"$","JA$"],JPY:[0,"\u00a5","JP\u00a5"],KRW:[0,"\u20a9","KR\u20a9"],LKR:[2,"Rs","SLRs"],LTL:[2,"Lt","Lt"],MNT:[0,"\u20ae","MN\u20ae"],MVR:[2,"Rf","MVR"],MXN:[2,"$","Mex$"],MYR:[2,"RM","RM"],NOK:[50,"kr","NOkr"],PAB:[2,"B/.","B/."],PEN:[2,"S/.","S/."],PHP:[2,"\u20b1","PHP"],PKR:[0,"Rs","PKRs."],PLN:[50,"z\u0142","z\u0142"],RON:[2,"RON","RON"],RSD:[0,"din","RSD"],RUB:[50,"\u20bd",
"RUB"],SAR:[2,"Rial","Rial"],SEK:[50,"kr","kr"],SGD:[2,"$","S$"],THB:[2,"\u0e3f","THB"],TRY:[2,"\u20ba","TRY"],TWD:[2,"NT$","NT$"],TZS:[0,"TSh","TSh"],UAH:[2,"\u0433\u0440\u043d.","UAH"],USD:[2,"$","US$"],UYU:[2,"$","$U"],VND:[48,"\u20ab","VN\u20ab"],YER:[0,"Rial","Rial"],ZAR:[2,"R","ZAR"]};var St={jl:".",ti:",",xl:"%",zi:"0",cq:"+",sl:"-",ml:"E",yl:"\u2030",ui:"\u221e",Xp:"NaN",Bp:"#,##0.###",CH:"#E0",wF:"#,##0%",kA:"\u00a4#,##0.00",kl:"USD"},Tt=St;Tt=St;var Vt=function(){this.D=40;this.h=1;this.j=3;this.H=this.m=0;this.L=!1;this.G=this.u="";this.l=Tt.sl;this.F="";this.g=1;this.o=!1;this.C=[];this.M=this.J=!1;var a=Tt.Bp;a.replace(/ /g,"\u00a0");var b=[0];this.u=Ut(this,a,b);for(var c=b[0],d=-1,e=0,f=0,g=0,h=-1,m=a.length,q=!0;b[0]<m&&q;b[0]++)switch(a.charAt(b[0])){case "#":0<f?g++:e++;0<=h&&0>d&&h++;break;case "0":if(0<g)throw Error('Unexpected "0" in pattern "'+a+'"');f++;0<=h&&0>d&&h++;break;case ",":0<h&&this.C.push(h);h=0;break;case ".":if(0<=
d)throw Error('Multiple decimal separators in pattern "'+a+'"');d=e+f+g;break;case "E":if(this.M)throw Error('Multiple exponential symbols in pattern "'+a+'"');this.M=!0;this.H=0;b[0]+1<m&&"+"==a.charAt(b[0]+1)&&(b[0]++,this.L=!0);for(;b[0]+1<m&&"0"==a.charAt(b[0]+1);)b[0]++,this.H++;if(1>e+f||1>this.H)throw Error('Malformed exponential pattern "'+a+'"');q=!1;break;default:b[0]--,q=!1}0==f&&0<e&&0<=d&&(f=d,0==f&&f++,g=e-f,e=f-1,f=1);if(0>d&&0<g||0<=d&&(d<e||d>e+f)||0==h)throw Error('Malformed pattern "'+
a+'"');g=e+f+g;this.j=0<=d?g-d:0;0<=d&&(this.m=e+f-d,0>this.m&&(this.m=0));this.h=(0<=d?d:g)-e;this.M&&(this.D=e+this.h,0==this.j&&0==this.h&&(this.h=1));this.C.push(Math.max(0,h));this.J=0==d||d==g;c=b[0]-c;this.G=Ut(this,a,b);b[0]<a.length&&";"==a.charAt(b[0])?(b[0]++,1!=this.g&&(this.o=!0),this.l=Ut(this,a,b),b[0]+=c,this.F=Ut(this,a,b)):(this.l+=this.u,this.F+=this.G)};
Vt.prototype.parse=function(a,b){b=b||[0];a=a.replace(/ |\u202f/g,"\u00a0");var c=a.indexOf(this.u,b[0])==b[0],d=a.indexOf(this.l,b[0])==b[0];c&&d&&(this.u.length>this.l.length?d=!1:this.u.length<this.l.length&&(c=!1));c?b[0]+=this.u.length:d&&(b[0]+=this.l.length);if(a.indexOf(Tt.ui,b[0])==b[0]){b[0]+=Tt.ui.length;var e=Infinity}else{e=a;var f=!1,g=!1,h=!1,m=-1,q=1,r=Tt.jl,u=Tt.ti,A=Tt.ml;u=u.replace(/\u202f/g,"\u00a0");for(var z="";b[0]<e.length;b[0]++){var H=e.charAt(b[0]),O=Wt(H);if(0<=O&&9>=
O)z+=O,h=!0;else if(H==r.charAt(0)){if(f||g)break;z+=".";f=!0}else if(H==u.charAt(0)&&("\u00a0"!=u.charAt(0)||b[0]+1<e.length&&0<=Wt(e.charAt(b[0]+1)))){if(f||g)break}else if(H==A.charAt(0)){if(g)break;z+="E";g=!0;m=b[0]}else if("+"==H||"-"==H){if(h&&m!=b[0]-1)break;z+=H}else if(1==this.g&&H==Tt.xl.charAt(0)){if(1!=q)break;q=100;if(h){b[0]++;break}}else if(1==this.g&&H==Tt.yl.charAt(0)){if(1!=q)break;q=1E3;if(h){b[0]++;break}}else break}1!=this.g&&(q=this.g);e=parseFloat(z)/q}if(c){if(a.indexOf(this.G,
b[0])!=b[0])return NaN;b[0]+=this.G.length}else if(d){if(a.indexOf(this.F,b[0])!=b[0])return NaN;b[0]+=this.F.length}return d?-e:e};
Vt.prototype.format=function(a){if(isNaN(a))return Tt.Xp;var b=[];var c=Xt;a=Yt(a,-c.Br);var d=0>a||0==a&&0>1/a;d?c.un?b.push(c.un):(b.push(c.prefix),b.push(this.l)):(b.push(c.prefix),b.push(this.u));if(isFinite(a))if(a=a*(d?-1:1)*this.g,this.M)if(0==a)Zt(this,a,this.h,b),$t(this,0,b);else{var e=Math.floor(Math.log(a)/Math.log(10)+2E-15);a=Yt(a,-e);var f=this.h;1<this.D&&this.D>this.h?(f=e%this.D,0>f&&(f=this.D+f),a=Yt(a,f),e-=f,f=1):1>this.h?(e++,a=Yt(a,-1)):(e-=this.h-1,a=Yt(a,this.h-1));Zt(this,
a,f,b);$t(this,e,b)}else Zt(this,a,this.h,b);else b.push(Tt.ui);d?c.vn?b.push(c.vn):(b.push(c.Xo),b.push(this.F)):(b.push(c.Xo),b.push(this.G));return b.join("")};
var Zt=function(a,b,c,d){if(a.m>a.j)throw Error("Min value must be less than max value");d||(d=[]);var e=Yt(b,a.j);e=Math.round(e);if(isFinite(e)){b=Math.floor(Yt(e,-a.j));var f=Math.floor(e-Yt(b,a.j))}else f=0;e=b;b=f;var g=e;f=b;var h=0<a.m||0<f||!1;e=a.m;h&&(e=a.m);var m="";for(b=g;1E20<b;)m="0"+m,b=Math.round(Yt(b,-1));m=b+m;var q=Tt.jl;b=Tt.zi.charCodeAt(0);var r=m.length,u=0;if(0<g||0<c){for(g=r;g<c;g++)d.push(String.fromCharCode(b));if(2<=a.C.length)for(c=1;c<a.C.length;c++)u+=a.C[c];c=r-u;
if(0<c){g=a.C;u=r=0;for(var A,z=Tt.ti,H=m.length,O=0;O<H;O++)if(d.push(String.fromCharCode(b+1*Number(m.charAt(O)))),1<H-O)if(A=g[u],O<c){var za=c-O;(1===A||0<A&&1===za%A)&&d.push(z)}else u<g.length&&(O===c?u+=1:A===O-c-r+1&&(d.push(z),r+=A,u+=1))}else{c=m;m=a.C;g=Tt.ti;A=c.length;z=[];for(r=m.length-1;0<=r&&0<A;r--){u=m[r];for(H=0;H<u&&0<=A-H-1;H++)z.push(String.fromCharCode(b+1*Number(c.charAt(A-H-1))));A-=u;0<A&&z.push(g)}d.push.apply(d,z.reverse())}}else h||d.push(String.fromCharCode(b));(a.J||
h)&&d.push(q);h=String(f);f=h.split("e+");if(2==f.length){if(h=parseFloat(f[0])){q=h;if(isFinite(q)){for(c=0;1<=(q/=10);)c++;q=c}else q=0<q?q:0;q=0-q-1;h=-1>q?h&&isFinite(h)?Yt(Math.round(Yt(h,-1)),1):h:h&&isFinite(h)?Yt(Math.round(Yt(h,q)),-q):h}h=String(h);h=h.replace(".","");h+=ve("0",parseInt(f[1],10)-h.length+1)}a.j+1>h.length&&(h="1"+ve("0",a.j-h.length)+h);for(a=h.length;"0"==h.charAt(a-1)&&a>e+1;)a--;for(g=1;g<a;g++)d.push(String.fromCharCode(b+1*Number(h.charAt(g))))},$t=function(a,b,c){c.push(Tt.ml);
0>b?(b=-b,c.push(Tt.sl)):a.L&&c.push(Tt.cq);b=""+b;for(var d=Tt.zi,e=b.length;e<a.H;e++)c.push(d);c.push(b)},Wt=function(a){a=a.charCodeAt(0);if(48<=a&&58>a)return a-48;var b=Tt.zi.charCodeAt(0);return b<=a&&a<b+10?a-b:-1},Ut=function(a,b,c){for(var d="",e=!1,f=b.length;c[0]<f;c[0]++){var g=b.charAt(c[0]);if("'"==g)c[0]+1<f&&"'"==b.charAt(c[0]+1)?(c[0]++,d+="'"):e=!e;else if(e)d+=g;else switch(g){case "#":case "0":case ",":case ".":case ";":return d;case "\u00a4":c[0]+1<f&&"\u00a4"==b.charAt(c[0]+
1)?(c[0]++,d+=Tt.kl):(g=Tt.kl,d+=g in Rt?Rt[g][1]:g);break;case "%":if(!a.o&&1!=a.g)throw Error("Too many percent/permill");if(a.o&&100!=a.g)throw Error("Inconsistent use of percent/permill characters");a.g=100;a.o=!1;d+=Tt.xl;break;case "\u2030":if(!a.o&&1!=a.g)throw Error("Too many percent/permill");if(a.o&&1E3!=a.g)throw Error("Inconsistent use of percent/permill characters");a.g=1E3;a.o=!1;d+=Tt.yl;break;default:d+=g}}return d},Xt={Br:0,un:"",vn:"",prefix:"",Xo:""},Yt=function(a,b){if(!a||!isFinite(a)||
0==b)return a;a=String(a).split("e");return parseFloat(a[0]+"e"+(parseInt(a[1]||0,10)+b))};var au=function(a){return 1==a%10&&11!=a%100?"one":2==a%10&&12!=a%100?"two":3==a%10&&13!=a%100?"few":"other"},bu=au;bu=au;var cu=function(a,b){if(void 0===b){b=a+"";var c=b.indexOf(".");b=Math.min(-1==c?0:b.length-c-1,3)}return 1==(a|0)&&0==b?"one":"other"},du=cu;du=cu;var iu=function(){this.l=eu;this.h=this.g=this.C=null;var a=Tt,b=Qt;if(fu!==a||gu!==b)fu=a,gu=b,hu=new Vt;this.m=hu},fu=null,gu=null,hu=null,ju=/'([{}#].*?)'/g,ku=/''/g;iu.prototype.format=function(a){if(this.l){this.C=[];var b=lu(this,this.l);this.h=mu(this,b);this.l=null}if(this.h&&0!=this.h.length)for(this.g=cc(this.C),b=[],nu(this,this.h,a,!1,b),a=b.join("");0<this.g.length;)a=a.replace(this.j(this.g),this.g.pop());else a="";return a};
var nu=function(a,b,c,d,e){for(var f=0;f<b.length;f++)switch(b[f].type){case 4:e.push(b[f].value);break;case 3:var g=b[f].value,h=a,m=e,q=c[g];void 0===q?m.push("Undefined parameter - "+g):(h.g.push(q),m.push(h.j(h.g)));break;case 2:g=b[f].value;h=a;m=c;q=d;var r=e,u=g.sh;void 0===m[u]?r.push("Undefined parameter - "+u):(u=g[m[u]],void 0===u&&(u=g.other),nu(h,u,m,q,r));break;case 0:g=b[f].value;ou(a,g,c,du,d,e);break;case 1:g=b[f].value;ou(a,g,c,bu,d,e);break;default:Eb("Unrecognized block type: "+
b[f].type)}},ou=function(a,b,c,d,e,f){var g=b.sh,h=b.Sl,m=+c[g];isNaN(m)?f.push("Undefined or invalid parameter - "+g):(h=m-h,g=b[c[g]],void 0===g&&(d=d(Math.abs(h)),g=b[d],void 0===g&&(g=b.other)),b=[],nu(a,g,c,e,b),c=b.join(""),e?f.push(c):(a=a.m.format(h),f.push(c.replace(/#/g,a))))},lu=function(a,b){var c=a.C,d=x(a.j,a);b=b.replace(ku,function(){c.push("'");return d(c)});return b=b.replace(ju,function(e,f){c.push(f);return d(c)})},pu=function(a){var b=0,c=[],d=[],e=/[{}]/g;e.lastIndex=0;for(var f;f=
e.exec(a);){var g=f.index;"}"==f[0]?(c.pop(),0==c.length&&(f={type:1},f.value=a.substring(b,g),d.push(f),b=g+1)):(0==c.length&&(b=a.substring(b,g),""!=b&&d.push({type:0,value:b}),b=g+1),c.push("{"))}b=a.substring(b);""!=b&&d.push({type:0,value:b});return d},qu=/^\s*(\w+)\s*,\s*plural\s*,(?:\s*offset:(\d+))?/,ru=/^\s*(\w+)\s*,\s*selectordinal\s*,/,su=/^\s*(\w+)\s*,\s*select\s*,/,mu=function(a,b){var c=[];b=pu(b);for(var d=0;d<b.length;d++){var e={};if(0==b[d].type)e.type=4,e.value=b[d].value;else if(1==
b[d].type){var f=b[d].value;switch(qu.test(f)?0:ru.test(f)?1:su.test(f)?2:/^\s*\w+\s*/.test(f)?3:5){case 2:e.type=2;e.value=tu(a,b[d].value);break;case 0:e.type=0;e.value=uu(a,b[d].value);break;case 1:e.type=1;e.value=vu(a,b[d].value);break;case 3:e.type=3;e.value=b[d].value;break;default:Eb("Unknown block type for pattern: "+b[d].value)}}else Eb("Unknown part of the pattern.");c.push(e)}return c},tu=function(a,b){var c="";b=b.replace(su,function(h,m){c=m;return""});var d={};d.sh=c;b=pu(b);for(var e=
0;e<b.length;){var f=b[e].value;e++;var g;1==b[e].type?g=mu(a,b[e].value):Eb("Expected block type.");d[f.replace(/\s/g,"")]=g;e++}return d},uu=function(a,b){var c="",d=0;b=b.replace(qu,function(m,q,r){c=q;r&&(d=parseInt(r,10));return""});var e={};e.sh=c;e.Sl=d;b=pu(b);for(var f=0;f<b.length;){var g=b[f].value;f++;var h;1==b[f].type?h=mu(a,b[f].value):Eb("Expected block type.");e[g.replace(/\s*(?:=)?(\w+)\s*/,"$1")]=h;f++}return e},vu=function(a,b){var c="";b=b.replace(ru,function(h,m){c=m;return""});
var d={};d.sh=c;d.Sl=0;b=pu(b);for(var e=0;e<b.length;){var f=b[e].value;e++;if(1==b[e].type)var g=mu(a,b[e].value);else Eb("Expected block type.");d[f.replace(/\s*(?:=)?(\w+)\s*/,"$1")]=g;e++}return d};iu.prototype.j=function(a){return"\ufddf_"+(a.length-1).toString(10)+"_"};var wu=chrome.i18n.getMessage("1522140683318860351"),xu=chrome.i18n.getMessage("4246483347873264186"),yu=chrome.i18n.getMessage("5991427458288444010"),Bi=chrome.i18n.getMessage("6063910461797960050"),zu=chrome.i18n.getMessage("7735695102441495789"),Au=chrome.i18n.getMessage("4575332923598659024"),eu=chrome.i18n.getMessage("2297080986956220930"),Bu=new iu;var Cu=function(a){this.g=a;this.s=$a("mr.cloud.mesi.MesiService")},ys=function(a){var b=gs(Xr.g,["hangouts","search"]);a.s.info("Retrieving Hangouts from MESI: "+b);return hs(a.g,b,"POST",Du).then(function(c){var d=[];c.result&&(d=c.result.map(function(e){var f=e.hangout,g=f.meeting_room_name,h;f.meeting_domain?h=f.meeting_domain:"BUSINESS"==f.type&&f.company_title&&(h=f.company_title.toLowerCase());var m=Bu.format({ORGANIZER:"",PARTICIPANTS:0});if((e=e.participant)&&0<e.length){var q=e[0].display_name;
m=e.reduce(function(r,u){r.add(u.user_id);"ORGANIZER"==u.role&&(q=u.display_name);return r},new Set);m=Bu.format({ORGANIZER:q,PARTICIPANTS:m.size})}return g&&h?new Zr(!1,g+"@"+h,h,g,m,f.hangout_id):new Zr(!1,f.hangout_id,h,g,m,f.hangout_id)}));return d})},Du={request_header:{client_version:{client_id:"39"}},search_sources:["0"]};var Eu=function(a,b){this.h=a;this.g=b},Hu=function(a,b,c,d){switch(b.type){case "REFRESH_AUTH":var e=d.Fd,f=d.deviceId,g=d.Vg;return Nt(a.h).then(function(){Fu(a.g,new Oj("AUTH_READY",{Fd:e,hb:f,Vg:g}),c.id)});case "STATUS_REQUEST":return Fu(a.g,b,c.id),Promise.resolve();case "STATUS_RESPONSE":return Fu(a.g,b,c.id,!0),b.data.routeDescription||Fu(a.g,b,c.id),Promise.resolve();case "HANGOUT_INACTIVE":return Gu(a.g,c,4,Ei(new Ai(zu,"warning"),c.sinkId));case "HANGOUT_INVALID":return Gu(a.g,c,3,Ei(new Ai(Au,
"warning"),c.sinkId));default:return Promise.reject(Error("Unknown type: "+b.type))}};var Iu=function(a){var b=a.method,c=a.uri,d=a.Hc,e=a.Mc,f=a.bo,g=a.headers,h=a.body,m=a.start,q=a.apiKey,r=a.Xe;a=a.mb;this.method=b&&b.toUpperCase()||"GET";(b=c)||(d=[d].concat(p(e||[])).join("/"),d=new dr(encodeURI(d)),f&&(f=ur(f),gr(d,f)),b=d);this.uri=b;q&&this.uri.h.add("key",q);this.g=a||null;this.headers=g||{};(this.body=h)&&(this.headers["Content-Type"]="application/json");this.Xe=void 0!==r?r:1E4;this.start=m||Va()},Ju=function(a){return(a.g?a.g.getAuthToken():Promise.resolve(null)).then(function(b){b&&
(a.headers.Authorization="Bearer "+b);b={method:a.method,headers:a.headers};a.body&&(b.body=JSON.stringify(a.body));return new Request(a.uri.toString(),b)})};var Ku={Wz:100,OI:101,OK:200,Xz:201,ACCEPTED:202,AE:203,OE:204,AG:205,lF:206,mE:207,lE:300,iE:301,WA:302,MH:303,KE:304,nK:305,ZI:307,xF:308,tp:400,TJ:401,bq:402,VA:403,NOT_FOUND:404,YD:405,DE:406,MF:407,yG:408,Kz:409,xB:410,XC:411,FF:412,vG:413,zG:414,bK:415,xG:416,xA:417,ZJ:422,fD:423,zA:424,GF:428,CJ:429,wG:431,Rp:500,HE:501,Nx:502,ZH:503,kB:504,cC:505,sC:507,sE:511,VF:1223};var Lu=function(a,b){Ab.call(this,b&&b.message||a.statusText);this.code=a.status;this.response=a;this.status=(this.g=b)&&b.status};t(Lu,Ab);var Pu=function(a){if(Mu.has(a.code))return!0;var b=a.g||{};return a.g?Nu.has(b.status)?!0:!!(b.errors||[]).find(function(c){return Ou.has(c)}):!1},Qu=function(a,b){a=new Response(void 0,{status:b||408,statusText:a});return new Lu(a)},Mu=new Set([400,401,403,404,405,406,501]),Nu=new Set(["PERMISSION_DENIED"]),Ou=new Set("authError command_is_in_terminal_state forbidden notFound unmanaged_group_acl acl_entry_bad_scope network_error".split(" "));var Ru=function(a){this.id=a};Ru.prototype.toString=function(){return this.id};var U=function(a,b){this.type=a instanceof Ru?String(a):a;this.h=this.target=b;this.defaultPrevented=!1};U.prototype.l=function(){this.defaultPrevented=!0};var Su=!Ke||9<=Number(gf),Tu=Ke&&!df("9"),Uu=function(){if(!w.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});try{w.addEventListener("test",Ia,b),w.removeEventListener("test",Ia,b)}catch(c){}return a}();var Vu=function(a,b){U.call(this,a?a.type:"");this.relatedTarget=this.h=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key="";this.keyCode=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.state=null;this.pointerId=0;this.pointerType="";this.g=null;a&&this.init(a,b)};B(Vu,U);var Wu=If({2:"touch",3:"pen",4:"mouse"});
Vu.prototype.init=function(a,b){var c=this.type=a.type,d=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.h=b;(b=a.relatedTarget)?Me&&(Fe(b,"nodeName")||(b=null)):"mouseover"==c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;d?(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0):(this.clientX=void 0!==a.clientX?a.clientX:
a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0);this.button=a.button;this.keyCode=a.keyCode||0;this.key=a.key||"";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.pointerId=a.pointerId||0;this.pointerType="string"===typeof a.pointerType?a.pointerType:Wu[a.pointerType]||"";this.state=a.state;this.g=a;a.defaultPrevented&&this.l()};
Vu.prototype.l=function(){Vu.Db.l.call(this);var a=this.g;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Tu)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Xu="closure_listenable_"+(1E6*Math.random()|0),Yu=function(a){return!(!a||!a[Xu])},Zu=0;var $u=function(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.Wc=e;this.key=++Zu;this.removed=this.uh=!1},av=function(a){a.removed=!0;a.listener=null;a.proxy=null;a.src=null;a.Wc=null};var bv=function(a){this.src=a;this.g={};this.h=0};bv.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.g[f];a||(a=this.g[f]=[],this.h++);var g=cv(a,b,d,e);-1<g?(b=a[g],c||(b.uh=!1)):(b=new $u(b,this.src,f,!!d,e),b.uh=c,a.push(b));return b};bv.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.g))return!1;var e=this.g[a];b=cv(e,b,c,d);return-1<b?(av(e[b]),Yb(e,b),0==e.length&&(delete this.g[a],this.h--),!0):!1};
var dv=function(a,b){var c=b.type;if(!(c in a.g))return!1;var d=Zb(a.g[c],b);d&&(av(b),0==a.g[c].length&&(delete a.g[c],a.h--));return d};bv.prototype.removeAll=function(a){a=a&&a.toString();var b=0,c;for(c in this.g)if(!a||c==a){for(var d=this.g[c],e=0;e<d.length;e++)++b,av(d[e]);delete this.g[c];this.h--}return b};var ev=function(a,b,c,d,e){a=a.g[b.toString()];b=-1;a&&(b=cv(a,c,d,e));return-1<b?a[b]:null};
bv.prototype.hasListener=function(a,b){var c=void 0!==a,d=c?a.toString():"",e=void 0!==b;return zc(this.g,function(f){for(var g=0;g<f.length;++g)if(!(c&&f[g].type!=d||e&&f[g].capture!=b))return!0;return!1})};var cv=function(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.removed&&f.listener==b&&f.capture==!!c&&f.Wc==d)return e}return-1};var fv="closure_lm_"+(1E6*Math.random()|0),gv={},hv=0,jv=function(a,b,c,d,e){if(d&&d.once)return iv(a,b,c,d,e);if(Array.isArray(b)){for(var f=0;f<b.length;f++)jv(a,b[f],c,d,e);return null}c=kv(c);return Yu(a)?a.listen(b,c,Na(d)?!!d.capture:!!d,e):lv(a,b,c,!1,d,e)},lv=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=Na(e)?!!e.capture:!!e,h=mv(a);h||(a[fv]=h=new bv(a));c=h.add(b,c,d,g,f);if(c.proxy)return c;d=nv();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)Uu||(e=g),void 0===
e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(ov(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");hv++;return c},nv=function(){var a=pv,b=Su?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b},iv=function(a,b,c,d,e){if(Array.isArray(b)){for(var f=0;f<b.length;f++)iv(a,b[f],c,d,e);return null}c=kv(c);return Yu(a)?
qv(a,b,c,Na(d)?!!d.capture:!!d,e):lv(a,b,c,!0,d,e)},rv=function(a,b,c,d,e){if(Array.isArray(b))for(var f=0;f<b.length;f++)rv(a,b[f],c,d,e);else d=Na(d)?!!d.capture:!!d,c=kv(c),Yu(a)?a.M.remove(String(b),c,d,e):a&&(a=mv(a))&&(b=ev(a,b,c,d,e))&&sv(b)},sv=function(a){if("number"===typeof a||!a||a.removed)return!1;var b=a.src;if(Yu(b))return dv(b.M,a);var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(ov(c),d):b.addListener&&b.removeListener&&
b.removeListener(d);hv--;(c=mv(b))?(dv(c,a),0==c.h&&(c.src=null,b[fv]=null)):av(a);return!0},tv=function(a){if(a)if(Yu(a))a.vk(void 0);else if(a=mv(a)){var b=0,c;for(c in a.g)for(var d=a.g[c].concat(),e=0;e<d.length;++e)sv(d[e])&&++b}},ov=function(a){return a in gv?gv[a]:gv[a]="on"+a},vv=function(a,b,c,d){var e=!0;if(a=mv(a))if(b=a.g[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.removed&&(f=uv(f,d),e=e&&!1!==f)}return e},uv=function(a,b){var c=a.listener,d=a.Wc||
a.src;a.uh&&sv(a);return c.call(d,b)},pv=function(a,b){if(a.removed)return!0;if(!Su){var c=b||Ha("window.event");b=new Vu(c,this);var d=!0;if(!(0>c.keyCode||void 0!=c.returnValue)){a:{var e=!1;if(0==c.keyCode)try{c.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==c.returnValue)c.returnValue=!0}c=[];for(e=b.h;e;e=e.parentNode)c.push(e);a=a.type;for(e=c.length-1;0<=e;e--){b.h=c[e];var f=vv(c[e],a,!0,b);d=d&&f}for(e=0;e<c.length;e++)b.h=c[e],f=vv(c[e],a,!1,b),d=d&&f}return d}return uv(a,new Vu(b,this))},
mv=function(a){a=a[fv];return a instanceof bv?a:null},wv="__closure_events_fn_"+(1E9*Math.random()>>>0),kv=function(a){if(Ma(a))return a;a[wv]||(a[wv]=function(b){return a.handleEvent(b)});return a[wv]};var xv=function(){T.call(this);this.M=new bv(this);this.ih=this;this.F=null};B(xv,T);xv.prototype[Xu]=!0;k=xv.prototype;k.addEventListener=function(a,b,c,d){jv(this,a,b,c,d)};k.removeEventListener=function(a,b,c,d){rv(this,a,b,c,d)};
k.N=function(a){var b,c=this.F;if(c)for(b=[];c;c=c.F)b.push(c);c=this.ih;var d=a.type||a;if("string"===typeof a)a=new U(a,c);else if(a instanceof U)a.target=a.target||c;else{var e=a;a=new U(d,c);Mc(a,e)}e=!0;if(b)for(var f=b.length-1;0<=f;f--){var g=a.h=b[f];e=g.pf(d,!0,a)&&e}g=a.h=c;e=g.pf(d,!0,a)&&e;e=g.pf(d,!1,a)&&e;if(b)for(f=0;f<b.length;f++)g=a.h=b[f],e=g.pf(d,!1,a)&&e;return e};k.ba=function(){xv.Db.ba.call(this);this.vk();this.F=null};
k.listen=function(a,b,c,d){return this.M.add(String(a),b,!1,c,d)};var qv=function(a,b,c,d,e){return a.M.add(String(b),c,!0,d,e)};xv.prototype.vk=function(a){this.M&&this.M.removeAll(a)};xv.prototype.pf=function(a,b,c){a=this.M.g[String(a)];if(!a)return!0;a=a.concat();for(var d=!0,e=0;e<a.length;++e){var f=a[e];if(f&&!f.removed&&f.capture==b){var g=f.listener,h=f.Wc||f.src;f.uh&&dv(this.M,f);d=!1!==g.call(h,c)&&d}}return d&&!c.defaultPrevented};
xv.prototype.hasListener=function(a,b){return this.M.hasListener(void 0!==a?String(a):void 0,b)};var yv=function(a,b){xv.call(this);this.j=a||1;this.h=b||w;this.l=x(this.o,this);this.m=Va()};B(yv,xv);yv.prototype.enabled=!1;yv.prototype.g=null;var zv=function(a,b){a.j=b;a.g&&a.enabled?(a.stop(),a.start()):a.g&&a.stop()};yv.prototype.o=function(){if(this.enabled){var a=Va()-this.m;0<a&&a<.8*this.j?this.g=this.h.setTimeout(this.l,this.j-a):(this.g&&(this.h.clearTimeout(this.g),this.g=null),this.N("tick"),this.enabled&&(this.stop(),this.start()))}};
yv.prototype.start=function(){this.enabled=!0;this.g||(this.g=this.h.setTimeout(this.l,this.j),this.m=Va())};yv.prototype.stop=function(){this.enabled=!1;this.g&&(this.h.clearTimeout(this.g),this.g=null)};yv.prototype.ba=function(){yv.Db.ba.call(this);this.stop();delete this.h};
var Av=function(a,b,c){if(Ma(a))c&&(a=x(a,c));else if(a&&"function"==typeof a.handleEvent)a=x(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:w.setTimeout(a,b||0)},Bv=function(a){w.clearTimeout(a)},Cv=function(a,b){var c=null;return nt(new Ys(function(d,e){c=Av(function(){d(b)},a);-1==c&&e(Error("Failed to schedule timer."))}),function(d){Bv(c);throw d;})};var Dv=function(){var a=void 0===a?!0:a;this.s=Zf("mr.cloud.slarti.Fetcher");this.g=0;this.h=a};Dv.prototype.execute=function(a){var b=this,c="Fetch call "+ ++this.g,d=new pf(function(){return Ev(b,c,a,function(e){return d.abort(e)})},1E3,this.h?5:1);return d.start()};
var Ev=function(a,b,c,d){var e=c.uri.toString().replace(/\?.*/,"?<redacted>"),f=c.method+" "+e;D(a.s,b+": "+f);e=[Ju(c).then(function(g){return Promise.resolve(fetch(g))})];c.Xe&&e.push(Cv(c.Xe).then(function(){throw Qu("API call timed out",504);}));return Promise.race(e).then(function(g){if(!g.ok)return g.json().then(function(m){return m},function(){return null}).then(function(m){var q;m&&m instanceof Object&&m.error&&(q=m.error);throw new Lu(g,q);});var h=(Va()-c.start)/1E3;D(a.s,b+" succeeded: "+
f+" duration = "+h+"s");return(h=g.headers.get("content-type"))&&h.includes("application/json")?g.json():h&&(h.includes("image")||h.includes("application/octet-stream"))?g.blob():g.text()},function(g){var h="";if(g instanceof Lu)h=", ("+g.status+"): "+g.message,Pu(g)&&d(g);else{try{h=", "+JSON.stringify(g,null,2)}catch(m){}g instanceof Error&&"Failed to fetch"==g.message&&(g=Qu(g.message))}ag(a.s,b+" failed: "+h);throw g;})};var Fv=function(a,b){this.g=Vr.g;this.mb=a;this.h=b};var Gv=new Map([["status","status"],["results","result"],["expirationTime","expiration_time"]]),Hv=function(a,b){Fv.call(this,a,b);this.s=Zf("mr.cloud.slarti.CommandsService")};t(Hv,Fv);Hv.prototype.get=function(a){a=new Iu({method:"GET",Hc:this.g,Mc:["commands",a],mb:this.mb});return this.h.execute(a).then(function(b){return b})};
Hv.prototype.list=function(a){a=new Iu({method:"GET",Hc:this.g,Mc:["commands"],bo:{deviceId:a},mb:this.mb});return this.h.execute(a).then(function(b){return b.command||[]})};Hv.prototype.send=function(a,b){var c=this;a=new Iu({method:"POST",Hc:this.g,Mc:["commands:send"],mb:this.mb,body:{command:b,deviceId:a}});return this.h.execute(a).then(function(d){c.s.info("Sent Slarti command with ID "+d.id);return d})};
Hv.prototype.update=function(a,b){for(var c=[],d={},e=n(Gv.keys()),f=e.next();!f.done;f=e.next())f=f.value,b[f]&&(d[f]=b[f],c.push(Gv.get(f)));d.id=a;a=new Iu({method:"PUT",Hc:this.g,Mc:["commands",a],mb:this.mb,body:{command:d,updateMask:c}});return this.h.execute(a).then(function(g){return g})};var Iv=w.JSON.parse;var Jv=function(){};Jv.prototype.g=null;var Lv=function(a){var b;(b=a.g)||(b={},Kv(a)&&(b[0]=!0,b[1]=!0),b=a.g=b);return b};var Mv,Nv=function(){};B(Nv,Jv);var Ov=function(a){return(a=Kv(a))?new ActiveXObject(a):new XMLHttpRequest},Kv=function(a){if(!a.h&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.h=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.h};Mv=new Nv;var Pv=function(a){xv.call(this);this.headers=new Om;this.X=a||null;this.h=!1;this.V=this.g=null;this.pa=this.J="";this.m=0;this.j="";this.l=this.na=this.H=this.ga=!1;this.o=0;this.D=null;this.u="";this.L=this.G=!1};B(Pv,xv);Pv.prototype.s=Zf("goog.net.XhrIo");var Qv=/^https?$/i,Rv=["POST","PUT"],Sv=[],Tv=function(a,b,c,d,e,f,g){var h=new Pv;Sv.push(h);b&&h.listen("complete",b);qv(h,"ready",h.ta);f&&(h.o=Math.max(0,f));g&&(h.G=g);h.send(a,c,d,e);return h};
Pv.prototype.ta=function(){this.dispose();Zb(Sv,this)};
Pv.prototype.send=function(a,b,c,d){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.J+"; newUri="+a);b=b?b.toUpperCase():"GET";this.J=a;this.j="";this.m=0;this.pa=b;this.ga=!1;this.h=!0;this.g=this.X?Ov(this.X):Ov(Mv);this.V=this.X?Lv(this.X):Lv(Mv);this.g.onreadystatechange=x(this.ua,this);try{bg(this.s,Uv(this,"Opening Xhr")),this.na=!0,this.g.open(b,String(a),!0),this.na=!1}catch(f){bg(this.s,Uv(this,"Error opening Xhr: "+f.message));Vv(this,f);return}a=c||
"";var e=this.headers.clone();d&&Hn(d,function(f,g){e.set(g,f)});d=Rb(e.Pb(),Wv);c=w.FormData&&a instanceof w.FormData;!Tb(Rv,b)||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(f,g){this.g.setRequestHeader(g,f)},this);this.u&&(this.g.responseType=this.u);"withCredentials"in this.g&&this.g.withCredentials!==this.G&&(this.g.withCredentials=this.G);try{Xv(this),0<this.o&&(this.L=Yv(this.g),bg(this.s,Uv(this,"Will abort after "+this.o+"ms if incomplete, xhr2 "+
this.L)),this.L?(this.g.timeout=this.o,this.g.ontimeout=x(this.Zg,this)):this.D=Av(this.Zg,this.o,this)),bg(this.s,Uv(this,"Sending request")),this.H=!0,this.g.send(a),this.H=!1}catch(f){bg(this.s,Uv(this,"Send error: "+f.message)),Vv(this,f)}};var Yv=function(a){return Ke&&df(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},Wv=function(a){return kd("Content-Type",a)};
Pv.prototype.Zg=function(){"undefined"!=typeof Ca&&this.g&&(this.j="Timed out after "+this.o+"ms, aborting",this.m=8,bg(this.s,Uv(this,this.j)),this.N("timeout"),this.abort(8))};var Vv=function(a,b){a.h=!1;a.g&&(a.l=!0,a.g.abort(),a.l=!1);a.j=b;a.m=5;Zv(a);$v(a)},Zv=function(a){a.ga||(a.ga=!0,a.N("complete"),a.N("error"))};Pv.prototype.abort=function(a){this.g&&this.h&&(bg(this.s,Uv(this,"Aborting")),this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=a||7,this.N("complete"),this.N("abort"),$v(this))};
Pv.prototype.ba=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),$v(this,!0));Pv.Db.ba.call(this)};Pv.prototype.ua=function(){this.C()||(this.na||this.H||this.l?aw(this):this.xa())};Pv.prototype.xa=function(){aw(this)};
var aw=function(a){if(a.h&&"undefined"!=typeof Ca)if(a.V[1]&&4==bw(a)&&2==a.Ja())bg(a.s,Uv(a,"Local request error detected and ignored"));else if(a.H&&4==bw(a))Av(a.ua,0,a);else if(a.N("readystatechange"),4==bw(a)){bg(a.s,Uv(a,"Request complete"));a.h=!1;try{cw(a)?(a.N("complete"),a.N("success")):(a.m=6,a.j=dw(a)+" ["+a.Ja()+"]",Zv(a))}finally{$v(a)}}},$v=function(a,b){if(a.g){Xv(a);var c=a.g,d=a.V[0]?Ia:null;a.g=null;a.V=null;b||a.N("ready");try{c.onreadystatechange=d}catch(e){ag(a.s,"Problem encountered resetting onreadystatechange: "+
e.message)}}},Xv=function(a){a.g&&a.L&&(a.g.ontimeout=null);a.D&&(Bv(a.D),a.D=null)},cw=function(a){var b=a.Ja();a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break a;default:c=!1}if(!c){if(b=0===b)a=String(a.J).match(Uq)[1]||null,!a&&w.self&&w.self.location&&(a=w.self.location.protocol,a=a.substr(0,a.length-1)),b=!Qv.test(a?a.toLowerCase():"");c=b}return c},bw=function(a){return a.g?a.g.readyState:0};
Pv.prototype.Ja=function(){try{return 2<bw(this)?this.g.status:-1}catch(a){return-1}};
var dw=function(a){try{return 2<bw(a)?a.g.statusText:""}catch(b){return bg(a.s,"Can not get status: "+b.message),""}},ew=function(a){try{return a.g?a.g.responseText:""}catch(b){return bg(a.s,"Can not get responseText: "+b.message),""}},fw=function(a){if(a.g)return Iv(a.g.responseText)},gw=function(a){try{if(!a.g)return null;if("response"in a.g)return a.g.response;switch(a.u){case "":case "text":return a.g.responseText;case "arraybuffer":if("mozResponseArrayBuffer"in a.g)return a.g.mozResponseArrayBuffer}ag(a.s,
"Response type "+a.u+" is not supported on this browser");return null}catch(b){return bg(a.s,"Can not get response: "+b.message),null}};Pv.prototype.getResponseHeader=function(a){if(this.g&&4==bw(this))return a=this.g.getResponseHeader(a),null===a?void 0:a};
var hw=function(a){var b={};a=(a.g&&4==bw(a)?a.g.getAllResponseHeaders()||"":"").split("\r\n");for(var c=0;c<a.length;c++)if(!ld(a[c])){var d=Ae(a[c],":",1),e=d[0];d=d[1];if("string"===typeof d){d=d.trim();var f=b[e]||[];b[e]=f;f.push(d)}}return yc(b,function(g){return g.join(", ")})},Uv=function(a,b){return b+" ["+a.pa+" "+a.J+" "+a.Ja()+"]"};var iw=function(){this.s=$a("mr.cloud.CredentialService")},lw=function(a){var b=new zb,c=Yr.g+"/iceconfig?key="+Yr.h;a.s.info("Requesting TURN credentials from "+c);var d=Tv(c,function(){cw(d)?(a.s.info("Got TURN credentials: "+ew(d)),b.resolve(jw(a,fw(d)))):b.resolve(kw(a))},"POST",void 0,{"Content-Type":"application/json"});return b.g},jw=function(a,b){try{var c=[];b.iceServers.forEach(function(d){d.urls.forEach(function(e){0==e.indexOf("turn:")&&c.push({url:e,credential:d.credential,username:d.username})})});
return c}catch(d){return a.s.error("Error parsing TURN credentials.",d),[]}},kw=function(a){a.s.error("XHR failed fetching TURN credentials.",null);return[]};var mw=function(a,b,c){this.s=$a("mr.cloud.slarti.MessageHandler");this.j=a;this.l=b;this.g=c;this.h=new Map},nw=function(a){if(tj(a.mediaSource))return Promise.resolve({title:"screen"});var b=a.sb&&a.sb.tabId;return null==b?Promise.resolve({title:"",url:""}):new Promise(function(c){chrome.tabs.get(b,function(d){c({title:d&&d.title||"",url:d&&d.url||""})})})},ow=function(a,b,c,d){var e=d.deviceId,f=b.data;return nw(c).then(function(g){g={id:null,issuer:null,name:"stream",status:null,results:null,
expirationTime:null,parameters:JSON.stringify({info:g,sessionDescription:f.description,mediaConstraints:f.mediaConstraints,settings:f.settings})};return a.j.send(e,g).then(function(h){return new Promise(function(m,q){a.h.set(h.id,{routeId:c.id,sinkId:d.id,resolve:m,reject:q,Jt:"PENDING_APPROVAL"==h.status})})},function(){var h=a.g,m=c.id,q=new Ai(wu,"warning");q.isBlocking=!0;Gu(h,m,7,Ei(Di(q,c.id),d.id))})})},pw=function(a,b){return lw(a.l).then(function(c){Fu(a.g,new Oj("TURN_CREDENTIALS",{credentials:c}),
b.id)})};var qw=function(a,b,c){this.h=a;this.j=b;this.g=c},rw=function(a,b,c,d,e){return new Promise(function(f){switch(b){case "slarti":case "mesi":break;default:throw Error("Unrecognized channel type: "+b);}if(!c.type)throw Error("Message has no type");switch(c.type){case "STOP":f(Gu(a.g,d,1,null));return;case "SESSION_START_SUCCESS":Sr(0);break;case "SESSION_END":break;case "SESSION_FAILURE":Sr(1);f(Gu(a.g,d,2,Ei(new Ai(wu,"warning"),d?d.sinkId:"")));return;case "__webrtc_stats__":break;case "PRESENTATION_CONNECTION_MESSAGE":Fu(a.g,
c.data,d.id,!0);break;case "OFFER":switch(b){case "slarti":f(ow(a.h,c,d,e));return;default:throw Error("Unexpected channel type: "+b);}case "GET_TURN_CREDENTIALS":switch(b){case "slarti":f(pw(a.h,d));return;default:throw Error("Unexpected channel type: "+b);}case "REFRESH_AUTH":case "LOCAL_PRESENT":case "MUTE":case "STATUS_REQUEST":case "STATUS_RESPONSE":case "HANGOUT_INACTIVE":case "HANGOUT_INVALID":f(Hu(a.j,c,d,e));return;case "new_session":Fu(a.g,c,d.id,!0);break;case "remove_session":Fu(a.g,c,
d.id,!0);a.g.terminateRoute(d.id);break;default:throw Error("Unknown type: "+c.type);}f()})};var sw=function(){var a=this;this.s=$a("mr.cloud.settings.SettingsService");this.g=null;chrome.settingsPrivate.onPrefsChanged.addListener(function(b){pj(13);if(a.g){b=n(b);for(var c=b.next();!c.done;c=b.next())if(c=c.value,"media_router.cloudservices.enabled"==c.key){yb(5);a.g.call(null,c.value);break}}})},tw=function(a,b){a.g=b},uw=function(){return new Promise(function(a,b){chrome.storage.sync.get("mr.cloud.notifiedHangouts",function(c){chrome.runtime.lastError?b(chrome.runtime.lastError):a(c)})})},
ww=function(a){return vw().catch(function(){return vw().catch(function(b){a.s.K("Error retrieving cloud enabled setting.",b);return!1})})},vw=function(){return xw().then(function(a){return!!a.value})},xw=function(){return new Promise(function(a,b){chrome.settingsPrivate.getPref("media_router.cloudservices.enabled",function(c){chrome.runtime.lastError?b(chrome.runtime.lastError):a(c)})})},yw=function(a){var b=a.s;chrome.storage.sync.set({"mr.cloud.notifiedHangouts":!0},function(){chrome.runtime.lastError&&
b.K("Error setting notified Hangout privacy.",chrome.runtime.lastError)})},Aw=function(a){return zw().catch(function(){return zw().catch(function(b){a.s.K("Error retrieving hangouts notified setting.",b);return!1})})},zw=function(){return uw().then(function(a){return!!a["mr.cloud.notifiedHangouts"]})};var Bw=new Map([["displayName","display_name"],["description","description"],["type","type"],["status","status"],["state","state"],["commandDefs","command_defs"]]),Cw=function(a,b){Fv.call(this,a,b)};t(Cw,Fv);k=Cw.prototype;k.act=function(a,b){a=new Iu({method:"POST",Hc:this.g,Mc:["devices:act"],mb:this.mb,body:{gcmId:b,id:a}});return this.h.execute(a).then(function(c){return c})};k.create=function(a){a=new Iu({method:"POST",Hc:this.g,Mc:["devices"],mb:this.mb,body:a});return this.h.execute(a).then(function(b){return b})};
k.delete=function(a){a=new Iu({method:"DELETE",Hc:this.g,Mc:["devices",a],mb:this.mb});return this.h.execute(a)};k.get=function(a){a=new Iu({method:"GET",Hc:this.g,Mc:["devices",a],mb:this.mb});return this.h.execute(a).then(function(b){return b})};k.list=function(a){var b=a.type,c=a.status;a=a.permission;var d={};b&&(d.type=b);c&&(d.status=c);a&&(d.permission=a);b=new Iu({method:"GET",Hc:this.g,Mc:["devices"],bo:d,mb:this.mb});return this.h.execute(b).then(function(e){return e.device||[]})};
k.update=function(a,b){for(var c=[],d={},e=n(Bw.keys()),f=e.next();!f.done;f=e.next())f=f.value,b[f]&&(d[f]=b[f],c.push(Bw.get(f)));d.id=a;a=new Iu({method:"PUT",Hc:this.g,Mc:["devices",a],mb:this.mb,body:{device:d,updateMask:c}});return this.h.execute(a).then(function(g){return g})};var Dw=function(a,b){Fv.call(this,a,b)};t(Dw,Fv);Dw.prototype.register=function(a){a=new Iu({method:"POST",Hc:this.g,Mc:["user:register"],mb:this.mb,body:{gcmId:a}});return this.h.execute(a)};Dw.prototype.unregister=function(a){a=new Iu({method:"POST",Hc:this.g,Mc:["user:unregister"],mb:this.mb,body:{gcmId:a}});return this.h.execute(a)};var Ew=function(a){var b=window.localStorage;this.s=$a("mr.cloud.slarti.GcmRegistration");this.j=a;this.h=b;this.g=null},Gw=function(a){if(!a.g){var b=a.h["mr.cloud.slarti.GcmRegistration.ID"];a.g=new Promise(function(c,d){return chrome.gcm.register(["307539924703"],function(e){a.g=null;if(e)if(e==b)gb(a.s,"Slarti GCM ID unchanged: "+e),c();else{gb(a.s,"Got new Slarti GCM ID: "+e);var f=b?Fw(a,b):Promise.resolve();c(f.then(function(){return a.j.register(e).then(function(){a.h["mr.cloud.slarti.GcmRegistration.ID"]=
e})}))}else f=chrome.runtime.lastError&&chrome.runtime.lastError.message||"unknown error",a.s.K("Error registering for GCM notifications: "+f),b&&Fw(a,b),d(Error(f))})})}return a.g},Fw=function(a,b){return a.j.unregister(b).then(function(){delete a.h["mr.cloud.slarti.GcmRegistration.ID"]},function(c){a.s.K("Failed to unregister GCM ID with Slarti",c)})};var Hw=null,Iw=function(){Jp.call(this,5,"mr.cloud.slarti.GcmEventListener","mr.cloud.slarti.SinkDiscoveryService",chrome.gcm.onMessage);this.s=$a("mr.cloud.slarti.GcmEventListener")};t(Iw,Jp);Iw.prototype.oi=function(a){if(a&&"307539924703"==a.from&&"object"==typeof a.data&&"string"==typeof a.data.data){var b=JSON.parse(a.data.data);a=b.type;b=b.id;if(a)return this.s.info("Received Slarti GCM notification: "+a+" ("+b+")"),!0}return!1};var Jw=function(){null==Hw&&(Hw=new Iw);return Hw};var Kw=function(a,b,c,d,e,f){f=void 0===f?null:f;this.s=$a("mr.cloud.slarti.SinkDiscoveryService");this.u=a;this.C=b;this.l=c;this.o=d;this.m=e;this.g=f||new ls(this.F.bind(this),c,36E5);Jw().addListener();km(this);mj("mr.cloud.slarti.SinkDiscoveryService",this)};t(Kw,cj);Kw.prototype.j=function(){Gw(this.m).catch(function(){});return this.g.j().filter(function(a){return a.isAvailable})};Kw.prototype.h=function(a){return this.g.h(a)};
Kw.prototype.handleEvent=function(a,b){if(a!=chrome.gcm.onMessage)throw Error("Unhandled event: expected chrome.gcm.onMessage");Lw(this,b)};
var Lw=function(a,b){var c=JSON.parse(b.data.data);a.s.info("Received Slarti GCM notification: "+c.type);gb(a.s,function(){return"Got notification: "+JSON.stringify(c)});switch(c.type){case "DEVICE_ADDED":Mw(a,c).then(function(d){"cast-receiver"==d.type&&(d=new ks(d.id,d.displayName,"ONLINE"==d.status),a.g.g.set(d.id,d),ps(a.l,[d.Jb]))});break;case "DEVICE_CHANGED":Mw(a,c).then(function(d){if("cast-receiver"==d.type){var e=Dm(Cm(),d.id);if(e=a.g.h(e))e.displayName=d.displayName,e.isAvailable="ONLINE"==
d.status,qs(a.l,[e.Jb])}});break;case "DEVICE_REMOVED":Nw(a,Ow(c));Promise.resolve();break;case "COMMAND_CHANGED":Pw(a,c).then(function(d){var e=a.o,f=d.id,g=e.h.get(f);if(g){var h=g.routeId,m=g.sinkId,q=g.resolve,r=g.reject,u=g.Jt;g=!0;try{var A=JSON.parse(d.results||"{}"),z=A.sessionDescription,H=A.errorCode,O=A.errorText;switch(d.status){case "SUCCESS":q(Fu(e.g,new Oj("ANSWER",z),h));u&&Rr(0);break;case "ERROR":case "TIMEOUT":var za="TIMEOUT"==d.status;q=wu;"KNOCK_DENIED"==H&&(Rr(za?2:1),q=za?
yu:xu);var Ib=e.g,Jb=new Ai(q,"warning");Jb.isBlocking=!0;Gu(Ib,h,7,Ei(Di(Jb,h),m));throw Error("Slarti command "+f+" failed with status: "+(d.status+", errorCode: "+H+", errorText: ")+O);default:g=!1}}catch(Nj){r(Nj)}finally{g&&e.h.delete(f)}}else e.s.K("Received update to unknown command with name = "+(d.name+" and id = "+f))});break;default:Promise.resolve()}};
Kw.prototype.F=function(){return this.C.list({type:"cast-receiver"}).then(function(a){return a.map(function(b){return new ks(b.id,b.displayName,"ONLINE"==b.status)})})};Kw.prototype.Ua=function(){return"SlartiSinkDiscoveryService"};Kw.prototype.Ib=function(){return[{cache:ts(this.g)}]};Kw.prototype.Hb=function(){var a=hm(this);a&&us(this.g,a.cache)};
var Nw=function(a,b){b=Dm(Cm(),b);var c=a.g.h(b);c&&(a.g.g.delete(b),rs(a.l,[c.Jb]))},Ow=function(a){a=a.deviceInfo;return a.device?a.device.id:a.deviceId},Mw=function(a,b){b=b.deviceInfo;return b.device?Promise.resolve(b.device):a.C.get(b.deviceId)},Pw=function(a,b){b=b.commandInfo;return b.command?Promise.resolve(b.command):a.u.get(b.commandId)};var Qw=function(){this.g=null},Rw=function(a,b){if(!a.g||L(a.g,2)<L(b,2))a.g=Jl(b)},Sw=function(a){return a.g?L(a.g,2)+";"+L(a.g,1):null};var Tw=function(){this.C=this.H=this.D=this.F=this.u=this.j=this.h=this.l=this.L=this.G=this.V=this.X=this.J=this.M=this.m=this.o=this.g=null},Uw=function(){var a=Tw.Ob();null==a.C&&(a.C=new Qw);return a.C},Vw=function(a){null==a.g&&(a.g=new Lt);return a.g},Ww=function(a){null==a.o&&(a.o=new Dt(Vw(a)));return a.o},Xw=function(a){null==a.m&&(a.m=new Dv);return a.m},Yw=function(a){null==a.M&&(a.M=new Hv(Vw(a),Xw(a)));return a.M},Zw=function(a,b){if(null==a.G){var c=Yw(a);null==a.H&&(a.H=new iw(Ww(a)));
a.G=new mw(c,a.H,b)}return a.G};Ja(Tw);var cx=function(a,b){this.j=a;this.m=b;this.C=new zb;this.ia=this.C.g;this.g=$w(a.id);this.h=new zb;this.l=!1;ax(this);bx(this);this.g.sendMessage(new Oj("GET_TURN_CREDENTIALS"))};cx.prototype.start=function(){var a=this;return this.ia.then(function(b){if(b.g)return Promise.reject(Error("Presentation already started"));b.start();return a.h.g})};cx.prototype.stop=function(){var a=this;this.l=!1;return this.ia.then(function(b){b.stop();a.ia=Promise.reject(Error("Peer connection has already been stopped"))})};
var ax=function(a){a.g.onMessage=function(b){if(b.type)switch(b.type){case "TURN_CREDENTIALS":a.C.resolve(new Tj(a.j.id,b.data.credentials));break;case "ANSWER":a.ia.then(function(c){bk(c,b.data)});break;case "STOP":a.h.reject("Stop signal received");a.stop();break;default:throw Error("Unknown message type: "+b.type);}else a.ia.then(function(c){var d={type:"PRESENTATION_CONNECTION_MESSAGE",data:b};"string"==typeof d?c.l.send(d):c.l.send(JSON.stringify(d))})}},bx=function(a){a.ia.then(function(b){Xj(b,
function(c){a.g.sendMessage(new Oj("OFFER",new Qj(c,null,null,a.m,a.j.id)))});Yj(b,function(c){c=Pj(c);"STOP"==c.type&&a.stop();a.g.sendMessage(c)});Uj(b,function(){a.l=!0;a.g.sendMessage(new Oj("SESSION_START_SUCCESS"));a.h.resolve(a.j)});Wj(b,function(){a.g.sendMessage(new Oj("SESSION_END"))});Vj(b,function(c){a.l||a.h.reject(c);a.g.sendMessage(new Oj("SESSION_FAILURE"))})})};var dx=function(a){this.g=a;this.h=new Map;this.G=new Map;this.H=new Map;this.F=[];this.u=this.M=this.o=this.l=null;this.C=this.j=!1;this.D=new Map;this.m=new Map;km(this)};dx.prototype.getName=function(){return"cloud"};
dx.prototype.tn=function(){var a=this;this.s.info("Initializing Cloud MRP");var b=Tw.Ob();if(Date.now()<ex){if(null==b.V){var c=Yw(b);null==b.J&&(b.J=new Cw(Vw(b),Xw(b)));var d=b.J,e=Zw(b,this);null==b.L&&(null==b.X&&(b.X=new Dw(Vw(b),Xw(b))),b.L=new Ew(b.X));b.V=new Kw(c,d,this,e,b.L)}this.F.push(b.V);Zw(b,this)}null==b.j&&(null==b.h&&(b.h=new as(Ww(b),Vw(b))),c=b.h,null==b.l&&(b.l=new Cu(Ww(b))),b.j=new xs(c,b.l,this));this.l=b.j;this.F.push(this.l);this.o=Vw(b);null==b.F&&(c=Zw(b,this),null==b.u&&
(b.u=new Eu(Vw(b),this)),b.F=new qw(c,b.u,this));this.M=b.F;null==b.D&&(b.D=new sw);this.u=b.D;ww(this.u).then(function(f){a.j=f;a.s.info("Cloud enabled setting: "+a.j)});tw(this.u,function(f){a.j=f;a.s.info("Cloud enabled setting: "+a.j);a.j&&fx(a)});Aw(this.u).then(function(f){a.C=f;a.s.info("Privacy notified setting: "+a.C)})};dx.prototype.Jh=function(){return Array.from(this.h.values())};
dx.prototype.vm=function(a){if(!gx(this,a)||-1!=a.indexOf("0F5096E8"))return Aq;gb(this.s,"GetAvailableSinks for "+a);var b=fx(this);this.m.clear();for(var c={},d=n(this.D.values()),e=d.next();!e.done;c={ef:c.ef,fh:c.fh},e=d.next())c.ef=e.value,c.fh=!1,b.forEach(function(f){return function(g){g.id==f.ef.Jb.id&&(f.fh=!0,g.friendlyName=f.ef.Jb.friendlyName)}}(c)),c.fh||this.m.set(c.ef.id,c.ef.Jb);b=b.concat.apply(b,p(this.m.values()));gb(this.s,function(){return"Available sinks are..."+JSON.stringify(b)});
this.l&&(b=b.concat(hx));return new zq(b,-1!=a.indexOf("0F5096E8")?rj:null)};var fx=function(a){var b=[];a.s.info("Checking cloud discovery services");a.F.forEach(function(c){c=c.j().map(function(d){return d.Jb});b.push.apply(b,p(c))});return b};k=dx.prototype;k.startObservingMediaSinks=function(){};k.stopObservingMediaSinks=function(){};k.startObservingMediaRoutes=function(){};k.stopObservingMediaRoutes=function(){};k.sn=function(a){return(a=ix(this,a))?a.Jb:null};
k.createRoute=function(a,b,c,d,e,f,g){var h=this;this.s.info("createRoute called");gb(this.s,"urn: "+a+" sinkId:"+b);if(e=this.G.get(b))return Gi(jx(this.g,this,e,a,c,g,function(m){m.mediaSource=a;m.sb.tabId=g;return Ii(m)}),function(m){Oq(h.g);return m});e=ix(this,b);return kx(this,a,e,b,c,d,g)};
var lx=function(a,b,c,d,e){b instanceof yq&&2==b.errorCode?Gu(a,c,6,null):(a.s.error("Error on start session",b instanceof Error?b:Error("Expected an Error value, got "+b)),a.h.has(c.id)&&Gu(a,c,e,Ei(new Ai(wu,"warning"),c.sinkId)));if(b=a.l)b=a.l,b.l.delete(d.deviceId)?(b.g.g.delete(d.id),b=!0):b=!1;b&&rs(a,[d.Jb])},kx=function(a,b,c,d,e,f,g){if(f)return Ji(Error("not supported"));f=!1;switch(c.g){case "slarti":Tr(1);break;case "mesi":f=!0;if(!a.C){a.C=!0;yw(a.u);var h=Ei(Ci(),d);a.g.g.onIssue(h)}Tr(0)}Cm().h=
new zm(c.model,null);var m=Qp(e,a.getName(),d,b,!0);a.h.set(m.id,m);a.G.set(d,m);a.D.set(m.id,c);a.H.set(m.id,c.g);Fq(a.g,a,m);Tq(a.g,a.Ua(),!0);if(qj(b)&&!f)return a.s.info("starting presentation on route: "+m.id),Hi(mx(m,b),function(q){lx(a,q,m,c,7);throw q;});a.s.info("starting mirroring on route: "+m.id);m.sb={tabId:g,sessionId:"",Yg:"",ge:c.model};qj(b)&&(m.isOffscreenPresentation=!0);return Hi(Hq(a.g,a,m,e),function(q){lx(a,q,m,c,5);throw q;})};
dx.prototype.terminateRoute=function(a){return Gu(this,a,0,null)};
var Gu=function(a,b,c,d){var e="string"==typeof b?a.h.get(b):b;if(!e)return Promise.reject(new yq(3,"Route in cloud provider not found for routeId "+b));a.s.info("terminating route: "+e.id);a.h.delete(e.id);a.G.delete(e.sinkId);a.D.get(e.id);a.D.delete(e.id);if(d)a.g.g.onIssue(d);ub("MediaRouter.Cloud.Session.End",c,Pr);Nq(a.g,e);0==a.h.size&&Tq(a.g,a.Ua(),!1);a.g.onPresentationConnectionStateChanged(e.id,"terminated");a.m.has(e.sinkId)&&(b=a.m.get(e.sinkId),rs(a,[b]),a.m.delete(e.sinkId));return Promise.resolve()};
k=dx.prototype;k.sendRouteMessage=function(a,b){var c=this.H.get(a);if(c){var d=(a=this.h.get(a)||void 0)?ix(this,a.sinkId):void 0;return rw(this.M,c,b,a,d)}return"string"===typeof b?(Fu(this,b,a),Promise.resolve()):Promise.reject(Error("Channel type missing"))};k.sendRouteBinaryMessage=function(a){return Promise.reject(Error("Route "+a+" does not support sending binary data."))};
k.ej=function(a){var b=new Lj;5>b.minFrameRate&&(b.minFrameRate=5);var c=this.dj(a);"hangouts"==c||"meetings"==c?(b.maxWidth=Math.min(window.screen&&window.screen.width||Infinity,2880),b.maxHeight=Math.min(window.screen&&window.screen.height||Infinity,1800)):b.senderSideLetterboxing=!0;Mj(b);Object.freeze(b);this.s.info("Settings for "+a+": "+Kj(b));if(!b.shouldCaptureAudio&&!b.shouldCaptureVideo)throw Error("Cannot start mirroring without video or audio capture.");return b};
k.dj=function(a){var b=null;a=ix(this,a);switch(a.g){case "slarti":b="webrtc";break;case "mesi":b=a.Fd?"meetings":"hangouts"}return b};k.Cn=function(){};k.am=function(a,b){gb(this.s,"Checking canRoute: "+a+" for sinkId: "+b);return gx(this,a)&&!!this.sn(b)};k.Li=function(a,b){return qj(a)&&this.h.has(b)};k.joinRoute=function(a,b){return(a=this.h.get(b))?(this.s.info("joining route: "+a.id),Ii(a)):Ji(Error("not supported"))};k.connectRouteByRouteId=function(){return Ji(Error("not supported"))};
k.detachRoute=function(){};
var ps=function(a,b){a.s.info(b.length+" sinks added");b=ix(a,b[0].id);Cm().g=new zm(b.model,null);fn(a.g);a.g.onSinkAvailabilityUpdated(a,2);a.s.info("sinkAvailability changed to AVAILABLE")},rs=function(a,b){a.s.info(b.length+" sinks removed");yb(2);a.F.some(function(c){return 0<c.j().length})||(a.g.onSinkAvailabilityUpdated(a,0),a.s.info("sinkAvailability changed to UNAVAILABLE"));fn(a.g)},qs=function(a,b){a.s.info(b.length+" sinks updated");fn(a.g)},Fu=function(a,b,c,d){(void 0===d?0:d)?io(a.g,
c,b):qp(a.g.M,new rp(c,b))},ix=function(a,b){var c=nx(a,b);c||(c=null,(b=a.G.get(b))&&(c=a.D.get(b.id)));return c},nx=function(a,b){var c=null;a.F.some(function(d){c=d.h(b);return!!c});return c},gx=function(a,b){var c=sj(b)||tj(b);b=qj(b);if(a.o.j&&!a.o.g&&c)return a.g.onSinkAvailabilityUpdated(a,2),!0;var d=!1;a.j&&a.o.g&&(d=!0);var e;if(e=!chrome.declarativeWebRequest)a=a.o,e=!(a.j||a.g&&a.h&&(-1!=Ot.indexOf(a.h)||-1!=Ot.indexOf(Mt(a))))&&b;return e?!1:d&&(c||b)};k=dx.prototype;
k.searchSinks=function(a,b){var c=this;if(!gx(this,a))return Promise.reject(Error("err"));a=As(this.l,b);a.then(function(d){ps(c,[d])});return a};k.createMediaRouteController=function(){return Xa()};k.provideSinks=function(){};k.Ua=function(){return"CloudProvider"};k.Ib=function(){return[void 0,{cloudEnabled:this.j,notifiedHangoutsPrivacy:this.C}]};k.Hb=function(){var a=im(this);a&&(a.cloudEnabled&&(this.j=a.cloudEnabled),a.notifiedHangoutsPrivacy&&(this.C=a.notifiedHangoutsPrivacy))};
var mx=function(a,b){a=new cx(a,b);return Ki(a.start())};dx.prototype.s=$a("mr.CloudProvider");var hx=new dm("pseudo:cloud","","meeting","","default"),ex=Date.parse("15 Aug 2020 00:00:00 GMT");var ox=function(){Jp.call(this,12,"ExternalMessageListener","mr.ProviderManager",chrome.runtime.onMessageExternal)};t(ox,Jp);ox.prototype.oi=function(a,b){return b.origin&&b.origin.startsWith("chrome-extension://")&&px.includes(b.origin.substring(19))?"start"==a.type||"stop"==a.type||"subscribe_log_data"==a.type:!1};ox.prototype.Pi=function(){return!0};var rx=function(){qx||(qx=new ox);return qx},qx=null,px=["idmofbkcelhplfjnmmdolenpigiiiecc","ggedfkijiiammpnbdadhllnehapomdge","njjegkblellcjnakomndbaloifhcoccg"];var sx=function(){Jp.call(this,11,"InternalMessageListener","mr.ProviderManager",chrome.runtime.onMessage)};t(sx,Jp);sx.prototype.oi=function(a,b){return"retrieve_log_data"==a.type&&b.origin=="chrome-extension://"+chrome.runtime.id&&b.url==b.origin+"/feedback.html"};sx.prototype.Pi=function(){return!0};var ux=function(){tx||(tx=new sx);return tx},tx=null;function vx(a){var b=wx,c=[];a&&c.push(new Bq(b));c.push(new dx(b));return c};var xx=function(a,b){this.routeId=a;this.message=b},yx=function(a){return"string"!=typeof a.message};var zx=function(a){this.D=a;this.l=this.C=null},Ax=function(a){if(null==a.l)if(null==a.C||Date.now()-a.C>=a.D)a.m();else{var b=Math.max(a.C+a.D-Date.now(),5);a.l=setTimeout(a.m.bind(a),b)}};zx.prototype.m=function(){null!=this.l&&(clearTimeout(this.l),this.l=null);this.F();this.C=Date.now()};zx.prototype.F=function(){};var Bx=function(a,b){zx.call(this,20);this.g=new Map;this.h=new Set;this.u=null;this.o=this.j=0;this.G=!1;this.M=a;this.H=b;this.s=$a("mr.RouteMessageSender")};t(Bx,zx);Bx.prototype.init=function(a){this.u=a;km(this)};Bx.prototype.stopListeningForRouteMessages=function(a){this.h.delete(a)};
Bx.prototype.send=function(a,b){var c=this.g.get(a);c||(c=[],this.g.set(a,c));b=new xx(a,b);c.push(b);50<c.length&&1==c.length%50&&this.s.K(function(){return"Message queue length is excessively large ("+(c.length+") for route "+a)});this.j+=yx(b)?0:b.message.length;yx(b)&&this.o++;Cx(this);this.h.has(a)&&Ax(this)};
var Dx=function(a,b){if(0!=b.length){b=n(b);for(var c=b.next();!c.done;c=b.next())c=c.value,a.j-=yx(c)?0:c.message.length,yx(c)&&a.o--}},Cx=function(a){var b=0<a.o||a.j>a.H;b!=a.G&&(a.G=b,Tq(a.M,a.Ua(),b))};Bx.prototype.F=function(){if(this.u){for(var a=n(this.h),b=a.next();!b.done;b=a.next()){b=b.value;var c=this.g.get(b);c&&0!=c.length&&(this.u(b,c),Dx(this,c),this.g.set(b,[]))}Cx(this)}else this.s.error("sendMessagesCallback not set. Messages not delivered.")};Bx.prototype.Ua=function(){return"mr.RouteMessageSender"};
Bx.prototype.Ib=function(){var a=[].concat(p(this.g.entries())).map(function(b){return[b[0],b[1].map(function(c){return c.message})]});return[new Ex(a,Array.from(this.h),this.j)]};Bx.prototype.Hb=function(){var a=hm(this);if(a){this.g=new Map;for(var b={},c=n(a.h),d=c.next();!d.done;b={gh:b.gh},d=c.next())d=d.value,b.gh=d[0],d=d[1].map(function(e){return function(f){return new xx(e.gh,f)}}(b)),this.g.set(b.gh,d);this.h=new Set(a.g);this.j=a.j}};var Ex=function(a,b,c){this.h=a;this.g=b;this.j=c};var rp=function(a,b){this.type="internal_message";this.routeId=a;this.message=b};var Fx=function(){this.g=[]};Fx.prototype.listen=function(a,b,c){this.g.push({type:a,Wc:b,target:c})};var Gx=function(a,b,c){var d=a.g.findIndex(function(e){return"internal_message"==e.type&&e.Wc==b&&e.target==c});-1!=d&&a.g.splice(d,1)},qp=function(a,b){a.g.forEach(function(c){c.type==b.type&&Promise.resolve().then(function(){return c.Wc.call(c.target,b)})})};var Hx=function(a,b,c){this.g=a;this.l=b;this.j=c;this.onMessage=function(){};c.listen("internal_message",this.h,this)};Hx.prototype.sendMessage=function(a,b){return this.l(this.g,a,b)};Hx.prototype.h=function(a){if(a.routeId==this.g)this.onMessage(a.message)};Hx.prototype.dispose=function(){this.onMessage=function(){};Gx(this.j,this.h,this)};
var Ix=new Hx("",function(){return Promise.resolve()},new Fx),Jx=function(a){this.g=a},$w=function(a){var b=yi,c=b.g.h.get(a);return c?new Hx(a,c.sendRouteMessage.bind(c),b.g.M):Ix};var Kx=function(a,b){this.m=null!=b?a.bind(b):a;this.C=this.o.bind(this);this.l=[];this.g=!1;this.h=null};Kx.prototype.j=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];this.l=[].concat(p(b));null==this.h?Lx(this):this.g=!0};var Lx=function(a){a.h=setTimeout(a.C,500);a.m.apply(a,p(a.l))};Kx.prototype.o=function(){this.h=null;this.g&&(this.g=!1,Lx(this))};var Mx=function(){this.config=null;this.s=$a("mr.ProviderManager");this.j=[];this.h=new Map;this.o=new Map;this.C=new Set;this.l=new Set;this.D=new Map;this.g=this.F=null;this.M=new Fx;this.V=new Kx(this.so,this);this.ga=new Kx(this.J,this);this.m=new Bx(this,524288);this.H=0;this.u=new Map;this.G=[];var a=new Ir(this);this.ub=a.onMessage.bind(a);a=new yr(this);this.X=a.onMessage.bind(a);this.onBeforeInvokeHandler=this.onBeforeInvokeHandler;this.createRoute=this.createRoute;this.joinRoute=this.joinRoute;
this.connectRouteByRouteId=this.connectRouteByRouteId;this.terminateRoute=this.terminateRoute;this.startObservingMediaSinks=this.startObservingMediaSinks;this.stopObservingMediaSinks=this.stopObservingMediaSinks;this.sendRouteMessage=this.sendRouteMessage;this.sendRouteBinaryMessage=this.sendRouteBinaryMessage;this.startListeningForRouteMessages=this.startListeningForRouteMessages;this.stopListeningForRouteMessages=this.stopListeningForRouteMessages;this.startObservingMediaRoutes=this.startObservingMediaRoutes;
this.stopObservingMediaRoutes=this.stopObservingMediaRoutes;this.detachRoute=this.detachRoute;this.searchSinks=this.searchSinks;this.provideSinks=this.provideSinks;this.updateMediaSinks=this.updateMediaSinks;this.createMediaRouteController=this.createMediaRouteController};t(Mx,cj);
Mx.prototype.handleEvent=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(a==chrome.runtime.onMessage)this.ub.apply(this,p(c));else if(a==chrome.runtime.onMessageExternal)this.X.apply(this,p(c));else throw Error("Unhandled event");};
var Mr=function(a,b){b=a.D.get(b);return gj(b).then(function(c){var d=!!a.config&&a.config.use_mirroring_service;c.D||(c.j=a,c.D=!0,c.qg(d));return c})},Ox=function(a,b,c){b.forEach(function(d){if(Nx(a,d.getName()))a.s.K("Provider "+d.getName()+" already registered.");else try{d.tn(c),a.j.push(d),a.u.set(d.getName(),0)}catch(e){a.s.K("Provider "+d.getName()+" failed to initialize.",e)}})},Px=function(a,b,c){var d=wx;d.D.set("webrtc","mr.mirror.webrtc.WebRtcService");d.D.set("cast_streaming","mr.mirror.cast.Service");
d.D.set("hangouts","mr.mirror.hangouts.HangoutsService");d.D.set("meetings","mr.mirror.hangouts.MeetingsService");var e=new Jx(d);yi||(yi=e);d.g=a;d.m.init(d.g.onRouteMessagesReceived.bind(d.g));Ox(d,b,c);d.config=c;km(d);mj("mr.ProviderManager",d)},Rx=function(a,b,c){return new Promise(function(d,e){var f=null;a.H++;Qx(a);f=window.setTimeout(function(){f=null;b.cancel(new yq(2,"timeout after "+c+" ms."))},c);b.g.then(function(g){a.H--;Qx(a);null!=f&&window.clearTimeout(f);d(g)},function(g){a.H--;
Qx(a);null!=f&&window.clearTimeout(f);e(g instanceof yq?g:g instanceof Error?new yq(0,g.message,g.stack):new yq(0))})})};Mx.prototype.onBeforeInvokeHandler=function(){pj(0)};var Sx=function(a){return"string"==typeof a?a:a.unique?"":a.scheme+"://"+a.host+"\n       "+(a.port?":"+a.port:"")+"/"};k=Mx.prototype;
k.createRoute=function(a,b,c,d,e,f,g){var h=this;g=void 0===g?!1:g;var m=Tx(this,a,b);if(!m)return Promise.reject(new yq(7,"No provider supports createRoute with source: "+a+" and sink: "+b));var q=void 0;void 0!==d&&(q=Sx(d));f=f&&0<f?f:6E4;a=m.createRoute(a,b,c,g,f,q,e);return Rx(this,a,f).then(function(r){return r},function(r){h.s.error("Error creating route.",r);throw r;})};
k.connectRouteByRouteId=function(a,b,c,d,e,f){var g=this.h.get(b);if(!g)return Promise.reject(new yq(7,"No provider supports join "+b));a=g.connectRouteByRouteId(a,b,c,Sx(d),e);return Rx(this,a,f&&0<f?f:3E4)};k.joinRoute=function(a,b,c,d,e,f){f=void 0===f?!1:f;var g=Ux(this,a,b);if(!g)return Promise.reject(new yq(7,"No provider supports join "+b));e=e&&0<e?e:3E4;a=g.joinRoute(a,b,f,e,Sx(c),d);return Rx(this,a,e)};
k.terminateRoute=function(a){var b=this.h.get(a);return b?Vx(this,a).then(function(){return b.terminateRoute(a)}):Promise.reject(new yq(3,"Route not found for routeId "+a))};k.startObservingMediaSinks=function(a){yb(1);this.C.has(a)||(this.C.add(a),this.j.forEach(function(b){b.startObservingMediaSinks(a)}));Wx(this,a)};k.stopObservingMediaSinks=function(a){this.C.delete(a)?Xx(this,a):this.s.info("No existing query "+a)};
var Xx=function(a,b){a.j.forEach(function(c){c.stopObservingMediaSinks(b)})},Wx=function(a,b){if("urn:x-org.chromium.media:source:tab:-1"==b)a.s.K("No sinks for sourceUrn: "+b);else{var c=new Map,d=[];a.j.forEach(function(e){var f=e.vm(b);0<f.sinks.length&&(d=f.origins);f.sinks.forEach(function(g){c.has(g.id)?a.s.K("Detected duplicate sink "+g.id+" from provider: "+e.getName()):c.set(g.id,g)})});Yx(a,b,Array.from(c.values()),d||[])}},Yx=function(a,b,c,d){a.s.info("Sending "+c.length+" sinks to MR for "+
b);a.g.onSinksReceived(b,c,d.map(Io))};k=Mx.prototype;k.sendRouteMessage=function(a,b,c){var d=this.h.get(a);d?(a=d.sendRouteMessage(a,b,c),a=Rx(this,Ki(a),3E4)):a=Promise.reject(Error("Invalid route ID "+a));return a};k.sendRouteBinaryMessage=function(a,b){var c=this.h.get(a);c?(a=c.sendRouteBinaryMessage(a,b),a=Rx(this,Ki(a),3E4)):a=Promise.reject(Error("Invalid route ID "+a));return a};
k.startListeningForRouteMessages=function(a){var b=this.m;b.h.has(a)||(b.h.add(a),(a=b.g.get(a))&&0<a.length&&Ax(b))};k.stopListeningForRouteMessages=function(a){this.m.stopListeningForRouteMessages(a)};k.detachRoute=function(a){var b=this.h.get(a);b?b.detachRoute(a):this.s.info("Route "+a+" does not exist.")};k.enableMdnsDiscovery=function(){};var Tx=function(a,b,c){return a.j.find(function(d){return d.am(b,c)})||null},Ux=function(a,b,c){return a.j.find(function(d){return d.Li(b,c)})||null};
Mx.prototype.J=function(){var a=this;this.C.forEach(function(b){Wx(a,b)})};var Qx=function(a){a.g.setKeepAlive(0<a.H||0<a.G.length)};k=Mx.prototype;k.startObservingMediaRoutes=function(a){this.l.has(a)||(this.l.add(a),this.j.forEach(function(b){b.startObservingMediaRoutes(a)}));this.V.j()};k.stopObservingMediaRoutes=function(a){this.l.delete(a)?this.j.forEach(function(b){b.stopObservingMediaRoutes(a)}):this.s.info("No existing route query "+a)};
k.so=function(){var a=this;if(0!=this.l.size){var b=[];this.j.forEach(function(c){b=b.concat(c.Jh())});this.l.forEach(function(c){var d=[];a.j.forEach(function(e){e.Jh().forEach(function(f){!f.mf&&e.Li(c,void 0,f)&&d.push(f.id)})});a.g.onRoutesUpdated(b,c,d)})}};k.Ua=function(){return"ProviderManager"};
k.Ib=function(){return[new Zx(this.j.map(function(a){return a.getName()}),Array.from(this.C),Array.from(this.l),Array.from(this.h,function(a){var b=n(a);a=b.next().value;b=b.next().value;return[a,b.getName()]}),Array.from(this.u),this.F)]};k.Hb=function(){var a=hm(this);if(a){this.C=new Set(a.C);this.l=new Set(a.j);for(var b=n(a.h),c=b.next();!c.done;c=b.next()){var d=n(c.value);c=d.next().value;d=d.next().value;d=Nx(this,d);this.h.set(c,d)}this.u=new Map(a.l);this.F=a.g||null}};
var Fq=function(a,b,c){a.h.set(c.id,b);Oq(a)},Nq=function(a,b){Vx(a,b.id);a.h.delete(b.id);var c=a.m;b=b.id;c.h.delete(b);var d=c.g.get(b);d&&(c.g.delete(b),Dx(c,d),Cx(c));Oq(a)},Oq=function(a){0<a.l.size&&a.V.j()};Mx.prototype.L=function(a){var b=this.h.get(a.id);b&&(b.Cn(a.id),0<this.l.size&&this.so())};var io=function(a,b,c){a.h.has(b)?("string"===typeof c||c instanceof Uint8Array||(c=JSON.stringify(c)),a.m.send(b,c)):a.s.K("Got route message for closed route "+b)};
Mx.prototype.onPresentationConnectionStateChanged=function(a,b){"terminated"==b&&this.m.m();this.g.onPresentationConnectionStateChanged(a,b)};Mx.prototype.onPresentationConnectionClosed=function(a,b,c){this.m.m();this.g.onPresentationConnectionClosed(a,b,c)};var Bj=function(a,b){a.o.delete(b);(a=a.h.get(b))&&a.terminateRoute(b)},fn=function(a){yb(4);a.ga.j()};
Mx.prototype.onSinkAvailabilityUpdated=function(a,b){var c=this;if(this.u.get(a.getName())!=b){var d=$x(this);this.u.set(a.getName(),b);a=$x(this);d!=a&&(yb(3),0==a&&this.J(),this.g.onSinkAvailabilityUpdated(a),0==a&&(this.C.forEach(function(e){Xx(c,e)}),this.C.clear()))}};
var $x=function(a){return Array.from(a.u.values()).reduce(function(b,c){return Math.max(b,c)},0)},Vx=function(a,b){return a.o.has(b)?Mr(a,a.o.get(b)).then(function(c){a.o.delete(b);return c.o()}):Promise.resolve(!1)},Hq=function(a,b,c,d,e){var f=b.dj(c.sinkId);a.s.info("Starting mirroring using service: "+f);a.o.set(c.id,f);return Li(Mr(a,f),function(g){a.F=f;return Hi(g.Wj(c,c.mediaSource,b.ej(c.sinkId),d,e),function(h){if(h instanceof Ni&&3==h.reason)throw new yq(8);throw h;})})},jx=function(a,
b,c,d,e,f,g){var h=a.o.get(c.id);return h?Li(Mr(a,h),function(m){a.F=h;return m.pa(c,d,b.ej(c.sinkId),e,f,g)}):Ji(Error("Route "+c.id+" is not mirroring"))},Tq=function(a,b,c){var d=a.G.indexOf(b),e=0<=d;c&&!e?a.G.push(b):!c&&e&&a.G.splice(d,1);Qx(a)},Nx=function(a,b){return a.j.find(function(c){return c.getName()==b})||null};k=Mx.prototype;
k.searchSinks=function(a,b,c){var d=a.startsWith("pseudo:")?a.substring(7):null;return(d=d?Nx(this,d):null)?d.searchSinks(b,c).then(function(e){return e.id}):Promise.reject(Error("No provider supports "+a))};k.provideSinks=function(a,b){var c=Nx(this,a);c?c.provideSinks(b):this.s.info("provideSinks: Provider not found for providerName "+a)};k.updateMediaSinks=function(a){this.C.has(a)||Wx(this,a)};
k.createMediaRouteController=function(a,b,c){var d=this,e=this.h.get(a);return e?e.createMediaRouteController(a,b,c).catch(function(f){d.s.error("createMediaRouteController failed: "+f.message);b.close();c.ptr.reset();throw f;}):(a="createMediaRouteController: Provider not found for "+a,this.s.error(a),b.close(),c.ptr.reset(),Promise.reject(Error(a)))};k.onMediaRemoterCreated=function(a,b,c){this.g.onMediaRemoterCreated(a,b,c)};k.getMediaSinkServiceStatus=function(){return this.g.getMediaSinkServiceStatus()};
var Lr=function(a){return"function"!=typeof a.g.getLogsAsString?Promise.resolve({Ac:""}):a.g.getLogsAsString()};Mx.prototype.getMirroringServiceHostForTab=function(a,b){this.g.getMirroringServiceHostForTab(a,b)};Mx.prototype.getMirroringServiceHostForDesktop=function(a,b,c){this.g.getMirroringServiceHostForDesktop(a,b,c)};Mx.prototype.getMirroringServiceHostForOffscreenTab=function(a,b,c){this.g.getMirroringServiceHostForOffscreenTab(a,b,c)};
var Zx=function(a,b,c,d,e,f){this.C=b;this.j=c;this.h=d;this.l=e;this.g=f};
