@tarxemo/customer_support 1.0.7 → 1.0.10
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(T,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):(T=typeof globalThis<"u"?globalThis:T||self,p(T.CustomerSupport={},T.React,T.lucideReact))})(this,(function(T,p,F){"use strict";var Yn=Object.defineProperty;var Zn=(T,p,F)=>p in T?Yn(T,p,{enumerable:!0,configurable:!0,writable:!0,value:F}):T[p]=F;var gt=(T,p,F)=>Zn(T,typeof p!="symbol"?p+"":p,F);function Ae(e,t){return function(){return e.apply(t,arguments)}}const{toString:_t}=Object.prototype,{getPrototypeOf:fe}=Object,{iterator:Y,toStringTag:Re}=Symbol,Z=(e=>t=>{const n=_t.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),D=e=>(e=e.toLowerCase(),t=>Z(t)===e),ee=e=>t=>typeof t===e,{isArray:H}=Array,z=ee("undefined");function J(e){return e!==null&&!z(e)&&e.constructor!==null&&!z(e.constructor)&&N(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ce=D("ArrayBuffer");function Tt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ce(e.buffer),t}const At=ee("string"),N=ee("function"),Ne=ee("number"),V=e=>e!==null&&typeof e=="object",Rt=e=>e===!0||e===!1,te=e=>{if(Z(e)!=="object")return!1;const t=fe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Re in e)&&!(Y in e)},Ct=e=>{if(!V(e)||J(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Nt=D("Date"),Pt=D("File"),xt=D("Blob"),Dt=D("FileList"),Ft=e=>V(e)&&N(e.pipe),Ut=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||N(e.append)&&((t=Z(e))==="formdata"||t==="object"&&N(e.toString)&&e.toString()==="[object FormData]"))},Lt=D("URLSearchParams"),[kt,Bt,It,jt]=["ReadableStream","Request","Response","Headers"].map(D),Mt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function K(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),H(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(J(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function Pe(e,t){if(J(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const j=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xe=e=>!z(e)&&e!==j;function de(){const{caseless:e,skipUndefined:t}=xe(this)&&this||{},n={},r=(s,o)=>{const i=e&&Pe(n,o)||o;te(n[i])&&te(s)?n[i]=de(n[i],s):te(s)?n[i]=de({},s):H(s)?n[i]=s.slice():(!t||!z(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&K(arguments[s],r);return n}const $t=(e,t,n,{allOwnKeys:r}={})=>(K(t,(s,o)=>{n&&N(s)?Object.defineProperty(e,o,{value:Ae(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),qt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ht=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},zt=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&fe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},vt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Jt=e=>{if(!e)return null;if(H(e))return e;let t=e.length;if(!Ne(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Vt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&fe(Uint8Array)),Kt=(e,t)=>{const r=(e&&e[Y]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Wt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Xt=D("HTMLFormElement"),Gt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),De=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Qt=D("RegExp"),Fe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};K(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Yt=e=>{Fe(e,(t,n)=>{if(N(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(N(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Zt=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return H(e)?r(e):r(String(e).split(t)),n},en=()=>{},tn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function nn(e){return!!(e&&N(e.append)&&e[Re]==="FormData"&&e[Y])}const rn=e=>{const t=new Array(10),n=(r,s)=>{if(V(r)){if(t.indexOf(r)>=0)return;if(J(r))return r;if(!("toJSON"in r)){t[s]=r;const o=H(r)?[]:{};return K(r,(i,c)=>{const d=n(i,s+1);!z(d)&&(o[c]=d)}),t[s]=void 0,o}}return r};return n(e,0)},sn=D("AsyncFunction"),on=e=>e&&(V(e)||N(e))&&N(e.then)&&N(e.catch),Ue=((e,t)=>e?setImmediate:t?((n,r)=>(j.addEventListener("message",({source:s,data:o})=>{s===j&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),j.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",N(j.postMessage)),an=typeof queueMicrotask<"u"?queueMicrotask.bind(j):typeof process<"u"&&process.nextTick||Ue,a={isArray:H,isArrayBuffer:Ce,isBuffer:J,isFormData:Ut,isArrayBufferView:Tt,isString:At,isNumber:Ne,isBoolean:Rt,isObject:V,isPlainObject:te,isEmptyObject:Ct,isReadableStream:kt,isRequest:Bt,isResponse:It,isHeaders:jt,isUndefined:z,isDate:Nt,isFile:Pt,isBlob:xt,isRegExp:Qt,isFunction:N,isStream:Ft,isURLSearchParams:Lt,isTypedArray:Vt,isFileList:Dt,forEach:K,merge:de,extend:$t,trim:Mt,stripBOM:qt,inherits:Ht,toFlatObject:zt,kindOf:Z,kindOfTest:D,endsWith:vt,toArray:Jt,forEachEntry:Kt,matchAll:Wt,isHTMLForm:Xt,hasOwnProperty:De,hasOwnProp:De,reduceDescriptors:Fe,freezeMethods:Yt,toObjectSet:Zt,toCamelCase:Gt,noop:en,toFiniteNumber:tn,findKey:Pe,global:j,isContextDefined:xe,isSpecCompliantForm:nn,toJSONObject:rn,isAsyncFn:sn,isThenable:on,setImmediate:Ue,asap:an,isIterable:e=>e!=null&&N(e[Y])};let E=class St extends Error{static from(t,n,r,s,o,i){const c=new St(t.message,n||t.code,r,s,o);return c.cause=t,c.name=t.name,i&&Object.assign(c,i),c}constructor(t,n,r,s,o){super(t),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),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}}};E.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",E.ERR_BAD_OPTION="ERR_BAD_OPTION",E.ECONNABORTED="ECONNABORTED",E.ETIMEDOUT="ETIMEDOUT",E.ERR_NETWORK="ERR_NETWORK",E.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",E.ERR_DEPRECATED="ERR_DEPRECATED",E.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",E.ERR_BAD_REQUEST="ERR_BAD_REQUEST",E.ERR_CANCELED="ERR_CANCELED",E.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",E.ERR_INVALID_URL="ERR_INVALID_URL";const cn=null;function pe(e){return a.isPlainObject(e)||a.isArray(e)}function Le(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function ke(e,t,n){return e?e.concat(t).map(function(s,o){return s=Le(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function ln(e){return a.isArray(e)&&!e.some(pe)}const un=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ne(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,h){return!a.isUndefined(h[y])});const r=n.metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!d&&a.isBlob(f))throw new E("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?d&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,y,h){let g=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(y,"{}"))y=r?y:y.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&ln(f)||(a.isFileList(f)||a.endsWith(y,"[]"))&&(g=a.toArray(f)))return y=Le(y),g.forEach(function(w,S){!(a.isUndefined(w)||w===null)&&t.append(i===!0?ke([y],S,o):i===null?y:y+"[]",u(w))}),!1}return pe(f)?!0:(t.append(ke(h,y,o),u(f)),!1)}const m=[],b=Object.assign(un,{defaultVisitor:l,convertValue:u,isVisitable:pe});function A(f,y){if(!a.isUndefined(f)){if(m.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));m.push(f),a.forEach(f,function(g,_){(!(a.isUndefined(g)||g===null)&&s.call(t,g,a.isString(_)?_.trim():_,y,b))===!0&&A(g,y?y.concat(_):[_])}),m.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return A(e),t}function Be(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function me(e,t){this._pairs=[],e&&ne(e,this,t)}const Ie=me.prototype;Ie.append=function(t,n){this._pairs.push([t,n])},Ie.toString=function(t){const n=t?function(r){return t.call(this,r,Be)}:Be;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function fn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function je(e,t,n){if(!t)return e;const r=n&&n.encode||fn,s=a.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(t,s):i=a.isURLSearchParams(t)?t.toString():new me(t,s).toString(r),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,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.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(r){r!==null&&t(r)})}}const $e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},dn={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:me,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},he=typeof window<"u"&&typeof document<"u",ye=typeof navigator=="object"&&navigator||void 0,pn=he&&(!ye||["ReactNative","NativeScript","NS"].indexOf(ye.product)<0),mn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",hn=he&&window.location.href||"http://localhost",R={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:he,hasStandardBrowserEnv:pn,hasStandardBrowserWebWorkerEnv:mn,navigator:ye,origin:hn},Symbol.toStringTag,{value:"Module"})),...dn};function yn(e,t){return ne(e,new R.classes.URLSearchParams,{visitor:function(n,r,s,o){return R.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function wn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function En(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function qe(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),d=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,d?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=En(s[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(wn(r),s,n,0)}),n}return null}function bn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const W={transitional:$e,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?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 n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return yn(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return ne(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),bn(t)):t}],transformResponse:[function(t){const n=this.transitional||W.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?E.from(c,E.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:R.classes.FormData,Blob:R.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=>{W.headers[e]={}});const gn=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"]),Sn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
-
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&gn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},He=Symbol("internals");function X(e){return e&&String(e).trim().toLowerCase()}function re(e){return e===!1||e==null?e:a.isArray(e)?e.map(re):String(e)}function On(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const _n=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function
|
|
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,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[He]=this[He]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=X(i);r[c]||(An(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};P.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(P.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),a.freezeMethods(P);function Ee(e,t){const n=this||W,r=t||n,s=P.from(r.headers);let o=r.data;return a.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function ze(e){return!!(e&&e.__CANCEL__)}let G=class extends E{constructor(t,n,r){super(t??"canceled",E.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function ve(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new E("Request failed with status code "+n.status,[E.ERR_BAD_REQUEST,E.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Rn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Cn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(d){const u=Date.now(),l=r[o];i||(i=u),n[s]=d,r[s]=u;let m=o,b=0;for(;m!==s;)b+=n[m++],m=m%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const A=l&&u-l;return A?Math.round(b*1e3/A):void 0}}function Nn(e,t){let n=0,r=1e3/t,s,o;const i=(u,l=Date.now())=>{n=l,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const l=Date.now(),m=l-n;m>=r?i(u,l):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-m)))},()=>s&&i(s)]}const se=(e,t,n=3)=>{let r=0;const s=Cn(50,250);return Nn(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,d=i-r,u=s(d),l=i<=c;r=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:d,rate:u||void 0,estimated:u&&c&&l?(c-i)/u:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(m)},n)},Je=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ve=e=>(...t)=>a.asap(()=>e(...t)),Pn=R.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,R.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(R.origin),R.navigator&&/(msie|trident)/i.test(R.navigator.userAgent)):()=>!0,xn=R.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&c.push(`path=${r}`),a.isString(s)&&c.push(`domain=${s}`),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 Dn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Fn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ke(e,t,n){let r=!Dn(t);return e&&(r||n==!1)?Fn(e,t):t}const We=e=>e instanceof P?{...e}:e;function M(e,t){t=t||{};const n={};function r(u,l,m,b){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:b},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(u,l,m,b){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u,m,b)}else return r(u,l,m,b)}function o(u,l){if(!a.isUndefined(l))return r(void 0,l)}function i(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function c(u,l,m){if(m in t)return r(u,l);if(m in e)return r(void 0,u)}const d={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)=>s(We(u),We(l),m,!0)};return a.forEach(Object.keys({...e,...t}),function(l){const m=d[l]||s,b=m(e[l],t[l],l);a.isUndefined(b)&&m!==c||(n[l]=b)}),n}const Xe=e=>{const t=M({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;if(t.headers=i=P.from(i),t.url=je(Ke(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(n)){if(R.hasStandardBrowserEnv||R.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const d=n.getHeaders(),u=["content-type","content-length"];Object.entries(d).forEach(([l,m])=>{u.includes(l.toLowerCase())&&i.set(l,m)})}}if(R.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Pn(t.url))){const d=s&&o&&xn.read(o);d&&i.set(s,d)}return t},Un=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const s=Xe(e);let o=s.data;const i=P.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:u}=s,l,m,b,A,f;function y(){A&&A(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function g(){if(!h)return;const w=P.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),C={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:w,config:e,request:h};ve(function(x){n(x),y()},function(x){r(x),y()},C),h=null}"onloadend"in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(g)},h.onabort=function(){h&&(r(new E("Request aborted",E.ECONNABORTED,e,h)),h=null)},h.onerror=function(S){const C=S&&S.message?S.message:"Network Error",k=new E(C,E.ERR_NETWORK,e,h);k.event=S||null,r(k),h=null},h.ontimeout=function(){let S=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const C=s.transitional||$e;s.timeoutErrorMessage&&(S=s.timeoutErrorMessage),r(new E(S,C.clarifyTimeoutError?E.ETIMEDOUT:E.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(S,C){h.setRequestHeader(C,S)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),u&&([b,f]=se(u,!0),h.addEventListener("progress",b)),d&&h.upload&&([m,A]=se(d),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",A)),(s.cancelToken||s.signal)&&(l=w=>{h&&(r(!w||w.type?new G(null,e,h):w),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const _=Rn(s.url);if(_&&R.protocols.indexOf(_)===-1){r(new E("Unsupported protocol "+_+":",E.ERR_BAD_REQUEST,e));return}h.send(o||null)})},Ln=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,c();const l=u instanceof Error?u:this.reason;r.abort(l instanceof E?l:new G(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new E(`timeout of ${t}ms exceeded`,E.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:d}=r;return d.unsubscribe=()=>a.asap(c),d}},kn=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},Bn=async function*(e,t){for await(const n of In(e))yield*kn(n,t)},In=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Ge=(e,t,n,r)=>{const s=Bn(e,t);let o=0,i,c=d=>{i||(i=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:u,value:l}=await s.next();if(u){c(),d.close();return}let m=l.byteLength;if(n){let b=o+=m;n(b)}d.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},Qe=64*1024,{isFunction:oe}=a,jn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Ye,TextEncoder:Ze}=a.global,et=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Mn=e=>{e=a.merge.call({skipUndefined:!0},jn,e);const{fetch:t,Request:n,Response:r}=e,s=t?oe(t):typeof fetch=="function",o=oe(n),i=oe(r);if(!s)return!1;const c=s&&oe(Ye),d=s&&(typeof Ze=="function"?(f=>y=>f.encode(y))(new Ze):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=o&&c&&et(()=>{let f=!1;const y=new n(R.origin,{body:new Ye,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),l=i&&c&&et(()=>a.isReadableStream(new r("").body)),m={stream:l&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!m[f]&&(m[f]=(y,h)=>{let g=y&&y[f];if(g)return g.call(y);throw new E(`Response type '${f}' is not supported`,E.ERR_NOT_SUPPORT,h)})});const b=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(R.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await d(f)).byteLength},A=async(f,y)=>{const h=a.toFiniteNumber(f.getContentLength());return h??b(y)};return async f=>{let{url:y,method:h,data:g,signal:_,cancelToken:w,timeout:S,onDownloadProgress:C,onUploadProgress:k,responseType:x,headers:_e,withCredentials:ce="same-origin",fetchOptions:mt}=Xe(f),ht=t||fetch;x=x?(x+"").toLowerCase():"text";let le=Ln([_,w&&w.toAbortSignal()],S),Q=null;const q=le&&le.unsubscribe&&(()=>{le.unsubscribe()});let yt;try{if(k&&u&&h!=="get"&&h!=="head"&&(yt=await A(_e,g))!==0){let I=new n(y,{method:"POST",body:g,duplex:"half"}),v;if(a.isFormData(g)&&(v=I.headers.get("content-type"))&&_e.setContentType(v),I.body){const[Te,ue]=Je(yt,se(Ve(k)));g=Ge(I.body,Qe,Te,ue)}}a.isString(ce)||(ce=ce?"include":"omit");const L=o&&"credentials"in n.prototype,wt={...mt,signal:le,method:h.toUpperCase(),headers:_e.normalize().toJSON(),body:g,duplex:"half",credentials:L?ce:void 0};Q=o&&new n(y,wt);let B=await(o?ht(Q,mt):ht(y,wt));const Et=l&&(x==="stream"||x==="response");if(l&&(C||Et&&q)){const I={};["status","statusText","headers"].forEach(bt=>{I[bt]=B[bt]});const v=a.toFiniteNumber(B.headers.get("content-length")),[Te,ue]=C&&Je(v,se(Ve(C),!0))||[];B=new r(Ge(B.body,Qe,Te,()=>{ue&&ue(),q&&q()}),I)}x=x||"text";let Qn=await m[a.findKey(m,x)||"text"](B,f);return!Et&&q&&q(),await new Promise((I,v)=>{ve(I,v,{data:Qn,headers:P.from(B.headers),status:B.status,statusText:B.statusText,config:f,request:Q})})}catch(L){throw q&&q(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new E("Network Error",E.ERR_NETWORK,f,Q),{cause:L.cause||L}):E.from(L,L&&L.code,f,Q)}}},$n=new Map,tt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,c=i,d,u,l=$n;for(;c--;)d=o[c],u=l.get(d),u===void 0&&l.set(d,u=c?new Map:Mn(t)),l=u;return u};tt();const be={http:cn,xhr:Un,fetch:{get:tt}};a.forEach(be,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const nt=e=>`- ${e}`,qn=e=>a.isFunction(e)||e===null||e===!1;function Hn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let c;if(s=r,!qn(r)&&(s=be[(c=String(r)).toLowerCase()],s===void 0))throw new E(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([d,u])=>`adapter ${d} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
|
|
1
|
+
(function(T,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):(T=typeof globalThis<"u"?globalThis:T||self,p(T.CustomerSupport={},T.React,T.lucideReact))})(this,(function(T,p,F){"use strict";var Yn=Object.defineProperty;var Zn=(T,p,F)=>p in T?Yn(T,p,{enumerable:!0,configurable:!0,writable:!0,value:F}):T[p]=F;var gt=(T,p,F)=>Zn(T,typeof p!="symbol"?p+"":p,F);function Ae(e,t){return function(){return e.apply(t,arguments)}}const{toString:_t}=Object.prototype,{getPrototypeOf:fe}=Object,{iterator:Y,toStringTag:Re}=Symbol,Z=(e=>t=>{const n=_t.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),D=e=>(e=e.toLowerCase(),t=>Z(t)===e),ee=e=>t=>typeof t===e,{isArray:H}=Array,z=ee("undefined");function J(e){return e!==null&&!z(e)&&e.constructor!==null&&!z(e.constructor)&&N(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ce=D("ArrayBuffer");function Tt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ce(e.buffer),t}const At=ee("string"),N=ee("function"),Ne=ee("number"),V=e=>e!==null&&typeof e=="object",Rt=e=>e===!0||e===!1,te=e=>{if(Z(e)!=="object")return!1;const t=fe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Re in e)&&!(Y in e)},Ct=e=>{if(!V(e)||J(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Nt=D("Date"),xt=D("File"),Pt=D("Blob"),Dt=D("FileList"),Ft=e=>V(e)&&N(e.pipe),Ut=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||N(e.append)&&((t=Z(e))==="formdata"||t==="object"&&N(e.toString)&&e.toString()==="[object FormData]"))},Lt=D("URLSearchParams"),[kt,Bt,It,jt]=["ReadableStream","Request","Response","Headers"].map(D),$t=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function K(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),H(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(J(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function xe(e,t){if(J(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const j=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Pe=e=>!z(e)&&e!==j;function de(){const{caseless:e,skipUndefined:t}=Pe(this)&&this||{},n={},r=(s,o)=>{const i=e&&xe(n,o)||o;te(n[i])&&te(s)?n[i]=de(n[i],s):te(s)?n[i]=de({},s):H(s)?n[i]=s.slice():(!t||!z(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&K(arguments[s],r);return n}const Mt=(e,t,n,{allOwnKeys:r}={})=>(K(t,(s,o)=>{n&&N(s)?Object.defineProperty(e,o,{value:Ae(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),qt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ht=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},zt=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&fe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},vt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Jt=e=>{if(!e)return null;if(H(e))return e;let t=e.length;if(!Ne(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Vt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&fe(Uint8Array)),Kt=(e,t)=>{const r=(e&&e[Y]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Wt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Xt=D("HTMLFormElement"),Gt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),De=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Qt=D("RegExp"),Fe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};K(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Yt=e=>{Fe(e,(t,n)=>{if(N(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(N(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Zt=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return H(e)?r(e):r(String(e).split(t)),n},en=()=>{},tn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function nn(e){return!!(e&&N(e.append)&&e[Re]==="FormData"&&e[Y])}const rn=e=>{const t=new Array(10),n=(r,s)=>{if(V(r)){if(t.indexOf(r)>=0)return;if(J(r))return r;if(!("toJSON"in r)){t[s]=r;const o=H(r)?[]:{};return K(r,(i,c)=>{const d=n(i,s+1);!z(d)&&(o[c]=d)}),t[s]=void 0,o}}return r};return n(e,0)},sn=D("AsyncFunction"),on=e=>e&&(V(e)||N(e))&&N(e.then)&&N(e.catch),Ue=((e,t)=>e?setImmediate:t?((n,r)=>(j.addEventListener("message",({source:s,data:o})=>{s===j&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),j.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",N(j.postMessage)),an=typeof queueMicrotask<"u"?queueMicrotask.bind(j):typeof process<"u"&&process.nextTick||Ue,a={isArray:H,isArrayBuffer:Ce,isBuffer:J,isFormData:Ut,isArrayBufferView:Tt,isString:At,isNumber:Ne,isBoolean:Rt,isObject:V,isPlainObject:te,isEmptyObject:Ct,isReadableStream:kt,isRequest:Bt,isResponse:It,isHeaders:jt,isUndefined:z,isDate:Nt,isFile:xt,isBlob:Pt,isRegExp:Qt,isFunction:N,isStream:Ft,isURLSearchParams:Lt,isTypedArray:Vt,isFileList:Dt,forEach:K,merge:de,extend:Mt,trim:$t,stripBOM:qt,inherits:Ht,toFlatObject:zt,kindOf:Z,kindOfTest:D,endsWith:vt,toArray:Jt,forEachEntry:Kt,matchAll:Wt,isHTMLForm:Xt,hasOwnProperty:De,hasOwnProp:De,reduceDescriptors:Fe,freezeMethods:Yt,toObjectSet:Zt,toCamelCase:Gt,noop:en,toFiniteNumber:tn,findKey:xe,global:j,isContextDefined:Pe,isSpecCompliantForm:nn,toJSONObject:rn,isAsyncFn:sn,isThenable:on,setImmediate:Ue,asap:an,isIterable:e=>e!=null&&N(e[Y])};let y=class St extends Error{static from(t,n,r,s,o,i){const c=new St(t.message,n||t.code,r,s,o);return c.cause=t,c.name=t.name,i&&Object.assign(c,i),c}constructor(t,n,r,s,o){super(t),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),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}}};y.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",y.ERR_BAD_OPTION="ERR_BAD_OPTION",y.ECONNABORTED="ECONNABORTED",y.ETIMEDOUT="ETIMEDOUT",y.ERR_NETWORK="ERR_NETWORK",y.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",y.ERR_DEPRECATED="ERR_DEPRECATED",y.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",y.ERR_BAD_REQUEST="ERR_BAD_REQUEST",y.ERR_CANCELED="ERR_CANCELED",y.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",y.ERR_INVALID_URL="ERR_INVALID_URL";const cn=null;function pe(e){return a.isPlainObject(e)||a.isArray(e)}function Le(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function ke(e,t,n){return e?e.concat(t).map(function(s,o){return s=Le(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function ln(e){return a.isArray(e)&&!e.some(pe)}const un=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ne(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,h){return!a.isUndefined(h[w])});const r=n.metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!d&&a.isBlob(f))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?d&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,w,h){let S=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(w,"{}"))w=r?w:w.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&ln(f)||(a.isFileList(f)||a.endsWith(w,"[]"))&&(S=a.toArray(f)))return w=Le(w),S.forEach(function(g,E){!(a.isUndefined(g)||g===null)&&t.append(i===!0?ke([w],E,o):i===null?w:w+"[]",u(g))}),!1}return pe(f)?!0:(t.append(ke(h,w,o),u(f)),!1)}const m=[],b=Object.assign(un,{defaultVisitor:l,convertValue:u,isVisitable:pe});function A(f,w){if(!a.isUndefined(f)){if(m.indexOf(f)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(f),a.forEach(f,function(S,_){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(_)?_.trim():_,w,b))===!0&&A(S,w?w.concat(_):[_])}),m.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return A(e),t}function Be(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function me(e,t){this._pairs=[],e&&ne(e,this,t)}const Ie=me.prototype;Ie.append=function(t,n){this._pairs.push([t,n])},Ie.toString=function(t){const n=t?function(r){return t.call(this,r,Be)}:Be;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function fn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function je(e,t,n){if(!t)return e;const r=n&&n.encode||fn,s=a.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(t,s):i=a.isURLSearchParams(t)?t.toString():new me(t,s).toString(r),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class $e{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.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(r){r!==null&&t(r)})}}const Me={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},dn={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:me,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},he=typeof window<"u"&&typeof document<"u",we=typeof navigator=="object"&&navigator||void 0,pn=he&&(!we||["ReactNative","NativeScript","NS"].indexOf(we.product)<0),mn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",hn=he&&window.location.href||"http://localhost",C={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:he,hasStandardBrowserEnv:pn,hasStandardBrowserWebWorkerEnv:mn,navigator:we,origin:hn},Symbol.toStringTag,{value:"Module"})),...dn};function wn(e,t){return ne(e,new C.classes.URLSearchParams,{visitor:function(n,r,s,o){return C.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function yn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function En(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function qe(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),d=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,d?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=En(s[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(yn(r),s,n,0)}),n}return null}function bn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const W={transitional:Me,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?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 n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return wn(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return ne(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),bn(t)):t}],transformResponse:[function(t){const n=this.transitional||W.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?y.from(c,y.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:C.classes.FormData,Blob:C.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=>{W.headers[e]={}});const gn=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"]),Sn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&gn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},He=Symbol("internals");function X(e){return e&&String(e).trim().toLowerCase()}function re(e){return e===!1||e==null?e:a.isArray(e)?e.map(re):String(e)}function On(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const _n=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ye(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function Tn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function An(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let x=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,d,u){const l=X(d);if(!l)throw new Error("header name must be a non-empty string");const m=a.findKey(s,l);(!m||s[m]===void 0||u===!0||u===void 0&&s[m]!==!1)&&(s[m||d]=re(c))}const i=(c,d)=>a.forEach(c,(u,l)=>o(u,l,d));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(a.isString(t)&&(t=t.trim())&&!_n(t))i(Sn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let c={},d,u;for(const l of t){if(!a.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(d=c[u])?a.isArray(d)?[...d,l[1]]:[d,l[1]]:l[1]}i(c,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=X(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return On(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=X(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ye(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=X(i),i){const c=a.findKey(r,i);c&&(!n||ye(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||ye(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,o)=>{const i=a.findKey(r,o);if(i){n[i]=re(s),delete n[o];return}const c=t?Tn(o):String(o).trim();c!==o&&delete n[o],n[c]=re(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).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,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[He]=this[He]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=X(i);r[c]||(An(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};x.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(x.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),a.freezeMethods(x);function Ee(e,t){const n=this||W,r=t||n,s=x.from(r.headers);let o=r.data;return a.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function ze(e){return!!(e&&e.__CANCEL__)}let G=class extends y{constructor(t,n,r){super(t??"canceled",y.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function ve(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Rn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Cn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(d){const u=Date.now(),l=r[o];i||(i=u),n[s]=d,r[s]=u;let m=o,b=0;for(;m!==s;)b+=n[m++],m=m%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const A=l&&u-l;return A?Math.round(b*1e3/A):void 0}}function Nn(e,t){let n=0,r=1e3/t,s,o;const i=(u,l=Date.now())=>{n=l,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const l=Date.now(),m=l-n;m>=r?i(u,l):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-m)))},()=>s&&i(s)]}const se=(e,t,n=3)=>{let r=0;const s=Cn(50,250);return Nn(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,d=i-r,u=s(d),l=i<=c;r=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:d,rate:u||void 0,estimated:u&&c&&l?(c-i)/u:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(m)},n)},Je=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ve=e=>(...t)=>a.asap(()=>e(...t)),xn=C.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,C.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(C.origin),C.navigator&&/(msie|trident)/i.test(C.navigator.userAgent)):()=>!0,Pn=C.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&c.push(`path=${r}`),a.isString(s)&&c.push(`domain=${s}`),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 Dn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Fn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ke(e,t,n){let r=!Dn(t);return e&&(r||n==!1)?Fn(e,t):t}const We=e=>e instanceof x?{...e}:e;function $(e,t){t=t||{};const n={};function r(u,l,m,b){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:b},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(u,l,m,b){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u,m,b)}else return r(u,l,m,b)}function o(u,l){if(!a.isUndefined(l))return r(void 0,l)}function i(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function c(u,l,m){if(m in t)return r(u,l);if(m in e)return r(void 0,u)}const d={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)=>s(We(u),We(l),m,!0)};return a.forEach(Object.keys({...e,...t}),function(l){const m=d[l]||s,b=m(e[l],t[l],l);a.isUndefined(b)&&m!==c||(n[l]=b)}),n}const Xe=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;if(t.headers=i=x.from(i),t.url=je(Ke(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(n)){if(C.hasStandardBrowserEnv||C.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const d=n.getHeaders(),u=["content-type","content-length"];Object.entries(d).forEach(([l,m])=>{u.includes(l.toLowerCase())&&i.set(l,m)})}}if(C.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&xn(t.url))){const d=s&&o&&Pn.read(o);d&&i.set(s,d)}return t},Un=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const s=Xe(e);let o=s.data;const i=x.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:u}=s,l,m,b,A,f;function w(){A&&A(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function S(){if(!h)return;const g=x.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),R={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:g,config:e,request:h};ve(function(P){n(P),w()},function(P){r(P),w()},R),h=null}"onloadend"in h?h.onloadend=S:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(S)},h.onabort=function(){h&&(r(new y("Request aborted",y.ECONNABORTED,e,h)),h=null)},h.onerror=function(E){const R=E&&E.message?E.message:"Network Error",k=new y(R,y.ERR_NETWORK,e,h);k.event=E||null,r(k),h=null},h.ontimeout=function(){let E=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const R=s.transitional||Me;s.timeoutErrorMessage&&(E=s.timeoutErrorMessage),r(new y(E,R.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(E,R){h.setRequestHeader(R,E)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),u&&([b,f]=se(u,!0),h.addEventListener("progress",b)),d&&h.upload&&([m,A]=se(d),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",A)),(s.cancelToken||s.signal)&&(l=g=>{h&&(r(!g||g.type?new G(null,e,h):g),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const _=Rn(s.url);if(_&&C.protocols.indexOf(_)===-1){r(new y("Unsupported protocol "+_+":",y.ERR_BAD_REQUEST,e));return}h.send(o||null)})},Ln=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,c();const l=u instanceof Error?u:this.reason;r.abort(l instanceof y?l:new G(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new y(`timeout of ${t}ms exceeded`,y.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:d}=r;return d.unsubscribe=()=>a.asap(c),d}},kn=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},Bn=async function*(e,t){for await(const n of In(e))yield*kn(n,t)},In=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Ge=(e,t,n,r)=>{const s=Bn(e,t);let o=0,i,c=d=>{i||(i=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:u,value:l}=await s.next();if(u){c(),d.close();return}let m=l.byteLength;if(n){let b=o+=m;n(b)}d.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},Qe=64*1024,{isFunction:oe}=a,jn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Ye,TextEncoder:Ze}=a.global,et=(e,...t)=>{try{return!!e(...t)}catch{return!1}},$n=e=>{e=a.merge.call({skipUndefined:!0},jn,e);const{fetch:t,Request:n,Response:r}=e,s=t?oe(t):typeof fetch=="function",o=oe(n),i=oe(r);if(!s)return!1;const c=s&&oe(Ye),d=s&&(typeof Ze=="function"?(f=>w=>f.encode(w))(new Ze):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=o&&c&&et(()=>{let f=!1;const w=new n(C.origin,{body:new Ye,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!w}),l=i&&c&&et(()=>a.isReadableStream(new r("").body)),m={stream:l&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!m[f]&&(m[f]=(w,h)=>{let S=w&&w[f];if(S)return S.call(w);throw new y(`Response type '${f}' is not supported`,y.ERR_NOT_SUPPORT,h)})});const b=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(C.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await d(f)).byteLength},A=async(f,w)=>{const h=a.toFiniteNumber(f.getContentLength());return h??b(w)};return async f=>{let{url:w,method:h,data:S,signal:_,cancelToken:g,timeout:E,onDownloadProgress:R,onUploadProgress:k,responseType:P,headers:_e,withCredentials:ce="same-origin",fetchOptions:mt}=Xe(f),ht=t||fetch;P=P?(P+"").toLowerCase():"text";let le=Ln([_,g&&g.toAbortSignal()],E),Q=null;const q=le&&le.unsubscribe&&(()=>{le.unsubscribe()});let wt;try{if(k&&u&&h!=="get"&&h!=="head"&&(wt=await A(_e,S))!==0){let I=new n(w,{method:"POST",body:S,duplex:"half"}),v;if(a.isFormData(S)&&(v=I.headers.get("content-type"))&&_e.setContentType(v),I.body){const[Te,ue]=Je(wt,se(Ve(k)));S=Ge(I.body,Qe,Te,ue)}}a.isString(ce)||(ce=ce?"include":"omit");const L=o&&"credentials"in n.prototype,yt={...mt,signal:le,method:h.toUpperCase(),headers:_e.normalize().toJSON(),body:S,duplex:"half",credentials:L?ce:void 0};Q=o&&new n(w,yt);let B=await(o?ht(Q,mt):ht(w,yt));const Et=l&&(P==="stream"||P==="response");if(l&&(R||Et&&q)){const I={};["status","statusText","headers"].forEach(bt=>{I[bt]=B[bt]});const v=a.toFiniteNumber(B.headers.get("content-length")),[Te,ue]=R&&Je(v,se(Ve(R),!0))||[];B=new r(Ge(B.body,Qe,Te,()=>{ue&&ue(),q&&q()}),I)}P=P||"text";let Qn=await m[a.findKey(m,P)||"text"](B,f);return!Et&&q&&q(),await new Promise((I,v)=>{ve(I,v,{data:Qn,headers:x.from(B.headers),status:B.status,statusText:B.statusText,config:f,request:Q})})}catch(L){throw q&&q(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,f,Q),{cause:L.cause||L}):y.from(L,L&&L.code,f,Q)}}},Mn=new Map,tt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,c=i,d,u,l=Mn;for(;c--;)d=o[c],u=l.get(d),u===void 0&&l.set(d,u=c?new Map:$n(t)),l=u;return u};tt();const be={http:cn,xhr:Un,fetch:{get:tt}};a.forEach(be,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const nt=e=>`- ${e}`,qn=e=>a.isFunction(e)||e===null||e===!1;function Hn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let c;if(s=r,!qn(r)&&(s=be[(c=String(r)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([d,u])=>`adapter ${d} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
|
|
4
4
|
`+i.map(nt).join(`
|
|
5
|
-
`):" "+nt(i[0]):"as no adapter specified";throw new
|
|
6
|
-
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=M(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&ae.assertOptions(r,{silentJSONParsing:U.transitional(U.boolean),forcedJSONParsing:U.transitional(U.boolean),clarifyTimeoutError:U.transitional(U.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:U.function,serialize:U.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ae.assertOptions(n,{baseUrl:U.spelling("baseURL"),withXsrfToken:U.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),n.headers=P.concat(i,o);const c=[];let d=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(d=d&&y.synchronous,c.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let l,m=0,b;if(!d){const f=[st.bind(this),void 0];for(f.unshift(...c),f.push(...u),b=f.length,l=Promise.resolve(n);m<b;)l=l.then(f[m++],f[m++]);return l}b=c.length;let A=n;for(;m<b;){const f=c[m++],y=c[m++];try{A=f(A)}catch(h){y.call(this,h);break}}try{l=st.call(this,A)}catch(f){return Promise.reject(f)}for(m=0,b=u.length;m<b;)l=l.then(u[m++],u[m++]);return l}getUri(t){t=M(this.defaults,t);const n=Ke(t.baseURL,t.url,t.allowAbsoluteUrls);return je(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){$.prototype[t]=function(n,r){return this.request(M(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,c){return this.request(M(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}$.prototype[t]=n(),$.prototype[t+"Form"]=n(!0)});let vn=class Ot{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new G(o,i,c),n(r.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 n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ot(function(s){t=s}),cancel:t}}};function Jn(e){return function(n){return e.apply(null,n)}}function Vn(e){return a.isObject(e)&&e.isAxiosError===!0}const Se={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(Se).forEach(([e,t])=>{Se[t]=e});function at(e){const t=new $(e),n=Ae($.prototype.request,t);return a.extend(n,$.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return at(M(e,s))},n}const O=at(W);O.Axios=$,O.CanceledError=G,O.CancelToken=vn,O.isCancel=ze,O.VERSION=ot,O.toFormData=ne,O.AxiosError=E,O.Cancel=O.CanceledError,O.all=function(t){return Promise.all(t)},O.spread=Jn,O.isAxiosError=Vn,O.mergeConfig=M,O.AxiosHeaders=P,O.formToJSON=e=>qe(a.isHTMLForm(e)?new FormData(e):e),O.getAdapter=rt.getAdapter,O.HttpStatusCode=Se,O.default=O;const{Axios:ir,AxiosError:ar,CanceledError:cr,isCancel:lr,CancelToken:ur,VERSION:fr,all:dr,Cancel:pr,isAxiosError:mr,spread:hr,toFormData:yr,AxiosHeaders:wr,HttpStatusCode:Er,formToJSON:br,getAdapter:gr,mergeConfig:Sr}=O,Kn="http://localhost:8000/api";class ct{constructor(t,n=Kn){gt(this,"client");this.client=O.create({baseURL:n,headers:{"Content-Type":"application/json","X-API-Key":t},timeout:3e4}),this.client.interceptors.response.use(r=>r,r=>{var s,o;if((s=r.response)!=null&&s.data){const c=((o=r.response.data.response)==null?void 0:o.message)||"An unknown error occurred";throw new Error(c)}else throw r.request?new Error("No response from server. Please check your connection."):new Error(r.message||"Request failed")})}async sendMessage(t,n){try{const r=await this.client.post("/chat/",{question:t,session_id:n});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 send message")}}async getConversationHistory(t){try{const n=await this.client.get(`/chat/history/${t}/`);if(n.data.response.status!=="success")throw new Error(n.data.response.message);return n.data.data}catch(n){throw n instanceof Error?n: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 Oe(e,t){const[n,r]=p.useState(()=>{try{const o=window.localStorage.getItem(e);return o?JSON.parse(o):t}catch(o){return console.warn(`Error reading localStorage key "${e}":`,o),t}});return[n,o=>{try{const i=o instanceof Function?o(n):o;r(i),window.localStorage.setItem(e,JSON.stringify(i))}catch(i){console.warn(`Error setting localStorage key "${e}":`,i)}}]}function lt(){return`session_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}const Wn="customer_support_session_id",Xn="customer_support_messages";function ut(e){const{apiKey:t,baseUrl:n,onError:r}=e,[s,o]=Oe(Xn,[]),[i,c]=Oe(Wn,lt()),[d,u]=p.useState(!1),[l,m]=p.useState(null),b=p.useRef(null);p.useEffect(()=>{b.current=new ct(t,n)},[t,n]);const A=p.useCallback(()=>{m(null)},[]),f=p.useCallback(async g=>{if(!b.current){const w=new Error("API client not initialized");m(w),r==null||r(w);return}if(!g.trim())return;const _={id:`user_${Date.now()}`,role:"USER",content:g,timestamp:new Date};o(w=>[...w,_]),u(!0),m(null);try{const w=await b.current.sendMessage(g,i),S={id:`assistant_${Date.now()}`,role:"ASSISTANT",content:w.answer,timestamp:new Date,sources:w.sources};o(C=>[...C,S]),w.session_id!==i&&c(w.session_id)}catch(w){const S=w instanceof Error?w:new Error("Failed to send message");m(S),r==null||r(S);const C={id:`error_${Date.now()}`,role:"ASSISTANT",content:`Sorry, I encountered an error: ${S.message}`,timestamp:new Date};o(k=>[...k,C])}finally{u(!1)}},[i,r,o,c]),y=p.useCallback(async()=>{if(!(!b.current||!i)){u(!0),m(null);try{const _=(await b.current.getConversationHistory(i)).messages.map((w,S)=>({id:`${w.role.toLowerCase()}_${S}_${Date.now()}`,role:w.role,content:w.content,timestamp:new Date(w.created_at)}));o(_)}catch(g){const _=g instanceof Error?g:new Error("Failed to load history");m(_),r==null||r(_)}finally{u(!1)}}},[i,r,o]),h=p.useCallback(()=>{o([]),c(lt())},[o,c]);return{messages:s,sendMessage:f,isLoading:d,error:l,clearError:A,sessionId:i,loadHistory:y,clearHistory:h}}const ft=({message:e})=>{const t=e.role==="USER",n=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((r,s)=>p.createElement("li",{key:s,className:"cs-message__source-item"},p.createElement("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"cs-message__source-link"},p.createElement(F.ExternalLink,{size:12}),p.createElement("span",null,r.title)),p.createElement("span",{className:"cs-message__source-similarity"},Math.round(r.similarity*100),"% match")))))),p.createElement("time",{className:"cs-message__time",dateTime:n.toISOString()},n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})))},dt=({onSendMessage:e,isLoading:t,placeholder:n="Type your message..."})=>{const[r,s]=p.useState(""),o=c=>{c.preventDefault(),r.trim()&&!t&&(e(r),s(""))},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:r,onChange:c=>s(c.target.value),onKeyDown:i,placeholder:n,disabled:t,rows:1,"aria-label":"Message input"}),p.createElement("button",{type:"submit",className:"cs-input__button",disabled:!r.trim()||t,"aria-label":"Send message"},p.createElement(F.Send,{size:20})))},pt=({messages:e,onSendMessage:t,onClose:n,isLoading:r,error:s,placeholder:o,welcomeMessage:i="Hi! How can I help you today?"})=>{const c=p.useRef(null);return p.useEffect(()=>{var d;(d=c.current)==null||d.scrollIntoView({behavior:"smooth"})},[e]),p.createElement("div",{className:"cs-window"},p.createElement("div",{className:"cs-window__header"},p.createElement("h3",{className:"cs-window__title"},"Customer Support"),p.createElement("button",{className:"cs-window__close",onClick:n,"aria-label":"Close chat"},p.createElement(F.X,{size:20}))),p.createElement("div",{className:"cs-window__messages"},e.length===0&&!r&&p.createElement("div",{className:"cs-window__welcome"},p.createElement("p",null,i)),e.map(d=>p.createElement(ft,{key:d.id,message:d})),r&&p.createElement("div",{className:"cs-window__typing"},p.createElement(F.Loader2,{size:20,className:"cs-window__typing-icon"}),p.createElement("span",null,"Thinking...")),s&&p.createElement("div",{className:"cs-window__error"},p.createElement("p",null,s.message)),p.createElement("div",{ref:c})),p.createElement("div",{className:"cs-window__input-wrapper"},p.createElement(dt,{onSendMessage:t,isLoading:r,placeholder:o})))},Gn=({apiKey:e,baseUrl:t,theme:n,position:r="bottom-right",welcomeMessage:s,placeholder:o,className:i="",onError:c,onMessageSent:d,onMessageReceived:u})=>{const[l,m]=p.useState(!1),{messages:b,sendMessage:A,isLoading:f,error:y,clearError:h}=ut({apiKey:e,baseUrl:t,onError:c});p.useEffect(()=>{if(n){const w=document.documentElement;n.primaryColor&&w.style.setProperty("--cs-primary-color",n.primaryColor),n.secondaryColor&&w.style.setProperty("--cs-secondary-color",n.secondaryColor),n.backgroundColor&&w.style.setProperty("--cs-bg-color",n.backgroundColor),n.textColor&&w.style.setProperty("--cs-text-color",n.textColor),n.fontFamily&&w.style.setProperty("--cs-font-family",n.fontFamily),n.borderRadius&&w.style.setProperty("--cs-border-radius",n.borderRadius),n.buttonColor&&w.style.setProperty("--cs-button-color",n.buttonColor),n.userMessageColor&&w.style.setProperty("--cs-user-message-color",n.userMessageColor),n.assistantMessageColor&&w.style.setProperty("--cs-assistant-message-color",n.assistantMessageColor)}},[n]);const g=async w=>{if(d==null||d(w),await A(w),!y){const S=b[b.length-1];(S==null?void 0:S.role)==="ASSISTANT"&&(u==null||u(S.content))}},_=()=>{m(!l),y&&h()};return p.createElement("div",{className:`cs-widget cs-widget--${r} ${i}`},l&&p.createElement(pt,{messages:b,onSendMessage:g,onClose:()=>m(!1),isLoading:f,error:y,placeholder:o,welcomeMessage:s}),p.createElement("button",{className:`cs-widget__toggle ${l?"cs-widget__toggle--open":""}`,onClick:_,"aria-label":l?"Close chat":"Open chat","aria-expanded":l},p.createElement(F.MessageCircle,{size:24}),!l&&b.length>0&&p.createElement("span",{className:"cs-widget__badge"},b.filter(w=>w.role==="ASSISTANT").length)))};T.ChatInput=dt,T.ChatMessage=ft,T.ChatWindow=pt,T.CustomerSupportAPIClient=ct,T.CustomerSupportWidget=Gn,T.useCustomerSupport=ut,T.useLocalStorage=Oe,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
|
|
5
|
+
`):" "+nt(i[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const rt={getAdapter:Hn,adapters:be};function ge(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new G(null,e)}function st(e){return ge(e),e.headers=x.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),rt.getAdapter(e.adapter||W.adapter,e)(e).then(function(r){return ge(e),r.data=Ee.call(e,e.transformResponse,r),r.headers=x.from(r.headers),r},function(r){return ze(r)||(ge(e),r&&r.response&&(r.response.data=Ee.call(e,e.transformResponse,r.response),r.response.headers=x.from(r.response.headers))),Promise.reject(r)})}const ot="1.13.4",ie={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ie[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const it={};ie.transitional=function(t,n,r){function s(o,i){return"[Axios v"+ot+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new y(s(i," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!it[i]&&(it[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}},ie.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function zn(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const c=e[o],d=c===void 0||i(c,o,e);if(d!==!0)throw new y("option "+o+" must be "+d,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+o,y.ERR_BAD_OPTION)}}const ae={assertOptions:zn,validators:ie},U=ae.validators;let M=class{constructor(t){this.defaults=t||{},this.interceptors={request:new $e,response:new $e}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&ae.assertOptions(r,{silentJSONParsing:U.transitional(U.boolean),forcedJSONParsing:U.transitional(U.boolean),clarifyTimeoutError:U.transitional(U.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:U.function,serialize:U.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ae.assertOptions(n,{baseUrl:U.spelling("baseURL"),withXsrfToken:U.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),n.headers=x.concat(i,o);const c=[];let d=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(d=d&&w.synchronous,c.unshift(w.fulfilled,w.rejected))});const u=[];this.interceptors.response.forEach(function(w){u.push(w.fulfilled,w.rejected)});let l,m=0,b;if(!d){const f=[st.bind(this),void 0];for(f.unshift(...c),f.push(...u),b=f.length,l=Promise.resolve(n);m<b;)l=l.then(f[m++],f[m++]);return l}b=c.length;let A=n;for(;m<b;){const f=c[m++],w=c[m++];try{A=f(A)}catch(h){w.call(this,h);break}}try{l=st.call(this,A)}catch(f){return Promise.reject(f)}for(m=0,b=u.length;m<b;)l=l.then(u[m++],u[m++]);return l}getUri(t){t=$(this.defaults,t);const n=Ke(t.baseURL,t.url,t.allowAbsoluteUrls);return je(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){M.prototype[t]=function(n,r){return this.request($(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,c){return this.request($(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}M.prototype[t]=n(),M.prototype[t+"Form"]=n(!0)});let vn=class Ot{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new G(o,i,c),n(r.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 n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ot(function(s){t=s}),cancel:t}}};function Jn(e){return function(n){return e.apply(null,n)}}function Vn(e){return a.isObject(e)&&e.isAxiosError===!0}const Se={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(Se).forEach(([e,t])=>{Se[t]=e});function at(e){const t=new M(e),n=Ae(M.prototype.request,t);return a.extend(n,M.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return at($(e,s))},n}const O=at(W);O.Axios=M,O.CanceledError=G,O.CancelToken=vn,O.isCancel=ze,O.VERSION=ot,O.toFormData=ne,O.AxiosError=y,O.Cancel=O.CanceledError,O.all=function(t){return Promise.all(t)},O.spread=Jn,O.isAxiosError=Vn,O.mergeConfig=$,O.AxiosHeaders=x,O.formToJSON=e=>qe(a.isHTMLForm(e)?new FormData(e):e),O.getAdapter=rt.getAdapter,O.HttpStatusCode=Se,O.default=O;const{Axios:ir,AxiosError:ar,CanceledError:cr,isCancel:lr,CancelToken:ur,VERSION:fr,all:dr,Cancel:pr,isAxiosError:mr,spread:hr,toFormData:wr,AxiosHeaders:yr,HttpStatusCode:Er,formToJSON:br,getAdapter:gr,mergeConfig:Sr}=O,Kn="https://customers-services.tarxemo.com/api";class ct{constructor(t,n=Kn){gt(this,"client");this.client=O.create({baseURL:n,headers:{"Content-Type":"application/json","X-API-Key":t},timeout:3e4}),this.client.interceptors.response.use(r=>r,r=>{var s,o;if((s=r.response)!=null&&s.data){const c=((o=r.response.data.response)==null?void 0:o.message)||"An unknown error occurred";throw new Error(c)}else throw r.request?new Error("No response from server. Please check your connection."):new Error(r.message||"Request failed")})}async sendMessage(t,n){try{const r=await this.client.post("/chat/",{question:t,session_id:n});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 send message")}}async getConversationHistory(t){try{const n=await this.client.get(`/chat/history/${t}/`);if(n.data.response.status!=="success")throw new Error(n.data.response.message);return n.data.data}catch(n){throw n instanceof Error?n: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 Oe(e,t){const[n,r]=p.useState(()=>{try{const o=window.localStorage.getItem(e);return o?JSON.parse(o):t}catch(o){return console.warn(`Error reading localStorage key "${e}":`,o),t}});return[n,o=>{try{const i=o instanceof Function?o(n):o;r(i),window.localStorage.setItem(e,JSON.stringify(i))}catch(i){console.warn(`Error setting localStorage key "${e}":`,i)}}]}function lt(){return`session_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}const Wn="customer_support_session_id",Xn="customer_support_messages";function ut(e){const{apiKey:t,baseUrl:n,onError:r}=e,[s,o]=Oe(Xn,[]),[i,c]=Oe(Wn,lt()),[d,u]=p.useState(!1),[l,m]=p.useState(null),b=p.useRef(null);p.useEffect(()=>{b.current=new ct(t,n)},[t,n]);const A=p.useCallback(()=>{m(null)},[]),f=p.useCallback(async S=>{if(!b.current){const g=new Error("API client not initialized");m(g),r==null||r(g);return}if(!S.trim())return;const _={id:`user_${Date.now()}`,role:"USER",content:S,timestamp:new Date};o(g=>[...g,_]),u(!0),m(null);try{const g=await b.current.sendMessage(S,i),E={id:`assistant_${Date.now()}`,role:"ASSISTANT",content:g.answer,timestamp:new Date,sources:g.sources};o(R=>[...R,E]),g.session_id!==i&&c(g.session_id)}catch(g){const E=g instanceof Error?g:new Error("Failed to send message");m(E),r==null||r(E);const R={id:`error_${Date.now()}`,role:"ASSISTANT",content:`Sorry, I encountered an error: ${E.message}`,timestamp:new Date};o(k=>[...k,R])}finally{u(!1)}},[i,r,o,c]),w=p.useCallback(async()=>{if(!(!b.current||!i)){u(!0),m(null);try{const _=(await b.current.getConversationHistory(i)).messages.map((g,E)=>({id:`${g.role.toLowerCase()}_${E}_${Date.now()}`,role:g.role,content:g.content,timestamp:new Date(g.created_at)}));o(_)}catch(S){const _=S instanceof Error?S:new Error("Failed to load history");m(_),r==null||r(_)}finally{u(!1)}}},[i,r,o]),h=p.useCallback(()=>{o([]),c(lt())},[o,c]);return{messages:s,sendMessage:f,isLoading:d,error:l,clearError:A,sessionId:i,loadHistory:w,clearHistory:h}}const ft=({message:e})=>{const t=e.role==="USER",n=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((r,s)=>p.createElement("li",{key:s,className:"cs-message__source-item"},p.createElement("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"cs-message__source-link"},p.createElement(F.ExternalLink,{size:12}),p.createElement("span",null,r.title)),p.createElement("span",{className:"cs-message__source-similarity"},Math.round(r.similarity*100),"% match")))))),p.createElement("time",{className:"cs-message__time",dateTime:n.toISOString()},n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})))},dt=({onSendMessage:e,isLoading:t,placeholder:n="Type your message..."})=>{const[r,s]=p.useState(""),o=c=>{c.preventDefault(),r.trim()&&!t&&(e(r),s(""))},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:r,onChange:c=>s(c.target.value),onKeyDown:i,placeholder:n,disabled:t,rows:1,"aria-label":"Message input"}),p.createElement("button",{type:"submit",className:"cs-input__button",disabled:!r.trim()||t,"aria-label":"Send message"},p.createElement(F.Send,{size:20})))},pt=({messages:e,onSendMessage:t,onClose:n,isLoading:r,error:s,placeholder:o,welcomeMessage:i="Hi! How can I help you today?"})=>{const c=p.useRef(null);return p.useEffect(()=>{var d;(d=c.current)==null||d.scrollIntoView({behavior:"smooth"})},[e]),p.createElement("div",{className:"cs-window"},p.createElement("div",{className:"cs-window__header"},p.createElement("h3",{className:"cs-window__title"},"Customer Support"),p.createElement("button",{className:"cs-window__close",onClick:n,"aria-label":"Close chat"},p.createElement(F.X,{size:20}))),p.createElement("div",{className:"cs-window__messages"},e.length===0&&!r&&p.createElement("div",{className:"cs-window__welcome"},p.createElement("p",null,i)),e.map(d=>p.createElement(ft,{key:d.id,message:d})),r&&p.createElement("div",{className:"cs-window__typing"},p.createElement(F.Loader2,{size:20,className:"cs-window__typing-icon"}),p.createElement("span",null,"Thinking...")),s&&p.createElement("div",{className:"cs-window__error"},p.createElement("p",null,s.message)),p.createElement("div",{ref:c})),p.createElement("div",{className:"cs-window__input-wrapper"},p.createElement(dt,{onSendMessage:t,isLoading:r,placeholder:o})))},Gn=({apiKey:e,baseUrl:t,theme:n,position:r="bottom-right",welcomeMessage:s,placeholder:o,className:i="",onError:c,onMessageSent:d,onMessageReceived:u})=>{const[l,m]=p.useState(!1),{messages:b,sendMessage:A,isLoading:f,error:w,clearError:h}=ut({apiKey:e,baseUrl:t,onError:c}),S=p.useMemo(()=>{const E={};return E["--cs-primary-color"]=(n==null?void 0:n.primaryColor)||"#6366f1",E["--cs-secondary-color"]=(n==null?void 0:n.secondaryColor)||(n==null?void 0:n.primaryColor)||"#8b5cf6",E["--cs-bg-color"]=(n==null?void 0:n.backgroundColor)||"#ffffff",E["--cs-text-color"]=(n==null?void 0:n.textColor)||"#1f2937",E["--cs-font-family"]=(n==null?void 0:n.fontFamily)||"inherit",E["--cs-border-radius"]=(n==null?void 0:n.borderRadius)||"12px",E["--cs-button-color"]=(n==null?void 0:n.buttonColor)||(n==null?void 0:n.primaryColor)||"#6366f1",E["--cs-user-message-color"]=(n==null?void 0:n.userMessageColor)||(n==null?void 0:n.primaryColor)||"#6366f1",E["--cs-assistant-message-color"]=(n==null?void 0:n.assistantMessageColor)||"#f3f4f6",n!=null&&n.primaryColor&&(E["--cs-focus-ring"]=`${n.primaryColor}33`),E},[n]),_=async E=>{if(d==null||d(E),await A(E),!w){const R=b[b.length-1];(R==null?void 0:R.role)==="ASSISTANT"&&(u==null||u(R.content))}},g=()=>{m(!l),w&&h()};return p.createElement("div",{className:`cs-widget cs-widget--${r} ${l?"cs-widget--open":""} ${i}`,style:S},l&&p.createElement(pt,{messages:b,onSendMessage:_,onClose:()=>m(!1),isLoading:f,error:w,placeholder:o,welcomeMessage:s}),p.createElement("button",{className:`cs-widget__toggle ${l?"cs-widget__toggle--open":""}`,onClick:g,"aria-label":l?"Close chat":"Open chat","aria-expanded":l},p.createElement(F.MessageCircle,{size:24}),!l&&b.length>0&&p.createElement("span",{className:"cs-widget__badge"},b.filter(E=>E.role==="ASSISTANT").length)))};T.ChatInput=dt,T.ChatMessage=ft,T.ChatWindow=pt,T.CustomerSupportAPIClient=ct,T.CustomerSupportWidget=Gn,T.useCustomerSupport=ut,T.useLocalStorage=Oe,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
|
|
7
7
|
//# sourceMappingURL=index.umd.js.map
|