@mediquo/elements 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/chunks/api-chat-client-1Vz6ZOwp.js +1 -0
  2. package/dist/chunks/{apple-pay-outcomes-DxrMPQqB.js → apple-pay-outcomes-0ozxSHyb.js} +1 -1
  3. package/dist/chunks/{appointment-card-skeleton-CYFfacro.js → appointment-card-skeleton-hglMW7x6.js} +1 -1
  4. package/dist/chunks/{chunk-GZF3YFSX-BzloXkVp.js → chunk-GZF3YFSX-DM-GTqxg.js} +1 -1
  5. package/dist/chunks/{chunk-YTQUGGS3-p18naHsk.js → chunk-YTQUGGS3-DmCGIoFy.js} +1 -1
  6. package/dist/chunks/{documentation-view-CS4Q-UpO.js → documentation-view-geQU8ttU.js} +1 -1
  7. package/dist/chunks/{external-mrLCXx_f.js → external-CJj32K_p.js} +1 -1
  8. package/dist/chunks/{index-yd2JNJSr.js → index-BBUiLb3Y.js} +1 -1
  9. package/dist/chunks/{index-DBMxJ4Dp.js → index-Bx8TWBsk.js} +1 -1
  10. package/dist/chunks/{price-CdF63nRC.js → price-DIhNpS8n.js} +1 -1
  11. package/dist/chunks/{refund-cancel-policy-Bl9qE8wD.js → refund-cancel-policy-BQDnePq9.js} +1 -1
  12. package/dist/chunks/{schemas.d-BEA8Pl6w.d.ts → schemas.d-5CaMrfOq.d.ts} +6 -0
  13. package/dist/env.js +1 -1
  14. package/dist/events.d.ts +46 -1
  15. package/dist/events.js +1 -1
  16. package/dist/i18n.js +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/mq-apple-pay-checkout.js +1 -1
  20. package/dist/mq-appointment-checkout.d.ts +1 -1
  21. package/dist/mq-appointment-checkout.js +1 -1
  22. package/dist/mq-appointment-documentation.js +1 -1
  23. package/dist/mq-chat-room.js +1 -1
  24. package/dist/mq-checkout.js +1 -1
  25. package/dist/mq-dashboard.js +1 -1
  26. package/dist/mq-documents.d.ts +42 -1
  27. package/dist/mq-documents.js +1 -1
  28. package/dist/mq-google-pay-checkout.js +1 -1
  29. package/dist/mq-immediate-videocall-checkout.js +1 -1
  30. package/dist/mq-my-appointments.js +1 -1
  31. package/dist/mq-payment-poller.d.ts +61 -0
  32. package/dist/mq-payment-poller.js +1 -0
  33. package/dist/mq-professional-presence-sync.js +1 -1
  34. package/dist/mq-schedule-success.js +1 -1
  35. package/dist/mq-schedule.d.ts +7 -1
  36. package/dist/mq-schedule.js +1 -1
  37. package/dist/mq-socket-provider.js +1 -1
  38. package/dist/mq-support-chat.js +1 -1
  39. package/dist/mq-terms-and-conditions.js +1 -1
  40. package/dist/mq-unread-count-sync.js +1 -1
  41. package/dist/mq-videocall.js +1 -1
  42. package/dist/react/mq-apple-pay-checkout.js +1 -1
  43. package/dist/react/mq-appointment-checkout.d.ts +1 -1
  44. package/dist/react/mq-appointment-checkout.js +1 -1
  45. package/dist/react/mq-appointment-documentation.js +1 -1
  46. package/dist/react/mq-chat-room.js +1 -1
  47. package/dist/react/mq-checkout.js +1 -1
  48. package/dist/react/mq-dashboard.js +1 -1
  49. package/dist/react/mq-documents-page.d.ts +32 -0
  50. package/dist/react/mq-documents-page.js +2 -0
  51. package/dist/react/mq-documents.d.ts +2 -0
  52. package/dist/react/mq-documents.js +1 -1
  53. package/dist/react/mq-google-pay-checkout.js +1 -1
  54. package/dist/react/mq-immediate-videocall-checkout.js +1 -1
  55. package/dist/react/mq-my-appointments.js +1 -1
  56. package/dist/react/mq-payment-poller.d.ts +33 -0
  57. package/dist/react/mq-payment-poller.js +2 -0
  58. package/dist/react/mq-professional-presence-sync.js +1 -1
  59. package/dist/react/mq-schedule-success.js +1 -1
  60. package/dist/react/mq-schedule.d.ts +1 -1
  61. package/dist/react/mq-schedule.js +1 -1
  62. package/dist/react/mq-socket-provider.js +1 -1
  63. package/dist/react/mq-support-chat.js +1 -1
  64. package/dist/react/mq-terms-and-conditions.js +1 -1
  65. package/dist/react/mq-unread-count-sync.js +1 -1
  66. package/dist/react/mq-videocall.js +1 -1
  67. package/package.json +5 -1
  68. package/dist/chunks/api-chat-client-vbjgaIRV.js +0 -1
