bitmax-crm-widget 1.0.7 β†’ 1.0.8

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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";var e=require("react");function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t,n,r,s,o,i){try{var a=e[o](i),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,s)}function r(e){return function(){var t=this,r=arguments;return new Promise(function(s,o){var i=e.apply(t,r);function a(e){n(i,s,o,a,c,"next",e)}function c(e){n(i,s,o,a,c,"throw",e)}a(void 0)})}}function s(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
- var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,s,i){var a=r&&r.prototype instanceof u?r:u,l=Object.create(a.prototype);return o(l,"_invoke",function(n,r,s){var o,i,a,u=0,l=s||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return o=t,i=0,a=e,d.n=n,c}};function p(n,r){for(i=n,a=r,t=0;!h&&u&&!s&&t<l.length;t++){var s,o=l[t],p=d.p,f=o[2];n>3?(s=f===r)&&(a=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=p&&((s=n<2&&p<o[1])?(i=0,d.v=r,d.n=o[1]):p<f&&(s=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,d.n=f,i=0))}if(s||n>1)return c;throw h=!0,r}return function(s,l,f){if(u>1)throw TypeError("Generator is already running");for(h&&1===l&&p(l,f),i=l,a=f;(t=i<2?e:a)||!h;){o||(i?i<3?(i>1&&(d.n=-1),p(i,a)):d.n=a:d.v=a);try{if(u=2,o){if(i||(s="next"),t=o[s]){if(!(t=t.call(o,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(a=TypeError("The iterator does not provide a '"+s+"' method"),i=1);o=e}else if((t=(h=d.n<0)?a:n.call(r,d))!==c)break}catch(t){o=e,i=1,a=t}finally{u=1}}return{value:t,done:h}}}(n,s,i),!0),l}var c={};function u(){}function l(){}function h(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),p=h.prototype=u.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,o(e,i,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=h,o(p,"constructor",h),o(h,"constructor",l),l.displayName="GeneratorFunction",o(h,i,"GeneratorFunction"),o(p),o(p,i,"Generator"),o(p,r,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:a,m:f}})()}function o(e,t,n,r){var s=Object.defineProperty;try{s({},"",{})}catch(e){s=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?s?s(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,o,i,a=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,s=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw s}}return a}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}const u=Object.create(null);u.open="0",u.close="1",u.ping="2",u.pong="3",u.message="4",u.upgrade="5",u.noop="6";const l=Object.create(null);Object.keys(u).forEach(e=>{l[u[e]]=e});const h={type:"error",data:"parser error"},d="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),p="function"==typeof ArrayBuffer,f=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,m=({type:e,data:t},n,r)=>d&&t instanceof Blob?n?r(t):g(t,r):p&&(t instanceof ArrayBuffer||f(t))?n?r(t):g(new Blob([t]),r):r(u[e]+(t||"")),g=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function y(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let b;const w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)v[w.charCodeAt(e)]=e;const E="function"==typeof ArrayBuffer,_=(e,t)=>{if("string"!=typeof e)return{type:"message",data:x(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:k(e.substring(1),t)};return l[n]?e.length>1?{type:l[n],data:e.substring(1)}:{type:l[n]}:h},k=(e,t)=>{if(E){const n=(e=>{let t,n,r,s,o,i=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);const u=new ArrayBuffer(i),l=new Uint8Array(u);for(t=0;t<a;t+=4)n=v[e.charCodeAt(t)],r=v[e.charCodeAt(t+1)],s=v[e.charCodeAt(t+2)],o=v[e.charCodeAt(t+3)],l[c++]=n<<2|r>>4,l[c++]=(15&r)<<4|s>>2,l[c++]=(3&s)<<6|63&o;return u})(e);return x(n,t)}return{base64:!0,data:e}},x=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,S=String.fromCharCode(30);function O(){return new TransformStream({transform(e,t){!function(e,t){d&&e.data instanceof Blob?e.data.arrayBuffer().then(y).then(t):p&&(e.data instanceof ArrayBuffer||f(e.data))?t(y(e.data)):m(e,!1,e=>{b||(b=new TextEncoder),t(b.encode(e))})}(e,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const e=new DataView(s.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{s=new Uint8Array(9);const e=new DataView(s.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(s[0]|=128),t.enqueue(s),t.enqueue(n)})}})}let R;function A(e){return e.reduce((e,t)=>e+t.length,0)}function T(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let s=0;s<t;s++)n[s]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function C(e){if(e)return function(e){for(var t in C.prototype)e[t]=C.prototype[t];return e}(e)}C.prototype.on=C.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},C.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},C.prototype.off=C.prototype.removeListener=C.prototype.removeAllListeners=C.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<r.length;s++)if((n=r[s])===t||n.fn===t){r.splice(s,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},C.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var s=(n=n.slice(0)).length;r<s;++r)n[r].apply(this,t)}return this},C.prototype.emitReserved=C.prototype.emit,C.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},C.prototype.hasListeners=function(e){return!!this.listeners(e).length};const N="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),B="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function j(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const L=B.setTimeout,P=B.clearTimeout;function U(e,t){t.useNativeTimers?(e.setTimeoutFn=L.bind(B),e.clearTimeoutFn=P.bind(B)):(e.setTimeoutFn=B.setTimeout.bind(B),e.clearTimeoutFn=B.clearTimeout.bind(B))}function I(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,s=e.length;r<s;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function F(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class q extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class D extends C{constructor(e){super(),this.writable=!1,U(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new q(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=_(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class M extends D{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(S),r=[];for(let e=0;e<n.length;e++){const s=_(n[e],t);if(r.push(s),"error"===s.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let s=0;e.forEach((e,o)=>{m(e,!1,e=>{r[o]=e,++s===n&&t(r.join(S))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=F()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let z=!1;try{z="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const H=z;function V(){}class W extends M{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}class K extends C{constructor(e,t,n){super(),this.createRequest=e,U(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=j(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=K.requestsCount++,K.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=V,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete K.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(K.requestsCount=0,K.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",J);else if("function"==typeof addEventListener){addEventListener("onpagehide"in B?"pagehide":"unload",J,!1)}function J(){for(let e in K.requests)K.requests.hasOwnProperty(e)&&K.requests[e].abort()}const $=function(){const e=G({xdomain:!1});return e&&null!==e.responseType}();function G(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||H))return new XMLHttpRequest}catch(e){}if(!t)try{return new(B[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Y="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Q extends D{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Y?{}:j(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;m(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=F()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const X=B.WebSocket||B.MozWebSocket;const Z={websocket:class extends Q{createSocket(e,t,n){return Y?new X(e,t,n):t?new X(e,t):new X(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends D{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){R||(R=new TextDecoder);const n=[];let r=0,s=-1,o=!1;return new TransformStream({transform(i,a){for(n.push(i);;){if(0===r){if(A(n)<1)break;const e=T(n,1);o=!(128&~e[0]),s=127&e[0],r=s<126?3:126===s?1:2}else if(1===r){if(A(n)<2)break;const e=T(n,2);s=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(A(n)<8)break;const e=T(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(h);break}s=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(A(n)<s)break;const e=T(n,s);a.enqueue(_(o?e:R.decode(e),t)),r=0}if(0===s||s>e){a.enqueue(h);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=O();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const s=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),s())}).catch(e=>{})};s();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends W{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=$&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(G,this.uri(),e)}}},ee=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,te=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ne(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let s=ee.exec(e||""),o={},i=14;for(;i--;)o[te[i]]=s[i]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const re="function"==typeof addEventListener&&"function"==typeof removeEventListener,se=[];re&&addEventListener("offline",()=>{se.forEach(e=>e())},!1);class oe extends C{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=ne(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=ne(t.host).host);U(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),re&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},se.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&oe.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",oe.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=I(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const s={type:e,data:t,options:n};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(oe.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),re&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=se.indexOf(this._offlineEventListener);-1!==e&&se.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}oe.protocol=4;class ie extends oe{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;oe.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;oe.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function s(){n||(n=!0,u(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,s(),this.emitReserved("upgradeError",n)};function i(){o("transport closed")}function a(){o("socket closed")}function c(e){t&&e.name!==t.name&&s()}const u=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",i),this.off("close",a),this.off("upgrading",c)};t.once("open",r),t.once("error",o),t.once("close",i),this.once("close",a),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let ae=class extends ie{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>Z[e]).filter(e=>!!e)),super(e,n)}};const ce="function"==typeof ArrayBuffer,ue=Object.prototype.toString,le="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===ue.call(Blob),he="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===ue.call(File);function de(e){return ce&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||le&&e instanceof Blob||he&&e instanceof File}function pe(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(pe(e[t]))return!0;return!1}if(de(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return pe(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&pe(e[t]))return!0;return!1}function fe(e){const t=[],n=e.data,r=e;return r.data=me(n,t),r.attachments=t.length,{packet:r,buffers:t}}function me(e,t){if(!e)return e;if(de(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=me(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=me(e[r],t));return n}return e}function ge(e,t){return e.data=ye(e.data,t),delete e.attachments,e}function ye(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=ye(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=ye(e[n],t));return e}const be=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var we;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(we||(we={}));function ve(e){return"[object Object]"===Object.prototype.toString.call(e)}class Ee extends C{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===we.BINARY_EVENT;n||t.type===we.BINARY_ACK?(t.type=n?we.EVENT:we.ACK,this.reconstructor=new _e(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!de(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===we[n.type])throw new Error("unknown packet type "+n.type);if(n.type===we.BINARY_EVENT||n.type===we.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const s=e.substring(r,t);if(s!=Number(s)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(s)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!Ee.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case we.CONNECT:return ve(t);case we.DISCONNECT:return void 0===t;case we.CONNECT_ERROR:return"string"==typeof t||ve(t);case we.EVENT:case we.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===be.indexOf(t[0]));case we.ACK:case we.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class _e{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=ge(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var ke=Object.freeze({__proto__:null,Decoder:Ee,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==we.EVENT&&e.type!==we.ACK||!pe(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===we.EVENT?we.BINARY_EVENT:we.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==we.BINARY_EVENT&&e.type!==we.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=fe(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return we},protocol:5});function xe(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Se=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Oe extends C{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[xe(e,"open",this.onopen.bind(this)),xe(e,"packet",this.onpacket.bind(this)),xe(e,"error",this.onerror.bind(this)),xe(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,s;if(Se.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:we.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const i=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(s=this.io.engine)||void 0===s?void 0:s._hasPingExpired());return this.flags.volatile&&!i||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(s),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const s=(e,t)=>e?r(e):n(t);s.withError=!0,t.push(s),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:we.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case we.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case we.EVENT:case we.BINARY_EVENT:this.onevent(e);break;case we.ACK:case we.BINARY_ACK:this.onack(e);break;case we.DISCONNECT:this.ondisconnect();break;case we.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:we.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:we.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function Re(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Re.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},Re.prototype.reset=function(){this.attempts=0},Re.prototype.setMin=function(e){this.ms=e},Re.prototype.setMax=function(e){this.max=e},Re.prototype.setJitter=function(e){this.jitter=e};class Ae extends C{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,U(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Re({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||ke;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new ae(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=xe(t,"open",function(){n.onopen(),e&&e()}),s=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=xe(t,"error",s);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),s(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(xe(e,"ping",this.onping.bind(this)),xe(e,"data",this.ondata.bind(this)),xe(e,"error",this.onerror.bind(this)),xe(e,"close",this.onclose.bind(this)),xe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){N(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Oe(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Te={};function Ce(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=ne(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,s=n.id,o=n.path,i=Te[s]&&o in Te[s].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||i?a=new Ae(r,t):(Te[s]||(Te[s]=new Ae(r,t)),a=Te[s]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function Ne(e,t){return function(){return e.apply(t,arguments)}}Object.assign(Ce,{Manager:Ae,Socket:Oe,io:Ce,connect:Ce});const{toString:Be}=Object.prototype,{getPrototypeOf:je}=Object,{iterator:Le,toStringTag:Pe}=Symbol,Ue=(e=>t=>{const n=Be.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ie=e=>(e=e.toLowerCase(),t=>Ue(t)===e),Fe=e=>t=>typeof t===e,{isArray:qe}=Array,De=Fe("undefined");function Me(e){return null!==e&&!De(e)&&null!==e.constructor&&!De(e.constructor)&&Ve(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ze=Ie("ArrayBuffer");const He=Fe("string"),Ve=Fe("function"),We=Fe("number"),Ke=e=>null!==e&&"object"==typeof e,Je=e=>{if("object"!==Ue(e))return!1;const t=je(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Pe in e||Le in e)},$e=Ie("Date"),Ge=Ie("File"),Ye=Ie("Blob"),Qe=Ie("FileList"),Xe=Ie("URLSearchParams"),[Ze,et,tt,nt]=["ReadableStream","Request","Response","Headers"].map(Ie);function rt(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),qe(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Me(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(r=0;r<o;r++)i=s[r],t.call(null,e[i],i,e)}}function st(e,t){if(Me(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const ot="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,it=e=>!De(e)&&e!==ot;const at=(ct="undefined"!=typeof Uint8Array&&je(Uint8Array),e=>ct&&e instanceof ct);var ct;const ut=Ie("HTMLFormElement"),lt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ht=Ie("RegExp"),dt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};rt(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)};const pt=Ie("AsyncFunction"),ft=(mt="function"==typeof setImmediate,gt=Ve(ot.postMessage),mt?setImmediate:gt?(yt=`axios@${Math.random()}`,bt=[],ot.addEventListener("message",({source:e,data:t})=>{e===ot&&t===yt&&bt.length&&bt.shift()()},!1),e=>{bt.push(e),ot.postMessage(yt,"*")}):e=>setTimeout(e));var mt,gt,yt,bt;const wt="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ot):"undefined"!=typeof process&&process.nextTick||ft;var vt={isArray:qe,isArrayBuffer:ze,isBuffer:Me,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Ve(e.append)&&("formdata"===(t=Ue(e))||"object"===t&&Ve(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ze(e.buffer),t},isString:He,isNumber:We,isBoolean:e=>!0===e||!1===e,isObject:Ke,isPlainObject:Je,isEmptyObject:e=>{if(!Ke(e)||Me(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Ze,isRequest:et,isResponse:tt,isHeaders:nt,isUndefined:De,isDate:$e,isFile:Ge,isBlob:Ye,isRegExp:ht,isFunction:Ve,isStream:e=>Ke(e)&&Ve(e.pipe),isURLSearchParams:Xe,isTypedArray:at,isFileList:Qe,forEach:rt,merge:function e(){const{caseless:t,skipUndefined:n}=it(this)&&this||{},r={},s=(s,o)=>{const i=t&&st(r,o)||o;Je(r[i])&&Je(s)?r[i]=e(r[i],s):Je(s)?r[i]=e({},s):qe(s)?r[i]=s.slice():n&&De(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&rt(arguments[e],s);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(rt(t,(t,r)=>{n&&Ve(t)?e[r]=Ne(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&je(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Ue,kindOfTest:Ie,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(qe(e))return e;let t=e.length;if(!We(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Le]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:ut,hasOwnProperty:lt,hasOwnProp:lt,reduceDescriptors:dt,freezeMethods:e=>{dt(e,(t,n)=>{if(Ve(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Ve(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return qe(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:st,global:ot,isContextDefined:it,isSpecCompliantForm:function(e){return!!(e&&Ve(e.append)&&"FormData"===e[Pe]&&e[Le])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Ke(e)){if(t.indexOf(e)>=0)return;if(Me(e))return e;if(!("toJSON"in e)){t[r]=e;const s=qe(e)?[]:{};return rt(e,(e,t)=>{const o=n(e,r+1);!De(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:pt,isThenable:e=>e&&(Ke(e)||Ve(e))&&Ve(e.then)&&Ve(e.catch),setImmediate:ft,asap:wt,isIterable:e=>null!=e&&Ve(e[Le])};function Et(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}vt.inherits(Et,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:vt.toJSONObject(this.config),code:this.code,status:this.status}}});const _t=Et.prototype,kt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{kt[e]={value:e}}),Object.defineProperties(Et,kt),Object.defineProperty(_t,"isAxiosError",{value:!0}),Et.from=(e,t,n,r,s,o)=>{const i=Object.create(_t);vt.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return Et.call(i,a,c,n,r,s),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function xt(e){return vt.isPlainObject(e)||vt.isArray(e)}function St(e){return vt.endsWith(e,"[]")?e.slice(0,-2):e}function Ot(e,t,n){return e?e.concat(t).map(function(e,t){return e=St(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Rt=vt.toFlatObject(vt,{},null,function(e){return/^is[A-Z]/.test(e)});function At(e,t,n){if(!vt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=vt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!vt.isUndefined(t[e])})).metaTokens,s=n.visitor||u,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&vt.isSpecCompliantForm(t);if(!vt.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(vt.isDate(e))return e.toISOString();if(vt.isBoolean(e))return e.toString();if(!a&&vt.isBlob(e))throw new Et("Blob is not supported. Use a Buffer instead.");return vt.isArrayBuffer(e)||vt.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(vt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(vt.isArray(e)&&function(e){return vt.isArray(e)&&!e.some(xt)}(e)||(vt.isFileList(e)||vt.endsWith(n,"[]"))&&(a=vt.toArray(e)))return n=St(n),a.forEach(function(e,r){!vt.isUndefined(e)&&null!==e&&t.append(!0===i?Ot([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!xt(e)||(t.append(Ot(s,n,o),c(e)),!1)}const l=[],h=Object.assign(Rt,{defaultVisitor:u,convertValue:c,isVisitable:xt});if(!vt.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!vt.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),vt.forEach(n,function(n,o){!0===(!(vt.isUndefined(n)||null===n)&&s.call(t,n,vt.isString(o)?o.trim():o,r,h))&&e(n,r?r.concat(o):[o])}),l.pop()}}(e),t}function Tt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Ct(e,t){this._pairs=[],e&&At(e,this,t)}const Nt=Ct.prototype;function Bt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function jt(e,t,n){if(!t)return e;const r=n&&n.encode||Bt;vt.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(o=s?s(t,n):vt.isURLSearchParams(t)?t.toString():new Ct(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Nt.append=function(e,t){this._pairs.push([e,t])},Nt.toString=function(e){const t=e?function(t){return e.call(this,t,Tt)}:Tt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Lt{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){vt.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Pt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ut={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ct,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const It="undefined"!=typeof window&&"undefined"!=typeof document,Ft="object"==typeof navigator&&navigator||void 0,qt=It&&(!Ft||["ReactNative","NativeScript","NS"].indexOf(Ft.product)<0),Dt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Mt=It&&window.location.href||"http://localhost";var zt={...Object.freeze({__proto__:null,hasBrowserEnv:It,hasStandardBrowserEnv:qt,hasStandardBrowserWebWorkerEnv:Dt,navigator:Ft,origin:Mt}),...Ut};function Ht(e){function t(e,n,r,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;if(o=!o&&vt.isArray(r)?r.length:o,a)return vt.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i;r[o]&&vt.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],s)&&vt.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}(r[o])),!i}if(vt.isFormData(e)&&vt.isFunction(e.entries)){const n={};return vt.forEachEntry(e,(e,r)=>{t(function(e){return vt.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Vt={transitional:Pt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=vt.isObject(e);s&&vt.isHTMLForm(e)&&(e=new FormData(e));if(vt.isFormData(e))return r?JSON.stringify(Ht(e)):e;if(vt.isArrayBuffer(e)||vt.isBuffer(e)||vt.isStream(e)||vt.isFile(e)||vt.isBlob(e)||vt.isReadableStream(e))return e;if(vt.isArrayBufferView(e))return e.buffer;if(vt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return At(e,new zt.classes.URLSearchParams,{visitor:function(e,t,n,r){return zt.isNode&&vt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=vt.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return At(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(vt.isString(e))try{return(t||JSON.parse)(e),vt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Vt.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(vt.isResponse(e)||vt.isReadableStream(e))return e;if(e&&vt.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw Et.from(e,Et.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:zt.classes.FormData,Blob:zt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};vt.forEach(["delete","get","head","post","put","patch"],e=>{Vt.headers[e]={}});const Wt=vt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Kt=Symbol("internals");function Jt(e){return e&&String(e).trim().toLowerCase()}function $t(e){return!1===e||null==e?e:vt.isArray(e)?e.map($t):String(e)}function Gt(e,t,n,r,s){return vt.isFunction(r)?r.call(this,t,n):(s&&(t=n),vt.isString(t)?vt.isString(r)?-1!==t.indexOf(r):vt.isRegExp(r)?r.test(t):void 0:void 0)}let Yt=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=Jt(t);if(!s)throw new Error("header name must be a non-empty string");const o=vt.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=$t(e))}const o=(e,t)=>vt.forEach(e,(e,n)=>s(e,n,t));if(vt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(vt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&Wt[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(vt.isObject(e)&&vt.isIterable(e)){let n,r,s={};for(const t of e){if(!vt.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?vt.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=Jt(e)){const n=vt.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(vt.isFunction(t))return t.call(this,e,n);if(vt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Jt(e)){const n=vt.findKey(this,e);return!(!n||void 0===this[n]||t&&!Gt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=Jt(e)){const s=vt.findKey(n,e);!s||t&&!Gt(0,n[s],s,t)||(delete n[s],r=!0)}}return vt.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!Gt(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return vt.forEach(this,(r,s)=>{const o=vt.findKey(n,s);if(o)return t[o]=$t(r),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();i!==s&&delete t[s],t[i]=$t(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return vt.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&vt.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Kt]=this[Kt]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Jt(e);t[r]||(!function(e,t){const n=vt.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return vt.isArray(e)?e.forEach(r):r(e),this}};function Qt(e,t){const n=this||Vt,r=t||n,s=Yt.from(r.headers);let o=r.data;return vt.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Xt(e){return!(!e||!e.__CANCEL__)}function Zt(e,t,n){Et.call(this,null==e?"canceled":e,Et.ERR_CANCELED,t,n),this.name="CanceledError"}function en(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Et("Request failed with status code "+n.status,[Et.ERR_BAD_REQUEST,Et.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),vt.reduceDescriptors(Yt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),vt.freezeMethods(Yt),vt.inherits(Zt,Et,{__CANCEL__:!0});const tn=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];s||(s=c),n[o]=a,r[o]=c;let l=i,h=0;for(;l!==o;)h+=n[l++],l%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const d=u&&c-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let n,r,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},o-a)))},()=>n&&i(n)]}(n=>{const o=n.loaded,i=n.lengthComputable?n.total:void 0,a=o-r,c=s(a);r=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},nn=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},rn=e=>(...t)=>vt.asap(()=>e(...t));var sn=zt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,zt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(zt.origin),zt.navigator&&/(msie|trident)/i.test(zt.navigator.userAgent)):()=>!0,on=zt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];vt.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),vt.isString(r)&&a.push(`path=${r}`),vt.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),vt.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function an(e,t,n){let r=!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const cn=e=>e instanceof Yt?{...e}:e;function un(e,t){t=t||{};const n={};function r(e,t,n,r){return vt.isPlainObject(e)&&vt.isPlainObject(t)?vt.merge.call({caseless:r},e,t):vt.isPlainObject(t)?vt.merge({},t):vt.isArray(t)?t.slice():t}function s(e,t,n,s){return vt.isUndefined(t)?vt.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!vt.isUndefined(t))return r(void 0,t)}function i(e,t){return vt.isUndefined(t)?vt.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,o){return o in t?r(n,s):o in e?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>s(cn(e),cn(t),0,!0)};return vt.forEach(Object.keys({...e,...t}),function(r){const o=c[r]||s,i=o(e[r],t[r],r);vt.isUndefined(i)&&o!==a||(n[r]=i)}),n}var ln=e=>{const t=un({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Yt.from(i),t.url=jt(an(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),vt.isFormData(n))if(zt.hasStandardBrowserEnv||zt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(vt.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(zt.hasStandardBrowserEnv&&(r&&vt.isFunction(r)&&(r=r(t)),r||!1!==r&&sn(t.url))){const e=s&&o&&on.read(o);e&&i.set(s,e)}return t};var hn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=ln(e);let s=r.data;const o=Yt.from(r.headers).normalize();let i,a,c,u,l,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Yt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());en(function(e){t(e),f()},function(e){n(e),f()},{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Et("Request aborted",Et.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new Et(t&&t.message?t.message:"Network Error",Et.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||Pt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Et(t,s.clarifyTimeoutError?Et.ETIMEDOUT:Et.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&vt.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),vt.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([c,l]=tn(p,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,u]=tn(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Zt(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===zt.protocols.indexOf(y)?n(new Et("Unsupported protocol "+y+":",Et.ERR_BAD_REQUEST,e)):m.send(s||null)})};const dn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Et?t:new Zt(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new Et(`timeout ${t} of ms exceeded`,Et.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>vt.asap(i),a}},pn=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},fn=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},mn=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of fn(e))yield*pn(n,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=i+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:gn}=vt,yn=(({Request:e,Response:t})=>({Request:e,Response:t}))(vt.global),{ReadableStream:bn,TextEncoder:wn}=vt.global,vn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},En=e=>{e=vt.merge.call({skipUndefined:!0},yn,e);const{fetch:t,Request:n,Response:r}=e,s=t?gn(t):"function"==typeof fetch,o=gn(n),i=gn(r);if(!s)return!1;const a=s&&gn(bn),c=s&&("function"==typeof wn?(u=new wn,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const l=o&&a&&vn(()=>{let e=!1;const t=new n(zt.origin,{body:new bn,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),h=i&&a&&vn(()=>vt.isReadableStream(new r("").body)),d={stream:h&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Et(`Response type '${e}' is not supported`,Et.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=vt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(vt.isBlob(e))return e.size;if(vt.isSpecCompliantForm(e)){const t=new n(zt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return vt.isArrayBufferView(e)||vt.isArrayBuffer(e)?e.byteLength:(vt.isURLSearchParams(e)&&(e+=""),vt.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:u,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:w="same-origin",fetchOptions:v}=ln(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let _=dn([c,u&&u.toAbortSignal()],f),k=null;const x=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let S;try{if(g&&l&&"get"!==i&&"head"!==i&&0!==(S=await p(b,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(vt.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=nn(S,tn(rn(g)));a=mn(t.body,65536,e,n)}}vt.isString(w)||(w=w?"include":"omit");const t=o&&"credentials"in n.prototype,c={...v,signal:_,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};k=o&&new n(s,c);let u=await(o?E(k,v):E(s,c));const f=h&&("stream"===y||"response"===y);if(h&&(m||f&&x)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=vt.toFiniteNumber(u.headers.get("content-length")),[n,s]=m&&nn(t,tn(rn(m),!0))||[];u=new r(mn(u.body,65536,n,()=>{s&&s(),x&&x()}),e)}y=y||"text";let O=await d[vt.findKey(d,y)||"text"](u,e);return!f&&x&&x(),await new Promise((t,n)=>{en(t,n,{data:O,headers:Yt.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:k})})}catch(t){if(x&&x(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Et("Network Error",Et.ERR_NETWORK,e,k),{cause:t.cause||t});throw Et.from(t,t&&t.code,e,k)}}},_n=new Map,kn=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,u=_n;for(;c--;)i=o[c],a=u.get(i),void 0===a&&u.set(i,a=c?new Map:En(t)),u=a;return a};kn();const xn={http:null,xhr:hn,fetch:{get:kn}};vt.forEach(xn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Sn=e=>`- ${e}`,On=e=>vt.isFunction(e)||null===e||!1===e;var Rn={getAdapter:function(e,t){e=vt.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){let n;if(r=e[i],s=r,!On(r)&&(s=xn[(n=String(r)).toLowerCase()],void 0===s))throw new Et(`Unknown adapter '${n}'`);if(s&&(vt.isFunction(s)||(s=s.get(t))))break;o[n||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Et("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(Sn).join("\n"):" "+Sn(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s},adapters:xn};function An(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Zt(null,e)}function Tn(e){An(e),e.headers=Yt.from(e.headers),e.data=Qt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Rn.getAdapter(e.adapter||Vt.adapter,e)(e).then(function(t){return An(e),t.data=Qt.call(e,e.transformResponse,t),t.headers=Yt.from(t.headers),t},function(t){return Xt(t)||(An(e),t&&t.response&&(t.response.data=Qt.call(e,e.transformResponse,t.response),t.response.headers=Yt.from(t.response.headers))),Promise.reject(t)})}const Cn="1.13.2",Nn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Nn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Bn={};Nn.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Cn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new Et(r(s," has been removed"+(t?" in "+t:"")),Et.ERR_DEPRECATED);return t&&!Bn[s]&&(Bn[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,o)}},Nn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var jn={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Et("options must be an object",Et.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const t=e[o],n=void 0===t||i(t,o,e);if(!0!==n)throw new Et("option "+o+" must be "+n,Et.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Et("Unknown option "+o,Et.ERR_BAD_OPTION)}},validators:Nn};const Ln=jn.validators;let Pn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Lt,response:new Lt}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=un(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&jn.assertOptions(n,{silentJSONParsing:Ln.transitional(Ln.boolean),forcedJSONParsing:Ln.transitional(Ln.boolean),clarifyTimeoutError:Ln.transitional(Ln.boolean)},!1),null!=r&&(vt.isFunction(r)?t.paramsSerializer={serialize:r}:jn.assertOptions(r,{encode:Ln.function,serialize:Ln.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),jn.assertOptions(t,{baseUrl:Ln.spelling("baseURL"),withXsrfToken:Ln.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&vt.merge(s.common,s[t.method]);s&&vt.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Yt.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,h=0;if(!a){const e=[Tn.bind(this),void 0];for(e.unshift(...i),e.push(...c),l=e.length,u=Promise.resolve(t);h<l;)u=u.then(e[h++],e[h++]);return u}l=i.length;let d=t;for(;h<l;){const e=i[h++],t=i[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=Tn.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(e){return jt(an((e=un(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};vt.forEach(["delete","get","head","options"],function(e){Pn.prototype[e]=function(t,n){return this.request(un(n||{},{method:e,url:t,data:(n||{}).data}))}}),vt.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(un(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Pn.prototype[e]=t(),Pn.prototype[e+"Form"]=t(!0)});const Un={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Un).forEach(([e,t])=>{Un[t]=e});const In=function e(t){const n=new Pn(t),r=Ne(Pn.prototype.request,n);return vt.extend(r,Pn.prototype,n,{allOwnKeys:!0}),vt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(un(t,n))},r}(Vt);In.Axios=Pn,In.CanceledError=Zt,In.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new Zt(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},In.isCancel=Xt,In.VERSION=Cn,In.toFormData=At,In.AxiosError=Et,In.Cancel=In.CanceledError,In.all=function(e){return Promise.all(e)},In.spread=function(e){return function(t){return e.apply(null,t)}},In.isAxiosError=function(e){return vt.isObject(e)&&!0===e.isAxiosError},In.mergeConfig=un,In.AxiosHeaders=Yt,In.formToJSON=e=>Ht(vt.isHTMLForm(e)?new FormData(e):e),In.getAdapter=Rn.getAdapter,In.HttpStatusCode=Un,In.default=In;const{Axios:Fn,AxiosError:qn,CanceledError:Dn,isCancel:Mn,CancelToken:zn,VERSION:Hn,all:Vn,Cancel:Wn,isAxiosError:Kn,spread:Jn,toFormData:$n,AxiosHeaders:Gn,HttpStatusCode:Yn,formToJSON:Qn,getAdapter:Xn,mergeConfig:Zn}=In;!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}(".crm-widget-container{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.crm-chat-button{align-items:center;border:none;border-radius:50%;box-shadow:0 10px 25px rgba(0,0,0,.2);color:#fff;cursor:pointer;display:flex;font-size:24px;height:64px;justify-content:center;position:fixed;transition:all .2s;width:64px}.crm-chat-button:hover{transform:scale(1.1)}.crm-icon{height:32px;width:32px}.crm-icon-sm{height:24px;width:24px}.crm-spin{animation:crm-spin 1s linear infinite}@keyframes crm-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.crm-badge{align-items:center;background-color:#ef4444;border-radius:50%;color:#fff;display:flex;font-size:12px;font-weight:600;height:20px;justify-content:center;position:absolute;right:-4px;top:-4px;width:20px}.crm-bottom-6{bottom:24px}.crm-right-6{right:24px}.crm-left-6{left:24px}.crm-top-6{top:24px}.crm-chat-window{background:#fff;border:1px solid #e5e7eb;border-radius:16px;box-shadow:0 20px 50px rgba(0,0,0,.3);display:flex;flex-direction:column;height:600px;max-width:448px;overflow:hidden;position:fixed;width:100%}.crm-chat-window.crm-dark{background:#1f2937;border-color:#374151}.crm-chat-window.crm-bottom-6{bottom:100px}.crm-chat-window.crm-right-6{right:24px}.crm-chat-window.crm-left-6{left:24px}.crm-chat-window.crm-top-6{top:100px}@media (max-width:640px){.crm-chat-window{border-radius:0;bottom:0!important;height:100vh;left:0!important;max-width:100%;right:0!important;top:0!important}}.crm-header{align-items:center;color:#fff;display:flex;justify-content:space-between;padding:16px 24px}.crm-header-content{align-items:center;display:flex;gap:12px}.crm-avatar{align-items:center;background:#fff;border-radius:50%;display:flex;font-size:20px;height:40px;justify-content:center;width:40px}.crm-title{font-size:18px;font-weight:600;margin:0}.crm-status{align-items:center;display:flex;font-size:14px;gap:8px;opacity:.9}.crm-status-dot{border-radius:50%;height:8px;width:8px}.crm-status-dot.crm-online{background-color:#10b981}.crm-status-dot.crm-offline{background-color:#ef4444}.crm-close-btn{background:hsla(0,0%,100%,.2);border:none;border-radius:50%;color:#fff;cursor:pointer;padding:8px;transition:background .2s}.crm-close-btn:hover{background:hsla(0,0%,100%,.3)}.crm-new-query-btn{align-items:center;background:hsla(0,0%,100%,.2);border:none;border-radius:50%;color:#fff;cursor:pointer;display:flex;justify-content:center;padding:8px;transition:all .2s}.crm-new-query-btn:hover{background:hsla(0,0%,100%,.3);transform:scale(1.05)}.crm-messages{background:#f9fafb;display:flex;flex:1;flex-direction:column;gap:16px;overflow-y:auto;padding:16px}.crm-dark .crm-messages{background:#111827}.crm-welcome-message{background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.1);padding:16px}.crm-dark .crm-welcome-message{background:#1f2937;border-color:#374151;color:#d1d5db}.crm-welcome-message p{color:#374151;font-size:14px;margin:0}.crm-dark .crm-welcome-message p{color:#d1d5db}.crm-message{display:flex}.crm-message-guest{justify-content:flex-end}.crm-message-agent{justify-content:flex-start}.crm-message-system{justify-content:center}.crm-message-bubble{border-radius:16px;box-shadow:0 1px 2px rgba(0,0,0,.1);max-width:75%;padding:10px 16px}.crm-message-guest .crm-message-bubble{border-bottom-right-radius:4px;color:#fff}.crm-message-agent .crm-message-bubble{background:#fff;border:1px solid #e5e7eb;border-bottom-left-radius:4px;color:#1f2937}.crm-dark .crm-message-agent .crm-message-bubble{background:#1f2937;border-color:#374151;color:#f3f4f6}.crm-agent-name{font-size:12px;font-weight:500;margin:0 0 4px;opacity:.7}.crm-message-text{font-size:14px;line-height:1.5;margin:0;white-space:pre-wrap;word-break:break-word}.crm-message-time{font-size:11px;margin:4px 0 0;opacity:.7}.crm-typing-indicator{display:flex;gap:4px;padding:4px 0}.crm-typing-dot{animation:typing 1.4s infinite;background:#9ca3af;border-radius:50%;height:8px;width:8px}.crm-typing-dot:nth-child(2){animation-delay:.2s}.crm-typing-dot:nth-child(3){animation-delay:.4s}@keyframes typing{0%,60%,to{transform:translateY(0)}30%{transform:translateY(-10px)}}.crm-input-container{background:#fff;border-top:1px solid #e5e7eb;padding:16px}.crm-dark .crm-input-container{background:#1f2937;border-color:#374151}.crm-input-wrapper{align-items:flex-end;display:flex;gap:8px}.crm-input{background:#f9fafb;border:1px solid #d1d5db;border-radius:12px;color:#1f2937;flex:1;font-family:inherit;font-size:14px;max-height:120px;min-height:48px;padding:12px 16px;resize:none}.crm-input:focus{border-color:#6366f1;box-shadow:0 0 0 3px rgba(99,102,241,.1);outline:none}.crm-input:disabled{cursor:not-allowed;opacity:.5}.crm-dark .crm-input{background:#111827;border-color:#4b5563;color:#f3f4f6}.crm-dark .crm-input::placeholder{color:#6b7280}.crm-send-btn{align-items:center;border:none;border-radius:12px;color:#fff;cursor:pointer;display:flex;flex-shrink:0;justify-content:center;padding:12px;transition:all .2s}.crm-send-btn:hover:not(:disabled){box-shadow:0 4px 12px rgba(0,0,0,.2)}.crm-send-btn:disabled{cursor:not-allowed;opacity:.5}.crm-input-hint{color:#9ca3af;font-size:11px;margin:8px 0 0;text-align:center}.crm-dark .crm-input-hint{color:#6b7280}.crm-messages::-webkit-scrollbar{width:6px}.crm-messages::-webkit-scrollbar-track{background:transparent}.crm-messages::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.crm-dark .crm-messages::-webkit-scrollbar-thumb{background:#4b5563}.crm-messages::-webkit-scrollbar-thumb:hover{background:#9ca3af}");exports.ChatCRMWidget=function(t){var n=t.apiKey,o=t.apiUrl,c=void 0===o?"https://chat-crm-backend-7mzo.onrender.com":o,u=t.primaryColor,l=void 0===u?"#4F46E5":u,h=t.position,d=void 0===h?"bottom-right":h,p=t.userData,f=void 0===p?null:p,m=t.welcomeMessage,g=void 0===m?"πŸ‘‹ Welcome! How can we help you today?":m,y=t.companyName,b=void 0===y?"Support":y,w=t.autoOpen,v=void 0!==w&&w,E=t.showNotifications,_=void 0===E||E,k=t.playSound,x=void 0!==k&&k,S=t.theme,O=void 0===S?"light":S,R=t.zIndex,A=void 0===R?9999:R,T=i(e.useState(v),2),C=T[0],N=T[1],B=i(e.useState([]),2),j=B[0],L=B[1],P=i(e.useState(""),2),U=P[0],I=P[1],F=i(e.useState(null),2),q=F[0],D=F[1],M=i(e.useState(null),2);M[0];var z=M[1],H=i(e.useState(null),2),V=H[0],W=H[1],K=i(e.useState(!1),2),J=K[0],$=K[1],G=i(e.useState(!1),2),Y=G[0],Q=G[1],X=i(e.useState(!1),2),Z=X[0],ee=X[1],te=i(e.useState(!1),2),ne=te[0],re=te[1],se=i(e.useState("Support Agent"),2),oe=se[0],ie=se[1],ae=i(e.useState(0),2),ce=ae[0],ue=ae[1],le=i(e.useState(!1),2),he=le[0],de=le[1],pe=i(e.useState("active"),2),fe=pe[0],me=pe[1],ge=e.useRef(null);e.useEffect(function(){var e;null===(e=ge.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[j]),e.useEffect(function(){return function(){q&&q.disconnect()}},[q]);var ye=function(){return f?{name:f.name||"Guest User",email:f.email||null,phone:f.phone||null,userId:f.userId||null}:{name:localStorage.getItem("chatGuestName")||"Guest User",email:localStorage.getItem("chatGuestEmail")||null,phone:localStorage.getItem("chatGuestPhone")||null,userId:localStorage.getItem("chatUserId")||null}},be=function(){var e=r(s().m(function e(){var t,r,o,i,a,u,l;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=ye(),Q(!0),e.p=1,console.log("πŸš€ Creating new conversation for first message..."),e.n=2,In.post("".concat(c,"/api/v1/webhook/guest-conversation"),{apiKey:n,guestName:t.name,guestEmail:t.email,guestPhone:t.phone,customUserId:t.userId});case 2:if(!(r=e.v).data.success){e.n=3;break}return o=r.data,i=o.conversationId,a=o.petitionId,u=o.queryId,z(u),W(i),de(!0),localStorage.setItem("chatGuestId",u),localStorage.setItem("chatConversationId",i),localStorage.setItem("chatPetitionId",a),console.log("βœ… Conversation created:",{petitionId:a,queryId:u}),e.a(2,{newConvId:i,petitionId:a});case 3:throw new Error("Failed to create conversation");case 4:throw e.p=4,l=e.v,console.error("❌ Create conversation error:",l),l;case 5:return e.p=5,Q(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),we=function(){var e=r(s().m(function e(t){var r,o;return s().w(function(e){for(;;)if(0===e.n)return r=t.convId,o=t.petitionId,ee(!0),e.a(2,new Promise(function(e,t){try{var s=Ce("".concat(c,"/widget"),{query:{conversationId:r,petitionId:o,apiKey:n},transports:["websocket","polling"]});s.on("connect",function(){$(!0),ee(!1),console.log("βœ… Connected to Chat CRM Widget Namespace"),e(s)}),s.on("connect_error",function(e){ee(!1),console.error("❌ Socket connect_error:",(null==e?void 0:e.message)||e)}),s.on("error",function(e){console.error("❌ Socket error:",e)}),s.on("disconnect",function(){$(!1),console.log("❌ Disconnected from Chat CRM")}),s.on("new-message",function(e){console.log("πŸ“¨ Received new-message:",e);var t={message:e.message||e.text||"",sender:e.sender||"agent",senderName:e.senderName||"Agent",timestamp:e.timestamp||new Date,read:!1};L(function(e){return[].concat(a(e),[t])}),ie(e.senderName||"Support Agent"),re(!1),!C&&_&&(ue(function(e){return e+1}),x&&Ee())}),s.on("query-accepted",function(e){console.log("βœ… Query accepted by agent:",e),ie(e.agentName||"Support Agent"),me("active"),L(function(t){return[].concat(a(t),[{message:e.message||"".concat(e.agentName," has accepted your query"),sender:"system",timestamp:new Date,read:!0}])})}),s.on("query-transferred",function(e){console.log("πŸ”„ Query transferred:",e),ie(e.toAgentName||"Support Agent"),L(function(t){return[].concat(a(t),[{message:e.message||"Your query has been transferred to ".concat(e.toAgentName),sender:"system",timestamp:new Date,read:!0}])})}),s.on("query-resolved",function(e){console.log("βœ… Query resolved:",e),me("resolved"),L(function(e){return[].concat(a(e),[{message:'βœ… This query has been resolved by the agent. Click "New Query" to start a new conversation.',sender:"system",timestamp:new Date,read:!0}])})}),s.on("query-reopened",function(e){console.log("πŸ”„ Query reopened:",e),me("active")}),s.on("agent-typing",function(e){re(!0),ie(e.agentName||"Support Agent"),setTimeout(function(){return re(!1)},3e3)}),D(s)}catch(e){ee(!1),t(e)}}))},e)}));return function(t){return e.apply(this,arguments)}}(),ve=function(){var e=r(s().m(function e(){var t,n,r,o,i,c,u,l,h;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:if(U.trim()&&"resolved"!==fe){e.n=1;break}return e.a(2);case 1:if(t=ye(),n=U.trim(),r=Date.now(),L(function(e){return[].concat(a(e),[{message:n,sender:"guest",senderName:t.name||"Guest User",read:!0,timestamp:new Date,tempId:r}])}),I(""),e.p=2,o=localStorage.getItem("chatPetitionId"),i=V||localStorage.getItem("chatConversationId"),o&&i){e.n=4;break}return e.n=3,be();case 3:c=e.v,i=c.newConvId,o=c.petitionId;case 4:if((u=q)&&J){e.n=6;break}return e.n=5,we({convId:i,petitionId:o});case 5:u=e.v;case 6:l={conversationId:i,petitionId:o,message:n,senderName:t.name||"Guest User",senderType:"Customer",timestamp:new Date},console.log("πŸ“€ Sending message:",l),u.emit("widget-message",l),e.n=8;break;case 7:e.p=7,h=e.v,console.error("❌ Send message error:",h),L(function(e){return e.filter(function(e){return e.tempId!==r})}),alert("Failed to send message. Please try again.");case 8:return e.a(2)}},e,null,[[2,7]])}));return function(){return e.apply(this,arguments)}}(),Ee=function(){var e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination),t.frequency.value=800,t.type="sine",n.gain.value=.1,t.start(),setTimeout(function(){return t.stop()},200)},_e=function(){var e={"bottom-right":"crm-bottom-6 crm-right-6","bottom-left":"crm-bottom-6 crm-left-6","top-right":"crm-top-6 crm-right-6","top-left":"crm-top-6 crm-left-6"};return e[d]||e["bottom-right"]},ke="dark"===O||"auto"===O&&window.matchMedia("(prefers-color-scheme: dark)").matches;return e.createElement("div",{className:"crm-widget-container",style:{zIndex:A}},e.createElement("button",{onClick:function(){N(!0),ue(0)},className:"crm-chat-button ".concat(_e()),style:{backgroundColor:l},"aria-label":"Open chat"},C?e.createElement("svg",{className:"crm-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})):e.createElement("svg",{className:"crm-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})),!C&&ce>0&&e.createElement("span",{className:"crm-badge"},ce)),C&&e.createElement("div",{className:"crm-chat-window ".concat(_e()," ").concat(ke?"crm-dark":"")},e.createElement("div",{className:"crm-header",style:{backgroundColor:l}},e.createElement("div",{className:"crm-header-content"},e.createElement("div",{className:"crm-avatar"},"πŸ’¬"),e.createElement("div",null,e.createElement("h3",{className:"crm-title"},b),e.createElement("div",{className:"crm-status"},e.createElement("div",{className:"crm-status-dot ".concat(J?"crm-online":"crm-offline")}),e.createElement("span",null,"resolved"===fe?e.createElement("span",{style:{color:"#10B981"}},"βœ“ Resolved"):"Support Agent"!==oe?e.createElement("span",null,"πŸ’¬ ",oe):J?"Online":Z?"Connecting…":"Ready")))),e.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},e.createElement("button",{onClick:function(){localStorage.removeItem("chatGuestId"),localStorage.removeItem("chatConversationId"),localStorage.removeItem("chatPetitionId"),q&&q.disconnect(),D(null),z(null),W(null),$(!1),de(!1),me("active"),L([]),I(""),console.log("πŸ†• Starting new query...")},className:"crm-new-query-btn",title:"Start New Query"},e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"}))),e.createElement("button",{onClick:function(){return N(!1)},className:"crm-close-btn"},e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))),e.createElement("div",{className:"crm-messages"},!he&&0===j.length&&e.createElement("div",{className:"crm-welcome-message"},e.createElement("p",null,g),e.createElement("p",{style:{fontSize:"0.875rem",marginTop:"8px",opacity:.7}},"πŸ‘‹ Start typing to begin your conversation")),j.map(function(t,n){return e.createElement("div",{key:n,className:"crm-message ".concat("guest"===t.sender?"crm-message-guest":"system"===t.sender?"crm-message-system":"crm-message-agent")},e.createElement("div",{className:"crm-message-bubble",style:"guest"===t.sender?{backgroundColor:l}:"system"===t.sender?{backgroundColor:"#F3F4F6",color:"#374151",border:"1px solid #E5E7EB"}:{}},"agent"===t.sender&&e.createElement("p",{className:"crm-agent-name"},t.senderName||oe),e.createElement("p",{className:"crm-message-text"},t.message),e.createElement("p",{className:"crm-message-time"},(r=t.timestamp,new Date(r).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})))));var r}),ne&&e.createElement("div",{className:"crm-message crm-message-agent"},e.createElement("div",{className:"crm-message-bubble"},e.createElement("div",{className:"crm-typing-indicator"},e.createElement("div",{className:"crm-typing-dot"}),e.createElement("div",{className:"crm-typing-dot"}),e.createElement("div",{className:"crm-typing-dot"})))),e.createElement("div",{ref:ge})),e.createElement("div",{className:"crm-input-container"},e.createElement("div",{className:"crm-input-wrapper"},e.createElement("textarea",{value:U,onChange:function(e){return I(e.target.value)},onKeyPress:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ve())},placeholder:"resolved"===fe?"Query is resolved. Start a new query to continue.":"Type your message...",rows:"1",className:"crm-input",disabled:"resolved"===fe}),e.createElement("button",{onClick:ve,disabled:!U.trim()||Y||"resolved"===fe,className:"crm-send-btn",style:{backgroundColor:l}},Y?e.createElement("svg",{className:"crm-icon-sm crm-spin",fill:"none",viewBox:"0 0 24 24"},e.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})):e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})))),e.createElement("p",{className:"crm-input-hint"},he?"Press Enter to send β€’ Shift+Enter for new line":"Send your first message to start conversation"))))};
3
+ var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,s,i){var a=r&&r.prototype instanceof u?r:u,l=Object.create(a.prototype);return o(l,"_invoke",function(n,r,s){var o,i,a,u=0,l=s||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return o=t,i=0,a=e,d.n=n,c}};function p(n,r){for(i=n,a=r,t=0;!h&&u&&!s&&t<l.length;t++){var s,o=l[t],p=d.p,f=o[2];n>3?(s=f===r)&&(a=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=p&&((s=n<2&&p<o[1])?(i=0,d.v=r,d.n=o[1]):p<f&&(s=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,d.n=f,i=0))}if(s||n>1)return c;throw h=!0,r}return function(s,l,f){if(u>1)throw TypeError("Generator is already running");for(h&&1===l&&p(l,f),i=l,a=f;(t=i<2?e:a)||!h;){o||(i?i<3?(i>1&&(d.n=-1),p(i,a)):d.n=a:d.v=a);try{if(u=2,o){if(i||(s="next"),t=o[s]){if(!(t=t.call(o,a)))throw TypeError("iterator result is not an object");if(!t.done)return t;a=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(a=TypeError("The iterator does not provide a '"+s+"' method"),i=1);o=e}else if((t=(h=d.n<0)?a:n.call(r,d))!==c)break}catch(t){o=e,i=1,a=t}finally{u=1}}return{value:t,done:h}}}(n,s,i),!0),l}var c={};function u(){}function l(){}function h(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),p=h.prototype=u.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,o(e,i,"GeneratorFunction")),e.prototype=Object.create(p),e}return l.prototype=h,o(p,"constructor",h),o(h,"constructor",l),l.displayName="GeneratorFunction",o(h,i,"GeneratorFunction"),o(p),o(p,i,"Generator"),o(p,r,function(){return this}),o(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:a,m:f}})()}function o(e,t,n,r){var s=Object.defineProperty;try{s({},"",{})}catch(e){s=0}o=function(e,t,n,r){function i(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?s?s(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},o(e,t,n,r)}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,s,o,i,a=[],c=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,s=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw s}}return a}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}const u=Object.create(null);u.open="0",u.close="1",u.ping="2",u.pong="3",u.message="4",u.upgrade="5",u.noop="6";const l=Object.create(null);Object.keys(u).forEach(e=>{l[u[e]]=e});const h={type:"error",data:"parser error"},d="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),p="function"==typeof ArrayBuffer,f=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,m=({type:e,data:t},n,r)=>d&&t instanceof Blob?n?r(t):g(t,r):p&&(t instanceof ArrayBuffer||f(t))?n?r(t):g(new Blob([t]),r):r(u[e]+(t||"")),g=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function y(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let b;const w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)v[w.charCodeAt(e)]=e;const E="function"==typeof ArrayBuffer,_=(e,t)=>{if("string"!=typeof e)return{type:"message",data:x(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:k(e.substring(1),t)};return l[n]?e.length>1?{type:l[n],data:e.substring(1)}:{type:l[n]}:h},k=(e,t)=>{if(E){const n=(e=>{let t,n,r,s,o,i=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);const u=new ArrayBuffer(i),l=new Uint8Array(u);for(t=0;t<a;t+=4)n=v[e.charCodeAt(t)],r=v[e.charCodeAt(t+1)],s=v[e.charCodeAt(t+2)],o=v[e.charCodeAt(t+3)],l[c++]=n<<2|r>>4,l[c++]=(15&r)<<4|s>>2,l[c++]=(3&s)<<6|63&o;return u})(e);return x(n,t)}return{base64:!0,data:e}},x=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,S=String.fromCharCode(30);function O(){return new TransformStream({transform(e,t){!function(e,t){d&&e.data instanceof Blob?e.data.arrayBuffer().then(y).then(t):p&&(e.data instanceof ArrayBuffer||f(e.data))?t(y(e.data)):m(e,!1,e=>{b||(b=new TextEncoder),t(b.encode(e))})}(e,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const e=new DataView(s.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{s=new Uint8Array(9);const e=new DataView(s.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(s[0]|=128),t.enqueue(s),t.enqueue(n)})}})}let R;function A(e){return e.reduce((e,t)=>e+t.length,0)}function T(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let s=0;s<t;s++)n[s]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function C(e){if(e)return function(e){for(var t in C.prototype)e[t]=C.prototype[t];return e}(e)}C.prototype.on=C.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},C.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},C.prototype.off=C.prototype.removeListener=C.prototype.removeAllListeners=C.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<r.length;s++)if((n=r[s])===t||n.fn===t){r.splice(s,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},C.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var s=(n=n.slice(0)).length;r<s;++r)n[r].apply(this,t)}return this},C.prototype.emitReserved=C.prototype.emit,C.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},C.prototype.hasListeners=function(e){return!!this.listeners(e).length};const N="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),B="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function j(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const L=B.setTimeout,P=B.clearTimeout;function U(e,t){t.useNativeTimers?(e.setTimeoutFn=L.bind(B),e.clearTimeoutFn=P.bind(B)):(e.setTimeoutFn=B.setTimeout.bind(B),e.clearTimeoutFn=B.clearTimeout.bind(B))}function I(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,s=e.length;r<s;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function F(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class q extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class D extends C{constructor(e){super(),this.writable=!1,U(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new q(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=_(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class M extends D{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(S),r=[];for(let e=0;e<n.length;e++){const s=_(n[e],t);if(r.push(s),"error"===s.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let s=0;e.forEach((e,o)=>{m(e,!1,e=>{r[o]=e,++s===n&&t(r.join(S))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=F()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let z=!1;try{z="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const H=z;function V(){}class W extends M{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}class K extends C{constructor(e,t,n){super(),this.createRequest=e,U(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=j(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=K.requestsCount++,K.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=V,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete K.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(K.requestsCount=0,K.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",J);else if("function"==typeof addEventListener){addEventListener("onpagehide"in B?"pagehide":"unload",J,!1)}function J(){for(let e in K.requests)K.requests.hasOwnProperty(e)&&K.requests[e].abort()}const $=function(){const e=G({xdomain:!1});return e&&null!==e.responseType}();function G(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||H))return new XMLHttpRequest}catch(e){}if(!t)try{return new(B[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Y="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class Q extends D{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Y?{}:j(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;m(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=F()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const X=B.WebSocket||B.MozWebSocket;const Z={websocket:class extends Q{createSocket(e,t,n){return Y?new X(e,t,n):t?new X(e,t):new X(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends D{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){R||(R=new TextDecoder);const n=[];let r=0,s=-1,o=!1;return new TransformStream({transform(i,a){for(n.push(i);;){if(0===r){if(A(n)<1)break;const e=T(n,1);o=!(128&~e[0]),s=127&e[0],r=s<126?3:126===s?1:2}else if(1===r){if(A(n)<2)break;const e=T(n,2);s=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(A(n)<8)break;const e=T(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(h);break}s=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(A(n)<s)break;const e=T(n,s);a.enqueue(_(o?e:R.decode(e),t)),r=0}if(0===s||s>e){a.enqueue(h);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=O();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const s=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),s())}).catch(e=>{})};s();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends W{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=$&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(G,this.uri(),e)}}},ee=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,te=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ne(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let s=ee.exec(e||""),o={},i=14;for(;i--;)o[te[i]]=s[i]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const re="function"==typeof addEventListener&&"function"==typeof removeEventListener,se=[];re&&addEventListener("offline",()=>{se.forEach(e=>e())},!1);class oe extends C{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=ne(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=ne(t.host).host);U(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,r=n.length;e<r;e++){let r=n[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),re&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},se.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&oe.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",oe.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=I(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const s={type:e,data:t,options:n};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(oe.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),re&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=se.indexOf(this._offlineEventListener);-1!==e&&se.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}oe.protocol=4;class ie extends oe{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;oe.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;oe.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function s(){n||(n=!0,u(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,s(),this.emitReserved("upgradeError",n)};function i(){o("transport closed")}function a(){o("socket closed")}function c(e){t&&e.name!==t.name&&s()}const u=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",i),this.off("close",a),this.off("upgrading",c)};t.once("open",r),t.once("error",o),t.once("close",i),this.once("close",a),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let ae=class extends ie{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>Z[e]).filter(e=>!!e)),super(e,n)}};const ce="function"==typeof ArrayBuffer,ue=Object.prototype.toString,le="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===ue.call(Blob),he="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===ue.call(File);function de(e){return ce&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||le&&e instanceof Blob||he&&e instanceof File}function pe(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(pe(e[t]))return!0;return!1}if(de(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return pe(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&pe(e[t]))return!0;return!1}function fe(e){const t=[],n=e.data,r=e;return r.data=me(n,t),r.attachments=t.length,{packet:r,buffers:t}}function me(e,t){if(!e)return e;if(de(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=me(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=me(e[r],t));return n}return e}function ge(e,t){return e.data=ye(e.data,t),delete e.attachments,e}function ye(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=ye(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=ye(e[n],t));return e}const be=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var we;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(we||(we={}));function ve(e){return"[object Object]"===Object.prototype.toString.call(e)}class Ee extends C{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===we.BINARY_EVENT;n||t.type===we.BINARY_ACK?(t.type=n?we.EVENT:we.ACK,this.reconstructor=new _e(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!de(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===we[n.type])throw new Error("unknown packet type "+n.type);if(n.type===we.BINARY_EVENT||n.type===we.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const s=e.substring(r,t);if(s!=Number(s)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(s)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!Ee.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case we.CONNECT:return ve(t);case we.DISCONNECT:return void 0===t;case we.CONNECT_ERROR:return"string"==typeof t||ve(t);case we.EVENT:case we.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===be.indexOf(t[0]));case we.ACK:case we.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class _e{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=ge(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var ke=Object.freeze({__proto__:null,Decoder:Ee,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==we.EVENT&&e.type!==we.ACK||!pe(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===we.EVENT?we.BINARY_EVENT:we.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==we.BINARY_EVENT&&e.type!==we.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=fe(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return we},protocol:5});function xe(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Se=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Oe extends C{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[xe(e,"open",this.onopen.bind(this)),xe(e,"packet",this.onpacket.bind(this)),xe(e,"error",this.onerror.bind(this)),xe(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,s;if(Se.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:we.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const i=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(s=this.io.engine)||void 0===s?void 0:s._hasPingExpired());return this.flags.volatile&&!i||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(s),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const s=(e,t)=>e?r(e):n(t);s.withError=!0,t.push(s),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:we.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case we.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case we.EVENT:case we.BINARY_EVENT:this.onevent(e);break;case we.ACK:case we.BINARY_ACK:this.onack(e);break;case we.DISCONNECT:this.ondisconnect();break;case we.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:we.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:we.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function Re(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Re.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},Re.prototype.reset=function(){this.attempts=0},Re.prototype.setMin=function(e){this.ms=e},Re.prototype.setMax=function(e){this.max=e},Re.prototype.setJitter=function(e){this.jitter=e};class Ae extends C{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,U(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Re({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||ke;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new ae(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=xe(t,"open",function(){n.onopen(),e&&e()}),s=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=xe(t,"error",s);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),s(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(xe(e,"ping",this.onping.bind(this)),xe(e,"data",this.ondata.bind(this)),xe(e,"error",this.onerror.bind(this)),xe(e,"close",this.onclose.bind(this)),xe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){N(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Oe(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Te={};function Ce(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=ne(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,s=n.id,o=n.path,i=Te[s]&&o in Te[s].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||i?a=new Ae(r,t):(Te[s]||(Te[s]=new Ae(r,t)),a=Te[s]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function Ne(e,t){return function(){return e.apply(t,arguments)}}Object.assign(Ce,{Manager:Ae,Socket:Oe,io:Ce,connect:Ce});const{toString:Be}=Object.prototype,{getPrototypeOf:je}=Object,{iterator:Le,toStringTag:Pe}=Symbol,Ue=(e=>t=>{const n=Be.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ie=e=>(e=e.toLowerCase(),t=>Ue(t)===e),Fe=e=>t=>typeof t===e,{isArray:qe}=Array,De=Fe("undefined");function Me(e){return null!==e&&!De(e)&&null!==e.constructor&&!De(e.constructor)&&Ve(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ze=Ie("ArrayBuffer");const He=Fe("string"),Ve=Fe("function"),We=Fe("number"),Ke=e=>null!==e&&"object"==typeof e,Je=e=>{if("object"!==Ue(e))return!1;const t=je(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Pe in e||Le in e)},$e=Ie("Date"),Ge=Ie("File"),Ye=Ie("Blob"),Qe=Ie("FileList"),Xe=Ie("URLSearchParams"),[Ze,et,tt,nt]=["ReadableStream","Request","Response","Headers"].map(Ie);function rt(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),qe(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Me(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(r=0;r<o;r++)i=s[r],t.call(null,e[i],i,e)}}function st(e,t){if(Me(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const ot="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,it=e=>!De(e)&&e!==ot;const at=(ct="undefined"!=typeof Uint8Array&&je(Uint8Array),e=>ct&&e instanceof ct);var ct;const ut=Ie("HTMLFormElement"),lt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ht=Ie("RegExp"),dt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};rt(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)};const pt=Ie("AsyncFunction"),ft=(mt="function"==typeof setImmediate,gt=Ve(ot.postMessage),mt?setImmediate:gt?(yt=`axios@${Math.random()}`,bt=[],ot.addEventListener("message",({source:e,data:t})=>{e===ot&&t===yt&&bt.length&&bt.shift()()},!1),e=>{bt.push(e),ot.postMessage(yt,"*")}):e=>setTimeout(e));var mt,gt,yt,bt;const wt="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ot):"undefined"!=typeof process&&process.nextTick||ft;var vt={isArray:qe,isArrayBuffer:ze,isBuffer:Me,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Ve(e.append)&&("formdata"===(t=Ue(e))||"object"===t&&Ve(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ze(e.buffer),t},isString:He,isNumber:We,isBoolean:e=>!0===e||!1===e,isObject:Ke,isPlainObject:Je,isEmptyObject:e=>{if(!Ke(e)||Me(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Ze,isRequest:et,isResponse:tt,isHeaders:nt,isUndefined:De,isDate:$e,isFile:Ge,isBlob:Ye,isRegExp:ht,isFunction:Ve,isStream:e=>Ke(e)&&Ve(e.pipe),isURLSearchParams:Xe,isTypedArray:at,isFileList:Qe,forEach:rt,merge:function e(){const{caseless:t,skipUndefined:n}=it(this)&&this||{},r={},s=(s,o)=>{const i=t&&st(r,o)||o;Je(r[i])&&Je(s)?r[i]=e(r[i],s):Je(s)?r[i]=e({},s):qe(s)?r[i]=s.slice():n&&De(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&rt(arguments[e],s);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(rt(t,(t,r)=>{n&&Ve(t)?e[r]=Ne(t,n):e[r]=t},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&je(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Ue,kindOfTest:Ie,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(qe(e))return e;let t=e.length;if(!We(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Le]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:ut,hasOwnProperty:lt,hasOwnProp:lt,reduceDescriptors:dt,freezeMethods:e=>{dt(e,(t,n)=>{if(Ve(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Ve(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return qe(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:st,global:ot,isContextDefined:it,isSpecCompliantForm:function(e){return!!(e&&Ve(e.append)&&"FormData"===e[Pe]&&e[Le])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Ke(e)){if(t.indexOf(e)>=0)return;if(Me(e))return e;if(!("toJSON"in e)){t[r]=e;const s=qe(e)?[]:{};return rt(e,(e,t)=>{const o=n(e,r+1);!De(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:pt,isThenable:e=>e&&(Ke(e)||Ve(e))&&Ve(e.then)&&Ve(e.catch),setImmediate:ft,asap:wt,isIterable:e=>null!=e&&Ve(e[Le])};function Et(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}vt.inherits(Et,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:vt.toJSONObject(this.config),code:this.code,status:this.status}}});const _t=Et.prototype,kt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{kt[e]={value:e}}),Object.defineProperties(Et,kt),Object.defineProperty(_t,"isAxiosError",{value:!0}),Et.from=(e,t,n,r,s,o)=>{const i=Object.create(_t);vt.toFlatObject(e,i,function(e){return e!==Error.prototype},e=>"isAxiosError"!==e);const a=e&&e.message?e.message:"Error",c=null==t&&e?e.code:t;return Et.call(i,a,c,n,r,s),e&&null==i.cause&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};function xt(e){return vt.isPlainObject(e)||vt.isArray(e)}function St(e){return vt.endsWith(e,"[]")?e.slice(0,-2):e}function Ot(e,t,n){return e?e.concat(t).map(function(e,t){return e=St(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Rt=vt.toFlatObject(vt,{},null,function(e){return/^is[A-Z]/.test(e)});function At(e,t,n){if(!vt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=vt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!vt.isUndefined(t[e])})).metaTokens,s=n.visitor||u,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&vt.isSpecCompliantForm(t);if(!vt.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(vt.isDate(e))return e.toISOString();if(vt.isBoolean(e))return e.toString();if(!a&&vt.isBlob(e))throw new Et("Blob is not supported. Use a Buffer instead.");return vt.isArrayBuffer(e)||vt.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(vt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(vt.isArray(e)&&function(e){return vt.isArray(e)&&!e.some(xt)}(e)||(vt.isFileList(e)||vt.endsWith(n,"[]"))&&(a=vt.toArray(e)))return n=St(n),a.forEach(function(e,r){!vt.isUndefined(e)&&null!==e&&t.append(!0===i?Ot([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!xt(e)||(t.append(Ot(s,n,o),c(e)),!1)}const l=[],h=Object.assign(Rt,{defaultVisitor:u,convertValue:c,isVisitable:xt});if(!vt.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!vt.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),vt.forEach(n,function(n,o){!0===(!(vt.isUndefined(n)||null===n)&&s.call(t,n,vt.isString(o)?o.trim():o,r,h))&&e(n,r?r.concat(o):[o])}),l.pop()}}(e),t}function Tt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Ct(e,t){this._pairs=[],e&&At(e,this,t)}const Nt=Ct.prototype;function Bt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function jt(e,t,n){if(!t)return e;const r=n&&n.encode||Bt;vt.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(o=s?s(t,n):vt.isURLSearchParams(t)?t.toString():new Ct(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Nt.append=function(e,t){this._pairs.push([e,t])},Nt.toString=function(e){const t=e?function(t){return e.call(this,t,Tt)}:Tt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class Lt{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){vt.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Pt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ut={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ct,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const It="undefined"!=typeof window&&"undefined"!=typeof document,Ft="object"==typeof navigator&&navigator||void 0,qt=It&&(!Ft||["ReactNative","NativeScript","NS"].indexOf(Ft.product)<0),Dt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Mt=It&&window.location.href||"http://localhost";var zt={...Object.freeze({__proto__:null,hasBrowserEnv:It,hasStandardBrowserEnv:qt,hasStandardBrowserWebWorkerEnv:Dt,navigator:Ft,origin:Mt}),...Ut};function Ht(e){function t(e,n,r,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;if(o=!o&&vt.isArray(r)?r.length:o,a)return vt.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i;r[o]&&vt.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],s)&&vt.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}(r[o])),!i}if(vt.isFormData(e)&&vt.isFunction(e.entries)){const n={};return vt.forEachEntry(e,(e,r)=>{t(function(e){return vt.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Vt={transitional:Pt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=vt.isObject(e);s&&vt.isHTMLForm(e)&&(e=new FormData(e));if(vt.isFormData(e))return r?JSON.stringify(Ht(e)):e;if(vt.isArrayBuffer(e)||vt.isBuffer(e)||vt.isStream(e)||vt.isFile(e)||vt.isBlob(e)||vt.isReadableStream(e))return e;if(vt.isArrayBufferView(e))return e.buffer;if(vt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return At(e,new zt.classes.URLSearchParams,{visitor:function(e,t,n,r){return zt.isNode&&vt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=vt.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return At(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(vt.isString(e))try{return(t||JSON.parse)(e),vt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Vt.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(vt.isResponse(e)||vt.isReadableStream(e))return e;if(e&&vt.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw Et.from(e,Et.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:zt.classes.FormData,Blob:zt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};vt.forEach(["delete","get","head","post","put","patch"],e=>{Vt.headers[e]={}});const Wt=vt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Kt=Symbol("internals");function Jt(e){return e&&String(e).trim().toLowerCase()}function $t(e){return!1===e||null==e?e:vt.isArray(e)?e.map($t):String(e)}function Gt(e,t,n,r,s){return vt.isFunction(r)?r.call(this,t,n):(s&&(t=n),vt.isString(t)?vt.isString(r)?-1!==t.indexOf(r):vt.isRegExp(r)?r.test(t):void 0:void 0)}let Yt=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=Jt(t);if(!s)throw new Error("header name must be a non-empty string");const o=vt.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=$t(e))}const o=(e,t)=>vt.forEach(e,(e,n)=>s(e,n,t));if(vt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(vt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&Wt[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(vt.isObject(e)&&vt.isIterable(e)){let n,r,s={};for(const t of e){if(!vt.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?vt.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=Jt(e)){const n=vt.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(vt.isFunction(t))return t.call(this,e,n);if(vt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Jt(e)){const n=vt.findKey(this,e);return!(!n||void 0===this[n]||t&&!Gt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=Jt(e)){const s=vt.findKey(n,e);!s||t&&!Gt(0,n[s],s,t)||(delete n[s],r=!0)}}return vt.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!Gt(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return vt.forEach(this,(r,s)=>{const o=vt.findKey(n,s);if(o)return t[o]=$t(r),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();i!==s&&delete t[s],t[i]=$t(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return vt.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&vt.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Kt]=this[Kt]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Jt(e);t[r]||(!function(e,t){const n=vt.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return vt.isArray(e)?e.forEach(r):r(e),this}};function Qt(e,t){const n=this||Vt,r=t||n,s=Yt.from(r.headers);let o=r.data;return vt.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Xt(e){return!(!e||!e.__CANCEL__)}function Zt(e,t,n){Et.call(this,null==e?"canceled":e,Et.ERR_CANCELED,t,n),this.name="CanceledError"}function en(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Et("Request failed with status code "+n.status,[Et.ERR_BAD_REQUEST,Et.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),vt.reduceDescriptors(Yt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),vt.freezeMethods(Yt),vt.inherits(Zt,Et,{__CANCEL__:!0});const tn=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];s||(s=c),n[o]=a,r[o]=c;let l=i,h=0;for(;l!==o;)h+=n[l++],l%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const d=u&&c-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return function(e,t){let n,r,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},o-a)))},()=>n&&i(n)]}(n=>{const o=n.loaded,i=n.lengthComputable?n.total:void 0,a=o-r,c=s(a);r=o;e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},nn=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},rn=e=>(...t)=>vt.asap(()=>e(...t));var sn=zt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,zt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(zt.origin),zt.navigator&&/(msie|trident)/i.test(zt.navigator.userAgent)):()=>!0,on=zt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];vt.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),vt.isString(r)&&a.push(`path=${r}`),vt.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),vt.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function an(e,t,n){let r=!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const cn=e=>e instanceof Yt?{...e}:e;function un(e,t){t=t||{};const n={};function r(e,t,n,r){return vt.isPlainObject(e)&&vt.isPlainObject(t)?vt.merge.call({caseless:r},e,t):vt.isPlainObject(t)?vt.merge({},t):vt.isArray(t)?t.slice():t}function s(e,t,n,s){return vt.isUndefined(t)?vt.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!vt.isUndefined(t))return r(void 0,t)}function i(e,t){return vt.isUndefined(t)?vt.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,o){return o in t?r(n,s):o in e?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>s(cn(e),cn(t),0,!0)};return vt.forEach(Object.keys({...e,...t}),function(r){const o=c[r]||s,i=o(e[r],t[r],r);vt.isUndefined(i)&&o!==a||(n[r]=i)}),n}var ln=e=>{const t=un({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Yt.from(i),t.url=jt(an(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),vt.isFormData(n))if(zt.hasStandardBrowserEnv||zt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(vt.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(zt.hasStandardBrowserEnv&&(r&&vt.isFunction(r)&&(r=r(t)),r||!1!==r&&sn(t.url))){const e=s&&o&&on.read(o);e&&i.set(s,e)}return t};var hn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=ln(e);let s=r.data;const o=Yt.from(r.headers).normalize();let i,a,c,u,l,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Yt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());en(function(e){t(e),f()},function(e){n(e),f()},{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Et("Request aborted",Et.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new Et(t&&t.message?t.message:"Network Error",Et.ERR_NETWORK,e,m);r.event=t||null,n(r),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||Pt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Et(t,s.clarifyTimeoutError?Et.ETIMEDOUT:Et.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&vt.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),vt.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([c,l]=tn(p,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,u]=tn(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Zt(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const y=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);y&&-1===zt.protocols.indexOf(y)?n(new Et("Unsupported protocol "+y+":",Et.ERR_BAD_REQUEST,e)):m.send(s||null)})};const dn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Et?t:new Zt(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new Et(`timeout ${t} of ms exceeded`,Et.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>vt.asap(i),a}},pn=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},fn=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},mn=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of fn(e))yield*pn(n,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=i+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:gn}=vt,yn=(({Request:e,Response:t})=>({Request:e,Response:t}))(vt.global),{ReadableStream:bn,TextEncoder:wn}=vt.global,vn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},En=e=>{e=vt.merge.call({skipUndefined:!0},yn,e);const{fetch:t,Request:n,Response:r}=e,s=t?gn(t):"function"==typeof fetch,o=gn(n),i=gn(r);if(!s)return!1;const a=s&&gn(bn),c=s&&("function"==typeof wn?(u=new wn,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const l=o&&a&&vn(()=>{let e=!1;const t=new n(zt.origin,{body:new bn,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),h=i&&a&&vn(()=>vt.isReadableStream(new r("").body)),d={stream:h&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Et(`Response type '${e}' is not supported`,Et.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=vt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(vt.isBlob(e))return e.size;if(vt.isSpecCompliantForm(e)){const t=new n(zt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return vt.isArrayBufferView(e)||vt.isArrayBuffer(e)?e.byteLength:(vt.isURLSearchParams(e)&&(e+=""),vt.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:u,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:w="same-origin",fetchOptions:v}=ln(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let _=dn([c,u&&u.toAbortSignal()],f),k=null;const x=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let S;try{if(g&&l&&"get"!==i&&"head"!==i&&0!==(S=await p(b,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(vt.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=nn(S,tn(rn(g)));a=mn(t.body,65536,e,n)}}vt.isString(w)||(w=w?"include":"omit");const t=o&&"credentials"in n.prototype,c={...v,signal:_,method:i.toUpperCase(),headers:b.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};k=o&&new n(s,c);let u=await(o?E(k,v):E(s,c));const f=h&&("stream"===y||"response"===y);if(h&&(m||f&&x)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=vt.toFiniteNumber(u.headers.get("content-length")),[n,s]=m&&nn(t,tn(rn(m),!0))||[];u=new r(mn(u.body,65536,n,()=>{s&&s(),x&&x()}),e)}y=y||"text";let O=await d[vt.findKey(d,y)||"text"](u,e);return!f&&x&&x(),await new Promise((t,n)=>{en(t,n,{data:O,headers:Yt.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:k})})}catch(t){if(x&&x(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Et("Network Error",Et.ERR_NETWORK,e,k),{cause:t.cause||t});throw Et.from(t,t&&t.code,e,k)}}},_n=new Map,kn=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,u=_n;for(;c--;)i=o[c],a=u.get(i),void 0===a&&u.set(i,a=c?new Map:En(t)),u=a;return a};kn();const xn={http:null,xhr:hn,fetch:{get:kn}};vt.forEach(xn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Sn=e=>`- ${e}`,On=e=>vt.isFunction(e)||null===e||!1===e;var Rn={getAdapter:function(e,t){e=vt.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){let n;if(r=e[i],s=r,!On(r)&&(s=xn[(n=String(r)).toLowerCase()],void 0===s))throw new Et(`Unknown adapter '${n}'`);if(s&&(vt.isFunction(s)||(s=s.get(t))))break;o[n||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));throw new Et("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(Sn).join("\n"):" "+Sn(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s},adapters:xn};function An(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Zt(null,e)}function Tn(e){An(e),e.headers=Yt.from(e.headers),e.data=Qt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Rn.getAdapter(e.adapter||Vt.adapter,e)(e).then(function(t){return An(e),t.data=Qt.call(e,e.transformResponse,t),t.headers=Yt.from(t.headers),t},function(t){return Xt(t)||(An(e),t&&t.response&&(t.response.data=Qt.call(e,e.transformResponse,t.response),t.response.headers=Yt.from(t.response.headers))),Promise.reject(t)})}const Cn="1.13.2",Nn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Nn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Bn={};Nn.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Cn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new Et(r(s," has been removed"+(t?" in "+t:"")),Et.ERR_DEPRECATED);return t&&!Bn[s]&&(Bn[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,o)}},Nn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var jn={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Et("options must be an object",Et.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const t=e[o],n=void 0===t||i(t,o,e);if(!0!==n)throw new Et("option "+o+" must be "+n,Et.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Et("Unknown option "+o,Et.ERR_BAD_OPTION)}},validators:Nn};const Ln=jn.validators;let Pn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Lt,response:new Lt}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=un(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&jn.assertOptions(n,{silentJSONParsing:Ln.transitional(Ln.boolean),forcedJSONParsing:Ln.transitional(Ln.boolean),clarifyTimeoutError:Ln.transitional(Ln.boolean)},!1),null!=r&&(vt.isFunction(r)?t.paramsSerializer={serialize:r}:jn.assertOptions(r,{encode:Ln.function,serialize:Ln.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),jn.assertOptions(t,{baseUrl:Ln.spelling("baseURL"),withXsrfToken:Ln.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&vt.merge(s.common,s[t.method]);s&&vt.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Yt.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,h=0;if(!a){const e=[Tn.bind(this),void 0];for(e.unshift(...i),e.push(...c),l=e.length,u=Promise.resolve(t);h<l;)u=u.then(e[h++],e[h++]);return u}l=i.length;let d=t;for(;h<l;){const e=i[h++],t=i[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{u=Tn.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,l=c.length;h<l;)u=u.then(c[h++],c[h++]);return u}getUri(e){return jt(an((e=un(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};vt.forEach(["delete","get","head","options"],function(e){Pn.prototype[e]=function(t,n){return this.request(un(n||{},{method:e,url:t,data:(n||{}).data}))}}),vt.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(un(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Pn.prototype[e]=t(),Pn.prototype[e+"Form"]=t(!0)});const Un={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Un).forEach(([e,t])=>{Un[t]=e});const In=function e(t){const n=new Pn(t),r=Ne(Pn.prototype.request,n);return vt.extend(r,Pn.prototype,n,{allOwnKeys:!0}),vt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(un(t,n))},r}(Vt);In.Axios=Pn,In.CanceledError=Zt,In.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new Zt(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},In.isCancel=Xt,In.VERSION=Cn,In.toFormData=At,In.AxiosError=Et,In.Cancel=In.CanceledError,In.all=function(e){return Promise.all(e)},In.spread=function(e){return function(t){return e.apply(null,t)}},In.isAxiosError=function(e){return vt.isObject(e)&&!0===e.isAxiosError},In.mergeConfig=un,In.AxiosHeaders=Yt,In.formToJSON=e=>Ht(vt.isHTMLForm(e)?new FormData(e):e),In.getAdapter=Rn.getAdapter,In.HttpStatusCode=Un,In.default=In;const{Axios:Fn,AxiosError:qn,CanceledError:Dn,isCancel:Mn,CancelToken:zn,VERSION:Hn,all:Vn,Cancel:Wn,isAxiosError:Kn,spread:Jn,toFormData:$n,AxiosHeaders:Gn,HttpStatusCode:Yn,formToJSON:Qn,getAdapter:Xn,mergeConfig:Zn}=In;!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}(".crm-widget-container{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.crm-chat-button{align-items:center;border:none;border-radius:50%;box-shadow:0 10px 25px rgba(0,0,0,.2);color:#fff;cursor:pointer;display:flex;font-size:24px;height:64px;justify-content:center;position:fixed;transition:all .2s;width:64px}.crm-chat-button:hover{transform:scale(1.1)}.crm-icon{height:32px;width:32px}.crm-icon-sm{height:24px;width:24px}.crm-spin{animation:crm-spin 1s linear infinite}@keyframes crm-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.crm-badge{align-items:center;background-color:#ef4444;border-radius:50%;color:#fff;display:flex;font-size:12px;font-weight:600;height:20px;justify-content:center;position:absolute;right:-4px;top:-4px;width:20px}.crm-bottom-6{bottom:24px}.crm-right-6{right:24px}.crm-left-6{left:24px}.crm-top-6{top:24px}.crm-chat-window{background:#fff;border:1px solid #e5e7eb;border-radius:16px;box-shadow:0 20px 50px rgba(0,0,0,.3);display:flex;flex-direction:column;height:600px;max-width:448px;overflow:hidden;position:fixed;width:100%}.crm-chat-window.crm-dark{background:#1f2937;border-color:#374151}.crm-chat-window.crm-bottom-6{bottom:100px}.crm-chat-window.crm-right-6{right:24px}.crm-chat-window.crm-left-6{left:24px}.crm-chat-window.crm-top-6{top:100px}@media (max-width:640px){.crm-chat-window{border-radius:0;bottom:0!important;height:100vh;left:0!important;max-width:100%;right:0!important;top:0!important}}.crm-header{align-items:center;color:#fff;display:flex;justify-content:space-between;padding:16px 24px}.crm-header-content{align-items:center;display:flex;gap:12px}.crm-avatar{align-items:center;background:#fff;border-radius:50%;display:flex;font-size:20px;height:40px;justify-content:center;width:40px}.crm-title{font-size:18px;font-weight:600;margin:0}.crm-status{align-items:center;display:flex;font-size:14px;gap:8px;opacity:.9}.crm-status-dot{border-radius:50%;height:8px;width:8px}.crm-status-dot.crm-online{background-color:#10b981}.crm-status-dot.crm-offline{background-color:#ef4444}.crm-close-btn{background:hsla(0,0%,100%,.2);border:none;border-radius:50%;color:#fff;cursor:pointer;padding:8px;transition:background .2s}.crm-close-btn:hover{background:hsla(0,0%,100%,.3)}.crm-new-query-btn{align-items:center;background:hsla(0,0%,100%,.2);border:none;border-radius:50%;color:#fff;cursor:pointer;display:flex;justify-content:center;padding:8px;transition:all .2s}.crm-new-query-btn:hover{background:hsla(0,0%,100%,.3);transform:scale(1.05)}.crm-messages{background:#f9fafb;display:flex;flex:1;flex-direction:column;gap:16px;overflow-y:auto;padding:16px}.crm-dark .crm-messages{background:#111827}.crm-welcome-message{background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.1);padding:16px}.crm-dark .crm-welcome-message{background:#1f2937;border-color:#374151;color:#d1d5db}.crm-welcome-message p{color:#374151;font-size:14px;margin:0}.crm-dark .crm-welcome-message p{color:#d1d5db}.crm-message{display:flex}.crm-message-guest{justify-content:flex-end}.crm-message-agent{justify-content:flex-start}.crm-message-system{justify-content:center}.crm-message-bubble{border-radius:16px;box-shadow:0 1px 2px rgba(0,0,0,.1);max-width:75%;padding:10px 16px}.crm-message-guest .crm-message-bubble{border-bottom-right-radius:4px;color:#fff}.crm-message-agent .crm-message-bubble{background:#fff;border:1px solid #e5e7eb;border-bottom-left-radius:4px;color:#1f2937}.crm-dark .crm-message-agent .crm-message-bubble{background:#1f2937;border-color:#374151;color:#f3f4f6}.crm-agent-name{font-size:12px;font-weight:500;margin:0 0 4px;opacity:.7}.crm-message-text{font-size:14px;line-height:1.5;margin:0;white-space:pre-wrap;word-break:break-word}.crm-message-time{font-size:11px;margin:4px 0 0;opacity:.7}.crm-typing-indicator{display:flex;gap:4px;padding:4px 0}.crm-typing-dot{animation:typing 1.4s infinite;background:#9ca3af;border-radius:50%;height:8px;width:8px}.crm-typing-dot:nth-child(2){animation-delay:.2s}.crm-typing-dot:nth-child(3){animation-delay:.4s}@keyframes typing{0%,60%,to{transform:translateY(0)}30%{transform:translateY(-10px)}}.crm-input-container{background:#fff;border-top:1px solid #e5e7eb;padding:16px}.crm-dark .crm-input-container{background:#1f2937;border-color:#374151}.crm-input-wrapper{align-items:flex-end;display:flex;gap:8px}.crm-input{background:#f9fafb;border:1px solid #d1d5db;border-radius:12px;color:#1f2937;flex:1;font-family:inherit;font-size:14px;max-height:120px;min-height:48px;padding:12px 16px;resize:none}.crm-input:focus{border-color:#6366f1;box-shadow:0 0 0 3px rgba(99,102,241,.1);outline:none}.crm-input:disabled{cursor:not-allowed;opacity:.5}.crm-dark .crm-input{background:#111827;border-color:#4b5563;color:#f3f4f6}.crm-dark .crm-input::placeholder{color:#6b7280}.crm-send-btn{align-items:center;border:none;border-radius:12px;color:#fff;cursor:pointer;display:flex;flex-shrink:0;justify-content:center;padding:12px;transition:all .2s}.crm-send-btn:hover:not(:disabled){box-shadow:0 4px 12px rgba(0,0,0,.2)}.crm-send-btn:disabled{cursor:not-allowed;opacity:.5}.crm-input-hint{color:#9ca3af;font-size:11px;margin:8px 0 0;text-align:center}.crm-dark .crm-input-hint{color:#6b7280}.crm-messages::-webkit-scrollbar{width:6px}.crm-messages::-webkit-scrollbar-track{background:transparent}.crm-messages::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.crm-dark .crm-messages::-webkit-scrollbar-thumb{background:#4b5563}.crm-messages::-webkit-scrollbar-thumb:hover{background:#9ca3af}");exports.ChatCRMWidget=function(t){var n=t.apiKey,o=t.apiUrl,c=void 0===o?"https://chat-crm-backend-7mzo.onrender.com":o,u=t.primaryColor,l=void 0===u?"#4F46E5":u,h=t.position,d=void 0===h?"bottom-right":h,p=t.userData,f=void 0===p?null:p,m=t.welcomeMessage,g=void 0===m?"πŸ‘‹ Welcome! How can we help you today?":m,y=t.companyName,b=void 0===y?"Support":y,w=t.autoOpen,v=void 0!==w&&w,E=t.showNotifications,_=void 0===E||E,k=t.playSound,x=void 0!==k&&k,S=t.theme,O=void 0===S?"light":S,R=t.zIndex,A=void 0===R?9999:R,T=i(e.useState(v),2),C=T[0],N=T[1],B=i(e.useState([]),2),j=B[0],L=B[1],P=i(e.useState(""),2),U=P[0],I=P[1],F=i(e.useState(null),2),q=F[0],D=F[1],M=i(e.useState(null),2);M[0];var z=M[1],H=i(e.useState(null),2),V=H[0],W=H[1],K=i(e.useState(!1),2),J=K[0],$=K[1],G=i(e.useState(!1),2),Y=G[0],Q=G[1],X=i(e.useState(!1),2),Z=X[0],ee=X[1],te=i(e.useState(!1),2),ne=te[0],re=te[1],se=i(e.useState("Support Agent"),2),oe=se[0],ie=se[1],ae=i(e.useState(0),2),ce=ae[0],ue=ae[1],le=i(e.useState(!1),2),he=le[0],de=le[1],pe=i(e.useState("active"),2),fe=pe[0],me=pe[1],ge=e.useRef(!1),ye=e.useRef(null);e.useEffect(function(){var e;null===(e=ye.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[j]),e.useEffect(function(){return function(){q&&q.disconnect()}},[q]);var be=function(){return f?{name:f.name||"Guest User",email:f.email||null,phone:f.phone||null,userId:f.userId||null}:{name:localStorage.getItem("chatGuestName")||"Guest User",email:localStorage.getItem("chatGuestEmail")||null,phone:localStorage.getItem("chatGuestPhone")||null,userId:localStorage.getItem("chatUserId")||null}},we=function(){var e=r(s().m(function e(){var t,r,o,i,a,u,l;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=be(),Q(!0),e.p=1,console.log("πŸš€ Creating new conversation for first message..."),e.n=2,In.post("".concat(c,"/api/v1/webhook/guest-conversation"),{apiKey:n,guestName:t.name,guestEmail:t.email,guestPhone:t.phone,customUserId:t.userId});case 2:if(!(r=e.v).data.success){e.n=3;break}return o=r.data,i=o.conversationId,a=o.petitionId,u=o.queryId,z(u),W(i),de(!0),localStorage.setItem("chatGuestId",u),localStorage.setItem("chatConversationId",i),localStorage.setItem("chatPetitionId",a),console.log("βœ… Conversation created:",{petitionId:a,queryId:u}),e.a(2,{newConvId:i,petitionId:a});case 3:throw new Error("Failed to create conversation");case 4:throw e.p=4,l=e.v,console.error("❌ Create conversation error:",l),l;case 5:return e.p=5,Q(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),ve=function(){var e=r(s().m(function e(t){var r,o;return s().w(function(e){for(;;)if(0===e.n)return r=t.convId,o=t.petitionId,ee(!0),e.a(2,new Promise(function(e,t){try{var s=Ce("".concat(c,"/widget"),{query:{conversationId:r,petitionId:o,apiKey:n},transports:["websocket","polling"]});s.on("connect",function(){$(!0),ee(!1),console.log("βœ… Connected to Chat CRM Widget Namespace"),e(s)}),s.on("connect_error",function(e){ee(!1),console.error("❌ Socket connect_error:",(null==e?void 0:e.message)||e)}),s.on("error",function(e){console.error("❌ Socket error:",e)}),s.on("disconnect",function(){$(!1),console.log("❌ Disconnected from Chat CRM")}),s.on("new-message",function(e){console.log("πŸ“¨ Received new-message:",e);var t={message:e.message||e.text||"",sender:e.sender||"agent",senderName:e.senderName||"Agent",timestamp:e.timestamp||new Date,read:!1};L(function(e){return[].concat(a(e),[t])}),ie(e.senderName||"Support Agent"),re(!1),!C&&_&&(ue(function(e){return e+1}),x&&_e())}),s.on("query-accepted",function(e){console.log("βœ… Query accepted by agent:",e),ie(e.agentName||"Support Agent"),me("active"),L(function(t){return[].concat(a(t),[{message:e.message||"".concat(e.agentName," has accepted your query"),sender:"system",timestamp:new Date,read:!0}])})}),s.on("query-transferred",function(e){console.log("πŸ”„ Query transferred:",e),ie(e.toAgentName||"Support Agent"),L(function(t){return[].concat(a(t),[{message:e.message||"Your query has been transferred to ".concat(e.toAgentName),sender:"system",timestamp:new Date,read:!0}])})}),s.on("query-resolved",function(e){console.log("βœ… Query resolved:",e),me("resolved"),ge.current?console.log("πŸ” Skipping duplicate resolved system message"):(ge.current=!0,L(function(e){return[].concat(a(e),[{message:'βœ… This query has been resolved by the agent. Click "New Query" to start a new conversation.',sender:"system",timestamp:new Date,read:!0}])}))}),s.on("query-reopened",function(e){console.log("πŸ”„ Query reopened:",e),me("active"),ge.current=!1}),s.on("agent-typing",function(e){re(!0),ie(e.agentName||"Support Agent"),setTimeout(function(){return re(!1)},3e3)}),D(s)}catch(e){ee(!1),t(e)}}))},e)}));return function(t){return e.apply(this,arguments)}}(),Ee=function(){var e=r(s().m(function e(){var t,n,r,o,i,c,u,l,h;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:if(U.trim()&&"resolved"!==fe){e.n=1;break}return e.a(2);case 1:if(t=be(),n=U.trim(),r=Date.now(),L(function(e){return[].concat(a(e),[{message:n,sender:"guest",senderName:t.name||"Guest User",read:!0,timestamp:new Date,tempId:r}])}),I(""),e.p=2,o=localStorage.getItem("chatPetitionId"),i=V||localStorage.getItem("chatConversationId"),o&&i){e.n=4;break}return e.n=3,we();case 3:c=e.v,i=c.newConvId,o=c.petitionId;case 4:if((u=q)&&J){e.n=6;break}try{q&&q.disconnect()}catch(e){}return e.n=5,ve({convId:i,petitionId:o});case 5:u=e.v;case 6:l={conversationId:i,petitionId:o,message:n,senderName:t.name||"Guest User",senderType:"Customer",timestamp:new Date},console.log("πŸ“€ Sending message:",l),u.emit("widget-message",l),e.n=8;break;case 7:e.p=7,h=e.v,console.error("❌ Send message error:",h),L(function(e){return e.filter(function(e){return e.tempId!==r})}),alert("Failed to send message. Please try again.");case 8:return e.a(2)}},e,null,[[2,7]])}));return function(){return e.apply(this,arguments)}}(),_e=function(){var e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination),t.frequency.value=800,t.type="sine",n.gain.value=.1,t.start(),setTimeout(function(){return t.stop()},200)},ke=function(){var e={"bottom-right":"crm-bottom-6 crm-right-6","bottom-left":"crm-bottom-6 crm-left-6","top-right":"crm-top-6 crm-right-6","top-left":"crm-top-6 crm-left-6"};return e[d]||e["bottom-right"]},xe="dark"===O||"auto"===O&&window.matchMedia("(prefers-color-scheme: dark)").matches;return e.createElement("div",{className:"crm-widget-container",style:{zIndex:A}},e.createElement("button",{onClick:function(){N(!0),ue(0)},className:"crm-chat-button ".concat(ke()),style:{backgroundColor:l},"aria-label":"Open chat"},C?e.createElement("svg",{className:"crm-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})):e.createElement("svg",{className:"crm-icon",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})),!C&&ce>0&&e.createElement("span",{className:"crm-badge"},ce)),C&&e.createElement("div",{className:"crm-chat-window ".concat(ke()," ").concat(xe?"crm-dark":"")},e.createElement("div",{className:"crm-header",style:{backgroundColor:l}},e.createElement("div",{className:"crm-header-content"},e.createElement("div",{className:"crm-avatar"},"πŸ’¬"),e.createElement("div",null,e.createElement("h3",{className:"crm-title"},b),e.createElement("div",{className:"crm-status"},e.createElement("div",{className:"crm-status-dot ".concat(J?"crm-online":"crm-offline")}),e.createElement("span",null,"resolved"===fe?e.createElement("span",{style:{color:"#10B981"}},"βœ“ Resolved"):"Support Agent"!==oe?e.createElement("span",null,"πŸ’¬ ",oe):J?"Online":Z?"Connecting…":"Ready")))),e.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},e.createElement("button",{onClick:function(){localStorage.removeItem("chatGuestId"),localStorage.removeItem("chatConversationId"),localStorage.removeItem("chatPetitionId"),q&&q.disconnect(),D(null),z(null),W(null),$(!1),de(!1),me("active"),ge.current=!1,L([]),I(""),console.log("πŸ†• Starting new query...")},className:"crm-new-query-btn",title:"Start New Query"},e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"}))),e.createElement("button",{onClick:function(){return N(!1)},className:"crm-close-btn"},e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))),e.createElement("div",{className:"crm-messages"},!he&&0===j.length&&e.createElement("div",{className:"crm-welcome-message"},e.createElement("p",null,g),e.createElement("p",{style:{fontSize:"0.875rem",marginTop:"8px",opacity:.7}},"πŸ‘‹ Start typing to begin your conversation")),j.map(function(t,n){return e.createElement("div",{key:n,className:"crm-message ".concat("guest"===t.sender?"crm-message-guest":"system"===t.sender?"crm-message-system":"crm-message-agent")},e.createElement("div",{className:"crm-message-bubble",style:"guest"===t.sender?{backgroundColor:l}:"system"===t.sender?{backgroundColor:"#F3F4F6",color:"#374151",border:"1px solid #E5E7EB"}:{}},"agent"===t.sender&&e.createElement("p",{className:"crm-agent-name"},t.senderName||oe),e.createElement("p",{className:"crm-message-text"},t.message),e.createElement("p",{className:"crm-message-time"},(r=t.timestamp,new Date(r).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})))));var r}),ne&&e.createElement("div",{className:"crm-message crm-message-agent"},e.createElement("div",{className:"crm-message-bubble"},e.createElement("div",{className:"crm-typing-indicator"},e.createElement("div",{className:"crm-typing-dot"}),e.createElement("div",{className:"crm-typing-dot"}),e.createElement("div",{className:"crm-typing-dot"})))),e.createElement("div",{ref:ye})),e.createElement("div",{className:"crm-input-container"},e.createElement("div",{className:"crm-input-wrapper"},e.createElement("textarea",{value:U,onChange:function(e){return I(e.target.value)},onKeyPress:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),Ee())},placeholder:"resolved"===fe?"Query is resolved. Start a new query to continue.":"Type your message...",rows:"1",className:"crm-input",disabled:"resolved"===fe}),e.createElement("button",{onClick:Ee,disabled:!U.trim()||Y||"resolved"===fe,className:"crm-send-btn",style:{backgroundColor:l}},Y?e.createElement("svg",{className:"crm-icon-sm crm-spin",fill:"none",viewBox:"0 0 24 24"},e.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})):e.createElement("svg",{className:"crm-icon-sm",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})))),e.createElement("p",{className:"crm-input-hint"},he?"Press Enter to send β€’ Shift+Enter for new line":"Send your first message to start conversation"))))};
4
4
  //# sourceMappingURL=index.js.map