'use strict';var k,aa=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}},ba=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}},ca="function"==typeof Object.create?Object.create:function(a){var b=function(){};b.prototype=a;return new b},da;
if("function"==typeof Object.setPrototypeOf)da=Object.setPrototypeOf;else{var ea;a:{var fa={Ja:!0},ha={};try{ha.__proto__=fa;ea=ha.Ja;break a}catch(a){}ea=!1}da=ea?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}
var ia=da,ja=function(a,b){a.prototype=ca(b.prototype);a.prototype.constructor=a;if(ia)ia(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.F=b.prototype},ka="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},la="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:
this,ma=function(a,b){if(b){var c=la;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&&ka(c,a,{configurable:!0,writable:!0,value:b})}},na=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+""};
ma("String.prototype.endsWith",function(a){return a?a:function(b,c){var d=na(this,b,"endsWith");b+="";void 0===c&&(c=d.length);c=Math.max(0,Math.min(c|0,d.length));for(var e=b.length;0<e&&0<c;)if(d[--c]!=b[--e])return!1;return 0>=e}});ma("String.prototype.startsWith",function(a){return a?a:function(b,c){var d=na(this,b,"startsWith");b+="";var e=d.length,f=b.length;c=Math.max(0,Math.min(c|0,d.length));for(var g=0;g<f&&c<e;)if(d[c++]!=b[g++])return!1;return g>=f}});
var oa=oa||{},l=this||self,pa=function(a){return void 0!==a},n=function(a){return"string"==typeof a},qa=function(a){return"number"==typeof a},p=function(){},ra=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},sa=function(a){return"array"==ra(a)},ta=function(a){var b=ra(a);return"array"==b||"object"==b&&"number"==typeof a.length},ua=function(a){return"function"==ra(a)},va=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},wa="closure_uid_"+(1E9*Math.random()>>>
0),xa=0,ya=function(a,b,c){return a.call.apply(a.bind,arguments)},za=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var e=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(e,d);return a.apply(b,e)}}return function(){return a.apply(b,arguments)}},Aa=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Aa=ya:Aa=za;return Aa.apply(null,arguments)},Ba=function(a,
b){var c=Array.prototype.slice.call(arguments,1);return function(){var d=c.slice();d.push.apply(d,arguments);return a.apply(this,d)}},Ca=Date.now||function(){return+new Date},r=function(a,b){a=a.split(".");var c=l;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&pa(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.F=b.prototype;a.prototype=new c;a.prototype.constructor=
a;a.vb=function(d,e,f){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];return b.prototype[e].apply(d,g)}};var u=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,u);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))};t(u,Error);u.prototype.name="CustomError";var Da=Array.prototype.indexOf?function(a,b){return Array.prototype.indexOf.call(a,b,void 0)}:function(a,b){if(n(a))return n(b)&&1==b.length?a.indexOf(b,0):-1;for(var c=0;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Ea=Array.prototype.lastIndexOf?function(a,b){return Array.prototype.lastIndexOf.call(a,b,a.length-1)}:function(a,b){var c=a.length-1;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},Fa=
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)},Ga=Array.prototype.map?function(a,b){return Array.prototype.map.call(a,b,void 0)}:function(a,b){for(var c=a.length,d=Array(c),e=n(a)?a.split(""):a,f=0;f<c;f++)f in e&&(d[f]=b.call(void 0,e[f],f,a));return d},Ha=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]},Ia=function(a){if(!sa(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0},Ka=function(a,b){b=Da(a,b);var c;(c=0<=b)&&Ja(a,b);return c},Ja=function(a,b){Array.prototype.splice.call(a,b,1)},La=function(a){return Array.prototype.concat.apply([],arguments)},Ma=function(a){return Array.prototype.concat.apply([],arguments)},Na=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[]},Oa=function(a,b){for(var c=1;c<arguments.length;c++){var d=
arguments[c];if(ta(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)}},Qa=function(a,b,c,d){Array.prototype.splice.apply(a,Pa(arguments,1))},Pa=function(a,b,c){return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)},Ra=function(a,b){return a>b?1:a<b?-1:0};var Sa=String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]},Ta=function(a,b){a=String(a).toLowerCase();b=String(b).toLowerCase();return a<b?-1:a==b?0:1},Va=function(a,b){var c=0;a=Sa(String(a)).split(".");b=Sa(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=Ua(0==f[1].length?0:parseInt(f[1],10),0==g[1].length?0:parseInt(g[1],10))||Ua(0==f[2].length,0==g[2].length)||Ua(f[2],g[2]);f=f[3];g=g[3]}while(0==c)}return c},Ua=function(a,b){return a<b?-1:a>b?1:0};var Wa;a:{var Xa=l.navigator;if(Xa){var Ya=Xa.userAgent;if(Ya){Wa=Ya;break a}}Wa=""}var v=function(a){return-1!=Wa.indexOf(a)};var Za=function(a,b,c){for(var d in a)b.call(c,a[d],d,a)},$a=function(a,b){var c={},d;for(d in a)c[d]=b.call(void 0,a[d],d,a);return c},ab=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b},bb=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b},w=function(a,b,c){b in a||(a[b]=c)},cb=function(a){var b={},c;for(c in a)b[c]=a[c];return b},db="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),eb=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<db.length;f++)c=db[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var fb=function(){return v("Firefox")||v("FxiOS")},gb=function(){return(v("Chrome")||v("CriOS"))&&!v("Edge")};var jb=function(a,b){this.a=a===hb&&b||"";this.b=ib};jb.prototype.toString=function(){return"Const{"+this.a+"}"};var ib={},hb={},kb=new jb(hb,"");var mb=function(){this.a="";this.b=lb},lb={};var ob=function(){this.a="";this.b=nb},qb=function(){var a=pb;if(a instanceof ob&&a.constructor===ob&&a.b===nb)return a.a;ra(a);return"type_error:SafeHtml"},nb={},rb=function(a){var b=new ob;b.a=a;return b};rb("<!DOCTYPE html>");var pb=rb("");rb("<br>");var sb=function(a){var b=new mb;b.a=kb instanceof jb&&kb.constructor===jb&&kb.b===ib?kb.a:"type_error:Const";b instanceof mb&&b.constructor===mb&&b.b===lb?b=b.a:(ra(b),b="type_error:TrustedResourceUrl");a.src=b.toString()};var tb=function(a){var b=RegExp;var c=":".replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08");b=new b(c,"g");return a.replace(b,"")},ub=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Ca()).toString(36)},vb=function(a){var b=1;a=a.split(":");for(var c=[];0<b&&a.length;)c.push(a.shift()),b--;a.length&&c.push(a.join(":"));return c};var wb=function(){return v("iPhone")&&!v("iPod")&&!v("iPad")};var xb=function(a){xb[" "](a);return a};xb[" "]=p;var yb=function(a,b,c){return Object.prototype.hasOwnProperty.call(a,b)?a[b]:a[b]=c(b)};var zb=v("Opera"),Ab=v("Trident")||v("MSIE"),Bb=v("Edge"),Cb=v("Gecko")&&!(-1!=Wa.toLowerCase().indexOf("webkit")&&!v("Edge"))&&!(v("Trident")||v("MSIE"))&&!v("Edge"),Db=-1!=Wa.toLowerCase().indexOf("webkit")&&!v("Edge"),Eb=function(){var a=l.document;return a?a.documentMode:void 0},Fb;
a:{var Gb="",Hb=function(){var a=Wa;if(Cb)return/rv:([^\);]+)(\)|;)/.exec(a);if(Bb)return/Edge\/([\d\.]+)/.exec(a);if(Ab)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(Db)return/WebKit\/(\S+)/.exec(a);if(zb)return/(?:Version)[ \/]?(\S+)/.exec(a)}();Hb&&(Gb=Hb?Hb[1]:"");if(Ab){var Ib=Eb();if(null!=Ib&&Ib>parseFloat(Gb)){Fb=String(Ib);break a}}Fb=Gb}var Jb=Fb,Kb={},Lb=function(a){return yb(Kb,a,function(){return 0<=Va(Jb,a)})},Mb;var Nb=l.document;
Mb=Nb&&Ab?Eb()||("CSS1Compat"==Nb.compatMode?parseInt(Jb,10):5):void 0;var Ob=function(a,b){this.c=a;this.f=b;this.b=0;this.a=null};Ob.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 Pb=function(a,b){a.f(b);100>a.b&&(a.b++,b.next=a.a,a.a=b)};var Qb=function(a){l.setTimeout(function(){throw a;},0)},Rb,Sb=function(){var a=l.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!v("Presto")&&(a=function(){var e=document.createElement("IFRAME");e.style.display="none";sb(e);document.documentElement.appendChild(e);var f=e.contentWindow;e=f.document;e.open();e.write(qb());e.close();var g="callImmediate"+Math.random(),h="file:"==f.location.protocol?"*":f.location.protocol+"//"+f.location.host;
e=Aa(function(m){if(("*"==h||m.origin==h)&&m.data==g)this.port1.onmessage()},this);f.addEventListener("message",e,!1);this.port1={};this.port2={postMessage:function(){f.postMessage(g,h)}}});if("undefined"!==typeof a&&!v("Trident")&&!v("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(pa(c.next)){c=c.next;var e=c.sa;c.sa=null;e()}};return function(e){d.next={sa:e};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?
function(e){var f=document.createElement("SCRIPT");f.onreadystatechange=function(){f.onreadystatechange=null;f.parentNode.removeChild(f);f=null;e();e=null};document.documentElement.appendChild(f)}:function(e){l.setTimeout(e,0)}};var Tb=function(){this.b=this.a=null},Vb=new Ob(function(){return new Ub},function(a){a.reset()});Tb.prototype.add=function(a,b){var c=Vb.get();c.set(a,b);this.b?this.b.next=c:this.a=c;this.b=c};Tb.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 Ub=function(){this.next=this.b=this.a=null};Ub.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};Ub.prototype.reset=function(){this.next=this.b=this.a=null};var $b=function(a,b){Wb||Xb();Yb||(Wb(),Yb=!0);Zb.add(a,b)},Wb,Xb=function(){if(l.Promise&&l.Promise.resolve){var a=l.Promise.resolve(void 0);Wb=function(){a.then(ac)}}else Wb=function(){var b=ac;!ua(l.setImmediate)||l.Window&&l.Window.prototype&&!v("Edge")&&l.Window.prototype.setImmediate==l.setImmediate?(Rb||(Rb=Sb()),Rb(b)):l.setImmediate(b)}},Yb=!1,Zb=new Tb,ac=function(){for(var a;a=Zb.remove();){try{a.a.call(a.b)}catch(b){Qb(b)}Pb(Vb,a)}Yb=!1};var x=function(a){this.a=0;this.i=void 0;this.f=this.b=this.c=null;this.g=this.h=!1;if(a!=p)try{var b=this;a.call(void 0,function(c){bc(b,2,c)},function(c){bc(b,3,c)})}catch(c){bc(this,3,c)}},cc=function(){this.next=this.context=this.b=this.f=this.a=null;this.c=!1};cc.prototype.reset=function(){this.context=this.b=this.f=this.a=null;this.c=!1};
var dc=new Ob(function(){return new cc},function(a){a.reset()}),ec=function(a,b,c){var d=dc.get();d.f=a;d.b=b;d.context=c;return d},y=function(a){if(a instanceof x)return a;var b=new x(p);bc(b,2,a);return b},fc=function(a){return new x(function(b,c){c(a)})},hc=function(a,b,c){gc(a,b,c,null)||$b(Ba(b,a))},z=function(a){return new x(function(b,c){var d=a.length,e=[];if(d)for(var f=function(q,I){d--;e[q]=I;0==d&&b(e)},g=function(q){c(q)},h=0,m;h<a.length;h++)m=a[h],hc(m,Ba(f,h),g);else b(e)})},A=function(){var a,
b,c=new x(function(d,e){a=d;b=e});return new ic(c,a,b)};x.prototype.then=function(a,b,c){return jc(this,ua(a)?a:null,ua(b)?b:null,c)};x.prototype.$goog_Thenable=!0;var B=function(a,b){b=ec(b,b,void 0);b.c=!0;kc(a,b);return a},D=function(a,b,c){return jc(a,null,b,c)};x.prototype.cancel=function(a){0==this.a&&$b(function(){var b=new E(a);lc(this,b)},this)};
var lc=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?lc(c,b):(f?(d=f,d.next==c.f&&(c.f=d),d.next=d.next.next):mc(c),nc(c,e,3,b)))}a.c=null}else bc(a,3,b)},kc=function(a,b){a.b||2!=a.a&&3!=a.a||oc(a);a.f?a.f.next=b:a.b=b;a.f=b},jc=function(a,b,c,d){var e=ec(null,null,null);e.a=new x(function(f,g){e.f=b?function(h){try{var m=b.call(d,h);f(m)}catch(q){g(q)}}:f;e.b=c?function(h){try{var m=c.call(d,
h);!pa(m)&&h instanceof E?g(h):f(m)}catch(q){g(q)}}:g});e.a.c=a;kc(a,e);return e.a};x.prototype.l=function(a){this.a=0;bc(this,2,a)};x.prototype.m=function(a){this.a=0;bc(this,3,a)};
var bc=function(a,b,c){0==a.a&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.a=1,gc(c,a.l,a.m,a)||(a.i=c,a.a=b,a.c=null,oc(a),3!=b||c instanceof E||pc(a,c)))},gc=function(a,b,c,d){if(a instanceof x)return kc(a,ec(b||p,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(va(a))try{var f=a.then;if(ua(f))return qc(a,f,b,c,d),!0}catch(g){return c.call(d,g),!0}return!1},qc=function(a,b,c,d,e){var f=!1,g=function(m){f||(f=!0,c.call(e,
m))},h=function(m){f||(f=!0,d.call(e,m))};try{b.call(a,g,h)}catch(m){h(m)}},oc=function(a){a.h||(a.h=!0,$b(a.j,a))},mc=function(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.f=null);return b};x.prototype.j=function(){for(var a;a=mc(this);)nc(this,a,this.a,this.i);this.h=!1};
var nc=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,rc(b,c,d);else try{b.c?b.f.call(b.context):rc(b,c,d)}catch(e){sc.call(null,e)}Pb(dc,b)},rc=function(a,b,c){2==b?a.f.call(a.context,c):a.b&&a.b.call(a.context,c)},pc=function(a,b){a.g=!0;$b(function(){a.g&&sc.call(null,b)})},sc=Qb,E=function(a){u.call(this,a)};t(E,u);E.prototype.name="cancel";var ic=function(a,b,c){this.a=a;this.b=b;this.c=c};var F=function(){return y("")};var G=function(a){this.type=a};r("castApp.protocol.Message",G);var tc=function(a){this.type=a;this.requestId=ub()};t(tc,G);r("castApp.protocol.Request",tc);var H=function(a,b){this.type=a;this.responseTo=b.requestId};t(H,G);r("castApp.protocol.Response",H);var uc=function(a,b){H.call(this,"Error",a);this.errorName=b||"err-unknown"};t(uc,H);r("castApp.protocol.Error",uc);var vc=function(){};r("castApp.protocol.Handshake",vc);var wc=function(){tc.call(this,"Handshake.Request");this.coreVersion=6};
t(wc,tc);vc.Request=wc;var xc=function(a){H.call(this,"Handshake.Response",a);this.version=6;this.latestVersion=void 0};t(xc,H);vc.Response=xc;var yc=function(a,b){H.call(this,"Handshake.UiVersionNotSupported",a);this.latestVersion=b};t(yc,H);vc.UiVersionNotSupported=yc;var zc=function(a){this.type="SetSimpleState";this.state=a};t(zc,G);r("castApp.protocol.SetSimpleState",zc);var Ac=function(){};r("castApp.protocol.ModalDialog",Ac);
var Bc=function(a){tc.call(this,"ModalDialog.Request");this.dialogId=a};t(Bc,tc);Ac.Request=Bc;var Cc=function(a,b){H.call(this,"ModalDialog.Response",a);this.button=b};t(Cc,H);Ac.Response=Cc;var Dc=function(a,b){this.type=a;this.deviceType=b};t(Dc,G);r("castApp.protocol.MessageWithDeviceType",Dc);var Ec=function(){};r("castApp.protocol.DeviceDiscovery",Ec);var Fc=function(a){this.type="DeviceDiscovery.ShowScanner";this.showTips=a};t(Fc,G);Ec.ShowScanner=Fc;var Gc=function(){};
r("castApp.protocol.SetupStart",Gc);var Hc=function(a,b,c){this.type="SetupStart.ShowDevice";this.state=a;this.deviceType=b;this.deviceName=c;this.analyticsOptIn=this.otherDevicesExist=!1};t(Hc,G);Gc.ShowDevice=Hc;var Ic=function(a){this.type="SetupStart.TosAccepted";this.analyticsOptIn=a};t(Ic,G);Gc.TosAccepted=Ic;var Jc=function(){};r("castApp.protocol.WiFiSwitching",Jc);var Kc=function(a,b,c){this.type="WiFiSwitching.ConnectHotSpot";this.state=a;this.deviceName=b;this.ssid=c};t(Kc,G);
Jc.ConnectHotSpot=Kc;var Lc=function(a,b){this.type="WiFiSwitching.ReconnectWiFi";this.state=a;this.ssid=b};t(Lc,G);Jc.ReconnectWiFi=Lc;var Mc=function(){};r("castApp.protocol.CodeConfirmation",Mc);var Nc=function(a){tc.call(this,"CodeConfirmation.Request");this.code=a};t(Nc,tc);Mc.Request=Nc;var Oc=function(a,b){H.call(this,"CodeConfirmation.Response",a);this.confirmed=b};t(Oc,H);Mc.Response=Oc;var Pc=function(){};r("castApp.protocol.AudioConfirmation",Pc);
var Qc=function(a){this.type="AudioConfirmation.PromptUser";this.state=a};t(Qc,G);Pc.PromptUser=Qc;var Rc=function(a){this.type="AudioConfirmation.UserAction";this.action=a};t(Rc,G);Pc.UserAction=Rc;var Sc=function(){};r("castApp.protocol.DeviceConfig",Sc);var Tc=function(a,b,c){tc.call(this,"DeviceConfig.Request");this.deviceType=a;this.name=b;this.country=c};t(Tc,tc);Sc.Request=Tc;var Uc=function(a,b,c){H.call(this,"DeviceConfig.Response",a);this.name=b;this.country=c};t(Uc,H);Sc.Response=Uc;
var Vc=function(){};r("castApp.protocol.WiFiConfig",Vc);var Wc=function(a,b,c){this.id=a;this.ssid=b;this.security=c};Vc.Network=Wc;var Xc=function(a,b,c,d){this.type="WiFiConfig.Show";this.state=a;this.deviceType=b;this.networks=c;this.selectedNetwork=d};t(Xc,G);Vc.Show=Xc;var Yc=function(a){this.type="WiFiConfig.UpdateNetworks";this.networks=a};t(Yc,G);Vc.UpdateNetworks=Yc;var Zc=function(a,b){this.type="WiFiConfig.Connect";this.network=a;this.password=b};t(Zc,G);Vc.Connect=Zc;
var $c=function(a){this.type="WiFiConfig.Retry";this.network=a};t($c,G);Vc.Retry=$c;var ad=function(){};r("castApp.protocol.Features",ad);var bd=function(){};ad.DeviceSettings=bd;var cd=function(){this.supportsDisplay=this.supportsSetup=!1};ad.Device=cd;var dd=function(){};r("castApp.protocol.Devices",dd);var ed=function(a,b,c){this.id=a;this.type=b;this.displayName=c};dd.DeviceProperties=ed;var fd=function(a,b){this.type="Devices.Show";this.devices=a;this.deviceName=b};t(fd,G);dd.Show=fd;
var gd=function(a,b){this.type="Devices.UserAction";this.device=a;this.action=b};t(gd,G);dd.UserAction=gd;var hd=function(){};r("castApp.protocol.DeviceSettings",hd);var id=function(a,b){this.localeId=a;this.displayString=b};hd.Locale=id;var jd=function(a,b,c){this.timeZoneId=a;this.displayString=b;this.offset=c};hd.TimeZone=jd;
var kd=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(kd,G);hd.Show=kd;
var ld=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(ld,G);hd.Apply=ld;var md=function(){};r("castApp.protocol.DetectCountry",md);var nd=function(){tc.call(this,"DetectCountry.Request")};t(nd,tc);md.Request=nd;var od=function(a,b){H.call(this,"DetectCountry.Response",a);this.countryCode=b};t(od,H);md.Response=od;var pd=function(){};r("castApp.protocol.Offers",pd);
var qd=function(){this.type="Offers.Scan";this.scanId=ub()};t(qd,G);pd.Scan=qd;var rd=function(a,b,c,d){this.token=a;this.displayName=b;this.deviceType=c;this.ssdpUdn=d};pd.Device=rd;var sd=function(a,b,c){this.type="Offers.ScanResults";this.scanId=a;this.devices=b;this.scanComplete=c};t(sd,G);pd.ScanResults=sd;var td=function(a){this.type="Offers.Redeem";this.url=a};t(td,G);pd.Redeem=td;var ud=function(a,b){this.type="Offers.AnalyticsEvent";this.eventType=a;this.offerId=b};t(ud,G);
pd.AnalyticsEvent=ud;var J=function(a,b){this.a=b;for(var c=[],d=!0,e=a.length-1;0<=e;e--){var f=a[e]|0;d&&f==b||(c[e]=f,d=!1)}this.b=c},vd={},wd=function(a){return-128<=a&&128>a?yb(vd,a,function(b){return new J([b|0],0>b?-1:0)}):new J([a|0],0>a?-1:0)},yd=function(a){if(isNaN(a)||!isFinite(a))return xd;if(0>a)return K(yd(-a));for(var b=[],c=1,d=0;a>=c;d++)b[d]=a/c|0,c*=4294967296;return new J(b,0)},zd=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 K(zd(a.substring(1),b));if(0<=a.indexOf("-"))throw Error('number format error: interior "-" character');for(var c=yd(Math.pow(b,8)),d=xd,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=yd(Math.pow(b,f)),d=Ad(d,f).add(yd(g))):(d=Ad(d,c),d=d.add(yd(g)))}return d},xd=wd(0),Bd=wd(1),Cd=wd(16777216),Dd=function(a){if(-1==a.a)return-Dd(K(a));for(var b=0,c=1,d=0;d<a.b.length;d++)b+=Ed(a,d)*c,c*=4294967296;return b};
J.prototype.toString=function(a){a=a||10;if(2>a||36<a)throw Error("radix out of range: "+a);if(Fd(this))return"0";if(-1==this.a)return"-"+K(this).toString(a);for(var b=yd(Math.pow(a,6)),c=this,d="";;){var e=Gd(c,b).a;c=Hd(c,Ad(e,b));var f=((0<c.b.length?c.b[0]:c.a)>>>0).toString(a);c=e;if(Fd(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},Ed=function(a,b){a=L(a,b);return 0<=a?a:4294967296+a},Fd=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},Id=function(a,b){a=Hd(a,b);return-1==a.a?-1:Fd(a)?0:1},K=function(a){for(var b=a.b.length,c=[],d=0;d<b;d++)c[d]=~a.b[d];return(new J(c,~a.a)).add(Bd)};J.prototype.abs=function(){return-1==this.a?K(this):this};
J.prototype.add=function(a){for(var b=Math.max(this.b.length,a.b.length),c=[],d=0,e=0;e<=b;e++){var f=d+(L(this,e)&65535)+(L(a,e)&65535),g=(f>>>16)+(L(this,e)>>>16)+(L(a,e)>>>16);d=g>>>16;f&=65535;g&=65535;c[e]=g<<16|f}return new J(c,c[c.length-1]&-2147483648?-1:0)};
var Hd=function(a,b){return a.add(K(b))},Ad=function(a,b){if(Fd(a)||Fd(b))return xd;if(-1==a.a)return-1==b.a?Ad(K(a),K(b)):K(Ad(K(a),b));if(-1==b.a)return K(Ad(a,K(b)));if(0>Id(a,Cd)&&0>Id(b,Cd))return yd(Dd(a)*Dd(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,h=L(a,e)&65535,m=L(b,f)>>>16,q=L(b,f)&65535;d[2*e+2*f]+=h*q;Jd(d,2*e+2*f);d[2*e+2*f+1]+=g*q;Jd(d,2*e+2*f+1);d[2*e+2*f+1]+=h*m;Jd(d,2*e+2*f+1);d[2*e+2*f+
2]+=g*m;Jd(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 J(d,0)},Jd=function(a,b){for(;(a[b]&65535)!=a[b];)a[b+1]+=a[b]>>>16,a[b]&=65535,b++},Kd=function(a,b){this.a=a;this.b=b},Gd=function(a,b){if(Fd(b))throw Error("division by zero");if(Fd(a))return new Kd(xd,xd);if(-1==a.a)return b=Gd(K(a),b),new Kd(K(b.a),K(b.b));if(-1==b.a)return b=Gd(a,K(b)),new Kd(K(b.a),b.b);if(30<a.b.length){if(-1==a.a||-1==b.a)throw Error("slowDivide_ only works with positive integers.");
for(var c=Bd,d=b;0>=Id(d,a);)c=Ld(c,1),d=Ld(d,1);var e=Md(c,1),f=Md(d,1);d=Md(d,2);for(c=Md(c,2);!Fd(d);){var g=f.add(d);0>=Id(g,a)&&(e=e.add(c),f=g);d=Md(d,1);c=Md(c,1)}b=Hd(a,Ad(e,b));return new Kd(e,b)}for(e=xd;0<=Id(a,b);){c=Math.max(1,Math.floor(Dd(a)/Dd(b)));d=Math.ceil(Math.log(c)/Math.LN2);d=48>=d?1:Math.pow(2,d-48);f=yd(c);for(g=Ad(f,b);-1==g.a||0<Id(g,a);)c-=d,f=yd(c),g=Ad(f,b);Fd(f)&&(f=Bd);e=e.add(f);a=Hd(a,g)}return new Kd(e,a)};
J.prototype.and=function(a){for(var b=Math.max(this.b.length,a.b.length),c=[],d=0;d<b;d++)c[d]=L(this,d)&L(a,d);return new J(c,this.a&a.a)};J.prototype.or=function(a){for(var b=Math.max(this.b.length,a.b.length),c=[],d=0;d<b;d++)c[d]=L(this,d)|L(a,d);return new J(c,this.a|a.a)};J.prototype.xor=function(a){for(var b=Math.max(this.b.length,a.b.length),c=[],d=0;d<b;d++)c[d]=L(this,d)^L(a,d);return new J(c,this.a^a.a)};
var Ld=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 J(e,a.a)},Md=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 J(e,a.a)};var Nd=function(a){this.a=a},Qd=function(a){try{return-1!=a.indexOf(":")?new Od(a):new Pd(a)}catch(b){return null}},Pd=function(a){this.b=null;var b=xd;if(a instanceof J){if(0!=a.a||0>Id(a,xd)||0<Id(a,Rd))throw Error("The address does not look like an IPv4.");b=cb(a)}else{if(!Sd.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=yd(e);b=Ld(b,8).or(e)}}this.a=b};t(Pd,Nd);var Sd=/^[0-9.]*$/,Rd=Hd(Ld(Bd,32),Bd);Pd.prototype.toString=function(){if(this.b)return this.b;for(var a=Ed(this.a,0),b=[],c=3;0<=c;c--)b[c]=String(a&255),a>>>=8;return this.b=b.join(".")};
var Od=function(a){this.b=null;var b=xd;if(a instanceof J){if(0!=a.a||0>Id(a,xd)||0<Id(a,Td))throw Error("The address does not look like a valid IPv6.");b=cb(a)}else{if(!Ud.test(a))throw Error(a+" is not a valid IPv6 address.");var c=a.split(":");if(-1!=c[c.length-1].indexOf(".")){a=Ed(cb((new Pd(c[c.length-1])).a),0);var d=[];d.push((a>>>16&65535).toString(16));d.push((a&65535).toString(16));Ja(c,c.length-1);Oa(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=Ma(c,f,d)}}if(8!=c.length)throw Error(a+" is not a valid IPv6 address");for(d=0;d<c.length;d++){e=zd(c[d],16);if(0>Id(e,xd)||0<Id(e,Vd))throw Error(c[d]+" in "+a+" is not a valid hextet.");b=Ld(b,16).or(e)}}this.a=b};t(Od,Nd);
var Ud=/^([a-fA-F0-9]*:){2}[a-fA-F0-9:.]*$/,Vd=wd(65535),Td=Hd(Ld(Bd,128),Bd);Od.prototype.toString=function(){if(this.b)return this.b;for(var a=[],b=3;0<=b;b--){var c=Ed(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 Wd="StopIteration"in l?l.StopIteration:{message:"StopIteration",stack:""},Xd=function(){};Xd.prototype.next=function(){throw Wd;};Xd.prototype.K=function(){return this};
var Yd=function(a){if(a instanceof Xd)return a;if("function"==typeof a.K)return a.K(!1);if(ta(a)){var b=0,c=new Xd;c.next=function(){for(;;){if(b>=a.length)throw Wd;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");},Zd=function(a,b){if(ta(a))try{Fa(a,b,void 0)}catch(c){if(c!==Wd)throw c;}else{a=Yd(a);try{for(;;)b.call(void 0,a.next(),void 0,a)}catch(c){if(c!==Wd)throw c;}}},$d=function(a,b){var c=null;Zd(a,function(d){c=b.call(void 0,c,d)});return c},ae=function(a,b){a=Yd(a);
try{for(;;)if(!b.call(void 0,a.next(),void 0,a))return!1}catch(c){if(c!==Wd)throw c;}return!0};var M=function(a,b){this.c={};this.b=[];this.f=this.a=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)if(a instanceof M)for(c=a.A(),d=0;d<c.length;d++)this.set(c[d],a.get(c[d]));else for(d in a)this.set(d,a[d])};M.prototype.u=function(){be(this);for(var a=[],b=0;b<this.b.length;b++)a.push(this.c[this.b[b]]);return a};M.prototype.A=function(){be(this);return this.b.concat()};
var de=function(a,b){return ce(a.c,b)};M.prototype.clear=function(){this.c={};this.f=this.a=this.b.length=0};M.prototype.remove=function(a){return ce(this.c,a)?(delete this.c[a],this.a--,this.f++,this.b.length>2*this.a&&be(this),!0):!1};var be=function(a){if(a.a!=a.b.length){for(var b=0,c=0;b<a.b.length;){var d=a.b[b];ce(a.c,d)&&(a.b[c++]=d);b++}a.b.length=c}if(a.a!=a.b.length){var e={};for(c=b=0;b<a.b.length;)d=a.b[b],ce(e,d)||(a.b[c++]=d,e[d]=1),b++;a.b.length=c}};
M.prototype.get=function(a,b){return ce(this.c,a)?this.c[a]:b};M.prototype.set=function(a,b){ce(this.c,a)||(this.a++,this.b.push(a),this.f++);this.c[a]=b};M.prototype.forEach=function(a,b){for(var c=this.A(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};M.prototype.K=function(a){be(this);var b=0,c=this.f,d=this,e=new Xd;e.next=function(){if(c!=d.f)throw Error("The map has changed since the iterator was created");if(b>=d.b.length)throw Wd;var f=d.b[b++];return a?f:d.c[f]};return e};
var ce=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var ee=function(a){if(a.u&&"function"==typeof a.u)return a.u();if(n(a))return a.split("");if(ta(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return ab(a)},fe=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);else if(ta(a)||n(a))Fa(a,b,void 0);else{if(a.A&&"function"==typeof a.A)var c=a.A();else if(a.u&&"function"==typeof a.u)c=void 0;else if(ta(a)||n(a)){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=bb(a);d=ee(a);e=d.length;for(var f=0;f<e;f++)b.call(void 0,
d[f],c&&c[f],a)}};var ge=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/,he=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 ie=function(a,b){this.f=this.j=this.c="";this.h=null;this.g=this.b="";this.a=!1;if(a instanceof ie){this.a=pa(b)?b:a.a;je(this,a.c);this.j=a.j;this.f=a.f;ke(this,a.h);this.b=a.b;b=a.i;var c=new le;c.c=b.c;b.a&&(c.a=new M(b.a),c.b=b.b);me(this,c);this.g=a.g}else a&&(c=String(a).match(ge))?(this.a=!!b,je(this,c[1]||"",!0),this.j=ne(c[2]||""),this.f=ne(c[3]||"",!0),ke(this,c[4]),this.b=ne(c[5]||"",!0),me(this,c[6]||"",!0),this.g=ne(c[7]||"")):(this.a=!!b,this.i=new le(null,this.a))};
ie.prototype.toString=function(){var a=[],b=this.c;b&&a.push(oe(b,pe,!0),":");var c=this.f;if(c||"file"==b)a.push("//"),(b=this.j)&&a.push(oe(b,pe,!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(oe(c,"/"==c.charAt(0)?qe:re,!0));(c=this.i.toString())&&a.push("?",c);(c=this.g)&&a.push("#",oe(c,se));return a.join("")};
var je=function(a,b,c){a.c=c?ne(b,!0):b;a.c&&(a.c=a.c.replace(/:$/,""))},ke=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},me=function(a,b,c){b instanceof le?(a.i=b,te(a.i,a.a)):(c||(b=oe(b,ue)),a.i=new le(b,a.a))},ve=function(a){return a instanceof ie?new ie(a):new ie(a,void 0)},ne=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},oe=function(a,b,c){return n(a)?(a=encodeURI(a).replace(b,we),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,
"%$1")),a):null},we=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},pe=/[#\/\?@]/g,re=/[#\?:]/g,qe=/[#\?]/g,ue=/[#\?@]/g,se=/#/g,le=function(a,b){this.b=this.a=null;this.c=a||null;this.f=!!b},xe=function(a){a.a||(a.a=new M,a.b=0,a.c&&he(a.c,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))};le.prototype.add=function(a,b){xe(this);this.c=null;a=ye(this,a);var c=this.a.get(a);c||this.a.set(a,c=[]);c.push(b);this.b+=1;return this};
le.prototype.remove=function(a){xe(this);a=ye(this,a);return de(this.a,a)?(this.c=null,this.b-=this.a.get(a).length,this.a.remove(a)):!1};le.prototype.clear=function(){this.a=this.c=null;this.b=0};var ze=function(a,b){xe(a);b=ye(a,b);return de(a.a,b)};k=le.prototype;k.forEach=function(a,b){xe(this);this.a.forEach(function(c,d){Fa(c,function(e){a.call(b,e,d,this)},this)},this)};
k.A=function(){xe(this);for(var a=this.a.u(),b=this.a.A(),c=[],d=0;d<b.length;d++)for(var e=a[d],f=0;f<e.length;f++)c.push(b[d]);return c};k.u=function(a){xe(this);var b=[];if(n(a))ze(this,a)&&(b=La(b,this.a.get(ye(this,a))));else{a=this.a.u();for(var c=0;c<a.length;c++)b=La(b,a[c])}return b};k.set=function(a,b){xe(this);this.c=null;a=ye(this,a);ze(this,a)&&(this.b-=this.a.get(a).length);this.a.set(a,[b]);this.b+=1;return this};
k.get=function(a,b){if(!a)return b;a=this.u(a);return 0<a.length?String(a[0]):b};k.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var a=[],b=this.a.A(),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 ye=function(a,b){b=String(b);a.f&&(b=b.toLowerCase());return b},te=function(a,b){b&&!a.f&&(xe(a),a.c=null,a.a.forEach(function(c,d){var e=d.toLowerCase();d!=e&&(this.remove(d),this.remove(e),0<c.length&&(this.c=null,this.a.set(ye(this,e),Na(c)),this.b+=c.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 Ae=function(a,b){this.ssid=a;this.wpa_auth=b};r("castApp.core.setupApi.ConnectWiFiMsg",Ae);var Be=function(a,b,c,d,e,f,g,h,m,q,I){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=h;this.wpa_state=m;this.setup_state=q;this.wpa_configured=I};r("castApp.core.setupApi.EurekaInfoMsg34Base",Be);
var Ce=function(a,b,c,d,e,f,g,h,m,q){Be.call(this,3,a,b,c,d,e,f,g,h,m,q)};t(Ce,Be);r("castApp.core.setupApi.EurekaInfoMsgV3",Ce);Ce.Location=function(a,b){this.latitude=a;this.longitude=b};var De=function(a,b,c){this.certificate=a;this.nonce=b;this.signed_data=c};Ce.Sign=De;var Ee=function(){};Ce.Detail=Ee;Ee.Timezone=function(a,b){this.display_string=a;this.offset=b};Ee.Locale=function(a){this.display_string=a};
var Fe=function(a,b,c,d,e,f,g,h,m,q,I,C){Be.call(this,a,b,c,d,e,f,g,h,m,q,I);this.uptime=C};t(Fe,Be);r("castApp.core.setupApi.EurekaInfoMsgV4",Fe);
var Ge=function(a){w(a,"locale","en-US");w(a,"debug_build",!1);w(a,"update_only_build",!1);w(a,"ethernet_connected",!1);w(a,"tos_accepted",!0);w(a,"time_format",0);w(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;w(b,"crash",!0);w(b,"stats",!0);w(b,"device_id",!1);w(b,"location",!1);w(b,"opencast",!1)}return a};Fe.SetupStats=function(){};var He=function(){};
Fe.Location=He;var Ie=function(){};Fe.OptIn=Ie;var Je=function(a,b,c){De.call(this,a,b,c)};t(Je,De);Fe.Sign=Je;var Ke=function(a){this.manufacturer="Google Inc.";this.model_name="Eureka Dongle";this.icon_list=a};t(Ke,Ee);Fe.Detail=Ke;Ke.Icon=function(a,b,c,d){this.mimetype="image/png";this.width=a;this.height=b;this.depth=c;this.url=d};var Le=function(){};r("castApp.core.setupApi.EurekaInfoMsgV7",Le);
var Me=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,w(b,"display_supported",!0),w(b,"wifi_supported",!0),w(b,"wifi_regulatory_domain_locked",!1),w(b,"hotspot_supported",!0),w(b,"ble_supported",!1),w(b,"multizone_supported",!1))}a.net&&w(a.net,"ethernet_connected",!1);a.setup&&w(a.setup,"tos_accepted",!0);a.settings&&(b=a.settings,w(b,"time_format",1),
w(b,"locale","en-US"));return a};Le.BuildInfo=function(){};var Ne=function(){};Le.DeviceInfo=Ne;Ne.Capabilities=function(){};Le.OtaStatus=function(){};Le.Net=function(){};Le.WiFi=function(){};var Oe=function(){};Le.Setup=Oe;Oe.Stats=function(){};var Pe=function(){};Le.Settings=Pe;var Qe=function(){};Le.OptIn=Qe;Le.OpenCast=function(){};Le.Multizone=function(){};var Re=function(a){this.wpa_id=a};r("castApp.core.setupApi.ForgetWiFiMsg",Re);
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 Se=function(a){this.sound_id=a};r("castApp.core.setupApi.PlaySoundRequestMsg",Se);r("castApp.core.setupApi.PlaySoundResponseMsg",function(a,b){this.volume=a;this.duration=b});var Te=function(a){this.params=a};
r("castApp.core.setupApi.RebootMsg",Te);var Ue=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",Ue);var Ve=function(a,b,c,d,e,f){Ue.call(this,a,b,c,d,e);this.ap_list=f};t(Ve,Ue);r("castApp.core.setupApi.ScanResultMsgV7",Ve);Ve.Ap=function(a,b,c){this.bssid=a;this.signal_level=b;this.frequency=c};var We=function(){};r("castApp.core.setupApi.SaveWiFiRequestMsg",We);
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 Xe=function(){};r("castApp.core.setupApi.SetEurekaInfoMsgBase",Xe);var Ye=function(){};t(Ye,Xe);r("castApp.core.setupApi.SetEurekaInfoMsgV3",Ye);var Ze=function(){};t(Ze,Xe);r("castApp.core.setupApi.SetEurekaInfoMsgV4",Ze);var $e=function(){};t($e,Xe);
r("castApp.core.setupApi.SetEurekaInfoMsgV7",$e);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 af=function(a){this.id=a};r("castApp.core.storage.SetupSession",af);var bf=function(){};r("castApp.core.storage.CommonSetupState",bf);var cf=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",cf);var df=function(a){this.deviceIpAddress=a};r("castApp.core.storage.SetupApiClientState",df);var ef=function(a){this.msg=a};r("castApp.core.storage.ConnectWiFiState",ef);
r("castApp.core.storage.EurekaInfoState",function(a,b,c,d,e,f,g,h){this.setupApiVersion=a;this.name=b;this.setupState=c;this.ssdpUdn=d;this.deviceType=e;this.features=f;this.ethernetConnected=g;this.tosAccepted=h});var ff=function(a,b){this.timeStamp=a;this.verificationProperties=b};r("castApp.core.storage.VerificationState",ff);var N=function(a){this.type=a};r("castApp.core.storage.SetupState",N);var gf=function(a,b){this.all=b;this.current=a};r("castApp.core.storage.SetupStateCollection",gf);
var hf=function(a,b,c){this.type=a;this.time=b;this.deviceId=c},jf=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 h=JSON.parse(g);break a}catch(m){f.removeItem(e)}h=null}h&&b.push(h)}}return b},kf=function(){var a=Ca()-432E5;jf(window.localStorage).forEach(function(b){(!b.timestamp||b.timestamp<a)&&window.localStorage.removeItem("setupSession_"+b.id)})},lf=function(a,b){b.timestamp=Ca();a.setItem("setupSession_"+
b.id,JSON.stringify(b))},mf=function(a,b){a.removeItem("setupSession_"+b.id)},nf=function(a){var b=a.getItem("setupDeviceState");if(b)try{return JSON.parse(b)}catch(c){a.removeItem("setupDeviceState")}return[]},of=function(a,b){0===b.length?a.removeItem("setupDeviceState"):a.setItem("setupDeviceState",JSON.stringify(b))},pf=function(a){return"false"===a.getItem("setupAutoNetworkSwitching")?!1:!0},qf=function(a,b){1===b?a.removeItem("castApp.analyticsOptIn"):a.setItem("castApp.analyticsOptIn",b.toString())};var rf=function(){},sf=function(){};t(sf,rf);sf.prototype.b=function(){};sf.prototype.f=function(){};sf.prototype.a=function(){return y(3)};sf.prototype.h=function(){};var tf=function(a){this.g=chrome.metricsPrivate;this.c=a};t(tf,rf);tf.prototype.b=function(a){this.g.recordUserAction("Cast.Chrome.App."+a.toString())};
tf.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(pa(a.offerId)){if(!qa(a.offerId)||0>a.offerId)return;b+="."+a.offerId}this.g.recordUserAction(b)};tf.prototype.a=function(){var a=parseInt(this.c.getItem("castApp.analyticsOptIn"),10);if(isNaN(a)||1>a||3<a)a=1;return y(a)};tf.prototype.h=function(a){a?(qf(this.c,2),this.b(1)):(qf(this.c,3),this.b(2))};var uf=function(){this.g=this.g;this.s=this.s};uf.prototype.g=!1;uf.prototype.aa=function(){this.g||(this.g=!0,this.C())};uf.prototype.C=function(){if(this.s)for(;this.s.length;)this.s.shift()()};var vf;(vf=!Ab)||(vf=9<=Number(Mb));var wf=vf,xf=Ab&&!Lb("9"),yf=function(){if(!l.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});try{l.addEventListener("test",p,b),l.removeEventListener("test",p,b)}catch(c){}return a}();var O=function(a,b){this.type=a;this.a=this.target=b;this.Ba=!0};O.prototype.b=function(){this.Ba=!1};var Af=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.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.a=b;if(b=a.relatedTarget){if(Cb){a:{try{xb(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;d?(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0):(this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0);this.button=a.button;this.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:zf[a.pointerType]||"";this.state=a.state;this.c=a;a.defaultPrevented&&this.b()}};t(Af,O);var zf={2:"touch",3:"pen",4:"mouse"};Af.prototype.b=function(){Af.F.b.call(this);var a=this.c;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,xf)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Bf="closure_listenable_"+(1E6*Math.random()|0),Cf=function(a){return!(!a||!a[Bf])},Df=0;var Ef=function(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.fa=e;this.key=++Df;this.removed=this.$=!1},Ff=function(a){a.removed=!0;a.listener=null;a.proxy=null;a.src=null;a.fa=null};var Gf=function(a){this.src=a;this.a={};this.b=0};Gf.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.a[f];a||(a=this.a[f]=[],this.b++);var g=Hf(a,b,d,e);-1<g?(b=a[g],c||(b.$=!1)):(b=new Ef(b,this.src,f,!!d,e),b.$=c,a.push(b));return b};Gf.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.a))return!1;var e=this.a[a];b=Hf(e,b,c,d);return-1<b?(Ff(e[b]),Ja(e,b),0==e.length&&(delete this.a[a],this.b--),!0):!1};
var If=function(a,b){var c=b.type;c in a.a&&Ka(a.a[c],b)&&(Ff(b),0==a.a[c].length&&(delete a.a[c],a.b--))};Gf.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,Ff(d[e]);delete this.a[c];this.b--}return b};var Jf=function(a,b,c,d,e){a=a.a[b.toString()];b=-1;a&&(b=Hf(a,c,d,e));return-1<b?a[b]:null},Hf=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.fa==d)return e}return-1};var Kf="closure_lm_"+(1E6*Math.random()|0),Lf={},Mf=0,Of=function(a,b,c,d,e){if(d&&d.once)return Nf(a,b,c,d,e);if(sa(b)){for(var f=0;f<b.length;f++)Of(a,b[f],c,d,e);return null}c=Qf(c);return Cf(a)?a.listen(b,c,va(d)?!!d.capture:!!d,e):Rf(a,b,c,!1,d,e)},Rf=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=va(e)?!!e.capture:!!e,h=Sf(a);h||(a[Kf]=h=new Gf(a));c=h.add(b,c,d,g,f);if(c.proxy)return c;d=Tf();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)yf||(e=g),void 0===e&&(e=
!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(Uf(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");Mf++;return c},Tf=function(){var a=Vf,b=wf?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},Nf=function(a,b,c,d,e){if(sa(b)){for(var f=0;f<b.length;f++)Nf(a,b[f],c,d,e);return null}c=Qf(c);return Cf(a)?a.c.add(String(b),
c,!0,va(d)?!!d.capture:!!d,e):Rf(a,b,c,!0,d,e)},Wf=function(a,b,c,d,e){if(sa(b))for(var f=0;f<b.length;f++)Wf(a,b[f],c,d,e);else d=va(d)?!!d.capture:!!d,c=Qf(c),Cf(a)?P(a,b,c,d,e):a&&(a=Sf(a))&&(b=Jf(a,b,c,d,e))&&Xf(b)},Xf=function(a){if(!qa(a)&&a&&!a.removed){var b=a.src;if(Cf(b))If(b.c,a);else{var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(Uf(c),d):b.addListener&&b.removeListener&&b.removeListener(d);Mf--;(c=Sf(b))?(If(c,a),0==c.b&&
(c.src=null,b[Kf]=null)):Ff(a)}}},Uf=function(a){return a in Lf?Lf[a]:Lf[a]="on"+a},Zf=function(a,b,c,d){var e=!0;if(a=Sf(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=Yf(f,d),e=e&&!1!==f)}return e},Yf=function(a,b){var c=a.listener,d=a.fa||a.src;a.$&&Xf(a);return c.call(d,b)},Vf=function(a,b){if(a.removed)return!0;if(!wf){if(!b)a:{b=["window","event"];for(var c=l,d=0;d<b.length;d++)if(c=c[b[d]],null==c){b=null;break a}b=c}d=b;b=new Af(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=Zf(d[e],a,!0,b);c=c&&f}for(e=0;e<d.length;e++)b.a=d[e],f=Zf(d[e],a,!1,b),c=c&&f}return c}return Yf(a,new Af(b,this))},Sf=function(a){a=a[Kf];return a instanceof Gf?a:null},$f="__closure_events_fn_"+(1E9*Math.random()>>>0),Qf=function(a){if(ua(a))return a;
a[$f]||(a[$f]=function(b){return a.handleEvent(b)});return a[$f]};var Q=function(){uf.call(this);this.c=new Gf(this);this.Ha=this;this.P=null};t(Q,uf);Q.prototype[Bf]=!0;Q.prototype.removeEventListener=function(a,b,c,d){Wf(this,a,b,c,d)};
var R=function(a,b){var c,d=a.P;if(d)for(c=[];d;d=d.P)c.push(d);a=a.Ha;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);eb(b,e)}e=!0;if(c)for(var f=c.length-1;0<=f;f--){var g=b.a=c[f];e=ag(g,d,!0,b)&&e}g=b.a=a;e=ag(g,d,!0,b)&&e;e=ag(g,d,!1,b)&&e;if(c)for(f=0;f<c.length;f++)g=b.a=c[f],e=ag(g,d,!1,b)&&e};Q.prototype.C=function(){Q.F.C.call(this);this.c&&this.c.removeAll(void 0);this.P=null};
Q.prototype.listen=function(a,b,c,d){return this.c.add(String(a),b,!1,c,d)};var P=function(a,b,c,d,e){a.c.remove(String(b),c,d,e)},ag=function(a,b,c,d){b=a.c.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 h=g.listener,m=g.fa||g.src;g.$&&If(a.c,g);e=!1!==h.call(m,d)&&e}}return e&&0!=d.Ba};var bg=function(){u.call(this)};ja(bg,u);bg.prototype.name="httpTimeout";var cg=function(a,b){var c=A(),d=function(e){c.b(e)};a.listen(b,d);return B(c.a,function(){P(a,b,d)})},dg=function(a){if(a instanceof E)throw a;},eg=function(a,b){var c=setTimeout(function(){a.cancel()},b);B(a,function(){clearTimeout(c);c=null});return a},fg=function(){var a=A();eg(a.a,2E3);return a};if(Ab&&Ab)try{new ActiveXObject("MSXML2.DOMDocument")}catch(a){};var S=function(a){this.a=new M;if(a){a=ee(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])}},gg=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[wa]||(a[wa]=++xa)):b.substr(0,1)+a};k=S.prototype;k.add=function(a){this.a.set(gg(a),a)};k.removeAll=function(a){a=ee(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};k.remove=function(a){return this.a.remove(gg(a))};k.clear=function(){this.a.clear()};k.contains=function(a){return de(this.a,gg(a))};
var hg=function(a,b){a=new S(a);a.removeAll(b);return a};S.prototype.u=function(){return this.a.u()};S.prototype.K=function(){return this.a.K(!1)};var ig=function(a){u.call(this,a)};ja(ig,u);ig.prototype.name="chrome.runtime.lastError";var jg=function(a,b){this.onNetworksChanged=a;this.onNetworkListChanged=b};r("castApp.core.NetworkingPrivateApi.WiFiProperties",function(){});r("castApp.core.NetworkingPrivateApi.NetworkProperties",function(){});var kg=[[0xfa8fca000000,0xfa8fcaffffff],[111971074048,111971139583]],lg=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]),mg=new S("bcamde".split("")),ng=new S("adghjkl".split("")),og=new S("bcamde".split("")),pg=new S(["b","c","a","m"]),qg=new S(["b","c","a","m"]),rg=new S(["d"]),sg=function(a,b){return!(!a||!b||0!==Ta(a,b))},tg=function(a){var b=
/^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(a)?parseInt(tb(a),16):NaN;return!!Ha(kg,function(c){return b>=c[0]&&b<=c[1]})},vg=function(a){return!a.WiFi||!a.WiFi.BSSID||a.WiFi.Security&&"None"!==a.WiFi.Security||!tg(a.WiFi.BSSID)?!1:mg.contains(ug(a.WiFi.SSID||"").type)},ug=function(a){var b=/^(.*)\.([^\.]*)$/.exec(a),c=null;return b&&3===b.length&&(c=wg(b[2]))?{name:b[1],type:c.type,subtype:c.subtype}:{name:a,type:"c",subtype:null}},wg=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}},xg=function(a,b){var c=new cd;c.supportsSetup=mg.contains(a);b&&!1===b.setup_supported&&(c.supportsSetup=!1);c.supportsDisplay=!ng.contains(a);b&&void 0!==b.display_supported&&(c.supportsDisplay=!!b.display_supported);if(og.contains(a)){var d=c.deviceSettings=new bd;d.supportsForgetWiFi=!0;b&&!1===b.wifi_supported&&(d.supportsForgetWiFi=!1);c.supportsSetup||(d.supportsForgetWiFi=!1);d.supportsReboot=pg.contains(a);b&&void 0!==b.reboot_supported&&
(d.supportsReboot=!!b.reboot_supported);d.supportsFdr=qg.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=!rg.contains(a)}return c},yg=function(a){return lg.b.get(a)||3},zg=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},Ag=function(a){switch(a){case 2:return 1;case 3:return 2;case 4:return 5;case 5:return 7}return 0},Bg=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},Cg=function(a){switch(a){case chrome.cast.SessionStatus.CONNECTED:return 1;case chrome.cast.SessionStatus.STOPPED:return 3}return 2},Dg=function(a,b){var c=
2;1===a.a?c=3:2===a.a&&(c=4);b=new Xc(c,b,[],null);b.selectedNetwork=new Wc(a.b||null,a.msg.ssid,zg(a.msg.wpa_auth));a.b&&b.networks.push(b.selectedNetwork);return b},Eg=function(a,b,c){switch(a){case 3:return c=new Ye,c.name=b,c;case 4:case 5:case 6:return a=new Ze,a.name=b,a.opt_in=new Ie,a.opt_in.crash=a.opt_in.stats=c,a;default:return a=new $e,a.name=b,a.opt_in=new Qe,a.opt_in.stats=c,a}},Fg=function(a){return"E8C28D3C"==a||"00000000-0000-0000-0000-000000000000"==a};var Gg=function(){},Ig=function(){this.b={};this.a={};Hg||(Hg=new x(function(a,b){window.__onGCastApiAvailable=function(d){d?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(Ig,Gg);
var Hg=null,Jg=function(a,b,c){return Hg.then(function(){var d=b+c,e=this.b[d];if(e)return e.a;e=fg();this.b[d]=e;var f=this.a[d];f||(f=new chrome.cast.SessionRequest(b),f=new chrome.cast.ApiConfig(f,this.c.bind(this),p,chrome.cast.AutoJoinPolicy.CUSTOM_CONTROLLER_SCOPED),f.invisibleSender=!Fg(b),f=chrome.cast.initializeWithContext(f,p,function(){}.bind(this)),this.a[d]=f);chrome.cast.requestSessionByIdWithContext(f,c);return e.a}.bind(a))};
Ig.prototype.c=function(a){var b=a.appId+a.sessionId,c=this.b[b];c&&c.b({session:a,context:this.a[b]})};var Kg=function(){jg.call(this,chrome.networkingPrivate.onNetworksChanged,chrome.networkingPrivate.onNetworkListChanged)};t(Kg,jg);Kg.a=void 0;Kg.b=function(){return Kg.a?Kg.a:Kg.a=new Kg};var Lg=function(a){return chrome.runtime.lastError?(a.c(new ig(chrome.runtime.lastError.message)),!0):!1};k=Kg.prototype;k.getNetworks=function(a){var b=A();chrome.networkingPrivate.getNetworks(a,function(c){Lg(b)||b.b(c)});return b.a};
k.getProperties=function(a){var b=A();chrome.networkingPrivate.getProperties(a,function(c){Lg(b)||b.b(c)});return b.a};k.requestNetworkScan=function(){chrome.networkingPrivate.requestNetworkScan()};k.startConnect=function(a){var b=A();chrome.networkingPrivate.startConnect(a,function(){Lg(b)||b.b()});return b.a};k.startDisconnect=function(a){var b=A();chrome.networkingPrivate.startDisconnect(a,function(){Lg(b)||b.b()});return b.a};
k.verifyDestination=function(a){var b=A();chrome.networkingPrivate.verifyDestination(a,function(c){Lg(b)||b.b(c)});return b.a};k.verifyAndEncryptData=function(a,b){var c=A();chrome.networkingPrivate.verifyAndEncryptData(a,b,function(d){Lg(c)||c.b(d)});return c.a};var Mg=function(){this.a=new S},Ng=function(a,b){a.a.add(b);return B(b,function(){this.a.remove(b)}.bind(a))},Og=function(a){if(0==a.a.a.a)return y();var b=a.a;a.a=new S;return new x(function(c){Zd(b,function(d){B(d,function(){b.remove(d)&&0==b.a.a&&c()});d.cancel()})})};var T=function(a,b){this.h=a;this.g=b;this.f=new Mg;this.c=new Q;this.a="stopped"};T.prototype.getState=function(){return this.a};T.prototype.b=function(a){a!==this.a&&(this.a=a,R(this.c,a))};T.prototype.start=function(){switch(this.a){case "stopped":case "stopping":return this.restart();case "starting":case "stoppingStartPending":return Pg(this);case "started":return y();default:return y()}};
T.prototype.restart=function(){switch(this.a){case "starting":case "started":this.b("stoppingStartPending");Qg(this);break;case "stopping":this.b("stoppingStartPending");break;case "stopped":this.b("starting"),Rg(this)}return Pg(this)};var Pg=function(a){var b=new Mg;return B(D(new x(function(c,d){Ng(b,cg(this.c,"started")).then(function(){c()});Ng(b,cg(this.c,"stopped")).then(function(){d()})}.bind(a)),function(c){c instanceof E&&this.stop();throw c;},a),function(){Og(b)})};
T.prototype.stop=function(){if("stopped"===this.a)return y();var a=this.a;this.b("stopping");"starting"!==a&&"started"!==a||Qg(this);return cg(this.c,"stopped")};
var U=function(a,b){if("starting"===a.a||"started"===a.a)return Ng(a.f,b),b;b.cancel();return fc(new E)},Sg=function(a){return"started"===a.a?y():cg(a.c,"started")},Qg=function(a){Og(a.f).then(function(){try{if(this.g)return this.g()}catch(b){}}.bind(a)).then(function(){"stoppingStartPending"===this.a?(this.b("starting"),Rg(this)):this.b("stopped")}.bind(a))},Rg=function(a){var b=null;try{b=a.h()}catch(c){b=fc(c)}"starting"!==a.a?b.cancel():D(Ng(a.f,b).then(a.b.bind(a,"started")),function(){this.stop()}.bind(a))};var Tg=function(a,b,c){if(ua(a))c&&(a=Aa(a,c));else if(a&&"function"==typeof a.handleEvent)a=Aa(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:l.setTimeout(a,b||0)},V=function(a){var b=null;return D(new x(function(c,d){b=Tg(function(){c(void 0)},a);-1==b&&d(Error("Failed to schedule timer."))}),function(c){l.clearTimeout(b);throw c;})};var ih=function(a){Ug||(Ug=new M("SetupStart.ShowDevice",Vg,"WiFiSwitching.ConnectHotSpot",Wg,"WiFiSwitching.ReconnectWiFi",Xg,"CodeConfirmation.Request",Yg,"DeviceConfig.Request",Zg,"DeviceConfig.Response",$g,"WiFiConfig.Show",ah,"WiFiConfig.UpdateNetworks",bh,"WiFiConfig.Connect",ch,"WiFiConfig.Retry",dh,"Devices.Show",eh,"Devices.UserAction",fh,"DeviceSettings.Show",gh,"DeviceSettings.Apply",hh),"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(b){Ug.set(b,
function(c){return y(c)})}));return Ug.get(a.type)(a).then(function(b){return JSON.stringify(b)})},Ug=null,Vg=function(a){return F(a.deviceName).then(function(b){b=new Hc(a.state,a.deviceType,b);b.otherDevicesExist=a.otherDevicesExist;b.analyticsOptIn=a.analyticsOptIn;return b})},Wg=function(a){return z([F(a.deviceName),F(a.ssid)]).then(function(b){return new Kc(a.state,b[0],b[1])})},Xg=function(a){return F(a.ssid).then(function(b){return new Lc(a.state,b)})},Yg=function(a){return z(a.code.map(F)).then(function(b){return new Nc(b)})},
Zg=function(a){return F(a.name).then(function(b){return new Tc(a.deviceType,b,a.country)})},$g=function(a){return F(a.name).then(function(b){return{requestId:a.responseTo,name:b,a:a.country}})},jh=function(a){return z([a.id?F(a.id):null,F(a.ssid)]).then(function(b){var c=ba(b);b=c.next().value;c=c.next().value;return new Wc(b,c,a.security)})},ah=function(a){return z([z(a.networks.map(jh)),a.selectedNetwork?jh(a.selectedNetwork):null]).then(function(b){var c=ba(b);b=c.next().value;c=c.next().value;
return new Xc(a.state,a.deviceType,b,c)})},bh=function(a){return z(a.networks.map(jh)).then(function(b){return new Yc(b)})},ch=function(a){return jh(a.network).then(function(b){return new Zc(b,"********")})},dh=function(a){return jh(a.network).then(function(b){return new $c(b)})},kh=function(a){return z([F(a.id),F(a.displayName)]).then(function(b){var c=ba(b);b=c.next().value;c=c.next().value;var d=cb(a);d.id=b;d.displayName=c;return d})},eh=function(a){return z([z(a.devices.map(kh)),a.deviceName?
F(a.deviceName):void 0]).then(function(b){var c=ba(b);b=c.next().value;c=c.next().value;return new fd(b,c)})},fh=function(a){return kh(a.device).then(function(b){return new gd(b,a.action)})},gh=function(a){return z([F(a.name),F(a.ssid||""),F(a.macAddress),F(a.ipAddress)]).then(function(b){var c=ba(b);b=c.next().value;var d=c.next().value,e=c.next().value;c=c.next().value;return new kd(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})})},hh=function(a){return F(a.name).then(function(b){var c=new ld(a);c.name=b;return c})};var lh=function(){this.a={};this.b={};this.c=new S};lh.prototype.sendMessage=function(a){a.responseTo?this.c.contains(a.responseTo)&&(this.c.remove(a.responseTo),mh(this,a)):mh(this,a)};lh.prototype.sendRequest=function(a,b){var c=A();this.a[a.requestId]={I:c,Da:b?setTimeout(Aa(this.i,this,a.requestId),b):null};mh(this,a);return c.a};lh.prototype.i=function(a){a in this.a&&(this.a[a].I.a.cancel(),delete this.a[a])};lh.prototype.addListener=function(a,b){var c=this.b[a];c||(c=this.b[a]=new S);c.add(b)};
var nh=function(a,b){var c=A(),d=Aa(function(e){c.b(e)},a);a.addListener(b,d);return B(c.a,function(){this.removeListener(b,d)}.bind(a))};lh.prototype.removeListener=function(a,b){(a=this.b[a])&&a.remove(b)};var oh=function(a,b){if(b.requestId)a.c.add(b.requestId);else if(b.responseTo){var c=a.a[b.responseTo];c&&(delete a.a[b.responseTo],null!==c.Da&&clearTimeout(c.Da),b instanceof uc?c.I.c(b):c.I.b(b))}var d=a.b[b.type];d&&d.u().forEach(function(e){d.contains(e)&&e(b)})};var ph=function(a,b,c,d,e){lh.call(this);this.f="object"===typeof b?b:null;this.j="function"===typeof b?b:null;this.h=c;this.m=d||p;this.g=e||function(f){return y(JSON.stringify(f))};a.addEventListener("message",this.l.bind(this))};t(ph,lh);ph.prototype.l=function(a){a.origin===this.h?(this.g(a.data),oh(this,a.data)):this.m()};var mh=function(a,b){a.g(b);a.f=a.f||a.j();a.f.postMessage(b,a.h)};var qh=function(a,b,c,d){this.f=new Q;this.h=new T(c,d);this.c=a;this.B=b+"/v6";this.w=b;this.g=[]},rh=function(){O.call(this,"redirect")};t(rh,O);qh.prototype.start=function(){return this.h.start().then(this.s.bind(this))};qh.prototype.stop=function(){return this.h.stop()};qh.prototype.j=function(a){0<=Da(this.g,a)||this.g.push(a)};
var sh=function(a){var b=a.localStorage.getItem("castApp.uiOrigin")||"https://castappui.google.com";qh.call(this,a,b,this.m.bind(this),this.l.bind(this));this.a=this.b=null;this.i=[["newwindow",this.v.bind(this)],["loadredirect",this.o.bind(this)]]};t(sh,qh);var th=["exit","loadabort","unresponsive"];sh.prototype.s=function(){return this.a};
var uh=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)};
sh.prototype.m=function(){var a=this,b=A(),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.B));th.forEach(function(f){d.addEventListener(f,c)});var e=function(){var f=d.contentWindow;a.b=d;a.a=new ph(a.c,f,a.w,function(){R(a.f,new O("originViolation"))},ih);b.b();uh(a)};d.addEventListener("contentload",e);B(b.a,function(){th.forEach(function(f){d.removeEventListener(f,c)});d.removeEventListener("contentload",
e)});a.i.forEach(function(f){d.addEventListener.apply(d,f)});d.parentElement||a.c.document.body.appendChild(d);a.b=d;return b.a};sh.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 y()};sh.prototype.o=function(a){R(this.f,new rh(a.newUrl,a.oldUrl))};
sh.prototype.v=function(a){var b=a.targetUrl,c=a.windowOpenDisposition,d=ve(b),e=d.c,f=d.f;d="https"===e&&("www.google.com"===f||"support.google.com"===f||"chromecast.com"===f)||"http"===e&&Qd(f)&&8008===d.h&&"/setup/NOTICE.html.gz"===d.b;!d&&0<=Da(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 vh=function(a,b,c,d,e,f,g,h,m,q,I){this.b=b;this.g=c;this.f=a.localStorage;this.l=d;this.c=e;this.m=m;this.j=f;this.reload=g;this.i=h;this.h=q;this.a=I};var wh=function(a){this.a=this.b=this.c=a};wh.prototype.reset=function(){this.a=this.b=this.c};var xh=function(a){a.a=Math.min(6E4,2*a.a);a.b=Math.min(6E4,a.a+0)};var yh=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",yh);yh.DeviceData=function(a,b,c){this.ipAddress=a;this.appId=b;this.sessionId=c};var zh=function(a,b,c,d){this.ipAddress=a;this.name=b;this.udn=c;this.modelName=d};yh.DeviceJustSetUp=zh;var Ah=function(){};yh.DeviceCapabilities=Ah;
yh.LogRecord=function(a,b,c,d){this.levelValue=a;this.msg=b;this.loggerName=c;this.time=d};var Dh=function(a){a.devices||a.deviceJustSetUp?z([a.devices?Bh(a.devices):void 0,a.deviceJustSetUp?Ch(a.deviceJustSetUp):void 0]).then(function(b){var c=ba(b);b=c.next().value;c=c.next().value;var d=cb(a);d.devices=b;d.deviceJustSetUp=c;return JSON.stringify(d)}):y(JSON.stringify(a))},Bh=function(a){return z(a.map(function(b){return F(b.ipAddress).then(function(c){var d=cb(b);d.ipAddress=c;return d})}))},Ch=function(a){return z([F(a.ipAddress),F(a.name),F(a.udn)]).then(function(b){var c=ba(b);b=
c.next().value;var d=c.next().value;c=c.next().value;b=new zh(b,d,c,a.modelName);a.capabilities&&(b.capabilities=a.capabilities);return b})};var Eh=function(){Q.call(this)};t(Eh,Q);var Fh=function(a){O.call(this,a.subtype);this.msg=a};t(Fh,O);var Gh=function(){this.b=new wh(100);this.f=null;Q.call(this)};t(Gh,Eh);var Hh=null;
Gh.prototype.start=function(){var a=this;Hh||(chrome.runtime.onMessage.addListener(this.h.bind(this)),Hh=D(B(new x(function(b,c){chrome.runtime.getBackgroundPage(function(){chrome.runtime.lastError?c(new ig(chrome.runtime.lastError.message)):(window["castApp.eventPage.Message.OriginID"]=ub(),a.a(),cg(a,"serviceReady").then(function(){b()},c))})}),function(){clearTimeout(a.f)}),function(b){throw b;}));return Hh};
Gh.prototype.a=function(){Ih("serviceCheck");this.f=setTimeout(this.a.bind(this),this.b.b);xh(this.b)};Gh.prototype.sendMessage=function(a){return this.start().then(function(){Ih(a)})};var Ih=function(a){a=va(a)?a:new yh(a);"logRecord"!==a.subtype&&Dh(a);chrome.runtime.sendMessage(a)},Jh=function(a){a.sendMessage("startDeviceMonitor")};Gh.prototype.h=function(a){"object"===typeof a&&"cast_app"===a.type&&"logRecord"!==a.subtype&&(Dh(a),R(this,new Fh(a)));return!1};var Kh=function(a){return(a=a.match(/^\w{2,3}([-_]|$)/))?a[0].replace(/[_-]/g,""):""},Lh=function(a){return(a=a.match(/[-_]([a-zA-Z]{2}|\d{3})([-_]|$)/))?a[0].replace(/[_-]/g,""):""};var Mh=fb(),Nh=wb()||v("iPod"),Oh=v("iPad"),Ph=v("Android")&&!(gb()||fb()||v("Opera")||v("Silk")),Qh=gb(),Rh=v("Safari")&&!(gb()||v("Coast")||v("Opera")||v("Edge")||v("Edg/")||fb()||v("Silk")||v("Android"))&&!(wb()||v("iPad")||v("iPod"));var Sh=function(a){return(a=a.exec(Wa))?a[1]:""},Th=function(){if(Mh)return Sh(/Firefox\/([0-9.]+)/);if(Ab||Bb||zb)return Jb;if(Qh)return wb()||v("iPad")||v("iPod")?Sh(/CriOS\/([0-9.]+)/):Sh(/Chrome\/([0-9.]+)/);if(Rh&&!(wb()||v("iPad")||v("iPod")))return Sh(/Version\/([0-9.]+)/);if(Nh||Oh){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(Wa);if(a)return a[1]+"."+a[2]}else if(Ph)return(a=Sh(/Android\s+([0-9.]+)/))?a:Sh(/Version\/([0-9.]+)/);return""}();var Uh=null,Vh=null,Xh=function(a){var b=[];Wh(a,function(c){b.push(c)});return b},Wh=function(a,b){function c(m){for(;d<a.length;){var q=a.charAt(d++),I=Vh[q];if(null!=I)return I;if(!/^[\s\xa0]*$/.test(q))throw Error("Unknown base64 encoding at char: "+q);}return m}Yh();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),h=c(64);if(64===h&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=h&&b(g<<6&192|h))}},Yh=function(){if(!Uh){Uh={};Vh={};for(var a=0;65>a;a++)Uh[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),
Vh[Uh[a]]=a,62<=a&&(Vh["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var Zh=function(){this.b=-1};var $h=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($h,Zh);$h.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 ai=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],h=a.a[3],m=a.a[4];for(e=0;80>e;e++){if(40>e)if(20>e){f=h^c&(g^h);var q=1518500249}else f=c^g^h,q=1859775393;else 60>e?(f=c&g|h&(c|g),q=2400959708):(f=c^g^
h,q=3395469782);f=(b<<5|b>>>27)+f+m+q+d[e]&4294967295;m=h;h=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]+h&4294967295;a.a[4]=a.a[4]+m&4294967295};
$h.prototype.update=function(a,b){if(null!=a){pa(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;)ai(this,a,d),d+=this.b;if(n(a))for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.b){ai(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.b){ai(this,e);f=0;break}}this.c=f;this.g+=b}};var bi=function(a,b){if(b+1>=a.length)return null;if(!(a[b+1]&128))return{length:a[b+1],ka: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,ka:c+1}},ci=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=bi(a,c);if(!f)break;var g=c+f.length+f.ka;if(g>=a.length)break;switch(e.action){case "step":c+=f.ka+1;continue;case "skip":c=g+1;continue;case "return":return Pa(a,c,g+1);default:return null}}return null},di=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)},
ei=function(a){return String.fromCharCode(50+a[a.length-1]%8)},fi=function(a,b){for(var c=[],d=0;4>d;d++)c[d]=a[b+d]^a[16+d];return c};var gi=function(a){this.a=a},hi=function(a,b,c,d){if(!a.f(d))return fc();var e=a.b(d.bssid);if(!e||!a.c(c))return fc();a=b.verifyDestination(e);D(a,function(){});return a.then(function(f){if(!f)return fc();f=new ff((new Date).getTime(),e);var g=e.certificate.replace(/[\r\n]/g,"");g=g.replace("-----BEGIN CERTIFICATE-----","");g=g.replace("-----END CERTIFICATE-----","");try{var h=Xh(g)}catch(C){h=null}if(h)if(g=ci(h)){h=new $h;h.update(g);g=[];var m=8*h.g;56>h.c?h.update(h.f,56-h.c):h.update(h.f,h.b-
(h.c-56));for(var q=h.b-1;56<=q;q--)h.h[q]=m&255,m/=256;ai(h,h.h);for(q=m=0;5>q;q++)for(var I=24;0<=I;I-=8)g[m]=h.a[q]>>I&255,++m;g?(h=[],h[0]=di(fi(g,0)),h[1]=ei(fi(g,4)),h[2]=di(fi(g,8)),h[3]=ei(fi(g,12))):h=null}else h=null;else h=null;if(!h)return fc();f.pin=h;return f})},ii=function(a){this.a=a};t(ii,gi);ii.prototype.f=function(a){return a.ssid===this.a.name};ii.prototype.c=function(){return!0};
ii.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 ji=function(a){this.a=a};t(ji,gi);ji.prototype.f=function(a){var b=this.a.hotspot_bssid.toLowerCase();return a.ssid===this.a.name&&a.bssid.toLowerCase()===b};
ji.prototype.c=function(a){return!(!this.a.sign||this.a.sign.nonce!==a)};
ji.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<=Va(Th,42)&&(b.intermediateCertificates=a.sign.intermediate_certs);return b};var ki=function(a){this.a=a};
t(ki,gi);ki.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&&sg(b.device_info.hotspot_bssid,a.bssid)};ki.prototype.c=function(a){return!(!this.a.sign||this.a.sign.nonce!==a)};
ki.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<=Va(Th,42)&&(b.intermediateCertificates=
a.sign.intermediate_certs);return b};var li=function(){};li.prototype.a=null;var ni=function(a){var b;(b=a.a)||(b={},mi(a)&&(b[0]=!0,b[1]=!0),b=a.a=b);return b};var oi,pi=function(){};t(pi,li);var qi=function(a){return(a=mi(a))?new ActiveXObject(a):new XMLHttpRequest},mi=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};oi=new pi;var ri=function(a){Q.call(this);this.headers=new M;this.w=a||null;this.b=!1;this.v=this.a=null;this.H="";this.h=0;this.f=this.G=this.m=this.B=!1;this.l=0;this.o=null;this.j="";this.R=this.i=!1};t(ri,Q);var si=/^https?$/i,ti=["POST","PUT"];ri.prototype.wa=function(){return this.j};ri.prototype.xa=function(){return this.i};
ri.prototype.send=function(a,b,c,d){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+a);b=b?b.toUpperCase():"GET";this.H=a;this.h=0;this.B=!1;this.b=!0;this.a=this.w?qi(this.w):qi(oi);this.v=this.w?ni(this.w):ni(oi);this.a.onreadystatechange=Aa(this.oa,this);try{this.G=!0,this.a.open(b,String(a),!0),this.G=!1}catch(f){ui(this);return}a=c||"";var e=new M(this.headers);d&&fe(d,function(f,g){e.set(g,f)});d=Ha(e.A(),vi);c=l.FormData&&a instanceof l.FormData;
!(0<=Da(ti,b))||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(f,g){this.a.setRequestHeader(g,f)},this);this.j&&(this.a.responseType=this.j);"withCredentials"in this.a&&this.a.withCredentials!==this.i&&(this.a.withCredentials=this.i);try{wi(this),0<this.l&&((this.R=xi(this.a))?(this.a.timeout=this.l,this.a.ontimeout=Aa(this.X,this)):this.o=Tg(this.X,this.l,this)),this.m=!0,this.a.send(a),this.m=!1}catch(f){ui(this)}};
var xi=function(a){return Ab&&Lb(9)&&qa(a.timeout)&&pa(a.ontimeout)},vi=function(a){return"content-type"==a.toLowerCase()};ri.prototype.X=function(){"undefined"!=typeof oa&&this.a&&(this.h=8,R(this,"timeout"),this.abort(8))};var ui=function(a){a.b=!1;a.a&&(a.f=!0,a.a.abort(),a.f=!1);a.h=5;yi(a);zi(a)},yi=function(a){a.B||(a.B=!0,R(a,"complete"),R(a,"error"))};
ri.prototype.abort=function(a){this.a&&this.b&&(this.b=!1,this.f=!0,this.a.abort(),this.f=!1,this.h=a||7,R(this,"complete"),R(this,"abort"),zi(this))};ri.prototype.C=function(){this.a&&(this.b&&(this.b=!1,this.f=!0,this.a.abort(),this.f=!1),zi(this,!0));ri.F.C.call(this)};ri.prototype.oa=function(){this.g||(this.G||this.m||this.f?Ai(this):this.Ia())};ri.prototype.Ia=function(){Ai(this)};
var Ai=function(a){if(a.b&&"undefined"!=typeof oa&&(!a.v[1]||4!=Bi(a)||2!=a.getStatus()))if(a.m&&4==Bi(a))Tg(a.oa,0,a);else if(R(a,"readystatechange"),4==Bi(a)){a.b=!1;try{Ci(a)?(R(a,"complete"),R(a,"success")):(a.h=6,a.getStatus(),yi(a))}finally{zi(a)}}},zi=function(a,b){if(a.a){wi(a);var c=a.a,d=a.v[0]?p:null;a.a=null;a.v=null;b||R(a,"ready");try{c.onreadystatechange=d}catch(e){}}},wi=function(a){a.a&&a.R&&(a.a.ontimeout=null);a.o&&(l.clearTimeout(a.o),a.o=null)},Ci=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.H).match(ge)[1]||null,!a&&l.self&&l.self.location&&(a=l.self.location.protocol,a=a.substr(0,a.length-1)),b=!si.test(a?a.toLowerCase():"");c=b}return c},Bi=function(a){return a.a?a.a.readyState:0};ri.prototype.getStatus=function(){try{return 2<Bi(this)?this.a.status:-1}catch(a){return-1}};ri.prototype.ca=function(){try{return this.a?this.a.responseText:""}catch(a){return""}};
ri.prototype.getResponseHeader=function(a){if(this.a&&4==Bi(this))return a=this.a.getResponseHeader(a),null===a?void 0:a};var Di=function(a){var b={};a=(a.a&&4==Bi(a)?a.a.getAllResponseHeaders()||"":"").split("\r\n");for(var c=0;c<a.length;c++)if(!/^[\s\xa0]*$/.test(a[c])){var d=vb(a[c]),e=d[0];d=d[1];if(n(d)){d=d.trim();var f=b[e]||[];b[e]=f;f.push(d)}}return $a(b,function(g){return g.join(", ")})};var Ei=function(a){uf.call(this);this.b=a;this.a={}};t(Ei,uf);var Fi=[];Ei.prototype.listen=function(a,b,c,d){sa(b)||(b&&(Fi[0]=b.toString()),b=Fi);for(var e=0;e<b.length;e++){var f=Of(a,b[e],c||this.handleEvent,d||!1,this.b||this);if(!f)break;this.a[f.key]=f}return this};
var Gi=function(a,b,c,d,e,f){if(sa(c))for(var g=0;g<c.length;g++)Gi(a,b,c[g],d,e,f);else d=d||a.handleEvent,e=va(e)?!!e.capture:!!e,f=f||a.b||a,d=Qf(d),e=!!e,c=Cf(b)?Jf(b.c,String(c),d,e,f):b?(b=Sf(b))?Jf(b,c,d,e,f):null:null,c&&(Xf(c),delete a.a[c.key])};Ei.prototype.removeAll=function(){Za(this.a,function(a,b){this.a.hasOwnProperty(b)&&Xf(a)},this);this.a={}};Ei.prototype.C=function(){Ei.F.C.call(this);this.removeAll()};
Ei.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented");};var Hi=function(){this.b=[];this.a=[]},Ii=function(a){0==a.b.length&&(a.b=a.a,a.b.reverse(),a.a=[]);return a.b.pop()},Ji=function(a){return a.b.length+a.a.length};Hi.prototype.clear=function(){this.b=[];this.a=[]};Hi.prototype.contains=function(a){return 0<=Da(this.b,a)||0<=Da(this.a,a)};Hi.prototype.remove=function(a){var b=this.b;var c=Ea(b,a);0<=c?(Ja(b,c),b=!0):b=!1;return b||Ka(this.a,a)};
Hi.prototype.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 Ki=function(a,b){uf.call(this);this.m=a||0;this.c=b||10;if(this.m>this.c)throw Error("[goog.structs.Pool] Min can not be greater than max");this.a=new Hi;this.b=new S;this.delay=0;this.i=null;this.Y()};t(Ki,uf);Ki.prototype.ba=function(){var a=Ca();if(!(null!=this.i&&a-this.i<this.delay)){for(var b;0<Ji(this.a)&&(b=Ii(this.a),!this.j(b));)this.Y();!b&&Li(this)<this.c&&(b=this.h());b&&(this.i=a,this.b.add(b));return b}};
Ki.prototype.S=function(a){this.b.remove(a);this.j(a)&&Li(this)<this.c?this.a.a.push(a):Mi(a)};Ki.prototype.Y=function(){for(var a=this.a;Li(this)<this.m;){var b=this.h();a.a.push(b)}for(;Li(this)>this.c&&0<Ji(this.a);)Mi(Ii(a))};Ki.prototype.h=function(){return{}};var Mi=function(a){if("function"==typeof a.aa)a.aa();else for(var b in a)a[b]=null};Ki.prototype.j=function(a){return"function"==typeof a.La?a.La():!0};Ki.prototype.contains=function(a){return this.a.contains(a)||this.b.contains(a)};
var Li=function(a){return Ji(a.a)+a.b.a.a};Ki.prototype.C=function(){Ki.F.C.call(this);if(0<this.b.a.a)throw Error("[goog.structs.Pool] Objects not released");delete this.b;for(var a=this.a;0!=a.b.length||0!=a.a.length;)Mi(Ii(a));delete this.a};var Ni=function(a,b){this.a=a;this.b=b};var Oi=function(a){this.a=[];if(a)a:{if(a instanceof Oi){var b=a.A();a=a.u();if(0>=this.a.length){for(var c=this.a,d=0;d<b.length;d++)c.push(new Ni(b[d],a[d]));break a}}else b=bb(a),a=ab(a);for(d=0;d<b.length;d++)Pi(this,b[d],a[d])}},Pi=function(a,b,c){var d=a.a;d.push(new Ni(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};
Oi.prototype.remove=function(){var a=this.a,b=a.length,c=a[0];if(!(0>=b)){if(1==b)Ia(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}};Oi.prototype.u=function(){for(var a=this.a,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].b);return b};Oi.prototype.A=function(){for(var a=this.a,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].a);return b};Oi.prototype.clear=function(){Ia(this.a)};var Qi=function(){Oi.call(this)};t(Qi,Oi);var Ri=function(a,b){this.l=void 0;this.f=new Qi;Ki.call(this,a,b)};t(Ri,Ki);k=Ri.prototype;k.ba=function(a,b){if(!a)return(a=Ri.F.ba.call(this))&&this.delay&&(this.l=l.setTimeout(Aa(this.da,this),this.delay)),a;Pi(this.f,pa(b)?b:100,a);this.da()};k.da=function(){for(var a=this.f;0<a.a.length;){var b=this.ba();if(b)a.remove().apply(this,[b]);else break}};k.S=function(a){Ri.F.S.call(this,a);this.da()};k.Y=function(){Ri.F.Y.call(this);this.da()};
k.C=function(){Ri.F.C.call(this);l.clearTimeout(this.l);this.f.clear();this.f=null};var Si=function(a,b,c,d){this.o=a;this.v=!!d;Ri.call(this,b,c)};t(Si,Ri);Si.prototype.h=function(){var a=new ri,b=this.o;b&&b.forEach(function(c,d){a.headers.set(d,c)});this.v&&(a.i=!0);return a};Si.prototype.j=function(a){return!a.g&&!a.a};var Ti=function(a,b,c,d,e,f){Q.call(this);this.i=pa(a)?a:1;this.h=pa(e)?Math.max(0,e):0;this.j=!!f;this.b=new Si(b,c,d,f);this.a=new M;this.f=new Ei(this)};t(Ti,Q);var Ui="ready complete success error abort timeout".split(" ");Ti.prototype.send=function(a,b,c,d,e,f,g,h,m,q){if(this.a.get(a))throw Error("[goog.net.XhrManager] ID in use");b=new Vi(b,Aa(this.m,this,a),c,d,e,g,pa(h)?h:this.i,m,pa(q)?q:this.j);this.a.set(a,b);a=Aa(this.l,this,a);this.b.ba(a,f);return b};
Ti.prototype.abort=function(a,b){var c=this.a.get(a);if(c){var d=c.ha;c.pa=!0;b&&(d&&(Gi(this.f,d,Ui,c.na),Nf(d,"ready",function(){var e=this.b;e.b.remove(d)&&e.S(d)},!1,this)),this.a.remove(a));d&&d.abort()}};Ti.prototype.l=function(a,b){var c=this.a.get(a);c&&!c.ha?(this.f.listen(b,Ui,c.na),b.l=Math.max(0,this.h),b.j=c.wa(),b.i=c.xa(),c.ha=b,R(this,new Wi("ready",this,a,b)),Xi(this,a,b),c.pa&&b.abort()):(a=this.b,a.b.remove(b)&&a.S(b))};
Ti.prototype.m=function(a,b){var c=b.target;switch(b.type){case "ready":Xi(this,a,c);break;case "complete":a:{var d=this.a.get(a);if(7==c.h||Ci(c)||d.Z>d.ja)if(R(this,new Wi("complete",this,a,c)),d&&(d.ua=!0,d.ta)){a=d.ta.call(c,b);break a}a=null}return a;case "success":R(this,new Wi("success",this,a,c));break;case "timeout":case "error":b=this.a.get(a);b.Z>b.ja&&R(this,new Wi("error",this,a,c));break;case "abort":R(this,new Wi("abort",this,a,c))}return null};
var Xi=function(a,b,c){var d=a.a.get(b);!d||d.ua||d.Z>d.ja?(d&&(Gi(a.f,c,Ui,d.na),a.a.remove(b)),a=a.b,a.b.remove(c)&&a.S(c)):(d.Z++,c.send(d.eb,d.qb,d.getContent(),d.cb))};Ti.prototype.C=function(){Ti.F.C.call(this);this.b.aa();this.b=null;this.f.aa();this.f=null;this.a.clear();this.a=null};var Wi=function(a,b,c,d){O.call(this,a,b);this.id=c;this.ha=d};t(Wi,O);
var Vi=function(a,b,c,d,e,f,g,h,m){this.eb=a;this.qb=c||"GET";this.a=d;this.cb=e||null;this.ja=pa(g)?g:1;this.Z=0;this.pa=this.ua=!1;this.na=b;this.ta=f;this.b=h||"";this.c=!!m;this.ha=null};Vi.prototype.getContent=function(){return this.a};Vi.prototype.xa=function(){return this.c};Vi.prototype.wa=function(){return this.b};var Yi=function(){},Zi=function(){u.call(this)};t(Zi,u);Zi.prototype.name="httpStatus";var $i=function(){u.call(this)};t($i,u);$i.prototype.name="httpResponseParsing";var aj=function(a,b){return a.request(b).then(function(c){if((c.getResponseHeader("content-type")||"").toLowerCase().startsWith("application/json")){c=c.ca();c.startsWith(")]}'")&&(c=c.substr(4));try{return JSON.parse(c)}catch(d){}}throw new $i;})},bj=function(){this.a=new M;this.b=0};t(bj,Yi);
var cj=function(a){this.b=a.ca();this.a={};Za(Di(a),function(b,c){this.a[c.toLowerCase()]=b},this)};cj.prototype.ca=function(){return this.b};cj.prototype.getResponseHeader=function(a){return this.a[a.toLowerCase()]||void 0};bj.prototype.request=function(a){var b=A(),c=a.timeout||1E4,d=this.a.get(c);d||(d=new Ti,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(e){e=e.target;Ci(e)?b.b(new cj(e)):b.c(new Zi(e.getStatus()))},a.D);return b.a};var dj=function(a,b,c){var d=b.read();this.a=d.eurekaInfoState&&d.eurekaInfoState.setupApiVersion||null;this.g=new ie("http://"+d.deviceIpAddress+":8008");this.b=a;this.c=b;c?(a=Kh(c),c=(c=Lh(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};dj.prototype.getState=function(){return this.c.read()};
var ej=function(a){return a.c.read().eurekaInfoState},gj=function(a,b){return a.b.request({url:fj(a,"/setup/connect_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(b),D:0})},hj=function(a,b){var c=new ie(a.g);c.b="/setup/eureka_info";if(b){var d=[];if(b.options){var e=new S(b.options),f=e.contains("sign");if(null===a.a||7>a.a){var g=new S(["sign","detail"]),h=new S;g=ee(g);for(var m=0;m<g.length;m++){var q=g[m];e.contains(q)&&h.add(q)}h.a.a&&d.push("options="+
h.u().join(","))}e.a.a&&(null===a.a||7<=a.a)&&d.push("params="+e.u().join(","))}b.nonce&&d.push("nonce="+b.nonce);d.length&&me(c,d.join("&"),void 0)}b=void 0;a.f&&(b={"Accept-Language":a.f});return aj(a.b,{url:c.toString(),method:"GET",headers:b,timeout:f?4E4:1E4,D:f?1:2}).then(a.j.bind(a)).then(a.l.bind(a))};dj.prototype.j=function(a){if(!a.version)return a;if(!this.i.contains(a.version))throw new ij(a.version);this.a=parseInt(a.version,10);var b=this.h.get(this.a,null);!b&&7<=this.a&&(b=Me);return b(a)};
dj.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=wg(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=xg(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?eb(c,d):b.eurekaInfoState=d;b.eurekaInfoState.features||(b.eurekaInfoState.features=xg(d.deviceType||c&&c.deviceType||"b"));this.c.write(b);return a};
var jj=function(a){return aj(a.b,{url:fj(a,"/setup/offer"),method:"GET",timeout:1E4,D:2}).then(function(b){return b})},kj=function(a,b){a.b.request({url:fj(a,"/setup/reboot"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new Te(b)),timeout:1E4,D:2})},lj=function(a){var b=new We;b.immediate=!0;return aj(a.b,{url:fj(a,"/setup/save_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(b),timeout:2E4,D:1}).then(function(c){var d=this.c.read();
d.eurekaInfoState&&d.eurekaInfoState.setupState!==c.setup_state&&(d.eurekaInfoState.setupState=c.setup_state,this.c.write(d));return c}.bind(a))},mj=function(a){return aj(a.b,{url:fj(a,"/setup/scan_results"),method:"GET",timeout:1E4,D:5}).then(function(b){return b})},nj=function(a){return a.b.request({url:fj(a,"/setup/scan_wifi"),method:"POST",D:0})},oj=function(a,b){return a.b.request({url:fj(a,"/setup/set_eureka_info"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(b),
D:0})},pj=function(a){return aj(a.b,{url:fj(a,"/setup/supported_locales"),method:"GET",timeout:1E4,D:2}).then(function(b){return b})},qj=function(a){return aj(a.b,{url:fj(a,"/setup/supported_timezones"),method:"GET",timeout:1E4,D:2}).then(function(b){return b})},fj=function(a,b){a=new ie(a.g);a.b=b;return a.toString()};new S(["now","fdr","ota"]);dj.prototype.i=new S([3,4,5,6,7,8]);dj.prototype.h=new M(3,function(a){w(a,"locale","en-US");return a},4,Ge,5,Ge,6,Ge,7,Me);
var rj=function(a){var b=new df(a);return{read:function(){return b},write:function(c){b=c}}},tj=function(a,b,c){var d=new dj(a,b,c);return d.a?y(d):hj(d,{options:sj()}).then(function(){return d})},vj=function(a,b,c,d,e){var f=new dj(a,b,e),g=b.read();if(g.eurekaInfoState&&g.eurekaInfoState.ethernetConnected)return y(f);if(g.verificationState){if(sg(g.verificationState.verificationProperties.deviceBssid,d.bssid))return y(f);g=new df(g.deviceIpAddress);b.write(g)}a={};var h=a.nonce=ub();a.options=sj().concat(["name",
"sign","device_info.public_key","device_info.hotspot_bssid"]);return hj(f,a).then(function(m){a:switch(m.version){case 3:m=hi(new ii(m),c,h,d);break a;case 4:case 5:case 6:m=hi(new ji(m),c,h,d);break a;default:m=hi(new ki(m),c,h,d)}return m}).then(function(m){g=b.read();g.verificationState=m;b.write(g);return f},function(m){dg(m);if(m instanceof Zi)throw m;throw new uj;})},ij=function(){u.call(this)};t(ij,u);ij.prototype.name="setupApiVersionError";var uj=function(){u.call(this)};t(uj,u);
uj.prototype.name="deviceVerificationError";var sj=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(" ")};var wj=function(a,b){this.networks=new M;this.f=new T(this.Za.bind(this),this.Ya.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 S;this.h=this.gb.bind(this);this.i=this.hb.bind(this);this.a=new Q};k=wj.prototype;k.start=function(){return this.f.start()};k.stop=function(){return this.f.stop()};
k.Za=function(){var a=this.b;a.onNetworkListChanged.addListener(this.h);a.onNetworksChanged.addListener(this.i);return U(this.f,this.b.getNetworks({networkType:"WiFi",visible:!0})).then(this.pb.bind(this))};k.pb=function(a){return z(a.filter(function(b){if(xj(this,b))return!0;this.c.add(b.GUID);return!1}.bind(this)).map(function(b){return this.ma(b.GUID)}.bind(this)))};
k.Ya=function(){this.b.onNetworkListChanged.removeListener(this.h);this.b.onNetworksChanged.removeListener(this.i);this.networks.clear();this.c.clear();return y()};k.gb=function(a){var b=new S(this.networks.A());a=hg(new S(a),this.c);Zd(hg(a,b),this.ma.bind(this));Zd(hg(b,a),this.Aa.bind(this))};k.Aa=function(a){var b=this.networks.get(a);this.networks.remove(a);a="Connected"===b.ConnectionState;b.ConnectionState="NotConnected";a&&yj(this,"disconnected",b);yj(this,"removed",b)};
k.hb=function(a){a=hg(new S(a),this.c);Zd(a,this.ma.bind(this))};k.ma=function(a){var b=this,c=A();B(D(zj(b,a).then(function(d){var e=b.networks.get(a),f=!(!e||"Connected"!==e.ConnectionState);b.networks.set(d.GUID,d);var g="Connected"===d.ConnectionState;e||yj(b,"added",d);!f&&g?yj(b,"connected",d):f&&!g&&yj(b,"disconnected",d)}),function(){de(b.networks,a)&&b.Aa(a)}),function(){c.b()});return c.a};
var yj=function(a,b,c){Aj.bind(a,c);R(a.a,new Bj(b,c))},zj=function(a,b){return D(U(a.f,a.b.getProperties(b)),function(c){c instanceof E||F(b);throw c;}.bind(a)).then(function(c){if(!Cj(this,c))throw this.c.add(b),new E;return c}.bind(a))},xj=function(a,b){return!Ha(a.g,function(c){return!c.c(b)})},Cj=function(a,b){return!Ha(a.g,function(c){return!c.a(b)})},Bj=function(a,b){O.call(this,a);this.properties=b};t(Bj,O);var Dj=function(){};Dj.prototype.c=function(){return!0};Dj.prototype.a=function(){return!0};
var Ej=function(a){this.b=a||null};t(Ej,Dj);Ej.prototype.c=function(a){return!(!a.WiFi||a.WiFi.Security&&"None"!==a.WiFi.Security)};Ej.prototype.a=function(a){return this.b?!(!a.WiFi||a.WiFi.BSSID!==this.b):vg(a)};
var Aj=function(a){var b=[];["GUID","Name"].forEach(function(c){c in a&&(b.push(" "+c+": "),b.push(F(""+a[c])))});["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(F(""+a.WiFi[c])))}),["Security","SignalStrength"].forEach(function(c){b.push(" WiFi."+c+": "+a.WiFi[c])}));return y("")};var Fj=function(a){this.b=a;this.a=null},Gj=new M(1,2E4,3,6E4,2,6E4),Ij=function(a,b){var c=nf(a).filter(Hj);c.push(b);of(a,c)},Hj=function(a){var b=Gj.get(a.type,Infinity);return Ca()-a.time<b},Jj=function(a){this.b=a};t(Jj,Dj);Jj.prototype.a=function(a){a=a.WiFi&&a.WiFi.BSSID;var b=Kj(this.b,a,2);b&&F(a);return!b};
var Lj=function(a){a.a=new M;for(var b=nf(a.b),c=[],d=0,e=b.length;d<e;++d){var f=b[d];if(Hj(f)){c.push(f);de(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&&of(a.b,c)},Kj=function(a,b,c){a.a||Lj(a);a=a.a.get(c,null);if(null===a||!de(a,b))return!1;b=a.get(b)+Gj.get(c,0);return Ca()<b},Mj=function(a,b){(a=Kj(a,b,1)||Kj(a,b,3))&&F(b);return a};var Nj=function(a,b,c,d){Q.call(this);this.m=new Fj(d.localStorage);this.f=new wj(a,new Ej,new Jj(this.m));this.h=b;this.G=a;this.B=c;this.l=d};t(Nj,Q);var Oj=function(a){O.call(this,"devices");this.devices=a};t(Oj,O);var Pj=function(a,b,c,d){Nj.call(this,a,b,c,d);this.a=null;this.j=0;this.b=new M;this.i=new wh(5E3);this.v=this.H.bind(this);this.w=this.lb.bind(this);this.o=new T(this.Xa.bind(this),this.Wa.bind(this))};t(Pj,Nj);
var Qj=function(a,b){return D(tj(a.B,rj(b)).then(function(c){var d=c.getState(),e=d.eurekaInfoState;if(d.deviceIpAddress&&e&&e.name&&e.ssdpUdn&&void 0!==e.ethernetConnected&&void 0!==e.tosAccepted&&e.deviceType&&void 0!==e.features)return c;F(b);return fc()}.bind(a)),function(){F(b)}.bind(a))};k=Pj.prototype;k.Xa=function(){this.l.document.addEventListener("visibilitychange",this.w);this.h.listen("devices",this.v);Jh(this.h);this.j=0;return this.f.start().then(this.N.bind(this))};
k.Wa=function(){this.l.document.removeEventListener("visibilitychange",this.w);P(this.h,"devices",this.v);this.j=0;this.i=new wh(5E3);this.a&&(this.a.cancel(),this.a=null);this.b.clear();return this.f.stop()};k.start=function(){return this.o.start()};k.stop=function(){return this.o.stop()};k.lb=function(){this.l.document.hidden?this.a&&(this.a.cancel(),this.a=null):(this.i=new wh(5E3),this.N())};
k.N=function(){this.a&&this.a.cancel();Lj(this.m);this.G.requestNetworkScan();this.j++;1<=this.j&&this.l.document.hidden?this.a=null:(this.a=V(this.i.b),U(this.o,this.a).then(this.N.bind(this)),xh(this.i))};var Rj=function(a){var b=[];a.b.u().forEach(function(c){c.U&&!Mj(this.m,c.ipAddress)&&b.push(c)}.bind(a));R(a,new Oj(b))};
Pj.prototype.H=function(a){var b=new S;a.msg.devices.forEach(function(c){b.add(c.ipAddress);var d=this.b.get(c.ipAddress);d||(d={ipAddress:c.ipAddress},Qj(this,c.ipAddress).then(function(e){var f=this.b.get(c.ipAddress);f?(f.U=e,this.b.set(c.ipAddress,f),Rj(this)):F(c.ipAddress)}.bind(this)));c.sessionId&&c.appId&&(d.sessionId=c.sessionId,d.appId=c.appId);this.b.set(c.ipAddress,d)}.bind(this));Zd(hg(new S(this.b.A()),b),this.b.remove.bind(this.b));Rj(this)};var Sj=function(){},Tj="function"==typeof Uint8Array,Wj=function(a,b,c,d){a.b=null;b||(b=c?[c]:[]);a.j=c?String(c):void 0;a.f=0===c?-1:0;a.a=b;a:{if(b=a.a.length)if(--b,c=a.a[b],!(null===c||"object"!=typeof c||sa(c)||Tj&&c instanceof Uint8Array)){a.g=b-a.f;a.c=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]||Uj):(Vj(a),a.c[c]=a.c[c]||Uj)},Uj=[],Vj=function(a){var b=a.g+a.f;a.a[b]||(a.c=a.a[b]={})},Xj=function(a,b){if(b<a.g){b+=a.f;var c=a.a[b];
return c===Uj?a.a[b]=[]:c}if(a.c)return c=a.c[b],c===Uj?a.c[b]=[]:c},Yj=function(a,b,c){b<a.g?a.a[b+a.f]=c:(Vj(a),a.c[b]=c)},Zj=function(a,b,c){a.b||(a.b={});if(!a.b[c]){for(var d=Xj(a,c),e=[],f=0;f<d.length;f++)e[f]=new b(d[f]);a.b[c]=e}b=a.b[c];b==Uj&&(b=a.b[c]=[]);return b},bk=function(a){if(a.b)for(var b in a.b){var c=a.b[b];if(sa(c))for(var d=0;d<c.length;d++)c[d]&&ak(c[d]);else c&&ak(c)}},ak=function(a){bk(a);return a.a};
Sj.prototype.h=Tj?function(){var a=Uint8Array.prototype.toJSON;Uint8Array.prototype.toJSON=function(){Yh();for(var b=Uh,c=[],d=0;d<this.length;d+=3){var e=this[d],f=d+1<this.length,g=f?this[d+1]:0,h=d+2<this.length,m=h?this[d+2]:0,q=e>>2;e=(e&3)<<4|g>>4;g=(g&15)<<2|m>>6;m&=63;h||(m=64,f||(g=64));c.push(b[q],b[e],b[g],b[m])}return c.join("")};try{return JSON.stringify(this.a&&ak(this),ck)}finally{Uint8Array.prototype.toJSON=a}}:function(){return JSON.stringify(this.a&&ak(this),ck)};
var ck=function(a,b){return qa(b)&&(isNaN(b)||Infinity===b||-Infinity===b)?String(b):b};Sj.prototype.toString=function(){bk(this);return this.a.toString()};var dk=function(a){Wj(this,a,0,null)};t(dk,Sj);var fk=function(a){Wj(this,a,"is.gsser",ek)};t(fk,Sj);var gk=function(a){Wj(this,a,0,null)};t(gk,Sj);var hk=function(a){Wj(this,a,0,null)};t(hk,Sj);var ek=[3,5,13];fk.messageId="is.gsser";fk.prototype.getTitle=function(){return Xj(this,1)};fk.prototype.setTitle=function(a){Yj(this,1,a)};var ik=function(a,b,c){this.b=a;this.a=c;this.c="https://clients3.google.com/cast/chromecast/home/gsse?rt=j&hl="+b};
ik.prototype.request=function(a){var b=new dk;Yj(b,3,a);Yj(b,1,"E8C28D3C");return this.b.request({url:this.c,method:"POST",content:b.h(),headers:{"Content-Type":"application/json"}}).then(function(c){c=c.ca();c.startsWith(")]}'\n")&&(c=c.slice(5));c=JSON.parse(c);c=new fk(c[0][0]);var d=[],e=Xj(c,4);e&&d.push(e);(e=Zj(c,hk,5))&&e.forEach(function(f){d.push(Xj(f,2))});d.forEach(this.a.j.bind(this.a));return c}.bind(this))};var jk=function(a){this.b=a;this.a=new M;this.f=new T(this.Ra.bind(this),this.Qa.bind(this));this.i=this.mb.bind(this);this.j=this.nb.bind(this);this.h=this.Pa.bind(this);this.l=this.kb.bind(this);this.g=this.Oa.bind(this);this.c=null},kk=function(a){this.a=a};kk.prototype.T=function(){var a=ug(this.a.WiFi.SSID),b=new ed("wifi:"+this.a.GUID,yg(a.type),a.name);b.needsSetup=!0;b.features=xg(a.type);return b};
kk.prototype.va=function(){var a=this.T();a={name:a.displayName,type:lg.a.get(a.type)||"c"};a.ssid=this.a.WiFi.SSID;a.bssid=this.a.WiFi.BSSID;return new cf(a)};kk.prototype.start=function(){return y()};kk.prototype.stop=function(){return y()};var lk=function(a,b,c,d){this.j=b;this.a=null;this.c=d;this.m=a;this.h=new T(this.Na.bind(this),this.Ma.bind(this));this.v=c;this.g=this.b=this.f=null;this.w=new ik(a.g,a.h(),this.m.m);this.i=this.l.bind(this);this.o=this.ib.bind(this);this.s=this.fb.bind(this)};
lk.prototype.va=function(){var a=this.T();return new cf({name:a.displayName,type:lg.a.get(a.type)||"c",ipAddress:this.j})};
var mk=function(a,b){if(!Fg(a.a.appId)||Fg(a.a.appId)&&!a.f)return b;a.a.status&&(b.sessionStatus=Cg(a.a.status));var c=Zj(a.f,gk,3);0<c.length&&(b.backdropImageAttributions=Ga(c,function(e){return Xj(e,1)}.bind(a)));c=Zj(a.f,hk,5);0<c.length&&(b.backdropSecondaryActions=Ga(c,function(e){var f={},g=Xj(e,1);g&&(f.text=g);(e=Xj(e,2))&&(f.url=e);return f}.bind(a)));if(c=a.f.getTitle())b.mediaTitle=c;var d=Xj(a.f,2);d&&(b.imgUrl=d);if(a=Xj(a.f,4))b.backdropPrimaryActionUrl=a;c||1!==b.backdropImageAttributions.length||
(b.mediaTitle=b.backdropImageAttributions[0],b.backdropImageAttributions=[]);return b};k=lk.prototype;
k.T=function(){var a="ip:"+this.j,b=this.v.getState().eurekaInfoState;a=new ed(a,yg(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(Fg(this.a.appId))a=mk(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=Cg(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=nk(this))if(0<=Da(b.supportedMediaCommands,chrome.cast.media.MediaCommand.PAUSE)&&(a.canPause=!0),b.playerState&&(a.playerState=Bg(b.playerState)),b.media&&(b.media.duration&&(a.mediaDuration=b.media.duration),b=b.media.metadata||
b.media.wb))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};k.rb=function(){if(this.g)if(!this.g.appId||!this.g.sessionId)ok(this),this.c();else if(!this.a||this.a.sessionId!=this.g.sessionId){var a=Jg(this.m.i,this.g.appId,this.g.sessionId);a.then(this.jb.bind(this));U(this.h,a);this.g=null}};
k.jb=function(a){a.session.status!==chrome.cast.SessionStatus.STOPPED&&(this.a&&ok(this),this.a=a.session,this.b=a.context,this.a.addMediaListenerWithContext(this.b,this.o),this.a.addUpdateListenerWithContext(this.b,this.i),Fg(this.a.appId)&&(this.a.addMessageListenerWithContext(this.b,"urn:x-cast:com.google.cast.sse",this.s),this.a.sendMessageWithContext(this.b,"urn:x-cast:com.google.cast.sse",{type:"GET_STATUS",requestId:Math.floor(4294967295*Math.random())},p,function(){})),this.a.media&&this.a.media.forEach(function(b){b.addUpdateListenerWithContext(this.b,
this.i)}.bind(this)),this.l())};k.fb=function(a,b){"urn:x-cast:com.google.cast.sse"===a&&(a=JSON.parse(b),a=this.w.request(a.backendData),a.then(function(c){this.f=c;this.c()}.bind(this)),U(this.h,a))};k.ib=function(a){this.l();a.addUpdateListenerWithContext(this.b,this.i)};k.start=function(){return this.h.start()};k.stop=function(){return this.h.stop()};k.Na=function(){return y()};k.Ma=function(){ok(this);return y()};
var ok=function(a){a.f=null;a.a&&(a.a.media&&a.a.media.forEach(function(b){b.removeUpdateListenerWithContext(this.b,this.i)}.bind(a)),a.a.removeUpdateListenerWithContext(a.b,a.i),a.a.removeMediaListenerWithContext(a.b,a.o),Fg(a.a.appId)&&a.a.removeMessageListenerWithContext(a.b,"urn:x-cast:com.google.cast.sse",a.s),a.a=null,a.b=null)},nk=function(a){if(!a.a||!a.a.media)return null;var b=null;a.a.media.forEach(function(c){c&&(b?!b.media&&c.media?b=c:b.playerState==chrome.cast.media.PlayerState.IDLE&&
c.playerState!=chrome.cast.media.PlayerState.IDLE&&(b=c):b=c)}.bind(a));return b};lk.prototype.l=function(){this.a.status===chrome.cast.SessionStatus.STOPPED&&ok(this);this.c()};
var pk=function(a,b){if(a.a&&a.b){var c=nk(a);c&&0<=Da(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(){}))}},qk=function(a,b,c){if(a.a&&a.b)switch(c){case 4:case 3:pk(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(){})}},rk=function(a,b){if(a.id===b.id)return 0;if(a.needsSetup!==b.needsSetup)return a.needsSetup?-1:1;var c=Ta(a.displayName,b.displayName);return 0!==c?c:a.id<b.id?-1:a.id>b.id?1:0};k=jk.prototype;k.start=function(){return this.f.start()};k.stop=function(){return this.f.stop()};
k.Ra=function(){this.O();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;Jh(a.h);a.N();return this.b.a.start()};
k.Qa=function(){this.b.b.a.a.removeListener("Devices.UserAction",this.h);var a=this.b.a.f.a;P(a,"added",this.i);P(a,"removed",this.j);P(this.b.a,"devices",this.g);var b=[this.b.a.stop()];this.a.forEach(function(c){b.push(c.stop())}.bind(this));this.a=new M;return z(b)};k.mb=function(a){var b="wifi:"+a.properties.GUID;a=this.a.get(b)||new kk(a.properties);this.a.set(b,a);a.start();this.O()};k.nb=function(a){a="wifi:"+a.properties.GUID;var b=this.a.get(a);b&&(b.stop(),this.a.remove(a),this.O())};
k.Oa=function(a){var b=new M,c=!1;a.devices.forEach(function(d){if(d.ipAddress){var e="ip:"+d.ipAddress,f=this.a.get(e);f||(f=new lk(this.b,d.ipAddress,d.U,this.O.bind(this)),f.start(),c=!0);var g=f;d.ipAddress!=g.j?(F(d.ipAddress),F(g.j)):(g.g=d,Sg(g.h).then(g.rb.bind(g)));b.set(e,f);this.a.remove(e)}}.bind(this));this.a.A().forEach(function(d){var e=this.a.get(d);e instanceof kk&&(b.set(d,e),this.a.remove(d))}.bind(this));0<this.a.a&&(c=!0);this.a.forEach(function(d){d.stop()}.bind(this));this.a=
b;c&&this.O()};k.O=function(a){var b=[];this.a.forEach(function(d){if(d=d.T()){for(var e,f=rk||Ra,g=0,h=b.length;g<h;){var m=g+h>>1;var q=f(d,b[m]);0<q?g=m+1:(h=m,e=!q)}e=e?g:~g;0>e&&Qa(b,-(e+1),0,d)}});var c=this.b.b.a.a;c.sendMessage(new fd(b,a));0===b.length?null===this.c&&(this.c=U(this.f,V(3E4)).then(function(){this.c=null;var d=0;this.a.forEach(function(e){d+=e.T()?1:0});0===d&&c.sendMessage(new G("DeviceDiscovery.NotFound"))}.bind(this))):null!==this.c&&(a=this.c,this.c=null,a.cancel())};
k.Pa=function(a){var b=this.a.get(a.device.id);if(b)switch(a.action){case 1:a=new af(ub());a.states=new gf(0,[new N(1)]);a.commonState=new bf;a.commonState.device=b.va();a.commonState.pinned=!0;lf(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:qk(b,a.device,a.action)}else F(a.device.id)};k.kb=function(){this.O();var a=this.b.a;Jh(a.h);a.N()};var sk=function(a,b){this.c=a;this.i=b;this.b=null;this.j=rj(b);this.g=this.a=null;this.f=new T(this.Ta.bind(this),this.Sa.bind(this));this.h=new M("DeviceSettings.Apply",this.Ka.bind(this),"DeviceSettings.Reboot",this.o.bind(this),"DeviceSettings.FactoryReset",this.m.bind(this),"DeviceSettings.ForgetWiFi",this.s.bind(this),"DeviceSettings.Exit",this.l.bind(this))};k=sk.prototype;k.start=function(){return this.f.start()};k.stop=function(){return this.f.stop()};
k.Ta=function(){return U(this.f,tj(this.c.g,this.j)).then(function(a){this.b=a;return z([U(this.f,hj(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(" ")})),U(this.f,pj(a)),U(this.f,qj(a))])}.bind(this)).then(function(a){this.ob.apply(this,a);var b=this.c.b.a.a;this.h.forEach(function(c,d){b.addListener(d,c)});tk(this,1)}.bind(this))};
k.Sa=function(){var a=this.c.b.a.a;this.h.forEach(function(b,c){a.removeListener(c,b)});this.b=null;this.j=rj(this.i);this.a=null;return y()};
k.ob=function(a,b,c){var d=ej(this.b),e=d.setupApiVersion,f=yg(d.deviceType);c=c.map(function(C){return new jd(C.timezone,C.display_string,C.offset)});b=b.map(function(C){return new id(C.locale,C.display_string)});var g=this.a={};if(7<=e){e=a.wifi;var h=a.settings,m=a.opt_in,q=a.build_info,I=a.device_info;a=a.net;g.deviceType=f;g.name=d.name;g.ssid=!d.ethernetConnected&&e.ssid||null;g.timeZoneId=h.timezone||null;g.supportedTimeZones=c;g.timeFormat=1===h.time_format?1:2;g.localeId=h.locale||"";g.supportedLocales=
b;g.statsOptIn=!!m.stats;g.firmwareVersion=q.cast_build_revision||"";g.countryCode=h.country_code||null;g.macAddress=I.mac_address||"";g.ipAddress=a.ip_address;this.g=void 0!==e.wpa_id?e.wpa_id:null}else h=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=h,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};
k.Ka=function(a){var b=this,c=ej(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)tk(b,1);else{var d=cb(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;tk(b,2);D(U(b.f,oj(b.b,uk(b,a))).then(function(){b.a.localeId!==d.localeId?b.c.reload():tk(b,1)}),function(){b.a=d;tk(b,3)})}};
var uk=function(a,b){var c=a.b.a;a=1===b.timeFormat?1:2;if(7<=c)return c=new $e,c.name=b.name,c.settings=new Pe,b.timeZoneId&&(c.settings.timezone=b.timeZoneId),c.settings.time_format=a,c.settings.locale=b.localeId,c.opt_in=new Qe,c.opt_in.stats=b.statsOptIn,c;if(4<=c&&6>=c)return c=new Ze,c.name=b.name,b.timeZoneId&&(c.timezone=b.timeZoneId),c.time_format=a,c.locale=b.localeId,c.opt_in=new Ie,c.opt_in.stats=b.statsOptIn,c;a=new Ye;a.name=b.name;b.timeZoneId&&(a.timezone=b.timeZoneId);a.locale=b.localeId;
return a},tk=function(a,b){a.c.b.a.a.sendMessage(new kd(b,ej(a.b).features,a.a))};sk.prototype.o=function(){if(ej(this.b).features.deviceSettings.supportsReboot){kj(this.b,"now");var a=this.b.c.read().deviceIpAddress;Ij(this.c.f,new hf(1,Ca(),a));this.c.c()}};sk.prototype.m=function(){if(ej(this.b).features.deviceSettings.supportsFdr){kj(this.b,"fdr");var a=this.b.c.read().deviceIpAddress;Ij(this.c.f,new hf(3,Ca(),a));this.c.c()}};
sk.prototype.s=function(){if(ej(this.b).features.deviceSettings.supportsForgetWiFi){var a=this.b,b=this.g;a.b.request({url:fj(a,"/setup/forget_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new Re(b)),timeout:1E4,D:2});this.c.c()}};sk.prototype.l=function(){this.c.c()};var vk=chrome.i18n.getMessage("3254351313955764967"),wk=chrome.i18n.getMessage("3485206350043289145");var xk=function(a){this.c=window;this.a=a;this.b=new Q;this.f=new T(this.h.bind(this),this.g.bind(this))};xk.prototype.start=function(){return this.f.start()};
xk.prototype.h=function(){var a=A();yk(this.c,"start");zk(this);var b=U(this.f,V(18E4)).then(function(){yk(this.c,"load-failed");R(this.b,"loadTimedOut");a.c(new bg)}.bind(this));U(this.f,this.a.start()).then(function(){var c=this.a.a;U(this.f,nh(c,"OfflineUiReady")).then(function(){R(this.b,"offlineUiReady")}.bind(this));R(this.b,"waitingForHandshake");return U(this.f,c.sendRequest(new wc))}.bind(this)).then(function(c){switch(c.type){case "Handshake.Response":yk(this.c,"hosting-embedded-ui");R(this.b,
"embeddedUiReady");b.cancel();a.b();break;case "Handshake.UiVersionNotSupported":yk(this.c,"update-required");R(this.b,"updateRequired");a.c(c);break;default:yk(this.c,"load-failed"),R(this.b,"loadFailed")}}.bind(this));return a.a};var zk=function(a){var b=a.c.document;[["#load-failed-message",vk],["#update-required-message",wk]].forEach(function(c){var d=b.querySelector(c[0]);d&&(d.textContent=c[1])})};xk.prototype.g=function(){return this.a.stop()};
var yk=function(a,b){(a=a.document&&a.document.body||null)&&a.setAttribute("class",b)};var Ak=function(a,b,c,d,e){this.b=b;this.a=c;this.f=d;this.g=a.localStorage;this.c=e},Bk=function(a,b){this.b=a;this.l=b;this.m=pa(void 0)?void 0:3E4;this.c=new M;this.h=!0;this.g=!1;this.a=new S;this.j=new Fj(a.g);this.f=new T(this.bb.bind(this),this.ab.bind(this));this.i=this.$a.bind(this)};k=Bk.prototype;k.start=function(){return this.f.start()};k.stop=function(){if(!this.g){var a=new sd(this.l,this.c.u(),!0);this.b.b.a.a.sendMessage(a);this.g=!0}return this.f.stop()};
k.bb=function(){this.b.a.listen("devices",this.i);Jh(this.b.a);U(this.f,V(this.m)).then(function(){this.h=!1;this.Ca()}.bind(this));return y()};k.ab=function(){P(this.b.a,"devices",this.i);this.c=new M;this.h=!0;this.g=!1;this.a=new S;return y()};
k.$a=function(a){var b=this;Lj(this.j);(a.msg.devices||[]).forEach(function(c){var d=c.ipAddress;de(b.c,d)||b.a.contains(d)||Mj(b.j,d)||(b.a.add(d),B(D(tj(b.b.f,rj(d)).then(function(e){if(7>e.a)throw new E;return U(b.f,jj(e)).then(function(f){var g=ej(e);f=new rd(f.token,g.name,yg(g.deviceType),g.ssdpUdn);b.c.set(d,f);b.a.remove(d);b.g||(f=new sd(b.l,b.c.u(),!b.h&&0===b.a.a.a),b.g=f.scanComplete,b.b.b.a.a.sendMessage(f))})}),function(){b.a.remove(d)}),b.Ca.bind(b)))})};
k.Ca=function(){this.h||0!==this.a.a.a||this.stop()};var W=function(a,b,c){this.b=new T(b||function(){return y()},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 Ek=function(a,b,c,d){var e=Ck,f=Dk,g=window.location.reload.bind(window.location),h=chrome.i18n.getUILanguage,m=new Gh;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=h;this.i=m};var Fk=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(Fk,W);Fk.prototype.l=function(){return U(this.b,Gk(this.a)).then(function(a){this.f=a;X(this).addListener("AudioConfirmation.UserAction",this.g);X(this).sendMessage(new Qc(1));this.c=3;this.h()}.bind(this))};Fk.prototype.j=function(){this.c=this.f=null;X(this).removeListener("AudioConfirmation.UserAction",this.g);return y()};
Fk.prototype.h=function(){if(null!==this.c){var a=this.b;var b=this.f;var c=this.c;b=b.b.request({url:fj(b,"/setup/play_sound"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new Se(c)),timeout:1E4,D:2});U(a,b);this.c=3;U(this.b,V(1===this.c?3E3:1900)).then(this.m)}};Fk.prototype.i=function(a){var b=null;switch(a.action){case 1:this.c=1;b=2;break;case 2:Y(this.a,12);Hk(this.a,new N(5));break;case 3:b=3;break;case 4:Y(this.a,13),a=this.a,mf(a.a.a,a.b),a.a.f()}b&&X(this).sendMessage(new Qc(b))};var Ik=function(a){W.call(this,a,this.c.bind(this),null)};t(Ik,W);Ik.prototype.c=function(){var a=this;U(this.b,X(this).sendRequest(new Nc((this.a.b.setupApiClientState||null).verificationState.pin))).then(function(b){b.confirmed?(Y(a.a,10),Hk(a.a,new N(5))):(Y(a.a,11),U(a.b,X(a).sendRequest(new Bc(1))).then(function(){var c=a.a;mf(c.a.a,c.b);c.a.f()}))});return y()};var Jk=function(a,b){this.i=a;this.a=new wj(a,new Ej(b));this.b="connected";this.c=null;this.f=new T(this.Va.bind(this),this.Ua.bind(this));this.g=new Q},Kk=["added","removed","connected","disconnected"];k=Jk.prototype;k.start=function(){return this.f.start()};k.stop=function(){return this.f.stop()};k.getState=function(){return this.b};k.Va=function(){var a=this;return a.a.start().then(function(){a.h();Kk.forEach(function(b){a.a.a.listen(b,a.h,!0,a)})})};
k.Ua=function(){this.b="connected";this.c=null;if(!this.a)return y();var a=this.a;this.a=null;Kk.forEach(function(b){P(a.a,b,this.h,!0,this)}.bind(this));return a.stop()};var Lk=function(a,b){a.b!==b&&(a.b=b,R(a.g,new O(b)))};
Jk.prototype.h=function(){if("failed"!==this.b){var a=null;1===this.a.networks.a&&(a=this.a.networks.u()[0]);if(!a)"connected"===this.b&&(Mk(this),Lk(this,"disconnected"));else if("Connected"===a.ConnectionState)this.c&&(a=this.c,this.c=null,a.cancel()),Lk(this,"connected");else if("connected"===this.b||"disconnected"===this.b)Mk(this),Lk(this,"reconnecting"),Nk(this,a.GUID)}};
var Nk=function(a,b){D(U(a.f,a.i.startConnect(b)),function(){Lk(this,"failed");this.a.stop()}.bind(a))},Mk=function(a){a.c||(a.c=U(a.f,V(9E4)).then(function(){Lk(this,"failed");this.a.stop()}.bind(a)))};var Ok=function(a){W.call(this,a,this.s.bind(this),this.m.bind(this));this.f=null;this.o=0;this.h=this.g=this.j=this.c=null};t(Ok,W);var Pk=["connected","disconnected","reconnecting","failed"];Ok.prototype.s=function(){var a=this,b=Z(a.a);X(a).sendMessage(Dg(b.connectWiFi,Qk(a.a)));a.g=new Jk(a.a.a.b,b.connectedHotSpotBssid);Pk.forEach(function(c){a.g.g.listen(c,a.i,!0,a)});return z([U(a.b,a.g.start()),U(a.b,Gk(a.a)).then(function(c){a.f=c;Rk(a)})]).then(a.v.bind(a))};
Ok.prototype.m=function(){var a=this;Sk(a);Tk(a);if(!a.g)return y();var b=a.g;a.g=null;Pk.forEach(function(c){P(b.g,c,a.i,!0,a)});return b.stop()};var Rk=function(a,b){a.c||(a.c=D(V(b||0).then(function(){++a.o;a.c=hj(a.f,{options:["version","setup.setup_state","net.ip_address"]});return a.c}).then(a.l.bind(a)),function(c){dg(c)}).then(function(){a.c=null;Rk(a,3E3)}))},Tk=function(a){if(a.c){var b=a.c;a.c=null;b.cancel()}};
Ok.prototype.l=function(){var a=ej(this.f).setupState;if(a!==this.j)switch(this.j=a,a){case 31:return Uk(this,2),fc(new E);case 21:case 41:case 10:case 11:return Uk(this,1),fc(new E);case 60:case 61:case 51:return Vk(this),fc(new E)}};
var Vk=function(a){Sk(a);Y(a.a,19);var b=ej(a.f);B(D(U(a.b,a.a.a.c.a()).then(function(c){c=Eg(b.setupApiVersion,Z(a.a).deviceName,3!==c);return U(a.b,oj(a.f,c))}),function(c){dg(c)}).then(function(){var c=Z(a.a),d=c.connectedHotSpotBssid;Ij(a.a.a.a,new hf(2,Ca(),d));delete c.connectedHotSpotBssid;Wk(a.a,c);if(60!==b.setupState&&4<=b.setupApiVersion)return D(U(a.b,lj(a.f)),p)}),function(){Hk(a.a,new N(8))})},Uk=function(a,b){Sk(a);Y(a.a,2===b?17:18);var c=Z(a.a);c.connectWiFi.a=b;Wk(a.a,c);Hk(a.a,
new N(6))};Ok.prototype.i=function(a){switch(a.type){case "connected":Rk(this);break;case "disconnected":case "reconnecting":Tk(this);break;case "failed":Uk(this,1)}};Ok.prototype.v=function(){clearTimeout(this.h);this.h=setTimeout(function(){Uk(this,1)}.bind(this),9E4)};var Sk=function(a){clearTimeout(a.h);a.h=null};var Xk="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 Yk=function(a){W.call(this,a,this.g.bind(this),null);this.f=!1;this.c=null};t(Yk,W);
Yk.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=Lh(a))&&-1!==Xk.indexOf(b)?b:(a=Kh(a).toUpperCase())&&-1!==Xk.indexOf(a)?a:"US");this.c=a;D(U(this.b,X(this).sendRequest(new Tc(Qk(this.a),c,this.c))).then(this.h.bind(this)),this.a.g.bind(this.a));return y()};
Yk.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);Wk(b.a,c);if(b.f){var d=null;return z([U(b.b,Gk(b.a)),b.a.a.c.a()]).then(function(e){d=e[0];e=e[1];var f=[];7<=d.a&&f.push(U(b.b,d.b.request({url:fj(d,"/setup/accept_tos"),method:"POST",timeout:1E4,D:2})));f.push(U(b.b,oj(d,Eg(d.a,c.deviceName,3!==e))));return z(f)}).then(function(){return U(b.b,hj(d,{options:["setup.setup_state"]}))}).then(function(){switch(ej(d).setupState){case 60:Zk(b.a);
break;case 62:Hk(b.a,new N(10));break;default:return fc()}})}Hk(b.a,new N(6))};var $k=function(a){W.call(this,a,this.c.bind(this),null)};t($k,W);$k.prototype.c=function(){var a=this,b=null;return z([U(this.b,Gk(this.a)),this.a.a.c.a()]).then(function(c){b=c[0];c=Eg(b.a,Z(a.a).deviceName,3!==c[1]);c=[U(a.b,oj(b,c))];4<=b.a&&c.push(U(a.b,lj(b)));return z(c)}).then(function(){return U(a.b,hj(b,{options:["setup.setup_state"]}))}).then(function(){switch(ej(b).setupState){case 60:case 52:Zk(a.a);break;case 62:Hk(a.a,new N(10));break;default:return fc()}})};var al=function(a,b,c,d){W.call(this,a,this.X.bind(this),this.m.bind(this));this.g=1;this.c=new Mg;this.w=c;this.B=b;this.i=null;this.G=void 0!==d?d:pf(a.a.a);this.h=null;this.s=this.R.bind(this);this.l=this.j.bind(this);this.H=this.P.bind(this)};t(al,W);
al.prototype.X=function(){var a=this;bl(a,1);a.h=new wj(this.a.a.b);var b=a.h.a;b.listen("connected",a.ea,!0,a);b.listen("added",a.o,!0,a);b=X(a);b.addListener("WiFiSwitching.Proceed",a.s);b.addListener("WiFiSwitching.RetryConnection",a.l);b.addListener("WiFiConfig.Retry",a.l);return U(a.b,a.h.start()).then(function(){var c=a.h.networks;(c=a.i&&c.get(a.i)||null)?"Connected"===c.ConnectionState?a.j():a.G?(a.M(1),bl(a,2),a.V(1),Ng(a.c,V(25E3)).then(a.v.bind(a)),a.a.a.b.startConnect(a.i)):a.v():(bl(a,
11),a.a.g())})};al.prototype.m=function(){this.g=1;this.i=null;var a=this.c;this.c=new Mg;a=[Og(a)];var b=this.h;this.h=null;if(b){var c=b.a;P(c,"connected",this.ea,!0,this);c.listen("added",this.o,!0,this);a.push(b.stop())}b=X(this);b.removeListener("WiFiSwitching.Proceed",this.s);b.removeListener("WiFiSwitching.RetryConnection",this.l);b.removeListener("WiFiConfig.Retry",this.l);return z(a)};
al.prototype.ea=function(a){if(cl(this,a))switch(this.g){case 2:this.M(2);this.j();break;case 6:this.M(4),this.j()}};al.prototype.o=function(a){cl(this,a)&&1===this.g&&(this.i=a.properties.GUID)};var cl=function(a,b){b=b.properties.WiFi;return a.w&&!sg(b.BSSID,a.w)||a.B&&b.SSID!==a.B?!1:!0};al.prototype.v=function(){this.M(3);bl(this,5);this.J(1)};
al.prototype.R=function(){var a=this;bl(a,6);a.J(2);var b=a.h.networks.get(this.i);b&&"Connected"===b.ConnectionState?a.j():Ng(a.c,V(1E4)).then(function(){bl(a,7);a.J(3)})};var dl=function(a){var b=A();Ng(a.c,b.a);var c=null,d=function(e){c=V(e).then(a.qa.bind(a)).then(function(f){a.M(5);b.b(f)},function(f){f instanceof Zi?d(2E3):f instanceof uj&&(Y(a.a,9),b.c(f))})};B(b.a,function(){if(c){var e=c;c=null;e.cancel()}});d(0);return b.a};
al.prototype.j=function(){var a=this;6===a.g||9===a.g?(bl(a,8),this.J(2)):(bl(a,3),this.V(1));var b=dl(a).then(function(c){bl(a,11);a.ra(c)},this.H);Ng(a.c,V(12E4)).then(function(){b.cancel()})};al.prototype.P=function(a){a=a instanceof ij||a instanceof uj;8===this.g?a?(bl(this,10),this.J(5)):(bl(this,9),this.J(4)):a?(bl(this,10),this.V(3)):(bl(this,4),this.V(2))};var bl=function(a,b){b!==a.g&&(a.g=b,b=a.c,a.c=new Mg,Og(b))};var el=function(a){this.f=Z(a).device;al.call(this,a,null,this.f.bssid)};t(el,al);var fl=new M(1,4,2,5,3,6,4,7,5,8);k=el.prototype;k.ea=function(a){var b=a.properties.WiFi,c=null;sg(b.BSSID,this.f.bssid)?(c=Z(this.a),c.connectedHotSpotBssid=b.BSSID):vg(a.properties)||(c=Z(this.a),c.originalWiFiNetwork={ssid:b.SSID,bssid:b.BSSID});c&&Wk(this.a,c);el.F.ea.call(this,a)};k.qa=function(){var a=this.a.a;return U(this.b,vj(a.g,rj("192.168.255.249"),a.b,{ssid:this.f.ssid,bssid:this.f.bssid},a.h()))};
k.V=function(a){var b=this.a.a,c=X(this),d=yg(this.f.type);c.sendMessage(new Hc(1===a&&3||2===a&&4||3===a&&5||null,d,this.f.name));3===a&&Ng(this.c,nh(c,"BadDeviceAck")).then(b.f.bind(b))};k.J=function(a){var b=this.a.a,c=X(this);c.sendMessage(new Kc(a,this.f.name,this.f.ssid));5===a&&Ng(this.c,nh(c,"BadDeviceAck")).then(b.f.bind(b))};k.ra=function(a){a=a.getState();this.a.h(a);a.eurekaInfoState.features.supportsDisplay?Hk(this.a,new N(3)):Hk(this.a,new N(4))};
k.M=function(a){(a=fl.get(a))&&Y(this.a,a)};var gl=function(a,b,c,d,e){var f=A(),g=new Pj(b,c,d,e),h=function(C){return C.U.getState().eurekaInfoState.ssdpUdn===a},m=function(C){(C=Ha(C.devices,h))&&f.b(C.ipAddress)};g.listen("devices",m);var q=null;g.start().then(function(){q=setInterval(function(){Jh(g.h);g.N()},5E3)});var I=setTimeout(f.c.bind(f),18E4);return B(f.a,function(){clearTimeout(I);clearInterval(q);P(g,"devices",m);g.stop()})};var hl=function(a){W.call(this,a,this.i.bind(this),null);this.c=null;this.l=0;this.f=null;this.h=0};t(hl,W);hl.prototype.i=function(){var a=this;Y(a.a,30);return U(this.b,Gk(this.a)).then(function(b){a.c=b;X(a).sendMessage(new Dc("OtaUpdate.Pending",Qk(a.a)));il(a,0)})};
var il=function(a,b){D(U(a.b,V(b)).then(function(){++a.l;return U(a.b,hj(a.c,{options:["ota_status","setup.setup_state"]}))}).then(function(c){var d=ej(a.c),e=0;7<=a.c.a&&(e=c.ota_status.download_progress);if(a.f!==d.setupState||e!==a.h)a.f=d.setupState,a.h=e,60===a.f&&a.g();il(a,3E3)}),function(c){dg(c);c=a.c.getState().eurekaInfoState.ssdpUdn;var d=a.a.a;U(a.b,gl(c,d.b,d.i,d.g,d.window)).then(a.g.bind(a),a.j.bind(a))})};
hl.prototype.g=function(){Y(this.a,31);var a=X(this);U(this.b,nh(a,"OtaUpdate.Proceed")).then(function(){Zk(this.a)}.bind(this));a.sendMessage(new Dc("OtaUpdate.Done",Qk(this.a)))};hl.prototype.j=function(){};var jl=function(a,b,c){this.f=new T(this.m.bind(this),this.l.bind(this));this.a=a;this.j=b;this.b=c;this.c=null;this.i=new Q;b.a.a.addListener("RestartSetup",this.s.bind(this));b.a.a.addListener("GoToDeviceList",this.a.f.bind(this.a))};jl.prototype.start=function(){return this.f.start()};jl.prototype.stop=function(){return this.f.stop()};
var Zk=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 yh("deviceJustSetUp");b.deviceJustSetUp=new zh(d,c.name,c.ssdpUdn,c.modelName);var e=new Ah;e.audioOutSupported=!0;e.videoOutSupported=!!c.features.supportsDisplay;b.deviceJustSetUp.capabilities=e;a.a.l.setItem("showDeviceBanner",d);mf(a.a.a,a.b);B(U(a.f,eg(a.a.i.sendMessage(b),1E4)),function(){B(a.stop(),function(){a.a.f()})})},Qk=function(a){return(a=a.b.commonState&&
a.b.commonState.device&&a.b.commonState.device.type)?yg(a):2},Gk=function(a){var b={read:function(){return a.b.setupApiClientState||null},write:a.h.bind(a)};return tj(a.a.g,b,a.a.h())};jl.prototype.h=function(a){a?this.b.setupApiClientState=a:delete this.b.setupApiClientState;lf(this.a.a,this.b)};
var Z=function(a){return a.b.commonState||new bf},Wk=function(a,b){b?a.b.commonState=b:delete a.b.commonState;lf(a.a.a,a.b)},Hk=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 gf(0,[b]);lf(a.a.a,a.b);a.c=a.a.j(a,b.type);R(a.i,new kl(b.type));D(U(a.f,a.c.start()),function(d){if(d instanceof E)switch(a.f.getState()){case "starting":case "started":a.g()}else a.g()})})};
jl.prototype.g=function(){mf(this.a.a,this.b);this.j.a.a.sendMessage(new Dc("ShowGenericSetupError",Qk(this)));D(this.stop(),p)};var Y=function(a,b){a.a.c.b(b)};
jl.prototype.m=function(){var a=this.b.states.all[this.b.states.current].type;this.c=this.a.j(this,a);R(this.i,new kl(a));null===this.a.a.getItem("setupNoCountryDetection")&&(a=Z(this),a.country||a.connectedHotSpotBssid||U(this.f,this.j.a.a.sendRequest(new nd)).then(function(b){var c=Z(this);c.country||(c.country=b.countryCode,Wk(this,c))}.bind(this)));return this.c.start()};jl.prototype.l=function(){var a=this.c;this.c=null;R(this.i,new kl(null));return a.stop()};
jl.prototype.s=function(){mf(this.a.a,this.b);this.a.m()};var kl=function(a){O.call(this,"newState");this.state=a};t(kl,O);var ll=function(a){W.call(this,a,this.B.bind(this),this.w.bind(this));this.c=1;this.f=this.h=null;this.g=new M;this.i=new M;this.j=null;this.o=this.H.bind(this);this.l=this.v.bind(this)};t(ll,W);
ll.prototype.B=function(){var a=this;ml(a,1);X(a).addListener("SetupStart.Proceed",a.o);var b=[];b.push(U(a.b,this.a.a.c.a()).then(function(e){a.j=e}));var c=Z(a.a);c.device&&!c.pinned&&(c.device=void 0,Wk(a.a,c));var d=a.a.a;a.f=new Pj(d.b,d.i,d.g,d.window);d=a.f.f.a;d.listen("added",a.m,!0,a);d.listen("connected",a.s,!0,a);a.f.listen("devices",this.l);b.push(U(a.b,a.f.start()));Sg(a.b).then(function(){c.pinned&&c.device?(a.h=c.device,ml(a,5),nl(a)):0!=a.i.a?ol(a,a.i.K(!1).next()):ae(a.g,function(e){if("NotConnected"===
e.ConnectionState)return!0;pl(a,e);return!1})&&(ml(a,2),nl(a),U(a.b,V(5E3)).then(a.G.bind(a)))});return z(b)};ll.prototype.w=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 y();var a=this.f;this.f=null;var b=a.f.a;P(b,"added",this.m,!0,this);P(b,"connected",this.s,!0,this);P(a,"devices",this.l);return a.stop()};
var ml=function(a,b){b!==a.c&&(a.c=b)},nl=function(a){var b=X(a);switch(a.c){case 1:case 2:b.sendMessage(new Fc(!1));break;case 3:b.sendMessage(new Fc(!0));break;case 4:b.sendMessage(new G("DeviceDiscovery.NotFound"));break;case 5:ql(a,1);break;case 6:ql(a,2);break;case 7:ql(a,3);break;case 8:ql(a,4)}},ql=function(a,b){var c=yg(a.h.type);b=new Hc(b,c,a.h.name);b.otherDevicesExist=1<a.g.a+a.i.a;b.analyticsOptIn=3!==a.j;X(a).sendMessage(b)};
ll.prototype.G=function(){if(2===this.c)if(0===this.g.a)ml(this,3),nl(this),U(this.b,V(45E3)).then(function(){3===this.c&&(this.f.stop(),ml(this,4),nl(this))}.bind(this));else{var a=$d(this.g,function(b,c){return"NotConnected"!==c.ConnectionState?c:(c.WiFi&&c.WiFi.SignalStrength||-Infinity)<(b&&b.WiFi&&b.WiFi.SignalStrength||-Infinity)?b:c});pl(this,a)}};
var pl=function(a,b){b=b&&b.WiFi;var c=b.SSID,d=ug(c);a.h=new cf({name:d.name,type:d.type,ssid:c,bssid:b.BSSID});ml(a,5);nl(a)},ol=function(a,b){var c=b.U.getState().eurekaInfoState;a.h=new cf({name:c.name,type:c.deviceType,ipAddress:b.ipAddress});ml(a,5);nl(a)};ll.prototype.m=function(a){a=a.properties;var b=!de(this.g,a.GUID);this.g.set(a.GUID,a);5===this.c?b&&nl(this):3===this.c&&pl(this,a)};ll.prototype.s=function(a){2!==this.c&&3!==this.c||pl(this,a.properties)};
ll.prototype.v=function(a){var b=this,c=null;a.devices.filter(function(d){d=d.U.getState().eurekaInfoState;return d.features.supportsSetup&&d.ethernetConnected&&!d.tosAccepted}).forEach(function(d){de(b.i,d.ipAddress)||(b.i.set(d.ipAddress,d),c=c||d)});c&&(2===b.c||3===b.c?ol(b,c):5===b.c&&nl(b))};
ll.prototype.H=function(){var a=this;5!==a.c&&8!==a.c||rl(a).then(function(){var b=Z(a.a);b.device=a.h;Wk(a.a,b);if(b.device.bssid)Y(a.a,3),Hk(a.a,new N(2));else{Y(a.a,27);ml(a,7);nl(a);var c=a.a.a;D(U(a.b,tj(c.g,rj(b.device.ipAddress),c.h())).then(function(d){a.a.h(d.getState());Y(a.a,27);Hk(a.a,new N(5))}),function(){ml(a,8);nl(a)})}})};
var rl=function(a){var b=a.a.a.a;if(null!==b.getItem("setupTosAccepted"))return y();var c=a.a.a.c,d=U(a.b,nh(X(a),"SetupStart.TosAccepted")).then(function(e){c.h(e.analyticsOptIn);b.setItem("setupTosAccepted","")}.bind(a));ml(a,6);nl(a);return d};var tl=function(a){this.f=a;this.b=new Q;this.networks=new M;this.c=!1;this.a=new T(function(){sl(this);return y()}.bind(this),function(){this.networks.clear();this.c=!1;return y()}.bind(this))};tl.prototype.start=function(){return this.a.start()};tl.prototype.stop=function(){return this.a.stop()};
var sl=function(a){D(U(a.a,nj(a.f)).then(function(){U(a.a,V(3E3))}).then(function(){var b=new ul;a.g(b);return b.I.a}).then(a.h.bind(a)).then(function(){return U(a.a,V(1E3))}).then(function(){sl(a)}),function(b){dg(b);R(a.b,new vl(b));a.stop()})};tl.prototype.g=function(a){D(U(this.a,mj(this.f)).then(this.i.bind(this,a)).then(function(){3===a.a?a.I.b(a.networks):U(this.a,V(2E3)).then(this.g.bind(this,a))}.bind(this)),function(b){a.I.c(b)})};
tl.prototype.i=function(a,b){var c=!1,d=!1;b.filter(function(e){return 1!==e.wpa_auth?!0:!tg(e.bssid)}).forEach(function(e){var f=wl(e),g=a.networks.get(f);g?xl(g,e):(g=new yl(e),a.networks.set(f,g),c=!0,de(this.networks,f)||(this.networks.set(f,g),d=!0))}.bind(this));a.a=c?0:a.a+1;if(d||!this.c)R(this.b,new O("networksAdded")),this.c=!0};
tl.prototype.h=function(a){a.forEach(function(b){b.ya=!0});Zd(hg(new S(this.networks.A()),a.A()),function(b){var c=this.networks.get(b);c.W=-Infinity;a.set(b,c)}.bind(this));this.networks=a;R(this.b,new O("scanCompleted"))};
var yl=function(a){this.id=wl(a);this.ssid=a.ssid;this.Ea=a.wpa_auth;this.Fa=a.wpa_cipher;this.Ga=a.wpa_id;this.ia=new S;this.W=a.signal_level;this.ya=this.ga=!1;xl(this,a)},xl=function(a,b){a.ia.add(b.bssid);a.W=Math.max(a.W,b.signal_level);b.ap_list&&b.ap_list.forEach(function(c){this.ia.add(c.bssid);this.W=Math.max(this.W,c.signal_level);this.ga=this.ga||5E3<=c.frequency}.bind(a))},vl=function(){O.call(this,"error")};t(vl,O);
var ul=function(){this.networks=new M;this.a=0;this.I=A()},wl=function(a){return a.wpa_id?a.wpa_id.toString():a.ssid+":"+a.wpa_auth+":"+a.wpa_cipher};var zl=function(a){W.call(this,a,this.v.bind(this),this.o.bind(this));this.h=this.f=this.c=this.g=null;this.s=this.i.bind(this);this.j=this.w.bind(this);this.m=this.B.bind(this)};t(zl,W);
zl.prototype.v=function(){var a=this;return U(a.b,Gk(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=Dg(a.f,Qk(a.a));delete c.connectWiFi;Wk(a.a,c);2===a.f.a?c=a.i():(b.addListener("WiFiConfig.ErrorAck",a.s),c=y());Al(a,d)}else c=a.i(),U(a.b,V(7E3)).then(function(){a.h||Al(a,new Xc(1,Qk(a.a),[],null))});b.addListener("WiFiConfig.Retry",a.m);return c})};
zl.prototype.i=function(){if(this.c)return y();this.c=new tl(this.g);this.c.b.listen("networksAdded",this.l,!0,this);X(this).addListener("WiFiConfig.Connect",this.j);Bl(this);return this.c.start()};zl.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.s);return this.c?(P(this.c.b,"networksAdded",this.l,!0,this),a=this.c,this.c=null,a.stop()):y()};
var Al=function(a,b){a.h=b;X(a).sendMessage(b)};zl.prototype.l=function(){if(this.h)X(this).sendMessage(new Yc(this.c.networks.u().map(function(e){return new Wc(e.id,e.ssid,zg(e.Ea))})));else{var a=Z(this.a),b=a.originalWiFiNetwork&&a.originalWiFiNetwork.bssid,c=[],d=null;Zd(this.c.networks,function(e){var f=new Wc(e.id,e.ssid,zg(e.Ea));c.push(f);b&&e.ia.contains(b)&&(d=f)});Al(this,new Xc(1,Qk(this.a),c,d))}};
zl.prototype.w=function(a){var b=this,c=Cl(b,a);U(b.b,new x(function(d){a.password?d(Dl(b,a.password).then(function(e){c.msg.enc_passwd=e})):d()})).then(function(){return U(b.b,El(b,c))}).then(function(d){d?(b.f=c,Al(b,new Xc(5,Qk(b.a),b.h.networks,a.network))):(d=Z(b.a),d.connectWiFi=c,Wk(b.a,d),D(gj(b.g,c.msg),p),Y(b.a,15),Hk(b.a,new N(7)))})};
var Cl=function(a,b){var c=new ef(new Ae(b.network.ssid,Ag(b.network.security)));b.network.id&&(c.b=b.network.id,a.c&&de(a.c.networks,b.network.id)?(a=a.c.networks.get(b.network.id),a.Fa&&(c.msg.wpa_cipher=a.Fa),a.Ga&&(c.msg.wpa_id=a.Ga)):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},El=function(a,b){var c=Z(a.a);if("m"!==(c.device&&c.device.type))return y(!1);var d=b.b;if(!d)return y(!1);if(b=a.c.networks.get(d)){if(b.ga)return y(!1);
if(b.ya)return y(!0)}return cg(a.c.b,"scanCompleted").then(function(){var e=a.c.networks.get(d);return e&&!e.ga})};zl.prototype.B=function(){var a=Z(this.a);a.connectWiFi=this.f;Wk(this.a,a);D(gj(this.g,a.connectWiFi.msg),p);Y(this.a,15);Hk(this.a,new N(7))};
var Dl=function(a,b){var c=a.g.getState().verificationState.verificationProperties;return a.a.a.b.verifyAndEncryptData(c,b)},Bl=function(a){var b=a.g.a;if(!(4>b)){var c=Z(a.a).country,d=null;7>b?(b=new Ze,b.location=new He,b.location.country_code=c,d=b):(b=new $e,b.settings=new Pe,b.settings.country_code=c,d=b);D(U(a.b,oj(a.g,d)),function(){})}};var Fl=function(a){var b=Z(a).connectWiFi,c=pf(a.a.a);v("Macintosh")&&1!==b.msg.wpa_auth&&(c=!1);al.call(this,a,b.msg.ssid,null,c);this.f=null};t(Fl,al);var Gl=new M(1,20,2,21,3,22,4,23,5,24);Fl.prototype.m=function(){this.f=null;return Fl.F.m.call(this)};var Hl=function(a){return a.f?y(a.f):U(a.b,Gk(a.a)).then(function(b){a.f=ej(b).connectedIpAddress;return a.f})};k=Fl.prototype;k.qa=function(){var a=this;return Hl(a).then(function(b){return U(a.b,tj(a.a.a.g,rj(b)))})};
k.V=function(a){var b=Z(this.a),c=b.connectWiFi;a=2===a||3===a?1:void 0;c.a!==a&&(c.a=a,Wk(this.a,b));X(this).sendMessage(Dg(c,Qk(this.a)))};k.J=function(a){X(this).sendMessage(new Lc(a,Z(this.a).connectWiFi.msg.ssid))};k.ra=function(a){this.a.h(a.getState());Hk(this.a,new N(9))};k.M=function(a){(a=Gl.get(a))&&Y(this.a,a)};var Ck=function(a,b){switch(b){case 1:return new ll(a);case 2:return new el(a);case 3:return new Ik(a);case 4:return new Fk(a);case 5:return new Yk(a);case 6:return new zl(a);case 7:return new Ok(a);case 8:return new Fl(a);case 9:return new $k(a);case 10:return new hl(a);default:return new W(a,null,null)}};var Il=null;r("castApp.app.setupManager",Il);var Jl={sb:"devices",tb:"offers",ub:"setup",ERROR:"error"},Kl=/^https?:/i,Ll=function(a){if(!a||"#"==a)return{};a.startsWith("#")&&(a=a.slice(1));var b=a.split("/");if(!(0<=Da(ab(Jl),b[0])))return{};a={L:b[0]};if(b[1])switch(a.L){case "devices":b=decodeURIComponent(b[1]);Qd(b)&&(a.ipAddress=b);break;case "setup":a.la=b[1];break;case "offers":b=decodeURIComponent(b[1]),Kl.test(b)&&(a.za=b)}return a};
window.addEventListener("hashchange",function(a){var b=ve(a.oldURL).g;a=ve(a.newURL).g;Ll(b).L!==Ll(a).L&&location.reload()});
var Dk=function(){window.location.hash="devices"},Ml=function(a){window.location.hash="setup/"+a},Nl=function(a){window.location.hash="devices/"+encodeURIComponent(a)},Ol=function(){window.location.hash="error"},Pl=function(a){if(v("Linux"))Ol();else{var b=chrome.metricsPrivate?new tf(window.localStorage):new sf,c=chrome.networkingPrivate?Kg.b():null,d=new Ek(window,c,new bj,b),e=new xk(a),f=function(){var g=Ll(window.location.hash);if("setup"===g.L){var h=null;if(g.la){if(Il&&Il.b.id===g.la)return;
h=Ha(jf(d.a),function(m){return m.id===g.la})}h||(h=new af(ub()),h.states=new gf(0,[new N(1)]),lf(d.a,h),window.history.replaceState(null,"","#setup/"+h.id));Il&&Il.stop();Il=new jl(d,e,h);Il.start()}};e.start().then(function(){f();window.addEventListener("hashchange",f)})}},Ql=function(a,b){if(v("Linux"))Ol();else{var c=new xk(a),d=chrome.networkingPrivate?Kg.b():null,e=new bj,f=new vh(window,c,e,Ml,Dk,Nl,window.location.reload.bind(window.location),new Ig,a,chrome.i18n.getUILanguage,new Pj(d,b,
e,window)),g=null,h=null,m=function(C){if(!h||h.i!==C){var Pf=g&&g.stop()||h&&h.stop()||y();g=null;var Rl=h=new sk(f,C);Pf.then(function(){h===Rl&&D(h.start(),Dk)})}},q=function(){if(!g){var C=h&&h.stop()||y(),Pf=g=new jk(f);h=null;C.then(function(){Pf===g&&g.start()})}},I=function(){var C=Ll(location.hash);"devices"===C.L&&(C.ipAddress?m(C.ipAddress):q())};c.start().then(function(){I();window.addEventListener("hashchange",I)})}},Tl=function(a,b){var c=new xk(a);a=chrome.metricsPrivate?new tf(window.localStorage):
new sf;var d=new Ak(window,c,b,new bj,a);c.start().then(function(){var e=c.a.a,f=new M;e.addListener("Offers.Scan",function(g){var h=g.scanId;de(f,h)||(g=new Bk(d,h),f.set(h,g),cg(g.f.c,"stopped").then(function(){f.remove(h)}),g.start())});e.addListener("Offers.Redeem",function(g){var h=encodeURIComponent(g.url);Sl(h).then(function(m){0===m.length?chrome.tabs.create({url:"chrome://cast/#offers/"+h,active:!0}):(chrome.tabs.update(m[0].tabId,{active:!0}),chrome.windows.update(m[0].windowId,{active:!0}))})});
e.addListener("Offers.AnalyticsEvent",function(g){d.c.f(g)});e.sendMessage(new G("Offers.Show"))})},Ul=function(a){yk(window,"start");D(aj(new bj,{url:a}).then(function(b){var c=b.url;return c&&Kl.test(c)?Sl(encodeURIComponent(a)).then(function(d){d.forEach(function(e){chrome.tabs.update(e.id,{url:c})})}):fc()}),function(){yk(window,"unknown-error")})},Sl=function(a){return new x(function(b){chrome.tabs.query({url:["chrome://cast/*","chrome-extension://"+chrome.runtime.id+"/cast_setup*"]},function(c){var d=
[];c.forEach(function(e){-1!==e.url.indexOf(a)&&d.push(e)});b(d)})})};window.addEventListener("load",function(){var a=new Gh,b=new sh(window);b.f.listen("originViolation",Ol);kf();var c=Ll(location.hash);switch(c.L){case "devices":Ql(b,a);break;case "offers":c.za?Ul(c.za):Tl(b,a);break;case "setup":Pl(b);break;case "error":yk(window,"unknown-error");break;default:JSON.stringify(c),Dk()}});
