;/*FB_PKG_DELIM*/ __d("CometFeedUnitLoadingIndicatorMask.react",["CometProgressIndicator.react","react"],(function(a,b,c,d,e,f,g){"use strict";var h,i=h||d("react");function a(){return i.jsx("div",{className:"x6s0dn4 x1h0vfkc x1ey2m1c x78zum5 xds687c xdt5ytf xl56j7k x10l6tqk x17qophe x13vifvy x1vjfegm",children:i.jsx(c("CometProgressIndicator.react"),{})})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),98); __d("EventListenerImplForCacheStorage",["CometEventListener"],(function(a,b,c,d,e,f){"use strict";f["default"]=b("CometEventListener")}),66); __d("ThriftTypes",[],(function(a,b,c,d,e,f){a=Object.freeze({STOP:0,VOID:1,BOOL:2,BYTE:3,I08:3,DOUBLE:4,I16:6,I32:8,I64:10,STRING:11,STRUCT:12,MAP:13,SET:14,LIST:15,FLOAT:19});b=a;f["default"]=b}),66); __d("TWriteBuffer",[],(function(a,b,c,d,e,f){a=function(){function a(b){b===void 0&&(b=a.DEFAULT_BYTE_BUFFER_SIZE),this.$1=new DataView(new ArrayBuffer(b)),this.$2=0}var b=a.prototype;b.write=function(a){this.$2+a.length>this.$1.byteLength&&this.$3(this.$2+a.length);for(var b=0;bthis.$1.byteLength&&this.$3(this.$2+1);this.$1.setUint8(this.$2,a);this.$2++;return 1};b.writeFloatBE=function(a){this.$2+Float32Array.BYTES_PER_ELEMENT>this.$1.byteLength&&this.$3(this.$2+Float32Array.BYTES_PER_ELEMENT);this.$1.setFloat32(this.$2,a);this.$2+=Float32Array.BYTES_PER_ELEMENT;return Float32Array.BYTES_PER_ELEMENT};b.writeDoubleBE=function(a){this.$2+Float64Array.BYTES_PER_ELEMENT>this.$1.byteLength&&this.$3(this.$2+Float64Array.BYTES_PER_ELEMENT);this.$1.setFloat64(this.$2,a);this.$2+=Float64Array.BYTES_PER_ELEMENT;return Float64Array.BYTES_PER_ELEMENT};b.toByteArray=function(){var a=new Uint8Array(this.$1.buffer,0,this.$2);return a};b.currentSize=function(){return this.$2};b.getUnderlyingDataView=function(){return this.$1};b.$3=function(a){a=a*2;if(!Number.isSafeInteger(a))throw new Error("unable to resize");a=new DataView(new ArrayBuffer(a));for(var b=0;b>6|192),b.writeByte(d&63|128);else if((d&64512)==55296){if(e+1>=a.length)throw new Error("UTF-16 string is truncated: ["+d.toString(16)+"]");if((a.charCodeAt(e+1)&64512)!==56320)throw new Error("Invalid UTF-16 string: ["+d.toString(16)+", "+a.charCodeAt(e+1).toString(16)+"]");d=65536+((d&1023)<<10)+(a.charCodeAt(++e)&1023);b.writeByte(d>>18|240);b.writeByte(d>>12&63|128);b.writeByte(d>>6&63|128);b.writeByte(d&63|128)}else b.writeByte(d>>12|224),b.writeByte(d>>6&63|128),b.writeByte(d&63|128)}return b.toByteArray()};g.StringToUtf8=a}),98); __d("Utf8ToString",[],(function(a,b,c,d,e,f){var g=function(a,b){throw new Error(a+": ["+b.map(function(a){return a.toString(16)}).toString()+"]")},h=function(a){g("Invalid UTF-8 sequence",a)},i=function(a,b){g("Not enough bytes for "+a+"-byte sequence",b)};a=function(a){var b=0,c=[];while(b=128&&d<194)h([d]);else if(d>=194&&d<224){b>=a.length&&i(2,[d]);var e=a[b++];(e&192)!==128&&h([d,e]);c.push(String.fromCharCode((d&31)<<6|e&63))}else if(d>=240&&d<245){b+2>=a.length&&i(4,[d]);e=a[b++];var f=a[b++],g=a[b++];(d==240&&(!(e>=144&&e<192)||(f&192)!==128||(g&192)!==128)||d>=241&&d<244&&((e&192)!==128||(f&192)!==128||(g&192)!==128)||d==244&&(!(e>=128&&e<144)||(f&192)!==128||(g&192)!==128))&&h([d,e,f,g]);e=((d&7)<<18|(e&63)<<12|(f&63)<<6|g&63)-65536;c.push(String.fromCharCode(55296+(e>>10)));c.push(String.fromCharCode(56320+(e&1023)))}else if(d>=245)h([d]);else{b+1>=a.length&&i(3,[d]);f=a[b++];g=a[b++];d==224?f>=160&&f<192||h([d,f,g]):d>=225&&d<237?f>=128&&f<192||h([d,f,g]):d==237?f>=128&&f<160||h([d,f,g]):d>=238&&d<240&&(f>=128&&f<192||h([d,f,g]));g>=128&&g<192||h([d,f,g]);c.push(String.fromCharCode((d&15)<<12|(f&63)<<6|g&63))}}return c.join("")};f.Utf8ToString=a}),66); __d("TNoOpWriteBuffer",[],(function(a,b,c,d,e,f){a=function(){function a(){this.$1=0}var b=a.prototype;b.write=function(a){this.$1+=a.length;return a.length};b.writeByte=function(a){this.$1++;return 1};b.writeFloatBE=function(a){this.$1+=Float32Array.BYTES_PER_ELEMENT;return Float32Array.BYTES_PER_ELEMENT};b.writeDoubleBE=function(a){this.$1+=Float64Array.BYTES_PER_ELEMENT;return Float64Array.BYTES_PER_ELEMENT};b.toByteArray=function(){throw new Error("operation not supported")};b.currentSize=function(){return this.$1};b.readByte=function(){throw new Error("operation not supported")};b.readBytes=function(a){throw new Error("operation not supported")};b.readFloatBE=function(){throw new Error("operation not supported")};b.readDoubleBE=function(){throw new Error("operation not supported")};return a}();f["default"]=a}),66); __d("TReadBuffer",[],(function(a,b,c,d,e,f){a=function(){function a(a){this.$1=a,this.$2=0}var b=a.prototype;b.readByte=function(){if(this.$2this.$1.length)throw new Error("not enough bytes to read");var b=new Uint8Array(this.$1.buffer,this.$3(),a);this.$2+=a;return b};b.readFloatBE=function(){if(Float32Array.BYTES_PER_ELEMENT+this.$2>this.$1.length)throw new Error("not enough bytes to read");var a=new DataView(this.$1.buffer).getFloat32(this.$3());this.$2+=Float32Array.BYTES_PER_ELEMENT;return a};b.readDoubleBE=function(){if(Float64Array.BYTES_PER_ELEMENT+this.$2>this.$1.length)throw new Error("not enough bytes to read");var a=new DataView(this.$1.buffer).getFloat64(this.$3());this.$2+=Float64Array.BYTES_PER_ELEMENT;return a};b.$3=function(){return this.$2+this.$1.byteOffset};b.getCurrentCursor=function(){return this.$2};b.writeByte=function(a){throw new Error("operation not supported")};b.write=function(a){throw new Error("operation not supported")};b.toByteArray=function(){throw new Error("operation not supported")};b.writeFloatBE=function(a){throw new Error("operation not supported")};b.writeDoubleBE=function(a){throw new Error("operation not supported")};return a}();f["default"]=a}),66); __d("CacheStorage",["ErrorGuard","ExecutionEnvironment","WebStorage","cr:6943","cr:8958","emptyFunction","err","killswitch"],(function(a,b,c,d,e,f,g){var h,i,j,k="_@_",l="3b",m="CacheStorageVersion",n={length:0,getItem:a=c("emptyFunction"),setItem:a,clear:a,removeItem:a,key:a};d=function(){function a(a){this._store=a}var b=a.prototype;b.getStore=function(){return this._store};b.keys=function(){var a=[];for(var b=0;b1?d-1:0),f=1;f1?b-1:0),d=1;d2?d-2:0),f=2;f>=7;if(a>0)b[c]=d|128;else{b[c]=d;break}}return b}function h(a,b,c){c=c;b[c++]=a>>8;b[c++]=a%256;return c}function e(a,b){return 256*a[b]+a[b+1]}function f(a){var b=0;for(var c=0,d=a.length;c=55296&&e<=56319?(b+=4,c++):b+=3}return b}function i(a,b,c,d){d=h(b,c,d);j(a,c,d);return d+b}function j(a,b,c){c=c;for(var d=0,e=a.length;d>6,b[c++]=128|f&63):f<55296||f>=57344?(b[c++]=224|f>>12,b[c++]=128|f>>6&63,b[c++]=128|f&63):(f=65536+((f&1023)<<10|a.charCodeAt(++d)&1023),b[c++]=240|f>>18,b[c++]=128|f>>12&63,b[c++]=128|f>>6&63,b[c++]=128|f&63)}}function k(a,b,c){var d=[],e=b,f=0;while(e191&&g<224){var h=a[e++];d[f++]=String.fromCharCode((g&31)<<6|h&63)}else if(g>239&&g<365){h=a[e++];var i=a[e++],j=a[e++];h=((g&7)<<18|(h&63)<<12|(i&63)<<6|j&63)-65536;d[f++]=String.fromCharCode(55296+(h>>10));d[f++]=String.fromCharCode(56320+(h&1023))}else{i=a[e++];j=a[e++];d[f++]=String.fromCharCode((g&15)<<12|(i&63)<<6|j&63)}}return d.join("")}var l=function(){function a(a,b,c,d){this.$1=a,this.$2=b,this.$5=c,this.$6=d,this.$4=!1}var b=a.prototype;b.$7=function(){var a=this;this.$4?(this.$4=!1,this.$5(),this.$3=d("MqttEnv").Env.setTimeout(function(){a.$7()},this.$2()*1e3)):this.$6()};b.reset=function(){var a=this;this.$4=!0;this.$3&&(d("MqttEnv").Env.clearTimeout(this.$3),this.$3=null);var b=this.$1()*1e3;b>0&&(this.$3=d("MqttEnv").Env.setTimeout(function(){a.$7()},b))};b.cancel=function(){this.$3&&(d("MqttEnv").Env.clearTimeout(this.$3),this.$3=null)};return a}();g.UTF8Length=f;g.convertStringToUTF8=j;g.concatBuffers=a;g.decodeMultiByteInt=b;g.convertUTF8ToString=k;g.encodeMultiByteInt=c;g.writeUInt16BE=h;g.readUInt16BE=e;g.writeString=i;g.Pinger=l}),98); __d("MqttUtils",["MqttEnv"],(function(a,b,c,d,e,f,g){"use strict";function a(a,b){return h(a,"sid",b.toString())}function b(a,b){var c=a;b.forEach(function(a,b){c=h(c,b,a)});return c}function h(a,b,c){if(a.indexOf("?")>0)return a+"&"+b+"="+c;else return a+"?"+b+"="+c}function c(){return Math.floor(d("MqttEnv").Env.random()*Number.MAX_SAFE_INTEGER)}function i(a,b,c){var e=arguments.length>1?a.then(b,c):a;e.then(null,function(a){d("MqttEnv").Env.setTimeout(function(){if(a instanceof Error)throw a;else throw new Error("promiseDone")},0)})}function e(a,b,c,e){var f=!1;d("MqttEnv").Env.setTimeout(function(){f||(f=!0,c(new Error("promise timeout")))},e);i(a,function(a){f||(f=!0,b(a))},function(a){f||(f=!0,c(a))})}function f(a){for(var b=arguments.length,c=new Array(b>1?b-1:0),d=1;d>4;b+=1;var i=d("MqttProtocolUtils").decodeMultiByteInt(a,b);if(i==null)return{position:e,wireMessage:null};b=i.offset;i=b+i.value;if(i>a.length)return{position:e,wireMessage:null};var j;switch(g){case h.CONNACK:e=a[b++];e=!!(e&1);var o=a[b++];j=new m(e,o);break;case h.PUBLISH:e=f&15;o=e>>1&3;f=d("MqttProtocolUtils").readUInt16BE(a,b);b+=2;var r=d("MqttProtocolUtils").convertUTF8ToString(a,b,f);b+=f;f=null;o===1&&(f=d("MqttProtocolUtils").readUInt16BE(a,b),b+=2);var s=p.createWithBytes(a.subarray(b,i)),t=(e&1)===1;e=(e&8)===8;j=new q(r,s,o,f,t,e);break;case h.PINGREQ:j=new k("PINGREQ");break;case h.PINGRESP:j=new k("PINGRESP");break;case h.PUBACK:case h.UNSUBACK:r=d("MqttProtocolUtils").readUInt16BE(a,b);j=new n(g===h.PUBACK?"PUBACK":"UNSUBACK",r);break;case h.SUBACK:s=d("MqttProtocolUtils").readUInt16BE(a,b);b+=2;o=a.subarray(b,i);j=new l(s,o);break;default:throw c("err")(d("MqttUtils").sprintf("Invalid MQTT message type %s.",g))}return{position:i,wireMessage:j}}function a(a){var b=[],c=0;while(c1||e===1&&f==null)throw new TypeError(d("MqttUtils").sprintf("Argument Invalid. qos: %s messageType: %s.",e,a));g.qos=e;g.messageIdentifier=f;return g}var c=a.prototype;c.encode=function(){var a=(this.messageType&15)<<4;a|=2;var b=d("MqttProtocolUtils").UTF8Length(this.topic),c=2+b+2;this.messageType===h.SUBSCRIBE&&(c+=1);var e=d("MqttProtocolUtils").encodeMultiByteInt(c);c=new ArrayBuffer(1+e.length+c);var f=new Uint8Array(c);f[0]=a;a=1;f.set(e,1);a+=e.length;this.messageIdentifier!=null&&(a=d("MqttProtocolUtils").writeUInt16BE(this.messageIdentifier,f,a));a=d("MqttProtocolUtils").writeString(this.topic,b,f,a);this.messageType===h.SUBSCRIBE&&this.qos!=null&&(f[a++]=this.qos);return c};return a}(b),p=function(){function a(a,b){this.payloadString=a,this.payloadBytes=b}a.createWithString=function(b){var c=new Uint8Array(new ArrayBuffer(d("MqttProtocolUtils").UTF8Length(b)));d("MqttProtocolUtils").convertStringToUTF8(b,c,0);return new a(b,c)};a.createWithBytes=function(b){var c=d("MqttProtocolUtils").convertUTF8ToString(b,0,b.length);return new a(c,b)};var b=a.prototype;b.string=function(){return this.payloadString};b.bytes=function(){return this.payloadBytes};return a}(),q=function(b){babelHelpers.inheritsLoose(a,b);function a(a,c,d,e,f,g){var h;h=b.call(this,"PUBLISH")||this;h.topic=a;h.payloadMessage=c;h.qos=d;h.messageIdentifier=e;h.retained=f!=null?f:!1;h.duplicate=g!=null?g:!1;if(h.qos===1&&h.messageIdentifier==null)throw new TypeError("Argument Invalid. messageIdentifier: null and qos: 1");return h}var c=a.prototype;c.encode=function(){var a=(this.messageType&15)<<4;this.duplicate&&(a|=8);a=a|=this.qos<<1;this.retained&&a!=1;var b=d("MqttProtocolUtils").UTF8Length(this.topic),c=b+2,e=this.qos===0?0:2;c+=e;e=this.payloadMessage.bytes();c+=e.byteLength;var f=d("MqttProtocolUtils").encodeMultiByteInt(c);c=new ArrayBuffer(1+f.length+c);var g=new Uint8Array(c);g[0]=a;g.set(f,1);a=1+f.length;a=d("MqttProtocolUtils").writeString(this.topic,b,g,a);this.qos!==0&&this.messageIdentifier!=null&&(a=d("MqttProtocolUtils").writeUInt16BE(this.messageIdentifier,g,a));g.set(e,a);return c};return a}(b),r=p.createWithString,s=p.createWithBytes;b={Base:b,ConnAck:m,Connect:f,Disconnect:e,Ping:k,PubAckUnsubAck:n,Publish:q,Subscription:o};g.MESSAGE_TYPE=h;g.decodeMessage=j;g.decodeByteMessages=a;g.Message=p;g.createMessageWithString=r;g.createMessageWithBytes=s;g.WireMessage=b}),98); __d("MqttUserNameUtils",["gkx"],(function(a,b,c,d,e,f,g){"use strict";function a(a){if(c("gkx")("1166607"))return!1;return a!=null?a:typeof document==="object"&&document&&document.hasFocus&&document.hasFocus()}function b(){return navigator.userAgent}g.getMqttForegroundStatus=a;g.getUserAgent=b}),98); __d("MqttUserName",["MqttUserNameUtils"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(a,b,c,e,f,g,h,i,j,k,l){h===void 0&&(h=null),i===void 0&&(i=""),j===void 0&&(j="websocket"),k===void 0&&(k=null),l===void 0&&(l=null),this.$1=a,this.$2=b,this.$3=c,this.$4=e,this.$5=f,this.$6=g,this.$7=d("MqttUserNameUtils").getMqttForegroundStatus(),this.$8=h,this.$9=i,this.$10=j,this.$11=k,this.$12=l}var b=a.prototype;b.gen=function(a,b,c,e){e===void 0&&(e=[]);var f=d("MqttUserNameUtils").getMqttForegroundStatus(this.$7);c=c.map(function(a){a={isBase64Publish:!1,messageId:a.messageId,payload:a.payload,qos:a.qos,topic:a.topic};typeof a.payload!=="string"&&(a.payload=btoa(String.fromCharCode.apply(null,a.payload)),a.isBase64Publish=!0);return a});f={a:d("MqttUserNameUtils").getUserAgent(),aid:this.$5,aids:this.$12!=null?Object.fromEntries(this.$12):null,chat_on:this.$6,cp:this.$3,ct:this.$10,d:this.$4,dc:"",ecp:this.$2,fg:f,gas:this.$8,mqtt_sid:"",no_auto_fg:!0,p:this.$11,pack:e,php_override:this.$9,pm:c,s:a,st:b,u:this.$1};return JSON.stringify(f)};b.setForegroundState=function(a){this.$7=a};b.setChatVisibility=function(a){this.$6=a};b.getEndpointCapabilities=function(){return this.$2};b.getDeviceId=function(){return this.$4};b.setEndpointCapabilities=function(a){this.$2=a};b.getIsGuestAuthStringPresent=function(){return this.$8!==null};return a}();g["default"]=a}),98); __d("PromiseResult",["Promise"],(function(a,b,c,d,e,f){"use strict";var g;a=function(){function a(){var a=this;this.promise=new(g||(g=b("Promise")))(function(b,c){a.$1=b,a.$2=c})}var c=a.prototype;c.resolve=function(a){this.$1(a)};c.reject=function(a){this.$2(a)};return a}();f["default"]=a}),66); __d("MqttFetchClient",["MqttEnv","MqttProtocolCodec","MqttUserName","MqttUtils","Promise","PromiseResult"],(function(a,b,c,d,e,f,g){"use strict";var h,i="fetch_pull",j="fetch_pull_finish",k="fetch_",l=6e4,m="action",n="chunked",o="send",p="true",q=5,r=20,s=10,t=5e3,u=typeof window!=="undefined"?window:self;a=function(){function a(){this.$1="",this.$2=d("MqttEnv").Env.getLoggerInstance(),this.$3=0,this.$4="",this.$5=new(c("MqttUserName"))("",0,1,"",0,!0),this.$6=function(){},this.$7=function(a){},this.$8=function(){},this.$9=function(a){},this.$10=0,this.$11=0,this.$12=0,this.$13=0,this.$14="Ready",this.$15=[],this.$16=[],this.$17=null,this.$18=!1,this.$19=0}a.isSupported=function(){return typeof u.fetch==="function"};var e=a.prototype;e.run=function(a,b,c,e,f,g,h,i){this.$1=d("MqttUtils").endpointWithSessionId(a,b),this.$3=b,this.$4=c,this.$5=e,this.$6=f,this.$7=g,this.$8=h,this.$9=i,this.$20()};e.isTopicSupported=function(a){return!0};e.publish=function(a,b){return this.$21(a,b)};e.publishBinary=function(a,b){return this.$21(a,b)};e.$21=function(a,d){if(this.$14!=="ReceivingData"){this.$2.bumpCounter(k+"publish."+a+".invalidstate");return(h||(h=b("Promise"))).reject("not connected")}else{this.$2.bumpCounter(k+"publish."+a+".publish");var e=new(c("PromiseResult"))();a={topic:a,payload:d,promiseResult:e};this.$15.push(a);this.$22();return e.promise}};e.abort=function(){this.$6=function(){},this.$7=function(a){},this.$8=function(){},this.$9=function(a){}};e.$23=function(a){var b=this;a.forEach(function(a){b.$2.bumpCounter(k+"publish."+a.topic+".resolved"),a.promiseResult.resolve()});this.$12+=a.length};e.$24=function(a,b){var c=this;a.forEach(function(a){c.$2.bumpCounter(k+"publish."+a.topic+".rejected"),a.promiseResult.reject(b)})};e.$25=function(a,b,c,d){var e=a.map(function(a){return a.topic}).join(",");this.$2.debugTrace("FetchClient","Fetch publish request failed. Publishes:"+e+", retry:"+c);this.$2.bumpCounter(k+"publish_request_failed");this.$14!=="ReceivingData"||c===q?(this.$24(a,d),this.$18=!1,this.$2.bumpCounter(k+"publish_request_failed_final"),this.$22()):this.$26(a,b,c+1)};e.$27=function(a,b,c,d){if(!d.ok){this.$2.bumpCounter(k+"publish_request_failed.http."+d.status);if(d.status===409){this.$19++;if(this.$19>=s){this.$2.bumpCounter(k+"409_reset");this.$28(new Error("Too many 409 errors"));return}}this.$25(a,b,c,this.$29(d));return}this.$2.bumpCounter(k+"publish_request_success");b=a.map(function(a){return a.topic}).join(",");this.$2.debugTrace("FetchClient","Fetch publish request success. Publishes:"+b+", retry:"+c);this.$23(a);this.$18=!1;this.$22()};e.$22=function(){if(this.$14!=="ReceivingData")return;if(this.$18)return;if(this.$15.length===0&&this.$16.length===0)return;this.$18=!0;var a=this.$15.slice(0,r);this.$15=this.$15.slice(r,this.$15.length);this.$17!=null&&d("MqttEnv").Env.clearTimeout(this.$17);this.$17=null;var b=this.$16.slice(0,r);this.$16=this.$16.slice(r,this.$16.length);this.$26(a,b,0)};e.$26=function(a,b,c){var e=this,f=a.map(function(a){return a.topic}).join(",");this.$2.debugTrace("FetchClient","Fetch publish request sent. Publishes:"+f+", retry:"+c);f=d("MqttUtils").endpointWithExtraParameter(this.$1,m,o);var g=a.map(function(a){return{topic:a.topic,payload:a.payload,qos:0,messageId:d("MqttEnv").Env.random()}});g=this.$5.gen(this.$3,[],g,b);this.$2.bumpCounter(k+"publish_request");d("MqttUtils").promiseDoneWithTimeout(u.fetch(f,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",referrer:"no-referrer",body:g,keepalive:!1}),function(d){return e.$27(a,b,c,d)},function(d){return e.$25(a,b,c,d)},l)};e.$30=function(a){a=a.message;this.$2.debugTrace("FetchClient","Fetch request failed with error:"+a);this.$9(a);this.$31(!1,a);this.$2.bumpCounter(k+"error");this.$14="Error"};e.$32=function(a){var b=this;this.$2.debugTrace("FetchClient","Fetch response data received");a=d("MqttProtocolCodec").decodeByteMessages(new Uint8Array(a));a=a.messages;var c=a.filter(function(a){return a.messageType===d("MqttProtocolCodec").MESSAGE_TYPE.PINGREQ});a=a.filter(function(a){return a.messageType===d("MqttProtocolCodec").MESSAGE_TYPE.PUBLISH}).map(function(a){if(!(a instanceof d("MqttProtocolCodec").WireMessage.Publish))return{};a=a;a.qos===1&&a.messageIdentifier!=null&&(b.$16.push(a.messageIdentifier),b.$17==null&&(b.$17=d("MqttEnv").Env.setTimeout(function(){b.$22()},t)));return{topic:a.topic,payload:a.payloadMessage,qos:a.qos}});for(var e=a,f=Array.isArray(e),g=0,e=f?e:e[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var h;if(f){if(g>=e.length)break;h=e[g++]}else{g=e.next();if(g.done)break;h=g.value}h=h;this.$2.bumpCounter(k+"response_"+((h=h.topic)!=null?h:"void"))}a&&a.length>0&&(this.$13+=a.length,this.$7(a));c&&c.length>0&&this.$33()};e.$33=function(){this.$2.debugTrace("FetchClient","Got server ping request"),this.$2.bumpCounter(k+"ping")};e.$28=function(a){this.$2.debugTrace("FetchClient","Fetch request ended: "+a.toString()),this.$2.bumpCounter(k+"done"),this.$34(a.message),this.$8(),this.$14="Done"};e.$35=function(a,b,c){var e=this;if(c!=null)try{this.$32(c)}catch(a){this.$28(a);this.$2.bumpCounter(k+"dataDecodeException");return}if(b){this.$28(new Error("EOF"));return}d("MqttUtils").promiseDone(a.read(),function(c){var b=c.done;c=c.value;return e.$35(a,b,c)},function(a){return e.$28(a)})};e.$36=function(a){if(!a.ok){this.$2.bumpCounter(k+"error.http."+a.status);this.$30(this.$29(a));return}a=a.body;if(!a){this.$30(new Error("Empty body"));return}a=a.getReader();this.$6();this.$2.bumpCounter(k+"success");this.$31(!0,null);this.$11=Date.now();this.$14="ReceivingData";this.$2.debugTrace("FetchClient","Fetch request success");this.$35(a,!1,null)};e.$34=function(a){this.$2.eventLogPullFinish({pullEventName:j,sessionID:this.$3,duration:Date.now()-this.$11,errorMessage:a,publishReceived:this.$13,publishSent:this.$12})};e.$31=function(a,b){this.$2.eventLogPull({pullEventName:i,sessionID:this.$3,status:a,duration:Date.now()-this.$10,hostname:this.$1,errorMessage:b})};e.$20=function(){var a=this;if(this.$14!=="Ready")return;this.$2.debugTrace("FetchClient","Sending fetch request");this.$2.bumpCounter(k+"request");this.$10=Date.now();var b=d("MqttUtils").endpointWithExtraParameter(this.$1,n,p);d("MqttUtils").promiseDoneWithTimeout(u.fetch(b,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",referrer:"no-referrer",body:this.$4,keepalive:!1}),function(b){return a.$36(b)},function(b){return a.$30(b)},l)};e.$29=function(a){return new Error("Http error, status="+a.status)};return a}();g["default"]=a}),98); __d("MqttGlobalStreamCounter",["CrossWindowEventEmitter","MqttEnv","uuidv4"],(function(a,b,c,d,e,f,g){"use strict";a=function(){function a(){var a=this;this.isTabClosed=!1;this.otherTabs=new Map();this.thisTab={totalConnectionStreams:0};this.broadcastChannel=new(c("CrossWindowEventEmitter"))("MqttGlobalStreamCounter");this.broadcastChannel.addListener("count-updated",function(b){b=JSON.parse(String(b));var c=!1;a.otherTabs.has(b.key)||(c=!0);b.event==="DELETE"?a.otherTabs["delete"](b.key):b.event==="UPDATE"&&b.value!=null&&(a.otherTabs.set(b.key,b.value),c&&a.$1())});this.tabID=c("uuidv4")()}var b=a.prototype;b.streamRequested=function(){this.thisTab.totalConnectionStreams++,this.$1()};b.streamClosed=function(){this.thisTab.totalConnectionStreams>0&&(this.thisTab.totalConnectionStreams--,this.$1())};b.tabClosed=function(){if(this.isTabClosed)return;this.isTabClosed=!0;var a={key:this.tabID,event:"DELETE"};this.broadcastChannel.emitRemote("count-updated",JSON.stringify(a))};b.getGlobalState=function(){var a={totalConnectionStreams:this.thisTab.totalConnectionStreams};this.otherTabs.forEach(function(b){a.totalConnectionStreams+=b.totalConnectionStreams});return a};b.$1=function(){var a={key:this.tabID,event:"UPDATE",value:this.thisTab};this.broadcastChannel.emitRemote("count-updated",JSON.stringify(a))};b.isEnabled=function(){return!0};return a}();var h=d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqttweb_global_connection_counter)?new a():{streamRequested:function(){},streamClosed:function(){},tabClosed:function(){},getGlobalState:function(){return{totalConnectionStreams:-1}},isEnabled:function(){return!1}};b=function(){return h};g.getInstance=b}),98); __d("MqttLongPollingClient",["MqttEnv","MqttProtocolCodec","MqttUserName","Promise","XHRRequest","getCrossOriginTransport"],(function(a,b,c,d,e,f,g){"use strict";var h,i=120*1e3,j="simple_pull",k="longpolling_";a=function(){function a(){this.$3="",this.$4=0,this.$2=d("MqttEnv").Env.getLoggerInstance(),this.$1="Ready",this.$5="",this.$6=new(c("MqttUserName"))("",0,1,"",0,!0),this.$7=function(){},this.$8=function(a){},this.$9=function(){},this.$10=function(a){},this.$11=0,this.$12=null,this.$13=new Set(["/t_ms","/messenger_sync_get_diffs","/messenger_sync_create_queue","/webrtc","/rtc_multi"])}var e=a.prototype;e.run=function(a,b,c,d,e,f,g,h){this.$3=a,this.$4=b,this.$5=c,this.$6=d,this.$7=e,this.$8=f,this.$9=g,this.$10=h,this.$14(this.$5)};e.isTopicSupported=function(a){return this.$13.has(a)};e.publish=function(a,c){return(h||(h=b("Promise"))).reject("not supported")};e.publishBinary=function(a,c){return(h||(h=b("Promise"))).reject("not supported")};e.abort=function(){this.$12!=null&&this.$12.abort("Disconnected")};e.$15=function(a,b){if(this.$1===a)return;this.$1=a;a==="Error"&&b!=null&&this.$10(b);this.$2.debugTrace("LongPollingClient","_changeStatus : "+a)};e.$16=function(a){if(this.$1!=="RequestSend")return;if(!a){this.$17("EmptyResponse",null);return}this.$7();this.$2.bumpCounter(k+"success");this.$18(!0,null);this.$15("ResponseReceived");a=d("MqttProtocolCodec").decodeByteMessages(new Uint8Array(a));a=a.messages.filter(function(a){return a instanceof d("MqttProtocolCodec").WireMessage.Publish}).map(function(a){if(a instanceof d("MqttProtocolCodec").WireMessage.Publish){a=a;return{topic:a.topic,payload:a.payloadMessage,qos:a.qos}}else return{}});this.$8(a);this.$9()};e.$17=function(a,b){b=b!=null?b.message:"null";this.$2.debugTrace("LongPollingClient Error","Poll failed with error:"+a+", errorMsg:"+b);this.$18(!1,a+":"+b);this.$2.bumpCounter(k+"error."+a);this.$15("Error",a)};e.$18=function(a,b){this.$2.eventLogPull({pullEventName:j,sessionID:this.$4,status:a,duration:Date.now()-this.$11,hostname:this.$3,errorMessage:b})};e.$14=function(a){var b=this;if(this.$1!=="Ready"||this.$12)return;this.$2.bumpCounter(k+"request");try{this.$11=Date.now(),this.$12=new(c("XHRRequest"))(this.$3).setResponseType("arraybuffer").setRawData(a).setTransportBuilder(c("getCrossOriginTransport").withCredentials).setResponseHandler(function(a){return b.$16(a)}).setNetworkFailureHandler(function(a){b.$17("Network",a)}).setErrorHandler(function(a){b.$17("Error",a)}).setAbortHandler(function(a){b.$17("Abort",null)}).setTimeoutHandler(function(){b.$17("Timeout",null)}).setTimeout(i).send(),this.$15("RequestSend")}catch(a){this.$17("Error",a)}};return a}();g["default"]=a}),98); __d("exponentialBackoff",["MqttEnv"],(function(a,b,c,d,e,f,g){function a(a,b){b===void 0&&(b=null);var c=null,e=0;function f(){for(var f=arguments.length,g=new Array(f),h=0;h");return 0}if(c.readyState!==c.OPEN){b.$9.bumpCounter("protocol.socket_send.failed.socket_not_open.");return 0}a=a.encode();var d=a.byteLength;c.send(a);return d};this.$3=a;this.$2={getKeepAliveIntervalSeconds:function(){return 10},getKeepAliveTimeoutSeconds:function(){return 10},ignoreSubProtocol:!1,mqttVersion:3,onConnectFailure:function(a,b,c){},onConnection:function(){},onConnectionLost:function(a,b){},onConnectSuccess:function(a){},onMessageArrived:function(a,b,c){},onMessageDelivered:function(a){},userName:""};this.$1="mqttwsclient";this.$4=0;this.$5=!1;this.$9=d("MqttEnv").Env.getLoggerInstance();this.$11=0}var b=a.prototype;b.connect=function(a){var b=this;if(this.$5)throw c("err")("Invalid state: connect - already connected");this.$2=a;this.setConnected(!1);this.$7!=null&&(d("MqttEnv").Env.clearTimeout(this.$7),this.$7=null);this.$7=d("MqttEnv").Env.setTimeout(function(){b.$9.bumpCounter("protocol.error.connect.timeout"),b.$12(d("MqttTypes").MqttErrors.CONNECT_TIMEOUT)},h*1e3);this.$6=d("MqttEnv").Env.createSocket(this.$3);this.$6.binaryType="arraybuffer";this.$6.onopen=function(){b.setConnected(!0),b.$9.debugTrace("Socket-Open","MQTTProtocolClient Socket Open"),b.$11=b.$13(new(d("MqttProtocolCodec").WireMessage.Connect)(b.$1,a)),a.onConnection()};this.$6.onmessage=function(a){a=a.data;if(!(a instanceof ArrayBuffer)){b.$9.bumpCounter("protocol.error.onmessage.type");b.$12(d("MqttTypes").MqttErrors.INVALID_DATA_TYPE);return}try{a=new Uint8Array(a);b.$10!=null&&(a=d("MqttProtocolUtils").concatBuffers(b.$10,a),b.$9.bumpCounter("protocol.debug.usingMessagesBuffer"),delete b.$10,b.$10=null);a=d("MqttProtocolCodec").decodeByteMessages(a);var c=a.messages;b.$10=a.remaining;for(a=0;as,c=this.$12>t;(b||c)&&(this.$12=0);this.$16!==0&&a<=s&&this.$10.bumpCounter("short_lived_session");c&&this.$10.bumpCounter("connection_attempt_limit")};e.$46=function(a,b,c,d,e,f,g,h,i,j){a?this.$14++:this.$15++;var k=Date.now();this.$10.eventLogConnect({sessionID:this.$9,connectionStatus:a,connectionState:this.mqttStateFromConnectionState(this.$11),ackReceived:b,duration:k-c,total_duration:k-d,hostname:this.$5,attemptNumber:this.$13,successTotal:this.$14,failTotal:this.$15,subscribedTopics:e,publishes:f,errorCode:i,errorMessage:j,osConnectivity:g,messageSizeBytes:h,disconnectCount:this.$23});a&&(this.$13=0)};e.$40=function(a,b,c,d,e,f,g,h){var i=a.mqttError;h=h!=null?i.errorMessage+" - "+h:i.errorMessage;this.$10.debugTrace("connect","Connect failed "+h);this.$10.bumpCounter("protocol.onconnectfailure");this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectfailure");this.$27.onConnectFailure();this.$46(!1,a.connAck!==-1,b,c,d,e,f,g,i.errorCode,h);if(a.connAck!=null){this.$10.bumpCounter("protocol.connect_failure."+a.connAck);if(a.connAck===u){this.$48(r);return}}this.$48()};e.$42=function(a,b){var c=this;this.$10.bumpCounter("protocol.onconnection");this.$10.debugTrace("Connect","Socket established");this.$27.onConnected();this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnection");b.forEach(function(a){c.$27.onSubscribe(a)});a.forEach(function(a){c.$27.onPublish(a.topic)});this.$35("TransportConnected")};e.$41=function(a,b,c,d,e,f){this.$10.bumpCounter("protocol.onconnectsuccess"),this.$10.debugTrace("connect","Connect success"),this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectsucess"),this.$27.onConnectSuccess(),this.$26=!0,this.$35("Connected"),this.$46(!0,!0,a,b,c,d,e,f),this.$50(c),this.$16=Date.now()};e.$43=function(a,b){this.$10.bumpCounter("protocol.onconnectionlost");this.$23++;if(a.errorCode){b=b!=null?a.errorMessage+" - "+b:a.errorMessage;this.$10.eventLogDisconnect({sessionID:this.$9,errorCode:a.errorCode,errorMessage:b,duration:Date.now()-this.$16,disconnectCount:this.$23})}this.$10.debugTrace("connect","connection lost");this.$27.onConnectionLost();this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onconnectionlost");this.$48()};e.$44=function(a,b,c){this.$10.bumpCounter("protocol.onmessagearrived");this.$6.getIsGuestAuthStringPresent()&&this.$10.bumpCounter("guestAuthentication.onmessagearrived");this.$10.debugTrace("onMessageArrived","Message received on "+a);this.$27.onMessage(a);try{this.$3(a,b,c)}catch(b){this.$10.logError(b,"Listener threw error"),this.$10.bumpCounter("listener_error."+a)}};e.$45=function(a){this.$10.bumpCounter("protocol.onmessagedelivered");var b=a!=null?a:"null";this.$10.debugTrace("onMessageDelivered","Delivered Message {ID: "+b+"}");if(a==null)return;b=this.$24.get(a);if(b==null){this.$10.bumpCounter("protocol.message_with_unknown_id");return}this.$24["delete"](a);(a=b.listener)==null?void 0:a.onEvent(d("MqttPublishListener").MqttPublishEvent.ACKED);b.resolve();this.$10.bumpCounter("publish.ack_received")};e.$30=function(a){this.$10.bumpCounter("protocol.fail_all_unacked_publishes."+a),this.$24.forEach(function(b,e,f){(e=b.listener)==null?void 0:e.onEvent(d("MqttPublishListener").MqttPublishEvent.NOT_ACKED);b.reject(c("err")(a))}),this.$24.clear()};e.$50=function(a){var b=this,c=new Set(a);c.forEach(function(a){b.$17.has(a)||b.unsubscribe(a)});a=new Set(this.$17);a.forEach(function(a){c.has(a)||b.subscribe(a)})};e.$47=function(a,b){try{this.$10.bumpCounter("js_error_in_init");this.$10.bumpCounter(b+".error");this.$25=!0;var c=a?a.message:"error";this.$10.debugTrace("onError",b+": "+c);this.$2(a)}catch(a){this.$10.bumpCounter("js_error_in_error_logging"),this.$10.logError(a,"JS error while trying to log previous error")}};return a}();g["default"]=a}),98); __d("MqttWebSocketUtils",[],(function(a,b,c,d,e,f){"use strict";function b(){return"WebSocket"in a&&a.WebSocket!=null&&"CLOSING"in a.WebSocket.prototype}f.hasWSSupport=b}),66); __d("MqttChannel",["ChannelClientID","IrisSubscribeChecker","MetaConfig","MqttAnalyticsHook","MqttConnection","MqttEnv","MqttPublishListener","MqttTypes","MqttUserName","MqttUtils","MqttWebSocketUtils","Promise","Run","err","isFastRefreshEnabledForCurrentDomain","promiseDone","requireDeferred"],(function(a,b,c,d,e,f,g){"use strict";var h,i=29125;a=function(){function a(a){var b=this,e=a.endpoint,f=a.pollingEndpoint,g=a.userFbid,h=a.appId,i=a.initialSubscribedTopics,j=a.capabilities,k=a.clientCapabilities,l=a.chatVisibility;l=l===void 0?!0:l;var m=a.guestAuthString;m=m===void 0?null:m;var n=a.phpOverride;n=n===void 0?"":n;var o=a.clientType;o=o===void 0?"websocket":o;var p=a.deviceId;p=p===void 0?c("ChannelClientID").getID():p;var q=a.pageId;q=q===void 0?null:q;a=a.assetIds;a=a===void 0?null:a;this.$11=d("MqttEnv").Env.getLoggerInstance();this.$11.setAppId(h);this.$12=new(c("MqttUserName"))(g,j,k,p,h,l,m,n,o,q,a);this.$1=e;this.$2=f;this.$5="Disconnected";this.$7="LPInactive";this.$6="Disconnected";this.$3=[];this.$4=new Set();this.$8=new Map();this.$9=new Map();this.$10=new(c("MqttConnection"))();this.$13=null;this.$16=new(c("MqttAnalyticsHook"))();this.$15=new Map();this.$14=[];if(!d("MqttEnv").Env.isUserLoggedInNow()&&!c("isFastRefreshEnabledForCurrentDomain")()&&(m==null||m=="")){this.$11.bumpCounter("logged_out_init");return}this.$10.addHook(this.$16);this.$10.addHook(new(c("IrisSubscribeChecker"))(function(){return b.$4.size>0}));this.$17(i);this.$18()}var e=a.prototype;e.$17=function(a){var b=this;if(this.$10.isRunning()){this.$19("run","Connection started calling run again");return}if(d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled))if(c("MetaConfig")._("15")){this.$19("MqttChannel","Websocket disabled, will do long polling only");return}else if(!d("MqttWebSocketUtils").hasWSSupport()){this.$19("MqttChannel","Websocket Unavailable, will do long polling only");this.$11.bumpCounter("ws_unavailable_polling");return}this.$10.run({endpoint:this.$1,extraConnectMessageProvider:function(){return b.$20()},mqttUserName:this.$12,onJSError:function(a){b.$21(a)},onMessageReceived:function(a,c,d){b.$22(a,c,d)},onStateChange:function(a){b.$23(a)},subscribedTopics:a});this.$24()};e.$24=function(){var a=this;d("Run").onUnload(function(){a.$10.onWindowUnload(),a.$25(d("MqttTypes").MqttErrors.BROWSER_CLOSE)})};e.shutdown=function(){this.$25(d("MqttTypes").MqttErrors.APP_DISCONNECT)};e.$25=function(a){this.$10&&this.$10.shutdown(a),this.$13&&this.$13.shutdown(),this.$16.onTabClose()};e.publish=function(a,b,c){c===void 0&&(c={qos:1,skipBuffer:!1});return this.$26(a,b,c)};e.publishBinary=function(a,b,c){c===void 0&&(c={qos:1,skipBuffer:!1});return this.$26(a,b,c)};e.$26=function(a,b,c){c===void 0&&(c={qos:1,skipBuffer:!1});var e;c.qos===0?e=this.$27(a,b,c.listener):e=this.$28(a,b,c);d("MqttUtils").promiseDone(e,function(){},function(a){(a=c.listener)==null?void 0:a.onEvent(d("MqttPublishListener").MqttPublishEvent.PUBLISH_ERROR)});return e};e.$27=function(a,b,c){return this.$29(a,b,0,c,1,null)};e.$28=function(a,c,e){var f={reject:function(a){},resolve:function(){}},g=new(h||(h=b("Promise")))(function(a,b){f.resolve=a,f.reject=b}),i=d("MqttEnv").Env.random();c={ack:f,attempt:0,options:e,payload:c,publishToken:i,startTime:Date.now(),timeoutId:null,topic:a};if(e.skipBuffer)if(this.$10.connectionState()==="Connecting"){this.$14.push(c);(a=e.listener)==null?void 0:a.onEvent(d("MqttPublishListener").MqttPublishEvent.QUEUED)}else this.$30(c);else{c.timeoutId=this.$31(i);this.$15.set(i,c);(a=e.listener)==null?void 0:a.onEvent(d("MqttPublishListener").MqttPublishEvent.QUEUED);this.$32(c)}return g};e.$30=function(a){a.attempt+=1,d("MqttUtils").promiseDone(this.$29(a.topic,a.payload,a.options.qos,a.options.listener,a.attempt,a.startTime),function(){a.ack.resolve()},function(b){a.ack.reject(b)})};e.$32=function(a){var b=this;a.attempt+=1;d("MqttUtils").promiseDone(this.$29(a.topic,a.payload,a.options.qos,a.options.listener,a.attempt,a.startTime),function(){return b.$33(a)},function(a){})};e.$29=function(a,b,e,f,g,h){var i=this,j,k,l=this.getConnectionState(),m=Date.now();!this.$10.canPublish()&&this.$13&&this.$13.canPublish()?(typeof b==="string"?j=this.$13.publish(a,b,e):j=this.$13.publishBinary(a,b,e),k="lp",f!=null&&(j=j.then(function(){return f.onEvent(d("MqttPublishListener").MqttPublishEvent.SENT)})),this.$11.bumpCounter("try_publish_lp")):(typeof b==="string"?j=this.$10.publish(a,b,e,f):j=this.$10.publishBinary(a,b,e,f),k="ws",this.$11.bumpCounter("try_publish_ws"));c("promiseDone")(j,function(){i.$11.eventLogOutgoingPublish({attempt:g,connectionState:l,disconnectCount:i.$10.getDisconnectCount(),errorMessage:null,firstAttemptStartTime:h,payloadSizeBytes:b.length*2,protocol:k,qos:e,sessionID:i.$10.getSessionId(),success:!0,thisAttemptStartTime:m,topic:a})},function(c){i.$11.eventLogOutgoingPublish({attempt:g,connectionState:l,disconnectCount:i.$10.getDisconnectCount(),errorMessage:c!=null?c.toString():null,firstAttemptStartTime:h,payloadSizeBytes:b.length*2,protocol:k,qos:e,sessionID:i.$10.getSessionId(),success:!1,thisAttemptStartTime:m,topic:a})});return j};e.subscribe=function(a,b){var c=this;this.$10.subscribe(a);var d=this.$8.get(a);!d?(d=[b],this.$8.set(a,d)):d.push(b);return function(){var d=c.$8.get(a)||[];d=d.filter(function(a){return a!==b});c.$8.set(a,d);d.length===0&&c.unsubscribeAll(a)}};e.subscribeBinary=function(a,b){var c=this;this.$10.subscribe(a);var d=this.$9.get(a);!d?(d=[b],this.$9.set(a,d)):d.push(b);return function(){var d=c.$9.get(a)||[];d=d.filter(function(a){return a!==b});c.$9.set(a,d);d.length===0&&c.unsubscribeAll(a)}};e.subscribeChannelEvents=function(a){this.$3.push(a)};e.unsubscribeChannelEvents=function(a){a=this.$3.indexOf(a);a>-1&&this.$3.splice(a,1)};e.registerExtraConnectPayloadProvider=function(a){var b=this;this.$19("MqttChannel","registerExtraConnectPayloadProvider called");this.$4.add(a);if(this.$10.isRunning()){a=a.getPublishMessages();a.forEach(function(a){typeof a.payload==="string"?b.publish(a.topic,a.payload,{qos:a.qos,skipBuffer:!0}):b.publishBinary(a.topic,a.payload,{qos:a.qos,skipBuffer:!0})})}};e.unregisterExtraConnectPayloadProvider=function(a){this.$4["delete"](a)};e.unsubscribeAll=function(a){this.$10.unsubscribe(a),this.$8["delete"](a),this.$9["delete"](a)};e.getConnectionState=function(){return this.$5};e.getLongPollingStatus=function(){return this.$7};e.getEndpoint=function(){return this.$1};e.addHook=function(a){this.$10.addHook(a)};e.removeHook=function(a){this.$10.removeHook(a)};e.testOnlyMessageReceived=function(a,b){this.$22(a,b,-1)};e.$34=function(a){var b=this.$15.get(a);b!=null&&b.timeoutId!=null&&d("MqttEnv").Env.clearTimeout(b.timeoutId);this.$15["delete"](a)};e.$31=function(a){var b=this;return d("MqttEnv").Env.setTimeout(function(a){var d=b.$15.get(a);if(!d)return;var e=d.topic;b.$11.bumpCounter("publish_timeout."+e);b.$11.debugTrace("publish_timeout","Timeout publishing topic: "+e+" publishToken: "+a);b.$34(a);d.ack.reject(c("err")("Publish Timed Out"))},i,a)};e.$33=function(a){var b=a.publishToken,c=this.$15.get(b);if(!c)return;this.$34(b);a.ack.resolve();this.$11.debugTrace("publish_success","Topic: "+a.topic+" publishToken: "+a.publishToken);this.$11.bumpCounter("publish_success."+a.topic)};e.$22=function(a,b,c){var d=this.$8.get(a);this.$11.eventLogIncomingPublish({connectionState:this.getConnectionState(),disconnectCount:this.$10.getDisconnectCount(),payloadSizeBytes:b.payloadString.length*2,qos:c,sessionID:this.$10.getSessionId(),topic:a});if(!d)this.$11.debugTrace("_onMessageReceived",a+" being dropped, no listeners");else for(var d=d,e=Array.isArray(d),f=0,d=e?d:d[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var g;if(e){if(f>=d.length)break;g=d[f++]}else{f=d.next();if(f.done)break;g=f.value}g=g;try{g(b.payloadString)}catch(a){this.$11.logError(a,"Listener exception"),this.$11.bumpCounter("listener_error")}}g=this.$9.get(a);this.$11.eventLogIncomingPublish({connectionState:this.getConnectionState(),disconnectCount:this.$10.getDisconnectCount(),payloadSizeBytes:b.payloadBytes.length,qos:c,sessionID:this.$10.getSessionId(),topic:a});if(!g)this.$11.debugTrace("_onMessageReceived",a+" being dropped, no binary listeners");else for(f=g,e=Array.isArray(f),d=0,f=e?f:f[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){if(e){if(d>=f.length)break;c=f[d++]}else{d=f.next();if(d.done)break;c=d.value}a=c;try{a(b.payloadBytes)}catch(a){this.$11.logError(a,"Binary Listener exception"),this.$11.bumpCounter("listener_error")}}};e.$21=function(a){if(d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)){a.isRecoverable?this.$11.bumpCounter("recoverable_error_skipped"):this.$11.bumpCounter("unrecoverable_error_skipped");return}a.isRecoverable?this.$11.bumpCounter("recoverable_error_not_skipped"):this.$11.bumpCounter("unrecoverable_error_not_skipped");this.$35(a)};e.$36=function(a){this.$35(a)};e.$35=function(a){for(var b=this.$3,c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;e.onJSError&&e.onJSError(a)}};e.$37=function(){var a=this;this.$14.forEach(function(b){a.$30(b),a.$11.bumpCounter("publish_from_temp_buffer."+b.topic)});this.$14=[];this.$15.forEach(function(b,c,d){a.$32(b),a.$11.bumpCounter("publish_from_buffer."+b.topic)})};e.$23=function(a){a==="Connecting"?(this.$14.forEach(function(a){a.ack.reject(c("err")("Client Reconnecting - "+a.topic))}),this.$14=[]):a==="TransportConnected"&&this.$37(),this.$19("_changeState","Connection state = "+a),this.$38(a,this.$7)};e.$39=function(a,b){this.$13&&this.$13.canPublish()&&this.$37(),this.$19("_changeLPStatus","LP status = "+a+", LP Request status = "+b),this.$38(this.$6,a)};e.$38=function(a,b){var c=this.$10.mqttStateFromConnectionState(a);this.$13&&this.$13.canPublish()&&(c="Connected");this.$6=a;(c!==this.$5||b!=this.$7)&&(this.$5=c,this.$7=b,this.$40(c))};e.$40=function(a){for(var b=this.$3,c=Array.isArray(b),d=0,b=c?b:b[typeof Symbol==="function"?Symbol.iterator:"@@iterator"]();;){var e;if(c){if(d>=b.length)break;e=b[d++]}else{d=b.next();if(d.done)break;e=d.value}e=e;e.onMQTTStateChanged(a)}};e.$20=function(){var a=this,b=[];this.$4.forEach(function(c){try{c=c.getPublishMessages();Array.prototype.push.apply(b,c)}catch(b){a.$11.logError(b,"ConnectPayload provider exception"),a.$11.bumpCounter("connectPayloadProvider_error")}});return b};e.$18=function(){var a=this;d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled)&&this.$2&&this.$2!=""&&c("requireDeferred")("MqttLongPollingRunner").__setRef("MqttChannel").onReady(function(b){b=new b(a.$2,a.$12,a.$10.hasFatal(),a.$10.hasConnectSuccess(),function(b,c,d){return a.$22(b,c,d)},function(){var b=Array.from(a.$8.keys()),c=Array.from(a.$9.keys());return Array.from(new Set(b.concat(c)))},function(){return a.$20()},function(b){a.$36(b)},function(b,c){a.$39(b,c)});b.start();a.$10.addHook(b);b.addHook(a.$16);a.$13=b;a.$11.debugTrace("MqttChannel","longPollingRunner loaded")})};e.$19=function(a,b){this.$11.debugTrace(a,"Mqtt channel: "+b)};e.setForegroundState=function(a){this.$12&&this.$12.setForegroundState(a)};e.setChatVisibility=function(a){this.$12&&this.$12.setChatVisibility(a)};e.getEndpointCapabilities=function(){return this.$12.getEndpointCapabilities()};e.setEndpointCapabilities=function(a){this.$12.setEndpointCapabilities(a)};return a}();g["default"]=a}),98); __d("MqttConfig",["MqttWebConfig"],(function(a,b,c,d,e,f,g){"use strict";g["default"]=c("MqttWebConfig")}),98); __d("MqttEnvConfigStorage",["WebStorage"],(function(a,b,c,d,e,f,g){var h,i="mqtt:";function a(a,b){var d=(h||(h=c("WebStorage"))).getLocalStorage();if(d){d=d.getItem(i+a);if(d!=null)return d}return b}function b(a,b){var d=(h||(h=c("WebStorage"))).getLocalStorage();d&&(b==null?d.removeItem(i+a):(h||(h=c("WebStorage"))).setItemGuarded(d,i+a,b))}g.configRead=a;g.configWrite=b}),98); __d("MqttLogger",["ChannelClientID","FBLogger","LogHistory","MqttEnv","MqttGlobalStreamCounter","MqttUnifiedClientConnectFalcoEvent","MqttUnifiedClientDisconnectFalcoEvent","MqttUnifiedClientIncomingPublishFalcoEvent","MqttUnifiedClientOutgoingPublishFalcoEvent","MqttWsClientTypedLoggerLite","NetworkStatus","ODS","Random","gkx"],(function(a,b,c,d,e,f,g){"use strict";var h,i="mqtt_client",j=100,k="WEBSOCKET",l=typeof window!=="undefined"?window:self,m=null,n={CLIENT_ERROR:"mqtt_client_error",CONNECT:"mqtt_client_connect",DISCONNECT:"mqtt_client_disconnect",PUBLISH:"mqtt_client_publish",PUBLISH_TIMEOUT:"mqtt_qos1_publish_timeout",SOCKET_DISCONNECT:"mqtt_protocol_error"},o={CONNECT:"connect",DISCONNECT:"disconnect",INCOMING_PUBLISH:"incoming_publish",OUTGOING_PUBLISH:"outgoing_publish"};a=function(){a.getInstance=function(){m||(m=new a());return m};function a(){this.$1=d("LogHistory").getInstance(i),this.$2=0,this.$3=Date.now(),this.$4=c("ChannelClientID").getID(),this.$6(),this.$5=d("MqttGlobalStreamCounter").getInstance(),this.$5.isEnabled()||(this.$5=null)}var b=a.prototype;b.setAppId=function(a){this.$2===0&&(this.$2=a)};b.eventLogConnect=function(a){var b=a.ackReceived,d=a.attemptNumber,e=a.connectionState,f=a.connectionStatus,g=a.disconnectCount,h=a.duration,i=a.errorMessage,j=a.failTotal,l=a.hostname,m=a.messageSizeBytes,p=a.osConnectivity,q=a.sessionID,r=a.successTotal;a=a.total_duration;f=f?"success":"failed";this.bumpCounter(n.CONNECT+"."+f);f=r/(r+j);r=p&&this.getBrowserConnectivity();var s={acked:b,attempt_number:d.toString(),client_type:k,connection_state:e,disconnect_count:g.toString(),duration:h.toString(),error:i,event_type:o.CONNECT,extra_data:{connect_success_rate:f.toString(),device_id:this.$4,hostname:l},os_connectivity:r,payload_size:m==null?void 0:m.toString(),session_id:q.toString(),total_duration:a.toString(),ws_count:(j=this.$5)==null?void 0:j.getGlobalState().totalConnectionStreams.toString()};this.$7(function(){c("MqttUnifiedClientConnectFalcoEvent").log(function(){return s})})};b.eventLogPull=function(a){var b=a.duration,c=a.errorMessage,e=a.hostname,f=a.pullEventName,g=a.sessionID;a=a.status;a={connection_status:a,device_id:this.$4,duration:b,error_message:c,hostname:e,href:l.location.hostname,logged_in:d("MqttEnv").Env.isUserLoggedInNow(),session_id:g};this.$8(f,a)};b.eventLogPullFinish=function(a){var b=a.duration,c=a.errorMessage,e=a.publishReceived,f=a.publishSent,g=a.pullEventName;a=a.sessionID;b={device_id:this.$4,duration:b,error_message:c,href:l.location.hostname,logged_in:d("MqttEnv").Env.isUserLoggedInNow(),publish_received:e,publish_sent:f,session_id:a};this.$8(g,b)};b.eventLogDisconnect=function(a){var b=a.disconnectCount,d=a.duration,e=a.errorMessage;a=a.sessionID;this.bumpCounter(n.DISCONNECT);var f={client_type:k,connection_state:"Disconnected",disconnect_count:b.toString(),duration:d.toString(),error:e,event_type:o.DISCONNECT,extra_data:{device_id:this.$4},os_connectivity:this.getBrowserConnectivity(),session_id:a.toString(),ws_count:(b=this.$5)==null?void 0:b.getGlobalState().totalConnectionStreams.toString()};this.$7(function(){c("MqttUnifiedClientDisconnectFalcoEvent").log(function(){return f})})};b.eventLogOutgoingPublish=function(a){var b=a.attempt,d=a.connectionState,e=a.disconnectCount,f=a.errorMessage,g=a.firstAttemptStartTime,h=a.payloadSizeBytes,i=a.protocol,j=a.qos,l=a.sessionID,m=a.success,p=a.thisAttemptStartTime;a=a.topic;this.bumpCounter(n.PUBLISH+"."+a);var q=Date.now(),r={acked:j===1?m:null,attempt_number:b.toString(),client_type:k,connection_state:d,disconnect_count:e.toString(),duration:(q-p).toString(),error:f,event_type:o.OUTGOING_PUBLISH,extra_data:{device_id:this.$4,protocol:i},os_connectivity:this.getBrowserConnectivity(),payload_size:h.toString(),qos:j.toString(),session_id:l.toString(),topic:a,total_duration:g!=null?(q-g).toString():null};this.$7(function(){c("MqttUnifiedClientIncomingPublishFalcoEvent").log(function(){return r})})};b.eventLogIncomingPublish=function(a){var b=a.connectionState,d=a.disconnectCount,e=a.payloadSizeBytes,f=a.qos,g=a.sessionID;a=a.topic;var h={client_type:k,connection_state:b,disconnect_count:d.toString(),event_type:o.INCOMING_PUBLISH,extra_data:{device_id:this.$4},os_connectivity:this.getBrowserConnectivity(),payload_size:e.toString(),qos:f.toString(),session_id:g.toString(),topic:a};b=a=="/webrtc"||a=="/rtc_multi";this.$9(function(){c("MqttUnifiedClientOutgoingPublishFalcoEvent").log(function(){return h})},50,b)};b.logError=function(a,b){d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c("FBLogger")(i).catching(a).mustfix(b)}catch(a){}})};b.logErrorWarn=function(a,b){d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c("FBLogger")(i).catching(a).warn(b)}catch(a){}})};b.logWarn=function(a,b){var c=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c.$1.warn(a,b)}catch(a){}})};b.debugTrace=function(a,b){var c=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){try{c.$1.debug(a,b)}catch(a){}})};b.bumpCounter=function(a){var b=this;if(!d("Random").coinflip(j))return;d("MqttEnv").Env.scheduleLoggingCallback(function(){b.$2!==0&&(h||(h=d("ODS"))).bumpEntityKey(2966,"mqtt_ws_client",b.$2+"."+a,j),(h||(h=d("ODS"))).bumpEntityKey(2966,"mqtt_ws_client",a,j)})};b.$8=function(a,b,e){var f=this;d("MqttEnv").Env.scheduleLoggingCallback(function(){b.event_type=a;b.app_id=f.$2;b.online=f.$10();var d=JSON.stringify(b);f.$1.log(a,d,{weight:e});a!==n.DISCONNECT&&c("MqttWsClientTypedLoggerLite").log(b)})};b.$9=function(a,b,e){c("gkx")("762")&&b!==0?e=e||d("Random").coinflip(b):e=!0;e&&d("MqttEnv").Env.scheduleCallback(a)};b.$7=function(a){this.$9(a,0,!1)};b.$10=function(){return l.navigator&&l.navigator.onLine!==void 0?l.navigator.onLine:!1};b.getBrowserConnectivity=function(){return c("NetworkStatus").isOnline()};b.$6=function(){var a=this;if(l.navigator&&l.navigator.onLine!==void 0){var b=function(b){b=b.online;b||a.bumpCounter("browser_disconnect")};c("NetworkStatus").onChange(b)}};return a}();g["default"]=a}),98); __d("MqttEnvInitializer",["CurrentMessengerUser","MetaConfig","MqttEnv","MqttEnvConfigStorage","MqttLogger","Random","clearTimeout","setTimeoutAcrossTransitions"],(function(a,b,c,d,e,f,g){"use strict";function h(a){switch(a){case d("MqttEnv").MqttGkNames.mqtt_waterfall_log_client_sampling:return c("MetaConfig")._("83");case d("MqttEnv").MqttGkNames.mqtt_ws_polling_enabled:return!0;case d("MqttEnv").MqttGkNames.mqtt_lp_use_fetch:return c("MetaConfig")._("84");case d("MqttEnv").MqttGkNames.mqtt_fast_lp:return c("MetaConfig")._("85");case d("MqttEnv").MqttGkNames.mqtt_lp_no_delay:return c("MetaConfig")._("86");case d("MqttEnv").MqttGkNames.mqtt_enable_publish_over_polling:return c("MetaConfig")._("87");case d("MqttEnv").MqttGkNames.mqttweb_global_connection_counter:return c("MetaConfig")._("88");default:c("MqttLogger").getInstance().logError(new Error("unknown gk"),"Unknown GK value "+a);return!1}}function a(){d("MqttEnv").Env.initialize(c("Random").random,d("CurrentMessengerUser").isLoggedInNow,c("clearTimeout"),c("setTimeoutAcrossTransitions"),function(){return c("MqttLogger").getInstance()},h,null,null,null,d("MqttEnvConfigStorage").configRead,d("MqttEnvConfigStorage").configWrite)}b={genGk:h,initialize:a};g["default"]=b}),98); __d("FBMqttChannel",["MqttChannel","MqttConfig","MqttEnvInitializer"],(function(a,b,c,d,e,f,g){"use strict";c("MqttEnvInitializer").initialize();b=new(c("MqttChannel"))({appId:(a=c("MqttConfig")).appID,capabilities:a.capabilities,chatVisibility:!1,clientCapabilities:a.clientCapabilities,endpoint:a.endpoint,initialSubscribedTopics:a.subscribedTopics,phpOverride:a.hostNameOverride,pollingEndpoint:a.pollingEndpoint,userFbid:a.fbid});g["default"]=b}),98); __d("MqttLongPollingRunner",["MqttEnv","MqttFetchClient","MqttLongPollingClient","MqttLongPollingHookCollection","MqttTypes","MqttUtils","MqttWebSocketUtils","Promise","exponentialBackoff"],(function(a,b,c,d,e,f,g){"use strict";var h,i=4,j=1e3,k=3e3,l="mqtt_should_longpoll",m="last_lp",n="yes",o="no";a=function(){function a(a,b,e,f,g,h,i,j,k){var l=this;this.$23=function(){try{if(!l.$30())return;l.$5.debugTrace("LongPollingRunner","_startPollingIfNecessary called");var a=l.$31();l.$14=a;var b=l.$9(),c=l.$10();b=b.filter(function(b){return a.isTopicSupported(b)});c=c.filter(function(b){return a.isTopicSupported(b.topic)});if(b.length===0&&c.length===0){l.$5.debugTrace("LongPollingRunner","Poll skipped, nothing to do");l.$14=null;d("MqttEnv").Env.setTimeout(function(){l.$23()},1e3);return}var e=d("MqttUtils").generateSessionId();a.run(l.$6,e,l.$7.gen(e,b,c),l.$7,function(){return l.$32()},function(a){return l.$33(a)},function(){return l.$34()},function(a){return l.$35(a)});l.$19.onPollRequestSent();e=b.join(",");b=c.map(function(a){return a.topic}).join(",");l.$5.debugTrace("LongPollingRunner","Making a poll request to "+l.$6+". SubscribedTopics:"+e+". Publishes:"+b)}catch(a){a&&l.$5.logErrorWarn(a,"lp_js_error"),l.$11(new(d("MqttTypes").MqttChannelError)(!1,"js error lp",a)),l.$35("lp_js_error")}};this.$6=a;this.$7=b;this.$1=f;this.$2=0;this.$3=e;this.$4=d("MqttWebSocketUtils").hasWSSupport();this.$5=d("MqttEnv").Env.getLoggerInstance();this.$8=g;this.$9=h;this.$10=i;this.$11=j;this.$12=k;this.$13=!1;this.$14=null;this.$15="LPInactive";this.$16="NotSent";this.$17=0;this.$19=new(c("MqttLongPollingHookCollection"))();this.$18=c("exponentialBackoff")(this.$23,this);this.$20=0;this.$21=o;a=d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_lp_use_fetch);b=c("MqttFetchClient").isSupported();a?this.$5.bumpCounter("fetch_gk_pass"):this.$5.bumpCounter("fetch_gk_fail");b?this.$5.bumpCounter("fetch_api_supported"):this.$5.bumpCounter("fetch_api_not_supported");this.$22=a&&b}var e=a.prototype;e.addHook=function(a){this.$19.addHook(a)};e.start=function(){var a=this;this.$21=d("MqttEnv").Env.configRead(m,o);this.$5.debugTrace("LongPollingRunner","Runner loaded, last status "+this.$21);this.$20=Date.now();this.$23();d("MqttEnv").Env.setTimeout(function(){a.$23()},j+100);d("MqttEnv").Env.setTimeout(function(){a.$23()},k+100)};e.shutdown=function(){this.$5.debugTrace("LongPollingRunner","Shutdown called"),this.$14&&this.$14.abort(),this.$19.onPollShutdownAbort(),this.$14=null};e.canPublish=function(){return this.$15==="LPActive"&&this.$16==="ReceivingData"};e.publish=function(a,b,c){return this.$24(a,b)};e.publishBinary=function(a,b,c){return this.$24(a,b)};e.$24=function(a,c){if(d("MqttEnv").Env.genGk(d("MqttEnv").MqttGkNames.mqtt_enable_publish_over_polling)&&(this.$14&&this.$14.isTopicSupported(a)))if(typeof c==="string")return this.$14.publish(a,c);else return this.$14.publishBinary(a,c);return(h||(h=b("Promise"))).reject()};e.onConnectAttempt=function(){};e.onConnectFailure=function(){this.$2++,this.$23()};e.onConnected=function(){};e.onConnectSuccess=function(){this.$1=!0,d("MqttEnv").Env.configWrite(m,null)};e.onConnectionLost=function(){};e.onConnectionDisconnect=function(){};e.onSubscribe=function(a){};e.onUnsubscribe=function(a){};e.onPublish=function(a){};e.onMessage=function(a){};e.onWSFatal=function(){this.$3=!0,this.$23()};e.getStatus=function(){return this.$15};e.getRequestStatus=function(){return this.$16};e.$25=function(a){a!==this.$15&&(this.$5.debugTrace("LongPollingRunner","status changed to "+a+" from "+this.$15),this.$15=a,this.$12(this.$15,this.$16))};e.$26=function(a){if(!this.$22)return;a!==this.$16&&(this.$5.debugTrace("LongPollingRunner","request status changed to "+a+" from "+this.$16),this.$16=a,this.$12(this.$15,this.$16))};e.$27=function(){this.$17=0};e.$28=function(){this.$17++,this.$17>=i&&this.$25("LPError")};e.$29=function(){var a,b=(a=d("MqttEnv")).Env.genGk(a.MqttGkNames.mqtt_lp_no_delay),c=a.Env.genGk(a.MqttGkNames.mqtt_ws_polling_enabled);a=a.Env.genGk(a.MqttGkNames.mqtt_fast_lp);this.$5.debugTrace("LongPollingRunner","_shouldPoll? pollNow:"+String(b)+" enabled:"+String(c)+" fastPoll:"+String(a)+" hasWSSupport:"+String(this.$4)+" hasWsSuccessBefore:"+String(this.$1)+" failureCount:"+this.$2+" wsFatal:"+String(this.$3));if(!c)return!1;if(b){this.$5.bumpCounter(l+".nd");return!0}if(!this.$4){this.$5.bumpCounter(l+".na");return!0}if(this.$3){this.$5.bumpCounter(l+".fatal");return!0}if(this.$1)return!1;if(a){c=Date.now()-this.$20;if(this.$21===n){if(this.$2>=1)return!0;if(c>j){this.$5.bumpCounter(l+".fastdelay");return!0}}else if(c>k){this.$5.bumpCounter(l+".regulardelay");return!0}}if(this.$2>=3){this.$5.bumpCounter(l+".failure");return!0}return!1};e.$30=function(){if(this.$14!=null)return!1;var a=this.$29();!this.$13&&a&&(this.$5.bumpCounter("polling_kickin"),this.$13=!0,this.$25("LPActive"),this.$27());this.$13&&!a&&(this.$5.bumpCounter("polling_stopped"),this.$13=!1,this.$25("LPInactive"),this.$27());return a};e.$31=function(){if(this.$22){this.$5.debugTrace("LongPollingRunner","Creating polling client using Fetch API");return new(c("MqttFetchClient"))()}else{this.$5.debugTrace("LongPollingRunner","Creating regular Polling client");return new(c("MqttLongPollingClient"))()}};e.$32=function(){this.$5.debugTrace("LongPollingRunner","Poll success"),this.$19.onPollRequestSuccess(),this.$18.reset(),this.$25("LPActive"),this.$27(),d("MqttEnv").Env.configWrite(m,n),this.$26("ReceivingData")};e.$33=function(a){var b=a.map(function(a){return a.topic}).join(",");this.$5.debugTrace("LongPollingRunner","Poll response received, message received:"+b);for(b=0;b