@tarxemo/customer_support 1.2.0 → 1.2.1

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.umd.js CHANGED
@@ -1,7 +1,7 @@
1
- (function(C,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("react"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react","lucide-react"],p):(C=typeof globalThis<"u"?globalThis:C||self,p(C.CustomerSupport={},C.React,C.lucideReact))})(this,(function(C,p,L){"use strict";var Qr=Object.defineProperty;var Zr=(C,p,L)=>p in C?Qr(C,p,{enumerable:!0,configurable:!0,writable:!0,value:L}):C[p]=L;var xt=(C,p,L)=>Zr(C,typeof p!="symbol"?p+"":p,L);function Ce(e,t){return function(){return e.apply(t,arguments)}}const{toString:St}=Object.prototype,{getPrototypeOf:me}=Object,{iterator:se,toStringTag:Re}=Symbol,ne=(e=>t=>{const r=St.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),F=e=>(e=e.toLowerCase(),t=>ne(t)===e),oe=e=>t=>typeof t===e,{isArray:K}=Array,V=oe("undefined");function Y(e){return e!==null&&!V(e)&&e.constructor!==null&&!V(e.constructor)&&U(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ne=F("ArrayBuffer");function Ot(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ne(e.buffer),t}const Tt=oe("string"),U=oe("function"),ke=oe("number"),Q=e=>e!==null&&typeof e=="object",At=e=>e===!0||e===!1,ie=e=>{if(ne(e)!=="object")return!1;const t=me(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Re in e)&&!(se in e)},Ct=e=>{if(!Q(e)||Y(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Rt=F("Date"),Nt=F("File"),kt=F("Blob"),vt=F("FileList"),Pt=e=>Q(e)&&U(e.pipe),Ut=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||U(e.append)&&((t=ne(e))==="formdata"||t==="object"&&U(e.toString)&&e.toString()==="[object FormData]"))},Dt=F("URLSearchParams"),[Ft,Lt,It,Bt]=["ReadableStream","Request","Response","Headers"].map(F),jt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Z(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let s,n;if(typeof e!="object"&&(e=[e]),K(e))for(s=0,n=e.length;s<n;s++)t.call(null,e[s],s,e);else{if(Y(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(s=0;s<i;s++)c=o[s],t.call(null,e[c],c,e)}}function ve(e,t){if(Y(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s=r.length,n;for(;s-- >0;)if(n=r[s],t===n.toLowerCase())return n;return null}const q=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Pe=e=>!V(e)&&e!==q;function he(){const{caseless:e,skipUndefined:t}=Pe(this)&&this||{},r={},s=(n,o)=>{const i=e&&ve(r,o)||o;ie(r[i])&&ie(n)?r[i]=he(r[i],n):ie(n)?r[i]=he({},n):K(n)?r[i]=n.slice():(!t||!V(n))&&(r[i]=n)};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&Z(arguments[n],s);return r}const $t=(e,t,r,{allOwnKeys:s}={})=>(Z(t,(n,o)=>{r&&U(n)?Object.defineProperty(e,o,{value:Ce(n,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),e),Mt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ht=(e,t,r,s)=>{e.prototype=Object.create(t.prototype,s),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},qt=(e,t,r,s)=>{let n,o,i;const c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)i=n[o],(!s||s(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=r!==!1&&me(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},zt=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return s!==-1&&s===r},Jt=e=>{if(!e)return null;if(K(e))return e;let t=e.length;if(!ke(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Wt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&me(Uint8Array)),Kt=(e,t)=>{const s=(e&&e[se]).call(e);let n;for(;(n=s.next())&&!n.done;){const o=n.value;t.call(e,o[0],o[1])}},Vt=(e,t)=>{let r;const s=[];for(;(r=e.exec(t))!==null;)s.push(r);return s},Xt=F("HTMLFormElement"),Gt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,n){return s.toUpperCase()+n}),Ue=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Yt=F("RegExp"),De=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Z(r,(n,o)=>{let i;(i=t(n,o,e))!==!1&&(s[o]=i||n)}),Object.defineProperties(e,s)},Qt=e=>{De(e,(t,r)=>{if(U(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=e[r];if(U(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Zt=(e,t)=>{const r={},s=n=>{n.forEach(o=>{r[o]=!0})};return K(e)?s(e):s(String(e).split(t)),r},er=()=>{},tr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function rr(e){return!!(e&&U(e.append)&&e[Re]==="FormData"&&e[se])}const sr=e=>{const t=new Array(10),r=(s,n)=>{if(Q(s)){if(t.indexOf(s)>=0)return;if(Y(s))return s;if(!("toJSON"in s)){t[n]=s;const o=K(s)?[]:{};return Z(s,(i,c)=>{const f=r(i,n+1);!V(f)&&(o[c]=f)}),t[n]=void 0,o}}return s};return r(e,0)},nr=F("AsyncFunction"),or=e=>e&&(Q(e)||U(e))&&U(e.then)&&U(e.catch),Fe=((e,t)=>e?setImmediate:t?((r,s)=>(q.addEventListener("message",({source:n,data:o})=>{n===q&&o===r&&s.length&&s.shift()()},!1),n=>{s.push(n),q.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",U(q.postMessage)),ir=typeof queueMicrotask<"u"?queueMicrotask.bind(q):typeof process<"u"&&process.nextTick||Fe,a={isArray:K,isArrayBuffer:Ne,isBuffer:Y,isFormData:Ut,isArrayBufferView:Ot,isString:Tt,isNumber:ke,isBoolean:At,isObject:Q,isPlainObject:ie,isEmptyObject:Ct,isReadableStream:Ft,isRequest:Lt,isResponse:It,isHeaders:Bt,isUndefined:V,isDate:Rt,isFile:Nt,isBlob:kt,isRegExp:Yt,isFunction:U,isStream:Pt,isURLSearchParams:Dt,isTypedArray:Wt,isFileList:vt,forEach:Z,merge:he,extend:$t,trim:jt,stripBOM:Mt,inherits:Ht,toFlatObject:qt,kindOf:ne,kindOfTest:F,endsWith:zt,toArray:Jt,forEachEntry:Kt,matchAll:Vt,isHTMLForm:Xt,hasOwnProperty:Ue,hasOwnProp:Ue,reduceDescriptors:De,freezeMethods:Qt,toObjectSet:Zt,toCamelCase:Gt,noop:er,toFiniteNumber:tr,findKey:ve,global:q,isContextDefined:Pe,isSpecCompliantForm:rr,toJSONObject:sr,isAsyncFn:nr,isThenable:or,setImmediate:Fe,asap:ir,isIterable:e=>e!=null&&U(e[se])};let b=class Et extends Error{static from(t,r,s,n,o,i){const c=new Et(t.message,r||t.code,s,n,o);return c.cause=t,c.name=t.name,i&&Object.assign(c,i),c}constructor(t,r,s,n,o){super(t),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),s&&(this.config=s),n&&(this.request=n),o&&(this.response=o,this.status=o.status)}toJSON(){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:a.toJSONObject(this.config),code:this.code,status:this.status}}};b.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",b.ERR_BAD_OPTION="ERR_BAD_OPTION",b.ECONNABORTED="ECONNABORTED",b.ETIMEDOUT="ETIMEDOUT",b.ERR_NETWORK="ERR_NETWORK",b.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",b.ERR_DEPRECATED="ERR_DEPRECATED",b.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",b.ERR_BAD_REQUEST="ERR_BAD_REQUEST",b.ERR_CANCELED="ERR_CANCELED",b.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",b.ERR_INVALID_URL="ERR_INVALID_URL";const ar=null;function ge(e){return a.isPlainObject(e)||a.isArray(e)}function Le(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ie(e,t,r){return e?e.concat(t).map(function(n,o){return n=Le(n),!r&&o?"["+n+"]":n}).join(r?".":""):t}function cr(e){return a.isArray(e)&&!e.some(ge)}const lr=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ae(e,t,r){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,h){return!a.isUndefined(h[g])});const s=r.metaTokens,n=r.visitor||l,o=r.dots,i=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(n))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!f&&a.isBlob(d))throw new b("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function l(d,g,h){let E=d;if(d&&!h&&typeof d=="object"){if(a.endsWith(g,"{}"))g=s?g:g.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&cr(d)||(a.isFileList(d)||a.endsWith(g,"[]"))&&(E=a.toArray(d)))return g=Le(g),E.forEach(function(x,T){!(a.isUndefined(x)||x===null)&&t.append(i===!0?Ie([g],T,o):i===null?g:g+"[]",u(x))}),!1}return ge(d)?!0:(t.append(Ie(h,g,o),u(d)),!1)}const m=[],y=Object.assign(lr,{defaultVisitor:l,convertValue:u,isVisitable:ge});function R(d,g){if(!a.isUndefined(d)){if(m.indexOf(d)!==-1)throw Error("Circular reference detected in "+g.join("."));m.push(d),a.forEach(d,function(E,O){(!(a.isUndefined(E)||E===null)&&n.call(t,E,a.isString(O)?O.trim():O,g,y))===!0&&R(E,g?g.concat(O):[O])}),m.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return R(e),t}function Be(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function we(e,t){this._pairs=[],e&&ae(e,this,t)}const je=we.prototype;je.append=function(t,r){this._pairs.push([t,r])},je.toString=function(t){const r=t?function(s){return t.call(this,s,Be)}:Be;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};function ur(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function $e(e,t,r){if(!t)return e;const s=r&&r.encode||ur,n=a.isFunction(r)?{serialize:r}:r,o=n&&n.serialize;let i;if(o?i=o(t,n):i=a.isURLSearchParams(t)?t.toString():new we(t,n).toString(s),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Me{constructor(){this.handlers=[]}use(t,r,s){return this.handlers.push({fulfilled:t,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(s){s!==null&&t(s)})}}const He={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},dr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:we,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},be=typeof window<"u"&&typeof document<"u",ye=typeof navigator=="object"&&navigator||void 0,fr=be&&(!ye||["ReactNative","NativeScript","NS"].indexOf(ye.product)<0),pr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",mr=be&&window.location.href||"http://localhost",v={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:be,hasStandardBrowserEnv:fr,hasStandardBrowserWebWorkerEnv:pr,navigator:ye,origin:mr},Symbol.toStringTag,{value:"Module"})),...dr};function hr(e,t){return ae(e,new v.classes.URLSearchParams,{visitor:function(r,s,n,o){return v.isNode&&a.isBuffer(r)?(this.append(s,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function gr(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function wr(e){const t={},r=Object.keys(e);let s;const n=r.length;let o;for(s=0;s<n;s++)o=r[s],t[o]=e[o];return t}function qe(e){function t(r,s,n,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),f=o>=r.length;return i=!i&&a.isArray(n)?n.length:i,f?(a.hasOwnProp(n,i)?n[i]=[n[i],s]:n[i]=s,!c):((!n[i]||!a.isObject(n[i]))&&(n[i]=[]),t(r,s,n[i],o)&&a.isArray(n[i])&&(n[i]=wr(n[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const r={};return a.forEachEntry(e,(s,n)=>{t(gr(s),n,r,0)}),r}return null}function br(e,t,r){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(e)}const ee={transitional:He,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",n=s.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return n?JSON.stringify(qe(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return hr(t,this.formSerializer).toString();if((c=a.isFileList(t))||s.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return ae(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return o||n?(r.setContentType("application/json",!1),br(t)):t}],transformResponse:[function(t){const r=this.transitional||ee.transitional,s=r&&r.forcedJSONParsing,n=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(s&&!this.responseType||n)){const i=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?b.from(c,b.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:v.classes.FormData,Blob:v.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ee.headers[e]={}});const yr=a.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"]),xr=e=>{const t={};let r,s,n;return e&&e.split(`
2
- `).forEach(function(i){n=i.indexOf(":"),r=i.substring(0,n).trim().toLowerCase(),s=i.substring(n+1).trim(),!(!r||t[r]&&yr[r])&&(r==="set-cookie"?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t},ze=Symbol("internals");function te(e){return e&&String(e).trim().toLowerCase()}function ce(e){return e===!1||e==null?e:a.isArray(e)?e.map(ce):String(e)}function Er(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(e);)t[s[1]]=s[2];return t}const _r=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function xe(e,t,r,s,n){if(a.isFunction(s))return s.call(this,t,r);if(n&&(t=r),!!a.isString(t)){if(a.isString(s))return t.indexOf(s)!==-1;if(a.isRegExp(s))return s.test(t)}}function Sr(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,s)=>r.toUpperCase()+s)}function Or(e,t){const r=a.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+r,{value:function(n,o,i){return this[s].call(this,t,n,o,i)},configurable:!0})})}let D=class{constructor(t){t&&this.set(t)}set(t,r,s){const n=this;function o(c,f,u){const l=te(f);if(!l)throw new Error("header name must be a non-empty string");const m=a.findKey(n,l);(!m||n[m]===void 0||u===!0||u===void 0&&n[m]!==!1)&&(n[m||f]=ce(c))}const i=(c,f)=>a.forEach(c,(u,l)=>o(u,l,f));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,r);else if(a.isString(t)&&(t=t.trim())&&!_r(t))i(xr(t),r);else if(a.isObject(t)&&a.isIterable(t)){let c={},f,u;for(const l of t){if(!a.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(f=c[u])?a.isArray(f)?[...f,l[1]]:[f,l[1]]:l[1]}i(c,r)}else t!=null&&o(r,t,s);return this}get(t,r){if(t=te(t),t){const s=a.findKey(this,t);if(s){const n=this[s];if(!r)return n;if(r===!0)return Er(n);if(a.isFunction(r))return r.call(this,n,s);if(a.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=te(t),t){const s=a.findKey(this,t);return!!(s&&this[s]!==void 0&&(!r||xe(this,this[s],s,r)))}return!1}delete(t,r){const s=this;let n=!1;function o(i){if(i=te(i),i){const c=a.findKey(s,i);c&&(!r||xe(s,s[c],c,r))&&(delete s[c],n=!0)}}return a.isArray(t)?t.forEach(o):o(t),n}clear(t){const r=Object.keys(this);let s=r.length,n=!1;for(;s--;){const o=r[s];(!t||xe(this,this[o],o,t,!0))&&(delete this[o],n=!0)}return n}normalize(t){const r=this,s={};return a.forEach(this,(n,o)=>{const i=a.findKey(s,o);if(i){r[i]=ce(n),delete r[o];return}const c=t?Sr(o):String(o).trim();c!==o&&delete r[o],r[c]=ce(n),s[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return a.forEach(this,(s,n)=>{s!=null&&s!==!1&&(r[n]=t&&a.isArray(s)?s.join(", "):s)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const s=new this(t);return r.forEach(n=>s.set(n)),s}static accessor(t){const s=(this[ze]=this[ze]={accessors:{}}).accessors,n=this.prototype;function o(i){const c=te(i);s[c]||(Or(n,i),s[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};D.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(D.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}}),a.freezeMethods(D);function Ee(e,t){const r=this||ee,s=t||r,n=D.from(s.headers);let o=s.data;return a.forEach(e,function(c){o=c.call(r,o,n.normalize(),t?t.status:void 0)}),n.normalize(),o}function Je(e){return!!(e&&e.__CANCEL__)}let re=class extends b{constructor(t,r,s){super(t??"canceled",b.ERR_CANCELED,r,s),this.name="CanceledError",this.__CANCEL__=!0}};function We(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new b("Request failed with status code "+r.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Tr(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Ar(e,t){e=e||10;const r=new Array(e),s=new Array(e);let n=0,o=0,i;return t=t!==void 0?t:1e3,function(f){const u=Date.now(),l=s[o];i||(i=u),r[n]=f,s[n]=u;let m=o,y=0;for(;m!==n;)y+=r[m++],m=m%e;if(n=(n+1)%e,n===o&&(o=(o+1)%e),u-i<t)return;const R=l&&u-l;return R?Math.round(y*1e3/R):void 0}}function Cr(e,t){let r=0,s=1e3/t,n,o;const i=(u,l=Date.now())=>{r=l,n=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const l=Date.now(),m=l-r;m>=s?i(u,l):(n=u,o||(o=setTimeout(()=>{o=null,i(n)},s-m)))},()=>n&&i(n)]}const le=(e,t,r=3)=>{let s=0;const n=Ar(50,250);return Cr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,f=i-s,u=n(f),l=i<=c;s=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&l?(c-i)/u:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(m)},r)},Ke=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},Ve=e=>(...t)=>a.asap(()=>e(...t)),Rr=v.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,v.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(v.origin),v.navigator&&/(msie|trident)/i.test(v.navigator.userAgent)):()=>!0,Nr=v.hasStandardBrowserEnv?{write(e,t,r,s,n,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(s)&&c.push(`path=${s}`),a.isString(n)&&c.push(`domain=${n}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")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(){return null},remove(){}};function kr(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function vr(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Xe(e,t,r){let s=!kr(t);return e&&(s||r==!1)?vr(e,t):t}const Ge=e=>e instanceof D?{...e}:e;function z(e,t){t=t||{};const r={};function s(u,l,m,y){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:y},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function n(u,l,m,y){if(a.isUndefined(l)){if(!a.isUndefined(u))return s(void 0,u,m,y)}else return s(u,l,m,y)}function o(u,l){if(!a.isUndefined(l))return s(void 0,l)}function i(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return s(void 0,u)}else return s(void 0,l)}function c(u,l,m){if(m in t)return s(u,l);if(m in e)return s(void 0,u)}const f={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:c,headers:(u,l,m)=>n(Ge(u),Ge(l),m,!0)};return a.forEach(Object.keys({...e,...t}),function(l){const m=f[l]||n,y=m(e[l],t[l],l);a.isUndefined(y)&&m!==c||(r[l]=y)}),r}const Ye=e=>{const t=z({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:o,headers:i,auth:c}=t;if(t.headers=i=D.from(i),t.url=$e(Xe(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(v.hasStandardBrowserEnv||v.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const f=r.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([l,m])=>{u.includes(l.toLowerCase())&&i.set(l,m)})}}if(v.hasStandardBrowserEnv&&(s&&a.isFunction(s)&&(s=s(t)),s||s!==!1&&Rr(t.url))){const f=n&&o&&Nr.read(o);f&&i.set(n,f)}return t},Pr=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,s){const n=Ye(e);let o=n.data;const i=D.from(n.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:u}=n,l,m,y,R,d;function g(){R&&R(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout;function E(){if(!h)return;const x=D.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),k={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:x,config:e,request:h};We(function(_){r(_),g()},function(_){s(_),g()},k),h=null}"onloadend"in h?h.onloadend=E:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(E)},h.onabort=function(){h&&(s(new b("Request aborted",b.ECONNABORTED,e,h)),h=null)},h.onerror=function(T){const k=T&&T.message?T.message:"Network Error",w=new b(k,b.ERR_NETWORK,e,h);w.event=T||null,s(w),h=null},h.ontimeout=function(){let T=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const k=n.transitional||He;n.timeoutErrorMessage&&(T=n.timeoutErrorMessage),s(new b(T,k.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(T,k){h.setRequestHeader(k,T)}),a.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),c&&c!=="json"&&(h.responseType=n.responseType),u&&([y,d]=le(u,!0),h.addEventListener("progress",y)),f&&h.upload&&([m,R]=le(f),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",R)),(n.cancelToken||n.signal)&&(l=x=>{h&&(s(!x||x.type?new re(null,e,h):x),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const O=Tr(n.url);if(O&&v.protocols.indexOf(O)===-1){s(new b("Unsupported protocol "+O+":",b.ERR_BAD_REQUEST,e));return}h.send(o||null)})},Ur=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,n;const o=function(u){if(!n){n=!0,c();const l=u instanceof Error?u:this.reason;s.abort(l instanceof b?l:new re(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new b(`timeout of ${t}ms exceeded`,b.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:f}=s;return f.unsubscribe=()=>a.asap(c),f}},Dr=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let s=0,n;for(;s<r;)n=s+t,yield e.slice(s,n),s=n},Fr=async function*(e,t){for await(const r of Lr(e))yield*Dr(r,t)},Lr=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:s}=await t.read();if(r)break;yield s}}finally{await t.cancel()}},Qe=(e,t,r,s)=>{const n=Fr(e,t);let o=0,i,c=f=>{i||(i=!0,s&&s(f))};return new ReadableStream({async pull(f){try{const{done:u,value:l}=await n.next();if(u){c(),f.close();return}let m=l.byteLength;if(r){let y=o+=m;r(y)}f.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(f){return c(f),n.return()}},{highWaterMark:2})},Ze=64*1024,{isFunction:ue}=a,Ir=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:et,TextEncoder:tt}=a.global,rt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Br=e=>{e=a.merge.call({skipUndefined:!0},Ir,e);const{fetch:t,Request:r,Response:s}=e,n=t?ue(t):typeof fetch=="function",o=ue(r),i=ue(s);if(!n)return!1;const c=n&&ue(et),f=n&&(typeof tt=="function"?(d=>g=>d.encode(g))(new tt):async d=>new Uint8Array(await new r(d).arrayBuffer())),u=o&&c&&rt(()=>{let d=!1;const g=new r(v.origin,{body:new et,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!g}),l=i&&c&&rt(()=>a.isReadableStream(new s("").body)),m={stream:l&&(d=>d.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!m[d]&&(m[d]=(g,h)=>{let E=g&&g[d];if(E)return E.call(g);throw new b(`Response type '${d}' is not supported`,b.ERR_NOT_SUPPORT,h)})});const y=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new r(v.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await f(d)).byteLength},R=async(d,g)=>{const h=a.toFiniteNumber(d.getContentLength());return h??y(g)};return async d=>{let{url:g,method:h,data:E,signal:O,cancelToken:x,timeout:T,onDownloadProgress:k,onUploadProgress:w,responseType:_,headers:P,withCredentials:N="same-origin",fetchOptions:B}=Ye(d),S=t||fetch;_=_?(_+"").toLowerCase():"text";let X=Ur([O,x&&x.toAbortSignal()],T),W=null;const $=X&&X.unsubscribe&&(()=>{X.unsubscribe()});let gt;try{if(w&&u&&h!=="get"&&h!=="head"&&(gt=await R(P,E))!==0){let H=new r(g,{method:"POST",body:E,duplex:"half"}),G;if(a.isFormData(E)&&(G=H.headers.get("content-type"))&&P.setContentType(G),H.body){const[Ae,pe]=Ke(gt,le(Ve(w)));E=Qe(H.body,Ze,Ae,pe)}}a.isString(N)||(N=N?"include":"omit");const j=o&&"credentials"in r.prototype,wt={...B,signal:X,method:h.toUpperCase(),headers:P.normalize().toJSON(),body:E,duplex:"half",credentials:j?N:void 0};W=o&&new r(g,wt);let M=await(o?S(W,B):S(g,wt));const bt=l&&(_==="stream"||_==="response");if(l&&(k||bt&&$)){const H={};["status","statusText","headers"].forEach(yt=>{H[yt]=M[yt]});const G=a.toFiniteNumber(M.headers.get("content-length")),[Ae,pe]=k&&Ke(G,le(Ve(k),!0))||[];M=new s(Qe(M.body,Ze,Ae,()=>{pe&&pe(),$&&$()}),H)}_=_||"text";let Yr=await m[a.findKey(m,_)||"text"](M,d);return!bt&&$&&$(),await new Promise((H,G)=>{We(H,G,{data:Yr,headers:D.from(M.headers),status:M.status,statusText:M.statusText,config:d,request:W})})}catch(j){throw $&&$(),j&&j.name==="TypeError"&&/Load failed|fetch/i.test(j.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,d,W),{cause:j.cause||j}):b.from(j,j&&j.code,d,W)}}},jr=new Map,st=e=>{let t=e&&e.env||{};const{fetch:r,Request:s,Response:n}=t,o=[s,n,r];let i=o.length,c=i,f,u,l=jr;for(;c--;)f=o[c],u=l.get(f),u===void 0&&l.set(f,u=c?new Map:Br(t)),l=u;return u};st();const _e={http:ar,xhr:Pr,fetch:{get:st}};a.forEach(_e,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const nt=e=>`- ${e}`,$r=e=>a.isFunction(e)||e===null||e===!1;function Mr(e,t){e=a.isArray(e)?e:[e];const{length:r}=e;let s,n;const o={};for(let i=0;i<r;i++){s=e[i];let c;if(n=s,!$r(s)&&(n=_e[(c=String(s)).toLowerCase()],n===void 0))throw new b(`Unknown adapter '${c}'`);if(n&&(a.isFunction(n)||(n=n.get(t))))break;o[c||"#"+i]=n}if(!n){const i=Object.entries(o).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
4
- `+i.map(nt).join(`
5
- `):" "+nt(i[0]):"as no adapter specified";throw new b("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return n}const ot={getAdapter:Mr,adapters:_e};function Se(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new re(null,e)}function it(e){return Se(e),e.headers=D.from(e.headers),e.data=Ee.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ot.getAdapter(e.adapter||ee.adapter,e)(e).then(function(s){return Se(e),s.data=Ee.call(e,e.transformResponse,s),s.headers=D.from(s.headers),s},function(s){return Je(s)||(Se(e),s&&s.response&&(s.response.data=Ee.call(e,e.transformResponse,s.response),s.response.headers=D.from(s.response.headers))),Promise.reject(s)})}const at="1.13.4",de={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{de[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const ct={};de.transitional=function(t,r,s){function n(o,i){return"[Axios v"+at+"] Transitional option '"+o+"'"+i+(s?". "+s:"")}return(o,i,c)=>{if(t===!1)throw new b(n(i," has been removed"+(r?" in "+r:"")),b.ERR_DEPRECATED);return r&&!ct[i]&&(ct[i]=!0,console.warn(n(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,i,c):!0}},de.spelling=function(t){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Hr(e,t,r){if(typeof e!="object")throw new b("options must be an object",b.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let n=s.length;for(;n-- >0;){const o=s[n],i=t[o];if(i){const c=e[o],f=c===void 0||i(c,o,e);if(f!==!0)throw new b("option "+o+" must be "+f,b.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new b("Unknown option "+o,b.ERR_BAD_OPTION)}}const fe={assertOptions:Hr,validators:de},I=fe.validators;let J=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Me,response:new Me}}async request(t,r){try{return await this._request(t,r)}catch(s){if(s instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const o=n.stack?n.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
6
- `+o):s.stack=o}catch{}}throw s}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=z(this.defaults,r);const{transitional:s,paramsSerializer:n,headers:o}=r;s!==void 0&&fe.assertOptions(s,{silentJSONParsing:I.transitional(I.boolean),forcedJSONParsing:I.transitional(I.boolean),clarifyTimeoutError:I.transitional(I.boolean)},!1),n!=null&&(a.isFunction(n)?r.paramsSerializer={serialize:n}:fe.assertOptions(n,{encode:I.function,serialize:I.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),fe.assertOptions(r,{baseUrl:I.spelling("baseURL"),withXsrfToken:I.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete o[d]}),r.headers=D.concat(i,o);const c=[];let f=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(f=f&&g.synchronous,c.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let l,m=0,y;if(!f){const d=[it.bind(this),void 0];for(d.unshift(...c),d.push(...u),y=d.length,l=Promise.resolve(r);m<y;)l=l.then(d[m++],d[m++]);return l}y=c.length;let R=r;for(;m<y;){const d=c[m++],g=c[m++];try{R=d(R)}catch(h){g.call(this,h);break}}try{l=it.call(this,R)}catch(d){return Promise.reject(d)}for(m=0,y=u.length;m<y;)l=l.then(u[m++],u[m++]);return l}getUri(t){t=z(this.defaults,t);const r=Xe(t.baseURL,t.url,t.allowAbsoluteUrls);return $e(r,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){J.prototype[t]=function(r,s){return this.request(z(s||{},{method:t,url:r,data:(s||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function r(s){return function(o,i,c){return this.request(z(c||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}J.prototype[t]=r(),J.prototype[t+"Form"]=r(!0)});let qr=class _t{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const s=this;this.promise.then(n=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](n);s._listeners=null}),this.promise.then=n=>{let o;const i=new Promise(c=>{s.subscribe(c),o=c}).then(n);return i.cancel=function(){s.unsubscribe(o)},i},t(function(o,i,c){s.reason||(s.reason=new re(o,i,c),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=s=>{t.abort(s)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new _t(function(n){t=n}),cancel:t}}};function zr(e){return function(r){return e.apply(null,r)}}function Jr(e){return a.isObject(e)&&e.isAxiosError===!0}const Oe={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(Oe).forEach(([e,t])=>{Oe[t]=e});function lt(e){const t=new J(e),r=Ce(J.prototype.request,t);return a.extend(r,J.prototype,t,{allOwnKeys:!0}),a.extend(r,t,null,{allOwnKeys:!0}),r.create=function(n){return lt(z(e,n))},r}const A=lt(ee);A.Axios=J,A.CanceledError=re,A.CancelToken=qr,A.isCancel=Je,A.VERSION=at,A.toFormData=ae,A.AxiosError=b,A.Cancel=A.CanceledError,A.all=function(t){return Promise.all(t)},A.spread=zr,A.isAxiosError=Jr,A.mergeConfig=z,A.AxiosHeaders=D,A.formToJSON=e=>qe(a.isHTMLForm(e)?new FormData(e):e),A.getAdapter=ot.getAdapter,A.HttpStatusCode=Oe,A.default=A;const{Axios:is,AxiosError:as,CanceledError:cs,isCancel:ls,CancelToken:us,VERSION:ds,all:fs,Cancel:ps,isAxiosError:ms,spread:hs,toFormData:gs,AxiosHeaders:ws,HttpStatusCode:bs,formToJSON:ys,getAdapter:xs,mergeConfig:Es}=A,Wr="https://customers-services.tarxemo.com/api";class ut{constructor(t,r=Wr){xt(this,"client");this.client=A.create({baseURL:r,headers:{"Content-Type":"application/json","X-API-Key":t},timeout:3e4}),this.client.interceptors.response.use(s=>s,s=>{var n,o;if((n=s.response)!=null&&n.data){const c=((o=s.response.data.response)==null?void 0:o.message)||"An unknown error occurred";throw new Error(c)}else throw s.request?new Error("No response from server. Please check your connection."):new Error(s.message||"Request failed")})}async sendMessage(t,r){try{const s=await this.client.post("/chat/",{question:t,session_id:r});if(s.data.response.status!=="success")throw new Error(s.data.response.message);return s.data.data}catch(s){throw s instanceof Error?s:new Error("Failed to send message")}}async getConversationHistory(t){try{const r=await this.client.get(`/chat/history/${t}/`);if(r.data.response.status!=="success")throw new Error(r.data.response.message);return r.data.data}catch(r){throw r instanceof Error?r:new Error("Failed to load conversation history")}}updateApiKey(t){this.client.defaults.headers.common["X-API-Key"]=t}updateBaseUrl(t){this.client.defaults.baseURL=t}}function Te(e,t){const[r,s]=p.useState(()=>{try{const n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return console.warn(`Error reading localStorage key "${e}":`,n),t}});return p.useEffect(()=>{try{window.localStorage.setItem(e,JSON.stringify(r))}catch(n){console.warn(`Error setting localStorage key "${e}":`,n)}},[e,r]),[r,s]}function dt(){return`session_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}const Kr="customer_support_session_id",Vr="customer_support_messages";function ft(e){const{apiKey:t,baseUrl:r,onError:s}=e,[n,o]=Te(Vr,[]),[i,c]=Te(Kr,dt()),[f,u]=p.useState(!1),[l,m]=p.useState(null),y=p.useRef(null);p.useEffect(()=>{y.current=new ut(t,r)},[t,r]);const R=p.useCallback(()=>{m(null)},[]),d=p.useCallback(async E=>{if(!y.current){const x=new Error("API client not initialized");m(x),s==null||s(x);return}if(!E.trim())return;const O={id:`user_${Date.now()}`,role:"USER",content:E,timestamp:new Date};o(x=>[...x,O]),u(!0),m(null);try{const x=await y.current.sendMessage(E,i),T={id:`assistant_${Date.now()}`,role:"ASSISTANT",content:x.answer,timestamp:new Date,sources:x.sources};o(k=>[...k,T]),x.session_id!==i&&c(x.session_id)}catch(x){const T=x instanceof Error?x:new Error("Failed to send message");m(T),s==null||s(T);const k={id:`error_${Date.now()}`,role:"ASSISTANT",content:`Sorry, I encountered an error: ${T.message}`,timestamp:new Date};o(w=>[...w,k])}finally{u(!1)}},[i,s,o,c]),g=p.useCallback(async()=>{if(!(!y.current||!i)){u(!0),m(null);try{const O=(await y.current.getConversationHistory(i)).messages.map((x,T)=>({id:`${x.role.toLowerCase()}_${T}_${Date.now()}`,role:x.role.toUpperCase(),content:x.content,timestamp:new Date(x.created_at)}));o(O)}catch(E){const O=E instanceof Error?E:new Error("Failed to load history");m(O),s==null||s(O)}finally{u(!1)}}},[i,s,o]),h=p.useCallback(()=>{o([]),c(dt())},[o,c]);return{messages:n,sendMessage:d,isLoading:f,error:l,clearError:R,sessionId:i,loadHistory:g,clearHistory:h}}const pt=({message:e})=>{const t=e.role.toUpperCase()==="USER",r=e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp);return p.createElement("div",{className:`cs-message ${t?"cs-message--user":"cs-message--assistant"}`},p.createElement("div",{className:"cs-message__content"},p.createElement("p",{className:"cs-message__text"},e.content),e.sources&&e.sources.length>0&&p.createElement("div",{className:"cs-message__sources"},p.createElement("p",{className:"cs-message__sources-title"},"Sources:"),p.createElement("ul",{className:"cs-message__sources-list"},e.sources.map((s,n)=>p.createElement("li",{key:n,className:"cs-message__source-item"},p.createElement("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"cs-message__source-link"},p.createElement(L.ExternalLink,{size:12}),p.createElement("span",null,s.title)),p.createElement("span",{className:"cs-message__source-similarity"},Math.round(s.similarity*100),"% match")))))),p.createElement("time",{className:"cs-message__time",dateTime:r.toISOString()},r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})))},mt=({onSendMessage:e,isLoading:t,placeholder:r="Type your message..."})=>{const[s,n]=p.useState(""),o=c=>{c.preventDefault(),s.trim()&&!t&&(e(s),n(""))},i=c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),o(c))};return p.createElement("form",{className:"cs-input",onSubmit:o},p.createElement("textarea",{className:"cs-input__textarea",value:s,onChange:c=>n(c.target.value),onKeyDown:i,placeholder:r,disabled:t,rows:1,"aria-label":"Message input"}),p.createElement("button",{type:"submit",className:"cs-input__button",disabled:!s.trim()||t,"aria-label":"Send message"},p.createElement(L.Send,{size:20})))},ht=({messages:e,onSendMessage:t,onClose:r,isLoading:s,error:n,placeholder:o,welcomeMessage:i="Hi! How can I help you today?"})=>{const c=p.useRef(null);return p.useEffect(()=>{var f;(f=c.current)==null||f.scrollIntoView({behavior:"smooth"})},[e]),p.createElement("div",{className:"cs-window"},p.createElement("div",{className:"cs-window__header"},p.createElement("div",{className:"cs-window__header-info"},p.createElement("h3",{className:"text-gray-900"},"Customer Support"),p.createElement("div",{className:"cs-window__status"},p.createElement("span",{className:"cs-window__status-dot"}),p.createElement("span",{className:"text-gray-900"},"Online"))),p.createElement("button",{className:"cs-window__close",onClick:r,"aria-label":"Close chat"},p.createElement(L.X,{size:20}))),p.createElement("div",{className:"cs-window__messages"},e.length===0&&!s&&p.createElement("div",{className:"cs-window__welcome"},p.createElement("p",null,i)),e.map(f=>p.createElement(pt,{key:f.id,message:f})),s&&p.createElement("div",{className:"cs-window__typing"},p.createElement(L.Loader2,{size:20,className:"cs-window__typing-icon"}),p.createElement("span",null,"Thinking...")),n&&p.createElement("div",{className:"cs-window__error"},p.createElement("p",null,n.message)),p.createElement("div",{ref:c})),p.createElement("div",{className:"cs-window__input-wrapper"},p.createElement(mt,{onSendMessage:t,isLoading:s,placeholder:o})))},Xr=':root{--cs-primary-color: inherit;--cs-secondary-color: inherit;--cs-bg-color: inherit;--cs-text-color: inherit;--cs-font-family: inherit;--cs-border-radius: 12px;--cs-button-color: var(--cs-primary-color);--cs-user-message-color: var(--cs-primary-color);--cs-assistant-message-color: rgba(0, 0, 0, .05);--cs-header-gradient: linear-gradient(135deg, var(--cs-primary-color), var(--cs-secondary-color));--cs-header-text-color: #ffffff;--cs-bg-text-color: #1a1a1a;--cs-user-text-color: #ffffff;--cs-assistant-text-color: #1a1a1a;--cs-success-color: #4ade80;--cs-error-color: #ef4444;--cs-error-bg-color: rgba(239, 68, 68, .1);--cs-border-color: rgba(0, 0, 0, .1);--cs-shadow-color: rgba(0, 0, 0, .1);--cs-scrollbar-thumb: rgba(0, 0, 0, .2);--cs-scrollbar-track: transparent;--cs-shadow-sm: 0 1px 2px 0 var(--cs-shadow-color);--cs-shadow: 0 4px 6px -1px var(--cs-shadow-color), 0 2px 4px -1px var(--cs-shadow-color);--cs-shadow-lg: 0 10px 15px -3px var(--cs-shadow-color), 0 4px 6px -2px var(--cs-shadow-color);--cs-shadow-xl: 0 20px 25px -5px var(--cs-shadow-color), 0 10px 10px -5px var(--cs-shadow-color)}.cs-widget{position:fixed;z-index:9999;font-family:var(--cs-font-family)}.cs-widget,.cs-widget *{box-sizing:border-box}.cs-widget--bottom-right{bottom:20px;right:20px}.cs-widget--bottom-left{bottom:20px;left:20px}.cs-widget--top-right{top:20px;right:20px}.cs-widget--top-left{top:20px;left:20px}.cs-widget__toggle{position:relative;width:60px;height:60px;border-radius:50%;background:var(--cs-primary-color);border:none;color:#fff;cursor:pointer;box-shadow:var(--cs-shadow-xl);transition:all .3s cubic-bezier(.4,0,.2,1);display:flex;align-items:center;justify-content:center}.cs-widget__toggle:hover{transform:scale(1.1);box-shadow:0 15px 25px -5px var(--cs-focus-ring)}.cs-widget__toggle:active{transform:scale(.95)}.cs-widget__toggle--open{background:var(--cs-error-color)}.cs-widget__badge{position:absolute;top:-5px;right:-5px;background:var(--cs-error-color);color:#fff;border-radius:50%;width:24px;height:24px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;box-shadow:var(--cs-shadow)}.cs-window{position:absolute;bottom:85px;right:0;width:380px;max-width:calc(100vw - 40px);height:600px;max-height:calc(100vh - 130px);background:var(--cs-bg-color);border-radius:var(--cs-border-radius);border:1px solid rgba(0,0,0,.1);box-shadow:var(--cs-shadow-xl);display:flex;flex-direction:column;overflow:visible;animation:slideUp .3s cubic-bezier(.4,0,.2,1);transform-origin:bottom right}.cs-window:after{content:"";position:absolute;bottom:-10px;right:25px;width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid var(--cs-bg-color);filter:drop-shadow(0 5px 5px var(--cs-shadow-color))}.cs-widget--bottom-left .cs-window{transform-origin:bottom left;right:auto;left:0}.cs-widget--bottom-left .cs-window:after{right:auto;left:25px}.cs-widget--top-right .cs-window{transform-origin:top right;bottom:auto;top:85px}.cs-widget--top-right .cs-window:after{bottom:auto;top:-10px;border-top:none;border-bottom:10px solid var(--cs-bg-color)}.cs-widget--top-left .cs-window{transform-origin:top left;bottom:auto;top:85px;right:auto;left:0}.cs-widget--top-left .cs-window:after{bottom:auto;top:-10px;border-top:none;border-bottom:10px solid var(--cs-bg-color);right:auto;left:25px}@keyframes slideUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.cs-window__header{background:var(--cs-header-gradient);color:var(--cs-header-text-color);padding:16px 20px;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}.cs-window__header-info{display:flex;flex-direction:column;gap:2px}.cs-window__title{margin:0;font-size:16px;font-weight:600}.cs-window__status{display:flex;align-items:center;gap:6px;font-size:12px;opacity:.9}.cs-window__status-dot{width:8px;height:8px;background:var(--cs-success-color);border-radius:50%;box-shadow:0 0 0 2px var(--cs-bg-color)}.cs-window__close{background:transparent;border:none;color:var(--cs-header-text-color);width:32px;height:32px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s}.cs-window__close:hover{background:var(--cs-shadow-color)}.cs-window__messages{flex:1;overflow-y:auto;overflow-x:hidden;padding:20px;display:flex;flex-direction:column;gap:16px;background:var(--cs-bg-color);color:var(--cs-bg-text-color)}.cs-window__messages::-webkit-scrollbar{width:6px}.cs-window__messages::-webkit-scrollbar-track{background:transparent}.cs-window__messages::-webkit-scrollbar-thumb{background:var(--cs-scrollbar-thumb);border-radius:3px}.cs-window__messages::-webkit-scrollbar-thumb:hover{background:var(--cs-border-color)}.cs-window__welcome{text-align:center;padding:40px 20px;color:var(--cs-bg-text-color);opacity:.7}.cs-window__welcome p{margin:0;font-size:16px}.cs-window__typing{display:flex;align-items:center;gap:8px;padding:12px 16px;background:var(--cs-assistant-message-color);border-radius:var(--cs-border-radius);width:fit-content;color:var(--cs-text-color)}.cs-window__typing-icon{animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.cs-window__error{background:var(--cs-error-bg-color);border:1px solid var(--cs-error-color);color:var(--cs-error-color);padding:12px 16px;border-radius:var(--cs-border-radius)}.cs-window__error p{margin:0}.cs-message{display:flex;flex-direction:column;gap:6px;max-width:85%;min-width:0;animation:fadeIn .3s ease-in-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.cs-message--user{align-self:flex-end;align-items:flex-end}.cs-message--assistant{align-self:flex-start;align-items:flex-start}.cs-message__content{background:var(--cs-assistant-message-color);padding:12px 16px;border-radius:var(--cs-border-radius);border-bottom-left-radius:4px;color:var(--cs-assistant-text-color);word-wrap:break-word;box-shadow:var(--cs-shadow-sm);min-width:0;max-width:100%}.cs-message--user .cs-message__content{background:var(--cs-user-message-color);color:var(--cs-user-text-color);border-radius:var(--cs-border-radius);border-bottom-right-radius:4px}.cs-message__text{margin:0;line-height:1.5;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere}.cs-message__time{font-size:11px;color:var(--cs-bg-text-color);opacity:.5;padding:0 4px}.cs-message__sources{margin-top:12px;padding-top:12px;border-top:1px solid var(--cs-border-color)}.cs-message__sources-title{margin:0 0 8px;font-size:12px;font-weight:600;color:var(--cs-bg-text-color);opacity:.7}.cs-message__sources-list{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:6px}.cs-message__source-item{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px}.cs-message__source-link{display:flex;align-items:center;gap:4px;color:var(--cs-primary-color);text-decoration:none;flex:1;min-width:0}.cs-message__source-link:hover{text-decoration:underline}.cs-message__source-link span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.cs-message__source-similarity{color:#6b7280;font-size:11px;white-space:nowrap}.cs-window__input-wrapper{padding:16px;background:var(--cs-bg-color);border-top:1px solid var(--cs-border-color);flex-shrink:0}.cs-input{display:flex;gap:8px;align-items:flex-end}.cs-input__textarea{flex:1;padding:12px 16px;border:1px solid var(--cs-border-color);border-radius:var(--cs-border-radius);font-family:var(--cs-font-family);font-size:14px;resize:none;max-height:120px;min-height:44px;transition:border-color .2s;background:var(--cs-bg-color);color:var(--cs-bg-text-color)}.cs-input__textarea:focus{outline:none;border-color:var(--cs-primary-color);box-shadow:0 0 0 3px var(--cs-focus-ring);background-color:var(--cs-bg-color)}.cs-input__textarea:disabled{background:var(--cs-border-color);cursor:not-allowed;opacity:.5}.cs-input__button{background:var(--cs-button-color);color:var(--cs-header-text-color);border:none;width:44px;height:44px;border-radius:var(--cs-border-radius);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;flex-shrink:0}.cs-input__button:hover:not(:disabled){background:var(--cs-secondary-color);transform:scale(1.05)}.cs-input__button:active:not(:disabled){transform:scale(.95)}.cs-input__button:disabled{background:var(--cs-border-color);cursor:not-allowed;opacity:.5}@media(max-width:480px){.cs-widget--open{position:fixed!important;inset:auto!important;bottom:20px!important;right:20px!important;width:auto!important;height:auto!important;z-index:10000!important}.cs-window{position:fixed!important;width:88vw!important;height:60vh!important;max-width:400px!important;max-height:500px!important;bottom:90px!important;right:5%!important;left:5%!important;top:auto!important;border-radius:var(--cs-border-radius)!important;box-shadow:var(--cs-shadow-xl)!important;display:flex!important;flex-direction:column!important;animation:slideUp .3s ease-out!important;overflow:visible!important}.cs-widget--open .cs-widget__toggle{display:flex!important;opacity:.8}.cs-window__messages{padding:16px}.cs-window__header{padding:12px 16px}.cs-window__input-wrapper{padding:12px}.cs-widget__toggle{width:50px;height:50px}}',Gr=({apiKey:e,baseUrl:t,theme:r,position:s="bottom-right",welcomeMessage:n,placeholder:o,className:i="",onError:c,onMessageSent:f,onMessageReceived:u})=>{const[l,m]=p.useState(!1),{messages:y,sendMessage:R,isLoading:d,error:g,clearError:h}=ft({apiKey:e,baseUrl:t,onError:c}),E=w=>{if(!w)return"#ffffff";let _,P,N;if(w.startsWith("#")){const S=w.slice(1);_=parseInt(S.substring(0,2),16),P=parseInt(S.substring(2,4),16),N=parseInt(S.substring(4,6),16)}else if(w.startsWith("rgb")){const S=w.match(/\d+/g);if(S&&S.length>=3)_=parseInt(S[0]),P=parseInt(S[1]),N=parseInt(S[2]);else return"#ffffff"}else return"#ffffff";return(.299*_+.587*P+.114*N)/255>.6?"#1a1a1a":"#ffffff"},O=(w,_)=>{if(!w)return`rgba(0, 0, 0, ${_})`;let P=0,N=0,B=0;if(w.startsWith("#")){const S=w.slice(1);S.length===3?(P=parseInt(S[0]+S[0],16),N=parseInt(S[1]+S[1],16),B=parseInt(S[2]+S[2],16)):(P=parseInt(S.substring(0,2),16),N=parseInt(S.substring(2,4),16),B=parseInt(S.substring(4,6),16))}else if(w.startsWith("rgb")){const S=w.match(/\d+/g);S&&S.length>=3&&(P=parseInt(S[0]),N=parseInt(S[1]),B=parseInt(S[2]))}return`rgba(${P}, ${N}, ${B}, ${_})`},x=p.useMemo(()=>{const w={},_=(r==null?void 0:r.primaryColor)||"#6366f1",P=(r==null?void 0:r.backgroundColor)||"#ffffff",N=(r==null?void 0:r.textColor)||(E(P)==="#ffffff"?"#ffffff":"#1f2937"),B=(r==null?void 0:r.successColor)||"#4ade80",S=(r==null?void 0:r.errorColor)||"#ef4444",X=(r==null?void 0:r.borderColor)||O(N,.1),W=(r==null?void 0:r.shadowColor)||"rgba(0, 0, 0, 0.1)";w["--cs-primary-color"]=_,w["--cs-secondary-color"]=(r==null?void 0:r.secondaryColor)||_,w["--cs-bg-color"]=P,w["--cs-text-color"]=N,w["--cs-font-family"]=(r==null?void 0:r.fontFamily)||"inherit",w["--cs-border-radius"]=(r==null?void 0:r.borderRadius)||"12px",w["--cs-success-color"]=B,w["--cs-error-color"]=S,w["--cs-error-bg-color"]=O(S,.1),w["--cs-border-color"]=X,w["--cs-shadow-color"]=W,w["--cs-scrollbar-thumb"]=O(N,.2),w["--cs-scrollbar-track"]="transparent",w["--cs-header-text-color"]=E(_),w["--cs-bg-text-color"]=N,w["--cs-button-color"]=(r==null?void 0:r.buttonColor)||_,w["--cs-user-message-color"]=(r==null?void 0:r.userMessageColor)||_,w["--cs-user-text-color"]=E((r==null?void 0:r.userMessageColor)||_);const $=E(P)==="#ffffff";return w["--cs-assistant-message-color"]=(r==null?void 0:r.assistantMessageColor)||($?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)"),w["--cs-assistant-text-color"]=N,w["--cs-focus-ring"]=O(_,.2),w},[r]),T=async w=>{if(f==null||f(w),await R(w),!g){const _=y[y.length-1];(_==null?void 0:_.role)==="ASSISTANT"&&(u==null||u(_.content))}},k=()=>{m(!l),g&&h()};return p.createElement("div",{className:`cs-widget cs-widget--${s} ${l?"cs-widget--open":""} ${i}`,style:x},p.createElement("style",{dangerouslySetInnerHTML:{__html:Xr}}),l&&p.createElement(ht,{messages:y,onSendMessage:T,onClose:()=>m(!1),isLoading:d,error:g,placeholder:o,welcomeMessage:n}),p.createElement("button",{className:`cs-widget__toggle ${l?"cs-widget__toggle--open":""}`,onClick:k,"aria-label":l?"Close chat":"Open chat","aria-expanded":l},p.createElement(L.MessageCircle,{size:24}),!l&&y.length>0&&p.createElement("span",{className:"cs-widget__badge"},y.filter(w=>w.role.toUpperCase()==="ASSISTANT").length)))};C.ChatInput=mt,C.ChatMessage=pt,C.ChatWindow=ht,C.CustomerSupportAPIClient=ut,C.CustomerSupportWidget=Gr,C.useCustomerSupport=ft,C.useLocalStorage=Te,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(R,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react","lucide-react"],f):(R=typeof globalThis<"u"?globalThis:R||self,f(R.CustomerSupport={},R.React,R.lucideReact))})(this,(function(R,f,I){"use strict";var Qr=Object.defineProperty;var Zr=(R,f,I)=>f in R?Qr(R,f,{enumerable:!0,configurable:!0,writable:!0,value:I}):R[f]=I;var xt=(R,f,I)=>Zr(R,typeof f!="symbol"?f+"":f,I);function Re(e,t){return function(){return e.apply(t,arguments)}}const{toString:St}=Object.prototype,{getPrototypeOf:he}=Object,{iterator:se,toStringTag:Ne}=Symbol,ne=(e=>t=>{const r=St.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),$=e=>(e=e.toLowerCase(),t=>ne(t)===e),oe=e=>t=>typeof t===e,{isArray:V}=Array,X=oe("undefined");function G(e){return e!==null&&!X(e)&&e.constructor!==null&&!X(e.constructor)&&U(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ve=$("ArrayBuffer");function Ot(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ve(e.buffer),t}const Tt=oe("string"),U=oe("function"),ke=oe("number"),Q=e=>e!==null&&typeof e=="object",At=e=>e===!0||e===!1,ie=e=>{if(ne(e)!=="object")return!1;const t=he(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ne in e)&&!(se in e)},Ct=e=>{if(!Q(e)||G(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Rt=$("Date"),Nt=$("File"),vt=$("Blob"),kt=$("FileList"),Pt=e=>Q(e)&&U(e.pipe),Dt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||U(e.append)&&((t=ne(e))==="formdata"||t==="object"&&U(e.toString)&&e.toString()==="[object FormData]"))},Ut=$("URLSearchParams"),[Ft,Lt,It,Bt]=["ReadableStream","Request","Response","Headers"].map($),jt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Z(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let s,n;if(typeof e!="object"&&(e=[e]),V(e))for(s=0,n=e.length;s<n;s++)t.call(null,e[s],s,e);else{if(G(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(s=0;s<i;s++)c=o[s],t.call(null,e[c],c,e)}}function Pe(e,t){if(G(e))return null;t=t.toLowerCase();const r=Object.keys(e);let s=r.length,n;for(;s-- >0;)if(n=r[s],t===n.toLowerCase())return n;return null}const J=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,De=e=>!X(e)&&e!==J;function ge(){const{caseless:e,skipUndefined:t}=De(this)&&this||{},r={},s=(n,o)=>{const i=e&&Pe(r,o)||o;ie(r[i])&&ie(n)?r[i]=ge(r[i],n):ie(n)?r[i]=ge({},n):V(n)?r[i]=n.slice():(!t||!X(n))&&(r[i]=n)};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&Z(arguments[n],s);return r}const $t=(e,t,r,{allOwnKeys:s}={})=>(Z(t,(n,o)=>{r&&U(n)?Object.defineProperty(e,o,{value:Re(n,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),e),Mt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ht=(e,t,r,s)=>{e.prototype=Object.create(t.prototype,s),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},qt=(e,t,r,s)=>{let n,o,i;const c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)i=n[o],(!s||s(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=r!==!1&&he(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},zt=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return s!==-1&&s===r},Jt=e=>{if(!e)return null;if(V(e))return e;let t=e.length;if(!ke(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Wt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&he(Uint8Array)),Kt=(e,t)=>{const s=(e&&e[se]).call(e);let n;for(;(n=s.next())&&!n.done;){const o=n.value;t.call(e,o[0],o[1])}},Vt=(e,t)=>{let r;const s=[];for(;(r=e.exec(t))!==null;)s.push(r);return s},Xt=$("HTMLFormElement"),Yt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,s,n){return s.toUpperCase()+n}),Ue=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Gt=$("RegExp"),Fe=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};Z(r,(n,o)=>{let i;(i=t(n,o,e))!==!1&&(s[o]=i||n)}),Object.defineProperties(e,s)},Qt=e=>{Fe(e,(t,r)=>{if(U(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const s=e[r];if(U(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Zt=(e,t)=>{const r={},s=n=>{n.forEach(o=>{r[o]=!0})};return V(e)?s(e):s(String(e).split(t)),r},er=()=>{},tr=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function rr(e){return!!(e&&U(e.append)&&e[Ne]==="FormData"&&e[se])}const sr=e=>{const t=new Array(10),r=(s,n)=>{if(Q(s)){if(t.indexOf(s)>=0)return;if(G(s))return s;if(!("toJSON"in s)){t[n]=s;const o=V(s)?[]:{};return Z(s,(i,c)=>{const p=r(i,n+1);!X(p)&&(o[c]=p)}),t[n]=void 0,o}}return s};return r(e,0)},nr=$("AsyncFunction"),or=e=>e&&(Q(e)||U(e))&&U(e.then)&&U(e.catch),Le=((e,t)=>e?setImmediate:t?((r,s)=>(J.addEventListener("message",({source:n,data:o})=>{n===J&&o===r&&s.length&&s.shift()()},!1),n=>{s.push(n),J.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",U(J.postMessage)),ir=typeof queueMicrotask<"u"?queueMicrotask.bind(J):typeof process<"u"&&process.nextTick||Le,a={isArray:V,isArrayBuffer:ve,isBuffer:G,isFormData:Dt,isArrayBufferView:Ot,isString:Tt,isNumber:ke,isBoolean:At,isObject:Q,isPlainObject:ie,isEmptyObject:Ct,isReadableStream:Ft,isRequest:Lt,isResponse:It,isHeaders:Bt,isUndefined:X,isDate:Rt,isFile:Nt,isBlob:vt,isRegExp:Gt,isFunction:U,isStream:Pt,isURLSearchParams:Ut,isTypedArray:Wt,isFileList:kt,forEach:Z,merge:ge,extend:$t,trim:jt,stripBOM:Mt,inherits:Ht,toFlatObject:qt,kindOf:ne,kindOfTest:$,endsWith:zt,toArray:Jt,forEachEntry:Kt,matchAll:Vt,isHTMLForm:Xt,hasOwnProperty:Ue,hasOwnProp:Ue,reduceDescriptors:Fe,freezeMethods:Qt,toObjectSet:Zt,toCamelCase:Yt,noop:er,toFiniteNumber:tr,findKey:Pe,global:J,isContextDefined:De,isSpecCompliantForm:rr,toJSONObject:sr,isAsyncFn:nr,isThenable:or,setImmediate:Le,asap:ir,isIterable:e=>e!=null&&U(e[se])};let w=class Et extends Error{static from(t,r,s,n,o,i){const c=new Et(t.message,r||t.code,s,n,o);return c.cause=t,c.name=t.name,i&&Object.assign(c,i),c}constructor(t,r,s,n,o){super(t),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),s&&(this.config=s),n&&(this.request=n),o&&(this.response=o,this.status=o.status)}toJSON(){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:a.toJSONObject(this.config),code:this.code,status:this.status}}};w.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",w.ERR_BAD_OPTION="ERR_BAD_OPTION",w.ECONNABORTED="ECONNABORTED",w.ETIMEDOUT="ETIMEDOUT",w.ERR_NETWORK="ERR_NETWORK",w.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",w.ERR_DEPRECATED="ERR_DEPRECATED",w.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",w.ERR_BAD_REQUEST="ERR_BAD_REQUEST",w.ERR_CANCELED="ERR_CANCELED",w.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",w.ERR_INVALID_URL="ERR_INVALID_URL";const ar=null;function we(e){return a.isPlainObject(e)||a.isArray(e)}function Ie(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Be(e,t,r){return e?e.concat(t).map(function(n,o){return n=Ie(n),!r&&o?"["+n+"]":n}).join(r?".":""):t}function cr(e){return a.isArray(e)&&!e.some(we)}const lr=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ae(e,t,r){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,h){return!a.isUndefined(h[g])});const s=r.metaTokens,n=r.visitor||l,o=r.dots,i=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(n))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!p&&a.isBlob(d))throw new w("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?p&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function l(d,g,h){let T=d;if(d&&!h&&typeof d=="object"){if(a.endsWith(g,"{}"))g=s?g:g.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&cr(d)||(a.isFileList(d)||a.endsWith(g,"[]"))&&(T=a.toArray(d)))return g=Ie(g),T.forEach(function(_,y){!(a.isUndefined(_)||_===null)&&t.append(i===!0?Be([g],y,o):i===null?g:g+"[]",u(_))}),!1}return we(d)?!0:(t.append(Be(h,g,o),u(d)),!1)}const m=[],x=Object.assign(lr,{defaultVisitor:l,convertValue:u,isVisitable:we});function N(d,g){if(!a.isUndefined(d)){if(m.indexOf(d)!==-1)throw Error("Circular reference detected in "+g.join("."));m.push(d),a.forEach(d,function(T,S){(!(a.isUndefined(T)||T===null)&&n.call(t,T,a.isString(S)?S.trim():S,g,x))===!0&&N(T,g?g.concat(S):[S])}),m.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return N(e),t}function je(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function be(e,t){this._pairs=[],e&&ae(e,this,t)}const $e=be.prototype;$e.append=function(t,r){this._pairs.push([t,r])},$e.toString=function(t){const r=t?function(s){return t.call(this,s,je)}:je;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};function ur(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Me(e,t,r){if(!t)return e;const s=r&&r.encode||ur,n=a.isFunction(r)?{serialize:r}:r,o=n&&n.serialize;let i;if(o?i=o(t,n):i=a.isURLSearchParams(t)?t.toString():new be(t,n).toString(s),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class He{constructor(){this.handlers=[]}use(t,r,s){return this.handlers.push({fulfilled:t,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(s){s!==null&&t(s)})}}const qe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},dr={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:be,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ye=typeof window<"u"&&typeof document<"u",xe=typeof navigator=="object"&&navigator||void 0,fr=ye&&(!xe||["ReactNative","NativeScript","NS"].indexOf(xe.product)<0),pr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",mr=ye&&window.location.href||"http://localhost",k={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ye,hasStandardBrowserEnv:fr,hasStandardBrowserWebWorkerEnv:pr,navigator:xe,origin:mr},Symbol.toStringTag,{value:"Module"})),...dr};function hr(e,t){return ae(e,new k.classes.URLSearchParams,{visitor:function(r,s,n,o){return k.isNode&&a.isBuffer(r)?(this.append(s,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function gr(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function wr(e){const t={},r=Object.keys(e);let s;const n=r.length;let o;for(s=0;s<n;s++)o=r[s],t[o]=e[o];return t}function ze(e){function t(r,s,n,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),p=o>=r.length;return i=!i&&a.isArray(n)?n.length:i,p?(a.hasOwnProp(n,i)?n[i]=[n[i],s]:n[i]=s,!c):((!n[i]||!a.isObject(n[i]))&&(n[i]=[]),t(r,s,n[i],o)&&a.isArray(n[i])&&(n[i]=wr(n[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const r={};return a.forEachEntry(e,(s,n)=>{t(gr(s),n,r,0)}),r}return null}function br(e,t,r){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(e)}const ee={transitional:qe,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const s=r.getContentType()||"",n=s.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return n?JSON.stringify(ze(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return hr(t,this.formSerializer).toString();if((c=a.isFileList(t))||s.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return ae(c?{"files[]":t}:t,p&&new p,this.formSerializer)}}return o||n?(r.setContentType("application/json",!1),br(t)):t}],transformResponse:[function(t){const r=this.transitional||ee.transitional,s=r&&r.forcedJSONParsing,n=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(s&&!this.responseType||n)){const i=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?w.from(c,w.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:k.classes.FormData,Blob:k.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ee.headers[e]={}});const yr=a.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"]),xr=e=>{const t={};let r,s,n;return e&&e.split(`
2
+ `).forEach(function(i){n=i.indexOf(":"),r=i.substring(0,n).trim().toLowerCase(),s=i.substring(n+1).trim(),!(!r||t[r]&&yr[r])&&(r==="set-cookie"?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)}),t},Je=Symbol("internals");function te(e){return e&&String(e).trim().toLowerCase()}function ce(e){return e===!1||e==null?e:a.isArray(e)?e.map(ce):String(e)}function Er(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(e);)t[s[1]]=s[2];return t}const _r=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ee(e,t,r,s,n){if(a.isFunction(s))return s.call(this,t,r);if(n&&(t=r),!!a.isString(t)){if(a.isString(s))return t.indexOf(s)!==-1;if(a.isRegExp(s))return s.test(t)}}function Sr(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,s)=>r.toUpperCase()+s)}function Or(e,t){const r=a.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+r,{value:function(n,o,i){return this[s].call(this,t,n,o,i)},configurable:!0})})}let F=class{constructor(t){t&&this.set(t)}set(t,r,s){const n=this;function o(c,p,u){const l=te(p);if(!l)throw new Error("header name must be a non-empty string");const m=a.findKey(n,l);(!m||n[m]===void 0||u===!0||u===void 0&&n[m]!==!1)&&(n[m||p]=ce(c))}const i=(c,p)=>a.forEach(c,(u,l)=>o(u,l,p));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,r);else if(a.isString(t)&&(t=t.trim())&&!_r(t))i(xr(t),r);else if(a.isObject(t)&&a.isIterable(t)){let c={},p,u;for(const l of t){if(!a.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(p=c[u])?a.isArray(p)?[...p,l[1]]:[p,l[1]]:l[1]}i(c,r)}else t!=null&&o(r,t,s);return this}get(t,r){if(t=te(t),t){const s=a.findKey(this,t);if(s){const n=this[s];if(!r)return n;if(r===!0)return Er(n);if(a.isFunction(r))return r.call(this,n,s);if(a.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=te(t),t){const s=a.findKey(this,t);return!!(s&&this[s]!==void 0&&(!r||Ee(this,this[s],s,r)))}return!1}delete(t,r){const s=this;let n=!1;function o(i){if(i=te(i),i){const c=a.findKey(s,i);c&&(!r||Ee(s,s[c],c,r))&&(delete s[c],n=!0)}}return a.isArray(t)?t.forEach(o):o(t),n}clear(t){const r=Object.keys(this);let s=r.length,n=!1;for(;s--;){const o=r[s];(!t||Ee(this,this[o],o,t,!0))&&(delete this[o],n=!0)}return n}normalize(t){const r=this,s={};return a.forEach(this,(n,o)=>{const i=a.findKey(s,o);if(i){r[i]=ce(n),delete r[o];return}const c=t?Sr(o):String(o).trim();c!==o&&delete r[o],r[c]=ce(n),s[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return a.forEach(this,(s,n)=>{s!=null&&s!==!1&&(r[n]=t&&a.isArray(s)?s.join(", "):s)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const s=new this(t);return r.forEach(n=>s.set(n)),s}static accessor(t){const s=(this[Je]=this[Je]={accessors:{}}).accessors,n=this.prototype;function o(i){const c=te(i);s[c]||(Or(n,i),s[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};F.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(F.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[r]=s}}}),a.freezeMethods(F);function _e(e,t){const r=this||ee,s=t||r,n=F.from(s.headers);let o=s.data;return a.forEach(e,function(c){o=c.call(r,o,n.normalize(),t?t.status:void 0)}),n.normalize(),o}function We(e){return!!(e&&e.__CANCEL__)}let re=class extends w{constructor(t,r,s){super(t??"canceled",w.ERR_CANCELED,r,s),this.name="CanceledError",this.__CANCEL__=!0}};function Ke(e,t,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?e(r):t(new w("Request failed with status code "+r.status,[w.ERR_BAD_REQUEST,w.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Tr(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Ar(e,t){e=e||10;const r=new Array(e),s=new Array(e);let n=0,o=0,i;return t=t!==void 0?t:1e3,function(p){const u=Date.now(),l=s[o];i||(i=u),r[n]=p,s[n]=u;let m=o,x=0;for(;m!==n;)x+=r[m++],m=m%e;if(n=(n+1)%e,n===o&&(o=(o+1)%e),u-i<t)return;const N=l&&u-l;return N?Math.round(x*1e3/N):void 0}}function Cr(e,t){let r=0,s=1e3/t,n,o;const i=(u,l=Date.now())=>{r=l,n=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const l=Date.now(),m=l-r;m>=s?i(u,l):(n=u,o||(o=setTimeout(()=>{o=null,i(n)},s-m)))},()=>n&&i(n)]}const le=(e,t,r=3)=>{let s=0;const n=Ar(50,250);return Cr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-s,u=n(p),l=i<=c;s=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:u||void 0,estimated:u&&c&&l?(c-i)/u:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(m)},r)},Ve=(e,t)=>{const r=e!=null;return[s=>t[0]({lengthComputable:r,total:e,loaded:s}),t[1]]},Xe=e=>(...t)=>a.asap(()=>e(...t)),Rr=k.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,k.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(k.origin),k.navigator&&/(msie|trident)/i.test(k.navigator.userAgent)):()=>!0,Nr=k.hasStandardBrowserEnv?{write(e,t,r,s,n,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(s)&&c.push(`path=${s}`),a.isString(n)&&c.push(`domain=${n}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")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(){return null},remove(){}};function vr(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function kr(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ye(e,t,r){let s=!vr(t);return e&&(s||r==!1)?kr(e,t):t}const Ge=e=>e instanceof F?{...e}:e;function W(e,t){t=t||{};const r={};function s(u,l,m,x){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:x},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function n(u,l,m,x){if(a.isUndefined(l)){if(!a.isUndefined(u))return s(void 0,u,m,x)}else return s(u,l,m,x)}function o(u,l){if(!a.isUndefined(l))return s(void 0,l)}function i(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return s(void 0,u)}else return s(void 0,l)}function c(u,l,m){if(m in t)return s(u,l);if(m in e)return s(void 0,u)}const p={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:c,headers:(u,l,m)=>n(Ge(u),Ge(l),m,!0)};return a.forEach(Object.keys({...e,...t}),function(l){const m=p[l]||n,x=m(e[l],t[l],l);a.isUndefined(x)&&m!==c||(r[l]=x)}),r}const Qe=e=>{const t=W({},e);let{data:r,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:o,headers:i,auth:c}=t;if(t.headers=i=F.from(i),t.url=Me(Ye(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(k.hasStandardBrowserEnv||k.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const p=r.getHeaders(),u=["content-type","content-length"];Object.entries(p).forEach(([l,m])=>{u.includes(l.toLowerCase())&&i.set(l,m)})}}if(k.hasStandardBrowserEnv&&(s&&a.isFunction(s)&&(s=s(t)),s||s!==!1&&Rr(t.url))){const p=n&&o&&Nr.read(o);p&&i.set(n,p)}return t},Pr=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(r,s){const n=Qe(e);let o=n.data;const i=F.from(n.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:u}=n,l,m,x,N,d;function g(){N&&N(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout;function T(){if(!h)return;const _=F.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),C={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:_,config:e,request:h};Ke(function(P){r(P),g()},function(P){s(P),g()},C),h=null}"onloadend"in h?h.onloadend=T:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(T)},h.onabort=function(){h&&(s(new w("Request aborted",w.ECONNABORTED,e,h)),h=null)},h.onerror=function(y){const C=y&&y.message?y.message:"Network Error",L=new w(C,w.ERR_NETWORK,e,h);L.event=y||null,s(L),h=null},h.ontimeout=function(){let y=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const C=n.transitional||qe;n.timeoutErrorMessage&&(y=n.timeoutErrorMessage),s(new w(y,C.clarifyTimeoutError?w.ETIMEDOUT:w.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(y,C){h.setRequestHeader(C,y)}),a.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),c&&c!=="json"&&(h.responseType=n.responseType),u&&([x,d]=le(u,!0),h.addEventListener("progress",x)),p&&h.upload&&([m,N]=le(p),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",N)),(n.cancelToken||n.signal)&&(l=_=>{h&&(s(!_||_.type?new re(null,e,h):_),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const S=Tr(n.url);if(S&&k.protocols.indexOf(S)===-1){s(new w("Unsupported protocol "+S+":",w.ERR_BAD_REQUEST,e));return}h.send(o||null)})},Dr=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let s=new AbortController,n;const o=function(u){if(!n){n=!0,c();const l=u instanceof Error?u:this.reason;s.abort(l instanceof w?l:new re(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new w(`timeout of ${t}ms exceeded`,w.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:p}=s;return p.unsubscribe=()=>a.asap(c),p}},Ur=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let s=0,n;for(;s<r;)n=s+t,yield e.slice(s,n),s=n},Fr=async function*(e,t){for await(const r of Lr(e))yield*Ur(r,t)},Lr=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:s}=await t.read();if(r)break;yield s}}finally{await t.cancel()}},Ze=(e,t,r,s)=>{const n=Fr(e,t);let o=0,i,c=p=>{i||(i=!0,s&&s(p))};return new ReadableStream({async pull(p){try{const{done:u,value:l}=await n.next();if(u){c(),p.close();return}let m=l.byteLength;if(r){let x=o+=m;r(x)}p.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(p){return c(p),n.return()}},{highWaterMark:2})},et=64*1024,{isFunction:ue}=a,Ir=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:tt,TextEncoder:rt}=a.global,st=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Br=e=>{e=a.merge.call({skipUndefined:!0},Ir,e);const{fetch:t,Request:r,Response:s}=e,n=t?ue(t):typeof fetch=="function",o=ue(r),i=ue(s);if(!n)return!1;const c=n&&ue(tt),p=n&&(typeof rt=="function"?(d=>g=>d.encode(g))(new rt):async d=>new Uint8Array(await new r(d).arrayBuffer())),u=o&&c&&st(()=>{let d=!1;const g=new r(k.origin,{body:new tt,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!g}),l=i&&c&&st(()=>a.isReadableStream(new s("").body)),m={stream:l&&(d=>d.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!m[d]&&(m[d]=(g,h)=>{let T=g&&g[d];if(T)return T.call(g);throw new w(`Response type '${d}' is not supported`,w.ERR_NOT_SUPPORT,h)})});const x=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new r(k.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await p(d)).byteLength},N=async(d,g)=>{const h=a.toFiniteNumber(d.getContentLength());return h??x(g)};return async d=>{let{url:g,method:h,data:T,signal:S,cancelToken:_,timeout:y,onDownloadProgress:C,onUploadProgress:L,responseType:P,headers:b,withCredentials:O="same-origin",fetchOptions:D}=Qe(d),v=t||fetch;P=P?(P+"").toLowerCase():"text";let B=Dr([S,_&&_.toAbortSignal()],y),E=null;const H=B&&B.unsubscribe&&(()=>{B.unsubscribe()});let pe;try{if(L&&u&&h!=="get"&&h!=="head"&&(pe=await N(b,T))!==0){let z=new r(g,{method:"POST",body:T,duplex:"half"}),Y;if(a.isFormData(T)&&(Y=z.headers.get("content-type"))&&b.setContentType(Y),z.body){const[Ce,me]=Ve(pe,le(Xe(L)));T=Ze(z.body,et,Ce,me)}}a.isString(O)||(O=O?"include":"omit");const j=o&&"credentials"in r.prototype,wt={...D,signal:B,method:h.toUpperCase(),headers:b.normalize().toJSON(),body:T,duplex:"half",credentials:j?O:void 0};E=o&&new r(g,wt);let q=await(o?v(E,D):v(g,wt));const bt=l&&(P==="stream"||P==="response");if(l&&(C||bt&&H)){const z={};["status","statusText","headers"].forEach(yt=>{z[yt]=q[yt]});const Y=a.toFiniteNumber(q.headers.get("content-length")),[Ce,me]=C&&Ve(Y,le(Xe(C),!0))||[];q=new s(Ze(q.body,et,Ce,()=>{me&&me(),H&&H()}),z)}P=P||"text";let Gr=await m[a.findKey(m,P)||"text"](q,d);return!bt&&H&&H(),await new Promise((z,Y)=>{Ke(z,Y,{data:Gr,headers:F.from(q.headers),status:q.status,statusText:q.statusText,config:d,request:E})})}catch(j){throw H&&H(),j&&j.name==="TypeError"&&/Load failed|fetch/i.test(j.message)?Object.assign(new w("Network Error",w.ERR_NETWORK,d,E),{cause:j.cause||j}):w.from(j,j&&j.code,d,E)}}},jr=new Map,nt=e=>{let t=e&&e.env||{};const{fetch:r,Request:s,Response:n}=t,o=[s,n,r];let i=o.length,c=i,p,u,l=jr;for(;c--;)p=o[c],u=l.get(p),u===void 0&&l.set(p,u=c?new Map:Br(t)),l=u;return u};nt();const Se={http:ar,xhr:Pr,fetch:{get:nt}};a.forEach(Se,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ot=e=>`- ${e}`,$r=e=>a.isFunction(e)||e===null||e===!1;function Mr(e,t){e=a.isArray(e)?e:[e];const{length:r}=e;let s,n;const o={};for(let i=0;i<r;i++){s=e[i];let c;if(n=s,!$r(s)&&(n=Se[(c=String(s)).toLowerCase()],n===void 0))throw new w(`Unknown adapter '${c}'`);if(n&&(a.isFunction(n)||(n=n.get(t))))break;o[c||"#"+i]=n}if(!n){const i=Object.entries(o).map(([p,u])=>`adapter ${p} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
4
+ `+i.map(ot).join(`
5
+ `):" "+ot(i[0]):"as no adapter specified";throw new w("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return n}const it={getAdapter:Mr,adapters:Se};function Oe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new re(null,e)}function at(e){return Oe(e),e.headers=F.from(e.headers),e.data=_e.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),it.getAdapter(e.adapter||ee.adapter,e)(e).then(function(s){return Oe(e),s.data=_e.call(e,e.transformResponse,s),s.headers=F.from(s.headers),s},function(s){return We(s)||(Oe(e),s&&s.response&&(s.response.data=_e.call(e,e.transformResponse,s.response),s.response.headers=F.from(s.response.headers))),Promise.reject(s)})}const ct="1.13.4",de={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{de[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const lt={};de.transitional=function(t,r,s){function n(o,i){return"[Axios v"+ct+"] Transitional option '"+o+"'"+i+(s?". "+s:"")}return(o,i,c)=>{if(t===!1)throw new w(n(i," has been removed"+(r?" in "+r:"")),w.ERR_DEPRECATED);return r&&!lt[i]&&(lt[i]=!0,console.warn(n(i," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,i,c):!0}},de.spelling=function(t){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function Hr(e,t,r){if(typeof e!="object")throw new w("options must be an object",w.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let n=s.length;for(;n-- >0;){const o=s[n],i=t[o];if(i){const c=e[o],p=c===void 0||i(c,o,e);if(p!==!0)throw new w("option "+o+" must be "+p,w.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new w("Unknown option "+o,w.ERR_BAD_OPTION)}}const fe={assertOptions:Hr,validators:de},M=fe.validators;let K=class{constructor(t){this.defaults=t||{},this.interceptors={request:new He,response:new He}}async request(t,r){try{return await this._request(t,r)}catch(s){if(s instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const o=n.stack?n.stack.replace(/^.+\n/,""):"";try{s.stack?o&&!String(s.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(s.stack+=`
6
+ `+o):s.stack=o}catch{}}throw s}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=W(this.defaults,r);const{transitional:s,paramsSerializer:n,headers:o}=r;s!==void 0&&fe.assertOptions(s,{silentJSONParsing:M.transitional(M.boolean),forcedJSONParsing:M.transitional(M.boolean),clarifyTimeoutError:M.transitional(M.boolean)},!1),n!=null&&(a.isFunction(n)?r.paramsSerializer={serialize:n}:fe.assertOptions(n,{encode:M.function,serialize:M.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),fe.assertOptions(r,{baseUrl:M.spelling("baseURL"),withXsrfToken:M.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete o[d]}),r.headers=F.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(p=p&&g.synchronous,c.unshift(g.fulfilled,g.rejected))});const u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let l,m=0,x;if(!p){const d=[at.bind(this),void 0];for(d.unshift(...c),d.push(...u),x=d.length,l=Promise.resolve(r);m<x;)l=l.then(d[m++],d[m++]);return l}x=c.length;let N=r;for(;m<x;){const d=c[m++],g=c[m++];try{N=d(N)}catch(h){g.call(this,h);break}}try{l=at.call(this,N)}catch(d){return Promise.reject(d)}for(m=0,x=u.length;m<x;)l=l.then(u[m++],u[m++]);return l}getUri(t){t=W(this.defaults,t);const r=Ye(t.baseURL,t.url,t.allowAbsoluteUrls);return Me(r,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){K.prototype[t]=function(r,s){return this.request(W(s||{},{method:t,url:r,data:(s||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function r(s){return function(o,i,c){return this.request(W(c||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}K.prototype[t]=r(),K.prototype[t+"Form"]=r(!0)});let qr=class _t{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const s=this;this.promise.then(n=>{if(!s._listeners)return;let o=s._listeners.length;for(;o-- >0;)s._listeners[o](n);s._listeners=null}),this.promise.then=n=>{let o;const i=new Promise(c=>{s.subscribe(c),o=c}).then(n);return i.cancel=function(){s.unsubscribe(o)},i},t(function(o,i,c){s.reason||(s.reason=new re(o,i,c),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const t=new AbortController,r=s=>{t.abort(s)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new _t(function(n){t=n}),cancel:t}}};function zr(e){return function(r){return e.apply(null,r)}}function Jr(e){return a.isObject(e)&&e.isAxiosError===!0}const Te={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(Te).forEach(([e,t])=>{Te[t]=e});function ut(e){const t=new K(e),r=Re(K.prototype.request,t);return a.extend(r,K.prototype,t,{allOwnKeys:!0}),a.extend(r,t,null,{allOwnKeys:!0}),r.create=function(n){return ut(W(e,n))},r}const A=ut(ee);A.Axios=K,A.CanceledError=re,A.CancelToken=qr,A.isCancel=We,A.VERSION=ct,A.toFormData=ae,A.AxiosError=w,A.Cancel=A.CanceledError,A.all=function(t){return Promise.all(t)},A.spread=zr,A.isAxiosError=Jr,A.mergeConfig=W,A.AxiosHeaders=F,A.formToJSON=e=>ze(a.isHTMLForm(e)?new FormData(e):e),A.getAdapter=it.getAdapter,A.HttpStatusCode=Te,A.default=A;const{Axios:is,AxiosError:as,CanceledError:cs,isCancel:ls,CancelToken:us,VERSION:ds,all:fs,Cancel:ps,isAxiosError:ms,spread:hs,toFormData:gs,AxiosHeaders:ws,HttpStatusCode:bs,formToJSON:ys,getAdapter:xs,mergeConfig:Es}=A,Wr="https://customers-services.tarxemo.com/api";class dt{constructor(t,r=Wr){xt(this,"client");this.client=A.create({baseURL:r,headers:{"Content-Type":"application/json","X-API-Key":t},timeout:3e4}),this.client.interceptors.response.use(s=>s,s=>{var n,o;if((n=s.response)!=null&&n.data){const c=((o=s.response.data.response)==null?void 0:o.message)||"An unknown error occurred";throw new Error(c)}else throw s.request?new Error("No response from server. Please check your connection."):new Error(s.message||"Request failed")})}async sendMessage(t,r){try{const s=await this.client.post("/chat/",{question:t,session_id:r});if(s.data.response.status!=="success")throw new Error(s.data.response.message);return s.data.data}catch(s){throw s instanceof Error?s:new Error("Failed to send message")}}async getConversationHistory(t){try{const r=await this.client.get(`/chat/history/${t}/`);if(r.data.response.status!=="success")throw new Error(r.data.response.message);return r.data.data}catch(r){throw r instanceof Error?r:new Error("Failed to load conversation history")}}updateApiKey(t){this.client.defaults.headers.common["X-API-Key"]=t}updateBaseUrl(t){this.client.defaults.baseURL=t}}function Ae(e,t){const[r,s]=f.useState(()=>{try{const n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return console.warn(`Error reading localStorage key "${e}":`,n),t}});return f.useEffect(()=>{try{window.localStorage.setItem(e,JSON.stringify(r))}catch(n){console.warn(`Error setting localStorage key "${e}":`,n)}},[e,r]),[r,s]}function ft(){return`session_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}const Kr="customer_support_session_id",Vr="customer_support_messages";function pt(e){const{apiKey:t,baseUrl:r,onError:s}=e,[n,o]=Ae(Vr,[]),[i,c]=Ae(Kr,ft()),[p,u]=f.useState(!1),[l,m]=f.useState(null),x=f.useRef(null);f.useEffect(()=>{x.current=new dt(t,r)},[t,r]);const N=f.useCallback(()=>{m(null)},[]),d=f.useCallback(async S=>{if(!x.current){const y=new Error("API client not initialized");m(y),s==null||s(y);return}if(!S.trim())return;const _={id:`user_${Date.now()}`,role:"USER",content:S,timestamp:new Date};o(y=>[...y,_]),u(!0),m(null);try{const y=await x.current.sendMessage(S,i),C={id:`assistant_${Date.now()}`,role:"ASSISTANT",content:y.answer,timestamp:new Date,sources:y.sources};o(L=>[...L,C]),y.session_id!==i&&c(y.session_id)}catch(y){const C=y instanceof Error?y:new Error("Failed to send message");m(C),s==null||s(C);const L={id:`error_${Date.now()}`,role:"ASSISTANT",content:`Sorry, I encountered an error: ${C.message}`,timestamp:new Date};o(P=>[...P,L])}finally{u(!1)}},[i,s,o,c]),g=f.useCallback(async()=>{if(!(!x.current||!i)){u(!0),m(null);try{const _=(await x.current.getConversationHistory(i)).messages.map((y,C)=>({id:`${y.role.toLowerCase()}_${C}_${Date.now()}`,role:y.role.toUpperCase(),content:y.content,timestamp:new Date(y.created_at)}));o(_)}catch(S){const _=S instanceof Error?S:new Error("Failed to load history");m(_),s==null||s(_)}finally{u(!1)}}},[i,s,o]),h=f.useCallback(()=>{o([]),c(ft())},[o,c]),T=f.useCallback(S=>{o(_=>_.filter(y=>y.id!==S))},[o]);return{messages:n,sendMessage:d,isLoading:p,error:l,clearError:N,sessionId:i,loadHistory:g,clearHistory:h,deleteMessage:T}}const mt=({message:e,onDelete:t})=>{const r=e.role.toUpperCase()==="USER",s=e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp);return f.createElement("div",{className:`cs-message ${r?"cs-message--user":"cs-message--assistant"}`},f.createElement("div",{className:"cs-message__content"},f.createElement("p",{className:"cs-message__text"},e.content),e.sources&&e.sources.length>0&&f.createElement("div",{className:"cs-message__sources"},f.createElement("p",{className:"cs-message__sources-title"},"Sources:"),f.createElement("ul",{className:"cs-message__sources-list"},e.sources.map((n,o)=>f.createElement("li",{key:o,className:"cs-message__source-item"},f.createElement("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:"cs-message__source-link"},f.createElement(I.ExternalLink,{size:12}),f.createElement("span",null,n.title)),f.createElement("span",{className:"cs-message__source-similarity"},Math.round(n.similarity*100),"% match"))))),t&&f.createElement("button",{className:"cs-message__delete",onClick:()=>{window.confirm("Delete this message?")&&t(e.id)},"aria-label":"Delete message"},f.createElement(I.Trash2,{size:14}))),f.createElement("time",{className:"cs-message__time",dateTime:s.toISOString()},s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})))},ht=({onSendMessage:e,isLoading:t,placeholder:r="Type your message..."})=>{const[s,n]=f.useState(""),o=c=>{c.preventDefault(),s.trim()&&!t&&(e(s),n(""))},i=c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),o(c))};return f.createElement("form",{className:"cs-input",onSubmit:o},f.createElement("textarea",{className:"cs-input__textarea",value:s,onChange:c=>n(c.target.value),onKeyDown:i,placeholder:r,disabled:t,rows:1,"aria-label":"Message input"}),f.createElement("button",{type:"submit",className:"cs-input__button",disabled:!s.trim()||t,"aria-label":"Send message"},f.createElement(I.Send,{size:20})))},gt=({messages:e,onSendMessage:t,onClose:r,isLoading:s,error:n,placeholder:o,welcomeMessage:i="Hi! How can I help you today?",onDeleteMessage:c,onClearHistory:p})=>{const u=f.useRef(null);return f.useEffect(()=>{var l;(l=u.current)==null||l.scrollIntoView({behavior:"smooth"})},[e]),f.createElement("div",{className:"cs-window"},f.createElement("div",{className:"cs-window__header"},f.createElement("div",{className:"cs-window__header-info"},f.createElement("h3",{className:"cs-window__title"},"Customer Support"),f.createElement("div",{className:"cs-window__status"},f.createElement("span",{className:"cs-window__status-dot"}),f.createElement("span",null,"Online"))),f.createElement("div",{style:{display:"flex",gap:"8px"}},e.length>0&&p&&f.createElement("button",{className:"cs-window__close",onClick:()=>{window.confirm("Are you sure you want to clear the entire chat history?")&&p()},"aria-label":"Clear chat history",title:"Clear chat history"},f.createElement(I.Trash2,{size:18})),f.createElement("button",{className:"cs-window__close",onClick:r,"aria-label":"Close chat"},f.createElement(I.X,{size:20})))),f.createElement("div",{className:"cs-window__messages"},e.length===0&&!s&&f.createElement("div",{className:"cs-window__welcome"},f.createElement("p",null,i)),e.map(l=>f.createElement(mt,{key:l.id,message:l,onDelete:c})),s&&f.createElement("div",{className:"cs-window__typing"},f.createElement(I.Loader2,{size:20,className:"cs-window__typing-icon"}),f.createElement("span",null,"Thinking...")),n&&f.createElement("div",{className:"cs-window__error"},f.createElement("p",null,n.message)),f.createElement("div",{ref:u})),f.createElement("div",{className:"cs-window__input-wrapper"},f.createElement(ht,{onSendMessage:t,isLoading:s,placeholder:o})))},Xr=':root{--cs-primary-color: inherit;--cs-secondary-color: inherit;--cs-bg-color: inherit;--cs-text-color: inherit;--cs-font-family: inherit;--cs-border-radius: 12px;--cs-button-color: var(--cs-primary-color);--cs-user-message-color: var(--cs-primary-color);--cs-assistant-message-color: rgba(0, 0, 0, .05);--cs-header-gradient: linear-gradient(135deg, var(--cs-primary-color), var(--cs-secondary-color));--cs-header-text-color: #ffffff;--cs-bg-text-color: #1a1a1a;--cs-user-text-color: #ffffff;--cs-assistant-text-color: #1a1a1a;--cs-success-color: #4ade80;--cs-error-color: #ef4444;--cs-error-bg-color: rgba(239, 68, 68, .1);--cs-border-color: rgba(0, 0, 0, .1);--cs-shadow-color: rgba(0, 0, 0, .1);--cs-scrollbar-thumb: rgba(0, 0, 0, .2);--cs-scrollbar-track: transparent;--cs-shadow-sm: 0 1px 2px 0 var(--cs-shadow-color);--cs-shadow: 0 4px 6px -1px var(--cs-shadow-color), 0 2px 4px -1px var(--cs-shadow-color);--cs-shadow-lg: 0 10px 15px -3px var(--cs-shadow-color), 0 4px 6px -2px var(--cs-shadow-color);--cs-shadow-xl: 0 20px 25px -5px var(--cs-shadow-color), 0 10px 10px -5px var(--cs-shadow-color)}.cs-widget{position:fixed;z-index:9999;font-family:var(--cs-font-family)}.cs-widget,.cs-widget *{box-sizing:border-box}.cs-widget--bottom-right{bottom:20px;right:20px}.cs-widget--bottom-left{bottom:20px;left:20px}.cs-widget--top-right{top:20px;right:20px}.cs-widget--top-left{top:20px;left:20px}.cs-widget__toggle{position:relative;width:60px;height:60px;border-radius:50%;background:var(--cs-primary-color);border:none;color:#fff;cursor:pointer;box-shadow:var(--cs-shadow-xl);transition:all .3s cubic-bezier(.4,0,.2,1);display:flex;align-items:center;justify-content:center}.cs-widget__toggle:hover{transform:scale(1.1);box-shadow:0 15px 25px -5px var(--cs-focus-ring)}.cs-widget__toggle:active{transform:scale(.95)}.cs-widget__toggle--open{background:var(--cs-error-color)}.cs-widget__badge{position:absolute;top:-5px;right:-5px;background:var(--cs-error-color);color:#fff;border-radius:50%;width:24px;height:24px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;box-shadow:var(--cs-shadow)}.cs-window{position:absolute;bottom:85px;right:0;width:380px;max-width:calc(100vw - 40px);height:600px;max-height:calc(100vh - 130px);background:var(--cs-bg-color);border-radius:var(--cs-border-radius);border:1px solid rgba(0,0,0,.1);box-shadow:var(--cs-shadow-xl);display:flex;flex-direction:column;overflow:visible;animation:slideUp .3s cubic-bezier(.4,0,.2,1);transform-origin:bottom right}.cs-window:after{content:"";position:absolute;bottom:-10px;right:25px;width:0;height:0;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid var(--cs-bg-color);filter:drop-shadow(0 5px 5px var(--cs-shadow-color))}.cs-widget--bottom-left .cs-window{transform-origin:bottom left;right:auto;left:0}.cs-widget--bottom-left .cs-window:after{right:auto;left:25px}.cs-widget--top-right .cs-window{transform-origin:top right;bottom:auto;top:85px}.cs-widget--top-right .cs-window:after{bottom:auto;top:-10px;border-top:none;border-bottom:10px solid var(--cs-bg-color)}.cs-widget--top-left .cs-window{transform-origin:top left;bottom:auto;top:85px;right:auto;left:0}.cs-widget--top-left .cs-window:after{bottom:auto;top:-10px;border-top:none;border-bottom:10px solid var(--cs-bg-color);right:auto;left:25px}@keyframes slideUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.cs-window__header{background:var(--cs-header-gradient);color:var(--cs-header-text-color);padding:16px 20px;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}.cs-window__header-info{display:flex;flex-direction:column;gap:2px}.cs-window__title{margin:0;font-size:16px;font-weight:600}.cs-window__status{display:flex;align-items:center;gap:6px;font-size:12px;opacity:.9}.cs-window__status-dot{width:8px;height:8px;background:var(--cs-success-color);border-radius:50%;box-shadow:0 0 0 2px var(--cs-bg-color)}.cs-window__close{background:transparent;border:none;color:var(--cs-header-text-color);width:32px;height:32px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s}.cs-window__close:hover{background:var(--cs-shadow-color)}.cs-window__messages{flex:1;overflow-y:auto;overflow-x:hidden;padding:20px;display:flex;flex-direction:column;gap:16px;background:var(--cs-bg-color);color:var(--cs-bg-text-color)}.cs-window__messages::-webkit-scrollbar{width:6px}.cs-window__messages::-webkit-scrollbar-track{background:transparent}.cs-window__messages::-webkit-scrollbar-thumb{background:var(--cs-scrollbar-thumb);border-radius:3px}.cs-window__messages::-webkit-scrollbar-thumb:hover{background:var(--cs-border-color)}.cs-window__welcome{text-align:center;padding:40px 20px;color:var(--cs-bg-text-color);opacity:.7}.cs-window__welcome p{margin:0;font-size:16px}.cs-window__typing{display:flex;align-items:center;gap:8px;padding:12px 16px;background:var(--cs-assistant-message-color);border-radius:var(--cs-border-radius);width:fit-content;color:var(--cs-text-color)}.cs-window__typing-icon{animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.cs-window__error{background:var(--cs-error-bg-color);border:1px solid var(--cs-error-color);color:var(--cs-error-color);padding:12px 16px;border-radius:var(--cs-border-radius)}.cs-window__error p{margin:0}.cs-message{display:flex;flex-direction:column;gap:6px;max-width:85%;min-width:0;animation:fadeIn .3s ease-in-out;position:relative;group:"message"}.cs-message:hover .cs-message__delete{opacity:1}@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.cs-message--user{align-self:flex-end;align-items:flex-end}.cs-message--assistant{align-self:flex-start;align-items:flex-start}.cs-message__content{background:var(--cs-assistant-message-color);padding:12px 16px;border-radius:var(--cs-border-radius);border-bottom-left-radius:4px;color:var(--cs-assistant-text-color);word-wrap:break-word;box-shadow:var(--cs-shadow-sm);min-width:0;max-width:100%}.cs-message--user .cs-message__content{background:var(--cs-user-message-color);color:var(--cs-user-text-color);border-radius:var(--cs-border-radius);border-bottom-right-radius:4px}.cs-message__text{margin:0;line-height:1.5;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere}.cs-message__time{font-size:11px;color:var(--cs-bg-text-color);opacity:.5;padding:0 4px}.cs-message__sources{margin-top:12px;padding-top:12px;border-top:1px solid var(--cs-border-color)}.cs-message__sources-title{margin:0 0 8px;font-size:12px;font-weight:600;color:var(--cs-bg-text-color);opacity:.7}.cs-message__sources-list{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:6px}.cs-message__source-item{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px}.cs-message__source-link{display:flex;align-items:center;gap:4px;color:var(--cs-primary-color);text-decoration:none;flex:1;min-width:0}.cs-message__source-link:hover{text-decoration:underline}.cs-message__source-link span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.cs-message__source-similarity{color:#6b7280;font-size:11px;white-space:nowrap}.cs-message__delete{position:absolute;top:50%;transform:translateY(-50%);background:var(--cs-bg-color);border:1px solid var(--cs-border-color);color:var(--cs-error-color);width:24px;height:24px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;opacity:0;transition:all .2s;box-shadow:var(--cs-shadow-sm);z-index:10}.cs-message__delete:hover{background:var(--cs-error-color);color:#fff;transform:translateY(-50%) scale(1.1)}.cs-message--user .cs-message__delete{left:-32px}.cs-message--assistant .cs-message__delete{right:-32px}.cs-window__input-wrapper{padding:16px;background:var(--cs-bg-color);border-top:1px solid var(--cs-border-color);flex-shrink:0}.cs-input{display:flex;gap:8px;align-items:flex-end}.cs-input__textarea{flex:1;padding:12px 16px;border:1px solid var(--cs-border-color);border-radius:var(--cs-border-radius);font-family:var(--cs-font-family);font-size:14px;resize:none;max-height:120px;min-height:44px;transition:border-color .2s;background:var(--cs-bg-color);color:var(--cs-bg-text-color)}.cs-input__textarea:focus{outline:none;border-color:var(--cs-primary-color);box-shadow:0 0 0 3px var(--cs-focus-ring);background-color:var(--cs-bg-color)}.cs-input__textarea:disabled{background:var(--cs-border-color);cursor:not-allowed;opacity:.5}.cs-input__button{background:var(--cs-button-color);color:var(--cs-header-text-color);border:none;width:44px;height:44px;border-radius:var(--cs-border-radius);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;flex-shrink:0}.cs-input__button:hover:not(:disabled){background:var(--cs-secondary-color);transform:scale(1.05)}.cs-input__button:active:not(:disabled){transform:scale(.95)}.cs-input__button:disabled{background:var(--cs-border-color);cursor:not-allowed;opacity:.5}@media(max-width:480px){.cs-widget--open{position:fixed!important;inset:auto!important;bottom:20px!important;right:20px!important;width:auto!important;height:auto!important;z-index:10000!important}.cs-window{position:fixed!important;width:88vw!important;height:60vh!important;max-width:400px!important;max-height:500px!important;bottom:90px!important;right:5%!important;left:5%!important;top:auto!important;border-radius:var(--cs-border-radius)!important;box-shadow:var(--cs-shadow-xl)!important;display:flex!important;flex-direction:column!important;animation:slideUp .3s ease-out!important;overflow:visible!important}.cs-widget--open .cs-widget__toggle{display:flex!important;opacity:.8}.cs-window__messages{padding:16px}.cs-window__header{padding:12px 16px}.cs-window__input-wrapper{padding:12px}.cs-widget__toggle{width:50px;height:50px}}',Yr=({apiKey:e,baseUrl:t,theme:r,position:s="bottom-right",welcomeMessage:n,placeholder:o,className:i="",onError:c,onMessageSent:p,onMessageReceived:u})=>{const[l,m]=f.useState(!1),{messages:x,sendMessage:N,isLoading:d,error:g,clearError:h,deleteMessage:T,clearHistory:S}=pt({apiKey:e,baseUrl:t,onError:c}),_=b=>{if(!b)return"#ffffff";let O,D,v;if(b.startsWith("#")){const E=b.slice(1);O=parseInt(E.substring(0,2),16),D=parseInt(E.substring(2,4),16),v=parseInt(E.substring(4,6),16)}else if(b.startsWith("rgb")){const E=b.match(/\d+/g);if(E&&E.length>=3)O=parseInt(E[0]),D=parseInt(E[1]),v=parseInt(E[2]);else return"#ffffff"}else return"#ffffff";return(.299*O+.587*D+.114*v)/255>.6?"#1a1a1a":"#ffffff"},y=(b,O)=>{if(!b)return`rgba(0, 0, 0, ${O})`;let D=0,v=0,B=0;if(b.startsWith("#")){const E=b.slice(1);E.length===3?(D=parseInt(E[0]+E[0],16),v=parseInt(E[1]+E[1],16),B=parseInt(E[2]+E[2],16)):(D=parseInt(E.substring(0,2),16),v=parseInt(E.substring(2,4),16),B=parseInt(E.substring(4,6),16))}else if(b.startsWith("rgb")){const E=b.match(/\d+/g);E&&E.length>=3&&(D=parseInt(E[0]),v=parseInt(E[1]),B=parseInt(E[2]))}return`rgba(${D}, ${v}, ${B}, ${O})`},C=f.useMemo(()=>{const b={},O=(r==null?void 0:r.primaryColor)||"#6366f1",D=(r==null?void 0:r.backgroundColor)||"#ffffff",v=(r==null?void 0:r.textColor)||(_(D)==="#ffffff"?"#ffffff":"#1f2937"),B=(r==null?void 0:r.successColor)||"#4ade80",E=(r==null?void 0:r.errorColor)||"#ef4444",H=(r==null?void 0:r.borderColor)||y(v,.1),pe=(r==null?void 0:r.shadowColor)||"rgba(0, 0, 0, 0.1)";b["--cs-primary-color"]=O,b["--cs-secondary-color"]=(r==null?void 0:r.secondaryColor)||O,b["--cs-bg-color"]=D,b["--cs-text-color"]=v,b["--cs-font-family"]=(r==null?void 0:r.fontFamily)||"inherit",b["--cs-border-radius"]=(r==null?void 0:r.borderRadius)||"12px",b["--cs-success-color"]=B,b["--cs-error-color"]=E,b["--cs-error-bg-color"]=y(E,.1),b["--cs-border-color"]=H,b["--cs-shadow-color"]=pe,b["--cs-scrollbar-thumb"]=y(v,.2),b["--cs-scrollbar-track"]="transparent",b["--cs-header-text-color"]=_(O),b["--cs-bg-text-color"]=v,b["--cs-button-color"]=(r==null?void 0:r.buttonColor)||O,b["--cs-user-message-color"]=(r==null?void 0:r.userMessageColor)||O,b["--cs-user-text-color"]=_((r==null?void 0:r.userMessageColor)||O);const j=_(D)==="#ffffff";return b["--cs-assistant-message-color"]=(r==null?void 0:r.assistantMessageColor)||(j?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)"),b["--cs-assistant-text-color"]=v,b["--cs-focus-ring"]=y(O,.2),b},[r]),L=async b=>{if(p==null||p(b),await N(b),!g){const O=x[x.length-1];(O==null?void 0:O.role)==="ASSISTANT"&&(u==null||u(O.content))}},P=()=>{m(!l),g&&h()};return f.createElement("div",{className:`cs-widget cs-widget--${s} ${l?"cs-widget--open":""} ${i}`,style:C},f.createElement("style",{dangerouslySetInnerHTML:{__html:Xr}}),l&&f.createElement(gt,{messages:x,onSendMessage:L,onClose:()=>m(!1),isLoading:d,error:g,placeholder:o,welcomeMessage:n,onDeleteMessage:T,onClearHistory:S}),f.createElement("button",{className:`cs-widget__toggle ${l?"cs-widget__toggle--open":""}`,onClick:P,"aria-label":l?"Close chat":"Open chat","aria-expanded":l},f.createElement(I.MessageCircle,{size:24}),!l&&x.length>0&&f.createElement("span",{className:"cs-widget__badge"},x.filter(b=>b.role.toUpperCase()==="ASSISTANT").length)))};R.ChatInput=ht,R.ChatMessage=mt,R.ChatWindow=gt,R.CustomerSupportAPIClient=dt,R.CustomerSupportWidget=Yr,R.useCustomerSupport=pt,R.useLocalStorage=Ae,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
7
7
  //# sourceMappingURL=index.umd.js.map