react-aichatbot-widget 1.5.0 → 1.5.2

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 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**, **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
-
33
- ---
34
-
35
- ## Usage Example
36
-
37
- ```jsx
38
- import React from "react";
39
- import ChatBotWidget from "react-aichatbot-widget";
40
-
41
- function App() {
42
- return (
43
- <div className="App">
44
- {/*add a namespace for chatbot and chatbot url*/}
45
- <ChatBotWidget
46
- pineconeNamespace=''
47
- url=''
48
- chatMessageUrl=''
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` 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**, **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
+
33
+ ---
34
+
35
+ ## Usage Example
36
+
37
+ ```jsx
38
+ import React from "react";
39
+ import ChatBotWidget from "react-aichatbot-widget";
40
+
41
+ function App() {
42
+ return (
43
+ <div className="App">
44
+ {/*add a namespace for chatbot and chatbot url*/}
45
+ <ChatBotWidget
46
+ pineconeNamespace=''
47
+ url=''
48
+ chatMessageUrl=''
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` 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,18 +1,6 @@
1
- "use strict";const h=require("react/jsx-runtime"),N=require("react"),D=require("lucide-react"),bt=({onMinimise: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)"},d={position:"absolute",top:"-4px",right:"-4px",width:"16px",height:"16px",backgroundColor:"#34d399",borderRadius:"50%",border:"4px solid white",animation:"pulse 2s infinite"};return h.jsxs("button",{onClick:e,style:l,onMouseEnter:c=>Object.assign(c.currentTarget.style,p),onMouseLeave:c=>Object.keys(p).forEach(u=>c.currentTarget.style[u]=l[u]||""),onFocus:c=>Object.assign(c.currentTarget.style,p),onBlur:c=>Object.keys(p).forEach(u=>c.currentTarget.style[u]=l[u]||""),children:[t?h.jsx(D.Minus,{size:20,strokeWidth:2.5}):h.jsx(D.MessageCircle,{size:20,strokeWidth:2.5}),!t&&h.jsx("span",{style:d}),h.jsx("style",{jsx:!0,children:`
2
- @keyframes pulse {
3
- 0% {
4
- box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
5
- }
6
- 70% {
7
- box-shadow: 0 0 0 10px rgba(52, 211, 153, 0);
8
- }
9
- 100% {
10
- box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
11
- }
12
- }
13
- `})]})},xt=({onSendMessage:e,isLoading:t,theme:n})=>{const[r,s]=N.useState(""),i=()=>{!r.trim()||t||(e(r.trim()),s(""))},o=u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),i())},l={padding:"16px",borderTop:"1px solid rgba(255, 255, 255, 0.2)",borderColor:n.fontColor,background:n.backgroundColor,flexShrink:0},p={display:"flex",gap:"12px",alignItems:"center"},d={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 h.jsx("div",{style:l,children:h.jsxs("div",{style:p,children:[h.jsx("input",{type:"text",placeholder:"Type a message...",value:r,onChange:u=>s(u.target.value),onKeyDown:o,disabled:t,style:d,onFocus:u=>{u.target.style.boxShadow="0 0 0 3px rgba(100, 150, 255, 0.3)",u.target.style.borderColor="#60a5fa"},onBlur:u=>{u.target.style.boxShadow="none",u.target.style.borderColor=n.fontColor}}),h.jsx("button",{onClick:i,disabled:t||!r.trim(),style:c,"aria-label":"Send message",onMouseEnter:u=>{!t&&r.trim()&&(u.currentTarget.style.transform="translateY(-2px)",u.currentTarget.style.boxShadow="0 8px 16px rgba(0,0,0,0.15)")},onMouseLeave:u=>{u.currentTarget.style.transform="translateY(0)",u.currentTarget.style.boxShadow="none"},children:h.jsx(D.Send,{size:18})})]})})},gt=({messages:e,isLoading:t,theme:n})=>{const r=N.useRef(null),s=()=>{r.current?.scrollIntoView({behavior:"smooth"})};function i(u){return new Date(u).toLocaleString("en-AU",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}N.useEffect(()=>{s()},[e,t]);const o={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=u=>({display:"flex",justifyContent:u==="user"?"flex-end":"flex-start",width:"100%"}),p={display:"flex",flexDirection:"column",maxWidth:"80%"},d=u=>({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:u==="user"?n.primaryColor:n.backgroundColor,color:n.fontColor,wordWrap:"break-word"}),c={...d("bot"),animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s"};return h.jsxs("div",{style:o,children:[e.map((u,x)=>h.jsx("div",{style:l(u.type),children:h.jsxs("div",{style:p,children:[u.type==="bot"&&h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-start",marginLeft:"4px",marginBottom:"2px"},children:[h.jsx(D.Bot,{size:14,color:n.fontColor}),h.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:i(u.response_timestamp)})]}),u.type==="user"&&h.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-end",marginRight:"4px",marginBottom:"2px"},children:h.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:"You"})}),h.jsx("div",{style:d(u.type),children:u.text})]})},x)),t&&h.jsx("div",{style:l("bot"),children:h.jsxs("div",{style:{typingBubbleStyle:c,display:"flex",alignItems:"center",gap:"8px"},children:[h.jsx(D.Bot,{size:24}),h.jsx("span",{children:"Typing..."})]})}),h.jsx("div",{ref:r})]})};function Je(e,t){return function(){return e.apply(t,arguments)}}const{toString:wt}=Object.prototype,{getPrototypeOf:Re}=Object,{iterator:ue,toStringTag:Ve}=Symbol,de=(e=>t=>{const n=wt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),L=e=>(e=e.toLowerCase(),t=>de(t)===e),fe=e=>t=>typeof t===e,{isArray:G}=Array,X=fe("undefined");function Z(e){return e!==null&&!X(e)&&e.constructor!==null&&!X(e.constructor)&&P(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ke=L("ArrayBuffer");function St(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ke(e.buffer),t}const Et=fe("string"),P=fe("function"),Xe=fe("number"),ee=e=>e!==null&&typeof e=="object",Rt=e=>e===!0||e===!1,ie=e=>{if(de(e)!=="object")return!1;const t=Re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ve in e)&&!(ue in e)},Ct=e=>{if(!ee(e)||Z(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Tt=L("Date"),Ot=L("File"),At=L("Blob"),jt=L("FileList"),kt=e=>ee(e)&&P(e.pipe),Ft=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||P(e.append)&&((t=de(e))==="formdata"||t==="object"&&P(e.toString)&&e.toString()==="[object FormData]"))},Nt=L("URLSearchParams"),[Pt,_t,Ut,Lt]=["ReadableStream","Request","Response","Headers"].map(L),Bt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function te(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),G(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Z(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let l;for(r=0;r<o;r++)l=i[r],t.call(null,e[l],l,e)}}function Ge(e,t){if(Z(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const q=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ye=e=>!X(e)&&e!==q;function ge(){const{caseless:e,skipUndefined:t}=Ye(this)&&this||{},n={},r=(s,i)=>{const o=e&&Ge(n,i)||i;ie(n[o])&&ie(s)?n[o]=ge(n[o],s):ie(s)?n[o]=ge({},s):G(s)?n[o]=s.slice():(!t||!X(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&te(arguments[s],r);return n}const It=(e,t,n,{allOwnKeys:r}={})=>(te(t,(s,i)=>{n&&P(s)?e[i]=Je(s,n):e[i]=s},{allOwnKeys:r}),e),Dt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),vt=(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)},Mt=(e,t,n,r)=>{let s,i,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&Re(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},zt=(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},qt=e=>{if(!e)return null;if(G(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},Ht=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Re(Uint8Array)),$t=(e,t)=>{const r=(e&&e[ue]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Wt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Jt=L("HTMLFormElement"),Vt=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),Kt=L("RegExp"),Qe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};te(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Xt=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+"'")})}})},Gt=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return G(e)?r(e):r(String(e).split(t)),n},Yt=()=>{},Qt=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Zt(e){return!!(e&&P(e.append)&&e[Ve]==="FormData"&&e[ue])}const en=e=>{const t=new Array(10),n=(r,s)=>{if(ee(r)){if(t.indexOf(r)>=0)return;if(Z(r))return r;if(!("toJSON"in r)){t[s]=r;const i=G(r)?[]:{};return te(r,(o,l)=>{const p=n(o,s+1);!X(p)&&(i[l]=p)}),t[s]=void 0,i}}return r};return n(e,0)},tn=L("AsyncFunction"),nn=e=>e&&(ee(e)||P(e))&&P(e.then)&&P(e.catch),Ze=((e,t)=>e?setImmediate:t?((n,r)=>(q.addEventListener("message",({source:s,data:i})=>{s===q&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),q.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",P(q.postMessage)),rn=typeof queueMicrotask<"u"?queueMicrotask.bind(q):typeof process<"u"&&process.nextTick||Ze,sn=e=>e!=null&&P(e[ue]),a={isArray:G,isArrayBuffer:Ke,isBuffer:Z,isFormData:Ft,isArrayBufferView:St,isString:Et,isNumber:Xe,isBoolean:Rt,isObject:ee,isPlainObject:ie,isEmptyObject:Ct,isReadableStream:Pt,isRequest:_t,isResponse:Ut,isHeaders:Lt,isUndefined:X,isDate:Tt,isFile:Ot,isBlob:At,isRegExp:Kt,isFunction:P,isStream:kt,isURLSearchParams:Nt,isTypedArray:Ht,isFileList:jt,forEach:te,merge:ge,extend:It,trim:Bt,stripBOM:Dt,inherits:vt,toFlatObject:Mt,kindOf:de,kindOfTest:L,endsWith:zt,toArray:qt,forEachEntry:$t,matchAll:Wt,isHTMLForm:Jt,hasOwnProperty:Fe,hasOwnProp:Fe,reduceDescriptors:Qe,freezeMethods:Xt,toObjectSet:Gt,toCamelCase:Vt,noop:Yt,toFiniteNumber:Qt,findKey:Ge,global:q,isContextDefined:Ye,isSpecCompliantForm:Zt,toJSONObject:en,isAsyncFn:tn,isThenable:nn,setImmediate:Ze,asap:rn,isIterable:sn};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,i)=>{const o=Object.create(et);a.toFlatObject(e,o,function(c){return c!==Error.prototype},d=>d!=="isAxiosError");const l=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return b.call(o,l,p,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const on=null;function we(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,i){return s=nt(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function an(e){return a.isArray(e)&&!e.some(we)}const ln=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function pe(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,m){return!a.isUndefined(m[y])});const r=n.metaTokens,s=n.visitor||c,i=n.dots,o=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 d(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,m){let S=f;if(f&&!m&&typeof f=="object"){if(a.endsWith(y,"{}"))y=r?y:y.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&an(f)||(a.isFileList(f)||a.endsWith(y,"[]"))&&(S=a.toArray(f)))return y=nt(y),S.forEach(function(w,C){!(a.isUndefined(w)||w===null)&&t.append(o===!0?Ne([y],C,i):o===null?y:y+"[]",d(w))}),!1}return we(f)?!0:(t.append(Ne(m,y,i),d(f)),!1)}const u=[],x=Object.assign(ln,{defaultVisitor:c,convertValue:d,isVisitable:we});function E(f,y){if(!a.isUndefined(f)){if(u.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));u.push(f),a.forEach(f,function(S,O){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(O)?O.trim():O,y,x))===!0&&E(S,y?y.concat(O):[O])}),u.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 Ce(e,t){this._pairs=[],e&&pe(e,this,t)}const rt=Ce.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 cn(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||cn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new Ce(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class _e{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const ot={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},un=typeof URLSearchParams<"u"?URLSearchParams:Ce,dn=typeof FormData<"u"?FormData:null,fn=typeof Blob<"u"?Blob:null,pn={isBrowser:!0,classes:{URLSearchParams:un,FormData:dn,Blob:fn},protocols:["http","https","file","blob","url","data"]},Te=typeof window<"u"&&typeof document<"u",Se=typeof navigator=="object"&&navigator||void 0,hn=Te&&(!Se||["ReactNative","NativeScript","NS"].indexOf(Se.product)<0),mn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yn=Te&&window.location.href||"http://localhost",bn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Te,hasStandardBrowserEnv:hn,hasStandardBrowserWebWorkerEnv:mn,navigator:Se,origin:yn},Symbol.toStringTag,{value:"Module"})),F={...bn,...pn};function xn(e,t){return pe(e,new F.classes.URLSearchParams,{visitor:function(n,r,s,i){return F.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function gn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function wn(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function it(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),p=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,p?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=wn(s[o])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(gn(r),s,n,0)}),n}return null}function Sn(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 ne={transitional:ot,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(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(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return xn(t,this.formSerializer).toString();if((l=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return pe(l?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Sn(t)):t}],transformResponse:[function(t){const n=this.transitional||ne.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?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:F.classes.FormData,Blob:F.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=>{ne.headers[e]={}});const En=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"]),Rn=e=>{const t={};let n,r,s;return e&&e.split(`
1
+ "use strict";const h=require("react/jsx-runtime"),N=require("react"),D=require("lucide-react"),xt=({onMinimise: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={position:"absolute",top:"-4px",right:"-4px",width:"16px",height:"16px",backgroundColor:"#34d399",borderRadius:"50%",border:"4px solid white",animation:"pulse 2s infinite"};return h.jsxs("button",{onClick:e,style:l,children:[t?h.jsx(D.Minus,{size:20,strokeWidth:2.5}):h.jsx(D.MessageCircle,{size:20,strokeWidth:2.5}),!t&&h.jsx("span",{style:p})]})},bt=({onSendMessage:e,isLoading:t,theme:n})=>{const[r,s]=N.useState(""),i=()=>{!r.trim()||t||(e(r.trim()),s(""))},o=u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),i())},l={padding:"16px",borderTop:"1px solid rgba(255, 255, 255, 0.2)",borderColor:n.fontColor,background:n.backgroundColor,flexShrink:0},p={display:"flex",gap:"12px",alignItems:"center"},d={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 h.jsx("div",{style:l,children:h.jsxs("div",{style:p,children:[h.jsx("input",{type:"text",placeholder:"Type a message...",value:r,onChange:u=>s(u.target.value),onKeyDown:o,disabled:t,style:d,onFocus:u=>{u.target.style.boxShadow="0 0 0 3px rgba(100, 150, 255, 0.3)",u.target.style.borderColor="#60a5fa"},onBlur:u=>{u.target.style.boxShadow="none",u.target.style.borderColor=n.fontColor}}),h.jsx("button",{onClick:i,disabled:t||!r.trim(),style:c,"aria-label":"Send message",onMouseEnter:u=>{!t&&r.trim()&&(u.currentTarget.style.transform="translateY(-2px)",u.currentTarget.style.boxShadow="0 8px 16px rgba(0,0,0,0.15)")},onMouseLeave:u=>{u.currentTarget.style.transform="translateY(0)",u.currentTarget.style.boxShadow="none"},children:h.jsx(D.Send,{size:18})})]})})},gt=({messages:e,isLoading:t,theme:n})=>{const r=N.useRef(null),s=()=>{r.current?.scrollIntoView({behavior:"smooth"})};function i(u){return new Date(u).toLocaleString("en-AU",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}N.useEffect(()=>{s()},[e,t]);const o={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=u=>({display:"flex",justifyContent:u==="user"?"flex-end":"flex-start",width:"100%"}),p={display:"flex",flexDirection:"column",maxWidth:"80%"},d=u=>({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:u==="user"?n.primaryColor:n.backgroundColor,color:n.fontColor,wordWrap:"break-word"}),c={...d("bot"),animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s"};return h.jsxs("div",{style:o,children:[e.map((u,b)=>h.jsx("div",{style:l(u.type),children:h.jsxs("div",{style:p,children:[u.type==="bot"&&u.response_timestamp&&h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-start",marginLeft:"4px",marginBottom:"2px"},children:[h.jsx(D.Bot,{size:14,color:n.fontColor}),h.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:i(u.response_timestamp)})]}),u.type==="user"&&h.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-end",marginRight:"4px",marginBottom:"2px"},children:h.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:"You"})}),h.jsx("div",{style:d(u.type),children:u.text})]})},b)),t&&h.jsx("div",{style:l("bot"),children:h.jsxs("div",{style:{...c,display:"flex",alignItems:"center",gap:"8px"},children:[h.jsx(D.Bot,{size:24}),h.jsx("span",{children:"Typing..."})]})}),h.jsx("div",{ref:r})]})};function Je(e,t){return function(){return e.apply(t,arguments)}}const{toString:wt}=Object.prototype,{getPrototypeOf:Re}=Object,{iterator:ue,toStringTag:Ve}=Symbol,de=(e=>t=>{const n=wt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),L=e=>(e=e.toLowerCase(),t=>de(t)===e),fe=e=>t=>typeof t===e,{isArray:G}=Array,X=fe("undefined");function Z(e){return e!==null&&!X(e)&&e.constructor!==null&&!X(e.constructor)&&P(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ke=L("ArrayBuffer");function St(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ke(e.buffer),t}const Et=fe("string"),P=fe("function"),Xe=fe("number"),ee=e=>e!==null&&typeof e=="object",Rt=e=>e===!0||e===!1,ie=e=>{if(de(e)!=="object")return!1;const t=Re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ve in e)&&!(ue in e)},Ct=e=>{if(!ee(e)||Z(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Tt=L("Date"),Ot=L("File"),At=L("Blob"),jt=L("FileList"),kt=e=>ee(e)&&P(e.pipe),Ft=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||P(e.append)&&((t=de(e))==="formdata"||t==="object"&&P(e.toString)&&e.toString()==="[object FormData]"))},Nt=L("URLSearchParams"),[Pt,_t,Ut,Lt]=["ReadableStream","Request","Response","Headers"].map(L),Bt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function te(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),G(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Z(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let l;for(r=0;r<o;r++)l=i[r],t.call(null,e[l],l,e)}}function Ge(e,t){if(Z(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const q=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ye=e=>!X(e)&&e!==q;function ge(){const{caseless:e,skipUndefined:t}=Ye(this)&&this||{},n={},r=(s,i)=>{const o=e&&Ge(n,i)||i;ie(n[o])&&ie(s)?n[o]=ge(n[o],s):ie(s)?n[o]=ge({},s):G(s)?n[o]=s.slice():(!t||!X(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&te(arguments[s],r);return n}const It=(e,t,n,{allOwnKeys:r}={})=>(te(t,(s,i)=>{n&&P(s)?e[i]=Je(s,n):e[i]=s},{allOwnKeys:r}),e),Dt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),vt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},zt=(e,t,n,r)=>{let s,i,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&Re(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},qt=e=>{if(!e)return null;if(G(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},Ht=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Re(Uint8Array)),$t=(e,t)=>{const r=(e&&e[ue]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Wt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Jt=L("HTMLFormElement"),Vt=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),Kt=L("RegExp"),Qe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};te(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Xt=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+"'")})}})},Gt=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return G(e)?r(e):r(String(e).split(t)),n},Yt=()=>{},Qt=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Zt(e){return!!(e&&P(e.append)&&e[Ve]==="FormData"&&e[ue])}const en=e=>{const t=new Array(10),n=(r,s)=>{if(ee(r)){if(t.indexOf(r)>=0)return;if(Z(r))return r;if(!("toJSON"in r)){t[s]=r;const i=G(r)?[]:{};return te(r,(o,l)=>{const p=n(o,s+1);!X(p)&&(i[l]=p)}),t[s]=void 0,i}}return r};return n(e,0)},tn=L("AsyncFunction"),nn=e=>e&&(ee(e)||P(e))&&P(e.then)&&P(e.catch),Ze=((e,t)=>e?setImmediate:t?((n,r)=>(q.addEventListener("message",({source:s,data:i})=>{s===q&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),q.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",P(q.postMessage)),rn=typeof queueMicrotask<"u"?queueMicrotask.bind(q):typeof process<"u"&&process.nextTick||Ze,sn=e=>e!=null&&P(e[ue]),a={isArray:G,isArrayBuffer:Ke,isBuffer:Z,isFormData:Ft,isArrayBufferView:St,isString:Et,isNumber:Xe,isBoolean:Rt,isObject:ee,isPlainObject:ie,isEmptyObject:Ct,isReadableStream:Pt,isRequest:_t,isResponse:Ut,isHeaders:Lt,isUndefined:X,isDate:Tt,isFile:Ot,isBlob:At,isRegExp:Kt,isFunction:P,isStream:kt,isURLSearchParams:Nt,isTypedArray:Ht,isFileList:jt,forEach:te,merge:ge,extend:It,trim:Bt,stripBOM:Dt,inherits:vt,toFlatObject:zt,kindOf:de,kindOfTest:L,endsWith:Mt,toArray:qt,forEachEntry:$t,matchAll:Wt,isHTMLForm:Jt,hasOwnProperty:Fe,hasOwnProp:Fe,reduceDescriptors:Qe,freezeMethods:Xt,toObjectSet:Gt,toCamelCase:Vt,noop:Yt,toFiniteNumber:Qt,findKey:Ge,global:q,isContextDefined:Ye,isSpecCompliantForm:Zt,toJSONObject:en,isAsyncFn:tn,isThenable:nn,setImmediate:Ze,asap:rn,isIterable:sn};function x(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(x,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=x.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(x,tt);Object.defineProperty(et,"isAxiosError",{value:!0});x.from=(e,t,n,r,s,i)=>{const o=Object.create(et);a.toFlatObject(e,o,function(c){return c!==Error.prototype},d=>d!=="isAxiosError");const l=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return x.call(o,l,p,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const on=null;function we(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,i){return s=nt(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function an(e){return a.isArray(e)&&!e.some(we)}const ln=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function pe(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,m){return!a.isUndefined(m[y])});const r=n.metaTokens,s=n.visitor||c,i=n.dots,o=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 d(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 x("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,m){let S=f;if(f&&!m&&typeof f=="object"){if(a.endsWith(y,"{}"))y=r?y:y.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&an(f)||(a.isFileList(f)||a.endsWith(y,"[]"))&&(S=a.toArray(f)))return y=nt(y),S.forEach(function(w,C){!(a.isUndefined(w)||w===null)&&t.append(o===!0?Ne([y],C,i):o===null?y:y+"[]",d(w))}),!1}return we(f)?!0:(t.append(Ne(m,y,i),d(f)),!1)}const u=[],b=Object.assign(ln,{defaultVisitor:c,convertValue:d,isVisitable:we});function E(f,y){if(!a.isUndefined(f)){if(u.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));u.push(f),a.forEach(f,function(S,O){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(O)?O.trim():O,y,b))===!0&&E(S,y?y.concat(O):[O])}),u.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 Ce(e,t){this._pairs=[],e&&pe(e,this,t)}const rt=Ce.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 cn(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||cn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new Ce(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class _e{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const ot={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},un=typeof URLSearchParams<"u"?URLSearchParams:Ce,dn=typeof FormData<"u"?FormData:null,fn=typeof Blob<"u"?Blob:null,pn={isBrowser:!0,classes:{URLSearchParams:un,FormData:dn,Blob:fn},protocols:["http","https","file","blob","url","data"]},Te=typeof window<"u"&&typeof document<"u",Se=typeof navigator=="object"&&navigator||void 0,hn=Te&&(!Se||["ReactNative","NativeScript","NS"].indexOf(Se.product)<0),mn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yn=Te&&window.location.href||"http://localhost",xn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Te,hasStandardBrowserEnv:hn,hasStandardBrowserWebWorkerEnv:mn,navigator:Se,origin:yn},Symbol.toStringTag,{value:"Module"})),F={...xn,...pn};function bn(e,t){return pe(e,new F.classes.URLSearchParams,{visitor:function(n,r,s,i){return F.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function gn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function wn(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function it(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),p=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,p?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=wn(s[o])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(gn(r),s,n,0)}),n}return null}function Sn(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 ne={transitional:ot,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(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(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return bn(t,this.formSerializer).toString();if((l=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return pe(l?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Sn(t)):t}],transformResponse:[function(t){const n=this.transitional||ne.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?x.from(l,x.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:F.classes.FormData,Blob:F.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=>{ne.headers[e]={}});const En=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"]),Rn=e=>{const t={};let n,r,s;return e&&e.split(`
14
2
  `).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&En[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Ue=Symbol("internals");function Q(e){return e&&String(e).trim().toLowerCase()}function ae(e){return e===!1||e==null?e:a.isArray(e)?e.map(ae):String(e)}function Cn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Tn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ye(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function On(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function An(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let _=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(l,p,d){const c=Q(p);if(!c)throw new Error("header name must be a non-empty string");const u=a.findKey(s,c);(!u||s[u]===void 0||d===!0||d===void 0&&s[u]!==!1)&&(s[u||p]=ae(l))}const o=(l,p)=>a.forEach(l,(d,c)=>i(d,c,p));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!Tn(t))o(Rn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let l={},p,d;for(const c of t){if(!a.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[d=c[0]]=(p=l[d])?a.isArray(p)?[...p,c[1]]:[p,c[1]]:c[1]}o(l,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Q(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Cn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Q(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ye(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Q(o),o){const l=a.findKey(r,o);l&&(!n||ye(r,r[l],l,n))&&(delete r[l],s=!0)}}return a.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||ye(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,i)=>{const o=a.findKey(r,i);if(o){n[o]=ae(s),delete n[i];return}const l=t?On(i):String(i).trim();l!==i&&delete n[i],n[l]=ae(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[Ue]=this[Ue]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=Q(o);r[l]||(An(s,o),r[l]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(_.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(_);function be(e,t){const n=this||ne,r=t||n,s=_.from(r.headers);let i=r.data;return a.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function at(e){return!!(e&&e.__CANCEL__)}function Y(e,t,n){b.call(this,e??"canceled",b.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(Y,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 jn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function kn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(p){const d=Date.now(),c=r[i];o||(o=d),n[s]=p,r[s]=d;let u=i,x=0;for(;u!==s;)x+=n[u++],u=u%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const E=c&&d-c;return E?Math.round(x*1e3/E):void 0}}function Fn(e,t){let n=0,r=1e3/t,s,i;const o=(d,c=Date.now())=>{n=c,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const c=Date.now(),u=c-n;u>=r?o(d,c):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-u)))},()=>s&&o(s)]}const ce=(e,t,n=3)=>{let r=0;const s=kn(50,250);return Fn(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,p=o-r,d=s(p),c=o<=l;r=o;const u={loaded:o,total:l,progress:l?o/l:void 0,bytes:p,rate:d||void 0,estimated:d&&l&&c?(l-o)/d:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(u)},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)),Nn=F.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,F.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(F.origin),F.navigator&&/(msie|trident)/i.test(F.navigator.userAgent)):()=>!0,Pn=F.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&l.push(`path=${r}`),a.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),a.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function _n(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Un(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ct(e,t,n){let r=!_n(t);return e&&(r||n==!1)?Un(e,t):t}const Ie=e=>e instanceof _?{...e}:e;function $(e,t){t=t||{};const n={};function r(d,c,u,x){return a.isPlainObject(d)&&a.isPlainObject(c)?a.merge.call({caseless:x},d,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(d,c,u,x){if(a.isUndefined(c)){if(!a.isUndefined(d))return r(void 0,d,u,x)}else return r(d,c,u,x)}function i(d,c){if(!a.isUndefined(c))return r(void 0,c)}function o(d,c){if(a.isUndefined(c)){if(!a.isUndefined(d))return r(void 0,d)}else return r(void 0,c)}function l(d,c,u){if(u in t)return r(d,c);if(u in e)return r(void 0,d)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(d,c,u)=>s(Ie(d),Ie(c),u,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const u=p[c]||s,x=u(e[c],t[c],c);a.isUndefined(x)&&u!==l||(n[c]=x)}),n}const ut=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=_.from(o),t.url=st(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(F.hasStandardBrowserEnv||F.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const p=n.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([c,u])=>{d.includes(c.toLowerCase())&&o.set(c,u)})}}if(F.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Nn(t.url))){const p=s&&i&&Pn.read(i);p&&o.set(s,p)}return t},Ln=typeof XMLHttpRequest<"u",Bn=Ln&&function(e){return new Promise(function(n,r){const s=ut(e);let i=s.data;const o=_.from(s.headers).normalize();let{responseType:l,onUploadProgress:p,onDownloadProgress:d}=s,c,u,x,E,f;function y(){E&&E(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function S(){if(!m)return;const w=_.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),A={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:w,config:e,request:m};lt(function(g){n(g),y()},function(g){r(g),y()},A),m=null}"onloadend"in m?m.onloadend=S:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(S)},m.onabort=function(){m&&(r(new b("Request aborted",b.ECONNABORTED,e,m)),m=null)},m.onerror=function(C){const A=C&&C.message?C.message:"Network Error",k=new b(A,b.ERR_NETWORK,e,m);k.event=C||null,r(k),m=null},m.ontimeout=function(){let C=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const A=s.transitional||ot;s.timeoutErrorMessage&&(C=s.timeoutErrorMessage),r(new b(C,A.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(C,A){m.setRequestHeader(A,C)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),d&&([x,f]=ce(d,!0),m.addEventListener("progress",x)),p&&m.upload&&([u,E]=ce(p),m.upload.addEventListener("progress",u),m.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(c=w=>{m&&(r(!w||w.type?new Y(null,e,m):w),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const O=jn(s.url);if(O&&F.protocols.indexOf(O)===-1){r(new b("Unsupported protocol "+O+":",b.ERR_BAD_REQUEST,e));return}m.send(i||null)})},In=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(d){if(!s){s=!0,l();const c=d instanceof Error?d:this.reason;r.abort(c instanceof b?c:new Y(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new b(`timeout ${t} of ms exceeded`,b.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:p}=r;return p.unsubscribe=()=>a.asap(l),p}},Dn=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},vn=async function*(e,t){for await(const n of Mn(e))yield*Dn(n,t)},Mn=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()}},De=(e,t,n,r)=>{const s=vn(e,t);let i=0,o,l=p=>{o||(o=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:d,value:c}=await s.next();if(d){l(),p.close();return}let u=c.byteLength;if(n){let x=i+=u;n(x)}p.enqueue(new Uint8Array(c))}catch(d){throw l(d),d}},cancel(p){return l(p),s.return()}},{highWaterMark:2})},ve=64*1024,{isFunction:oe}=a,zn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Me,TextEncoder:ze}=a.global,qe=(e,...t)=>{try{return!!e(...t)}catch{return!1}},qn=e=>{e=a.merge.call({skipUndefined:!0},zn,e);const{fetch:t,Request:n,Response:r}=e,s=t?oe(t):typeof fetch=="function",i=oe(n),o=oe(r);if(!s)return!1;const l=s&&oe(Me),p=s&&(typeof ze=="function"?(f=>y=>f.encode(y))(new ze):async f=>new Uint8Array(await new n(f).arrayBuffer())),d=i&&l&&qe(()=>{let f=!1;const y=new n(F.origin,{body:new Me,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),c=o&&l&&qe(()=>a.isReadableStream(new r("").body)),u={stream:c&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!u[f]&&(u[f]=(y,m)=>{let S=y&&y[f];if(S)return S.call(y);throw new b(`Response type '${f}' is not supported`,b.ERR_NOT_SUPPORT,m)})});const x=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(F.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 m=a.toFiniteNumber(f.getContentLength());return m??x(y)};return async f=>{let{url:y,method:m,data:S,signal:O,cancelToken:w,timeout:C,onDownloadProgress:A,onUploadProgress:k,responseType:g,headers:U,withCredentials:W="same-origin",fetchOptions:z}=ut(f),re=t||fetch;g=g?(g+"").toLowerCase():"text";let J=In([O,w&&w.toAbortSignal()],C),R=null;const j=J&&J.unsubscribe&&(()=>{J.unsubscribe()});let V;try{if(k&&d&&m!=="get"&&m!=="head"&&(V=await E(U,S))!==0){let M=new n(y,{method:"POST",body:S,duplex:"half"}),K;if(a.isFormData(S)&&(K=M.headers.get("content-type"))&&U.setContentType(K),M.body){const[me,se]=Le(V,ce(Be(k)));S=De(M.body,ve,me,se)}}a.isString(W)||(W=W?"include":"omit");const B=i&&"credentials"in n.prototype,Ae={...z,signal:J,method:m.toUpperCase(),headers:U.normalize().toJSON(),body:S,duplex:"half",credentials:B?W:void 0};R=i&&new n(y,Ae);let v=await(i?re(R,z):re(y,Ae));const je=c&&(g==="stream"||g==="response");if(c&&(A||je&&j)){const M={};["status","statusText","headers"].forEach(ke=>{M[ke]=v[ke]});const K=a.toFiniteNumber(v.headers.get("content-length")),[me,se]=A&&Le(K,ce(Be(A),!0))||[];v=new r(De(v.body,ve,me,()=>{se&&se(),j&&j()}),M)}g=g||"text";let yt=await u[a.findKey(u,g)||"text"](v,f);return!je&&j&&j(),await new Promise((M,K)=>{lt(M,K,{data:yt,headers:_.from(v.headers),status:v.status,statusText:v.statusText,config:f,request:R})})}catch(B){throw j&&j(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,f,R),{cause:B.cause||B}):b.from(B,B&&B.code,f,R)}}},Hn=new Map,dt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,p,d,c=Hn;for(;l--;)p=i[l],d=c.get(p),d===void 0&&c.set(p,d=l?new Map:qn(t)),c=d;return d};dt();const Oe={http:on,xhr:Bn,fetch:{get:dt}};a.forEach(Oe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const He=e=>`- ${e}`,$n=e=>a.isFunction(e)||e===null||e===!1;function Wn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let l;if(s=r,!$n(r)&&(s=Oe[(l=String(r)).toLowerCase()],s===void 0))throw new b(`Unknown adapter '${l}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[l||"#"+o]=s}if(!s){const o=Object.entries(i).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ue]=this[Ue]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=Q(o);r[l]||(An(s,o),r[l]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(_.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(_);function xe(e,t){const n=this||ne,r=t||n,s=_.from(r.headers);let i=r.data;return a.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function at(e){return!!(e&&e.__CANCEL__)}function Y(e,t,n){x.call(this,e??"canceled",x.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(Y,x,{__CANCEL__:!0});function lt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new x("Request failed with status code "+n.status,[x.ERR_BAD_REQUEST,x.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function jn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function kn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(p){const d=Date.now(),c=r[i];o||(o=d),n[s]=p,r[s]=d;let u=i,b=0;for(;u!==s;)b+=n[u++],u=u%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const E=c&&d-c;return E?Math.round(b*1e3/E):void 0}}function Fn(e,t){let n=0,r=1e3/t,s,i;const o=(d,c=Date.now())=>{n=c,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const c=Date.now(),u=c-n;u>=r?o(d,c):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-u)))},()=>s&&o(s)]}const ce=(e,t,n=3)=>{let r=0;const s=kn(50,250);return Fn(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,p=o-r,d=s(p),c=o<=l;r=o;const u={loaded:o,total:l,progress:l?o/l:void 0,bytes:p,rate:d||void 0,estimated:d&&l&&c?(l-o)/d:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(u)},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)),Nn=F.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,F.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(F.origin),F.navigator&&/(msie|trident)/i.test(F.navigator.userAgent)):()=>!0,Pn=F.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&l.push(`path=${r}`),a.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),a.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function _n(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Un(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ct(e,t,n){let r=!_n(t);return e&&(r||n==!1)?Un(e,t):t}const Ie=e=>e instanceof _?{...e}:e;function $(e,t){t=t||{};const n={};function r(d,c,u,b){return a.isPlainObject(d)&&a.isPlainObject(c)?a.merge.call({caseless:b},d,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(d,c,u,b){if(a.isUndefined(c)){if(!a.isUndefined(d))return r(void 0,d,u,b)}else return r(d,c,u,b)}function i(d,c){if(!a.isUndefined(c))return r(void 0,c)}function o(d,c){if(a.isUndefined(c)){if(!a.isUndefined(d))return r(void 0,d)}else return r(void 0,c)}function l(d,c,u){if(u in t)return r(d,c);if(u in e)return r(void 0,d)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(d,c,u)=>s(Ie(d),Ie(c),u,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const u=p[c]||s,b=u(e[c],t[c],c);a.isUndefined(b)&&u!==l||(n[c]=b)}),n}const ut=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=_.from(o),t.url=st(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(F.hasStandardBrowserEnv||F.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const p=n.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([c,u])=>{d.includes(c.toLowerCase())&&o.set(c,u)})}}if(F.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Nn(t.url))){const p=s&&i&&Pn.read(i);p&&o.set(s,p)}return t},Ln=typeof XMLHttpRequest<"u",Bn=Ln&&function(e){return new Promise(function(n,r){const s=ut(e);let i=s.data;const o=_.from(s.headers).normalize();let{responseType:l,onUploadProgress:p,onDownloadProgress:d}=s,c,u,b,E,f;function y(){E&&E(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function S(){if(!m)return;const w=_.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),A={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:w,config:e,request:m};lt(function(g){n(g),y()},function(g){r(g),y()},A),m=null}"onloadend"in m?m.onloadend=S:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(S)},m.onabort=function(){m&&(r(new x("Request aborted",x.ECONNABORTED,e,m)),m=null)},m.onerror=function(C){const A=C&&C.message?C.message:"Network Error",k=new x(A,x.ERR_NETWORK,e,m);k.event=C||null,r(k),m=null},m.ontimeout=function(){let C=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const A=s.transitional||ot;s.timeoutErrorMessage&&(C=s.timeoutErrorMessage),r(new x(C,A.clarifyTimeoutError?x.ETIMEDOUT:x.ECONNABORTED,e,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(C,A){m.setRequestHeader(A,C)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),d&&([b,f]=ce(d,!0),m.addEventListener("progress",b)),p&&m.upload&&([u,E]=ce(p),m.upload.addEventListener("progress",u),m.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(c=w=>{m&&(r(!w||w.type?new Y(null,e,m):w),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const O=jn(s.url);if(O&&F.protocols.indexOf(O)===-1){r(new x("Unsupported protocol "+O+":",x.ERR_BAD_REQUEST,e));return}m.send(i||null)})},In=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(d){if(!s){s=!0,l();const c=d instanceof Error?d:this.reason;r.abort(c instanceof x?c:new Y(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new x(`timeout ${t} of ms exceeded`,x.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:p}=r;return p.unsubscribe=()=>a.asap(l),p}},Dn=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},vn=async function*(e,t){for await(const n of zn(e))yield*Dn(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()}},De=(e,t,n,r)=>{const s=vn(e,t);let i=0,o,l=p=>{o||(o=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:d,value:c}=await s.next();if(d){l(),p.close();return}let u=c.byteLength;if(n){let b=i+=u;n(b)}p.enqueue(new Uint8Array(c))}catch(d){throw l(d),d}},cancel(p){return l(p),s.return()}},{highWaterMark:2})},ve=64*1024,{isFunction:oe}=a,Mn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:ze,TextEncoder:Me}=a.global,qe=(e,...t)=>{try{return!!e(...t)}catch{return!1}},qn=e=>{e=a.merge.call({skipUndefined:!0},Mn,e);const{fetch:t,Request:n,Response:r}=e,s=t?oe(t):typeof fetch=="function",i=oe(n),o=oe(r);if(!s)return!1;const l=s&&oe(ze),p=s&&(typeof Me=="function"?(f=>y=>f.encode(y))(new Me):async f=>new Uint8Array(await new n(f).arrayBuffer())),d=i&&l&&qe(()=>{let f=!1;const y=new n(F.origin,{body:new ze,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),c=o&&l&&qe(()=>a.isReadableStream(new r("").body)),u={stream:c&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!u[f]&&(u[f]=(y,m)=>{let S=y&&y[f];if(S)return S.call(y);throw new x(`Response type '${f}' is not supported`,x.ERR_NOT_SUPPORT,m)})});const b=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(F.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 m=a.toFiniteNumber(f.getContentLength());return m??b(y)};return async f=>{let{url:y,method:m,data:S,signal:O,cancelToken:w,timeout:C,onDownloadProgress:A,onUploadProgress:k,responseType:g,headers:U,withCredentials:W="same-origin",fetchOptions:M}=ut(f),re=t||fetch;g=g?(g+"").toLowerCase():"text";let J=In([O,w&&w.toAbortSignal()],C),R=null;const j=J&&J.unsubscribe&&(()=>{J.unsubscribe()});let V;try{if(k&&d&&m!=="get"&&m!=="head"&&(V=await E(U,S))!==0){let z=new n(y,{method:"POST",body:S,duplex:"half"}),K;if(a.isFormData(S)&&(K=z.headers.get("content-type"))&&U.setContentType(K),z.body){const[me,se]=Le(V,ce(Be(k)));S=De(z.body,ve,me,se)}}a.isString(W)||(W=W?"include":"omit");const B=i&&"credentials"in n.prototype,Ae={...M,signal:J,method:m.toUpperCase(),headers:U.normalize().toJSON(),body:S,duplex:"half",credentials:B?W:void 0};R=i&&new n(y,Ae);let v=await(i?re(R,M):re(y,Ae));const je=c&&(g==="stream"||g==="response");if(c&&(A||je&&j)){const z={};["status","statusText","headers"].forEach(ke=>{z[ke]=v[ke]});const K=a.toFiniteNumber(v.headers.get("content-length")),[me,se]=A&&Le(K,ce(Be(A),!0))||[];v=new r(De(v.body,ve,me,()=>{se&&se(),j&&j()}),z)}g=g||"text";let yt=await u[a.findKey(u,g)||"text"](v,f);return!je&&j&&j(),await new Promise((z,K)=>{lt(z,K,{data:yt,headers:_.from(v.headers),status:v.status,statusText:v.statusText,config:f,request:R})})}catch(B){throw j&&j(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new x("Network Error",x.ERR_NETWORK,f,R),{cause:B.cause||B}):x.from(B,B&&B.code,f,R)}}},Hn=new Map,dt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,p,d,c=Hn;for(;l--;)p=i[l],d=c.get(p),d===void 0&&c.set(p,d=l?new Map:qn(t)),c=d;return d};dt();const Oe={http:on,xhr:Bn,fetch:{get:dt}};a.forEach(Oe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const He=e=>`- ${e}`,$n=e=>a.isFunction(e)||e===null||e===!1;function Wn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let l;if(s=r,!$n(r)&&(s=Oe[(l=String(r)).toLowerCase()],s===void 0))throw new x(`Unknown adapter '${l}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[l||"#"+o]=s}if(!s){const o=Object.entries(i).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
16
4
  `+o.map(He).join(`
17
- `):" "+He(o[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:Wn,adapters:Oe};function xe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Y(null,e)}function $e(e){return xe(e),e.headers=_.from(e.headers),e.data=be.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ft.getAdapter(e.adapter||ne.adapter,e)(e).then(function(r){return xe(e),r.data=be.call(e,e.transformResponse,r),r.headers=_.from(r.headers),r},function(r){return at(r)||(xe(e),r&&r.response&&(r.response.data=be.call(e,e.transformResponse,r.response),r.response.headers=_.from(r.response.headers))),Promise.reject(r)})}const pt="1.13.2",he={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{he[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const We={};he.transitional=function(t,n,r){function s(i,o){return"[Axios v"+pt+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new b(s(o," has been removed"+(n?" in "+n:"")),b.ERR_DEPRECATED);return n&&!We[o]&&(We[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};he.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Jn(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 i=r[s],o=t[i];if(o){const l=e[i],p=l===void 0||o(l,i,e);if(p!==!0)throw new b("option "+i+" must be "+p,b.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new b("Unknown option "+i,b.ERR_BAD_OPTION)}}const le={assertOptions:Jn,validators:he},I=le.validators;let H=class{constructor(t){this.defaults=t||{},this.interceptors={request:new _e,response:new _e}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
18
- `+i):r.stack=i}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:i}=n;r!==void 0&&le.assertOptions(r,{silentJSONParsing:I.transitional(I.boolean),forcedJSONParsing:I.transitional(I.boolean),clarifyTimeoutError:I.transitional(I.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:le.assertOptions(s,{encode:I.function,serialize:I.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),le.assertOptions(n,{baseUrl:I.spelling("baseURL"),withXsrfToken:I.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=_.concat(o,i);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 d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let c,u=0,x;if(!p){const f=[$e.bind(this),void 0];for(f.unshift(...l),f.push(...d),x=f.length,c=Promise.resolve(n);u<x;)c=c.then(f[u++],f[u++]);return c}x=l.length;let E=n;for(;u<x;){const f=l[u++],y=l[u++];try{E=f(E)}catch(m){y.call(this,m);break}}try{c=$e.call(this,E)}catch(f){return Promise.reject(f)}for(u=0,x=d.length;u<x;)c=c.then(d[u++],d[u++]);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(i,o,l){return this.request($(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}H.prototype[t]=n(),H.prototype[t+"Form"]=n(!0)});let Vn=class ht{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new Y(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ht(function(s){t=s}),cancel:t}}};function Kn(e){return function(n){return e.apply(null,n)}}function Xn(e){return a.isObject(e)&&e.isAxiosError===!0}const Ee={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ee).forEach(([e,t])=>{Ee[t]=e});function 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 T=mt(ne);T.Axios=H;T.CanceledError=Y;T.CancelToken=Vn;T.isCancel=at;T.VERSION=pt;T.toFormData=pe;T.AxiosError=b;T.Cancel=T.CanceledError;T.all=function(t){return Promise.all(t)};T.spread=Kn;T.isAxiosError=Xn;T.mergeConfig=$;T.AxiosHeaders=_;T.formToJSON=e=>it(a.isHTMLForm(e)?new FormData(e):e);T.getAdapter=ft.getAdapter;T.HttpStatusCode=Ee;T.default=T;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}=T,Gn=async(e,t,n,r,s)=>{console.log("Creating chat session with input url:",n);const i={chatInput:e,metadata:{pinecone_namespace:t,name:r,email:s}};try{return(await T.post(n,i,{headers:{"Content-Type":"application/json"}})).data}catch(o){throw console.error("Error communicating with chat API:",o),o}},Yn=async(e,t,n,r)=>{const s={chatInput:e,metadata:{pinecone_namespace:t},sessionId:r};try{return(await T.post(n,s,{headers:{"Content-Type":"application/json"}})).data}catch(i){throw console.error("Error communicating with chat API:",i),i}},Qn=({handleMessageFromForm:e,theme:t,chatBotData:n,setChatSessionId:r})=>{const[s,i]=N.useState(""),[o,l]=N.useState(""),[p,d]=N.useState(""),[c,u]=N.useState(""),[x,E]=N.useState(!1),f=async g=>{if(g.preventDefault(),E(!0),u(""),!s.trim()||!o.trim()){u("Name and email are required"),E(!1);return}try{const U=await Gn(p,n.pineconeNamespace,n.initiateChatUrl,s,o);console.log("response from n8n",U),e([{type:"user",text:p},{type:"bot",text:U.n8n.response,response_timestamp:U.n8n.response_timestamp,sessionId:U.n8n.sessionId}]),r(U.n8n.sessionId)}catch(U){console.log("error sending user details",U),u("Failed to submit. Please try again.")}finally{E(!1)}i(""),l(""),d("")},y={padding:"20px",flexShrink:0,background:t.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},m={display:"flex",flexDirection:"column",gap:"24px"},S={fontSize:"14px",fontWeight:"500",color:t.fontColor,margin:0,lineHeight:"1.4"},O={display:"flex",flexDirection:"column",gap:"20px"},w={fontSize:"14px",color:t.fontColor,fontWeight:"500"},C={width:"100%",padding:"12px 16px",background:t.backgroundColor,color:t.fontColor,border:"1px solid #a1a1aa",borderRadius:"12px",fontSize:"15px",outline:"none",boxSizing:"border-box"},A={padding:"12px 20px",borderRadius:"12px",fontWeight:"600",fontSize:"15px",border:"none",cursor:s.trim()&&o.trim()&&!x?"pointer":"not-allowed",opacity:s.trim()&&o.trim()&&!x?1:.5,background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease"},k={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return h.jsx("div",{style:y,children:h.jsxs("form",{onSubmit:f,style:m,children:[c&&h.jsx("div",{style:k,role:"alert",children:c}),h.jsx("p",{style:S,children:n.welcomeText}),h.jsxs("div",{style:O,children:[h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Full Name"}),h.jsx("input",{type:"text",placeholder:"Enter your full name",value:s,onChange:g=>{i(g.target.value),u("")},style:C,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Email Address"}),h.jsx("input",{type:"email",placeholder:"Enter your email",value:o,onChange:g=>{l(g.target.value),u("")},style:C,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Message"}),h.jsx("textarea",{placeholder:"Enter your message",value:p,onChange:g=>{d(g.target.value),u("")},style:{...C,minHeight:"60px",resize:"vertical"},required:!0})]})]}),h.jsx("button",{type:"submit",disabled:!s.trim()||!o.trim()||x,style:A,onMouseEnter:g=>{s.trim()&&o.trim()&&!x&&(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:x?"Submitting...":h.jsxs(h.Fragment,{children:[h.jsx(D.Send,{size:18}),"Submit"]})})]})})},Zn=({onClose:e,theme:t,chatBotData:n})=>{const[r,s]=N.useState([]),[i,o]=N.useState(!1),[l,p]=N.useState(!1),[d,c]=N.useState(!1),[u,x]=N.useState(null),E=n.position==="left",f=R=>{x(R)},y={position:"fixed",bottom:"112px",[E?"left":"right"]:"32px",zIndex:50,width:d?"684px":"384px",height:d?"620px":"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"},m={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)"},S={position:"relative"},O={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},w={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},C={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},A={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},k={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"},U={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},W={fontWeight:"600"},z=(R,j)=>{R.currentTarget.style.background=j?"rgba(255,255,255,0.2)":"transparent"},re=R=>{s(R),p(!0)},J=async R=>{o(!0),s(j=>[...j,{type:"user",text:R}]);try{const j=await Yn(R,n.pineconeNamespace,n.onGoingChatUrl,u);s(V=>[...V,{type:"bot",text:j.n8n.response,response_timestamp:j.n8n.response_timestamp,suggested_prompts:j.n8n.suggested_prompt}])}catch(j){console.error("Chat error:",j),s(V=>[...V,{type:"bot",text:"Sorry, something went wrong."}])}finally{o(!1)}};return h.jsxs("div",{style:y,children:[h.jsxs("div",{style:m,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[h.jsxs("div",{style:S,children:[h.jsx("div",{style:O,children:h.jsx(D.MessageCircle,{size:22})}),h.jsx("span",{style:w})]}),h.jsxs("div",{children:[h.jsx("h3",{style:C,children:n.name}),h.jsx("p",{style:A,children:n.subTitle})]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[h.jsx("button",{onClick:()=>c(R=>!R),"aria-label":"expand chat",style:k,onMouseEnter:R=>z(R,!0),onMouseLeave:R=>z(R,!1),children:d?h.jsx(D.Minimize2,{size:20}):h.jsx(D.Maximize2,{size:20})}),h.jsx("button",{onClick:e,"aria-label":"close chat",style:k,onMouseEnter:R=>z(R,!0),onMouseLeave:R=>z(R,!1),children:h.jsx(D.X,{size:20})})]})]}),u?h.jsxs(h.Fragment,{children:[h.jsx(gt,{messages:r,isLoading:i,theme:t}),h.jsx(xt,{onSendMessage:J,isLoading:i,theme:t,messages:r})]}):h.jsx(Qn,{handleMessageFromForm:re,theme:t,chatBotData:n,setChatSessionId:f}),h.jsx("div",{style:g,children:h.jsxs("p",{style:U,children:["powered by"," ",h.jsx("span",{style:W,children:"clone67.com"})]})})]})},er=({pineconeNamespace:e,onGoingChatUrl:t,initiateChatUrl:n,primaryColor:r="#3b82f6",secondaryColor:s="#8b5cf6",backgroundColor:i="#ffffff",fontColor:o="#1f2937",placeholderColor:l="#9ca3af",position:p="right",name:d="Assistant",subTitle:c="Typically replies instantly",welcomeText:u="Hi! How can I help you today?"})=>{const[x,E]=N.useState(!1),f=()=>E(k=>!k),y=()=>E(k=>!k),m={primaryColor:r,secondaryColor:s,backgroundColor:i,fontColor:o,placeholderColor:l,inputBackgroundColor:i},S={name:d,subTitle:c,welcomeText:u,onGoingChatUrl:t,initiateChatUrl:n,pineconeNamespace:e,position:p},O=p==="left",w="32px",C={position:"fixed",bottom:"104px",[O?"left":"right"]:w,zIndex:9999,pointerEvents:"auto"},A={position:"fixed",bottom:"32px",[O?"left":"right"]:w,zIndex:1e4,pointerEvents:"auto"};return h.jsxs(h.Fragment,{children:[x&&h.jsx("div",{style:C,children:h.jsx(Zn,{onClose:f,theme:m,chatBotData:S})}),h.jsx("div",{style:A,children:h.jsx(bt,{onMinimise:y,isOpen:x,theme:m,chatBotData:S})})]})};module.exports=er;
5
+ `):" "+He(o[0]):"as no adapter specified";throw new x("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const ft={getAdapter:Wn,adapters:Oe};function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Y(null,e)}function $e(e){return be(e),e.headers=_.from(e.headers),e.data=xe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ft.getAdapter(e.adapter||ne.adapter,e)(e).then(function(r){return be(e),r.data=xe.call(e,e.transformResponse,r),r.headers=_.from(r.headers),r},function(r){return at(r)||(be(e),r&&r.response&&(r.response.data=xe.call(e,e.transformResponse,r.response),r.response.headers=_.from(r.response.headers))),Promise.reject(r)})}const pt="1.13.2",he={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{he[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const We={};he.transitional=function(t,n,r){function s(i,o){return"[Axios v"+pt+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new x(s(o," has been removed"+(n?" in "+n:"")),x.ERR_DEPRECATED);return n&&!We[o]&&(We[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};he.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Jn(e,t,n){if(typeof e!="object")throw new x("options must be an object",x.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const l=e[i],p=l===void 0||o(l,i,e);if(p!==!0)throw new x("option "+i+" must be "+p,x.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new x("Unknown option "+i,x.ERR_BAD_OPTION)}}const le={assertOptions:Jn,validators:he},I=le.validators;let H=class{constructor(t){this.defaults=t||{},this.interceptors={request:new _e,response:new _e}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
6
+ `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&le.assertOptions(r,{silentJSONParsing:I.transitional(I.boolean),forcedJSONParsing:I.transitional(I.boolean),clarifyTimeoutError:I.transitional(I.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:le.assertOptions(s,{encode:I.function,serialize:I.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),le.assertOptions(n,{baseUrl:I.spelling("baseURL"),withXsrfToken:I.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=_.concat(o,i);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 d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let c,u=0,b;if(!p){const f=[$e.bind(this),void 0];for(f.unshift(...l),f.push(...d),b=f.length,c=Promise.resolve(n);u<b;)c=c.then(f[u++],f[u++]);return c}b=l.length;let E=n;for(;u<b;){const f=l[u++],y=l[u++];try{E=f(E)}catch(m){y.call(this,m);break}}try{c=$e.call(this,E)}catch(f){return Promise.reject(f)}for(u=0,b=d.length;u<b;)c=c.then(d[u++],d[u++]);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(i,o,l){return this.request($(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}H.prototype[t]=n(),H.prototype[t+"Form"]=n(!0)});let Vn=class ht{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new Y(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ht(function(s){t=s}),cancel:t}}};function Kn(e){return function(n){return e.apply(null,n)}}function Xn(e){return a.isObject(e)&&e.isAxiosError===!0}const Ee={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ee).forEach(([e,t])=>{Ee[t]=e});function 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 T=mt(ne);T.Axios=H;T.CanceledError=Y;T.CancelToken=Vn;T.isCancel=at;T.VERSION=pt;T.toFormData=pe;T.AxiosError=x;T.Cancel=T.CanceledError;T.all=function(t){return Promise.all(t)};T.spread=Kn;T.isAxiosError=Xn;T.mergeConfig=$;T.AxiosHeaders=_;T.formToJSON=e=>it(a.isHTMLForm(e)?new FormData(e):e);T.getAdapter=ft.getAdapter;T.HttpStatusCode=Ee;T.default=T;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:xr,mergeConfig:br}=T,Gn=async(e,t,n,r,s)=>{const i={chatInput:e,metadata:{pinecone_namespace:t,name:r,email:s}};try{return(await T.post(n,i,{headers:{"Content-Type":"application/json"}})).data}catch(o){throw console.error("Error communicating with chat API:",o),o}},Yn=async(e,t,n,r)=>{const s={chatInput:e,metadata:{pinecone_namespace:t},sessionId:r};try{return(await T.post(n,s,{headers:{"Content-Type":"application/json"}})).data}catch(i){throw console.error("Error communicating with chat API:",i),i}},Qn=({handleMessageFromForm:e,theme:t,chatBotData:n,setChatSessionId:r})=>{const[s,i]=N.useState(""),[o,l]=N.useState(""),[p,d]=N.useState(""),[c,u]=N.useState(""),[b,E]=N.useState(!1),f=async g=>{if(g.preventDefault(),E(!0),u(""),!s.trim()||!o.trim()){u("Name and email are required"),E(!1);return}try{const U=await Gn(p,n.pineconeNamespace,n.initiateChatUrl,s,o);e([{type:"user",text:p},{type:"bot",text:U.n8n.response,response_timestamp:U.n8n.response_timestamp,sessionId:U.n8n.sessionId}]),r(U.n8n.sessionId)}catch(U){console.log("error sending user details",U),u("Failed to submit. Please try again.")}finally{E(!1)}i(""),l(""),d("")},y={padding:"20px",flexShrink:0,background:t.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},m={display:"flex",flexDirection:"column",gap:"24px"},S={fontSize:"14px",fontWeight:"500",color:t.fontColor,margin:0,lineHeight:"1.4"},O={display:"flex",flexDirection:"column",gap:"20px"},w={fontSize:"14px",color:t.fontColor,fontWeight:"500"},C={width:"100%",padding:"12px 16px",background:t.backgroundColor,color:t.fontColor,border:"1px solid #a1a1aa",borderRadius:"12px",fontSize:"15px",outline:"none",boxSizing:"border-box"},A={padding:"12px 20px",borderRadius:"12px",fontWeight:"600",fontSize:"15px",border:"none",cursor:s.trim()&&o.trim()&&!b?"pointer":"not-allowed",opacity:s.trim()&&o.trim()&&!b?1:.5,background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease"},k={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return h.jsx("div",{style:y,children:h.jsxs("form",{onSubmit:f,style:m,children:[c&&h.jsx("div",{style:k,role:"alert",children:c}),h.jsx("p",{style:S,children:n.welcomeText}),h.jsxs("div",{style:O,children:[h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Full Name"}),h.jsx("input",{type:"text",placeholder:"Enter your full name",value:s,onChange:g=>{i(g.target.value),u("")},style:C,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Email Address"}),h.jsx("input",{type:"email",placeholder:"Enter your email",value:o,onChange:g=>{l(g.target.value),u("")},style:C,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:w,children:"Message"}),h.jsx("textarea",{placeholder:"Enter your message",value:p,onChange:g=>{d(g.target.value),u("")},style:{...C,minHeight:"60px",resize:"vertical"},required:!0})]})]}),h.jsx("button",{type:"submit",disabled:!s.trim()||!o.trim()||b,style:A,onMouseEnter:g=>{s.trim()&&o.trim()&&!b&&(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:b?"Submitting...":h.jsxs(h.Fragment,{children:[h.jsx(D.Send,{size:18}),"Submit"]})})]})})},Zn=({onClose:e,theme:t,chatBotData:n})=>{const[r,s]=N.useState([]),[i,o]=N.useState(!1),[l,p]=N.useState(!1),[d,c]=N.useState(!1),[u,b]=N.useState(""),E=n.position==="left",f=R=>{b(R)},y={position:"fixed",bottom:"112px",[E?"left":"right"]:"32px",zIndex:50,width:d?"684px":"384px",height:d?"620px":"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"},m={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)"},S={position:"relative"},O={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},w={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},C={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},A={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},k={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"},U={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},W={fontWeight:"600"},M=(R,j)=>{R.currentTarget.style.background=j?"rgba(255,255,255,0.2)":"transparent"},re=R=>{s(R),p(!0)},J=async R=>{o(!0),s(j=>[...j,{type:"user",text:R}]);try{const j=await Yn(R,n.pineconeNamespace,n.onGoingChatUrl,u);s(V=>[...V,{type:"bot",text:j.n8n.response,response_timestamp:j.n8n.response_timestamp,suggested_prompts:j.n8n.suggested_prompt}])}catch(j){console.error("Chat error:",j),s(V=>[...V,{type:"bot",text:"Sorry, something went wrong."}])}finally{o(!1)}};return h.jsxs("div",{style:y,children:[h.jsxs("div",{style:m,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[h.jsxs("div",{style:S,children:[h.jsx("div",{style:O,children:h.jsx(D.MessageCircle,{size:22})}),h.jsx("span",{style:w})]}),h.jsxs("div",{children:[h.jsx("h3",{style:C,children:n.name}),h.jsx("p",{style:A,children:n.subTitle})]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[h.jsx("button",{onClick:()=>c(R=>!R),"aria-label":"expand chat",style:k,onMouseEnter:R=>M(R,!0),onMouseLeave:R=>M(R,!1),children:d?h.jsx(D.Minimize2,{size:20}):h.jsx(D.Maximize2,{size:20})}),h.jsx("button",{onClick:e,"aria-label":"close chat",style:k,onMouseEnter:R=>M(R,!0),onMouseLeave:R=>M(R,!1),children:h.jsx(D.X,{size:20})})]})]}),u?h.jsxs(h.Fragment,{children:[h.jsx(gt,{messages:r,isLoading:i,theme:t}),h.jsx(bt,{onSendMessage:J,isLoading:i,theme:t})]}):h.jsx(Qn,{handleMessageFromForm:re,theme:t,chatBotData:n,setChatSessionId:f}),h.jsx("div",{style:g,children:h.jsxs("p",{style:U,children:["powered by"," ",h.jsx("span",{style:W,children:"clone67.com"})]})})]})},er=({pineconeNamespace:e,onGoingChatUrl:t,initiateChatUrl:n,primaryColor:r="#3b82f6",secondaryColor:s="#8b5cf6",backgroundColor:i="#ffffff",fontColor:o="#1f2937",placeholderColor:l="#9ca3af",position:p="right",name:d="Assistant",subTitle:c="Typically replies instantly",welcomeText:u="Hi! How can I help you today?"})=>{const[b,E]=N.useState(!1),f=()=>E(k=>!k),y=()=>E(k=>!k),m={primaryColor:r,secondaryColor:s,backgroundColor:i,fontColor:o,placeholderColor:l,inputBackgroundColor:i},S={name:d,subTitle:c,welcomeText:u,onGoingChatUrl:t,initiateChatUrl:n,pineconeNamespace:e,position:p},O=p==="left",w="32px",C={position:"fixed",bottom:"104px",[O?"left":"right"]:w,zIndex:9999,pointerEvents:"auto"},A={position:"fixed",bottom:"32px",[O?"left":"right"]:w,zIndex:1e4,pointerEvents:"auto"};return h.jsxs(h.Fragment,{children:[b&&h.jsx("div",{style:C,children:h.jsx(Zn,{onClose:f,theme:m,chatBotData:S})}),h.jsx("div",{style:A,children:h.jsx(xt,{onMinimise:y,isOpen:b,theme:m,chatBotData:S})})]})};module.exports=er;
package/dist/index.js CHANGED
@@ -21,19 +21,12 @@ const At = ({ onMinimise: e, isOpen: t, theme: n, chatBotData: r }) => {
21
21
  pointerEvents: "auto",
22
22
  transition: "all 300ms ease",
23
23
  outline: "none"
24
- }, p = {
25
- transform: "scale(1.10)",
26
- boxShadow: "0 25px 35px -5px rgba(0,0,0,0.2)"
27
24
  };
28
25
  return /* @__PURE__ */ O(
29
26
  "button",
30
27
  {
31
28
  onClick: e,
32
29
  style: l,
33
- onMouseEnter: (c) => Object.assign(c.currentTarget.style, p),
34
- onMouseLeave: (c) => Object.keys(p).forEach((u) => c.currentTarget.style[u] = l[u] || ""),
35
- onFocus: (c) => Object.assign(c.currentTarget.style, p),
36
- onBlur: (c) => Object.keys(p).forEach((u) => c.currentTarget.style[u] = l[u] || ""),
37
30
  children: [
38
31
  t ? /* @__PURE__ */ y(Rt, { size: 20, strokeWidth: 2.5 }) : /* @__PURE__ */ y(Ke, { size: 20, strokeWidth: 2.5 }),
39
32
  !t && /* @__PURE__ */ y("span", { style: {
@@ -46,20 +39,7 @@ const At = ({ onMinimise: e, isOpen: t, theme: n, chatBotData: r }) => {
46
39
  borderRadius: "50%",
47
40
  border: "4px solid white",
48
41
  animation: "pulse 2s infinite"
49
- } }),
50
- /* @__PURE__ */ y("style", { jsx: !0, children: `
51
- @keyframes pulse {
52
- 0% {
53
- box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
54
- }
55
- 70% {
56
- box-shadow: 0 0 0 10px rgba(52, 211, 153, 0);
57
- }
58
- 100% {
59
- box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
60
- }
61
- }
62
- ` })
42
+ } })
63
43
  ]
64
44
  }
65
45
  );
@@ -195,7 +175,7 @@ const At = ({ onMinimise: e, isOpen: t, theme: n, chatBotData: r }) => {
195
175
  };
196
176
  return /* @__PURE__ */ O("div", { style: s, children: [
197
177
  e.map((u, g) => /* @__PURE__ */ y("div", { style: l(u.type), children: /* @__PURE__ */ O("div", { style: p, children: [
198
- u.type === "bot" && /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: "4px", justifyContent: "flex-start", marginLeft: "4px", marginBottom: "2px" }, children: [
178
+ u.type === "bot" && u.response_timestamp && /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: "4px", justifyContent: "flex-start", marginLeft: "4px", marginBottom: "2px" }, children: [
199
179
  /* @__PURE__ */ y(Pe, { size: 14, color: n.fontColor }),
200
180
  /* @__PURE__ */ y(
201
181
  "span",
@@ -223,7 +203,7 @@ const At = ({ onMinimise: e, isOpen: t, theme: n, chatBotData: r }) => {
223
203
  /* @__PURE__ */ y("div", { style: d(u.type), children: u.text })
224
204
  ] }) }, g)),
225
205
  t && /* @__PURE__ */ y("div", { style: l("bot"), children: /* @__PURE__ */ O("div", { style: {
226
- typingBubbleStyle: c,
206
+ ...c,
227
207
  display: "flex",
228
208
  alignItems: "center",
229
209
  gap: "8px"
@@ -2003,7 +1983,6 @@ const {
2003
1983
  getAdapter: Fr,
2004
1984
  mergeConfig: Nr
2005
1985
  } = T, ir = async (e, t, n, r, o) => {
2006
- console.log("Creating chat session with input url:", n);
2007
1986
  const i = {
2008
1987
  chatInput: e,
2009
1988
  metadata: {
@@ -2060,7 +2039,7 @@ const {
2060
2039
  o,
2061
2040
  s
2062
2041
  );
2063
- console.log("response from n8n", L), e([
2042
+ e([
2064
2043
  { type: "user", text: p },
2065
2044
  { type: "bot", text: L.n8n.response, response_timestamp: L.n8n.response_timestamp, sessionId: L.n8n.sessionId }
2066
2045
  ]), r(L.n8n.sessionId);
@@ -2203,7 +2182,7 @@ const {
2203
2182
  )
2204
2183
  ] }) });
2205
2184
  }, cr = ({ onClose: e, theme: t, chatBotData: n }) => {
2206
- const [r, o] = B([]), [i, s] = B(!1), [l, p] = B(!1), [d, c] = B(!1), [u, g] = B(null), E = n.position === "left", f = (R) => {
2185
+ const [r, o] = B([]), [i, s] = B(!1), [l, p] = B(!1), [d, c] = B(!1), [u, g] = B(""), E = n.position === "left", f = (R) => {
2207
2186
  g(R);
2208
2187
  }, m = {
2209
2188
  position: "fixed",
@@ -2340,7 +2319,7 @@ const {
2340
2319
  ] }),
2341
2320
  u ? /* @__PURE__ */ O(Re, { children: [
2342
2321
  /* @__PURE__ */ y(Ft, { messages: r, isLoading: i, theme: t }),
2343
- /* @__PURE__ */ y(kt, { onSendMessage: J, isLoading: i, theme: t, messages: r })
2322
+ /* @__PURE__ */ y(kt, { onSendMessage: J, isLoading: i, theme: t })
2344
2323
  ] }) : /* @__PURE__ */ y(
2345
2324
  lr,
2346
2325
  {
@@ -2377,7 +2356,6 @@ const {
2377
2356
  fontColor: s,
2378
2357
  placeholderColor: l,
2379
2358
  inputBackgroundColor: i
2380
- // fallback if not provided
2381
2359
  }, S = {
2382
2360
  name: d,
2383
2361
  subTitle: c,
package/package.json CHANGED
@@ -1,40 +1,45 @@
1
- {
2
- "name": "react-aichatbot-widget",
3
- "version": "1.5.0",
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
- }
40
- }
1
+ {
2
+ "name": "react-aichatbot-widget",
3
+ "version": "1.5.2",
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
+ "@types/jest": "^30.0.0",
39
+ "@types/node": "^25.0.0",
40
+ "@types/react": "^19.2.7",
41
+ "@types/react-dom": "^19.2.3",
42
+ "axios": "^1.6.0",
43
+ "typescript": "^5.9.3"
44
+ }
45
+ }