'use strict';var h,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,ca=function(){ca=function(){};ba.Symbol||(ba.Symbol=da)},da=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}(),fa=function(){ca();var a=ba.Symbol.iterator;a||(a=ba.Symbol.iterator=ba.Symbol("iterator"));"function"!=
typeof Array.prototype[a]&&aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return ea(this)}});fa=function(){}},ea=function(a){var b=0;return ha(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})},ha=function(a){fa();a={next:a};a[ba.Symbol.iterator]=function(){return this};return a},ia=function(a){fa();var b=a[Symbol.iterator];return b?b.call(a):ea(a)},ja=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");
if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""},ka=function(a,b){if(b){var c=ba;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&aa(c,a,{configurable:!0,writable:!0,value:b})}};
ka("String.prototype.endsWith",function(a){return a?a:function(a,c){var b=ja(this,a,"endsWith");a+="";void 0===c&&(c=b.length);c=Math.max(0,Math.min(c|0,b.length));for(var e=a.length;0<e&&0<c;)if(b[--c]!=a[--e])return!1;return 0>=e}});ka("String.prototype.startsWith",function(a){return a?a:function(a,c){var b=ja(this,a,"startsWith");a+="";var e=b.length,f=a.length;c=Math.max(0,Math.min(c|0,b.length));for(var g=0;g<f&&c<e;)if(b[c++]!=a[g++])return!1;return g>=f}});
var la=la||{},k=this,m=function(a){return void 0!==a},n=function(a){return"string"==typeof a},ma=function(a){return"number"==typeof a},q=function(){},na=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";
if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==b&&"undefined"==typeof a.call)return"object";return b},oa=function(a){return"array"==na(a)},pa=function(a){var b=na(a);return"array"==b||"object"==b&&"number"==typeof a.length},qa=function(a){return"function"==na(a)},ra=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},sa="closure_uid_"+(1E9*Math.random()>>>
0),ta=0,ua=function(a,b,c){return a.call.apply(a.bind,arguments)},va=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}},wa=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?wa=ua:wa=va;return wa.apply(null,arguments)},xa=function(a,
b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}},ya=Date.now||function(){return+new Date},r=function(a,b){a=a.split(".");var c=k;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&m(b)?c[d]=b:c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}},t=function(a,b){function c(){}c.prototype=b.prototype;a.H=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.xb=function(a,
c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};var v=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,v);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))};t(v,Error);v.prototype.name="CustomError";var za=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Aa=function(a,b){a=String(a).toLowerCase();b=String(b).toLowerCase();return a<b?-1:a==b?0:1},Ba=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^ya()).toString(36)},Da=function(a,b){var c=0;a=za(String(a)).split(".");b=za(String(b)).split(".");for(var d=Math.max(a.length,b.length),e=0;0==c&&e<d;e++){var f=a[e]||"",g=b[e]||
"";do{f=/(\d*)(\D*)(.*)/.exec(f)||["","","",""];g=/(\d*)(\D*)(.*)/.exec(g)||["","","",""];if(0==f[0].length&&0==g[0].length)break;c=Ca(0==f[1].length?0:parseInt(f[1],10),0==g[1].length?0:parseInt(g[1],10))||Ca(0==f[2].length,0==g[2].length)||Ca(f[2],g[2]);f=f[3];g=g[3]}while(0==c)}return c},Ca=function(a,b){return a<b?-1:a>b?1:0};var Ea=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(n(a))return n(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Fa=Array.prototype.lastIndexOf?function(a,b,c){return Array.prototype.lastIndexOf.call(a,b,null==c?a.length-1:c)}:function(a,b,c){c=null==c?a.length-1:c;0>c&&(c=Math.max(0,a.length+c));if(n(a))return n(b)&&1==b.length?a.lastIndexOf(b,c):-1;for(;0<=
c;c--)if(c in a&&a[c]===b)return c;return-1},Ga=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=n(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Ha=Array.prototype.map?function(a,b,c){return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=n(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},Ia=function(a,b){a:{for(var c=a.length,d=n(a)?a.split(""):a,e=0;e<c;e++)if(e in
d&&b.call(void 0,d[e],e,a)){b=e;break a}b=-1}return 0>b?null:n(a)?a.charAt(b):a[b]},Ja=function(a){if(!oa(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0},La=function(a,b){b=Ea(a,b);var c;(c=0<=b)&&Ka(a,b);return c},Ka=function(a,b){Array.prototype.splice.call(a,b,1)},Ma=function(a){return Array.prototype.concat.apply([],arguments)},Na=function(a){return Array.prototype.concat.apply([],arguments)},Oa=function(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]},
Pa=function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(pa(d)){var e=a.length||0,f=d.length||0;a.length=e+f;for(var g=0;g<f;g++)a[e+g]=d[g]}else a.push(d)}},Ra=function(a,b,c,d){Array.prototype.splice.apply(a,Qa(arguments,1))},Qa=function(a,b,c){return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)},Sa=function(a,b){return a>b?1:a<b?-1:0};var Ta;a:{var Ua=k.navigator;if(Ua){var Va=Ua.userAgent;if(Va){Ta=Va;break a}}Ta=""}var w=function(a){return-1!=Ta.indexOf(a)};var Wa=function(a,b,c){for(var d in a)b.call(c,a[d],d,a)},Xa=function(a,b){for(var c in a)if(b.call(void 0,a[c],c,a))return!0;return!1},Ya=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b},Za=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b},x=function(a,b,c){b in a||(a[b]=c)},$a=function(a){var b={},c;for(c in a)b[c]=a[c];return b},ab="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),bb=function(a,b){for(var c,d,e=1;e<arguments.length;e++){d=
arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<ab.length;f++)c=ab[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var cb=function(){return(w("Chrome")||w("CriOS"))&&!w("Edge")};var db=function(){return w("iPhone")&&!w("iPod")&&!w("iPad")};var eb=function(a){eb[" "](a);return a};eb[" "]=q;var gb=function(a,b){var c=fb;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var hb=w("Opera"),y=w("Trident")||w("MSIE"),ib=w("Edge"),jb=w("Gecko")&&!(-1!=Ta.toLowerCase().indexOf("webkit")&&!w("Edge"))&&!(w("Trident")||w("MSIE"))&&!w("Edge"),kb=-1!=Ta.toLowerCase().indexOf("webkit")&&!w("Edge"),lb=function(){var a=k.document;return a?a.documentMode:void 0},mb;
a:{var nb="",ob=function(){var a=Ta;if(jb)return/rv\:([^\);]+)(\)|;)/.exec(a);if(ib)return/Edge\/([\d\.]+)/.exec(a);if(y)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(kb)return/WebKit\/(\S+)/.exec(a);if(hb)return/(?:Version)[ \/]?(\S+)/.exec(a)}();ob&&(nb=ob?ob[1]:"");if(y){var pb=lb();if(null!=pb&&pb>parseFloat(nb)){mb=String(pb);break a}}mb=nb}var qb=mb,fb={},rb=function(a){return gb(a,function(){return 0<=Da(qb,a)})},sb;var tb=k.document;
sb=tb&&y?lb()||("CSS1Compat"==tb.compatMode?parseInt(qb,10):5):void 0;var ub=function(a,b,c){this.g=c;this.c=a;this.f=b;this.b=0;this.a=null};ub.prototype.get=function(){if(0<this.b){this.b--;var a=this.a;this.a=a.next;a.next=null}else a=this.c();return a};var vb=function(a,b){a.f(b);a.b<a.g&&(a.b++,b.next=a.a,a.a=b)};var wb=function(a){k.setTimeout(function(){throw a;},0)},xb,yb=function(){var a=k.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!w("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=wa(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&&!w("Trident")&&!w("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(m(c.next)){c=c.next;var a=c.ua;c.ua=null;a()}};return function(a){d.next={ua: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){k.setTimeout(a,0)}};var zb=function(){this.b=this.a=null},Bb=new ub(function(){return new Ab},function(a){a.reset()},100);zb.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 Ab=function(){this.next=this.b=this.a=null};Ab.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};Ab.prototype.reset=function(){this.next=this.b=this.a=null};var Gb=function(a,b){Cb||Db();Eb||(Cb(),Eb=!0);var c=Fb,d=Bb.get();d.set(a,b);c.b?c.b.next=d:c.a=d;c.b=d},Cb,Db=function(){if(-1!=String(k.Promise).indexOf("[native code]")){var a=k.Promise.resolve(void 0);Cb=function(){a.then(Hb)}}else Cb=function(){var a=Hb;!qa(k.setImmediate)||k.Window&&k.Window.prototype&&!w("Edge")&&k.Window.prototype.setImmediate==k.setImmediate?(xb||(xb=yb()),xb(a)):k.setImmediate(a)}},Eb=!1,Fb=new zb,Hb=function(){for(var a;a=Fb.remove();){try{a.a.call(a.b)}catch(b){wb(b)}vb(Bb,
a)}Eb=!1};var z=function(a,b){this.a=0;this.i=void 0;this.f=this.b=this.c=null;this.g=this.h=!1;if(a!=q)try{var c=this;a.call(b,function(a){Ib(c,2,a)},function(a){Ib(c,3,a)})}catch(d){Ib(this,3,d)}},Jb=function(){this.next=this.context=this.b=this.f=this.a=null;this.c=!1};Jb.prototype.reset=function(){this.context=this.b=this.f=this.a=null;this.c=!1};
var Kb=new ub(function(){return new Jb},function(a){a.reset()},100),Lb=function(a,b,c){var d=Kb.get();d.f=a;d.b=b;d.context=c;return d},A=function(a){if(a instanceof z)return a;var b=new z(q);Ib(b,2,a);return b},Mb=function(a){return new z(function(b,c){c(a)})},Ob=function(a,b,c){Nb(a,b,c,null)||Gb(xa(b,a))},B=function(a){return new z(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,p;l<a.length;l++)p=a[l],Ob(p,xa(f,l),g);else b(e)})},C=
function(){var a,b,c=new z(function(c,e){a=c;b=e});return new Pb(c,a,b)};z.prototype.then=function(a,b,c){return Qb(this,qa(a)?a:null,qa(b)?b:null,c)};z.prototype.then=z.prototype.then;z.prototype.$goog_Thenable=!0;var D=function(a,b){b=Lb(b,b,void 0);b.c=!0;Rb(a,b);return a},E=function(a,b,c){return Qb(a,null,b,c)};z.prototype.cancel=function(a){0==this.a&&Gb(function(){var b=new F(a);Sb(this,b)},this)};
var Sb=function(a,b){if(0==a.a)if(a.c){var c=a.c;if(c.b){for(var d=0,e=null,f=null,g=c.b;g&&(g.c||(d++,g.a==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(0==c.a&&1==d?Sb(c,b):(f?(d=f,d.next==c.f&&(c.f=d),d.next=d.next.next):Tb(c),Ub(c,e,3,b)))}a.c=null}else Ib(a,3,b)},Rb=function(a,b){a.b||2!=a.a&&3!=a.a||Vb(a);a.f?a.f.next=b:a.b=b;a.f=b},Qb=function(a,b,c,d){var e=Lb(null,null,null);e.a=new z(function(a,g){e.f=b?function(c){try{var e=b.call(d,c);a(e)}catch(u){g(u)}}:a;e.b=c?function(b){try{var e=c.call(d,
b);!m(e)&&b instanceof F?g(b):a(e)}catch(u){g(u)}}:g});e.a.c=a;Rb(a,e);return e.a};z.prototype.l=function(a){this.a=0;Ib(this,2,a)};z.prototype.m=function(a){this.a=0;Ib(this,3,a)};
var Ib=function(a,b,c){0==a.a&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.a=1,Nb(c,a.l,a.m,a)||(a.i=c,a.a=b,a.c=null,Vb(a),3!=b||c instanceof F||Wb(a,c)))},Nb=function(a,b,c,d){if(a instanceof z)return Rb(a,Lb(b||q,c||null,d)),!0;if(a)try{var e=!!a.$goog_Thenable}catch(g){e=!1}else e=!1;if(e)return a.then(b,c,d),!0;if(ra(a))try{var f=a.then;if(qa(f))return Xb(a,f,b,c,d),!0}catch(g){return c.call(d,g),!0}return!1},Xb=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(p){l(p)}},Vb=function(a){a.h||(a.h=!0,Gb(a.j,a))},Tb=function(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.f=null);return b};z.prototype.j=function(){for(var a;a=Tb(this);)Ub(this,a,this.a,this.i);this.h=!1};
var Ub=function(a,b,c,d){if(3==c&&b.b&&!b.c)for(;a&&a.g;a=a.c)a.g=!1;if(b.a)b.a.c=null,Yb(b,c,d);else try{b.c?b.f.call(b.context):Yb(b,c,d)}catch(e){Zb.call(null,e)}vb(Kb,b)},Yb=function(a,b,c){2==b?a.f.call(a.context,c):a.b&&a.b.call(a.context,c)},Wb=function(a,b){a.g=!0;Gb(function(){a.g&&Zb.call(null,b)})},Zb=wb,F=function(a){v.call(this,a)};t(F,v);F.prototype.name="cancel";var Pb=function(a,b,c){this.a=a;this.b=b;this.c=c};var G=function(){return A("")};var H=function(a){this.type=a};r("castApp.protocol.Message",H);var $b=function(a){this.type=a;this.requestId=Ba()};t($b,H);r("castApp.protocol.Request",$b);var I=function(a,b){this.type=a;this.responseTo=b.requestId};t(I,H);r("castApp.protocol.Response",I);var ac=function(a,b){I.call(this,"Error",a);this.errorName=b||"err-unknown"};t(ac,I);r("castApp.protocol.Error",ac);var bc=function(){};r("castApp.protocol.Handshake",bc);var cc=function(){$b.call(this,"Handshake.Request");this.coreVersion=6};
t(cc,$b);bc.Request=cc;var dc=function(a){I.call(this,"Handshake.Response",a);this.version=6;this.latestVersion=void 0};t(dc,I);bc.Response=dc;var ec=function(a,b){I.call(this,"Handshake.UiVersionNotSupported",a);this.latestVersion=b};t(ec,I);bc.UiVersionNotSupported=ec;var fc=function(a){this.type="SetSimpleState";this.state=a};t(fc,H);r("castApp.protocol.SetSimpleState",fc);var gc=function(){};r("castApp.protocol.ModalDialog",gc);
var hc=function(a){$b.call(this,"ModalDialog.Request");this.dialogId=a};t(hc,$b);gc.Request=hc;var ic=function(a,b){I.call(this,"ModalDialog.Response",a);this.button=b};t(ic,I);gc.Response=ic;var jc=function(a,b){this.type=a;this.deviceType=b};t(jc,H);r("castApp.protocol.MessageWithDeviceType",jc);var kc=function(){};r("castApp.protocol.DeviceDiscovery",kc);var lc=function(a){this.type="DeviceDiscovery.ShowScanner";this.showTips=a};t(lc,H);kc.ShowScanner=lc;var mc=function(){};
r("castApp.protocol.SetupStart",mc);var nc=function(a,b,c){this.type="SetupStart.ShowDevice";this.state=a;this.deviceType=b;this.deviceName=c;this.analyticsOptIn=this.otherDevicesExist=!1};t(nc,H);mc.ShowDevice=nc;var oc=function(a){this.type="SetupStart.TosAccepted";this.analyticsOptIn=a};t(oc,H);mc.TosAccepted=oc;var pc=function(){};r("castApp.protocol.WiFiSwitching",pc);var qc=function(a,b,c){this.type="WiFiSwitching.ConnectHotSpot";this.state=a;this.deviceName=b;this.ssid=c};t(qc,H);
pc.ConnectHotSpot=qc;var rc=function(a,b){this.type="WiFiSwitching.ReconnectWiFi";this.state=a;this.ssid=b};t(rc,H);pc.ReconnectWiFi=rc;var sc=function(){};r("castApp.protocol.CodeConfirmation",sc);var tc=function(a){$b.call(this,"CodeConfirmation.Request");this.code=a};t(tc,$b);sc.Request=tc;var uc=function(a,b){I.call(this,"CodeConfirmation.Response",a);this.confirmed=b};t(uc,I);sc.Response=uc;var vc=function(){};r("castApp.protocol.AudioConfirmation",vc);
var wc=function(a){this.type="AudioConfirmation.PromptUser";this.state=a};t(wc,H);vc.PromptUser=wc;var xc=function(a){this.type="AudioConfirmation.UserAction";this.action=a};t(xc,H);vc.UserAction=xc;var yc=function(){};r("castApp.protocol.DeviceConfig",yc);var zc=function(a,b,c){$b.call(this,"DeviceConfig.Request");this.deviceType=a;this.name=b;this.country=c};t(zc,$b);yc.Request=zc;var Ac=function(a,b,c){I.call(this,"DeviceConfig.Response",a);this.name=b;this.country=c};t(Ac,I);yc.Response=Ac;
var Bc=function(){};r("castApp.protocol.WiFiConfig",Bc);var Cc=function(a,b,c){this.id=a;this.ssid=b;this.security=c};Bc.Network=Cc;var Dc=function(a,b,c,d){this.type="WiFiConfig.Show";this.state=a;this.deviceType=b;this.networks=c;this.selectedNetwork=d};t(Dc,H);Bc.Show=Dc;var Ec=function(a){this.type="WiFiConfig.UpdateNetworks";this.networks=a};t(Ec,H);Bc.UpdateNetworks=Ec;var Fc=function(a,b){this.type="WiFiConfig.Connect";this.network=a;this.password=b};t(Fc,H);Bc.Connect=Fc;
var Gc=function(a){this.type="WiFiConfig.Retry";this.network=a};t(Gc,H);Bc.Retry=Gc;var Hc=function(){};r("castApp.protocol.Features",Hc);var Ic=function(){};Hc.DeviceSettings=Ic;var Jc=function(){this.supportsDisplay=this.supportsSetup=!1};Hc.Device=Jc;var Kc=function(){};r("castApp.protocol.Devices",Kc);var Lc=function(a,b,c){this.id=a;this.type=b;this.displayName=c};Kc.DeviceProperties=Lc;var Mc=function(a,b){this.type="Devices.Show";this.devices=a;this.deviceName=b};t(Mc,H);Kc.Show=Mc;
var Nc=function(a,b){this.type="Devices.UserAction";this.device=a;this.action=b};t(Nc,H);Kc.UserAction=Nc;var Oc=function(){};r("castApp.protocol.DeviceSettings",Oc);var Pc=function(a,b){this.localeId=a;this.displayString=b};Oc.Locale=Pc;var Qc=function(a,b,c){this.timeZoneId=a;this.displayString=b;this.offset=c};Oc.TimeZone=Qc;
var Rc=function(a,b,c){this.type="DeviceSettings.Show";this.state=a;this.features=b;this.deviceType=c.deviceType;this.name=c.name;this.ssid=c.ssid;this.timeZoneId=c.timeZoneId;this.supportedTimeZones=c.supportedTimeZones;this.timeFormat=c.timeFormat;this.localeId=c.localeId;this.supportedLocales=c.supportedLocales;this.statsOptIn=c.statsOptIn;this.firmwareVersion=c.firmwareVersion;this.countryCode=c.countryCode;this.macAddress=c.macAddress;this.ipAddress=c.ipAddress};t(Rc,H);Oc.Show=Rc;
var Sc=function(a){this.type="DeviceSettings.Apply";this.name=a.name;this.timeZoneId=a.timeZoneId;this.timeFormat=a.timeFormat;this.localeId=a.localeId;this.statsOptIn=a.statsOptIn};t(Sc,H);Oc.Apply=Sc;var Tc=function(){};r("castApp.protocol.DetectCountry",Tc);var Uc=function(){$b.call(this,"DetectCountry.Request")};t(Uc,$b);Tc.Request=Uc;var Vc=function(a,b){I.call(this,"DetectCountry.Response",a);this.countryCode=b};t(Vc,I);Tc.Response=Vc;var Wc=function(){};r("castApp.protocol.Offers",Wc);
var Xc=function(){this.type="Offers.Scan";this.scanId=Ba()};t(Xc,H);Wc.Scan=Xc;var Yc=function(a,b,c,d){this.token=a;this.displayName=b;this.deviceType=c;this.ssdpUdn=d};Wc.Device=Yc;var Zc=function(a,b,c){this.type="Offers.ScanResults";this.scanId=a;this.devices=b;this.scanComplete=c};t(Zc,H);Wc.ScanResults=Zc;var $c=function(a){this.type="Offers.Redeem";this.url=a};t($c,H);Wc.Redeem=$c;var ad=function(a,b){this.type="Offers.AnalyticsEvent";this.eventType=a;this.offerId=b};t(ad,H);
Wc.AnalyticsEvent=ad;var bd=function(a,b){this.b=[];this.a=b;for(var c=!0,d=a.length-1;0<=d;d--){var e=a[d]|0;c&&e==b||(this.b[d]=e,c=!1)}},cd={},dd=function(a){if(-128<=a&&128>a){var b=cd[a];if(b)return b}b=new bd([a|0],0>a?-1:0);-128<=a&&128>a&&(cd[a]=b);return b},fd=function(a){if(isNaN(a)||!isFinite(a))return ed;if(0>a)return J(fd(-a));for(var b=[],c=1,d=0;a>=c;d++)b[d]=a/c|0,c*=4294967296;return new bd(b,0)},gd=function(a,b){if(0==a.length)throw Error("number format error: empty string");b=b||10;if(2>b||36<b)throw Error("radix out of range: "+
b);if("-"==a.charAt(0))return J(gd(a.substring(1),b));if(0<=a.indexOf("-"))throw Error('number format error: interior "-" character');for(var c=fd(Math.pow(b,8)),d=ed,e=0;e<a.length;e+=8){var f=Math.min(8,a.length-e),g=parseInt(a.substring(e,e+f),b);8>f?(f=fd(Math.pow(b,f)),d=hd(id(d,f),fd(g))):(d=id(d,c),d=hd(d,fd(g)))}return d},ed=dd(0),jd=dd(1),kd=dd(16777216),ld=function(a){if(-1==a.a)return-ld(J(a));for(var b=0,c=1,d=0;d<a.b.length;d++)b+=md(a,d)*c,c*=4294967296;return b};
bd.prototype.toString=function(a){a=a||10;if(2>a||36<a)throw Error("radix out of range: "+a);if(nd(this))return"0";if(-1==this.a)return"-"+J(this).toString(a);for(var b=fd(Math.pow(a,6)),c=this,d="";;){var e=od(c,b);c=pd(c,id(e,b));var f=((0<c.b.length?c.b[0]:c.a)>>>0).toString(a);c=e;if(nd(c))return f+d;for(;6>f.length;)f="0"+f;d=""+f+d}};
var L=function(a,b){return 0>b?0:b<a.b.length?a.b[b]:a.a},md=function(a,b){a=L(a,b);return 0<=a?a:4294967296+a},nd=function(a){if(0!=a.a)return!1;for(var b=0;b<a.b.length;b++)if(0!=a.b[b])return!1;return!0},qd=function(a,b){a=pd(a,b);return-1==a.a?-1:nd(a)?0:1},J=function(a){for(var b=a.b.length,c=[],d=0;d<b;d++)c[d]=~a.b[d];a=new bd(c,~a.a);return hd(a,jd)},hd=function(a,b){for(var c=Math.max(a.b.length,b.b.length),d=[],e=0,f=0;f<=c;f++){var g=e+(L(a,f)&65535)+(L(b,f)&65535),l=(g>>>16)+(L(a,f)>>>
16)+(L(b,f)>>>16);e=l>>>16;g&=65535;l&=65535;d[f]=l<<16|g}return new bd(d,d[d.length-1]&-2147483648?-1:0)},pd=function(a,b){return hd(a,J(b))},id=function(a,b){if(nd(a)||nd(b))return ed;if(-1==a.a)return-1==b.a?id(J(a),J(b)):J(id(J(a),b));if(-1==b.a)return J(id(a,J(b)));if(0>qd(a,kd)&&0>qd(b,kd))return fd(ld(a)*ld(b));for(var c=a.b.length+b.b.length,d=[],e=0;e<2*c;e++)d[e]=0;for(e=0;e<a.b.length;e++)for(var f=0;f<b.b.length;f++){var g=L(a,e)>>>16,l=L(a,e)&65535,p=L(b,f)>>>16,u=L(b,f)&65535;d[2*e+
2*f]+=l*u;rd(d,2*e+2*f);d[2*e+2*f+1]+=g*u;rd(d,2*e+2*f+1);d[2*e+2*f+1]+=l*p;rd(d,2*e+2*f+1);d[2*e+2*f+2]+=g*p;rd(d,2*e+2*f+2)}for(e=0;e<c;e++)d[e]=d[2*e+1]<<16|d[2*e];for(e=c;e<2*c;e++)d[e]=0;return new bd(d,0)},rd=function(a,b){for(;(a[b]&65535)!=a[b];)a[b+1]+=a[b]>>>16,a[b]&=65535,b++},od=function(a,b){if(nd(b))throw Error("division by zero");if(nd(a))return ed;if(-1==a.a)return-1==b.a?od(J(a),J(b)):J(od(J(a),b));if(-1==b.a)return J(od(a,J(b)));if(30<a.b.length){if(-1==a.a||-1==b.a)throw Error("slowDivide_ only works with positive integers.");
for(var c=jd;0>=qd(b,a);)c=sd(c,1),b=sd(b,1);var d=td(c,1),e=td(b,1);b=td(b,2);for(c=td(c,2);!nd(b);){var f=hd(e,b);0>=qd(f,a)&&(d=hd(d,c),e=f);b=td(b,1);c=td(c,1)}return d}for(c=ed;0<=qd(a,b);){d=Math.max(1,Math.floor(ld(a)/ld(b)));e=Math.ceil(Math.log(d)/Math.LN2);e=48>=e?1:Math.pow(2,e-48);f=fd(d);for(var g=id(f,b);-1==g.a||0<qd(g,a);)d-=e,f=fd(d),g=id(f,b);nd(f)&&(f=jd);c=hd(c,f);a=pd(a,g)}return c},ud=function(a,b){for(var c=Math.max(a.b.length,b.b.length),d=[],e=0;e<c;e++)d[e]=L(a,e)|L(b,e);
return new bd(d,a.a|b.a)},sd=function(a,b){var c=b>>5;b%=32;for(var d=a.b.length+c+(0<b?1:0),e=[],f=0;f<d;f++)e[f]=0<b?L(a,f-c)<<b|L(a,f-c-1)>>>32-b:L(a,f-c);return new bd(e,a.a)},td=function(a,b){var c=b>>5;b%=32;for(var d=a.b.length-c,e=[],f=0;f<d;f++)e[f]=0<b?L(a,f+c)>>>b|L(a,f+c+1)<<32-b:L(a,f+c);return new bd(e,a.a)};var vd=function(a){this.a=a},yd=function(a){try{return-1!=a.indexOf(":")?new wd(a):new xd(a)}catch(b){return null}},xd=function(a){this.b=null;var b=ed;if(a instanceof bd){if(0!=a.a||0>qd(a,ed)||0<qd(a,zd))throw Error("The address does not look like an IPv4.");b=$a(a)}else{if(!Ad.test(a))throw Error(a+" does not look like an IPv4 address.");var c=a.split(".");if(4!=c.length)throw Error(a+" does not look like an IPv4 address.");for(var d=0;d<c.length;d++){var e=c[d];var f=Number(e);e=0==f&&/^[\s\xa0]*$/.test(e)?
NaN:f;if(isNaN(e)||0>e||255<e||1!=c[d].length&&0==c[d].lastIndexOf("0",0))throw Error("In "+a+", octet "+d+" is not valid");e=fd(e);b=ud(sd(b,8),e)}}this.a=b};t(xd,vd);var Ad=/^[0-9.]*$/,zd=pd(sd(jd,32),jd);xd.prototype.toString=function(){if(this.b)return this.b;for(var a=md(this.a,0),b=[],c=3;0<=c;c--)b[c]=String(a&255),a>>>=8;return this.b=b.join(".")};
var wd=function(a){this.b=null;var b=ed;if(a instanceof bd){if(0!=a.a||0>qd(a,ed)||0<qd(a,Bd))throw Error("The address does not look like a valid IPv6.");b=$a(a)}else{if(!Cd.test(a))throw Error(a+" is not a valid IPv6 address.");var c=a.split(":");if(-1!=c[c.length-1].indexOf(".")){a=md($a((new xd(c[c.length-1])).a),0);var d=[];d.push((a>>>16&65535).toString(16));d.push((a&65535).toString(16));Ka(c,c.length-1);Pa(c,d);a=c.join(":")}d=a.split("::");if(2<d.length||1==d.length&&8!=c.length)throw Error(a+
" is not a valid IPv6 address.");if(1<d.length){c=d[0].split(":");d=d[1].split(":");1==c.length&&""==c[0]&&(c=[]);1==d.length&&""==d[0]&&(d=[]);var e=8-(c.length+d.length);if(1>e)c=[];else{for(var f=[],g=0;g<e;g++)f[g]="0";c=Na(c,f,d)}}if(8!=c.length)throw Error(a+" is not a valid IPv6 address");for(d=0;d<c.length;d++){e=gd(c[d],16);if(0>qd(e,ed)||0<qd(e,Dd))throw Error(c[d]+" in "+a+" is not a valid hextet.");b=ud(sd(b,16),e)}}this.a=b};t(wd,vd);
var Cd=/^([a-fA-F0-9]*:){2}[a-fA-F0-9:.]*$/,Dd=dd(65535),Bd=pd(sd(jd,128),jd);wd.prototype.toString=function(){if(this.b)return this.b;for(var a=[],b=3;0<=b;b--){var c=md(this.a,b),d=c&65535;a.push((c>>>16).toString(16));a.push(d.toString(16))}c=b=-1;for(var e=d=0,f=0;f<a.length;f++)"0"==a[f]?(e++,-1==c&&(c=f),e>d&&(d=e,b=c)):(c=-1,e=0);0<d&&(b+d==a.length&&a.push(""),a.splice(b,d,""),0==b&&(a=[""].concat(a)));return this.b=a.join(":")};var Ed="StopIteration"in k?k.StopIteration:{message:"StopIteration",stack:""},Fd=function(){};Fd.prototype.next=function(){throw Ed;};Fd.prototype.M=function(){return this};
var Gd=function(a){if(a instanceof Fd)return a;if("function"==typeof a.M)return a.M(!1);if(pa(a)){var b=0,c=new Fd;c.next=function(){for(;;){if(b>=a.length)throw Ed;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");},Hd=function(a,b){if(pa(a))try{Ga(a,b,void 0)}catch(c){if(c!==Ed)throw c;}else{a=Gd(a);try{for(;;)b.call(void 0,a.next(),void 0,a)}catch(c){if(c!==Ed)throw c;}}},Id=function(a,b){var c=null;Hd(a,function(a){c=b.call(void 0,c,a)});return c},Jd=function(a,b){a=Gd(a);
try{for(;;)if(!b.call(void 0,a.next(),void 0,a))return!1}catch(c){if(c!==Ed)throw c;}return!0};var M=function(a,b){this.b={};this.a=[];this.f=this.c=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 if(a){a instanceof M?(c=a.C(),d=a.u()):(c=Za(a),d=Ya(a));for(var e=0;e<c.length;e++)this.set(c[e],d[e])}};M.prototype.s=function(){return this.c};M.prototype.u=function(){Kd(this);for(var a=[],b=0;b<this.a.length;b++)a.push(this.b[this.a[b]]);return a};M.prototype.C=function(){Kd(this);return this.a.concat()};
var Md=function(a,b){return Ld(a.b,b)};M.prototype.clear=function(){this.b={};this.f=this.c=this.a.length=0};M.prototype.remove=function(a){return Ld(this.b,a)?(delete this.b[a],this.c--,this.f++,this.a.length>2*this.c&&Kd(this),!0):!1};var Kd=function(a){if(a.c!=a.a.length){for(var b=0,c=0;b<a.a.length;){var d=a.a[b];Ld(a.b,d)&&(a.a[c++]=d);b++}a.a.length=c}if(a.c!=a.a.length){var e={};for(c=b=0;b<a.a.length;)d=a.a[b],Ld(e,d)||(a.a[c++]=d,e[d]=1),b++;a.a.length=c}};
M.prototype.get=function(a,b){return Ld(this.b,a)?this.b[a]:b};M.prototype.set=function(a,b){Ld(this.b,a)||(this.c++,this.a.push(a),this.f++);this.b[a]=b};M.prototype.forEach=function(a,b){for(var c=this.C(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};M.prototype.M=function(a){Kd(this);var b=0,c=this.f,d=this,e=new Fd;e.next=function(){if(c!=d.f)throw Error("The map has changed since the iterator was created");if(b>=d.a.length)throw Ed;var e=d.a[b++];return a?e:d.b[e]};return e};
var Ld=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var Nd=function(a){if(a.u&&"function"==typeof a.u)return a.u();if(n(a))return a.split("");if(pa(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Ya(a)},Od=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);else if(pa(a)||n(a))Ga(a,b,void 0);else{if(a.C&&"function"==typeof a.C)var c=a.C();else if(a.u&&"function"==typeof a.u)c=void 0;else if(pa(a)||n(a)){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=Za(a);d=Nd(a);e=d.length;for(var f=0;f<e;f++)b.call(void 0,
d[f],c&&c[f],a)}};var Pd=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/,Qd=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," ")):"")}}};var Rd=function(a,b){this.f=this.j=this.c="";this.h=null;this.g=this.b="";this.a=!1;if(a instanceof Rd){this.a=m(b)?b:a.a;Sd(this,a.c);this.j=a.j;this.f=a.f;Td(this,a.h);this.b=a.b;b=a.i;var c=new Ud;c.c=b.c;b.a&&(c.a=new M(b.a),c.b=b.b);Vd(this,c);this.g=a.g}else a&&(c=String(a).match(Pd))?(this.a=!!b,Sd(this,c[1]||"",!0),this.j=Wd(c[2]||""),this.f=Wd(c[3]||"",!0),Td(this,c[4]),this.b=Wd(c[5]||"",!0),Vd(this,c[6]||"",!0),this.g=Wd(c[7]||"")):(this.a=!!b,this.i=new Ud(null,0,this.a))};
Rd.prototype.toString=function(){var a=[],b=this.c;b&&a.push(Xd(b,Yd,!0),":");var c=this.f;if(c||"file"==b)a.push("//"),(b=this.j)&&a.push(Xd(b,Yd,!0),"@"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.h,null!=c&&a.push(":",String(c));if(c=this.b)this.f&&"/"!=c.charAt(0)&&a.push("/"),a.push(Xd(c,"/"==c.charAt(0)?Zd:$d,!0));(c=this.i.toString())&&a.push("?",c);(c=this.g)&&a.push("#",Xd(c,ae));return a.join("")};
var Sd=function(a,b,c){a.c=c?Wd(b,!0):b;a.c&&(a.c=a.c.replace(/:$/,""))},Td=function(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.h=b}else a.h=null},Vd=function(a,b,c){b instanceof Ud?(a.i=b,be(a.i,a.a)):(c||(b=Xd(b,ce)),a.i=new Ud(b,0,a.a))},de=function(a){return a instanceof Rd?new Rd(a):new Rd(a,void 0)},Wd=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},Xd=function(a,b,c){return n(a)?(a=encodeURI(a).replace(b,ee),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,
"%$1")),a):null},ee=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},Yd=/[#\/\?@]/g,$d=/[\#\?:]/g,Zd=/[\#\?]/g,ce=/[\#\?@]/g,ae=/#/g,Ud=function(a,b,c){this.b=this.a=null;this.c=a||null;this.f=!!c},fe=function(a){a.a||(a.a=new M,a.b=0,a.c&&Qd(a.c,function(b,c){b=decodeURIComponent(b.replace(/\+/g," "));fe(a);a.c=null;b=ge(a,b);var d=a.a.get(b);d||a.a.set(b,d=[]);d.push(c);a.b+=1}))};Ud.prototype.s=function(){fe(this);return this.b};
Ud.prototype.remove=function(a){fe(this);a=ge(this,a);return Md(this.a,a)?(this.c=null,this.b-=this.a.get(a).length,this.a.remove(a)):!1};Ud.prototype.clear=function(){this.a=this.c=null;this.b=0};var he=function(a,b){fe(a);b=ge(a,b);return Md(a.a,b)};h=Ud.prototype;h.forEach=function(a,b){fe(this);this.a.forEach(function(c,d){Ga(c,function(c){a.call(b,c,d,this)},this)},this)};
h.C=function(){fe(this);for(var a=this.a.u(),b=this.a.C(),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.u=function(a){fe(this);var b=[];if(n(a))he(this,a)&&(b=Ma(b,this.a.get(ge(this,a))));else{a=this.a.u();for(var c=0;c<a.length;c++)b=Ma(b,a[c])}return b};h.set=function(a,b){fe(this);this.c=null;a=ge(this,a);he(this,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.u(a):[];return 0<a.length?String(a[0]):b};
h.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var a=[],b=this.a.C(),c=0;c<b.length;c++){var d=b[c],e=encodeURIComponent(String(d));d=this.u(d);for(var f=0;f<d.length;f++){var g=e;""!==d[f]&&(g+="="+encodeURIComponent(String(d[f])));a.push(g)}}return this.c=a.join("&")};
var ge=function(a,b){b=String(b);a.f&&(b=b.toLowerCase());return b},be=function(a,b){b&&!a.f&&(fe(a),a.c=null,a.a.forEach(function(a,b){var c=b.toLowerCase();b!=c&&(this.remove(b),this.remove(c),0<a.length&&(this.c=null,this.a.set(ge(this,c),Oa(a)),this.b+=a.length))},a));a.f=b};r("castApp.core.setupApi.ConfiguredNetworkMsg",function(a,b,c,d){this.ssid=a;this.wpa_auth=b;this.wpa_cipher=c;this.wpa_id=d});var ie=function(a,b){this.ssid=a;this.wpa_auth=b};r("castApp.core.setupApi.ConnectWiFiMsg",ie);var je=function(a,b,c,d,e,f,g,l,p,u,K){this.version=a;this.name=b;this.build_version=c;this.has_update=d;this.ssdp_udn=e;this.mac_address=f;this.connected=g;this.ssid=l;this.wpa_state=p;this.setup_state=u;this.wpa_configured=K};r("castApp.core.setupApi.EurekaInfoMsg34Base",je);
var ke=function(a,b,c,d,e,f,g,l,p,u){je.call(this,3,a,b,c,d,e,f,g,l,p,u)};t(ke,je);r("castApp.core.setupApi.EurekaInfoMsgV3",ke);ke.Location=function(a,b){this.latitude=a;this.longitude=b};var le=function(a,b,c){this.certificate=a;this.nonce=b;this.signed_data=c};ke.Sign=le;var me=function(){};ke.Detail=me;me.Timezone=function(a,b){this.display_string=a;this.offset=b};me.Locale=function(a){this.display_string=a};
var ne=function(a,b,c,d,e,f,g,l,p,u,K,Zg){je.call(this,a,b,c,d,e,f,g,l,p,u,K);this.uptime=Zg};t(ne,je);r("castApp.core.setupApi.EurekaInfoMsgV4",ne);
var oe=function(a){x(a,"locale","en-US");x(a,"debug_build",!1);x(a,"update_only_build",!1);x(a,"ethernet_connected",!1);x(a,"tos_accepted",!0);x(a,"time_format",0);x(a,"hdmi_control",!0);!n(a.hotspot_bssid)&&a.mac_address&&5<=a.mac_address.length&&(a.hotspot_bssid="00:1A:11:FF:"+a.mac_address.substr(a.mac_address.length-5));if(a.opt_in){var b=a.opt_in;x(b,"crash",!0);x(b,"stats",!0);x(b,"device_id",!1);x(b,"location",!1);x(b,"opencast",!1)}return a};ne.SetupStats=function(){};var pe=function(){};
ne.Location=pe;var qe=function(){};ne.OptIn=qe;var re=function(a,b,c){le.call(this,a,b,c)};t(re,le);ne.Sign=re;var se=function(a){this.manufacturer="Google Inc.";this.model_name="Eureka Dongle";this.icon_list=a};t(se,me);ne.Detail=se;se.Icon=function(a,b,c,d){this.mimetype="image/png";this.width=a;this.height=b;this.depth=c;this.url=d};var te=function(){};r("castApp.core.setupApi.EurekaInfoMsgV7",te);
var ue=function(a){if(a.device_info){var b=a.device_info;!b.hotspot_bssid&&b.mac_address&&(b.hotspot_bssid="00:1A:11:FF:"+b.mac_address.substr(b.mac_address.length-5));b.capabilities&&(b=b.capabilities,x(b,"display_supported",!0),x(b,"wifi_supported",!0),x(b,"wifi_regulatory_domain_locked",!1),x(b,"hotspot_supported",!0),x(b,"ble_supported",!1),x(b,"multizone_supported",!1))}a.net&&x(a.net,"ethernet_connected",!1);a.setup&&x(a.setup,"tos_accepted",!0);a.settings&&(b=a.settings,x(b,"time_format",1),
x(b,"locale","en-US"));return a};te.BuildInfo=function(){};var ve=function(){};te.DeviceInfo=ve;ve.Capabilities=function(){};te.OtaStatus=function(){};te.Net=function(){};te.WiFi=function(){};var we=function(){};te.Setup=we;we.Stats=function(){};var xe=function(){};te.Settings=xe;var ye=function(){};te.OptIn=ye;te.OpenCast=function(){};te.Multizone=function(){};var ze=function(a){this.wpa_id=a};r("castApp.core.setupApi.ForgetWiFiMsg",ze);
r("castApp.core.setupApi.GetAppDeviceIdRequestMsg",function(a){this.app_id=a});r("castApp.core.setupApi.GetAppDeviceIdResponseMsg",function(a,b,c){this.app_device_id=a;this.certificate=b;this.signed_data=c});r("castApp.core.setupApi.OfferMsg",function(a){this.token=a});var Ae=function(a){this.sound_id=a};r("castApp.core.setupApi.PlaySoundRequestMsg",Ae);r("castApp.core.setupApi.PlaySoundResponseMsg",function(a,b){this.volume=a;this.duration=b});var Be=function(a){this.params=a};
r("castApp.core.setupApi.RebootMsg",Be);var Ce=function(a,b,c,d,e){this.ssid=a;this.wpa_auth=b;this.wpa_cipher=c;this.bssid=d;this.signal_level=e};r("castApp.core.setupApi.ScanResultMsgBase",Ce);var De=function(a,b,c,d,e,f){Ce.call(this,a,b,c,d,e);this.ap_list=f};t(De,Ce);r("castApp.core.setupApi.ScanResultMsgV7",De);De.Ap=function(a,b,c){this.bssid=a;this.signal_level=b;this.frequency=c};var Ee=function(){};r("castApp.core.setupApi.SaveWiFiRequestMsg",Ee);
r("castApp.core.setupApi.SaveWiFiResponseMsg",function(a){this.setup_state=a});r("castApp.core.setupApi.SendLogReportRequestMsg",function(a){this.uuid=a});r("castApp.core.setupApi.SendLogReportResponseMsg",function(a){this.crash_report_id=a});var Fe=function(){};r("castApp.core.setupApi.SetEurekaInfoMsgBase",Fe);var Ge=function(){};t(Ge,Fe);r("castApp.core.setupApi.SetEurekaInfoMsgV3",Ge);var He=function(){};t(He,Fe);r("castApp.core.setupApi.SetEurekaInfoMsgV4",He);var Ie=function(){};t(Ie,Fe);
r("castApp.core.setupApi.SetEurekaInfoMsgV7",Ie);r("castApp.core.setupApi.SupportedLocale",function(a,b){this.locale=a;this.display_string=b});r("castApp.core.setupApi.SupportedTimeZone",function(a,b,c){this.timezone=a;this.display_string=b;this.offset=c});var Je=function(a){this.id=a};r("castApp.core.storage.SetupSession",Je);var Ke=function(){};r("castApp.core.storage.CommonSetupState",Ke);var Le=function(a){this.type=a.type;this.name=a.name;this.bssid=a.bssid;this.ssid=a.ssid;this.ipAddress=a.ipAddress};r("castApp.core.storage.DeviceToSetUp",Le);var Me=function(a){this.deviceIpAddress=a};r("castApp.core.storage.SetupApiClientState",Me);var Ne=function(a){this.msg=a};r("castApp.core.storage.ConnectWiFiState",Ne);
r("castApp.core.storage.EurekaInfoState",function(a,b,c,d,e,f,g,l){this.setupApiVersion=a;this.name=b;this.setupState=c;this.ssdpUdn=d;this.deviceType=e;this.features=f;this.ethernetConnected=g;this.tosAccepted=l});var Oe=function(a,b){this.timeStamp=a;this.verificationProperties=b};r("castApp.core.storage.VerificationState",Oe);var N=function(a){this.type=a};r("castApp.core.storage.SetupState",N);var Pe=function(a,b){this.all=b;this.current=a};r("castApp.core.storage.SetupStateCollection",Pe);
var Qe=function(a,b,c){this.type=a;this.time=b;this.deviceId=c},Re=function(a){for(var b=[],c=0,d=a.length;c<d;++c){var e=a.key(c);if(e&&0==e.lastIndexOf("setupSession_",0)){a:{var f=a,g=f.getItem(e);if(g)try{var l=JSON.parse(g);break a}catch(p){f.removeItem(e)}l=null}l&&b.push(l)}}return b},Se=function(){var a=ya()-432E5;Re(window.localStorage).forEach(function(b){(!b.timestamp||b.timestamp<a)&&window.localStorage.removeItem("setupSession_"+b.id)})},Te=function(a,b){b.timestamp=ya();a.setItem("setupSession_"+
b.id,JSON.stringify(b))},Ue=function(a,b){a.removeItem("setupSession_"+b.id)},Ve=function(a){var b=a.getItem("setupDeviceState");if(b)try{return JSON.parse(b)}catch(c){a.removeItem("setupDeviceState")}return[]},We=function(a,b){0===b.length?a.removeItem("setupDeviceState"):a.setItem("setupDeviceState",JSON.stringify(b))},Xe=function(a){return"false"===a.getItem("setupAutoNetworkSwitching")?!1:!0},Ye=function(a,b){1===b?a.removeItem("castApp.analyticsOptIn"):a.setItem("castApp.analyticsOptIn",b.toString())};var Ze=function(){},$e=function(){};t($e,Ze);$e.prototype.b=function(){};$e.prototype.f=function(){};$e.prototype.a=function(){return A(3)};$e.prototype.h=function(){};var af=function(a){this.g=chrome.metricsPrivate;this.c=a};t(af,Ze);af.prototype.b=function(a){this.g.recordUserAction("Cast.Chrome.App."+a.toString())};
af.prototype.f=function(a){switch(a.eventType){case 1:var b="List";break;case 2:b="View";break;case 3:b="Redeem";break;default:return}b="Cast.Chrome.App.Offers."+b;if(m(a.offerId)){if(!ma(a.offerId)||0>a.offerId)return;b+="."+a.offerId}this.g.recordUserAction(b)};af.prototype.a=function(){var a=parseInt(this.c.getItem("castApp.analyticsOptIn"),10);if(isNaN(a)||1>a||3<a)a=1;return A(a)};af.prototype.h=function(a){a?(Ye(this.c,2),this.b(1)):(Ye(this.c,3),this.b(2))};var bf=function(){this.g=this.g;this.v=this.v};bf.prototype.g=!1;bf.prototype.ca=function(){this.g||(this.g=!0,this.F())};bf.prototype.F=function(){if(this.v)for(;this.v.length;)this.v.shift()()};var cf=!y||9<=Number(sb),df=y&&!rb("9");!kb||rb("528");jb&&rb("1.9b")||y&&rb("8")||hb&&rb("9.5")||kb&&rb("528");jb&&!rb("8")||y&&rb("9");var ef=function(){if(!k.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});k.addEventListener("test",q,b);k.removeEventListener("test",q,b);return a}();var O=function(a,b){this.type=a;this.a=this.target=b;this.Da=!0};O.prototype.b=function(){this.Da=!1};var gf=function(a,b){O.call(this,a?a.type:"");this.relatedTarget=this.a=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.state=null;this.pointerId=0;this.pointerType="";this.c=null;if(a){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.a=b;if(b=a.relatedTarget){if(jb){a:{try{eb(b.nodeName);var e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"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.pointerId=a.pointerId||0;this.pointerType=n(a.pointerType)?a.pointerType:ff[a.pointerType]||"";this.state=a.state;this.c=a;a.defaultPrevented&&this.b()}};t(gf,O);var ff={2:"touch",3:"pen",4:"mouse"};gf.prototype.b=function(){gf.H.b.call(this);var a=this.c;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,df)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var hf="closure_listenable_"+(1E6*Math.random()|0),jf=function(a){return!(!a||!a[hf])},kf=0;var lf=function(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.ga=e;this.key=++kf;this.removed=this.ba=!1},mf=function(a){a.removed=!0;a.listener=null;a.proxy=null;a.src=null;a.ga=null};var nf=function(a){this.src=a;this.a={};this.b=0},pf=function(a,b,c,d,e,f){var g=b.toString();b=a.a[g];b||(b=a.a[g]=[],a.b++);var l=of(b,c,e,f);-1<l?(a=b[l],d||(a.ba=!1)):(a=new lf(c,a.src,g,!!e,f),a.ba=d,b.push(a));return a};nf.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.a))return!1;var e=this.a[a];b=of(e,b,c,d);return-1<b?(mf(e[b]),Ka(e,b),0==e.length&&(delete this.a[a],this.b--),!0):!1};
var qf=function(a,b){var c=b.type;c in a.a&&La(a.a[c],b)&&(mf(b),0==a.a[c].length&&(delete a.a[c],a.b--))};nf.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,mf(d[e]);delete this.a[c];this.b--}return b};var rf=function(a,b,c,d,e){a=a.a[b.toString()];b=-1;a&&(b=of(a,c,d,e));return-1<b?a[b]:null};
nf.prototype.hasListener=function(a,b){var c=m(a),d=c?a.toString():"",e=m(b);return Xa(this.a,function(a){for(var f=0;f<a.length;++f)if(!(c&&a[f].type!=d||e&&a[f].capture!=b))return!0;return!1})};var of=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.ga==d)return e}return-1};var sf="closure_lm_"+(1E6*Math.random()|0),tf={},uf=0,wf=function(a,b,c,d,e){if(d&&d.once)return vf(a,b,c,d,e);if(oa(b)){for(var f=0;f<b.length;f++)wf(a,b[f],c,d,e);return null}c=xf(c);return jf(a)?a.listen(b,c,ra(d)?!!d.capture:!!d,e):yf(a,b,c,!1,d,e)},yf=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=ra(e)?!!e.capture:!!e,l=zf(a);l||(a[sf]=l=new nf(a));c=pf(l,b,c,d,g,f);if(c.proxy)return c;d=Af();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)ef||(e=g),void 0===e&&(e=
!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(Bf(b.toString()),d);else throw Error("addEventListener and attachEvent are unavailable.");uf++;return c},Af=function(){var a=Cf,b=cf?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},vf=function(a,b,c,d,e){if(oa(b)){for(var f=0;f<b.length;f++)vf(a,b[f],c,d,e);return null}c=xf(c);return jf(a)?pf(a.b,String(b),c,!0,ra(d)?!!d.capture:!!d,e):yf(a,b,c,!0,d,e)},Df=
function(a,b,c,d,e){if(oa(b))for(var f=0;f<b.length;f++)Df(a,b[f],c,d,e);else d=ra(d)?!!d.capture:!!d,c=xf(c),jf(a)?a.A(b,c,d,e):a&&(a=zf(a))&&(b=rf(a,b,c,d,e))&&Ef(b)},Ef=function(a){if(!ma(a)&&a&&!a.removed){var b=a.src;if(jf(b))qf(b.b,a);else{var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent&&b.detachEvent(Bf(c),d);uf--;(c=zf(b))?(qf(c,a),0==c.b&&(c.src=null,b[sf]=null)):mf(a)}}},Bf=function(a){return a in tf?tf[a]:tf[a]="on"+a},Gf=function(a,b,c,d){var e=
!0;if(a=zf(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=Ff(f,d),e=e&&!1!==f)}return e},Ff=function(a,b){var c=a.listener,d=a.ga||a.src;a.ba&&Ef(a);return c.call(d,b)},Cf=function(a,b){if(a.removed)return!0;if(!cf){if(!b)a:{b=["window","event"];for(var c=k,d=0;d<b.length;d++)if(c=c[b[d]],null==c){b=null;break a}b=c}d=b;b=new gf(d,this);c=!0;if(!(0>d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=
!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.a;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;0<=e;e--){b.a=d[e];var f=Gf(d[e],a,!0,b);c=c&&f}for(e=0;e<d.length;e++)b.a=d[e],f=Gf(d[e],a,!1,b),c=c&&f}return c}return Ff(a,new gf(b,this))},zf=function(a){a=a[sf];return a instanceof nf?a:null},Hf="__closure_events_fn_"+(1E9*Math.random()>>>0),xf=function(a){if(qa(a))return a;a[Hf]||(a[Hf]=function(b){return a.handleEvent(b)});return a[Hf]};var P=function(){bf.call(this);this.b=new nf(this);this.Ja=this;this.S=null};t(P,bf);P.prototype[hf]=!0;P.prototype.removeEventListener=function(a,b,c,d){Df(this,a,b,c,d)};
var Q=function(a,b){var c,d=a.S;if(d)for(c=[];d;d=d.S)c.push(d);a=a.Ja;d=b.type||b;if(n(b))b=new O(b,a);else if(b instanceof O)b.target=b.target||a;else{var e=b;b=new O(d,a);bb(b,e)}e=!0;if(c)for(var f=c.length-1;0<=f;f--){var g=b.a=c[f];e=If(g,d,!0,b)&&e}g=b.a=a;e=If(g,d,!0,b)&&e;e=If(g,d,!1,b)&&e;if(c)for(f=0;f<c.length;f++)g=b.a=c[f],e=If(g,d,!1,b)&&e};P.prototype.F=function(){P.H.F.call(this);this.b&&this.b.removeAll(void 0);this.S=null};
P.prototype.listen=function(a,b,c,d){return pf(this.b,String(a),b,!1,c,d)};P.prototype.A=function(a,b,c,d){return this.b.remove(String(a),b,c,d)};var If=function(a,b,c,d){b=a.b.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,p=g.ga||g.src;g.ba&&qf(a.b,g);e=!1!==l.call(p,d)&&e}}return e&&0!=d.Da};P.prototype.hasListener=function(a,b){return this.b.hasListener(m(a)?String(a):void 0,b)};var Jf=function(){v.call(this)};t(Jf,v);Jf.prototype.name="httpTimeout";var Kf=function(a,b){var c=C(),d=function(a){c.b(a)};a.listen(b,d);return D(c.a,function(){a.A(b,d)})},Lf=function(a){if(a instanceof F)throw a;},Mf=function(a,b){var c=setTimeout(function(){a.cancel()},b);D(a,function(){clearTimeout(c);c=null});return a},Nf=function(){var a=C();Mf(a.a,2E3);return a};!jb&&!y||y&&9<=Number(sb)||jb&&rb("1.9.1");y&&rb("9");if(y&&y)try{new ActiveXObject("MSXML2.DOMDocument")}catch(a){};var R=function(a){this.a=new M;if(a){a=Nd(a);for(var b=a.length,c=0;c<b;c++)Of(this,a[c])}},Pf=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[sa]||(a[sa]=++ta)):b.substr(0,1)+a};R.prototype.s=function(){return this.a.s()};var Of=function(a,b){a.a.set(Pf(b),b)};R.prototype.removeAll=function(a){a=Nd(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};R.prototype.remove=function(a){return this.a.remove(Pf(a))};R.prototype.clear=function(){this.a.clear()};
R.prototype.contains=function(a){return Md(this.a,Pf(a))};var Qf=function(a,b){a=new R(a);a.removeAll(b);return a};R.prototype.u=function(){return this.a.u()};R.prototype.M=function(){return this.a.M(!1)};var Rf=function(a){v.call(this,a)};t(Rf,v);Rf.prototype.name="chrome.runtime.lastError";var Sf=function(a,b){this.onNetworksChanged=a;this.onNetworkListChanged=b};r("castApp.core.NetworkingPrivateApi.WiFiProperties",function(){});r("castApp.core.NetworkingPrivateApi.NetworkProperties",function(){});var Tf=[[0xfa8fca000000,0xfa8fcaffffff],[111971074048,111971139583]],Uf=new function(a){this.b=new M;this.a=new M;for(var b=a.length,c=0;c<b;++c)this.b.set(a[c],a[c+1]),this.a.set(a[c+1],a[c])}(["a",4,"b",2,"c",3,"d",5,"e",6,"f",1,"g",7,"h",8,"i",9,"j",10,"k",11,"l",12,"m",13]),Vf=new R("bcamde".split("")),Wf=new R("adghjkl".split("")),Xf=new R("bcamde".split("")),Yf=new R(["b","c","a","m"]),Zf=new R(["b","c","a","m"]),$f=new R(["d"]),ag=function(a){if(/^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(a)){var b=
parseInt;var c=RegExp;var d=":".replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08");c=new c(d,"g");a=a.replace(c,"");b=b(a,16)}else b=NaN;return b},bg=function(a,b){return!(!a||!b||0!==Aa(a,b))},cg=function(a){var b=ag(a);return!!Ia(Tf,function(a){return b>=a[0]&&b<=a[1]})},eg=function(a){return!a.WiFi||!a.WiFi.BSSID||a.WiFi.Security&&"None"!==a.WiFi.Security||!cg(a.WiFi.BSSID)?!1:Vf.contains(dg(a.WiFi.SSID||"").type)},dg=function(a){var b=/^(.*)\.([^\.]*)$/.exec(a),c=null;return b&&
3===b.length&&(c=fg(b[2]))?{name:b[1],type:c.type,subtype:c.subtype}:{name:a,type:"c",subtype:null}},fg=function(a){a=/^([a-m])(\d{0,3})$/.exec(a);if(!a||3!==a.length)return null;var b=parseInt(a[2],10);return{type:a[1],subtype:isNaN(b)?null:b}},gg=function(a,b){var c=new Jc;c.supportsSetup=Vf.contains(a);b&&!1===b.setup_supported&&(c.supportsSetup=!1);c.supportsDisplay=!Wf.contains(a);b&&void 0!==b.display_supported&&(c.supportsDisplay=!!b.display_supported);if(Xf.contains(a)){var d=c.deviceSettings=
new Ic;d.supportsForgetWiFi=!0;b&&!1===b.wifi_supported&&(d.supportsForgetWiFi=!1);c.supportsSetup||(d.supportsForgetWiFi=!1);d.supportsReboot=Yf.contains(a);b&&void 0!==b.reboot_supported&&(d.supportsReboot=!!b.reboot_supported);d.supportsFdr=Zf.contains(a);b&&void 0!==b.fdr_supported&&(d.supportsFdr=!!b.fdr_supported);c.supportsSetup||(d.supportsFdr=!1);d.supportsDataCollectionToggle=!0;b&&void 0!==b.stats_supported&&(d.supportsDataCollectionToggle=!!b.stats_supported);d.supportsTimeFormatChange=
!0;c.supportsDisplay||(d.supportsTimeFormatChange=!1);d.supportsOtherLicenses=!$f.contains(a)}return c},hg=function(a){return Uf.b.get(a)||3},ig=function(a){switch(a){case 2:case 3:case 4:return 3;case 5:case 6:return 4;case 7:case 8:return 5}return 2},jg=function(a){switch(a){case 2:return 1;case 3:return 2;case 4:return 5;case 5:return 7}return 0},kg=function(a){switch(a){case chrome.cast.media.PlayerState.PLAYING:return 2;case chrome.cast.media.PlayerState.PAUSED:return 3;case chrome.cast.media.PlayerState.BUFFERING:return 4}return 1},
lg=function(a){switch(a){case chrome.cast.SessionStatus.CONNECTED:return 1;case chrome.cast.SessionStatus.STOPPED:return 3}return 2},mg=function(a,b){var c=2;1===a.a?c=3:2===a.a&&(c=4);b=new Dc(c,b,[],null);b.selectedNetwork=new Cc(a.b||null,a.msg.ssid,ig(a.msg.wpa_auth));a.b&&b.networks.push(b.selectedNetwork);return b},ng=function(a,b,c){switch(a){case 3:return c=new Ge,c.name=b,c;case 4:case 5:case 6:return a=new He,a.name=b,a.opt_in=new qe,a.opt_in.crash=a.opt_in.stats=c,a;default:return a=new Ie,
a.name=b,a.opt_in=new ye,a.opt_in.stats=c,a}},og=function(a){return"E8C28D3C"==a||"00000000-0000-0000-0000-000000000000"==a};var pg=function(){},rg=function(){this.b={};this.a={};qg||(qg=new z(function(a,b){window.__onGCastApiAvailable=function(c){c?a():b()}.bind(this);var c=document.createElement("script");c.setAttribute("src",chrome.extension.getURL("cast_sender.js"));document.head.appendChild(c)}.bind(this)))};t(rg,pg);
var qg=null,sg=function(a,b,c){return qg.then(function(){var a=b+c,e=this.b[a];if(e)return e.a;e=Nf();this.b[a]=e;var f=this.a[a];f||(f=new chrome.cast.SessionRequest(b),f=new chrome.cast.ApiConfig(f,this.c.bind(this),q,chrome.cast.AutoJoinPolicy.CUSTOM_CONTROLLER_SCOPED),f.invisibleSender=!og(b),f=chrome.cast.initializeWithContext(f,q,function(){}.bind(this)),this.a[a]=f);chrome.cast.requestSessionByIdWithContext(f,c);return e.a}.bind(a))};
rg.prototype.c=function(a){var b=a.appId+a.sessionId,c=this.b[b];c&&c.b({session:a,context:this.a[b]})};var tg=function(){Sf.call(this,chrome.networkingPrivate.onNetworksChanged,chrome.networkingPrivate.onNetworkListChanged)};t(tg,Sf);tg.a=void 0;tg.b=function(){return tg.a?tg.a:tg.a=new tg};var ug=function(a){return chrome.runtime.lastError?(a.c(new Rf(chrome.runtime.lastError.message)),!0):!1};h=tg.prototype;h.getNetworks=function(a){var b=C();chrome.networkingPrivate.getNetworks(a,function(a){ug(b)||b.b(a)});return b.a};
h.getProperties=function(a){var b=C();chrome.networkingPrivate.getProperties(a,function(a){ug(b)||b.b(a)});return b.a};h.requestNetworkScan=function(){chrome.networkingPrivate.requestNetworkScan()};h.startConnect=function(a){var b=C();chrome.networkingPrivate.startConnect(a,function(){ug(b)||b.b()});return b.a};h.startDisconnect=function(a){var b=C();chrome.networkingPrivate.startDisconnect(a,function(){ug(b)||b.b()});return b.a};
h.verifyDestination=function(a){var b=C();chrome.networkingPrivate.verifyDestination(a,function(a){ug(b)||b.b(a)});return b.a};h.verifyAndEncryptData=function(a,b){var c=C();chrome.networkingPrivate.verifyAndEncryptData(a,b,function(a){ug(c)||c.b(a)});return c.a};var vg=function(){this.a=new R},wg=function(a,b){Of(a.a,b);return D(b,function(){this.a.remove(b)}.bind(a))},xg=function(a){if(0==a.a.a.c)return A();var b=a.a;a.a=new R;return new z(function(a){Hd(b,function(c){D(c,function(){b.remove(c)&&0==b.a.c&&a()});c.cancel()})})};var S=function(a,b){this.h=a;this.g=b;this.f=new vg;this.c=new P;this.a="stopped"};S.prototype.getState=function(){return this.a};S.prototype.b=function(a){a!==this.a&&(this.a=a,Q(this.c,a))};S.prototype.start=function(){switch(this.a){case "stopped":case "stopping":return this.restart();case "starting":case "stoppingStartPending":return yg(this);case "started":return A();default:return A()}};
S.prototype.restart=function(){switch(this.a){case "starting":case "started":this.b("stoppingStartPending");zg(this);break;case "stopping":this.b("stoppingStartPending");break;case "stopped":this.b("starting"),Ag(this)}return yg(this)};var yg=function(a){var b=new vg;return D(E(new z(function(a,d){wg(b,Kf(this.c,"started")).then(function(){a()});wg(b,Kf(this.c,"stopped")).then(function(){d()})}.bind(a)),function(a){a instanceof F&&this.stop();throw a;},a),function(){xg(b)})};
S.prototype.stop=function(){if("stopped"===this.a)return A();var a=this.a;this.b("stopping");"starting"!==a&&"started"!==a||zg(this);return Kf(this.c,"stopped")};
var T=function(a,b){if("starting"===a.a||"started"===a.a)return wg(a.f,b),b;b.cancel();return Mb(new F)},Bg=function(a){return"started"===a.a?A():Kf(a.c,"started")},zg=function(a){xg(a.f).then(function(){try{if(this.g)return this.g()}catch(b){}}.bind(a)).then(function(){"stoppingStartPending"===this.a?(this.b("starting"),Ag(this)):this.b("stopped")}.bind(a))},Ag=function(a){var b=null;try{b=a.h()}catch(c){b=Mb(c)}"starting"!==a.a?b.cancel():E(wg(a.f,b).then(a.b.bind(a,"started")),function(){this.stop()}.bind(a))};var Cg=function(a,b,c){if(qa(a))c&&(a=wa(a,c));else if(a&&"function"==typeof a.handleEvent)a=wa(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:k.setTimeout(a,b||0)},U=function(a){var b=null;return E(new z(function(c,d){b=Cg(function(){c(void 0)},a);-1==b&&d(Error("Failed to schedule timer."))}),function(a){k.clearTimeout(b);throw a;})};var Sg=function(a){Dg||(Dg=new M("SetupStart.ShowDevice",Eg,"WiFiSwitching.ConnectHotSpot",Fg,"WiFiSwitching.ReconnectWiFi",Gg,"CodeConfirmation.Request",Hg,"DeviceConfig.Request",Ig,"DeviceConfig.Response",Jg,"WiFiConfig.Show",Kg,"WiFiConfig.UpdateNetworks",Lg,"WiFiConfig.Connect",Mg,"WiFiConfig.Retry",Ng,"Devices.Show",Og,"Devices.UserAction",Pg,"DeviceSettings.Show",Qg,"DeviceSettings.Apply",Rg),"Error Handshake.Request Handshake.Response Handshake.UiVersionNotSupported OfflineUiReady SetupSessionTakeoverConfirmed SetSimpleState ModalDialog.Request ModalDialog.Response ShowGenericSetupError DeviceDiscovery.ShowScanner DeviceDiscovery.NotFound SetupStart.Proceed SetupStart.TosAccepted WiFiSwitching.Proceed WiFiSwitching.RetryConnection BadDeviceAck CodeConfirmation.Response AudioConfirmation.PromptUser AudioConfirmation.UserAction WiFiConfig.ErrorAck OtaUpdate.Pending OtaUpdate.Done OtaUpdate.Proceed DeviceSettings.Reboot DeviceSettings.FactoryReset DeviceSettings.ForgetWiFi DeviceSettings.Exit RestartSetup GoToDeviceList DetectCountry.Request DetectCountry.Response Offers.Show Offers.Scan Offers.ScanResults Offers.Redeem Offers.AnalyticsEvent".split(" ").forEach(function(a){Dg.set(a,
function(a){return A(a)})}));return Dg.get(a.type)(a).then(function(a){return JSON.stringify(a)})},Dg=null,Eg=function(a){return G().then(function(b){b=new nc(a.state,a.deviceType,b);b.otherDevicesExist=a.otherDevicesExist;b.analyticsOptIn=a.analyticsOptIn;return b})},Fg=function(a){return B([G(),G()]).then(function(b){return new qc(a.state,b[0],b[1])})},Gg=function(a){return G().then(function(b){return new rc(a.state,b)})},Hg=function(a){return B(a.code.map(G)).then(function(a){return new tc(a)})},
Ig=function(a){return G().then(function(b){return new zc(a.deviceType,b,a.country)})},Jg=function(a){return G().then(function(b){return{requestId:a.responseTo,name:b,a:a.country}})},Tg=function(a){return B([a.id?G():null,G()]).then(function(b){var c=ia(b);b=c.next().value;c=c.next().value;return new Cc(b,c,a.security)})},Kg=function(a){return B([B(a.networks.map(Tg)),a.selectedNetwork?Tg(a.selectedNetwork):null]).then(function(b){var c=ia(b);b=c.next().value;c=c.next().value;return new Dc(a.state,
a.deviceType,b,c)})},Lg=function(a){return B(a.networks.map(Tg)).then(function(a){return new Ec(a)})},Mg=function(a){return Tg(a.network).then(function(a){return new Fc(a,"********")})},Ng=function(a){return Tg(a.network).then(function(a){return new Gc(a)})},Ug=function(a){return B([G(),G()]).then(function(b){var c=ia(b);b=c.next().value;c=c.next().value;var d=$a(a);d.id=b;d.displayName=c;return d})},Og=function(a){return B([B(a.devices.map(Ug)),a.deviceName?G():void 0]).then(function(a){var b=ia(a);
a=b.next().value;b=b.next().value;return new Mc(a,b)})},Pg=function(a){return Ug(a.device).then(function(b){return new Nc(b,a.action)})},Qg=function(a){return B([G(),G(),G(),G()]).then(function(b){var c=ia(b);b=c.next().value;var d=c.next().value,e=c.next().value;c=c.next().value;return new Rc(a.state,a.features,{deviceType:a.deviceType,name:b,ssid:a.ssid?d:null,timeZoneId:a.timeZoneId,supportedTimeZones:a.supportedTimeZones,timeFormat:a.timeFormat,localeId:a.localeId,supportedLocales:a.supportedLocales,
statsOptIn:a.statsOptIn,firmwareVersion:a.firmwareVersion,countryCode:a.countryCode,macAddress:e,ipAddress:c})})},Rg=function(a){return G().then(function(b){var c=new Sc(a);c.name=b;return c})};var Vg=function(){this.a={};this.b={};this.c=new R};Vg.prototype.sendMessage=function(a){a.responseTo?this.c.contains(a.responseTo)&&(this.c.remove(a.responseTo),Wg(this,a)):Wg(this,a)};Vg.prototype.sendRequest=function(a,b){var c=C();this.a[a.requestId]={K:c,Fa:b?setTimeout(wa(this.i,this,a.requestId),b):null};Wg(this,a);return c.a};Vg.prototype.i=function(a){a in this.a&&(this.a[a].K.a.cancel(),delete this.a[a])};
Vg.prototype.addListener=function(a,b){var c=this.b[a];c||(c=this.b[a]=new R);Of(c,b)};var Xg=function(a,b){var c=C(),d=wa(function(a){c.b(a)},a);a.addListener(b,d);return D(c.a,function(){this.removeListener(b,d)}.bind(a))};Vg.prototype.removeListener=function(a,b){(a=this.b[a])&&a.remove(b)};
var Yg=function(a,b){if(b.requestId)Of(a.c,b.requestId);else if(b.responseTo){var c=a.a[b.responseTo];c&&(delete a.a[b.responseTo],null!==c.Fa&&clearTimeout(c.Fa),b instanceof ac?c.K.c(b):c.K.b(b))}var d=a.b[b.type];d&&d.u().forEach(function(a){d.contains(a)&&a(b)})};var $g=function(a,b,c,d,e){Vg.call(this);this.f="object"===typeof b?b:null;this.j="function"===typeof b?b:null;this.h=c;this.m=d||q;this.g=e||function(a){return A(JSON.stringify(a))};a.addEventListener("message",this.l.bind(this))};t($g,Vg);$g.prototype.l=function(a){a.origin===this.h?(this.g(a.data),Yg(this,a.data)):this.m()};var Wg=function(a,b){a.g(b);a.f=a.f||a.j();a.f.postMessage(b,a.h)};var ah=function(a,b,c,d){this.f=new P;this.h=new S(c,d);this.c=a;this.D=b+"/v6";this.B=b;this.g=[]},bh=function(){O.call(this,"redirect")};t(bh,O);ah.prototype.start=function(){return this.h.start().then(this.v.bind(this))};ah.prototype.stop=function(){return this.h.stop()};ah.prototype.j=function(a){0<=Ea(this.g,a)||this.g.push(a)};
var ch=function(a){var b=a.localStorage.getItem("castApp.uiOrigin")||"https://castappui.google.com";ah.call(this,a,b,this.m.bind(this),this.l.bind(this));this.a=this.b=null;this.i=[["newwindow",this.w.bind(this)],["loadredirect",this.o.bind(this)]]};t(ch,ah);var dh=["exit","loadabort","unresponsive"];ch.prototype.v=function(){return this.a};
var eh=function(a){var b=setInterval(function(){document.activeElement===this.b?clearInterval(b):this.b.focus()}.bind(a),20);window.addEventListener("focus",a.b.focus.bind(a.b),!0)};
ch.prototype.m=function(){var a=this,b=C(),c=b.c.bind(b),d=a.c.document.querySelector("#cast-app-ui");d||(d=a.c.document.createElement("webview"),d.setAttribute("id","cast-app-ui"),d.setAttribute("src",a.D));dh.forEach(function(a){d.addEventListener(a,c)});var e=function(){var c=d.contentWindow;a.b=d;a.a=new $g(a.c,c,a.B,function(){Q(a.f,new O("originViolation"))},Sg);b.b();eh(a)};d.addEventListener("contentload",e);D(b.a,function(){dh.forEach(function(a){d.removeEventListener(a,c)});d.removeEventListener("contentload",
e)});a.i.forEach(function(a){d.addEventListener.apply(d,a)});d.parentElement||a.c.document.body.appendChild(d);a.b=d;return b.a};ch.prototype.l=function(){this.a=null;if(this.b&&this.b.parentElement){var a=this.b;this.b=null;a.parentElement.removeChild(a);this.i.forEach(function(b){a.removeEventListener.apply(a,b)})}return A()};ch.prototype.o=function(){Q(this.f,new bh)};
ch.prototype.w=function(a){var b=a.targetUrl,c=a.windowOpenDisposition,d=de(b),e=d.c,f=d.f;d="https"===e&&("www.google.com"===f||"support.google.com"===f||"chromecast.com"===f)||"http"===e&&yd(f)&&8008===d.h&&"/setup/NOTICE.html.gz"===d.b;!d&&0<=Ea(this.g,b)&&(d=!0);e="new_foreground_tab"===c;d&&(e||"new_background_tab"===c)&&chrome.tabs.create({url:b,active:e});a.window.discard()};var fh=function(a,b,c,d,e,f,g,l,p,u,K){this.b=b;this.g=c;this.f=a.localStorage;this.l=d;this.c=e;this.m=p;this.j=f;this.reload=g;this.i=l;this.h=u;this.a=K};var gh=function(a,b,c,d){this.c=a;this.f=b;this.a=this.b=a;this.g=c||0;this.h=d||2};gh.prototype.reset=function(){this.a=this.b=this.c};var hh=function(a){a.a=Math.min(a.f,a.a*a.h);a.b=Math.min(a.f,a.a+(a.g?Math.round(a.g*(Math.random()-.5)*2*a.a):0))};var ih=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};r("castApp.eventPage.Message",ih);ih.DeviceData=function(a,b,c){this.ipAddress=a;this.appId=b;this.sessionId=c};var jh=function(a,b,c,d){this.ipAddress=a;this.name=b;this.udn=c;this.modelName=d};ih.DeviceJustSetUp=jh;var kh=function(){};ih.DeviceCapabilities=kh;
ih.LogRecord=function(a,b,c,d){this.levelValue=a;this.msg=b;this.loggerName=c;this.time=d};var nh=function(a){a.devices||a.deviceJustSetUp?B([a.devices?lh(a.devices):void 0,a.deviceJustSetUp?mh(a.deviceJustSetUp):void 0]).then(function(b){var c=ia(b);b=c.next().value;c=c.next().value;var d=$a(a);d.devices=b;d.deviceJustSetUp=c;return JSON.stringify(d)}):A(JSON.stringify(a))},lh=function(a){return B(a.map(function(a){return G().then(function(b){var c=$a(a);c.ipAddress=b;return c})}))},mh=function(a){return B([G(),G(),G()]).then(function(b){var c=ia(b);b=c.next().value;var d=c.next().value;
c=c.next().value;b=new jh(b,d,c,a.modelName);a.capabilities&&(b.capabilities=a.capabilities);return b})};var oh=function(){P.call(this)};t(oh,P);var ph=function(a){O.call(this,a.subtype);this.msg=a};t(ph,O);var qh=function(){this.c=new gh(100,6E4);this.f=null;P.call(this)};t(qh,oh);var rh=null;
qh.prototype.start=function(){var a=this;rh||(chrome.runtime.onMessage.addListener(this.h.bind(this)),rh=E(D(new z(function(b,c){chrome.runtime.getBackgroundPage(function(){chrome.runtime.lastError?c(new Rf(chrome.runtime.lastError.message)):(window["castApp.eventPage.Message.OriginID"]=Ba(),a.a(),Kf(a,"serviceReady").then(function(){b()},c))})}),function(){clearTimeout(a.f)}),function(a){throw a;}));return rh};
qh.prototype.a=function(){sh("serviceCheck");this.f=setTimeout(this.a.bind(this),this.c.b);hh(this.c)};qh.prototype.sendMessage=function(a){return this.start().then(function(){sh(a)})};var sh=function(a){a=ra(a)?a:new ih(a);"logRecord"!==a.subtype&&nh(a);chrome.runtime.sendMessage(a)},th=function(a){a.sendMessage("startDeviceMonitor")};qh.prototype.h=function(a){"object"===typeof a&&"cast_app"===a.type&&"logRecord"!==a.subtype&&(nh(a),Q(this,new ph(a)));return!1};var uh=function(a){return(a=a.match(/^\w{2,3}([-_]|$)/))?a[0].replace(/[_-]/g,""):""},vh=function(a){return(a=a.match(/[-_]([a-zA-Z]{2}|\d{3})([-_]|$)/))?a[0].replace(/[_-]/g,""):""};var wh=w("Firefox"),xh=db()||w("iPod"),yh=w("iPad"),zh=w("Android")&&!(cb()||w("Firefox")||w("Opera")||w("Silk")),Ah=cb(),Bh=w("Safari")&&!(cb()||w("Coast")||w("Opera")||w("Edge")||w("Silk")||w("Android"))&&!(db()||w("iPad")||w("iPod"));var Ch=function(a){return(a=a.exec(Ta))?a[1]:""},Dh=function(){if(wh)return Ch(/Firefox\/([0-9.]+)/);if(y||ib||hb)return qb;if(Ah)return db()||w("iPad")||w("iPod")?Ch(/CriOS\/([0-9.]+)/):Ch(/Chrome\/([0-9.]+)/);if(Bh&&!(db()||w("iPad")||w("iPod")))return Ch(/Version\/([0-9.]+)/);if(xh||yh){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(Ta);if(a)return a[1]+"."+a[2]}else if(zh)return(a=Ch(/Android\s+([0-9.]+)/))?a:Ch(/Version\/([0-9.]+)/);return""}();var Eh=null,Fh=null,Hh=function(a){var b=[];Gh(a,function(a){b.push(a)});return b},Gh=function(a,b){function c(b){for(;d<a.length;){var c=a.charAt(d++),e=Fh[c];if(null!=e)return e;if(!/^[\s\xa0]*$/.test(c))throw Error("Unknown base64 encoding at char: "+c);}return b}Ih();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))}},Ih=function(){if(!Eh){Eh={};Fh={};for(var a=0;65>a;a++)Eh[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),
Fh[Eh[a]]=a,62<=a&&(Fh["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var Jh=function(){this.b=-1};var Kh=function(){this.b=64;this.a=[];this.h=[];this.i=[];this.f=[];this.f[0]=128;for(var a=1;a<this.b;++a)this.f[a]=0;this.g=this.c=0;this.reset()};t(Kh,Jh);Kh.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.c=0};
var Lh=function(a,b,c){c||(c=0);var d=a.i;if(n(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(e=16;80>e;e++){var f=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=(f<<1|f>>>31)&4294967295}b=a.a[0];c=a.a[1];var g=a.a[2],l=a.a[3],p=a.a[4];for(e=0;80>e;e++){if(40>e)if(20>e){f=l^c&(g^l);var u=1518500249}else f=c^g^l,u=1859775393;else 60>e?(f=c&g|l&(c|g),u=2400959708):(f=c^g^
l,u=3395469782);f=(b<<5|b>>>27)+f+p+u+d[e]&4294967295;p=l;l=g;g=(c<<30|c>>>2)&4294967295;c=b;b=f}a.a[0]=a.a[0]+b&4294967295;a.a[1]=a.a[1]+c&4294967295;a.a[2]=a.a[2]+g&4294967295;a.a[3]=a.a[3]+l&4294967295;a.a[4]=a.a[4]+p&4294967295};
Kh.prototype.update=function(a,b){if(null!=a){m(b)||(b=a.length);for(var c=b-this.b,d=0,e=this.h,f=this.c;d<b;){if(0==f)for(;d<=c;)Lh(this,a,d),d+=this.b;if(n(a))for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.b){Lh(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.b){Lh(this,e);f=0;break}}this.c=f;this.g+=b}};var Mh=function(a,b){if(b+1>=a.length)return null;if(!(a[b+1]&128))return{length:a[b+1],ma:1};var c=a[b+1]&127;if(b+c+1>=a.length||2<c)return null;for(var d=0,e=2;e<=c+1;e++)d=d<<8|a[b+e];return{length:d,ma:c+1}},Nh=function(a){var b=[{action:"step",code:48,optional:!1},{action:"step",code:48,optional:!1},{action:"skip",code:160,optional:!0},{action:"skip",code:2,optional:!1},{action:"skip",code:48,optional:!1},{action:"skip",code:48,optional:!1},{action:"skip",code:48,optional:!1},{action:"skip",
code:48,optional:!1},{action:"return",code:48,optional:!1}],c=0,d=-1;if(65535<a.length)return null;for(;b.length;){var e=b.shift();d++;if(a[c]!=e.code){if(e.optional)continue;break}var f=Mh(a,c);if(!f)break;var g=c+f.length+f.ma;if(g>=a.length)break;switch(e.action){case "step":c+=f.ma+1;continue;case "skip":c=g+1;continue;case "return":return Qa(a,c,g+1);default:return null}}return null},Oh=function(a){for(var b=a.length,c=0,d=0;d<b-1;d++)c+=a[d];c=(a[b-1]+16*c)%24;a=65+c;73<=a&&a++;79<=a&&a++;return String.fromCharCode(a)},
Ph=function(a){return String.fromCharCode(50+a[a.length-1]%8)},Qh=function(a,b){for(var c=[],d=0;4>d;d++)c[d]=a[b+d]^a[16+d];return c};var Rh=function(a){this.a=a},Sh=function(a,b,c,d){if(!a.f(d))return Mb();var e=a.b(d.bssid);if(!e||!a.c(c))return Mb();a=b.verifyDestination(e);E(a,function(){});return a.then(function(a){if(!a)return Mb();a=new Oe((new Date).getTime(),e);var b=e.certificate.replace(/[\r\n]/g,"");b=b.replace("-----BEGIN CERTIFICATE-----","");b=b.replace("-----END CERTIFICATE-----","");try{var c=Hh(b)}catch(Zg){c=null}if(c)if(b=Nh(c)){c=new Kh;c.update(b);b=[];var d=8*c.g;56>c.c?c.update(c.f,56-c.c):c.update(c.f,c.b-
(c.c-56));for(var f=c.b-1;56<=f;f--)c.h[f]=d&255,d/=256;Lh(c,c.h);for(f=d=0;5>f;f++)for(var K=24;0<=K;K-=8)b[d]=c.a[f]>>K&255,++d;b?(c=[],c[0]=Oh(Qh(b,0)),c[1]=Ph(Qh(b,4)),c[2]=Oh(Qh(b,8)),c[3]=Ph(Qh(b,12))):c=null}else c=null;else c=null;if(!c)return Mb();a.pin=c;return a})},Th=function(a){this.a=a};t(Th,Rh);Th.prototype.f=function(a){return a.ssid===this.a.name};Th.prototype.c=function(){return!0};
Th.prototype.b=function(a){var b=this.a,c={};if(!(b.public_key&&b.ssdp_udn&&b.name&&b.sign&&b.sign.certificate&&b.sign.nonce&&b.sign.signed_data))return null;c.certificate=b.sign.certificate;c.publicKey=b.public_key;c.nonce=b.sign.nonce;c.signedData=b.sign.signed_data;c.deviceSerial=b.ssdp_udn;c.deviceSsid=b.name;c.deviceBssid=a;return c};var Uh=function(a){this.a=a};t(Uh,Rh);Uh.prototype.f=function(a){var b=this.a.hotspot_bssid.toLowerCase();return a.ssid===this.a.name&&a.bssid.toLowerCase()===b};
Uh.prototype.c=function(a){return!(!this.a.sign||this.a.sign.nonce!==a)};
Uh.prototype.b=function(){var a=this.a,b={};if(!(a.public_key&&a.ssdp_udn&&a.name&&a.sign&&a.sign.certificate&&a.sign.nonce&&a.sign.signed_data&&a.hotspot_bssid))return null;b.certificate=a.sign.certificate;b.publicKey=a.public_key;b.nonce=a.sign.nonce;b.signedData=a.sign.signed_data;b.deviceSerial=a.ssdp_udn;b.deviceSsid=a.name;b.deviceBssid=a.hotspot_bssid;a.sign.intermediate_certs&&0<=Da(Dh,42)&&(b.intermediateCertificates=a.sign.intermediate_certs);return b};var Vh=function(a){this.a=a};
t(Vh,Rh);Vh.prototype.f=function(a){var b=this.a;if(!b.name||!b.device_info||!b.device_info.hotspot_bssid)return!1;var c=b.name;b.setup&&b.setup.ssid_suffix&&"c"!==b.setup.ssid_suffix&&(c+="."+b.setup.ssid_suffix);return a.ssid===c&&bg(b.device_info.hotspot_bssid,a.bssid)};Vh.prototype.c=function(a){return!(!this.a.sign||this.a.sign.nonce!==a)};
Vh.prototype.b=function(){var a=this.a,b={};if(!(a.name&&a.device_info&&a.device_info.public_key&&a.device_info.ssdp_udn&&a.device_info.hotspot_bssid&&a.sign&&a.sign.certificate&&a.sign.nonce&&a.sign.signed_data))return null;b.certificate=a.sign.certificate;b.publicKey=a.device_info.public_key;b.nonce=a.sign.nonce;b.signedData=a.sign.signed_data;b.deviceSerial=a.device_info.ssdp_udn;b.deviceSsid=a.name;b.deviceBssid=a.device_info.hotspot_bssid;a.sign.intermediate_certs&&0<=Da(Dh,42)&&(b.intermediateCertificates=
a.sign.intermediate_certs);return b};var Wh=function(){};Wh.prototype.a=null;var Yh=function(a){var b;(b=a.a)||(b={},Xh(a)&&(b[0]=!0,b[1]=!0),b=a.a=b);return b};var Zh,$h=function(){};t($h,Wh);var ai=function(a){return(a=Xh(a))?new ActiveXObject(a):new XMLHttpRequest},Xh=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};Zh=new $h;var V=function(a){P.call(this);this.headers=new M;this.B=a||null;this.c=!1;this.w=this.a=null;this.J="";this.h=0;this.f=this.I=this.m=this.D=!1;this.l=0;this.o=null;this.j="";this.T=this.i=!1};t(V,P);var bi=/^https?$/i,ci=["POST","PUT"];V.prototype.ya=function(){return this.j};V.prototype.za=function(){return this.i};
V.prototype.send=function(a,b,c,d){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.J+"; newUri="+a);b=b?b.toUpperCase():"GET";this.J=a;this.h=0;this.D=!1;this.c=!0;this.a=this.B?ai(this.B):ai(Zh);this.w=this.B?Yh(this.B):Yh(Zh);this.a.onreadystatechange=wa(this.qa,this);try{this.I=!0,this.a.open(b,String(a),!0),this.I=!1}catch(f){di(this);return}a=c||"";var e=new M(this.headers);d&&Od(d,function(a,b){e.set(b,a)});d=Ia(e.C(),ei);c=k.FormData&&a instanceof k.FormData;
!(0<=Ea(ci,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.j&&(this.a.responseType=this.j);"withCredentials"in this.a&&this.a.withCredentials!==this.i&&(this.a.withCredentials=this.i);try{fi(this),0<this.l&&((this.T=gi(this.a))?(this.a.timeout=this.l,this.a.ontimeout=wa(this.Z,this)):this.o=Cg(this.Z,this.l,this)),this.m=!0,this.a.send(a),this.m=!1}catch(f){di(this)}};
var gi=function(a){return y&&rb(9)&&ma(a.timeout)&&m(a.ontimeout)},ei=function(a){return"content-type"==a.toLowerCase()};V.prototype.Z=function(){"undefined"!=typeof la&&this.a&&(this.h=8,Q(this,"timeout"),this.abort(8))};var di=function(a){a.c=!1;a.a&&(a.f=!0,a.a.abort(),a.f=!1);a.h=5;hi(a);ii(a)},hi=function(a){a.D||(a.D=!0,Q(a,"complete"),Q(a,"error"))};V.prototype.abort=function(a){this.a&&this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.h=a||7,Q(this,"complete"),Q(this,"abort"),ii(this))};
V.prototype.F=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),ii(this,!0));V.H.F.call(this)};V.prototype.qa=function(){this.g||(this.I||this.m||this.f?ji(this):this.Ka())};V.prototype.Ka=function(){ji(this)};
var ji=function(a){if(a.c&&"undefined"!=typeof la&&(!a.w[1]||4!=ki(a)||2!=a.getStatus()))if(a.m&&4==ki(a))Cg(a.qa,0,a);else if(Q(a,"readystatechange"),4==ki(a)){a.c=!1;try{li(a)?(Q(a,"complete"),Q(a,"success")):(a.h=6,a.getStatus(),hi(a))}finally{ii(a)}}},ii=function(a,b){if(a.a){fi(a);var c=a.a,d=a.w[0]?q:null;a.a=null;a.w=null;b||Q(a,"ready");try{c.onreadystatechange=d}catch(e){}}},fi=function(a){a.a&&a.T&&(a.a.ontimeout=null);ma(a.o)&&(k.clearTimeout(a.o),a.o=null)},li=function(a){var b=a.getStatus();
a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break a;default:c=!1}if(!c){if(b=0===b)a=String(a.J).match(Pd)[1]||null,!a&&k.self&&k.self.location&&(a=k.self.location.protocol,a=a.substr(0,a.length-1)),b=!bi.test(a?a.toLowerCase():"");c=b}return c},ki=function(a){return a.a?a.a.readyState:0};V.prototype.getStatus=function(){try{return 2<ki(this)?this.a.status:-1}catch(a){return-1}};V.prototype.ea=function(){try{return this.a?this.a.responseText:""}catch(a){return""}};
V.prototype.getResponseHeader=function(a){if(this.a&&4==ki(this))return a=this.a.getResponseHeader(a),null===a?void 0:a};var mi=function(a){var b={};a=(a.a&&4==ki(a)?a.a.getAllResponseHeaders():"").split("\r\n");for(var c=0;c<a.length;c++)if(!/^[\s\xa0]*$/.test(a[c])){var d=2;for(var e=a[c].split(": "),f=[];0<d&&e.length;)f.push(e.shift()),d--;e.length&&f.push(e.join(": "));d=f;b[d[0]]=b[d[0]]?b[d[0]]+(", "+d[1]):d[1]}return b};var ni=function(a){bf.call(this);this.b=a;this.a={}};t(ni,bf);var oi=[];h=ni.prototype;h.listen=function(a,b,c,d){oa(b)||(b&&(oi[0]=b.toString()),b=oi);for(var e=0;e<b.length;e++){var f=wf(a,b[e],c||this.handleEvent,d||!1,this.b||this);if(!f)break;this.a[f.key]=f}return this};
h.A=function(a,b,c,d,e){if(oa(b))for(var f=0;f<b.length;f++)this.A(a,b[f],c,d,e);else c=c||this.handleEvent,d=ra(d)?!!d.capture:!!d,e=e||this.b||this,c=xf(c),d=!!d,b=jf(a)?rf(a.b,String(b),c,d,e):a?(a=zf(a))?rf(a,b,c,d,e):null:null,b&&(Ef(b),delete this.a[b.key]);return this};h.removeAll=function(){Wa(this.a,function(a,b){this.a.hasOwnProperty(b)&&Ef(a)},this);this.a={}};h.F=function(){ni.H.F.call(this);this.removeAll()};
h.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented");};var pi=function(){this.b=[];this.a=[]},qi=function(a){0==a.b.length&&(a.b=a.a,a.b.reverse(),a.a=[]);return a.b.pop()};h=pi.prototype;h.s=function(){return this.b.length+this.a.length};h.clear=function(){this.b=[];this.a=[]};h.contains=function(a){return 0<=Ea(this.b,a)||0<=Ea(this.a,a)};h.remove=function(a){var b=this.b;var c=Fa(b,a);0<=c?(Ka(b,c),b=!0):b=!1;return b||La(this.a,a)};
h.u=function(){for(var a=[],b=this.b.length-1;0<=b;--b)a.push(this.b[b]);var c=this.a.length;for(b=0;b<c;++b)a.push(this.a[b]);return a};var ri=function(a,b){bf.call(this);this.l=a||0;this.c=b||10;if(this.l>this.c)throw Error("[goog.structs.Pool] Min can not be greater than max");this.a=new pi;this.b=new R;this.i=null;this.$()};t(ri,bf);ri.prototype.da=function(){var a=ya();if(!(null!=this.i&&0>a-this.i)){for(var b;0<this.a.s()&&(b=qi(this.a),!this.j(b));)this.$();!b&&this.s()<this.c&&(b=this.h());b&&(this.i=a,Of(this.b,b));return b}};ri.prototype.U=function(a){this.b.remove(a);this.j(a)&&this.s()<this.c?this.a.a.push(a):si(a)};
ri.prototype.$=function(){for(var a=this.a;this.s()<this.l;){var b=this.h();a.a.push(b)}for(;this.s()>this.c&&0<this.a.s();)si(qi(a))};ri.prototype.h=function(){return{}};var si=function(a){if("function"==typeof a.ca)a.ca();else for(var b in a)a[b]=null};ri.prototype.j=function(a){return"function"==typeof a.Ma?a.Ma():!0};ri.prototype.contains=function(a){return this.a.contains(a)||this.b.contains(a)};ri.prototype.s=function(){return this.a.s()+this.b.s()};
ri.prototype.F=function(){ri.H.F.call(this);if(0<this.b.s())throw Error("[goog.structs.Pool] Objects not released");delete this.b;for(var a=this.a;0!=a.b.length||0!=a.a.length;)si(qi(a));delete this.a};var ti=function(a,b){this.a=a;this.b=b};var ui=function(a){this.a=[];if(a)a:{if(a instanceof ui){var b=a.C();a=a.u();if(0>=this.s()){for(var c=this.a,d=0;d<b.length;d++)c.push(new ti(b[d],a[d]));break a}}else b=Za(a),a=Ya(a);for(d=0;d<b.length;d++)vi(this,b[d],a[d])}},vi=function(a,b,c){var d=a.a;d.push(new ti(b,c));b=d.length-1;a=a.a;for(c=a[b];0<b;)if(d=b-1>>1,a[d].a>c.a)a[b]=a[d],b=d;else break;a[b]=c};h=ui.prototype;
h.remove=function(){var a=this.a,b=a.length,c=a[0];if(!(0>=b)){if(1==b)Ja(a);else{a[0]=a.pop();a=0;b=this.a;for(var d=b.length,e=b[a];a<d>>1;){var f=2*a+1,g=2*a+2;f=g<d&&b[g].a<b[f].a?g:f;if(b[f].a>e.a)break;b[a]=b[f];a=f}b[a]=e}return c.b}};h.u=function(){for(var a=this.a,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].b);return b};h.C=function(){for(var a=this.a,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].a);return b};h.s=function(){return this.a.length};h.clear=function(){Ja(this.a)};var wi=function(){ui.call(this)};t(wi,ui);var xi=function(a,b){this.f=new wi;ri.call(this,a,b)};t(xi,ri);h=xi.prototype;h.da=function(a,b){if(!a)return xi.H.da.call(this);vi(this.f,m(b)?b:100,a);this.la()};h.la=function(){for(var a=this.f;0<a.s();){var b=this.da();if(b)a.remove().apply(this,[b]);else break}};h.U=function(a){xi.H.U.call(this,a);this.la()};h.$=function(){xi.H.$.call(this);this.la()};h.F=function(){xi.H.F.call(this);k.clearTimeout(void 0);this.f.clear();this.f=null};var yi=function(a,b,c,d){this.m=a;this.o=!!d;xi.call(this,b,c)};t(yi,xi);yi.prototype.h=function(){var a=new V,b=this.m;b&&b.forEach(function(b,d){a.headers.set(d,b)});this.o&&(a.i=!0);return a};yi.prototype.j=function(a){return!a.g&&!a.a};var zi=function(a,b,c,d,e,f){P.call(this);this.i=m(a)?a:1;this.h=m(e)?Math.max(0,e):0;this.j=!!f;this.c=new yi(b,c,d,f);this.a=new M;this.f=new ni(this)};t(zi,P);var Ai="ready complete success error abort timeout".split(" ");zi.prototype.send=function(a,b,c,d,e,f,g,l,p,u){if(this.a.get(a))throw Error("[goog.net.XhrManager] ID in use");b=new Bi(b,wa(this.m,this,a),c,d,e,g,m(l)?l:this.i,p,m(u)?u:this.j);this.a.set(a,b);a=wa(this.l,this,a);this.c.da(a,f);return b};
zi.prototype.abort=function(a,b){var c=this.a.get(a);if(c){var d=c.ia;c.ra=!0;b&&(d&&(this.f.A(d,Ai,c.pa),vf(d,"ready",function(){var a=this.c;a.b.remove(d)&&a.U(d)},!1,this)),this.a.remove(a));d&&d.abort()}};zi.prototype.l=function(a,b){var c=this.a.get(a);c&&!c.ia?(this.f.listen(b,Ai,c.pa),b.l=Math.max(0,this.h),b.j=c.ya(),b.i=c.za(),c.ia=b,Q(this,new Ci("ready",this,a,b)),Di(this,a,b),c.ra&&b.abort()):(a=this.c,a.b.remove(b)&&a.U(b))};
zi.prototype.m=function(a,b){var c=b.target;switch(b.type){case "ready":Di(this,a,c);break;case "complete":a:{var d=this.a.get(a);if(7==c.h||li(c)||d.aa>d.ka)if(Q(this,new Ci("complete",this,a,c)),d&&(d.wa=!0,d.va)){a=d.va.call(c,b);break a}a=null}return a;case "success":Q(this,new Ci("success",this,a,c));break;case "timeout":case "error":b=this.a.get(a);b.aa>b.ka&&Q(this,new Ci("error",this,a,c));break;case "abort":Q(this,new Ci("abort",this,a,c))}return null};
var Di=function(a,b,c){var d=a.a.get(b);!d||d.wa||d.aa>d.ka?(d&&(a.f.A(c,Ai,d.pa),a.a.remove(b)),a=a.c,a.b.remove(c)&&a.U(c)):(d.aa++,c.send(d.gb,d.sb,d.eb,d.fb))};zi.prototype.F=function(){zi.H.F.call(this);this.c.ca();this.c=null;this.f.ca();this.f=null;this.a.clear();this.a=null};var Ci=function(a,b,c,d){O.call(this,a,b);this.id=c;this.ia=d};t(Ci,O);
var Bi=function(a,b,c,d,e,f,g,l,p){this.gb=a;this.sb=c||"GET";this.eb=d;this.fb=e||null;this.ka=m(g)?g:1;this.aa=0;this.ra=this.wa=!1;this.pa=b;this.va=f;this.a=l||"";this.b=!!p;this.ia=null};Bi.prototype.za=function(){return this.b};Bi.prototype.ya=function(){return this.a};var Ei=function(){},Fi=function(){v.call(this)};t(Fi,v);Fi.prototype.name="httpStatus";var Gi=function(){v.call(this)};t(Gi,v);Gi.prototype.name="httpResponseParsing";var Hi=function(a,b){return a.request(b).then(function(a){if((a.getResponseHeader("content-type")||"").toLowerCase().startsWith("application/json")){a=a.ea();a.startsWith(")]}'")&&(a=a.substr(4));try{return JSON.parse(a)}catch(d){}}throw new Gi;})},Ii=function(){this.a=new M;this.b=0};t(Ii,Ei);
var Ji=function(a){this.b=a.ea();this.a={};Wa(mi(a),function(a,c){this.a[c.toLowerCase()]=a},this)};Ji.prototype.ea=function(){return this.b};Ji.prototype.getResponseHeader=function(a){return this.a[a.toLowerCase()]||void 0};Ii.prototype.request=function(a){var b=C(),c=a.timeout||1E4,d=this.a.get(c);d||(d=new zi,d.h=Math.max(0,c),this.a.set(c,d));c=a.method||"GET";d.send(this.b++,a.url,c,a.content,a.headers,0,function(a){a=a.target;li(a)?b.b(new Ji(a)):b.c(new Fi(a.getStatus()))},a.G);return b.a};var Ki=function(a,b,c){var d=b.read();this.a=d.eurekaInfoState&&d.eurekaInfoState.setupApiVersion||null;this.g=new Rd("http://"+d.deviceIpAddress+":8008");this.b=a;this.c=b;c?(a=uh(c),c=(c=vh(c))?"en"==a?a+"-"+c+", en;q=0.8":a+"-"+c+", "+a+";q=0.8, en;q=0.5":a+", en;q=0.5"):c=null;this.f=c},Li=function(a){var b=new Me(a);return{read:function(){return b},write:function(a){b=a}}},Oi=function(a,b,c){var d=new Ki(a,b,c);return d.a?A(d):Mi(d,{options:Ni()}).then(function(){return d})},Qi=function(a,b,
c,d,e){var f=new Ki(a,b,e),g=b.read();if(g.eurekaInfoState&&g.eurekaInfoState.ethernetConnected)return A(f);if(g.verificationState){if(bg(g.verificationState.verificationProperties.deviceBssid,d.bssid))return A(f);g=new Me(g.deviceIpAddress);b.write(g)}a={};var l=a.nonce=Ba();a.options=Ni().concat(["name","sign","device_info.public_key","device_info.hotspot_bssid"]);return Mi(f,a).then(function(a){a:switch(a.version){case 3:a=Sh(new Th(a),c,l,d);break a;case 4:case 5:case 6:a=Sh(new Uh(a),c,l,d);
break a;default:a=Sh(new Vh(a),c,l,d)}return a}).then(function(a){g=b.read();g.verificationState=a;b.write(g);return f},function(a){Lf(a);if(a instanceof Fi)throw a;throw new Pi;})},Ri=function(){v.call(this)};t(Ri,v);Ri.prototype.name="setupApiVersionError";var Pi=function(){v.call(this)};t(Pi,v);Pi.prototype.name="deviceVerificationError";var Ni=function(){return"version name setup.setup_state net.ethernet_connected net.ip_address device_info.ssdp_udn device_info.model_name device_info.capabilities setup.ssid_suffix setup.tos_accepted".split(" ")};
Ki.prototype.i=new R([3,4,5,6,7,8]);Ki.prototype.h=new M(3,function(a){x(a,"locale","en-US");return a},4,oe,5,oe,6,oe,7,ue);Ki.prototype.getState=function(){return this.c.read()};
var Si=function(a){return a.c.read().eurekaInfoState},Ui=function(a,b){return a.b.request({url:Ti(a,"/setup/connect_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(b),G:0})},Mi=function(a,b){var c=new Rd(a.g);c.b="/setup/eureka_info";if(b){var d=[];if(b.options){var e=new R(b.options),f=e.contains("sign");if(null===a.a||7>a.a){var g=new R(["sign","detail"]),l=new R;g=Nd(g);for(var p=0;p<g.length;p++){var u=g[p];e.contains(u)&&Of(l,u)}l.s()&&d.push("options="+
l.u().join(","))}e.s()&&(null===a.a||7<=a.a)&&d.push("params="+e.u().join(","))}b.nonce&&d.push("nonce="+b.nonce);d.length&&Vd(c,d.join("&"),void 0)}b=void 0;a.f&&(b={"Accept-Language":a.f});return Hi(a.b,{url:c.toString(),method:"GET",headers:b,timeout:f?4E4:1E4,G:f?1:2}).then(a.j.bind(a)).then(a.l.bind(a))};Ki.prototype.j=function(a){if(!a.version)return a;if(!this.i.contains(a.version))throw new Ri;this.a=parseInt(a.version,10);var b=this.h.get(this.a,null);!b&&7<=this.a&&(b=ue);return b(a)};
Ki.prototype.l=function(a){var b=this.c.read(),c=b.eurekaInfoState,d={};this.a&&(d.setupApiVersion=this.a);if(3<=this.a&&6>=this.a)d.name=a.name,d.setupState=a.setup_state,d.ssdpUdn=a.ssdp_udn,3===this.a?(d.ethernetConnected=!1,d.tosAccepted=!0,d.modelName="Chromecast"):(d.ethernetConnected=6===this.a?!!a.ethernet_connected:!1,d.tosAccepted=!!a.tos_accepted,a.detail&&(d.modelName=a.detail.model_name)),a.ip_address&&(d.connectedIpAddress=a.ip_address),d.deviceType="c";else if(7<=this.a){a.name&&(d.name=
a.name);if(a.setup&&(void 0!==a.setup.setup_state&&(d.setupState=a.setup.setup_state),63===d.setupState?d.tosAccepted=!1:void 0!==a.setup.tos_accepted&&(d.tosAccepted=a.setup.tos_accepted),void 0!==a.setup.ssid_suffix)){var e=fg(a.setup.ssid_suffix);d.deviceType=e?e.type:"c"}a.device_info&&(a.device_info.model_name&&(d.modelName=a.device_info.model_name),a.device_info.ssdp_udn&&(d.ssdpUdn=a.device_info.ssdp_udn),a.device_info.capabilities&&(d.features=gg(d.deviceType||c&&c.deviceType||"b",a.device_info.capabilities)));
a.net&&(void 0!==a.net.ethernet_connected&&(d.ethernetConnected=a.net.ethernet_connected),a.net.ip_address&&(d.connectedIpAddress=a.net.ip_address))}c?bb(c,d):b.eurekaInfoState=d;b.eurekaInfoState.features||(b.eurekaInfoState.features=gg(d.deviceType||c&&c.deviceType||"b"));this.c.write(b);return a};
var Vi=function(a){return Hi(a.b,{url:Ti(a,"/setup/offer"),method:"GET",timeout:1E4,G:2}).then(function(a){return a})},Wi=function(a,b){a.b.request({url:Ti(a,"/setup/reboot"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new Be(b)),timeout:1E4,G:2})},Xi=function(a){var b=new Ee;b.immediate=!0;return Hi(a.b,{url:Ti(a,"/setup/save_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(b),timeout:2E4,G:1}).then(function(a){var b=this.c.read();
b.eurekaInfoState&&b.eurekaInfoState.setupState!==a.setup_state&&(b.eurekaInfoState.setupState=a.setup_state,this.c.write(b));return a}.bind(a))},Yi=function(a){return Hi(a.b,{url:Ti(a,"/setup/scan_results"),method:"GET",timeout:1E4,G:5}).then(function(a){return a})},Zi=function(a){return a.b.request({url:Ti(a,"/setup/scan_wifi"),method:"POST",G:0})},$i=function(a,b){return a.b.request({url:Ti(a,"/setup/set_eureka_info"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(b),
G:0})},aj=function(a){return Hi(a.b,{url:Ti(a,"/setup/supported_locales"),method:"GET",timeout:1E4,G:2}).then(function(a){return a})},bj=function(a){return Hi(a.b,{url:Ti(a,"/setup/supported_timezones"),method:"GET",timeout:1E4,G:2}).then(function(a){return a})},Ti=function(a,b){a=new Rd(a.g);a.b=b;return a.toString()};var cj=function(a,b){this.networks=new M;this.f=new S(this.$a.bind(this),this.Za.bind(this));this.b=a;this.g=[];for(var c=1,d=arguments.length;c<d;++c)this.g.push(arguments[c]);this.c=new R;this.h=this.ib.bind(this);this.i=this.jb.bind(this);this.a=new P},dj=function(a,b){O.call(this,a);this.properties=b};t(dj,O);var ej=function(){};ej.prototype.c=function(){return!0};ej.prototype.a=function(){return!0};var fj=function(a){this.b=a||null};t(fj,ej);
fj.prototype.c=function(a){return!(!a.WiFi||a.WiFi.Security&&"None"!==a.WiFi.Security)};fj.prototype.a=function(a){return this.b?!(!a.WiFi||a.WiFi.BSSID!==this.b):eg(a)};
var gj=function(a){var b=[];["GUID","Name"].forEach(function(c){c in a&&(b.push(" "+c+": "),b.push(G()))});["ConnectionState","Type"].forEach(function(c){c in a&&b.push(" "+c+": "+a[c])});a.WiFi&&(["SSID","BSSID"].forEach(function(c){c in a.WiFi&&(b.push(" WiFi."+c+": "),b.push(G()))}),["Security","SignalStrength"].forEach(function(c){b.push(" WiFi."+c+": "+a.WiFi[c])}));return A("")};h=cj.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};
h.$a=function(){var a=this.b;a.onNetworkListChanged.addListener(this.h);a.onNetworksChanged.addListener(this.i);return T(this.f,this.b.getNetworks({networkType:"WiFi",visible:!0})).then(this.rb.bind(this))};h.rb=function(a){return B(a.filter(function(a){if(hj(this,a))return!0;Of(this.c,a.GUID);return!1}.bind(this)).map(function(a){return this.oa(a.GUID)}.bind(this)))};
h.Za=function(){this.b.onNetworkListChanged.removeListener(this.h);this.b.onNetworksChanged.removeListener(this.i);this.networks.clear();this.c.clear();return A()};h.ib=function(a){var b=new R(this.networks.C());a=Qf(new R(a),this.c);Hd(Qf(a,b),this.oa.bind(this));Hd(Qf(b,a),this.Ca.bind(this))};h.Ca=function(a){var b=this.networks.get(a);this.networks.remove(a);a="Connected"===b.ConnectionState;b.ConnectionState="NotConnected";a&&ij(this,"disconnected",b);ij(this,"removed",b)};
h.jb=function(a){a=Qf(new R(a),this.c);Hd(a,this.oa.bind(this))};h.oa=function(a){var b=this,c=C();D(E(jj(b,a).then(function(c){var d=b.networks.get(a),f=!(!d||"Connected"!==d.ConnectionState);b.networks.set(c.GUID,c);var g="Connected"===c.ConnectionState;d||ij(b,"added",c);!f&&g?ij(b,"connected",c):f&&!g&&ij(b,"disconnected",c)}),function(){Md(b.networks,a)&&b.Ca(a)}),function(){c.b()});return c.a};
var ij=function(a,b,c){gj.bind(a,c);Q(a.a,new dj(b,c))},jj=function(a,b){return E(T(a.f,a.b.getProperties(b)),function(a){a instanceof F||G();throw a;}.bind(a)).then(function(a){if(!kj(this,a))throw Of(this.c,b),new F;return a}.bind(a))},hj=function(a,b){return!Ia(a.g,function(a){return!a.c(b)})},kj=function(a,b){return!Ia(a.g,function(a){return!a.a(b)})};var lj=function(a){this.b=a;this.a=null},mj=new M(1,2E4,3,6E4,2,6E4),oj=function(a,b){var c=Ve(a).filter(nj);c.push(b);We(a,c)},nj=function(a){var b=mj.get(a.type,Infinity);return ya()-a.time<b},pj=function(a){this.b=a};t(pj,ej);pj.prototype.a=function(a){(a=qj(this.b,a.WiFi&&a.WiFi.BSSID,2))&&G();return!a};
var rj=function(a){a.a=new M;for(var b=Ve(a.b),c=[],d=0,e=b.length;d<e;++d){var f=b[d];if(nj(f)){c.push(f);Md(a.a,f.type)||a.a.set(f.type,new M);var g=a.a.get(f.type);g&&g.get(f.deviceId,-Infinity)<f.time&&g.set(f.deviceId,f.time)}}c.length!==b.length&&We(a.b,c)},qj=function(a,b,c){a.a||rj(a);a=a.a.get(c,null);if(null===a||!Md(a,b))return!1;b=a.get(b)+mj.get(c,0);return ya()<b},sj=function(a,b){(a=qj(a,b,1)||qj(a,b,3))&&G();return a};var tj=function(a,b,c,d){P.call(this);this.m=new lj(d.localStorage);this.f=new cj(a,new fj,new pj(this.m));this.h=b;this.I=a;this.D=c;this.l=d};t(tj,P);var uj=function(a){O.call(this,"devices");this.devices=a};t(uj,O);var vj=function(a,b,c,d){tj.call(this,a,b,c,d);this.a=null;this.j=0;this.c=new M;this.i=new gh(5E3,6E4);this.w=this.J.bind(this);this.B=this.nb.bind(this);this.o=new S(this.Ya.bind(this),this.Xa.bind(this))};t(vj,tj);
var wj=function(a,b){return E(Oi(a.D,Li(b)).then(function(a){var b=a.getState(),c=b.eurekaInfoState;if(b.deviceIpAddress&&c&&c.name&&c.ssdpUdn&&void 0!==c.ethernetConnected&&void 0!==c.tosAccepted&&c.deviceType&&void 0!==c.features)return a;G();return Mb()}.bind(a)),function(){G()}.bind(a))};h=vj.prototype;h.Ya=function(){this.l.document.addEventListener("visibilitychange",this.B);this.h.listen("devices",this.w);th(this.h);this.j=0;return this.f.start().then(this.P.bind(this))};
h.Xa=function(){this.l.document.removeEventListener("visibilitychange",this.B);this.h.A("devices",this.w);this.j=0;this.i=new gh(5E3,6E4);this.a&&(this.a.cancel(),this.a=null);this.c.clear();return this.f.stop()};h.start=function(){return this.o.start()};h.stop=function(){return this.o.stop()};h.nb=function(){this.l.document.hidden?this.a&&(this.a.cancel(),this.a=null):(this.i=new gh(5E3,6E4),this.P())};
h.P=function(){this.a&&this.a.cancel();rj(this.m);this.I.requestNetworkScan();this.j++;1<=this.j&&this.l.document.hidden?this.a=null:(this.a=U(this.i.b),T(this.o,this.a).then(this.P.bind(this)),hh(this.i))};var xj=function(a){var b=[];a.c.u().forEach(function(a){a.W&&!sj(this.m,a.ipAddress)&&b.push(a)}.bind(a));Q(a,new uj(b))};
vj.prototype.J=function(a){var b=new R;a.msg.devices.forEach(function(a){Of(b,a.ipAddress);var c=this.c.get(a.ipAddress);c||(c={ipAddress:a.ipAddress},wj(this,a.ipAddress).then(function(b){var c=this.c.get(a.ipAddress);c?(c.W=b,this.c.set(a.ipAddress,c),xj(this)):G()}.bind(this)));a.sessionId&&a.appId&&(c.sessionId=a.sessionId,c.appId=a.appId);this.c.set(a.ipAddress,c)}.bind(this));Hd(Qf(new R(this.c.C()),b),this.c.remove.bind(this.c));xj(this)};var yj=function(){},zj="function"==typeof Uint8Array,Cj=function(a,b,c,d){a.c=null;b||(b=c?[c]:[]);a.j=c?String(c):void 0;a.f=0===c?-1:0;a.a=b;a:{if(a.a.length&&(b=a.a.length-1,(c=a.a[b])&&"object"==typeof c&&!oa(c)&&!(zj&&c instanceof Uint8Array))){a.g=b-a.f;a.b=c;break a}a.g=Number.MAX_VALUE}a.i={};if(d)for(b=0;b<d.length;b++)c=d[b],c<a.g?(c+=a.f,a.a[c]=a.a[c]||Aj):(Bj(a),a.b[c]=a.b[c]||Aj)},Aj=[],Bj=function(a){var b=a.g+a.f;a.a[b]||(a.b=a.a[b]={})},Dj=function(a,b){if(b<a.g){b+=a.f;var c=a.a[b];
return c===Aj?a.a[b]=[]:c}if(a.b)return c=a.b[b],c===Aj?a.b[b]=[]:c},Ej=function(a,b,c){b<a.g?a.a[b+a.f]=c:(Bj(a),a.b[b]=c)},Fj=function(a,b,c){a.c||(a.c={});if(!a.c[c]){if(c<a.g){var d=c+a.f;var e=a.a[d];d=e===Aj?a.a[d]=[]:e}else e=a.b[c],d=e===Aj?a.b[c]=[]:e;e=[];for(var f=0;f<d.length;f++)e[f]=new b(d[f]);a.c[c]=e}b=a.c[c];b==Aj&&(b=a.c[c]=[]);return b},Hj=function(a){if(a.c)for(var b in a.c){var c=a.c[b];if(oa(c))for(var d=0;d<c.length;d++)c[d]&&Gj(c[d]);else c&&Gj(c)}},Gj=function(a){Hj(a);return a.a};
yj.prototype.h=zj?function(){var a=Uint8Array.prototype.toJSON;Uint8Array.prototype.toJSON=function(){Ih();for(var a=Eh,b=[],e=0;e<this.length;e+=3){var f=this[e],g=e+1<this.length,l=g?this[e+1]:0,p=e+2<this.length,u=p?this[e+2]:0,K=f>>2;f=(f&3)<<4|l>>4;l=(l&15)<<2|u>>6;u&=63;p||(u=64,g||(l=64));b.push(a[K],a[f],a[l],a[u])}return b.join("")};try{var b=JSON.stringify(Gj(this),Ij)}finally{Uint8Array.prototype.toJSON=a}return b}:function(){return JSON.stringify(Gj(this),Ij)};
var Ij=function(a,b){if(ma(b)){if(isNaN(b))return"NaN";if(Infinity===b)return"Infinity";if(-Infinity===b)return"-Infinity"}return b};yj.prototype.toString=function(){Hj(this);return this.a.toString()};var Jj=function(a){Cj(this,a,0,null)};t(Jj,yj);var Lj=function(a){Cj(this,a,"is.gsser",Kj)};t(Lj,yj);var Kj=[3,5,13];Lj.messageId="is.gsser";Lj.prototype.getTitle=function(){return Dj(this,1)};Lj.prototype.setTitle=function(a){Ej(this,1,a)};var Mj=function(a){Cj(this,a,0,null)};t(Mj,yj);var Nj=function(a){Cj(this,a,0,null)};t(Nj,yj);var Oj=function(a,b,c){this.b=a;this.a=c;this.c="https://clients3.google.com/cast/chromecast/home/gsse?rt=j&hl="+b};
Oj.prototype.request=function(a){var b=new Jj;Ej(b,3,a);Ej(b,1,"E8C28D3C");return this.b.request({url:this.c,method:"POST",content:b.h(),headers:{"Content-Type":"application/json"}}).then(function(a){a=a.ea();a.startsWith(")]}'\n")&&(a=a.slice(5));a=JSON.parse(a);a=new Lj(a[0][0]);var b=[],c=Dj(a,4);c&&b.push(c);(c=Fj(a,Nj,5))&&c.forEach(function(a){b.push(Dj(a,2))});b.forEach(this.a.j.bind(this.a));return a}.bind(this))};var Pj=function(a){this.b=a;this.a=new M;this.f=new S(this.Sa.bind(this),this.Ra.bind(this));this.i=this.ob.bind(this);this.j=this.pb.bind(this);this.h=this.Qa.bind(this);this.l=this.mb.bind(this);this.g=this.Pa.bind(this);this.c=null},Qj=function(a){this.a=a};Qj.prototype.V=function(){var a=dg(this.a.WiFi.SSID),b=new Lc("wifi:"+this.a.GUID,hg(a.type),a.name);b.needsSetup=!0;b.features=gg(a.type);return b};
Qj.prototype.xa=function(){var a=this.V();a={name:a.displayName,type:Uf.a.get(a.type)||"c"};a.ssid=this.a.WiFi.SSID;a.bssid=this.a.WiFi.BSSID;return new Le(a)};Qj.prototype.start=function(){return A()};Qj.prototype.stop=function(){return A()};var Rj=function(a,b,c,d){this.j=b;this.a=null;this.c=d;this.m=a;this.h=new S(this.Oa.bind(this),this.Na.bind(this));this.w=c;this.g=this.b=this.f=null;this.B=new Oj(a.g,a.h(),this.m.m);this.i=this.l.bind(this);this.o=this.kb.bind(this);this.v=this.hb.bind(this)};
Rj.prototype.xa=function(){var a=this.V();return new Le({name:a.displayName,type:Uf.a.get(a.type)||"c",ipAddress:this.j})};
var Sj=function(a,b){if(!og(a.a.appId)||og(a.a.appId)&&!a.f)return b;a.a.status&&(b.sessionStatus=lg(a.a.status));var c=Fj(a.f,Mj,3);0<c.length&&(b.backdropImageAttributions=Ha(c,function(a){return Dj(a,1)}.bind(a)));c=Fj(a.f,Nj,5);0<c.length&&(b.backdropSecondaryActions=Ha(c,function(a){var b={},c=Dj(a,1);c&&(b.text=c);(a=Dj(a,2))&&(b.url=a);return b}.bind(a)));if(c=a.f.getTitle())b.mediaTitle=c;var d=Dj(a.f,2);d&&(b.imgUrl=d);if(a=Dj(a.f,4))b.backdropPrimaryActionUrl=a;c||1!==b.backdropImageAttributions.length||
(b.mediaTitle=b.backdropImageAttributions[0],b.backdropImageAttributions=[]);return b};h=Rj.prototype;
h.V=function(){var a="ip:"+this.j,b=this.w.getState().eurekaInfoState;a=new Lc(a,hg(b.deviceType),b.name);a.features=b.features;a.displayName=b.name;a.needsSetup=b.ethernetConnected&&!b.tosAccepted;if(a.needsSetup&&!a.features.supportsSetup)a=null;else if(this.a&&this.a.status!==chrome.cast.SessionStatus.STOPPED)if(og(this.a.appId))a=Sj(this,a);else if(a.isCasting=!0,this.a.receiver.volume&&(b=this.a.receiver.volume.level,null!==b&&(a.volumeLevel=b),b=this.a.receiver.volume.muted,null!==b&&(a.isMuted=
b)),this.a.status&&(a.sessionStatus=lg(this.a.status)),b=this.a.appId,"85CDB22F"===b||"0F5096E8"===b)this.a.displayName&&(a.mediaTitle=this.a.displayName),this.a.statusText&&(a.mediaSource=this.a.statusText);else if(this.a.displayName&&(a.mediaSource=this.a.displayName),b=Tj(this))if(0<=Ea(b.supportedMediaCommands,chrome.cast.media.MediaCommand.PAUSE)&&(a.canPause=!0),b.playerState&&(a.playerState=kg(b.playerState)),b.media&&(b.media.duration&&(a.mediaDuration=b.media.duration),b=b.media.metadata||
b.media.yb))b.title&&(a.mediaTitle=b.title),b.images&&0<b.images.length&&b.images[0].url&&!b.images[0].url.endsWith(".ico")&&(a.imgUrl=b.images[0].url);return a};h.tb=function(){if(this.g)if(!this.g.appId||!this.g.sessionId)Uj(this),this.c();else if(!this.a||this.a.sessionId!=this.g.sessionId){var a=sg(this.m.i,this.g.appId,this.g.sessionId);a.then(this.lb.bind(this));T(this.h,a);this.g=null}};
h.lb=function(a){a.session.status!==chrome.cast.SessionStatus.STOPPED&&(this.a&&Uj(this),this.a=a.session,this.b=a.context,this.a.addMediaListenerWithContext(this.b,this.o),this.a.addUpdateListenerWithContext(this.b,this.i),og(this.a.appId)&&(this.a.addMessageListenerWithContext(this.b,"urn:x-cast:com.google.cast.sse",this.v),this.a.sendMessageWithContext(this.b,"urn:x-cast:com.google.cast.sse",{type:"GET_STATUS",requestId:Math.floor(4294967295*Math.random())},q,function(){})),this.a.media&&this.a.media.forEach(function(a){a.addUpdateListenerWithContext(this.b,
this.i)}.bind(this)),this.l())};h.hb=function(a,b){"urn:x-cast:com.google.cast.sse"===a&&(a=JSON.parse(b),a=this.B.request(a.backendData),a.then(function(a){this.f=a;this.c()}.bind(this)),T(this.h,a))};h.kb=function(a){this.l();a.addUpdateListenerWithContext(this.b,this.i)};h.start=function(){return this.h.start()};h.stop=function(){return this.h.stop()};h.Oa=function(){return A()};h.Na=function(){Uj(this);return A()};
var Uj=function(a){a.f=null;a.a&&(a.a.media&&a.a.media.forEach(function(a){a.removeUpdateListenerWithContext(this.b,this.i)}.bind(a)),a.a.removeUpdateListenerWithContext(a.b,a.i),a.a.removeMediaListenerWithContext(a.b,a.o),og(a.a.appId)&&a.a.removeMessageListenerWithContext(a.b,"urn:x-cast:com.google.cast.sse",a.v),a.a=null,a.b=null)},Tj=function(a){if(!a.a||!a.a.media)return null;var b=null;a.a.media.forEach(function(a){a&&(b?!b.media&&a.media?b=a:b.playerState==chrome.cast.media.PlayerState.IDLE&&
a.playerState!=chrome.cast.media.PlayerState.IDLE&&(b=a):b=a)}.bind(a));return b};Rj.prototype.l=function(){this.a.status===chrome.cast.SessionStatus.STOPPED&&Uj(this);this.c()};
var Vj=function(a,b){if(a.a&&a.b){var c=Tj(a);c&&0<=Ea(c.supportedMediaCommands,chrome.cast.media.MediaCommand.PAUSE)&&(3==b&&c.playerState==chrome.cast.media.PlayerState.PAUSED?c.playWithContext(a.b,null,a.c,function(){}):4==b&&c.playerState==chrome.cast.media.PlayerState.PLAYING&&c.pauseWithContext(a.b,null,a.c,function(){}))}},Wj=function(a,b,c){if(a.a&&a.b)switch(c){case 4:case 3:Vj(a,c);break;case 5:a.a.stopWithContext(a.b,a.c,function(){});break;case 6:a.a.setReceiverMutedWithContext(a.b,!0,
a.c,function(){});break;case 7:a.a.setReceiverMutedWithContext(a.b,!1,a.c,function(){});break;case 8:b.volumeLevel!==a.a.receiver.volume.level&&a.a.setReceiverVolumeLevelWithContext(a.b,b.volumeLevel,a.c,function(){})}},Xj=function(a,b){if(a.id===b.id)return 0;if(a.needsSetup!==b.needsSetup)return a.needsSetup?-1:1;var c=Aa(a.displayName,b.displayName);return 0!==c?c:a.id<b.id?-1:a.id>b.id?1:0};h=Pj.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};
h.Sa=function(){this.R();var a=this.b.a.f.a;a.listen("added",this.i);a.listen("removed",this.j);a=this.b.b.a.a;a.addListener("Devices.UserAction",this.h);a.addListener("DeviceDiscovery.ScanAgain",this.l);this.b.a.listen("devices",this.g);a=this.b.a;th(a.h);a.P();return this.b.a.start()};
h.Ra=function(){this.b.b.a.a.removeListener("Devices.UserAction",this.h);var a=this.b.a.f.a;a.A("added",this.i);a.A("removed",this.j);this.b.a.A("devices",this.g);var b=[this.b.a.stop()];this.a.forEach(function(a){b.push(a.stop())}.bind(this));this.a=new M;return B(b)};h.ob=function(a){var b="wifi:"+a.properties.GUID;a=this.a.get(b)||new Qj(a.properties);this.a.set(b,a);a.start();this.R()};h.pb=function(a){a="wifi:"+a.properties.GUID;var b=this.a.get(a);b&&(b.stop(),this.a.remove(a),this.R())};
h.Pa=function(a){var b=new M,c=!1;a.devices.forEach(function(a){if(a.ipAddress){var d="ip:"+a.ipAddress,f=this.a.get(d);f||(f=new Rj(this.b,a.ipAddress,a.W,this.R.bind(this)),f.start(),c=!0);var g=f;a.ipAddress!=g.j?(G(),G()):(g.g=a,Bg(g.h).then(g.tb.bind(g)));b.set(d,f);this.a.remove(d)}}.bind(this));this.a.C().forEach(function(a){var c=this.a.get(a);c instanceof Qj&&(b.set(a,c),this.a.remove(a))}.bind(this));0<this.a.s()&&(c=!0);this.a.forEach(function(a){a.stop()}.bind(this));this.a=b;c&&this.R()};
h.R=function(a){var b=[];this.a.forEach(function(a){if(a=a.V()){for(var c,d=Xj||Sa,g=0,l=b.length;g<l;){var p=g+l>>1;var u=d(a,b[p]);0<u?g=p+1:(l=p,c=!u)}c=c?g:~g;0>c&&Ra(b,-(c+1),0,a)}});var c=this.b.b.a.a;c.sendMessage(new Mc(b,a));0===b.length?null===this.c&&(this.c=T(this.f,U(3E4)).then(function(){this.c=null;var a=0;this.a.forEach(function(b){a+=b.V()?1:0});0===a&&c.sendMessage(new H("DeviceDiscovery.NotFound"))}.bind(this))):null!==this.c&&(a=this.c,this.c=null,a.cancel())};
h.Qa=function(a){var b=this.a.get(a.device.id);if(b)switch(a.action){case 1:a=new Je(Ba());a.states=new Pe(0,[new N(1)]);a.commonState=new Ke;a.commonState.device=b.xa();a.commonState.pinned=!0;Te(this.b.f,a);this.b.l(a.id);break;case 2:this.b.j(b.j);break;case 3:case 4:case 5:case 6:case 7:case 8:Wj(b,a.device,a.action)}else G()};h.mb=function(){this.R();var a=this.b.a;th(a.h);a.P()};var Yj=function(a,b){this.c=a;this.i=b;this.b=null;this.j=Li(b);this.g=this.a=null;this.f=new S(this.Ua.bind(this),this.Ta.bind(this));this.h=new M("DeviceSettings.Apply",this.La.bind(this),"DeviceSettings.Reboot",this.o.bind(this),"DeviceSettings.FactoryReset",this.m.bind(this),"DeviceSettings.ForgetWiFi",this.v.bind(this),"DeviceSettings.Exit",this.l.bind(this))};h=Yj.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};
h.Ua=function(){return T(this.f,Oi(this.c.g,this.j)).then(function(a){this.b=a;return B([T(this.f,Mi(a,{options:"build_info.cast_build_revision device_info.mac_address detail net.ip_address settings.country_code settings.locale settings.timezone settings.time_format opt_in.stats wifi.ssid wifi.wpa_id".split(" ")})),T(this.f,aj(a)),T(this.f,bj(a))])}.bind(this)).then(function(a){this.qb.apply(this,a);var b=this.c.b.a.a;this.h.forEach(function(a,d){b.addListener(d,a)});Zj(this,1)}.bind(this))};
h.Ta=function(){var a=this.c.b.a.a;this.h.forEach(function(b,c){a.removeListener(c,b)});this.b=null;this.j=Li(this.i);this.a=null;return A()};
h.qb=function(a,b,c){var d=Si(this.b),e=d.setupApiVersion,f=hg(d.deviceType);c=c.map(function(a){return new Qc(a.timezone,a.display_string,a.offset)});b=b.map(function(a){return new Pc(a.locale,a.display_string)});var g=this.a={};if(7<=e){e=a.wifi;var l=a.settings,p=a.opt_in,u=a.build_info,K=a.device_info;a=a.net;g.deviceType=f;g.name=d.name;g.ssid=!d.ethernetConnected&&e.ssid||null;g.timeZoneId=l.timezone||null;g.supportedTimeZones=c;g.timeFormat=1===l.time_format?1:2;g.localeId=l.locale||"";g.supportedLocales=
b;g.statsOptIn=!!p.stats;g.firmwareVersion=u.cast_build_revision||"";g.countryCode=l.country_code||null;g.macAddress=K.mac_address||"";g.ipAddress=a.ip_address;this.g=void 0!==e.wpa_id?e.wpa_id:null}else l=1===(3<e?a.time_format:2)?1:2,g.deviceType=f,g.name=d.name,g.ssid=!d.ethernetConnected&&a.ssid||null,g.timeZoneId=a.timezone||null,g.supportedTimeZones=c,g.timeFormat=l,g.localeId=a.locale,g.supportedLocales=b,g.statsOptIn=!!(3<e&&a.opt_in&&a.opt_in.stats),g.firmwareVersion=a.build_version,g.countryCode=
3<e&&a.location&&a.location.country_code||null,g.macAddress=a.mac_address,g.ipAddress=a.ip_address,this.g=void 0!==a.wpa_id?a.wpa_id:null};
h.La=function(a){var b=this,c=Si(this.b).features.deviceSettings;a.timeFormat===b.a.timeFormat||c.supportsTimeFormatChange||(a.timeFormat=b.a.timeFormat);a.statsOptIn===b.a.statsOptIn||c.supportsDataCollectionToggle||(a.statsOptIn=b.a.statsOptIn);if(a.name===b.a.name&&a.timeZoneId===b.a.timeZoneId&&a.timeFormat===b.a.timeFormat&&a.localeId===b.a.localeId&&a.statsOptIn===b.a.statsOptIn)Zj(b,1);else{var d=$a(b.a);b.a.name=a.name;b.a.timeZoneId=a.timeZoneId;b.a.timeFormat=a.timeFormat;b.a.localeId=a.localeId;
b.a.statsOptIn=a.statsOptIn;Zj(b,2);E(T(b.f,$i(b.b,ak(b,a))).then(function(){b.a.localeId!==d.localeId?b.c.reload():Zj(b,1)}),function(){b.a=d;Zj(b,3)})}};
var ak=function(a,b){var c=a.b.a;a=1===b.timeFormat?1:2;if(7<=c)return c=new Ie,c.name=b.name,c.settings=new xe,b.timeZoneId&&(c.settings.timezone=b.timeZoneId),c.settings.time_format=a,c.settings.locale=b.localeId,c.opt_in=new ye,c.opt_in.stats=b.statsOptIn,c;if(4<=c&&6>=c)return c=new He,c.name=b.name,b.timeZoneId&&(c.timezone=b.timeZoneId),c.time_format=a,c.locale=b.localeId,c.opt_in=new qe,c.opt_in.stats=b.statsOptIn,c;a=new Ge;a.name=b.name;b.timeZoneId&&(a.timezone=b.timeZoneId);a.locale=b.localeId;
return a},Zj=function(a,b){a.c.b.a.a.sendMessage(new Rc(b,Si(a.b).features,a.a))};Yj.prototype.o=function(){if(Si(this.b).features.deviceSettings.supportsReboot){Wi(this.b,"now");var a=this.b.c.read().deviceIpAddress;oj(this.c.f,new Qe(1,ya(),a));this.c.c()}};Yj.prototype.m=function(){if(Si(this.b).features.deviceSettings.supportsFdr){Wi(this.b,"fdr");var a=this.b.c.read().deviceIpAddress;oj(this.c.f,new Qe(3,ya(),a));this.c.c()}};
Yj.prototype.v=function(){if(Si(this.b).features.deviceSettings.supportsForgetWiFi){var a=this.b,b=this.g;a.b.request({url:Ti(a,"/setup/forget_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new ze(b)),timeout:1E4,G:2});this.c.c()}};Yj.prototype.l=function(){this.c.c()};var bk=chrome.i18n.getMessage("3254351313955764967"),ck=chrome.i18n.getMessage("3485206350043289145");var dk=function(a,b){this.c=a;this.a=b;this.b=new P;this.f=new S(this.h.bind(this),this.g.bind(this))};dk.prototype.start=function(){return this.f.start()};
dk.prototype.h=function(){var a=C();ek(this.c,"start");fk(this);var b=T(this.f,U(18E4)).then(function(){ek(this.c,"load-failed");Q(this.b,"loadTimedOut");a.c(new Jf)}.bind(this));T(this.f,this.a.start()).then(function(){var a=this.a.a;T(this.f,Xg(a,"OfflineUiReady")).then(function(){Q(this.b,"offlineUiReady")}.bind(this));Q(this.b,"waitingForHandshake");return T(this.f,a.sendRequest(new cc))}.bind(this)).then(function(c){switch(c.type){case "Handshake.Response":ek(this.c,"hosting-embedded-ui");Q(this.b,
"embeddedUiReady");b.cancel();a.b();break;case "Handshake.UiVersionNotSupported":ek(this.c,"update-required");Q(this.b,"updateRequired");a.c(c);break;default:ek(this.c,"load-failed"),Q(this.b,"loadFailed")}}.bind(this));return a.a};var fk=function(a){var b=a.c.document;[["#load-failed-message",bk],["#update-required-message",ck]].forEach(function(a){var c=b.querySelector(a[0]);c&&(c.textContent=a[1])})};dk.prototype.g=function(){return this.a.stop()};
var ek=function(a,b){(a=a.document&&a.document.body||null)&&a.setAttribute("class",b)};var gk=function(a,b,c,d,e){this.b=b;this.a=c;this.f=d;this.g=a.localStorage;this.c=e},hk=function(a,b,c){this.b=a;this.l=b;this.m=m(c)?c:3E4;this.c=new M;this.h=!0;this.g=!1;this.a=new R;this.j=new lj(a.g);this.f=new S(this.cb.bind(this),this.bb.bind(this));this.i=this.ab.bind(this)};h=hk.prototype;h.start=function(){return this.f.start()};h.stop=function(){if(!this.g){var a=new Zc(this.l,this.c.u(),!0);this.b.b.a.a.sendMessage(a);this.g=!0}return this.f.stop()};
h.cb=function(){this.b.a.listen("devices",this.i);th(this.b.a);T(this.f,U(this.m)).then(function(){this.h=!1;this.Ea()}.bind(this));return A()};h.bb=function(){this.b.a.A("devices",this.i);this.c=new M;this.h=!0;this.g=!1;this.a=new R;return A()};
h.ab=function(a){var b=this;rj(this.j);(a.msg.devices||[]).forEach(function(a){var c=a.ipAddress;Md(b.c,c)||b.a.contains(c)||sj(b.j,c)||(Of(b.a,c),D(E(Oi(b.b.f,Li(c)).then(function(a){if(7>a.a)throw new F;return T(b.f,Vi(a)).then(function(d){var e=Si(a);d=new Yc(d.token,e.name,hg(e.deviceType),e.ssdpUdn);b.c.set(c,d);b.a.remove(c);b.g||(d=new Zc(b.l,b.c.u(),!b.h&&0===b.a.s()),b.g=d.scanComplete,b.b.b.a.a.sendMessage(d))})}),function(){b.a.remove(c)}),b.Ea.bind(b)))})};
h.Ea=function(){this.h||0!==this.a.s()||this.stop()};var W=function(a,b,c){this.b=new S(b||function(){return A()},c||void 0);this.a=a};W.prototype.start=function(){return this.b.start()};W.prototype.stop=function(){return this.b.stop()};var X=function(a){return a.a.j.a.a};var kk=function(a,b,c,d){var e=ik,f=jk,g=window.location.reload.bind(window.location),l=chrome.i18n.getUILanguage,p=new qh;this.window=a;this.b=b;this.g=c;this.a=a.localStorage;this.l=a.sessionStorage;this.c=d;this.j=e;this.f=f;this.m=g;this.h=l;this.i=p};var lk=function(a){W.call(this,a,this.l.bind(this),this.j.bind(this));this.c=this.f=null;this.g=this.i.bind(this);this.m=this.h.bind(this)};t(lk,W);lk.prototype.l=function(){return T(this.b,mk(this.a)).then(function(a){this.f=a;X(this).addListener("AudioConfirmation.UserAction",this.g);X(this).sendMessage(new wc(1));this.c=3;this.h()}.bind(this))};lk.prototype.j=function(){this.c=this.f=null;X(this).removeListener("AudioConfirmation.UserAction",this.g);return A()};
lk.prototype.h=function(){if(null!==this.c){var a=this.b;var b=this.f;var c=this.c;b=b.b.request({url:Ti(b,"/setup/play_sound"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new Ae(c)),timeout:1E4,G:2});T(a,b);this.c=3;T(this.b,U(1===this.c?3E3:1900)).then(this.m)}};lk.prototype.i=function(a){var b=null;switch(a.action){case 1:this.c=1;b=2;break;case 2:Y(this.a,12);nk(this.a,new N(5));break;case 3:b=3;break;case 4:Y(this.a,13),a=this.a,Ue(a.a.a,a.b),a.a.f()}b&&X(this).sendMessage(new wc(b))};var ok=function(a){W.call(this,a,this.c.bind(this),null)};t(ok,W);ok.prototype.c=function(){var a=this;T(this.b,X(this).sendRequest(new tc((this.a.b.setupApiClientState||null).verificationState.pin))).then(function(b){b.confirmed?(Y(a.a,10),nk(a.a,new N(5))):(Y(a.a,11),T(a.b,X(a).sendRequest(new hc(1))).then(function(){var b=a.a;Ue(b.a.a,b.b);b.a.f()}))});return A()};var pk=function(a,b){this.i=a;this.a=new cj(a,new fj(b));this.b="connected";this.c=null;this.f=new S(this.Wa.bind(this),this.Va.bind(this));this.g=new P},qk=["added","removed","connected","disconnected"];h=pk.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};h.getState=function(){return this.b};h.Wa=function(){var a=this;return a.a.start().then(function(){a.h();qk.forEach(function(b){a.a.a.listen(b,a.h,!0,a)})})};
h.Va=function(){this.b="connected";this.c=null;if(!this.a)return A();var a=this.a;this.a=null;qk.forEach(function(b){a.a.A(b,this.h,!0,this)}.bind(this));return a.stop()};var rk=function(a,b){a.b!==b&&(a.b=b,Q(a.g,new O(b)))};
pk.prototype.h=function(){if("failed"!==this.b){var a=null;1===this.a.networks.s()&&(a=this.a.networks.u()[0]);if(!a)"connected"===this.b&&(sk(this),rk(this,"disconnected"));else if("Connected"===a.ConnectionState)this.c&&(a=this.c,this.c=null,a.cancel()),rk(this,"connected");else if("connected"===this.b||"disconnected"===this.b)sk(this),rk(this,"reconnecting"),tk(this,a.GUID)}};
var tk=function(a,b){E(T(a.f,a.i.startConnect(b)),function(){rk(this,"failed");this.a.stop()}.bind(a))},sk=function(a){a.c||(a.c=T(a.f,U(9E4)).then(function(){rk(this,"failed");this.a.stop()}.bind(a)))};var uk=function(a){W.call(this,a,this.v.bind(this),this.m.bind(this));this.f=null;this.o=0;this.h=this.g=this.j=this.c=null};t(uk,W);var vk=["connected","disconnected","reconnecting","failed"];uk.prototype.v=function(){var a=this,b=Z(a.a);X(a).sendMessage(mg(b.connectWiFi,wk(a.a)));a.g=new pk(a.a.a.b,b.connectedHotSpotBssid);vk.forEach(function(b){a.g.g.listen(b,a.i,!0,a)});return B([T(a.b,a.g.start()),T(a.b,mk(a.a)).then(function(b){a.f=b;xk(a)})]).then(a.w.bind(a))};
uk.prototype.m=function(){var a=this;yk(a);zk(a);if(!a.g)return A();var b=a.g;a.g=null;vk.forEach(function(c){b.g.A(c,a.i,!0,a)});return b.stop()};var xk=function(a,b){a.c||(a.c=E(U(b||0).then(function(){++a.o;a.c=Mi(a.f,{options:["version","setup.setup_state","net.ip_address"]});return a.c}).then(a.l.bind(a)),function(a){Lf(a)}).then(function(){a.c=null;xk(a,3E3)}))},zk=function(a){if(a.c){var b=a.c;a.c=null;b.cancel()}};
uk.prototype.l=function(){var a=Si(this.f).setupState;if(a!==this.j)switch(this.j=a,a){case 31:return Ak(this,2),Mb(new F);case 21:case 41:case 10:case 11:return Ak(this,1),Mb(new F);case 60:case 61:case 51:return Bk(this),Mb(new F)}};
var Bk=function(a){yk(a);Y(a.a,19);var b=Si(a.f);D(E(T(a.b,a.a.a.c.a()).then(function(c){c=ng(b.setupApiVersion,Z(a.a).deviceName,3!==c);return T(a.b,$i(a.f,c))}),function(a){Lf(a)}).then(function(){var c=Z(a.a),d=c.connectedHotSpotBssid;oj(a.a.a.a,new Qe(2,ya(),d));delete c.connectedHotSpotBssid;Ck(a.a,c);if(60!==b.setupState&&4<=b.setupApiVersion)return E(T(a.b,Xi(a.f)),q)}),function(){nk(a.a,new N(8))})},Ak=function(a,b){yk(a);Y(a.a,2===b?17:18);var c=Z(a.a);c.connectWiFi.a=b;Ck(a.a,c);nk(a.a,
new N(6))};uk.prototype.i=function(a){switch(a.type){case "connected":xk(this);break;case "disconnected":case "reconnecting":zk(this);break;case "failed":Ak(this,1)}};uk.prototype.w=function(){clearTimeout(this.h);this.h=setTimeout(function(){Ak(this,1)}.bind(this),9E4)};var yk=function(a){clearTimeout(a.h);a.h=null};var Dk="AC AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CP CR CU CV CW CX CY CZ DE DG DJ DK DM DO DZ EA EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU IC ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TA TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW".split(" ");var Ek=function(a){W.call(this,a,this.g.bind(this),null);this.f=!1;this.c=null};t(Ek,W);
Ek.prototype.g=function(){var a=Z(this.a);this.f=!!a.device.ipAddress;var b=(this.a.b.setupApiClientState||null).eurekaInfoState,c=a.deviceName||b.name;b=3===b.setupApiVersion;this.f||b||a.country?a=null:(a=this.a.a.h(),a=(b=vh(a))&&-1!==Dk.indexOf(b)?b:(a=uh(a).toUpperCase())&&-1!==Dk.indexOf(a)?a:"US");this.c=a;E(T(this.b,X(this).sendRequest(new zc(wk(this.a),c,this.c))).then(this.h.bind(this)),this.a.g.bind(this.a));return A()};
Ek.prototype.h=function(a){var b=this;Y(b.a,14);var c=Z(b.a);c.deviceName=a.name;b.c&&a.country&&(c.country=a.country);Ck(b.a,c);if(b.f){var d=null;return B([T(b.b,mk(b.a)),b.a.a.c.a()]).then(function(a){d=a[0];a=a[1];var e=[];7<=d.a&&e.push(T(b.b,d.b.request({url:Ti(d,"/setup/accept_tos"),method:"POST",timeout:1E4,G:2})));e.push(T(b.b,$i(d,ng(d.a,c.deviceName,3!==a))));return B(e)}).then(function(){return T(b.b,Mi(d,{options:["setup.setup_state"]}))}).then(function(){switch(Si(d).setupState){case 60:Fk(b.a);
break;case 62:nk(b.a,new N(10));break;default:return Mb()}})}nk(b.a,new N(6))};var Gk=function(a){W.call(this,a,this.c.bind(this),null)};t(Gk,W);Gk.prototype.c=function(){var a=this,b=null;return B([T(this.b,mk(this.a)),this.a.a.c.a()]).then(function(c){b=c[0];c=ng(b.a,Z(a.a).deviceName,3!==c[1]);c=[T(a.b,$i(b,c))];4<=b.a&&c.push(T(a.b,Xi(b)));return B(c)}).then(function(){return T(a.b,Mi(b,{options:["setup.setup_state"]}))}).then(function(){switch(Si(b).setupState){case 60:case 52:Fk(a.a);break;case 62:nk(a.a,new N(10));break;default:return Mb()}})};var Hk=function(a,b,c,d){W.call(this,a,this.Z.bind(this),this.m.bind(this));this.g=1;this.c=new vg;this.B=c;this.D=b;this.i=null;this.I=void 0!==d?d:Xe(a.a.a);this.h=null;this.v=this.T.bind(this);this.l=this.j.bind(this);this.J=this.S.bind(this)};t(Hk,W);
Hk.prototype.Z=function(){var a=this;Ik(a,1);a.h=new cj(this.a.a.b);var b=a.h.a;b.listen("connected",a.fa,!0,a);b.listen("added",a.o,!0,a);b=X(a);b.addListener("WiFiSwitching.Proceed",a.v);b.addListener("WiFiSwitching.RetryConnection",a.l);b.addListener("WiFiConfig.Retry",a.l);return T(a.b,a.h.start()).then(function(){var b=a.h.networks;(b=a.i&&b.get(a.i)||null)?"Connected"===b.ConnectionState?a.j():a.I?(a.O(1),Ik(a,2),a.X(1),wg(a.c,U(25E3)).then(a.w.bind(a)),a.a.a.b.startConnect(a.i)):a.w():(Ik(a,
11),a.a.g())})};Hk.prototype.m=function(){this.g=1;this.i=null;var a=this.c;this.c=new vg;a=[xg(a)];var b=this.h;this.h=null;if(b){var c=b.a;c.A("connected",this.fa,!0,this);c.listen("added",this.o,!0,this);a.push(b.stop())}b=X(this);b.removeListener("WiFiSwitching.Proceed",this.v);b.removeListener("WiFiSwitching.RetryConnection",this.l);b.removeListener("WiFiConfig.Retry",this.l);return B(a)};
Hk.prototype.fa=function(a){if(Jk(this,a))switch(this.g){case 2:this.O(2);this.j();break;case 6:this.O(4),this.j()}};Hk.prototype.o=function(a){Jk(this,a)&&1===this.g&&(this.i=a.properties.GUID)};var Jk=function(a,b){b=b.properties.WiFi;return a.B&&!bg(b.BSSID,a.B)||a.D&&b.SSID!==a.D?!1:!0};Hk.prototype.w=function(){this.O(3);Ik(this,5);this.L(1)};
Hk.prototype.T=function(){var a=this;Ik(a,6);a.L(2);var b=a.h.networks.get(this.i);b&&"Connected"===b.ConnectionState?a.j():wg(a.c,U(1E4)).then(function(){Ik(a,7);a.L(3)})};var Kk=function(a){var b=C();wg(a.c,b.a);var c=null,d=function(e){c=U(e).then(a.sa.bind(a)).then(function(c){a.O(5);b.b(c)},function(c){c instanceof Fi?d(2E3):c instanceof Pi&&(Y(a.a,9),b.c(c))})};D(b.a,function(){if(c){var a=c;c=null;a.cancel()}});d(0);return b.a};
Hk.prototype.j=function(){var a=this;6===a.g||9===a.g?(Ik(a,8),this.L(2)):(Ik(a,3),this.X(1));var b=Kk(a).then(function(b){Ik(a,11);a.ta(b)},this.J);wg(a.c,U(12E4)).then(function(){b.cancel()})};Hk.prototype.S=function(a){a=a instanceof Ri||a instanceof Pi;8===this.g?a?(Ik(this,10),this.L(5)):(Ik(this,9),this.L(4)):a?(Ik(this,10),this.X(3)):(Ik(this,4),this.X(2))};var Ik=function(a,b){b!==a.g&&(a.g=b,b=a.c,a.c=new vg,xg(b))};var Lk=function(a){this.f=Z(a).device;Hk.call(this,a,null,this.f.bssid)};t(Lk,Hk);var Mk=new M(1,4,2,5,3,6,4,7,5,8);h=Lk.prototype;h.fa=function(a){var b=a.properties.WiFi,c=null;bg(b.BSSID,this.f.bssid)?(c=Z(this.a),c.connectedHotSpotBssid=b.BSSID):eg(a.properties)||(c=Z(this.a),c.originalWiFiNetwork={ssid:b.SSID,bssid:b.BSSID});c&&Ck(this.a,c);Lk.H.fa.call(this,a)};h.sa=function(){var a=this.a.a;return T(this.b,Qi(a.g,Li("192.168.255.249"),a.b,{ssid:this.f.ssid,bssid:this.f.bssid},a.h()))};
h.X=function(a){var b=this.a.a,c=X(this),d=hg(this.f.type);c.sendMessage(new nc(1===a&&3||2===a&&4||3===a&&5||null,d,this.f.name));3===a&&wg(this.c,Xg(c,"BadDeviceAck")).then(b.f.bind(b))};h.L=function(a){var b=this.a.a,c=X(this);c.sendMessage(new qc(a,this.f.name,this.f.ssid));5===a&&wg(this.c,Xg(c,"BadDeviceAck")).then(b.f.bind(b))};h.ta=function(a){a=a.getState();this.a.h(a);a.eurekaInfoState.features.supportsDisplay?nk(this.a,new N(3)):nk(this.a,new N(4))};
h.O=function(a){(a=Mk.get(a))&&Y(this.a,a)};var Nk=function(a,b,c,d,e){var f=C(),g=new vj(b,c,d,e),l=function(b){return b.W.getState().eurekaInfoState.ssdpUdn===a},p=function(a){(a=Ia(a.devices,l))&&f.b(a.ipAddress)};g.listen("devices",p);var u=null;g.start().then(function(){u=setInterval(function(){th(g.h);g.P()},5E3)});var K=setTimeout(f.c.bind(f),18E4);return D(f.a,function(){clearTimeout(K);clearInterval(u);g.A("devices",p);g.stop()})};var Ok=function(a){W.call(this,a,this.i.bind(this),null);this.c=null;this.l=0;this.f=null;this.h=0};t(Ok,W);Ok.prototype.i=function(){var a=this;Y(a.a,30);return T(this.b,mk(this.a)).then(function(b){a.c=b;X(a).sendMessage(new jc("OtaUpdate.Pending",wk(a.a)));Pk(a,0)})};
var Pk=function(a,b){E(T(a.b,U(b)).then(function(){++a.l;return T(a.b,Mi(a.c,{options:["ota_status","setup.setup_state"]}))}).then(function(b){var c=Si(a.c),e=0;7<=a.c.a&&(e=b.ota_status.download_progress);if(a.f!==c.setupState||e!==a.h)a.f=c.setupState,a.h=e,60===a.f&&a.g();Pk(a,3E3)}),function(b){Lf(b);b=a.c.getState().eurekaInfoState.ssdpUdn;var c=a.a.a;T(a.b,Nk(b,c.b,c.i,c.g,c.window)).then(a.g.bind(a),a.j.bind(a))})};
Ok.prototype.g=function(){Y(this.a,31);var a=X(this);T(this.b,Xg(a,"OtaUpdate.Proceed")).then(function(){Fk(this.a)}.bind(this));a.sendMessage(new jc("OtaUpdate.Done",wk(this.a)))};Ok.prototype.j=function(){};var Qk=function(a,b,c){this.f=new S(this.m.bind(this),this.l.bind(this));this.a=a;this.j=b;this.b=c;this.c=null;this.i=new P;b.a.a.addListener("RestartSetup",this.v.bind(this));b.a.a.addListener("GoToDeviceList",this.a.f.bind(this.a))},Rk=function(a){O.call(this,"newState");this.state=a};t(Rk,O);Qk.prototype.start=function(){return this.f.start()};Qk.prototype.stop=function(){return this.f.stop()};
var Fk=function(a){var b=Z(a),c=a.b.setupApiClientState||null,d=c.deviceIpAddress;c=c.eurekaInfoState;Y(a,b.device&&b.device.bssid?25:28);b=new ih("deviceJustSetUp");b.deviceJustSetUp=new jh(d,c.name,c.ssdpUdn,c.modelName);var e=new kh;e.audioOutSupported=!0;e.videoOutSupported=!!c.features.supportsDisplay;b.deviceJustSetUp.capabilities=e;a.a.l.setItem("showDeviceBanner",d);Ue(a.a.a,a.b);D(T(a.f,Mf(a.a.i.sendMessage(b),1E4)),function(){D(a.stop(),function(){a.a.f()})})},wk=function(a){return(a=a.b.commonState&&
a.b.commonState.device&&a.b.commonState.device.type)?hg(a):2},mk=function(a){var b={read:function(){return a.b.setupApiClientState||null},write:a.h.bind(a)};return Oi(a.a.g,b,a.a.h())};Qk.prototype.h=function(a){a?this.b.setupApiClientState=a:delete this.b.setupApiClientState;Te(this.a.a,this.b)};
var Z=function(a){return a.b.commonState||new Ke},Ck=function(a,b){b?a.b.commonState=b:delete a.b.commonState;Te(a.a.a,a.b)},nk=function(a,b){a.c.stop().then(function(){if(a.b.states){var c=a.b.states;c.all=c.all.slice(0,c.current+1);c.all.push(b);c.current=c.all.length-1}else a.b.states=new Pe(0,[b]);Te(a.a.a,a.b);a.c=a.a.j(a,b.type);Q(a.i,new Rk(b.type));E(T(a.f,a.c.start()),function(b){if(b instanceof F)switch(a.f.getState()){case "starting":case "started":a.g()}else a.g()})})};
Qk.prototype.g=function(){Ue(this.a.a,this.b);this.j.a.a.sendMessage(new jc("ShowGenericSetupError",wk(this)));E(this.stop(),q)};var Y=function(a,b){a.a.c.b(b)};
Qk.prototype.m=function(){var a=this.b.states.all[this.b.states.current].type;this.c=this.a.j(this,a);Q(this.i,new Rk(a));null===this.a.a.getItem("setupNoCountryDetection")&&(a=Z(this),a.country||a.connectedHotSpotBssid||T(this.f,this.j.a.a.sendRequest(new Uc)).then(function(a){var b=Z(this);b.country||(b.country=a.countryCode,Ck(this,b))}.bind(this)));return this.c.start()};Qk.prototype.l=function(){var a=this.c;this.c=null;Q(this.i,new Rk(null));return a.stop()};
Qk.prototype.v=function(){Ue(this.a.a,this.b);this.a.m()};var Sk=function(a){W.call(this,a,this.D.bind(this),this.B.bind(this));this.c=1;this.f=this.h=null;this.g=new M;this.i=new M;this.j=null;this.o=this.J.bind(this);this.l=this.w.bind(this)};t(Sk,W);
Sk.prototype.D=function(){var a=this;Tk(a,1);X(a).addListener("SetupStart.Proceed",a.o);var b=[];b.push(T(a.b,this.a.a.c.a()).then(function(b){a.j=b}));var c=Z(a.a);c.device&&!c.pinned&&(c.device=void 0,Ck(a.a,c));var d=a.a.a;a.f=new vj(d.b,d.i,d.g,d.window);d=a.f.f.a;d.listen("added",a.m,!0,a);d.listen("connected",a.v,!0,a);a.f.listen("devices",this.l);b.push(T(a.b,a.f.start()));Bg(a.b).then(function(){c.pinned&&c.device?(a.h=c.device,Tk(a,5),Uk(a)):0!=a.i.c?Vk(a,a.i.M(!1).next()):Jd(a.g,function(b){if("NotConnected"===
b.ConnectionState)return!0;Wk(a,b);return!1})&&(Tk(a,2),Uk(a),T(a.b,U(5E3)).then(a.I.bind(a)))});return B(b)};Sk.prototype.B=function(){this.c=1;this.h=null;this.g=new M;this.i=new M;this.j=null;X(this).removeListener("SetupStart.Proceed",this.o);if(!this.f)return A();var a=this.f;this.f=null;var b=a.f.a;b.A("added",this.m,!0,this);b.A("connected",this.v,!0,this);a.A("devices",this.l);return a.stop()};
var Tk=function(a,b){b!==a.c&&(a.c=b)},Uk=function(a){var b=X(a);switch(a.c){case 1:case 2:b.sendMessage(new lc(!1));break;case 3:b.sendMessage(new lc(!0));break;case 4:b.sendMessage(new H("DeviceDiscovery.NotFound"));break;case 5:Xk(a,1);break;case 6:Xk(a,2);break;case 7:Xk(a,3);break;case 8:Xk(a,4)}},Xk=function(a,b){var c=hg(a.h.type);b=new nc(b,c,a.h.name);b.otherDevicesExist=1<a.g.s()+a.i.s();b.analyticsOptIn=3!==a.j;X(a).sendMessage(b)};
Sk.prototype.I=function(){if(2===this.c)if(0===this.g.s())Tk(this,3),Uk(this),T(this.b,U(45E3)).then(function(){3===this.c&&(this.f.stop(),Tk(this,4),Uk(this))}.bind(this));else{var a=Id(this.g,function(a,c){return"NotConnected"!==c.ConnectionState?c:(c.WiFi&&c.WiFi.SignalStrength||-Infinity)<(a&&a.WiFi&&a.WiFi.SignalStrength||-Infinity)?a:c});Wk(this,a)}};
var Wk=function(a,b){b=b&&b.WiFi;var c=b.SSID,d=dg(c);a.h=new Le({name:d.name,type:d.type,ssid:c,bssid:b.BSSID});Tk(a,5);Uk(a)},Vk=function(a,b){var c=b.W.getState().eurekaInfoState;a.h=new Le({name:c.name,type:c.deviceType,ipAddress:b.ipAddress});Tk(a,5);Uk(a)};Sk.prototype.m=function(a){a=a.properties;var b=!Md(this.g,a.GUID);this.g.set(a.GUID,a);5===this.c?b&&Uk(this):3===this.c&&Wk(this,a)};Sk.prototype.v=function(a){2!==this.c&&3!==this.c||Wk(this,a.properties)};
Sk.prototype.w=function(a){var b=this,c=null;a.devices.filter(function(a){a=a.W.getState().eurekaInfoState;return a.features.supportsSetup&&a.ethernetConnected&&!a.tosAccepted}).forEach(function(a){Md(b.i,a.ipAddress)||(b.i.set(a.ipAddress,a),c=c||a)});c&&(2===b.c||3===b.c?Vk(b,c):5===b.c&&Uk(b))};
Sk.prototype.J=function(){var a=this;5!==a.c&&8!==a.c||Yk(a).then(function(){var b=Z(a.a);b.device=a.h;Ck(a.a,b);if(b.device.bssid)Y(a.a,3),nk(a.a,new N(2));else{Y(a.a,27);Tk(a,7);Uk(a);var c=a.a.a;E(T(a.b,Oi(c.g,Li(b.device.ipAddress),c.h())).then(function(b){a.a.h(b.getState());Y(a.a,27);nk(a.a,new N(5))}),function(){Tk(a,8);Uk(a)})}})};
var Yk=function(a){var b=a.a.a.a;if(null!==b.getItem("setupTosAccepted"))return A();var c=a.a.a.c,d=T(a.b,Xg(X(a),"SetupStart.TosAccepted")).then(function(a){c.h(a.analyticsOptIn);b.setItem("setupTosAccepted","")}.bind(a));Tk(a,6);Uk(a);return d};var $k=function(a){this.f=a;this.b=new P;this.networks=new M;this.c=!1;this.a=new S(function(){Zk(this);return A()}.bind(this),function(){this.networks.clear();this.c=!1;return A()}.bind(this))},cl=function(a){this.id=al(a);this.ssid=a.ssid;this.Ga=a.wpa_auth;this.Ha=a.wpa_cipher;this.Ia=a.wpa_id;this.ja=new R;this.Y=a.signal_level;this.Aa=this.ha=!1;bl(this,a)},bl=function(a,b){Of(a.ja,b.bssid);a.Y=Math.max(a.Y,b.signal_level);b.ap_list&&b.ap_list.forEach(function(a){Of(this.ja,a.bssid);this.Y=Math.max(this.Y,
a.signal_level);this.ha=this.ha||5E3<=a.frequency}.bind(a))},dl=function(){O.call(this,"error")};t(dl,O);var el=function(){this.networks=new M;this.a=0;this.K=C()},al=function(a){return a.wpa_id?a.wpa_id.toString():a.ssid+":"+a.wpa_auth+":"+a.wpa_cipher};$k.prototype.start=function(){return this.a.start()};$k.prototype.stop=function(){return this.a.stop()};
var Zk=function(a){E(T(a.a,Zi(a.f)).then(function(){T(a.a,U(3E3))}).then(function(){var b=new el;a.g(b);return b.K.a}).then(a.h.bind(a)).then(function(){return T(a.a,U(1E3))}).then(function(){Zk(a)}),function(b){Lf(b);Q(a.b,new dl);a.stop()})};$k.prototype.g=function(a){E(T(this.a,Yi(this.f)).then(this.i.bind(this,a)).then(function(){3===a.a?a.K.b(a.networks):T(this.a,U(2E3)).then(this.g.bind(this,a))}.bind(this)),function(b){a.K.c(b)})};
$k.prototype.i=function(a,b){var c=!1,d=!1;b.filter(function(a){return 1!==a.wpa_auth?!0:!cg(a.bssid)}).forEach(function(b){var e=al(b),g=a.networks.get(e);g?bl(g,b):(g=new cl(b),a.networks.set(e,g),c=!0,Md(this.networks,e)||(this.networks.set(e,g),d=!0))}.bind(this));a.a=c?0:a.a+1;if(d||!this.c)Q(this.b,new O("networksAdded")),this.c=!0};
$k.prototype.h=function(a){a.forEach(function(a){a.Aa=!0});Hd(Qf(new R(this.networks.C()),a.C()),function(b){var c=this.networks.get(b);c.Y=-Infinity;a.set(b,c)}.bind(this));this.networks=a;Q(this.b,new O("scanCompleted"))};var fl=function(a){W.call(this,a,this.w.bind(this),this.o.bind(this));this.h=this.f=this.c=this.g=null;this.v=this.i.bind(this);this.j=this.B.bind(this);this.m=this.D.bind(this)};t(fl,W);
fl.prototype.w=function(){var a=this;return T(a.b,mk(a.a)).then(function(b){a.g=b;var c=null;b=X(a);c=Z(a.a);a.f=c.connectWiFi||null;if(a.f){var d=mg(a.f,wk(a.a));delete c.connectWiFi;Ck(a.a,c);2===a.f.a?c=a.i():(b.addListener("WiFiConfig.ErrorAck",a.v),c=A());gl(a,d)}else c=a.i(),T(a.b,U(7E3)).then(function(){a.h||gl(a,new Dc(1,wk(a.a),[],null))});b.addListener("WiFiConfig.Retry",a.m);return c})};
fl.prototype.i=function(){if(this.c)return A();this.c=new $k(this.g);this.c.b.listen("networksAdded",this.l,!0,this);X(this).addListener("WiFiConfig.Connect",this.j);hl(this);return this.c.start()};fl.prototype.o=function(){this.h=this.g=null;var a=X(this);a.removeListener("WiFiConfig.Connect",this.j);a.removeListener("WiFiConfig.Retry",this.m);a.removeListener("WiFiConfig.ErrorAck",this.v);return this.c?(this.c.b.A("networksAdded",this.l,!0,this),a=this.c,this.c=null,a.stop()):A()};
var gl=function(a,b){a.h=b;X(a).sendMessage(b)};fl.prototype.l=function(){if(this.h)X(this).sendMessage(new Ec(this.c.networks.u().map(function(a){return new Cc(a.id,a.ssid,ig(a.Ga))})));else{var a=Z(this.a),b=a.originalWiFiNetwork&&a.originalWiFiNetwork.bssid,c=[],d=null;Hd(this.c.networks,function(a){var e=new Cc(a.id,a.ssid,ig(a.Ga));c.push(e);b&&a.ja.contains(b)&&(d=e)});gl(this,new Dc(1,wk(this.a),c,d))}};
fl.prototype.B=function(a){var b=this,c=il(b,a);T(b.b,new z(function(d){a.password?d(jl(b,a.password).then(function(a){c.msg.enc_passwd=a})):d()})).then(function(){return T(b.b,kl(b,c))}).then(function(d){d?(b.f=c,gl(b,new Dc(5,wk(b.a),b.h.networks,a.network))):(d=Z(b.a),d.connectWiFi=c,Ck(b.a,d),E(Ui(b.g,c.msg),q),Y(b.a,15),nk(b.a,new N(7)))})};
var il=function(a,b){var c=new Ne(new ie(b.network.ssid,jg(b.network.security)));b.network.id&&(c.b=b.network.id,a.c&&Md(a.c.networks,b.network.id)?(a=a.c.networks.get(b.network.id),a.Ha&&(c.msg.wpa_cipher=a.Ha),a.Ia&&(c.msg.wpa_id=a.Ia)):a.f&&a.f.b===b.network.id&&(a=a.f.msg,a.wpa_cipher&&(c.msg.wpa_cipher=a.wpa_cipher),a.wpa_id&&(c.msg.wpa_id=a.wpa_id)));return c},kl=function(a,b){var c=Z(a.a);if("m"!==(c.device&&c.device.type))return A(!1);var d=b.b;if(!d)return A(!1);if(b=a.c.networks.get(d)){if(b.ha)return A(!1);
if(b.Aa)return A(!0)}return Kf(a.c.b,"scanCompleted").then(function(){var b=a.c.networks.get(d);return b&&!b.ha})};fl.prototype.D=function(){var a=Z(this.a);a.connectWiFi=this.f;Ck(this.a,a);E(Ui(this.g,a.connectWiFi.msg),q);Y(this.a,15);nk(this.a,new N(7))};
var jl=function(a,b){var c=a.g.getState().verificationState.verificationProperties;return a.a.a.b.verifyAndEncryptData(c,b)},hl=function(a){var b=a.g.a;if(!(4>b)){var c=Z(a.a).country,d=null;7>b?(b=new He,b.location=new pe,b.location.country_code=c,d=b):(b=new Ie,b.settings=new xe,b.settings.country_code=c,d=b);E(T(a.b,$i(a.g,d)),function(){})}};var ll=function(a){var b=Z(a).connectWiFi,c=Xe(a.a.a);w("Macintosh")&&1!==b.msg.wpa_auth&&(c=!1);Hk.call(this,a,b.msg.ssid,null,c);this.f=null};t(ll,Hk);var ml=new M(1,20,2,21,3,22,4,23,5,24);ll.prototype.m=function(){this.f=null;return ll.H.m.call(this)};var nl=function(a){return a.f?A(a.f):T(a.b,mk(a.a)).then(function(b){a.f=Si(b).connectedIpAddress;return a.f})};h=ll.prototype;h.sa=function(){var a=this;return nl(a).then(function(b){return T(a.b,Oi(a.a.a.g,Li(b)))})};
h.X=function(a){var b=Z(this.a),c=b.connectWiFi;a=2===a||3===a?1:void 0;c.a!==a&&(c.a=a,Ck(this.a,b));X(this).sendMessage(mg(c,wk(this.a)))};h.L=function(a){X(this).sendMessage(new rc(a,Z(this.a).connectWiFi.msg.ssid))};h.ta=function(a){this.a.h(a.getState());nk(this.a,new N(9))};h.O=function(a){(a=ml.get(a))&&Y(this.a,a)};var ik=function(a,b){switch(b){case 1:return new Sk(a);case 2:return new Lk(a);case 3:return new ok(a);case 4:return new lk(a);case 5:return new Ek(a);case 6:return new fl(a);case 7:return new uk(a);case 8:return new ll(a);case 9:return new Gk(a);case 10:return new Ok(a);default:return new W(a,null,null)}};var ol=null;r("castApp.app.setupManager",ol);var pl={ub:"devices",vb:"offers",wb:"setup",ERROR:"error"},ql=/^https?:/i,rl=function(a){if(!a||"#"==a)return{};a.startsWith("#")&&(a=a.slice(1));var b=a.split("/");if(!(0<=Ea(Ya(pl),b[0])))return{};a={N:b[0]};if(b[1])switch(a.N){case "devices":b=decodeURIComponent(b[1]);yd(b)&&(a.ipAddress=b);break;case "setup":a.na=b[1];break;case "offers":b=decodeURIComponent(b[1]),ql.test(b)&&(a.Ba=b)}return a};
window.addEventListener("hashchange",function(a){var b=de(a.oldURL).g;a=de(a.newURL).g;rl(b).N!==rl(a).N&&location.reload()});
var jk=function(){window.location.hash="devices"},sl=function(a){window.location.hash="setup/"+a},tl=function(a){window.location.hash="devices/"+encodeURIComponent(a)},ul=function(){window.location.hash="error"},vl=function(a){if(w("Linux"))ul();else{var b=chrome.metricsPrivate?new af(window.localStorage):new $e,c=chrome.networkingPrivate?tg.b():null,d=new kk(window,c,new Ii,b),e=new dk(window,a),f=function(){var a=rl(window.location.hash);if("setup"===a.N){var b=null;if(a.na){if(ol&&ol.b.id===a.na)return;
b=Ia(Re(d.a),function(b){return b.id===a.na})}b||(b=new Je(Ba()),b.states=new Pe(0,[new N(1)]),Te(d.a,b),window.history.replaceState(null,"","#setup/"+b.id));ol&&ol.stop();ol=new Qk(d,e,b);ol.start()}};e.start().then(function(){f();window.addEventListener("hashchange",f)})}},wl=function(a,b){if(w("Linux"))ul();else{var c=new dk(window,a),d=chrome.networkingPrivate?tg.b():null,e=new Ii,f=new fh(window,c,e,sl,jk,tl,window.location.reload.bind(window.location),new rg,a,chrome.i18n.getUILanguage,new vj(d,
b,e,window)),g=null,l=null,p=function(a){if(!l||l.i!==a){var b=g&&g.stop()||l&&l.stop()||A();g=null;var c=l=new Yj(f,a);b.then(function(){l===c&&E(l.start(),jk)})}},u=function(){if(!g){var a=l&&l.stop()||A(),b=g=new Pj(f);l=null;a.then(function(){b===g&&g.start()})}},K=function(){var a=rl(location.hash);"devices"===a.N&&(a.ipAddress?p(a.ipAddress):u())};c.start().then(function(){K();window.addEventListener("hashchange",K)})}},yl=function(a,b){var c=new dk(window,a);a=chrome.metricsPrivate?new af(window.localStorage):
new $e;var d=new gk(window,c,b,new Ii,a);c.start().then(function(){var a=c.a.a,b=new M;a.addListener("Offers.Scan",function(a){var c=a.scanId;Md(b,c)||(a=new hk(d,c),b.set(c,a),Kf(a.f.c,"stopped").then(function(){b.remove(c)}),a.start())});a.addListener("Offers.Redeem",function(a){var b=encodeURIComponent(a.url);xl(b).then(function(a){0===a.length?chrome.tabs.create({url:"chrome://cast/#offers/"+b,active:!0}):(chrome.tabs.update(a[0].tabId,{active:!0}),chrome.windows.update(a[0].windowId,{active:!0}))})});
a.addListener("Offers.AnalyticsEvent",function(a){d.c.f(a)});a.sendMessage(new H("Offers.Show"))})},zl=function(a){ek(window,"start");E(Hi(new Ii,{url:a}).then(function(b){var c=b.url;return c&&ql.test(c)?xl(encodeURIComponent(a)).then(function(a){a.forEach(function(a){chrome.tabs.update(a.id,{url:c})})}):Mb()}),function(){ek(window,"unknown-error")})},xl=function(a){return new z(function(b){chrome.tabs.query({url:["chrome://cast/*","chrome-extension://"+chrome.runtime.id+"/cast_setup*"]},function(c){var d=
[];c.forEach(function(b){-1!==b.url.indexOf(a)&&d.push(b)});b(d)})})};window.addEventListener("load",function(){var a=new qh,b=new ch(window);b.f.listen("originViolation",ul);Se();var c=rl(location.hash);switch(c.N){case "devices":wl(b,a);break;case "offers":c.Ba?zl(c.Ba):yl(b,a);break;case "setup":vl(b);break;case "error":ek(window,"unknown-error");break;default:JSON.stringify(c),jk()}});