@@ -1 +1 @@
1
- import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{e as r}from"./chunks/provide-D2fnEhT2.js";import{S as n,E as o}from"./chunks/chunk-YTQUGGS3-p18naHsk.js";import{l as i}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{a as s,x as a}from"./chunks/lit-element-DiWJYFwC.js";import{n as c}from"./chunks/property-scuRaFcM.js";import{r as u}from"./chunks/state-LQivXIgA.js";import"./chunks/context-provider--AKuwfs9.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-mrLCXx_f.js";function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function h(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var r=function t(){var r=!1;try{r=this instanceof t}catch{}return r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}),r}var f,l,d={exports:{}};function y(){if(l)return f;l=1;var t=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];return f=function(r){var n=r,o=r.indexOf("["),i=r.indexOf("]");-1!=o&&-1!=i&&(r=r.substring(0,o)+r.substring(o,i).replace(/:/g,";")+r.substring(i,r.length));for(var s,a,c=t.exec(r||""),u={},p=14;p--;)u[e[p]]=c[p]||"";return-1!=o&&-1!=i&&(u.source=n,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=function(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");"/"!=e.substr(0,1)&&0!==e.length||n.splice(0,1);"/"==e.substr(e.length-1,1)&&n.splice(n.length-1,1);return n}(0,u.path),u.queryKey=(s=u.query,a={},s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,e,r){e&&(a[e]=r)}),a),u},f}var m,g,v,b,C,w,k={exports:{}},x={exports:{}};function A(){if(g)return m;g=1;var t=1e3,e=60*t,r=60*e,n=24*r,o=365.25*n;function i(t,e,r){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}return m=function(s,a){a=a||{};var c=typeof s;if("string"===c&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(i);if(!s)return;var a=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*e;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(s);if("number"===c&&!1===isNaN(s))return a.long?function(o){return i(o,n,"day")||i(o,r,"hour")||i(o,e,"minute")||i(o,t,"second")||o+" ms"}(s):function(o){if(o>=n)return Math.round(o/n)+"d";if(o>=r)return Math.round(o/r)+"h";if(o>=e)return Math.round(o/e)+"m";if(o>=t)return Math.round(o/t)+"s";return o+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},m}function F(){return v||(v=1,function(t,e){function r(t){var r;function o(){if(o.enabled){var t=o,n=+new Date,i=n-(r||n);t.diff=i,t.prev=r,t.curr=n,r=n;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(r,n){if("%%"===r)return r;c++;var o=e.formatters[n];if("function"==typeof o){var i=s[c];r=o.call(t,i),s.splice(c,1),c--}return r}),e.formatArgs.call(t,s),(o.log||e.log||console.log.bind(console)).apply(t,s)}}return o.namespace=t,o.enabled=e.enabled(t),o.useColors=e.useColors(),o.color=function(t){var r,n=0;for(r in t)n=(n<<5)-n+t.charCodeAt(r),n|=0;return e.colors[Math.abs(n)%e.colors.length]}(t),o.destroy=n,"function"==typeof e.init&&e.init(o),e.instances.push(o),o}function n(){var t=e.instances.indexOf(this);return-1!==t&&(e.instances.splice(t,1),!0)}(e=x.exports=r.debug=r.default=r).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){var r;e.save(t),e.names=[],e.skips=[];var n=("string"==typeof t?t:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(t=n[r].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")));for(r=0;r<e.instances.length;r++){var i=e.instances[r];i.enabled=e.enabled(i.namespace)}},e.enabled=function(t){if("*"===t[t.length-1])return!0;var r,n;for(r=0,n=e.skips.length;r<n;r++)if(e.skips[r].test(t))return!1;for(r=0,n=e.names.length;r<n;r++)if(e.names[r].test(t))return!0;return!1},e.humanize=A(),e.instances=[],e.names=[],e.skips=[],e.formatters={}}(0,x.exports)),x.exports}function B(){return b||(b=1,function(t,e){function r(){var t;try{t=e.storage.debug}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t}(e=k.exports=F()).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(t){var r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),!r)return;var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,n)},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=r,e.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"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+)/)},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.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"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(r())}(0,k.exports)),k.exports}var E,S={},N={exports:{}};function R(){return E||(E=1,function(){function t(e){if(e)return function(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}(e)}N.exports=t,t.prototype.on=t.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},t.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},t.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e)}return this},t.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},t.prototype.hasListeners=function(t){return!!this.listeners(t).length}}()),N.exports}var T,O,P,j,q,D,_={};function L(){if(O)return T;O=1;var t={}.toString;return T=Array.isArray||function(e){return"[object Array]"==t.call(e)}}function M(){if(j)return P;j=1,P=function(n){return t&&Buffer.isBuffer(n)||e&&(n instanceof ArrayBuffer||r(n))};var t="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,e="function"==typeof ArrayBuffer,r=function(t){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer};return P}function U(){if(q)return _;q=1;var t=L(),e=M(),r=Object.prototype.toString,n="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===r.call(Blob),o="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===r.call(File);function i(r,n){if(!r)return r;if(e(r)){var o={_placeholder:!0,num:n.length};return n.push(r),o}if(t(r)){for(var s=new Array(r.length),a=0;a<r.length;a++)s[a]=i(r[a],n);return s}if("object"==typeof r&&!(r instanceof Date)){s={};for(var c in r)s[c]=i(r[c],n);return s}return r}function s(e,r){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<r.length)return r[e.num];throw new Error("illegal attachments")}if(t(e))for(var n=0;n<e.length;n++)e[n]=s(e[n],r);else if("object"==typeof e)for(var o in e)e[o]=s(e[o],r);return e}return _.deconstructPacket=function(t){var e=[],r=t.data,n=t;return n.data=i(r,e),n.attachments=e.length,{packet:n,buffers:e}},_.reconstructPacket=function(t,e){return t.data=s(t.data,e),t.attachments=void 0,t},_.removeBlobs=function(r,i){var s=0,a=r;!function r(c,u,p){if(!c)return c;if(n&&c instanceof Blob||o&&c instanceof File){s++;var h=new FileReader;h.onload=function(){p?p[u]=this.result:a=this.result,--s||i(a)},h.readAsArrayBuffer(c)}else if(t(c))for(var f=0;f<c.length;f++)r(c[f],f,c);else if("object"==typeof c&&!e(c))for(var l in c)r(c[l],l,c)}(a),s||i(a)},_}function I(){return D||(D=1,function(t){var e=B()("socket.io-parser"),r=R(),n=U(),o=L(),i=M();function s(){}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=s,t.Decoder=u;var a=t.ERROR+'"encode error"';function c(r){var n=""+r.type;if(t.BINARY_EVENT!==r.type&&t.BINARY_ACK!==r.type||(n+=r.attachments+"-"),r.nsp&&"/"!==r.nsp&&(n+=r.nsp+","),null!=r.id&&(n+=r.id),null!=r.data){var o=function(t){try{return JSON.stringify(t)}catch(t){return!1}}(r.data);if(!1===o)return a;n+=o}return e("encoded %j as %s",r,n),n}function u(t){this.reconstructor=null,t=t||{},this.opts={maxAttachments:t.maxAttachments||10}}function p(t){this.reconPack=t,this.buffers=[]}s.prototype.encode=function(r,o){(e("encoding packet %j",r),t.BINARY_EVENT===r.type||t.BINARY_ACK===r.type)?function(t,e){function r(t){var r=n.deconstructPacket(t),o=c(r.packet),i=r.buffers;i.unshift(o),e(i)}n.removeBlobs(t,r)}(r,o):o([c(r)])},r(u.prototype),u.prototype.add=function(r){var n;if("string"==typeof r){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=function(r,n){var i=0,s={type:Number(r.charAt(0))};if(null==t.types[s.type])return a="unknown packet type "+s.type,{type:t.ERROR,data:"parser error: "+a};var a;if(t.BINARY_EVENT===s.type||t.BINARY_ACK===s.type){for(var c=i+1;"-"!==r.charAt(++i)&&i!=r.length;);var u=r.substring(c,i);if(u!=Number(u)||"-"!==r.charAt(i))throw new Error("Illegal attachments");var p=Number(u);if(!h(p)||p<0)throw new Error("Illegal attachments");if(p>n)throw new Error("too many attachments");s.attachments=p}if("/"===r.charAt(i+1)){for(c=i+1;++i;){if(","===(l=r.charAt(i)))break;if(i===r.length)break}s.nsp=r.substring(c,i)}else s.nsp="/";var f=r.charAt(i+1);if(""!==f&&Number(f)==f){for(c=i+1;++i;){var l;if(null==(l=r.charAt(i))||Number(l)!=l){--i;break}if(i===r.length)break}s.id=Number(r.substring(c,i+1))}if(r.charAt(++i)){var d=function(t){try{return JSON.parse(t)}catch(t){return!1}}(r.substr(i));if(!function(t,e){switch(t){case 0:return"object"==typeof e;case 1:return void 0===e;case 4:return"string"==typeof e||"object"==typeof e;case 2:case 5:return o(e)&&("string"==typeof e[0]||"number"==typeof e[0]);case 3:case 6:return o(e)}}(s.type,d))throw new Error("invalid payload");s.data=d}return e("decoded %s as %j",r,s),s}(r,this.opts.maxAttachments),t.BINARY_EVENT===n.type||t.BINARY_ACK===n.type?(this.reconstructor=new p(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n)}else{if(!i(r)&&!r.base64)throw new Error("Unknown type: "+r);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(r))&&(this.reconstructor=null,this.emit("decoded",n))}},u.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};var h=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}}(S)),S}var z,H,X,W,J,$={exports:{}},Y={},K={exports:{}};function V(){return X?H:(X=1,H="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")())}function G(){if(J)return W;J=1;var t=function(){if(z)return K.exports;z=1;try{K.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){K.exports=!1}return K.exports}(),e=V();return W=function(r){var n=r.xdomain,o=r.xscheme,i=r.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!n||t))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!o&&i)return new XDomainRequest}catch(t){}if(!n)try{return new(e[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}}var Z,Q,tt,et,rt,nt,ot,it,st,at,ct,ut,pt={exports:{}},ht={};function ft(){return Q||(Q=1,Z=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e}),Z}function lt(){if(nt)return rt;nt=1;var t=function(){if(et)return tt;et=1;var t={}.toString;return tt=Array.isArray||function(e){return"[object Array]"==t.call(e)}}(),e=Object.prototype.toString,r="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===e.call(Blob),n="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===e.call(File);return rt=function e(o){if(!o||"object"!=typeof o)return!1;if(t(o)){for(var i=0,s=o.length;i<s;i++)if(e(o[i]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(o)||"function"==typeof ArrayBuffer&&o instanceof ArrayBuffer||r&&o instanceof Blob||n&&o instanceof File)return!0;if(o.toJSON&&"function"==typeof o.toJSON&&1===arguments.length)return e(o.toJSON(),!0);for(var a in o)if(Object.prototype.hasOwnProperty.call(o,a)&&e(o[a]))return!0;return!1},rt}function dt(){if(ut)return ct;ut=1;var t,e,r,n=String.fromCharCode;function o(t){for(var e,r,n=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(r=t.charCodeAt(o++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--):n.push(e);return n}function i(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function s(t,e){return n(t>>e&63|128)}function a(t,e){if(!(4294967168&t))return n(t);var r="";return 4294965248&t?4294901760&t?4292870144&t||(r=n(t>>18&7|240),r+=s(t,12),r+=s(t,6)):(i(t,e)||(t=65533),r=n(t>>12&15|224),r+=s(t,6)):r=n(t>>6&31|192),r+=n(63&t|128)}function c(){if(r>=e)throw Error("Invalid byte index");var n=255&t[r];if(r++,128==(192&n))return 63&n;throw Error("Invalid continuation byte")}function u(n){var o,s;if(r>e)throw Error("Invalid byte index");if(r==e)return!1;if(o=255&t[r],r++,!(128&o))return o;if(192==(224&o)){if((s=(31&o)<<6|c())>=128)return s;throw Error("Invalid continuation byte")}if(224==(240&o)){if((s=(15&o)<<12|c()<<6|c())>=2048)return i(s,n)?s:65533;throw Error("Invalid continuation byte")}if(240==(248&o)&&(s=(7&o)<<18|c()<<12|c()<<6|c())>=65536&&s<=1114111)return s;throw Error("Invalid UTF-8 detected")}return ct={version:"2.1.2",encode:function(t,e){for(var r=!1!==(e=e||{}).strict,n=o(t),i=n.length,s=-1,c="";++s<i;)c+=a(n[s],r);return c},decode:function(i,s){var a=!1!==(s=s||{}).strict;t=o(i),e=t.length,r=0;for(var c,p=[];!1!==(c=u(a));)p.push(c);return function(t){for(var e,r=t.length,o=-1,i="";++o<r;)(e=t[o])>65535&&(i+=n((e-=65536)>>>10&1023|55296),e=56320|1023&e),i+=n(e);return i}(p)}}}var yt,mt,gt,vt,bt,Ct,wt={};function kt(){if(gt)return mt;gt=1;var t=void 0!==t?t:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,e=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),r=e&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),n=t&&t.prototype.append&&t.prototype.getBlob;function o(t){return t.map(function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var r=new Uint8Array(t.byteLength);r.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=r.buffer}return e}return t})}function i(e,r){r=r||{};var n=new t;return o(e).forEach(function(t){n.append(t)}),r.type?n.getBlob(r.type):n.getBlob()}function s(t,e){return new Blob(o(t),e||{})}return"undefined"!=typeof Blob&&(i.prototype=Blob.prototype,s.prototype=Blob.prototype),mt=e?r?Blob:s:n?i:void 0}function xt(){return vt||(vt=1,function(t){var e,r,n=ft(),o=lt(),i=(it||(it=1,ot=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||0===n)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(r-e),s=e,a=0;s<r;s++,a++)i[a]=o[s];return i.buffer}),ot),s=function(){if(at)return st;function t(){}return at=1,st=function(e,r,n){var o=!1;return n=n||t,i.count=e,0===e?r():i;function i(t,e){if(i.count<=0)throw new Error("after called too many times");--i.count,t?(o=!0,r(t),r=n):0!==i.count||o||r(null,e)}}}(),a=dt();"undefined"!=typeof ArrayBuffer&&(yt||(yt=1,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wt.encode=function(t){var e,n=new Uint8Array(t),o=n.length,i="";for(e=0;e<o;e+=3)i+=r[n[e]>>2],i+=r[(3&n[e])<<4|n[e+1]>>4],i+=r[(15&n[e+1])<<2|n[e+2]>>6],i+=r[63&n[e+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},wt.decode=function(t){var e,n,o,i,s,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),h=new Uint8Array(p);for(e=0;e<c;e+=4)n=r.indexOf(t[e]),o=r.indexOf(t[e+1]),i=r.indexOf(t[e+2]),s=r.indexOf(t[e+3]),h[u++]=n<<2|o>>4,h[u++]=(15&o)<<4|i>>2,h[u++]=(3&i)<<6|63&s;return p}),e=wt);var c="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),u="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),p=c||u;t.protocol=3;var h=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},f=n(h),l={type:"error",data:"parser error"},d=kt();function y(t,e,r){for(var n=new Array(t.length),o=s(t.length,r),i=function(t,r,o){e(r,function(e,r){n[t]=r,o(e,n)})},a=0;a<t.length;a++)i(a,t[a],o)}t.encodePacket=function(e,r,n,o){"function"==typeof r&&(o=r,r=!1),"function"==typeof n&&(o=n,n=null);var i=void 0===e.data?void 0:e.data.buffer||e.data;if("undefined"!=typeof ArrayBuffer&&i instanceof ArrayBuffer)return function(e,r,n){if(!r)return t.encodeBase64Packet(e,n);var o=e.data,i=new Uint8Array(o),s=new Uint8Array(1+o.byteLength);s[0]=h[e.type];for(var a=0;a<i.length;a++)s[a+1]=i[a];return n(s.buffer)}(e,r,o);if(void 0!==d&&i instanceof d)return function(e,r,n){if(!r)return t.encodeBase64Packet(e,n);if(p)return function(e,r,n){if(!r)return t.encodeBase64Packet(e,n);var o=new FileReader;return o.onload=function(){t.encodePacket({type:e.type,data:o.result},r,!0,n)},o.readAsArrayBuffer(e.data)}(e,r,n);var o=new Uint8Array(1);o[0]=h[e.type];var i=new d([o.buffer,e.data]);return n(i)}(e,r,o);if(i&&i.base64)return function(e,r){var n="b"+t.packets[e.type]+e.data.data;return r(n)}(e,o);var s=h[e.type];return void 0!==e.data&&(s+=n?a.encode(String(e.data),{strict:!1}):String(e.data)),o(""+s)},t.encodeBase64Packet=function(e,r){var n,o="b"+t.packets[e.type];if(void 0!==d&&e.data instanceof d){var i=new FileReader;return i.onload=function(){var t=i.result.split(",")[1];r(o+t)},i.readAsDataURL(e.data)}try{n=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];n=String.fromCharCode.apply(null,a)}return o+=btoa(n),r(o)},t.decodePacket=function(e,r,n){if(void 0===e)return l;if("string"==typeof e){if("b"===e.charAt(0))return t.decodeBase64Packet(e.substr(1),r);if(n&&!1===(e=function(t){try{t=a.decode(t,{strict:!1})}catch(t){return!1}return t}(e)))return l;var o=e.charAt(0);return Number(o)==o&&f[o]?e.length>1?{type:f[o],data:e.substring(1)}:{type:f[o]}:l}o=new Uint8Array(e)[0];var s=i(e,1);return d&&"blob"===r&&(s=new d([s])),{type:f[o],data:s}},t.decodeBase64Packet=function(t,r){var n=f[t.charAt(0)];if(!e)return{type:n,data:{base64:!0,data:t.substr(1)}};var o=e.decode(t.substr(1));return"blob"===r&&d&&(o=new d([o])),{type:n,data:o}},t.encodePayload=function(e,r,n){"function"==typeof r&&(n=r,r=null);var i=o(e);if(r&&i)return d&&!p?t.encodePayloadAsBlob(e,n):t.encodePayloadAsArrayBuffer(e,n);if(!e.length)return n("0:");y(e,function(e,n){t.encodePacket(e,!!i&&r,!1,function(t){n(null,function(t){return t.length+":"+t}(t))})},function(t,e){return n(e.join(""))})},t.decodePayload=function(e,r,n){if("string"!=typeof e)return t.decodePayloadAsBinary(e,r,n);var o;if("function"==typeof r&&(n=r,r=null),""===e)return n(l,0,1);for(var i,s,a="",c=0,u=e.length;c<u;c++){var p=e.charAt(c);if(":"===p){if(""===a||a!=(i=Number(a)))return n(l,0,1);if(a!=(s=e.substr(c+1,i)).length)return n(l,0,1);if(s.length){if(o=t.decodePacket(s,r,!1),l.type===o.type&&l.data===o.data)return n(l,0,1);if(!1===n(o,c+i,u))return}c+=i,a=""}else a+=p}return""!==a?n(l,0,1):void 0},t.encodePayloadAsArrayBuffer=function(e,r){if(!e.length)return r(new ArrayBuffer(0));y(e,function(e,r){t.encodePacket(e,!0,!0,function(t){return r(null,t)})},function(t,e){var n=e.reduce(function(t,e){var r;return t+(r="string"==typeof e?e.length:e.byteLength).toString().length+r+2},0),o=new Uint8Array(n),i=0;return e.forEach(function(t){var e="string"==typeof t,r=t;if(e){for(var n=new Uint8Array(t.length),s=0;s<t.length;s++)n[s]=t.charCodeAt(s);r=n.buffer}o[i++]=e?0:1;var a=r.byteLength.toString();for(s=0;s<a.length;s++)o[i++]=parseInt(a[s]);o[i++]=255;for(n=new Uint8Array(r),s=0;s<n.length;s++)o[i++]=n[s]}),r(o.buffer)})},t.encodePayloadAsBlob=function(e,r){y(e,function(e,r){t.encodePacket(e,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var n=new Uint8Array(t.length),o=0;o<t.length;o++)n[o]=t.charCodeAt(o);t=n.buffer,e[0]=0}var i=(t instanceof ArrayBuffer?t.byteLength:t.size).toString(),s=new Uint8Array(i.length+1);for(o=0;o<i.length;o++)s[o]=parseInt(i[o]);if(s[i.length]=255,d){var a=new d([e.buffer,s.buffer,t]);r(null,a)}})},function(t,e){return r(new d(e))})},t.decodePayloadAsBinary=function(e,r,n){"function"==typeof r&&(n=r,r=null);for(var o=e,s=[];o.byteLength>0;){for(var a=new Uint8Array(o),c=0===a[0],u="",p=1;255!==a[p];p++){if(u.length>310)return n(l,0,1);u+=a[p]}o=i(o,2+u.length),u=parseInt(u);var h=i(o,0,u);if(c)try{h=String.fromCharCode.apply(null,new Uint8Array(h))}catch(t){var f=new Uint8Array(h);h="";for(p=0;p<f.length;p++)h+=String.fromCharCode(f[p])}s.push(h),o=i(o,u)}var d=s.length;s.forEach(function(e,o){n(t.decodePacket(e,r,!0),o,d)})}}(ht)),ht}function At(){if(Ct)return bt;Ct=1;var t=xt(),e=R();function r(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.isReactNative=t.isReactNative,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}return bt=r,e(r.prototype),r.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),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(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(e){var r=t.decodePacket(e,this.socket.binaryType);this.onPacket(r)},r.prototype.onPacket=function(t){this.emit("packet",t)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")},bt}var Ft,Bt,Et,St,Nt,Rt={};function Tt(){return Ft||(Ft=1,Rt.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},Rt.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}),Rt}function Ot(){return Et?Bt:(Et=1,Bt=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t})}function Pt(){if(Nt)return St;Nt=1;var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),r={},n=0,o=0;function i(t){var r="";do{r=e[t%64]+r,t=Math.floor(t/64)}while(t>0);return r}function s(){var e=i(+new Date);return e!==t?(n=0,t=e):e+"."+i(n++)}for(;o<64;o++)r[e[o]]=o;return s.encode=i,s.decode=function(t){var e=0;for(o=0;o<t.length;o++)e=64*e+r[t.charAt(o)];return e},St=s}var jt,qt,Dt,_t,Lt,Mt,Ut,It,zt,Ht={exports:{}},Xt={exports:{}};function Wt(){if(qt)return jt;qt=1;var t=1e3,e=60*t,r=60*e,n=24*r,o=365.25*n;function i(t,e,r){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}return jt=function(s,a){a=a||{};var c=typeof s;if("string"===c&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(i);if(!s)return;var a=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*e;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(s);if("number"===c&&!1===isNaN(s))return a.long?function(o){return i(o,n,"day")||i(o,r,"hour")||i(o,e,"minute")||i(o,t,"second")||o+" ms"}(s):function(o){if(o>=n)return Math.round(o/n)+"d";if(o>=r)return Math.round(o/r)+"h";if(o>=e)return Math.round(o/e)+"m";if(o>=t)return Math.round(o/t)+"s";return o+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},jt}function Jt(){return Dt||(Dt=1,function(t,e){function r(t){var r;function o(){if(o.enabled){var t=o,n=+new Date,i=n-(r||n);t.diff=i,t.prev=r,t.curr=n,r=n;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(r,n){if("%%"===r)return r;c++;var o=e.formatters[n];if("function"==typeof o){var i=s[c];r=o.call(t,i),s.splice(c,1),c--}return r}),e.formatArgs.call(t,s),(o.log||e.log||console.log.bind(console)).apply(t,s)}}return o.namespace=t,o.enabled=e.enabled(t),o.useColors=e.useColors(),o.color=function(t){var r,n=0;for(r in t)n=(n<<5)-n+t.charCodeAt(r),n|=0;return e.colors[Math.abs(n)%e.colors.length]}(t),o.destroy=n,"function"==typeof e.init&&e.init(o),e.instances.push(o),o}function n(){var t=e.instances.indexOf(this);return-1!==t&&(e.instances.splice(t,1),!0)}(e=Xt.exports=r.debug=r.default=r).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){var r;e.save(t),e.names=[],e.skips=[];var n=("string"==typeof t?t:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(t=n[r].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")));for(r=0;r<e.instances.length;r++){var i=e.instances[r];i.enabled=e.enabled(i.namespace)}},e.enabled=function(t){if("*"===t[t.length-1])return!0;var r,n;for(r=0,n=e.skips.length;r<n;r++)if(e.skips[r].test(t))return!1;for(r=0,n=e.names.length;r<n;r++)if(e.names[r].test(t))return!0;return!1},e.humanize=Wt(),e.instances=[],e.names=[],e.skips=[],e.formatters={}}(0,Xt.exports)),Xt.exports}function $t(){return _t||(_t=1,function(t,e){function r(){var t;try{t=e.storage.debug}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t}(e=Ht.exports=Jt()).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(t){var r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),!r)return;var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,n)},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=r,e.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"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+)/)},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.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"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(r())}(0,Ht.exports)),Ht.exports}function Yt(){if(Mt)return Lt;Mt=1;var t=At(),e=Tt(),r=xt(),n=Ot(),o=Pt(),i=$t()("engine.io-client:polling");Lt=a;var s=null!=new(G())({xdomain:!1}).responseType;function a(e){var r=e&&e.forceBase64;s&&!r||(this.supportsBinary=!1),t.call(this,e)}return n(a,t),a.prototype.name="polling",a.prototype.doOpen=function(){this.poll()},a.prototype.pause=function(t){var e=this;function r(){i("paused"),e.readyState="paused",t()}if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(i("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){i("pre-pause polling complete"),--n||r()})),this.writable||(i("we are currently writing - waiting to pause"),n++,this.once("drain",function(){i("pre-pause writing complete"),--n||r()}))}else r()},a.prototype.poll=function(){i("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},a.prototype.onData=function(t){var e=this;i("polling got data %s",t);r.decodePayload(t,this.socket.binaryType,function(t,r,n){if("opening"===e.readyState&&"open"===t.type&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():i('ignoring poll - transport state "%s"',this.readyState))},a.prototype.doClose=function(){var t=this;function e(){i("writing close packet"),t.write([{type:"close"}])}"open"===this.readyState?(i("transport open - closing"),e()):(i("transport not open - deferring close"),this.once("open",e))},a.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};r.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,n)})},a.prototype.uri=function(){var t=this.query||{},r=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(t[this.timestampParam]=o()),this.supportsBinary||t.sid||(t.b64=1),t=e.encode(t),this.port&&("https"===r&&443!==Number(this.port)||"http"===r&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t),r+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t},Lt}var Kt,Vt,Gt,Zt,Qt,te,ee,re,ne=h(Object.freeze({__proto__:null,default:{}}));function oe(){if(Vt)return Kt;Vt=1;var t,e,r=At(),n=xt(),o=Tt(),i=Ot(),s=Pt(),a=$t()("engine.io-client:websocket");if("undefined"!=typeof WebSocket?t=WebSocket:"undefined"!=typeof self&&(t=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{e=ne}catch(t){}var c=t||e;function u(n){n&&n.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=n.perMessageDeflate,this.usingBrowserWebSocket=t&&!n.forceNode,this.protocols=n.protocols,this.usingBrowserWebSocket||(c=e),r.call(this,n)}return Kt=u,i(u,r),u.prototype.name="websocket",u.prototype.supportsBinary=!0,u.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={};this.isReactNative||(r.agent=this.agent,r.perMessageDeflate=this.perMessageDeflate,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new c(t,e):new c(t):new c(t,e,r)}catch(t){return this.emit("error",t)}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()}},u.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},u.prototype.write=function(t){var e=this;this.writable=!1;for(var r=t.length,o=0,i=r;o<i;o++)(function(t){n.encodePacket(t,e.supportsBinary,function(n){if(!e.usingBrowserWebSocket){var o={};if(t.options&&(o.compress=t.options.compress),e.perMessageDeflate)("string"==typeof n?Buffer.byteLength(n):n.length)<e.perMessageDeflate.threshold&&(o.compress=!1)}try{e.usingBrowserWebSocket?e.ws.send(n):e.ws.send(n,o)}catch(t){a("websocket closed before onclose event")}--r||s()})})(t[o]);function s(){e.emit("flush"),setTimeout(function(){e.writable=!0,e.emit("drain")},0)}},u.prototype.onClose=function(){r.prototype.onClose.call(this)},u.prototype.doClose=function(){void 0!==this.ws&&(this.ws.onerror=function(){},this.ws.close())},u.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";return this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=s()),this.supportsBinary||(t.b64=1),(t=o.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+t},u.prototype.check=function(){return!(!c||"__initialize"in c&&this.name===u.prototype.name)},Kt}function ie(){if(Gt)return Y;Gt=1;var t=G(),e=function(){if(Ut)return pt.exports;Ut=1;var t=G(),e=Yt(),r=R(),n=Ot(),o=$t()("engine.io-client:polling-xhr"),i=V();function s(){}function a(t){if(e.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,"undefined"!=typeof location){var r="https:"===location.protocol,n=location.port;n||(n=r?443:80),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||n!==t.port,this.xs=t.secure!==r}}function c(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}pt.exports=a,pt.exports.Request=c,n(a,e),a.prototype.supportsBinary=!0,a.prototype.request=function(t){return(t=t||{}).uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new c(t)},a.prototype.doWrite=function(t,e){var r="string"!=typeof t&&void 0!==t,n=this.request({method:"POST",data:t,isBinary:r}),o=this;n.on("success",e),n.on("error",function(t){o.onError("xhr post error",t)}),this.sendXhr=n},a.prototype.doPoll=function(){o("xhr poll");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},r(c.prototype),c.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 r=this.xhr=new t(e),n=this;try{o("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var i in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.extraHeaders[i])}catch(t){}if("POST"===this.method)try{this.isBinary?r.setRequestHeader("Content-type","application/octet-stream"):r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=this.withCredentials),this.requestTimeout&&(r.timeout=this.requestTimeout),this.hasXDR()?(r.onload=function(){n.onLoad()},r.onerror=function(){n.onError(r.responseText)}):r.onreadystatechange=function(){if(2===r.readyState)try{var t=r.getResponseHeader("Content-Type");(n.supportsBinary&&"application/octet-stream"===t||"application/octet-stream; charset=UTF-8"===t)&&(r.responseType="arraybuffer")}catch(t){}4===r.readyState&&(200===r.status||1223===r.status?n.onLoad():setTimeout(function(){n.onError("number"==typeof r.status?r.status:0)},0))},o("xhr data %s",this.data),r.send(this.data)}catch(t){return void setTimeout(function(){n.onError(t)},0)}"undefined"!=typeof document&&(this.index=c.requestsCount++,c.requests[this.index]=this)},c.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},c.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},c.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},c.prototype.cleanup=function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=s:this.xhr.onreadystatechange=s,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete c.requests[this.index],this.xhr=null}},c.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t=("application/octet-stream"===e||"application/octet-stream; charset=UTF-8"===e)&&this.xhr.response||this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},c.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},c.prototype.abort=function(){this.cleanup()},c.requestsCount=0,c.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",u):"function"==typeof addEventListener&&addEventListener("onpagehide"in i?"pagehide":"unload",u,!1));function u(){for(var t in c.requests)c.requests.hasOwnProperty(t)&&c.requests[t].abort()}return pt.exports}(),r=function(){if(zt)return It;zt=1;var t=Yt(),e=Ot(),r=V();It=a;var n,o=/\n/g,i=/\\n/g;function s(){}function a(e){t.call(this,e),this.query=this.query||{},n||(n=r.___eio=r.___eio||[]),this.index=n.length;var o=this;n.push(function(t){o.onData(t)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){o.script&&(o.script.onerror=s)},!1)}return e(a,t),a.prototype.supportsBinary=!1,a.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),t.prototype.doClose.call(this)},a.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},a.prototype.doWrite=function(t,e){var r=this;if(!this.form){var n,s=document.createElement("form"),a=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=c,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}function u(){p(),e()}function p(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(t){r.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+r.iframeId+'">';n=document.createElement(t)}catch(t){(n=document.createElement("iframe")).name=r.iframeId,n.src="javascript:0"}n.id=r.iframeId,r.form.appendChild(n),r.iframe=n}this.form.action=this.uri(),p(),t=t.replace(i,"\\\n"),this.area.value=t.replace(o,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&u()}:this.iframe.onload=u},It}(),n=oe();return Y.polling=function(n){var o=!1,i=!1,s=!1!==n.jsonp;if("undefined"!=typeof location){var a="https:"===location.protocol,c=location.port;c||(c=a?443:80),o=n.hostname!==location.hostname||c!==n.port,i=n.secure!==a}if(n.xdomain=o,n.xscheme=i,"open"in new t(n)&&!n.forceJSONP)return new e(n);if(!s)throw new Error("JSONP disabled");return new r(n)},Y.websocket=n,Y}function se(){if(Qt)return Zt;Qt=1;var t=[].indexOf;return Zt=function(e,r){if(t)return e.indexOf(r);for(var n=0;n<e.length;++n)if(e[n]===r)return n;return-1},Zt}function ae(){return re||(re=1,$.exports=function(){if(ee)return te;ee=1;var t=ie(),e=R(),r=$t()("engine.io-client:socket"),n=se(),o=xt(),i=y(),s=Tt();function a(t,e){if(!(this instanceof a))return new a(t,e);e=e||{},t&&"object"==typeof t&&(e=t,t=null),t?(t=i(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=i(e.host).host),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=s.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=!1!==e.withCredentials,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=!1!==e.perMessageDeflate&&(e.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||void 0,this.key=e.key||void 0,this.passphrase=e.passphrase||void 0,this.cert=e.cert||void 0,this.ca=e.ca||void 0,this.ciphers=e.ciphers||void 0,this.rejectUnauthorized=void 0===e.rejectUnauthorized||e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}return te=a,a.priorWebsocketSuccess=!1,e(a.prototype),a.protocol=o.protocol,a.Socket=a,a.Transport=At(),a.transports=ie(),a.parser=xt(),a.prototype.createTransport=function(e){r('creating transport "%s"',e);var n=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}(this.query);n.EIO=o.protocol,n.transport=e;var i=this.transportOptions[e]||{};return this.id&&(n.sid=this.id),new t[e]({query:n,socket:this,agent:i.agent||this.agent,hostname:i.hostname||this.hostname,port:i.port||this.port,secure:i.secure||this.secure,path:i.path||this.path,forceJSONP:i.forceJSONP||this.forceJSONP,jsonp:i.jsonp||this.jsonp,forceBase64:i.forceBase64||this.forceBase64,enablesXDR:i.enablesXDR||this.enablesXDR,withCredentials:i.withCredentials||this.withCredentials,timestampRequests:i.timestampRequests||this.timestampRequests,timestampParam:i.timestampParam||this.timestampParam,policyPort:i.policyPort||this.policyPort,pfx:i.pfx||this.pfx,key:i.key||this.key,passphrase:i.passphrase||this.passphrase,cert:i.cert||this.cert,ca:i.ca||this.ca,ciphers:i.ciphers||this.ciphers,rejectUnauthorized:i.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:i.perMessageDeflate||this.perMessageDeflate,extraHeaders:i.extraHeaders||this.extraHeaders,forceNode:i.forceNode||this.forceNode,localAddress:i.localAddress||this.localAddress,requestTimeout:i.requestTimeout||this.requestTimeout,protocols:i.protocols||void 0,isReactNative:this.isReactNative})},a.prototype.open=function(){var t;if(this.rememberUpgrade&&a.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.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)},a.prototype.setTransport=function(t){r("setting transport %s",t.name);var e=this;this.transport&&(r("clearing existing transport %s",this.transport.name),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")})},a.prototype.probe=function(t){r('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),n=!1,o=this;function i(){if(o.onlyBinaryUpgrades){var i=!this.supportsBinary&&o.transport.supportsBinary;n=n||i}n||(r('probe transport "%s" opened',t),e.send([{type:"ping",data:"probe"}]),e.once("packet",function(i){if(!n)if("pong"===i.type&&"probe"===i.data){if(r('probe transport "%s" pong',t),o.upgrading=!0,o.emit("upgrading",e),!e)return;a.priorWebsocketSuccess="websocket"===e.name,r('pausing current transport "%s"',o.transport.name),o.transport.pause(function(){n||"closed"!==o.readyState&&(r("changing transport and sending upgrade packet"),f(),o.setTransport(e),e.send([{type:"upgrade"}]),o.emit("upgrade",e),e=null,o.upgrading=!1,o.flush())})}else{r('probe transport "%s" failed',t);var s=new Error("probe error");s.transport=e.name,o.emit("upgradeError",s)}}))}function s(){n||(n=!0,f(),e.close(),e=null)}function c(n){var i=new Error("probe error: "+n);i.transport=e.name,s(),r('probe transport "%s" failed because of error: %s',t,n),o.emit("upgradeError",i)}function u(){c("transport closed")}function p(){c("socket closed")}function h(t){e&&t.name!==e.name&&(r('"%s" works - aborting "%s"',t.name,e.name),s())}function f(){e.removeListener("open",i),e.removeListener("error",c),e.removeListener("close",u),o.removeListener("close",p),o.removeListener("upgrading",h)}a.priorWebsocketSuccess=!1,e.once("open",i),e.once("error",c),e.once("close",u),this.once("close",p),this.once("upgrading",h),e.open()},a.prototype.onOpen=function(){if(r("socket open"),this.readyState="open",a.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){r("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},a.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(r('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else r('packet received with socket readyState "%s"',this.readyState)},a.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},a.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},a.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){r("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},a.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},a.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},a.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(r("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},a.prototype.write=a.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this},a.prototype.sendPacket=function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}},a.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?o():e()}):this.upgrading?o():e()}function e(){t.onClose("forced close"),r("socket closing - telling transport to close"),t.transport.close()}function n(){t.removeListener("upgrade",n),t.removeListener("upgradeError",n),e()}function o(){t.once("upgrade",n),t.once("upgradeError",n)}return this},a.prototype.onError=function(t){r("socket error %j",t),a.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},a.prototype.onClose=function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(r('socket close with reason: "%s"',t),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",t,e),this.writeBuffer=[],this.prevBufferLen=0)},a.prototype.filterUpgrades=function(t){for(var e=[],r=0,o=t.length;r<o;r++)~n(this.transports,t[r])&&e.push(t[r]);return e},te}(),$.exports.parser=xt()),$.exports}var ce,ue,pe,he,fe,le,de,ye,me,ge,ve,be,Ce={exports:{}};function we(){if(he)return pe;return he=1,pe=function(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}}function ke(){if(le)return fe;le=1;var t=[].slice;return fe=function(e,r){if("string"==typeof r&&(r=e[r]),"function"!=typeof r)throw new Error("bind() requires a function");var n=t.call(arguments,2);return function(){return r.apply(e,n.concat(t.call(arguments)))}},fe}function xe(){return de||(de=1,function(t){var e=I(),r=R(),n=(ue||(ue=1,ce=function(t,e){for(var r=[],n=(e=e||0)||0;n<t.length;n++)r[n-e]=t[n];return r}),ce),o=we(),i=ke(),s=B()("socket.io-client:socket"),a=Tt(),c=lt();t.exports=h;var u={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},p=r.prototype.emit;function h(t,e,r){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},r&&r.query&&(this.query=r.query),this.io.autoConnect&&this.open()}r(h.prototype),h.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[o(t,"open",i(this,"onopen")),o(t,"packet",i(this,"onpacket")),o(t,"close",i(this,"onclose"))]}},h.prototype.open=h.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.reconnecting||this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},h.prototype.send=function(){var t=n(arguments);return t.unshift("message"),this.emit.apply(this,t),this},h.prototype.emit=function(t){if(u.hasOwnProperty(t))return p.apply(this,arguments),this;var r=n(arguments),o={type:(void 0!==this.flags.binary?this.flags.binary:c(r))?e.BINARY_EVENT:e.EVENT,data:r,options:{}};return o.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof r[r.length-1]&&(s("emitting packet with ack id %d",this.ids),this.acks[this.ids]=r.pop(),o.id=this.ids++),this.connected?this.packet(o):this.sendBuffer.push(o),this.flags={},this},h.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},h.prototype.onopen=function(){if(s("transport is open - connecting"),"/"!==this.nsp)if(this.query){var t="object"==typeof this.query?a.encode(this.query):this.query;s("sending connect packet with query %s",t),this.packet({type:e.CONNECT,query:t})}else this.packet({type:e.CONNECT})},h.prototype.onclose=function(t){s("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},h.prototype.onpacket=function(t){var r=t.nsp===this.nsp,n=t.type===e.ERROR&&"/"===t.nsp;if(r||n)switch(t.type){case e.CONNECT:this.onconnect();break;case e.EVENT:case e.BINARY_EVENT:this.onevent(t);break;case e.ACK:case e.BINARY_ACK:this.onack(t);break;case e.DISCONNECT:this.ondisconnect();break;case e.ERROR:this.emit("error",t.data)}},h.prototype.onevent=function(t){var e=t.data||[];s("emitting event %j",e),null!=t.id&&(s("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?p.apply(this,e):this.receiveBuffer.push(e)},h.prototype.ack=function(t){var r=this,o=!1;return function(){if(!o){o=!0;var i=n(arguments);s("sending ack %j",i),r.packet({type:c(i)?e.BINARY_ACK:e.ACK,id:t,data:i})}}},h.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(s("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):s("bad ack %s",t.id)},h.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},h.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)p.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},h.prototype.ondisconnect=function(){s("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},h.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},h.prototype.close=h.prototype.disconnect=function(){return this.connected&&(s("performing disconnect (%s)",this.nsp),this.packet({type:e.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},h.prototype.compress=function(t){return this.flags.compress=t,this},h.prototype.binary=function(t){return this.flags.binary=t,this}}(Ce)),Ce.exports}function Ae(){if(ve)return ge;ve=1;var t=ae(),e=xe(),r=R(),n=I(),o=we(),i=ke(),s=B()("socket.io-client:manager"),a=se(),c=function(){if(me)return ye;function t(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}return me=1,ye=t,t.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=1&Math.floor(10*e)?t+r:t-r}return 0|Math.min(t,this.max)},t.prototype.reset=function(){this.attempts=0},t.prototype.setMin=function(t){this.ms=t},t.prototype.setMax=function(t){this.max=t},t.prototype.setJitter=function(t){this.jitter=t},ye}(),u=Object.prototype.hasOwnProperty;function p(t,e){if(!(this instanceof p))return new p(t,e);t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new c({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=e.parser||n;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}return ge=p,p.prototype.emitAll=function(){for(var t in this.emit.apply(this,arguments),this.nsps)u.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},p.prototype.updateSocketIds=function(){for(var t in this.nsps)u.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},p.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},r(p.prototype),p.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},p.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},p.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},p.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},p.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},p.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},p.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},p.prototype.open=p.prototype.connect=function(e,r){if(s("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;s("opening %s",this.uri),this.engine=t(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var a=o(n,"open",function(){i.onopen(),e&&e()}),c=o(n,"error",function(t){if(s("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var r=new Error("Connection error");r.data=t,e(r)}else i.maybeReconnectOnOpen()});if(!1!==this._timeout){var u=this._timeout;s("connect attempt will timeout after %d",u),0===u&&a.destroy();var p=setTimeout(function(){s("connect attempt timed out after %d",u),a.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",u)},u);this.subs.push({destroy:function(){clearTimeout(p)}})}return this.subs.push(a),this.subs.push(c),this},p.prototype.onopen=function(){s("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(o(t,"data",i(this,"ondata"))),this.subs.push(o(t,"ping",i(this,"onping"))),this.subs.push(o(t,"pong",i(this,"onpong"))),this.subs.push(o(t,"error",i(this,"onerror"))),this.subs.push(o(t,"close",i(this,"onclose"))),this.subs.push(o(this.decoder,"decoded",i(this,"ondecoded")))},p.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},p.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},p.prototype.ondata=function(t){this.decoder.add(t)},p.prototype.ondecoded=function(t){this.emit("packet",t)},p.prototype.onerror=function(t){s("error",t),this.emitAll("error",t)},p.prototype.socket=function(t,r){var n=this.nsps[t];if(!n){n=new e(this,t,r),this.nsps[t]=n;var o=this;n.on("connecting",i),n.on("connect",function(){n.id=o.generateId(t)}),this.autoConnect&&i()}function i(){~a(o.connecting,n)||o.connecting.push(n)}return n},p.prototype.destroy=function(t){var e=a(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},p.prototype.packet=function(t){s("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()}))},p.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},p.prototype.cleanup=function(){s("cleanup");for(var t=this.subs.length,e=0;e<t;e++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},p.prototype.close=p.prototype.disconnect=function(){s("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},p.prototype.onclose=function(t){s("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},p.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)s("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();s("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(s("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(s("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(s("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}},p.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)},ge}var Fe=(be||(be=1,function(t,e){var r=function(){if(w)return C;w=1;var t=y(),e=B()("socket.io-client:url");return C=function(r,n){var o=r;n=n||"undefined"!=typeof location&&location,null==r&&(r=n.protocol+"//"+n.host),"string"==typeof r&&("/"===r.charAt(0)&&(r="/"===r.charAt(1)?n.protocol+r:n.host+r),/^(https?|wss?):\/\//.test(r)||(e("protocol-less url %s",r),r=void 0!==n?n.protocol+"//"+r:"https://"+r),e("parse %s",r),o=t(r)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";var i=-1!==o.host.indexOf(":")?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+i+":"+o.port,o.href=o.protocol+"://"+i+(n&&n.port===o.port?"":":"+o.port),o}}(),n=I(),o=Ae(),i=B()("socket.io-client");t.exports=e=a;var s=e.managers={};function a(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,a=r(t),c=a.source,u=a.id,p=a.path,h=s[u]&&p in s[u].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||h?(i("ignoring socket cache for %s",c),n=o(c,e)):(s[u]||(i("new io instance for %s",c),s[u]=o(c,e)),n=s[u]),a.query&&!e.query&&(e.query=a.query),n.socket(a.path,e)}e.protocol=n.protocol,e.connect=a,e.Manager=Ae(),e.Socket=xe()}(d,d.exports)),d.exports),Be=p(Fe),Ee={development:"https://chat-server-dev.mediquo.com",production:"https://chat-server.mediquo.com"},Se=class{constructor(t){this.socket=Be(Ee[t.env],{transports:["websocket"],query:`jwt=${t.accessToken}`,reconnection:!0,reconnectionDelay:5e3,reconnectionDelayMax:5e3,upgrade:!1,secure:!0,autoConnect:!1,forceNew:!0}),this.anyListeners=new Set,this.setupWildcardListener()}setupWildcardListener(){const t=this.socket,e=t.onevent;t.onevent=t=>{e.call(this.socket,t);try{const[e,r]=t.data;for(const t of this.anyListeners)try{t(e,r)}catch(t){i.error(`Error in onAny callback for event "${e}":`,t)}}catch(t){i.error("Wildcard listener error:",t)}}}on(t,e){this.socket.on(t,e)}off(t,e){this.socket.off(t,e)}emit(t,...e){this.socket.emit(t,...e)}onAny(t){this.anyListeners.add(t)}offAny(t){t?this.anyListeners.delete(t):this.anyListeners.clear()}connect(){this.socket.connect()}disconnect(){this.socket.disconnect()}connected(){return this.socket.connected}};let Ne=class SocketProvider extends s{constructor(){super(...arguments),this.socket=void 0}disconnectedCallback(){super.disconnectedCallback(),this.cleanupSocket()}updated(t){super.updated(t),(t.has("env")||t.has("token"))&&(this.cleanupSocket(),this.initializeSocket())}initializeSocket(){this.token?(this.socket=new Se({env:this.env,accessToken:this.token}),this.socket.connect(),this.socket.onAny((t,e)=>{this.dispatchEvent(new o(t,e))})):i.warn("Socket provider: No token provided, socket will not be initialized")}cleanupSocket(){this.socket&&(this.socket.disconnect(),this.socket=void 0)}render(){return a`<slot></slot>`}};t([c({type:String})],Ne.prototype,"env",void 0),t([c({type:String})],Ne.prototype,"token",void 0),t([r({context:n}),u()],Ne.prototype,"socket",void 0),Ne=t([e("mq-socket-provider")],Ne);export{Ne as SocketProvider};
1
+ import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{e as r}from"./chunks/provide-D2fnEhT2.js";import{S as n,E as o}from"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import{l as i}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{a as s,x as a}from"./chunks/lit-element-DiWJYFwC.js";import{n as c}from"./chunks/property-scuRaFcM.js";import{r as u}from"./chunks/state-LQivXIgA.js";import"./chunks/context-provider--AKuwfs9.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-CJj32K_p.js";function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function h(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var r=function t(){var r=!1;try{r=this instanceof t}catch{}return r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}),r}var f,l,d={exports:{}};function y(){if(l)return f;l=1;var t=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];return f=function(r){var n=r,o=r.indexOf("["),i=r.indexOf("]");-1!=o&&-1!=i&&(r=r.substring(0,o)+r.substring(o,i).replace(/:/g,";")+r.substring(i,r.length));for(var s,a,c=t.exec(r||""),u={},p=14;p--;)u[e[p]]=c[p]||"";return-1!=o&&-1!=i&&(u.source=n,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=function(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");"/"!=e.substr(0,1)&&0!==e.length||n.splice(0,1);"/"==e.substr(e.length-1,1)&&n.splice(n.length-1,1);return n}(0,u.path),u.queryKey=(s=u.query,a={},s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,e,r){e&&(a[e]=r)}),a),u},f}var m,g,v,b,C,w,k={exports:{}},x={exports:{}};function A(){if(g)return m;g=1;var t=1e3,e=60*t,r=60*e,n=24*r,o=365.25*n;function i(t,e,r){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}return m=function(s,a){a=a||{};var c=typeof s;if("string"===c&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(i);if(!s)return;var a=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*e;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(s);if("number"===c&&!1===isNaN(s))return a.long?function(o){return i(o,n,"day")||i(o,r,"hour")||i(o,e,"minute")||i(o,t,"second")||o+" ms"}(s):function(o){if(o>=n)return Math.round(o/n)+"d";if(o>=r)return Math.round(o/r)+"h";if(o>=e)return Math.round(o/e)+"m";if(o>=t)return Math.round(o/t)+"s";return o+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},m}function F(){return v||(v=1,function(t,e){function r(t){var r;function o(){if(o.enabled){var t=o,n=+new Date,i=n-(r||n);t.diff=i,t.prev=r,t.curr=n,r=n;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(r,n){if("%%"===r)return r;c++;var o=e.formatters[n];if("function"==typeof o){var i=s[c];r=o.call(t,i),s.splice(c,1),c--}return r}),e.formatArgs.call(t,s),(o.log||e.log||console.log.bind(console)).apply(t,s)}}return o.namespace=t,o.enabled=e.enabled(t),o.useColors=e.useColors(),o.color=function(t){var r,n=0;for(r in t)n=(n<<5)-n+t.charCodeAt(r),n|=0;return e.colors[Math.abs(n)%e.colors.length]}(t),o.destroy=n,"function"==typeof e.init&&e.init(o),e.instances.push(o),o}function n(){var t=e.instances.indexOf(this);return-1!==t&&(e.instances.splice(t,1),!0)}(e=x.exports=r.debug=r.default=r).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){var r;e.save(t),e.names=[],e.skips=[];var n=("string"==typeof t?t:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(t=n[r].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")));for(r=0;r<e.instances.length;r++){var i=e.instances[r];i.enabled=e.enabled(i.namespace)}},e.enabled=function(t){if("*"===t[t.length-1])return!0;var r,n;for(r=0,n=e.skips.length;r<n;r++)if(e.skips[r].test(t))return!1;for(r=0,n=e.names.length;r<n;r++)if(e.names[r].test(t))return!0;return!1},e.humanize=A(),e.instances=[],e.names=[],e.skips=[],e.formatters={}}(0,x.exports)),x.exports}function B(){return b||(b=1,function(t,e){function r(){var t;try{t=e.storage.debug}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t}(e=k.exports=F()).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(t){var r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),!r)return;var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,n)},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=r,e.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"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+)/)},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.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"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(r())}(0,k.exports)),k.exports}var E,S={},N={exports:{}};function R(){return E||(E=1,function(){function t(e){if(e)return function(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}(e)}N.exports=t,t.prototype.on=t.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},t.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},t.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e)}return this},t.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},t.prototype.hasListeners=function(t){return!!this.listeners(t).length}}()),N.exports}var T,O,P,j,q,D,_={};function L(){if(O)return T;O=1;var t={}.toString;return T=Array.isArray||function(e){return"[object Array]"==t.call(e)}}function M(){if(j)return P;j=1,P=function(n){return t&&Buffer.isBuffer(n)||e&&(n instanceof ArrayBuffer||r(n))};var t="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,e="function"==typeof ArrayBuffer,r=function(t){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer};return P}function U(){if(q)return _;q=1;var t=L(),e=M(),r=Object.prototype.toString,n="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===r.call(Blob),o="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===r.call(File);function i(r,n){if(!r)return r;if(e(r)){var o={_placeholder:!0,num:n.length};return n.push(r),o}if(t(r)){for(var s=new Array(r.length),a=0;a<r.length;a++)s[a]=i(r[a],n);return s}if("object"==typeof r&&!(r instanceof Date)){s={};for(var c in r)s[c]=i(r[c],n);return s}return r}function s(e,r){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<r.length)return r[e.num];throw new Error("illegal attachments")}if(t(e))for(var n=0;n<e.length;n++)e[n]=s(e[n],r);else if("object"==typeof e)for(var o in e)e[o]=s(e[o],r);return e}return _.deconstructPacket=function(t){var e=[],r=t.data,n=t;return n.data=i(r,e),n.attachments=e.length,{packet:n,buffers:e}},_.reconstructPacket=function(t,e){return t.data=s(t.data,e),t.attachments=void 0,t},_.removeBlobs=function(r,i){var s=0,a=r;!function r(c,u,p){if(!c)return c;if(n&&c instanceof Blob||o&&c instanceof File){s++;var h=new FileReader;h.onload=function(){p?p[u]=this.result:a=this.result,--s||i(a)},h.readAsArrayBuffer(c)}else if(t(c))for(var f=0;f<c.length;f++)r(c[f],f,c);else if("object"==typeof c&&!e(c))for(var l in c)r(c[l],l,c)}(a),s||i(a)},_}function I(){return D||(D=1,function(t){var e=B()("socket.io-parser"),r=R(),n=U(),o=L(),i=M();function s(){}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=s,t.Decoder=u;var a=t.ERROR+'"encode error"';function c(r){var n=""+r.type;if(t.BINARY_EVENT!==r.type&&t.BINARY_ACK!==r.type||(n+=r.attachments+"-"),r.nsp&&"/"!==r.nsp&&(n+=r.nsp+","),null!=r.id&&(n+=r.id),null!=r.data){var o=function(t){try{return JSON.stringify(t)}catch(t){return!1}}(r.data);if(!1===o)return a;n+=o}return e("encoded %j as %s",r,n),n}function u(t){this.reconstructor=null,t=t||{},this.opts={maxAttachments:t.maxAttachments||10}}function p(t){this.reconPack=t,this.buffers=[]}s.prototype.encode=function(r,o){(e("encoding packet %j",r),t.BINARY_EVENT===r.type||t.BINARY_ACK===r.type)?function(t,e){function r(t){var r=n.deconstructPacket(t),o=c(r.packet),i=r.buffers;i.unshift(o),e(i)}n.removeBlobs(t,r)}(r,o):o([c(r)])},r(u.prototype),u.prototype.add=function(r){var n;if("string"==typeof r){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=function(r,n){var i=0,s={type:Number(r.charAt(0))};if(null==t.types[s.type])return a="unknown packet type "+s.type,{type:t.ERROR,data:"parser error: "+a};var a;if(t.BINARY_EVENT===s.type||t.BINARY_ACK===s.type){for(var c=i+1;"-"!==r.charAt(++i)&&i!=r.length;);var u=r.substring(c,i);if(u!=Number(u)||"-"!==r.charAt(i))throw new Error("Illegal attachments");var p=Number(u);if(!h(p)||p<0)throw new Error("Illegal attachments");if(p>n)throw new Error("too many attachments");s.attachments=p}if("/"===r.charAt(i+1)){for(c=i+1;++i;){if(","===(l=r.charAt(i)))break;if(i===r.length)break}s.nsp=r.substring(c,i)}else s.nsp="/";var f=r.charAt(i+1);if(""!==f&&Number(f)==f){for(c=i+1;++i;){var l;if(null==(l=r.charAt(i))||Number(l)!=l){--i;break}if(i===r.length)break}s.id=Number(r.substring(c,i+1))}if(r.charAt(++i)){var d=function(t){try{return JSON.parse(t)}catch(t){return!1}}(r.substr(i));if(!function(t,e){switch(t){case 0:return"object"==typeof e;case 1:return void 0===e;case 4:return"string"==typeof e||"object"==typeof e;case 2:case 5:return o(e)&&("string"==typeof e[0]||"number"==typeof e[0]);case 3:case 6:return o(e)}}(s.type,d))throw new Error("invalid payload");s.data=d}return e("decoded %s as %j",r,s),s}(r,this.opts.maxAttachments),t.BINARY_EVENT===n.type||t.BINARY_ACK===n.type?(this.reconstructor=new p(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n)}else{if(!i(r)&&!r.base64)throw new Error("Unknown type: "+r);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(r))&&(this.reconstructor=null,this.emit("decoded",n))}},u.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};var h=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}}(S)),S}var z,H,X,W,J,$={exports:{}},Y={},K={exports:{}};function V(){return X?H:(X=1,H="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")())}function G(){if(J)return W;J=1;var t=function(){if(z)return K.exports;z=1;try{K.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){K.exports=!1}return K.exports}(),e=V();return W=function(r){var n=r.xdomain,o=r.xscheme,i=r.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!n||t))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!o&&i)return new XDomainRequest}catch(t){}if(!n)try{return new(e[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}}var Z,Q,tt,et,rt,nt,ot,it,st,at,ct,ut,pt={exports:{}},ht={};function ft(){return Q||(Q=1,Z=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e}),Z}function lt(){if(nt)return rt;nt=1;var t=function(){if(et)return tt;et=1;var t={}.toString;return tt=Array.isArray||function(e){return"[object Array]"==t.call(e)}}(),e=Object.prototype.toString,r="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===e.call(Blob),n="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===e.call(File);return rt=function e(o){if(!o||"object"!=typeof o)return!1;if(t(o)){for(var i=0,s=o.length;i<s;i++)if(e(o[i]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(o)||"function"==typeof ArrayBuffer&&o instanceof ArrayBuffer||r&&o instanceof Blob||n&&o instanceof File)return!0;if(o.toJSON&&"function"==typeof o.toJSON&&1===arguments.length)return e(o.toJSON(),!0);for(var a in o)if(Object.prototype.hasOwnProperty.call(o,a)&&e(o[a]))return!0;return!1},rt}function dt(){if(ut)return ct;ut=1;var t,e,r,n=String.fromCharCode;function o(t){for(var e,r,n=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(r=t.charCodeAt(o++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),o--):n.push(e);return n}function i(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function s(t,e){return n(t>>e&63|128)}function a(t,e){if(!(4294967168&t))return n(t);var r="";return 4294965248&t?4294901760&t?4292870144&t||(r=n(t>>18&7|240),r+=s(t,12),r+=s(t,6)):(i(t,e)||(t=65533),r=n(t>>12&15|224),r+=s(t,6)):r=n(t>>6&31|192),r+=n(63&t|128)}function c(){if(r>=e)throw Error("Invalid byte index");var n=255&t[r];if(r++,128==(192&n))return 63&n;throw Error("Invalid continuation byte")}function u(n){var o,s;if(r>e)throw Error("Invalid byte index");if(r==e)return!1;if(o=255&t[r],r++,!(128&o))return o;if(192==(224&o)){if((s=(31&o)<<6|c())>=128)return s;throw Error("Invalid continuation byte")}if(224==(240&o)){if((s=(15&o)<<12|c()<<6|c())>=2048)return i(s,n)?s:65533;throw Error("Invalid continuation byte")}if(240==(248&o)&&(s=(7&o)<<18|c()<<12|c()<<6|c())>=65536&&s<=1114111)return s;throw Error("Invalid UTF-8 detected")}return ct={version:"2.1.2",encode:function(t,e){for(var r=!1!==(e=e||{}).strict,n=o(t),i=n.length,s=-1,c="";++s<i;)c+=a(n[s],r);return c},decode:function(i,s){var a=!1!==(s=s||{}).strict;t=o(i),e=t.length,r=0;for(var c,p=[];!1!==(c=u(a));)p.push(c);return function(t){for(var e,r=t.length,o=-1,i="";++o<r;)(e=t[o])>65535&&(i+=n((e-=65536)>>>10&1023|55296),e=56320|1023&e),i+=n(e);return i}(p)}}}var yt,mt,gt,vt,bt,Ct,wt={};function kt(){if(gt)return mt;gt=1;var t=void 0!==t?t:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,e=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),r=e&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),n=t&&t.prototype.append&&t.prototype.getBlob;function o(t){return t.map(function(t){if(t.buffer instanceof ArrayBuffer){var e=t.buffer;if(t.byteLength!==e.byteLength){var r=new Uint8Array(t.byteLength);r.set(new Uint8Array(e,t.byteOffset,t.byteLength)),e=r.buffer}return e}return t})}function i(e,r){r=r||{};var n=new t;return o(e).forEach(function(t){n.append(t)}),r.type?n.getBlob(r.type):n.getBlob()}function s(t,e){return new Blob(o(t),e||{})}return"undefined"!=typeof Blob&&(i.prototype=Blob.prototype,s.prototype=Blob.prototype),mt=e?r?Blob:s:n?i:void 0}function xt(){return vt||(vt=1,function(t){var e,r,n=ft(),o=lt(),i=(it||(it=1,ot=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||0===n)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(r-e),s=e,a=0;s<r;s++,a++)i[a]=o[s];return i.buffer}),ot),s=function(){if(at)return st;function t(){}return at=1,st=function(e,r,n){var o=!1;return n=n||t,i.count=e,0===e?r():i;function i(t,e){if(i.count<=0)throw new Error("after called too many times");--i.count,t?(o=!0,r(t),r=n):0!==i.count||o||r(null,e)}}}(),a=dt();"undefined"!=typeof ArrayBuffer&&(yt||(yt=1,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wt.encode=function(t){var e,n=new Uint8Array(t),o=n.length,i="";for(e=0;e<o;e+=3)i+=r[n[e]>>2],i+=r[(3&n[e])<<4|n[e+1]>>4],i+=r[(15&n[e+1])<<2|n[e+2]>>6],i+=r[63&n[e+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},wt.decode=function(t){var e,n,o,i,s,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),h=new Uint8Array(p);for(e=0;e<c;e+=4)n=r.indexOf(t[e]),o=r.indexOf(t[e+1]),i=r.indexOf(t[e+2]),s=r.indexOf(t[e+3]),h[u++]=n<<2|o>>4,h[u++]=(15&o)<<4|i>>2,h[u++]=(3&i)<<6|63&s;return p}),e=wt);var c="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),u="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),p=c||u;t.protocol=3;var h=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},f=n(h),l={type:"error",data:"parser error"},d=kt();function y(t,e,r){for(var n=new Array(t.length),o=s(t.length,r),i=function(t,r,o){e(r,function(e,r){n[t]=r,o(e,n)})},a=0;a<t.length;a++)i(a,t[a],o)}t.encodePacket=function(e,r,n,o){"function"==typeof r&&(o=r,r=!1),"function"==typeof n&&(o=n,n=null);var i=void 0===e.data?void 0:e.data.buffer||e.data;if("undefined"!=typeof ArrayBuffer&&i instanceof ArrayBuffer)return function(e,r,n){if(!r)return t.encodeBase64Packet(e,n);var o=e.data,i=new Uint8Array(o),s=new Uint8Array(1+o.byteLength);s[0]=h[e.type];for(var a=0;a<i.length;a++)s[a+1]=i[a];return n(s.buffer)}(e,r,o);if(void 0!==d&&i instanceof d)return function(e,r,n){if(!r)return t.encodeBase64Packet(e,n);if(p)return function(e,r,n){if(!r)return t.encodeBase64Packet(e,n);var o=new FileReader;return o.onload=function(){t.encodePacket({type:e.type,data:o.result},r,!0,n)},o.readAsArrayBuffer(e.data)}(e,r,n);var o=new Uint8Array(1);o[0]=h[e.type];var i=new d([o.buffer,e.data]);return n(i)}(e,r,o);if(i&&i.base64)return function(e,r){var n="b"+t.packets[e.type]+e.data.data;return r(n)}(e,o);var s=h[e.type];return void 0!==e.data&&(s+=n?a.encode(String(e.data),{strict:!1}):String(e.data)),o(""+s)},t.encodeBase64Packet=function(e,r){var n,o="b"+t.packets[e.type];if(void 0!==d&&e.data instanceof d){var i=new FileReader;return i.onload=function(){var t=i.result.split(",")[1];r(o+t)},i.readAsDataURL(e.data)}try{n=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];n=String.fromCharCode.apply(null,a)}return o+=btoa(n),r(o)},t.decodePacket=function(e,r,n){if(void 0===e)return l;if("string"==typeof e){if("b"===e.charAt(0))return t.decodeBase64Packet(e.substr(1),r);if(n&&!1===(e=function(t){try{t=a.decode(t,{strict:!1})}catch(t){return!1}return t}(e)))return l;var o=e.charAt(0);return Number(o)==o&&f[o]?e.length>1?{type:f[o],data:e.substring(1)}:{type:f[o]}:l}o=new Uint8Array(e)[0];var s=i(e,1);return d&&"blob"===r&&(s=new d([s])),{type:f[o],data:s}},t.decodeBase64Packet=function(t,r){var n=f[t.charAt(0)];if(!e)return{type:n,data:{base64:!0,data:t.substr(1)}};var o=e.decode(t.substr(1));return"blob"===r&&d&&(o=new d([o])),{type:n,data:o}},t.encodePayload=function(e,r,n){"function"==typeof r&&(n=r,r=null);var i=o(e);if(r&&i)return d&&!p?t.encodePayloadAsBlob(e,n):t.encodePayloadAsArrayBuffer(e,n);if(!e.length)return n("0:");y(e,function(e,n){t.encodePacket(e,!!i&&r,!1,function(t){n(null,function(t){return t.length+":"+t}(t))})},function(t,e){return n(e.join(""))})},t.decodePayload=function(e,r,n){if("string"!=typeof e)return t.decodePayloadAsBinary(e,r,n);var o;if("function"==typeof r&&(n=r,r=null),""===e)return n(l,0,1);for(var i,s,a="",c=0,u=e.length;c<u;c++){var p=e.charAt(c);if(":"===p){if(""===a||a!=(i=Number(a)))return n(l,0,1);if(a!=(s=e.substr(c+1,i)).length)return n(l,0,1);if(s.length){if(o=t.decodePacket(s,r,!1),l.type===o.type&&l.data===o.data)return n(l,0,1);if(!1===n(o,c+i,u))return}c+=i,a=""}else a+=p}return""!==a?n(l,0,1):void 0},t.encodePayloadAsArrayBuffer=function(e,r){if(!e.length)return r(new ArrayBuffer(0));y(e,function(e,r){t.encodePacket(e,!0,!0,function(t){return r(null,t)})},function(t,e){var n=e.reduce(function(t,e){var r;return t+(r="string"==typeof e?e.length:e.byteLength).toString().length+r+2},0),o=new Uint8Array(n),i=0;return e.forEach(function(t){var e="string"==typeof t,r=t;if(e){for(var n=new Uint8Array(t.length),s=0;s<t.length;s++)n[s]=t.charCodeAt(s);r=n.buffer}o[i++]=e?0:1;var a=r.byteLength.toString();for(s=0;s<a.length;s++)o[i++]=parseInt(a[s]);o[i++]=255;for(n=new Uint8Array(r),s=0;s<n.length;s++)o[i++]=n[s]}),r(o.buffer)})},t.encodePayloadAsBlob=function(e,r){y(e,function(e,r){t.encodePacket(e,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var n=new Uint8Array(t.length),o=0;o<t.length;o++)n[o]=t.charCodeAt(o);t=n.buffer,e[0]=0}var i=(t instanceof ArrayBuffer?t.byteLength:t.size).toString(),s=new Uint8Array(i.length+1);for(o=0;o<i.length;o++)s[o]=parseInt(i[o]);if(s[i.length]=255,d){var a=new d([e.buffer,s.buffer,t]);r(null,a)}})},function(t,e){return r(new d(e))})},t.decodePayloadAsBinary=function(e,r,n){"function"==typeof r&&(n=r,r=null);for(var o=e,s=[];o.byteLength>0;){for(var a=new Uint8Array(o),c=0===a[0],u="",p=1;255!==a[p];p++){if(u.length>310)return n(l,0,1);u+=a[p]}o=i(o,2+u.length),u=parseInt(u);var h=i(o,0,u);if(c)try{h=String.fromCharCode.apply(null,new Uint8Array(h))}catch(t){var f=new Uint8Array(h);h="";for(p=0;p<f.length;p++)h+=String.fromCharCode(f[p])}s.push(h),o=i(o,u)}var d=s.length;s.forEach(function(e,o){n(t.decodePacket(e,r,!0),o,d)})}}(ht)),ht}function At(){if(Ct)return bt;Ct=1;var t=xt(),e=R();function r(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.isReactNative=t.isReactNative,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}return bt=r,e(r.prototype),r.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),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(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(e){var r=t.decodePacket(e,this.socket.binaryType);this.onPacket(r)},r.prototype.onPacket=function(t){this.emit("packet",t)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")},bt}var Ft,Bt,Et,St,Nt,Rt={};function Tt(){return Ft||(Ft=1,Rt.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},Rt.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}),Rt}function Ot(){return Et?Bt:(Et=1,Bt=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t})}function Pt(){if(Nt)return St;Nt=1;var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),r={},n=0,o=0;function i(t){var r="";do{r=e[t%64]+r,t=Math.floor(t/64)}while(t>0);return r}function s(){var e=i(+new Date);return e!==t?(n=0,t=e):e+"."+i(n++)}for(;o<64;o++)r[e[o]]=o;return s.encode=i,s.decode=function(t){var e=0;for(o=0;o<t.length;o++)e=64*e+r[t.charAt(o)];return e},St=s}var jt,qt,Dt,_t,Lt,Mt,Ut,It,zt,Ht={exports:{}},Xt={exports:{}};function Wt(){if(qt)return jt;qt=1;var t=1e3,e=60*t,r=60*e,n=24*r,o=365.25*n;function i(t,e,r){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}return jt=function(s,a){a=a||{};var c=typeof s;if("string"===c&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(i);if(!s)return;var a=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*o;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*e;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(s);if("number"===c&&!1===isNaN(s))return a.long?function(o){return i(o,n,"day")||i(o,r,"hour")||i(o,e,"minute")||i(o,t,"second")||o+" ms"}(s):function(o){if(o>=n)return Math.round(o/n)+"d";if(o>=r)return Math.round(o/r)+"h";if(o>=e)return Math.round(o/e)+"m";if(o>=t)return Math.round(o/t)+"s";return o+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},jt}function Jt(){return Dt||(Dt=1,function(t,e){function r(t){var r;function o(){if(o.enabled){var t=o,n=+new Date,i=n-(r||n);t.diff=i,t.prev=r,t.curr=n,r=n;for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var c=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(r,n){if("%%"===r)return r;c++;var o=e.formatters[n];if("function"==typeof o){var i=s[c];r=o.call(t,i),s.splice(c,1),c--}return r}),e.formatArgs.call(t,s),(o.log||e.log||console.log.bind(console)).apply(t,s)}}return o.namespace=t,o.enabled=e.enabled(t),o.useColors=e.useColors(),o.color=function(t){var r,n=0;for(r in t)n=(n<<5)-n+t.charCodeAt(r),n|=0;return e.colors[Math.abs(n)%e.colors.length]}(t),o.destroy=n,"function"==typeof e.init&&e.init(o),e.instances.push(o),o}function n(){var t=e.instances.indexOf(this);return-1!==t&&(e.instances.splice(t,1),!0)}(e=Xt.exports=r.debug=r.default=r).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){var r;e.save(t),e.names=[],e.skips=[];var n=("string"==typeof t?t:"").split(/[\s,]+/),o=n.length;for(r=0;r<o;r++)n[r]&&("-"===(t=n[r].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")));for(r=0;r<e.instances.length;r++){var i=e.instances[r];i.enabled=e.enabled(i.namespace)}},e.enabled=function(t){if("*"===t[t.length-1])return!0;var r,n;for(r=0,n=e.skips.length;r<n;r++)if(e.skips[r].test(t))return!1;for(r=0,n=e.names.length;r<n;r++)if(e.names[r].test(t))return!0;return!1},e.humanize=Wt(),e.instances=[],e.names=[],e.skips=[],e.formatters={}}(0,Xt.exports)),Xt.exports}function $t(){return _t||(_t=1,function(t,e){function r(){var t;try{t=e.storage.debug}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t}(e=Ht.exports=Jt()).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(t){var r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),!r)return;var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,n)},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=r,e.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"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+)/)},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.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"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(r())}(0,Ht.exports)),Ht.exports}function Yt(){if(Mt)return Lt;Mt=1;var t=At(),e=Tt(),r=xt(),n=Ot(),o=Pt(),i=$t()("engine.io-client:polling");Lt=a;var s=null!=new(G())({xdomain:!1}).responseType;function a(e){var r=e&&e.forceBase64;s&&!r||(this.supportsBinary=!1),t.call(this,e)}return n(a,t),a.prototype.name="polling",a.prototype.doOpen=function(){this.poll()},a.prototype.pause=function(t){var e=this;function r(){i("paused"),e.readyState="paused",t()}if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(i("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){i("pre-pause polling complete"),--n||r()})),this.writable||(i("we are currently writing - waiting to pause"),n++,this.once("drain",function(){i("pre-pause writing complete"),--n||r()}))}else r()},a.prototype.poll=function(){i("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},a.prototype.onData=function(t){var e=this;i("polling got data %s",t);r.decodePayload(t,this.socket.binaryType,function(t,r,n){if("opening"===e.readyState&&"open"===t.type&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():i('ignoring poll - transport state "%s"',this.readyState))},a.prototype.doClose=function(){var t=this;function e(){i("writing close packet"),t.write([{type:"close"}])}"open"===this.readyState?(i("transport open - closing"),e()):(i("transport not open - deferring close"),this.once("open",e))},a.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};r.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,n)})},a.prototype.uri=function(){var t=this.query||{},r=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(t[this.timestampParam]=o()),this.supportsBinary||t.sid||(t.b64=1),t=e.encode(t),this.port&&("https"===r&&443!==Number(this.port)||"http"===r&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t),r+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t},Lt}var Kt,Vt,Gt,Zt,Qt,te,ee,re,ne=h(Object.freeze({__proto__:null,default:{}}));function oe(){if(Vt)return Kt;Vt=1;var t,e,r=At(),n=xt(),o=Tt(),i=Ot(),s=Pt(),a=$t()("engine.io-client:websocket");if("undefined"!=typeof WebSocket?t=WebSocket:"undefined"!=typeof self&&(t=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{e=ne}catch(t){}var c=t||e;function u(n){n&&n.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=n.perMessageDeflate,this.usingBrowserWebSocket=t&&!n.forceNode,this.protocols=n.protocols,this.usingBrowserWebSocket||(c=e),r.call(this,n)}return Kt=u,i(u,r),u.prototype.name="websocket",u.prototype.supportsBinary=!0,u.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={};this.isReactNative||(r.agent=this.agent,r.perMessageDeflate=this.perMessageDeflate,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new c(t,e):new c(t):new c(t,e,r)}catch(t){return this.emit("error",t)}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()}},u.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},u.prototype.write=function(t){var e=this;this.writable=!1;for(var r=t.length,o=0,i=r;o<i;o++)(function(t){n.encodePacket(t,e.supportsBinary,function(n){if(!e.usingBrowserWebSocket){var o={};if(t.options&&(o.compress=t.options.compress),e.perMessageDeflate)("string"==typeof n?Buffer.byteLength(n):n.length)<e.perMessageDeflate.threshold&&(o.compress=!1)}try{e.usingBrowserWebSocket?e.ws.send(n):e.ws.send(n,o)}catch(t){a("websocket closed before onclose event")}--r||s()})})(t[o]);function s(){e.emit("flush"),setTimeout(function(){e.writable=!0,e.emit("drain")},0)}},u.prototype.onClose=function(){r.prototype.onClose.call(this)},u.prototype.doClose=function(){void 0!==this.ws&&(this.ws.onerror=function(){},this.ws.close())},u.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";return this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=s()),this.supportsBinary||(t.b64=1),(t=o.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+t},u.prototype.check=function(){return!(!c||"__initialize"in c&&this.name===u.prototype.name)},Kt}function ie(){if(Gt)return Y;Gt=1;var t=G(),e=function(){if(Ut)return pt.exports;Ut=1;var t=G(),e=Yt(),r=R(),n=Ot(),o=$t()("engine.io-client:polling-xhr"),i=V();function s(){}function a(t){if(e.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,"undefined"!=typeof location){var r="https:"===location.protocol,n=location.port;n||(n=r?443:80),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||n!==t.port,this.xs=t.secure!==r}}function c(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}pt.exports=a,pt.exports.Request=c,n(a,e),a.prototype.supportsBinary=!0,a.prototype.request=function(t){return(t=t||{}).uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new c(t)},a.prototype.doWrite=function(t,e){var r="string"!=typeof t&&void 0!==t,n=this.request({method:"POST",data:t,isBinary:r}),o=this;n.on("success",e),n.on("error",function(t){o.onError("xhr post error",t)}),this.sendXhr=n},a.prototype.doPoll=function(){o("xhr poll");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},r(c.prototype),c.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 r=this.xhr=new t(e),n=this;try{o("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var i in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.extraHeaders[i])}catch(t){}if("POST"===this.method)try{this.isBinary?r.setRequestHeader("Content-type","application/octet-stream"):r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=this.withCredentials),this.requestTimeout&&(r.timeout=this.requestTimeout),this.hasXDR()?(r.onload=function(){n.onLoad()},r.onerror=function(){n.onError(r.responseText)}):r.onreadystatechange=function(){if(2===r.readyState)try{var t=r.getResponseHeader("Content-Type");(n.supportsBinary&&"application/octet-stream"===t||"application/octet-stream; charset=UTF-8"===t)&&(r.responseType="arraybuffer")}catch(t){}4===r.readyState&&(200===r.status||1223===r.status?n.onLoad():setTimeout(function(){n.onError("number"==typeof r.status?r.status:0)},0))},o("xhr data %s",this.data),r.send(this.data)}catch(t){return void setTimeout(function(){n.onError(t)},0)}"undefined"!=typeof document&&(this.index=c.requestsCount++,c.requests[this.index]=this)},c.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},c.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},c.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},c.prototype.cleanup=function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=s:this.xhr.onreadystatechange=s,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete c.requests[this.index],this.xhr=null}},c.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t=("application/octet-stream"===e||"application/octet-stream; charset=UTF-8"===e)&&this.xhr.response||this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},c.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},c.prototype.abort=function(){this.cleanup()},c.requestsCount=0,c.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",u):"function"==typeof addEventListener&&addEventListener("onpagehide"in i?"pagehide":"unload",u,!1));function u(){for(var t in c.requests)c.requests.hasOwnProperty(t)&&c.requests[t].abort()}return pt.exports}(),r=function(){if(zt)return It;zt=1;var t=Yt(),e=Ot(),r=V();It=a;var n,o=/\n/g,i=/\\n/g;function s(){}function a(e){t.call(this,e),this.query=this.query||{},n||(n=r.___eio=r.___eio||[]),this.index=n.length;var o=this;n.push(function(t){o.onData(t)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){o.script&&(o.script.onerror=s)},!1)}return e(a,t),a.prototype.supportsBinary=!1,a.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),t.prototype.doClose.call(this)},a.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},a.prototype.doWrite=function(t,e){var r=this;if(!this.form){var n,s=document.createElement("form"),a=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=c,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}function u(){p(),e()}function p(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(t){r.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+r.iframeId+'">';n=document.createElement(t)}catch(t){(n=document.createElement("iframe")).name=r.iframeId,n.src="javascript:0"}n.id=r.iframeId,r.form.appendChild(n),r.iframe=n}this.form.action=this.uri(),p(),t=t.replace(i,"\\\n"),this.area.value=t.replace(o,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&u()}:this.iframe.onload=u},It}(),n=oe();return Y.polling=function(n){var o=!1,i=!1,s=!1!==n.jsonp;if("undefined"!=typeof location){var a="https:"===location.protocol,c=location.port;c||(c=a?443:80),o=n.hostname!==location.hostname||c!==n.port,i=n.secure!==a}if(n.xdomain=o,n.xscheme=i,"open"in new t(n)&&!n.forceJSONP)return new e(n);if(!s)throw new Error("JSONP disabled");return new r(n)},Y.websocket=n,Y}function se(){if(Qt)return Zt;Qt=1;var t=[].indexOf;return Zt=function(e,r){if(t)return e.indexOf(r);for(var n=0;n<e.length;++n)if(e[n]===r)return n;return-1},Zt}function ae(){return re||(re=1,$.exports=function(){if(ee)return te;ee=1;var t=ie(),e=R(),r=$t()("engine.io-client:socket"),n=se(),o=xt(),i=y(),s=Tt();function a(t,e){if(!(this instanceof a))return new a(t,e);e=e||{},t&&"object"==typeof t&&(e=t,t=null),t?(t=i(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=i(e.host).host),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=s.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=!1!==e.withCredentials,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=!1!==e.perMessageDeflate&&(e.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||void 0,this.key=e.key||void 0,this.passphrase=e.passphrase||void 0,this.cert=e.cert||void 0,this.ca=e.ca||void 0,this.ciphers=e.ciphers||void 0,this.rejectUnauthorized=void 0===e.rejectUnauthorized||e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}return te=a,a.priorWebsocketSuccess=!1,e(a.prototype),a.protocol=o.protocol,a.Socket=a,a.Transport=At(),a.transports=ie(),a.parser=xt(),a.prototype.createTransport=function(e){r('creating transport "%s"',e);var n=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}(this.query);n.EIO=o.protocol,n.transport=e;var i=this.transportOptions[e]||{};return this.id&&(n.sid=this.id),new t[e]({query:n,socket:this,agent:i.agent||this.agent,hostname:i.hostname||this.hostname,port:i.port||this.port,secure:i.secure||this.secure,path:i.path||this.path,forceJSONP:i.forceJSONP||this.forceJSONP,jsonp:i.jsonp||this.jsonp,forceBase64:i.forceBase64||this.forceBase64,enablesXDR:i.enablesXDR||this.enablesXDR,withCredentials:i.withCredentials||this.withCredentials,timestampRequests:i.timestampRequests||this.timestampRequests,timestampParam:i.timestampParam||this.timestampParam,policyPort:i.policyPort||this.policyPort,pfx:i.pfx||this.pfx,key:i.key||this.key,passphrase:i.passphrase||this.passphrase,cert:i.cert||this.cert,ca:i.ca||this.ca,ciphers:i.ciphers||this.ciphers,rejectUnauthorized:i.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:i.perMessageDeflate||this.perMessageDeflate,extraHeaders:i.extraHeaders||this.extraHeaders,forceNode:i.forceNode||this.forceNode,localAddress:i.localAddress||this.localAddress,requestTimeout:i.requestTimeout||this.requestTimeout,protocols:i.protocols||void 0,isReactNative:this.isReactNative})},a.prototype.open=function(){var t;if(this.rememberUpgrade&&a.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.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)},a.prototype.setTransport=function(t){r("setting transport %s",t.name);var e=this;this.transport&&(r("clearing existing transport %s",this.transport.name),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")})},a.prototype.probe=function(t){r('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),n=!1,o=this;function i(){if(o.onlyBinaryUpgrades){var i=!this.supportsBinary&&o.transport.supportsBinary;n=n||i}n||(r('probe transport "%s" opened',t),e.send([{type:"ping",data:"probe"}]),e.once("packet",function(i){if(!n)if("pong"===i.type&&"probe"===i.data){if(r('probe transport "%s" pong',t),o.upgrading=!0,o.emit("upgrading",e),!e)return;a.priorWebsocketSuccess="websocket"===e.name,r('pausing current transport "%s"',o.transport.name),o.transport.pause(function(){n||"closed"!==o.readyState&&(r("changing transport and sending upgrade packet"),f(),o.setTransport(e),e.send([{type:"upgrade"}]),o.emit("upgrade",e),e=null,o.upgrading=!1,o.flush())})}else{r('probe transport "%s" failed',t);var s=new Error("probe error");s.transport=e.name,o.emit("upgradeError",s)}}))}function s(){n||(n=!0,f(),e.close(),e=null)}function c(n){var i=new Error("probe error: "+n);i.transport=e.name,s(),r('probe transport "%s" failed because of error: %s',t,n),o.emit("upgradeError",i)}function u(){c("transport closed")}function p(){c("socket closed")}function h(t){e&&t.name!==e.name&&(r('"%s" works - aborting "%s"',t.name,e.name),s())}function f(){e.removeListener("open",i),e.removeListener("error",c),e.removeListener("close",u),o.removeListener("close",p),o.removeListener("upgrading",h)}a.priorWebsocketSuccess=!1,e.once("open",i),e.once("error",c),e.once("close",u),this.once("close",p),this.once("upgrading",h),e.open()},a.prototype.onOpen=function(){if(r("socket open"),this.readyState="open",a.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){r("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},a.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(r('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else r('packet received with socket readyState "%s"',this.readyState)},a.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},a.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},a.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){r("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},a.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},a.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},a.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(r("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},a.prototype.write=a.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this},a.prototype.sendPacket=function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}},a.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?o():e()}):this.upgrading?o():e()}function e(){t.onClose("forced close"),r("socket closing - telling transport to close"),t.transport.close()}function n(){t.removeListener("upgrade",n),t.removeListener("upgradeError",n),e()}function o(){t.once("upgrade",n),t.once("upgradeError",n)}return this},a.prototype.onError=function(t){r("socket error %j",t),a.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},a.prototype.onClose=function(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(r('socket close with reason: "%s"',t),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",t,e),this.writeBuffer=[],this.prevBufferLen=0)},a.prototype.filterUpgrades=function(t){for(var e=[],r=0,o=t.length;r<o;r++)~n(this.transports,t[r])&&e.push(t[r]);return e},te}(),$.exports.parser=xt()),$.exports}var ce,ue,pe,he,fe,le,de,ye,me,ge,ve,be,Ce={exports:{}};function we(){if(he)return pe;return he=1,pe=function(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}}function ke(){if(le)return fe;le=1;var t=[].slice;return fe=function(e,r){if("string"==typeof r&&(r=e[r]),"function"!=typeof r)throw new Error("bind() requires a function");var n=t.call(arguments,2);return function(){return r.apply(e,n.concat(t.call(arguments)))}},fe}function xe(){return de||(de=1,function(t){var e=I(),r=R(),n=(ue||(ue=1,ce=function(t,e){for(var r=[],n=(e=e||0)||0;n<t.length;n++)r[n-e]=t[n];return r}),ce),o=we(),i=ke(),s=B()("socket.io-client:socket"),a=Tt(),c=lt();t.exports=h;var u={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},p=r.prototype.emit;function h(t,e,r){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},r&&r.query&&(this.query=r.query),this.io.autoConnect&&this.open()}r(h.prototype),h.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[o(t,"open",i(this,"onopen")),o(t,"packet",i(this,"onpacket")),o(t,"close",i(this,"onclose"))]}},h.prototype.open=h.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.reconnecting||this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},h.prototype.send=function(){var t=n(arguments);return t.unshift("message"),this.emit.apply(this,t),this},h.prototype.emit=function(t){if(u.hasOwnProperty(t))return p.apply(this,arguments),this;var r=n(arguments),o={type:(void 0!==this.flags.binary?this.flags.binary:c(r))?e.BINARY_EVENT:e.EVENT,data:r,options:{}};return o.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof r[r.length-1]&&(s("emitting packet with ack id %d",this.ids),this.acks[this.ids]=r.pop(),o.id=this.ids++),this.connected?this.packet(o):this.sendBuffer.push(o),this.flags={},this},h.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},h.prototype.onopen=function(){if(s("transport is open - connecting"),"/"!==this.nsp)if(this.query){var t="object"==typeof this.query?a.encode(this.query):this.query;s("sending connect packet with query %s",t),this.packet({type:e.CONNECT,query:t})}else this.packet({type:e.CONNECT})},h.prototype.onclose=function(t){s("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},h.prototype.onpacket=function(t){var r=t.nsp===this.nsp,n=t.type===e.ERROR&&"/"===t.nsp;if(r||n)switch(t.type){case e.CONNECT:this.onconnect();break;case e.EVENT:case e.BINARY_EVENT:this.onevent(t);break;case e.ACK:case e.BINARY_ACK:this.onack(t);break;case e.DISCONNECT:this.ondisconnect();break;case e.ERROR:this.emit("error",t.data)}},h.prototype.onevent=function(t){var e=t.data||[];s("emitting event %j",e),null!=t.id&&(s("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?p.apply(this,e):this.receiveBuffer.push(e)},h.prototype.ack=function(t){var r=this,o=!1;return function(){if(!o){o=!0;var i=n(arguments);s("sending ack %j",i),r.packet({type:c(i)?e.BINARY_ACK:e.ACK,id:t,data:i})}}},h.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(s("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):s("bad ack %s",t.id)},h.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},h.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)p.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},h.prototype.ondisconnect=function(){s("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},h.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},h.prototype.close=h.prototype.disconnect=function(){return this.connected&&(s("performing disconnect (%s)",this.nsp),this.packet({type:e.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},h.prototype.compress=function(t){return this.flags.compress=t,this},h.prototype.binary=function(t){return this.flags.binary=t,this}}(Ce)),Ce.exports}function Ae(){if(ve)return ge;ve=1;var t=ae(),e=xe(),r=R(),n=I(),o=we(),i=ke(),s=B()("socket.io-client:manager"),a=se(),c=function(){if(me)return ye;function t(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}return me=1,ye=t,t.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=1&Math.floor(10*e)?t+r:t-r}return 0|Math.min(t,this.max)},t.prototype.reset=function(){this.attempts=0},t.prototype.setMin=function(t){this.ms=t},t.prototype.setMax=function(t){this.max=t},t.prototype.setJitter=function(t){this.jitter=t},ye}(),u=Object.prototype.hasOwnProperty;function p(t,e){if(!(this instanceof p))return new p(t,e);t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new c({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=e.parser||n;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}return ge=p,p.prototype.emitAll=function(){for(var t in this.emit.apply(this,arguments),this.nsps)u.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},p.prototype.updateSocketIds=function(){for(var t in this.nsps)u.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},p.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},r(p.prototype),p.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},p.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},p.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},p.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},p.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},p.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},p.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},p.prototype.open=p.prototype.connect=function(e,r){if(s("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;s("opening %s",this.uri),this.engine=t(this.uri,this.opts);var n=this.engine,i=this;this.readyState="opening",this.skipReconnect=!1;var a=o(n,"open",function(){i.onopen(),e&&e()}),c=o(n,"error",function(t){if(s("connect_error"),i.cleanup(),i.readyState="closed",i.emitAll("connect_error",t),e){var r=new Error("Connection error");r.data=t,e(r)}else i.maybeReconnectOnOpen()});if(!1!==this._timeout){var u=this._timeout;s("connect attempt will timeout after %d",u),0===u&&a.destroy();var p=setTimeout(function(){s("connect attempt timed out after %d",u),a.destroy(),n.close(),n.emit("error","timeout"),i.emitAll("connect_timeout",u)},u);this.subs.push({destroy:function(){clearTimeout(p)}})}return this.subs.push(a),this.subs.push(c),this},p.prototype.onopen=function(){s("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(o(t,"data",i(this,"ondata"))),this.subs.push(o(t,"ping",i(this,"onping"))),this.subs.push(o(t,"pong",i(this,"onpong"))),this.subs.push(o(t,"error",i(this,"onerror"))),this.subs.push(o(t,"close",i(this,"onclose"))),this.subs.push(o(this.decoder,"decoded",i(this,"ondecoded")))},p.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},p.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},p.prototype.ondata=function(t){this.decoder.add(t)},p.prototype.ondecoded=function(t){this.emit("packet",t)},p.prototype.onerror=function(t){s("error",t),this.emitAll("error",t)},p.prototype.socket=function(t,r){var n=this.nsps[t];if(!n){n=new e(this,t,r),this.nsps[t]=n;var o=this;n.on("connecting",i),n.on("connect",function(){n.id=o.generateId(t)}),this.autoConnect&&i()}function i(){~a(o.connecting,n)||o.connecting.push(n)}return n},p.prototype.destroy=function(t){var e=a(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},p.prototype.packet=function(t){s("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()}))},p.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},p.prototype.cleanup=function(){s("cleanup");for(var t=this.subs.length,e=0;e<t;e++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},p.prototype.close=p.prototype.disconnect=function(){s("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},p.prototype.onclose=function(t){s("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},p.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)s("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();s("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(s("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(s("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(s("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}},p.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)},ge}var Fe=(be||(be=1,function(t,e){var r=function(){if(w)return C;w=1;var t=y(),e=B()("socket.io-client:url");return C=function(r,n){var o=r;n=n||"undefined"!=typeof location&&location,null==r&&(r=n.protocol+"//"+n.host),"string"==typeof r&&("/"===r.charAt(0)&&(r="/"===r.charAt(1)?n.protocol+r:n.host+r),/^(https?|wss?):\/\//.test(r)||(e("protocol-less url %s",r),r=void 0!==n?n.protocol+"//"+r:"https://"+r),e("parse %s",r),o=t(r)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";var i=-1!==o.host.indexOf(":")?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+i+":"+o.port,o.href=o.protocol+"://"+i+(n&&n.port===o.port?"":":"+o.port),o}}(),n=I(),o=Ae(),i=B()("socket.io-client");t.exports=e=a;var s=e.managers={};function a(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,a=r(t),c=a.source,u=a.id,p=a.path,h=s[u]&&p in s[u].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||h?(i("ignoring socket cache for %s",c),n=o(c,e)):(s[u]||(i("new io instance for %s",c),s[u]=o(c,e)),n=s[u]),a.query&&!e.query&&(e.query=a.query),n.socket(a.path,e)}e.protocol=n.protocol,e.connect=a,e.Manager=Ae(),e.Socket=xe()}(d,d.exports)),d.exports),Be=p(Fe),Ee={development:"https://chat-server-dev.mediquo.com",production:"https://chat-server.mediquo.com"},Se=class{constructor(t){this.socket=Be(Ee[t.env],{transports:["websocket"],query:`jwt=${t.accessToken}`,reconnection:!0,reconnectionDelay:5e3,reconnectionDelayMax:5e3,upgrade:!1,secure:!0,autoConnect:!1,forceNew:!0}),this.anyListeners=new Set,this.setupWildcardListener()}setupWildcardListener(){const t=this.socket,e=t.onevent;t.onevent=t=>{e.call(this.socket,t);try{const[e,r]=t.data;for(const t of this.anyListeners)try{t(e,r)}catch(t){i.error(`Error in onAny callback for event "${e}":`,t)}}catch(t){i.error("Wildcard listener error:",t)}}}on(t,e){this.socket.on(t,e)}off(t,e){this.socket.off(t,e)}emit(t,...e){this.socket.emit(t,...e)}onAny(t){this.anyListeners.add(t)}offAny(t){t?this.anyListeners.delete(t):this.anyListeners.clear()}connect(){this.socket.connect()}disconnect(){this.socket.disconnect()}connected(){return this.socket.connected}};let Ne=class SocketProvider extends s{constructor(){super(...arguments),this.socket=void 0}disconnectedCallback(){super.disconnectedCallback(),this.cleanupSocket()}updated(t){super.updated(t),(t.has("env")||t.has("token"))&&(this.cleanupSocket(),this.initializeSocket())}initializeSocket(){this.token?(this.socket=new Se({env:this.env,accessToken:this.token}),this.socket.connect(),this.socket.onAny((t,e)=>{this.dispatchEvent(new o(t,e))})):i.warn("Socket provider: No token provided, socket will not be initialized")}cleanupSocket(){this.socket&&(this.socket.disconnect(),this.socket=void 0)}render(){return a`<slot></slot>`}};t([c({type:String})],Ne.prototype,"env",void 0),t([c({type:String})],Ne.prototype,"token",void 0),t([r({context:n}),u()],Ne.prototype,"socket",void 0),Ne=t([e("mq-socket-provider")],Ne);export{Ne as SocketProvider};
@@ -1 +1 @@
1
- import{_ as o,t}from"./chunks/custom-element-DA9Fxvxd.js";import{m as e}from"./chunks/runtime-Bg1WXVCx.js";import{l as r}from"./chunks/localized-decorator-BlOuLhym.js";import{a as s,c as i}from"./chunks/api-chat-client-vbjgaIRV.js";import{Q as a}from"./chunks/query-controller-BlO1Ax65.js";import{M as n}from"./chunks/mutation-controller-CR2qcqhH.js";import{g as c}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{g as p}from"./chunks/chunk-YMQSBQHL-De_r7BNk.js";import{g as h}from"./chunks/chunk-GZF3YFSX-BzloXkVp.js";import{a as l,i as d,E as u,x as m}from"./chunks/lit-element-DiWJYFwC.js";import{n as v}from"./chunks/property-scuRaFcM.js";import{r as f}from"./chunks/state-LQivXIgA.js";import{tokens as g}from"./theme.js";import{annotationQuestionIcon as y}from"./ui/icons/annotation-question-icon.js";import{spinnerIcon as k}from"./ui/icons/spinner-icon.js";import{xIcon as b}from"./ui/icons/x-icon.js";import"./mq-chat-room.js";import"./ui/mq-avatar.js";import{b as _,a as w,S as j,c as q,d as x}from"./chunks/index-BJYWtEmT.js";import{toast as z}from"./ui/mq-toast.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/external-mrLCXx_f.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/query-Cjvi4_dT.js";import"./ui/icons/types.js";import"./chunks/provide-D2fnEhT2.js";import"./chunks/context-provider--AKuwfs9.js";import"./chunks/consume-CovVqBjI.js";import"./ui/mq-button.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./events.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./i18n.js";import"./chunks/chunk-YTQUGGS3-p18naHsk.js";let $=class MqSupportChat extends l{constructor(){super(...arguments),this.variant="icon",this.open=!1,this._hasOpened=!1,this._lastEmittedUnread=0,this._orgSetupQuery=new a(this,()=>c(s)),this._professionalQuery=new a(this,()=>p(s,{hash:this._professionalHash??""},{enabled:Boolean(this._professionalHash)})),this._unreadQuery=new a(this,()=>h(s,{roomId:this.roomId??0},{enabled:Boolean(this.roomId)})),this._supportRoomMutation=new n(this,{mutationFn:o=>s.rooms.createSupportRoom(o),onSuccess:o=>{this.roomId=o.room_id,this.open&&this._markSupportRead()},onError:()=>{this.open&&(this.open=!1,z.error(e("No se ha podido abrir el chat con soporte")))}}),this._readAllMutation=new n(this,{mutationFn:()=>s.professionals.readAllMessages({roomId:this.roomId??0}),onSuccess:()=>{const o=this.roomId;o&&this._unreadQuery.queryClient?.invalidateQueries({queryKey:h(s,{roomId:o}).queryKey})}}),this._onUnreadRequest=()=>{this._emitUnreadChange()},this._onToggleRequest=()=>{this._toggle()},this._onKeydown=o=>{o.defaultPrevented||"Escape"===o.key&&this.open&&this._close()}}static{this.styles=[g,d`*{box-sizing:border-box}:host{position:fixed;bottom:calc(var(--mq-safe-bottom,0px) + var(--sp-1));right:calc(var(--sp-4) + var(--mq-safe-right,0px));z-index:1000}@keyframes widget-in{from{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.widget{animation:widget-in .3s ease-out}.launcher{display:inline-flex;align-items:center;padding:0;border:none;background-color:var(--color-primary-light);border-radius:9999px;cursor:pointer;transition:transform .1s ease-out}.launcher:active{transform:scale(.95)}.launcher:focus-visible{outline:0}.icon-circle{position:relative;flex-shrink:0;width:var(--size-13);height:var(--size-13);--avatar-size:var(--size-13);border-radius:var(--border-radius-full);display:grid;place-items:center;background-color:var(--color-primary);color:var(--color-white);transition:background-color .1s ease-out,color .1s ease-out}.launcher.open .icon-circle{background-color:var(--color-primary-light);color:var(--color-primary-dark)}.icon{position:absolute;display:grid;place-items:center;transition:opacity .12s ease-out,transform .12s ease-out}.icon-chat{opacity:1;transform:rotate(0)}.launcher.open .icon-chat{opacity:0;transform:rotate(90deg)}.icon-close{opacity:0;transform:rotate(-90deg)}.launcher.open .icon-close{opacity:1;transform:rotate(0)}.icon-circle.with-avatar{background-color:var(--color-primary-light)}.launcher-avatar{width:var(--size-13);height:var(--size-13)}.icon-circle.with-avatar .icon-close,.launcher.open .icon-circle.with-avatar .icon-chat{transform:none}.icon-circle.with-avatar .online-dot{z-index:1}.online-dot{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) translate(calc(var(--avatar-size) * .35355),calc(var(--avatar-size) * -.35355));width:var(--size-3);height:var(--size-3);border-radius:var(--border-radius-full);background-color:var(--color-gray-medium);border:2px solid var(--color-background);transition:opacity .2s ease-out}.online-dot[data-presence=online]{background-color:var(--color-text-icons--success)}.online-dot[data-presence=absent]{background-color:#ff014d}.launcher.has-unread .online-dot,.launcher.open .online-dot{opacity:0}@keyframes badge-in{from{transform:scale(0)}to{transform:scale(1)}}.badge{position:absolute;top:calc(-1 * var(--size-1));right:calc(-1 * var(--size-1));min-width:var(--size-5);height:var(--size-5);padding:0 var(--sp-1);display:grid;place-items:center;background-color:var(--color-negative);border:2px solid var(--color-background);border-radius:9999px;color:var(--color-white);font-family:var(--font-body);font-size:var(--text-xs);line-height:1;font-weight:var(--font-weight-bold);animation:badge-in .15s ease-out;z-index:2}.panel{position:fixed;z-index:1;inset:var(--mq-safe-top,0) var(--mq-safe-right,0) var(--mq-safe-bottom,0) var(--mq-safe-left,0);background-color:var(--color-white);overflow:hidden;transform:scale(.95);transform-origin:bottom right;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s ease-out,transform .15s ease-out,visibility 0s linear .15s}.panel.open{opacity:1;transform:none;visibility:visible;pointer-events:auto;transition:opacity .15s ease-out,transform .15s ease-out}.panel-loading{width:100%;height:100%;display:grid;place-items:center}mq-chat-room{display:block;width:100%;height:100%}@media (min-width:768px){.panel{inset:auto;bottom:calc(var(--size-20) + var(--mq-safe-bottom,0px));right:calc(var(--sp-4) + var(--mq-safe-right,0px));width:400px;height:calc(100vh - 6rem - var(--mq-safe-top,0px) - var(--mq-safe-bottom,0px));max-height:560px;border-radius:var(--border-radius-lg)}}`]}get _professionalHash(){return this._orgSetupQuery.result?.data?.support_professional?.hash??void 0}get unreadCount(){return this._unreadQuery.result?.data?.unread_count??0}get _presence(){const o=this._professionalQuery.result?.data;return o?i(o):void 0}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this._onKeydown),window.addEventListener(_.eventName,this._onToggleRequest),window.addEventListener(w.eventName,this._onUnreadRequest)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this._onKeydown),window.removeEventListener(_.eventName,this._onToggleRequest),window.removeEventListener(w.eventName,this._onUnreadRequest)}willUpdate(o){o.has("apiKey")&&this.apiKey&&s.setApiKey(this.apiKey),o.has("token")&&this.token&&s.setAuthToken(this.token)}updated(){this._ensureRoom();const o=this.unreadCount;o!==this._lastEmittedUnread&&(this._lastEmittedUnread=o,this._emitUnreadChange())}_ensureRoom(){const o=this._professionalHash;!o||this.roomId||this._supportRoomMutation.isPending||this._supportRoomMutation.isError||this._supportRoomMutation.run({professional_hash:o})}_emitUnreadChange(){window.dispatchEvent(new j(this.unreadCount))}_markSupportRead(){const o=this.roomId,t=this._unreadQuery.queryClient;o&&t&&(t.setQueryData(h(s,{roomId:o}).queryKey,o=>o?{...o,unread_count:0}:o),this._readAllMutation.run(void 0))}_toggle(){this.open?this._close():this._open()}_open(){this.open=!0,this._hasOpened=!0,this.dispatchEvent(new q),!this.roomId&&this._supportRoomMutation.isError&&this._supportRoomMutation.reset(),this._ensureRoom(),this._markSupportRead()}_close(){this.open=!1,this.dispatchEvent(new x)}render(){const o=this._professionalHash;if(!o||!this.token)return u;const t=this._professionalQuery.result?.data;if("avatar"===this.variant&&!t)return u;const r=this.unreadCount>0,s="avatar"===this.variant&&Boolean(t);return m`<div class="widget"><div class="panel ${this.open?"open":""}">${this._hasOpened?this.roomId?m`<mq-chat-room api-key="${this.apiKey}" token="${this.token}" professional-hash="${o}" .roomId="${this.roomId}" @mq-chat-room-close="${this._close}"></mq-chat-room>`:m`<div class="panel-loading">${k({color:"var(--color-primary)"})}</div>`:u}</div><button type="button" class="launcher ${this.open?"open":""} ${r?"has-unread":""}" aria-label="${this.label||e("Chat con soporte")}" aria-expanded="${this.open?"true":"false"}" @click="${this._toggle}"><span class="icon-circle ${s?"with-avatar":""}">${this._presence?m`<span class="online-dot" data-presence="${this._presence}"></span>`:u} ${r&&!this.open?m`<span class="badge">${this.unreadCount>99?"99+":this.unreadCount}</span>`:u} <span class="icon icon-chat">${s?m`<mq-avatar class="launcher-avatar" .src="${t?.avatar??void 0}" .fallback="${t?.name}" .alt="${t?.name}"></mq-avatar>`:y({size:24})} </span><span class="icon icon-close">${b({size:24})}</span></span></button></div>`}};o([v({type:String,attribute:"api-key"})],$.prototype,"apiKey",void 0),o([v({type:String,attribute:"token"})],$.prototype,"token",void 0),o([v({type:String,attribute:"label"})],$.prototype,"label",void 0),o([v({type:String,attribute:"variant"})],$.prototype,"variant",void 0),o([f()],$.prototype,"open",void 0),o([f()],$.prototype,"roomId",void 0),o([f()],$.prototype,"_hasOpened",void 0),$=o([r(),t("mq-support-chat")],$);export{$ as MqSupportChat};
1
+ import{_ as o,t}from"./chunks/custom-element-DA9Fxvxd.js";import{m as e}from"./chunks/runtime-Bg1WXVCx.js";import{l as r}from"./chunks/localized-decorator-BlOuLhym.js";import{a as s,c as i}from"./chunks/api-chat-client-1Vz6ZOwp.js";import{Q as a}from"./chunks/query-controller-BlO1Ax65.js";import{M as n}from"./chunks/mutation-controller-CR2qcqhH.js";import{g as c}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{g as p}from"./chunks/chunk-YMQSBQHL-De_r7BNk.js";import{g as h}from"./chunks/chunk-GZF3YFSX-DM-GTqxg.js";import{a as l,i as d,E as u,x as m}from"./chunks/lit-element-DiWJYFwC.js";import{n as v}from"./chunks/property-scuRaFcM.js";import{r as f}from"./chunks/state-LQivXIgA.js";import{tokens as g}from"./theme.js";import{annotationQuestionIcon as y}from"./ui/icons/annotation-question-icon.js";import{spinnerIcon as k}from"./ui/icons/spinner-icon.js";import{xIcon as b}from"./ui/icons/x-icon.js";import"./mq-chat-room.js";import"./ui/mq-avatar.js";import{b as _,a as w,S as j,c as q,d as x}from"./chunks/index-BJYWtEmT.js";import{toast as z}from"./ui/mq-toast.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/query-Cjvi4_dT.js";import"./ui/icons/types.js";import"./chunks/provide-D2fnEhT2.js";import"./chunks/context-provider--AKuwfs9.js";import"./chunks/consume-CovVqBjI.js";import"./ui/mq-button.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./events.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./i18n.js";import"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";let $=class MqSupportChat extends l{constructor(){super(...arguments),this.variant="icon",this.open=!1,this._hasOpened=!1,this._lastEmittedUnread=0,this._orgSetupQuery=new a(this,()=>c(s)),this._professionalQuery=new a(this,()=>p(s,{hash:this._professionalHash??""},{enabled:Boolean(this._professionalHash)})),this._unreadQuery=new a(this,()=>h(s,{roomId:this.roomId??0},{enabled:Boolean(this.roomId)})),this._supportRoomMutation=new n(this,{mutationFn:o=>s.rooms.createSupportRoom(o),onSuccess:o=>{this.roomId=o.room_id,this.open&&this._markSupportRead()},onError:()=>{this.open&&(this.open=!1,z.error(e("No se ha podido abrir el chat con soporte")))}}),this._readAllMutation=new n(this,{mutationFn:()=>s.professionals.readAllMessages({roomId:this.roomId??0}),onSuccess:()=>{const o=this.roomId;o&&this._unreadQuery.queryClient?.invalidateQueries({queryKey:h(s,{roomId:o}).queryKey})}}),this._onUnreadRequest=()=>{this._emitUnreadChange()},this._onToggleRequest=()=>{this._toggle()},this._onKeydown=o=>{o.defaultPrevented||"Escape"===o.key&&this.open&&this._close()}}static{this.styles=[g,d`*{box-sizing:border-box}:host{position:fixed;bottom:calc(var(--mq-safe-bottom,0px) + var(--sp-1));right:calc(var(--sp-4) + var(--mq-safe-right,0px));z-index:1000}@keyframes widget-in{from{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.widget{animation:widget-in .3s ease-out}.launcher{display:inline-flex;align-items:center;padding:0;border:none;background-color:var(--color-primary-light);border-radius:9999px;cursor:pointer;transition:transform .1s ease-out}.launcher:active{transform:scale(.95)}.launcher:focus-visible{outline:0}.icon-circle{position:relative;flex-shrink:0;width:var(--size-13);height:var(--size-13);--avatar-size:var(--size-13);border-radius:var(--border-radius-full);display:grid;place-items:center;background-color:var(--color-primary);color:var(--color-white);transition:background-color .1s ease-out,color .1s ease-out}.launcher.open .icon-circle{background-color:var(--color-primary-light);color:var(--color-primary-dark)}.icon{position:absolute;display:grid;place-items:center;transition:opacity .12s ease-out,transform .12s ease-out}.icon-chat{opacity:1;transform:rotate(0)}.launcher.open .icon-chat{opacity:0;transform:rotate(90deg)}.icon-close{opacity:0;transform:rotate(-90deg)}.launcher.open .icon-close{opacity:1;transform:rotate(0)}.icon-circle.with-avatar{background-color:var(--color-primary-light)}.launcher-avatar{width:var(--size-13);height:var(--size-13)}.icon-circle.with-avatar .icon-close,.launcher.open .icon-circle.with-avatar .icon-chat{transform:none}.icon-circle.with-avatar .online-dot{z-index:1}.online-dot{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) translate(calc(var(--avatar-size) * .35355),calc(var(--avatar-size) * -.35355));width:var(--size-3);height:var(--size-3);border-radius:var(--border-radius-full);background-color:var(--color-gray-medium);border:2px solid var(--color-background);transition:opacity .2s ease-out}.online-dot[data-presence=online]{background-color:var(--color-text-icons--success)}.online-dot[data-presence=absent]{background-color:#ff014d}.launcher.has-unread .online-dot,.launcher.open .online-dot{opacity:0}@keyframes badge-in{from{transform:scale(0)}to{transform:scale(1)}}.badge{position:absolute;top:calc(-1 * var(--size-1));right:calc(-1 * var(--size-1));min-width:var(--size-5);height:var(--size-5);padding:0 var(--sp-1);display:grid;place-items:center;background-color:var(--color-negative);border:2px solid var(--color-background);border-radius:9999px;color:var(--color-white);font-family:var(--font-body);font-size:var(--text-xs);line-height:1;font-weight:var(--font-weight-bold);animation:badge-in .15s ease-out;z-index:2}.panel{position:fixed;z-index:1;inset:var(--mq-safe-top,0) var(--mq-safe-right,0) var(--mq-safe-bottom,0) var(--mq-safe-left,0);background-color:var(--color-white);overflow:hidden;transform:scale(.95);transform-origin:bottom right;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .15s ease-out,transform .15s ease-out,visibility 0s linear .15s}.panel.open{opacity:1;transform:none;visibility:visible;pointer-events:auto;transition:opacity .15s ease-out,transform .15s ease-out}.panel-loading{width:100%;height:100%;display:grid;place-items:center}mq-chat-room{display:block;width:100%;height:100%}@media (min-width:768px){.panel{inset:auto;bottom:calc(var(--size-20) + var(--mq-safe-bottom,0px));right:calc(var(--sp-4) + var(--mq-safe-right,0px));width:400px;height:calc(100vh - 6rem - var(--mq-safe-top,0px) - var(--mq-safe-bottom,0px));max-height:560px;border-radius:var(--border-radius-lg)}}`]}get _professionalHash(){return this._orgSetupQuery.result?.data?.support_professional?.hash??void 0}get unreadCount(){return this._unreadQuery.result?.data?.unread_count??0}get _presence(){const o=this._professionalQuery.result?.data;return o?i(o):void 0}connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this._onKeydown),window.addEventListener(_.eventName,this._onToggleRequest),window.addEventListener(w.eventName,this._onUnreadRequest)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this._onKeydown),window.removeEventListener(_.eventName,this._onToggleRequest),window.removeEventListener(w.eventName,this._onUnreadRequest)}willUpdate(o){o.has("apiKey")&&this.apiKey&&s.setApiKey(this.apiKey),o.has("token")&&this.token&&s.setAuthToken(this.token)}updated(){this._ensureRoom();const o=this.unreadCount;o!==this._lastEmittedUnread&&(this._lastEmittedUnread=o,this._emitUnreadChange())}_ensureRoom(){const o=this._professionalHash;!o||this.roomId||this._supportRoomMutation.isPending||this._supportRoomMutation.isError||this._supportRoomMutation.run({professional_hash:o})}_emitUnreadChange(){window.dispatchEvent(new j(this.unreadCount))}_markSupportRead(){const o=this.roomId,t=this._unreadQuery.queryClient;o&&t&&(t.setQueryData(h(s,{roomId:o}).queryKey,o=>o?{...o,unread_count:0}:o),this._readAllMutation.run(void 0))}_toggle(){this.open?this._close():this._open()}_open(){this.open=!0,this._hasOpened=!0,this.dispatchEvent(new q),!this.roomId&&this._supportRoomMutation.isError&&this._supportRoomMutation.reset(),this._ensureRoom(),this._markSupportRead()}_close(){this.open=!1,this.dispatchEvent(new x)}render(){const o=this._professionalHash;if(!o||!this.token)return u;const t=this._professionalQuery.result?.data;if("avatar"===this.variant&&!t)return u;const r=this.unreadCount>0,s="avatar"===this.variant&&Boolean(t);return m`<div class="widget"><div class="panel ${this.open?"open":""}">${this._hasOpened?this.roomId?m`<mq-chat-room api-key="${this.apiKey}" token="${this.token}" professional-hash="${o}" .roomId="${this.roomId}" @mq-chat-room-close="${this._close}"></mq-chat-room>`:m`<div class="panel-loading">${k({color:"var(--color-primary)"})}</div>`:u}</div><button type="button" class="launcher ${this.open?"open":""} ${r?"has-unread":""}" aria-label="${this.label||e("Chat con soporte")}" aria-expanded="${this.open?"true":"false"}" @click="${this._toggle}"><span class="icon-circle ${s?"with-avatar":""}">${this._presence?m`<span class="online-dot" data-presence="${this._presence}"></span>`:u} ${r&&!this.open?m`<span class="badge">${this.unreadCount>99?"99+":this.unreadCount}</span>`:u} <span class="icon icon-chat">${s?m`<mq-avatar class="launcher-avatar" .src="${t?.avatar??void 0}" .fallback="${t?.name}" .alt="${t?.name}"></mq-avatar>`:y({size:24})} </span><span class="icon icon-close">${b({size:24})}</span></span></button></div>`}};o([v({type:String,attribute:"api-key"})],$.prototype,"apiKey",void 0),o([v({type:String,attribute:"token"})],$.prototype,"token",void 0),o([v({type:String,attribute:"label"})],$.prototype,"label",void 0),o([v({type:String,attribute:"variant"})],$.prototype,"variant",void 0),o([f()],$.prototype,"open",void 0),o([f()],$.prototype,"roomId",void 0),o([f()],$.prototype,"_hasOpened",void 0),$=o([r(),t("mq-support-chat")],$);export{$ as MqSupportChat};
@@ -1 +1 @@
1
- export{M as MqTermsAndConditions}from"./chunks/index-yd2JNJSr.js";import{g as t}from"./chunks/api-chat-client-vbjgaIRV.js";import{i as s}from"./chunks/isBefore-CPpTogxo.js";import"./chunks/custom-element-DA9Fxvxd.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/state-LQivXIgA.js";import"./ui/mq-checkbox.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-button.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./env.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/external-mrLCXx_f.js";var e={accepted:"accepted",outdated:"outdated",not_accepted:"not-accepted"};function o({acceptedAt:o,lastVersionAt:c}){const n=o?t(o):null,r=c?t(c):null;return n&&r?s(n,r)?e.outdated:e.accepted:e.not_accepted}export{e as TERMS_ACCEPTANCE_STATUS,o as hasAcceptedTermsAndConditions};
1
+ export{M as MqTermsAndConditions}from"./chunks/index-BBUiLb3Y.js";import{g as t}from"./chunks/api-chat-client-1Vz6ZOwp.js";import{i as s}from"./chunks/isBefore-CPpTogxo.js";import"./chunks/custom-element-DA9Fxvxd.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/state-LQivXIgA.js";import"./ui/mq-checkbox.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-button.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./env.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";var e={accepted:"accepted",outdated:"outdated",not_accepted:"not-accepted"};function o({acceptedAt:o,lastVersionAt:c}){const n=o?t(o):null,r=c?t(c):null;return n&&r?s(n,r)?e.outdated:e.accepted:e.not_accepted}export{e as TERMS_ACCEPTANCE_STATUS,o as hasAcceptedTermsAndConditions};
@@ -1 +1 @@
1
- import{_ as e,t as s}from"./chunks/custom-element-DA9Fxvxd.js";import{a as t,E as n}from"./chunks/lit-element-DiWJYFwC.js";import{s as r}from"./chunks/context-consumer-ESdICVAb.js";import{Q as o}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{l as c}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import{a as i,S as a}from"./chunks/chunk-YTQUGGS3-p18naHsk.js";import{S as u,g as h}from"./chunks/chunk-GZF3YFSX-BzloXkVp.js";import{a as m}from"./chunks/api-chat-client-vbjgaIRV.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-mrLCXx_f.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";class UnreadCountSyncController{constructor(e){this.host=e,this.onMessageReceived=e=>{if(!this.queryClient)return;if(!function(e){const{eventName:s,fromUserHash:t,senderType:n,excludeFrom:r}=e;return!(s!==i.message||n&&n!==u.ordinary||!t||r&&t===r)}({eventName:i.message,fromUserHash:e.fromUserHash,senderType:e.senderType,excludeFrom:this.loginToken?.patient.hash}))return;const s=Number(e.roomId),t=h(m,{roomId:s}).queryKey;this.queryClient.setQueryData(t,e=>{if(e)return{...e,unread_count:e.unread_count+1}})},new r(this.host,{context:a,subscribe:!0,callback:e=>{e&&(this.socket=e,this.socket.on(i.message,this.onMessageReceived))}}),new r(this.host,{context:o,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),new r(this.host,{context:c,subscribe:!0,callback:e=>{e&&(this.loginToken=e)}}),this.host.addController(this)}hostConnected(){}hostDisconnected(){this.socket?.off(i.message,this.onMessageReceived)}}let l=class MqUnreadCountSync extends t{constructor(){super(...arguments),this._controller=new UnreadCountSyncController(this)}createRenderRoot(){return this}render(){return n}};l=e([s("mq-unread-count-sync")],l);export{l as MqUnreadCountSync,UnreadCountSyncController};
1
+ import{_ as e,t as s}from"./chunks/custom-element-DA9Fxvxd.js";import{a as t,E as n}from"./chunks/lit-element-DiWJYFwC.js";import{s as r}from"./chunks/context-consumer-ESdICVAb.js";import{Q as o}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{l as c}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import{a as i,S as a}from"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import{S as u,g as h}from"./chunks/chunk-GZF3YFSX-DM-GTqxg.js";import{a as m}from"./chunks/api-chat-client-1Vz6ZOwp.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";class UnreadCountSyncController{constructor(e){this.host=e,this.onMessageReceived=e=>{if(!this.queryClient)return;if(!function(e){const{eventName:s,fromUserHash:t,senderType:n,excludeFrom:r}=e;return!(s!==i.message||n&&n!==u.ordinary||!t||r&&t===r)}({eventName:i.message,fromUserHash:e.fromUserHash,senderType:e.senderType,excludeFrom:this.loginToken?.patient.hash}))return;const s=Number(e.roomId),t=h(m,{roomId:s}).queryKey;this.queryClient.setQueryData(t,e=>{if(e)return{...e,unread_count:e.unread_count+1}})},new r(this.host,{context:a,subscribe:!0,callback:e=>{e&&(this.socket=e,this.socket.on(i.message,this.onMessageReceived))}}),new r(this.host,{context:o,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),new r(this.host,{context:c,subscribe:!0,callback:e=>{e&&(this.loginToken=e)}}),this.host.addController(this)}hostConnected(){}hostDisconnected(){this.socket?.off(i.message,this.onMessageReceived)}}let l=class MqUnreadCountSync extends t{constructor(){super(...arguments),this._controller=new UnreadCountSyncController(this)}createRenderRoot(){return this}render(){return n}};l=e([s("mq-unread-count-sync")],l);export{l as MqUnreadCountSync,UnreadCountSyncController};