react-aichatbot-widget 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # React AI Chatbot Widget
2
+
3
+ A React chatbot widget using **React**, **TailwindCSS**, **Axios**, and **Lucide Icons**.
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ ### Step 1: Install the Widget
10
+
11
+ ```bash
12
+ npm install react-ai-chatbot-widget
13
+ ```
14
+
15
+ > `axios` is included with the widget and does not need to be installed separately.
16
+
17
+ ### Step 2: Install Peer Dependencies
18
+
19
+ ```bash
20
+ npm install react react-dom tailwindcss lucide-react
21
+ ```
22
+
23
+ > Ensure versions match your project.
24
+
25
+ | Package | Version | | |
26
+ | -------------- | -------- | - | ------- |
27
+ | `react` | ^18.0.0 | | ^19.0.0 |
28
+ | `react-dom` | ^18.0.0 | | ^19.0.0 |
29
+ | `tailwindcss` | ^4.1.17 | | |
30
+ | `lucide-react` | ^0.554.0 | | |
31
+ | `axios` | ^1.6.0 | | |
32
+ | `uuid` | ^13.0.0 | | |
33
+
34
+ ---
35
+
36
+ ## Usage Example
37
+
38
+ ```jsx
39
+ import React from "react";
40
+ import ChatBotWidget from "react-ai-chatbot-widget";
41
+
42
+ function App() {
43
+ return (
44
+ <div className="App">
45
+ {/*add a namespace for chatbot and chatbot url*/}
46
+ <ChatBotWidget
47
+ pineconeNamespace=''
48
+ chatbotHostURL=''
49
+ />
50
+ </div>
51
+ );
52
+ }
53
+
54
+ export default App;
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Notes
60
+
61
+ * `axios` & `uuid` is bundled; no extra installation required.
62
+ * TailwindCSS is required if you want to customize styles.
63
+ * React and ReactDOM must match the versions listed above.
package/dist/index.cjs ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";const m=require("react/jsx-runtime"),C=require("react"),$=require("lucide-react"),Et=({onClick:e})=>m.jsxs("button",{onClick:e,"aria-label":"Open chat support",className:"fixed bottom-8 right-8 z-50 w-14 h-14 bg-gradient-to-br from-sky-500 to-sky-600 hover:from-sky-600 hover:to-sky-700 text-white rounded-full shadow-2xl flex items-center justify-center transition-all duration-300 hover:scale-110 focus:outline-none focus:ring-4 focus:ring-sky-400/50",children:[m.jsx($.MessageCircle,{size:30,strokeWidth:2.2}),m.jsx("span",{className:"absolute -top-1 -right-1 w-3 h-3 bg-emerald-400 rounded-full border-2 border-white animate-pulse shadow-lg"})]}),St=({onSendMessage:e,isLoading:t})=>{const[n,r]=C.useState(""),s=()=>{!n.trim()||t||(e(n.trim()),r(""))},i=o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),s())};return m.jsx("div",{className:"p-4 border-t bg-white flex-shrink-0",children:m.jsxs("div",{className:"flex gap-3",children:[m.jsx("input",{type:"text",placeholder:"Type a message...",value:n,onChange:o=>r(o.target.value),onKeyPress:i,disabled:t,className:"flex-1 px-4 py-3 border border-neutral-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-sky-500 focus:border-transparent transition-shadow placeholder-neutral-400 text-sm disabled:opacity-50 disabled:cursor-not-allowed"}),m.jsx("button",{onClick:s,disabled:t||!n.trim(),className:"bg-sky-600 hover:bg-sky-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-5 py-3 rounded-xl font-medium transition-colors shadow-md hover:shadow-lg flex items-center gap-2","aria-label":"Send message",children:m.jsx($.Send,{size:18})})]})})},Rt=({messages:e,isLoading:t})=>{const n=C.useRef(null),r=()=>{var s;(s=n.current)==null||s.scrollIntoView({behavior:"smooth"})};return C.useEffect(()=>{r()},[e,t]),m.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4 bg-neutral-50",children:[e.map((s,i)=>m.jsx("div",{className:`flex ${s.type==="user"?"justify-end":""}`,children:m.jsx("div",{className:`px-4 py-3 rounded-2xl shadow-sm border border-neutral-200 max-w-[80%] text-sm leading-relaxed ${s.type==="user"?"bg-sky-600 text-white rounded-br-none":"bg-white text-neutral-800 rounded-bl-none"}`,children:s.text})},i)),t&&m.jsx("div",{className:"flex",children:m.jsx("div",{className:"bg-white text-neutral-800 px-4 py-3 rounded-2xl rounded-bl-none shadow-sm border border-neutral-200 max-w-[80%] text-sm leading-relaxed",children:m.jsx($.Ellipsis,{className:"animate-pulse"})})}),m.jsx("div",{ref:n})]})};function Xe(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ot}=Object.prototype,{getPrototypeOf:Se}=Object,{iterator:ae,toStringTag:Ge}=Symbol,le=(e=>t=>{const n=Ot.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),U=e=>(e=e.toLowerCase(),t=>le(t)===e),ce=e=>t=>typeof t===e,{isArray:V}=Array,z=ce("undefined");function X(e){return e!==null&&!z(e)&&e.constructor!==null&&!z(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Qe=U("ArrayBuffer");function Tt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Qe(e.buffer),t}const At=ce("string"),A=ce("function"),Ze=ce("number"),G=e=>e!==null&&typeof e=="object",Nt=e=>e===!0||e===!1,re=e=>{if(le(e)!=="object")return!1;const t=Se(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ge in e)&&!(ae in e)},Ct=e=>{if(!G(e)||X(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},jt=U("Date"),Pt=U("File"),Ft=U("Blob"),Ut=U("FileList"),kt=e=>G(e)&&A(e.pipe),_t=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||A(e.append)&&((t=le(e))==="formdata"||t==="object"&&A(e.toString)&&e.toString()==="[object FormData]"))},Dt=U("URLSearchParams"),[Lt,Bt,It,qt]=["ReadableStream","Request","Response","Headers"].map(U),vt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Q(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),V(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(X(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let l;for(r=0;r<o;r++)l=i[r],t.call(null,e[l],l,e)}}function Ye(e,t){if(X(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 q=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,et=e=>!z(e)&&e!==q;function we(){const{caseless:e,skipUndefined:t}=et(this)&&this||{},n={},r=(s,i)=>{const o=e&&Ye(n,i)||i;re(n[o])&&re(s)?n[o]=we(n[o],s):re(s)?n[o]=we({},s):V(s)?n[o]=s.slice():(!t||!z(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Q(arguments[s],r);return n}const Ht=(e,t,n,{allOwnKeys:r}={})=>(Q(t,(s,i)=>{n&&A(s)?e[i]=Xe(s,n):e[i]=s},{allOwnKeys:r}),e),Mt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),$t=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},zt=(e,t,n,r)=>{let s,i,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&Se(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(V(e))return e;let t=e.length;if(!Ze(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Wt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Se(Uint8Array)),Kt=(e,t)=>{const r=(e&&e[ae]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Xt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Gt=U("HTMLFormElement"),Qt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ue=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Zt=U("RegExp"),tt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Q(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Yt=e=>{tt(e,(t,n)=>{if(A(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(A(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+"'")})}})},en=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return V(e)?r(e):r(String(e).split(t)),n},tn=()=>{},nn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function rn(e){return!!(e&&A(e.append)&&e[Ge]==="FormData"&&e[ae])}const sn=e=>{const t=new Array(10),n=(r,s)=>{if(G(r)){if(t.indexOf(r)>=0)return;if(X(r))return r;if(!("toJSON"in r)){t[s]=r;const i=V(r)?[]:{};return Q(r,(o,l)=>{const f=n(o,s+1);!z(f)&&(i[l]=f)}),t[s]=void 0,i}}return r};return n(e,0)},on=U("AsyncFunction"),an=e=>e&&(G(e)||A(e))&&A(e.then)&&A(e.catch),nt=((e,t)=>e?setImmediate:t?((n,r)=>(q.addEventListener("message",({source:s,data:i})=>{s===q&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),q.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",A(q.postMessage)),ln=typeof queueMicrotask<"u"?queueMicrotask.bind(q):typeof process<"u"&&process.nextTick||nt,cn=e=>e!=null&&A(e[ae]),a={isArray:V,isArrayBuffer:Qe,isBuffer:X,isFormData:_t,isArrayBufferView:Tt,isString:At,isNumber:Ze,isBoolean:Nt,isObject:G,isPlainObject:re,isEmptyObject:Ct,isReadableStream:Lt,isRequest:Bt,isResponse:It,isHeaders:qt,isUndefined:z,isDate:jt,isFile:Pt,isBlob:Ft,isRegExp:Zt,isFunction:A,isStream:kt,isURLSearchParams:Dt,isTypedArray:Wt,isFileList:Ut,forEach:Q,merge:we,extend:Ht,trim:vt,stripBOM:Mt,inherits:$t,toFlatObject:zt,kindOf:le,kindOfTest:U,endsWith:Vt,toArray:Jt,forEachEntry:Kt,matchAll:Xt,isHTMLForm:Gt,hasOwnProperty:Ue,hasOwnProp:Ue,reduceDescriptors:tt,freezeMethods:Yt,toObjectSet:en,toCamelCase:Qt,noop:tn,toFiniteNumber:nn,findKey:Ye,global:q,isContextDefined:et,isSpecCompliantForm:rn,toJSONObject:sn,isAsyncFn:on,isThenable:an,setImmediate:nt,asap:ln,isIterable:cn};function y(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(y,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const rt=y.prototype,st={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{st[e]={value:e}});Object.defineProperties(y,st);Object.defineProperty(rt,"isAxiosError",{value:!0});y.from=(e,t,n,r,s,i)=>{const o=Object.create(rt);a.toFlatObject(e,o,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return y.call(o,l,f,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const un=null;function ge(e){return a.isPlainObject(e)||a.isArray(e)}function ot(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function ke(e,t,n){return e?e.concat(t).map(function(s,i){return s=ot(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function dn(e){return a.isArray(e)&&!e.some(ge)}const fn=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ue(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(b,h){return!a.isUndefined(h[b])});const r=n.metaTokens,s=n.visitor||c,i=n.dots,o=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))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 y("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 c(d,b,h){let E=d;if(d&&!h&&typeof d=="object"){if(a.endsWith(b,"{}"))b=r?b:b.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&dn(d)||(a.isFileList(d)||a.endsWith(b,"[]"))&&(E=a.toArray(d)))return b=ot(b),E.forEach(function(S,T){!(a.isUndefined(S)||S===null)&&t.append(o===!0?ke([b],T,i):o===null?b:b+"[]",u(S))}),!1}return ge(d)?!0:(t.append(ke(h,b,i),u(d)),!1)}const p=[],w=Object.assign(fn,{defaultVisitor:c,convertValue:u,isVisitable:ge});function g(d,b){if(!a.isUndefined(d)){if(p.indexOf(d)!==-1)throw Error("Circular reference detected in "+b.join("."));p.push(d),a.forEach(d,function(E,j){(!(a.isUndefined(E)||E===null)&&s.call(t,E,a.isString(j)?j.trim():j,b,w))===!0&&g(E,b?b.concat(j):[j])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return g(e),t}function _e(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Re(e,t){this._pairs=[],e&&ue(e,this,t)}const it=Re.prototype;it.append=function(t,n){this._pairs.push([t,n])};it.toString=function(t){const n=t?function(r){return t.call(this,r,_e)}:_e;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function hn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function at(e,t,n){if(!t)return e;const r=n&&n.encode||hn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new Re(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class De{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 lt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},pn=typeof URLSearchParams<"u"?URLSearchParams:Re,mn=typeof FormData<"u"?FormData:null,bn=typeof Blob<"u"?Blob:null,yn={isBrowser:!0,classes:{URLSearchParams:pn,FormData:mn,Blob:bn},protocols:["http","https","file","blob","url","data"]},Oe=typeof window<"u"&&typeof document<"u",xe=typeof navigator=="object"&&navigator||void 0,wn=Oe&&(!xe||["ReactNative","NativeScript","NS"].indexOf(xe.product)<0),gn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",xn=Oe&&window.location.href||"http://localhost",En=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Oe,hasStandardBrowserEnv:wn,hasStandardBrowserWebWorkerEnv:gn,navigator:xe,origin:xn},Symbol.toStringTag,{value:"Module"})),O={...En,...yn};function Sn(e,t){return ue(e,new O.classes.URLSearchParams,{visitor:function(n,r,s,i){return O.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Rn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function On(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function ct(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),f=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,f?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=On(s[o])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Rn(r),s,n,0)}),n}return null}function Tn(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 Z={transitional:lt,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(ct(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 l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Sn(t,this.formSerializer).toString();if((l=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return ue(l?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Tn(t)):t}],transformResponse:[function(t){const n=this.transitional||Z.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 o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?y.from(l,y.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:O.classes.FormData,Blob:O.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=>{Z.headers[e]={}});const An=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"]),Nn=e=>{const t={};let n,r,s;return e&&e.split(`
2
+ `).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&An[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Le=Symbol("internals");function K(e){return e&&String(e).trim().toLowerCase()}function se(e){return e===!1||e==null?e:a.isArray(e)?e.map(se):String(e)}function Cn(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 jn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function pe(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 Pn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Fn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let N=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(l,f,u){const c=K(f);if(!c)throw new Error("header name must be a non-empty string");const p=a.findKey(s,c);(!p||s[p]===void 0||u===!0||u===void 0&&s[p]!==!1)&&(s[p||f]=se(l))}const o=(l,f)=>a.forEach(l,(u,c)=>i(u,c,f));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!jn(t))o(Nn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let l={},f,u;for(const c of t){if(!a.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[u=c[0]]=(f=l[u])?a.isArray(f)?[...f,c[1]]:[f,c[1]]:c[1]}o(l,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=K(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Cn(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=K(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||pe(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=K(o),o){const l=a.findKey(r,o);l&&(!n||pe(r,r[l],l,n))&&(delete r[l],s=!0)}}return a.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||pe(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,i)=>{const o=a.findKey(r,i);if(o){n[o]=se(s),delete n[i];return}const l=t?Pn(i):String(i).trim();l!==i&&delete n[i],n[l]=se(s),r[l]=!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[Le]=this[Le]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=K(o);r[l]||(Fn(s,o),r[l]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};N.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(N.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(N);function me(e,t){const n=this||Z,r=t||n,s=N.from(r.headers);let i=r.data;return a.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function ut(e){return!!(e&&e.__CANCEL__)}function J(e,t,n){y.call(this,e??"canceled",y.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(J,y,{__CANCEL__:!0});function dt(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 Un(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function kn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const u=Date.now(),c=r[i];o||(o=u),n[s]=f,r[s]=u;let p=i,w=0;for(;p!==s;)w+=n[p++],p=p%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const g=c&&u-c;return g?Math.round(w*1e3/g):void 0}}function _n(e,t){let n=0,r=1e3/t,s,i;const o=(u,c=Date.now())=>{n=c,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const c=Date.now(),p=c-n;p>=r?o(u,c):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-p)))},()=>s&&o(s)]}const ie=(e,t,n=3)=>{let r=0;const s=kn(50,250);return _n(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,f=o-r,u=s(f),c=o<=l;r=o;const p={loaded:o,total:l,progress:l?o/l:void 0,bytes:f,rate:u||void 0,estimated:u&&l&&c?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(p)},n)},Be=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ie=e=>(...t)=>a.asap(()=>e(...t)),Dn=O.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,O.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(O.origin),O.navigator&&/(msie|trident)/i.test(O.navigator.userAgent)):()=>!0,Ln=O.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&l.push(`path=${r}`),a.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),a.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.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 Bn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function In(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ft(e,t,n){let r=!Bn(t);return e&&(r||n==!1)?In(e,t):t}const qe=e=>e instanceof N?{...e}:e;function H(e,t){t=t||{};const n={};function r(u,c,p,w){return a.isPlainObject(u)&&a.isPlainObject(c)?a.merge.call({caseless:w},u,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(u,c,p,w){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u,p,w)}else return r(u,c,p,w)}function i(u,c){if(!a.isUndefined(c))return r(void 0,c)}function o(u,c){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function l(u,c,p){if(p in t)return r(u,c);if(p in e)return r(void 0,u)}const f={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,c,p)=>s(qe(u),qe(c),p,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const p=f[c]||s,w=p(e[c],t[c],c);a.isUndefined(w)&&p!==l||(n[c]=w)}),n}const ht=e=>{const t=H({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=N.from(o),t.url=at(ft(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(O.hasStandardBrowserEnv||O.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const f=n.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([c,p])=>{u.includes(c.toLowerCase())&&o.set(c,p)})}}if(O.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Dn(t.url))){const f=s&&i&&Ln.read(i);f&&o.set(s,f)}return t},qn=typeof XMLHttpRequest<"u",vn=qn&&function(e){return new Promise(function(n,r){const s=ht(e);let i=s.data;const o=N.from(s.headers).normalize();let{responseType:l,onUploadProgress:f,onDownloadProgress:u}=s,c,p,w,g,d;function b(){g&&g(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function E(){if(!h)return;const S=N.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),F={data:!l||l==="text"||l==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:S,config:e,request:h};dt(function(P){n(P),b()},function(P){r(P),b()},F),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&&(r(new y("Request aborted",y.ECONNABORTED,e,h)),h=null)},h.onerror=function(T){const F=T&&T.message?T.message:"Network Error",B=new y(F,y.ERR_NETWORK,e,h);B.event=T||null,r(B),h=null},h.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const F=s.transitional||lt;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new y(T,F.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&a.forEach(o.toJSON(),function(T,F){h.setRequestHeader(F,T)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),l&&l!=="json"&&(h.responseType=s.responseType),u&&([w,d]=ie(u,!0),h.addEventListener("progress",w)),f&&h.upload&&([p,g]=ie(f),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(c=S=>{h&&(r(!S||S.type?new J(null,e,h):S),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const j=Un(s.url);if(j&&O.protocols.indexOf(j)===-1){r(new y("Unsupported protocol "+j+":",y.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Hn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,l();const c=u instanceof Error?u:this.reason;r.abort(c instanceof y?c:new J(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new y(`timeout ${t} of ms exceeded`,y.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:f}=r;return f.unsubscribe=()=>a.asap(l),f}},Mn=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},$n=async function*(e,t){for await(const n of zn(e))yield*Mn(n,t)},zn=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()}},ve=(e,t,n,r)=>{const s=$n(e,t);let i=0,o,l=f=>{o||(o=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:u,value:c}=await s.next();if(u){l(),f.close();return}let p=c.byteLength;if(n){let w=i+=p;n(w)}f.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(f){return l(f),s.return()}},{highWaterMark:2})},He=64*1024,{isFunction:ne}=a,Vn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Me,TextEncoder:$e}=a.global,ze=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Jn=e=>{e=a.merge.call({skipUndefined:!0},Vn,e);const{fetch:t,Request:n,Response:r}=e,s=t?ne(t):typeof fetch=="function",i=ne(n),o=ne(r);if(!s)return!1;const l=s&&ne(Me),f=s&&(typeof $e=="function"?(d=>b=>d.encode(b))(new $e):async d=>new Uint8Array(await new n(d).arrayBuffer())),u=i&&l&&ze(()=>{let d=!1;const b=new n(O.origin,{body:new Me,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!b}),c=o&&l&&ze(()=>a.isReadableStream(new r("").body)),p={stream:c&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!p[d]&&(p[d]=(b,h)=>{let E=b&&b[d];if(E)return E.call(b);throw new y(`Response type '${d}' is not supported`,y.ERR_NOT_SUPPORT,h)})});const w=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new n(O.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},g=async(d,b)=>{const h=a.toFiniteNumber(d.getContentLength());return h??w(b)};return async d=>{let{url:b,method:h,data:E,signal:j,cancelToken:S,timeout:T,onDownloadProgress:F,onUploadProgress:B,responseType:P,headers:fe,withCredentials:Y="same-origin",fetchOptions:Ae}=ht(d),Ne=t||fetch;P=P?(P+"").toLowerCase():"text";let ee=Hn([j,S&&S.toAbortSignal()],T),W=null;const I=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let Ce;try{if(B&&u&&h!=="get"&&h!=="head"&&(Ce=await g(fe,E))!==0){let L=new n(b,{method:"POST",body:E,duplex:"half"}),M;if(a.isFormData(E)&&(M=L.headers.get("content-type"))&&fe.setContentType(M),L.body){const[he,te]=Be(Ce,ie(Ie(B)));E=ve(L.body,He,he,te)}}a.isString(Y)||(Y=Y?"include":"omit");const k=i&&"credentials"in n.prototype,je={...Ae,signal:ee,method:h.toUpperCase(),headers:fe.normalize().toJSON(),body:E,duplex:"half",credentials:k?Y:void 0};W=i&&new n(b,je);let D=await(i?Ne(W,Ae):Ne(b,je));const Pe=c&&(P==="stream"||P==="response");if(c&&(F||Pe&&I)){const L={};["status","statusText","headers"].forEach(Fe=>{L[Fe]=D[Fe]});const M=a.toFiniteNumber(D.headers.get("content-length")),[he,te]=F&&Be(M,ie(Ie(F),!0))||[];D=new r(ve(D.body,He,he,()=>{te&&te(),I&&I()}),L)}P=P||"text";let xt=await p[a.findKey(p,P)||"text"](D,d);return!Pe&&I&&I(),await new Promise((L,M)=>{dt(L,M,{data:xt,headers:N.from(D.headers),status:D.status,statusText:D.statusText,config:d,request:W})})}catch(k){throw I&&I(),k&&k.name==="TypeError"&&/Load failed|fetch/i.test(k.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,d,W),{cause:k.cause||k}):y.from(k,k&&k.code,d,W)}}},Wn=new Map,pt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,f,u,c=Wn;for(;l--;)f=i[l],u=c.get(f),u===void 0&&c.set(f,u=l?new Map:Jn(t)),c=u;return u};pt();const Te={http:un,xhr:vn,fetch:{get:pt}};a.forEach(Te,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ve=e=>`- ${e}`,Kn=e=>a.isFunction(e)||e===null||e===!1;function Xn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let l;if(s=r,!Kn(r)&&(s=Te[(l=String(r)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${l}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[l||"#"+o]=s}if(!s){const o=Object.entries(i).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
4
+ `+o.map(Ve).join(`
5
+ `):" "+Ve(o[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const mt={getAdapter:Xn,adapters:Te};function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new J(null,e)}function Je(e){return be(e),e.headers=N.from(e.headers),e.data=me.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),mt.getAdapter(e.adapter||Z.adapter,e)(e).then(function(r){return be(e),r.data=me.call(e,e.transformResponse,r),r.headers=N.from(r.headers),r},function(r){return ut(r)||(be(e),r&&r.response&&(r.response.data=me.call(e,e.transformResponse,r.response),r.response.headers=N.from(r.response.headers))),Promise.reject(r)})}const bt="1.13.2",de={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{de[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const We={};de.transitional=function(t,n,r){function s(i,o){return"[Axios v"+bt+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new y(s(o," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!We[o]&&(We[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};de.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Gn(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 i=r[s],o=t[i];if(o){const l=e[i],f=l===void 0||o(l,i,e);if(f!==!0)throw new y("option "+i+" must be "+f,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+i,y.ERR_BAD_OPTION)}}const oe={assertOptions:Gn,validators:de},_=oe.validators;let v=class{constructor(t){this.defaults=t||{},this.interceptors={request:new De,response:new De}}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 i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
6
+ `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=H(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&oe.assertOptions(r,{silentJSONParsing:_.transitional(_.boolean),forcedJSONParsing:_.transitional(_.boolean),clarifyTimeoutError:_.transitional(_.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:oe.assertOptions(s,{encode:_.function,serialize:_.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),oe.assertOptions(n,{baseUrl:_.spelling("baseURL"),withXsrfToken:_.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),n.headers=N.concat(o,i);const l=[];let f=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(f=f&&b.synchronous,l.unshift(b.fulfilled,b.rejected))});const u=[];this.interceptors.response.forEach(function(b){u.push(b.fulfilled,b.rejected)});let c,p=0,w;if(!f){const d=[Je.bind(this),void 0];for(d.unshift(...l),d.push(...u),w=d.length,c=Promise.resolve(n);p<w;)c=c.then(d[p++],d[p++]);return c}w=l.length;let g=n;for(;p<w;){const d=l[p++],b=l[p++];try{g=d(g)}catch(h){b.call(this,h);break}}try{c=Je.call(this,g)}catch(d){return Promise.reject(d)}for(p=0,w=u.length;p<w;)c=c.then(u[p++],u[p++]);return c}getUri(t){t=H(this.defaults,t);const n=ft(t.baseURL,t.url,t.allowAbsoluteUrls);return at(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){v.prototype[t]=function(n,r){return this.request(H(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,l){return this.request(H(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}v.prototype[t]=n(),v.prototype[t+"Form"]=n(!0)});let Qn=class yt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new J(i,o,l),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 yt(function(s){t=s}),cancel:t}}};function Zn(e){return function(n){return e.apply(null,n)}}function Yn(e){return a.isObject(e)&&e.isAxiosError===!0}const Ee={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(Ee).forEach(([e,t])=>{Ee[t]=e});function wt(e){const t=new v(e),n=Xe(v.prototype.request,t);return a.extend(n,v.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return wt(H(e,s))},n}const x=wt(Z);x.Axios=v;x.CanceledError=J;x.CancelToken=Qn;x.isCancel=ut;x.VERSION=bt;x.toFormData=ue;x.AxiosError=y;x.Cancel=x.CanceledError;x.all=function(t){return Promise.all(t)};x.spread=Zn;x.isAxiosError=Yn;x.mergeConfig=H;x.AxiosHeaders=N;x.formToJSON=e=>ct(a.isHTMLForm(e)?new FormData(e):e);x.getAdapter=mt.getAdapter;x.HttpStatusCode=Ee;x.default=x;const{Axios:dr,AxiosError:fr,CanceledError:hr,isCancel:pr,CancelToken:mr,VERSION:br,all:yr,Cancel:wr,isAxiosError:gr,spread:xr,toFormData:Er,AxiosHeaders:Sr,HttpStatusCode:Rr,formToJSON:Or,getAdapter:Tr,mergeConfig:Ar}=x,gt=async(e,t,n,r)=>{const s={chatInput:e,sessionId:t,metadata:{pinecone_namespace:n}};try{return(await x.post(r,s,{headers:{"Content-Type":"application/json"}})).data.output}catch(i){throw console.error("Error communicating with chat API:",i),i}},er=({handleMessageFromForm:e,sessionId:t,pineconeNamespace:n,chatbotHostURL:r})=>{const[s,i]=C.useState(""),[o,l]=C.useState(""),[f,u]=C.useState(""),[c,p]=C.useState(!1),w=async g=>{if(g.preventDefault(),p(!0),u(""),!s.trim()||!o.trim()){u("Name and email are required");return}const d=`Hi, I am ${s} and my email is ${o}`;try{const h=(await gt(d,t,n,r)).response;e([{type:"user",text:d},{type:"bot",text:h}])}catch(b){console.log("error sending user details",b),u("Failed to submit. Please try again.")}finally{p(!1)}i(""),l("")};return m.jsx("div",{className:"p-5 border-t bg-white flex-shrink-0",children:m.jsxs("form",{onSubmit:w,className:"flex flex-col gap-6",children:[f&&m.jsx("div",{className:"bg-red-100 text-neutral-800 p-2 rounded relative text-center text-sm",role:"alert",children:f}),m.jsx("p",{className:"text-neutral-700 text-sm font-medium",children:"Please enter your details to get started."}),m.jsxs("div",{className:"flex flex-col gap-5",children:[m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("label",{className:"text-sm text-neutral-700",children:"Full Name"}),m.jsx("input",{type:"text",placeholder:"Enter your full name",value:s,onChange:g=>{i(g.target.value),u("")},className:"w-full px-3 py-2 border border-neutral-300 rounded-xl bg-neutral-50",required:!0})]}),m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("label",{className:"text-sm text-neutral-700",children:"Email Address"}),m.jsx("input",{type:"email",placeholder:"Enter your email",value:o,onChange:g=>{l(g.target.value),u("")},className:"w-full px-3 py-2 border border-neutral-300 rounded-xl bg-neutral-50",required:!0})]})]}),m.jsx("button",{type:"submit",disabled:!s.trim()||!o.trim()||c,className:`bg-sky-600 hover:bg-sky-700 disabled:opacity-50 \r
7
+ disabled:cursor-not-allowed text-white px-5 py-3 \r
8
+ rounded-xl font-medium flex items-center justify-center gap-2 mt-20`,children:c?"Submitting...":m.jsxs(m.Fragment,{children:[m.jsx($.Send,{size:18})," Submit"]})})]})})},tr=({onClose:e,sessionId:t,pineconeNamespace:n,chatbotHostURL:r})=>{const[s,i]=C.useState([]),[o,l]=C.useState(!1),[f,u]=C.useState(!1),c=w=>{i(w),u(!0)},p=async w=>{l(!0),i(g=>[...g,{type:"user",text:w}]);try{const d=(await gt(w,t,n,r)).response;i(b=>[...b,{type:"bot",text:d}])}catch(g){console.error("Chat error:",g),i(d=>[...d,{type:"bot",text:"Sorry, something went wrong."}])}finally{l(!1)}};return m.jsxs("div",{className:`fixed bottom-28 shadow-xl right-8 z-50 w-96 h-[520px] bg-white/90 \r
9
+ backdrop-blur-xl rounded-2xl border border-neutral-100 \r
10
+ flex flex-col overflow-hidden`,children:[m.jsxs("div",{className:`bg-gradient-to-r from-sky-500 to-sky-600 text-white px-5 py-4\r
11
+ rounded-t-2xl flex items-center justify-between shadow-sm`,children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsxs("div",{className:"relative",children:[m.jsx("div",{className:"w-11 h-11 bg-white/25 rounded-full flex items-center justify-center",children:m.jsx($.MessageCircle,{size:22})}),m.jsx("span",{className:"absolute bottom-0 right-0 w-3.5 h-3.5 bg-emerald-400 rounded-full border-2 border-white"})]}),m.jsxs("div",{children:[m.jsx("h3",{className:"font-semibold text-lg",children:"Swiggy"}),m.jsx("p",{className:"text-xs opacity-90",children:"Virtual assistance"})]})]}),m.jsx("button",{onClick:e,"aria-label":"Close chat",className:"p-2 hover:bg-white/20 rounded-full",children:m.jsx($.X,{size:20})})]}),!f&&m.jsx(er,{handleMessageFromForm:c,sessionId:t,pineconeNamespace:n,chatbotHostURL:r}),f&&m.jsxs(m.Fragment,{children:[m.jsx(Rt,{messages:s,isLoading:o}),m.jsx(St,{onSendMessage:p,isLoading:o})]}),m.jsx("div",{className:"bg-neutral-50 border-t border-neutral-200 px-5 py-3 text-center",children:m.jsxs("p",{className:"text-[11px] text-neutral-500 tracking-wide",children:["powered by ",m.jsx("span",{className:"font-semibold text-neutral-600",children:"clone67.com"})]})})]})},R=[];for(let e=0;e<256;++e)R.push((e+256).toString(16).slice(1));function nr(e,t=0){return(R[e[t+0]]+R[e[t+1]]+R[e[t+2]]+R[e[t+3]]+"-"+R[e[t+4]]+R[e[t+5]]+"-"+R[e[t+6]]+R[e[t+7]]+"-"+R[e[t+8]]+R[e[t+9]]+"-"+R[e[t+10]]+R[e[t+11]]+R[e[t+12]]+R[e[t+13]]+R[e[t+14]]+R[e[t+15]]).toLowerCase()}let ye;const rr=new Uint8Array(16);function sr(){if(!ye){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ye=crypto.getRandomValues.bind(crypto)}return ye(rr)}const or=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ke={randomUUID:or};function ir(e,t,n){var s;e=e||{};const r=e.random??((s=e.rng)==null?void 0:s.call(e))??sr();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,nr(r)}function ar(e,t,n){return Ke.randomUUID&&!e?Ke.randomUUID():ir(e)}function lr({pineconeNamespace:e,chatbotHostURL:t}){const[n,r]=C.useState(!1),[s,i]=C.useState("");C.useEffect(()=>{const l=ar();i(l)},[]);const o=()=>{r(l=>!l)};return m.jsxs("div",{className:"fixed bottom-7 right-7",children:[n&&m.jsx(tr,{onClose:o,sessionId:s,pineconeNamespace:e,chatbotHostURL:t}),m.jsx(Et,{onClick:o})]})}module.exports=lr;