/*! * Engine.IO v4.0.4 * (c) 2014-2020 Guillermo Rauch * Released under the MIT License. */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.eio=e():t.eio=e()}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")(),(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=11)}([function(t,e,r){var n=r(15),o=r(16),i=String.fromCharCode(30);t.exports={protocol:4,encodePacket:n,encodePayload:function(t,e){var r=t.length,o=new Array(r),s=0;t.forEach((function(t,a){n(t,!1,(function(t){o[a]=t,++s===r&&e(o.join(i))}))}))},decodePacket:o,decodePayload:function(t,e){for(var r=t.split(i),n=[],s=0;s0);return e}function c(){var t=u(+new Date);return t!==n?(s=0,n=t):t+"."+u(s++)}for(;a<64;a++)i[o[a]]=a;c.encode=u,c.decode=function(t){var e=0;for(a=0;a1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return i(this,e),r=a(this,u(e).call(this)),t&&"object"===o(t)&&(s=t,t=null),t?(t=h(t),s.hostname=t.host,s.secure="https"===t.protocol||"wss"===t.protocol,s.port=t.port,t.query&&(s.query=t.query)):s.host&&(s.hostname=h(s.host).host),r.secure=null!=s.secure?s.secure:"undefined"!=typeof location&&"https:"===location.protocol,s.hostname&&!s.port&&(s.port=r.secure?"443":"80"),r.hostname=s.hostname||("undefined"!=typeof location?location.hostname:"localhost"),r.port=s.port||("undefined"!=typeof location&&location.port?location.port:r.secure?443:80),r.transports=s.transports||["polling","websocket"],r.readyState="",r.writeBuffer=[],r.prevBufferLen=0,r.opts=n({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,jsonp:!0,timestampParam:"t",policyPort:843,rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{}},s),r.opts.path=r.opts.path.replace(/\/$/,"")+"/","string"==typeof r.opts.query&&(r.opts.query=y.decode(r.opts.query)),r.id=null,r.upgrades=null,r.pingInterval=null,r.pingTimeout=null,r.pingTimeoutTimer=null,r.open(),r}var r,f,d;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,t),r=e,(f=[{key:"createTransport",value:function(t){var e=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}(this.opts.query);e.EIO=l.protocol,e.transport=t,this.id&&(e.sid=this.id);var r=n({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new p[t](r)}},{key:"open",value:function(){var t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var r=this;return void setTimeout((function(){r.emit("error","No transports available")}),0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}},{key:"setTransport",value:function(t){var e=this;this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",(function(){e.onDrain()})).on("packet",(function(t){e.onPacket(t)})).on("error",(function(t){e.onError(t)})).on("close",(function(){e.onClose("transport close")}))}},{key:"probe",value:function(t){var r=this.createTransport(t,{probe:1}),n=!1,o=this;function i(){if(o.onlyBinaryUpgrades){var t=!this.supportsBinary&&o.transport.supportsBinary;n=n||t}n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(function(t){if(!n)if("pong"===t.type&&"probe"===t.data){if(o.upgrading=!0,o.emit("upgrading",r),!r)return;e.priorWebsocketSuccess="websocket"===r.name,o.transport.pause((function(){n||"closed"!==o.readyState&&(f(),o.setTransport(r),r.send([{type:"upgrade"}]),o.emit("upgrade",r),r=null,o.upgrading=!1,o.flush())}))}else{var i=new Error("probe error");i.transport=r.name,o.emit("upgradeError",i)}})))}function s(){n||(n=!0,f(),r.close(),r=null)}function a(t){var e=new Error("probe error: "+t);e.transport=r.name,s(),o.emit("upgradeError",e)}function u(){a("transport closed")}function c(){a("socket closed")}function p(t){r&&t.name!==r.name&&s()}function f(){r.removeListener("open",i),r.removeListener("error",a),r.removeListener("close",u),o.removeListener("close",c),o.removeListener("upgrading",p)}e.priorWebsocketSuccess=!1,r.once("open",i),r.once("error",a),r.once("close",u),this.once("close",c),this.once("upgrading",p),r.open()}},{key:"onOpen",value:function(){if(this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause)for(var t=0,r=this.upgrades.length;t0&&void 0!==arguments[0]?arguments[0]:{};return o(t,{xd:this.xd,xs:this.xs},this.opts),new w(this.uri(),t)}},{key:"doWrite",value:function(t,e){var r=this.request({method:"POST",data:t}),n=this;r.on("success",e),r.on("error",(function(t){n.onError("xhr post error",t)}))}},{key:"doPoll",value:function(){var t=this.request(),e=this;t.on("data",(function(t){e.onData(t)})),t.on("error",(function(t){e.onError("xhr poll error",t)})),this.pollXhr=t}}]),e}(h),w=function(t){function e(t,r){var n;return i(this,e),(n=u(this,c(e).call(this))).opts=r,n.method=r.method||"GET",n.uri=t,n.async=!1!==r.async,n.data=void 0!==r.data?r.data:null,n.create(),n}return p(e,t),a(e,[{key:"create",value:function(){var t=d(this.opts,"agent","enablesXDR","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;var r=this.xhr=new l(t),n=this;try{r.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders)for(var o in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this.opts.extraHeaders[o])}catch(t){}if("POST"===this.method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),this.hasXDR()?(r.onload=function(){n.onLoad()},r.onerror=function(){n.onError(r.responseText)}):r.onreadystatechange=function(){4===r.readyState&&(200===r.status||1223===r.status?n.onLoad():setTimeout((function(){n.onError("number"==typeof r.status?r.status:0)}),0))},r.send(this.data)}catch(t){return void setTimeout((function(){n.onError(t)}),0)}"undefined"!=typeof document&&(this.index=e.requestsCount++,e.requests[this.index]=this)}},{key:"onSuccess",value:function(){this.emit("success"),this.cleanup()}},{key:"onData",value:function(t){this.emit("data",t),this.onSuccess()}},{key:"onError",value:function(t){this.emit("error",t),this.cleanup(!0)}},{key:"cleanup",value:function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=b:this.xhr.onreadystatechange=b,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete e.requests[this.index],this.xhr=null}}},{key:"onLoad",value:function(){var t=this.xhr.responseText;null!==t&&this.onData(t)}},{key:"hasXDR",value:function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR}},{key:"abort",value:function(){this.cleanup()}}]),e}(y);if(w.requestsCount=0,w.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",k);else if("function"==typeof addEventListener){addEventListener("onpagehide"in m?"pagehide":"unload",k,!1)}function k(){for(var t in w.requests)w.requests.hasOwnProperty(t)&&w.requests[t].abort()}t.exports=g,t.exports.Request=w},function(t,e,r){var n=r(8).PACKET_TYPES,o="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),i="function"==typeof ArrayBuffer,s=function(t,e){var r=new FileReader;return r.onload=function(){var t=r.result.split(",")[1];e("b"+t)},r.readAsDataURL(t)};t.exports=function(t,e,r){var a,u=t.type,c=t.data;return o&&c instanceof Blob?e?r(c):s(c,r):i&&(c instanceof ArrayBuffer||(a=c,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer))?e?r(c instanceof ArrayBuffer?c:c.buffer):s(new Blob([c]),r):r(n[u]+(c||""))}},function(t,e,r){var n,o=r(8),i=o.PACKET_TYPES_REVERSE,s=o.ERROR_PACKET;"function"==typeof ArrayBuffer&&(n=r(17));var a=function(t,e){if(n){var r=n.decode(t);return u(r,e)}return{base64:!0,data:t}},u=function(t,e){switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}};t.exports=function(t,e){if("string"!=typeof t)return{type:"message",data:u(t,e)};var r=t.charAt(0);return"b"===r?{type:"message",data:a(t.substring(1),e)}:i[r]?t.length>1?{type:i[r],data:t.substring(1)}:{type:i[r]}:s}},function(t,e){!function(t){"use strict";e.encode=function(e){var r,n=new Uint8Array(e),o=n.length,i="";for(r=0;r>2],i+=t[(3&n[r])<<4|n[r+1]>>4],i+=t[(15&n[r+1])<<2|n[r+2]>>6],i+=t[63&n[r+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(e){var r,n,o,i,s,a=.75*e.length,u=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var p=new ArrayBuffer(a),f=new Uint8Array(p);for(r=0;r>4,f[c++]=(15&o)<<4|i>>2,f[c++]=(3&i)<<6|63&s;return p}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r';r=document.createElement(t)}catch(t){(r=document.createElement("iframe")).name=n.iframeId,r.src="javascript:0"}r.id=n.iframeId,n.form.appendChild(r),n.iframe=r}this.form.action=this.uri(),u(),t=t.replace(h,"\\\n"),this.area.value=t.replace(l,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&a()}:this.iframe.onload=a}},{key:"supportsBinary",get:function(){return!1}}])&&o(r.prototype,p),d&&o(r,d),e}(p);t.exports=d},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r