Mini Kabibi Habibi

Current Path : C:/Program Files/Adobe/Adobe Creative Cloud/ACC/resources/legacy/panels/wam-client/
Upload File :
Current File : C:/Program Files/Adobe/Adobe Creative Cloud/ACC/resources/legacy/panels/wam-client/cc-wam-client.js

/*! For license information please see cc-wam-client.js.LICENSE.txt */
!function(){var e={962:function(e){function t(){}e.exports=function(e,n,o){var i=!1;return o=o||t,r.count=e,0===e?n():r;function r(e,t){if(r.count<=0)throw new Error("after called too many times");--r.count,e?(i=!0,n(e),n=o):0!==r.count||i||n(null,t)}}},42:function(e){e.exports=function(e,t,n){var o=e.byteLength;if(t=t||0,n=n||o,e.slice)return e.slice(t,n);if(t<0&&(t+=o),n<0&&(n+=o),n>o&&(n=o),t>=o||t>=n||0===o)return new ArrayBuffer(0);for(var i=new Uint8Array(e),r=new Uint8Array(n-t),s=t,a=0;s<n;s++,a++)r[a]=i[s];return r.buffer}},145:function(e){function t(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=t,t.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},t.prototype.reset=function(){this.attempts=0},t.prototype.setMin=function(e){this.ms=e},t.prototype.setMax=function(e){this.max=e},t.prototype.setJitter=function(e){this.jitter=e}},733:function(e,t){!function(){"use strict";for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),o=0;o<64;o++)n[e.charCodeAt(o)]=o;t.encode=function(t){var n,o=new Uint8Array(t),i=o.length,r="";for(n=0;n<i;n+=3)r+=e[o[n]>>2],r+=e[(3&o[n])<<4|o[n+1]>>4],r+=e[(15&o[n+1])<<2|o[n+2]>>6],r+=e[63&o[n+2]];return i%3==2?r=r.substring(0,r.length-1)+"=":i%3==1&&(r=r.substring(0,r.length-2)+"=="),r},t.decode=function(e){var t,o,i,r,s,a=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var l=new ArrayBuffer(a),p=new Uint8Array(l);for(t=0;t<c;t+=4)o=n[e.charCodeAt(t)],i=n[e.charCodeAt(t+1)],r=n[e.charCodeAt(t+2)],s=n[e.charCodeAt(t+3)],p[u++]=o<<2|i>>4,p[u++]=(15&i)<<4|r>>2,p[u++]=(3&r)<<6|63&s;return l}}()},108:function(e){var t=void 0!==t?t:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,n=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),o=n&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),i=t&&t.prototype.append&&t.prototype.getBlob;function r(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e}))}function s(e,n){n=n||{};var o=new t;return r(e).forEach((function(e){o.append(e)})),n.type?o.getBlob(n.type):o.getBlob()}function a(e,t){return new Blob(r(e),t||{})}"undefined"!=typeof Blob&&(s.prototype=Blob.prototype,a.prototype=Blob.prototype),e.exports=n?o?Blob:a:i?s:void 0},821:function(e){var t=[].slice;e.exports=function(e,n){if("string"==typeof n&&(n=e[n]),"function"!=typeof n)throw new Error("bind() requires a function");var o=t.call(arguments,2);return function(){return n.apply(e,o.concat(t.call(arguments)))}}},745:function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,o=this._callbacks["$"+e];if(!o)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<o.length;i++)if((n=o[i])===t||n.fn===t){o.splice(i,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var o=0,i=(n=n.slice(0)).length;o<i;++o)n[o].apply(this,t);return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}},292:function(e){e.exports=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},409:function(e,t,n){e.exports=n(477),e.exports.parser=n(570)},477:function(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var i=n(47),r=n(745),s=n(986)("engine.io-client:socket"),a=n(486),c=n(570),u=n(26),l=n(877);function p(e,t){if(!(this instanceof p))return new p(e,t);t=t||{},e&&"object"===o(e)&&(t=e,e=null),e?(e=u(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=u(t.host).host),this.secure=null!=t.secure?t.secure:n.g.location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||(n.g.location?location.hostname:"localhost"),this.port=t.port||(n.g.location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=l.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode;var i="object"===(void 0===n.g?"undefined":o(n.g))&&n.g;i.global===i&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e.exports=p,p.priorWebsocketSuccess=!1,r(p.prototype),p.protocol=c.protocol,p.Socket=p,p.Transport=n(664),p.transports=n(47),p.parser=n(570),p.prototype.createTransport=function(e){s('creating transport "%s"',e);var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=c.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new i[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0})},p.prototype.open=function(){var e;if(this.rememberUpgrade&&p.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},p.prototype.setTransport=function(e){s("setting transport %s",e.name);var t=this;this.transport&&(s("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},p.prototype.probe=function(e){s('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=!1,o=this;function i(){if(o.onlyBinaryUpgrades){var i=!this.supportsBinary&&o.transport.supportsBinary;n=n||i}n||(s('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(i){if(!n)if("pong"===i.type&&"probe"===i.data){if(s('probe transport "%s" pong',e),o.upgrading=!0,o.emit("upgrading",t),!t)return;p.priorWebsocketSuccess="websocket"===t.name,s('pausing current transport "%s"',o.transport.name),o.transport.pause((function(){n||"closed"!==o.readyState&&(s("changing transport and sending upgrade packet"),h(),o.setTransport(t),t.send([{type:"upgrade"}]),o.emit("upgrade",t),t=null,o.upgrading=!1,o.flush())}))}else{s('probe transport "%s" failed',e);var r=new Error("probe error");r.transport=t.name,o.emit("upgradeError",r)}})))}function r(){n||(n=!0,h(),t.close(),t=null)}function a(n){var i=new Error("probe error: "+n);i.transport=t.name,r(),s('probe transport "%s" failed because of error: %s',e,n),o.emit("upgradeError",i)}function c(){a("transport closed")}function u(){a("socket closed")}function l(e){t&&e.name!==t.name&&(s('"%s" works - aborting "%s"',e.name,t.name),r())}function h(){t.removeListener("open",i),t.removeListener("error",a),t.removeListener("close",c),o.removeListener("close",u),o.removeListener("upgrading",l)}p.priorWebsocketSuccess=!1,t.once("open",i),t.once("error",a),t.once("close",c),this.once("close",u),this.once("upgrading",l),t.open()},p.prototype.onOpen=function(){if(s("socket open"),this.readyState="open",p.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){s("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},p.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(s('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else s('packet received with socket readyState "%s"',this.readyState)},p.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},p.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout((function(){"closed"!==t.readyState&&t.onClose("ping timeout")}),e||t.pingInterval+t.pingTimeout)},p.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout((function(){s("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)}),e.pingInterval)},p.prototype.ping=function(){var e=this;this.sendPacket("ping",(function(){e.emit("ping")}))},p.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},p.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(s("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},p.prototype.write=p.prototype.send=function(e,t,n){return this.sendPacket("message",e,t,n),this},p.prototype.sendPacket=function(e,t,n,o){if("function"==typeof t&&(o=t,t=void 0),"function"==typeof n&&(o=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var i={type:e,data:t,options:n};this.emit("packetCreate",i),this.writeBuffer.push(i),o&&this.once("flush",o),this.flush()}},p.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?o():t()})):this.upgrading?o():t()}function t(){e.onClose("forced close"),s("socket closing - telling transport to close"),e.transport.close()}function n(){e.removeListener("upgrade",n),e.removeListener("upgradeError",n),t()}function o(){e.once("upgrade",n),e.once("upgradeError",n)}return this},p.prototype.onError=function(e){s("socket error %j",e),p.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},p.prototype.onClose=function(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(s('socket close with reason: "%s"',e),clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)},p.prototype.filterUpgrades=function(e){for(var t=[],n=0,o=e.length;n<o;n++)~a(this.transports,e[n])&&t.push(e[n]);return t}},664:function(e,t,n){var o=n(570),i=n(745);function r(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}e.exports=r,i(r.prototype),r.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},r.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},r.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(e){var t=o.decodePacket(e,this.socket.binaryType);this.onPacket(t)},r.prototype.onPacket=function(e){this.emit("packet",e)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},47:function(e,t,n){var o=n(573),i=n(114),r=n(344),s=n(351);t.polling=function(e){var t=!1,s=!1,a=!1!==e.jsonp;if(n.g.location){var c="https:"===location.protocol,u=location.port;u||(u=c?443:80),t=e.hostname!==location.hostname||u!==e.port,s=e.secure!==c}if(e.xdomain=t,e.xscheme=s,"open"in new o(e)&&!e.forceJSONP)return new i(e);if(!a)throw new Error("JSONP disabled");return new r(e)},t.websocket=s},344:function(e,t,n){var o=n(763),i=n(292);e.exports=u;var r,s=/\n/g,a=/\\n/g;function c(){}function u(e){o.call(this,e),this.query=this.query||{},r||(n.g.___eio||(n.g.___eio=[]),r=n.g.___eio),this.index=r.length;var t=this;r.push((function(e){t.onData(e)})),this.query.j=this.index,n.g.document&&n.g.addEventListener&&n.g.addEventListener("beforeunload",(function(){t.script&&(t.script.onerror=c)}),!1)}i(u,o),u.prototype.supportsBinary=!1,u.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),o.prototype.doClose.call(this)},u.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)}),100)},u.prototype.doWrite=function(e,t){var n=this;if(!this.form){var o,i=document.createElement("form"),r=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;i.className="socketio",i.style.position="absolute",i.style.top="-1000px",i.style.left="-1000px",i.target=c,i.method="POST",i.setAttribute("accept-charset","utf-8"),r.name="d",i.appendChild(r),document.body.appendChild(i),this.form=i,this.area=r}function u(){l(),t()}function l(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(e){n.onError("jsonp polling iframe removal error",e)}try{var e='<iframe src="javascript:0" name="'+n.iframeId+'">';o=document.createElement(e)}catch(e){(o=document.createElement("iframe")).name=n.iframeId,o.src="javascript:0"}o.id=n.iframeId,n.form.appendChild(o),n.iframe=o}this.form.action=this.uri(),l(),e=e.replace(a,"\\\n"),this.area.value=e.replace(s,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&u()}:this.iframe.onload=u}},114:function(e,t,n){var o=n(573),i=n(763),r=n(745),s=n(292),a=n(986)("engine.io-client:polling-xhr");function c(){}function u(e){if(i.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,n.g.location){var t="https:"===location.protocol,o=location.port;o||(o=t?443:80),this.xd=e.hostname!==n.g.location.hostname||o!==e.port,this.xs=e.secure!==t}}function l(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}function p(){for(var e in l.requests)l.requests.hasOwnProperty(e)&&l.requests[e].abort()}e.exports=u,e.exports.Request=l,s(u,i),u.prototype.supportsBinary=!0,u.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new l(e)},u.prototype.doWrite=function(e,t){var n="string"!=typeof e&&void 0!==e,o=this.request({method:"POST",data:e,isBinary:n}),i=this;o.on("success",t),o.on("error",(function(e){i.onError("xhr post error",e)})),this.sendXhr=o},u.prototype.doPoll=function(){a("xhr poll");var e=this.request(),t=this;e.on("data",(function(e){t.onData(e)})),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e},r(l.prototype),l.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new o(e),i=this;try{a("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var r in t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(r)&&t.setRequestHeader(r,this.extraHeaders[r])}catch(e){}if("POST"===this.method)try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=!0),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){i.onLoad()},t.onerror=function(){i.onError(t.responseText)}):t.onreadystatechange=function(){if(2===t.readyState)try{var e=t.getResponseHeader("Content-Type");i.supportsBinary&&"application/octet-stream"===e&&(t.responseType="arraybuffer")}catch(e){}4===t.readyState&&(200===t.status||1223===t.status?i.onLoad():setTimeout((function(){i.onError(t.status)}),0))},a("xhr data %s",this.data),t.send(this.data)}catch(e){return void setTimeout((function(){i.onError(e)}),0)}n.g.document&&(this.index=l.requestsCount++,l.requests[this.index]=this)},l.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},l.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},l.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},l.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=c:this.xhr.onreadystatechange=c,e)try{this.xhr.abort()}catch(e){}n.g.document&&delete l.requests[this.index],this.xhr=null}},l.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e="application/octet-stream"===t&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},l.prototype.hasXDR=function(){return void 0!==n.g.XDomainRequest&&!this.xs&&this.enablesXDR},l.prototype.abort=function(){this.cleanup()},l.requestsCount=0,l.requests={},n.g.document&&(n.g.attachEvent?n.g.attachEvent("onunload",p):n.g.addEventListener&&n.g.addEventListener("beforeunload",p,!1))},763:function(e,t,n){var o=n(664),i=n(877),r=n(570),s=n(292),a=n(289),c=n(986)("engine.io-client:polling");e.exports=l;var u=null!=new(n(573))({xdomain:!1}).responseType;function l(e){var t=e&&e.forceBase64;u&&!t||(this.supportsBinary=!1),o.call(this,e)}s(l,o),l.prototype.name="polling",l.prototype.doOpen=function(){this.poll()},l.prototype.pause=function(e){var t=this;function n(){c("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var o=0;this.polling&&(c("we are currently polling - waiting to pause"),o++,this.once("pollComplete",(function(){c("pre-pause polling complete"),--o||n()}))),this.writable||(c("we are currently writing - waiting to pause"),o++,this.once("drain",(function(){c("pre-pause writing complete"),--o||n()})))}else n()},l.prototype.poll=function(){c("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},l.prototype.onData=function(e){var t=this;c("polling got data %s",e),r.decodePayload(e,this.socket.binaryType,(function(e,n,o){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():c('ignoring poll - transport state "%s"',this.readyState))},l.prototype.doClose=function(){var e=this;function t(){c("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(c("transport open - closing"),t()):(c("transport not open - deferring close"),this.once("open",t))},l.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};r.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,n)}))},l.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=i.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e}},351:function(e,t,n){var o,i=n(664),r=n(570),s=n(877),a=n(292),c=n(289),u=n(986)("engine.io-client:websocket"),l=n.g.WebSocket||n.g.MozWebSocket;if("undefined"==typeof window)try{o=n(20)}catch(e){}var p=l;function h(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=l&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(p=o),i.call(this,e)}p||"undefined"!=typeof window||(p=o),e.exports=h,a(h,i),h.prototype.name="websocket",h.prototype.supportsBinary=!0,h.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?t?new p(e,t):new p(e):new p(e,t,n)}catch(e){return this.emit("error",e)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},h.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},h.prototype.write=function(e){var t=this;this.writable=!1;for(var o=e.length,i=0,s=o;i<s;i++)!function(e){r.encodePacket(e,t.supportsBinary,(function(i){if(!t.usingBrowserWebSocket){var r={};e.options&&(r.compress=e.options.compress),t.perMessageDeflate&&("string"==typeof i?n.g.Buffer.byteLength(i):i.length)<t.perMessageDeflate.threshold&&(r.compress=!1)}try{t.usingBrowserWebSocket?t.ws.send(i):t.ws.send(i,r)}catch(e){u("websocket closed before onclose event")}--o||(t.emit("flush"),setTimeout((function(){t.writable=!0,t.emit("drain")}),0))}))}(e[i])},h.prototype.onClose=function(){i.prototype.onClose.call(this)},h.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},h.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=c()),this.supportsBinary||(e.b64=1),(e=s.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e},h.prototype.check=function(){return!(!p||"__initialize"in p&&this.name===h.prototype.name)}},573:function(e,t,n){var o=n(18);e.exports=function(e){var t=e.xdomain,i=e.xscheme,r=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||o))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!i&&r)return new XDomainRequest}catch(e){}if(!t)try{return new(n.g[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}},986:function(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=n(736)).log=function(){return"object"===("undefined"==typeof console?"undefined":o(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var o="color: "+this.color;e.splice(1,0,o,"color: inherit");var i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(r=i))})),e.splice(r,0,o)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=i,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(i())},736:function(e,t,n){function o(e){var n;function o(){if(o.enabled){var e=o,i=+new Date,r=i-(n||i);e.diff=r,e.prev=n,e.curr=i,n=i;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(n,o){if("%%"===n)return n;c++;var i=t.formatters[o];if("function"==typeof i){var r=s[c];n=i.call(e,r),s.splice(c,1),c--}return n})),t.formatArgs.call(e,s),(o.log||t.log||console.log.bind(console)).apply(e,s)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,o=0;for(n in e)o=(o<<5)-o+e.charCodeAt(n),o|=0;return t.colors[Math.abs(o)%t.colors.length]}(e),o.destroy=i,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function i(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=o.debug=o.default=o).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var o=("string"==typeof e?e:"").split(/[\s,]+/),i=o.length;for(n=0;n<i;n++)o[n]&&("-"===(e=o[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var r=t.instances[n];r.enabled=t.enabled(r.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,o;for(n=0,o=t.skips.length;n<o;n++)if(t.skips[n].test(e))return!1;for(n=0,o=t.names.length;n<o;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(660),t.instances=[],t.names=[],t.skips=[],t.formatters={}},660:function(e){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}var n=1e3,o=60*n,i=60*o,r=24*i;function s(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}e.exports=function(e,a){a=a||{};var c,u=t(e);if("string"===u&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"days":case"day":case"d":return s*r;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*o;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===u&&!1===isNaN(e))return a.long?s(c=e,r,"day")||s(c,i,"hour")||s(c,o,"minute")||s(c,n,"second")||c+" ms":function(e){return e>=r?Math.round(e/r)+"d":e>=i?Math.round(e/i)+"h":e>=o?Math.round(e/o)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},570:function(e,t,n){var o,i=n(888),r=n(310),s=n(42),a=n(962),c=n(326);"undefined"!=typeof ArrayBuffer&&(o=n(733));var u="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),l="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),p=u||l;t.protocol=3;var h=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},f=i(h),d={type:"error",data:"parser error"},g=n(108);function m(e,t,n){for(var o=new Array(e.length),i=a(e.length,n),r=function(e,n,i){t(n,(function(t,n){o[e]=n,i(t,o)}))},s=0;s<e.length;s++)r(s,e[s],i)}t.encodePacket=function(e,n,o,i){"function"==typeof n&&(i=n,n=!1),"function"==typeof o&&(i=o,o=null);var r=void 0===e.data?void 0:e.data.buffer||e.data;if("undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer)return function(e,n,o){if(!n)return t.encodeBase64Packet(e,o);var i=e.data,r=new Uint8Array(i),s=new Uint8Array(1+i.byteLength);s[0]=h[e.type];for(var a=0;a<r.length;a++)s[a+1]=r[a];return o(s.buffer)}(e,n,i);if(void 0!==g&&r instanceof g)return function(e,n,o){if(!n)return t.encodeBase64Packet(e,o);if(p)return function(e,n,o){if(!n)return t.encodeBase64Packet(e,o);var i=new FileReader;return i.onload=function(){t.encodePacket({type:e.type,data:i.result},n,!0,o)},i.readAsArrayBuffer(e.data)}(e,n,o);var i=new Uint8Array(1);return i[0]=h[e.type],o(new g([i.buffer,e.data]))}(e,n,i);if(r&&r.base64)return function(e,n){return n("b"+t.packets[e.type]+e.data.data)}(e,i);var s=h[e.type];return void 0!==e.data&&(s+=o?c.encode(String(e.data),{strict:!1}):String(e.data)),i(""+s)},t.encodeBase64Packet=function(e,n){var o,i="b"+t.packets[e.type];if(void 0!==g&&e.data instanceof g){var r=new FileReader;return r.onload=function(){var e=r.result.split(",")[1];n(i+e)},r.readAsDataURL(e.data)}try{o=String.fromCharCode.apply(null,new Uint8Array(e.data))}catch(t){for(var s=new Uint8Array(e.data),a=new Array(s.length),c=0;c<s.length;c++)a[c]=s[c];o=String.fromCharCode.apply(null,a)}return i+=btoa(o),n(i)},t.decodePacket=function(e,n,o){if(void 0===e)return d;if("string"==typeof e){if("b"===e.charAt(0))return t.decodeBase64Packet(e.substr(1),n);if(o&&!1===(e=function(e){try{e=c.decode(e,{strict:!1})}catch(e){return!1}return e}(e)))return d;var i=e.charAt(0);return Number(i)==i&&f[i]?e.length>1?{type:f[i],data:e.substring(1)}:{type:f[i]}:d}i=new Uint8Array(e)[0];var r=s(e,1);return g&&"blob"===n&&(r=new g([r])),{type:f[i],data:r}},t.decodeBase64Packet=function(e,t){var n=f[e.charAt(0)];if(!o)return{type:n,data:{base64:!0,data:e.substr(1)}};var i=o.decode(e.substr(1));return"blob"===t&&g&&(i=new g([i])),{type:n,data:i}},t.encodePayload=function(e,n,o){"function"==typeof n&&(o=n,n=null);var i=r(e);return n&&i?g&&!p?t.encodePayloadAsBlob(e,o):t.encodePayloadAsArrayBuffer(e,o):e.length?void m(e,(function(e,o){t.encodePacket(e,!!i&&n,!1,(function(e){o(null,function(e){return e.length+":"+e}(e))}))}),(function(e,t){return o(t.join(""))})):o("0:")},t.decodePayload=function(e,n,o){if("string"!=typeof e)return t.decodePayloadAsBinary(e,n,o);var i;if("function"==typeof n&&(o=n,n=null),""===e)return o(d,0,1);for(var r,s,a="",c=0,u=e.length;c<u;c++){var l=e.charAt(c);if(":"===l){if(""===a||a!=(r=Number(a)))return o(d,0,1);if(a!=(s=e.substr(c+1,r)).length)return o(d,0,1);if(s.length){if(i=t.decodePacket(s,n,!1),d.type===i.type&&d.data===i.data)return o(d,0,1);if(!1===o(i,c+r,u))return}c+=r,a=""}else a+=l}return""!==a?o(d,0,1):void 0},t.encodePayloadAsArrayBuffer=function(e,n){if(!e.length)return n(new ArrayBuffer(0));m(e,(function(e,n){t.encodePacket(e,!0,!0,(function(e){return n(null,e)}))}),(function(e,t){var o=t.reduce((function(e,t){var n;return e+(n="string"==typeof t?t.length:t.byteLength).toString().length+n+2}),0),i=new Uint8Array(o),r=0;return t.forEach((function(e){var t="string"==typeof e,n=e;if(t){for(var o=new Uint8Array(e.length),s=0;s<e.length;s++)o[s]=e.charCodeAt(s);n=o.buffer}i[r++]=t?0:1;var a=n.byteLength.toString();for(s=0;s<a.length;s++)i[r++]=parseInt(a[s]);for(i[r++]=255,o=new Uint8Array(n),s=0;s<o.length;s++)i[r++]=o[s]})),n(i.buffer)}))},t.encodePayloadAsBlob=function(e,n){m(e,(function(e,n){t.encodePacket(e,!0,!0,(function(e){var t=new Uint8Array(1);if(t[0]=1,"string"==typeof e){for(var o=new Uint8Array(e.length),i=0;i<e.length;i++)o[i]=e.charCodeAt(i);e=o.buffer,t[0]=0}var r=(e instanceof ArrayBuffer?e.byteLength:e.size).toString(),s=new Uint8Array(r.length+1);for(i=0;i<r.length;i++)s[i]=parseInt(r[i]);if(s[r.length]=255,g){var a=new g([t.buffer,s.buffer,e]);n(null,a)}}))}),(function(e,t){return n(new g(t))}))},t.decodePayloadAsBinary=function(e,n,o){"function"==typeof n&&(o=n,n=null);for(var i=e,r=[];i.byteLength>0;){for(var a=new Uint8Array(i),c=0===a[0],u="",l=1;255!==a[l];l++){if(u.length>310)return o(d,0,1);u+=a[l]}i=s(i,2+u.length),u=parseInt(u);var p=s(i,0,u);if(c)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(e){var h=new Uint8Array(p);for(p="",l=0;l<h.length;l++)p+=String.fromCharCode(h[l])}r.push(p),i=s(i,u)}var f=r.length;r.forEach((function(e,i){o(t.decodePacket(e,n,!0),i,f)}))}},888:function(e){e.exports=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var o in e)n.call(e,o)&&t.push(o);return t}},326:function(e){var t,n,o,i=String.fromCharCode;function r(e){for(var t,n,o=[],i=0,r=e.length;i<r;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<r?56320==(64512&(n=e.charCodeAt(i++)))?o.push(((1023&t)<<10)+(1023&n)+65536):(o.push(t),i--):o.push(t);return o}function s(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function a(e,t){return i(e>>t&63|128)}function c(e,t){if(0==(4294967168&e))return i(e);var n="";return 0==(4294965248&e)?n=i(e>>6&31|192):0==(4294901760&e)?(s(e,t)||(e=65533),n=i(e>>12&15|224),n+=a(e,6)):0==(4292870144&e)&&(n=i(e>>18&7|240),n+=a(e,12),n+=a(e,6)),n+i(63&e|128)}function u(){if(o>=n)throw Error("Invalid byte index");var e=255&t[o];if(o++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function l(e){var i,r;if(o>n)throw Error("Invalid byte index");if(o==n)return!1;if(i=255&t[o],o++,0==(128&i))return i;if(192==(224&i)){if((r=(31&i)<<6|u())>=128)return r;throw Error("Invalid continuation byte")}if(224==(240&i)){if((r=(15&i)<<12|u()<<6|u())>=2048)return s(r,e)?r:65533;throw Error("Invalid continuation byte")}if(240==(248&i)&&(r=(7&i)<<18|u()<<12|u()<<6|u())>=65536&&r<=1114111)return r;throw Error("Invalid UTF-8 detected")}e.exports={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,o=r(e),i=o.length,s=-1,a="";++s<i;)a+=c(o[s],n);return a},decode:function(e,s){var a=!1!==(s=s||{}).strict;t=r(e),n=t.length,o=0;for(var c,u=[];!1!==(c=l(a));)u.push(c);return function(e){for(var t,n=e.length,o=-1,r="";++o<n;)(t=e[o])>65535&&(r+=i((t-=65536)>>>10&1023|55296),t=56320|1023&t),r+=i(t);return r}(u)}}},683:function(e){!function(){var t=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i");function n(e){for(var t="",n=0;n<e;n++)t+=(65536*(1+Math.random())|0).toString(16).substring(1);return t}function o(e){if(!e)throw new TypeError("Invalid argument; `value` has no value.");this.value=o.EMPTY,e&&e instanceof o?this.value=e.toString():e&&"[object String]"===Object.prototype.toString.call(e)&&o.isGuid(e)&&(this.value=e),this.equals=function(e){return o.isGuid(e)&&this.value==e},this.isEmpty=function(){return this.value===o.EMPTY},this.toString=function(){return this.value},this.toJSON=function(){return this.value}}o.EMPTY="00000000-0000-0000-0000-000000000000",o.isGuid=function(e){return e&&(e instanceof o||t.test(e.toString()))},o.create=function(){return new o([n(2),n(1),n(1),n(1),n(3)].join("-"))},o.raw=function(){return[n(2),n(1),n(1),n(1),n(3)].join("-")},e.exports?e.exports=o:"undefined"!=typeof window&&(window.Guid=o)}()},310:function(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var i=n(853),r=Object.prototype.toString,s="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===r.call(Blob),a="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===r.call(File);e.exports=function e(t){if(!t||"object"!==o(t))return!1;if(i(t)){for(var n=0,r=t.length;n<r;n++)if(e(t[n]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(t)||"function"==typeof ArrayBuffer&&t instanceof ArrayBuffer||s&&t instanceof Blob||a&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return e(t.toJSON(),!0);for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)&&e(t[c]))return!0;return!1}},853:function(e){var t={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==t.call(e)}},18:function(e){try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){e.exports=!1}},486:function(e){var t=[].indexOf;e.exports=function(e,n){if(t)return e.indexOf(n);for(var o=0;o<e.length;++o)if(e[o]===n)return o;return-1}},877:function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),o=0,i=n.length;o<i;o++){var r=n[o].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}},26:function(e){var t=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(e){var o=e,i=e.indexOf("["),r=e.indexOf("]");-1!=i&&-1!=r&&(e=e.substring(0,i)+e.substring(i,r).replace(/:/g,";")+e.substring(r,e.length));for(var s=t.exec(e||""),a={},c=14;c--;)a[n[c]]=s[c]||"";return-1!=i&&-1!=r&&(a.source=o,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},352:function(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var i=n(550),r=n(940),s=n(501),a=n(925)("socket.io-client");e.exports=t=u;var c=t.managers={};function u(e,t){"object"===o(e)&&(t=e,e=void 0),t=t||{};var n,r=i(e),u=r.source,l=r.id,p=r.path,h=c[l]&&p in c[l].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||h?(a("ignoring socket cache for %s",u),n=s(u,t)):(c[l]||(a("new io instance for %s",u),c[l]=s(u,t)),n=c[l]),r.query&&!t.query&&(t.query=r.query),n.socket(r.path,t)}t.protocol=r.protocol,t.connect=u,t.Manager=n(501),t.Socket=n(479)},501:function(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var i=n(409),r=n(479),s=n(745),a=n(940),c=n(807),u=n(821),l=n(925)("socket.io-client:manager"),p=n(486),h=n(145),f=Object.prototype.hasOwnProperty;function d(e,t){if(!(this instanceof d))return new d(e,t);e&&"object"===o(e)&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new h({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||a;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}e.exports=d,d.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)f.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},d.prototype.updateSocketIds=function(){for(var e in this.nsps)f.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},d.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},s(d.prototype),d.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},d.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},d.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},d.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},d.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},d.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},d.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},d.prototype.open=d.prototype.connect=function(e,t){if(l("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;l("opening %s",this.uri),this.engine=i(this.uri,this.opts);var n=this.engine,o=this;this.readyState="opening",this.skipReconnect=!1;var r=c(n,"open",(function(){o.onopen(),e&&e()})),s=c(n,"error",(function(t){if(l("connect_error"),o.cleanup(),o.readyState="closed",o.emitAll("connect_error",t),e){var n=new Error("Connection error");n.data=t,e(n)}else o.maybeReconnectOnOpen()}));if(!1!==this._timeout){var a=this._timeout;l("connect attempt will timeout after %d",a);var u=setTimeout((function(){l("connect attempt timed out after %d",a),r.destroy(),n.close(),n.emit("error","timeout"),o.emitAll("connect_timeout",a)}),a);this.subs.push({destroy:function(){clearTimeout(u)}})}return this.subs.push(r),this.subs.push(s),this},d.prototype.onopen=function(){l("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(c(e,"data",u(this,"ondata"))),this.subs.push(c(e,"ping",u(this,"onping"))),this.subs.push(c(e,"pong",u(this,"onpong"))),this.subs.push(c(e,"error",u(this,"onerror"))),this.subs.push(c(e,"close",u(this,"onclose"))),this.subs.push(c(this.decoder,"decoded",u(this,"ondecoded")))},d.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},d.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},d.prototype.ondata=function(e){this.decoder.add(e)},d.prototype.ondecoded=function(e){this.emit("packet",e)},d.prototype.onerror=function(e){l("error",e),this.emitAll("error",e)},d.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new r(this,e,t),this.nsps[e]=n;var o=this;n.on("connecting",i),n.on("connect",(function(){n.id=o.generateId(e)})),this.autoConnect&&i()}function i(){~p(o.connecting,n)||o.connecting.push(n)}return n},d.prototype.destroy=function(e){var t=p(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},d.prototype.packet=function(e){l("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(n){for(var o=0;o<n.length;o++)t.engine.write(n[o],e.options);t.encoding=!1,t.processPacketQueue()})))},d.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},d.prototype.cleanup=function(){l("cleanup");for(var e=this.subs.length,t=0;t<e;t++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},d.prototype.close=d.prototype.disconnect=function(){l("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},d.prototype.onclose=function(e){l("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},d.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)l("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();l("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var n=setTimeout((function(){e.skipReconnect||(l("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(l("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(l("reconnect success"),e.onreconnect())})))}),t);this.subs.push({destroy:function(){clearTimeout(n)}})}},d.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},807:function(e){e.exports=function(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}}},479:function(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var i=n(940),r=n(745),s=n(459),a=n(807),c=n(821),u=n(925)("socket.io-client:socket"),l=n(877);e.exports=f;var p={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},h=r.prototype.emit;function f(e,t,n){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}r(f.prototype),f.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[a(e,"open",c(this,"onopen")),a(e,"packet",c(this,"onpacket")),a(e,"close",c(this,"onclose"))]}},f.prototype.open=f.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},f.prototype.send=function(){var e=s(arguments);return e.unshift("message"),this.emit.apply(this,e),this},f.prototype.emit=function(e){if(p.hasOwnProperty(e))return h.apply(this,arguments),this;var t=s(arguments),n={type:i.EVENT,data:t,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(u("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),delete this.flags,this},f.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},f.prototype.onopen=function(){if(u("transport is open - connecting"),"/"!==this.nsp)if(this.query){var e="object"===o(this.query)?l.encode(this.query):this.query;u("sending connect packet with query %s",e),this.packet({type:i.CONNECT,query:e})}else this.packet({type:i.CONNECT})},f.prototype.onclose=function(e){u("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},f.prototype.onpacket=function(e){if(e.nsp===this.nsp)switch(e.type){case i.CONNECT:this.onconnect();break;case i.EVENT:case i.BINARY_EVENT:this.onevent(e);break;case i.ACK:case i.BINARY_ACK:this.onack(e);break;case i.DISCONNECT:this.ondisconnect();break;case i.ERROR:this.emit("error",e.data)}},f.prototype.onevent=function(e){var t=e.data||[];u("emitting event %j",t),null!=e.id&&(u("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?h.apply(this,t):this.receiveBuffer.push(t)},f.prototype.ack=function(e){var t=this,n=!1;return function(){if(!n){n=!0;var o=s(arguments);u("sending ack %j",o),t.packet({type:i.ACK,id:e,data:o})}}},f.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(u("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):u("bad ack %s",e.id)},f.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},f.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)h.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},f.prototype.ondisconnect=function(){u("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},f.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},f.prototype.close=f.prototype.disconnect=function(){return this.connected&&(u("performing disconnect (%s)",this.nsp),this.packet({type:i.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},f.prototype.compress=function(e){return this.flags=this.flags||{},this.flags.compress=e,this}},550:function(e,t,n){var o=n(26),i=n(925)("socket.io-client:url");e.exports=function(e,t){var r=e;t=t||n.g.location,null==e&&(e=t.protocol+"//"+t.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(i("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),i("parse %s",e),r=o(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var s=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port,r.href=r.protocol+"://"+s+(t&&t.port===r.port?"":":"+r.port),r}},925:function(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=n(153)).log=function(){return"object"===("undefined"==typeof console?"undefined":o(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var o="color: "+this.color;e.splice(1,0,o,"color: inherit");var i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(r=i))})),e.splice(r,0,o)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=i,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(i())},153:function(e,t,n){var o;function i(e){function n(){if(n.enabled){var e=n,i=+new Date,r=i-(o||i);e.diff=r,e.prev=o,e.curr=i,o=i;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(n,o){if("%%"===n)return n;c++;var i=t.formatters[o];if("function"==typeof i){var r=s[c];n=i.call(e,r),s.splice(c,1),c--}return n})),t.formatArgs.call(e,s),(n.log||t.log||console.log.bind(console)).apply(e,s)}}return n.namespace=e,n.enabled=t.enabled(e),n.useColors=t.useColors(),n.color=function(e){var n,o=0;for(n in e)o=(o<<5)-o+e.charCodeAt(n),o|=0;return t.colors[Math.abs(o)%t.colors.length]}(e),"function"==typeof t.init&&t.init(n),n}(t=e.exports=i.debug=i.default=i).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){t.save(e),t.names=[],t.skips=[];for(var n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length,i=0;i<o;i++)n[i]&&("-"===(e=n[i].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){var n,o;for(n=0,o=t.skips.length;n<o;n++)if(t.skips[n].test(e))return!1;for(n=0,o=t.names.length;n<o;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(119),t.names=[],t.skips=[],t.formatters={}},119:function(e){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}var n=1e3,o=60*n,i=60*o,r=24*i;function s(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}e.exports=function(e,a){a=a||{};var c,u=t(e);if("string"===u&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"days":case"day":case"d":return s*r;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*o;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===u&&!1===isNaN(e))return a.long?s(c=e,r,"day")||s(c,i,"hour")||s(c,o,"minute")||s(c,n,"second")||c+" ms":function(e){return e>=r?Math.round(e/r)+"d":e>=i?Math.round(e/i)+"h":e>=o?Math.round(e/o)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},137:function(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var i=n(378),r=n(502),s=Object.prototype.toString,a="function"==typeof n.g.Blob||"[object BlobConstructor]"===s.call(n.g.Blob),c="function"==typeof n.g.File||"[object FileConstructor]"===s.call(n.g.File);function u(e,t){if(!e)return e;if(r(e)){var n={_placeholder:!0,num:t.length};return t.push(e),n}if(i(e)){for(var s=new Array(e.length),a=0;a<e.length;a++)s[a]=u(e[a],t);return s}if("object"===o(e)&&!(e instanceof Date)){for(var c in s={},e)s[c]=u(e[c],t);return s}return e}function l(e,t){if(!e)return e;if(e&&e._placeholder)return t[e.num];if(i(e))for(var n=0;n<e.length;n++)e[n]=l(e[n],t);else if("object"===o(e))for(var r in e)e[r]=l(e[r],t);return e}t.deconstructPacket=function(e){var t=[],n=e.data,o=e;return o.data=u(n,t),o.attachments=t.length,{packet:o,buffers:t}},t.reconstructPacket=function(e,t){return e.data=l(e.data,t),e.attachments=void 0,e},t.removeBlobs=function(e,t){var n=0,s=e;!function e(u,l,p){if(!u)return u;if(a&&u instanceof Blob||c&&u instanceof File){n++;var h=new FileReader;h.onload=function(){p?p[l]=this.result:s=this.result,--n||t(s)},h.readAsArrayBuffer(u)}else if(i(u))for(var f=0;f<u.length;f++)e(u[f],f,u);else if("object"===o(u)&&!r(u))for(var d in u)e(u[d],d,u)}(s),n||t(s)}},940:function(e,t,n){var o=n(77)("socket.io-parser"),i=n(745),r=n(310),s=n(137),a=n(378),c=n(502);function u(){}function l(e){var n=""+e.type;return t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(n+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(n+=e.nsp+","),null!=e.id&&(n+=e.id),null!=e.data&&(n+=JSON.stringify(e.data)),o("encoded %j as %s",e,n),n}function p(){this.reconstructor=null}function h(e){this.reconPack=e,this.buffers=[]}function f(e){return{type:t.ERROR,data:"parser error: "+e}}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=u,t.Decoder=p,u.prototype.encode=function(e,n){e.type!==t.EVENT&&e.type!==t.ACK||!r(e.data)||(e.type=e.type===t.EVENT?t.BINARY_EVENT:t.BINARY_ACK),o("encoding packet %j",e),t.BINARY_EVENT===e.type||t.BINARY_ACK===e.type?function(e,t){s.removeBlobs(e,(function(e){var n=s.deconstructPacket(e),o=l(n.packet),i=n.buffers;i.unshift(o),t(i)}))}(e,n):n([l(e)])},i(p.prototype),p.prototype.add=function(e){var n;if("string"==typeof e)n=function(e){var n=0,i={type:Number(e.charAt(0))};if(null==t.types[i.type])return f("unknown packet type "+i.type);if(t.BINARY_EVENT===i.type||t.BINARY_ACK===i.type){for(var r="";"-"!==e.charAt(++n)&&(r+=e.charAt(n),n!=e.length););if(r!=Number(r)||"-"!==e.charAt(n))throw new Error("Illegal attachments");i.attachments=Number(r)}if("/"===e.charAt(n+1))for(i.nsp="";++n&&","!==(c=e.charAt(n))&&(i.nsp+=c,n!==e.length););else i.nsp="/";var s=e.charAt(n+1);if(""!==s&&Number(s)==s){for(i.id="";++n;){var c;if(null==(c=e.charAt(n))||Number(c)!=c){--n;break}if(i.id+=e.charAt(n),n===e.length)break}i.id=Number(i.id)}if(e.charAt(++n)){var u=function(e){try{return JSON.parse(e)}catch(e){return!1}}(e.substr(n));if(!1===u||i.type!==t.ERROR&&!a(u))return f("invalid payload");i.data=u}return o("decoded %s as %j",e,i),i}(e),t.BINARY_EVENT===n.type||t.BINARY_ACK===n.type?(this.reconstructor=new h(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!c(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,this.emit("decoded",n))}},p.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},h.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},h.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},502:function(e,t,n){e.exports=function(e){return n.g.Buffer&&n.g.Buffer.isBuffer(e)||n.g.ArrayBuffer&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))}},77:function(e,t,n){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=n(217)).log=function(){return"object"===("undefined"==typeof console?"undefined":o(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var o="color: "+this.color;e.splice(1,0,o,"color: inherit");var i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(r=i))})),e.splice(r,0,o)}},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=i,t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(i())},217:function(e,t,n){function o(e){var n;function o(){if(o.enabled){var e=o,i=+new Date,r=i-(n||i);e.diff=r,e.prev=n,e.curr=i,n=i;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(n,o){if("%%"===n)return n;c++;var i=t.formatters[o];if("function"==typeof i){var r=s[c];n=i.call(e,r),s.splice(c,1),c--}return n})),t.formatArgs.call(e,s),(o.log||t.log||console.log.bind(console)).apply(e,s)}}return o.namespace=e,o.enabled=t.enabled(e),o.useColors=t.useColors(),o.color=function(e){var n,o=0;for(n in e)o=(o<<5)-o+e.charCodeAt(n),o|=0;return t.colors[Math.abs(o)%t.colors.length]}(e),o.destroy=i,"function"==typeof t.init&&t.init(o),t.instances.push(o),o}function i(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=o.debug=o.default=o).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var n;t.save(e),t.names=[],t.skips=[];var o=("string"==typeof e?e:"").split(/[\s,]+/),i=o.length;for(n=0;n<i;n++)o[n]&&("-"===(e=o[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var r=t.instances[n];r.enabled=t.enabled(r.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,o;for(n=0,o=t.skips.length;n<o;n++)if(t.skips[n].test(e))return!1;for(n=0,o=t.names.length;n<o;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(813),t.instances=[],t.names=[],t.skips=[],t.formatters={}},378:function(e){var t={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==t.call(e)}},813:function(e){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}var n=1e3,o=60*n,i=60*o,r=24*i;function s(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}e.exports=function(e,a){a=a||{};var c,u=t(e);if("string"===u&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"days":case"day":case"d":return s*r;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*o;case"seconds":case"second":case"secs":case"sec":case"s":return s*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===u&&!1===isNaN(e))return a.long?s(c=e,r,"day")||s(c,i,"hour")||s(c,o,"minute")||s(c,n,"second")||c+" ms":function(e){return e>=r?Math.round(e/r)+"d":e>=i?Math.round(e/i)+"h":e>=o?Math.round(e/o)+"m":e>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},459:function(e){e.exports=function(e,t){for(var n=[],o=(t=t||0)||0;o<e.length;o++)n[o-t]=e[o];return n}},289:function(e){"use strict";var t,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),o=64,i={},r=0,s=0;function a(e){var t="";do{t=n[e%o]+t,e=Math.floor(e/o)}while(e>0);return t}function c(){var e=a(+new Date);return e!==t?(r=0,t=e):e+"."+a(r++)}for(;s<o;s++)i[n[s]]=s;c.encode=a,c.decode=function(e){var t=0;for(s=0;s<e.length;s++)t=t*o+i[e.charAt(s)];return t},e.exports=c},20:function(){}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,n){for(var o=0;o<n.length;o++){var i=n[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,(void 0,r=function(t,n){if("object"!==e(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var i=o.call(t,"string");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(i.key),"symbol"===e(r)?r:String(r)),i)}var r}var o=function(){function n(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this._hostObject=null,this._hostMessageHandlerFn=null}var o,i;return o=n,(i=[{key:"initialize",value:function(t){t&&"object"==e(t)&&(t.hostObject&&"object"==e(t.hostObject)&&(this._hostObject=t.hostObject),t.hostMessageHandlerFn&&"function"==typeof t.hostMessageHandlerFn&&(this._hostMessageHandlerFn=t.hostMessageHandlerFn))}},{key:"handleMessage",value:function(e){}},{key:"finalize",value:function(e){}},{key:"sendMessage",value:function(e){return this._hostObject&&this._hostObject.handleMessage&&"function"==typeof this._hostObject.handleMessage?this._hostObject.handleMessage(e):this._hostMessageHandlerFn?this._hostMessageHandlerFn(e):void 0}},{key:"sendMessageToJSCore",value:function(e,t){return this.sendMessage({targetType:"JSCore",message:e,data:t||{}})}},{key:"sendMessageToParent",value:function(e,t){return this.sendMessage({targetType:"Parent",message:e,data:t||{}})}},{key:"sendMessageToHost",value:function(e,t){return this.sendMessage({targetType:"Host",message:e,data:t||{}})}},{key:"sendMessageToContainer",value:function(e,t){return this.sendMessage({targetType:"Container",message:e,data:t||{}})}},{key:"sendMessageToApplet",value:function(e,t,n,o,i){return this.sendMessage({targetType:"Applet",targetID:n||"",targetVersion:o||"",targetInstanceID:i||"",message:e,data:t||{}})}}])&&t(o.prototype,i),Object.defineProperty(o,"prototype",{writable:!1}),n}(),i={pingInterval:1e4,pingTimeout:3e4,expireMsgsCallInterval:600,expireDataDefaultInterval:3600,perConnectionTimeout:2e4,totalConnectionTimeout:12e4,messageTimeout:72e5,registrationTimeout:5e3,authenticationTimeout:5e3,sendCurrentDeviceTimeOut:5e3,sendUmiDetailsTimeout:5e3},r={ui:"ui",engine:"engine"},s={authenticate:"authenticate",registerClient:"registerClient",sendStatus:"clientMsg",sendCurrentDevice:"sendCurrentDevice",sendUmiDetails:"umiDetails",onMessage:"clientMsg",onDisconnection:"disconnect",onError:"error",onConnectionFail:"connect_failed",onConnectionTimeout:"connect_timeout",onConnectionError:"connect_error",onConnection:"connect",onConnecting:"connecting",onUIStateChange:"clientStates",onReconnectionFail:"reconnect_failed",onReconnectionAttempt:"reconnect_attempt",onClose:"close"},a={reconnectionAttempts:2,shouldReconnect:!0},c={command:"cc.command",confirmation:"cc.confirmationResponse",deepLink:"cc.deepLink",dataRequest:"cc.dataRequest",status:"cc.status",refresh:"cc.refresh",dataResponse:"cc.dataResponse"},u=1,l={AppsPanelBL:"AppsPanel_BL",AppsPanelBLVersion:"1.0",AppsPanelUI:"AppsPanel_UI",AppsPanelUIVersion:"1.0",ContainerBL:"C3Container_BL",ContainerBLVersion:"1.0"},p={command:"performAppAction",confirmation:"confirmAppAction",hidePopup:"HidePopup",ccHomeConnected:"ccHomeConnected",ccHomeDisconnected:"ccHomeDisconnected",sendAnalytics:"SendAnalyticsFromJS",handleDeepLinking:"HandleDeepLinking",getUmiData:"GetUmiData"},h={connected:"ACCC_WAM_SERVICE_CONNECTED",disconnected:"ACCC_WAM_SERVICE_DISCONNECTED",state:"ACCC_WAM_SERVICE_CONNECTION_STATE",states:{serviceConnectionAttempt:"WAM_SERVICE_CONNECTION_ATTEMPTED",serviceConnectionSuccess:"WAM_SERVICE_CONNECTION_SUCCESS",serviceConnectionFailed:"WAM_SERVICE_CONNECTION_FAILED",serviceConnectionIgnored:"WAM_SERVICE_CONNECTION_IGNORED",serviceRegistrationAttempt:"WAM_SERVICE_REGISTRATION_ATTEMPT",serviceAuthenticationAttempt:"WAM_SERVICE_AUTHENTICATION_ATTEMPT",serviceAuthenticationFailure:"WAM_SERVICE_AUTHENTICATION_FAILURE",serviceRegistrationSuccess:"WAM_SERVICE_REGISTRATION_SUCCESS",serviceRegistrationFailed:"WAM_SERVICE_REGISTRATION_FAILED",serviceDisconnection:"WAM_SERVICE_DISCONNECTION",commandReceived:"WAM_SERVICE_COMMAND_RECEIVED",confirmationReceived:"WAM_SERVICE_CONFIRMATION_RECEIVED",clientAdded:"WAM_SERVICE_UI_CLIENT_ADDED",clientRemoved:"WAM_SERVICE_UI_CLIENT_REMOVED",deepLinkRequestReceived:"WAM_SERVICE_DEEPLINK_REQUEST_RECEIVED",dataRequestReceived:"WAM_SERVICE_DATA_REQUEST_RECEIVED",umiDetailsRequestReceived:"WAM_SERVICE_UMI_DETAILS_REQUEST_RECEIVED",umiDetailsResponseSent:"WAM_SERVICE_UMI_DETAILS_RESPONSE_SENT"},reasonCodes:{connectionInProgress:"connectionInProgress",otherConnectionEstablished:"otherConnectionEstablished",multipleConnectionSuccess:"multipleConnectionSuccess",invalidParams:"invalidParams"}},f=n(352),d=n.n(f);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function m(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,t){if("object"!==g(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==g(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===g(i)?i:String(i)),o)}var i}var y="receive",v="#",b=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._socket=null,this._messageDetails={},this._logger=t}var t,n;return t=e,n=[{key:"connect",value:function(e,t){this._logger.info("SocketInterface","connect","Initiate websocket connection with ".concat(e)),this._socket=d()(e,t)}},{key:"disconnect",value:function(){for(var e in this._logger.info("SocketInterface","disconnect","Disconnecting websocket connection"),this._messageDetails)this._messageDetails[e].isTimedOut=!0,this._removeMessageUsingKey(e);this._messageDetails={},this._logger.debug("SocketInterface","disconnect","Cleared message map"),this._socket&&"object"===g(this._socket)&&this._socket.disconnect(),this._socket=null,this._logger.info("SocketInterface","disconnect","Disconnected websocket connection")}},{key:"sendMessage",value:function(e,t,n){var o=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,s="send#"+e;this._logger.info("SocketInterface","sendMessage","Registering message:".concat(s)),this._addMessageToMap(s,n,i,r),this._socket.emit(e,t,(function(e){o._successWrapper(s,e),o._removeMessageUsingKey(s)}))}},{key:"receiveMessage",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,r=y+v+e;this._logger.debug("SocketInterface","receiveMessage","Registering message:".concat(r)),this._addMessageToMap(r,t,o,i),this._socket.on(e,(function(e){n._successWrapper(r,e)}))}},{key:"removeReceiveMessage",value:function(e){this._removeMessageUsingKey(y+v+e)}},{key:"restartTimerForReceiveMessage",value:function(e){this._logger.debug("SocketInterface","restartTimerForReceiveMessage","Reset timer for Message:".concat(e));var t=y+v+e;if(0!==Object.keys(this._messageDetails).length&&this._messageDetails[t]){var n=this._messageDetails[t];-1!=n.timeoutID&&(clearTimeout(n.timeoutID),this._logger.debug("SocketInterface","restartTimerForReceiveMessage","Reset timer completed for message key:".concat(t)),n.timeoutID=setTimeout(this._timeoutWrapper.bind(this),n.timeoutInterval,t))}else this._logger.debug("SocketInterface","restartTimerForReceiveMessage","Connection already closed before message key:".concat(t))}},{key:"_addMessageToMap",value:function(e,t,n,o){var i=-1;-1!=o&&(i=setTimeout(this._timeoutWrapper.bind(this),o,e)),this._messageDetails[e]={successCallback:t,timeoutCallback:n,timeoutID:i,timeoutInterval:o,isTimedOut:!1}}},{key:"_removeMessageUsingKey",value:function(e){if(0==e.indexOf(y)){var t=this._getMessageNameFromMessageKey(e);this._socket.off(t),this._logger.debug("SocketInterface","_removeMessageUsingKey","Unsubscribed :".concat(t))}-1!=this._messageDetails[e].timeoutID&&clearTimeout(this._messageDetails[e].timeoutID),delete this._messageDetails[e]}},{key:"_timeoutWrapper",value:function(e){if(this._logger.debug("SocketInterface","_timeoutWrapper","Received timeout callback for Message Key:".concat(e)),0!==Object.keys(this._messageDetails).length&&this._messageDetails[e]){var t=this._messageDetails[e];t.isTimedOut||(t.isTimedOut=!0,this._removeMessageUsingKey(e),t.timeoutCallback(this._getMessageNameFromMessageKey(e)))}else this._logger.debug("SocketInterface","_timeoutWrapper","Connection already closed/ No handler for Message key:".concat(e))}},{key:"_successWrapper",value:function(e,t){if(this._logger.debug("SocketInterface","_successWrapper","Received success callback for Message Key:".concat(e)),0!==Object.keys(this._messageDetails).length&&this._messageDetails[e]){var n=this._messageDetails[e];n.isTimedOut||(n.isTimedOut=!0,-1!=n.timeoutID&&clearTimeout(n.timeoutID),n.successCallback(t,this._getMessageNameFromMessageKey(e)),n.isTimedOut=!1)}else this._logger.debug("SocketInterface","_successWrapper","Connection already closed before message key:".concat(e))}},{key:"_getMessageNameFromMessageKey",value:function(e){return e.substr(e.indexOf(v)+1)}}],n&&m(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),_=n(683),C=n.n(_);function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,t){if("object"!==w(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==w(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===w(i)?i:String(i)),o)}var i}function k(e,t,n){return t&&A(e.prototype,t),n&&A(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var I=function(e,t){for(var n in e)t.includes(n)||delete e[n]},T=function(){function e(t){S(this,e),this._logger=t,this._apiVersion="",this._userID="",this._deviceID="",this._id="",this._clientType="",this._clientSubType="",this._messageContextId="",this._ingestContext={},this.msgType="",this.msg=null}return k(e,[{key:"initializeMessage",value:function(e){if(!e||"object"!==w(e))return this._logger.error("MessageBase","initializeMessage","Invalid message object",e),!1;if(!e.userContext||"object"!==w(e.userContext)||!e.userContext.userId||"string"!=typeof e.userContext.userId||!e.userContext.deviceId||"string"!=typeof e.userContext.deviceId)return this._logger.error("MessageBase","initializeMessage","Invalid user context"),!1;if(!e.id||"string"!=typeof e.id)return this._logger.error("MessageBase","initializeMessage","Invalid message id",e.id),!1;if(!e.clientType||"string"!=typeof e.clientType)return this._logger.error("MessageBase","initializeMessage","Invalid clientType",e.clientType),!1;if(e.clientSubType&&"string"==typeof e.clientSubType||this._logger.error("MessageBase","initializeMessage","Invalid clientSubType",e.clientSubType),!e.apiVersion||"number"!=typeof e.apiVersion)return this._logger.error("MessageBase","initializeMessage","Invalid API version",e.apiVersion),!1;if(!e.msgContextId||"string"!=typeof e.msgContextId)return this._logger.error("MessageBase","initializeMessage","Invalid messageContextId",e.msgContextId),!1;if(!e.msgType||"string"!=typeof e.msgType)return this._logger.error("MessageBase","initializeMessage","Invalid msgType",e.msgType),!1;var t;switch(e.msgType){case c.command:t=new M(this._logger);break;case c.confirmation:t=new R(this._logger);break;case c.deepLink:t=new x(this._logger);break;case c.dataRequest:t=new E(this._logger);break;default:return this._logger.error("MessageBase","initializeMessage","Invalid msgType",e.msgType),!1}return t.initializeMessage(e.msgBody)?(this._userID=e.userContext.userId,this._deviceID=e.userContext.deviceId,this._id=e.id,this._clientType=e.clientType,this._clientSubType=e.clientSubType,this._apiVersion=e.apiVersion,this._messageContextId=e.messageContextId,this._ingestContext=e.msgBody.ingestContext,this.msgType=e.msgType,this.msg=t,!0):(this._logger.error("MessageBase","initializeMessage","Invalid message body"),!1)}},{key:"validateUserContext",value:function(e){return e==this._userID||(this._logger.warn("MessageBase","validateUserContext","User context does not match with the WAMClient"),!1)}},{key:"extract",value:function(){var e=this.msg.extract();return e.clientSubType=this._clientSubType,e.ingestContext=this._ingestContext,e}}]),e}(),M=function(){function e(t){S(this,e),this._sapCode="",this._version="",this._command="",this._showDialog="",this._moduleId="",this._preferenceDetails={},this._logger=t}return k(e,[{key:"initializeMessage",value:function(e){return e&&"object"===w(e)?e.command&&"string"==typeof e.command?(this._sapCode=e.sapCode,this._version=e.version,this._command=e.command,this._preferenceDetails=e.preferenceDetails,this._showDialog=e.showDialog,this._moduleId=e.moduleId,!0):(this._logger.error("CommandMessage","initializeMessage","Invalid command",e.command),!1):(this._logger.error("CommandMessage","initializeMessage","Invalid message body",e),!1)}},{key:"extract",value:function(){var e={};return e.sapCode=this._sapCode,e.version=this._version,e.command=this._command,e.preferenceDetails=this._preferenceDetails,e.showDialog=this._showDialog,e.moduleId=this._moduleId,e}}]),e}(),E=function(){function e(t){S(this,e),this.dataRequestMessageObj=null,this._logger=t}return k(e,[{key:"initializeMessage",value:function(e){return e&&"object"===w(e)?e.request&&"string"==typeof e.request?(this.dataRequestMessageObj=e,!0):(this._logger.error("DataRequestMessage","initializeMessage","Invalid request",e.request),!1):(this._logger.error("DataRequestMessage","initializeMessage","Invalid message body",e),!1)}},{key:"extract",value:function(){return this.dataRequestMessageObj}}]),e}(),D=function(){function e(t){S(this,e),this._userID="",this._deviceID="",this._data={},this._request="",this._logger=t}return k(e,[{key:"initializeMessage",value:function(e,t,n){return n&&"object"===w(n)?n.request&&"string"==typeof n.request?n.data&&"object"===w(n.data)?(this._userID=e,this._deviceID=t,this._data=n.data,this._request=n.request,!0):(this._logger.error("DataResponseMessage","initializeMessage","data payload does not exist in message body:"),!1):(this._logger.error("DataResponseMessage","initializeMessage","request type does not exist in message body:"),!1):(this._logger.error("DataResponseMessage","initializeMessage","Invalid message body:",n),!1)}},{key:"extract",value:function(){return{messages:[{id:C().create(),userContext:{userId:this._userID,deviceId:this._deviceID},clientType:r.engine,msgType:c.dataResponse,msgTimestamp:JSON.stringify((new Date).getTime()),msgBody:{status:{data:this._data,request:this._request,status:"success"}},autoContext:{ttl:"low"},apiVersion:u,msgContextId:"".concat(c.dataResponse,":").concat(this._request)}]}}}]),e}(),x=function(){function e(t){S(this,e),this.deepLinkObj={},this._logger=t}return k(e,[{key:"initializeMessage",value:function(e){return this._logger.info("DeepLinkMessage ","initializeMessage CommandMessage with msgBody : ",e),e&&"object"===w(e)?e.workflow&&"string"==typeof e.workflow?(this.deepLinkObj=e,!0):(this._logger.error("DeepLinkMessage ","initializeMessage","Invalid workflow",e.workflow),!1):(this._logger.error("DeepLinkMessage ","initializeMessage","Invalid message body",e),!1)}},{key:"extract",value:function(){return this.deepLinkObj}}]),e}(),R=function(){function e(t){S(this,e),this._logger=t,this._sapCode="",this._version="",this._confirmationID="",this._confirmationType="",this._confirmationValue="",this._confirmationCheckboxes=[]}return k(e,[{key:"initializeMessage",value:function(e){return e&&"object"===w(e)?e.confirmationType&&"string"==typeof e.confirmationType?e.confirmationValue&&"string"==typeof e.confirmationValue?e.confirmationID&&"string"==typeof e.confirmationID?(this._sapCode=e.sapCode,this._version=e.version,this._confirmationType=e.confirmationType,this._confirmationValue=e.confirmationValue,this._confirmationID=e.confirmationID,e.confirmationCheckboxes&&e.confirmationCheckboxes.constructor==Array&&(this._logger.debug("ConfirmationMessage","initializeMessage","Received confirmationCheckboxes",e.confirmationCheckboxes),this._confirmationCheckboxes=e.confirmationCheckboxes),!0):(this._logger.error("ConfirmationMessage","initializeMessage","Invalid confirmationID",e.confirmationID),!1):(this._logger.error("ConfirmationMessage","initializeMessage","Invalid confirmationValue",e.confirmationValue),!1):(this._logger.error("ConfirmationMessage","initializeMessage","Invalid confirmationType",e.confirmationType),!1):(this._logger.error("ConfirmationMessage","initializeMessage","Invalid message body",e),!1)}},{key:"extract",value:function(){var e={};return e.sapCode=this._sapCode,e.version=this._version,e.confirmationCheckboxes=this._confirmationCheckboxes,e.confirmationType=this._confirmationType,e.confirmationValue=this._confirmationValue,e.confirmationID=this._confirmationID,e}}]),e}(),O=function(){function e(t){S(this,e),this._sapCode="",this._version="",this._moduleId="",this._shouldSendForcefully=!1,this._msgContextId="",this._userID="",this._deviceID="",this._status=null,this._logger=t}return k(e,[{key:"initializeMessage",value:function(e,t,n){return n&&"object"===w(n)?n.status&&"object"===w(n.status)?(n.sapCode&&"string"==typeof n.sapCode&&n.version&&"string"==typeof n.version?(this._sapCode=n.sapCode,this._version=n.version,this._msgContextId="".concat(this._sapCode,"_").concat(this._version)):this._msgContextId="ACCC_0.0",n.moduleId&&"string"==typeof n.moduleId&&(this._moduleId=n.moduleId),n.shouldSendForcefully&&"string"==typeof n.shouldSendForcefully&&(this._shouldSendForcefully="true"===n.shouldSendForcefully),this._status=n.status,this._userID=e,this._deviceID=t,!0):(this._logger.error("StatusMessage","initializeMessage","Invalid status:",n.status),!1):(this._logger.error("StatusMessage","initializeMessage","Invalid message body:",n),!1)}},{key:"extract",value:function(){if(this._status&&this._status.command&&("getAppsAndServicesList"===this._status.command||"updateAppsData"===this._status.command)&&this._status.listingDetails){var e=JSON.parse(this._status.listingDetails);!function(e,t,n){for(var o in e)if(t.includes(o)){if(Array.isArray(e[o]))for(var i=0;i<e[o].length;i+=1)I(e[o][i],n)}else delete e[o]}(e,["active_sessions","appsPreference","available_to_install","available_updates","clientVersion","incompatible","incompatible_apps","incompatibleWithCheckprevious","installed","processingState"],["sapcode","version","updates_info","uninstallable","other_version_data","launchable","is_update_available","display_name","inprogress","platform","entitlement_info","total_progress_percent","action","status","cancelable","localizedMessageText","build_version","update_type","all_installed_versions","installed_version","product_whatsnew_url","lastModifiedTimeStamp","lastModifiedOperationType","error_details","session_source","module_list","unlicensedAppEligibleForOpen","isLatestAppVersion"]),this._status.listingDetails=JSON.stringify(e)}if(this._status&&this._status.confirmationDetails){if(this._status.confirmationDetails.confirmationButtons&&this._status.confirmationDetails.confirmationButtons.constructor!=Array){var t=this._status.confirmationDetails.confirmationButtons;this._status.confirmationDetails.confirmationButtons=[],this._status.confirmationDetails.confirmationButtons.push(t)}if(this._status.confirmationDetails.confirmationCheckboxes&&this._status.confirmationDetails.confirmationCheckboxes.constructor!=Array){var n=this._status.confirmationDetails.confirmationCheckboxes;this._status.confirmationDetails.confirmationCheckboxes=[],this._status.confirmationDetails.confirmationCheckboxes.push(n)}}return{messages:[{id:C().create(),userContext:{userId:this._userID,deviceId:this._deviceID},clientType:r.engine,msgType:c.status,msgContextId:this._msgContextId,msgTimestamp:JSON.stringify((new Date).getTime()),msgBody:{sapCode:this._sapCode,moduleId:this._moduleId,version:this._version,status:this._status},autoContext:{ttl:"low"},apiVersion:u}]}}}]),e}();function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function B(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==P(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===P(i)?i:String(i)),o)}var i}var j=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._setConnectionData(),this._ccHomeExternalGateway=t,this._logger=t._logger,this.setWAMProfileDefault()}var t,n;return t=e,n=[{key:"setWAMProfileDefault",value:function(){this._startTimeStamp=-1,this._endTimeStamp=-1,this._connectCompleteTimeStamp=-1,this._authenticationCompleteTimeStamp=-1,this._clientRegisteredTimeStamp=-1,this._createAppsListCompleteTimestamp=-1,this._publishAppsStateCompleteTimestamp=-1,this._sendWamProfileEvent=!1,this._firstGetAppsStatus=!1}},{key:"connectionEstablished",value:function(e,t){var n=this;if(this._connectCompleteTimeStamp=(new Date).getTime(),this._logger.info("WAMInterface","connectionEstablished",this._wamVersion),"v2"===this._wamVersion){var o={authorization:this._accessToken,"x-adobe-app-id":this._appID};this._sendStateEvent(h.states.serviceAuthenticationAttempt),this._socketInterfaceObj.sendMessage(s.authenticate,o,(function(e){!0===e.authenticated?(n._logger.info("WAMInterface","connectionEstablished","Server URL:".concat(n._wamURL," for ").concat(t)),n._authenticationCompleteTimeStamp=(new Date).getTime(),n._isConnected=!0,n._sendStateEvent(h.states.serviceConnectionSuccess),n._socketInterfaceObj.receiveMessage(s.onDisconnection,n.disconnect.bind(n)),n._socketInterfaceObj.receiveMessage(s.onClose,n.messageClose.bind(n)),n._socketInterfaceObj.sendMessage(s.registerClient,{connection:{userId:n._userID,deviceId:n._deviceID,clientInfo:{id:n._clientGuid,clientType:r.engine,listenTo:[r.ui],userName:n._userName,userEmail:n._userEmailId,clientVersion:n._clientVersion,clientPlatform:n._clientPlatform,thorDeviceId:n._deviceID}}},n.clientRegistered.bind(n),n.registrationTimedout.bind(n),i.registrationTimeout),n._sendStateEvent(h.states.serviceRegistrationAttempt)):(n._logger.info("WAMInterface","connectionEstablished","Authentication faliure"),n._authenticationCompleteTimeStamp=(new Date).getTime(),n._endTimeStamp=(new Date).getTime(),n._sendWAMProfileEvent("Failure"),n._sendStateEvent(h.states.serviceAuthenticationFailure),n.disconnect("authenticationFailure"))}),this.authenticationTimedout.bind(this),i.authenticationTimeout)}else this._logger.info("WAMInterface","connectionEstablished","Server URL:".concat(this._wamURL," for ").concat(t)),this._isConnected=!0,this._sendStateEvent(h.states.serviceConnectionSuccess),this._socketInterfaceObj.receiveMessage(s.onDisconnection,this.disconnect.bind(this)),this._socketInterfaceObj.receiveMessage(s.onClose,this.messageClose.bind(this)),this._socketInterfaceObj.sendMessage(s.registerClient,{connection:{userId:this._userID,deviceId:this._deviceID,clientInfo:{id:this._clientGuid,clientType:r.engine,listenTo:[r.ui]}}},this.clientRegistered.bind(this),this.registrationTimedout.bind(this),i.registrationTimeout),this._sendStateEvent(h.states.serviceRegistrationAttempt)}},{key:"connectionFailed",value:function(e,t){this._logger.warn("WAMInterface","connectionFailed","Connection to WAM server failed at: ".concat(this._wamURL," for ").concat(t)),this._endTimeStamp=(new Date).getTime(),this._sendWAMProfileEvent("Failure"),t===s.onReconnectionFail&&this.disconnect("reconnectionFailed:".concat(JSON.stringify(e)))}},{key:"connectionError",value:function(e,t){this._logger.warn("WAMInterface","connectionError","Connection Failed with error:".concat(JSON.stringify(e)," for ").concat(t))}},{key:"connectionTimedOut",value:function(e,t){this._logger.warn("WAMInterface","connectionTimedOut","Connection Timedout for ".concat(t))}},{key:"connectionTimedOutAfterReconnection",value:function(e){this._logger.warn("WAMInterface","connectionTimedOutAfterReconnection","Connection Timedout for ".concat(e)),this._endTimeStamp=(new Date).getTime(),this._sendWAMProfileEvent("Failure"),this.disconnect("handShakeTimedout")}},{key:"reconnectionAttempt",value:function(e){this._logger.debug("WAMInterface","reconnectionAttempt","Attempting reconnection: ".concat(e))}},{key:"messageReceived",value:function(e,t){if(this._logger.info("WAMInterface","messageReceived","Message Received:".concat(t," with data:").concat(JSON.stringify(e))),e&&"object"===P(e)&&e.messages&&e.messages.constructor==Array){var n,o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,r=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw r}}}}(e.messages);try{for(o.s();!(n=o.n()).done;){var i=n.value,r=new T(this._logger);if(r.initializeMessage(i)&&r.validateUserContext(this._userID)){var a=r.extract();""!==a.clientSubType&&(this._clientSubType=a.clientSubType);var u=JSON.stringify(a);if(this._logger.info("WAMInterface","messageReceived","Sending messageType:".concat(r.msgType," with data:").concat(u," to native handler..")),r.msgType==c.command)this._ccHomeExternalGateway.sendMessageToApplet(p.command,a,l.AppsPanelBL,l.AppsPanelBLVersion),this._sendStateEvent(h.states.commandReceived),this._logger.info("WAMInterface","messageReceived","CommandRecieved");else if(r.msgType==c.confirmation){this._ccHomeExternalGateway.sendMessageToApplet(p.confirmation,a,l.AppsPanelBL,l.AppsPanelBLVersion),this._sendStateEvent(h.states.confirmationReceived);var f={data:{response:{status:{status:"closeConfirmation",confirmationDetails:{confirmationID:a.confirmationID}}}}};this.sendStatus(f)}else r.msgType==c.deepLink?(a.endpoint="wam",this._ccHomeExternalGateway.sendMessageToApplet(p.handleDeepLinking,a,l.ContainerBL,l.ContainerBLVersion),this._sendStateEvent(h.states.deepLinkRequestReceived),this._logger.info("WAMInterface ","messageReceived ","DeepLinkRecieved")):r.msgType==c.dataRequest?(a.endpoint="wam",a.request===s.sendUmiDetails&&(this._ccHomeExternalGateway.sendMessageToApplet(p.getUmiData,a,l.ContainerBL,l.ContainerBLVersion),this._sendStateEvent(h.states.umiDetailsRequestReceived)),this._logger.info("WAMInterface ","messageReceived ","DataRequestReceived")):this._logger.warn("WAMInterface","messageReceived","Invalid messageType:".concat(r.msgType," with data:").concat(JSON.stringify(r.extract())," to AppsAdaptor."))}else this._logger.warn("WAMInterface","messageReceived","Ignoring message")}}catch(e){o.e(e)}finally{o.f()}this._socketInterfaceObj.restartTimerForReceiveMessage(t)}else this._logger.warn("WAMInterface","messageReceived","Ignoring the invalid message array received from client")}},{key:"messageError",value:function(e){this._logger.error("WAMInterface","messageError","Communication Failed with error: ".concat(JSON.stringify(e))),this.disconnect("messageError:".concat(JSON.stringify(e)))}},{key:"messageTimedout",value:function(){this._logger.error("WAMInterface","messageTimeout","No message received."),this.disconnect("messageTimedout")}},{key:"messageClose",value:function(){this._logger.error("WAMInterface","messageClose","Close message received"),this.disconnect("messageClose")}},{key:"stateChanged",value:function(e){if(this._logger.debug("WAMInterface","stateChanged","Received State:".concat(JSON.stringify(e))),e&&e.clientStates&&e.clientStates.constructor==Array)for(var t=e.clientStates.length,n=0;n<t;n+=1){var o=e.clientStates[n];o.clientType===r.ui&&o.clientId&&(o.connected&&-1===this._connectedUIClients.indexOf(o.clientId)?(this._logger.info("WAMInterface","stateChanged","New UI Client connected:".concat(JSON.stringify(e))),this._connectedUIClients.push(o.clientId),this._sendStateEvent(h.states.clientAdded)):o.connected||-1===this._connectedUIClients.indexOf(o.clientId)||(this._logger.info("WAMInterface","stateChanged","UI client disconnected:".concat(JSON.stringify(e))),this._connectedUIClients.splice(this._connectedUIClients.indexOf(o.clientId),1),this._sendStateEvent(h.states.clientRemoved)))}0===this._connectedUIClients.length&&(this._logger.info("WAMInterface","stateChanged","All UI clients disconnected. Initiating Disconnect"),this.disconnect("uiDisconnected")),this._logger.debug("WAMInterface","stateChanged","End of clientStateChanged")}},{key:"clientRegistered",value:function(e){this._logger.info("WAMInterface","clientRegistered","Client registration successfull with response:".concat(JSON.stringify(e))),this._clientRegisteredTimeStamp=(new Date).getTime(),this._socketInterfaceObj.receiveMessage(s.onMessage,this.messageReceived.bind(this),this.messageTimedout.bind(this),i.messageTimeout),this._socketInterfaceObj.receiveMessage(s.onUIStateChange,this.stateChanged.bind(this)),this._ccHomeExternalGateway.sendMessageToApplet(p.ccHomeConnected,"",l.AppsPanelBL,l.AppsPanelBLVersion),this._ccHomeExternalGateway.sendMessageToContainer(p.sendAnalytics,{eventCode:h.connected,eventParamData:{eventParam:[]}}),this._sendStateEvent(h.states.serviceRegistrationSuccess)}},{key:"registrationTimedout",value:function(){this._logger.error("WAMInterface","registrationTimedout","Client registration timedout"),this._sendStateEvent(h.states.serviceRegistrationFailed),this._endTimeStamp=(new Date).getTime(),this._sendWAMProfileEvent("Failure"),this.disconnect("registrationTimedout")}},{key:"authenticationTimedout",value:function(){this._logger.error("WAMInterface","authenticationTimedout","Client Autehntication timedout"),this._sendStateEvent(h.states.serviceAuthenticationFailure),this._endTimeStamp=(new Date).getTime(),this._sendWAMProfileEvent("Failure"),this.disconnect("authenticationTimedout")}},{key:"sendCurrentDeviceSuccessful",value:function(e){this._logger.info("WAMInterface","sendCurrentDeviceSuccessful","Client re-registration successfull with response:".concat(JSON.stringify(e))),this._ccHomeExternalGateway.sendMessageToApplet(p.ccHomeConnected,"",l.AppsPanelBL,l.AppsPanelBLVersion)}},{key:"statusSendSuccessful",value:function(e){this._logger.debug("WAMInterface","statusSendSuccessful","clientState successfull response: ".concat(JSON.stringify(e)))}},{key:"sendUmiDetailsSuccessful",value:function(e){this._logger.info("WAMInterface","sendUmiDetailsSuccessful","response: ".concat(JSON.stringify(e)))}},{key:"connect",value:function(e){return this._logger.info("WAMInterface","connect","Connecting with WAM service"),this._sendStateEvent(h.states.serviceConnectionAttempt),this._validateConnectionParams(e)?!0===this._isConnected?(this._logger.debug("WAMInterface","connect","Client already connected. Sending sendCurrentDevice"),this._logger.debug("WAMInterface","connect","Sending device id, requested workflow is: ".concat(e.data.wamVersion)),this._socketInterfaceObj.sendMessage(s.sendCurrentDevice,{channelGuid:e.data.deviceId,workflow:e.data.wamVersion},this.sendCurrentDeviceSuccessful.bind(this)),this._sendStateEvent(h.states.serviceConnectionSuccess,h.reasonCodes.multipleConnectionSuccess),!0):null!=this._socketInterfaceObj?(this._logger.debug("WAMInterface","connect","Connection attempt in progress. Ignoring new request."),this._sendStateEvent(h.states.serviceConnectionIgnored,h.reasonCodes.connectionInProgress),!0):(this.setWAMProfileDefault(),this._startTimeStamp=(new Date).getTime(),this._sendWamProfileEvent=!0,this._setConnectionData(e.data),this._socketInterfaceObj=new b(this._logger),"v2"==this._wamVersion?(this._logger.info("WAMInterface","connect","in V2 version"),this._socketInterfaceObj.connect(this._wamURL,{path:"/v2/ws",transports:["websocket"],timeout:i.perConnectionTimeout,reconnection:a.shouldReconnect,reconnectionAttempts:a.reconnectionAttempts,query:{api_key:this._apiKey}})):(this._logger.info("WAMInterface","connect","in V1 version"),this._socketInterfaceObj.connect(this._wamURL,{path:"/v1",timeout:i.perConnectionTimeout,reconnection:a.shouldReconnect,reconnectionAttempts:a.reconnectionAttempts,query:{api_key:this._apiKey},transportOptions:{polling:{extraHeaders:{Authorization:"Bearer ".concat(this._accessToken),"X-Adobe-App-Id":this._appID}}}})),this._socketInterfaceObj.receiveMessage(s.onConnection,this.connectionEstablished.bind(this),this.connectionTimedOutAfterReconnection.bind(this),i.totalConnectionTimeout),this._socketInterfaceObj.receiveMessage(s.onConnectionError,this.connectionError.bind(this)),this._socketInterfaceObj.receiveMessage(s.onConnectionFail,this.connectionFailed.bind(this)),this._socketInterfaceObj.receiveMessage(s.onConnectionTimeout,this.connectionTimedOut.bind(this)),this._socketInterfaceObj.receiveMessage(s.onReconnectionFail,this.connectionFailed.bind(this)),this._socketInterfaceObj.receiveMessage(s.onReconnectionAttempt,this.reconnectionAttempt.bind(this)),this._socketInterfaceObj.receiveMessage(s.onError,this.messageError.bind(this)),!0):(this._logger.error("WAMInterface","connect","invalid params"),this._sendStateEvent(h.states.serviceConnectionFailed,h.reasonCodes.invalidParams),!1)}},{key:"disconnect",value:function(e){if(this._logger.info("WAMInterface","disconnect","Disconnecting socket interface. Initiated by:".concat(e)),"io client disconnect"!==e)return this._socketInterfaceObj&&"object"===P(this._socketInterfaceObj)&&(this._socketInterfaceObj.disconnect(),this._ccHomeExternalGateway.sendMessageToApplet(p.ccHomeDisconnected,"",l.AppsPanelBL,l.AppsPanelBLVersion),this._ccHomeExternalGateway.sendMessageToContainer(p.sendAnalytics,{eventCode:h.disconnected,eventParamData:{eventParam:[]}}),this._sendStateEvent(h.states.serviceDisconnection,e)),this._logger.info("WAMInterface","disconnect","Connection with WAM service has been closed by ".concat(e)),this._socketInterfaceObj=null,this._setConnectionData(),this.setWAMProfileDefault(),!0;this._logger.info("WAMInterface","disconnect","Ignoring disconnect callback as it is client initiated")}},{key:"sendStatus",value:function(e){if(!1===this._isConnected)return this._logger.error("WAMInterface","sendStatus","No connection with WAM service"),!1;var t=new O(this._logger);if(this._logger.info("WAMInterface","sendStatus","device id:".concat(this._deviceID)),t.initializeMessage(this._userID,this._deviceID,e.data.response)){var n=t.extract(),o=JSON.stringify(n),i=JSON.stringify(t._status);if(this._lastStatusMessage&&this._lastStatusMessage===i&&!t._shouldSendForcefully)return void this._logger.warn("WAMInterface","sendStatus","Ignoring status:".concat(t._status.status," with data:").concat(o));this._lastStatusMessage=i,this._logger.info("WAMInterface","sendStatus","Sending status:".concat(t._status.status," with data:").concat(o," to AMS.")),!0===this._sendWamProfileEvent&&"getAppsAndServicesList"===t._status.command&&(this._createAppsListCompleteTimestamp=(new Date).getTime(),this._firstGetAppsListStatus=!0),this._socketInterfaceObj.sendMessage(s.sendStatus,n,this.statusSendSuccessful.bind(this)),this._firstGetAppsListStatus&&(this._publishAppsStateCompleteTimestamp=(new Date).getTime(),this._endTimeStamp=this._publishAppsStateCompleteTimestamp,this._sendWAMProfileEvent("Success"),this._firstGetAppsListStatus=!1)}else this._endTimeStamp=(new Date).getTime(),this._sendWAMProfileEvent("Failure"),this._logger.error("WAMInterface","sendStatus","Unable to initialize message")}},{key:"sendDataResponse",value:function(e){if(this._logger.info("WAMInterface","sendDataResponse"),!1===this._isConnected)return this._logger.error("WAMInterface","sendDataResponse","No connection with WAM service"),!1;this._logger.info("WAMInterface","sendDataResponse: msg",e);var t=e.message,n=new D(this._logger);if(t===s.sendUmiDetails){if(n.initializeMessage(this._userID,this._deviceID,{data:JSON.parse(e.data),request:s.sendUmiDetails})){var o=n.extract();return this._socketInterfaceObj.sendMessage(s.sendStatus,o,this.sendUmiDetailsSuccessful.bind(this),i.sendUmiDetailsTimeout),this._sendStateEvent(h.states.umiDetailsResponseSent),!0}return this._logger.error("WAMInterface","sendDataResponse: ".concat(s.sendUmiDetails),"Unable to initialize message"),!1}return!1}},{key:"_validateConnectionParams",value:function(e){return!!(e&&"object"===P(e)&&e.data&&"object"===P(e.data)&&e.data.userId&&"string"==typeof e.data.userId&&e.data.deviceId&&"string"==typeof e.data.deviceId&&e.data.clientGuid&&"string"==typeof e.data.clientGuid&&e.data.wamURL&&"string"==typeof e.data.wamURL&&e.data.accessToken&&"string"==typeof e.data.appID&&"string"==typeof e.data["x-api-key"])||(this._logger.error("WAMInterface","_validateConnectionParams","Invalid connection parameters",e),!1)}},{key:"_setConnectionData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._userID=e.userId,this._deviceID=e.deviceId,this._clientGuid=e.clientGuid,this._wamURL=e.wamURL,this._accessToken=e.accessToken,this._appID=e.appID,this._apiKey=e["x-api-key"],this._wamVersion=e.wamVersion,this._userName=e.userName,this._userEmailId=e.userEmailId,this._clientVersion=e.clientVersion,this._clientPlatform=e.clientPlatform,this._isConnected=t,this._clientSubType=null,this._connectedUIClients=[],this._lastStatusMessage=null}},{key:"_sendStateEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this._logger.info("WAMInterface","_sendStateEvent","currState:".concat(e," reasonCode:").concat(t," errorCode:").concat(n));var o={eventCode:h.state,eventParamData:{eventParam:[]}};o.eventParamData.eventParam.push({"@currState":e}),null!=this._clientSubType&&o.eventParamData.eventParam.push({"@clientSubType":this._clientSubType}),this._wamVersion&&o.eventParamData.eventParam.push({"@workflow":this._wamVersion}),""!==t&&o.eventParamData.eventParam.push({"@reasonCode":t}),""!==n&&o.eventParamData.eventParam.push({"@errorCode":n}),this._ccHomeExternalGateway.sendMessageToContainer(p.sendAnalytics,o)}},{key:"_sendWAMProfileEvent",value:function(e){if(this._logger.info("WAMInterface","_sendWAMProfileEvent","status:".concat(e),"sendWamProfile:".concat(this._sendWamProfileEvent)),!0===this._sendWamProfileEvent){this._sendWamProfileEvent=!1;var t=this._endTimeStamp-this._startTimeStamp,n=this._connectCompleteTimeStamp>-1?this._connectCompleteTimeStamp-this._startTimeStamp:-1,o=this._authenticationCompleteTimeStamp>-1?this._authenticationCompleteTimeStamp-this._connectCompleteTimeStamp:-1,i=this._createAppsListCompleteTimestamp>-1&&this._clientRegisteredTimeStamp>-1?this._createAppsListCompleteTimestamp-this._clientRegisteredTimeStamp:-1,r=this._publishAppsStateCompleteTimestamp>-1?this._publishAppsStateCompleteTimestamp-this._createAppsListCompleteTimestamp:-1,s={Id:"v2"===this._wamVersion?this._deviceID:this._userID,Client:"Desktop",SubClient:"CCD",WF:this._wamVersion,Status:e,TotalTimeTaken:t,timestamp:new Date,StepsAndTime:{CCDToWAMConnectTime:n,AuthenticationTime:o,CCDToCreateAppsList:i,CCDToPublishAppsState:r}},a=JSON.stringify(s),c={eventCode:h.state,eventParamData:{eventParam:[]}};c.eventParamData.eventParam.push({"@wamProfileTime":a}),this._ccHomeExternalGateway.sendMessageToContainer(p.sendAnalytics,c)}}}],n&&B(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}function W(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,t){if("object"!==N(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==N(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===N(i)?i:String(i)),o)}var i}var L=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"_preprocess",value:function(e){for(var t=0;t<e.length;++t)"string"==typeof e[t]&&e[t].length>10512&&(e[t]=e[t].substring(0,10512)+".....<Truncated>")}},{key:"getStringFromArgs",value:function(e){for(var t="",n=0;n<e.length;n++)"string"==typeof e[n]?t+=e[n]:e[n]&&(t+=JSON.stringify(e[n]));return t}},{key:"error",value:function(){if(!window.logLevel||0!==window.logLevel){var e=Array.prototype.slice.call(arguments);console.error.apply(console,e);try{window.JSObject?window.JSObject.logError(this.getStringFromArgs(e)):window.app&&window.app.logMessage&&window.app.logMessage(["ERROR",this.getStringFromArgs(e)])}catch(e){}}}},{key:"warn",value:function(){if(window.logLevel&&window.logLevel>=2){var e=Array.prototype.slice.call(arguments);console.warn.apply(console,e);try{window.JSObject?window.JSObject.logWarn(this.getStringFromArgs(e)):window.app&&window.app.logMessage&&window.app.logMessage(["WARN",this.getStringFromArgs(e)])}catch(e){}}}},{key:"log",value:function(){if(window.logLevel&&window.logLevel>=3){var e=Array.prototype.slice.call(arguments);this._preprocess(e),console.trace&&console.trace.apply(console,e);try{window.JSObject?window.JSObject.logInfo(this.getStringFromArgs(e)):window.app&&window.app.logMessage&&window.app.logMessage(["LOG",this.getStringFromArgs(e)])}catch(e){}}}},{key:"info",value:function(){if(window.logLevel&&window.logLevel>=3){var e=Array.prototype.slice.call(arguments);this._preprocess(e),console.trace&&console.trace.apply(console,e);try{window.JSObject?window.JSObject.logInfo(this.getStringFromArgs(e)):window.app&&window.app.logMessage&&window.app.logMessage(["INFO",this.getStringFromArgs(e)])}catch(e){}}}},{key:"debug",value:function(){if(window.logLevel&&window.logLevel>=4){var e=Array.prototype.slice.call(arguments);this._preprocess(e),console.trace&&console.trace.apply(console,e);try{window.JSObject?window.JSObject.logDebug(this.getStringFromArgs(e)):window.app&&window.app.logMessage&&window.app.logMessage(["DEBUG",this.getStringFromArgs(e)])}catch(e){}}}},{key:"trace",value:function(){if(window.logLevel&&window.logLevel>=5){var e=Array.prototype.slice.call(arguments);this._preprocess(e),console.trace&&console.trace.apply(console,e);try{window.JSObject?window.JSObject.logTrace(this.getStringFromArgs(e)):window.app&&window.app.logMessage&&window.app.logMessage(["TRACE",this.getStringFromArgs(e)])}catch(e){}}}}],n&&W(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),U=new L;function q(e){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(e)}function z(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,t){if("object"!==q(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==q(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===q(i)?i:String(i)),o)}var i}var V=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._logger=U}var t,n;return t=e,n=[{key:"getStringFromArgs",value:function(e){for(var t="WAMClient",n=0;n<e.length;n+=1)"string"==typeof e[n]?t="".concat(t," | ").concat(e[n]):t+=JSON.stringify(e[n]);return t}},{key:"error",value:function(){var e=Array.prototype.slice.call(arguments);this._logger.error(this.getStringFromArgs(e))}},{key:"warn",value:function(){var e=Array.prototype.slice.call(arguments);this._logger.warn(this.getStringFromArgs(e))}},{key:"log",value:function(){var e=Array.prototype.slice.call(arguments);this._logger.info(this.getStringFromArgs(e))}},{key:"info",value:function(){var e=Array.prototype.slice.call(arguments);this._logger.info(this.getStringFromArgs(e))}},{key:"debug",value:function(){var e=Array.prototype.slice.call(arguments);this._logger.debug(this.getStringFromArgs(e))}},{key:"trace",value:function(){var e=Array.prototype.slice.call(arguments);this._logger.trace(this.getStringFromArgs(e))}}],n&&z(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}function J(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,t){if("object"!==H(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==H(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===H(i)?i:String(i)),o)}var i}function G(){return G="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=X(e)););return e}(e,t);if(o){var i=Object.getOwnPropertyDescriptor(o,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},G.apply(this,arguments)}function K(e,t){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},K(e,t)}function X(e){return X=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},X(e)}var $=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&K(e,t)}(s,e);var t,n,o,i,r=(o=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=X(o);if(i){var n=X(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===H(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function s(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(e=r.call(this))._wamInterface=null,e._logger=null,e}return t=s,(n=[{key:"initialize",value:function(e){G(X(s.prototype),"initialize",this).call(this,e),this._logger=new V,this._wamInterface=new j(this),this._logger.info("JS Module load: WAMClient: version: 6.1.0"),this._logger.info("CCHomeExternalGateway","initialize","CCHomeExternalGateway initialized")}},{key:"handleMessage",value:function(e){var t=e.message;switch(t){case"connect":return this._logger.info("CCHomeExternalGateway","handleMessage","Received Message:".concat(t)),this._wamInterface.connect(e);case"disconnect":return this._logger.info("CCHomeExternalGateway","handleMessage","Received Message:".concat(t)),this._wamInterface.disconnect("Native");case"status":return this._logger.info("CCHomeExternalGateway","handleMessage","Status:",JSON.stringify(e)),this._wamInterface.sendStatus(e);case"umiDetails":return this._logger.info("CCHomeExternalGateway","handleMessage","Received Message:".concat(t)),this._wamInterface.sendDataResponse(e);default:return!1}}},{key:"finalize",value:function(e){G(X(s.prototype),"finalize",this).call(this,e),this._logger.debug("CCHomeExternalGateway","finalize","CCHomeExternalGateway finalized")}}])&&J(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(o);window.WAMClient=function(){return window.WAMClientObject||(window.WAMClientObject=new $),window.WAMClientObject}}()}();