text: 'use strict';var Ud;p("mr.IssueSeverity",{En:"fatal",ir:"warning",lp:"notification"});p("mr.IssueAction",{vn:"dismiss",Eo:"learn_more"});var Vd=function(a,b){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},Xd=function(){var a=new Vd(Wd,"notification");a.helpPageId=6320939;a.defaultAction="learn_more";a.secondaryActions=["dismiss"];return a};var Yd=function(a,b){var c=this;this.b=void 0===b?null:b;this.a=new Promise(function(b,e){var d=function(a){c.b=null;e(a)};c.f=d;a(function(a){c.b=null;b(a)},d)})};Yd.prototype.cancel=function(a){this.f(a);if(this.b){var b=this.b;this.b=null;setTimeout(function(){return b(a)},0)}};var Zd=function(a,b,c){c=void 0===c?null:c;return new Yd(function(d,e){a.a.then(function(a){if(b)try{d(b(a))}catch(g){e(g)}else d(a)},function(a){if(c)try{d(c(a))}catch(g){e(g)}else e(a)})},function(b){a.cancel(b)})};
  Yd.prototype.then=function(a,b){return Zd(this,a,void 0===b?null:b)};var $d=function(a,b){return Zd(a,null,b)},ae=function(a){return new Yd(function(b){b(a)})},be=function(a){return new Yd(function(b,c){c(a)})},ce=function(a){return new Yd(function(b,c){a.then(b,c)})},de=function(a,b){var c=!1,d=null;return new Yd(function(e,f){a.then(function(a){c||(d=b(a),d.a.then(e,f))},f)},function(a){d?d.cancel(a):c=!0})};var ee=function(){var a=ja(navigator.userAgent.match(/Windows NT (\d+.\d+)/)||[]);a.next();a=a.next().value;return 6.2<=parseFloat(a)},fe=function(){var a=navigator.userAgent;return a.includes("CrOS")?"ChromeOS":a.includes("Windows")?"Windows":a.includes("Macintosh")?"Mac":a.includes("Linux")?"Linux":"Other"};var ge=!("undefined"==typeof chrome||!chrome.networkingPrivate||!chrome.networkingPrivate.setWifiTDLSEnabledState||"ChromeOS"!=fe()),he=["ChromeOS","Windows"].includes(fe());var ie=function(a,b,c,d){this.b=a;this.a=b;this.f=c||null;this.g=d||null},le=function(a,b){if("tab"==a.b)a=je(a);else if("offscreen_tab"==a.b)b=je(a),b.presentationId=a.g,a=b;else{var c={audio:!1,video:!1};a.a.shouldCaptureVideo&&(c.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:b}},ke(a,c.video.mandatory));he&&a.a.shouldCaptureAudio&&(c.audio={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:b}});a=c}return a},je=function(a){var b={audio:a.a.shouldCaptureAudio,video:a.a.shouldCaptureVideo};
  a.a.shouldCaptureVideo&&(b.videoConstraints={mandatory:{enableAutoThrottling:!0}},ke(a,b.videoConstraints.mandatory));return b},ke=function(a,b){var c=a.a.minWidth,d=a.a.minHeight;if(a.a.senderSideLetterboxing){c=a.a;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{for(var d=c.maxWidth,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.a.maxWidth,maxHeight:a.a.maxHeight,minFrameRate:a.a.minFrameRate,maxFrameRate:a.a.maxFrameRate})};var me=function(a){this.b=a;this.f=Date.now()},ne=function(a,b){null!=b&&(a+="_"+b);return a};me.prototype.a=function(a){oe(ne(this.b,a),Date.now()-this.f)};var oe=function(a,b){0>b&&(t(pe,"Timing analytics event with negative time"),b=0);1E4<b&&(b=1E4);try{chrome.metricsPrivate.recordTime(a,b)}catch(c){t(pe,"Failed to record time "+b+" in "+a)}},pe=Ia("mr.Timing"),qe=function(a){me.call(this,a)};ka(qe,me);
  qe.prototype.a=function(a){a=ne(this.b,a);var b=Date.now()-this.f;if(0>b)t(re,"Timing analytics event with negative time");else{1E4>b&&(b=1E4);18E4<b&&(b=18E4);try{chrome.metricsPrivate.recordMediumTime(a,b)}catch(c){t(re,"Failed to record time "+b+" in "+a)}}};var re=Ia("mr.MediumTiming"),se=function(a){me.call(this,a)};ka(se,me);
  se.prototype.a=function(a){a=ne(this.b,a);var b=Date.now()-this.f;if(0>b)t(te,"Timing analytics event with negative time");else{18E4>b&&(b=18E4);36E5<b&&(b=36E5);try{chrome.metricsPrivate.recordLongTime(a,b)}catch(c){t(te,"Failed to record time "+b+" in "+a)}}};
  var te=Ia("mr.LongTiming"),ue=Ia("mr.Analytics"),ve=function(a){try{chrome.metricsPrivate.recordUserAction(a)}catch(b){t(ue,"Failed to record event "+a)}},we=function(a,b,c){var d,e=0,f;for(f in c)e++,c[f]==b&&(d=f);if(d){c={metricName:a,type:"histogram-linear",min:1,max:e,buckets:e+1};try{chrome.metricsPrivate.recordValue(c,b)}catch(g){t(ue,"Failed to record enum value "+d+" ("+b+") in "+a,g)}}else ue.error("Unknown analytics value, "+b+" for histogram, "+a,Error())},xe=function(a,b){try{if(0>b)throw Error("Invalid count for "+
  a+": "+b);100<b&&t(ue,"Small count for "+a+" exceeded limits: "+b,Error());chrome.metricsPrivate.recordSmallCount(a,b)}catch(c){t(ue,"Failed to record small count "+a+" ("+b+")",c)}};var ye={Um:0,Sm:1,Wm:2,Tm:3,zm:4,Vm:5,eo:6,Oq:7,pn:8,sg:9},ze=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};ka(ze,Error);var Ae=function(a){this.b=a;this.a=this.Zc=null;this.j=Ia("mr.mirror.MirrorMediaStream")};Ae.prototype.start=function(){return"tab"==this.b.b?Be(this):"offscreen_tab"==this.b.b?Ce(this):De(this)};var Be=function(a){var b=le(a.b);u(a.j,"Starting tab capture with constraints "+JSON.stringify(b));return new Promise(function(c,d){chrome.tabCapture.capture(b,function(b){b?(Ee(a,b),c(a)):d(Fe())});window.setTimeout(function(){d(new ze("chrome.tabCapture.capture failed to call its callback",2))},5E3)})};
  Ae.prototype.f=function(a){a&&u(this.j,function(){return"Track "+JSON.stringify(a.target)+" ended"});this.stop()};
  var Fe=function(){return chrome.runtime.lastError&&chrome.runtime.lastError.message?new ze(chrome.runtime.lastError.message,7):new ze("empty_stream",0)},De=function(a){return(new Promise(function(a,c){var b=["screen","audio"];"Linux"==fe()&&b.push("window");var e=chrome.desktopCapture.chooseDesktopMedia(b,a);window.setTimeout(function(){chrome.desktopCapture.cancelChooseDesktopMedia(e);c(new ze("timeout",1))},6E4)})).then(function(b){if(!b)throw new ze("User cancelled capture dialog",3);var c=le(a.b,
  b);u(a.j,function(){return"Starting desktop capture with constraints "+JSON.stringify(c)});return new Promise(function(a,b){navigator.webkitGetUserMedia(c,a,function(a){var c=8;if("PermissionDeniedError"==a.name||"NotAllowedError"==a.name)c=3;b(new ze(a.name+" "+a.constraintName+": "+a.message,c))})})}).then(function(b){if(b)Ee(a,b);else throw new ze("empty_stream",8);return a})},Ce=function(a){var b=le(a.b);u(a.j,function(){return"Starting offscreen tab capture with constraints "+JSON.stringify(b)});
  return new Promise(function(c,d){chrome.tabCapture.captureOffscreenTab(a.b.f.toString(),b,function(b){b?(Ee(a,b),c(a)):d(Fe())})})},Ee=function(a,b){a.a=b;b.getAudioTracks().length||b.getVideoTracks();b.getTracks().forEach(function(b){b.onended=a.f.bind(a)})};Ae.prototype.stop=function(){this.a&&(this.a.getTracks().forEach(function(a){a.onended=null;a.stop()}),this.a=null,this.Zc&&this.Zc())};var Ge,He={Mo:0,Xm:1,Ym:2,rn:3,sn:4,Ln:5,fo:6,Ko:7,bp:8,cp:9,Wp:10,vq:11,wq:12,Dq:13,Nq:14},Ie=function(a){void 0==Ge&&(we("MediaRouter.Provider.WakeEvent",a,He),Ge=a)};var Le=function(a){return Je(a)||Ke(a)},Me=function(a){if(!a.startsWith("http:")&&!a.startsWith("https:"))return!1;var b=document.createElement("a");b.href=a;return"http:"!=b.protocol&&"https:"!=b.protocol?!1:-1==b.hash.indexOf("__castAppId__")},Ne=["https://docs.google.com"],Je=function(a){return a.startsWith("urn:x-org.chromium.media:source:tab:")||-1!=a.indexOf("0F5096E8")},Ke=function(a){return"urn:x-org.chromium.media:source:desktop"==a};var Oe=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 Pe=function(){},Te=function(a){var b=Qe.get(a)||null;if(b)return Promise.resolve(b);b=Re.get(a);b||(b=new Ra,Re.set(a,b),Se(a,b));return b.a},Se=function(a,b){var c=Ue.get(a)||null;if(!c)b.reject(Error("No corresponding bundle for "+a));else if(!Ve.has(c)){var d=We.get(c);d||(u(Xe,"Loading bundle "+c+" for module "+a),d=Ye(c),We.set(c,d));d.catch(function(a){b.reject(a)})}},Ye=function(a){var b=new Ra;b.a.then(function(){u(Xe,"Bundle "+a+" loaded")},function(b){Xe.error("Failed to load bundle "+
  a);throw b;});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.a},Ze=function(a,b){if(Qe.has(a))throw Error("Duplicate module "+a);Qe.set(a,b);(a=Re.get(a))&&a.resolve(b)};
  Pe.prototype.handleEvent=function(a,b){for(var c=1;c<arguments.length;++c);throw Error("Not implemented");};
  var Ue=new Map([["mr.cast.ChannelService","background_script.js"],["mr.cast.SinkDiscoveryService","background_script.js"],["mr.mirror.cast.Service","mirroring_cast_streaming.js"],["mr.cloud.discovery.CloudSinkDiscoveryService","background_script.js"],["mr.dial.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"]]),Ve=new Set(["background_script.js"]),Xe=Ia("mr.Module"),Qe=new Map,Re=new Map,We=new Map;var $e=chrome.i18n.getMessage("545449835455981095");var af=function(a,b){this.G=a;this.h=b||null;this.b=this.a=null;this.F=Ia("mr.mirror.Service."+a);this.s=this.T.bind(this);this.g=!1};ka(af,Pe);af.prototype.Ga=function(a){this.g||(this.h=a,this.g=!0,this.ie())};af.prototype.ie=function(){};af.prototype.getName=function(){return this.G};
  var ff=function(a,b,c,d,e,f){u(a.F,"Start mirroring on route "+b.id);return a.g?ce(bf(c,b.ob.tabId).then(function(){return cf(a)}).then(function(){var a=df(c,d,e);return(new Ae(a)).start()}).then(function(c){if(a.b)throw c.stop(),new ze("Cannot start multiple streams");a.b=c;c=a.l.bind(a);a.b.Zc=c;return f?f(b).a:b}).then(function(b){if(a.a)throw new ze("Cannot start multiple sessions");if(!a.b)throw new ze("Media stream ended before session could start.");a.a=a.he(d,b);return a.a.start(a.b.a)}).then(function(){Je(c)&&
  !chrome.tabs.onUpdated.hasListener(a.s)&&chrome.tabs.onUpdated.addListener(a.s);return a.A(b,c,d)}).then(null,function(b){ef(a,b);return a.l().then(function(){throw b;})})):be(Error("Not initialized"))},bf=function(a,b){return Je(a)?b?Oe(b).then(function(a){if(!a.active)throw new ze("Tab to be mirrored is not active",7);}):Promise.reject(new ze("BUG: Tab ID is required.")):Promise.resolve()};
  af.prototype.K=function(a,b,c,d,e){var f=this;if(!this.a)return Promise.reject(new ze("No session to update streams on",7));if(!this.a.Zh())return Promise.reject(new ze("Session does not support updating stream",7));var g=!1;return Promise.resolve().then(function(){var a=df(b,c,d);return(new Ae(a)).start()}).then(function(b){f.b&&(f.b.Zc=null,f.b.stop(),f.Kd());f.b=b;b=f.l.bind(f);f.b.Zc=b;g=!0;return e?e(a).a:a}).then(function(){if(!f.a)throw new ze("Session ended while updating stream");if(!f.b)throw new ze("Media stream ended before session could be updated.");
  f.a.sf();return f.a.ei(f.b.a)}).then(this.A.bind(this,a,b,c)).then(null,function(a){ef(f,a);if(g)return f.l().then(function(){throw a;});throw a;})};
  af.prototype.A=function(a,b,c){var d=this;return new Promise(function(e,f){if(d.a)if(Je(b))gf(d.a,a.ob.tabId).then(function(){hf(d.a);d.Ge();e(d.a.Db())},function(a){d.F.error("Failed to obtain initial tab info.",a);f(a)});else{if(Me(b)){var g="Capturing "+a.mediaSource;jf(d.a,g,g,null);hf(d.a);d.Hf()}else jf(d.a,"Capturing Desktop","Capturing Desktop",null),hf(d.a),d.De();kf(d,c,d.b);e(d.a.Db())}else f(new ze("Session gone before executing post-startup steps",7))})};
  var ef=function(a,b){b.reason=null!=b.reason?b.reason:9;a.F.error("Failed to start mirroring: "+b.message+(",  reason = "+b.reason+": "+b.stack));a.Fe(b.reason)},cf=function(a){return a.g?a.l().then(function(b){b&&a.Ee();return b}):Promise.reject("Not initialized")};
  af.prototype.l=function(){var a=this;chrome.tabs.onUpdated.removeListener(this.s);var b=this.b;this.b=null;b&&(b.Zc=null);var c=this.a;this.a=null;var d;c?d=this.Ye(c).catch(function(b){return a.F.error("Error in before-cleanup steps",b)}).then(function(){return c.stop()}).catch(function(b){return a.F.error("Error stopping session",b)}).then(function(){a.h.tf(c.Db().id)}).catch(function(b){return a.F.error("Error in ended callbacks",b)}).then(function(){return!0}):d=Promise.resolve(!1);b&&(d=d.then(function(c){b.stop();
  a.Kd();return c}));return d};af.prototype.Ye=function(){return Promise.resolve()};af.prototype.T=function(a,b,c){Ie(14);this.a&&this.a.tabId&&this.a.tabId==a&&("complete"==b.status||b.favIconUrl&&"complete"==c.status)&&(this.a.fi(c),this.h.ph(this.a.Db()),hf(this.a))};
  var df=function(a,b,c){if(Je(a))return new ie("tab",b);if(Ke(a))return new ie("desktop",b);if(Me(a)){if(!c)throw new ze("Missing offscreen tab presentation id");return new ie("offscreen_tab",b,a,c)}throw new ze("Source URN does not suggest a known capture type.");},kf=function(a,b,c){b.shouldCaptureAudio&&c.a&&!c.a.getAudioTracks().length&&a.h.mc().send(new Vd($e,"notification"))};h=af.prototype;h.he=function(){};h.Ge=function(){};h.De=function(){};h.Hf=function(){};h.Ee=function(){};h.Fe=function(){};
  h.Kd=function(){};h.rf=function(){return Fa()};h.createMediaRouteController=function(){return Fa()};var lf=function(a){this.g=a;this.v=!1;this.tabId=this.B=this.iconUrl=null},jf=function(a,b,c,d){a.g.description=b;a.v||a.g.offTheRecord?(a.B=null,a.iconUrl=null):(a.B=c,a.iconUrl=d);a.sf()},hf=function(a){a.v||a.g.offTheRecord||a.Mh()},gf=function(a,b){a.tabId=b;return Oe(b).then(a.fi.bind(a))};h=lf.prototype;h.fi=function(a){this.v=a.incognito;var b=new URL(a.url);jf(this,a.title,"file:"==b.protocol?"Local content (Tab)":b.hostname+" (Tab)",a.favIconUrl)};h.Db=function(){return this.g};h.start=function(){};
  h.Zh=function(){return!1};h.ei=function(){};h.stop=function(){return Promise.resolve()};h.Mh=function(){};h.sf=function(){};var pf=function(){var a=this;this.maxWidth=1920;this.maxHeight=1080;this.minHeight=this.minWidth=180;this.senderSideLetterboxing=!1;this.minFrameRate=0;this.maxFrameRate=30;this.minVideoBitrate=300;this.maxVideoBitrate=5E3;this.audioBitrate=0;this.maxLatencyMillis=800;this.animatedLatencyMillis=this.minLatencyMillis=400;this.dscpEnabled=["Mac","Linux","ChromeOS"].includes(fe())||ee();this.enableLogging=!0;this.useTdls=!1;this.shouldCaptureAudio=this.shouldCaptureVideo=!0;var b=window.localStorage?
  window.localStorage.getItem(mf):null;if(b)try{var c=JSON.parse(String(b));if(c instanceof Object)nf(this,c),t(Ia("mr.mirror.Settings"),function(){return"Initial mr.mirror.Settings overridden to: "+of(a)});else throw Error("localStorage["+mf+"] "+("does not parse as an Object: "+b));}catch(d){throw Ia("mr.mirror.Settings").error(mf+' must be of the form \'{"maxWidth":640, "maxHeight":360}\'.',d),Error("Overrides not parseable.  See ERROR log for details.");}};
  pf.prototype.clone=function(){var a=new pf;nf(a,this);return a};
  var of=function(a){return JSON.stringify(a,function(a,c){if(0==a.length||!a.endsWith("_"))return c})},nf=function(a,b){for(var c=ja(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])},qf=function(a){var b=screen.width,c=screen.height;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},mf="mr.mirror.Settings.Overrides";var rf=function(a,b){this.type=a;this.data=b},sf=function(a){a=JSON.parse(a);if(!a.type)throw Error("Invalid message");return new rf(a.type,a.data)},tf=function(a,b,c,d){this.description=a;this.settings=b||null;this.mediaConstraints=c||null;this.presentationUrl=d||null};var wf=function(a,b){this.j=Ia("cv2.PeerConnection");this.T=uf;this.a=vf(this,b);this.l=this.a.createDataChannel(a,{reliable:!1});this.B=new Ra;this.u=!1;this.g=0;this.f=null;this.w=this.h=0;this.b=!1;this.A=function(){};this.m=function(){};this.v=function(){};this.s=function(){}},xf=function(a,b){a.m=b},yf=function(a,b){a.v=b},zf=function(a,b){a.s=b},Af=function(a,b){a.A=b},Bf=function(a,b){a.l.onmessage=function(a){b(a.data)}},Cf=function(a){var b={};b.iceServers=[{url:"stun:stun.l.google.com:19302"}].concat(a);
  return b},vf=function(a,b){var c=Cf(b);b=new webkitRTCPeerConnection(c);b.onicecandidate=a.G.bind(a);b.a=a.I.bind(a);b.oniceconnectionstatechange=a.H.bind(a);u(a.j,function(){return"Created webkitRTCPeerConnnection with config: "+JSON.stringify(c)});return b};wf.prototype.start=function(){this.b||(this.b=!0,Df(this))};wf.prototype.stop=function(){u(this.j,"Stopping peer connection...");this.b&&(this.b=!1,"closed"!=this.a.signalingState&&this.a.close());this.a=null};
  var Df=function(a){u(a.j,"Sending offer to peer.");a.h=Date.now();a.a.createOffer(a.K.bind(a),function(b){t(a.j,"Error creating offer.",b)},a.T);a.B.a.then(function(b){a.A(b)})};wf.prototype.K=function(a){var b=this;u(this.j,function(){return"Setting local description: "+JSON.stringify(a)});this.a.setLocalDescription(a,function(){u(b.j,"Local description set successfully")},function(a){t(b.j,"Error setting local description.",a)})};
  var Ef=function(a,b){v(a.j,function(){return"<===: "+JSON.stringify(b)});var c=new RTCSessionDescription(b);u(a.j,function(){return"Setting remote description: "+JSON.stringify(c)});a.a.setRemoteDescription(c,function(){u(a.j,"Remote description set successfully.")},function(b){t(a.j,"Error setting remote description.",b)})};
  wf.prototype.G=function(a){var b=this;a.candidate?(this.g++,this.w=Date.now(),1==this.g?this.f=setTimeout(function(){u(b.j,"ICE candidate gathering timed out.");b.f=null;Ff(b)},5E3):this.u&&t(this.j,"Received ICE candidate after resolving session description.")):(u(this.j,"End of ICE candidates."),oe("MediaRouter.WebRtc.IceCandidateGathering.Duration.Reported",Date.now()-this.h),Ff(this),0<this.g&&oe("MediaRouter.WebRtc.IceCandidateGathering.Duration.Real",this.w-this.h))};
  wf.prototype.I=function(){"completed"==this.a.iceGatheringState&&Ff(this)};var Ff=function(a){clearTimeout(a.f);a.f=null;if(!a.u){u(a.j,"Resolving sesion description after gathering "+a.g+" ICE candidates.");var b=a.a.localDescription;a.B.resolve({type:b.type,sdp:b.sdp});a.u=!0}};
  wf.prototype.H=function(a){var b=this;if(this.a){var c=this.a.iceConnectionState;u(this.j,"New ICE connection state: "+c+".");"connected"==c?this.m("iceconnected"):"completed"==c?this.m("icecompleted"):"failed"==c?(t(this.j,function(){return"Ice connection failed: "+JSON.stringify(a)}),this.v("icefailed")):"closed"==c?this.s("iceclosed"):"disconnected"==c&&(t(this.j,"Ice connection state is bad."),this.b&&(u(this.j,"Restarting ICE."),this.a.createOffer(this.K.bind(this),function(a){t(b.j,"Error creating new offer.",
  a)},Gf)))}};var uf={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},Gf={mandatory:{IceRestart:!0,OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};var Hf=window.localStorage,If=0,Kf=function(a){return(a=window.localStorage.getItem(Jf(a,!1)))?JSON.parse(a):null},Lf=function(a){return(a=window.localStorage.getItem(Jf(a,!0)))?JSON.parse(a):null},Nf=function(a){if(Mf.has(a.fa()))throw Error("Duplicate instance name "+a.fa());Mf.set(a.fa(),a);a.wa()},Tf=function(a){for(var b=0,c=ja(Object.keys(Hf)),d=c.next();!d.done;d=c.next()){var d=d.value,e=d.length+window.localStorage.getItem(d).length;d.startsWith("mr.")?If+=e:b+=e}Of=a;(window.localStorage.getItem("version")&&
  window.localStorage.getItem("version")!==chrome.runtime.getManifest().version||Pf(a))&&Qf();u(Rf,"initialize: "+If+" chars used, "+b+" other chars");chrome.runtime.onSuspend.addListener(Sf)},Of=null,Rf=Ia("mr.PersistentDataManager"),Mf=new Map,Jf=function(a,b){return"mr."+(b?"persistent.":"temp.")+a.fa()},Pf=function(a){return!!window.localStorage.getItem("mrInstanceId")&&window.localStorage.getItem("mrInstanceId")!==a},Sf=function(){u(Rf,"onSuspend");Uf("version",chrome.runtime.getManifest().version);
  Of&&Uf("mrInstanceId",Of);Mf.forEach(Vf)},Vf=function(a){var b=a.sa();b&&void 0!=b[0]&&Uf(Jf(a,!1),JSON.stringify(b[0]));b&&void 0!=b[1]&&Uf(Jf(a,!0),JSON.stringify(b[1]))},Uf=function(a,b){var c=window.localStorage.getItem(a);c=null!=c?b.length-c.length:a.length+b.length;52E5<If+c&&(t(Rf,"Unable to write "+c+" chars"),Qf());if(52E5<If+c)throw Rf.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.");}If+=c},Wf=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 a=d.result,f=[],g=0,l=a.byteLength;g<l;g+=8192)f.push(String.fromCharCode.apply(null,new Uint16Array(a,g,Math.min(l-g,8192)/2)));Uf("mr.temp.mirror.cast.Service.eventsBlob",
  f.join(""));b()}catch(r){c(r)}};d.readAsArrayBuffer(a)})},Qf=function(){for(var a=ja(Object.keys(Hf)),b=a.next();!b.done;b=a.next())b=b.value,b.startsWith("mr.temp.")&&(If-=b.length+window.localStorage.getItem(b).length,delete window.localStorage[b]);u(Rf,"removeTemporary_: "+If+" chars used")};var Xf=function(a,b,c){this.l=c;this.f=a;this.g=b;this.b=0;this.a=null};Xf.prototype.get=function(){if(0<this.b){this.b--;var a=this.a;this.a=a.next;a.next=null}else a=this.f();return a};var Yf=function(a,b){a.g(b);a.b<a.l&&(a.b++,b.next=a.a,a.a=b)};var Zf=function(a){return function(){return a}},$f=Zf(!1),ag=Zf(!0),bg=function(a){return a},cg=function(a){return function(){throw Error(a);}},dg=function(a){var b=b||0;return function(){return a.apply(this,Array.prototype.slice.call(arguments,0,b))}};var eg=function(a){na.setTimeout(function(){throw a;},0)},fg,gg=function(){var a=na.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!sc("Presto")&&(a=function(){var a=document.createElement("IFRAME");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host,
  a=n(function(a){if(("*"==d||a.origin==d)&&a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&!sc("Trident")&&!sc("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(k(c.next)){c=c.next;var a=c.af;c.af=null;a()}};return function(a){d.next={af:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?
  function(a){var b=document.createElement("SCRIPT");b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){na.setTimeout(a,0)}};var hg=function(){this.b=this.a=null},jg=new Xf(function(){return new ig},function(a){a.reset()},100);hg.prototype.add=function(a,b){var c=jg.get();c.set(a,b);this.b?this.b.next=c:this.a=c;this.b=c};hg.prototype.remove=function(){var a=null;this.a&&(a=this.a,this.a=this.a.next,this.a||(this.b=null),a.next=null);return a};var ig=function(){this.next=this.scope=this.a=null};ig.prototype.set=function(a,b){this.a=a;this.scope=b;this.next=null};
  ig.prototype.reset=function(){this.next=this.scope=this.a=null};var pg=function(a,b){kg||lg();mg||(kg(),mg=!0);og.add(a,b)},kg,lg=function(){if(-1!=String(na.Promise).indexOf("[native code]")){var a=na.Promise.resolve(void 0);kg=function(){a.then(qg)}}else kg=function(){var a=qg;!wa(na.setImmediate)||na.Window&&na.Window.prototype&&!sc("Edge")&&na.Window.prototype.setImmediate==na.setImmediate?(fg||(fg=gg()),fg(a)):na.setImmediate(a)}},mg=!1,og=new hg,qg=function(){for(var a;a=og.remove();){try{a.a.call(a.scope)}catch(b){eg(b)}Yf(jg,a)}mg=!1};var rg=function(){return sc("iPhone")&&!sc("iPod")&&!sc("iPad")},sg=function(){return rg()||sc("iPad")||sc("iPod")};var tg=function(a){tg[" "](a);return a};tg[" "]=qa;var ug=function(a,b){try{return tg(a[b]),!0}catch(c){}return!1},wg=function(a,b){var c=vg;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var xg=function(){return na.navigator||null},yg=sc("Opera"),zg=sc("Trident")||sc("MSIE"),Ag=sc("Edge"),Bg=sc("Gecko")&&!(-1!=pc.toLowerCase().indexOf("webkit")&&!sc("Edge"))&&!(sc("Trident")||sc("MSIE"))&&!sc("Edge"),Cg=-1!=pc.toLowerCase().indexOf("webkit")&&!sc("Edge"),Dg=Cg&&sc("Mobile"),Eg=xg(),Fg=Eg&&Eg.platform||"",Gg=sc("Macintosh"),Hg=sc("Windows"),Ig=sc("Linux")||sc("CrOS"),Jg=sc("Android"),Kg=rg(),Lg=sc("iPad"),Mg=sc("iPod"),Ng=function(){var a=na.document;return a?a.documentMode:void 0},
  Og;a:{var Pg="",Qg=function(){var a=pc;if(Bg)return/rv\:([^\);]+)(\)|;)/.exec(a);if(Ag)return/Edge\/([\d\.]+)/.exec(a);if(zg)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(Cg)return/WebKit\/(\S+)/.exec(a);if(yg)return/(?:Version)[ \/]?(\S+)/.exec(a)}();Qg&&(Pg=Qg?Qg[1]:"");if(zg){var Rg=Ng();if(null!=Rg&&Rg>parseFloat(Pg)){Og=String(Rg);break a}}Og=Pg}var Sg=Og,vg={},Tg=function(a){return wg(a,function(){return 0<=kb(Sg,a)})},Ug;var Vg=na.document;
  Ug=Vg&&zg?Ng()||("CSS1Compat"==Vg.compatMode?parseInt(Sg,10):5):void 0;var Wg=function(a){if("undefined"==typeof a)return"undefined";if(null==a)return"NULL";var b=[],c;for(c in a)if(!wa(a[c])){var d=c+" = ";try{d+=a[c]}catch(e){d+="*** "+e+" ***"}b.push(d)}return b.join("\n")},Xg=function(a){var b=[],c=[],d={},e=function(a,g){var f=g+"  ";try{if(k(a))if(null===a)b.push("NULL");else if(oa(a))b.push('"'+a.replace(/\n/g,"\n"+g)+'"');else if(wa(a))b.push(String(a).replace(/\n/g,"\n"+g));else if(xa(a)){a[ya]||c.push(a);var r=a[ya]||(a[ya]=++Aa);if(d[r])b.push("*** reference loop detected (id="+
  r+") ***");else{d[r]=!0;b.push("{");for(var y in a)wa(a[y])||(b.push("\n"),b.push(f),b.push(y+" = "),e(a[y],f));b.push("\n"+g+"}");delete d[r]}}else b.push(a);else b.push("undefined")}catch(z){b.push("*** "+z+" ***")}};e(a,"");for(a=0;a<c.length;a++)za(c[a]);return b.join("")},Yg=function(a){var b=Yg;var c=Error();if(Error.captureStackTrace)Error.captureStackTrace(c,b),b=String(c.stack);else{try{throw c;}catch(e){c=e}b=(b=c.stack)?String(b):null}if(b)return b;b=[];for(var c=arguments.callee.caller,
  d=0;c&&(!a||d<a);){b.push(Zg(c));b.push("()\n");try{c=c.caller}catch(e){b.push("[exception trying to get caller]\n");break}d++;if(50<=d){b.push("[...long stack...]");break}}a&&d>=a?b.push("[...reached max depth limit...]"):b.push("[end]");return b.join("")},Zg=function(a){if($g[a])return $g[a];a=String(a);if(!$g[a]){var b=/function ([^\(]+)/.exec(a);$g[a]=b?b[1]:"[Anonymous]"}return $g[a]},$g={};var ah=function(a,b,c,d,e){this.reset(a,b,c,d,e)};ah.prototype.a=null;var bh=0;ah.prototype.reset=function(a,b,c,d,e){"number"==typeof e||bh++;this.l=d||Ea();this.b=a;this.g=b;this.f=c;delete this.a};ah.prototype.getMessage=function(){return this.g};var ch=function(a){this.l=a;this.a=this.g=this.b=this.f=null},dh=function(a,b){this.name=a;this.value=b};dh.prototype.toString=function(){return this.name};var eh=new dh("SEVERE",1E3),fh=new dh("WARNING",900),gh=new dh("INFO",800),hh=new dh("CONFIG",700),ih=new dh("FINE",500),jh=new dh("FINER",400),kh=new dh("ALL",0);ch.prototype.getName=function(){return this.l};ch.prototype.getChildren=function(){this.g||(this.g={});return this.g};
  var lh=function(a){if(a.b)return a.b;if(a.f)return lh(a.f);pb("Root logger has no level set.");return null};ch.prototype.log=function(a,b,c){a.value>=lh(this).value&&(wa(b)&&(b=b()),a=new ah(a,String(b),this.l),c&&(a.a=c),mh(this,a))};ch.prototype.config=function(a,b){this.log(hh,a,b)};ch.prototype.logRecord=function(a){a.b.value>=lh(this).value&&mh(this,a)};
  var mh=function(a,b){var c="log:"+b.getMessage();na.console&&(na.console.timeStamp?na.console.timeStamp(c):na.console.markTimeline&&na.console.markTimeline(c));for(na.msWriteProfilerMark&&na.msWriteProfilerMark(c);a;){var d=a,e=b;if(d.a)for(var f=0;c=d.a[f];f++)c(e);a=a.f}},nh={},oh=null,ph=function(){oh||(oh=new ch(""),nh[""]=oh,oh.b=hh)},qh=function(a){ph();var b;if(!(b=nh[a])){b=new ch(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=qh(a.substr(0,c));c.getChildren()[d]=b;b.f=c;nh[a]=b}return b};var rh=function(){this.u=this.u;this.T=this.T};rh.prototype.u=!1;rh.prototype.ta=function(){this.u||(this.u=!0,this.X())};rh.prototype.l=function(a){sh(this,Da(th,a))};var sh=function(a,b){a.u?k(void 0)?b.call(void 0):b():(a.T||(a.T=[]),a.T.push(k(void 0)?n(b,void 0):b))};rh.prototype.X=function(){if(this.T)for(;this.T.length;)this.T.shift()()};var th=function(a){a&&"function"==typeof a.ta&&a.ta()},uh=function(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];va(d)?uh.apply(null,d):th(d)}};var vh=!zg||9<=Number(Ug),wh=zg&&!Tg("9");!Cg||Tg("528");Bg&&Tg("1.9b")||zg&&Tg("8")||yg&&Tg("9.5")||Cg&&Tg("528");Bg&&!Tg("8")||zg&&Tg("9");var A=function(a,b){this.type=a;this.f=this.target=b;this.Kh=!0};A.prototype.g=function(){this.Kh=!1};var xh=function(a,b){A.call(this,a?a.type:"");this.relatedTarget=this.f=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key="";this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.a=this.state=null;a&&this.init(a,b)};q(xh,A);
  xh.prototype.init=function(a,b){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.f=b;(b=a.relatedTarget)?Bg&&(ug(b,"nodeName")||(b=null)):"mouseover"==c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;null===d?(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.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.button=a.button;this.key=a.key||"";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.a=a;a.defaultPrevented&&this.g()};xh.prototype.g=function(){xh.V.g.call(this);var a=this.a;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,wh)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var yh="closure_listenable_"+(1E6*Math.random()|0),zh=function(a){return!(!a||!a[yh])},Ah=0;var Bh=function(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.Ma=e;this.key=++Ah;this.removed=this.fe=!1},Ch=function(a){a.removed=!0;a.listener=null;a.proxy=null;a.src=null;a.Ma=null};var Eh=function(a){this.src=a;this.a={};this.b=0};Eh.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var g=Fh(a,b,d,e);-1<g?(b=a[g],c||(b.fe=!1)):(b=new Bh(b,this.src,f,!!d,e),b.fe=c,a.push(b));return b};Eh.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.a))return!1;var e=this.a[a];b=Fh(e,b,c,d);return-1<b?(Ch(e[b]),Hb(e,b),0==e.length&&(delete this.a[a],this.b--),!0):!1};
  var Gh=function(a,b){var c=b.type;if(!(c in a.a))return!1;var d=Ib(a.a[c],b);d&&(Ch(b),0==a.a[c].length&&(delete a.a[c],a.b--));return d};Eh.prototype.removeAll=function(a){a=a&&a.toString();var b=0,c;for(c in this.a)if(!a||c==a){for(var d=this.a[c],e=0;e<d.length;e++)++b,Ch(d[e]);delete this.a[c];this.b--}return b};
  var Hh=function(a,b,c,d,e){a=a.a[b.toString()];b=-1;a&&(b=Fh(a,c,d,e));return-1<b?a[b]:null},Fh=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.Ma==d)return e}return-1};var Ih="closure_lm_"+(1E6*Math.random()|0),Jh={},Kh=0,Lh=function(a,b,c,d,e){if(ua(b)){for(var f=0;f<b.length;f++)Lh(a,b[f],c,d,e);return null}c=Mh(c);return zh(a)?a.listen(b,c,d,e):Nh(a,b,c,!1,d,e)},Nh=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=!!e,l=Oh(a);l||(a[Ih]=l=new Eh(a));c=l.add(b,c,d,e,f);if(c.proxy)return c;d=Ph();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)a.addEventListener(b.toString(),d,g);else if(a.attachEvent)a.attachEvent(Qh(b.toString()),d);else throw Error("addEventListener and attachEvent are unavailable.");
  Kh++;return c},Ph=function(){var a=Rh,b=vh?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},Sh=function(a,b,c,d,e){if(ua(b)){for(var f=0;f<b.length;f++)Sh(a,b[f],c,d,e);return null}c=Mh(c);return zh(a)?Th(a,b,c,d,e):Nh(a,b,c,!0,d,e)},Uh=function(a,b,c,d,e){if(ua(b))for(var f=0;f<b.length;f++)Uh(a,b[f],c,d,e);else c=Mh(c),zh(a)?a.w(b,c,d,e):a&&(a=Oh(a))&&(b=Hh(a,b,c,!!d,e))&&Vh(b)},Vh=function(a){if(m(a)||!a||a.removed)return!1;var b=
  a.src;if(zh(b))return Gh(b.xb,a);var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent&&b.detachEvent(Qh(c),d);Kh--;(c=Oh(b))?(Gh(c,a),0==c.b&&(c.src=null,b[Ih]=null)):Ch(a);return!0},Qh=function(a){return a in Jh?Jh[a]:Jh[a]="on"+a},Xh=function(a,b,c,d){var e=!0;if(a=Oh(a))if(b=a.a[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.removed&&(f=Wh(f,d),e=e&&!1!==f)}return e},Wh=function(a,b){var c=a.listener,d=a.Ma||a.src;a.fe&&
  Vh(a);return c.call(d,b)},Rh=function(a,b){if(a.removed)return!0;if(!vh){var c=b||pa("window.event");b=new xh(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.f;e;e=e.parentNode)c.push(e);for(var e=a.type,f=c.length-1;0<=f;f--)b.f=c[f],a=Xh(c[f],e,!0,b),d=d&&a;for(f=0;f<c.length;f++)b.f=c[f],a=Xh(c[f],e,!1,b),d=d&&a}return d}return Wh(a,new xh(b,this))},Oh=function(a){a=
  a[Ih];return a instanceof Eh?a:null},Yh="__closure_events_fn_"+(1E9*Math.random()>>>0),Mh=function(a){if(wa(a))return a;a[Yh]||(a[Yh]=function(b){return a.handleEvent(b)});return a[Yh]};var B=function(){rh.call(this);this.xb=new Eh(this);this.Di=this;this.K=null};q(B,rh);B.prototype[yh]=!0;B.prototype.removeEventListener=function(a,b,c,d){Uh(this,a,b,c,d)};
  B.prototype.dispatchEvent=function(a){var b,c=this.K;if(c)for(b=[];c;c=c.K)b.push(c);var c=this.Di,d=a.type||a;if(oa(a))a=new A(a,c);else if(a instanceof A)a.target=a.target||c;else{var e=a;a=new A(d,c);kc(a,e)}var e=!0;if(b)for(var f=b.length-1;0<=f;f--){var g=a.f=b[f];e=Zh(g,d,!0,a)&&e}g=a.f=c;e=Zh(g,d,!0,a)&&e;e=Zh(g,d,!1,a)&&e;if(b)for(f=0;f<b.length;f++)g=a.f=b[f],e=Zh(g,d,!1,a)&&e;return e};B.prototype.X=function(){B.V.X.call(this);this.xb&&this.xb.removeAll(void 0);this.K=null};
  B.prototype.listen=function(a,b,c,d){return this.xb.add(String(a),b,!1,c,d)};var Th=function(a,b,c,d,e){return a.xb.add(String(b),c,!0,d,e)};B.prototype.w=function(a,b,c,d){return this.xb.remove(String(a),b,c,d)};var Zh=function(a,b,c,d){b=a.xb.a[String(b)];if(!b)return!0;b=b.concat();for(var e=!0,f=0;f<b.length;++f){var g=b[f];if(g&&!g.removed&&g.capture==c){var l=g.listener,r=g.Ma||g.src;g.fe&&Gh(a.xb,g);e=!1!==l.call(r,d)&&e}}return e&&0!=d.Kh};var $h="StopIteration"in na?na.StopIteration:{message:"StopIteration",stack:""},ai=function(){};ai.prototype.next=function(){throw $h;};ai.prototype.Oa=function(){return this};
  var bi=function(a){if(a instanceof ai)return a;if("function"==typeof a.Oa)return a.Oa(!1);if(va(a)){var b=0,c=new ai;c.next=function(){for(;;){if(b>=a.length)throw $h;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");},ci=function(a,b,c){if(va(a))try{w(a,b,c)}catch(d){if(d!==$h)throw d;}else{a=bi(a);try{for(;;)b.call(c,a.next(),void 0,a)}catch(d){if(d!==$h)throw d;}}},di=function(a,b){a=bi(a);try{for(;!b.call(void 0,a.next(),void 0,a););}catch(c){if(c!==$h)throw c;}},ei=function(a){if(va(a))return x(a);
  a=bi(a);var b=[];ci(a,function(a){b.push(a)});return b};var fi=na.JSON.parse,gi=na.JSON.stringify;var hi=function(a,b,c){a&&a.log(b,c,void 0)},ii=function(a,b,c){a&&a.log(eh,b,c)},C=function(a,b,c){a&&a.log(fh,b,c)},D=function(a,b){a&&a.log(gh,b,void 0)},ji=function(a,b){a&&a.log(ih,b,void 0)};var ki=function(){};ki.prototype.a=null;var mi=function(a){var b;(b=a.a)||(b={},li(a)&&(b[0]=!0,b[1]=!0),b=a.a=b);return b};var ni,oi=function(){};q(oi,ki);var pi=function(a){return(a=li(a))?new ActiveXObject(a):new XMLHttpRequest},li=function(a){if(!a.b&&"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.b=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.b};ni=new oi;var ri=function(a,b){this.b={};this.a=[];this.g=this.f=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&&qi(this,a)};h=ri.prototype;h.da=function(){return this.f};h.P=function(){si(this);for(var a=[],b=0;b<this.a.length;b++)a.push(this.b[this.a[b]]);return a};h.Ka=function(){si(this);return this.a.concat()};h.La=function(a){return ti(this.b,a)};
  h.Lc=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b];if(ti(this.b,c)&&this.b[c]==a)return!0}return!1};h.equals=function(a,b){if(this===a)return!0;if(this.f!=a.da())return!1;b=b||ui;si(this);for(var c,d=0;c=this.a[d];d++)if(!b(this.get(c),a.get(c)))return!1;return!0};var ui=function(a,b){return a===b};ri.prototype.jb=function(){return 0==this.f};ri.prototype.clear=function(){this.b={};this.g=this.f=this.a.length=0};
  ri.prototype.remove=function(a){return ti(this.b,a)?(delete this.b[a],this.f--,this.g++,this.a.length>2*this.f&&si(this),!0):!1};var si=function(a){var b,c;if(a.f!=a.a.length){for(b=c=0;c<a.a.length;){var d=a.a[c];ti(a.b,d)&&(a.a[b++]=d);c++}a.a.length=b}if(a.f!=a.a.length){var e={};for(b=c=0;c<a.a.length;)d=a.a[c],ti(e,d)||(a.a[b++]=d,e[d]=1),c++;a.a.length=b}};ri.prototype.get=function(a,b){return ti(this.b,a)?this.b[a]:b};
  ri.prototype.set=function(a,b){ti(this.b,a)||(this.f++,this.a.push(a),this.g++);this.b[a]=b};var qi=function(a,b){if(b instanceof ri){var c=b.Ka();b=b.P()}else c=ac(b),b=$b(b);for(var d=0;d<c.length;d++)a.set(c[d],b[d])};ri.prototype.forEach=function(a,b){for(var c=this.Ka(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};ri.prototype.clone=function(){return new ri(this)};var vi=function(a){si(a);for(var b={},c=0;c<a.a.length;c++){var d=a.a[c];b[d]=a.b[d]}return b};
  ri.prototype.Oa=function(a){si(this);var b=0,c=this.g,d=this,e=new ai;e.next=function(){if(c!=d.g)throw Error("The map has changed since the iterator was created");if(b>=d.a.length)throw $h;var e=d.a[b++];return a?e:d.b[e]};return e};var ti=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var wi=function(a){return a.da&&"function"==typeof a.da?a.da():va(a)||oa(a)?a.length:Zb(a)},xi=function(a){if(a.P&&"function"==typeof a.P)return a.P();if(oa(a))return a.split("");if(va(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return $b(a)},yi=function(a){if(a.Ka&&"function"==typeof a.Ka)return a.Ka();if(!a.P||"function"!=typeof a.P){if(va(a)||oa(a)){var b=[];a=a.length;for(var c=0;c<a;c++)b.push(c);return b}return ac(a)}},zi=function(a){return a.jb&&"function"==typeof a.jb?a.jb():
  va(a)||oa(a)?Cb(a):dc(a)},Ai=function(a,b,c){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,c);else if(va(a)||oa(a))w(a,b,c);else for(var d=yi(a),e=xi(a),f=e.length,g=0;g<f;g++)b.call(c,e[g],d&&d[g],a)},Bi=function(a,b,c){if("function"==typeof a.map)return a.map(b,c);if(va(a)||oa(a))return ub(a,b,c);var d=yi(a),e=xi(a),f=e.length;if(d){var g={};for(var l=0;l<f;l++)g[d[l]]=b.call(c,e[l],d[l],a)}else for(g=[],l=0;l<f;l++)g[l]=b.call(c,e[l],void 0,a);return g},Ci=function(a,b){if("function"==
  typeof a.every)return a.every(b,void 0);if(va(a)||oa(a))return xb(a,b,void 0);for(var c=yi(a),d=xi(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 Di=function(a){a.prototype.then=a.prototype.then;a.prototype.$goog_Thenable=!0},Ei=function(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}};var Hi=function(a,b){this.a=0;this.m=void 0;this.g=this.b=this.f=null;this.l=this.h=!1;if(a!=qa)try{var c=this;a.call(b,function(a){Fi(c,2,a)},function(a){if(!(a instanceof Gi))try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(e){}Fi(c,3,a)})}catch(d){Fi(this,3,d)}},Ii=function(){this.next=this.g=this.b=this.l=this.a=null;this.f=!1};Ii.prototype.reset=function(){this.g=this.b=this.l=this.a=null;this.f=!1};
  var Ji=new Xf(function(){return new Ii},function(a){a.reset()},100),Ki=function(a,b,c){var d=Ji.get();d.l=a;d.b=b;d.g=c;return d},Li=function(a){if(a instanceof Hi)return a;var b=new Hi(qa);Fi(b,2,a);return b},Mi=function(a){return new Hi(function(b,c){c(a)})},Oi=function(a,b,c){Ni(a,b,c,null)||pg(Da(b,a))},Pi=function(a){return new Hi(function(b,c){a.length||b(void 0);for(var d=0,e;d<a.length;d++)e=a[d],Oi(e,b,c)})},Qi=function(a){return new Hi(function(b,c){var d=a.length,e=[];if(d)for(var f=function(a,
  c){d--;e[a]=c;0==d&&b(e)},g=function(a){c(a)},l=0,r;l<a.length;l++)r=a[l],Oi(r,Da(f,l),g);else b(e)})},Ri=function(a){return new Hi(function(b){var c=a.length,d=[];if(c)for(var e=function(a,e,f){c--;d[a]=e?{fc:!0,value:f}:{fc:!1,reason:f};0==c&&b(d)},f=0,g;f<a.length;f++)g=a[f],Oi(g,Da(e,f,!0),Da(e,f,!1));else b(d)})},ec=function(){var a,b,c=new Hi(function(c,e){a=c;b=e});return new Si(c,a,b)};Hi.prototype.then=function(a,b,c){return Ti(this,wa(a)?a:null,wa(b)?b:null,c)};Di(Hi);
  var Vi=function(a,b,c){b=Ki(b,b,c);b.f=!0;Ui(a,b);return a},Wi=function(a,b,c){return Ti(a,null,b,c)};Hi.prototype.cancel=function(a){0==this.a&&pg(function(){var b=new Gi(a);Xi(this,b)},this)};
  var Xi=function(a,b){if(0==a.a)if(a.f){var c=a.f;if(c.b){for(var d=0,e=null,f=null,g=c.b;g&&(g.f||(d++,g.a==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(0==c.a&&1==d?Xi(c,b):(f?(d=f,d.next==c.g&&(c.g=d),d.next=d.next.next):Yi(c),Zi(c,e,3,b)))}a.f=null}else Fi(a,3,b)},Ui=function(a,b){a.b||2!=a.a&&3!=a.a||$i(a);a.g?a.g.next=b:a.b=b;a.g=b},Ti=function(a,b,c,d){var e=Ki(null,null,null);e.a=new Hi(function(a,g){e.l=b?function(c){try{var e=b.call(d,c);a(e)}catch(y){g(y)}}:a;e.b=c?function(b){try{var e=c.call(d,
  b);!k(e)&&b instanceof Gi?g(b):a(e)}catch(y){g(y)}}:g});e.a.f=a;Ui(a,e);return e.a};Hi.prototype.w=function(a){this.a=0;Fi(this,2,a)};Hi.prototype.s=function(a){this.a=0;Fi(this,3,a)};
  var Fi=function(a,b,c){0==a.a&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.a=1,Ni(c,a.w,a.s,a)||(a.m=c,a.a=b,a.f=null,$i(a),3!=b||c instanceof Gi||aj(a,c)))},Ni=function(a,b,c,d){if(a instanceof Hi)return Ui(a,Ki(b||qa,c||null,d)),!0;if(Ei(a))return a.then(b,c,d),!0;if(xa(a))try{var e=a.then;if(wa(e))return bj(a,e,b,c,d),!0}catch(f){return c.call(d,f),!0}return!1},bj=function(a,b,c,d,e){var f=!1,g=function(a){f||(f=!0,c.call(e,a))},l=function(a){f||(f=!0,d.call(e,a))};try{b.call(a,
  g,l)}catch(r){l(r)}},$i=function(a){a.h||(a.h=!0,pg(a.u,a))},Yi=function(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.g=null);return b};Hi.prototype.u=function(){for(var a;a=Yi(this);)Zi(this,a,this.a,this.m);this.h=!1};
  var Zi=function(a,b,c,d){if(3==c&&b.b&&!b.f)for(;a&&a.l;a=a.f)a.l=!1;if(b.a)b.a.f=null,cj(b,c,d);else try{b.f?b.l.call(b.g):cj(b,c,d)}catch(e){dj.call(null,e)}Yf(Ji,b)},cj=function(a,b,c){2==b?a.l.call(a.g,c):a.b&&a.b.call(a.g,c)},aj=function(a,b){a.l=!0;pg(function(){a.l&&dj.call(null,b)})},dj=eg,Gi=function(a){mb.call(this,a)};q(Gi,mb);Gi.prototype.name="cancel";var Si=function(a,b,c){this.a=a;this.resolve=b;this.reject=c};var ej=function(a,b){B.call(this);this.b=a||1;this.a=b||na;this.f=n(this.bm,this);this.g=Ea()};q(ej,B);h=ej.prototype;h.enabled=!1;h.tb=null;h.bm=function(){if(this.enabled){var a=Ea()-this.g;0<a&&a<.8*this.b?this.tb=this.a.setTimeout(this.f,this.b-a):(this.tb&&(this.a.clearTimeout(this.tb),this.tb=null),this.dispatchEvent("tick"),this.enabled&&(this.tb=this.a.setTimeout(this.f,this.b),this.g=Ea()))}};h.start=function(){this.enabled=!0;this.tb||(this.tb=this.a.setTimeout(this.f,this.b),this.g=Ea())};
  h.stop=function(){this.enabled=!1;this.tb&&(this.a.clearTimeout(this.tb),this.tb=null)};h.X=function(){ej.V.X.call(this);this.stop();delete this.a};
  var fj=function(a,b,c){if(wa(a))c&&(a=n(a,c));else if(a&&"function"==typeof a.handleEvent)a=n(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:na.setTimeout(a,b||0)},gj=function(a){na.clearTimeout(a)},hj=function(a){var b=null;return Wi(new Hi(function(c,d){b=fj(function(){c(void 0)},a);-1==b&&d(Error("Failed to schedule timer."))}),function(a){gj(b);throw a;})};var ij=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/,jj=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," ")):"")}}},kj=function(a,b,c){c=null!=c?"="+encodeURIComponent(String(c)):"";if(b+=c){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;a=a[0]+(a[1]?"?"+a[1]:"")+a[2]}return a},lj=/#|$/,mj=function(a,b){var c=a.search(lj);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," "))},nj=function(a,b){var c=a.length-1;0<=c&&
  a.indexOf("/",c)==c&&(a=a.substr(0,a.length-1));0==b.lastIndexOf("/",0)&&(b=b.substr(1));return hb(a,"/",b)};var oj=function(a){B.call(this);this.headers=new ri;this.O=a||null;this.b=!1;this.I=this.a=null;this.ba=this.G="";this.m=0;this.f="";this.g=this.Y=this.B=this.U=!1;this.h=0;this.v=null;this.s="";this.H=this.A=!1};q(oj,B);oj.prototype.j=qh("goog.net.XhrIo");var pj=/^https?$/i,qj=["POST","PUT"],rj=[],sj=function(a,b,c,d,e,f,g){var l=new oj;rj.push(l);b&&l.listen("complete",b);Th(l,"ready",l.oa);f&&(l.h=Math.max(0,f));g&&(l.A=g);l.send(a,c,d,e);return l};oj.prototype.oa=function(){this.ta();Ib(rj,this)};
  oj.prototype.send=function(a,b,c,d){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.G+"; newUri="+a);b=b?b.toUpperCase():"GET";this.G=a;this.f="";this.m=0;this.ba=b;this.U=!1;this.b=!0;this.a=this.O?pi(this.O):pi(ni);this.I=this.O?mi(this.O):mi(ni);this.a.onreadystatechange=n(this.ga,this);try{ji(this.j,tj(this,"Opening Xhr")),this.Y=!0,this.a.open(b,String(a),!0),this.Y=!1}catch(f){ji(this.j,tj(this,"Error opening Xhr: "+f.message));uj(this,f);return}a=c||"";
  var e=this.headers.clone();d&&Ai(d,function(a,b){e.set(b,a)});d=zb(e.Ka(),vj);c=na.FormData&&a instanceof na.FormData;!Bb(qj,b)||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(a,b){this.a.setRequestHeader(b,a)},this);this.s&&(this.a.responseType=this.s);"withCredentials"in this.a&&this.a.withCredentials!==this.A&&(this.a.withCredentials=this.A);try{wj(this),0<this.h&&(this.H=xj(this.a),ji(this.j,tj(this,"Will abort after "+this.h+"ms if incomplete, xhr2 "+
  this.H)),this.H?(this.a.timeout=this.h,this.a.ontimeout=n(this.ka,this)):this.v=fj(this.ka,this.h,this)),ji(this.j,tj(this,"Sending request")),this.B=!0,this.a.send(a),this.B=!1}catch(f){ji(this.j,tj(this,"Send error: "+f.message)),uj(this,f)}};var xj=function(a){return zg&&Tg(9)&&m(a.timeout)&&k(a.ontimeout)},vj=function(a){return Sa("Content-Type",a)};
  oj.prototype.ka=function(){"undefined"!=typeof ma&&this.a&&(this.f="Timed out after "+this.h+"ms, aborting",this.m=8,ji(this.j,tj(this,this.f)),this.dispatchEvent("timeout"),this.abort(8))};var uj=function(a,b){a.b=!1;a.a&&(a.g=!0,a.a.abort(),a.g=!1);a.f=b;a.m=5;yj(a);zj(a)},yj=function(a){a.U||(a.U=!0,a.dispatchEvent("complete"),a.dispatchEvent("error"))};
  oj.prototype.abort=function(a){this.a&&this.b&&(ji(this.j,tj(this,"Aborting")),this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.m=a||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),zj(this))};oj.prototype.X=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),zj(this,!0));oj.V.X.call(this)};oj.prototype.ga=function(){this.u||(this.Y||this.B||this.g?Aj(this):this.ia())};oj.prototype.ia=function(){Aj(this)};
  var Aj=function(a){if(a.b&&"undefined"!=typeof ma)if(a.I[1]&&4==Bj(a)&&2==a.za())ji(a.j,tj(a,"Local request error detected and ignored"));else if(a.B&&4==Bj(a))fj(a.ga,0,a);else if(a.dispatchEvent("readystatechange"),4==Bj(a)){ji(a.j,tj(a,"Request complete"));a.b=!1;try{if(Cj(a))a.dispatchEvent("complete"),a.dispatchEvent("success");else{a.m=6;try{var b=2<Bj(a)?a.a.statusText:""}catch(c){ji(a.j,"Can not get status: "+c.message),b=""}a.f=b+" ["+a.za()+"]";yj(a)}}finally{zj(a)}}},zj=function(a,b){if(a.a){wj(a);
  var c=a.a,d=a.I[0]?qa:null;a.a=null;a.I=null;b||a.dispatchEvent("ready");try{c.onreadystatechange=d}catch(e){ii(a.j,"Problem encountered resetting onreadystatechange: "+e.message)}}},wj=function(a){a.a&&a.H&&(a.a.ontimeout=null);m(a.v)&&(gj(a.v),a.v=null)},Cj=function(a){var b=a.za();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.G).match(ij)[1]||null,!a&&na.self&&na.self.location&&(a=na.self.location.protocol,
  a=a.substr(0,a.length-1)),b=!pj.test(a?a.toLowerCase():"");c=b}return c},Bj=function(a){return a.a?a.a.readyState:0};oj.prototype.za=function(){try{return 2<Bj(this)?this.a.status:-1}catch(a){return-1}};
  var Dj=function(a){try{return a.a?a.a.responseText:""}catch(b){return ji(a.j,"Can not get responseText: "+b.message),""}},Ej=function(a){if(a.a)return fi(a.a.responseText)},Fj=function(a){try{if(!a.a)return null;if("response"in a.a)return a.a.response;switch(a.s){case "":case "text":return a.a.responseText;case "arraybuffer":if("mozResponseArrayBuffer"in a.a)return a.a.mozResponseArrayBuffer}ii(a.j,"Response type "+a.s+" is not supported on this browser");return null}catch(b){return ji(a.j,"Can not get response: "+
  b.message),null}};oj.prototype.getResponseHeader=function(a){if(this.a&&4==Bj(this))return a=this.a.getResponseHeader(a),null===a?void 0:a};var Gj=function(a){var b={};a=(a.a&&4==Bj(a)?a.a.getAllResponseHeaders():"").split("\r\n");for(var c=0;c<a.length;c++)if(!Ua(a[c])){var d=lb(a[c],": ",2);b[d[0]]=b[d[0]]?b[d[0]]+(", "+d[1]):d[1]}return b},tj=function(a,b){return b+" ["+a.ba+" "+a.G+" "+a.za()+"]"};var Hj=function(){},Ij=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 Hj;b.g=a;a=ja(c);a.next();b.a=a.next().value;b.f=a.next().value;b.l=a.next().value;b.b=a.next().value;return b};Hj.prototype.Z=function(){return this.b};var Jj=function(a,b,c,d,e,f){this.id=a;this.sinkId=b;this.mediaSource=c;this.isLocal=d;this.description=e;this.iconUrl=f;this.allowStop=!0;this.customControllerPath=null;this.forDisplay=!0;this.offTheRecord=!1;this.Mc=d;this.isOffscreenPresentation=!1},Kj=function(a,b,c,d,e,f,g){return new Jj("urn:x-org.chromium:media:route:"+a+"/"+b+"-"+c+"/"+d,c,d,e,f,g)};var Lj=function(a){this.b=a;this.a=1E3*Math.floor(1E6*Math.random())},Mj=function(a){var b=a.a++;0==b&&(b=a.a++);return b};Lj.prototype.fa=function(){return"IdGenerator."+this.b};Lj.prototype.sa=function(){return[this.a]};Lj.prototype.wa=function(){var a=Kf(this);a&&(this.a=a)};window.navigator.userAgent.match(/Chrome\/([0-9]+)/);var Nj=function(a,b){this.type=a;this.entryPoint=b};p("castApp.frontEnd.ExtensionMessage",Nj);var Oj=function(a){return"urn:x-cast:com.google.cast."+a},Pj=Oj("tp.connection"),Qj=Oj("receiver"),Rj=Oj("remoting"),Sj=Oj("media"),Tj=Oj("webrtc"),Uj=Oj("broadcast"),Vj=ic({Qq:Pj,Rq:Oj("tp.heartbeat"),aq:Qj,gq:Rj,Lo:Sj,Oo:Oj("media.universalRemote.optIn"),kr:Tj,Jm:Uj});var Wj=function(a){return"available"==a||"available_rescan"==a};var Xj=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 Yj=(new Map).set("+","-").set("/","_").set("=","."),Zj=function(a){return btoa(String.fromCharCode.apply(String,[].concat(la(a)))).replace(/[+/=]/g,function(a){return Yj.get(a)})};var ak=function(){this.a=[];this.l=[];this.h=[];this.f=[];this.f[0]=128;for(var a=1;64>a;++a)this.f[a]=0;this.g=this.b=0;this.reset()};ak.prototype.reset=function(){this.a[0]=1732584193;this.a[1]=4023233417;this.a[2]=2562383102;this.a[3]=271733878;this.a[4]=3285377520;this.g=this.b=0};
  var bk=function(a,b,c){c=void 0===c?0:c;var d=a.h;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.a[0];c=a.a[1];for(var e=a.a[2],f=a.a[3],g=a.a[4],l,r,y=0;80>y;y++)40>y?20>y?(l=f^c&(e^f),r=1518500249):(l=c^e^f,r=1859775393):60>y?(l=c&e|f&(c|e),r=2400959708):(l=
  c^e^f,r=3395469782),l=(b<<5|b>>>27)+l+g+r+d[y]&4294967295,g=f,f=e,e=(c<<30|c>>>2)&4294967295,c=b,b=l;a.a[0]=a.a[0]+b&4294967295;a.a[1]=a.a[1]+c&4294967295;a.a[2]=a.a[2]+e&4294967295;a.a[3]=a.a[3]+f&4294967295;a.a[4]=a.a[4]+g&4294967295};
  ak.prototype.update=function(a,b){b=void 0===b?a.length:b;for(var c=b-64,d=0,e=this.l,f=this.b;d<b;){if(0==f)for(;d<=c;)bk(this,a,d),d+=64;if("string"===typeof a)for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,64==f){bk(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,64==f){bk(this,e);f=0;break}}this.b=f;this.g+=b};
  ak.prototype.digest=function(){var a=[],b=8*this.g;56>this.b?this.update(this.f,56-this.b):this.update(this.f,64-(this.b-56));for(var c=63;56<=c;c--)this.l[c]=b&255,b/=256;bk(this,this.l);for(c=b=0;5>c;c++)for(var d=24;0<=d;d-=8)a[b]=this.a[c]>>d&255,++b;return a};var ck=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)};var ek=function(){this.h=ck();this.b=new dk(null,null);this.a=new dk(null,null);this.l=[];this.g=this.f=0;Nf(this)},gk=function(){fk||(fk=new ek);return fk},hk=function(a,b){b=b.toLowerCase();var c=new ak;c.update(b);c.update(a.h);return"r"+Zj(c.digest())},ik=function(){var a=gk();return a.b.model?a.b:a.a.model?a.a:new dk(null,null)};ek.prototype.fa=function(){return"SinkUtils"};
  ek.prototype.sa=function(){return[{recentLaunchedDevice:this.b,recentDiscoveredDevice:this.a},{receiverIdToken:this.h,fixedIpList:this.l.join(","),castControlPort:this.f,lastCloudSinkCheckTimeMillis:this.g}]};
  ek.prototype.wa=function(){var a=Kf(this);a&&(this.b=a.recentLaunchedDevice||new dk(null,null),this.a=a.recentDiscoveredDevice||new dk(null,null));if(a=Lf(this))this.h=a.receiverIdToken||ck(),this.l=a.fixedIpList&&a.fixedIpList.split(",")||[],this.f=a.castControlPort||0,this.g=a.lastCloudSinkCheckTimeMillis||0};var fk=null,dk=function(a,b){this.model=a;this.ip=b};var jk=function(a,b){this.ib=this.Jb=this.Kb=this.Ba=this.hb=null;this.ab=new Xj(hk(gk(),b),a);this.gb={};this.be={};this.Hc=!1};jk.prototype.getId=function(){return this.ab.id};var kk=function(a,b){a.Hc=b;return a};
  jk.prototype.update=function(a){if(this.getId()!=a.getId())return!1;var b=!1;this.ab.friendlyName!=a.ab.friendlyName&&(this.ab.friendlyName=a.ab.friendlyName,b=!0);this.Kb!=a.Kb&&(this.Kb=a.Kb,b=!0);this.Jb!=a.Jb&&(this.Jb=a.Jb,b=!0);this.hb!=a.hb&&(this.hb=a.hb,b=!0);this.Ba!=a.Ba&&(this.Ba=a.Ba,b=!0);return b};jk.prototype.Ea=function(){return this.hb};jk.prototype.va=function(){return this.Ba};
  var lk=function(a,b){return a.gb[b]||"unknown"},mk=function(a){var b=new jk(a.ab.friendlyName,"");b.ab.id=a.ab.id;b.hb=a.hb;b.Ba=a.Ba;b.Kb=a.Kb;b.Jb=a.Jb;b.ib=a.ib;b.gb=a.gb;b.be=a.be;b.Hc=a.Hc;return b};var ok=function(a,b,c,d,e,f){a=hk(gk(),a);this.b=new Xj(a,b,nk(d));this.ib=c||null;this.a=d||null;this.hb=e||null;this.Ba=f||null;this.gb={};this.Ub=!1},pk=function(a){if(!a.ib||!a.Ea())return null;var b=new ok(a.ab.id,a.ab.friendlyName,a.ib,void 0,a.Ea(),gk().f||8009);b.b.id=a.ab.id;b.Ub=!0;return b};
  ok.prototype.update=function(a,b,c,d){var e=!1;this.b.friendlyName!=a&&(this.b.friendlyName=a,e=!0);null!=b&&this.hb!=b&&(this.hb=b,e=!0);null!=c&&this.Ba!=c&&(this.Ba=c,e=!0);null!=d&&this.a!=d&&(this.a=d,e=!0);return e};var nk=function(a){return a&1?"cast":a&32?"cast_audio_group":"cast_audio"};ok.prototype.getId=function(){return this.b.id};
  var qk=function(a){var b=new ok("",a.friendlyName,a.modelName,a.capabilities,a.ip,a.port);b.b.id=a.id;b.Ub=a.discoveredByDial;b.gb=a.appStatusMap;for(var c in b.gb)"unavailable"==b.gb[c]&&(b.gb[c]="unavailable_rescan");return b};ok.prototype.Ea=function(){return this.hb};ok.prototype.va=function(){return this.Ba};var rk=function(a,b){return a.gb[b]||"unknown"};var sk={Do:0,to:1},tk={fr:0,ij:1,bq:2},uk={DIAL:0,Io:1,Jo:2,qn:3},vk={sp:0,TIMEOUT:1,FAILED:2},wk={sg:0,Am:1,gn:2,Mn:3,Zm:4,ap:5,jn:6,Op:7},xk={Ai:0,SUCCESS:1},yk=function(a){we("MediaRouter.Cast.Session.Ended",a,tk)},zk=function(a){we("MediaRouter.Cast.Channel.ConnectResult",a,xk)},Ak=function(a){we("MediaRouter.Cast.Discovery.Type",a,uk)},Bk=function(a){we("MediaRouter.Cast.Session.Fail",a,vk)};var Ck=function(a,b,c,d,e){for(var f=[],g=4;g<arguments.length;++g)f[g-4]=arguments[g];var l=this;this.l=a;this.m=b;this.h=c;this.b=d;this.g=f;this.a=!1;this.f=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];return l.ik.apply(l,[].concat(la(b)))}};h=Ck.prototype;h.addListener=function(){this.a||(this.a=!0,this.b.addListener.apply(this.b,[].concat([this.f],la(this.g))))};h.removeListener=function(){this.a&&(this.b.removeListener(this.f),this.a=!1)};
  h.Je=function(a){for(var b=0;b<arguments.length;++b);return!0};h.ik=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];var d=this;Ie(this.l);if(!this.Je.apply(this,[].concat(la(b))))return!1;Te(this.h).then(function(a){return a.handleEvent.apply(a,[].concat([d.b],la(b)))});return this.cf()};h.fa=function(){return"mr.EventListener."+this.m};h.sa=function(){return[this.a]};h.wa=function(){Kf(this)&&this.addListener()};h.cf=function(){};var Dk={serviceType:"_googlecast._tcp.local"},Ek=null,Fk=function(){Ek||(Ek=new Ck(7,"CastMdnsEventListener","mr.cast.SinkDiscoveryService",chrome.mdns.onServiceList,Dk));return Ek},Gk=null,Hk=function(){Gk||(Gk="ChromeOS"==fe()?new Ck(9,"CastNetworkListChangedEventListener","mr.cast.SinkDiscoveryService",chrome.networkingPrivate.onNetworkListChanged):new Ck(8,"CastNetworksChangedEventListener","mr.cast.SinkDiscoveryService",chrome.networkingPrivate.onNetworksChanged));return Gk},Ik=null,Jk=null,
  Kk=function(){Ik||(Ik=new Ck(2,"CastChannelMessageListener","mr.cast.ChannelService",chrome.cast.channel.onMessage));Jk||(Jk=new Ck(1,"CastChannelErrorListener","mr.cast.ChannelService",chrome.cast.channel.onError));return[Ik,Jk]};var Lk=function(a){return Promise.all(a.map(function(a){return a.then(function(a){return{fc:!0,value:a}},function(a){return{fc:!1,reason:a}})}))};var Mk=function(a,b){this.g=b;this.T=a;this.T.l=this.b.bind(this);this.a=new ri;this.m=new ri;this.f=new ri;this.H=null;this.w=this.B="";this.l=null;this.K=this.u=!1;this.G=[];this.j=Ia("mr.cast.SinkDiscoveryService");this.v=new Set;this.s={cc:0,jc:0};this.h=this.A=0};ka(Mk,Pe);Mk.prototype.init=function(){Nf(this);this.u&&(Nk(this),Ok(this));Ze("mr.cast.SinkDiscoveryService",this)};var Nk=function(a){u(a.j,"Start listening to network changes");Hk().addListener()};
  Mk.prototype.start=function(){var a=Date.now(),b=Fk();if(b.a){if(6E4>a-this.H)return;u(this.j,"Forcing mdns discovery");chrome.mdns.forceDiscovery(qa);b=Fk();b.removeListener()}else u(this.j,"Adding mdns listener");b.addListener();this.H=a};Mk.prototype.stop=function(){u(this.j,"Stopping...");Fk().removeListener()};
  Mk.prototype.handleEvent=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(a==chrome.mdns.onServiceList)this.I.apply(this,[].concat(la(c)));else if(a==chrome.networkingPrivate.onNetworksChanged||a==chrome.networkingPrivate.onNetworkListChanged)Ok(this);else throw Error("Unhandled event");};
  var Pk=function(a,b){if(-1==b.serviceName.indexOf("._googlecast."))return null;var c={};b.serviceData.forEach(function(a){0==a.search(/[a-z]{2}=.+/)&&(c[a.substring(0,2)]=a.substring(3))});var d=c.id;if(!d)return t(a.j,"Missing ID"),null;hk(gk(),d);var e=Number(b.serviceHostPort.substring(b.serviceHostPort.indexOf(":")+1));if(isNaN(e)||0>e||65535<e)return t(a.j,"Missing or invalid port"),null;var f=c.fn;if(!f||!b.ipAddress)return t(a.j,"Missing friendly name or IP address"),null;a=Number(c.ca);return new ok(d,
  f,c.md||"",isNaN(a)?0:a,b.ipAddress,e)};Mk.prototype.I=function(a){var b=this;u(this.j,"Registering "+a.length+" devices");0!=this.h&&(clearTimeout(this.h),this.h=0);a=Qk(this,a).map(function(a){return Rk(b,a,!0)});Lk(a).then(function(){b.s={cc:b.a.da(),jc:Sk(b)};Tk(b)})};var Tk=function(a){0!=a.h||36E5>Date.now()-a.A||(a.h=setTimeout(function(){var b=a.s;xe("MediaRouter.Cast.Discovery.KnownDevicesCount",b.jc);xe("MediaRouter.Cast.Discovery.ConnectedDevicesCount",b.cc);a.A=Date.now();a.h=0},5E3))};
  Mk.prototype.Og=function(){return this.s};
  var Sk=function(a){var b=a.v.size;ci(a.a.Oa(!1),function(c){a.v.has(c.getId())||b++});return b},Rk=function(a,b,c){if(a.f.La(b.getId()))return Promise.resolve();a.f.set(b.getId(),b);return Uk(a,b).then(function(d){d?(d=a.a.get(b.getId()),c&&(d?d.Ub&&Ak(3):Ak(1)),Vk(a,b)):(u(a.j,"Inaccessible sink: "+b.getId()),Wk(a,b.getId()));a.f.remove(b.getId())})},Xk=function(a,b){return void 0!=a.G.find(function(a){return a.ipAddress==b.ipAddress})},Qk=function(a,b){var c=[];a.v.clear();b.forEach(function(b){if(!Xk(a,
  b)&&(b=Pk(a,b))){var d=b.getId();a.v.add(d);if(a.f.La(d)){var f=a.f.get(d);if(f.Ea()==b.Ea()&&f.va()==b.va()){u(a.j,"Sink has pending connection "+d);return}t(a.j,"Pending sink changed ip "+d);a.f.remove(d)}if(d=a.a.get(d)){if(b=d.update(b.b.friendlyName,b.Ea(),b.va(),b.a))d.Ub=!1;b&&Yk(a.g,d)}else c.push(b)}});return c},Zk=function(a,b){var c=a.a.get(b.getId()),d=null,e=b.Ea(),f=b.va();null!=e&&null!=f&&(d=a.m.get(e+":"+f));if(c&&!d){var g=b.Ea(),l=b.va();g&&l&&a.m.remove(g+":"+l)}d&&!c&&a.a.remove(d.getId());
  a.a.set(b.getId(),b);null!=e&&null!=f&&a.m.set(e+":"+f,b)},Vk=function(a,b){u(a.j,"Adding sink "+b.getId());Zk(a,b);a.u||(a.u=!0,Nk(a));a=a.g;a.b.onSinkAvailabilityUpdated(a,1);Yk(a,b);$k(a.l,b);gk().a=new dk(b.ib,b.Ea())},Wk=function(a,b){var c=a.a.get(b);if(c){u(a.j,"Removing sink "+b);a.a.remove(b);b=c.Ea();var d=c.va();null!=b&&null!=d&&a.m.remove(b+":"+d);a.g.T(c)}},al=function(a){var b=a.a.P();a.a.clear();a.m.clear();b.forEach(a.g.T,a.g)},Uk=function(a,b){v(a.j,"Checking access to "+b.getId());
  return bl(a.T,b).then(function(a){if(b.Ub){var c=4;a.audioOnly||(c|=1);b.a=c;b.b.iconType=nk(b.a)}return!0},function(){return!1})},cl=function(a){u(a.j,"Pruning inactive sinks.");ci(a.a.Oa(!1),function(b){a.f.set(b.getId(),b);Uk(a,b).then(function(c){c||Wk(a,b.getId());a.f.remove(b.getId())})})};Mk.prototype.b=function(a){return this.a.get(a,null)};var dl=function(a,b){var c=[];ci(a.a.Oa(!1),function(a){Wj(rk(a,b))&&c.push(a)});return c};Mk.prototype.fa=function(){return"cast.SinkDiscoveryService"};
  Mk.prototype.sa=function(){var a=this,b={};ci(this.a.Oa(!0),function(c){var d=a.a.get(c);d={id:d.getId(),ip:d.Ea(),port:d.va(),friendlyName:d.b.friendlyName,modelName:d.ib,capabilities:d.a,discoveredByDial:d.Ub,appStatusMap:d.gb};b[c]=d});return[new el(b,this.w,this.s),new fl(this.u,this.A)]};
  Mk.prototype.wa=function(){var a=Kf(this);if(a&&3==a.version){this.w=a.networkIds;this.s=a.deviceCounts;a=a.sinkMap;this.K=0<Object.keys(a).length;for(var b in a){var c=qk(a[b]);this.b(c.getId())||Zk(this,c)}cl(this)}if(b=Lf(this))this.u=b.hasSavedSinks,this.A=b.lastSinkCountMetricRecordTime||0};
  var gl=function(a,b){a.K=0<Object.keys(b).length;for(var c in b){var d=qk(b[c]);a.b(d.getId())||Rk(a,d,!1)}},Ok=function(a){u(a.j,"Fetching networks state");a.l&&Vf(a.l);chrome.networkingPrivate.getNetworks({networkType:"All",visible:!0,configured:!0},function(b){for(var c=[],d=0;d<b.length;d++)"Connected"==b[d].ConnectionState&&c.push(b[d].GUID);hl(a,c.sort().join(","))})},hl=function(a,b){u(a.j,function(){return"Update current network "+il(b)});b!=a.B&&(a.l&&(Mf.delete(a.l.fa()),a.l=null),b?(a.w&&
  b!=a.w?al(a):cl(a),a.B=b,a.w=b,a.l=new jl(a,a.B)):a.B="")},il=function(a){for(var b=0,c=0;c<a.length;c++)b+=a.charCodeAt(c);return b},el=function(a,b,c){this.sinkMap=a;this.networkIds=b;this.deviceCounts=c;this.version=3},fl=function(a,b){this.hasSavedSinks=a;this.lastSinkCountMetricRecordTime=b},jl=function(a,b){this.a=a;this.b=b;Nf(this)};jl.prototype.fa=function(){return"cast.NetworkSink."+this.b};
  jl.prototype.sa=function(){var a=this,b=null,c=this.a.sa();c&&(this.a.K||0<this.a.a.da())&&(b=c[0]);u(this.a.j,function(){return"Saving sink data for network "+il(a.b)});return[null,b]};jl.prototype.wa=function(){var a=this;u(this.a.j,function(){return"Restoring sink data for network "+il(a.b)});var b=Lf(this);b&&3==b.version&&gl(this.a,b.sinkMap)};var kl={STOP_MEDIA:"STOP",MEDIA_SET_VOLUME:"SET_VOLUME",MEDIA_GET_STATUS:"GET_STATUS"};var ll=function(){this.type="GET_STATUS";this.requestId=0};var ml=function(a,b,c){this.type="APPLICATION_BROADCAST";this.requestId=0;this.appIds=a;this.namespace=b;this.message=c};var nl=function(a){this.type="LAUNCH";this.requestId=0;this.appId=a;this.language=null};var ol=function(a){this.type="STOP";this.requestId=0;this.sessionId=a||null};var pl=function(a,b){this.requestId=a;this.b=b;this.bi=null};pl.prototype.a=function(){};var ql=function(){this.a=new ri},rl=function(a,b){a.a.set(b.requestId,b);b.bi=setTimeout(function(){a.a.remove(b.requestId);b.a()},b.b)},sl=function(a,b){var c=a.a.get(b);if(!c)return null;clearTimeout(c.bi);a.a.remove(b);return c};var tl=function(a,b){this.b=a;this.f=b;this.a=new ql;this.g=new Lj("cast.RequestIdGenerator")};tl.prototype.init=function(){Nf(this.g)};var vl=function(a,b,c,d){var e=Mj(a.g);b.requestId=e;b=new Ra;c=new ul(e,b,m(c)&&0<c?c:6E5,d);rl(a.a,c);return c};
  tl.prototype.sendRequest=function(a,b,c,d,e,f){var g=this;if(!Vj.hasOwnProperty(c))return Promise.reject(Error("Custom namespace is not supported"));var l=vl(this,a,k(d)?d:3E3,e),r=l.qa;wl(this.b,b,c,a,e||this.f,f).then(null,function(){sl(g.a,l.requestId);r.reject(xl)});return r.a};tl.prototype.sendMessage=function(a,b,c,d,e,f){var g=this,l=vl(this,a,k(d)?d:3E3,e),r=l.qa;wl(this.b,b,c,a,e||this.f,f).then(function(){sl(g.a,l.requestId);r.resolve(!0)},function(){sl(g.a,l.requestId);r.reject(xl)});return r.a};
  var yl=function(a,b,c){var d=new nl(b.appId);d.language=b.language?b.language:chrome.i18n.getUILanguage?chrome.i18n.getUILanguage():chrome.runtime.getManifest().default_locale;return a.sendRequest(d,c,Qj,b.requestSessionTimeout)},zl=Error("Timeout"),xl=Error("Failed to send message"),ul=function(a,b,c,d){pl.call(this,a,c);this.qa=b;this.sourceId=d};ka(ul,pl);ul.prototype.a=function(){this.qa.reject(zl)};var Bl=function(a){this.a=new ri;a&&Al(this,a)},Cl=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[ya]||(a[ya]=++Aa)):b.substr(0,1)+a};Bl.prototype.da=function(){return this.a.da()};Bl.prototype.add=function(a){this.a.set(Cl(a),a)};var Al=function(a,b){b=xi(b);for(var c=b.length,d=0;d<c;d++)a.add(b[d])};h=Bl.prototype;h.removeAll=function(a){a=xi(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};h.remove=function(a){return this.a.remove(Cl(a))};h.clear=function(){this.a.clear()};
  h.jb=function(){return this.a.jb()};h.contains=function(a){return this.a.La(Cl(a))};h.P=function(){return this.a.P()};h.clone=function(){return new Bl(this)};h.equals=function(a){return this.da()==wi(a)&&Dl(this,a)};var Dl=function(a,b){var c=wi(b);if(a.da()>c)return!1;!(b instanceof Bl)&&5<c&&(b=new Bl(b));return Ci(a,function(a){var c=b;return c.contains&&"function"==typeof c.contains?c.contains(a):c.Lc&&"function"==typeof c.Lc?c.Lc(a):va(c)||oa(c)?Bb(c,a):bc(c,a)})};Bl.prototype.Oa=function(){return this.a.Oa(!1)};var El=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};p("castApp.eventPage.Message",El);var Fl=function(a,b,c){this.ipAddress=a;this.appId=b;this.sessionId=c};El.DeviceData=Fl;El.DeviceJustSetUp=function(a,b,c,d){this.ipAddress=a;this.name=b;this.udn=c;this.modelName=d};El.DeviceCapabilities=function(){};
  El.LogRecord=function(a,b,c,d){this.levelValue=a;this.msg=b;this.loggerName=c;this.time=d};var Hl=function(a,b){this.f=a;this.g=b;this.b=new ri;this.a=new Bl;this.l=0;this.u=new ri("serviceCheck",this.uk.bind(this),"startDeviceMonitor",this.vk.bind(this),"releaseDeviceMonitor",this.tk.bind(this),"deviceJustSetUp",this.qk.bind(this),"logRecord",this.rk.bind(this));chrome.runtime.onMessage.addListener(this.m.bind(this));chrome.runtime.onMessageExternal.addListener(this.h.bind(this));Gl(this,"serviceReady")};Hl.prototype.j=Ia("castApp.eventPage.Service");
  var Kl=function(a){if(Il(a)){var b=new Bl;ci(a.f.a.Oa(!1),function(a){var c=a.Ea();b.add(c);this.b.La(c)||this.g.sendRequest(new ll,a,Qj)}.bind(a));var c=!1;a.b.Ka().forEach(function(a){b.contains(a)||(this.b.remove(a),c=!0)}.bind(a));c&&Jl(a)}},Il=function(a){if(0===a.a.da())return!1;var b=Ea();3E4<b-a.l&&(a.l=b,chrome.tabs.query({url:["chrome://cast/*","chrome-extension://"+chrome.runtime.id+"/cast_setup/*"]},function(a){0===a.length?(u(this.j,"No tabs found. Clearing device monitor clients."),
  this.a.clear()):u(this.j,function(){return"Tab check found active tabs: "+a.map(function(a){return a.id})})}.bind(a)));b=a.a.da();u(a.j,"Monitor client count: "+b);return 0<b};Hl.prototype.m=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 pb("Missing origin ID in the incoming message."),!1;try{var e=d(a,b,c);e&&c(e)}catch(f){this.j.error("Error while handling request",f)}return!1};
  var Gl=function(a,b,c){var d=new El(b,c);v(a.j,function(){return"Sending message: "+JSON.stringify(d)});chrome.runtime.sendMessage(d)};h=Hl.prototype;h.uk=function(){Gl(this,"serviceReady")};h.vk=function(a){this.a.contains(a.originId)?u(this.j,"Client: "+a.originId+"already registered, dispatching current device list."):(u(this.j,"Registering monitor client: "+a.originId),this.a.add(a.originId));Jl(this);Ll(this)};h.tk=function(a){u(this.j,"Unregistering monitor client: "+a.originId);this.a.remove(a.originId)};
  h.qk=function(a){a=a.deviceJustSetUp;var b=a.udn.replace(/-/g,"").toLowerCase(),c;a.capabilities&&(c=(a.capabilities.audioOutSupported?4:0)|(a.capabilities.videoOutSupported?1:0));c=new ok(b,a.name,a.modelName,c,a.ipAddress,gk().f||8009);Rk(this.f,c,!0)};h.rk=function(a){a=a.logRecord;La({level:Qa(a.levelValue),F:a.loggerName,time:a.time,message:a.msg})};
  var Jl=function(a){var b=a.b.P();Gl(a,"devices",b)},Ll=function(a){v(a.f.j,"Executing forceDiscovery.");chrome.mdns.forceDiscovery(qa);a.f.a.P().forEach(function(a){this.g.sendRequest(new ll,a,Qj)}.bind(a))};Hl.prototype.h=function(a,b,c){switch(a.type){case "handshake":c(new Nj("handshake"));break;case "launch":b=b.tab&&m(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.Hb={CUSTOM_CONTROLLER_SCOPED:"custom_controller_scoped",TAB_AND_ORIGIN_SCOPED:"tab_and_origin_scoped",ORIGIN_SCOPED:"origin_scoped",PAGE_SCOPED:"page_scoped"};p("chrome.cast.AutoJoinPolicy",chrome.cast.Hb);chrome.cast.Zd={CREATE_SESSION:"create_session",CAST_THIS_TAB:"cast_this_tab"};p("chrome.cast.DefaultActionPolicy",chrome.cast.Zd);chrome.cast.Sb={VIDEO_OUT:"video_out",AUDIO_OUT:"audio_out",VIDEO_IN:"video_in",AUDIO_IN:"audio_in",MULTIZONE_GROUP:"multizone_group"};
  p("chrome.cast.Capability",chrome.cast.Sb);chrome.cast.Ib={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"};p("chrome.cast.ErrorCode",chrome.cast.Ib);chrome.cast.kj={AVAILABLE:"available",UNAVAILABLE:"unavailable"};
  p("chrome.cast.ReceiverAvailability",chrome.cast.kj);chrome.cast.Aj={CHROME:"chrome",IOS:"ios",ANDROID:"android"};p("chrome.cast.SenderPlatform",chrome.cast.Aj);chrome.cast.ce={CAST:"cast",DIAL:"dial",HANGOUT:"hangout",CUSTOM:"custom"};p("chrome.cast.ReceiverType",chrome.cast.ce);chrome.cast.ui={RUNNING:"running",STOPPED:"stopped",ERROR:"error"};p("chrome.cast.DialAppState",chrome.cast.ui);chrome.cast.qd={CAST:"cast",STOP:"stop"};p("chrome.cast.ReceiverAction",chrome.cast.qd);
  chrome.cast.og={CONNECTED:"connected",DISCONNECTED:"disconnected",STOPPED:"stopped"};p("chrome.cast.SessionStatus",chrome.cast.og);chrome.cast.Pj={ATTENUATION:"attenuation",FIXED:"fixed",MASTER:"master"};p("chrome.cast.VolumeControlType",chrome.cast.Pj);chrome.cast.VERSION=[1,2];p("chrome.cast.VERSION",chrome.cast.VERSION);chrome.cast.dm=!0;p("chrome.cast.usingPresentationApi",chrome.cast.dm);chrome.cast.Error=function(a,b,c){this.code=a;this.description=b||null;this.details=c||null};p("chrome.cast.Error",chrome.cast.Error);chrome.cast.zj=function(a){this.platform=a;this.packageId=this.url=null};p("chrome.cast.SenderApplication",chrome.cast.zj);chrome.cast.Image=function(a){this.url=a;this.width=this.height=null};p("chrome.cast.Image",chrome.cast.Image);
  chrome.cast.Volume=function(a,b){this.level=k(a)?a:null;this.muted=k(b)?b:null};p("chrome.cast.Volume",chrome.cast.Volume);chrome.cast.ki=function(a,b,c,d,e){this.sessionRequest=a;this.sessionListener=b;this.receiverListener=c;this.autoJoinPolicy=d||chrome.cast.Hb.TAB_AND_ORIGIN_SCOPED;this.defaultActionPolicy=e||chrome.cast.Zd.CREATE_SESSION;this.customDialLaunchCallback=null;this.invisibleSender=!1;this.additionalSessionRequests=[]};p("chrome.cast.ApiConfig",chrome.cast.ki);chrome.cast.wi=function(a,b){this.appName=a;this.launchParameter=b||null};p("chrome.cast.DialRequest",chrome.cast.wi);
  chrome.cast.eg=function(a,b,c){this.receiver=a;this.appState=b;this.extraData=c||null};p("chrome.cast.DialLaunchData",chrome.cast.eg);chrome.cast.vi=function(a,b){this.doLaunch=a;this.launchParameter=b||null};p("chrome.cast.DialLaunchResponse",chrome.cast.vi);chrome.cast.ng=function(a,b,c){this.appId=a;this.capabilities=ua(b)?b:[chrome.cast.Sb.VIDEO_OUT,chrome.cast.Sb.AUDIO_OUT];this.requestSessionTimeout=c||chrome.cast.timeout.requestSession;this.dialRequest=this.language=null};
  p("chrome.cast.SessionRequest",chrome.cast.ng);
  chrome.cast.Qe=function(a,b,c,d){this.label=a;a=b;bb.test(a)&&(-1!=a.indexOf("&")&&(a=a.replace(Wa,"&amp;")),-1!=a.indexOf("<")&&(a=a.replace(Xa,"&lt;")),-1!=a.indexOf(">")&&(a=a.replace(Ya,"&gt;")),-1!=a.indexOf('"')&&(a=a.replace(Za,"&quot;")),-1!=a.indexOf("'")&&(a=a.replace($a,"&#39;")),-1!=a.indexOf("\x00")&&(a=a.replace(ab,"&#0;")));this.friendlyName=a;this.capabilities=c||[];this.volume=d||null;this.receiverType=chrome.cast.ce.CAST;this.displayStatus=this.isActiveInput=null};
  p("chrome.cast.Receiver",chrome.cast.Qe);chrome.cast.lj=function(a,b){this.statusText=a;this.appImages=b;this.showStop=null};p("chrome.cast.ReceiverDisplayStatus",chrome.cast.lj);chrome.cast.rg=function(){this.requestSession=6E4;this.sendCustomMessage=this.setReceiverVolume=this.stopSession=this.leaveSession=3E3};p("chrome.cast.Timeout",chrome.cast.rg);chrome.cast.timeout=new chrome.cast.rg;p("chrome.cast.timeout",chrome.cast.timeout);chrome.cast.Yf="auto-join";chrome.cast.kg="cast-session_";chrome.cast.media.pd={PAUSE:"pause",SEEK:"seek",STREAM_VOLUME:"stream_volume",STREAM_MUTE:"stream_mute"};p("chrome.cast.media.MediaCommand",chrome.cast.media.pd);chrome.cast.media.vb={GENERIC:0,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4};p("chrome.cast.media.MetadataType",chrome.cast.media.vb);chrome.cast.media.Pe={IDLE:"IDLE",PLAYING:"PLAYING",PAUSED:"PAUSED",BUFFERING:"BUFFERING"};p("chrome.cast.media.PlayerState",chrome.cast.media.Pe);
  chrome.cast.media.Re={OFF:"REPEAT_OFF",ALL:"REPEAT_ALL",SINGLE:"REPEAT_SINGLE",ALL_AND_SHUFFLE:"REPEAT_ALL_AND_SHUFFLE"};p("chrome.cast.media.RepeatMode",chrome.cast.media.Re);chrome.cast.media.mj={PLAYBACK_START:"PLAYBACK_START",PLAYBACK_PAUSE:"PLAYBACK_PAUSE"};p("chrome.cast.media.ResumeState",chrome.cast.media.mj);chrome.cast.media.pg={BUFFERED:"BUFFERED",LIVE:"LIVE",OTHER:"OTHER"};p("chrome.cast.media.StreamType",chrome.cast.media.pg);
  chrome.cast.media.Ii={CANCELLED:"CANCELLED",INTERRUPTED:"INTERRUPTED",FINISHED:"FINISHED",ERROR:"ERROR"};p("chrome.cast.media.IdleReason",chrome.cast.media.Ii);chrome.cast.media.Mj={TEXT:"TEXT",AUDIO:"AUDIO",VIDEO:"VIDEO"};p("chrome.cast.media.TrackType",chrome.cast.media.Mj);chrome.cast.media.Jj={SUBTITLES:"SUBTITLES",CAPTIONS:"CAPTIONS",DESCRIPTIONS:"DESCRIPTIONS",CHAPTERS:"CHAPTERS",METADATA:"METADATA"};p("chrome.cast.media.TextTrackType",chrome.cast.media.Jj);
  chrome.cast.media.Fj={NONE:"NONE",OUTLINE:"OUTLINE",DROP_SHADOW:"DROP_SHADOW",RAISED:"RAISED",DEPRESSED:"DEPRESSED"};p("chrome.cast.media.TextTrackEdgeType",chrome.cast.media.Fj);chrome.cast.media.Kj={NONE:"NONE",NORMAL:"NORMAL",ROUNDED_CORNERS:"ROUNDED_CORNERS"};p("chrome.cast.media.TextTrackWindowType",chrome.cast.media.Kj);
  chrome.cast.media.Gj={SANS_SERIF:"SANS_SERIF",MONOSPACED_SANS_SERIF:"MONOSPACED_SANS_SERIF",SERIF:"SERIF",MONOSPACED_SERIF:"MONOSPACED_SERIF",CASUAL:"CASUAL",CURSIVE:"CURSIVE",SMALL_CAPITALS:"SMALL_CAPITALS"};p("chrome.cast.media.TextTrackFontGenericFamily",chrome.cast.media.Gj);chrome.cast.media.Hj={NORMAL:"NORMAL",BOLD:"BOLD",BOLD_ITALIC:"BOLD_ITALIC",ITALIC:"ITALIC"};p("chrome.cast.media.TextTrackFontStyle",chrome.cast.media.Hj);chrome.cast.media.Fi=function(){this.customData=null};p("chrome.cast.media.GetStatusRequest",chrome.cast.media.Fi);chrome.cast.media.Wi=function(){this.customData=null};p("chrome.cast.media.PauseRequest",chrome.cast.media.Wi);chrome.cast.media.Yi=function(){this.customData=null};p("chrome.cast.media.PlayRequest",chrome.cast.media.Yi);chrome.cast.media.yj=function(){this.customData=this.resumeState=this.currentTime=null};p("chrome.cast.media.SeekRequest",chrome.cast.media.yj);
  chrome.cast.media.Bj=function(){this.customData=null};p("chrome.cast.media.StopRequest",chrome.cast.media.Bj);chrome.cast.media.Qj=function(a){this.volume=a;this.customData=null};p("chrome.cast.media.VolumeRequest",chrome.cast.media.Qj);chrome.cast.media.Ki=function(a){this.type="LOAD";this.requestId=0;this.sessionId=null;this.media=a;this.activeTrackIds=null;this.autoplay=!0;this.customData=this.currentTime=null};p("chrome.cast.media.LoadRequest",chrome.cast.media.Ki);
  chrome.cast.media.Zp=function(a){this.type="PRECACHE";this.requestId=0;this.data=a};chrome.cast.media.zi=function(a,b){this.requestId=0;this.activeTrackIds=a||null;this.textTrackStyle=b||null};p("chrome.cast.media.EditTracksInfoRequest",chrome.cast.media.zi);chrome.cast.media.Ei=function(){this.metadataType=this.type=chrome.cast.media.vb.GENERIC;this.releaseDate=this.releaseYear=this.images=this.subtitle=this.title=null};p("chrome.cast.media.GenericMediaMetadata",chrome.cast.media.Ei);
  chrome.cast.media.Oi=function(){this.metadataType=this.type=chrome.cast.media.vb.MOVIE;this.releaseDate=this.releaseYear=this.images=this.subtitle=this.studio=this.title=null};p("chrome.cast.media.MovieMediaMetadata",chrome.cast.media.Oi);chrome.cast.media.Nj=function(){this.metadataType=this.type=chrome.cast.media.vb.TV_SHOW;this.originalAirdate=this.releaseYear=this.images=this.episode=this.episodeNumber=this.season=this.seasonNumber=this.episodeTitle=this.title=this.seriesTitle=null};
  p("chrome.cast.media.TvShowMediaMetadata",chrome.cast.media.Nj);chrome.cast.media.Pi=function(){this.metadataType=this.type=chrome.cast.media.vb.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=null};p("chrome.cast.media.MusicTrackMediaMetadata",chrome.cast.media.Pi);
  chrome.cast.media.Xi=function(){this.metadataType=this.type=chrome.cast.media.vb.PHOTO;this.creationDateTime=this.height=this.width=this.longitude=this.latitude=this.images=this.location=this.artist=this.title=null};p("chrome.cast.media.PhotoMediaMetadata",chrome.cast.media.Xi);chrome.cast.media.Ni=function(a,b){this.contentId=a;this.streamType=chrome.cast.media.pg.BUFFERED;this.contentType=b;this.customData=this.textTrackStyle=this.tracks=this.duration=this.metadata=null};
  p("chrome.cast.media.MediaInfo",chrome.cast.media.Ni);chrome.cast.media.bj=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};p("chrome.cast.media.QueueItem",chrome.cast.media.bj);chrome.cast.media.ri="CC1AD845";p("chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID",chrome.cast.media.ri);chrome.cast.media.timeout={};chrome.cast.media.timeout.load=0;p("chrome.cast.media.timeout.load",chrome.cast.media.timeout.load);
  chrome.cast.media.timeout.za=0;p("chrome.cast.media.timeout.getStatus",chrome.cast.media.timeout.za);chrome.cast.media.timeout.play=0;p("chrome.cast.media.timeout.play",chrome.cast.media.timeout.play);chrome.cast.media.timeout.pause=0;p("chrome.cast.media.timeout.pause",chrome.cast.media.timeout.pause);chrome.cast.media.timeout.seek=0;p("chrome.cast.media.timeout.seek",chrome.cast.media.timeout.seek);chrome.cast.media.timeout.stop=0;p("chrome.cast.media.timeout.stop",chrome.cast.media.timeout.stop);
  chrome.cast.media.timeout.bc=0;p("chrome.cast.media.timeout.setVolume",chrome.cast.media.timeout.bc);chrome.cast.media.timeout.ef=0;p("chrome.cast.media.timeout.editTracksInfo",chrome.cast.media.timeout.ef);chrome.cast.media.timeout.ml=0;p("chrome.cast.media.timeout.queue",chrome.cast.media.timeout.ml);chrome.cast.media.Lj=function(a,b){this.trackId=a;this.trackContentType=this.trackContentId=null;this.type=b;this.customData=this.subtype=this.language=this.name=null};p("chrome.cast.media.Track",chrome.cast.media.Lj);
  chrome.cast.media.Ij=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};p("chrome.cast.media.TextTrackStyle",chrome.cast.media.Ij);chrome.cast.media.dj=function(a){this.type="QUEUE_LOAD";this.sessionId=this.requestId=null;this.items=a;this.startIndex=0;this.repeatMode=chrome.cast.media.Re.OFF;this.customData=null};
  p("chrome.cast.media.QueueLoadRequest",chrome.cast.media.dj);chrome.cast.media.aj=function(a){this.type="QUEUE_INSERT";this.sessionId=this.requestId=null;this.items=a;this.customData=this.insertBefore=null};p("chrome.cast.media.QueueInsertItemsRequest",chrome.cast.media.aj);chrome.cast.media.hj=function(a){this.type="QUEUE_UPDATE";this.sessionId=this.requestId=null;this.items=a;this.customData=null};p("chrome.cast.media.QueueUpdateItemsRequest",chrome.cast.media.hj);
  chrome.cast.media.cj=function(){this.type="QUEUE_UPDATE";this.customData=this.jump=this.currentItemId=this.sessionId=this.requestId=null};p("chrome.cast.media.QueueJumpRequest",chrome.cast.media.cj);chrome.cast.media.gj=function(){this.type="QUEUE_UPDATE";this.customData=this.repeatMode=this.sessionId=this.requestId=null};p("chrome.cast.media.QueueSetPropertiesRequest",chrome.cast.media.gj);
  chrome.cast.media.ej=function(a){this.type="QUEUE_REMOVE";this.sessionId=this.requestId=null;this.itemIds=a;this.customData=null};p("chrome.cast.media.QueueRemoveItemsRequest",chrome.cast.media.ej);chrome.cast.media.fj=function(a){this.type="QUEUE_REORDER";this.sessionId=this.requestId=null;this.itemIds=a;this.customData=this.insertBefore=null};p("chrome.cast.media.QueueReorderItemsRequest",chrome.cast.media.fj);chrome.cast.media.J=function(a,b){this.sessionId=a;this.mediaSessionId=b;this.media=null;this.playbackRate=1;this.playerState=chrome.cast.media.Pe.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.Re.OFF};p("chrome.cast.media.Media",chrome.cast.media.J);chrome.cast.media.J.prototype.za=function(){};
  chrome.cast.media.J.prototype.getStatus=chrome.cast.media.J.prototype.za;chrome.cast.media.J.prototype.play=function(){};chrome.cast.media.J.prototype.play=chrome.cast.media.J.prototype.play;chrome.cast.media.J.prototype.fl=function(){};chrome.cast.media.J.prototype.playWithContext=chrome.cast.media.J.prototype.fl;chrome.cast.media.J.prototype.pause=function(){};chrome.cast.media.J.prototype.pause=chrome.cast.media.J.prototype.pause;chrome.cast.media.J.prototype.el=function(){};
  chrome.cast.media.J.prototype.pauseWithContext=chrome.cast.media.J.prototype.el;chrome.cast.media.J.prototype.seek=function(){};chrome.cast.media.J.prototype.seek=chrome.cast.media.J.prototype.seek;chrome.cast.media.J.prototype.stop=function(){};chrome.cast.media.J.prototype.stop=chrome.cast.media.J.prototype.stop;chrome.cast.media.J.prototype.bc=function(){};chrome.cast.media.J.prototype.setVolume=chrome.cast.media.J.prototype.bc;chrome.cast.media.J.prototype.ef=function(){};
  chrome.cast.media.J.prototype.editTracksInfo=chrome.cast.media.J.prototype.ef;chrome.cast.media.J.prototype.ol=function(){};chrome.cast.media.J.prototype.queueInsertItems=chrome.cast.media.J.prototype.ol;chrome.cast.media.J.prototype.nl=function(){};chrome.cast.media.J.prototype.queueAppendItem=chrome.cast.media.J.prototype.nl;chrome.cast.media.J.prototype.yl=function(){};chrome.cast.media.J.prototype.queueUpdateItems=chrome.cast.media.J.prototype.yl;chrome.cast.media.J.prototype.tl=function(){};
  chrome.cast.media.J.prototype.queuePrev=chrome.cast.media.J.prototype.tl;chrome.cast.media.J.prototype.sl=function(){};chrome.cast.media.J.prototype.queueNext=chrome.cast.media.J.prototype.sl;chrome.cast.media.J.prototype.pl=function(a){Ml(this,a)};chrome.cast.media.J.prototype.queueJumpToItem=chrome.cast.media.J.prototype.pl;chrome.cast.media.J.prototype.xl=function(){};chrome.cast.media.J.prototype.queueSetRepeatMode=chrome.cast.media.J.prototype.xl;chrome.cast.media.J.prototype.vl=function(){};
  chrome.cast.media.J.prototype.queueRemoveItems=chrome.cast.media.J.prototype.vl;chrome.cast.media.J.prototype.ul=function(a){Ml(this,a)};chrome.cast.media.J.prototype.queueRemoveItem=chrome.cast.media.J.prototype.ul;chrome.cast.media.J.prototype.wl=function(){};chrome.cast.media.J.prototype.queueReorderItems=chrome.cast.media.J.prototype.wl;chrome.cast.media.J.prototype.rl=function(a,b,c,d){a=Ml(this,a);0>a||(0>b?d&&d(new chrome.cast.Error(chrome.cast.Ib.INVALID_PARAMETER)):a==b&&c&&c())};
  chrome.cast.media.J.prototype.queueMoveItemToNewIndex=chrome.cast.media.J.prototype.rl;chrome.cast.media.J.prototype.Zl=function(a){return-1<this.supportedMediaCommands.indexOf(a)};chrome.cast.media.J.prototype.supportsCommand=chrome.cast.media.J.prototype.Zl;chrome.cast.media.J.prototype.kk=function(){return this.currentTime};chrome.cast.media.J.prototype.getEstimatedTime=chrome.cast.media.J.prototype.kk;chrome.cast.media.J.prototype.Ue=function(){};
  chrome.cast.media.J.prototype.addUpdateListener=chrome.cast.media.J.prototype.Ue;chrome.cast.media.J.prototype.Ve=function(){};chrome.cast.media.J.prototype.addUpdateListenerWithContext=chrome.cast.media.J.prototype.Ve;chrome.cast.media.J.prototype.Lf=function(){};chrome.cast.media.J.prototype.removeUpdateListener=chrome.cast.media.J.prototype.Lf;chrome.cast.media.J.prototype.Mf=function(){};chrome.cast.media.J.prototype.removeUpdateListenerWithContext=chrome.cast.media.J.prototype.Mf;
  var Ml=function(a,b){return yb(a.items,function(a){return a.itemId==b})};var Nl=function(a,b,c){this.sessionId=a;this.namespaceName=b;this.message=c};var Ol=function(a){this.a=a;this.j=Ia("mr.cast.ReceiverStatusQuerier")},Pl=function(a,b){return wc(new uc(n(a.b,a,b),3500,5),2).start().then(null,function(c){u(a.j,"Failed to get receiver status from "+b.getId());throw c;})};Ol.prototype.b=function(a){u(this.j,"Query receiver status: "+a.getId());return this.a.sendRequest(new ll,a,Qj)};var Ql=function(a,b){this.type="SET_VOLUME";this.requestId=0;this.volume=a;this.expectedVolume=b||null};chrome.cast.L=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.og.CONNECTED;this.transportId=""};p("chrome.cast.Session",chrome.cast.L);chrome.cast.L.prototype.Ul=function(a,b,c){this.Th(null,a,b,c)};chrome.cast.L.prototype.setReceiverVolumeLevel=chrome.cast.L.prototype.Ul;
  chrome.cast.L.prototype.Th=function(a,b,c,d){b=new Ql(new chrome.cast.Volume(b,null),this.receiver.volume);a.setReceiverVolume(this.sessionId,b,c,d)};chrome.cast.L.prototype.setReceiverVolumeLevelWithContext=chrome.cast.L.prototype.Th;chrome.cast.L.prototype.Tl=function(a,b,c){this.Sh(0,a,b,c)};chrome.cast.L.prototype.setReceiverMuted=chrome.cast.L.prototype.Tl;
  chrome.cast.L.prototype.Sh=function(a,b,c,d){a=new Ql(new chrome.cast.Volume(null,b),this.receiver.volume);null.setReceiverVolume(this.sessionId,a,c,d)};chrome.cast.L.prototype.setReceiverMutedWithContext=chrome.cast.L.prototype.Sh;chrome.cast.L.prototype.leave=function(a,b){null.leaveSession(this.sessionId,a,b)};chrome.cast.L.prototype.leave=chrome.cast.L.prototype.leave;chrome.cast.L.prototype.stop=function(){};chrome.cast.L.prototype.stop=chrome.cast.L.prototype.stop;
  chrome.cast.L.prototype.Wl=function(){};chrome.cast.L.prototype.stopWithContext=chrome.cast.L.prototype.Wl;chrome.cast.L.prototype.sendMessage=function(){};chrome.cast.L.prototype.sendMessage=chrome.cast.L.prototype.sendMessage;chrome.cast.L.prototype.Nl=function(){};chrome.cast.L.prototype.sendMessageWithContext=chrome.cast.L.prototype.Nl;chrome.cast.L.prototype.Ue=function(){};chrome.cast.L.prototype.addUpdateListener=chrome.cast.L.prototype.Ue;chrome.cast.L.prototype.Ve=function(){};
  chrome.cast.L.prototype.addUpdateListenerWithContext=chrome.cast.L.prototype.Ve;chrome.cast.L.prototype.Lf=function(){};chrome.cast.L.prototype.removeUpdateListener=chrome.cast.L.prototype.Lf;chrome.cast.L.prototype.Mf=function(){};chrome.cast.L.prototype.removeUpdateListenerWithContext=chrome.cast.L.prototype.Mf;chrome.cast.L.prototype.Vj=function(){};chrome.cast.L.prototype.addMessageListener=chrome.cast.L.prototype.Vj;chrome.cast.L.prototype.Wj=function(){};
  chrome.cast.L.prototype.addMessageListenerWithContext=chrome.cast.L.prototype.Wj;chrome.cast.L.prototype.Tj=function(){};chrome.cast.L.prototype.addMediaListener=chrome.cast.L.prototype.Tj;chrome.cast.L.prototype.Uj=function(){};chrome.cast.L.prototype.addMediaListenerWithContext=chrome.cast.L.prototype.Uj;chrome.cast.L.prototype.Fl=function(){};chrome.cast.L.prototype.removeMediaListener=chrome.cast.L.prototype.Fl;chrome.cast.L.prototype.Gl=function(){};
  chrome.cast.L.prototype.removeMediaListenerWithContext=chrome.cast.L.prototype.Gl;chrome.cast.L.prototype.Hl=function(){};chrome.cast.L.prototype.removeMessageListener=chrome.cast.L.prototype.Hl;chrome.cast.L.prototype.Il=function(){};chrome.cast.L.prototype.removeMessageListenerWithContext=chrome.cast.L.prototype.Il;chrome.cast.L.prototype.zk=function(a){a.sessionId=this.sessionId};chrome.cast.L.prototype.loadMedia=chrome.cast.L.prototype.zk;chrome.cast.L.prototype.ql=function(a){a.sessionId=this.sessionId};
  chrome.cast.L.prototype.queueLoad=chrome.cast.L.prototype.ql;var Tl=function(a,b){if(!b.applications||1!=b.applications.length)return null;var c=b.applications[0];a=Rl(a);a=new chrome.cast.L(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||Sl(a)))return null;a.receiver.volume=b.volume;"boolean"==typeof b.isActiveInput&&(a.receiver.isActiveInput=b.isActiveInput);return a},Ul=function(a){var b=
  [];if(!a)return b;a&1&&b.push(chrome.cast.Sb.VIDEO_OUT);a&2&&b.push(chrome.cast.Sb.VIDEO_IN);a&4&&b.push(chrome.cast.Sb.AUDIO_OUT);a&8&&b.push(chrome.cast.Sb.AUDIO_IN);a&32&&b.push(chrome.cast.Sb.MULTIZONE_GROUP);return b},Rl=function(a){return new chrome.cast.Qe(a.getId(),a.b.friendlyName,Ul(a.a))},Vl=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={index:0};e.index<c.length;e={index:e.index},e.index++)if(!d.some(function(a){return function(b){return b.name==
  c[a.index].name}}(e)))return!0;return a.receiver.volume.level!==b.receiver.volume.level||a.receiver.volume.muted!==b.receiver.volume.muted?!0:!1},Wl=function(a){ua(a)?a.forEach(Wl):xa(a)&&Object.keys(a).forEach(function(b){null===a[b]?delete a[b]:(xa(a[b])||ua(a[b]))&&Wl(a[b])})},Xl=function(a){return a.namespaces.some(function(a){return a.name==Sj})},Yl=["MultizoneLeader","MultizoneFollower"],Sl=function(a){return null!==a&&"MultizoneLeader"==a.appId},Zl=function(a){return"E8C28D3C"==a||"00000000-0000-0000-0000-000000000000"==
  a};var $l=function(a){this.b=a;this.j=Ia("mr.cast.SessionLauncher")},am=function(a,b,c){we("MediaRouter.Cast.Session.Type",0,sk);return yl(a.b,b,c).then(a.a.bind(a,c),function(a){a&&zl==a?Bk(1):Bk(0);throw a;})};$l.prototype.a=function(a,b){v(this.j,"Got launch result from "+a.getId());if("LAUNCH_ERROR"==b.type)throw Bk(2),Error(b.reason);a=Tl(a,b.status);u(this.j,"Launched session: "+a.sessionId);return a};var bm=function(a,b,c){this.type=a;this.message=b;this.sequenceNumber=k(c)?c:-1;this.timeoutMillis=0;this.clientId=""};var cm=function(a,b){this.g=a;this.a=b;this.f=[];this.b=new ql},em=function(a,b){return(a=dm(a.a,b))?a.routeId:null};cm.prototype.listen=function(a,b){this.f[a]=b};var gm=function(a,b,c,d){v(fm,"Sending to "+c);v(fm,JSON.stringify(d));d.clientId=c;a=a.g;a.b.Mb(a,b,d)},hm=function(a,b,c){var d=dm(a.a,b);d&&d.a?gm(a,d.routeId,b,c):a.connect(b).then(function(d){d?(d=em(a,b))?gm(a,d,b,c):t(fm,"No route for "+b):t(fm,"No connected client "+b)},null)};
  cm.prototype.connect=function(a){var b=dm(this.a,a);if(null!=b&&b.a)return Promise.resolve(!0);b=em(this,a);if(!b)return t(fm,"No route for client "+a),Promise.resolve(!1);if(a=this.b.a.get(b,null))return a.qa.a;a=new Ra;rl(this.b,new im(b,a));return a.a};var fm=Ia("mr.cast.ApiMessenger"),im=function(a,b){pl.call(this,a,3E4);this.qa=b};ka(im,pl);im.prototype.a=function(){this.qa.resolve(!1)};var jm=function(a,b){this.pb=this.l=this.b="";this.Ba=null;this.f=this.a="";this.g=!1;var c;a instanceof jm?(this.g=k(b)?b:a.g,km(this,a.b),this.l=a.l,lm(this,a.pb),mm(this,a.va()),nm(this,a.a),om(this,a.h.clone()),pm(this,a.f)):a&&(c=String(a).match(ij))?(this.g=!!b,km(this,c[1]||"",!0),this.l=qm(c[2]||""),lm(this,c[3]||"",!0),mm(this,c[4]),nm(this,c[5]||"",!0),om(this,c[6]||"",!0),pm(this,c[7]||"",!0)):(this.g=!!b,this.h=new rm(null,0,this.g))};
  jm.prototype.toString=function(){var a=[],b=this.b;b&&a.push(sm(b,tm,!0),":");var c=this.pb;if(c||"file"==b)a.push("//"),(b=this.l)&&a.push(sm(b,tm,!0),"@"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.va(),null!=c&&a.push(":",String(c));if(c=this.a)this.pb&&"/"!=c.charAt(0)&&a.push("/"),a.push(sm(c,"/"==c.charAt(0)?um:vm,!0));(c=this.h.toString())&&a.push("?",c);(c=this.f)&&a.push("#",sm(c,wm));return a.join("")};
  jm.prototype.resolve=function(a){var b=this.clone(),c=!!a.b;c?km(b,a.b):c=!!a.l;c?b.l=a.l:c=!!a.pb;c?lm(b,a.pb):c=null!=a.Ba;var d=a.a;if(c)mm(b,a.va());else if(c=!!a.a){if("/"!=d.charAt(0))if(this.pb&&!this.a)d="/"+d;else{var e=b.a.lastIndexOf("/");-1!=e&&(d=b.a.substr(0,e+1)+d)}e=d;if(".."==e||"."==e)d="";else if(-1!=e.indexOf("./")||-1!=e.indexOf("/.")){for(var d=0==e.lastIndexOf("/",0),e=e.split("/"),f=[],g=0;g<e.length;){var l=e[g++];"."==l?d&&g==e.length&&f.push(""):".."==l?((1<f.length||1==
  f.length&&""!=f[0])&&f.pop(),d&&g==e.length&&f.push("")):(f.push(l),d=!0)}d=f.join("/")}else d=e}c?nm(b,d):c=""!==a.h.toString();c?om(b,a.h.clone()):c=!!a.f;c&&pm(b,a.f);return b};jm.prototype.clone=function(){return new jm(this)};var km=function(a,b,c){a.b=c?qm(b,!0):b;a.b&&(a.b=a.b.replace(/:$/,""))},lm=function(a,b,c){a.pb=c?qm(b,!0):b};jm.prototype.va=function(){return this.Ba};
  var mm=function(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.Ba=b}else a.Ba=null},nm=function(a,b,c){a.a=c?qm(b,!0):b},om=function(a,b,c){b instanceof rm?(a.h=b,xm(a.h,a.g)):(c||(b=sm(b,ym)),a.h=new rm(b,0,a.g))},pm=function(a,b,c){a.f=c?qm(b):b},qm=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},sm=function(a,b,c){return oa(a)?(a=encodeURI(a).replace(b,zm),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null},zm=function(a){a=
  a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},tm=/[#\/\?@]/g,vm=/[\#\?:]/g,um=/[\#\?]/g,ym=/[\#\?@]/g,wm=/#/g,rm=function(a,b,c){this.b=this.a=null;this.f=a||null;this.g=!!c},Am=function(a){a.a||(a.a=new ri,a.b=0,a.f&&jj(a.f,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))},Cm=function(a){var b=yi(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new rm(null,0,void 0);a=xi(a);for(var d=0;d<b.length;d++){var e=b[d],f=a[d];ua(f)?Bm(c,e,f):
  c.add(e,f)}return c};h=rm.prototype;h.da=function(){Am(this);return this.b};h.add=function(a,b){Am(this);this.f=null;a=Dm(this,a);var c=this.a.get(a);c||this.a.set(a,c=[]);c.push(b);this.b+=1;return this};h.remove=function(a){Am(this);a=Dm(this,a);return this.a.La(a)?(this.f=null,this.b-=this.a.get(a).length,this.a.remove(a)):!1};h.clear=function(){this.a=this.f=null;this.b=0};h.jb=function(){Am(this);return 0==this.b};h.La=function(a){Am(this);a=Dm(this,a);return this.a.La(a)};
  h.Lc=function(a){var b=this.P();return Bb(b,a)};h.forEach=function(a,b){Am(this);this.a.forEach(function(c,d){w(c,function(c){a.call(b,c,d,this)},this)},this)};h.Ka=function(){Am(this);for(var a=this.a.P(),b=this.a.Ka(),c=[],d=0;d<b.length;d++)for(var e=a[d],f=0;f<e.length;f++)c.push(b[d]);return c};h.P=function(a){Am(this);var b=[];if(oa(a))this.La(a)&&(b=Lb(b,this.a.get(Dm(this,a))));else{a=this.a.P();for(var c=0;c<a.length;c++)b=Lb(b,a[c])}return b};
  h.set=function(a,b){Am(this);this.f=null;a=Dm(this,a);this.La(a)&&(this.b-=this.a.get(a).length);this.a.set(a,[b]);this.b+=1;return this};h.get=function(a,b){a=a?this.P(a):[];return 0<a.length?String(a[0]):b};var Bm=function(a,b,c){a.remove(b);0<c.length&&(a.f=null,a.a.set(Dm(a,b),x(c)),a.b+=c.length)};
  rm.prototype.toString=function(){if(this.f)return this.f;if(!this.a)return"";for(var a=[],b=this.a.Ka(),c=0;c<b.length;c++)for(var d=b[c],e=encodeURIComponent(String(d)),d=this.P(d),f=0;f<d.length;f++){var g=e;""!==d[f]&&(g+="="+encodeURIComponent(String(d[f])));a.push(g)}return this.f=a.join("&")};rm.prototype.clone=function(){var a=new rm;a.f=this.f;this.a&&(a.a=this.a.clone(),a.b=this.b);return a};
  var Dm=function(a,b){b=String(b);a.g&&(b=b.toLowerCase());return b},xm=function(a,b){b&&!a.g&&(Am(a),a.f=null,a.a.forEach(function(a,b){var c=b.toLowerCase();b!=c&&(this.remove(b),Bm(this,c,a))},a));a.g=b};rm.prototype.extend=function(a){for(var b=0;b<arguments.length;b++)Ai(arguments[b],function(a,b){this.add(b,a)},this)};var Em=function(a,b,c,d,e,f,g,l,r,y){this.l=a;this.a=b||null;this.b=c||null;this.f=d||null;this.g=k(e)?e:null;this.w=f||null;this.s=g||null;this.u=l||!1;this.m=r||null;this.h=y||null},Fm=function(a,b){return(a=a.match(b+"=([^/]*)"))?a[1]:null},Hm=function(a){a=a.match(/__castAppId__=([^/]*)/g);return null==a?[]:tb(ub(a,function(a){a=Fm(a,"__castAppId__");if(!a)return null;a=a.match(Gm);if(!a||0==a.length)return null;var b=[];3==a.length&&a[2]&&(b=a[2].split(","));return{appId:a[1],capabilities:b}}),
  function(a){return null!=a})},Im=function(a){return Fm(a,"__castClientId__")},Jm=function(a){return ub(a.l,function(a){return a.appId})},Km=function(a){return a.b?a.b:chrome.cast.Hb.TAB_AND_ORIGIN_SCOPED};
  Em.prototype.toString=function(){var a=new jm;km(a,"https");lm(a,"google.com");nm(a,"/cast");var b=[];w(this.l,function(a){var c="__castAppId__="+a.appId;a.capabilities&&0<a.capabilities.length&&(c=c+"("+a.capabilities.join(","),c+=")");b.push(c)});this.a&&b.push("__castClientId__="+this.a);this.b&&b.push("__castAutoJoinPolicy__="+this.b);this.f&&b.push("__castDefaultActionPolicy__="+this.f);null!=this.g&&b.push("__castLaunchTimeout__="+this.g);this.w&&b.push("__dialAppName__="+this.w);this.s&&b.push("__dialPostData__="+
  this.s);this.u&&b.push("__castInvisibleSender__=true");this.m&&(b.push("__castBroadcastNamespace__="+this.m),b.push("__castBroadcastId__="+Math.random()));this.h&&b.push("__castBroadcastMessage__="+encodeURIComponent(JSON.stringify(this.h)));pm(a,b.join("/"));return a.toString()};
  var Mm=function(a,b){a=Jm(a);var c=Lm(b);return wb(a,function(a){return Bb(c,a)})},Nm=function(a){a=new jm(a);if("https"!=a.b||"google.com"!=a.pb||"/cast"!=a.a)return null;var b=a.f;a=Hm(b);if(!a||0==a.length)return null;var c=Im(b),d=Fm(b,"__castAutoJoinPolicy__"),e=Fm(b,"__castDefaultActionPolicy__");var f=Fm(b,"__castLaunchTimeout__");null==f?f=null:(f=Number(f),f=!isNaN(f)&&0<=f?f:null);var g=Fm(b,"__dialAppName__"),l=Fm(b,"__dialPostData__"),r=Fm(b,"__castInvisibleSender__"),r=null===r?null:
  "true"==r,y=Fm(b,"__castBroadcastNamespace__"),b=(b=Fm(b,"__castBroadcastMessage__"))?JSON.parse(decodeURIComponent(b)):null;return new Em(a,c,d,e,f,g,l,r,y,b)},Lm=function(a){return(a=Nm(a))?Jm(a):null},Om=function(a){return(a=Nm(a))?a.a:null},Gm=/(^\w+)(?:\(([\w,\ ]*)\))?$/;var Pm=function(a,b,c,d,e,f){this.f=a;this.m=b;this.l=c;this.a=d;this.h=e;this.g=f;this.b=new cm(f,c);this.v=new Ol(this.f);this.A=new $l(this.f)};Pm.prototype.init=function(){this.l.init();this.b.listen("v2_message",this.s.bind(this));this.b.listen("app_message",this.u.bind(this));this.b.listen("leave_session",this.w.bind(this))};
  var Sm=function(a,b,c,d){Qm(a.a,b).slice().forEach(function(b){b!=d&&Rm(a,b,c)})},Rm=function(a,b,c){c.clientId=b;hm(a.b,b,c)},Tm=function(a,b,c,d){c={receiver:Rl(c),action:d};Rm(a,b,new bm("receiver_action",c))};
  Pm.prototype.s=function(a){var b=a.message,c=b.sessionId;if(c){var d=Um(this.a,c);if(d)if(c=Vm(this.a,c))if(c=this.m.b(c))switch(b.type){case "STOP":Wm(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":Xm(this,a,c,d);break;case "SET_VOLUME":Ym(this,a,c);break;default:t(Zm,"Unknown request")}else $m(this,
  a,chrome.cast.Ib.INVALID_PARAMETER,"No receiver");else $m(this,a,chrome.cast.Ib.INVALID_PARAMETER,"No sink ID");else $m(this,a,chrome.cast.Ib.INVALID_PARAMETER,"Unknown session ID")}else $m(this,a,chrome.cast.Ib.INVALID_PARAMETER,"No session ID")};
  var $m=function(a,b,c,d){c=new chrome.cast.Error(c,d);an(a,b,c)},an=function(a,b,c){hm(a.b,b.clientId,new bm("error",c,b.sequenceNumber))},Wm=function(a,b,c){var d=b.message;ve("MediaRouter.Cast.Session.End");var e=d.sessionId,f=bn(a.a,e);f&&(f.g=!0);f=function(){cn(a,e,b)};a.f.sendRequest(d,c,Qj,b.timeoutMillis,b.clientId).then(f,f)},Xm=function(a,b,c,d){var e=b.message,f=e.type;f in kl&&(e.type=kl[f]);a.f.sendRequest(e,c,Sj,b.timeoutMillis,b.clientId,d.transportId).then(function(c){var e=d.sessionId;
  c.sessionId=e;dn(a.a,e,en(c.status,e));hm(a.b,b.clientId,new bm("v2_message",c,b.sequenceNumber))},function(c){an(a,b,c)})},Ym=function(a,b,c){var d=b.message;delete d.sessionId;a.f.sendRequest(d,c,Qj,b.timeoutMillis,b.clientId).then(function(){hm(a.b,b.clientId,new bm("v2_message",null,b.sequenceNumber))},function(c){an(a,b,c)})};
  Pm.prototype.u=function(a){var b=this,c=a.message,d=c.sessionId;if(d){var e=Vm(this.a,d);e?(e=this.m.b(e))?(d=Um(this.a,d),zb(d.namespaces,function(a){return a.name==c.namespaceName})?wl(this.h,e,c.namespaceName,c.message,a.clientId,d.transportId).then(function(){hm(b.b,a.clientId,new bm("app_message",null,a.sequenceNumber))},function(){$m(b,a,chrome.cast.Ib.CHANNEL_ERROR,"Channel to receiver not available")}):$m(this,a,chrome.cast.Ib.INVALID_PARAMETER,"Invalid namespace")):t(Zm,"No receiver from sinkId"):
  t(Zm,"No sinkId from sessionId")}else t(Zm,"No sessionId")};
  Pm.prototype.w=function(a){var b=this;u(Zm,"Leave session");var c=bn(this.a,a.message);if(c){var d=a.clientId,e=dm(this.l,d);if(e){var f=[],g=[],l=e.tabId,r=e.origin,y=e.autoJoinPolicy;c.b.forEach(function(a){var c=dm(b.l,a);y==chrome.cast.Hb.TAB_AND_ORIGIN_SCOPED&&l==c.tabId&&r==c.origin||y==chrome.cast.Hb.ORIGIN_SCOPED&&r==c.origin?(c.b=!0,f.push(a)):g.push(a)});hm(this.b,d,new bm("leave_session",null,a.sequenceNumber));f.forEach(function(a){(a=dm(b.l,a))&&fn(b.g,a.routeId,!0,!0)});c.b=g}else t(Zm,
  "No client record")}else t(Zm,"No session")};
  var gn=function(a,b,c){Xl(b)&&a.f.sendRequest(new ll,c,Sj,void 0,void 0,b.transportId).catch(qa)},$k=function(a,b,c){var d=b.getId();u(Zm,"Query status for "+d);Pl(a.v,b).then(function(e){hn(a,d,e);c&&(e=jn(a.a,d))&&gn(a,e,b)},qa)},kn=function(a,b){if("*"==b.destinationId)return!0;b=b.destinationId;if(b==a.h.h||null!=dm(a.l,b))return!0;u(Zm,"Invalid destination "+b);return!1},pn=function(a,b,c){v(Zm,function(){return"Cast message: "+JSON.stringify(c)});if(kn(a,c))if(c.namespace_==Rj||c.namespace_==
  Tj)(b=ln(a.a,b))&&b.a.forEach(function(b){var d=a.g,e=d.f.get(b);e&&e.Mc&&d.b.te(d,b,c)});else{var d=JSON.parse(c.data),e=mn(a,d),e=e?e.sourceId:void 0;switch(d.type){case "RECEIVER_STATUS":hn(a,b,d);break;case "MEDIA_STATUS":nn(a,b,c,e)}}else on(a.h,b,c.destinationId,c.sourceId,!1)},mn=function(a,b){a=sl(a.f.a,b.requestId);if(!a)return null;var c=a.qa;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.Ib.SESSION_ERROR,b.reason||b.type,b));break;default:c.resolve(b)}return a},qn=function(a,b,c){v(Zm,function(){return"App message: "+JSON.stringify(c)});if(b=jn(a.a,b)){var d;"*"==c.destinationId?d=Qm(a.a,b.sessionId):d=[c.destinationId];var e=new Nl(b.sessionId,c.namespace_,c.data);d.forEach(function(b){hm(a.b,b,new bm("app_message",e))})}else t(Zm,"No session for incoming app message")},en=function(a,b){a.forEach(function(a){a.sessionId=b;var c=a.supportedMediaCommands,
  e=[];c&1&&e.push(chrome.cast.media.pd.PAUSE);c&2&&e.push(chrome.cast.media.pd.SEEK);c&4&&e.push(chrome.cast.media.pd.STREAM_VOLUME);c&8&&e.push(chrome.cast.media.pd.STREAM_MUTE);a.supportedMediaCommands=e});return a},rn=function(a,b){if(b=jn(a.a,b)){b=b.sessionId;var c=bn(a.a,b);c&&c.g||cn(a,b)}},cn=function(a,b,c){c&&Rm(a,c.clientId,c);(c=bn(a.a,b))&&c.a.slice().forEach(function(b){fn(a.g,b,!0)});sn(a.a,b)},hn=function(a,b,c){v(Zm,"Receiver status for "+b);var d=c.status;if(d)if(c=a.m.b(b)){var d=
  Tl(c,d),e=ln(a.a,b);e?d?d.sessionId==e.session.sessionId?(b=e.session,Vl(b,d)&&(v(Zm,"Updating session "+d.sessionId),b.statusText=d.statusText,b.namespaces=d.namespaces,b.receiver.volume=d.receiver.volume,tn(a.g,e),Sm(a,b.sessionId,new bm("update_session",b)))):(rn(a,b),yk(1),un(a.g,null,c,null,d)):(rn(a,b),yk(1)):d&&un(a.g,null,c,null,d)}else ve("MediaRouter.Cast.Error.Sink.Missing.From.Discovery.Service"),t(Zm,"Got message from receiver "+b+", but sink is no longer available.")},nn=function(a,
  b,c,d){if(b=jn(a.a,b))if(c=JSON.parse(c.data))b=b.sessionId,c.sessionId=b,dn(a.a,b,en(c.status,b)),Sm(a,c.sessionId,new bm("v2_message",c),d)},vn=function(a,b){var c=Ul(b.a);return(b=zb(a.l,function(a){return xb(a.capabilities,function(a){return Bb(c,a)})}))?b.appId:Jm(a)[0]},wn=function(a,b,c){var d=Nm(b);if(!d)return Promise.reject(Error("Invalid source "+b));var e=vn(d,c),f=new me("MediaRouter.Cast.Session.Launch");return am(a.A,new chrome.cast.ng(e,void 0,null==d.g?chrome.cast.timeout.requestSession:
  d.g),c).then(function(a){u(Zm,"Launched session "+a.sessionId+" for appId "+e);f.a("Success");return a},function(a){Zm.error("Failed to session for appId "+e);f.a("Failure");throw a;})},Zm=Ia("mr.cast.ApiHandler");var xn=function(a,b){if(!chrome.runtime.lastError)return null;a=a+" failed, chrome.runtime.lastError: "+(chrome.runtime.lastError.message||"Unknown error");b&&v(b,a);return Error(a)};var yn=function(){this.b=new ri;this.f=new ri;this.a=new ri},Dn=function(a,b,c){c=void 0===c?!1:c;var d=b.getId(),e=b.Ea()+":"+b.va(),f=a.b.get(d);if(f){if(a.a.get(d)==e)return v(zn,"Using pending creation to "+d),f;u(zn,"Device "+d+" IP changed from "+a.a.get(b.getId())+" to "+e);An(a,b)}b=Bn(a,b,c?15E3:1E4).then(function(b){Cn(a,d);zk(1);return b},function(b){e==a.a.get(d)&&Cn(a,d);zk(0);return Promise.reject(b)});a.b.set(d,b);a.a.set(d,e);return b},An=function(a,b){b=b.getId();v(zn,"Aborting connection to device "+
  b);var c=a.f.get(b);c&&c.abort();Cn(a,b)},Cn=function(a,b){a.b.remove(b);a.f.remove(b);a.a.remove(b)},Bn=function(a,b,c){var d=new uc(function(){return En(b,c)},1E3,3);a.f.set(b.getId(),d);return wc(d,1.5).start().then(null,function(a){u(zn,"Failed to create channel to "+b.getId());return Promise.reject(a)})},En=function(a,b){var c=Fn++;u(zn,"Connecting to (id "+c+") "+a.getId());var d=new me("MediaRouter.Cast.Mdns.Channel.Open");return Gn(a,b).then(function(a){u(zn,function(){return"Channel opened (id "+
  c+"): "+JSON.stringify(a)});d.a("Success");return a},function(a){u(zn,"Channel did not open (id "+c+").");d.a("Failure");return Promise.reject(a)})},Gn=function(a,b){var c={ipAddress:a.Ea(),port:a.va(),auth:"ssl_verified",timeout:1E4,livenessTimeout:b,pingInterval:5E3,capabilities:0};u(zn,function(){return"Opening channel to "+JSON.stringify(c)});var d=new Ra;chrome.cast.channel.open(c,function(a){a?"open"==a.readyState?d.resolve(a):(xn("chrome.cast.channel.open",zn),chrome.cast.channel.close(a,function(){xn("chrome.cast.channel.close",
  zn)}),d.reject(Error(a.errorState))):(a=xn("chrome.cast.channel.open",zn),d.reject(a))});return d.a},zn=Ia("mr.cast.ChannelFactory"),Fn=0;var Hn=function(a,b,c,d){return{namespace_:a,data:oa(b)?b:JSON.stringify(b),sourceId:c,destinationId:d}};var In=function(a){this.type="CLOSE";this.reasonCode=a};var Jn=sc("Firefox"),Kn=rg()||sc("iPod"),Ln=sc("iPad"),Mn=sc("Android")&&!(tc()||sc("Firefox")||sc("Opera")||sc("Silk")),Nn=tc(),On=sc("Safari")&&!(tc()||sc("Coast")||sc("Opera")||sc("Edge")||sc("Silk")||sc("Android"))&&!sg();var Pn=function(a){return(a=a.exec(pc))?a[1]:""},Qn=function(){if(Jn)return Pn(/Firefox\/([0-9.]+)/);if(zg||Ag||yg)return Sg;if(Nn)return sg()?Pn(/CriOS\/([0-9.]+)/):Pn(/Chrome\/([0-9.]+)/);if(On&&!sg())return Pn(/Version\/([0-9.]+)/);if(Kn||Ln){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(pc);if(a)return a[1]+"."+a[2]}else if(Mn)return(a=Pn(/Android\s+([0-9.]+)/))?a:Pn(/Version\/([0-9.]+)/);return""}();var Sn=function(a){this.type="CONNECT";this.origin={};this.userAgent=pc;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:Qn,platform:Rn(),systemVersion:b,connectionType:1};this.connType=a?0:2},Rn=function(){switch(fe()){case "ChromeOS":return 5;case "Windows":return 3;case "Mac":return 4;case "Linux":return 6}return 0};var Tn=function(){this.a=new ri};Tn.prototype.init=function(){Nf(this)};var Un=function(a,b,c,d,e){if(!a.a.La([b.channelId,c,d].join("#"))){var f=Hn(Pj,new Sn(e),c,d);chrome.cast.channel.send(b,f,a.b.bind(a));a.a.set([b.channelId,c,d].join("#"),e)}};Tn.prototype.b=function(){xn("chrome.cast.channel.send",Vn)};
  var Wn=function(a,b){a.a.Ka().forEach(function(c){c.split("#")[0]==b.channelId.toString()&&a.a.remove(c)})},Xn=function(a,b,c){a.a.forEach(function(d,e){var f=e.split("#");f[0]==b.channelId.toString()&&(Un(a,c,f[1],f[2],d),a.a.remove(e))})};Tn.prototype.fa=function(){return"cast.VirtualConnectionManager"};Tn.prototype.sa=function(){var a=vi(this.a);return[new Yn(a)]};Tn.prototype.wa=function(){var a=Kf(this);if(a)for(var b in a.a)this.a.set(b,a.a[b])};ra(Tn);
  var Vn=Ia("mr.cast.VirtualConnectionManager"),Yn=function(a){this.a=a};var Zn=function(a,b){this.g=b;this.h=a;this.b=new ri;this.a=new ri;this.f=Tn.na();this.m=new yn;this.l=null};ka(Zn,Pe);Zn.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.w.apply(this,[].concat(la(c))):a==chrome.cast.channel.onError&&this.u.apply(this,[].concat(la(c)))};Zn.prototype.init=function(){this.f.init();Nf(this);Ze("mr.cast.ChannelService",this);Kk().forEach(function(a){return a.addListener()})};
  var wl=function(a,b,c,d,e,f){var g=e||a.h,l=f||"receiver-0";return bl(a,b).then(function(b){return $n(a,b,c,d,g,l)})},ao=function(a,b,c,d,e){bl(a,b).then(function(b){return Un(a.f,b,c,d,e)})},on=function(a,b,c,d,e){if(b=a.b.get(b))a=a.f,a.a.La([b.channelId,c,d].join("#"))&&(a.a.remove([b.channelId,c,d].join("#")),c=Hn(Pj,new In(e?5:0),c,d),chrome.cast.channel.send(b,c,a.b.bind(a)))};
  Zn.prototype.w=function(a,b){var c=this.a.get(a.channelId);if(c){var d=this.l(c);if(d){if(Vj.hasOwnProperty(b.namespace_)){var e=JSON.parse(b.data);switch(e.type){case "CLOSE":this.f.a.remove([a.channelId,b.destinationId,b.sourceId].join("#"));return;case "RPC":break;default:v(bo,function(){return"Got message "+(e.type||e.responseType)+" "+("from "+d.getId())})}}else v(bo,"Got message in "+b.namespace_+" from "+d.getId());co(this.g,d,b)}else t(bo,"Got message for unknown receiver (receiverId="+c+
  ").")}else t(bo,"Got message for unknown channel (channelId="+a.channelId+").")};var eo=function(a,b){chrome.cast.channel.close(b,function(){chrome.runtime.lastError||v(bo,"Channel close success")});var c=a.a.get(b.channelId);c&&(a.a.remove(b.channelId),a.b.remove(c))};Zn.prototype.u=function(a,b){t(bo,function(){return"Channel error: "+JSON.stringify(a)+(b?", "+JSON.stringify(b):"")});b&&fo(b);go(this,a)};
  var fo=function(a){switch(a.errorState){case "unknown":var b=0;break;case "authentication_error":b=1;break;case "connect_error":b=2;break;case "connect_timeout":b=6;break;case "ping_timeout":b=7;break;default:return}if(-8192<=a.nssErrorCode&&-7192>a.nssErrorCode||2==a.challengeReplyErrorType||8==a.challengeReplyErrorType||9==a.challengeReplyErrorType||11==a.challengeReplyErrorType||-200>=a.netReturnValue&&-300<a.netReturnValue||30==a.eventType||31==a.eventType||32==a.eventType)b=3;if(26==a.eventType||
  -201==a.netReturnValue||-8181==a.nssErrorCode||-8162==a.nssErrorCode||-8161==a.nssErrorCode)b=4;-138==a.netReturnValue&&(b=5);if(-8182==a.nssErrorCode||10==a.eventType||12==a.eventType)b=1;t(bo,"Channel error code: "+b);we("MediaRouter.Cast.Channel.Error",b,wk)},go=function(a,b){var c=a.a.get(b.channelId);eo(a,b);if(c){var d=a.l(c);d&&bl(a,d,!0).then(function(c){u(bo,"Re-connected to receiver: "+d.getId());Xn(a.f,b,c);$k(a.g.l,d,!0)},function(){u(bo,"Failed to re-connect to receiver: "+d.getId());
  Wn(a.f,b);var c=a.g.a,f=d.getId();u(c.j,"Channel error for sink "+f);Wk(c,f);yk(2)})}},bl=function(a,b,c){c=void 0===c?!1:c;var d=b.getId(),e=a.b.get(d);return e&&"open"==e.readyState?Promise.resolve(e):Dn(a.m,b,c).then(function(b){if(a.a.La(b.channelId))return b;a.b.get(d)&&(t(bo,"Duplicate channel to a receiver "+d),eo(a,a.b.get(d)));u(bo,"Connected to: "+d);a.b.set(d,b);a.a.set(b.channelId,d);return b},null)},$n=function(a,b,c,d,e,f){Un(a.f,b,e,f,0==f.indexOf("receiver-0"));Wl(d);var g=Hn(c,d,
  e,f);"object"===typeof d&&"RPC"==d.type||v(bo,function(){return"Channel is sending message: "+JSON.stringify(g)});return new Promise(function(c,d){chrome.cast.channel.send(b,g,function(b){b?b.errorState?(d(Error("Failed to send message")),go(a,b)):c(!0):(b=xn("chrome.cast.channel.send",bo),d(b))})})};Zn.prototype.fa=function(){return"cast.ChannelService"};Zn.prototype.sa=function(){return[new ho(vi(this.b),vi(this.a))]};Zn.prototype.wa=function(){var a=Kf(this);a&&(qi(this.b,a.b),qi(this.a,a.a))};
  var bo=Ia("mr.cast.ChannelService"),ho=function(a,b){this.b=a;this.a=b};var io=function(){this.requestId=0;this.type="GET_APP_AVAILABILITY";this.appId=[]};var jo=function(a,b){this.g=a;this.b=b;this.f=new Bl;this.a=new ri};jo.prototype.init=function(){Nf(this)};var ko=function(a,b){var c=a.a.get(b);c&&(c.Jf--,0<c.Jf||(ci(a.b.a.Oa(!1),function(a){switch(rk(a,b)){case "available":a.gb[b]="available_rescan";break;case "unavailable":a.gb[b]="unavailable_rescan"}}),a.a.remove(b)))};h=jo.prototype;
  h.ih=function(a){var b=this;ci(this.a.Oa(!0),function(c){a:{switch(rk(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.f.contains(e)||(b.f.add(e),d=function(){b.f.remove(e)},wc(new uc(b.fk.bind(b,a,c),5500,3),2).start().then(b.ci.bind(b,a,c),function(){b.j.error("Failed to get app availability response for "+a.getId()+", appId "+c+" after 3 attempts.");b.ci(a,c,"unknown")}).then(d,d))}})};
  h.ci=function(a,b,c){c!=rk(a,b)&&(u(this.j,b+" on "+a.getId()+" is "+c),a.gb[b]=c,Yk(this.b.g,a))};
  h.fk=function(a,b){var c=this,d=new io;d.appId=[b];var e=new me("MediaRouter.Cast.App.Availability");return this.g.sendRequest(d,a,Qj,5E3).then(function(a){e.a("Success");v(c.j,function(){return"App availability response "+JSON.stringify(a)});for(var b in a.availability){if("APP_AVAILABLE"==a.availability[b])return"available";if("APP_UNAVAILABLE"==a.availability[b])return"unavailable"}return"unknown"},function(d){e.a("Failure");c.j.error("checkAppAvailability_ failed for "+a.getId()+", appId "+b);
  throw d;})};h.fa=function(){return"cast.AppDiscoveryService"};h.sa=function(){return[new lo(vi(this.a))]};h.wa=function(){var a=Kf(this);a&&qi(this.a,a.a)};h.j=Ia("mr.cast.AppDiscoveryService");var lo=function(a){this.a=a};var mo=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,mo);else if(b=Error().stack)this.stack=b;this.errorCode=a};ka(mo,Error);var no=function(a,b){this.sinks=a;this.origins=b||null},oo=new no([]);var po=function(a,b,c,d){return Kj(c,"cast",b.getId(),a,d,"",null)};var qo=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.b=this.a=!1},ro=function(){this.a=[]};ro.prototype.init=function(){Nf(this)};ro.prototype.da=function(){return this.a.length};var dm=function(a,b){return zb(a.a,function(a){return a.clientId==b})},so=function(a,b){return zb(a.a,function(a){return a.routeId==b})},to=function(a,b){a.a=tb(a.a,function(a){return a.clientId!=b})};ro.prototype.fa=function(){return"cast.ClientRecords"};
  ro.prototype.sa=function(){return[new uo(this.a)]};ro.prototype.wa=function(){var a=Kf(this);a&&(this.a=a.a)};var uo=function(a){this.a=a};var vo=function(a){this.a=a},wo=function(){var a=[];gk().l.forEach(function(b){var c="Receiver-"+b.replace(/\./g,"_"),d=gk().f||8009;a.push({serviceName:c+"._googlecast._tcp.local",serviceHostPort:c+":"+d,ipAddress:b,serviceData:["id=mdns:"+c,"ve=02","ca=5","st=1","fn="+c,"md=Chromecast"]})});return a};vo.prototype.init=function(){var a=wo(),b=this.a;b.I(a);b.G=a};var xo=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 yo=function(a,b){this.b=[];this.a=[];this.sinkId=a;this.session=b;this.l=this.f=null;this.offTheRecord=this.g=!1},zo=function(){this.j=Ia("mr.cast.SessionRecords");this.a=[]};zo.prototype.init=function(){Nf(this)};
  var sn=function(a,b){u(a.j,"Removing session "+b);a.a=tb(a.a,function(a){return a.session.sessionId!=b})},Qm=function(a,b){return(a=bn(a,b))?a.b:[]},jn=function(a,b){return(a=ln(a,b))?a.session:null},Ao=function(a,b){return zb(a.a,function(a){return Bb(a.b,b)})},Bo=function(a,b){return zb(a.a,function(a){return Bb(a.a,b)})},Co=function(a,b){return zb(a.a,function(a){return null!=zb(a.a,function(a){return Ij(a).a==b})})},ln=function(a,b){return zb(a.a,function(a){return a.sinkId==b||a.f==b})},bn=function(a,
  b){return zb(a.a,function(a){return a.session.sessionId==b})},Vm=function(a,b){return(a=bn(a,b))?a.sinkId:null},Um=function(a,b){return(a=bn(a,b))?a.session:null},dn=function(a,b,c){var d=Um(a,b);d&&(a=tb(c,function(a){return a.playerState!=chrome.cast.media.Pe.IDLE}),a.forEach(function(a){if(!a.media){var b=zb(d.media,function(b){return b.mediaSessionId==a.mediaSessionId});b&&(a.media=b.media)}}),d.media=a)};zo.prototype.fa=function(){return"cast.SessionRecords"};zo.prototype.sa=function(){return[new Do(this.a)]};
  zo.prototype.wa=function(){var a=Kf(this);if(a)for(var b=0;b<a.a.length;b++){var c=a.a[b],d=new yo(c.sinkId,c.session);d.b=c.b;d.a=c.a;d.g=c.g;d.l=c.l;d.f=c.f;this.a.push(d)}};var Do=function(a){this.a=a};var Eo=function(a){this.w="sender-"+ib();this.f=new ri;this.m=null;Nf(this);this.b=a;this.h=new ro;this.g=new zo;this.u=new Zn(this.w,this);this.a=new Mk(this.u,this);this.G=new vo(this.a);this.v=new tl(this.u,this.w);this.A=new jo(this.v,this.a);this.l=new Pm(this.v,this.a,this.h,this.g,this.u,this);this.B=new Hl(this.a,this.v);this.H=this.a.start.bind(this.a);this.s=new Map;this.K=!0};h=Eo.prototype;h.getName=function(){return"cast"};
  h.Ga=function(){this.v.init();this.g.init();this.l.init();this.u.init();this.a.init();this.G.init();this.A.init()};h.kc=function(){var a=this.f.P(),b=[].concat(la(this.s.values())).map(function(a){return a.Kf.Db()});return a.concat(b)};h.wd=function(a){var b=this;if(null!=Fo(a))return new no([]);var c=new Bl;Go(a).forEach(function(a){dl(b.a,a).map(function(a){return a.b}).forEach(function(a){c.add(a)})});return new no(c.P(),-1!=a.indexOf("0F5096E8")?Ne:null)};
  h.startObservingMediaSinks=function(a){var b=this,c=Fo(a);c?(u(this.j,"Received broadcast request "+a),ci(this.a.a.Oa(!1),function(a){b.v.sendMessage(c,a,Uj).catch(function(a){b.j.error("Broadcast failed "+a.message)})})):(Go(a).forEach(function(a){var c=b.A,d=c.a.get(a);d?d.Jf++:c.a.set(a,{Jf:1});u(c.j,"Scanning sinks for app availability");ci(c.b.a.Oa(!1),c.ih,c)}),this.K&&this.b.nf()&&this.a.start())};
  h.stopObservingMediaSinks=function(a){var b=this;null!=Fo(a)||Go(a).forEach(function(a){ko(b.A,a)})};h.startObservingMediaRoutes=function(){};h.stopObservingMediaRoutes=function(){};h.ed=function(a){u(this.j,"Enables discovery: "+a);(this.K=a)?this.b.If(this.H):this.a.stop()};h.Cd=function(a){return(a=this.a.b(a))?a.b:null};
  var Ho=function(a,b,c){a.j.error("Error launching.",c);fn(a,b.id,!1,!0,"error");c=new Vd(xo,"warning");c.routeId=b.id;a.b.mc().send(c)},Mo=function(a,b,c,d,e,f,g,l){gk().b=new dk(c.ib,c.Ea());var r=po(b,c,d,!0);r.forDisplay=!1;r.offTheRecord=e;a.f.set(r.id,r);a.b.pc(a,r);Io(a);(e=Nm(b))&&e.a&&Jo(a,e,r.id,g,l);Le(b)||Me(b)?(r.ob={tabId:l,sessionId:"",He:c.Ea()||"",Ie:c.ib||""},Me(b)&&(r.isOffscreenPresentation=!0),a.b.qf(a,r,d,function(e){return ce(Ko(a,b,c,d,f,g,l,e))}).a.then(function(){Lo(a,r)},
  function(b){Ho(a,r,b)})):Ko(a,b,c,d,f,g,l,r).then(null,function(b){Ho(a,r,b)});return Promise.resolve(r)},Ko=function(a,b,c,d,e,f,g,l){return wn(a.l,No(b,c,e),c).then(function(e){un(a,b,c,d,e,f,g,l);return l})};
  Eo.prototype.createRoute=function(a,b,c,d,e,f,g){var l=this,r=this.a.b(b);if(!r)return be(Error("No sink with ID "+b));var y=Im(a);if(y){setTimeout(function(){Tm(l.l,y,r,chrome.cast.qd.CAST)},0);var z=function(){return Mo(l,a,r,c,d,e,f,g)},I=dm(this.h,y);if(I)return ce(this.terminateRoute(I.routeId).then(z,z));if(f&&g&&(b=Oo(this,a,f,g,d,e,b)))return b}return ce(Mo(this,a,r,c,d,e,f,g))};
  var fn=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?"closed":e;u(a.j,"Remove route "+b);var f=so(a.h,b);if(f){c=c||f.b;var g=f.clientId;u(a.j,"Remove client "+g);for(var l=a.g,r=0;r<l.a.length;r++)Ib(l.a[r].b,g);to(a.h,g)}if(g=Bo(a.g,b))Ib(g.a,b),Po(a,g.a);if(l=a.f.get(b))if(l.Mc&&g&&(on(a.u,l.sinkId,f?f.clientId:a.w,g.session.transportId,c),l.forDisplay&&f&&(a.m={Kc:f,Oh:g})),a.f.remove(b),a.b.Xc(a,l),Io(a),d)a.b.onPresentationConnectionClosed(b,e,"Remove route");else a.b.onPresentationConnectionStateChanged(b,
  "terminated")},tn=function(a,b){b.a.forEach(function(c){if(c=a.f.get(c)){var d=b.session;c.ob&&c.forDisplay?Lo(a,c):(c.description=d.statusText||d.displayName,a.b.Wb(a,c))}})},Qo=function(a,b){wb(b,function(b){b=a.f.get(b,null);if(!b||!b.mediaSource)return!1;var c=Nm(b.mediaSource),c=c?c.u:!1;return b.isLocal&&!c})&&w(b,function(b){if(b=a.f.get(b,null))b.isLocal=!0})},Po=function(a,b){var c=[],d=[],e=null;b.forEach(function(b){if(b=a.f.get(b)){b.forDisplay=!1;var f=Nm(b.mediaSource);f&&zb(Jm(f),Zl)||
  (b.Mc?(f=f?Km(f):null,e||f==chrome.cast.Hb.CUSTOM_CONTROLLER_SCOPED||(c.push(b),e=b.sinkId)):e&&e!=b.sinkId?c.push(b):d.push(b))}});w(0<c.length?c:d,function(a){a.forDisplay=!0})},Jo=function(a,b,c,d,e){var f=b.a;if(f&&!dm(a.h,f)){u(a.j,"Add client "+f);var g=Jm(b);a.h.a.push(new qo(c,f,g,Km(b),d||null,k(e)?e:null))}},Lo=function(a,b){if(a=Bo(a.g,b.id))a=a.session,a.statusText=b.description||a.statusText},un=function(a,b,c,d,e,f,g,l){var r=ln(a.g,c.getId());if(!r){var y=a.g,r=c.getId();u(y.j,"Adding new session: "+
  r+", "+e.sessionId);var z=bn(y,e.sessionId);z?(Sl(e)?(z.l=e,z.f=r):Sl(z.session)&&(z.l=z.session,z.f=z.sinkId,z.session=e,z.sinkId=r),r=z):(r=new yo(r,e),y.a.push(r))}var I=null!=b;if(!I&&Zl(e.appId))return null;null==b?(z=new Em([{appId:e.appId,capabilities:e.capabilities}]),b=z.toString()):z=Nm(b);if(y=l){if(!a.f.get(y.id))return t(a.j,"Route "+y.id+" not added"),y}else y=po(b,c,d||e.sessionId,I),a.f.set(y.id,y);d=y.id;u(a.j,"Add route "+d);b=null;z&&(b=z.a,Jo(a,z,d,f,g));Bb(r.a,d)||r.a.push(d);
  y.Mc&&ao(a.u,c,b||a.w,e.transportId,!(z&&z.u));r.offTheRecord=y.offTheRecord;f=r.a;Qo(a,f);Po(a,f);f=y;g=e.sessionId;d=e.appId;("0F5096E8"==d||"85CDB22F"==d)&&g&&f.ob&&(f.ob.sessionId=g);!Xl(e)||null!==e&&Bb(Yl,e.appId)||(f.customControllerPath="cast_route_details.html?"+["sessionId="+g,"appId="+d].join("&"));f.description=e.statusText||e.displayName;l?a.b.Wb(a,y):a.b.pc(a,y);Io(a);if(l=b)Bb(r.b,b)?l=!1:(r.b.push(b),l=!0);l&&(a=a.l,hm(a.b,b,new bm("new_session",e)),gn(a,e,c));return y};
  Eo.prototype.terminateRoute=function(a){var b=this,c=this.f.get(a);if(!c)return Promise.reject(new mo(3,"Route in Cast provider not found for routeId  "+a));var d=Bo(this.g,a);if(!d)return fn(this,a,!0),Promise.resolve();var e=d.session.sessionId,f=this.a.b(c.sinkId);if(!f)return cn(this.l,e),Promise.resolve();(a=so(this.h,a))&&Tm(this.l,a.clientId,f,chrome.cast.qd.STOP);yk(0);return new Promise(function(a){var c=function(){rn(b.l,f.getId());a()};b.v.sendRequest(new ol(e),f,Qj).then(c,c)})};
  var Ro=function(a,b){var c=null;di(a.f.Oa(!1),function(d){if(!d.Mc)return!1;var e=a.a.b(d.sinkId);if(!e||!Mm(b,No(d.mediaSource,e)))return!1;c=d;return!0});if(!c||!c.mediaSource)return null;var d=Om(c.mediaSource);if(!d)return null;var e=dm(a.h,d);return e?(d=Ao(a.g,d))?{Kc:e,Oh:d}:null:null},Oo=function(a,b,c,d,e,f,g){var l=null;di(a.f.Oa(!1),function(a){var b=a.ob;return b&&null!=b.tabId&&b.tabId==d&&Je(a.mediaSource)?(l=a,!0):!1});if(!l)return null;var r=function(){return a.createRoute(b,g||l.sinkId,
  "",e,f,c,null==d?void 0:d)};return ce(a.terminateRoute(l.id).then(r,r))};h=Eo.prototype;h.connectRouteByRouteId=function(a,b,c,d,e){if(!Nm(a))return be(Error("Unsupported presentation URL"));b=Ij(b);b=bn(this.g,b.a);if(!b)return be(Error("No matching route"));var f=this.a.b(b.sinkId);return f?(a=un(this,a,f,c,b.session,d,e))?ae(a):be(Error("Failed to create route")):be(Error("No sink"))};
  h.joinRoute=function(a,b,c,d,e,f){var g=Nm(a);if(!g)return be(Error("Unsupported presentation URL"));if(b==chrome.cast.Yf){a:{var l=Ro(this,g);if(!l){if(!this.m||this.m.Kc.origin!=e||this.m.Kc.tabId!=f){l=null;break a}l=this.m}switch(Km(g)){case chrome.cast.Hb.PAGE_SCOPED:l=null;break a;case chrome.cast.Hb.ORIGIN_SCOPED:if(e!=l.Kc.origin){l=null;break a}break;case chrome.cast.Hb.TAB_AND_ORIGIN_SCOPED:if(e!=l.Kc.origin||f!=l.Kc.tabId){l=null;break a}}l=bn(this.g,l.Oh.session.sessionId)}if(!l&&(g.f?
  g.f:chrome.cast.Zd.CREATE_SESSION)!=chrome.cast.Zd.CAST_THIS_TAB&&(d=Oo(this,a,e,f,c,d)))return d}else l=So(this,b);if(!l)return be(Error("No matching route"));if(l.offTheRecord!=c)return be(Error("Off the record mismatch"));d=this.a.b(l.sinkId);if(!d)return be(Error("No sink"));a=un(this,a,d,b,l.session,e,f);a.offTheRecord=c;return ae(a)};h.detachRoute=function(a){fn(this,a,!1,!0)};
  h.Qc=function(a){var b=this.a.b(a);if(!b)throw Error("Cannot mirror with no sink.");var c=new pf,b=b.a;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;qf(c);Object.freeze(c);u(this.j,function(){return"Settings for "+a+": "+of(c)});if(!c.shouldCaptureAudio&&!c.shouldCaptureVideo)throw Error("Cannot start mirroring without video or audio capture");
  return c};h.gc=function(){return"cast_streaming"};
  h.sendRouteMessage=function(a,b,c){var d=this,e=this.s.get(a);if(e)return"string"!==typeof b?Promise.reject("String-typed message required"):e.Kf.gl(b);if(!c)return new Promise(function(a,c){"string"!==typeof b&&c(Error("Cannot send non-string messages via ApiHandler."));c=d.l.b;v(fm,"Received: "+b);var e=JSON.parse(b),f=e.clientId;"client_connect"==e.type?(v(fm,"App "+f),(e=dm(c.a,f))?(e.a=!0,(c=sl(c.b,e.routeId))&&c.qa.resolve(!0)):t(fm,"Client not found "+f)):em(c,f)?(c=c.f[e.type])&&c(e):t(fm,
  "No route for "+f);a()});var f=Bo(this.g,a);if(!f)return Promise.reject(Error("Not managing the route "+a));var g=this.a.b(f.sinkId);if(!g)return Promise.reject(Error("Sink no longer accessible"));var l=(a=so(this.h,a))?a.clientId:this.w;return new Promise(function(a){wl(d.u,g,c.namespace,b,l,f.session.transportId).then(a,a)})};h.sendRouteBinaryMessage=function(a,b){var c=this.s.get(a);return c?c.Kf.Ml(b):Promise.reject(Error("Route "+a+" does not support sending binary data."))};
  h.rd=function(a,b){var c=this.a.b(b);if(!c)return!1;a=No(a,c);return(a=Lm(a))&&0!=a.length?wb(a,function(a){return Wj(rk(c,a))}):!1};h.Ic=function(a,b,c){var d=Go(a);return d&&0!=d.length?b==chrome.cast.Yf?!0:c&&c.mediaSource?(a=Lm(c.mediaSource),wb(a,function(a){return Bb(d,a)})):void 0==b||So(this,b)?!0:!1:!1};
  var No=function(a,b,c){return Le(a)||Me(a)?(a={appId:0==(b.a&1)?"85CDB22F":"0F5096E8",capabilities:Ul(b.a)},(new Em([a],void 0,void 0,void 0,c)).toString()):a},Go=function(a){var b=[];if(Le(a)||Me(a)){var c=fe();Ke(a)&&"ChromeOS"!=c&&"Windows"!=c||b.push("85CDB22F");b.push("0F5096E8")}else(a=Lm(a))&&(b=Lb(b,a));return b},Fo=function(a){var b=Nm(a);if(!b)return null;a=Go(a);var c=b.m||"",b=b.h;return c&&b?new ml(a,c,JSON.stringify(b)):null},So=function(a,b){return 0==b.indexOf(chrome.cast.kg)?bn(a.g,
  b.substr(chrome.cast.kg.length)):Co(a.g,b)},co=function(a,b,c){var d=a.B;if(Il(d)&&Vj.hasOwnProperty(c.namespace_)){var e=b.Ea();if(e){var f=JSON.parse(c.data);if("RECEIVER_STATUS"===f.type){var g=f.status&&f.status.applications&&f.status.applications[0],l=f=null;g&&(g.appId&&(f=g.appId),g.sessionId&&(l=g.sessionId));g=d.b.get(e);d.b.set(e,new Fl(e,f,l));g&&g.appId===f||Jl(d)}}}a=a.l;b=b.getId();Vj.hasOwnProperty(c.namespace_)?pn(a,b,c):qn(a,b,c)};
  Eo.prototype.T=function(a){if(0==this.a.a.da())this.b.onSinkAvailabilityUpdated(this,0);var b=this.l;a=a.getId();(a=ln(b.a,a))&&a.session&&cn(b,a.session.sessionId);Kl(this.B);this.b.Fb()};var Yk=function(a,b){a.A.ih(b);Kl(a.B);a.b.Fb()};h=Eo.prototype;h.fa=function(){return"cast.Provider"};h.sa=function(){return[new To(this.w,vi(this.f),this.m)]};h.wa=function(){var a=Kf(this);a&&(this.w=a.f,qi(this.f,a.b),this.m=a.a)};h.searchSinks=function(){return Fa()};h.createMediaRouteController=function(){return Fa()};
  h.provideSinks=function(){};
  var Io=function(a){a.b.cd(a.fa(),a.kc().some(function(a){return a.isLocal}))},Wo=function(a){var b=Uo(),c=a.Db();if(b.s.has(c.id))throw Error("Cannot re-register for same route ID: "+c.id);u(b.j,"Registering remoter with route: "+c.id);a=new Vo(a);b.s.set(c.id,a);b.b.pc(b,c);Io(b);a.a=function(a){return b.b.Mb(b,c.id,a)};return a},Xo=function(a){var b=Uo();a=a.Db();var c=b.s.get(a.id);c&&(u(b.j,"Unregistering remoter with route: "+a.id),c.a=null,b.s.delete(a.id),b.b.Xc(b,a),Io(b))};
  Eo.prototype.j=Ia("mr.CastProvider");var Vo=function(a){this.Kf=a;this.a=null},Yo=function(a,b){a.a&&a.a(b)},To=function(a,b,c){this.f=a;this.b=b;this.a=c};var Zo=function(a,b){this.routeId=a;this.message=b},$o=function(a){return"string"!=typeof a.message};var ap=function(a,b){this.input=a;this.domain=b};var bp=function(a){this.s=a;this.g=this.l=null},cp=function(a){if(null==a.g)if(null==a.l||Date.now()-a.l>=a.s)a.h();else{var b=Math.max(a.l+a.s-Date.now(),5);a.g=setTimeout(a.h.bind(a),b)}};bp.prototype.h=function(){null!=this.g&&(clearTimeout(this.g),this.g=null);this.w();this.l=Date.now()};bp.prototype.w=function(){};var dp=function(a,b){bp.call(this,20);this.a=new Map;this.b=new Set;this.u=null;this.m=this.f=0;this.v=!1;this.B=a;this.A=b;this.j=Ia("mr.RouteMessageSender")};ka(dp,bp);dp.prototype.init=function(a){this.u=a;Nf(this)};dp.prototype.stopListeningForRouteMessages=function(a){this.b.delete(a)};
  dp.prototype.send=function(a,b){var c=this.a.get(a);c||(c=[],this.a.set(a,c));b=new Zo(a,b);c.push(b);50<c.length&&1==c.length%50&&t(this.j,function(){return"Message queue length is excessively large "+("("+c.length+") for route "+a)});this.f+=$o(b)?0:b.message.length;$o(b)&&this.m++;ep(this);this.b.has(a)&&cp(this)};
  var fp=function(a,b){if(0!=b.length){b=ja(b);for(var c=b.next();!c.done;c=b.next())c=c.value,a.f-=$o(c)?0:c.message.length,$o(c)&&a.m--}},ep=function(a){var b=0<a.m||a.f>a.A;b!=a.v&&(a.v=b,a.B.cd(a.fa(),b))};dp.prototype.w=function(){if(this.u){for(var a=ja(this.b),b=a.next();!b.done;b=a.next()){var b=b.value,c=this.a.get(b);c&&0!=c.length&&(this.u(b,c),fp(this,c),this.a.set(b,[]))}ep(this)}else this.j.error("sendMessagesCallback not set. Messages not delivered.")};dp.prototype.fa=function(){return"mr.RouteMessageSender"};
  dp.prototype.sa=function(){var a=[].concat(la(this.a.entries())).map(function(a){return[a[0],a[1].map(function(a){return a.message})]});return[new gp(a,Array.from(this.b),this.f)]};dp.prototype.wa=function(){var a=Kf(this);if(a){this.a=new Map;for(var b={},c=ja(a.b),d=c.next();!d.done;b={routeId:b.routeId},d=c.next())d=d.value,b.routeId=d[0],d=d[1].map(function(a){return function(b){return new Zo(a.routeId,b)}}(b)),this.a.set(b.routeId,d);this.b=new Set(a.a);this.f=a.f}};
  var gp=function(a,b,c){this.b=a;this.a=b;this.f=c};var hp=function(){this.a=[]};hp.prototype.listen=function(a,b,c){this.a.push({type:a,Ma:b,target:c})};hp.prototype.w=function(a,b,c){var d=this.a.findIndex(function(d){return d.type==a&&d.Ma==b&&d.target==c});-1!=d&&this.a.splice(d,1)};hp.prototype.dispatchEvent=function(a){this.a.forEach(function(b){b.type==a.type&&Promise.resolve().then(function(){return b.Ma.call(b.target,a)})})};var ip=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)};var jp=function(a,b,c){this.m=null!=c?a.bind(c):a;this.h=b;this.l=this.u.bind(this);this.g=[];this.a=!1;this.b=null};jp.prototype.f=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];this.g=[].concat(la(b));null==this.b?kp(this):this.a=!0};var kp=function(a){a.b=setTimeout(a.l,a.h);a.m.apply(a,[].concat(la(a.g)))};jp.prototype.u=function(){this.b=null;this.a&&(this.a=!1,kp(this))};var lp=/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/,mp=[4278190080,4293918720,4294901760],np=[167772160,2886729728,3232235520],op=function(a){var b=document.createElement("a");b.href=a;return b};var qp=function(a,b,c,d){b="["+b+"]: "+c+" "+d.responseURL+" => "+d.status+" ("+d.statusText+")";pp(d)?u(a,b):v(a,b)},pp=function(a){return 200<=a.status&&299>=a.status},rp=function(a){a=(new DOMParser).parseFromString(a,"text/xml");return a.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror").length?null:a};var sp=function(){this.name="unknown";this.state="error";this.a=null;this.allowStop=!0;this.resource=null;this.extraData={}},tp=function(){var a=Error.call(this);this.message=a.message;"stack"in a&&(this.stack=a.stack)};ka(tp,Error);var vp=function(a,b){void 0===b&&(up||(up=new lc(10,2E3,1)),b=up);this.b=a;this.a=b;this.j=Ia("mr.dial.Client")};
  vp.prototype.launchApp=function(a,b){var c=this;return this.a.send(wp(this,a),"POST",b,{timeoutMillis:15E3}).then(function(a){return xp(c,"launchApp","POST",a)})};
  var yp=function(a,b){return a.a.send(wp(a,b),"DELETE").then(function(b){return xp(a,"stopApp","DELETE",b)})},zp=function(a,b){return a.a.send(wp(a,b),"GET",void 0,{kh:3}).then(function(c){qp(a.j,"GetAppInfo","GET",c);if(!pp(c)){if(404==c.status)throw new tp;throw Error("Response error: "+c.status);}c=rp(c.responseText);if(!c)throw u(a.j,"Invalid or empty response"),Error("Invalid or empty response");var d=c.getElementsByTagName("service");if(!d||1!=d.length)throw u(a.j,"Invalid GET response (invalid service)"),
  Error("Invalid GET response (invalid service)");c=new sp;for(var e=0,f=d[0].childNodes.length;e<f;e++){var g=d[0].childNodes[e];if("state"==g.nodeName){a:switch(g.textContent){case "running":g="running";break a;case "stopped":g="stopped";break a;default:g="error"}c.state=g}else"name"==g.nodeName?c.name=g.textContent:"link"==g.nodeName?c.resource=g.getAttribute("href"):"options"==g.nodeName?c.allowStop="false"!=g.getAttribute("allowStop"):c.extraData[g.nodeName]=g.innerHTML}if("unknown"==c.name)throw u(a.j,
  "GET response missing name value"),Error("GET response missing name value");if(c.name!=b)throw u(a.j,"GET app name mismatch"),Error("GET app name mismatch");if("error"==c.state)throw u(a.j,"GET response missing state value"),Error("GET response missing state value");if((d=/installable=(.+)/.exec(c.state))&&d[1])c.state="installable",c.a=d[1];else if("running"!=c.state&&"stopped"!=c.state)throw u(a.j,"GET response has invalid state value"),Error("GET response has invalid state value");return c})},
  wp=function(a,b){a=a.b.Kb;"/"!=a.charAt(a.length-1)&&(a+="/");return a+b},xp=function(a,b,c,d){return new Promise(function(e,f){qp(a.j,b,c,d);pp(d)?e():f(Error(d.statusText))})},up=null;var Ap=function(){var a=window.crypto.getRandomValues(new Uint8Array(16));return ub(a,function(a){a=a.toString(16);return 1<a.length?a:"0"+a}).join("")},Bp=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},Cp=function(a){for(var b,
  c,d=[],e=0,f=0;e<a.length;){var g=a[e++];if(128>g)d[f++]=String.fromCharCode(g);else if(191<g&&224>g)c=a[e++],d[f++]=String.fromCharCode((g&31)<<6|c&63);else if(239<g&&365>g){c=a[e++];b=a[e++];var l=a[e++];b=((g&7)<<18|(c&63)<<12|(b&63)<<6|l&63)-65536;d[f++]=String.fromCharCode(55296+(b>>10));d[f++]=String.fromCharCode(56320+(b&1023))}else c=a[e++],b=a[e++],d[f++]=String.fromCharCode((g&15)<<12|(c&63)<<6|b&63)}return d.join("")};var Dp=null,Ep=null,Fp=Bg||Cg&&!On||yg||!On&&!zg&&"function"==typeof na.atob,Hp=function(a){Gp();for(var b=Dp,c=[],d=0;d<a.length;d+=3){var e=a[d],f=d+1<a.length,g=f?a[d+1]:0,l=d+2<a.length,r=l?a[d+2]:0,y=e>>2,e=(e&3)<<4|g>>4,g=(g&15)<<2|r>>6,r=r&63;l||(r=64,f||(g=64));c.push(b[y],b[e],b[g],b[r])}return c.join("")},Jp=function(a){if(Fp)return na.atob(a);var b="";Ip(a,function(a){b+=String.fromCharCode(a)});return b},Kp=function(a){var b=new Uint8Array(Math.ceil(3*a.length/4)),c=0;Ip(a,function(a){b[c++]=
  a});return b.subarray(0,c)},Ip=function(a,b){function c(b){for(;d<a.length;){var c=a.charAt(d++),e=Ep[c];if(null!=e)return e;if(!Ua(c))throw Error("Unknown base64 encoding at char: "+c);}return b}Gp();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),l=c(64);if(64===l&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=l&&b(g<<6&192|l))}},Gp=function(){if(!Dp){Dp={};Ep={};for(var a=0;65>a;a++)Dp[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),Ep[Dp[a]]=a,62<=a&&(Ep["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=
  a)}};var Lp=function(a,b){this.appName=a;this.launchParameter=void 0===b?"":b},Np=function(a){if(a.startsWith("urn:dial-multiscreen-org:dial:application:")){var b=a.indexOf("?"),c=a.substring(42,0<b?b:void 0);a=c&&0<c.length?new Lp(c,0<b?a.substring(b+1):void 0):null}else a=Mp(a);return a},Mp=function(a){var b=(new jm(a)).f;if(!b)return null;a=(a=Op.exec(b))?a[1]:null;if(!a)return null;a=decodeURIComponent(a);if(b=(b=Pp.exec(b))?b[1]:void 0)try{b=Jp(b)}catch(c){return t(Qp,"Invalid base64 encoded postData:"+
  b),null}return new Lp(a,b)},Qp=Ia("mr.dial.MediaSource"),Op=/__dialAppName__=([A-Za-z0-9-._~!$&'()*+,;=%]+)/,Pp=/__dialPostData__=([A-Za-z0-9]+={0,2})/;var Rp=function(a,b){this.ub=a;this.appName=b};var Sp=function(a){this.a=new Map;this.b=a};Sp.prototype.init=function(){Nf(this)};Sp.prototype.clear=function(){this.a.clear()};Sp.prototype.add=function(a){if(!this.a.get(a.ub.id)){this.a.set(a.ub.id,a);var b=this.b;Tp(b);b.g.pc(b,a.ub)}};var Up=function(a,b){a=ja(a.a);for(var c=a.next();!c.done;c=a.next())if(c=ja(c.value),c.next(),c=c.next().value,c.ub.sinkId==b)return c;return null},Wp=function(a,b){var c=a.a.get(b);c&&(a.a.delete(b),Vp(a.b,c))},Xp=function(a){return Array.from(a.a.values(),function(a){return a.ub})};
  Sp.prototype.fa=function(){return"dial.ActivityRecords"};Sp.prototype.sa=function(){return[Array.from(this.a)]};Sp.prototype.wa=function(){var a=Kf(this);a&&(this.a=new Map(a))};var Yp={zn:0,tq:1,qp:2,yn:3},Zp={ERROR:0,Ip:1,EMPTY:2},$p=function(a){we("MediaRouter.Dial.Create.Route",a,Yp)};var aq=function(){this.a=this.modelName=this.deviceType=this.expireTimeMillis=this.fetchTimeMillis=this.appUrl=this.ipAddress=this.friendlyName=this.deviceLabel=this.uniqueId=null},bq=function(a){if(a.deviceLabel)if(a.uniqueId)if(a.friendlyName)if(a.ipAddress)if(a.appUrl)if(a.fetchTimeMillis)if(a.expireTimeMillis){var b=a.ipAddress;a=op(a.appUrl);b="http:"==a.protocol&&a.hostname==b?null:"Invalid appUrl"}else b="Missing expireTimeMillis";else b="Missing fetchTimeMillis";else b="Missing appUrl";else b=
  "Missing ipAddress";else b="Missing friendlyName";else b="Missing uniqueId";else b="Missing deviceLabel";return b};aq.prototype.toString=function(){return JSON.stringify(this,function(a,b){return"string"===typeof b&&b.startsWith("uuid:")?"***":b})};
  var cq=function(a){var b=new aq;b.uniqueId=a.uniqueId;b.deviceLabel=a.deviceLabel;b.friendlyName=a.friendlyName;b.ipAddress=a.ipAddress;b.appUrl=a.appUrl;b.fetchTimeMillis=a.fetchTimeMillis;b.expireTimeMillis=a.expireTimeMillis;b.deviceType=a.deviceType;b.modelName=a.modelName;b.a=a.configId;return b},eq=function(a){void 0===a&&(dq||(dq=new lc(10,3E3,2)),a=dq);this.a=new Map;this.b=new Map;this.f=new Map;this.g=a;this.j=Ia("mr.dial.DeviceDescriptionService");Nf(this)};eq.prototype.fa=function(){return"mr.dial.DeviceDescriptionService"};
  eq.prototype.sa=function(){return[Array.from(this.a)]};eq.prototype.wa=function(){var a=Kf(this);if(a)for(var a=ja(a),b=a.next();!b.done;b=a.next()){var c=ja(b.value),b=c.next().value,c=c.next().value;null!=bq(cq(c))?this.j.error("Dropping invalid description "+(b+" loaded from storage.")):this.a.set(b,cq(c))}};
  var gq=function(a,b){var c;if(c=a.a.get(b.deviceLabel)){if(c.a!=b.configId||Date.now()>=c.expireTimeMillis)v(a.j,"Removing invalid entry "+c.toString()),a.a.delete(b.deviceLabel),c=null}else c=null;return c?(ve("MediaRouter.Dial.Device.Description.Cached"),Promise.resolve(c)):fq(a,b)},fq=function(a,b){if(!hq(b.deviceDescriptionUrl))return Promise.reject(Error("Invalid device description URL: "+b.deviceDescriptionUrl));var c=a.b.get(b.deviceLabel);if(c&&c.deviceDescriptionUrl==b.deviceDescriptionUrl)return c.qa.a;
  var d=new Ra,c={deviceDescriptionUrl:b.deviceDescriptionUrl,qa:d};a.b.set(b.deviceLabel,c);chrome.dial.fetchDeviceDescription(b.deviceLabel,function(c){a.b.delete(b.deviceLabel);c?((c=iq(a,b,c.deviceDescription,c.appUrl))?(u(a.j,"Got device description for "+c.deviceLabel),v(a.j,"... device description was: "+c.toString()),null!=c.a&&(v(a.j,"Caching device description for "+c.deviceLabel),a.a.set(b.deviceLabel,c))):(we("MediaRouter.Dial.Device.Description.Failure",1,Zp),u(a.j,"Invalid device description"),
  c=null),c?d.resolve(c):d.reject(Error("Failed to process device description"))):d.reject(xn("chrome.dial.fetchDeviceDescription"))});return d.a},iq=function(a,b,c,d){var e=rp(c);if(!e)return null;var f=new aq;f.fetchTimeMillis=Date.now();f.expireTimeMillis=f.fetchTimeMillis+18E5;f.deviceLabel=b.deviceLabel;f.a=b.configId;b=op(b.deviceDescriptionUrl);f.ipAddress=b.hostname;f.deviceType=jq(e,"deviceType");f.modelName=jq(e,"modelName");f.friendlyName=jq(e,"friendlyName");f.uniqueId=jq(e,"UDN");!f.friendlyName&&
  f.modelName&&(f.friendlyName=f.modelName,f.uniqueId&&(f.friendlyName+="["+f.uniqueId.slice(-4)+"]"),t(a.j,"Fixed device description: created friendlyName from modelName."));f.appUrl=d;d=bq(f);v(a.j,function(){return"Device description: "+kq(e)});return d?(t(a.j,function(){return"Device description failed to validate: "+f},d),null):f},jq=function(a,b){return(a=a.getElementsByTagName(b))&&0!=a.length?a[0].textContent:null},kq=function(a){var b=function(a){for(var b=0,c=a.length;b<c;b++)a[b].textContent=
  "***"};b(a.getElementsByTagName("UDN"));b(a.getElementsByTagName("serialNumber"));return(new XMLSerializer).serializeToString(a)},lq=function(a,b){var c=a.f.get(b);if(c)return c.a;c=new Ra;a.f.set(b,c);a.g.send(b,"GET").then(function(d){a.f.delete(b);qp(a.j,"checkAccess","GET",d);c.resolve(pp(d))},function(){a.j.error("Timed out checking access to device description URL.");c.resolve(!1)});return c.a},hq=function(a){a=op(a);var b;if(b="http:"==a.protocol)a:{b:if((a=a.hostname.match(lp))&&5==a.length){b=
  [];for(var c=0;4>c;c++)if(b[c]=Number.parseInt(a[c+1],10),0>b[c]||255<b[c]){a=null;break b}a=b}else a=null;if(a)for(a=(a[0]<<24|a[1]<<16|a[2]<<8|a[0])>>>0,b=0;3>b;b++)if((a&mp[b])>>>0==np[b]){b=!0;break a}b=!1}return b},dq=null;var mq=null,nq=null,oq=function(){mq||(mq=new Ck(3,"dial.DialOnDeviceListEventListener","mr.dial.SinkDiscoveryService",chrome.dial.onDeviceList));nq||(nq=new Ck(4,"dial.DialOnErrorEventListener","mr.dial.SinkDiscoveryService",chrome.dial.onError));return[mq,nq]};var pq=function(a,b){b=void 0===b?new eq:b;this.f=a;this.m=b;this.j=Ia("mr.dial.SinkDiscoveryService");this.a=new Map;this.h=this.l=!1;this.b={cc:0,jc:0};this.g=0};ka(pq,Pe);pq.prototype.init=function(){Nf(this);Ze("mr.dial.SinkDiscoveryService",this)};pq.prototype.start=function(){this.l||(u(this.j,"Starting..."),this.l=!0,oq().forEach(function(a){return a.addListener()}),qq(this))};pq.prototype.stop=function(){u(this.j,"Stopping...");this.l=!1;oq().forEach(function(a){return a.removeListener()})};
  var qq=function(a){a.l?chrome.dial.discoverNow(function(b){u(a.j,"chrome.dial.discoverNow = "+b)}):u(a.j,"Not started. Ignoring discover().")},uq=function(a,b){u(a.j,"addSinks returned "+b.length+" sinks");v(a.j,function(){return"....the list is: "+JSON.stringify(b)});var c=new Set(a.a.keys());b.forEach(function(b){var d=rq(b.sink_id),e=b.extra_data.dial_media_sink,f=sq.test(e.model_name);b=new jk(b.name,d);b.hb=e.ip_address.address.join(".");b.Kb=e.app_url.url;b.ib=e.model_name;e=kk(b,!f);tq(a,e);
  c.delete(e.getId())});var d=[];c.forEach(function(b){var c=a.a.get(b);d.push(c);a.a.delete(b)});0<d.length&&a.f.lc(d);var e=a.a.size;a.b={cc:e,jc:e}};
  pq.prototype.u=function(a){var b=this;u(this.j,"onDeviceList returned "+a.length+" devices");v(this.j,function(){return"....the list is: "+JSON.stringify(a)});this.h=!1;var c=0,d=[],e=new Set;a.forEach(function(a){d.push(vq(b,a).then(function(a){e.add(a.getId());tq(b,a)},function(){c++}))});Lk(d).then(function(){b.h||wq(b,e).then(function(){var a=b.a.size;xq(b,a,a+c)})})};
  var xq=function(a,b,c){a.b={cc:b,jc:c};36E5>Date.now()-a.g||(b=a.b,xe("MediaRouter.Dial.AvailableDevicesCount",b.cc),xe("MediaRouter.Dial.KnownDevicesCount",b.jc),a.g=Date.now())},tq=function(a,b){if(!a.h){v(a.j,"mayAddSink, id = "+b.getId());var c=a.a.get(b.getId());c?c.update(b)&&(v(a.j,"Updated sink "+c.getId()),a.f.Wc(c)):(v(a.j,function(){return"Adding new sink "+b.getId()+": "+("name = "+b.ab.friendlyName+(b.hb?", ip = "+b.hb:"")+(b.ib?", model = "+b.ib:"")+", apps = "+JSON.stringify(b.gb))}),
  a.a.set(b.getId(),b),a.f.Dd(b))}},wq=function(a,b){var c=[],d=[];a.a.forEach(function(e){b.has(e.getId())||d.push((e.Jb?lq(a.m,e.Jb):Promise.resolve(!1)).then(function(b){b||(a.a.delete(e.getId()),c.push(e))}))});return Lk(d).then(function(){0<c.length&&a.f.lc(c)})},vq=function(a,b){return gq(a.m,b).then(function(a){var c=a.uniqueId?rq(a.uniqueId):"",e=a.uniqueId?hk(gk(),c):b.deviceLabel,f=sq.test(a.modelName),c=new jk(a.friendlyName,c);c.ab.id=e;c.hb=a.ipAddress;c.Kb=a.appUrl;c.Jb=b.deviceDescriptionUrl;
  c.ib=a.modelName;return kk(c,!f)})},rq=function(a){0==a.indexOf("uuid:")&&(a=a.substr(5));return a.replace(/-/g,"").toLowerCase()};
  pq.prototype.w=function(a){switch(a.code){case "no_valid_network_interfaces":case "network_disconnected":t(this.j,"DIAL error: "+a.code+". Clear device list now.");a=Array.from(this.a.values());this.a.clear();this.f.lc(a);xq(this,0,0);this.h=!0;break;case "no_listeners":case "socket_error":case "cellular_network":case "unknown":t(this.j,"DIAL error: "+a.code+". Keep device list.");break;default:t(this.j,"Unhandled DIAL error: "+a.code)}};
  var yq=function(a,b){return a.a.get(b)||null},Aq=function(a,b){var c=[];a.a.forEach(function(a){"available"==lk(a,b)&&c.push(a.ab)});return new no(c,zq[b])};h=pq.prototype;h.Og=function(){return this.b};h.handleEvent=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(a==chrome.dial.onDeviceList)this.u.apply(this,[].concat(la(c)));else if(a==chrome.dial.onError)this.w.apply(this,[].concat(la(c)));else throw Error("Unhandled event");};h.fa=function(){return"dial.DialSinkDiscoveryService"};
  h.sa=function(){return[new Bq(Array.from(this.a),this.b),{deviceCountMetricsRecordTime:this.g}]};h.wa=function(){var a=Kf(this);if(a){for(var b=ja(a.sinks),c=b.next();!c.done;c=b.next())c=c.value,this.a.set(c[0],mk(c[1]));this.b=a.deviceCounts}if(a=Lf(this))this.g=a.deviceCountMetricsRecordTime};
  var zq={YouTube:"https://tv.youtube.com https://tv-green-qa.youtube.com https://tv-release-qa.youtube.com https://web-green-qa.youtube.com https://web-release-qa.youtube.com https://www.youtube.com".split(" "),Netflix:["https://www.netflix.com"],Pandora:["https://www.pandora.com"],Radio:["https://www.pandora.com"],Hulu:["https://www.hulu.com"],Vimeo:["https://www.vimeo.com"],Dailymotion:["https://www.dailymotion.com"],"com.dailymotion":["https://www.dailymotion.com"]},sq=/Eureka Dongle|Chromecast Audio/i,
  Bq=function(a,b){this.sinks=a;this.deviceCounts=b};var Cq=function(a,b){this.j=Ia("mr.dial.AppDiscoveryService");this.a=new Set;this.b=a;this.h=b;this.l=new Map;this.m=new Map;this.f=null;this.g=!1};Cq.prototype.init=function(){Nf(this)};Cq.prototype.start=function(){u(this.j,"Starting periodic scanning.");this.g||(this.g=!0,Dq(this))};Cq.prototype.stop=function(){u(this.j,"Stopping periodic scanning.");this.g&&(this.g=!1,this.f&&(clearTimeout(this.f),this.f=null),this.l.clear())};
  var Dq=function(a){u(a.j,"Start app status scan.");var b=[];Array.from(a.b.a.values()).forEach(function(c){b.push.apply(b,Eq(a,c))});Array.from(a.h.a.values()).forEach(function(c){b.push(Fq(a,c))});Lk(b).then(function(){a.g&&!a.f&&(v(a.j,"Scan complete; scheduling for next scan."),a.f=setTimeout(function(){v(a.j,"Start app status scan (timer-based)");a.f=null;Dq(a)},6E4))})},Eq=function(a,b){if(!b.Hc)return[];for(var c=[],d=ja(a.a),e=d.next();!e.done;e=d.next())c.push(a.u(e.value,b));return c};
  Cq.prototype.u=function(a,b){var c=this;if("unknown"!=lk(b,a)&&36E5>Date.now()-(b.be[a]||0)||!b.Hc)return Promise.resolve();v(this.j,"Querying "+b.getId()+" for "+a+" to update app status");return Gq(this,b,a).then(function(d){a:if("Netflix"==d.name)d=!d.extraData||"websocket"!=d.extraData.capabilities||"running"!=d.state&&"stopped"!=d.state?"unavailable":"available";else switch(d.state){case "running":case "stopped":d="available";break a;default:d="unavailable"}Hq(c,b,a,d)},function(d){d instanceof
  tp?Hq(c,b,a,"unavailable"):(t(c.j,"Failed to process app availability; "+b.getId()+" does not support app availability"),kk(b,!1))})};
  var Fq=function(a,b){var c=yq(a.b,b.ub.sinkId);if(!c)return t(a.j,"Activity refers to nonexistent sink: "+b.ub.id),Promise.resolve();if(!c.Hc)return Promise.resolve();var d=b.appName;v(a.j,"Querying "+c.getId()+" for "+d+" to update activity");return Gq(a,c,d).then(function(b){"running"!=b.state&&Iq(a,c,d)},function(){return Iq(a,c,d)})},Jq=function(a,b){var c=a.m.get(b.getId());c||(c=new vp(b),v(a.j,"Created DIAL client for "+b.getId()),a.m.set(b.getId(),c));return c},Gq=function(a,b,c){var d=Kq(b,
  c),e=a.l.get(d);if(e)return e;e=zp(Jq(a,b),c);a.l.set(d,e);b=function(){a.l.delete(d)};e.then(b,b);return e},Kq=function(a,b){return a.getId()+":"+b},Hq=function(a,b,c,d){v(a.j,"Got app status "+d+" from "+b.getId()+" for "+c);var e=lk(b,c);b.gb[c]=d;b.be[c]=Date.now();d!=e&&a.b.f.Wc(b)},Iq=function(a,b,c){(b=Up(a.h,b.getId()))&&b.appName==c&&Wp(a.h,b.ub.id)},Lq=function(a,b){return Array.from(a.b.a.values()).some(function(a){return"unknown"==lk(a,b)})};Cq.prototype.fa=function(){return"dial.AppDiscoveryService"};
  Cq.prototype.sa=function(){return[Array.from(this.a)]};Cq.prototype.wa=function(){var a=Kf(this);this.a=new Set(a||[])};var Mq=function(a,b,c){this.g=a;this.a=b||new pq(this);this.b=new Sp(this);this.f=c||new Cq(this.a,this.b);this.j=Ia("mr.DialProvider")};h=Mq.prototype;h.getName=function(){return"dial"};h.Ga=function(){this.b.init();this.a.init();this.f.init()};h.wd=function(a){v(this.j,"GetAvailableSinks for "+a);return(a=Np(a))?Aq(this.a,a.appName):oo};
  h.startObservingMediaSinks=function(a){var b=Np(a);if(b){a=this.f;b=b.appName;if(!a.a.has(b)||Lq(a,b))a.a.add(b),0!=a.b.a.size&&(a.g?Array.from(a.b.a.values()).forEach(a.u.bind(a,b)):a.start());Tp(this)}};h.stopObservingMediaSinks=function(a){if(a=Np(a))this.f.a.delete(a.appName),Nq(this)};h.startObservingMediaRoutes=function(){Tp(this)};h.stopObservingMediaRoutes=function(){Nq(this)};h.ed=function(a){a?(this.a.start(),Tp(this)):this.a.stop()};
  var Nq=function(a){(0==a.a.a.size||0==a.f.a.size&&0==a.b.a.size)&&a.f.stop()},Tp=function(a){0<a.a.a.size&&(0<a.f.a.size||0<a.b.a.size)&&a.f.start()};h=Mq.prototype;h.Cd=function(a){return(a=yq(this.a,a))?a.ab:null};h.kc=function(){return Xp(this.b)};
  h.createRoute=function(a,b,c,d){var e=this,f=yq(this.a,b);if(!f)return $p(0),be(Error("Unkown sink: "+b));gk().b=new dk(f.ib,f.Ea());var g=Np(a);if(!g)return be(Error("No app name set."));var l=g.appName,r=new vp(f);return ce(zp(r,l).then(function(a){if("running"==a.state)return yp(r,l)}).then(function(){return r.launchApp(l,g.launchParameter)}).then(function(){return Oq(e,b,a,l,c,d)}).catch(function(a){$p(3);throw a;}))};h.joinRoute=function(){return be(Error("Not supported"))};
  h.connectRouteByRouteId=function(){return be(Error("Not supported"))};h.detachRoute=function(){};var Oq=function(a,b,c,d,e,f){$p(1);b=Kj(e,a.getName(),b,c,!0,d,null);b.offTheRecord=f;a.b.add(new Rp(b,d));return b};Mq.prototype.Dd=function(a){this.g.onSinkAvailabilityUpdated(this,1);Tp(this);Eq(this.f,a);this.g.Fb();gk().a=new dk(a.ib,a.Ea())};
  Mq.prototype.lc=function(a){var b=this;if(0==this.a.a.size)this.g.onSinkAvailabilityUpdated(this,0);Nq(this);a.forEach(function(a){var c=b.b;a=a.getId();if(a=Up(c,a))c.a.delete(a.ub.id),Vp(c.b,a)});this.g.Fb()};Mq.prototype.Wc=function(){this.g.Fb()};var Vp=function(a,b){b=b.ub;if(b.isLocal)a.g.onPresentationConnectionStateChanged(b.id,"terminated");Nq(a);a.g.Xc(a,b)};h=Mq.prototype;
  h.terminateRoute=function(a){var b=this.b.a.get(a)||null;if(!b)return Promise.reject(new mo(3,"Route in DIAL provider not found for routeId "+a));Wp(this.b,a);return(a=yq(this.a,b.ub.sinkId))?yp(new vp(a),b.appName):Promise.reject(new mo(3,"Sink in DIAL provider not found for sinkId "+b.ub.sinkId))};h.Qc=function(){throw Error("Not implemented.");};h.gc=function(){return null};h.sendRouteMessage=function(){return Promise.reject(Error("DIAL sending messages is not supported"))};
  h.sendRouteBinaryMessage=function(){return Promise.reject(Error("DIAL sending messages is not supported"))};h.rd=function(a,b){b=yq(this.a,b);return!b||Le(a)?!1:(a=Np(a))?"available"==lk(b,a.appName):!1};h.Ic=function(){return!1};h.searchSinks=function(){return Fa()};h.createMediaRouteController=function(){return Fa()};h.provideSinks=function(a){uq(this.a,a)};var Pq=function(a,b){this.f=a;this.b=b;this.a=this.f.a;this.j=Ia("mr.cast.CastDialSinkDiscoveryCallbacks")},Qq=function(a,b){var c=a.a.b(b.getId());if(c)return c;(b=b.Ea())?(a=a.a,c=gk().f||8009,a=a.m.get(b+":"+c)):a=null;return a};Pq.prototype.Dd=function(a){Qq(this,a)?Ak(2):Rq(this,a);this.b.Dd(a)};var Rq=function(a,b){var c=pk(b);c&&Uk(a.a,c).then(function(d){d?Qq(a,b)?Ak(2):(Vk(a.a,c),Ak(0)):ve("MediaRouter.Dial.Sink.Discovered.NonCast")},qa)};
  Pq.prototype.lc=function(a){var b=this;w(a,function(a){var c=b.a.b(a.getId());c&&c.Ub&&Wk(b.a,a.getId())});this.b.lc(a)};Pq.prototype.Wc=function(a){var b=this.a.b(a.getId());b?b.Ub&&(b.update(a.ab.friendlyName,a.Ea(),b.va(),b.a)&&u(this.j,"Updated Cast sink with DIAL sink: "+a.getId()),Yk(this.a.g,b)):Rq(this,a);this.b.Wc(a)};var Sq=function(a,b){this.m=new pq(new Pq(b,this));this.f=new ri;this.b=a;this.h=this.l=0;this.g=new Bl;this.a=new Mq(this,this.m)};h=Sq.prototype;h.fa=function(){return"cast.DialProviderWrapper"};h.sa=function(){return[new Tq(vi(this.f),this.l,this.h,this.g.P())]};h.wa=function(){var a=Kf(this);a&&(qi(this.f,a.b),this.l=a.sequenceNumber,this.h=a.f,Al(this.g,a.a))};h.getName=function(){return this.a.getName()};h.Ga=function(){this.a.Ga();Nf(this)};h.kc=function(){return this.a.kc()};h.ph=function(){};
  h.wd=function(a){return this.a.wd(a)};h.startObservingMediaSinks=function(a){this.a.startObservingMediaSinks(a)};h.stopObservingMediaSinks=function(a){this.a.stopObservingMediaSinks(a)};h.startObservingMediaRoutes=function(a){this.a.startObservingMediaRoutes(a)};h.stopObservingMediaRoutes=function(a){this.a.stopObservingMediaRoutes(a)};h.ed=function(a){this.a.ed(a)};h.Cd=function(a){return this.a.Cd(a)};
  var Vq=function(a,b,c,d,e){var f=Np(b),g=yq(a.m,c);if(!g)return Promise.reject(Error("Attempting custom launch with closed route"));var l=f.appName;if(!l)return Promise.reject(Error("No app name given"));var r=Im(b);return r?zp(new vp(g),l).then(function(y){var z=Oq(a.a,c,b,l,e,d);y={routeId:z.id,sinkId:g.getId(),appName:l,wg:y,launchParameter:f.launchParameter,session:null,clientId:null};a.f.set(z.id,y);var I=Uq(a,y.sinkId),H=new bm("receiver_action",{receiver:I,action:chrome.cast.qd.CAST});H.clientId=
  r;a.b.Mb(a,y.routeId,H);var H=chrome.cast.L,ia=String(a.h);a.h=(a.h+1)%9007199254740992;I=new H(ia,"",y.appName,[],I);y.session=I;y.clientId=r;I=new bm("new_session",I);I.clientId=r;a.b.Mb(a,y.routeId,I);return z}):Promise.reject(Error("No client ID"))};Sq.prototype.createRoute=function(a,b,c,d,e,f,g){return Wq.test(a)?ce(Vq(this,a,b,d,c)):this.a.createRoute(a,b,c,d,e,f,g)};
  Sq.prototype.terminateRoute=function(a){var b=this.f.get(a);if(b&&b.session&&b.clientId){var c={receiver:Uq(this,b.sinkId),action:chrome.cast.qd.STOP},c=new bm("receiver_action",c);c.clientId=b.clientId;this.b.Mb(this,b.routeId,c);this.b.onPresentationConnectionStateChanged(b.routeId,"terminated")}return this.a.terminateRoute(a)};
  Sq.prototype.sendRouteMessage=function(a,b,c){var d=JSON.parse(b);switch(d.type){case "client_connect":return b=d.clientId,(a=this.f.get(a))?(c=Uq(this,a.sinkId),c.receiverType=chrome.cast.ce.DIAL,c=new bm("custom_dial_launch",new chrome.cast.eg(c,a.wg.state,a.wg.extraData)),c.clientId=b,b=this.l,this.l=(this.l+1)%9007199254740992,c.sequenceNumber=b,this.g.add(c.sequenceNumber),this.b.Mb(this,a.routeId,c),a=Promise.resolve()):a=Promise.reject(Error("Unknown route")),a;case "custom_dial_launch":if(this.g.contains(d.sequenceNumber))return this.g.remove(d.sequenceNumber),
  b=d.message,(a=this.f.get(a))?b&&!b.doLaunch?a=Promise.resolve():(c=yq(this.m,a.sinkId))?(c=new vp(c),d=a.launchParameter,d=(b?b.launchParameter:null)||d,a=c.launchApp(a.appName,d)):a=Promise.reject(Error("Custom launch response for sink that no longer exists")):a=Promise.reject(Error("Unknown route")),a;break;case "v2_message":if("STOP"==d.message.type)return this.terminateRoute(a),Promise.resolve()}return this.a.sendRouteMessage(a,b,c)};
  Sq.prototype.sendRouteBinaryMessage=function(a){return Promise.reject(Error("Route "+a+" does not support sending binary data."))};var Uq=function(a,b){a=yq(a.m,b);b=new chrome.cast.Qe(b,a.ab.friendlyName);b.ipAddress=a.Ea();b.receiverType=chrome.cast.ce.DIAL;return b};h=Sq.prototype;h.Qc=function(a){return this.a.Qc(a)};h.gc=function(a){return this.a.gc(a)};h.rd=function(a,b){return this.a.rd(a,b)};h.Ic=function(a,b,c){return this.a.Ic(a,b,c)};
  h.connectRouteByRouteId=function(a,b,c,d,e){return this.a.connectRouteByRouteId(a,b,c,d,e)};h.joinRoute=function(a,b,c,d,e,f){return this.a.joinRoute(a,b,c,d,e,f)};h.detachRoute=function(a){this.f.remove(a);this.a.detachRoute(a)};h.Fb=function(){this.b.Fb()};h.onSinkAvailabilityUpdated=function(a,b){this.b.onSinkAvailabilityUpdated(a,b)};h.pc=function(a,b){this.b.pc(this,b)};h.Xc=function(a,b){this.b.Xc(this,b)};h.Wb=function(a,b){this.b.Wb(this,b)};h.Mb=function(a,b,c){this.b.Mb(this,b,c)};
  h.onPresentationConnectionStateChanged=function(a,b){this.b.onPresentationConnectionStateChanged(a,b)};h.onPresentationConnectionClosed=function(a,b,c){this.b.onPresentationConnectionClosed(a,b,c)};h.gf=function(a){return this.b.gf(a)};h.jf=function(){return this.b.jf()};h.mc=function(){return this.b.mc()};h.te=function(a,b,c){this.b.te(this,b,c)};h.tf=function(a){this.b.tf(a)};h.Dd=function(a){this.a.Dd(a)};h.lc=function(a){this.a.lc(a)};h.Wc=function(a){this.a.Wc(a)};h.qf=function(){};h.hh=function(){};
  h.searchSinks=function(a,b){return this.a.searchSinks(a,b)};h.provideSinks=function(a){this.a.provideSinks(a)};h.createMediaRouteController=function(){return Fa()};h.If=function(a){this.b.If(a)};h.nf=function(){return this.b.nf()};h.cd=function(a,b){return this.b.cd(a,b)};var Tq=function(a,b,c,d){this.b=a;this.sequenceNumber=b;this.f=c;this.a=d},Wq=/__dialAppName__/;var Xq=function(a){this.a=a;this.j=Ia("mr.ExternalMessageHandler")};
  Xq.prototype.onMessage=function(a,b,c){var d=this;u(this.j,"Received a message from "+b.id+" type: "+a.type);var e=chrome.runtime.id;"start"==a.type?(a=a.message,this.a.searchSinks("pseudo:cloud","urn:x-org.chromium.media:source:desktop",new ap(a.meetingName,a.domain)).then(function(a){var f="PresentationId"+b.id+Yq++;d.a.createRoute("urn:x-org.chromium.media:source:desktop",a,f).then(function(a){c(new yc(e,"route",a.id))}).catch(function(a){c(new yc(e,"error",a))})},function(){c(new yc(e,"error",
  Error("Failed to find sink.")))})):"stop"==a.type?this.a.terminateRoute(a.message.routeId).then(function(){c(new yc(e,"stopped"))}):(c(new yc(e,"error",Error("Unhandled message type"))),this.j.error("Unhandled message type "+a.type))};var Yq=0;var Zq=function(a){if(0>=a)throw Error("invalid buffer size");this.a=[];this.b=[];this.f=a},$q=function(a,b){if(a.da()>=a.f){if(a.jb())throw Error("Empty queue");0==a.a.length&&(a.a=a.b,a.a.reverse(),a.b=[]);a.a.pop()}a.b.push(b)};Zq.prototype.da=function(){return this.a.length+this.b.length};Zq.prototype.jb=function(){return 0==this.da()};Zq.prototype.P=function(){var a=this.a.slice();a.reverse();a.push.apply(a,[].concat(la(this.b)));return a};Zq.prototype.clear=function(){this.a=[];this.b=[]};var ar=function(){this.a=new Zq(1E3);this.b=Date.now()},cr=function(){null==br&&(br=new ar);return br};ar.prototype.init=function(){Ja=1;var a=Ia("browser"),b=window.onerror;window.onerror=function(c,e,f,g,l){b&&b(c,e,f,g,l);a.error("Error: "+c+" ("+e+" @ Line: "+f+")",l)};Ka.push(this.g.bind(this));var c=window.localStorage["debug.logs"];c&&(Ja=Pa(c.toUpperCase()));window.localStorage["debug.console"]&&Ka.push(this.f.bind(this))};
  ar.prototype.g=function(a){$q(this.a,dr(this,a,!1));a=a.Lb;a instanceof Error&&a.stack&&$q(this.a,a.stack)};ar.prototype.f=function(a){var b=[dr(this,a,!0)];a.Lb&&b.push(a.Lb);switch(a.level){case 3:console.error.apply(console,[].concat(la(b)));break;case 2:console.warn.apply(console,[].concat(la(b)));break;case 1:console.log.apply(console,[].concat(la(b)));break;default:console.debug.apply(console,[].concat(la(b)))}};
  var dr=function(a,b,c){var d=["["];if(c)d.push(("       "+((Date.now()-a.b)/1E3).toFixed(3)).slice(-7));else{a=new Date(b.time);var e=function(a){return 10>a?"0"+a:a};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("][",Oa[b.level],"][",b.F,"] ",b.message);if(!c&&null!=b.Lb)if(d.push("\n"),b.Lb instanceof Error)d.push(b.Lb.message);else try{d.push(JSON.stringify(b.Lb))}catch(f){d.push(b.Lb.toString())}d.push("\n");
  return d.join("")},er=function(){var a=cr();return 0==a.a.da()?"NA":a.a.P().join("")},fr=function(){var a=cr();Nf(a)};ar.prototype.fa=function(){return"LogManager"};ar.prototype.sa=function(){return[this.a.P()]};ar.prototype.wa=function(){var a=this.a.P();this.a.clear();for(var b=ja(Kf(this)||[]),c=b.next();!c.done;c=b.next())$q(this.a,c.value);a=ja(a);for(c=a.next();!c.done;c=a.next())$q(this.a,c.value)};var br=null;var gr=function(a){this.a=a;this.j=Ia("mr.InternalMessageHandler")};
  gr.prototype.onMessage=function(a,b,c){var d=this;if("retrieve_log_data"!=a.type)c(new yc(chrome.runtime.id,"error",Error("Unhandled message type")));else{var e={logs:er(),device:ik()};b=[];var f=Dc(e.device.ip).then(function(a){a.a&&(e.device.version=a.a)});b.push(f);var g=this.a.w;g&&(a=hr(this,g,a.source).then(function(a){a&&(e.castStreamingLogs=a)},function(){d.j.error("Log upload failed for service: "+g)}),b.push(a));b.push(ir(this,e,"mr.cast.SinkDiscoveryService","castDeviceCounts"));b.push(ir(this,
  e,"mr.dial.SinkDiscoveryService","dialDeviceCounts"));Lk(b).then(function(){c(e)})}};var ir=function(a,b,c,d){return Te(c).then(function(a){a=a.Og();b[d]=a.jc+"."+a.cc},function(){a.j.error("Failed to get device counts for "+d+".")})},hr=function(a,b,c){return jr(a.a,b).then(function(a){return a.rf(c)})};var kr=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];for(var d=a,c=ja(c),e=c.next();!e.done;e=c.next()){if(void 0==d||"object"!=typeof d)return;d=d[e.value]}return d};var lr=function(){Ck.call(this,5,"cloud.GcmEventListener","mr.cloud.discovery.CloudSinkDiscoveryService",chrome.gcm.onMessage);this.j=Ia("mr.CloudGcmEventListener")};ka(lr,Ck);lr.prototype.Je=function(a){a=kr(a,"data","notification");if(!a)return this.j.error("Notification json not found"),!1;try{var b=JSON.parse(a);return!!b&&Array.isArray(b.events)&&0<b.events.length}catch(c){return this.j.error("Invalid json: "+a),!1}};var or=function(){nr||(nr=new lr);return nr},nr=null;var tr=function(a,b){this.h=a;this.m=b;this.l=new Ra;this.a=this.l.a;this.g=pr(a.id);this.b=new Ra;this.f=!1;qr(this);rr(this);sr(this,new rf("GET_TURN_CREDENTIALS"))};tr.prototype.start=function(){var a=this;return this.a.then(function(b){if(b.b)return Promise.reject(Error("Presentation already started"));b.start();return a.b.a})};tr.prototype.stop=function(){var a=this;this.f=!1;return this.a.then(function(b){b.stop();a.a=Promise.reject(Error("Peer connection has already been stopped"))})};
  var qr=function(a){a.g.onMessage=function(b){if(b.type)switch(b.type){case "TURN_CREDENTIALS":a.l.resolve(new wf(a.h.id,b.data.credentials));break;case "ANSWER":a.a.then(function(a){Ef(a,b.data)});break;case "STOP":a.b.reject("Stop signal received");a.stop();break;default:throw Error("Unknown message type: "+b.type);}else a.a.then(function(a){var c={type:"PRESENTATION_CONNECTION_MESSAGE",data:b};"string"==typeof c?a.l.send(c):a.l.send(JSON.stringify(c))})}},rr=function(a){a.a.then(function(b){Af(b,
  function(b){sr(a,new rf("OFFER",new tf(b,null,null,a.m)))});Bf(b,function(b){b=sf(b);"STOP"==b.type&&a.stop();sr(a,b)});xf(b,function(){a.f=!0;sr(a,new rf("SESSION_START_SUCCESS"));a.b.resolve(a.h)});zf(b,function(){sr(a,new rf("SESSION_END"))});yf(b,function(b){a.f||a.b.reject(b);sr(a,new rf("SESSION_FAILURE"))})})},sr=function(a,b){a.g.sendMessage(b,ur)},ur={channelType:"cloud"};var vr={ACCEPTED:0,nn:1,TIMEOUT:2},wr={SUCCESS:0,Ai:1},xr={Oj:0,ij:1,mr:2,Zn:3,Yn:4,Vo:5,TIMEOUT:6,Up:7},yr={Wn:0,Jq:1},zr={Cp:0,Ho:1,USER:2,Rn:3},Ar=function(a){we("MediaRouter.Cloud.Knock.Result",a,vr)},Br=function(a){we("MediaRouter.Cloud.Session.Start",a,wr)},Cr=function(a){we("MediaRouter.Cloud.Session.Type",a,yr)},Dr=function(a){we("MediaRouter.Cloud.Device.UserRole",a,zr)};var Er=function(a,b,c,d,e,f){c=void 0===c?null:c;a||null==c&&(c="default");this.dh=a;this.Aa=b;this.pb=c;this.Vc=void 0===d?null:d;this.Ab=void 0===e?null:e;this.yc=void 0===f?null:f};Er.prototype.b=function(){var a="";this.Ab?a=this.Ab:this.Vc&&(a=this.Vc);return a};Er.prototype.yb=function(){return this.dh};Er.prototype.getId=function(){return this.Aa};Er.prototype.merge=function(a){!this.yc&&a.yc&&(this.yc=a.yc);!this.Ab&&a.Ab&&(this.Ab=a.Ab);this.Ab&&a.Ab&&this.yc&&(this.Ab=a.Ab)};var Fr=function(a,b){this.a=a;this.b=b},Gr=new Fr("https://www.googleapis.com/clouddevices/v1","AIzaSyAOZM8ZYeov685QMjXT3sC7XNizfrTEKjA"),Hr=new Fr("https://www.googleapis.com/calendar/v3",""),Ir=new Fr("https://www.googleapis.com/hangouts/v1",""),Jr=new Fr("https://networktraversal.googleapis.com/v1alpha","AIzaSyAOZM8ZYeov685QMjXT3sC7XNizfrTEKjA");var Kr=function(a,b){this.b=a;this.f=b;this.j=Ia("mr.cloud.calendar.CalendarService")},Or=function(a){return Lr(a,a.f.a).then(function(b){u(a.j,Mr(b.length)+" events discovered before filtering.");return Nr(a,b)},function(b){t(a.j,"Error getting Hangouts from calendar.",b);return[]})},Mr=function(a){return 20<a?"20+":a.toString()},Lr=function(a,b){var c=Date.now();return Pr(a,b,new Date(c),new Date(c+9E5)).then(function(b){return b.filter(a.a)})};
  Kr.prototype.a=function(a){return!(!a.start||!a.end||a.start.date||a.end.date||!a.start.dateTime||!a.end.dateTime)};
  var Pr=function(a,b,c,d){b=Qr(Hr.a,["calendars",b,"events"],{timeMin:c.toJSON(),timeMax:d.toJSON(),singleEvents:!0});v(a.j,"Retrieving Hangouts from Calendar: "+b);return Rr(a.b,b,"GET").then(function(a){return a.items?a.items:[]})},Nr=function(a,b){var c=[];b.filter(function(a){return a.hangoutLink}).forEach(function(b){var d=new jm(b.hangoutLink);if("meet.google.com"==d.pb)c.push(new Er(!0,d.a.substring(1),void 0,void 0,b.summary));else if(d=d.a.substring(12).split("/"),2==d.length){var f=ja(d),
  d=f.next().value,f=f.next().value;if(-1!=d.indexOf(".")){var g=f;var l=d}c.push(new Er(!1,f+"@"+d,l,g,b.summary,void 0))}else t(a.j,"Invalid hangout link from calendar event: "+b.hangoutLink)});u(a.j,Mr(c.length)+" events discovered with Hangout links.");return c};var Sr=function(a){this.email=a;this.imageUrl=null},Tr=function(a){this.type=a},Ur=function(a,b,c){this.type="__cloud_webrtc_session_message__";this.sessionDescription=a;this.user=null!=b?b:null;this.flungUrl=null!=c?c:null};ka(Ur,Tr);
  var Vr=function(a,b,c){this.name=a;this.parameters=b;this.minimalRole=null!=c?c:"user"},Wr={_settings:{type:"string"},_presentationRequest:{type:"string"},_optMediaConstraints:{type:"string"},_webrtcMessage:{type:"string"},_user:{type:"string"}},Xr=new Vr("_knockingStartWebrtcSession",Wr,"viewer"),Yr=new Vr("_startWebrtcSession",Wr),Zr=new Vr("_stopSession",{},"viewer");var $r=function(a){this.a=a;this.id=a.id;this.j=Ia("mr.cloud.devices.CloudDevice")};$r.prototype.isAvailable=function(){if(this.getState().appStatus){var a="online"==this.a.connectionStatus,b="available"==this.getState().appStatus,c=as(this,864E5);v(this.j,"Device id: "+this.id+", availability: GCM connected "+a+", app Available: "+b+", checked in: "+c);return a&&b&&c}a=as(this,9E5);u(this.j,"Availability for legacy receiver app: "+a);return a};
  var as=function(a,b){a=a.a.lastUpdateTimeMs?Number(a.a.lastUpdateTimeMs):null;return!!(a&&a>Date.now()-b)};$r.prototype.b=function(){return this.getState().settings.receiverName};$r.prototype.getId=function(){return this.id};$r.prototype.getState=function(){return this.a.state._cloudCast};var bs=function(a){this.h=a;this.b=this.f=this.a=null;this.l=this.g=!1;this.j=Ia("mr.cloud.devices.CloudDevicesService");Nf(this)};bs.prototype.getDevice=function(a){a=Qr(Gr.a,["devices",a]);return Rr(this.h,a,"GET").then(function(a){return new $r(a)})};
  var cs=function(a,b){var c=Qr(Gr.a,["devices"],b);return Rr(a.h,c,"GET").then(function(c){var d=(c.devices||[]).filter(function(a){return null!=a.commandDefs&&null!=a.commandDefs._cloudCast}).map(function(a){return new $r(a)});if(c=c.nextPageToken){var f=gc(b);f.token=c;return cs(a,f).then(function(a){return d.concat(a)})}return d})};bs.prototype.fa=function(){return"CloudDevicesService"};bs.prototype.sa=function(){return[new ds(this.a,this.b,this.f)]};
  bs.prototype.wa=function(){var a=Kf(this);a&&(this.a=a.yk,this.b=a.gcmRegistrationId,this.f=a.xk)};
  var es=function(a){return new Promise(function(b,c){a.g?c(Error("Registering...")):(a.g=!0,a.b&&a.f&&a.f+864E5>=Date.now()?(a.g=!1,b(a.b)):chrome.gcm.register(["919648714761"],function(d){a.g=!1;d?(v(a.j,"Got GCM ID: "+d),a.b=d,a.f=Date.now(),a.a=null,b(d)):(t(a.j,"Error: "+chrome.runtime.lastError.message),a.b=null,a.f=null,a.a=null,c(Error(chrome.runtime.lastError.message)))}))})},fs=function(a,b){if(a.l)Promise.resolve();else if(a.l=!0,b&&(!a.a||a.a+864E5<Date.now())){b={filters:["myDevices"],
  gcmRegistrationId:b,gcmSenderId:"919648714761",expirationTimeMs:864E5};var c=Qr(Gr.a,["subscriptions","subscribe"],{});Rr(a.h,c,"POST",b).then(function(){v(a.j,"Subscribed on: "+Date.now());a.a=Date.now();a.l=!1;return Promise.resolve()},function(b){a.l=!1;throw b;})}else Promise.resolve()},ds=function(a,b,c){this.yk=a;this.gcmRegistrationId=b;this.xk=c};var gs=function(a,b,c,d,e,f,g){var l=hk(gk(),a);this.xa=new Xj(l,b,f,g,e);this.deviceId=a;this.a=c;this.model=d},hs=function(a,b,c,d,e){gs.call(this,a,b,["cloud"],"Chrome Streaming Receiver",d);this.Te=c;this.isAvailable=e};ka(hs,gs);var is=function(a){var b=a.pb,c;a.Vc&&a.b()!=a.Vc&&(c=a.Vc);gs.call(this,a.getId(),a.b(),["mesi"],"Hangout",b,a.yb()?"meeting":"hangout",c);this.yb=a.yb();this.xc=a.yc||""};ka(is,gs);var js=function(a){this.a=a;this.j=Ia("mr.cloud.messaging.GcmMessageHandler")};js.prototype.onMessage=function(a){var b=this;a=JSON.parse(a.data.notification);var c=gk();a.events.forEach(function(a){if(a.deviceId){var d=hk(c,a.deviceId);switch(a.type){case "deviceCreated":ks(b,a);break;case "deviceUpdated":ls(b,a,d);break;case "deviceDeleted":ms(b.a,{sinkId:d});break;default:v(b.j,function(){return"[unhandled event] "+JSON.stringify(a)})}}else b.j.error("Device ID not provided")})};
  var ks=function(a,b){var c=kr(b,"statePatch","_cloudCast","settings","receiverName");"string"!=typeof c?a.j.error("Receiver name not a string: "+c):(b=new hs(b.deviceId,c,"owner","default",!0),a=a.a,a.a.a.set(b.xa.id,b),a.a.b=Date.now(),ns(a.f,[b.xa]))},ls=function(a,b,c){b=kr(b,"statePatch","_cloudCast","appStatus");if("string"!=typeof b)a.j.error("App status not a string: "+b);else if(a=a.a,b="available"==b,c=a.a.nc(c))c.isAvailable=b,a.a.b=Date.now(),os(a.f,[c.xa])};var ps=function(a,b,c){this.h=a;this.g=b;this.a=new Map;this.f=new Map;this.b=null;this.l=c};ps.prototype.Yc=function(){var a=this.b+this.l;if(null==this.b||a<Date.now())this.b=Date.now(),qs(this);return Array.from(this.a.values())};ps.prototype.nc=function(a){return this.a.get(a)||null};
  var qs=function(a){a.h().then(function(b){rs(a,b)})},rs=function(a,b){var c=new Map(a.a),d=new Map,e=new Map,f=[],g=[];b.forEach(function(a){var b=a.xa.id;d.set(b,a);e.set(b,a.deviceId);c.has(b)?c.has(b)&&JSON.stringify(c.get(b))!=JSON.stringify(a)&&g.push(a.xa):f.push(a.xa);c.delete(b)});b=[].concat(la(c.values())).map(function(a){return a.xa});a.f.clear();a.f=e;a.a.clear();a.a=d;ss(a,f,g,b)},ss=function(a,b,c,d){0<b.length&&ns(a.g,b);0<c.length&&os(a.g,c);0<d.length&&ts(a.g,d)},vs=function(a){for(var b=
  {},c=ja(a.a.entries()),d=c.next();!d.done;d=c.next()){var e=ja(d.value),d=e.next().value,e=e.next().value;b[d]=e}c={};d=ja(a.f.entries());for(e=d.next();!e.done;e=d.next()){var f=ja(e.value),e=f.next().value,f=f.next().value;c[e]=f}return new us(b,c,a.b)},ws=function(a,b){for(var c in b.sinks){var d=b.sinks[c],e=null;"Hangout"==d.model?e=new is(new Er(d.yb,d.deviceId,d.xa.domain,d.xa.description,d.xa.friendlyName,d.xc)):"Chrome Streaming Receiver"==d.model&&(e=new hs(d.deviceId,d.xa.friendlyName,
  d.Te,d.xa.domain,d.isAvailable));a.a.set(c,e)}for(c in b.a)a.f.set(c,b.a[c]);b.b&&(a.b=b.b)},us=function(a,b,c){this.sinks=a;this.a=b;this.b=c};var xs=function(a,b){this.b=a;this.f=b;this.a=new ps(this.Bk.bind(this),b,2E4);this.g=new js(this);or().addListener();Nf(this);Ze("mr.cloud.discovery.CloudSinkDiscoveryService",this)};ka(xs,Pe);h=xs.prototype;h.Yc=function(){var a=this;es(this.b).then(function(b){fs(a.b,b)},function(){});return this.a.Yc().filter(function(a){return a.isAvailable})};h.nc=function(a){return this.a.nc(a)};
  h.handleEvent=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(a==chrome.gcm.onMessage)this.g.onMessage.apply(this.g,[].concat(la(c)));else throw Error("Unhandled event: expected chrome.gcm.onMessage");};
  h.Bk=function(){return cs(this.b,{descriptionSubstring:"Chrome Streaming Receiver"}).then(function(a){return a.map(function(a){ve("MediaRouter.Cloud.CloudReceiver.Sink.Discovered");var b=a.isAvailable()&&!(a.a.invitations&&0!=a.a.invitations.length);return new hs(a.getId(),a.b(),a.a.personalizedInfo.maxRole,"default",b)})})};h.fa=function(){return"CloudSinkDiscoveryService"};h.sa=function(){return[{cache:vs(this.a)}]};h.wa=function(){var a=Kf(this);a&&ws(this.a,a.cache)};
  var ms=function(a,b){if(b=a.a.nc(b.sinkId))a.a.a.delete(b.xa.id),a.a.b=Date.now(),ts(a.f,[b.xa])};var As=function(a,b,c){if(!ys){ph();var d=oh;d.b=kh;var e=zs;d.a||(d.a=[]);d.a.push(e);ys=!0}this.f=a;this.g=b;this.a=new ps(this.l.bind(this),c,2E4);this.b=new Map;Nf(this)},zs=function(a){La({F:a.f,level:Qa(a.b.value),time:a.l,message:a.getMessage(),Lb:a.a})};As.prototype.Yc=function(){return this.a.Yc()};As.prototype.nc=function(a){return this.a.nc(a)};
  As.prototype.l=function(){var a=this;u(this.j,"Fetching hangouts");return Lk([Bs(this.g),Or(this.f)]).then(function(b){var c=Array.from(a.b.values());b.forEach(function(b){b.fc?c=c.concat(b.value):a.j.error("Error discovering Hangouts",b.reason)});var d=c.reduce(function(a,b){var c=a[b.getId()];c?c.merge(b):c=b;a[c.getId()]=c;return a},{});return Object.keys(d).map(function(a){a=d[a];ve("MediaRouter.Cloud.Hangout.Sink.Discovered");return new is(a)})})};
  var Ds=function(a,b){return Te("mr.mirror.hangouts.MeetingsService").then(function(a){return a.qb(b)}).then(function(b){return Cs(a,b)},function(){return b.input.match(/^#/)?Promise.reject(Error("Failed to resolve meeting alias.")):Cs(a,b.input,b.domain)})},Cs=function(a,b,c){c=c||void 0;var d=!c;b=new Er(d,d?b:b+"@"+c,c,b,void 0,void 0);a.b.set(b.getId(),b);b=new is(b);a.a.a.set(b.xa.id,b);return b.xa};As.prototype.fa=function(){return"HangoutSinkDiscoveryService"};
  As.prototype.sa=function(){for(var a={},b=ja(this.b.entries()),c=b.next();!c.done;c=b.next()){var d=ja(c.value),c=d.next().value,d=d.next().value;a[c]=d}return[{cache:vs(this.a),manualHangouts:a}]};As.prototype.wa=function(){var a=Kf(this);if(a){ws(this.a,a.cache);for(var b in a.manualHangouts){var c=a.manualHangouts[b];this.b.set(b,new Er(c.dh,c.Aa,c.pb,c.Vc,c.Ab,c.yc))}}};As.prototype.j=Ia("mr.cloud.discovery.HangoutSinkDiscoveryService");var ys=!1;var Es=!Bg&&!zg||zg&&9<=Number(Ug)||Bg&&Tg("1.9.1");zg&&Tg("9");var Fs=function(a,b){this.width=a;this.height=b};h=Fs.prototype;h.clone=function(){return new Fs(this.width,this.height)};h.toString=function(){return"("+this.width+" x "+this.height+")"};h.Yj=function(){return this.width*this.height};h.jb=function(){return!this.Yj()};h.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};h.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};
  h.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};var Gs={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"},Hs=function(a){a=a.document;a="CSS1Compat"==a.compatMode?a.documentElement:a.body;return new Fs(a.clientWidth,a.clientHeight)},Is=function(a){return a?a.parentWindow||a.defaultView:window},Js=function(a,b){if("textContent"in a)a.textContent=b;else if(3==a.nodeType)a.data=
  b;else if(a.firstChild&&3==a.firstChild.nodeType){for(;a.lastChild!=a.firstChild;)a.removeChild(a.lastChild);a.firstChild.data=b}else{for(var c;c=a.firstChild;)a.removeChild(c);a.appendChild((9==a.nodeType?a:a.ownerDocument||a.document).createTextNode(String(b)))}},Ks=function(a){this.a=a||na.document||document};
  Ks.prototype.setProperties=function(a,b){Xb(b,function(b,d){b&&b.ic&&(b=b.Sc());"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:Gs.hasOwnProperty(d)?a.setAttribute(Gs[d],b):0==d.lastIndexOf("aria-",0)||0==d.lastIndexOf("data-",0)?a.setAttribute(d,b):a[d]=b})};Ks.prototype.getChildren=function(a){return Es&&void 0!=a.children?a.children:tb(a.childNodes,function(a){return 1==a.nodeType})};Ks.prototype.isElement=function(a){return xa(a)&&1==a.nodeType};
  Ks.prototype.contains=function(a,b){if(!a||!b)return!1;if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||!!(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a};var Ls=function(a,b,c,d,e,f,g,l){this.a=null;this.s=!1;this.w=ec();this.b=[];this.m=a?encodeURIComponent(String(a)):null;this.v=null;!d&&b&&(this.v=b);this.K=c||null;this.f=!d;this.g=null!=e?e:null;this.h=f||null;this.G=!!g;this.A=l||null};q(Ls,rh);var Ms;var Ns=Ic("https://apis.google.com/js/client.js");Ns instanceof Fc&&Ns.constructor===Fc&&Ns.b===Ec?Ms=Ns.a:(pb("expected object of type Const, got '"+Ns+"'"),Ms="type_error:Const");var Os=new Vc;Os.a=Ms;
  Ls.prototype.init=function(){var a=n(function(a){this.a=a;var b=pa("client.request",a),c=pa("auth",a);b&&c?this.B():a.load("client",n(this.B,this))},this),b=Ps("gapi");b?a(b.gapi):Qs(this,a);return this.w.a};
  var Ps=function(a){for(var b=window,c=pa(a,b);!c&&b!=window.top&&Rs(b.parent,a);)b=b.parent,c=pa(a,b);return c?b:null},Rs=function(a,b){try{return!!a&&null!=a.location.href&&ug(a,b)}catch(c){return!1}},Qs=function(a,b){var c=Ps("gapi_onload");if(c){var d=c.gapi_onload;c.gapi_onload=function(){d();b(c.gapi)}}else{window.gapi_onload=function(){b(window.gapi)};var e=document.createElement("script");e.src=Wc(Os);a.A&&Js(e,gi(a.A));document.getElementsByTagName("head")[0].appendChild(e)}};
  Ls.prototype.B=function(){for(var a=0;a<this.b.length;a++)this.b[a].qa.resolve(Ss(this,this.b[a].requestData));this.s=!0;this.w.resolve(this.a)};Ls.prototype.sendRequest=function(a){if(this.s)return Ss(this,a);var b=ec();this.b.push({requestData:a,qa:b});return b.a};
  var Ss=function(a,b){var c,d=pa("config.get",a.a);if(!a.f){var e=d("googleapis.config/auth/useFirstPartyAuth");var f=d("googleapis.config/auth/useOriginToken")}null!=a.g&&(c=d("client/cors"));try{var g=pa("config.update",a.a);a.f||(g("googleapis.config/auth/useFirstPartyAuth",!1),g("googleapis.config/auth/useOriginToken",!1));null!=a.g&&g("client/cors",a.g);var l=pa("client.request",a.a),r=Ts(a);b.headers&&kc(r,b.headers);var y={headers:r,root:a.K,path:b.path,method:b.method,body:b.body},z=b.params||
  {};a.m&&!a.h?kc(z,{key:a.m}):a.h&&kc(z,{key:null});dc(z)||(y.params=z);var I=Li(l(y));b.callback&&I.then(function(a){b.callback.apply(null,[a.result,a])},function(a){b.callback.apply(null,[a.result,a])});return I}finally{g=pa("config.update",a.a),a.f||(g("googleapis.config/auth/useFirstPartyAuth",e),g("googleapis.config/auth/useOriginToken",f)),null!=a.g&&g("client/cors",c)}},Ts=function(a){if(a.f){if(a.h)return{Authorization:"Bearer "+a.h};var b=pa("auth.getAuthHeaderValueForFirstParty",a.a);return{Authorization:a.G?
  b([]):b(),"X-Goog-AuthUser":a.v}}return{}};var Us=function(a){this.a=a},Qr=function(a,b,c){var d="";b.forEach(function(a){d+="/"+encodeURIComponent(a)});a=new jm(a+d);c&&(c=Cm(c),om(a,c));return a},Rr=function(a,b,c,d){return a.a.getAuthToken().then(function(e){var f=Vs(e);return Ws(f,b,c,d).catch(function(f){if("INVALID_ACCESS_ERROR"==f)return Xs(a,e,b,c,d);throw f;})})},Xs=function(a,b,c,d,e){return Ys(b).then(function(){return Rr(a,c,d,e)})},Ws=function(a,b,c,d){return new Promise(function(e,f){var g=Zs(b,c,function(a){a&&!a.error?e(a):
  a&&401==a.error.code?f("INVALID_ACCESS_ERROR"):f(a&&a.error?a.error.errors?a.error.errors[0]:a:Error(a))},d);a.sendRequest(g)})},Vs=function(a){a=new Ls(void 0,void 0,void 0,!1,!1,a);a.init();return a},Zs=function(a,b,c,d){a={callback:c,method:b,path:a.toString()};d&&(a.body=d);return a};var bt=function(){this.b=!1;this.a=null;this.f=!1;this.j=Ia("mr.cloud.identity.IdentityService");Nf(this);$s(this);at(this)},ct=function(a){return a.a?a.a.substr(a.a.indexOf("@")+1):""};bt.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 Ys=function(a){return new Promise(function(b){chrome.identity.removeCachedAuthToken({token:a},function(){b()})})},at=function(a){a.getAuthToken().then(function(b){chrome.identity.getProfileUserInfo(function(c){a.b=!!c.email||!!c.id;a.a=c.email||null;b&&!a.b&&(a.f=!0)})},function(b){v(a.j,"Unable to set sign in and email.",b)})},$s=function(a){chrome.identity.onSignInChanged.addListener(function(b,c){Ie(6);a.b=c;u(a.j,"Signed in change: "+a.b);a.b?at(a):(a.a=null,a.f=!1)})},dt=function(a){return a.getAuthToken().then(function(b){var c=
  window.gapi;if(!c)return a.j.error("gapi not loaded."),!1;u(a.j,"Setting gapi auth token");c.auth.setToken({access_token:b});return!0})};bt.prototype.fa=function(){return"IdentityService"};bt.prototype.sa=function(){return[null,{signedIn:this.b,userEmail:this.a,kioskAuth:this.f}]};bt.prototype.wa=function(){var a=Lf(this);a&&(a.signedIn&&(this.b=a.signedIn),a.userEmail&&(this.a=a.userEmail),a.kioskAuth&&(this.f=a.kioskAuth))};var et="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 ft={Zf:{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"}},mi:{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"}}},gt=ft,gt=ft;var ht={AED:[2,"dh","\u062f.\u0625.","DH"],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,"TL","YTL"],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 it={cg:".",Ke:",",ig:"%",Se:"0",Vi:"+",Li:"-",fg:"E",jg:"\u2030",Ne:"\u221e",Qi:"NaN",bg:"#,##0.###",nj:"#E0",Ui:"#,##0%",ni:"\u00a4#,##0.00",si:"USD"},jt=it,jt=it;var mt=function(a,b,c){this.v=b||jt.si;this.O=c||0;this.B=40;this.b=1;this.T=0;this.g=3;this.K=this.f=0;this.I=!1;this.A=this.u="";this.l="-";this.w="";this.a=1;this.m=!1;this.h=[];this.G=this.H=!1;this.s=0;if("number"==typeof a)switch(a){case 1:kt(this,jt.bg);break;case 2:kt(this,jt.nj);break;case 3:kt(this,jt.Ui);break;case 4:a=jt.ni;b=["0"];c=ht[this.v][0]&7;if(0<c){b.push(".");for(var d=0;d<c;d++)b.push("0")}a=a.replace(/0.00/g,b.join(""));kt(this,a);break;case 5:lt(this,1);break;case 6:lt(this,
  2);break;default:throw Error("Unsupported pattern type.");}else kt(this,a)},kt=function(a,b){b.replace(/ /g,"\u00a0");var c=[0];a.u=nt(a,b,c);for(var d=c[0],e=-1,f=0,g=0,l=0,r=-1,y=b.length,z=!0;c[0]<y&&z;c[0]++)switch(b.charAt(c[0])){case "#":0<g?l++:f++;0<=r&&0>e&&r++;break;case "0":if(0<l)throw Error('Unexpected "0" in pattern "'+b+'"');g++;0<=r&&0>e&&r++;break;case ",":0<r&&a.h.push(r);r=0;break;case ".":if(0<=e)throw Error('Multiple decimal separators in pattern "'+b+'"');e=f+g+l;break;case "E":if(a.G)throw Error('Multiple exponential symbols in pattern "'+
  b+'"');a.G=!0;a.K=0;c[0]+1<y&&"+"==b.charAt(c[0]+1)&&(c[0]++,a.I=!0);for(;c[0]+1<y&&"0"==b.charAt(c[0]+1);)c[0]++,a.K++;if(1>f+g||1>a.K)throw Error('Malformed exponential pattern "'+b+'"');z=!1;break;default:c[0]--,z=!1}0==g&&0<f&&0<=e&&(g=e,0==g&&g++,l=f-g,f=g-1,g=1);if(0>e&&0<l||0<=e&&(e<f||e>f+g)||0==r)throw Error('Malformed pattern "'+b+'"');l=f+g+l;a.g=0<=e?l-e:0;0<=e&&(a.f=f+g-e,0>a.f&&(a.f=0));a.b=(0<=e?e:l)-f;a.G&&(a.B=f+a.b,0==a.g&&0==a.b&&(a.b=1));a.h.push(Math.max(0,r));a.H=0==e||e==l;
  d=c[0]-d;a.A=nt(a,b,c);c[0]<b.length&&";"==b.charAt(c[0])?(c[0]++,1!=a.a&&(a.m=!0),a.l=nt(a,b,c),c[0]+=d,a.w=nt(a,b,c)):(a.l+=a.u,a.w+=a.A)},lt=function(a,b){a.s=b;kt(a,jt.bg);a.f=0;a.g=2;if(0<a.f)throw Error("Can't combine significant digits and minimum fraction digits");a.T=2};
  mt.prototype.parse=function(a,b){b=b||[0];if(0!=this.s)throw Error("Parsing of compact numbers is unimplemented");a=a.replace(/ /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(jt.Ne,b[0])==b[0]){b[0]+=jt.Ne.length;var e=Infinity}else{e=a;var f=!1,g=!1,l=!1,r=-1,y=1,z=jt.cg,I=jt.Ke,H=jt.fg;if(0!=this.s)throw Error("Parsing of compact style numbers is not implemented");
  for(var ia="";b[0]<e.length;b[0]++){var fb=e.charAt(b[0]),Y=ot(fb);if(0<=Y&&9>=Y)ia+=Y,l=!0;else if(fb==z.charAt(0)){if(f||g)break;ia+=".";f=!0}else if(fb==I.charAt(0)&&("\u00a0"!=I.charAt(0)||b[0]+1<e.length&&0<=ot(e.charAt(b[0]+1)))){if(f||g)break}else if(fb==H.charAt(0)){if(g)break;ia+="E";g=!0;r=b[0]}else if("+"==fb||"-"==fb){if(l&&r!=b[0]-1)break;ia+=fb}else if(1==this.a&&fb==jt.ig.charAt(0)){if(1!=y)break;y=100;if(l){b[0]++;break}}else if(1==this.a&&fb==jt.jg.charAt(0)){if(1!=y)break;y=1E3;
  if(l){b[0]++;break}}else break}1!=this.a&&(y=this.a);e=parseFloat(ia)/y}if(c){if(a.indexOf(this.A,b[0])!=b[0])return NaN;b[0]+=this.A.length}else if(d){if(a.indexOf(this.w,b[0])!=b[0])return NaN;b[0]+=this.w.length}return d?-e:e};
  mt.prototype.format=function(a){if(isNaN(a))return jt.Qi;var b=[];var c=a;if(0==this.s)c=pt;else{c=Math.abs(c);var d=qt(this,1>=c?0:rt(c)).df;c=qt(this,d+rt(st(this,c/Math.pow(10,d)).bh))}a/=Math.pow(10,c.df);b.push(c.prefix);d=0>a||0==a&&0>1/a;b.push(d?this.l:this.u);if(isFinite(a))if(a=a*(d?-1:1)*this.a,this.G){var e=a;if(0==e)tt(this,e,this.b,b),ut(this,0,b);else{a=Math.floor(Math.log(e)/Math.log(10)+2E-15);var f=Math.pow(10,a);isFinite(f)&&0!==f?e/=f:(f=Math.pow(10,Math.floor(a/2)),e=e/f/f,1==
  a%2&&(e=0<a?e/10:10*e));f=this.b;if(1<this.B&&this.B>this.b){for(;0!=a%this.B;)e*=10,a--;f=1}else 1>this.b?(a++,e/=10):(a-=this.b-1,e*=Math.pow(10,this.b-1));tt(this,e,f,b);ut(this,a,b)}}else tt(this,a,this.b,b);else b.push(jt.Ne);b.push(d?this.w:this.A);b.push(c.Yh);return b.join("")};
  var st=function(a,b){var c=Math.pow(10,a.g);a=0>=a.T?Math.round(b*c):Math.round(vt(b*c,a.T,a.g));isFinite(a)?(b=Math.floor(a/c),c=Math.floor(a-b*c)):c=0;return{bh:b,jk:c}},tt=function(a,b,c,d){if(a.f>a.g)throw Error("Min value must be less than max value");d||(d=[]);b=st(a,b);var e=b.bh,f=b.jk,g=0<a.f||0<f||!1;b=a.f;g&&(b=a.f);for(var l="",r=e;1E20<r;)l="0"+l,r=Math.round(r/10);var l=r+l,y=jt.cg,r=jt.Se.charCodeAt(0),z=l.length,I=0;if(0<e||0<c){for(e=z;e<c;e++)d.push(String.fromCharCode(r));if(2<=
  a.h.length)for(c=1;c<a.h.length;c++)I+=a.h[c];c=z-I;if(0<c)for(var e=a.h,I=z=0,H,ia=jt.Ke,fb=l.length,Y=0;Y<fb;Y++){if(d.push(String.fromCharCode(r+1*Number(l.charAt(Y)))),1<fb-Y)if(H=e[I],Y<c){var cb=c-Y;(1===H||0<H&&1===cb%H)&&d.push(ia)}else I<e.length&&(Y===c?I+=1:H===Y-c-z+1&&(d.push(ia),z+=H,I+=1))}else{c=l;l=a.h;e=jt.Ke;H=c.length;ia=[];for(z=l.length-1;0<=z&&0<H;z--){I=l[z];for(fb=0;fb<I&&0<=H-fb-1;fb++)ia.push(String.fromCharCode(r+1*Number(c.charAt(H-fb-1))));H-=I;0<H&&ia.push(e)}d.push.apply(d,
  ia.reverse())}}else g||d.push(String.fromCharCode(r));(a.H||g)&&d.push(y);f=String(f);g=f.split("e+");2==g.length&&(f=String(vt(parseFloat(g[0]),a.T,1)),f=f.replace(".",""),f+=db("0",parseInt(g[1],10)-f.length+1));a.g+1>f.length&&(f="1"+db("0",a.g-f.length)+f);for(a=f.length;"0"==f.charAt(a-1)&&a>b+1;)a--;for(e=1;e<a;e++)d.push(String.fromCharCode(r+1*Number(f.charAt(e))))},ut=function(a,b,c){c.push(jt.fg);0>b?(b=-b,c.push(jt.Li)):a.I&&c.push(jt.Vi);b=""+b;for(var d=jt.Se,e=b.length;e<a.K;e++)c.push(d);
  c.push(b)},ot=function(a){a=a.charCodeAt(0);if(48<=a&&58>a)return a-48;var b=jt.Se.charCodeAt(0);return b<=a&&a<b+10?a-b:-1},nt=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":if(c[0]+1<f&&"\u00a4"==b.charAt(c[0]+1))c[0]++,d+=a.v;else switch(a.O){case 0:d+=ht[a.v][1];break;case 2:var g=a.v,l=ht[g],d=d+(g==
  l[1]?g:g+" "+l[1]);break;case 1:d+=ht[a.v][2]}break;case "%":if(!a.m&&1!=a.a)throw Error("Too many percent/permill");if(a.m&&100!=a.a)throw Error("Inconsistent use of percent/permill characters");a.a=100;a.m=!1;d+=jt.ig;break;case "\u2030":if(!a.m&&1!=a.a)throw Error("Too many percent/permill");if(a.m&&1E3!=a.a)throw Error("Inconsistent use of percent/permill characters");a.a=1E3;a.m=!1;d+=jt.jg;break;default:d+=g}}return d},pt={prefix:"",Yh:"",df:0},qt=function(a,b){a=1==a.s?gt.Zf:gt.mi;null==a&&
  (a=gt.Zf);if(3>b)return pt;b=Math.min(14,b);var c=a[Math.pow(10,b)];for(--b;!c&&3<=b;)c=a[Math.pow(10,b)],b--;if(!c)return pt;a=c.other;return a&&"0"!=a?(a=/([^0]*)(0+)(.*)/.exec(a))?{prefix:a[1],Yh:a[3],df:b+1-(a[2].length-1)}:pt:pt},rt=function(a){if(!isFinite(a))return 0<a?a:0;for(var b=0;1<=(a/=10);)b++;return b},vt=function(a,b,c){if(!a)return a;b=b-rt(a)-1;if(b<-c)return c=Math.pow(10,c),Math.round(a/c)*c;c=Math.pow(10,b);return Math.round(a*c)/c};var wt=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"},xt=wt,xt=wt;var yt=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"},zt=yt,zt=yt;var Dt=function(a){this.g=a;this.b=this.a=this.l=null;a=jt;var b=gt;if(At!==a||Bt!==b)At=a,Bt=b,Ct=new mt(1);this.h=Ct},At=null,Bt=null,Ct=null,Et=/'([{}#].*?)'/g,Ft=/''/g;Dt.prototype.format=function(a){if(this.g){this.l=[];var b=Gt(this,this.g);this.b=Ht(this,b);this.g=null}if(this.b&&0!=this.b.length)for(this.a=x(this.l),b=[],It(this,this.b,a,!1,b),a=b.join("");0<this.a.length;)a=a.replace(this.f(this.a),this.a.pop());else a="";return a};
  var It=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,l=a,r=e,y=c[g];k(y)?(l.a.push(y),r.push(l.f(l.a))):r.push("Undefined parameter - "+g);break;case 2:g=b[f].value;l=e;r=g.de;k(c[r])?(r=g[c[r]],k(r)||(r=g.other),It(a,r,c,d,l)):l.push("Undefined parameter - "+r);break;case 0:g=b[f].value;Jt(a,g,c,zt,d,e);break;case 1:g=b[f].value;Jt(a,g,c,xt,d,e);break;default:pb("Unrecognized block type: "+b[f].type)}},Jt=function(a,b,c,d,
  e,f){var g=b.de,l=b.yg,r=+c[g];isNaN(r)?f.push("Undefined or invalid parameter - "+g):(l=r-l,g=b[c[g]],k(g)||(d=a.h.U?d(l,a.h.U()):d(l),g=b[d],k(g)||(g=b.other)),b=[],It(a,g,c,e,b),c=b.join(""),e?f.push(c):(a=a.h.format(l),f.push(c.replace(/#/g,a))))},Gt=function(a,b){var c=a.l,d=n(a.f,a);b=b.replace(Ft,function(){c.push("'");return d(c)});return b=b.replace(Et,function(a,b){c.push(b);return d(c)})},Kt=function(a){var b=0;var 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},Lt=/^\s*(\w+)\s*,\s*plural\s*,(?:\s*offset:(\d+))?/,Mt=/^\s*(\w+)\s*,\s*selectordinal\s*,/,Nt=/^\s*(\w+)\s*,\s*select\s*,/,Ht=function(a,b){var c=[];b=Kt(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(Lt.test(f)?0:Mt.test(f)?1:Nt.test(f)?2:/^\s*\w+\s*/.test(f)?3:5){case 2:e.type=2;e.value=Ot(a,b[d].value);break;case 0:e.type=0;e.value=Pt(a,b[d].value);break;case 1:e.type=1;e.value=Qt(a,b[d].value);break;case 3:e.type=3;e.value=b[d].value;break;default:pb("Unknown block type for pattern: "+b[d].value)}}else pb("Unknown part of the pattern.");c.push(e)}return c},Ot=function(a,b){var c,d="";b=b.replace(Nt,function(a,b){d=b;return""});var e={};e.de=d;b=Kt(b);for(var f=0;f<b.length;){var g=b[f].value;
  f++;1==b[f].type?c=Ht(a,b[f].value):pb("Expected block type.");e[g.replace(/\s/g,"")]=c;f++}return e},Pt=function(a,b){var c,d="",e=0;b=b.replace(Lt,function(a,b,c){d=b;c&&(e=parseInt(c,10));return""});var f={};f.de=d;f.yg=e;b=Kt(b);for(var g=0;g<b.length;){var l=b[g].value;g++;1==b[g].type?c=Ht(a,b[g].value):pb("Expected block type.");f[l.replace(/\s*(?:=)?(\w+)\s*/,"$1")]=c;g++}return f},Qt=function(a,b){var c,d="";b=b.replace(Mt,function(a,b){d=b;return""});var e={};e.de=d;e.yg=0;b=Kt(b);for(var f=
  0;f<b.length;){var g=b[f].value;f++;1==b[f].type?c=Ht(a,b[f].value):pb("Expected block type.");e[g.replace(/\s*(?:=)?(\w+)\s*/,"$1")]=c;f++}return e};Dt.prototype.f=function(a){return"\ufddf_"+(a.length-1).toString(10)+"_"};var Rt=chrome.i18n.getMessage("1522140683318860351"),St=chrome.i18n.getMessage("4246483347873264186"),Tt=chrome.i18n.getMessage("5991427458288444010"),Wd=chrome.i18n.getMessage("6063910461797960050"),Ut=chrome.i18n.getMessage("7735695102441495789"),Vt=chrome.i18n.getMessage("4575332923598659024"),Wt=chrome.i18n.getMessage("2297080986956220930"),Xt=new Dt(Wt);var Yt=function(a){this.a=a;this.j=Ia("mr.cloud.mesi.MesiService")},Bs=function(a){var b=Ir.a;.1>Math.random()&&(b=b.replace("v1","v1_preprod"));b=Qr(b,["hangouts","search"]);u(a.j,"Retrieving Hangouts from MESI: "+b);return Rr(a.a,b,"POST",Zt).then(function(a){var b=[];a.result&&(b=a.result.map(function(a){var b=a.hangout,c=b.meeting_room_name,d;b.meeting_domain?d=b.meeting_domain:"BUSINESS"==b.type&&b.company_title&&(d=b.company_title.toLowerCase());var e=Xt.format({ORGANIZER:"",PARTICIPANTS:0});
  if((a=a.participant)&&0<a.length)var y=a[0].display_name,e=a.reduce(function(a,b){a.add(b.user_id);"ORGANIZER"==b.role&&(y=b.display_name);return a},new Set),e=Xt.format({ORGANIZER:y,PARTICIPANTS:e.size});return c&&d?new Er(!1,c+"@"+d,d,c,e,b.hangout_id):new Er(!1,b.hangout_id,d,c,e,b.hangout_id)}));return b})},Zt={request_header:{client_version:{client_id:"39"}},search_sources:["0"]};var $t=function(a,b,c){this.state=a;this.type=null!=b?b:null;this.a=null!=c?c:null},au=function(a){this.a=a},du=function(a,b,c,d){return bu(a,Xr,b,c,d,35E3).then(function(b){return cu(a,b)})},fu=function(a,b,c,d){return bu(a,Yr,b,c,d,23E3).then(function(a){var b=a.state;return"done"==b?(a=eu(a),new $t(b,a.type,new Ur(a.sessionDescription))):new $t(b)})},bu=function(a,b,c,d,e,f){var g={_webrtcMessage:JSON.stringify(d.presentationUrl?new Ur(d.description,null,d.presentationUrl):new Ur(d.description))};
  d.settings&&(g._settings=of(d.settings));d.mediaConstraints&&(g._optMediaConstraints=JSON.stringify(d.mediaConstraints));e&&(g._user=JSON.stringify(e));return gu(a,c,b,g,f)},cu=function(a,b){var c=b.state;switch(c){case "done":return Promise.resolve(hu(b));case "queued":case "inProgress":return iu(a,b).then(function(b){return cu(a,b)});default:return Promise.resolve(new $t(c))}},iu=function(a,b){return new Promise(function(c){var d=setInterval(function(){ju(a,b.id).then(function(a){"queued"!=a.state&&
  "inProgress"!=a.state&&(clearInterval(d),c(a))})},2E3)})},hu=function(a){a=eu(a);return"__cloud_webrtc_session_message__"==a.type?new $t("done","knocking_cloud_webrtc_session_message",new Ur(a.sessionDescription)):new $t("done",a.type)},gu=function(a,b,c,d,e){b={deviceId:b,name:"_cloudCast."+c.name,parameters:d,expirationTimeoutMs:e||1E4};c={};e&&(c.responseAwaitMs=Math.min(e+5E3,25E3));e=Qr(Gr.a,["commands"],c);return Rr(a.a,e,"POST",b)},eu=function(a){return a.results&&a.results.results?JSON.parse(a.results.results):
  null},ju=function(a,b){b=Qr(Gr.a,["commands",b]);return Rr(a.a,b,"GET")};au.$inject=["gapiService"];var ku=function(a,b,c,d){this.b=a;this.f=b;this.g=c;this.a=d},ou=function(a,b,c,d){return lu(a,b,d).then(function(b){a:{var d=c.id;if("done"!=b.state)d=Promise.reject(Error("Offer not executed by receiver. State: "+b.state));else{switch(b.type){case "__cloud_webrtc_session_message__":b=new rf("ANSWER",b.a.sessionDescription);mu(a.a,b,d);break;case "knocking_cloud_webrtc_session_message":Ar(0);b=new rf("KNOCK_ANSWER",b.a.sessionDescription);mu(a.a,b,d);break;case "knock_denied":Ar(1);nu(a,St,d);break;
  case "knock_timeout":Ar(2);nu(a,Tt,d);break;default:d=Promise.reject(Error("Invalid message type: "+b.type));break a}d=Promise.resolve()}}return d})},qu=function(a,b){return pu(a.g).then(function(c){mu(a.a,new rf("TURN_CREDENTIALS",{credentials:c}),b.id)})},lu=function(a,b,c){var d=c.deviceId,e=a.f.a,e=e?new Sr(e):void 0;b=b.data;switch(c.Te){case "owner":Dr(0);break;case "manager":Dr(1);break;case "user":Dr(2);break;case "viewer":Dr(3)}return"viewer"==c.Te?du(a.b,d,b,e):fu(a.b,d,b,e)},nu=function(a,
  b,c){b=new Vd(b,"warning");b.isBlocking=!0;a.a.a.mc().send(b);mu(a.a,new rf("STOP"),c)};var ru=function(a,b){this.b=a;this.a=b},tu=function(a,b,c,d){switch(b.type){case "REFRESH_AUTH":var e=d.yb,f=d.deviceId,g=d.xc;return dt(a.b).then(function(){mu(a.a,new rf("AUTH_READY",{yb:e,Ua:f,xc:g}),c.id)});case "LOCAL_PRESENT":return mu(a.a,new rf("AUTH_READY",{yb:d.yb,Ua:d.deviceId,xc:d.xc,ec:!b.data.local}),c.id),Promise.resolve();case "STATUS_REQUEST":return mu(a.a,b,c.id),Promise.resolve();case "STATUS_RESPONSE":return mu(a.a,b,c.id,!0),b.data.routeDescription||mu(a.a,b,c.id),Promise.resolve();
  case "HANGOUT_INACTIVE":return su(a.a,c,4,new Vd(Ut,"warning"));case "HANGOUT_INVALID":return su(a.a,c,3,new Vd(Vt,"warning"));default:return Promise.reject(Error("Unknown type: "+b.type))}};var uu=function(a,b,c){this.b=a;this.f=b;this.a=c},vu=function(a,b,c,d,e){return new Promise(function(f){switch(b){case "cloud":case "mesi":break;default:throw Error("Unrecognized channel type");}if(!c.type)throw Error("Message has no type");switch(c.type){case "STOP":f(su(a.a,d,1,null));return;case "SESSION_START_SUCCESS":Br(0);break;case "SESSION_END":break;case "SESSION_FAILURE":Br(1);f(su(a.a,d,2,new Vd(Rt,"warning")));return;case "__webrtc_stats__":break;case "PRESENTATION_CONNECTION_MESSAGE":mu(a.a,
  c.data,d.id,!0);break;case "OFFER":f(ou(a.b,c,d,e));return;case "GET_TURN_CREDENTIALS":f(qu(a.b,d));return;case "REFRESH_AUTH":case "LOCAL_PRESENT":case "MUTE":case "STATUS_REQUEST":case "STATUS_RESPONSE":case "HANGOUT_INACTIVE":case "HANGOUT_INVALID":f(tu(a.f,c,d,e));return;case "new_session":mu(a.a,c,d.id,!0);break;case "remove_session":mu(a.a,c,d.id,!0);a.a.terminateRoute(d.id);break;default:throw Error("Unknown type: "+c.type);}f()})};var wu=function(){var a=this;this.j=Ia("mr.cloud.settings.SettingsService");this.a=null;chrome.settingsPrivate.onPrefsChanged.addListener(function(b){Ie(13);if(a.a){b=ja(b);for(var c=b.next();!c.done;c=b.next())if(c=c.value,"media_router.cloudservices.enabled"==c.key){a.a.call(null,c.value);break}}})},xu=function(a,b){a.a=b},yu=function(a){var b=a.j;chrome.storage.sync.set({"mr.cloud.cloudEnabled":!0},function(){chrome.runtime.lastError&&t(b,"Error setting cloud setting: "+JSON.stringify(chrome.runtime.lastError))})},
  Au=function(a){return zu().catch(function(){return zu().catch(function(b){t(a.j,"Error retrieving cloud on setting.",b);return!1})})},zu=function(){return Bu("mr.cloud.cloudEnabled").then(function(a){return!!a["mr.cloud.cloudEnabled"]})},Bu=function(a){return new Promise(function(b,c){chrome.storage.sync.get(a,function(a){chrome.runtime.lastError?c(chrome.runtime.lastError):b(a)})})},Du=function(a){return Cu().catch(function(){return Cu().catch(function(b){t(a.j,"Error retrieving cloud enabled setting.",
  b);return!1})})},Cu=function(){return Eu().then(function(a){return!!a.value})},Eu=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)})})},Fu=function(a){var b=a.j;chrome.storage.sync.set({"mr.cloud.notifiedHangouts":!0},function(){chrome.runtime.lastError&&t(b,"Error setting notified Hangout privacy.",chrome.runtime.lastError)})},Hu=function(a){return Gu().catch(function(){return Gu().catch(function(b){t(a.j,
  "Error retrieving hangouts notified setting.",b);return!1})})},Gu=function(){return Bu("mr.cloud.notifiedHangouts").then(function(a){return!!a["mr.cloud.notifiedHangouts"]})};var Iu=function(a,b){this.a=a;this.b=b},Ju=function(a){return new Iu((a.a>>>1|(a.b&1)<<31)>>>0,a.b>>>1>>>0)},Ku=function(a){return new Iu(a.a<<1>>>0,(a.b<<1|a.a>>>31)>>>0)};Iu.prototype.add=function(a){return new Iu((this.a+a.a&4294967295)>>>0>>>0,((this.b+a.b&4294967295)>>>0)+(4294967296<=this.a+a.a?1:0)>>>0)};
  var Lu=function(a,b){return new Iu((a.a-b.a&4294967295)>>>0>>>0,((a.b-b.b&4294967295)>>>0)-(0>a.a-b.a?1:0)>>>0)},Mu=function(a){var b=a&65535,c=a>>>16;a=10*b+65536*(0*b&65535)+65536*(10*c&65535);for(b=0*c+(0*b>>>16)+(10*c>>>16);4294967296<=a;)a-=4294967296,b+=1;return new Iu(a>>>0,b>>>0)};
  Iu.prototype.toString=function(){for(var a="",b=this;0!=b.a||0!=b.b;){var c=new Iu(0,0);for(var b=new Iu(b.a,b.b),d=new Iu(10,0),e=new Iu(1,0);!(d.b&2147483648);)d=Ku(d),e=Ku(e);for(;0!=e.a||0!=e.b;)0>=(d.b<b.b||d.b==b.b&&d.a<b.a?-1:d.b==b.b&&d.a==b.a?0:1)&&(c=c.add(e),b=Lu(b,d)),d=Ju(d),e=Ju(e);c=[c,b];b=c[0];a=c[1].a+a}""==a&&(a="0");return a};
  var Nu=function(a){for(var b=new Iu(0,0),c=new Iu(0,0),d=0;d<a.length;d++){if("0">a[d]||"9"<a[d])return null;c.a=parseInt(a[d],10);var e=Mu(b.a),b=Mu(b.b);b.b=b.a;b.a=0;b=e.add(b).add(c)}return b};Iu.prototype.clone=function(){return new Iu(this.a,this.b)};var Ou=function(a,b){this.a=a;this.b=b};Ou.prototype.add=function(a){return new Ou((this.a+a.a&4294967295)>>>0>>>0,((this.b+a.b&4294967295)>>>0)+(4294967296<=this.a+a.a?1:0)>>>0)};Ou.prototype.clone=function(){return new Ou(this.a,this.b)};
  Ou.prototype.toString=function(){var a=0!=(this.b&2147483648),b=new Iu(this.a,this.b);a&&(b=Lu(new Iu(0,0),b));return(a?"-":"")+b.toString()};var Pu=0,Qu=0,Ru=function(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)));Pu=c;Qu=a},Su=function(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 Kp(a);pb("Type not convertible to Uint8Array.");return new Uint8Array(0)};var Uu=function(a,b,c){this.b=null;this.m=this.u=this.a=this.g=this.l=0;this.h=!1;a&&Tu(this,a,b,c)},Vu=[],Wu=function(a,b,c){if(Vu.length){var d=Vu.pop();a&&Tu(d,a,b,c);return d}return new Uu(a,b,c)};Uu.prototype.clone=function(){return Wu(this.b,this.l,this.g-this.l)};Uu.prototype.clear=function(){this.b=null;this.a=this.g=this.l=0;this.h=!1};var Tu=function(a,b,c,d){a.b=Su(b);a.l=k(c)?c:0;a.g=k(d)?a.l+d:a.b.length;a.a=a.l};Uu.prototype.reset=function(){this.a=this.l};
  Uu.prototype.f=function(){var a=this.b;var b=a[this.a+0];var c=b&127;if(128>b)return this.a+=1,c;b=a[this.a+1];c|=(b&127)<<7;if(128>b)return this.a+=2,c;b=a[this.a+2];c|=(b&127)<<14;if(128>b)return this.a+=3,c;b=a[this.a+3];c|=(b&127)<<21;if(128>b)return this.a+=4,c;b=a[this.a+4];c|=(b&15)<<28;if(128>b)return this.a+=5,c>>>0;this.a+=10;return c};Uu.prototype.w=Uu.prototype.f;
  var Xu=function(a){a:{for(var b,c=0,d,e=0;4>e;e++)if(b=a.b[a.a++],c|=(b&127)<<7*e,128>b){a.u=c>>>0;a.m=0;break a}b=a.b[a.a++];c|=(b&127)<<28;d=0|(b&127)>>4;if(128>b)a.u=c>>>0,a.m=d>>>0;else{for(e=0;5>e;e++)if(b=a.b[a.a++],d|=(b&127)<<7*e+3,128>b){a.u=c>>>0;a.m=d>>>0;break a}pb("Failed to read varint, encoding is invalid.");a.h=!0}}b=a.u;c=a.m;if(a=c&2147483648)b=~b+1>>>0,c=~c>>>0,0==b&&(c=c+1>>>0);b=4294967296*c+b;return a?-b:b};Uu.prototype.s=function(){return this.w()};var Yu=function(){this.a=[]};Yu.prototype.length=function(){return this.a.length};var Zu=function(a){var b=a.a;a.a=[];return b},$u=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},av=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},bv=function(a,b){if(0<=b)av(a,b);else{for(var c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},cv=function(a,b){a.a.push(b>>>0&255);a.a.push(b>>>8&255);a.a.push(b>>>16&255);a.a.push(b>>>24&255)};var dv=function(a,b,c){this.a=Wu(a,b,c);this.b=this.f=-1;this.g=!1};dv.prototype.reset=function(){this.a.reset();this.b=this.f=-1};
  var ev=function(a){var b=a.a;if(b.a==b.g)return!1;(b=a.g)||(b=a.a,b=b.h||0>b.a||b.a>b.g);if(b)return pb("Decoder hit an error"),!1;var c=a.a.f(),b=c>>>3,c=c&7;if(0!=c&&5!=c&&1!=c&&2!=c&&3!=c&&4!=c)return pb("Invalid wire type"),a.g=!0,!1;a.f=b;a.b=c;return!0},fv=function(a){switch(a.b){case 0:if(0!=a.b)pb("Invalid wire type for skipVarintField"),fv(a);else{for(a=a.a;a.b[a.a]&128;)a.a++;a.a++}break;case 1:1!=a.b?(pb("Invalid wire type for skipFixed64Field"),fv(a)):(a=a.a,a.a+=8);break;case 2:if(2!=
  a.b)pb("Invalid wire type for skipDelimitedField"),fv(a);else{var b=a.a.f();a=a.a;a.a+=b}break;case 5:5!=a.b?(pb("Invalid wire type for skipFixed32Field"),fv(a)):(a=a.a,a.a+=4);break;case 3:b=[a.f];do{if(!ev(a)){pb("Unmatched start-group tag: stream EOF");a.g=!0;break}if(3==a.b)b.push(a.f);else if(4==a.b&&a.f!=b.pop()){pb("Unmatched end-group tag");a.g=!0;break}}while(0<b.length);break;default:pb("Invalid wire encoding for field.")}},gv=function(a,b,c){var d=a.a.g,e=a.a.f(),e=a.a.a+e;a.a.g=e;c(b,
  a);a.a.a=e;a.a.g=d},hv=function(a){var b=a.a.f();a=a.a;for(var c,d,e=a.b,f=a.a,b=f+b,g=[],l="";f<b;){var r=e[f++];if(128>r)g.push(r);else if(192>r)continue;else if(224>r)d=e[f++],g.push((r&31)<<6|d&63);else if(240>r)d=e[f++],c=e[f++],g.push((r&15)<<12|(d&63)<<6|c&63);else if(248>r){d=e[f++];c=e[f++];var y=e[f++];c=(r&7)<<18|(d&63)<<12|(c&63)<<6|y&63;c-=65536;g.push((c>>10&1023)+55296,(c&1023)+56320)}8192<=g.length&&(l+=String.fromCharCode.apply(null,g),g.length=0)}l+=String.fromCharCode.apply(null,
  g);a.a=f;return l},iv=function(a,b){for(var c=a.a.f(),c=a.a.a+c,d=[];a.a.a<c;)d.push(b.call(a.a));return d};var E=function(){this.f=[];this.b=0;this.a=new Yu},kv=function(a,b){jv(a,b,2);b=Zu(a.a);a.f.push(b);a.b+=b.length;b.push(a.b);return b},lv=function(a,b){for(var c=b.pop(),c=a.b+a.a.length()-c;127<c;)b.push(c&127|128),c>>>=7,a.b++;b.push(c);a.b++};E.prototype.reset=function(){this.f=[];Zu(this.a);this.b=0};
  var F=function(a){for(var b=new Uint8Array(a.b+a.a.length()),c=a.f,d=c.length,e=0,f=0;f<d;f++){var g=c[f];b.set(g,e);e+=g.length}c=Zu(a.a);b.set(c,e);a.f=[b];return b},jv=function(a,b,c){av(a.a,8*b+c)},G=function(a,b,c){null!=c&&null!=c&&(jv(a,b,0),bv(a.a,c))},J=function(a,b,c){null!=c&&null!=c&&(jv(a,b,0),a=a.a,Ru(c),$u(a,Pu,Qu))},mv=function(a,b,c){if(null!=c){var d=c;(c=0<d.length&&"-"==d[0])&&(d=d.substring(1));d=Nu(d);null===d?c=null:(c&&(d=Lu(new Iu(0,0),d)),c=new Ou(d.a,d.b));jv(a,b,0);$u(a.a,
  c.a,c.b)}},nv=function(a,b,c){null!=c&&null!=c&&(jv(a,b,0),av(a.a,c))},ov=function(a,b,c){null!=c&&null!=c&&(jv(a,b,0),a=a.a,Ru(c),$u(a,Pu,Qu))},pv=function(a,b,c){null!=c&&(c=Nu(c),jv(a,b,0),$u(a.a,c.a,c.b))},qv=function(a,b,c){if(null!=c){jv(a,b,5);a=a.a;var d=c,d=(c=0>d?1:0)?-d:d;0===d?0<1/d?Pu=Qu=0:(Qu=0,Pu=2147483648):isNaN(d)?(Qu=0,Pu=2147483647):3.4028234663852886E38<d?(Qu=0,Pu=(c<<31|2139095040)>>>0):1.1754943508222875E-38>d?(d=Math.round(d/Math.pow(2,-149)),Qu=0,Pu=(c<<31|d)>>>0):(b=Math.floor(Math.log(d)/
  Math.LN2),d*=Math.pow(2,-b),d=Math.round(8388608*d)&8388607,Qu=0,Pu=(c<<31|b+127<<23|d)>>>0);cv(a,Pu)}},K=function(a,b,c){null!=c&&(jv(a,b,0),a.a.a.push(c?1:0))},L=function(a,b,c){null!=c&&(jv(a,b,0),bv(a.a,c))},M=function(a,b,c){if(null!=c){b=kv(a,b);for(var d=a.a,e=0;e<c.length;e++){var f=c.charCodeAt(e);if(128>f)d.a.push(f);else if(2048>f)d.a.push(f>>6|192),d.a.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.a.push(f>>18|240),d.a.push(f>>12&63|128),d.a.push(f>>6&63|128),d.a.push(f&63|128),e++)}else d.a.push(f>>12|224),d.a.push(f>>6&63|128),d.a.push(f&63|128)}lv(a,b)}},rv=function(a,b,c){null!=c&&(c=Su(c),jv(a,b,2),av(a.a,c.length),b=Zu(a.a),a.f.push(b),a.f.push(c),a.b+=b.length+c.length)},N=function(a,b,c,d){null!=c&&(b=kv(a,b),d(c,a),lv(a,b))},sv=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++){var e=a,f=c[d];null!=f&&(jv(e,b,0),bv(e.a,f))}},tv=function(a,b,c){if(null!=c)for(var d=0;d<
  c.length;d++){var e=a,f=c[d];null!=f&&(jv(e,b,0),e=e.a,Ru(f),$u(e,Pu,Qu))}},uv=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++){var e=a,f=c[d];null!=f&&(jv(e,b,0),av(e.a,f))}},vv=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++){var e=a,f=c[d];null!=f&&(jv(e,b,5),cv(e.a,f))}},wv=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)L(a,b,c[d])},xv=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)M(a,b,c[d])},yv=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)rv(a,b,c[d])},O=
  function(a,b,c,d){if(null!=c)for(var e=0;e<c.length;e++){var f=kv(a,b);d(c[e],a);lv(a,f)}},zv=function(a,b,c,d){if(null!=c)for(var e=0;e<c.length;e++)jv(a,b,3),d(c[e],a),jv(a,b,4)},Av=function(a,b,c){if(null!=c&&c.length){b=kv(a,b);for(var d=0;d<c.length;d++)bv(a.a,c[d]);lv(a,b)}};var P=function(){},Bv="function"==typeof Uint8Array;P.prototype.lk=function(){return this.gh};
  var Q=function(a,b,c,d,e){a.a=null;b||(b=c?[c]:[]);a.gh=c?String(c):void 0;a.h=0===c?-1:0;a.f=b;a:{if(a.f.length&&(b=a.f.length-1,(c=a.f[b])&&"object"==typeof c&&!ua(c)&&!(Bv&&c instanceof Uint8Array))){a.l=b-a.h;a.b=c;break a}-1<d?(a.l=d,a.b=null):a.l=Number.MAX_VALUE}a.A={};if(e)for(d=0;d<e.length;d++)b=e[d],b<a.l?(b+=a.h,a.f[b]=a.f[b]||Cv):a.b[b]=a.b[b]||Cv},Cv=Object.freeze?Object.freeze([]):[],Dv=function(a,b,c,d){for(var e in c){var f=c[e],g=f.vr;if(!f.Bg)throw Error("Message extension present that was generated without binary serialization support");
  var l=d.call(a,g);if(null!=l)if(g.eh())if(f.ak)f.Bg.call(b,g.Hg,l,f.ak);else throw Error("Message extension present holding submessage without binary support enabled, and message is being serialized to binary format");else f.Bg.call(b,g.Hg,l)}},R=function(a,b){if(b<a.l){b+=a.h;var c=a.f[b];return c===Cv?a.f[b]=[]:c}c=a.b[b];return c===Cv?a.b[b]=[]:c},Ev=function(a,b){a=R(a,b);return null==a?a:+a},Fv=function(a){if(null==a||a instanceof Uint8Array)return a;if(oa(a))return Kp(a);pb("Cannot coerce to Uint8Array: "+
  sa(a));return null},Hv=function(a){Gv(a);return!a.length||a[0]instanceof Uint8Array?a:ub(a,Fv)},Gv=function(a){if(a&&1<a.length){var b=sa(a[0]);w(a,function(a){sa(a)!=b&&pb("Inconsistent type in JSPB repeated field array. Got "+sa(a)+" expected "+b)})}},S=function(a,b,c){a=R(a,b);return null==a?c:a},T=function(a,b,c){b<a.l?a.f[b+a.h]=c:a.b[b]=c},U=function(a,b,c,d){a.a||(a.a={});if(!a.a[c]){var e=R(a,c);if(d||e)a.a[c]=new b(e)}return a.a[c]},V=function(a,b,c){Iv(a,b,c);b=a.a[c];b==Cv&&(b=a.a[c]=[]);
  return b},Iv=function(a,b,c){a.a||(a.a={});if(!a.a[c]){for(var d=R(a,c),e=[],f=0;f<d.length;f++)e[f]=new b(d[f]);a.a[c]=e}},W=function(a,b,c){a.a||(a.a={});var d=c?Jv(c):c;a.a[b]=c;T(a,b,d)},Kv=function(a,b,c){a.a||(a.a={});c=c||[];for(var d=[],e=0;e<c.length;e++)d[e]=Jv(c[e]);a.a[b]=c;T(a,b,d)},Lv=function(a,b,c,d){Iv(a,d,b);var e=a.a[b];e||(e=a.a[b]=[]);c=c?c:new d;a=R(a,b);e.push(c);a.push(Jv(c))},Mv=function(a){if(a.a)for(var b in a.a){var c=a.a[b];if(ua(c))for(var d=0;d<c.length;d++)c[d]&&Jv(c[d]);
  else c&&Jv(c)}},Jv=function(a){Mv(a);return a.f};P.prototype.ha=Bv?function(){var a=Uint8Array.prototype.toJSON;Uint8Array.prototype.toJSON=function(){return Hp(this)};try{var b=JSON.stringify(Jv(this),Nv)}finally{Uint8Array.prototype.toJSON=a}return b}:function(){return JSON.stringify(Jv(this),Nv)};
  var Nv=function(a,b){if(m(b)){if(isNaN(b))return"NaN";if(Infinity===b)return"Infinity";if(-Infinity===b)return"-Infinity"}return b},Pv=function(a){var b=Ov[a[0]];if(!b)throw Error("Unknown JsPb message type: "+a[0]);return new b(a)};P.prototype.toString=function(){Mv(this);return this.f.toString()};
  P.prototype.m=function(a){if(this.b){this.a||(this.a={});var b=a.Hg;if(a.b){if(a.eh())return this.a[b]||(this.a[b]=ub(this.b[b]||[],function(b){return new a.a(b)})),this.a[b]}else if(a.eh())return!this.a[b]&&this.b[b]&&(this.a[b]=new a.a(this.b[b])),this.a[b];return this.b[b]}};
  var Rv=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(!Qv(a[d],b[d]))return!1;return!0},Qv=function(a,b){if(a==b)return!0;if(!xa(a)||!xa(b)||a.constructor!=b.constructor)return!1;if(Bv&&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){for(var d=void 0,e=void 0,f=Math.max(a.length,b.length),c=0;c<f;c++){var g=a[c],l=b[c];g&&g.constructor==Object&&(d=g,g=void 0);
  l&&l.constructor==Object&&(e=l,l=void 0);if(!Qv(g,l))return!1}return d||e?(d=d||{},e=e||{},Rv(d,e)):!0}if(a.constructor===Object)return Rv(a,b);throw Error("Invalid type in JSPB array");};P.prototype.clone=function(){return Sv(this)};
  var Sv=function(a){return new a.constructor(Tv(Jv(a)))},Tv=function(a){var b;if(ua(a)){for(var c=Array(a.length),d=0;d<a.length;d++)null!=(b=a[d])&&(c[d]="object"==typeof b?Tv(b):b);return c}if(Bv&&a instanceof Uint8Array)return new Uint8Array(a);c={};for(d in a)null!=(b=a[d])&&(c[d]="object"==typeof b?Tv(b):b);return c},Uv=function(a,b){Ov[a]=b;b.messageId=a},Ov={};var X=function(a){Q(this,a,0,-1,null)};q(X,P);X.prototype.o=function(){var a=new E;Vv(this,a);return F(a)};var Vv=function(a,b){var c=R(a,1);null!=c&&J(b,1,c);c=R(a,2);null!=c&&M(b,2,c);c=U(a,Wv,3);null!=c&&N(b,3,c,Xv)},Wv=function(a){Q(this,a,0,-1,null)};q(Wv,P);Wv.prototype.o=function(){var a=new E;Xv(this,a);return F(a)};var Xv=function(a,b){var c=R(a,1);null!=c&&M(b,1,c);c=R(a,2);null!=c&&J(b,2,c)};X.prototype.sb=function(){return R(this,1)};var Yv=function(){this.a=null},Zv=function(a,b){if(!a.a||R(a.a,2)<R(b,2))a.a=Sv(b)},$v=function(a){return a.a?R(a.a,2)+";"+R(a.a,1):null};var aw=function(){this.j=Ia("mr.cloud.CredentialService")},pu=function(a){var b=new Ra,c=Jr.a+"/iceconfig?key="+Jr.b;u(a.j,"Requesting TURN credentials from "+c);var d=sj(c,function(){Cj(d)?(u(a.j,"Got TURN credentials: "+Dj(d)),b.resolve(bw(a,Ej(d)))):b.resolve(cw(a))},"POST",void 0,{"Content-Type":"application/json"});return b.a},bw=function(a,b){try{var c=[];b.iceServers.forEach(function(a){a.urls.forEach(function(b){0==b.indexOf("turn:")&&c.push({url:b,credential:a.credential,username:a.username})})});
  return c}catch(d){return a.j.error("Error parsing TURN credentials.",d),[]}},cw=function(a){a.j.error("XHR failed fetching TURN credentials.",null);return[]};var dw=function(){this.u=this.K=this.B=this.A=this.v=this.m=this.s=this.l=this.b=this.h=this.g=this.f=this.w=this.a=null},ew=function(){var a=dw.na();null==a.u&&(a.u=new Yv);return a.u},fw=function(a){null==a.a&&(a.a=new bt);return a.a},gw=function(a){null==a.w&&(a.w=new Us(fw(a)));return a.w},hw=function(a){null==a.s&&(a.s=new au(gw(a)));return a.s};ra(dw);var iw=function(a){this.a=a;this.b=new Map;this.A=new Map;this.s=[];this.l=this.K=this.w=this.B=this.h=null;this.m=this.g=this.f=!1;this.v=new Map;this.u=new Map;Nf(this)};iw.prototype.getName=function(){return"cloud"};
  iw.prototype.Ga=function(){var a=this;u(this.j,"Initializing Cloud MRP");var b=dw.na();null==b.g&&(null==b.f&&(b.f=new bs(gw(b))),b.g=new xs(b.f,this));this.s.push(b.g);if(null==b.l){null==b.b&&(b.b=new Kr(gw(b),fw(b)));var c=b.b;null==b.h&&(b.h=new Yt(gw(b)));b.l=new As(c,b.h,this)}this.h=b.l;this.s.push(this.h);this.B=hw(b);this.w=fw(b);if(null==b.A){if(null==b.m){c=hw(b);var d=fw(b);null==b.K&&(b.K=new aw(gw(b)));b.m=new ku(c,d,b.K,this)}c=b.m;null==b.v&&(b.v=new ru(fw(b),this));b.A=new uu(c,b.v,
  this)}this.K=b.A;null==b.B&&(b.B=new wu);this.l=b.B;Du(this.l).then(function(b){a.f=b;u(a.j,"Cloud enabled setting: "+a.f)});Au(this.l).then(function(b){a.g=b;u(a.j,"Cloud on setting: "+a.g)});xu(this.l,function(b){a.f=b;u(a.j,"Cloud enabled setting: "+a.f);a.f&&jw(a)});Hu(this.l).then(function(b){a.m=b;u(a.j,"Privacy notified setting: "+a.m)})};iw.prototype.kc=function(){return Array.from(this.b.values())};
  iw.prototype.wd=function(a){if(!kw(this,a))return oo;v(this.j,"GetAvailableSinks for "+a);var b=[];if(this.g||lw())b=jw(this);this.u.clear();for(var c={},d=ja(this.v.values()),e=d.next();!e.done;c={dd:c.dd,ke:c.ke},e=d.next())c.dd=e.value,c.ke=!1,b.forEach(function(a){return function(b){b.xa.id==a.dd.xa.id&&(a.ke=!0,b.xa.friendlyName=a.dd.xa.friendlyName)}}(c)),c.ke||this.u.set(c.dd.xa.id,c.dd);b=b.concat.apply(b,[].concat(la(this.u.values())));v(this.j,function(){return"Available sinks are..."+JSON.stringify(b)});
  c=b.map(function(a){return a.xa});this.h&&(c=c.concat(mw));return new no(c,-1!=a.indexOf("0F5096E8")?Ne:null)};var jw=function(a){var b=[];u(a.j,"Checking cloud discovery services");gk().g=Ea();a.s.forEach(function(a){a=a.Yc();b=b.concat(a)});return b};h=iw.prototype;h.startObservingMediaSinks=function(){};h.stopObservingMediaSinks=function(){};h.startObservingMediaRoutes=function(){};h.stopObservingMediaRoutes=function(){};h.ed=function(){};h.Cd=function(a){return(a=nw(this,a))?a.xa:null};
  h.createRoute=function(a,b,c,d,e,f,g){var l=this;u(this.j,"createRoute called");v(this.j,"urn: "+a+" sinkId:"+b);if(e=this.A.get(b))return Zd(this.a.hh(this,e,a,c,g,function(b){b.mediaSource=a;b.ob.tabId=g;return ae(b)}),function(a){l.a.Wb(l,a);return a});e=nw(this,b);return ow(this,a,e,b,c,d,g)};
  var pw=function(a,b,c,d,e){b instanceof mo&&2==b.errorCode?su(a,c,6,null):(a.j.error("Error on start session",b instanceof Error?b:Error("Expected an Error value, got "+b)),su(a,c,e,new Vd(Rt,"warning")));if(b=a.h)b=a.h,b.b.delete(d.deviceId)?(b.a.a.delete(d.xa.id),b=!0):b=!1;b&&ts(a,[d.xa])},ow=function(a,b,c,d,e,f,g){if(f)return be(Error("not supported"));f=!1;switch(qw(c)){case "cloud":Cr(1);break;case "mesi":f=!0;if(!a.m){a.m=!0;Fu(a.l);var l=Xd();a.a.mc().send(l)}Cr(0)}gk().b=new dk(c.model,
  null);var r=Kj(e,a.getName(),d,b,!0,"",null);f&&(r.customControllerPath="cloud_route_details/view.html?routeId="+r.id);a.b.set(r.id,r);a.A.set(d,r);a.v.set(r.id,c);a.a.pc(a,r);a.a.cd(a.fa(),!0);if(Me(b)&&!f)return u(a.j,"starting presentation on route: "+r.id),$d(rw(r,b),function(b){pw(a,b,r,c,7);throw b;});u(a.j,"starting mirroring on route: "+r.id);r.ob={tabId:g,sessionId:"",He:"",Ie:c.model};Me(b)&&(r.isOffscreenPresentation=!0);return $d(a.a.qf(a,r,e),function(b){pw(a,b,r,c,5);throw b;})};
  iw.prototype.terminateRoute=function(a){var b=this.b.get(a);return b?su(this,b,0,null):Promise.reject(new mo(3,"Route in cloud provider not found for routeId "+a))};
  var su=function(a,b,c,d){u(a.j,"terminating route: "+b.id);a.b.delete(b.id);a.A.delete(b.sinkId);var e=a.v.get(b.id);a.v.delete(b.id);d&&a.a.mc().send(d);we("MediaRouter.Cloud.Session.End",c,xr);switch(c){case 1:break;default:switch(qw(e)){case "cloud":gu(a.B,e.deviceId,Zr,{})}}a.a.Xc(a,b);0==a.b.size&&a.a.cd(a.fa(),!1);a.a.onPresentationConnectionStateChanged(b.id,"terminated");a.u.has(b.sinkId)&&(c=a.u.get(b.sinkId),ts(a,[c.xa]),a.u.delete(b.sinkId));return Promise.resolve()};h=iw.prototype;
  h.sendRouteMessage=function(a,b,c){if(c&&c.channelType){c=c.channelType;var d=(a=this.b.get(a)||void 0)?nw(this,a.sinkId):void 0;return vu(this.K,c,b,a,d)}return oa(b)?(mu(this,b,a),Promise.resolve()):Promise.reject(Error("Channel type missing"))};h.sendRouteBinaryMessage=function(a){return Promise.reject(Error("Route "+a+" does not support sending binary data."))};
  h.Qc=function(a){var b=new pf;5>b.minFrameRate&&(b.minFrameRate=5);"hangouts"!=this.gc(a)&&(b.senderSideLetterboxing=!0);qf(b);Object.freeze(b);u(this.j,"Settings for "+a+": "+of(b));if(!b.shouldCaptureAudio&&!b.shouldCaptureVideo)throw Error("Cannot start mirroring without video or audio capture.");return b};h.gc=function(a){var b=null;a=nw(this,a);switch(qw(a)){case "cloud":b="webrtc";break;case "mesi":b=a.yb?"meetings":"hangouts"}return b};
  h.rd=function(a,b){v(this.j,"Checking canRoute: "+a+" for sinkId: "+b);return kw(this,a)&&!!this.Cd(b)};h.Ic=function(a,b){return"https://hangouts.google.com/cloudmrp-mirroring"==a&&this.b.has(b)};h.joinRoute=function(a,b){return(a=this.b.get(b))?ae(a):be(Error("not supported"))};h.connectRouteByRouteId=function(){return be(Error("not supported"))};h.detachRoute=function(){};
  var ns=function(a,b){u(a.j,b.length+" sinks added");0<b.length&&!a.g&&(yu(a.l),a.g=!0);b=nw(a,b[0].id);gk().a=new dk(b.model,null);a.a.Fb();a.a.onSinkAvailabilityUpdated(a,2);u(a.j,"sinkAvailability changed to AVAILABLE")},ts=function(a,b){u(a.j,b.length+" sinks removed");a.s.some(function(a){return 0<a.Yc().length})||(a.a.onSinkAvailabilityUpdated(a,0),u(a.j,"sinkAvailability changed to UNAVAILABLE"));a.a.Fb()},os=function(a,b){u(a.j,b.length+" sinks updated");a.a.Fb()},mu=function(a,b,c,d){(void 0===
  d?0:d)?a.a.Mb(a,c,b):a.a.te(a,c,b)},nw=function(a,b){var c=sw(a,b);c||(c=null,(b=a.A.get(b))&&(c=a.v.get(b.id)));return c},sw=function(a,b){var c=null;a.s.some(function(a){c=a.nc(b);return!!c});return c},qw=function(a){return Bb(a.a,"cloud")?"cloud":Bb(a.a,"mesi")?"mesi":null},lw=function(){var a=gk().g;return 3E5<=Date.now()-a},kw=function(a,b){var c=Le(b);b=Me(b);if(a.w.f&&!a.w.b&&c)return a.a.onSinkAvailabilityUpdated(a,2),!0;var d=!1;a.f&&a.w.b&&(d=!0);var e;if(e=!chrome.declarativeWebRequest)a=
  a.w,e=!(a.f||a.b&&a.a&&(-1!=et.indexOf(a.a)||-1!=et.indexOf(ct(a))))&&b;return e?!1:d&&(c||b)};iw.prototype.searchSinks=function(a,b){var c=this;if(!kw(this,a))return Promise.reject(Error("err"));a=Ds(this.h,b);a.then(function(a){ns(c,[a])});return a};var tw=function(a,b){b=a.b.get(b);if(!b)return Promise.reject(Error("Route not found"));a=a.gc(b.sinkId);return"hangouts"!=a&&"meetings"!=a?Promise.reject(Error("Unsupported sink channel type")):jr(Qe.get("mr.ProviderManager")||null,a)};h=iw.prototype;
  h.createMediaRouteController=function(a,b,c){return tw(this,a).then(function(d){return d.createMediaRouteController(a,b,c)})};h.provideSinks=function(){};h.fa=function(){return"CloudProvider"};h.sa=function(){return[void 0,{cloudEnabled:this.f,cloudOn:this.g,notifiedHangoutsPrivacy:this.m}]};h.wa=function(){var a=Lf(this);a&&(a.cloudEnabled&&(this.f=a.cloudEnabled),a.cloudOn&&(this.g=a.cloudOn),a.notifiedHangoutsPrivacy&&(this.m=a.notifiedHangoutsPrivacy))};var rw=function(a,b){a=new tr(a,b);return ce(a.start())};
  iw.prototype.j=Ia("mr.CloudProvider");var mw=new Xj("pseudo:cloud","","meeting","","default");var uw=function(){Ck.call(this,12,"ExternalMessageListener","mr.ProviderManager",chrome.runtime.onMessageExternal)};ka(uw,Ck);uw.prototype.Je=function(a,b){return b.id&&-1!=vw.indexOf(b.id)?"start"==a.type||"stop"==a.type:!1};uw.prototype.cf=function(){return!0};var xw=function(){ww||(ww=new uw);return ww},ww=null,vw=["idmofbkcelhplfjnmmdolenpigiiiecc","ggedfkijiiammpnbdadhllnehapomdge","njjegkblellcjnakomndbaloifhcoccg"];var yw=function(){Ck.call(this,11,"InternalMessageListener","mr.ProviderManager",chrome.runtime.onMessage)};ka(yw,Ck);yw.prototype.Je=function(a,b){return"retrieve_log_data"==a.type&&b.id==chrome.runtime.id&&b.url=="chrome-extension://"+b.id+"/feedback.html"};yw.prototype.cf=function(){return!0};var Aw=function(){zw||(zw=new yw);return zw},zw=null;var Cw=function(){var a=Bw,b=new Eo(a),c=new Sq(a,b),b=[b,c];b.push(new iw(a));return b};var Dw=function(){this.a=null;this.j=Ia("mr.IssueSenderImpl")};Dw.prototype.init=function(a){this.a=a};Dw.prototype.send=function(a){if(this.a)if(this.a.onIssue)this.a.onIssue(a);else this.j.error("MediaRouterService.onIssue not defined.");else this.j.error("MediaRouterService is not set.")};var Ew=function(a,b){this.type="internal_message";this.routeId=a;this.message=b};var Fw=function(a,b,c){this.a=a;this.g=b;this.f=c;this.onMessage=function(){};c.listen("internal_message",this.b,this)};Fw.prototype.sendMessage=function(a,b){return this.g(this.a,a,b)};Fw.prototype.b=function(a){if(a.routeId==this.a)this.onMessage(a.message)};Fw.prototype.ta=function(){this.onMessage=function(){};this.f.w("internal_message",this.b,this)};
  var Gw=new Fw("",function(){return Promise.resolve()},new hp),Hw=function(a){this.a=a},pr=function(a){var b=Ud,c=b.a.gf(a);return c?new Fw(a,c.sendRouteMessage.bind(c),b.a.jf()):Gw};var Iw=function(){this.j=Ia("mr.ProviderManager");this.b=[];this.a=new Map;this.m=new Map;this.g=new Set;this.l=new Set;this.s=new Map;this.f=this.w=null;this.G=new hp;this.H=new jp(this.Pl,500,this);this.ba=new jp(this.I,500,this);this.h=new dp(this,524288);this.K=0;this.T=new Dw;this.u=new Map;this.B=-1==window.navigator.userAgent.indexOf("Windows");this.A=[];this.v=[];var a=new gr(this);this.U=a.onMessage.bind(a);a=new Xq(this);this.O=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.enableMdnsDiscovery=this.enableMdnsDiscovery;this.searchSinks=this.searchSinks;this.provideSinks=this.provideSinks;this.updateMediaSinks=this.updateMediaSinks;this.createMediaRouteController=this.createMediaRouteController};ka(Iw,Pe);
  Iw.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.U.apply(this,[].concat(la(c)));else if(a==chrome.runtime.onMessageExternal)this.O.apply(this,[].concat(la(c)));else throw Error("Unhandled event");};var jr=function(a,b){b=a.s.get(b);return Te(b).then(function(b){b.Ga(a);return b})};
  Iw.prototype.Ga=function(a,b,c){this.s.set("webrtc","mr.mirror.webrtc.WebRtcService");this.s.set("cast_streaming","mr.mirror.cast.Service");this.s.set("hangouts","mr.mirror.hangouts.HangoutsService");this.s.set("meetings","mr.mirror.hangouts.MeetingsService");var d=new Hw(this);Ud||(Ud=d);this.f=a;this.T.init(a);this.h.init(this.f.onRouteMessagesReceived.bind(this.f));b.forEach(this.Y,this);(a=Jw(this,"dial"))&&a.ed(c?c.enable_dial_discovery:!0);(a=Jw(this,"cast"))&&a.ed(c?c.enable_cast_discovery:
  !0);Nf(this);Ze("mr.ProviderManager",this)};Iw.prototype.Y=function(a){if(Jw(this,a.getName()))t(this.j,"Provider "+a.getName()+" already registered.");else try{a.Ga(),this.b.push(a),this.u.set(a.getName(),0)}catch(b){t(this.j,"Provider "+a.getName()+" failed to initialize.",b)}};
  var Lw=function(a,b,c){return new Promise(function(d,e){var f=null;a.K++;Kw(a);f=window.setTimeout(function(){f=null;b.cancel(new mo(2,"timeout after "+c+" ms."))},c);b.a.then(function(b){a.K--;Kw(a);null!=f&&window.clearTimeout(f);d(b)},function(b){a.K--;Kw(a);null!=f&&window.clearTimeout(f);e(b instanceof mo?b:b instanceof Error?new mo(0,b.message,b.stack):new mo(0))})})};Iw.prototype.onBeforeInvokeHandler=function(){Ie(0)};
  var Mw=function(a){return"string"==typeof a?a:a.unique?"":a.scheme+"://"+a.host+"\n       "+(a.port?":"+a.port:"")+"/"};h=Iw.prototype;
  h.createRoute=function(a,b,c,d,e,f,g){g=void 0===g?!1:g;var l=this,r=Nw(this,a,b);if(!r)return Promise.reject(new mo(7,"No provider supports createRoute with source: "+a+" and sink: "+b));var y=void 0;void 0!==d&&(y=Mw(d));f=f&&0<f?f:6E4;a=r.createRoute(a,b,c,g,f,y,e);return Lw(this,a,f).then(function(a){return a},function(a){l.j.error("Error creating route.",a);throw a;})};
  h.connectRouteByRouteId=function(a,b,c,d,e,f){var g=this.a.get(b);if(!g)return Promise.reject(new mo(7,"No provider supports join "+b));a=g.connectRouteByRouteId(a,b,c,Mw(d),e);return Lw(this,a,f&&0<f?f:3E4)};h.joinRoute=function(a,b,c,d,e,f){f=void 0===f?!1:f;var g=Ow(this,a,b);if(!g)return Promise.reject(new mo(7,"No provider supports join "+b));e=e&&0<e?e:3E4;a=g.joinRoute(a,b,f,e,Mw(c),d);return Lw(this,a,e)};
  h.terminateRoute=function(a){var b=this.a.get(a);return b?Pw(this,a).then(function(){return b.terminateRoute(a)}):Promise.reject(new mo(3,"Route not found for routeId "+a))};h.startObservingMediaSinks=function(a){this.g.has(a)||(this.g.add(a),this.b.forEach(function(b){b.startObservingMediaSinks(a)}));Qw(this,a)};h.stopObservingMediaSinks=function(a){this.g.delete(a)?Rw(this,a):u(this.j,"No existing query "+a)};
  var Rw=function(a,b){a.b.forEach(function(a){a.stopObservingMediaSinks(b)})},Qw=function(a,b){if("urn:x-org.chromium.media:source:tab:-1"==b)t(a.j,"No sinks for sourceUrn: "+b);else{var c=new Map,d=[];a.b.forEach(function(e){var f=e.wd(b);0<f.sinks.length&&(d=f.origins);f.sinks.forEach(function(b){c.has(b.id)?t(a.j,"Detected duplicate sink "+b.id+" from provider: "+e.getName()):c.set(b.id,b)})});Sw(a,b,Array.from(c.values()),d||[])}},Sw=function(a,b,c,d){u(a.j,"Sending "+c.length+" sinks to MR for "+
  b);a.f.onSinksReceived(b,c,d.map(ip))};h=Iw.prototype;h.sendRouteMessage=function(a,b,c){var d=this.a.get(a);d?(a=d.sendRouteMessage(a,b,c),a=Lw(this,ce(a),3E4)):a=Promise.reject(Error("Invalid route ID "+a));return a};h.sendRouteBinaryMessage=function(a,b){var c=this.a.get(a);c?(a=c.sendRouteBinaryMessage(a,b),a=Lw(this,ce(a),3E4)):a=Promise.reject(Error("Invalid route ID "+a));return a};
  h.startListeningForRouteMessages=function(a){var b=this.h;b.b.has(a)||(b.b.add(a),(a=b.a.get(a))&&0<a.length&&cp(b))};h.stopListeningForRouteMessages=function(a){this.h.stopListeningForRouteMessages(a)};h.detachRoute=function(a){var b=this.a.get(a);b?b.detachRoute(a):u(this.j,"Route "+a+" does not exist.")};h.enableMdnsDiscovery=function(){this.B=!0;this.A.forEach(function(a){a()});this.A.length=0};
  var Nw=function(a,b,c){return a.b.find(function(a){return a.rd(b,c)})||null},Ow=function(a,b,c){return a.b.find(function(a){return a.Ic(b,c)})||null};Iw.prototype.I=function(){var a=this;this.g.forEach(function(b){Qw(a,b)})};var Kw=function(a){a.f.setKeepAlive(0<a.K||0<a.v.length)};h=Iw.prototype;h.startObservingMediaRoutes=function(a){this.l.has(a)||(this.l.add(a),this.b.forEach(function(b){b.startObservingMediaRoutes(a)}));this.H.f()};
  h.stopObservingMediaRoutes=function(a){this.l.delete(a)?this.b.forEach(function(b){b.stopObservingMediaRoutes(a)}):u(this.j,"No existing route query "+a)};h.Pl=function(){var a=this;if(0!=this.l.size){var b=[];this.b.forEach(function(a){b=b.concat(a.kc())});this.l.forEach(function(c){var d=[];a.b.forEach(function(a){a.kc().forEach(function(b){!b.Mc&&a.Ic(c,void 0,b)&&d.push(b.id)})});a.f.onRoutesUpdated(b,c,d)})}};h.fa=function(){return"ProviderManager"};
  h.sa=function(){return[new Tw(this.b.map(function(a){return a.getName()}),Array.from(this.g),Array.from(this.l),Array.from(this.a,function(a){var b=ja(a);a=b.next().value;b=b.next().value;return[a,b.getName()]}),Array.from(this.u),this.B,this.w)]};h.wa=function(){var a=Kf(this);if(a){this.g=new Set(a.h);this.l=new Set(a.g);for(var b=ja(a.f),c=b.next();!c.done;c=b.next()){var d=ja(c.value),c=d.next().value,d=d.next().value,d=Jw(this,d);this.a.set(c,d)}this.u=new Map(a.l);this.w=a.a||null;a.b&&this.enableMdnsDiscovery()}};
  h.gf=function(a){return this.a.get(a)};h.pc=function(a,b){this.a.set(b.id,a);this.Wb(a,b)};h.Xc=function(a,b){Pw(this,b.id);this.a.delete(b.id);var c=this.h,d=b.id;c.b.delete(d);var e=c.a.get(d);e&&(c.a.delete(d),fp(c,e),ep(c));this.Wb(a,b)};h.Wb=function(){0<this.l.size&&this.H.f()};h.ph=function(a){var b=this.a.get(a.id);b&&this.Wb(b,a)};
  h.Mb=function(a,b,c){this.a.has(b)?("string"===typeof c||c instanceof Uint8Array||(c=JSON.stringify(c)),this.h.send(b,c)):t(this.j,"Got route message for closed route "+b)};h.onPresentationConnectionStateChanged=function(a,b){"terminated"==b&&this.h.h();this.f.onPresentationConnectionStateChanged(a,b)};h.onPresentationConnectionClosed=function(a,b,c){this.h.h();this.f.onPresentationConnectionClosed(a,b,c)};h.tf=function(a){this.m.delete(a);var b=this.a.get(a);b&&b.terminateRoute(a)};
  h.te=function(a,b,c){this.G.dispatchEvent(new Ew(b,c))};h.Fb=function(){this.ba.f()};h.onSinkAvailabilityUpdated=function(a,b){var c=this;if(this.u.get(a.getName())!=b){var d=Uw(this);this.u.set(a.getName(),b);a=Uw(this);d!=a&&(this.f.onSinkAvailabilityUpdated(a),0==a&&(this.g.forEach(function(a){Rw(c,a)}),this.g.clear()))}};var Uw=function(a){return Array.from(a.u.values()).reduce(function(a,c){return Math.max(a,c)},0)};Iw.prototype.jf=function(){return this.G};Iw.prototype.mc=function(){return this.T};
  var Pw=function(a,b){return a.m.has(b)?jr(a,a.m.get(b)).then(function(c){a.m.delete(b);return cf(c)}):Promise.resolve(!1)};h=Iw.prototype;h.qf=function(a,b,c,d){var e=this,f=a.gc(b.sinkId);u(this.j,"Starting mirroring using service: "+f);this.m.set(b.id,f);return de(jr(this,f),function(g){e.w=f;return $d(ff(g,b,b.mediaSource,a.Qc(b.sinkId),c,d),function(a){if(a instanceof ze&&3==a.reason)throw new mo(8);throw a;})})};
  h.hh=function(a,b,c,d,e,f){var g=this,l=this.m.get(b.id);return l?de(jr(this,l),function(r){g.w=l;var y=a.Qc(b.sinkId);u(r.F,"Update mirroring on route "+b.id);return r.g?ce(bf(c,e).then(r.K.bind(r,b,c,y,d,f))):be(Error("Not initialized"))}):be(Error("Route "+b.id+" is not mirroring"))};h.If=function(a){this.B?a():-1==this.A.indexOf(a)&&this.A.push(a)};h.nf=function(){return this.B};h.cd=function(a,b){var c=this.v.indexOf(a),d=0<=c;b&&!d?this.v.push(a):!b&&d&&this.v.splice(c,1);Kw(this)};
  var Jw=function(a,b){return a.b.find(function(a){return a.getName()==b})||null};Iw.prototype.searchSinks=function(a,b,c){var d=a.startsWith("pseudo:")?a.substring(7):null;return(d=d?Jw(this,d):null)?d.searchSinks(b,c).then(function(a){return a.id}):Promise.reject(Error("No provider supports "+a))};Iw.prototype.provideSinks=function(a,b){var c=Jw(this,a);c?c.provideSinks(b):this.j.error("provideSinks: Provider not found for providerName "+a)};
  Iw.prototype.updateMediaSinks=function(a){this.g.has(a)||Qw(this,a)};Iw.prototype.createMediaRouteController=function(a,b,c){var d=this,e=this.a.get(a);return e?e.createMediaRouteController(a,b,c).catch(function(a){d.j.error("createMediaRouteController failed: "+a.message);b.close();c.ptr.reset();throw a;}):(a="createMediaRouteController: Provider not found for "+a,this.j.error(a),b.close(),c.ptr.reset(),Promise.reject(Error(a)))};
  var Tw=function(a,b,c,d,e,f,g){this.h=b;this.g=c;this.f=d;this.l=e;this.b=f;this.a=g};
  