react-aichatbot-widget 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +71 -71
- package/dist/index.cjs +6 -6
- package/dist/index.js +77 -78
- package/package.json +41 -41
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
*** Copyright (c) 2025 Prashanta Pandit ***
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
*** Copyright (c) 2025 Prashanta Pandit ***
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
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-aichatbot-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-aichatbot-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
|
-
url=''
|
|
49
|
-
primaryColor="" // hex color code
|
|
50
|
-
secondaryColor="" // hex color code
|
|
51
|
-
fontColor="" // hex color code
|
|
52
|
-
backgroundColor="" // hex color code
|
|
53
|
-
position="" // left or right
|
|
54
|
-
name="" // any name
|
|
55
|
-
subTitle="" // any subtitle
|
|
56
|
-
welcomeText="" // any welcome text
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default App;
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## Notes
|
|
68
|
-
|
|
69
|
-
* `axios` & `uuid` is bundled; no extra installation required.
|
|
70
|
-
* TailwindCSS is required if you want to customize styles.
|
|
71
|
-
* React and ReactDOM must match the versions listed above.
|
|
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-aichatbot-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-aichatbot-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
|
+
url=''
|
|
49
|
+
primaryColor="" // hex color code
|
|
50
|
+
secondaryColor="" // hex color code
|
|
51
|
+
fontColor="" // hex color code
|
|
52
|
+
backgroundColor="" // hex color code
|
|
53
|
+
position="" // left or right
|
|
54
|
+
name="" // any name
|
|
55
|
+
subTitle="" // any subtitle
|
|
56
|
+
welcomeText="" // any welcome text
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default App;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
|
|
69
|
+
* `axios` & `uuid` is bundled; no extra installation required.
|
|
70
|
+
* TailwindCSS is required if you want to customize styles.
|
|
71
|
+
* React and ReactDOM must match the versions listed above.
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const m=require("react/jsx-runtime"),N=require("react"),
|
|
1
|
+
"use strict";const m=require("react/jsx-runtime"),N=require("react"),z=require("lucide-react"),xt=require("uuid"),gt=({onClick:e,isOpen:t,theme:n,chatBotData:r})=>{const s=r.position==="left",l={position:"fixed",bottom:"32px",left:s?"32px":"auto",right:s?"auto":"32px",background:`linear-gradient(135deg, ${n.primaryColor}, ${n.secondaryColor})`,color:n.fontColor,width:"64px",height:"64px",borderRadius:"50%",border:"none",boxShadow:"0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",pointerEvents:"auto",transition:"all 300ms ease",outline:"none"},p={transform:"scale(1.10)",boxShadow:"0 25px 35px -5px rgba(0,0,0,0.2)"},u={position:"absolute",top:"-4px",right:"-4px",width:"16px",height:"16px",backgroundColor:"#34d399",borderRadius:"50%",border:"4px solid white",animation:"pulse 2s infinite"};return m.jsxs("button",{onClick:e,style:l,onMouseEnter:c=>Object.assign(c.currentTarget.style,p),onMouseLeave:c=>Object.keys(p).forEach(d=>c.currentTarget.style[d]=l[d]||""),onFocus:c=>Object.assign(c.currentTarget.style,p),onBlur:c=>Object.keys(p).forEach(d=>c.currentTarget.style[d]=l[d]||""),children:[t?m.jsx(z.X,{size:30,strokeWidth:2.5}):m.jsx(z.MessageCircle,{size:30,strokeWidth:2.5}),!t&&m.jsx("span",{style:u}),m.jsx("style",{jsx:!0,children:`
|
|
2
2
|
@keyframes pulse {
|
|
3
3
|
0% {
|
|
4
4
|
box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
`})]})},wt=({onSendMessage:e,isLoading:t,theme:n})=>{const[r,s]=N.useState(""),o=()=>{!r.trim()||t||(e(r.trim()),s(""))},i=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),o())},l={padding:"16px",borderTop:"1px solid rgba(255, 255, 255, 0.2)",background:n.backgroundColor,flexShrink:0},p={display:"flex",gap:"12px",alignItems:"center"},u={flex:1,padding:"12px 16px",background:n.inputBackgroundColor||n.backgroundColor,color:n.fontColor,border:`1px solid ${n.fontColor}`,borderRadius:"12px",fontSize:"14px",outline:"none",transition:"all 0.2s ease",opacity:t?.5:1,cursor:t?"not-allowed":"text",boxShadow:"none"},c={padding:"12px 20px",borderRadius:"12px",background:`linear-gradient(135deg, ${n.primaryColor}, ${n.secondaryColor})`,color:n.fontColor,border:"none",cursor:t||!r.trim()?"not-allowed":"pointer",opacity:t||!r.trim()?.5:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontWeight:"600",fontSize:"14px",transition:"all 0.2s ease",minWidth:"48px"};return m.jsx("div",{style:l,children:m.jsxs("div",{style:p,children:[m.jsx("input",{type:"text",placeholder:"Type a message...",value:r,onChange:d=>s(d.target.value),onKeyDown:i,disabled:t,style:u,onFocus:d=>{d.target.style.boxShadow="0 0 0 3px rgba(100, 150, 255, 0.3)",d.target.style.borderColor="#60a5fa"},onBlur:d=>{d.target.style.boxShadow="none",d.target.style.borderColor=n.fontColor}}),m.jsx("button",{onClick:o,disabled:t||!r.trim(),style:c,"aria-label":"Send message",onMouseEnter:d=>{!t&&r.trim()&&(d.currentTarget.style.transform="translateY(-2px)",d.currentTarget.style.boxShadow="0 8px 16px rgba(0,0,0,0.15)")},onMouseLeave:d=>{d.currentTarget.style.transform="translateY(0)",d.currentTarget.style.boxShadow="none"},children:m.jsx(M.Send,{size:18})})]})})},St=({messages:e,isLoading:t,theme:n,botResponseTime:r})=>{const s=N.useRef(null);console.log("Messages in MessageBox:",e);const o=()=>{s.current?.scrollIntoView({behavior:"smooth"})};N.useEffect(()=>{o()},[e,t]);const i={flex:1,overflowY:"auto",padding:"20px",background:n.backgroundColor,color:n.fontColor,borderTop:"1px solid rgba(255, 255, 255, 0.2)",display:"flex",flexDirection:"column",gap:"16px"},l=d=>({display:"flex",justifyContent:d==="user"?"flex-end":"flex-start",width:"100%"}),p={display:"flex",flexDirection:"column",maxWidth:"80%"},u=d=>({padding:"12px 16px",borderRadius:"16px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid #e4e4e7",fontSize:"14px",lineHeight:"1.5",background:d==="user"?n.primaryColor:n.backgroundColor,color:n.fontColor,wordWrap:"break-word"}),c={...u("bot"),animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s"};return m.jsxs("div",{style:i,children:[e.map((d,x)=>m.jsx("div",{style:l(d.type),children:m.jsxs("div",{style:p,children:[d.type==="bot"&&r&&m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-start",marginLeft:"4px",marginBottom:"2px"},children:[m.jsx(M.Bot,{size:14,color:n.fontColor}),m.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:r})]}),d.type==="user"&&m.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-end",marginRight:"4px",marginBottom:"2px"},children:m.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:"You"})}),m.jsx("div",{style:u(d.type),children:d.text})]})},x)),t&&m.jsx("div",{style:l("bot"),children:m.jsx("div",{style:c,children:m.jsx(M.Bot,{size:24})})}),m.jsx("div",{ref:s})]})};function Je(e,t){return function(){return e.apply(t,arguments)}}const{toString:Et}=Object.prototype,{getPrototypeOf:Ee}=Object,{iterator:ce,toStringTag:Ve}=Symbol,ue=(e=>t=>{const n=Et.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),_=e=>(e=e.toLowerCase(),t=>ue(t)===e),de=e=>t=>typeof t===e,{isArray:K}=Array,V=de("undefined");function Q(e){return e!==null&&!V(e)&&e.constructor!==null&&!V(e.constructor)&&P(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ke=_("ArrayBuffer");function Rt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ke(e.buffer),t}const Ct=de("string"),P=de("function"),Xe=de("number"),Z=e=>e!==null&&typeof e=="object",Tt=e=>e===!0||e===!1,oe=e=>{if(ue(e)!=="object")return!1;const t=Ee(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ve in e)&&!(ce in e)},Ot=e=>{if(!Z(e)||Q(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},At=_("Date"),jt=_("File"),kt=_("Blob"),Ft=_("FileList"),Nt=e=>Z(e)&&P(e.pipe),Pt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||P(e.append)&&((t=ue(e))==="formdata"||t==="object"&&P(e.toString)&&e.toString()==="[object FormData]"))},Ut=_("URLSearchParams"),[_t,Lt,Bt,Dt]=["ReadableStream","Request","Response","Headers"].map(_),It=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ee(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),K(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Q(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let l;for(r=0;r<i;r++)l=o[r],t.call(null,e[l],l,e)}}function Ye(e,t){if(Q(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 z=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ge=e=>!V(e)&&e!==z;function xe(){const{caseless:e,skipUndefined:t}=Ge(this)&&this||{},n={},r=(s,o)=>{const i=e&&Ye(n,o)||o;oe(n[i])&&oe(s)?n[i]=xe(n[i],s):oe(s)?n[i]=xe({},s):K(s)?n[i]=s.slice():(!t||!V(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ee(arguments[s],r);return n}const vt=(e,t,n,{allOwnKeys:r}={})=>(ee(t,(s,o)=>{n&&P(s)?e[o]=Je(s,n):e[o]=s},{allOwnKeys:r}),e),qt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Mt=(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,o,i;const l={};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))&&!l[i]&&(t[i]=e[i],l[i]=!0);e=n!==!1&&Ee(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Ht=(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},$t=e=>{if(!e)return null;if(K(e))return e;let t=e.length;if(!Xe(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"&&Ee(Uint8Array)),Jt=(e,t)=>{const r=(e&&e[ce]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Vt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Kt=_("HTMLFormElement"),Xt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Fe=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Yt=_("RegExp"),Qe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ee(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Gt=e=>{Qe(e,(t,n)=>{if(P(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(P(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+"'")})}})},Qt=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return K(e)?r(e):r(String(e).split(t)),n},Zt=()=>{},en=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function tn(e){return!!(e&&P(e.append)&&e[Ve]==="FormData"&&e[ce])}const nn=e=>{const t=new Array(10),n=(r,s)=>{if(Z(r)){if(t.indexOf(r)>=0)return;if(Q(r))return r;if(!("toJSON"in r)){t[s]=r;const o=K(r)?[]:{};return ee(r,(i,l)=>{const p=n(i,s+1);!V(p)&&(o[l]=p)}),t[s]=void 0,o}}return r};return n(e,0)},rn=_("AsyncFunction"),sn=e=>e&&(Z(e)||P(e))&&P(e.then)&&P(e.catch),Ze=((e,t)=>e?setImmediate:t?((n,r)=>(z.addEventListener("message",({source:s,data:o})=>{s===z&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),z.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",P(z.postMessage)),on=typeof queueMicrotask<"u"?queueMicrotask.bind(z):typeof process<"u"&&process.nextTick||Ze,an=e=>e!=null&&P(e[ce]),a={isArray:K,isArrayBuffer:Ke,isBuffer:Q,isFormData:Pt,isArrayBufferView:Rt,isString:Ct,isNumber:Xe,isBoolean:Tt,isObject:Z,isPlainObject:oe,isEmptyObject:Ot,isReadableStream:_t,isRequest:Lt,isResponse:Bt,isHeaders:Dt,isUndefined:V,isDate:At,isFile:jt,isBlob:kt,isRegExp:Yt,isFunction:P,isStream:Nt,isURLSearchParams:Ut,isTypedArray:Wt,isFileList:Ft,forEach:ee,merge:xe,extend:vt,trim:It,stripBOM:qt,inherits:Mt,toFlatObject:zt,kindOf:ue,kindOfTest:_,endsWith:Ht,toArray:$t,forEachEntry:Jt,matchAll:Vt,isHTMLForm:Kt,hasOwnProperty:Fe,hasOwnProp:Fe,reduceDescriptors:Qe,freezeMethods:Gt,toObjectSet:Qt,toCamelCase:Xt,noop:Zt,toFiniteNumber:en,findKey:Ye,global:z,isContextDefined:Ge,isSpecCompliantForm:tn,toJSONObject:nn,isAsyncFn:rn,isThenable:sn,setImmediate:Ze,asap:on,isIterable:an};function b(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(b,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 et=b.prototype,tt={};["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=>{tt[e]={value:e}});Object.defineProperties(b,tt);Object.defineProperty(et,"isAxiosError",{value:!0});b.from=(e,t,n,r,s,o)=>{const i=Object.create(et);a.toFlatObject(e,i,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return b.call(i,l,p,n,r,s),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const ln=null;function ge(e){return a.isPlainObject(e)||a.isArray(e)}function nt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ne(e,t,n){return e?e.concat(t).map(function(s,o){return s=nt(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function cn(e){return a.isArray(e)&&!e.some(ge)}const un=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function fe(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||c,o=n.dots,i=n.indexes,p=(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(!p&&a.isBlob(f))throw new b("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function c(f,y,h){let w=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)&&cn(f)||(a.isFileList(f)||a.endsWith(y,"[]"))&&(w=a.toArray(f)))return y=nt(y),w.forEach(function(S,g){!(a.isUndefined(S)||S===null)&&t.append(i===!0?Ne([y],g,o):i===null?y:y+"[]",u(S))}),!1}return ge(f)?!0:(t.append(Ne(h,y,o),u(f)),!1)}const d=[],x=Object.assign(un,{defaultVisitor:c,convertValue:u,isVisitable:ge});function E(f,y){if(!a.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(f),a.forEach(f,function(w,C){(!(a.isUndefined(w)||w===null)&&s.call(t,w,a.isString(C)?C.trim():C,y,x))===!0&&E(w,y?y.concat(C):[C])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return E(e),t}function Pe(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&&fe(e,this,t)}const rt=Re.prototype;rt.append=function(t,n){this._pairs.push([t,n])};rt.toString=function(t){const n=t?function(r){return t.call(this,r,Pe)}:Pe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function dn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function st(e,t,n){if(!t)return e;const r=n&&n.encode||dn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(t,n):o=a.isURLSearchParams(t)?t.toString():new Re(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ue{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 ot={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fn=typeof URLSearchParams<"u"?URLSearchParams:Re,pn=typeof FormData<"u"?FormData:null,hn=typeof Blob<"u"?Blob:null,mn={isBrowser:!0,classes:{URLSearchParams:fn,FormData:pn,Blob:hn},protocols:["http","https","file","blob","url","data"]},Ce=typeof window<"u"&&typeof document<"u",we=typeof navigator=="object"&&navigator||void 0,yn=Ce&&(!we||["ReactNative","NativeScript","NS"].indexOf(we.product)<0),bn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",xn=Ce&&window.location.href||"http://localhost",gn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ce,hasStandardBrowserEnv:yn,hasStandardBrowserWebWorkerEnv:bn,navigator:we,origin:xn},Symbol.toStringTag,{value:"Module"})),k={...gn,...mn};function wn(e,t){return fe(e,new k.classes.URLSearchParams,{visitor:function(n,r,s,o){return k.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Sn(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 it(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),p=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!l):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=En(s[i])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Sn(r),s,n,0)}),n}return null}function Rn(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 te={transitional:ot,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(it(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(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return wn(t,this.formSerializer).toString();if((l=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return fe(l?{"files[]":t}:t,p&&new p,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),Rn(t)):t}],transformResponse:[function(t){const n=this.transitional||te.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(l){if(i)throw l.name==="SyntaxError"?b.from(l,b.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:k.classes.FormData,Blob:k.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{te.headers[e]={}});const Cn=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"]),Tn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
13
|
+
`})]})},wt=({onSendMessage:e,isLoading:t,theme:n})=>{const[r,s]=N.useState(""),o=()=>{!r.trim()||t||(e(r.trim()),s(""))},i=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),o())},l={padding:"16px",borderTop:"1px solid rgba(255, 255, 255, 0.2)",background:n.backgroundColor,flexShrink:0},p={display:"flex",gap:"12px",alignItems:"center"},u={flex:1,padding:"12px 16px",background:n.inputBackgroundColor||n.backgroundColor,color:n.fontColor,border:`1px solid ${n.fontColor}`,borderRadius:"12px",fontSize:"14px",outline:"none",transition:"all 0.2s ease",opacity:t?.5:1,cursor:t?"not-allowed":"text",boxShadow:"none"},c={padding:"12px 20px",borderRadius:"12px",background:`linear-gradient(135deg, ${n.primaryColor}, ${n.secondaryColor})`,color:n.fontColor,border:"none",cursor:t||!r.trim()?"not-allowed":"pointer",opacity:t||!r.trim()?.5:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontWeight:"600",fontSize:"14px",transition:"all 0.2s ease",minWidth:"48px"};return m.jsx("div",{style:l,children:m.jsxs("div",{style:p,children:[m.jsx("input",{type:"text",placeholder:"Type a message...",value:r,onChange:d=>s(d.target.value),onKeyDown:i,disabled:t,style:u,onFocus:d=>{d.target.style.boxShadow="0 0 0 3px rgba(100, 150, 255, 0.3)",d.target.style.borderColor="#60a5fa"},onBlur:d=>{d.target.style.boxShadow="none",d.target.style.borderColor=n.fontColor}}),m.jsx("button",{onClick:o,disabled:t||!r.trim(),style:c,"aria-label":"Send message",onMouseEnter:d=>{!t&&r.trim()&&(d.currentTarget.style.transform="translateY(-2px)",d.currentTarget.style.boxShadow="0 8px 16px rgba(0,0,0,0.15)")},onMouseLeave:d=>{d.currentTarget.style.transform="translateY(0)",d.currentTarget.style.boxShadow="none"},children:m.jsx(z.Send,{size:18})})]})})},St=({messages:e,isLoading:t,theme:n,botResponseTime:r})=>{const s=N.useRef(null),o=()=>{s.current?.scrollIntoView({behavior:"smooth"})};N.useEffect(()=>{o()},[e,t]);const i={flex:1,overflowY:"auto",padding:"20px",background:n.backgroundColor,color:n.fontColor,borderTop:"1px solid rgba(255, 255, 255, 0.2)",display:"flex",flexDirection:"column",gap:"16px"},l=d=>({display:"flex",justifyContent:d==="user"?"flex-end":"flex-start",width:"100%"}),p={display:"flex",flexDirection:"column",maxWidth:"80%"},u=d=>({padding:"12px 16px",borderRadius:"16px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid #e4e4e7",fontSize:"14px",lineHeight:"1.5",background:d==="user"?n.primaryColor:n.backgroundColor,color:n.fontColor,wordWrap:"break-word"}),c={...u("bot"),animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s"};return m.jsxs("div",{style:i,children:[e.map((d,x)=>m.jsx("div",{style:l(d.type),children:m.jsxs("div",{style:p,children:[d.type==="bot"&&r&&m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-start",marginLeft:"4px",marginBottom:"2px"},children:[m.jsx(z.Bot,{size:14,color:n.fontColor}),m.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:r})]}),d.type==="user"&&m.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-end",marginRight:"4px",marginBottom:"2px"},children:m.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:"You"})}),m.jsx("div",{style:u(d.type),children:d.text})]})},x)),t&&m.jsx("div",{style:l("bot"),children:m.jsx("div",{style:c,children:m.jsx(z.Bot,{size:24})})}),m.jsx("div",{ref:s})]})};function Je(e,t){return function(){return e.apply(t,arguments)}}const{toString:Et}=Object.prototype,{getPrototypeOf:Ee}=Object,{iterator:ce,toStringTag:Ve}=Symbol,ue=(e=>t=>{const n=Et.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),_=e=>(e=e.toLowerCase(),t=>ue(t)===e),de=e=>t=>typeof t===e,{isArray:K}=Array,V=de("undefined");function Q(e){return e!==null&&!V(e)&&e.constructor!==null&&!V(e.constructor)&&P(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ke=_("ArrayBuffer");function Rt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ke(e.buffer),t}const Ct=de("string"),P=de("function"),Xe=de("number"),Z=e=>e!==null&&typeof e=="object",Tt=e=>e===!0||e===!1,oe=e=>{if(ue(e)!=="object")return!1;const t=Ee(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ve in e)&&!(ce in e)},Ot=e=>{if(!Z(e)||Q(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},At=_("Date"),jt=_("File"),kt=_("Blob"),Ft=_("FileList"),Nt=e=>Z(e)&&P(e.pipe),Pt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||P(e.append)&&((t=ue(e))==="formdata"||t==="object"&&P(e.toString)&&e.toString()==="[object FormData]"))},Ut=_("URLSearchParams"),[_t,Lt,Bt,Dt]=["ReadableStream","Request","Response","Headers"].map(_),It=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ee(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),K(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Q(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let l;for(r=0;r<i;r++)l=o[r],t.call(null,e[l],l,e)}}function Ye(e,t){if(Q(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 H=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ge=e=>!V(e)&&e!==H;function xe(){const{caseless:e,skipUndefined:t}=Ge(this)&&this||{},n={},r=(s,o)=>{const i=e&&Ye(n,o)||o;oe(n[i])&&oe(s)?n[i]=xe(n[i],s):oe(s)?n[i]=xe({},s):K(s)?n[i]=s.slice():(!t||!V(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ee(arguments[s],r);return n}const vt=(e,t,n,{allOwnKeys:r}={})=>(ee(t,(s,o)=>{n&&P(s)?e[o]=Je(s,n):e[o]=s},{allOwnKeys:r}),e),qt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),zt=(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)},Ht=(e,t,n,r)=>{let s,o,i;const l={};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))&&!l[i]&&(t[i]=e[i],l[i]=!0);e=n!==!1&&Ee(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Mt=(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},$t=e=>{if(!e)return null;if(K(e))return e;let t=e.length;if(!Xe(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"&&Ee(Uint8Array)),Jt=(e,t)=>{const r=(e&&e[ce]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Vt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Kt=_("HTMLFormElement"),Xt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Fe=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Yt=_("RegExp"),Qe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ee(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Gt=e=>{Qe(e,(t,n)=>{if(P(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(P(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+"'")})}})},Qt=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return K(e)?r(e):r(String(e).split(t)),n},Zt=()=>{},en=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function tn(e){return!!(e&&P(e.append)&&e[Ve]==="FormData"&&e[ce])}const nn=e=>{const t=new Array(10),n=(r,s)=>{if(Z(r)){if(t.indexOf(r)>=0)return;if(Q(r))return r;if(!("toJSON"in r)){t[s]=r;const o=K(r)?[]:{};return ee(r,(i,l)=>{const p=n(i,s+1);!V(p)&&(o[l]=p)}),t[s]=void 0,o}}return r};return n(e,0)},rn=_("AsyncFunction"),sn=e=>e&&(Z(e)||P(e))&&P(e.then)&&P(e.catch),Ze=((e,t)=>e?setImmediate:t?((n,r)=>(H.addEventListener("message",({source:s,data:o})=>{s===H&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),H.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",P(H.postMessage)),on=typeof queueMicrotask<"u"?queueMicrotask.bind(H):typeof process<"u"&&process.nextTick||Ze,an=e=>e!=null&&P(e[ce]),a={isArray:K,isArrayBuffer:Ke,isBuffer:Q,isFormData:Pt,isArrayBufferView:Rt,isString:Ct,isNumber:Xe,isBoolean:Tt,isObject:Z,isPlainObject:oe,isEmptyObject:Ot,isReadableStream:_t,isRequest:Lt,isResponse:Bt,isHeaders:Dt,isUndefined:V,isDate:At,isFile:jt,isBlob:kt,isRegExp:Yt,isFunction:P,isStream:Nt,isURLSearchParams:Ut,isTypedArray:Wt,isFileList:Ft,forEach:ee,merge:xe,extend:vt,trim:It,stripBOM:qt,inherits:zt,toFlatObject:Ht,kindOf:ue,kindOfTest:_,endsWith:Mt,toArray:$t,forEachEntry:Jt,matchAll:Vt,isHTMLForm:Kt,hasOwnProperty:Fe,hasOwnProp:Fe,reduceDescriptors:Qe,freezeMethods:Gt,toObjectSet:Qt,toCamelCase:Xt,noop:Zt,toFiniteNumber:en,findKey:Ye,global:H,isContextDefined:Ge,isSpecCompliantForm:tn,toJSONObject:nn,isAsyncFn:rn,isThenable:sn,setImmediate:Ze,asap:on,isIterable:an};function b(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(b,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 et=b.prototype,tt={};["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=>{tt[e]={value:e}});Object.defineProperties(b,tt);Object.defineProperty(et,"isAxiosError",{value:!0});b.from=(e,t,n,r,s,o)=>{const i=Object.create(et);a.toFlatObject(e,i,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return b.call(i,l,p,n,r,s),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const ln=null;function ge(e){return a.isPlainObject(e)||a.isArray(e)}function nt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ne(e,t,n){return e?e.concat(t).map(function(s,o){return s=nt(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function cn(e){return a.isArray(e)&&!e.some(ge)}const un=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function fe(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||c,o=n.dots,i=n.indexes,p=(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(!p&&a.isBlob(f))throw new b("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function c(f,y,h){let w=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)&&cn(f)||(a.isFileList(f)||a.endsWith(y,"[]"))&&(w=a.toArray(f)))return y=nt(y),w.forEach(function(S,g){!(a.isUndefined(S)||S===null)&&t.append(i===!0?Ne([y],g,o):i===null?y:y+"[]",u(S))}),!1}return ge(f)?!0:(t.append(Ne(h,y,o),u(f)),!1)}const d=[],x=Object.assign(un,{defaultVisitor:c,convertValue:u,isVisitable:ge});function E(f,y){if(!a.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(f),a.forEach(f,function(w,C){(!(a.isUndefined(w)||w===null)&&s.call(t,w,a.isString(C)?C.trim():C,y,x))===!0&&E(w,y?y.concat(C):[C])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return E(e),t}function Pe(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&&fe(e,this,t)}const rt=Re.prototype;rt.append=function(t,n){this._pairs.push([t,n])};rt.toString=function(t){const n=t?function(r){return t.call(this,r,Pe)}:Pe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function dn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function st(e,t,n){if(!t)return e;const r=n&&n.encode||dn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let o;if(s?o=s(t,n):o=a.isURLSearchParams(t)?t.toString():new Re(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ue{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 ot={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fn=typeof URLSearchParams<"u"?URLSearchParams:Re,pn=typeof FormData<"u"?FormData:null,hn=typeof Blob<"u"?Blob:null,mn={isBrowser:!0,classes:{URLSearchParams:fn,FormData:pn,Blob:hn},protocols:["http","https","file","blob","url","data"]},Ce=typeof window<"u"&&typeof document<"u",we=typeof navigator=="object"&&navigator||void 0,yn=Ce&&(!we||["ReactNative","NativeScript","NS"].indexOf(we.product)<0),bn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",xn=Ce&&window.location.href||"http://localhost",gn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ce,hasStandardBrowserEnv:yn,hasStandardBrowserWebWorkerEnv:bn,navigator:we,origin:xn},Symbol.toStringTag,{value:"Module"})),j={...gn,...mn};function wn(e,t){return fe(e,new j.classes.URLSearchParams,{visitor:function(n,r,s,o){return j.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Sn(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 it(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),p=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!l):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=En(s[i])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Sn(r),s,n,0)}),n}return null}function Rn(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 te={transitional:ot,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(it(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(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return wn(t,this.formSerializer).toString();if((l=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return fe(l?{"files[]":t}:t,p&&new p,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),Rn(t)):t}],transformResponse:[function(t){const n=this.transitional||te.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(l){if(i)throw l.name==="SyntaxError"?b.from(l,b.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:j.classes.FormData,Blob:j.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=>{te.headers[e]={}});const Cn=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"]),Tn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
14
14
|
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&Cn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},_e=Symbol("internals");function G(e){return e&&String(e).trim().toLowerCase()}function ie(e){return e===!1||e==null?e:a.isArray(e)?e.map(ie):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 An=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function me(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 jn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function kn(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 U=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(l,p,u){const c=G(p);if(!c)throw new Error("header name must be a non-empty string");const d=a.findKey(s,c);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||p]=ie(l))}const i=(l,p)=>a.forEach(l,(u,c)=>o(u,c,p));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(a.isString(t)&&(t=t.trim())&&!An(t))i(Tn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let l={},p,u;for(const c of t){if(!a.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[u=c[0]]=(p=l[u])?a.isArray(p)?[...p,c[1]]:[p,c[1]]:c[1]}i(l,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=G(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=G(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||me(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=G(i),i){const l=a.findKey(r,i);l&&(!n||me(r,r[l],l,n))&&(delete r[l],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||me(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]=ie(s),delete n[o];return}const l=t?jn(o):String(o).trim();l!==o&&delete n[o],n[l]=ie(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(`
|
|
15
|
-
`)}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[_e]=this[_e]={accessors:{}}).accessors,s=this.prototype;function o(i){const l=G(i);r[l]||(kn(s,i),r[l]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};U.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(U.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(U);function ye(e,t){const n=this||te,r=t||n,s=U.from(r.headers);let o=r.data;return a.forEach(e,function(l){o=l.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function at(e){return!!(e&&e.__CANCEL__)}function X(e,t,n){b.call(this,e??"canceled",b.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(X,b,{__CANCEL__:!0});function lt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new b("Request failed with status code "+n.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Fn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Nn(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(p){const u=Date.now(),c=r[o];i||(i=u),n[s]=p,r[s]=u;let d=o,x=0;for(;d!==s;)x+=n[d++],d=d%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const E=c&&u-c;return E?Math.round(x*1e3/E):void 0}}function Pn(e,t){let n=0,r=1e3/t,s,o;const i=(u,c=Date.now())=>{n=c,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?i(u,c):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const le=(e,t,n=3)=>{let r=0;const s=Nn(50,250);return Pn(o=>{const i=o.loaded,l=o.lengthComputable?o.total:void 0,p=i-r,u=s(p),c=i<=l;r=i;const d={loaded:i,total:l,progress:l?i/l:void 0,bytes:p,rate:u||void 0,estimated:u&&l&&c?(l-i)/u:void 0,event:o,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(d)},n)},Le=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Be=e=>(...t)=>a.asap(()=>e(...t)),Un=k.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,k.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(k.origin),k.navigator&&/(msie|trident)/i.test(k.navigator.userAgent)):()=>!0,_n=k.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){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}`),o===!0&&l.push("secure"),a.isString(i)&&l.push(`SameSite=${i}`),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 Ln(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Bn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ct(e,t,n){let r=!Ln(t);return e&&(r||n==!1)?Bn(e,t):t}const De=e=>e instanceof U?{...e}:e;function $(e,t){t=t||{};const n={};function r(u,c,d,x){return a.isPlainObject(u)&&a.isPlainObject(c)?a.merge.call({caseless:x},u,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(u,c,d,x){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u,d,x)}else return r(u,c,d,x)}function o(u,c){if(!a.isUndefined(c))return r(void 0,c)}function i(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,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(u,c,d)=>s(De(u),De(c),d,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const d=p[c]||s,x=d(e[c],t[c],c);a.isUndefined(x)&&d!==l||(n[c]=x)}),n}const ut=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:l}=t;if(t.headers=i=U.from(i),t.url=st(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(k.hasStandardBrowserEnv||k.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const p=n.getHeaders(),u=["content-type","content-length"];Object.entries(p).forEach(([c,d])=>{u.includes(c.toLowerCase())&&i.set(c,d)})}}if(k.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Un(t.url))){const p=s&&o&&_n.read(o);p&&i.set(s,p)}return t},Dn=typeof XMLHttpRequest<"u",In=Dn&&function(e){return new Promise(function(n,r){const s=ut(e);let o=s.data;const i=U.from(s.headers).normalize();let{responseType:l,onUploadProgress:p,onDownloadProgress:u}=s,c,d,x,E,f;function y(){E&&E(),f&&f(),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 w(){if(!h)return;const S=U.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),T={data:!l||l==="text"||l==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:S,config:e,request:h};lt(function(O){n(O),y()},function(O){r(O),y()},T),h=null}"onloadend"in h?h.onloadend=w:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(w)},h.onabort=function(){h&&(r(new b("Request aborted",b.ECONNABORTED,e,h)),h=null)},h.onerror=function(g){const T=g&&g.message?g.message:"Network Error",A=new b(T,b.ERR_NETWORK,e,h);A.event=g||null,r(A),h=null},h.ontimeout=function(){let g=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const T=s.transitional||ot;s.timeoutErrorMessage&&(g=s.timeoutErrorMessage),r(new b(g,T.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(g,T){h.setRequestHeader(T,g)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),l&&l!=="json"&&(h.responseType=s.responseType),u&&([x,f]=le(u,!0),h.addEventListener("progress",x)),p&&h.upload&&([d,E]=le(p),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(c=S=>{h&&(r(!S||S.type?new X(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 C=Fn(s.url);if(C&&k.protocols.indexOf(C)===-1){r(new b("Unsupported protocol "+C+":",b.ERR_BAD_REQUEST,e));return}h.send(o||null)})},vn=(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,l();const c=u instanceof Error?u:this.reason;r.abort(c instanceof b?c:new X(c instanceof Error?c.message:c))}};let i=t&&setTimeout(()=>{i=null,o(new b(`timeout ${t} of ms exceeded`,b.ETIMEDOUT))},t);const l=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:p}=r;return p.unsubscribe=()=>a.asap(l),p}},qn=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},Mn=async function*(e,t){for await(const n of zn(e))yield*qn(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()}},Ie=(e,t,n,r)=>{const s=Mn(e,t);let o=0,i,l=p=>{i||(i=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:u,value:c}=await s.next();if(u){l(),p.close();return}let d=c.byteLength;if(n){let x=o+=d;n(x)}p.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(p){return l(p),s.return()}},{highWaterMark:2})},ve=64*1024,{isFunction:se}=a,Hn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:qe,TextEncoder:Me}=a.global,ze=(e,...t)=>{try{return!!e(...t)}catch{return!1}},$n=e=>{e=a.merge.call({skipUndefined:!0},Hn,e);const{fetch:t,Request:n,Response:r}=e,s=t?se(t):typeof fetch=="function",o=se(n),i=se(r);if(!s)return!1;const l=s&&se(qe),p=s&&(typeof Me=="function"?(f=>y=>f.encode(y))(new Me):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=o&&l&&ze(()=>{let f=!1;const y=new n(k.origin,{body:new qe,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),c=i&&l&&ze(()=>a.isReadableStream(new r("").body)),d={stream:c&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!d[f]&&(d[f]=(y,h)=>{let w=y&&y[f];if(w)return w.call(y);throw new b(`Response type '${f}' is not supported`,b.ERR_NOT_SUPPORT,h)})});const x=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(k.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 p(f)).byteLength},E=async(f,y)=>{const h=a.toFiniteNumber(f.getContentLength());return h??x(y)};return async f=>{let{url:y,method:h,data:w,signal:C,cancelToken:S,timeout:g,onDownloadProgress:T,onUploadProgress:A,responseType:O,headers:Y,withCredentials:W="same-origin",fetchOptions:ne}=ut(f),j=t||fetch;O=O?(O+"").toLowerCase():"text";let F=vn([C,S&&S.toAbortSignal()],g),D=null;const I=F&&F.unsubscribe&&(()=>{F.unsubscribe()});let Oe;try{if(A&&u&&h!=="get"&&h!=="head"&&(Oe=await E(Y,w))!==0){let q=new n(y,{method:"POST",body:w,duplex:"half"}),J;if(a.isFormData(w)&&(J=q.headers.get("content-type"))&&Y.setContentType(J),q.body){const[he,re]=Le(Oe,le(Be(A)));w=Ie(q.body,ve,he,re)}}a.isString(W)||(W=W?"include":"omit");const L=o&&"credentials"in n.prototype,Ae={...ne,signal:F,method:h.toUpperCase(),headers:Y.normalize().toJSON(),body:w,duplex:"half",credentials:L?W:void 0};D=o&&new n(y,Ae);let v=await(o?j(D,ne):j(y,Ae));const je=c&&(O==="stream"||O==="response");if(c&&(T||je&&I)){const q={};["status","statusText","headers"].forEach(ke=>{q[ke]=v[ke]});const J=a.toFiniteNumber(v.headers.get("content-length")),[he,re]=T&&Le(J,le(Be(T),!0))||[];v=new r(Ie(v.body,ve,he,()=>{re&&re(),I&&I()}),q)}O=O||"text";let bt=await d[a.findKey(d,O)||"text"](v,f);return!je&&I&&I(),await new Promise((q,J)=>{lt(q,J,{data:bt,headers:U.from(v.headers),status:v.status,statusText:v.statusText,config:f,request:D})})}catch(L){throw I&&I(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,f,D),{cause:L.cause||L}):b.from(L,L&&L.code,f,D)}}},Wn=new Map,dt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,l=i,p,u,c=Wn;for(;l--;)p=o[l],u=c.get(p),u===void 0&&c.set(p,u=l?new Map:$n(t)),c=u;return u};dt();const Te={http:ln,xhr:In,fetch:{get:dt}};a.forEach(Te,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const He=e=>`- ${e}`,Jn=e=>a.isFunction(e)||e===null||e===!1;function Vn(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 l;if(s=r,!Jn(r)&&(s=Te[(l=String(r)).toLowerCase()],s===void 0))throw new b(`Unknown adapter '${l}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;o[l||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,u])=>`adapter ${p} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?i.length>1?`since :
|
|
16
|
-
`+i.map(
|
|
17
|
-
`):" "+
|
|
18
|
-
`+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:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:B.function,serialize:B.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ae.assertOptions(n,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.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=U.concat(i,o);const l=[];let p=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(p=p&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let c,d=0,x;if(!p){const f=[$e.bind(this),void 0];for(f.unshift(...l),f.push(...u),x=f.length,c=Promise.resolve(n);d<x;)c=c.then(f[d++],f[d++]);return c}x=l.length;let E=n;for(;d<x;){const f=l[d++],y=l[d++];try{E=f(E)}catch(h){y.call(this,h);break}}try{c=$e.call(this,E)}catch(f){return Promise.reject(f)}for(d=0,x=u.length;d<x;)c=c.then(u[d++],u[d++]);return c}getUri(t){t=$(this.defaults,t);const n=ct(t.baseURL,t.url,t.allowAbsoluteUrls);return st(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){H.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,l){return this.request($(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}H.prototype[t]=n(),H.prototype[t+"Form"]=n(!0)});let Xn=class ht{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(l=>{r.subscribe(l),o=l}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,l){r.reason||(r.reason=new X(o,i,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 ht(function(s){t=s}),cancel:t}}};function Yn(e){return function(n){return e.apply(null,n)}}function Gn(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 mt(e){const t=new H(e),n=Je(H.prototype.request,t);return a.extend(n,H.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return mt($(e,s))},n}const R=mt(te);R.Axios=H;R.CanceledError=X;R.CancelToken=Xn;R.isCancel=at;R.VERSION=pt;R.toFormData=fe;R.AxiosError=b;R.Cancel=R.CanceledError;R.all=function(t){return Promise.all(t)};R.spread=Yn;R.isAxiosError=Gn;R.mergeConfig=$;R.AxiosHeaders=U;R.formToJSON=e=>it(a.isHTMLForm(e)?new FormData(e):e);R.getAdapter=ft.getAdapter;R.HttpStatusCode=Se;R.default=R;const{Axios:rr,AxiosError:sr,CanceledError:or,isCancel:ir,CancelToken:ar,VERSION:lr,all:cr,Cancel:ur,isAxiosError:dr,spread:fr,toFormData:pr,AxiosHeaders:hr,HttpStatusCode:mr,formToJSON:yr,getAdapter:br,mergeConfig:xr}=R,yt=async(e,t,n,r)=>{const s={chatInput:e,sessionId:t,metadata:{pinecone_namespace:n}};try{const o=await R.post(r,s,{headers:{"Content-Type":"application/json"}}),i=o.data.response;return console.log("API response:",o),i}catch(o){throw console.error("Error communicating with chat API:",o),o}},Qn=({handleMessageFromForm:e,theme:t,chatBotData:n})=>{const[r,s]=N.useState(""),[o,i]=N.useState(""),[l,p]=N.useState(""),[u,c]=N.useState(!1),d=async g=>{if(g.preventDefault(),c(!0),p(""),!r.trim()||!o.trim()){p("Name and email are required"),c(!1);return}const T=`Hi, I am ${r} and my email is ${o}`;try{const A=await yt(T,n.sessionId,n.pineconeNamespace,n.url);console.log("metaData from user form:",A);const O=A.output;e([{type:"user",text:T},{type:"bot",text:O}])}catch(A){console.log("error sending user details",A),p("Failed to submit. Please try again.")}finally{c(!1)}s(""),i("")},x={padding:"20px",flexShrink:0,background:t.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},E={display:"flex",flexDirection:"column",gap:"24px"},f={fontSize:"14px",fontWeight:"500",color:t.fontColor,margin:0,lineHeight:"1.4"},y={display:"flex",flexDirection:"column",gap:"20px"},h={fontSize:"14px",color:t.fontColor,fontWeight:"500"},w={width:"100%",padding:"12px 16px",background:t.backgroundColor,color:t.fontColor,border:"1px solid #a1a1aa",borderRadius:"12px",fontSize:"15px",outline:"none",boxSizing:"border-box"},C={padding:"12px 20px",borderRadius:"12px",fontWeight:"600",fontSize:"15px",border:"none",cursor:r.trim()&&o.trim()&&!u?"pointer":"not-allowed",opacity:r.trim()&&o.trim()&&!u?1:.5,background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"80px",transition:"all 0.2s ease"},S={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return m.jsx("div",{style:x,children:m.jsxs("form",{onSubmit:d,style:E,children:[l&&m.jsx("div",{style:S,role:"alert",children:l}),m.jsx("p",{style:f,children:n.welcomeText}),m.jsxs("div",{style:y,children:[m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[m.jsx("label",{style:h,children:"Full Name"}),m.jsx("input",{type:"text",placeholder:"Enter your full name",value:r,onChange:g=>{s(g.target.value),p("")},style:w,required:!0})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[m.jsx("label",{style:h,children:"Email Address"}),m.jsx("input",{type:"email",placeholder:"Enter your email",value:o,onChange:g=>{i(g.target.value),p("")},style:w,required:!0})]})]}),m.jsx("button",{type:"submit",disabled:!r.trim()||!o.trim()||u,style:C,onMouseEnter:g=>{r.trim()&&o.trim()&&!u&&(g.currentTarget.style.transform="translateY(-2px)",g.currentTarget.style.boxShadow="0 10px 20px rgba(0,0,0,0.15)")},onMouseLeave:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="none"},children:u?"Submitting...":m.jsxs(m.Fragment,{children:[m.jsx(M.Send,{size:18}),"Submit"]})})]})})},Zn=({onClose:e,theme:t,chatBotData:n})=>{const[r,s]=N.useState([]),[o,i]=N.useState(!1),[l,p]=N.useState(!1),[u,c]=N.useState(null),x={position:"fixed",bottom:"112px",[n.position==="left"?"left":"right"]:"32px",zIndex:50,width:"384px",height:"520px",background:`${t.backgroundColor}cc`,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderRadius:"16px",border:"1px solid rgba(255, 255, 255, 0.3)",boxShadow:"0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.1)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},E={padding:"16px 20px",background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,borderRadius:"16px 16px 0 0",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)"},f={position:"relative"},y={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},h={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},w={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},C={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},S={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},g={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},T={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},A={fontWeight:"600"},O=(j,F)=>{j.currentTarget.style.background=F?"rgba(255,255,255,0.2)":"transparent"},Y=j=>j?new Date(j).toLocaleTimeString("en-AU",{hour:"2-digit",minute:"2-digit"}):"",W=j=>{s(j),p(!0)},ne=async j=>{i(!0),s(F=>[...F,{type:"user",text:j}]);try{const F=await yt(j,n.sessionId,n.pineconeNamespace,n.url),D=F.output;c(Y(F.response_timestamp)),s(I=>[...I,{type:"bot",text:D}])}catch(F){console.error("Chat error:",F),s(D=>[...D,{type:"bot",text:"Sorry, something went wrong."}])}finally{i(!1)}};return m.jsxs("div",{style:x,children:[m.jsxs("div",{style:E,children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[m.jsxs("div",{style:f,children:[m.jsx("div",{style:y,children:m.jsx(M.MessageCircle,{size:22})}),m.jsx("span",{style:h})]}),m.jsxs("div",{children:[m.jsx("h3",{style:w,children:n.name}),m.jsx("p",{style:C,children:n.subTitle})]})]}),m.jsx("button",{onClick:e,"aria-label":"Close chat",style:S,onMouseEnter:j=>O(j,!0),onMouseLeave:j=>O(j,!1),children:m.jsx(M.X,{size:20})})]}),l?m.jsxs(m.Fragment,{children:[m.jsx(St,{messages:r,isLoading:o,theme:t,botResponseTime:u}),m.jsx(wt,{onSendMessage:ne,isLoading:o,theme:t})]}):m.jsx(Qn,{handleMessageFromForm:W,theme:t,chatBotData:n}),m.jsx("div",{style:g,children:m.jsxs("p",{style:T,children:["powered by"," ",m.jsx("span",{style:A,children:"clone67.com"})]})})]})},er=({pineconeNamespace:e,url:t,primaryColor:n="#3b82f6",secondaryColor:r="#8b5cf6",backgroundColor:s="#ffffff",fontColor:o="#1f2937",placeholderColor:i="#9ca3af",position:l="right",name:p="Assistant",subTitle:u="Typically replies instantly",welcomeText:c="Hi! How can I help you today?"})=>{const[d,x]=N.useState(!1),[E,f]=N.useState("");N.useEffect(()=>{f(xt.v4())},[]);const y=()=>x(A=>!A),h={primaryColor:n,secondaryColor:r,backgroundColor:s,fontColor:o,placeholderColor:i,inputBackgroundColor:s},w={name:p,subTitle:u,welcomeText:c,url:t,pineconeNamespace:e,position:l,sessionId:E},C=l==="left",S="32px",g={position:"fixed",bottom:"104px",[C?"left":"right"]:S,zIndex:9999,pointerEvents:"auto"},T={position:"fixed",bottom:"32px",[C?"left":"right"]:S,zIndex:1e4,pointerEvents:"auto"};return m.jsxs(m.Fragment,{children:[d&&m.jsx("div",{style:g,children:m.jsx(Zn,{onClose:y,theme:h,chatBotData:w})}),m.jsx("div",{style:T,children:m.jsx(gt,{onClick:y,isOpen:d,theme:h,chatBotData:w})})]})};module.exports=er;
|
|
15
|
+
`)}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[_e]=this[_e]={accessors:{}}).accessors,s=this.prototype;function o(i){const l=G(i);r[l]||(kn(s,i),r[l]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};U.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(U.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(U);function ye(e,t){const n=this||te,r=t||n,s=U.from(r.headers);let o=r.data;return a.forEach(e,function(l){o=l.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function at(e){return!!(e&&e.__CANCEL__)}function X(e,t,n){b.call(this,e??"canceled",b.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(X,b,{__CANCEL__:!0});function lt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new b("Request failed with status code "+n.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Fn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Nn(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(p){const u=Date.now(),c=r[o];i||(i=u),n[s]=p,r[s]=u;let d=o,x=0;for(;d!==s;)x+=n[d++],d=d%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i<t)return;const E=c&&u-c;return E?Math.round(x*1e3/E):void 0}}function Pn(e,t){let n=0,r=1e3/t,s,o;const i=(u,c=Date.now())=>{n=c,s=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?i(u,c):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const le=(e,t,n=3)=>{let r=0;const s=Nn(50,250);return Pn(o=>{const i=o.loaded,l=o.lengthComputable?o.total:void 0,p=i-r,u=s(p),c=i<=l;r=i;const d={loaded:i,total:l,progress:l?i/l:void 0,bytes:p,rate:u||void 0,estimated:u&&l&&c?(l-i)/u:void 0,event:o,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(d)},n)},Le=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Be=e=>(...t)=>a.asap(()=>e(...t)),Un=j.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,j.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,_n=j.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){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}`),o===!0&&l.push("secure"),a.isString(i)&&l.push(`SameSite=${i}`),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 Ln(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Bn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ct(e,t,n){let r=!Ln(t);return e&&(r||n==!1)?Bn(e,t):t}const De=e=>e instanceof U?{...e}:e;function $(e,t){t=t||{};const n={};function r(u,c,d,x){return a.isPlainObject(u)&&a.isPlainObject(c)?a.merge.call({caseless:x},u,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(u,c,d,x){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u,d,x)}else return r(u,c,d,x)}function o(u,c){if(!a.isUndefined(c))return r(void 0,c)}function i(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,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(u,c,d)=>s(De(u),De(c),d,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const d=p[c]||s,x=d(e[c],t[c],c);a.isUndefined(x)&&d!==l||(n[c]=x)}),n}const ut=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:l}=t;if(t.headers=i=U.from(i),t.url=st(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const p=n.getHeaders(),u=["content-type","content-length"];Object.entries(p).forEach(([c,d])=>{u.includes(c.toLowerCase())&&i.set(c,d)})}}if(j.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Un(t.url))){const p=s&&o&&_n.read(o);p&&i.set(s,p)}return t},Dn=typeof XMLHttpRequest<"u",In=Dn&&function(e){return new Promise(function(n,r){const s=ut(e);let o=s.data;const i=U.from(s.headers).normalize();let{responseType:l,onUploadProgress:p,onDownloadProgress:u}=s,c,d,x,E,f;function y(){E&&E(),f&&f(),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 w(){if(!h)return;const S=U.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),T={data:!l||l==="text"||l==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:S,config:e,request:h};lt(function(O){n(O),y()},function(O){r(O),y()},T),h=null}"onloadend"in h?h.onloadend=w:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(w)},h.onabort=function(){h&&(r(new b("Request aborted",b.ECONNABORTED,e,h)),h=null)},h.onerror=function(g){const T=g&&g.message?g.message:"Network Error",k=new b(T,b.ERR_NETWORK,e,h);k.event=g||null,r(k),h=null},h.ontimeout=function(){let g=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const T=s.transitional||ot;s.timeoutErrorMessage&&(g=s.timeoutErrorMessage),r(new b(g,T.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(g,T){h.setRequestHeader(T,g)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),l&&l!=="json"&&(h.responseType=s.responseType),u&&([x,f]=le(u,!0),h.addEventListener("progress",x)),p&&h.upload&&([d,E]=le(p),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(c=S=>{h&&(r(!S||S.type?new X(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 C=Fn(s.url);if(C&&j.protocols.indexOf(C)===-1){r(new b("Unsupported protocol "+C+":",b.ERR_BAD_REQUEST,e));return}h.send(o||null)})},vn=(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,l();const c=u instanceof Error?u:this.reason;r.abort(c instanceof b?c:new X(c instanceof Error?c.message:c))}};let i=t&&setTimeout(()=>{i=null,o(new b(`timeout ${t} of ms exceeded`,b.ETIMEDOUT))},t);const l=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:p}=r;return p.unsubscribe=()=>a.asap(l),p}},qn=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},zn=async function*(e,t){for await(const n of Hn(e))yield*qn(n,t)},Hn=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()}},Ie=(e,t,n,r)=>{const s=zn(e,t);let o=0,i,l=p=>{i||(i=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:u,value:c}=await s.next();if(u){l(),p.close();return}let d=c.byteLength;if(n){let x=o+=d;n(x)}p.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(p){return l(p),s.return()}},{highWaterMark:2})},ve=64*1024,{isFunction:se}=a,Mn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:qe,TextEncoder:ze}=a.global,He=(e,...t)=>{try{return!!e(...t)}catch{return!1}},$n=e=>{e=a.merge.call({skipUndefined:!0},Mn,e);const{fetch:t,Request:n,Response:r}=e,s=t?se(t):typeof fetch=="function",o=se(n),i=se(r);if(!s)return!1;const l=s&&se(qe),p=s&&(typeof ze=="function"?(f=>y=>f.encode(y))(new ze):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=o&&l&&He(()=>{let f=!1;const y=new n(j.origin,{body:new qe,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),c=i&&l&&He(()=>a.isReadableStream(new r("").body)),d={stream:c&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!d[f]&&(d[f]=(y,h)=>{let w=y&&y[f];if(w)return w.call(y);throw new b(`Response type '${f}' is not supported`,b.ERR_NOT_SUPPORT,h)})});const x=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(j.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 p(f)).byteLength},E=async(f,y)=>{const h=a.toFiniteNumber(f.getContentLength());return h??x(y)};return async f=>{let{url:y,method:h,data:w,signal:C,cancelToken:S,timeout:g,onDownloadProgress:T,onUploadProgress:k,responseType:O,headers:Y,withCredentials:W="same-origin",fetchOptions:ne}=ut(f),A=t||fetch;O=O?(O+"").toLowerCase():"text";let F=vn([C,S&&S.toAbortSignal()],g),D=null;const I=F&&F.unsubscribe&&(()=>{F.unsubscribe()});let Oe;try{if(k&&u&&h!=="get"&&h!=="head"&&(Oe=await E(Y,w))!==0){let q=new n(y,{method:"POST",body:w,duplex:"half"}),J;if(a.isFormData(w)&&(J=q.headers.get("content-type"))&&Y.setContentType(J),q.body){const[he,re]=Le(Oe,le(Be(k)));w=Ie(q.body,ve,he,re)}}a.isString(W)||(W=W?"include":"omit");const L=o&&"credentials"in n.prototype,Ae={...ne,signal:F,method:h.toUpperCase(),headers:Y.normalize().toJSON(),body:w,duplex:"half",credentials:L?W:void 0};D=o&&new n(y,Ae);let v=await(o?A(D,ne):A(y,Ae));const je=c&&(O==="stream"||O==="response");if(c&&(T||je&&I)){const q={};["status","statusText","headers"].forEach(ke=>{q[ke]=v[ke]});const J=a.toFiniteNumber(v.headers.get("content-length")),[he,re]=T&&Le(J,le(Be(T),!0))||[];v=new r(Ie(v.body,ve,he,()=>{re&&re(),I&&I()}),q)}O=O||"text";let bt=await d[a.findKey(d,O)||"text"](v,f);return!je&&I&&I(),await new Promise((q,J)=>{lt(q,J,{data:bt,headers:U.from(v.headers),status:v.status,statusText:v.statusText,config:f,request:D})})}catch(L){throw I&&I(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,f,D),{cause:L.cause||L}):b.from(L,L&&L.code,f,D)}}},Wn=new Map,dt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,l=i,p,u,c=Wn;for(;l--;)p=o[l],u=c.get(p),u===void 0&&c.set(p,u=l?new Map:$n(t)),c=u;return u};dt();const Te={http:ln,xhr:In,fetch:{get:dt}};a.forEach(Te,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Me=e=>`- ${e}`,Jn=e=>a.isFunction(e)||e===null||e===!1;function Vn(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 l;if(s=r,!Jn(r)&&(s=Te[(l=String(r)).toLowerCase()],s===void 0))throw new b(`Unknown adapter '${l}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;o[l||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,u])=>`adapter ${p} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?i.length>1?`since :
|
|
16
|
+
`+i.map(Me).join(`
|
|
17
|
+
`):" "+Me(i[0]):"as no adapter specified";throw new b("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const ft={getAdapter:Vn,adapters:Te};function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new X(null,e)}function $e(e){return be(e),e.headers=U.from(e.headers),e.data=ye.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ft.getAdapter(e.adapter||te.adapter,e)(e).then(function(r){return be(e),r.data=ye.call(e,e.transformResponse,r),r.headers=U.from(r.headers),r},function(r){return at(r)||(be(e),r&&r.response&&(r.response.data=ye.call(e,e.transformResponse,r.response),r.response.headers=U.from(r.response.headers))),Promise.reject(r)})}const pt="1.13.2",pe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{pe[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const We={};pe.transitional=function(t,n,r){function s(o,i){return"[Axios v"+pt+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,l)=>{if(t===!1)throw new b(s(i," has been removed"+(n?" in "+n:"")),b.ERR_DEPRECATED);return n&&!We[i]&&(We[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,l):!0}};pe.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Kn(e,t,n){if(typeof e!="object")throw new b("options must be an object",b.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 l=e[o],p=l===void 0||i(l,o,e);if(p!==!0)throw new b("option "+o+" must be "+p,b.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new b("Unknown option "+o,b.ERR_BAD_OPTION)}}const ae={assertOptions:Kn,validators:pe},B=ae.validators;let M=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ue,response:new Ue}}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+=`
|
|
18
|
+
`+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:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:B.function,serialize:B.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ae.assertOptions(n,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.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=U.concat(i,o);const l=[];let p=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(p=p&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let c,d=0,x;if(!p){const f=[$e.bind(this),void 0];for(f.unshift(...l),f.push(...u),x=f.length,c=Promise.resolve(n);d<x;)c=c.then(f[d++],f[d++]);return c}x=l.length;let E=n;for(;d<x;){const f=l[d++],y=l[d++];try{E=f(E)}catch(h){y.call(this,h);break}}try{c=$e.call(this,E)}catch(f){return Promise.reject(f)}for(d=0,x=u.length;d<x;)c=c.then(u[d++],u[d++]);return c}getUri(t){t=$(this.defaults,t);const n=ct(t.baseURL,t.url,t.allowAbsoluteUrls);return st(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,l){return this.request($(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}M.prototype[t]=n(),M.prototype[t+"Form"]=n(!0)});let Xn=class ht{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(l=>{r.subscribe(l),o=l}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,l){r.reason||(r.reason=new X(o,i,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 ht(function(s){t=s}),cancel:t}}};function Yn(e){return function(n){return e.apply(null,n)}}function Gn(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 mt(e){const t=new M(e),n=Je(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 mt($(e,s))},n}const R=mt(te);R.Axios=M;R.CanceledError=X;R.CancelToken=Xn;R.isCancel=at;R.VERSION=pt;R.toFormData=fe;R.AxiosError=b;R.Cancel=R.CanceledError;R.all=function(t){return Promise.all(t)};R.spread=Yn;R.isAxiosError=Gn;R.mergeConfig=$;R.AxiosHeaders=U;R.formToJSON=e=>it(a.isHTMLForm(e)?new FormData(e):e);R.getAdapter=ft.getAdapter;R.HttpStatusCode=Se;R.default=R;const{Axios:rr,AxiosError:sr,CanceledError:or,isCancel:ir,CancelToken:ar,VERSION:lr,all:cr,Cancel:ur,isAxiosError:dr,spread:fr,toFormData:pr,AxiosHeaders:hr,HttpStatusCode:mr,formToJSON:yr,getAdapter:br,mergeConfig:xr}=R,yt=async(e,t,n,r,s,o)=>{const i={chatInput:e,sessionId:t,metadata:{pinecone_namespace:n,name:s,email:o}};try{return(await R.post(r,i,{headers:{"Content-Type":"application/json"}})).data}catch(l){throw console.error("Error communicating with chat API:",l),l}},Qn=({handleMessageFromForm:e,theme:t,chatBotData:n})=>{const[r,s]=N.useState(""),[o,i]=N.useState(""),[l,p]=N.useState(""),[u,c]=N.useState(!1),d=async g=>{if(g.preventDefault(),c(!0),p(""),!r.trim()||!o.trim()){p("Name and email are required"),c(!1);return}const T=`Hi, I am ${r} and my email is ${o}`;try{const O=(await yt(T,n.sessionId,n.pineconeNamespace,n.url,r,o)).response;e([{type:"user",text:T},{type:"bot",text:O}])}catch(k){console.log("error sending user details",k),p("Failed to submit. Please try again.")}finally{c(!1)}s(""),i("")},x={padding:"20px",flexShrink:0,background:t.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},E={display:"flex",flexDirection:"column",gap:"24px"},f={fontSize:"14px",fontWeight:"500",color:t.fontColor,margin:0,lineHeight:"1.4"},y={display:"flex",flexDirection:"column",gap:"20px"},h={fontSize:"14px",color:t.fontColor,fontWeight:"500"},w={width:"100%",padding:"12px 16px",background:t.backgroundColor,color:t.fontColor,border:"1px solid #a1a1aa",borderRadius:"12px",fontSize:"15px",outline:"none",boxSizing:"border-box"},C={padding:"12px 20px",borderRadius:"12px",fontWeight:"600",fontSize:"15px",border:"none",cursor:r.trim()&&o.trim()&&!u?"pointer":"not-allowed",opacity:r.trim()&&o.trim()&&!u?1:.5,background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"80px",transition:"all 0.2s ease"},S={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return m.jsx("div",{style:x,children:m.jsxs("form",{onSubmit:d,style:E,children:[l&&m.jsx("div",{style:S,role:"alert",children:l}),m.jsx("p",{style:f,children:n.welcomeText}),m.jsxs("div",{style:y,children:[m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[m.jsx("label",{style:h,children:"Full Name"}),m.jsx("input",{type:"text",placeholder:"Enter your full name",value:r,onChange:g=>{s(g.target.value),p("")},style:w,required:!0})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[m.jsx("label",{style:h,children:"Email Address"}),m.jsx("input",{type:"email",placeholder:"Enter your email",value:o,onChange:g=>{i(g.target.value),p("")},style:w,required:!0})]})]}),m.jsx("button",{type:"submit",disabled:!r.trim()||!o.trim()||u,style:C,onMouseEnter:g=>{r.trim()&&o.trim()&&!u&&(g.currentTarget.style.transform="translateY(-2px)",g.currentTarget.style.boxShadow="0 10px 20px rgba(0,0,0,0.15)")},onMouseLeave:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="none"},children:u?"Submitting...":m.jsxs(m.Fragment,{children:[m.jsx(z.Send,{size:18}),"Submit"]})})]})})},Zn=({onClose:e,theme:t,chatBotData:n})=>{const[r,s]=N.useState([]),[o,i]=N.useState(!1),[l,p]=N.useState(!1),[u,c]=N.useState(null),x={position:"fixed",bottom:"112px",[n.position==="left"?"left":"right"]:"32px",zIndex:50,width:"384px",height:"520px",background:`${t.backgroundColor}cc`,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderRadius:"16px",border:"1px solid rgba(255, 255, 255, 0.3)",boxShadow:"0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.1)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},E={padding:"16px 20px",background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,borderRadius:"16px 16px 0 0",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)"},f={position:"relative"},y={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},h={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},w={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},C={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},S={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},g={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},T={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},k={fontWeight:"600"},O=(A,F)=>{A.currentTarget.style.background=F?"rgba(255,255,255,0.2)":"transparent"},Y=A=>A?new Date(A).toLocaleTimeString("en-AU",{hour:"2-digit",minute:"2-digit"}):"",W=A=>{s(A),p(!0)},ne=async A=>{i(!0),s(F=>[...F,{type:"user",text:A}]);try{const F=await yt(A,n.sessionId,n.pineconeNamespace,n.url),D=F.response;c(Y(F.response_timestamp)),s(I=>[...I,{type:"bot",text:D}])}catch(F){console.error("Chat error:",F),s(D=>[...D,{type:"bot",text:"Sorry, something went wrong."}])}finally{i(!1)}};return m.jsxs("div",{style:x,children:[m.jsxs("div",{style:E,children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[m.jsxs("div",{style:f,children:[m.jsx("div",{style:y,children:m.jsx(z.MessageCircle,{size:22})}),m.jsx("span",{style:h})]}),m.jsxs("div",{children:[m.jsx("h3",{style:w,children:n.name}),m.jsx("p",{style:C,children:n.subTitle})]})]}),m.jsx("button",{onClick:e,"aria-label":"Close chat",style:S,onMouseEnter:A=>O(A,!0),onMouseLeave:A=>O(A,!1),children:m.jsx(z.X,{size:20})})]}),l?m.jsxs(m.Fragment,{children:[m.jsx(St,{messages:r,isLoading:o,theme:t,botResponseTime:u}),m.jsx(wt,{onSendMessage:ne,isLoading:o,theme:t})]}):m.jsx(Qn,{handleMessageFromForm:W,theme:t,chatBotData:n}),m.jsx("div",{style:g,children:m.jsxs("p",{style:T,children:["powered by"," ",m.jsx("span",{style:k,children:"clone67.com"})]})})]})},er=({pineconeNamespace:e,url:t,primaryColor:n="#3b82f6",secondaryColor:r="#8b5cf6",backgroundColor:s="#ffffff",fontColor:o="#1f2937",placeholderColor:i="#9ca3af",position:l="right",name:p="Assistant",subTitle:u="Typically replies instantly",welcomeText:c="Hi! How can I help you today?"})=>{const[d,x]=N.useState(!1),[E,f]=N.useState("");N.useEffect(()=>{f(xt.v4())},[]);const y=()=>x(k=>!k),h={primaryColor:n,secondaryColor:r,backgroundColor:s,fontColor:o,placeholderColor:i,inputBackgroundColor:s},w={name:p,subTitle:u,welcomeText:c,url:t,pineconeNamespace:e,position:l,sessionId:E},C=l==="left",S="32px",g={position:"fixed",bottom:"104px",[C?"left":"right"]:S,zIndex:9999,pointerEvents:"auto"},T={position:"fixed",bottom:"32px",[C?"left":"right"]:S,zIndex:1e4,pointerEvents:"auto"};return m.jsxs(m.Fragment,{children:[d&&m.jsx("div",{style:g,children:m.jsx(Zn,{onClose:y,theme:h,chatBotData:w})}),m.jsx("div",{style:T,children:m.jsx(gt,{onClick:y,isOpen:d,theme:h,chatBotData:w})})]})};module.exports=er;
|
package/dist/index.js
CHANGED
|
@@ -146,9 +146,7 @@ const Ot = ({ onClick: e, isOpen: t, theme: n, chatBotData: r }) => {
|
|
|
146
146
|
)
|
|
147
147
|
] }) });
|
|
148
148
|
}, kt = ({ messages: e, isLoading: t, theme: n, botResponseTime: r }) => {
|
|
149
|
-
const o = Ct(null)
|
|
150
|
-
console.log("Messages in MessageBox:", e);
|
|
151
|
-
const s = () => {
|
|
149
|
+
const o = Ct(null), s = () => {
|
|
152
150
|
o.current?.scrollIntoView({ behavior: "smooth" });
|
|
153
151
|
};
|
|
154
152
|
Ke(() => {
|
|
@@ -254,7 +252,7 @@ const Pt = de("string"), U = de("function"), tt = de("number"), Z = (e) => e !==
|
|
|
254
252
|
let t;
|
|
255
253
|
return e && (typeof FormData == "function" && e instanceof FormData || U(e.append) && ((t = ue(e)) === "formdata" || // detect form-data instance
|
|
256
254
|
t === "object" && U(e.toString) && e.toString() === "[object FormData]"));
|
|
257
|
-
}, zt = B("URLSearchParams"), [Ht,
|
|
255
|
+
}, zt = B("URLSearchParams"), [Ht, qt, Mt, $t] = ["ReadableStream", "Request", "Response", "Headers"].map(B), Wt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
258
256
|
function ee(e, t, { allOwnKeys: n = !1 } = {}) {
|
|
259
257
|
if (e === null || typeof e > "u")
|
|
260
258
|
return;
|
|
@@ -282,7 +280,7 @@ function nt(e, t) {
|
|
|
282
280
|
return o;
|
|
283
281
|
return null;
|
|
284
282
|
}
|
|
285
|
-
const
|
|
283
|
+
const q = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, rt = (e) => !V(e) && e !== q;
|
|
286
284
|
function ge() {
|
|
287
285
|
const { caseless: e, skipUndefined: t } = rt(this) && this || {}, n = {}, r = (o, s) => {
|
|
288
286
|
const i = e && nt(n, s) || s;
|
|
@@ -391,14 +389,14 @@ const un = (e) => {
|
|
|
391
389
|
return r;
|
|
392
390
|
};
|
|
393
391
|
return n(e, 0);
|
|
394
|
-
}, dn = B("AsyncFunction"), fn = (e) => e && (Z(e) || U(e)) && U(e.then) && U(e.catch), st = ((e, t) => e ? setImmediate : t ? ((n, r) => (
|
|
395
|
-
o ===
|
|
392
|
+
}, dn = B("AsyncFunction"), fn = (e) => e && (Z(e) || U(e)) && U(e.then) && U(e.catch), st = ((e, t) => e ? setImmediate : t ? ((n, r) => (q.addEventListener("message", ({ source: o, data: s }) => {
|
|
393
|
+
o === q && s === n && r.length && r.shift()();
|
|
396
394
|
}, !1), (o) => {
|
|
397
|
-
r.push(o),
|
|
395
|
+
r.push(o), q.postMessage(n, "*");
|
|
398
396
|
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
|
|
399
397
|
typeof setImmediate == "function",
|
|
400
|
-
U(
|
|
401
|
-
), pn = typeof queueMicrotask < "u" ? queueMicrotask.bind(
|
|
398
|
+
U(q.postMessage)
|
|
399
|
+
), pn = typeof queueMicrotask < "u" ? queueMicrotask.bind(q) : typeof process < "u" && process.nextTick || st, hn = (e) => e != null && U(e[ce]), a = {
|
|
402
400
|
isArray: K,
|
|
403
401
|
isArrayBuffer: et,
|
|
404
402
|
isBuffer: Q,
|
|
@@ -411,8 +409,8 @@ const un = (e) => {
|
|
|
411
409
|
isPlainObject: se,
|
|
412
410
|
isEmptyObject: _t,
|
|
413
411
|
isReadableStream: Ht,
|
|
414
|
-
isRequest:
|
|
415
|
-
isResponse:
|
|
412
|
+
isRequest: qt,
|
|
413
|
+
isResponse: Mt,
|
|
416
414
|
isHeaders: $t,
|
|
417
415
|
isUndefined: V,
|
|
418
416
|
isDate: Lt,
|
|
@@ -448,7 +446,7 @@ const un = (e) => {
|
|
|
448
446
|
noop: an,
|
|
449
447
|
toFiniteNumber: ln,
|
|
450
448
|
findKey: nt,
|
|
451
|
-
global:
|
|
449
|
+
global: q,
|
|
452
450
|
isContextDefined: rt,
|
|
453
451
|
isSpecCompliantForm: cn,
|
|
454
452
|
toJSONObject: un,
|
|
@@ -712,14 +710,14 @@ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Tn
|
|
|
712
710
|
hasStandardBrowserWebWorkerEnv: Cn,
|
|
713
711
|
navigator: we,
|
|
714
712
|
origin: Tn
|
|
715
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
713
|
+
}, Symbol.toStringTag, { value: "Module" })), F = {
|
|
716
714
|
...On,
|
|
717
715
|
...En
|
|
718
716
|
};
|
|
719
717
|
function An(e, t) {
|
|
720
|
-
return fe(e, new
|
|
718
|
+
return fe(e, new F.classes.URLSearchParams(), {
|
|
721
719
|
visitor: function(n, r, o, s) {
|
|
722
|
-
return
|
|
720
|
+
return F.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments);
|
|
723
721
|
},
|
|
724
722
|
...t
|
|
725
723
|
});
|
|
@@ -814,8 +812,8 @@ const te = {
|
|
|
814
812
|
maxContentLength: -1,
|
|
815
813
|
maxBodyLength: -1,
|
|
816
814
|
env: {
|
|
817
|
-
FormData:
|
|
818
|
-
Blob:
|
|
815
|
+
FormData: F.classes.FormData,
|
|
816
|
+
Blob: F.classes.Blob
|
|
819
817
|
},
|
|
820
818
|
validateStatus: function(t) {
|
|
821
819
|
return t >= 200 && t < 300;
|
|
@@ -1115,10 +1113,10 @@ const le = (e, t, n = 3) => {
|
|
|
1115
1113
|
total: e,
|
|
1116
1114
|
loaded: r
|
|
1117
1115
|
}), t[1]];
|
|
1118
|
-
}, Ie = (e) => (...t) => a.asap(() => e(...t)), zn =
|
|
1119
|
-
new URL(
|
|
1120
|
-
|
|
1121
|
-
) : () => !0, Hn =
|
|
1116
|
+
}, Ie = (e) => (...t) => a.asap(() => e(...t)), zn = F.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, F.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
|
|
1117
|
+
new URL(F.origin),
|
|
1118
|
+
F.navigator && /(msie|trident)/i.test(F.navigator.userAgent)
|
|
1119
|
+
) : () => !0, Hn = F.hasStandardBrowserEnv ? (
|
|
1122
1120
|
// Standard browser envs support document.cookie
|
|
1123
1121
|
{
|
|
1124
1122
|
write(e, t, n, r, o, s, i) {
|
|
@@ -1147,15 +1145,15 @@ const le = (e, t, n = 3) => {
|
|
|
1147
1145
|
}
|
|
1148
1146
|
}
|
|
1149
1147
|
);
|
|
1150
|
-
function
|
|
1148
|
+
function qn(e) {
|
|
1151
1149
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
|
|
1152
1150
|
}
|
|
1153
|
-
function
|
|
1151
|
+
function Mn(e, t) {
|
|
1154
1152
|
return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
|
|
1155
1153
|
}
|
|
1156
1154
|
function mt(e, t, n) {
|
|
1157
|
-
let r = !
|
|
1158
|
-
return e && (r || n == !1) ?
|
|
1155
|
+
let r = !qn(t);
|
|
1156
|
+
return e && (r || n == !1) ? Mn(e, t) : t;
|
|
1159
1157
|
}
|
|
1160
1158
|
const ve = (e) => e instanceof _ ? { ...e } : e;
|
|
1161
1159
|
function $(e, t) {
|
|
@@ -1229,7 +1227,7 @@ const yt = (e) => {
|
|
|
1229
1227
|
"Authorization",
|
|
1230
1228
|
"Basic " + btoa((l.username || "") + ":" + (l.password ? unescape(encodeURIComponent(l.password)) : ""))
|
|
1231
1229
|
), a.isFormData(n)) {
|
|
1232
|
-
if (
|
|
1230
|
+
if (F.hasStandardBrowserEnv || F.hasStandardBrowserWebWorkerEnv)
|
|
1233
1231
|
i.setContentType(void 0);
|
|
1234
1232
|
else if (a.isFunction(n.getHeaders)) {
|
|
1235
1233
|
const p = n.getHeaders(), u = ["content-type", "content-length"];
|
|
@@ -1238,7 +1236,7 @@ const yt = (e) => {
|
|
|
1238
1236
|
});
|
|
1239
1237
|
}
|
|
1240
1238
|
}
|
|
1241
|
-
if (
|
|
1239
|
+
if (F.hasStandardBrowserEnv && (r && a.isFunction(r) && (r = r(t)), r || r !== !1 && zn(t.url))) {
|
|
1242
1240
|
const p = o && s && Hn.read(s);
|
|
1243
1241
|
p && i.set(o, p);
|
|
1244
1242
|
}
|
|
@@ -1278,8 +1276,8 @@ const yt = (e) => {
|
|
|
1278
1276
|
}, h.onabort = function() {
|
|
1279
1277
|
h && (r(new b("Request aborted", b.ECONNABORTED, e, h)), h = null);
|
|
1280
1278
|
}, h.onerror = function(x) {
|
|
1281
|
-
const T = x && x.message ? x.message : "Network Error",
|
|
1282
|
-
|
|
1279
|
+
const T = x && x.message ? x.message : "Network Error", N = new b(T, b.ERR_NETWORK, e, h);
|
|
1280
|
+
N.event = x || null, r(N), h = null;
|
|
1283
1281
|
}, h.ontimeout = function() {
|
|
1284
1282
|
let x = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
|
|
1285
1283
|
const T = o.transitional || dt;
|
|
@@ -1295,7 +1293,7 @@ const yt = (e) => {
|
|
|
1295
1293
|
h && (r(!S || S.type ? new X(null, e, h) : S), h.abort(), h = null);
|
|
1296
1294
|
}, o.cancelToken && o.cancelToken.subscribe(c), o.signal && (o.signal.aborted ? c() : o.signal.addEventListener("abort", c)));
|
|
1297
1295
|
const C = jn(o.url);
|
|
1298
|
-
if (C &&
|
|
1296
|
+
if (C && F.protocols.indexOf(C) === -1) {
|
|
1299
1297
|
r(new b("Unsupported protocol " + C + ":", b.ERR_BAD_REQUEST, e));
|
|
1300
1298
|
return;
|
|
1301
1299
|
}
|
|
@@ -1385,8 +1383,8 @@ const yt = (e) => {
|
|
|
1385
1383
|
Request: e,
|
|
1386
1384
|
Response: t
|
|
1387
1385
|
}))(a.global), {
|
|
1388
|
-
ReadableStream:
|
|
1389
|
-
TextEncoder:
|
|
1386
|
+
ReadableStream: qe,
|
|
1387
|
+
TextEncoder: Me
|
|
1390
1388
|
} = a.global, $e = (e, ...t) => {
|
|
1391
1389
|
try {
|
|
1392
1390
|
return !!e(...t);
|
|
@@ -1400,10 +1398,10 @@ const yt = (e) => {
|
|
|
1400
1398
|
const { fetch: t, Request: n, Response: r } = e, o = t ? oe(t) : typeof fetch == "function", s = oe(n), i = oe(r);
|
|
1401
1399
|
if (!o)
|
|
1402
1400
|
return !1;
|
|
1403
|
-
const l = o && oe(
|
|
1401
|
+
const l = o && oe(qe), p = o && (typeof Me == "function" ? /* @__PURE__ */ ((f) => (m) => f.encode(m))(new Me()) : async (f) => new Uint8Array(await new n(f).arrayBuffer())), u = s && l && $e(() => {
|
|
1404
1402
|
let f = !1;
|
|
1405
|
-
const m = new n(
|
|
1406
|
-
body: new
|
|
1403
|
+
const m = new n(F.origin, {
|
|
1404
|
+
body: new qe(),
|
|
1407
1405
|
method: "POST",
|
|
1408
1406
|
get duplex() {
|
|
1409
1407
|
return f = !0, "half";
|
|
@@ -1427,7 +1425,7 @@ const yt = (e) => {
|
|
|
1427
1425
|
if (a.isBlob(f))
|
|
1428
1426
|
return f.size;
|
|
1429
1427
|
if (a.isSpecCompliantForm(f))
|
|
1430
|
-
return (await new n(
|
|
1428
|
+
return (await new n(F.origin, {
|
|
1431
1429
|
method: "POST",
|
|
1432
1430
|
body: f
|
|
1433
1431
|
}).arrayBuffer()).byteLength;
|
|
@@ -1448,12 +1446,12 @@ const yt = (e) => {
|
|
|
1448
1446
|
cancelToken: S,
|
|
1449
1447
|
timeout: x,
|
|
1450
1448
|
onDownloadProgress: T,
|
|
1451
|
-
onUploadProgress:
|
|
1449
|
+
onUploadProgress: N,
|
|
1452
1450
|
responseType: A,
|
|
1453
1451
|
headers: Y,
|
|
1454
1452
|
withCredentials: W = "same-origin",
|
|
1455
1453
|
fetchOptions: ne
|
|
1456
|
-
} = yt(f),
|
|
1454
|
+
} = yt(f), k = t || fetch;
|
|
1457
1455
|
A = A ? (A + "").toLowerCase() : "text";
|
|
1458
1456
|
let P = Jn([C, S && S.toAbortSignal()], x), I = null;
|
|
1459
1457
|
const v = P && P.unsubscribe && (() => {
|
|
@@ -1461,7 +1459,7 @@ const yt = (e) => {
|
|
|
1461
1459
|
});
|
|
1462
1460
|
let Ae;
|
|
1463
1461
|
try {
|
|
1464
|
-
if (
|
|
1462
|
+
if (N && u && h !== "get" && h !== "head" && (Ae = await E(Y, w)) !== 0) {
|
|
1465
1463
|
let H = new n(m, {
|
|
1466
1464
|
method: "POST",
|
|
1467
1465
|
body: w,
|
|
@@ -1470,7 +1468,7 @@ const yt = (e) => {
|
|
|
1470
1468
|
if (a.isFormData(w) && (J = H.headers.get("content-type")) && Y.setContentType(J), H.body) {
|
|
1471
1469
|
const [he, re] = je(
|
|
1472
1470
|
Ae,
|
|
1473
|
-
le(Ie(
|
|
1471
|
+
le(Ie(N))
|
|
1474
1472
|
);
|
|
1475
1473
|
w = ze(H.body, He, he, re);
|
|
1476
1474
|
}
|
|
@@ -1486,7 +1484,7 @@ const yt = (e) => {
|
|
|
1486
1484
|
credentials: D ? W : void 0
|
|
1487
1485
|
};
|
|
1488
1486
|
I = s && new n(m, ke);
|
|
1489
|
-
let z = await (s ?
|
|
1487
|
+
let z = await (s ? k(I, ne) : k(m, ke));
|
|
1490
1488
|
const Fe = c && (A === "stream" || A === "response");
|
|
1491
1489
|
if (c && (T || Fe && v)) {
|
|
1492
1490
|
const H = {};
|
|
@@ -1666,7 +1664,7 @@ const ae = {
|
|
|
1666
1664
|
assertOptions: tr,
|
|
1667
1665
|
validators: pe
|
|
1668
1666
|
}, j = ae.validators;
|
|
1669
|
-
let
|
|
1667
|
+
let M = class {
|
|
1670
1668
|
constructor(t) {
|
|
1671
1669
|
this.defaults = t || {}, this.interceptors = {
|
|
1672
1670
|
request: new Be(),
|
|
@@ -1767,7 +1765,7 @@ let q = class {
|
|
|
1767
1765
|
}
|
|
1768
1766
|
};
|
|
1769
1767
|
a.forEach(["delete", "get", "head", "options"], function(t) {
|
|
1770
|
-
|
|
1768
|
+
M.prototype[t] = function(n, r) {
|
|
1771
1769
|
return this.request($(r || {}, {
|
|
1772
1770
|
method: t,
|
|
1773
1771
|
url: n,
|
|
@@ -1788,7 +1786,7 @@ a.forEach(["post", "put", "patch"], function(t) {
|
|
|
1788
1786
|
}));
|
|
1789
1787
|
};
|
|
1790
1788
|
}
|
|
1791
|
-
|
|
1789
|
+
M.prototype[t] = n(), M.prototype[t + "Form"] = n(!0);
|
|
1792
1790
|
});
|
|
1793
1791
|
let nr = class wt {
|
|
1794
1792
|
constructor(t) {
|
|
@@ -1946,13 +1944,13 @@ Object.entries(Se).forEach(([e, t]) => {
|
|
|
1946
1944
|
Se[t] = e;
|
|
1947
1945
|
});
|
|
1948
1946
|
function St(e) {
|
|
1949
|
-
const t = new
|
|
1950
|
-
return a.extend(n,
|
|
1947
|
+
const t = new M(e), n = Qe(M.prototype.request, t);
|
|
1948
|
+
return a.extend(n, M.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(o) {
|
|
1951
1949
|
return St($(e, o));
|
|
1952
1950
|
}, n;
|
|
1953
1951
|
}
|
|
1954
1952
|
const R = St(te);
|
|
1955
|
-
R.Axios =
|
|
1953
|
+
R.Axios = M;
|
|
1956
1954
|
R.CanceledError = X;
|
|
1957
1955
|
R.CancelToken = nr;
|
|
1958
1956
|
R.isCancel = pt;
|
|
@@ -1988,27 +1986,28 @@ const {
|
|
|
1988
1986
|
formToJSON: Or,
|
|
1989
1987
|
getAdapter: Ar,
|
|
1990
1988
|
mergeConfig: kr
|
|
1991
|
-
} = R, Et = async (e, t, n, r) => {
|
|
1992
|
-
const
|
|
1989
|
+
} = R, Et = async (e, t, n, r, o, s) => {
|
|
1990
|
+
const i = {
|
|
1993
1991
|
chatInput: e,
|
|
1994
1992
|
sessionId: t,
|
|
1995
1993
|
metadata: {
|
|
1996
|
-
pinecone_namespace: n
|
|
1994
|
+
pinecone_namespace: n,
|
|
1995
|
+
name: o,
|
|
1996
|
+
email: s
|
|
1997
1997
|
}
|
|
1998
1998
|
};
|
|
1999
1999
|
try {
|
|
2000
|
-
|
|
2000
|
+
return (await R.post(
|
|
2001
2001
|
r,
|
|
2002
|
-
|
|
2002
|
+
i,
|
|
2003
2003
|
{
|
|
2004
2004
|
headers: {
|
|
2005
2005
|
"Content-Type": "application/json"
|
|
2006
2006
|
}
|
|
2007
2007
|
}
|
|
2008
|
-
)
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
throw console.error("Error communicating with chat API:", s), s;
|
|
2008
|
+
)).data;
|
|
2009
|
+
} catch (l) {
|
|
2010
|
+
throw console.error("Error communicating with chat API:", l), l;
|
|
2012
2011
|
}
|
|
2013
2012
|
}, sr = ({ handleMessageFromForm: e, theme: t, chatBotData: n }) => {
|
|
2014
2013
|
const [r, o] = L(""), [s, i] = L(""), [l, p] = L(""), [u, c] = L(!1), d = async (x) => {
|
|
@@ -2018,20 +2017,20 @@ const {
|
|
|
2018
2017
|
}
|
|
2019
2018
|
const T = `Hi, I am ${r} and my email is ${s}`;
|
|
2020
2019
|
try {
|
|
2021
|
-
const
|
|
2020
|
+
const A = (await Et(
|
|
2022
2021
|
T,
|
|
2023
2022
|
n.sessionId,
|
|
2024
2023
|
n.pineconeNamespace,
|
|
2025
|
-
n.url
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2024
|
+
n.url,
|
|
2025
|
+
r,
|
|
2026
|
+
s
|
|
2027
|
+
)).response;
|
|
2029
2028
|
e([
|
|
2030
2029
|
{ type: "user", text: T },
|
|
2031
2030
|
{ type: "bot", text: A }
|
|
2032
2031
|
]);
|
|
2033
|
-
} catch (
|
|
2034
|
-
console.log("error sending user details",
|
|
2032
|
+
} catch (N) {
|
|
2033
|
+
console.log("error sending user details", N), p("Failed to submit. Please try again.");
|
|
2035
2034
|
} finally {
|
|
2036
2035
|
c(!1);
|
|
2037
2036
|
}
|
|
@@ -2224,24 +2223,24 @@ const {
|
|
|
2224
2223
|
fontSize: "11px",
|
|
2225
2224
|
color: t.fontColor,
|
|
2226
2225
|
letterSpacing: "0.5px"
|
|
2227
|
-
},
|
|
2226
|
+
}, N = {
|
|
2228
2227
|
fontWeight: "600"
|
|
2229
|
-
}, A = (
|
|
2230
|
-
|
|
2231
|
-
}, Y = (
|
|
2228
|
+
}, A = (k, P) => {
|
|
2229
|
+
k.currentTarget.style.background = P ? "rgba(255,255,255,0.2)" : "transparent";
|
|
2230
|
+
}, Y = (k) => k ? new Date(k).toLocaleTimeString("en-AU", {
|
|
2232
2231
|
hour: "2-digit",
|
|
2233
2232
|
minute: "2-digit"
|
|
2234
|
-
}) : "", W = (
|
|
2235
|
-
o(
|
|
2236
|
-
}, ne = async (
|
|
2237
|
-
i(!0), o((P) => [...P, { type: "user", text:
|
|
2233
|
+
}) : "", W = (k) => {
|
|
2234
|
+
o(k), p(!0);
|
|
2235
|
+
}, ne = async (k) => {
|
|
2236
|
+
i(!0), o((P) => [...P, { type: "user", text: k }]);
|
|
2238
2237
|
try {
|
|
2239
2238
|
const P = await Et(
|
|
2240
|
-
|
|
2239
|
+
k,
|
|
2241
2240
|
n.sessionId,
|
|
2242
2241
|
n.pineconeNamespace,
|
|
2243
2242
|
n.url
|
|
2244
|
-
), I = P.
|
|
2243
|
+
), I = P.response;
|
|
2245
2244
|
c(Y(P.response_timestamp)), o((v) => [...v, { type: "bot", text: I }]);
|
|
2246
2245
|
} catch (P) {
|
|
2247
2246
|
console.error("Chat error:", P), o((I) => [
|
|
@@ -2270,8 +2269,8 @@ const {
|
|
|
2270
2269
|
onClick: e,
|
|
2271
2270
|
"aria-label": "Close chat",
|
|
2272
2271
|
style: S,
|
|
2273
|
-
onMouseEnter: (
|
|
2274
|
-
onMouseLeave: (
|
|
2272
|
+
onMouseEnter: (k) => A(k, !0),
|
|
2273
|
+
onMouseLeave: (k) => A(k, !1),
|
|
2275
2274
|
children: /* @__PURE__ */ y(Xe, { size: 20 })
|
|
2276
2275
|
}
|
|
2277
2276
|
)
|
|
@@ -2290,7 +2289,7 @@ const {
|
|
|
2290
2289
|
/* @__PURE__ */ y("div", { style: x, children: /* @__PURE__ */ O("p", { style: T, children: [
|
|
2291
2290
|
"powered by",
|
|
2292
2291
|
" ",
|
|
2293
|
-
/* @__PURE__ */ y("span", { style:
|
|
2292
|
+
/* @__PURE__ */ y("span", { style: N, children: "clone67.com" })
|
|
2294
2293
|
] }) })
|
|
2295
2294
|
] });
|
|
2296
2295
|
}, Fr = ({
|
|
@@ -2310,7 +2309,7 @@ const {
|
|
|
2310
2309
|
Ke(() => {
|
|
2311
2310
|
f(Tt());
|
|
2312
2311
|
}, []);
|
|
2313
|
-
const m = () => g((
|
|
2312
|
+
const m = () => g((N) => !N), h = {
|
|
2314
2313
|
primaryColor: n,
|
|
2315
2314
|
secondaryColor: r,
|
|
2316
2315
|
backgroundColor: o,
|
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-aichatbot-widget",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "A React ChatBot Widget",
|
|
5
|
-
"main": "dist/index.cjs",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist",
|
|
10
|
-
"index.js"
|
|
11
|
-
],
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "https://github.com/Prashanta-Pandit/chatbot-widget"
|
|
16
|
-
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "vite build",
|
|
19
|
-
"prepare": "npm run build"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [
|
|
22
|
-
"react",
|
|
23
|
-
"chatbot",
|
|
24
|
-
"widget"
|
|
25
|
-
],
|
|
26
|
-
"author": "Prashanta Pandit",
|
|
27
|
-
"peerDependencies": {
|
|
28
|
-
"lucide-react": "^0.554.0",
|
|
29
|
-
"react": "^18.0.0 || ^19.0.0",
|
|
30
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@vitejs/plugin-react": "^4.0.0",
|
|
34
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
35
|
-
"vite": "^7.2.4"
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"axios": "^1.6.0",
|
|
39
|
-
"uuid": "^13.0.0"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-aichatbot-widget",
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "A React ChatBot Widget",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"index.js"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/Prashanta-Pandit/chatbot-widget"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "vite build",
|
|
19
|
+
"prepare": "npm run build"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"react",
|
|
23
|
+
"chatbot",
|
|
24
|
+
"widget"
|
|
25
|
+
],
|
|
26
|
+
"author": "Prashanta Pandit",
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"lucide-react": "^0.554.0",
|
|
29
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
30
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
34
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
35
|
+
"vite": "^7.2.4"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"axios": "^1.6.0",
|
|
39
|
+
"uuid": "^13.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|