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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import e,{useState as t,useRef as n,useEffect as r}from"react";function s(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 o(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 i(e){return function(){var t=this,n=arguments;return new Promise(function(r,s){var i=e.apply(t,n);function a(e){o(i,r,s,a,c,"next",e)}function c(e){o(i,r,s,a,c,"throw",e)}a(void 0)})}}function a(){
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",s=n.toStringTag||"@@toStringTag";function o(n,r,s,o){var a=r&&r.prototype instanceof l?r:l,u=Object.create(a.prototype);return c(u,"_invoke",function(n,r,s){var o,a,c,l=0,u=s||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return o=t,a=0,c=e,d.n=n,i}};function p(n,r){for(a=n,c=r,t=0;!h&&l&&!s&&t<u.length;t++){var s,o=u[t],p=d.p,f=o[2];n>3?(s=f===r)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=e):o[0]<=p&&((s=n<2&&p<o[1])?(a=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,a=0))}if(s||n>1)return i;throw h=!0,r}return function(s,u,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,c=f;(t=a<2?e:c)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,c)):d.n=c:d.v=c);try{if(l=2,o){if(a||(s="next"),t=o[s]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=o.return)&&t.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+s+"' method"),a=1);o=e}else if((t=(h=d.n<0)?c:n.call(r,d))!==i)break}catch(t){o=e,a=1,c=t}finally{l=1}}return{value:t,done:h}}}(n,s,o),!0),u}var i={};function l(){}function u(){}function h(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),p=h.prototype=l.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,c(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return u.prototype=h,c(p,"constructor",h),c(h,"constructor",u),u.displayName="GeneratorFunction",c(h,s,"GeneratorFunction"),c(p),c(p,s,"Generator"),c(p,r,function(){return this}),c(p,"toString",function(){return"[object Generator]"}),(a=function(){return{w:o,m:f}})()}function c(e,t,n,r){var s=Object.defineProperty;try{s({},"",{})}catch(e){s=0}c=function(e,t,n,r){function o(t,n){c(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:(o("next",0),o("throw",1),o("return",2))},c(e,t,n,r)}function l(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,l=!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){l=!0,s=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw s}}return a}}(e,t)||h(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 u(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(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 h(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}const d=Object.create(null);d.open="0",d.close="1",d.ping="2",d.pong="3",d.message="4",d.upgrade="5",d.noop="6";const p=Object.create(null);Object.keys(d).forEach(e=>{p[d[e]]=e});const f={type:"error",data:"parser error"},m="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),g="function"==typeof ArrayBuffer,y=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,b=({type:e,data:t},n,r)=>m&&t instanceof Blob?n?r(t):w(t,r):g&&(t instanceof ArrayBuffer||y(t))?n?r(t):w(new Blob([t]),r):r(d[e]+(t||"")),w=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function v(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let E;const _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)k[_.charCodeAt(e)]=e;const x="function"==typeof ArrayBuffer,O=(e,t)=>{if("string"!=typeof e)return{type:"message",data:R(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:S(e.substring(1),t)};return p[n]?e.length>1?{type:p[n],data:e.substring(1)}:{type:p[n]}:f},S=(e,t)=>{if(x){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 l=new ArrayBuffer(i),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=k[e.charCodeAt(t)],r=k[e.charCodeAt(t+1)],s=k[e.charCodeAt(t+2)],o=k[e.charCodeAt(t+3)],u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|s>>2,u[c++]=(3&s)<<6|63&o;return l})(e);return R(n,t)}return{base64:!0,data:e}},R=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,A=String.fromCharCode(30);function T(){return new TransformStream({transform(e,t){!function(e,t){m&&e.data instanceof Blob?e.data.arrayBuffer().then(v).then(t):g&&(e.data instanceof ArrayBuffer||y(e.data))?t(v(e.data)):b(e,!1,e=>{E||(E=new TextEncoder),t(E.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 C;function N(e){return e.reduce((e,t)=>e+t.length,0)}function B(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 j(e){if(e)return function(e){for(var t in j.prototype)e[t]=j.prototype[t];return e}(e)}j.prototype.on=j.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},j.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},j.prototype.off=j.prototype.removeListener=j.prototype.removeAllListeners=j.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},j.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},j.prototype.emitReserved=j.prototype.emit,j.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},j.prototype.hasListeners=function(e){return!!this.listeners(e).length};const L="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),P="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function U(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const I=P.setTimeout,F=P.clearTimeout;function q(e,t){t.useNativeTimers?(e.setTimeoutFn=I.bind(P),e.clearTimeoutFn=F.bind(P)):(e.setTimeoutFn=P.setTimeout.bind(P),e.clearTimeoutFn=P.clearTimeout.bind(P))}function D(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 M(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class z extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class H extends j{constructor(e){super(),this.writable=!1,q(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 z(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=O(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 V extends H{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(A),r=[];for(let e=0;e<n.length;e++){const s=O(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)=>{b(e,!1,e=>{r[o]=e,++s===n&&t(r.join(A))})})})(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]=M()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let W=!1;try{W="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const K=W;function J(){}class $ extends V{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 G extends j{constructor(e,t,n){super(),this.createRequest=e,q(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=U(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=G.requestsCount++,G.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=J,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete G.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(G.requestsCount=0,G.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Y);else if("function"==typeof addEventListener){addEventListener("onpagehide"in P?"pagehide":"unload",Y,!1)}function Y(){for(let e in G.requests)G.requests.hasOwnProperty(e)&&G.requests[e].abort()}const Q=function(){const e=X({xdomain:!1});return e&&null!==e.responseType}();function X(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||K))return new XMLHttpRequest}catch(e){}if(!t)try{return new(P[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Z="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class ee extends H{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Z?{}:U(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;b(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&L(()=>{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]=M()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const te=P.WebSocket||P.MozWebSocket;const ne={websocket:class extends ee{createSocket(e,t,n){return Z?new te(e,t,n):t?new te(e,t):new te(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends H{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){C||(C=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(N(n)<1)break;const e=B(n,1);o=!(128&~e[0]),s=127&e[0],r=s<126?3:126===s?1:2}else if(1===r){if(N(n)<2)break;const e=B(n,2);s=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(N(n)<8)break;const e=B(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(f);break}s=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(N(n)<s)break;const e=B(n,s);a.enqueue(O(o?e:C.decode(e),t)),r=0}if(0===s||s>e){a.enqueue(f);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=T();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&&L(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends ${constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Q&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new G(X,this.uri(),e)}}},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,se=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function oe(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=re.exec(e||""),o={},i=14;for(;i--;)o[se[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 ie="function"==typeof addEventListener&&"function"==typeof removeEventListener,ae=[];ie&&addEventListener("offline",()=>{ae.forEach(e=>e())},!1);class ce extends j{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=oe(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=oe(t.host).host);q(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)),ie&&(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"})},ae.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&&ce.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",ce.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+=D(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,L(()=>{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(ce.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(),ie&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=ae.indexOf(this._offlineEventListener);-1!==e&&ae.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ce.protocol=4;class le extends ce{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;ce.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;ce.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(l(),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,l(),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 l=()=>{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 ue=class extends le{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=>ne[e]).filter(e=>!!e)),super(e,n)}};const he="function"==typeof ArrayBuffer,de=Object.prototype.toString,pe="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===de.call(Blob),fe="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===de.call(File);function me(e){return he&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||pe&&e instanceof Blob||fe&&e instanceof File}function ge(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(ge(e[t]))return!0;return!1}if(me(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return ge(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&ge(e[t]))return!0;return!1}function ye(e){const t=[],n=e.data,r=e;return r.data=be(n,t),r.attachments=t.length,{packet:r,buffers:t}}function be(e,t){if(!e)return e;if(me(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]=be(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]=be(e[r],t));return n}return e}function we(e,t){return e.data=ve(e.data,t),delete e.attachments,e}function ve(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]=ve(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=ve(e[n],t));return e}const Ee=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var _e;!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"}(_e||(_e={}));function ke(e){return"[object Object]"===Object.prototype.toString.call(e)}class xe extends j{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===_e.BINARY_EVENT;n||t.type===_e.BINARY_ACK?(t.type=n?_e.EVENT:_e.ACK,this.reconstructor=new Oe(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!me(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===_e[n.type])throw new Error("unknown packet type "+n.type);if(n.type===_e.BINARY_EVENT||n.type===_e.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(!xe.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 _e.CONNECT:return ke(t);case _e.DISCONNECT:return void 0===t;case _e.CONNECT_ERROR:return"string"==typeof t||ke(t);case _e.EVENT:case _e.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Ee.indexOf(t[0]));case _e.ACK:case _e.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Oe{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=we(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Se=Object.freeze({__proto__:null,Decoder:xe,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==_e.EVENT&&e.type!==_e.ACK||!ge(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===_e.EVENT?_e.BINARY_EVENT:_e.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==_e.BINARY_EVENT&&e.type!==_e.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=ye(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return _e},protocol:5});function Re(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Ae=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Te extends j{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=[Re(e,"open",this.onopen.bind(this)),Re(e,"packet",this.onpacket.bind(this)),Re(e,"error",this.onerror.bind(this)),Re(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(Ae.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:_e.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:_e.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 _e.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 _e.EVENT:case _e.BINARY_EVENT:this.onevent(e);break;case _e.ACK:case _e.BINARY_ACK:this.onack(e);break;case _e.DISCONNECT:this.ondisconnect();break;case _e.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:_e.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:_e.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 Ce(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}Ce.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)},Ce.prototype.reset=function(){this.attempts=0},Ce.prototype.setMin=function(e){this.ms=e},Ce.prototype.setMax=function(e){this.max=e},Ce.prototype.setJitter=function(e){this.jitter=e};class Ne extends j{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,q(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 Ce({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||Se;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 ue(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Re(t,"open",function(){n.onopen(),e&&e()}),s=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=Re(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(Re(e,"ping",this.onping.bind(this)),Re(e,"data",this.ondata.bind(this)),Re(e,"error",this.onerror.bind(this)),Re(e,"close",this.onclose.bind(this)),Re(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){L(()=>{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 Te(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 Be={};function je(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=oe(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=Be[s]&&o in Be[s].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||i?a=new Ne(r,t):(Be[s]||(Be[s]=new Ne(r,t)),a=Be[s]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function Le(e,t){return function(){return e.apply(t,arguments)}}Object.assign(je,{Manager:Ne,Socket:Te,io:je,connect:je});const{toString:Pe}=Object.prototype,{getPrototypeOf:Ue}=Object,{iterator:Ie,toStringTag:Fe}=Symbol,qe=(e=>t=>{const n=Pe.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),De=e=>(e=e.toLowerCase(),t=>qe(t)===e),Me=e=>t=>typeof t===e,{isArray:ze}=Array,He=Me("undefined");function Ve(e){return null!==e&&!He(e)&&null!==e.constructor&&!He(e.constructor)&&Je(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const We=De("ArrayBuffer");const Ke=Me("string"),Je=Me("function"),$e=Me("number"),Ge=e=>null!==e&&"object"==typeof e,Ye=e=>{if("object"!==qe(e))return!1;const t=Ue(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Fe in e||Ie in e)},Qe=De("Date"),Xe=De("File"),Ze=De("Blob"),et=De("FileList"),tt=De("URLSearchParams"),[nt,rt,st,ot]=["ReadableStream","Request","Response","Headers"].map(De);function it(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),ze(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Ve(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 at(e,t){if(Ve(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 ct="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,lt=e=>!He(e)&&e!==ct;const ut=(ht="undefined"!=typeof Uint8Array&&Ue(Uint8Array),e=>ht&&e instanceof ht);var ht;const dt=De("HTMLFormElement"),pt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ft=De("RegExp"),mt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};it(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)};const gt=De("AsyncFunction"),yt=(bt="function"==typeof setImmediate,wt=Je(ct.postMessage),bt?setImmediate:wt?(vt=`axios@${Math.random()}`,Et=[],ct.addEventListener("message",({source:e,data:t})=>{e===ct&&t===vt&&Et.length&&Et.shift()()},!1),e=>{Et.push(e),ct.postMessage(vt,"*")}):e=>setTimeout(e));var bt,wt,vt,Et;const _t="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ct):"undefined"!=typeof process&&process.nextTick||yt;var kt={isArray:ze,isArrayBuffer:We,isBuffer:Ve,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Je(e.append)&&("formdata"===(t=qe(e))||"object"===t&&Je(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&We(e.buffer),t},isString:Ke,isNumber:$e,isBoolean:e=>!0===e||!1===e,isObject:Ge,isPlainObject:Ye,isEmptyObject:e=>{if(!Ge(e)||Ve(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:nt,isRequest:rt,isResponse:st,isHeaders:ot,isUndefined:He,isDate:Qe,isFile:Xe,isBlob:Ze,isRegExp:ft,isFunction:Je,isStream:e=>Ge(e)&&Je(e.pipe),isURLSearchParams:tt,isTypedArray:ut,isFileList:et,forEach:it,merge:function e(){const{caseless:t,skipUndefined:n}=lt(this)&&this||{},r={},s=(s,o)=>{const i=t&&at(r,o)||o;Ye(r[i])&&Ye(s)?r[i]=e(r[i],s):Ye(s)?r[i]=e({},s):ze(s)?r[i]=s.slice():n&&He(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&it(arguments[e],s);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(it(t,(t,r)=>{n&&Je(t)?e[r]=Le(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&&Ue(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:qe,kindOfTest:De,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(ze(e))return e;let t=e.length;if(!$e(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Ie]).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:dt,hasOwnProperty:pt,hasOwnProp:pt,reduceDescriptors:mt,freezeMethods:e=>{mt(e,(t,n)=>{if(Je(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Je(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 ze(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:at,global:ct,isContextDefined:lt,isSpecCompliantForm:function(e){return!!(e&&Je(e.append)&&"FormData"===e[Fe]&&e[Ie])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Ge(e)){if(t.indexOf(e)>=0)return;if(Ve(e))return e;if(!("toJSON"in e)){t[r]=e;const s=ze(e)?[]:{};return it(e,(e,t)=>{const o=n(e,r+1);!He(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:gt,isThenable:e=>e&&(Ge(e)||Je(e))&&Je(e.then)&&Je(e.catch),setImmediate:yt,asap:_t,isIterable:e=>null!=e&&Je(e[Ie])};function xt(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)}kt.inherits(xt,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:kt.toJSONObject(this.config),code:this.code,status:this.status}}});const Ot=xt.prototype,St={};["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=>{St[e]={value:e}}),Object.defineProperties(xt,St),Object.defineProperty(Ot,"isAxiosError",{value:!0}),xt.from=(e,t,n,r,s,o)=>{const i=Object.create(Ot);kt.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 xt.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 Rt(e){return kt.isPlainObject(e)||kt.isArray(e)}function At(e){return kt.endsWith(e,"[]")?e.slice(0,-2):e}function Tt(e,t,n){return e?e.concat(t).map(function(e,t){return e=At(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Ct=kt.toFlatObject(kt,{},null,function(e){return/^is[A-Z]/.test(e)});function Nt(e,t,n){if(!kt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=kt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!kt.isUndefined(t[e])})).metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&kt.isSpecCompliantForm(t);if(!kt.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(kt.isDate(e))return e.toISOString();if(kt.isBoolean(e))return e.toString();if(!a&&kt.isBlob(e))throw new xt("Blob is not supported. Use a Buffer instead.");return kt.isArrayBuffer(e)||kt.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(kt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(kt.isArray(e)&&function(e){return kt.isArray(e)&&!e.some(Rt)}(e)||(kt.isFileList(e)||kt.endsWith(n,"[]"))&&(a=kt.toArray(e)))return n=At(n),a.forEach(function(e,r){!kt.isUndefined(e)&&null!==e&&t.append(!0===i?Tt([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!Rt(e)||(t.append(Tt(s,n,o),c(e)),!1)}const u=[],h=Object.assign(Ct,{defaultVisitor:l,convertValue:c,isVisitable:Rt});if(!kt.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!kt.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),kt.forEach(n,function(n,o){!0===(!(kt.isUndefined(n)||null===n)&&s.call(t,n,kt.isString(o)?o.trim():o,r,h))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t}function Bt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function jt(e,t){this._pairs=[],e&&Nt(e,this,t)}const Lt=jt.prototype;function Pt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ut(e,t,n){if(!t)return e;const r=n&&n.encode||Pt;kt.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(o=s?s(t,n):kt.isURLSearchParams(t)?t.toString():new jt(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Lt.append=function(e,t){this._pairs.push([e,t])},Lt.toString=function(e){const t=e?function(t){return e.call(this,t,Bt)}:Bt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class It{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){kt.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Ft={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},qt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:jt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Dt="undefined"!=typeof window&&"undefined"!=typeof document,Mt="object"==typeof navigator&&navigator||void 0,zt=Dt&&(!Mt||["ReactNative","NativeScript","NS"].indexOf(Mt.product)<0),Ht="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Vt=Dt&&window.location.href||"http://localhost";var Wt={...Object.freeze({__proto__:null,hasBrowserEnv:Dt,hasStandardBrowserEnv:zt,hasStandardBrowserWebWorkerEnv:Ht,navigator:Mt,origin:Vt}),...qt};function Kt(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&&kt.isArray(r)?r.length:o,a)return kt.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i;r[o]&&kt.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],s)&&kt.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(kt.isFormData(e)&&kt.isFunction(e.entries)){const n={};return kt.forEachEntry(e,(e,r)=>{t(function(e){return kt.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Jt={transitional:Ft,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=kt.isObject(e);s&&kt.isHTMLForm(e)&&(e=new FormData(e));if(kt.isFormData(e))return r?JSON.stringify(Kt(e)):e;if(kt.isArrayBuffer(e)||kt.isBuffer(e)||kt.isStream(e)||kt.isFile(e)||kt.isBlob(e)||kt.isReadableStream(e))return e;if(kt.isArrayBufferView(e))return e.buffer;if(kt.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 Nt(e,new Wt.classes.URLSearchParams,{visitor:function(e,t,n,r){return Wt.isNode&&kt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=kt.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Nt(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(kt.isString(e))try{return(t||JSON.parse)(e),kt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Jt.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(kt.isResponse(e)||kt.isReadableStream(e))return e;if(e&&kt.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 xt.from(e,xt.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:Wt.classes.FormData,Blob:Wt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};kt.forEach(["delete","get","head","post","put","patch"],e=>{Jt.headers[e]={}});const $t=kt.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 Gt=Symbol("internals");function Yt(e){return e&&String(e).trim().toLowerCase()}function Qt(e){return!1===e||null==e?e:kt.isArray(e)?e.map(Qt):String(e)}function Xt(e,t,n,r,s){return kt.isFunction(r)?r.call(this,t,n):(s&&(t=n),kt.isString(t)?kt.isString(r)?-1!==t.indexOf(r):kt.isRegExp(r)?r.test(t):void 0:void 0)}let Zt=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=Yt(t);if(!s)throw new Error("header name must be a non-empty string");const o=kt.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=Qt(e))}const o=(e,t)=>kt.forEach(e,(e,n)=>s(e,n,t));if(kt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(kt.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]&&$t[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(kt.isObject(e)&&kt.isIterable(e)){let n,r,s={};for(const t of e){if(!kt.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?kt.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=Yt(e)){const n=kt.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(kt.isFunction(t))return t.call(this,e,n);if(kt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Yt(e)){const n=kt.findKey(this,e);return!(!n||void 0===this[n]||t&&!Xt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=Yt(e)){const s=kt.findKey(n,e);!s||t&&!Xt(0,n[s],s,t)||(delete n[s],r=!0)}}return kt.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&&!Xt(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return kt.forEach(this,(r,s)=>{const o=kt.findKey(n,s);if(o)return t[o]=Qt(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]=Qt(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return kt.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&kt.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[Gt]=this[Gt]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Yt(e);t[r]||(!function(e,t){const n=kt.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 kt.isArray(e)?e.forEach(r):r(e),this}};function en(e,t){const n=this||Jt,r=t||n,s=Zt.from(r.headers);let o=r.data;return kt.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function tn(e){return!(!e||!e.__CANCEL__)}function nn(e,t,n){xt.call(this,null==e?"canceled":e,xt.ERR_CANCELED,t,n),this.name="CanceledError"}function rn(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new xt("Request failed with status code "+n.status,[xt.ERR_BAD_REQUEST,xt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),kt.reduceDescriptors(Zt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),kt.freezeMethods(Zt),kt.inherits(nn,xt,{__CANCEL__:!0});const sn=(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(),l=r[i];s||(s=c),n[o]=a,r[o]=c;let u=i,h=0;for(;u!==o;)h+=n[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const d=l&&c-l;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)},on=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},an=e=>(...t)=>kt.asap(()=>e(...t));var cn=Wt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Wt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Wt.origin),Wt.navigator&&/(msie|trident)/i.test(Wt.navigator.userAgent)):()=>!0,ln=Wt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];kt.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),kt.isString(r)&&a.push(`path=${r}`),kt.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),kt.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 un(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 hn=e=>e instanceof Zt?{...e}:e;function dn(e,t){t=t||{};const n={};function r(e,t,n,r){return kt.isPlainObject(e)&&kt.isPlainObject(t)?kt.merge.call({caseless:r},e,t):kt.isPlainObject(t)?kt.merge({},t):kt.isArray(t)?t.slice():t}function s(e,t,n,s){return kt.isUndefined(t)?kt.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!kt.isUndefined(t))return r(void 0,t)}function i(e,t){return kt.isUndefined(t)?kt.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(hn(e),hn(t),0,!0)};return kt.forEach(Object.keys({...e,...t}),function(r){const o=c[r]||s,i=o(e[r],t[r],r);kt.isUndefined(i)&&o!==a||(n[r]=i)}),n}var pn=e=>{const t=dn({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Zt.from(i),t.url=Ut(un(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),kt.isFormData(n))if(Wt.hasStandardBrowserEnv||Wt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(kt.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(Wt.hasStandardBrowserEnv&&(r&&kt.isFunction(r)&&(r=r(t)),r||!1!==r&&cn(t.url))){const e=s&&o&&ln.read(o);e&&i.set(s,e)}return t};var fn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=pn(e);let s=r.data;const o=Zt.from(r.headers).normalize();let i,a,c,l,u,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Zt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());rn(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 xt("Request aborted",xt.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new xt(t&&t.message?t.message:"Network Error",xt.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||Ft;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new xt(t,s.clarifyTimeoutError?xt.ETIMEDOUT:xt.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&kt.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),kt.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([c,u]=sn(p,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,l]=sn(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new nn(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===Wt.protocols.indexOf(y)?n(new xt("Unsupported protocol "+y+":",xt.ERR_BAD_REQUEST,e)):m.send(s||null)})};const mn=(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 xt?t:new nn(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new xt(`timeout ${t} of ms exceeded`,xt.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=()=>kt.asap(i),a}},gn=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},yn=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()}},bn=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of yn(e))yield*gn(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:wn}=kt,vn=(({Request:e,Response:t})=>({Request:e,Response:t}))(kt.global),{ReadableStream:En,TextEncoder:_n}=kt.global,kn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},xn=e=>{e=kt.merge.call({skipUndefined:!0},vn,e);const{fetch:t,Request:n,Response:r}=e,s=t?wn(t):"function"==typeof fetch,o=wn(n),i=wn(r);if(!s)return!1;const a=s&&wn(En),c=s&&("function"==typeof _n?(l=new _n,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=o&&a&&kn(()=>{let e=!1;const t=new n(Wt.origin,{body:new En,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),h=i&&a&&kn(()=>kt.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 xt(`Response type '${e}' is not supported`,xt.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=kt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(kt.isBlob(e))return e.size;if(kt.isSpecCompliantForm(e)){const t=new n(Wt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return kt.isArrayBufferView(e)||kt.isArrayBuffer(e)?e.byteLength:(kt.isURLSearchParams(e)&&(e+=""),kt.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:w="same-origin",fetchOptions:v}=pn(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let _=mn([c,l&&l.toAbortSignal()],f),k=null;const x=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let O;try{if(g&&u&&"get"!==i&&"head"!==i&&0!==(O=await p(b,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(kt.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=on(O,sn(an(g)));a=bn(t.body,65536,e,n)}}kt.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 l=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]=l[t]});const t=kt.toFiniteNumber(l.headers.get("content-length")),[n,s]=m&&on(t,sn(an(m),!0))||[];l=new r(bn(l.body,65536,n,()=>{s&&s(),x&&x()}),e)}y=y||"text";let S=await d[kt.findKey(d,y)||"text"](l,e);return!f&&x&&x(),await new Promise((t,n)=>{rn(t,n,{data:S,headers:Zt.from(l.headers),status:l.status,statusText:l.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 xt("Network Error",xt.ERR_NETWORK,e,k),{cause:t.cause||t});throw xt.from(t,t&&t.code,e,k)}}},On=new Map,Sn=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,l=On;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:xn(t)),l=a;return a};Sn();const Rn={http:null,xhr:fn,fetch:{get:Sn}};kt.forEach(Rn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const An=e=>`- ${e}`,Tn=e=>kt.isFunction(e)||null===e||!1===e;var Cn={getAdapter:function(e,t){e=kt.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,!Tn(r)&&(s=Rn[(n=String(r)).toLowerCase()],void 0===s))throw new xt(`Unknown adapter '${n}'`);if(s&&(kt.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 xt("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(An).join("\n"):" "+An(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s},adapters:Rn};function Nn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nn(null,e)}function Bn(e){Nn(e),e.headers=Zt.from(e.headers),e.data=en.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Cn.getAdapter(e.adapter||Jt.adapter,e)(e).then(function(t){return Nn(e),t.data=en.call(e,e.transformResponse,t),t.headers=Zt.from(t.headers),t},function(t){return tn(t)||(Nn(e),t&&t.response&&(t.response.data=en.call(e,e.transformResponse,t.response),t.response.headers=Zt.from(t.response.headers))),Promise.reject(t)})}const jn="1.13.2",Ln={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ln[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Pn={};Ln.transitional=function(e,t,n){function r(e,t){return"[Axios v"+jn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new xt(r(s," has been removed"+(t?" in "+t:"")),xt.ERR_DEPRECATED);return t&&!Pn[s]&&(Pn[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)}},Ln.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var Un={assertOptions:function(e,t,n){if("object"!=typeof e)throw new xt("options must be an object",xt.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 xt("option "+o+" must be "+n,xt.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new xt("Unknown option "+o,xt.ERR_BAD_OPTION)}},validators:Ln};const In=Un.validators;let Fn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new It,response:new It}}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=dn(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&Un.assertOptions(n,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),null!=r&&(kt.isFunction(r)?t.paramsSerializer={serialize:r}:Un.assertOptions(r,{encode:In.function,serialize:In.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Un.assertOptions(t,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&kt.merge(s.common,s[t.method]);s&&kt.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Zt.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 l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,h=0;if(!a){const e=[Bn.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);h<u;)l=l.then(e[h++],e[h++]);return l}u=i.length;let d=t;for(;h<u;){const e=i[h++],t=i[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{l=Bn.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,u=c.length;h<u;)l=l.then(c[h++],c[h++]);return l}getUri(e){return Ut(un((e=dn(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};kt.forEach(["delete","get","head","options"],function(e){Fn.prototype[e]=function(t,n){return this.request(dn(n||{},{method:e,url:t,data:(n||{}).data}))}}),kt.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(dn(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Fn.prototype[e]=t(),Fn.prototype[e+"Form"]=t(!0)});const qn={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(qn).forEach(([e,t])=>{qn[t]=e});const Dn=function e(t){const n=new Fn(t),r=Le(Fn.prototype.request,n);return kt.extend(r,Fn.prototype,n,{allOwnKeys:!0}),kt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(dn(t,n))},r}(Jt);Dn.Axios=Fn,Dn.CanceledError=nn,Dn.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 nn(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}}},Dn.isCancel=tn,Dn.VERSION=jn,Dn.toFormData=Nt,Dn.AxiosError=xt,Dn.Cancel=Dn.CanceledError,Dn.all=function(e){return Promise.all(e)},Dn.spread=function(e){return function(t){return e.apply(null,t)}},Dn.isAxiosError=function(e){return kt.isObject(e)&&!0===e.isAxiosError},Dn.mergeConfig=dn,Dn.AxiosHeaders=Zt,Dn.formToJSON=e=>Kt(kt.isHTMLForm(e)?new FormData(e):e),Dn.getAdapter=Cn.getAdapter,Dn.HttpStatusCode=qn,Dn.default=Dn;const{Axios:Mn,AxiosError:zn,CanceledError:Hn,isCancel:Vn,CancelToken:Wn,VERSION:Kn,all:Jn,Cancel:$n,isAxiosError:Gn,spread:Yn,toFormData:Qn,AxiosHeaders:Xn,HttpStatusCode:Zn,formToJSON:er,getAdapter:tr,mergeConfig:nr}=Dn;!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}");var rr=function(s){var o=s.apiKey,c=s.apiUrl,h=void 0===c?"https://chat-crm-backend-7mzo.onrender.com":c,d=s.primaryColor,p=void 0===d?"#4F46E5":d,f=s.position,m=void 0===f?"bottom-right":f,g=s.userData,y=void 0===g?null:g,b=s.welcomeMessage,w=void 0===b?"πŸ‘‹ Welcome! How can we help you today?":b,v=s.companyName,E=void 0===v?"Support":v,_=s.autoOpen,k=void 0!==_&&_,x=s.showNotifications,O=void 0===x||x,S=s.playSound,R=void 0!==S&&S,A=s.theme,T=void 0===A?"light":A,C=s.zIndex,N=void 0===C?9999:C,B=l(t(k),2),j=B[0],L=B[1],P=l(t([]),2),U=P[0],I=P[1],F=l(t(""),2),q=F[0],D=F[1],M=l(t(null),2),z=M[0],H=M[1],V=l(t(null),2);V[0];var W=V[1],K=l(t(null),2),J=K[0],$=K[1],G=l(t(!1),2),Y=G[0],Q=G[1],X=l(t(!1),2),Z=X[0],ee=X[1],te=l(t(!1),2),ne=te[0],re=te[1],se=l(t(!1),2),oe=se[0],ie=se[1],ae=l(t("Support Agent"),2),ce=ae[0],le=ae[1],ue=l(t(0),2),he=ue[0],de=ue[1],pe=l(t(!1),2),fe=pe[0],me=pe[1],ge=l(t("active"),2),ye=ge[0],be=ge[1],we=n(null);r(function(){var e;null===(e=we.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[U]),r(function(){return function(){z&&z.disconnect()}},[z]);var ve=function(){return y?{name:y.name||"Guest User",email:y.email||null,phone:y.phone||null,userId:y.userId||null}:{name:localStorage.getItem("chatGuestName")||"Guest User",email:localStorage.getItem("chatGuestEmail")||null,phone:localStorage.getItem("chatGuestPhone")||null,userId:localStorage.getItem("chatUserId")||null}},Ee=function(){var e=i(a().m(function e(){var t,n,r,s,i,c,l;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=ve(),ee(!0),e.p=1,console.log("πŸš€ Creating new conversation for first message..."),e.n=2,Dn.post("".concat(h,"/api/v1/webhook/guest-conversation"),{apiKey:o,guestName:t.name,guestEmail:t.email,guestPhone:t.phone,customUserId:t.userId});case 2:if(!(n=e.v).data.success){e.n=3;break}return r=n.data,s=r.conversationId,i=r.petitionId,c=r.queryId,W(c),$(s),me(!0),localStorage.setItem("chatGuestId",c),localStorage.setItem("chatConversationId",s),localStorage.setItem("chatPetitionId",i),console.log("βœ… Conversation created:",{petitionId:i,queryId:c}),e.a(2,{newConvId:s,petitionId:i});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,ee(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),_e=function(){var e=i(a().m(function e(t){var n,r;return a().w(function(e){for(;;)if(0===e.n)return n=t.convId,r=t.petitionId,re(!0),e.a(2,new Promise(function(e,t){try{var s=je("".concat(h,"/widget"),{query:{conversationId:n,petitionId:r,apiKey:o},transports:["websocket","polling"]});s.on("connect",function(){Q(!0),re(!1),console.log("βœ… Connected to Chat CRM Widget Namespace"),e(s)}),s.on("connect_error",function(e){re(!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(){Q(!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};I(function(e){return[].concat(u(e),[t])}),le(e.senderName||"Support Agent"),ie(!1),!j&&O&&(de(function(e){return e+1}),R&&xe())}),s.on("query-accepted",function(e){console.log("βœ… Query accepted by agent:",e),le(e.agentName||"Support Agent"),be("active"),I(function(t){return[].concat(u(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),le(e.toAgentName||"Support Agent"),I(function(t){return[].concat(u(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),be("resolved"),I(function(e){return[].concat(u(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),be("active")}),s.on("agent-typing",function(e){ie(!0),le(e.agentName||"Support Agent"),setTimeout(function(){return ie(!1)},3e3)}),H(s)}catch(e){re(!1),t(e)}}))},e)}));return function(t){return e.apply(this,arguments)}}(),ke=function(){var e=i(a().m(function e(){var t,n,r,s,o,i,c,l,h;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(q.trim()&&"resolved"!==ye){e.n=1;break}return e.a(2);case 1:if(t=ve(),n=q.trim(),r=Date.now(),I(function(e){return[].concat(u(e),[{message:n,sender:"guest",senderName:t.name||"Guest User",read:!0,timestamp:new Date,tempId:r}])}),D(""),e.p=2,s=localStorage.getItem("chatPetitionId"),o=J||localStorage.getItem("chatConversationId"),s&&o){e.n=4;break}return e.n=3,Ee();case 3:i=e.v,o=i.newConvId,s=i.petitionId;case 4:if((c=z)&&Y){e.n=6;break}return e.n=5,_e({convId:o,petitionId:s});case 5:c=e.v;case 6:l={conversationId:o,petitionId:s,message:n,senderName:t.name||"Guest User",senderType:"Customer",timestamp:new Date},console.log("πŸ“€ Sending message:",l),c.emit("widget-message",l),e.n=8;break;case 7:e.p=7,h=e.v,console.error("❌ Send message error:",h),I(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)}}(),xe=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)},Oe=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[m]||e["bottom-right"]},Se="dark"===T||"auto"===T&&window.matchMedia("(prefers-color-scheme: dark)").matches;return e.createElement("div",{className:"crm-widget-container",style:{zIndex:N}},e.createElement("button",{onClick:function(){L(!0),de(0)},className:"crm-chat-button ".concat(Oe()),style:{backgroundColor:p},"aria-label":"Open chat"},j?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"})),!j&&he>0&&e.createElement("span",{className:"crm-badge"},he)),j&&e.createElement("div",{className:"crm-chat-window ".concat(Oe()," ").concat(Se?"crm-dark":"")},e.createElement("div",{className:"crm-header",style:{backgroundColor:p}},e.createElement("div",{className:"crm-header-content"},e.createElement("div",{className:"crm-avatar"},"πŸ’¬"),e.createElement("div",null,e.createElement("h3",{className:"crm-title"},E),e.createElement("div",{className:"crm-status"},e.createElement("div",{className:"crm-status-dot ".concat(Y?"crm-online":"crm-offline")}),e.createElement("span",null,"resolved"===ye?e.createElement("span",{style:{color:"#10B981"}},"βœ“ Resolved"):"Support Agent"!==ce?e.createElement("span",null,"πŸ’¬ ",ce):Y?"Online":ne?"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"),z&&z.disconnect(),H(null),W(null),$(null),Q(!1),me(!1),be("active"),I([]),D(""),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 L(!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"},!fe&&0===U.length&&e.createElement("div",{className:"crm-welcome-message"},e.createElement("p",null,w),e.createElement("p",{style:{fontSize:"0.875rem",marginTop:"8px",opacity:.7}},"πŸ‘‹ Start typing to begin your conversation")),U.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:p}:"system"===t.sender?{backgroundColor:"#F3F4F6",color:"#374151",border:"1px solid #E5E7EB"}:{}},"agent"===t.sender&&e.createElement("p",{className:"crm-agent-name"},t.senderName||ce),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}),oe&&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:we})),e.createElement("div",{className:"crm-input-container"},e.createElement("div",{className:"crm-input-wrapper"},e.createElement("textarea",{value:q,onChange:function(e){return D(e.target.value)},onKeyPress:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ke())},placeholder:"resolved"===ye?"Query is resolved. Start a new query to continue.":"Type your message...",rows:"1",className:"crm-input",disabled:"resolved"===ye}),e.createElement("button",{onClick:ke,disabled:!q.trim()||Z||"resolved"===ye,className:"crm-send-btn",style:{backgroundColor:p}},Z?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"},fe?"Press Enter to send β€’ Shift+Enter for new line":"Send your first message to start conversation"))))};export{rr as ChatCRMWidget};
3
+ var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",s=n.toStringTag||"@@toStringTag";function o(n,r,s,o){var a=r&&r.prototype instanceof l?r:l,u=Object.create(a.prototype);return c(u,"_invoke",function(n,r,s){var o,a,c,l=0,u=s||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return o=t,a=0,c=e,d.n=n,i}};function p(n,r){for(a=n,c=r,t=0;!h&&l&&!s&&t<u.length;t++){var s,o=u[t],p=d.p,f=o[2];n>3?(s=f===r)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=e):o[0]<=p&&((s=n<2&&p<o[1])?(a=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,a=0))}if(s||n>1)return i;throw h=!0,r}return function(s,u,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,c=f;(t=a<2?e:c)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,c)):d.n=c:d.v=c);try{if(l=2,o){if(a||(s="next"),t=o[s]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=o.return)&&t.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+s+"' method"),a=1);o=e}else if((t=(h=d.n<0)?c:n.call(r,d))!==i)break}catch(t){o=e,a=1,c=t}finally{l=1}}return{value:t,done:h}}}(n,s,o),!0),u}var i={};function l(){}function u(){}function h(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(c(t={},r,function(){return this}),t),p=h.prototype=l.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,c(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return u.prototype=h,c(p,"constructor",h),c(h,"constructor",u),u.displayName="GeneratorFunction",c(h,s,"GeneratorFunction"),c(p),c(p,s,"Generator"),c(p,r,function(){return this}),c(p,"toString",function(){return"[object Generator]"}),(a=function(){return{w:o,m:f}})()}function c(e,t,n,r){var s=Object.defineProperty;try{s({},"",{})}catch(e){s=0}c=function(e,t,n,r){function o(t,n){c(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:(o("next",0),o("throw",1),o("return",2))},c(e,t,n,r)}function l(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,l=!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){l=!0,s=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw s}}return a}}(e,t)||h(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 u(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(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 h(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}const d=Object.create(null);d.open="0",d.close="1",d.ping="2",d.pong="3",d.message="4",d.upgrade="5",d.noop="6";const p=Object.create(null);Object.keys(d).forEach(e=>{p[d[e]]=e});const f={type:"error",data:"parser error"},m="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),g="function"==typeof ArrayBuffer,y=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,b=({type:e,data:t},n,r)=>m&&t instanceof Blob?n?r(t):w(t,r):g&&(t instanceof ArrayBuffer||y(t))?n?r(t):w(new Blob([t]),r):r(d[e]+(t||"")),w=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function v(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let E;const _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",k="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)k[_.charCodeAt(e)]=e;const x="function"==typeof ArrayBuffer,O=(e,t)=>{if("string"!=typeof e)return{type:"message",data:R(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:S(e.substring(1),t)};return p[n]?e.length>1?{type:p[n],data:e.substring(1)}:{type:p[n]}:f},S=(e,t)=>{if(x){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 l=new ArrayBuffer(i),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=k[e.charCodeAt(t)],r=k[e.charCodeAt(t+1)],s=k[e.charCodeAt(t+2)],o=k[e.charCodeAt(t+3)],u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|s>>2,u[c++]=(3&s)<<6|63&o;return l})(e);return R(n,t)}return{base64:!0,data:e}},R=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,A=String.fromCharCode(30);function T(){return new TransformStream({transform(e,t){!function(e,t){m&&e.data instanceof Blob?e.data.arrayBuffer().then(v).then(t):g&&(e.data instanceof ArrayBuffer||y(e.data))?t(v(e.data)):b(e,!1,e=>{E||(E=new TextEncoder),t(E.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 C;function N(e){return e.reduce((e,t)=>e+t.length,0)}function B(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 j(e){if(e)return function(e){for(var t in j.prototype)e[t]=j.prototype[t];return e}(e)}j.prototype.on=j.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},j.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},j.prototype.off=j.prototype.removeListener=j.prototype.removeAllListeners=j.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},j.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},j.prototype.emitReserved=j.prototype.emit,j.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},j.prototype.hasListeners=function(e){return!!this.listeners(e).length};const L="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),P="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function U(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const I=P.setTimeout,F=P.clearTimeout;function q(e,t){t.useNativeTimers?(e.setTimeoutFn=I.bind(P),e.clearTimeoutFn=F.bind(P)):(e.setTimeoutFn=P.setTimeout.bind(P),e.clearTimeoutFn=P.clearTimeout.bind(P))}function D(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 M(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class z extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class H extends j{constructor(e){super(),this.writable=!1,q(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 z(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=O(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 V extends H{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(A),r=[];for(let e=0;e<n.length;e++){const s=O(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)=>{b(e,!1,e=>{r[o]=e,++s===n&&t(r.join(A))})})})(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]=M()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let W=!1;try{W="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const K=W;function J(){}class $ extends V{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 G extends j{constructor(e,t,n){super(),this.createRequest=e,q(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=U(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=G.requestsCount++,G.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=J,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete G.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(G.requestsCount=0,G.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Y);else if("function"==typeof addEventListener){addEventListener("onpagehide"in P?"pagehide":"unload",Y,!1)}function Y(){for(let e in G.requests)G.requests.hasOwnProperty(e)&&G.requests[e].abort()}const Q=function(){const e=X({xdomain:!1});return e&&null!==e.responseType}();function X(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||K))return new XMLHttpRequest}catch(e){}if(!t)try{return new(P[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Z="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class ee extends H{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Z?{}:U(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;b(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&L(()=>{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]=M()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const te=P.WebSocket||P.MozWebSocket;const ne={websocket:class extends ee{createSocket(e,t,n){return Z?new te(e,t,n):t?new te(e,t):new te(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends H{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){C||(C=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(N(n)<1)break;const e=B(n,1);o=!(128&~e[0]),s=127&e[0],r=s<126?3:126===s?1:2}else if(1===r){if(N(n)<2)break;const e=B(n,2);s=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(N(n)<8)break;const e=B(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(f);break}s=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(N(n)<s)break;const e=B(n,s);a.enqueue(O(o?e:C.decode(e),t)),r=0}if(0===s||s>e){a.enqueue(f);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=T();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&&L(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends ${constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Q&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new G(X,this.uri(),e)}}},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,se=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function oe(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=re.exec(e||""),o={},i=14;for(;i--;)o[se[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 ie="function"==typeof addEventListener&&"function"==typeof removeEventListener,ae=[];ie&&addEventListener("offline",()=>{ae.forEach(e=>e())},!1);class ce extends j{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=oe(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=oe(t.host).host);q(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)),ie&&(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"})},ae.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&&ce.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",ce.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+=D(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,L(()=>{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(ce.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(),ie&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=ae.indexOf(this._offlineEventListener);-1!==e&&ae.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ce.protocol=4;class le extends ce{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;ce.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;ce.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(l(),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,l(),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 l=()=>{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 ue=class extends le{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=>ne[e]).filter(e=>!!e)),super(e,n)}};const he="function"==typeof ArrayBuffer,de=Object.prototype.toString,pe="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===de.call(Blob),fe="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===de.call(File);function me(e){return he&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||pe&&e instanceof Blob||fe&&e instanceof File}function ge(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(ge(e[t]))return!0;return!1}if(me(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return ge(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&ge(e[t]))return!0;return!1}function ye(e){const t=[],n=e.data,r=e;return r.data=be(n,t),r.attachments=t.length,{packet:r,buffers:t}}function be(e,t){if(!e)return e;if(me(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]=be(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]=be(e[r],t));return n}return e}function we(e,t){return e.data=ve(e.data,t),delete e.attachments,e}function ve(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]=ve(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=ve(e[n],t));return e}const Ee=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var _e;!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"}(_e||(_e={}));function ke(e){return"[object Object]"===Object.prototype.toString.call(e)}class xe extends j{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===_e.BINARY_EVENT;n||t.type===_e.BINARY_ACK?(t.type=n?_e.EVENT:_e.ACK,this.reconstructor=new Oe(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!me(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===_e[n.type])throw new Error("unknown packet type "+n.type);if(n.type===_e.BINARY_EVENT||n.type===_e.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(!xe.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 _e.CONNECT:return ke(t);case _e.DISCONNECT:return void 0===t;case _e.CONNECT_ERROR:return"string"==typeof t||ke(t);case _e.EVENT:case _e.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Ee.indexOf(t[0]));case _e.ACK:case _e.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Oe{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=we(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Se=Object.freeze({__proto__:null,Decoder:xe,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==_e.EVENT&&e.type!==_e.ACK||!ge(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===_e.EVENT?_e.BINARY_EVENT:_e.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==_e.BINARY_EVENT&&e.type!==_e.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=ye(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return _e},protocol:5});function Re(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Ae=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Te extends j{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=[Re(e,"open",this.onopen.bind(this)),Re(e,"packet",this.onpacket.bind(this)),Re(e,"error",this.onerror.bind(this)),Re(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(Ae.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:_e.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:_e.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 _e.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 _e.EVENT:case _e.BINARY_EVENT:this.onevent(e);break;case _e.ACK:case _e.BINARY_ACK:this.onack(e);break;case _e.DISCONNECT:this.ondisconnect();break;case _e.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:_e.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:_e.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 Ce(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}Ce.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)},Ce.prototype.reset=function(){this.attempts=0},Ce.prototype.setMin=function(e){this.ms=e},Ce.prototype.setMax=function(e){this.max=e},Ce.prototype.setJitter=function(e){this.jitter=e};class Ne extends j{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,q(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 Ce({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||Se;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 ue(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Re(t,"open",function(){n.onopen(),e&&e()}),s=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=Re(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(Re(e,"ping",this.onping.bind(this)),Re(e,"data",this.ondata.bind(this)),Re(e,"error",this.onerror.bind(this)),Re(e,"close",this.onclose.bind(this)),Re(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){L(()=>{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 Te(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 Be={};function je(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=oe(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=Be[s]&&o in Be[s].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||i?a=new Ne(r,t):(Be[s]||(Be[s]=new Ne(r,t)),a=Be[s]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function Le(e,t){return function(){return e.apply(t,arguments)}}Object.assign(je,{Manager:Ne,Socket:Te,io:je,connect:je});const{toString:Pe}=Object.prototype,{getPrototypeOf:Ue}=Object,{iterator:Ie,toStringTag:Fe}=Symbol,qe=(e=>t=>{const n=Pe.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),De=e=>(e=e.toLowerCase(),t=>qe(t)===e),Me=e=>t=>typeof t===e,{isArray:ze}=Array,He=Me("undefined");function Ve(e){return null!==e&&!He(e)&&null!==e.constructor&&!He(e.constructor)&&Je(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const We=De("ArrayBuffer");const Ke=Me("string"),Je=Me("function"),$e=Me("number"),Ge=e=>null!==e&&"object"==typeof e,Ye=e=>{if("object"!==qe(e))return!1;const t=Ue(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Fe in e||Ie in e)},Qe=De("Date"),Xe=De("File"),Ze=De("Blob"),et=De("FileList"),tt=De("URLSearchParams"),[nt,rt,st,ot]=["ReadableStream","Request","Response","Headers"].map(De);function it(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),ze(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Ve(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 at(e,t){if(Ve(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 ct="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,lt=e=>!He(e)&&e!==ct;const ut=(ht="undefined"!=typeof Uint8Array&&Ue(Uint8Array),e=>ht&&e instanceof ht);var ht;const dt=De("HTMLFormElement"),pt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ft=De("RegExp"),mt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};it(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)};const gt=De("AsyncFunction"),yt=(bt="function"==typeof setImmediate,wt=Je(ct.postMessage),bt?setImmediate:wt?(vt=`axios@${Math.random()}`,Et=[],ct.addEventListener("message",({source:e,data:t})=>{e===ct&&t===vt&&Et.length&&Et.shift()()},!1),e=>{Et.push(e),ct.postMessage(vt,"*")}):e=>setTimeout(e));var bt,wt,vt,Et;const _t="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ct):"undefined"!=typeof process&&process.nextTick||yt;var kt={isArray:ze,isArrayBuffer:We,isBuffer:Ve,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Je(e.append)&&("formdata"===(t=qe(e))||"object"===t&&Je(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&We(e.buffer),t},isString:Ke,isNumber:$e,isBoolean:e=>!0===e||!1===e,isObject:Ge,isPlainObject:Ye,isEmptyObject:e=>{if(!Ge(e)||Ve(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:nt,isRequest:rt,isResponse:st,isHeaders:ot,isUndefined:He,isDate:Qe,isFile:Xe,isBlob:Ze,isRegExp:ft,isFunction:Je,isStream:e=>Ge(e)&&Je(e.pipe),isURLSearchParams:tt,isTypedArray:ut,isFileList:et,forEach:it,merge:function e(){const{caseless:t,skipUndefined:n}=lt(this)&&this||{},r={},s=(s,o)=>{const i=t&&at(r,o)||o;Ye(r[i])&&Ye(s)?r[i]=e(r[i],s):Ye(s)?r[i]=e({},s):ze(s)?r[i]=s.slice():n&&He(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&it(arguments[e],s);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(it(t,(t,r)=>{n&&Je(t)?e[r]=Le(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&&Ue(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:qe,kindOfTest:De,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(ze(e))return e;let t=e.length;if(!$e(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Ie]).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:dt,hasOwnProperty:pt,hasOwnProp:pt,reduceDescriptors:mt,freezeMethods:e=>{mt(e,(t,n)=>{if(Je(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Je(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 ze(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:at,global:ct,isContextDefined:lt,isSpecCompliantForm:function(e){return!!(e&&Je(e.append)&&"FormData"===e[Fe]&&e[Ie])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Ge(e)){if(t.indexOf(e)>=0)return;if(Ve(e))return e;if(!("toJSON"in e)){t[r]=e;const s=ze(e)?[]:{};return it(e,(e,t)=>{const o=n(e,r+1);!He(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:gt,isThenable:e=>e&&(Ge(e)||Je(e))&&Je(e.then)&&Je(e.catch),setImmediate:yt,asap:_t,isIterable:e=>null!=e&&Je(e[Ie])};function xt(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)}kt.inherits(xt,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:kt.toJSONObject(this.config),code:this.code,status:this.status}}});const Ot=xt.prototype,St={};["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=>{St[e]={value:e}}),Object.defineProperties(xt,St),Object.defineProperty(Ot,"isAxiosError",{value:!0}),xt.from=(e,t,n,r,s,o)=>{const i=Object.create(Ot);kt.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 xt.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 Rt(e){return kt.isPlainObject(e)||kt.isArray(e)}function At(e){return kt.endsWith(e,"[]")?e.slice(0,-2):e}function Tt(e,t,n){return e?e.concat(t).map(function(e,t){return e=At(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Ct=kt.toFlatObject(kt,{},null,function(e){return/^is[A-Z]/.test(e)});function Nt(e,t,n){if(!kt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=kt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!kt.isUndefined(t[e])})).metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&kt.isSpecCompliantForm(t);if(!kt.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(kt.isDate(e))return e.toISOString();if(kt.isBoolean(e))return e.toString();if(!a&&kt.isBlob(e))throw new xt("Blob is not supported. Use a Buffer instead.");return kt.isArrayBuffer(e)||kt.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(kt.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(kt.isArray(e)&&function(e){return kt.isArray(e)&&!e.some(Rt)}(e)||(kt.isFileList(e)||kt.endsWith(n,"[]"))&&(a=kt.toArray(e)))return n=At(n),a.forEach(function(e,r){!kt.isUndefined(e)&&null!==e&&t.append(!0===i?Tt([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!Rt(e)||(t.append(Tt(s,n,o),c(e)),!1)}const u=[],h=Object.assign(Ct,{defaultVisitor:l,convertValue:c,isVisitable:Rt});if(!kt.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!kt.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),kt.forEach(n,function(n,o){!0===(!(kt.isUndefined(n)||null===n)&&s.call(t,n,kt.isString(o)?o.trim():o,r,h))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t}function Bt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function jt(e,t){this._pairs=[],e&&Nt(e,this,t)}const Lt=jt.prototype;function Pt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ut(e,t,n){if(!t)return e;const r=n&&n.encode||Pt;kt.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(o=s?s(t,n):kt.isURLSearchParams(t)?t.toString():new jt(t,n).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Lt.append=function(e,t){this._pairs.push([e,t])},Lt.toString=function(e){const t=e?function(t){return e.call(this,t,Bt)}:Bt;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class It{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){kt.forEach(this.handlers,function(t){null!==t&&e(t)})}}var Ft={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},qt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:jt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Dt="undefined"!=typeof window&&"undefined"!=typeof document,Mt="object"==typeof navigator&&navigator||void 0,zt=Dt&&(!Mt||["ReactNative","NativeScript","NS"].indexOf(Mt.product)<0),Ht="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Vt=Dt&&window.location.href||"http://localhost";var Wt={...Object.freeze({__proto__:null,hasBrowserEnv:Dt,hasStandardBrowserEnv:zt,hasStandardBrowserWebWorkerEnv:Ht,navigator:Mt,origin:Vt}),...qt};function Kt(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&&kt.isArray(r)?r.length:o,a)return kt.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i;r[o]&&kt.isObject(r[o])||(r[o]=[]);return t(e,n,r[o],s)&&kt.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(kt.isFormData(e)&&kt.isFunction(e.entries)){const n={};return kt.forEachEntry(e,(e,r)=>{t(function(e){return kt.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const Jt={transitional:Ft,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=kt.isObject(e);s&&kt.isHTMLForm(e)&&(e=new FormData(e));if(kt.isFormData(e))return r?JSON.stringify(Kt(e)):e;if(kt.isArrayBuffer(e)||kt.isBuffer(e)||kt.isStream(e)||kt.isFile(e)||kt.isBlob(e)||kt.isReadableStream(e))return e;if(kt.isArrayBufferView(e))return e.buffer;if(kt.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 Nt(e,new Wt.classes.URLSearchParams,{visitor:function(e,t,n,r){return Wt.isNode&&kt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=kt.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Nt(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e,t,n){if(kt.isString(e))try{return(t||JSON.parse)(e),kt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Jt.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(kt.isResponse(e)||kt.isReadableStream(e))return e;if(e&&kt.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 xt.from(e,xt.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:Wt.classes.FormData,Blob:Wt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};kt.forEach(["delete","get","head","post","put","patch"],e=>{Jt.headers[e]={}});const $t=kt.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 Gt=Symbol("internals");function Yt(e){return e&&String(e).trim().toLowerCase()}function Qt(e){return!1===e||null==e?e:kt.isArray(e)?e.map(Qt):String(e)}function Xt(e,t,n,r,s){return kt.isFunction(r)?r.call(this,t,n):(s&&(t=n),kt.isString(t)?kt.isString(r)?-1!==t.indexOf(r):kt.isRegExp(r)?r.test(t):void 0:void 0)}let Zt=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=Yt(t);if(!s)throw new Error("header name must be a non-empty string");const o=kt.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=Qt(e))}const o=(e,t)=>kt.forEach(e,(e,n)=>s(e,n,t));if(kt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(kt.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]&&$t[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(kt.isObject(e)&&kt.isIterable(e)){let n,r,s={};for(const t of e){if(!kt.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?kt.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=Yt(e)){const n=kt.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(kt.isFunction(t))return t.call(this,e,n);if(kt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Yt(e)){const n=kt.findKey(this,e);return!(!n||void 0===this[n]||t&&!Xt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=Yt(e)){const s=kt.findKey(n,e);!s||t&&!Xt(0,n[s],s,t)||(delete n[s],r=!0)}}return kt.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&&!Xt(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return kt.forEach(this,(r,s)=>{const o=kt.findKey(n,s);if(o)return t[o]=Qt(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]=Qt(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return kt.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&kt.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[Gt]=this[Gt]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Yt(e);t[r]||(!function(e,t){const n=kt.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 kt.isArray(e)?e.forEach(r):r(e),this}};function en(e,t){const n=this||Jt,r=t||n,s=Zt.from(r.headers);let o=r.data;return kt.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function tn(e){return!(!e||!e.__CANCEL__)}function nn(e,t,n){xt.call(this,null==e?"canceled":e,xt.ERR_CANCELED,t,n),this.name="CanceledError"}function rn(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new xt("Request failed with status code "+n.status,[xt.ERR_BAD_REQUEST,xt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}Zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),kt.reduceDescriptors(Zt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),kt.freezeMethods(Zt),kt.inherits(nn,xt,{__CANCEL__:!0});const sn=(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(),l=r[i];s||(s=c),n[o]=a,r[o]=c;let u=i,h=0;for(;u!==o;)h+=n[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const d=l&&c-l;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)},on=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},an=e=>(...t)=>kt.asap(()=>e(...t));var cn=Wt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Wt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Wt.origin),Wt.navigator&&/(msie|trident)/i.test(Wt.navigator.userAgent)):()=>!0,ln=Wt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];kt.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),kt.isString(r)&&a.push(`path=${r}`),kt.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),kt.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 un(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 hn=e=>e instanceof Zt?{...e}:e;function dn(e,t){t=t||{};const n={};function r(e,t,n,r){return kt.isPlainObject(e)&&kt.isPlainObject(t)?kt.merge.call({caseless:r},e,t):kt.isPlainObject(t)?kt.merge({},t):kt.isArray(t)?t.slice():t}function s(e,t,n,s){return kt.isUndefined(t)?kt.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!kt.isUndefined(t))return r(void 0,t)}function i(e,t){return kt.isUndefined(t)?kt.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(hn(e),hn(t),0,!0)};return kt.forEach(Object.keys({...e,...t}),function(r){const o=c[r]||s,i=o(e[r],t[r],r);kt.isUndefined(i)&&o!==a||(n[r]=i)}),n}var pn=e=>{const t=dn({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=Zt.from(i),t.url=Ut(un(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),kt.isFormData(n))if(Wt.hasStandardBrowserEnv||Wt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(kt.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(Wt.hasStandardBrowserEnv&&(r&&kt.isFunction(r)&&(r=r(t)),r||!1!==r&&cn(t.url))){const e=s&&o&&ln.read(o);e&&i.set(s,e)}return t};var fn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=pn(e);let s=r.data;const o=Zt.from(r.headers).normalize();let i,a,c,l,u,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=r;function f(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Zt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());rn(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 xt("Request aborted",xt.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=new xt(t&&t.message?t.message:"Network Error",xt.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||Ft;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new xt(t,s.clarifyTimeoutError?xt.ETIMEDOUT:xt.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&kt.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),kt.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),h&&"json"!==h&&(m.responseType=r.responseType),p&&([c,u]=sn(p,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,l]=sn(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new nn(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===Wt.protocols.indexOf(y)?n(new xt("Unsupported protocol "+y+":",xt.ERR_BAD_REQUEST,e)):m.send(s||null)})};const mn=(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 xt?t:new nn(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new xt(`timeout ${t} of ms exceeded`,xt.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=()=>kt.asap(i),a}},gn=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},yn=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()}},bn=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of yn(e))yield*gn(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:wn}=kt,vn=(({Request:e,Response:t})=>({Request:e,Response:t}))(kt.global),{ReadableStream:En,TextEncoder:_n}=kt.global,kn=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},xn=e=>{e=kt.merge.call({skipUndefined:!0},vn,e);const{fetch:t,Request:n,Response:r}=e,s=t?wn(t):"function"==typeof fetch,o=wn(n),i=wn(r);if(!s)return!1;const a=s&&wn(En),c=s&&("function"==typeof _n?(l=new _n,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=o&&a&&kn(()=>{let e=!1;const t=new n(Wt.origin,{body:new En,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),h=i&&a&&kn(()=>kt.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 xt(`Response type '${e}' is not supported`,xt.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=kt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(kt.isBlob(e))return e.size;if(kt.isSpecCompliantForm(e)){const t=new n(Wt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return kt.isArrayBufferView(e)||kt.isArrayBuffer(e)?e.byteLength:(kt.isURLSearchParams(e)&&(e+=""),kt.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:s,method:i,data:a,signal:c,cancelToken:l,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:b,withCredentials:w="same-origin",fetchOptions:v}=pn(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let _=mn([c,l&&l.toAbortSignal()],f),k=null;const x=_&&_.unsubscribe&&(()=>{_.unsubscribe()});let O;try{if(g&&u&&"get"!==i&&"head"!==i&&0!==(O=await p(b,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(kt.isFormData(a)&&(e=t.headers.get("content-type"))&&b.setContentType(e),t.body){const[e,n]=on(O,sn(an(g)));a=bn(t.body,65536,e,n)}}kt.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 l=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]=l[t]});const t=kt.toFiniteNumber(l.headers.get("content-length")),[n,s]=m&&on(t,sn(an(m),!0))||[];l=new r(bn(l.body,65536,n,()=>{s&&s(),x&&x()}),e)}y=y||"text";let S=await d[kt.findKey(d,y)||"text"](l,e);return!f&&x&&x(),await new Promise((t,n)=>{rn(t,n,{data:S,headers:Zt.from(l.headers),status:l.status,statusText:l.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 xt("Network Error",xt.ERR_NETWORK,e,k),{cause:t.cause||t});throw xt.from(t,t&&t.code,e,k)}}},On=new Map,Sn=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,l=On;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:xn(t)),l=a;return a};Sn();const Rn={http:null,xhr:fn,fetch:{get:Sn}};kt.forEach(Rn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const An=e=>`- ${e}`,Tn=e=>kt.isFunction(e)||null===e||!1===e;var Cn={getAdapter:function(e,t){e=kt.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,!Tn(r)&&(s=Rn[(n=String(r)).toLowerCase()],void 0===s))throw new xt(`Unknown adapter '${n}'`);if(s&&(kt.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 xt("There is no suitable adapter to dispatch the request "+(n?e.length>1?"since :\n"+e.map(An).join("\n"):" "+An(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s},adapters:Rn};function Nn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nn(null,e)}function Bn(e){Nn(e),e.headers=Zt.from(e.headers),e.data=en.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Cn.getAdapter(e.adapter||Jt.adapter,e)(e).then(function(t){return Nn(e),t.data=en.call(e,e.transformResponse,t),t.headers=Zt.from(t.headers),t},function(t){return tn(t)||(Nn(e),t&&t.response&&(t.response.data=en.call(e,e.transformResponse,t.response),t.response.headers=Zt.from(t.response.headers))),Promise.reject(t)})}const jn="1.13.2",Ln={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ln[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Pn={};Ln.transitional=function(e,t,n){function r(e,t){return"[Axios v"+jn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new xt(r(s," has been removed"+(t?" in "+t:"")),xt.ERR_DEPRECATED);return t&&!Pn[s]&&(Pn[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)}},Ln.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var Un={assertOptions:function(e,t,n){if("object"!=typeof e)throw new xt("options must be an object",xt.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 xt("option "+o+" must be "+n,xt.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new xt("Unknown option "+o,xt.ERR_BAD_OPTION)}},validators:Ln};const In=Un.validators;let Fn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new It,response:new It}}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=dn(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&Un.assertOptions(n,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),null!=r&&(kt.isFunction(r)?t.paramsSerializer={serialize:r}:Un.assertOptions(r,{encode:In.function,serialize:In.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Un.assertOptions(t,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&kt.merge(s.common,s[t.method]);s&&kt.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=Zt.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 l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,h=0;if(!a){const e=[Bn.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);h<u;)l=l.then(e[h++],e[h++]);return l}u=i.length;let d=t;for(;h<u;){const e=i[h++],t=i[h++];try{d=e(d)}catch(e){t.call(this,e);break}}try{l=Bn.call(this,d)}catch(e){return Promise.reject(e)}for(h=0,u=c.length;h<u;)l=l.then(c[h++],c[h++]);return l}getUri(e){return Ut(un((e=dn(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};kt.forEach(["delete","get","head","options"],function(e){Fn.prototype[e]=function(t,n){return this.request(dn(n||{},{method:e,url:t,data:(n||{}).data}))}}),kt.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(dn(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}Fn.prototype[e]=t(),Fn.prototype[e+"Form"]=t(!0)});const qn={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(qn).forEach(([e,t])=>{qn[t]=e});const Dn=function e(t){const n=new Fn(t),r=Le(Fn.prototype.request,n);return kt.extend(r,Fn.prototype,n,{allOwnKeys:!0}),kt.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(dn(t,n))},r}(Jt);Dn.Axios=Fn,Dn.CanceledError=nn,Dn.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 nn(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}}},Dn.isCancel=tn,Dn.VERSION=jn,Dn.toFormData=Nt,Dn.AxiosError=xt,Dn.Cancel=Dn.CanceledError,Dn.all=function(e){return Promise.all(e)},Dn.spread=function(e){return function(t){return e.apply(null,t)}},Dn.isAxiosError=function(e){return kt.isObject(e)&&!0===e.isAxiosError},Dn.mergeConfig=dn,Dn.AxiosHeaders=Zt,Dn.formToJSON=e=>Kt(kt.isHTMLForm(e)?new FormData(e):e),Dn.getAdapter=Cn.getAdapter,Dn.HttpStatusCode=qn,Dn.default=Dn;const{Axios:Mn,AxiosError:zn,CanceledError:Hn,isCancel:Vn,CancelToken:Wn,VERSION:Kn,all:Jn,Cancel:$n,isAxiosError:Gn,spread:Yn,toFormData:Qn,AxiosHeaders:Xn,HttpStatusCode:Zn,formToJSON:er,getAdapter:tr,mergeConfig:nr}=Dn;!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}");var rr=function(s){var o=s.apiKey,c=s.apiUrl,h=void 0===c?"https://chat-crm-backend-7mzo.onrender.com":c,d=s.primaryColor,p=void 0===d?"#4F46E5":d,f=s.position,m=void 0===f?"bottom-right":f,g=s.userData,y=void 0===g?null:g,b=s.welcomeMessage,w=void 0===b?"πŸ‘‹ Welcome! How can we help you today?":b,v=s.companyName,E=void 0===v?"Support":v,_=s.autoOpen,k=void 0!==_&&_,x=s.showNotifications,O=void 0===x||x,S=s.playSound,R=void 0!==S&&S,A=s.theme,T=void 0===A?"light":A,C=s.zIndex,N=void 0===C?9999:C,B=l(t(k),2),j=B[0],L=B[1],P=l(t([]),2),U=P[0],I=P[1],F=l(t(""),2),q=F[0],D=F[1],M=l(t(null),2),z=M[0],H=M[1],V=l(t(null),2);V[0];var W=V[1],K=l(t(null),2),J=K[0],$=K[1],G=l(t(!1),2),Y=G[0],Q=G[1],X=l(t(!1),2),Z=X[0],ee=X[1],te=l(t(!1),2),ne=te[0],re=te[1],se=l(t(!1),2),oe=se[0],ie=se[1],ae=l(t("Support Agent"),2),ce=ae[0],le=ae[1],ue=l(t(0),2),he=ue[0],de=ue[1],pe=l(t(!1),2),fe=pe[0],me=pe[1],ge=l(t("active"),2),ye=ge[0],be=ge[1],we=n(!1),ve=n(null);r(function(){var e;null===(e=ve.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})},[U]),r(function(){return function(){z&&z.disconnect()}},[z]);var Ee=function(){return y?{name:y.name||"Guest User",email:y.email||null,phone:y.phone||null,userId:y.userId||null}:{name:localStorage.getItem("chatGuestName")||"Guest User",email:localStorage.getItem("chatGuestEmail")||null,phone:localStorage.getItem("chatGuestPhone")||null,userId:localStorage.getItem("chatUserId")||null}},_e=function(){var e=i(a().m(function e(){var t,n,r,s,i,c,l;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=Ee(),ee(!0),e.p=1,console.log("πŸš€ Creating new conversation for first message..."),e.n=2,Dn.post("".concat(h,"/api/v1/webhook/guest-conversation"),{apiKey:o,guestName:t.name,guestEmail:t.email,guestPhone:t.phone,customUserId:t.userId});case 2:if(!(n=e.v).data.success){e.n=3;break}return r=n.data,s=r.conversationId,i=r.petitionId,c=r.queryId,W(c),$(s),me(!0),localStorage.setItem("chatGuestId",c),localStorage.setItem("chatConversationId",s),localStorage.setItem("chatPetitionId",i),console.log("βœ… Conversation created:",{petitionId:i,queryId:c}),e.a(2,{newConvId:s,petitionId:i});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,ee(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),ke=function(){var e=i(a().m(function e(t){var n,r;return a().w(function(e){for(;;)if(0===e.n)return n=t.convId,r=t.petitionId,re(!0),e.a(2,new Promise(function(e,t){try{var s=je("".concat(h,"/widget"),{query:{conversationId:n,petitionId:r,apiKey:o},transports:["websocket","polling"]});s.on("connect",function(){Q(!0),re(!1),console.log("βœ… Connected to Chat CRM Widget Namespace"),e(s)}),s.on("connect_error",function(e){re(!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(){Q(!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};I(function(e){return[].concat(u(e),[t])}),le(e.senderName||"Support Agent"),ie(!1),!j&&O&&(de(function(e){return e+1}),R&&Oe())}),s.on("query-accepted",function(e){console.log("βœ… Query accepted by agent:",e),le(e.agentName||"Support Agent"),be("active"),I(function(t){return[].concat(u(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),le(e.toAgentName||"Support Agent"),I(function(t){return[].concat(u(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),be("resolved"),we.current?console.log("πŸ” Skipping duplicate resolved system message"):(we.current=!0,I(function(e){return[].concat(u(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),be("active"),we.current=!1}),s.on("agent-typing",function(e){ie(!0),le(e.agentName||"Support Agent"),setTimeout(function(){return ie(!1)},3e3)}),H(s)}catch(e){re(!1),t(e)}}))},e)}));return function(t){return e.apply(this,arguments)}}(),xe=function(){var e=i(a().m(function e(){var t,n,r,s,o,i,c,l,h;return a().w(function(e){for(;;)switch(e.p=e.n){case 0:if(q.trim()&&"resolved"!==ye){e.n=1;break}return e.a(2);case 1:if(t=Ee(),n=q.trim(),r=Date.now(),I(function(e){return[].concat(u(e),[{message:n,sender:"guest",senderName:t.name||"Guest User",read:!0,timestamp:new Date,tempId:r}])}),D(""),e.p=2,s=localStorage.getItem("chatPetitionId"),o=J||localStorage.getItem("chatConversationId"),s&&o){e.n=4;break}return e.n=3,_e();case 3:i=e.v,o=i.newConvId,s=i.petitionId;case 4:if((c=z)&&Y){e.n=6;break}try{z&&z.disconnect()}catch(e){}return e.n=5,ke({convId:o,petitionId:s});case 5:c=e.v;case 6:l={conversationId:o,petitionId:s,message:n,senderName:t.name||"Guest User",senderType:"Customer",timestamp:new Date},console.log("πŸ“€ Sending message:",l),c.emit("widget-message",l),e.n=8;break;case 7:e.p=7,h=e.v,console.error("❌ Send message error:",h),I(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)}}(),Oe=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)},Se=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[m]||e["bottom-right"]},Re="dark"===T||"auto"===T&&window.matchMedia("(prefers-color-scheme: dark)").matches;return e.createElement("div",{className:"crm-widget-container",style:{zIndex:N}},e.createElement("button",{onClick:function(){L(!0),de(0)},className:"crm-chat-button ".concat(Se()),style:{backgroundColor:p},"aria-label":"Open chat"},j?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"})),!j&&he>0&&e.createElement("span",{className:"crm-badge"},he)),j&&e.createElement("div",{className:"crm-chat-window ".concat(Se()," ").concat(Re?"crm-dark":"")},e.createElement("div",{className:"crm-header",style:{backgroundColor:p}},e.createElement("div",{className:"crm-header-content"},e.createElement("div",{className:"crm-avatar"},"πŸ’¬"),e.createElement("div",null,e.createElement("h3",{className:"crm-title"},E),e.createElement("div",{className:"crm-status"},e.createElement("div",{className:"crm-status-dot ".concat(Y?"crm-online":"crm-offline")}),e.createElement("span",null,"resolved"===ye?e.createElement("span",{style:{color:"#10B981"}},"βœ“ Resolved"):"Support Agent"!==ce?e.createElement("span",null,"πŸ’¬ ",ce):Y?"Online":ne?"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"),z&&z.disconnect(),H(null),W(null),$(null),Q(!1),me(!1),be("active"),we.current=!1,I([]),D(""),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 L(!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"},!fe&&0===U.length&&e.createElement("div",{className:"crm-welcome-message"},e.createElement("p",null,w),e.createElement("p",{style:{fontSize:"0.875rem",marginTop:"8px",opacity:.7}},"πŸ‘‹ Start typing to begin your conversation")),U.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:p}:"system"===t.sender?{backgroundColor:"#F3F4F6",color:"#374151",border:"1px solid #E5E7EB"}:{}},"agent"===t.sender&&e.createElement("p",{className:"crm-agent-name"},t.senderName||ce),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}),oe&&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:ve})),e.createElement("div",{className:"crm-input-container"},e.createElement("div",{className:"crm-input-wrapper"},e.createElement("textarea",{value:q,onChange:function(e){return D(e.target.value)},onKeyPress:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),xe())},placeholder:"resolved"===ye?"Query is resolved. Start a new query to continue.":"Type your message...",rows:"1",className:"crm-input",disabled:"resolved"===ye}),e.createElement("button",{onClick:xe,disabled:!q.trim()||Z||"resolved"===ye,className:"crm-send-btn",style:{backgroundColor:p}},Z?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"},fe?"Press Enter to send β€’ Shift+Enter for new line":"Send your first message to start conversation"))))};export{rr as ChatCRMWidget};
4
4
  //# sourceMappingURL=index.esm.js.map