react-aichatbot-widget 1.5.3 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,11 +1,6 @@
1
- "use strict";const p=require("react/jsx-runtime"),N=require("react"),L=require("lucide-react"),gt=({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"},h={position:"absolute",top:"-4px",right:"-4px",width:"16px",height:"16px",backgroundColor:"#34d399",borderRadius:"50%",border:"4px solid white",animation:"pulse 2s infinite"};return p.jsxs("button",{onClick:e,style:l,children:[t?p.jsx(L.Minus,{size:20,strokeWidth:2.5}):p.jsx(L.MessageCircle,{size:20,strokeWidth:2.5}),!t&&p.jsx("span",{style:h})]})},xt=({onSendMessage:e,isLoading:t,theme:n})=>{const[r,s]=N.useState(""),i=()=>{!r.trim()||t||(e(r.trim()),s(""))},o=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),i())},l={padding:"16px",borderTop:"1px solid rgba(255, 255, 255, 0.2)",borderColor:n.fontColor,background:n.backgroundColor,flexShrink:0},h={display:"flex",gap:"12px",alignItems:"center"},u={flex:1,padding:"12px 16px",background:n.inputBackgroundColor||n.backgroundColor,color:n.fontColor,border:`1px solid ${n.fontColor}`,borderRadius:"12px",fontSize:"14px",outline:"none",transition:"all 0.2s ease",opacity:t?.5:1,cursor:t?"not-allowed":"text",boxShadow:"none"},c={padding:"12px 20px",borderRadius:"12px",background:`linear-gradient(135deg, ${n.primaryColor}, ${n.secondaryColor})`,color:n.fontColor,border:"none",cursor:t||!r.trim()?"not-allowed":"pointer",opacity:t||!r.trim()?.5:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontWeight:"600",fontSize:"14px",transition:"all 0.2s ease",minWidth:"48px"};return p.jsx("div",{style:l,children:p.jsxs("div",{style:h,children:[p.jsx("input",{type:"text",placeholder:"Type a message...",value:r,onChange:d=>s(d.target.value),onKeyDown:o,disabled:t,style:u,onFocus:d=>{d.target.style.boxShadow="0 0 0 3px rgba(100, 150, 255, 0.3)",d.target.style.borderColor="#60a5fa"},onBlur:d=>{d.target.style.boxShadow="none",d.target.style.borderColor=n.fontColor}}),p.jsx("button",{onClick:i,disabled:t||!r.trim(),style:c,"aria-label":"Send message",onMouseEnter:d=>{!t&&r.trim()&&(d.currentTarget.style.transform="translateY(-2px)",d.currentTarget.style.boxShadow="0 8px 16px rgba(0,0,0,0.15)")},onMouseLeave:d=>{d.currentTarget.style.transform="translateY(0)",d.currentTarget.style.boxShadow="none"},children:p.jsx(L.Send,{size:18})})]})})},bt=({messages:e,isLoading:t,theme:n})=>{console.log("messages",e);const r=N.useRef(null),s=()=>{r.current?.scrollIntoView({behavior:"smooth"})};function i(d){return new Date(d).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=d=>({display:"flex",justifyContent:d==="user"?"flex-end":"flex-start",width:"100%"}),h={display:"flex",flexDirection:"column",maxWidth:"80%"},u=d=>({padding:"12px 16px",borderRadius:"16px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid #e4e4e7",fontSize:"14px",lineHeight:"1.5",background:d==="user"?n.primaryColor:n.backgroundColor,color:n.fontColor,wordWrap:"break-word"}),c={...u("bot"),animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s"};return p.jsxs("div",{style:o,children:[e.map((d,x)=>p.jsx("div",{style:l(d.sender_type),children:p.jsxs("div",{style:h,children:[d.sender_type==="bot"&&d.created_at&&p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-start",marginLeft:"4px",marginBottom:"2px"},children:[p.jsx(L.Bot,{size:14,color:n.fontColor}),p.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:i(d.created_at)})]}),d.sender_type==="user"&&p.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-end",marginRight:"4px",marginBottom:"2px"},children:p.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:"You"})}),p.jsx("div",{style:u(d.sender_type),children:d.message})]})},x)),t&&p.jsx("div",{style:l("bot"),children:p.jsxs("div",{style:{...c,display:"flex",alignItems:"center",gap:"8px"},children:[p.jsx(L.Bot,{size:24}),p.jsx("span",{children:"Typing..."})]})}),p.jsx("div",{ref:r})]})};function Je(e,t){return function(){return e.apply(t,arguments)}}const{toString:wt}=Object.prototype,{getPrototypeOf:Ce}=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)),B=e=>(e=e.toLowerCase(),t=>de(t)===e),fe=e=>t=>typeof t===e,{isArray:X}=Array,K=fe("undefined");function Z(e){return e!==null&&!K(e)&&e.constructor!==null&&!K(e.constructor)&&P(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ke=B("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",Ct=e=>e===!0||e===!1,ie=e=>{if(de(e)!=="object")return!1;const t=Ce(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ve in e)&&!(ue in e)},Rt=e=>{if(!ee(e)||Z(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Tt=B("Date"),Ot=B("File"),At=B("Blob"),jt=B("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=B("URLSearchParams"),[Pt,_t,Ut,Lt]=["ReadableStream","Request","Response","Headers"].map(B),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]),X(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=>!K(e)&&e!==q;function be(){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]=be(n[o],s):ie(s)?n[o]=be({},s):X(s)?n[o]=s.slice():(!t||!K(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&&Ce(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Ht=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},qt=e=>{if(!e)return null;if(X(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},Mt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ce(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=B("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=B("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 X(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=X(r)?[]:{};return te(r,(o,l)=>{const h=n(o,s+1);!K(h)&&(i[l]=h)}),t[s]=void 0,i}}return r};return n(e,0)},tn=B("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:X,isArrayBuffer:Ke,isBuffer:Z,isFormData:Ft,isArrayBufferView:St,isString:Et,isNumber:Xe,isBoolean:Ct,isObject:ee,isPlainObject:ie,isEmptyObject:Rt,isReadableStream:Pt,isRequest:_t,isResponse:Ut,isHeaders:Lt,isUndefined:K,isDate:Tt,isFile:Ot,isBlob:At,isRegExp:Kt,isFunction:P,isStream:kt,isURLSearchParams:Nt,isTypedArray:Mt,isFileList:jt,forEach:te,merge:be,extend:It,trim:Bt,stripBOM:Dt,inherits:vt,toFlatObject:zt,kindOf:de,kindOfTest:B,endsWith:Ht,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 g(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(g,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=g.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(g,tt);Object.defineProperty(et,"isAxiosError",{value:!0});g.from=(e,t,n,r,s,i)=>{const o=Object.create(et);a.toFlatObject(e,o,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",h=t==null&&e?e.code:t;return g.call(o,l,h,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,h=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!h&&a.isBlob(f))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?h&&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,A){!(a.isUndefined(w)||w===null)&&t.append(o===!0?Ne([y],A,i):o===null?y:y+"[]",u(w))}),!1}return we(f)?!0:(t.append(Ne(m,y,i),u(f)),!1)}const d=[],x=Object.assign(ln,{defaultVisitor:c,convertValue:u,isVisitable:we});function C(f,y){if(!a.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(f),a.forEach(f,function(S,O){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(O)?O.trim():O,y,x))===!0&&C(S,y?y.concat(O):[O])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return C(e),t}function Pe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Re(e,t){this._pairs=[],e&&pe(e,this,t)}const rt=Re.prototype;rt.append=function(t,n){this._pairs.push([t,n])};rt.toString=function(t){const n=t?function(r){return t.call(this,r,Pe)}:Pe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function 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 Re(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class _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:Re,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",gn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Te,hasStandardBrowserEnv:hn,hasStandardBrowserWebWorkerEnv:mn,navigator:Se,origin:yn},Symbol.toStringTag,{value:"Module"})),k={...gn,...pn};function xn(e,t){return pe(e,new k.classes.URLSearchParams,{visitor:function(n,r,s,i){return k.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function bn(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),h=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,h?(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(bn(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 h=this.env&&this.env.FormData;return pe(l?{"files[]":t}:t,h&&new h,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"?g.from(l,g.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:k.classes.FormData,Blob:k.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{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"]),Cn=e=>{const t={};let n,r,s;return e&&e.split(`
2
- `).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&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 Rn(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,h,u){const c=Q(h);if(!c)throw new Error("header name must be a non-empty string");const d=a.findKey(s,c);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||h]=ae(l))}const o=(l,h)=>a.forEach(l,(u,c)=>i(u,c,h));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!Tn(t))o(Cn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let l={},h,u;for(const c of t){if(!a.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[u=c[0]]=(h=l[u])?a.isArray(h)?[...h,c[1]]:[h,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 Rn(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(`
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 ge(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 G(e,t,n){g.call(this,e??"canceled",g.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(G,g,{__CANCEL__:!0});function lt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new g("Request failed with status code "+n.status,[g.ERR_BAD_REQUEST,g.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(h){const u=Date.now(),c=r[i];o||(o=u),n[s]=h,r[s]=u;let d=i,x=0;for(;d!==s;)x+=n[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const C=c&&u-c;return C?Math.round(x*1e3/C):void 0}}function Fn(e,t){let n=0,r=1e3/t,s,i;const o=(u,c=Date.now())=>{n=c,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?o(u,c):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>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,h=o-r,u=s(h),c=o<=l;r=o;const d={loaded:o,total:l,progress:l?o/l:void 0,bytes:h,rate:u||void 0,estimated:u&&l&&c?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(d)},n)},Le=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Be=e=>(...t)=>a.asap(()=>e(...t)),Nn=k.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,k.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(k.origin),k.navigator&&/(msie|trident)/i.test(k.navigator.userAgent)):()=>!0,Pn=k.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(u,c,d,x){return a.isPlainObject(u)&&a.isPlainObject(c)?a.merge.call({caseless:x},u,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(u,c,d,x){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u,d,x)}else return r(u,c,d,x)}function i(u,c){if(!a.isUndefined(c))return r(void 0,c)}function o(u,c){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function l(u,c,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}const h={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,c,d)=>s(Ie(u),Ie(c),d,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const d=h[c]||s,x=d(e[c],t[c],c);a.isUndefined(x)&&d!==l||(n[c]=x)}),n}const ut=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName: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(k.hasStandardBrowserEnv||k.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const h=n.getHeaders(),u=["content-type","content-length"];Object.entries(h).forEach(([c,d])=>{u.includes(c.toLowerCase())&&o.set(c,d)})}}if(k.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Nn(t.url))){const h=s&&i&&Pn.read(i);h&&o.set(s,h)}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:h,onDownloadProgress:u}=s,c,d,x,C,f;function y(){C&&C(),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()),j={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:w,config:e,request:m};lt(function(R){n(R),y()},function(R){r(R),y()},j),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 g("Request aborted",g.ECONNABORTED,e,m)),m=null)},m.onerror=function(A){const j=A&&A.message?A.message:"Network Error",E=new g(j,g.ERR_NETWORK,e,m);E.event=A||null,r(E),m=null},m.ontimeout=function(){let A=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const j=s.transitional||ot;s.timeoutErrorMessage&&(A=s.timeoutErrorMessage),r(new g(A,j.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(A,j){m.setRequestHeader(j,A)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),u&&([x,f]=ce(u,!0),m.addEventListener("progress",x)),h&&m.upload&&([d,C]=ce(h),m.upload.addEventListener("progress",d),m.upload.addEventListener("loadend",C)),(s.cancelToken||s.signal)&&(c=w=>{m&&(r(!w||w.type?new G(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&&k.protocols.indexOf(O)===-1){r(new g("Unsupported protocol "+O+":",g.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(u){if(!s){s=!0,l();const c=u instanceof Error?u:this.reason;r.abort(c instanceof g?c:new G(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new g(`timeout ${t} of ms exceeded`,g.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:h}=r;return h.unsubscribe=()=>a.asap(l),h}},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=h=>{o||(o=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:u,value:c}=await s.next();if(u){l(),h.close();return}let d=c.byteLength;if(n){let x=i+=d;n(x)}h.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(h){return l(h),s.return()}},{highWaterMark:2})},ve=64*1024,{isFunction:oe}=a,Hn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:ze,TextEncoder:He}=a.global,qe=(e,...t)=>{try{return!!e(...t)}catch{return!1}},qn=e=>{e=a.merge.call({skipUndefined:!0},Hn,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),h=s&&(typeof He=="function"?(f=>y=>f.encode(y))(new He):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=i&&l&&qe(()=>{let f=!1;const y=new n(k.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)),d={stream:c&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!d[f]&&(d[f]=(y,m)=>{let S=y&&y[f];if(S)return S.call(y);throw new g(`Response type '${f}' is not supported`,g.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(k.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await h(f)).byteLength},C=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:A,onDownloadProgress:j,onUploadProgress:E,responseType:R,headers:Y,withCredentials:W="same-origin",fetchOptions:re}=ut(f),z=t||fetch;R=R?(R+"").toLowerCase():"text";let J=In([O,w&&w.toAbortSignal()],A),H=null;const b=J&&J.unsubscribe&&(()=>{J.unsubscribe()});let U;try{if(E&&u&&m!=="get"&&m!=="head"&&(U=await C(Y,S))!==0){let v=new n(y,{method:"POST",body:S,duplex:"half"}),V;if(a.isFormData(S)&&(V=v.headers.get("content-type"))&&Y.setContentType(V),v.body){const[me,se]=Le(U,ce(Be(E)));S=De(v.body,ve,me,se)}}a.isString(W)||(W=W?"include":"omit");const F=i&&"credentials"in n.prototype,Ae={...re,signal:J,method:m.toUpperCase(),headers:Y.normalize().toJSON(),body:S,duplex:"half",credentials:F?W:void 0};H=i&&new n(y,Ae);let D=await(i?z(H,re):z(y,Ae));const je=c&&(R==="stream"||R==="response");if(c&&(j||je&&b)){const v={};["status","statusText","headers"].forEach(ke=>{v[ke]=D[ke]});const V=a.toFiniteNumber(D.headers.get("content-length")),[me,se]=j&&Le(V,ce(Be(j),!0))||[];D=new r(De(D.body,ve,me,()=>{se&&se(),b&&b()}),v)}R=R||"text";let yt=await d[a.findKey(d,R)||"text"](D,f);return!je&&b&&b(),await new Promise((v,V)=>{lt(v,V,{data:yt,headers:_.from(D.headers),status:D.status,statusText:D.statusText,config:f,request:H})})}catch(F){throw b&&b(),F&&F.name==="TypeError"&&/Load failed|fetch/i.test(F.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,H),{cause:F.cause||F}):g.from(F,F&&F.code,f,H)}}},Mn=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,h,u,c=Mn;for(;l--;)h=i[l],u=c.get(h),u===void 0&&c.set(h,u=l?new Map:qn(t)),c=u;return u};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 Me=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 g(`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(([h,u])=>`adapter ${h} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
1
+ "use strict";const h=require("react/jsx-runtime"),P=require("react"),B=require("lucide-react"),gt=({onMinimise:e,isOpen:t,theme:n,chatBotData:r})=>{const s=r.position==="left",i=s?"32px":"auto",o=s?"auto":"32px",l=localStorage.getItem("clone67ChatSessionId"),p={position:"fixed",bottom:"32px",left:i,right:o,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"},u={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:p,children:[t?h.jsx(B.Minus,{size:20,strokeWidth:2.5}):h.jsx(B.MessageCircle,{size:20,strokeWidth:2.5}),!t&&l&&h.jsx("span",{style:u})]})},xt=({onSendMessage:e,isLoading:t,theme:n})=>{const[r,s]=P.useState(""),i=()=>{!r.trim()||t||(e(r.trim()),s(""))},o=d=>{d.key==="Enter"&&!d.shiftKey&&(d.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"},u={flex:1,padding:"12px 16px",background:n.inputBackgroundColor||n.backgroundColor,color:n.fontColor,border:`1px solid ${n.fontColor}`,borderRadius:"12px",fontSize:"14px",outline:"none",transition:"all 0.2s ease",opacity:t?.5:1,cursor:t?"not-allowed":"text",boxShadow:"none"},c={padding:"12px 20px",borderRadius:"12px",background:`linear-gradient(135deg, ${n.primaryColor}, ${n.secondaryColor})`,color:n.fontColor,border:"none",cursor:t||!r.trim()?"not-allowed":"pointer",opacity:t||!r.trim()?.5:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontWeight:"600",fontSize:"14px",transition:"all 0.2s ease",minWidth:"48px"};return h.jsx("div",{style:l,children:h.jsxs("div",{style:p,children:[h.jsx("input",{type:"text",placeholder:"Type a message...",value:r,onChange:d=>s(d.target.value),onKeyDown:o,disabled:t,style:u,onFocus:d=>{d.target.style.boxShadow="0 0 0 3px rgba(100, 150, 255, 0.3)",d.target.style.borderColor="#60a5fa"},onBlur:d=>{d.target.style.boxShadow="none",d.target.style.borderColor=n.fontColor}}),h.jsx("button",{onClick:i,disabled:t||!r.trim(),style:c,"aria-label":"Send message",onMouseEnter:d=>{!t&&r.trim()&&(d.currentTarget.style.transform="translateY(-2px)",d.currentTarget.style.boxShadow="0 8px 16px rgba(0,0,0,0.15)")},onMouseLeave:d=>{d.currentTarget.style.transform="translateY(0)",d.currentTarget.style.boxShadow="none"},children:h.jsx(B.Send,{size:18})})]})})},bt=({messages:e,isLoading:t,theme:n})=>{console.log("messages",e);const r=P.useRef(null),s=()=>{r.current?.scrollIntoView({behavior:"smooth"})};function i(d){return new Date(d).toLocaleString("en-AU",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}P.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=d=>({display:"flex",justifyContent:d==="user"?"flex-end":"flex-start",width:"100%"}),p={display:"flex",flexDirection:"column",maxWidth:"80%"},u=d=>({padding:"12px 16px",borderRadius:"16px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid #e4e4e7",fontSize:"14px",lineHeight:"1.5",background:d==="user"?n.primaryColor:n.backgroundColor,color:n.fontColor,wordWrap:"break-word"}),c={...u("bot"),animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s"};return h.jsxs("div",{style:o,children:[e.map((d,x)=>h.jsx("div",{style:l(d.sender_type),children:h.jsxs("div",{style:p,children:[d.sender_type==="bot"&&d.created_at&&h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-start",marginLeft:"4px",marginBottom:"2px"},children:[h.jsx(B.Bot,{size:14,color:n.fontColor}),h.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:i(d.created_at)})]}),d.sender_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:u(d.sender_type),children:d.message})]})},x)),t&&h.jsx("div",{style:l("bot"),children:h.jsxs("div",{style:{...c,display:"flex",alignItems:"center",gap:"8px"},children:[h.jsx(B.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:St}=Object.prototype,{getPrototypeOf:Ce}=Object,{iterator:ue,toStringTag:Ve}=Symbol,de=(e=>t=>{const n=St.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),U=e=>(e=e.toLowerCase(),t=>de(t)===e),fe=e=>t=>typeof t===e,{isArray:X}=Array,K=fe("undefined");function Z(e){return e!==null&&!K(e)&&e.constructor!==null&&!K(e.constructor)&&N(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ke=U("ArrayBuffer");function wt(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"),N=fe("function"),Xe=fe("number"),ee=e=>e!==null&&typeof e=="object",Ct=e=>e===!0||e===!1,ie=e=>{if(de(e)!=="object")return!1;const t=Ce(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ve in e)&&!(ue in e)},Rt=e=>{if(!ee(e)||Z(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Tt=U("Date"),Ot=U("File"),At=U("Blob"),jt=U("FileList"),kt=e=>ee(e)&&N(e.pipe),Ft=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||N(e.append)&&((t=de(e))==="formdata"||t==="object"&&N(e.toString)&&e.toString()==="[object FormData]"))},Pt=U("URLSearchParams"),[Nt,_t,Ut,It]=["ReadableStream","Request","Response","Headers"].map(U),Lt=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]),X(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=>!K(e)&&e!==q;function be(){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]=be(n[o],s):ie(s)?n[o]=be({},s):X(s)?n[o]=s.slice():(!t||!K(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&te(arguments[s],r);return n}const Bt=(e,t,n,{allOwnKeys:r}={})=>(te(t,(s,i)=>{n&&N(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&&Ce(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},qt=(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},Ht=e=>{if(!e)return null;if(X(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},Mt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ce(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=U("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=U("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(N(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(N(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Gt=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return X(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&&N(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=X(r)?[]:{};return te(r,(o,l)=>{const p=n(o,s+1);!K(p)&&(i[l]=p)}),t[s]=void 0,i}}return r};return n(e,0)},tn=U("AsyncFunction"),nn=e=>e&&(ee(e)||N(e))&&N(e.then)&&N(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",N(q.postMessage)),rn=typeof queueMicrotask<"u"?queueMicrotask.bind(q):typeof process<"u"&&process.nextTick||Ze,sn=e=>e!=null&&N(e[ue]),a={isArray:X,isArrayBuffer:Ke,isBuffer:Z,isFormData:Ft,isArrayBufferView:wt,isString:Et,isNumber:Xe,isBoolean:Ct,isObject:ee,isPlainObject:ie,isEmptyObject:Rt,isReadableStream:Nt,isRequest:_t,isResponse:Ut,isHeaders:It,isUndefined:K,isDate:Tt,isFile:Ot,isBlob:At,isRegExp:Kt,isFunction:N,isStream:kt,isURLSearchParams:Pt,isTypedArray:Mt,isFileList:jt,forEach:te,merge:be,extend:Bt,trim:Lt,stripBOM:Dt,inherits:vt,toFlatObject:zt,kindOf:de,kindOfTest:U,endsWith:qt,toArray:Ht,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 g(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(g,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=g.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(g,tt);Object.defineProperty(et,"isAxiosError",{value:!0});g.from=(e,t,n,r,s,i)=>{const o=Object.create(et);a.toFlatObject(e,o,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return g.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 Se(e){return a.isPlainObject(e)||a.isArray(e)}function nt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Pe(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(Se)}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 u(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!p&&a.isBlob(f))throw new g("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 w=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,"[]"))&&(w=a.toArray(f)))return y=nt(y),w.forEach(function(S,A){!(a.isUndefined(S)||S===null)&&t.append(o===!0?Pe([y],A,i):o===null?y:y+"[]",u(S))}),!1}return Se(f)?!0:(t.append(Pe(m,y,i),u(f)),!1)}const d=[],x=Object.assign(ln,{defaultVisitor:c,convertValue:u,isVisitable:Se});function C(f,y){if(!a.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(f),a.forEach(f,function(w,O){(!(a.isUndefined(w)||w===null)&&s.call(t,w,a.isString(O)?O.trim():O,y,x))===!0&&C(w,y?y.concat(O):[O])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return C(e),t}function Ne(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Re(e,t){this._pairs=[],e&&pe(e,this,t)}const rt=Re.prototype;rt.append=function(t,n){this._pairs.push([t,n])};rt.toString=function(t){const n=t?function(r){return t.call(this,r,Ne)}:Ne;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 Re(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class _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:Re,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",we=typeof navigator=="object"&&navigator||void 0,hn=Te&&(!we||["ReactNative","NativeScript","NS"].indexOf(we.product)<0),mn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yn=Te&&window.location.href||"http://localhost",gn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Te,hasStandardBrowserEnv:hn,hasStandardBrowserWebWorkerEnv:mn,navigator:we,origin:yn},Symbol.toStringTag,{value:"Module"})),F={...gn,...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 bn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Sn(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]=Sn(s[o])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(bn(r),s,n,0)}),n}return null}function wn(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),wn(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"?g.from(l,g.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"]),Cn=e=>{const t={};let n,r,s;return e&&e.split(`
2
+ `).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&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 Rn(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,u){const c=Q(p);if(!c)throw new Error("header name must be a non-empty string");const d=a.findKey(s,c);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||p]=ae(l))}const o=(l,p)=>a.forEach(l,(u,c)=>i(u,c,p));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!Tn(t))o(Cn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let l={},p,u;for(const c of t){if(!a.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[u=c[0]]=(p=l[u])?a.isArray(p)?[...p,c[1]]:[p,c[1]]:c[1]}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 Rn(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(`
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 ge(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 G(e,t,n){g.call(this,e??"canceled",g.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(G,g,{__CANCEL__:!0});function lt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new g("Request failed with status code "+n.status,[g.ERR_BAD_REQUEST,g.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 u=Date.now(),c=r[i];o||(o=u),n[s]=p,r[s]=u;let d=i,x=0;for(;d!==s;)x+=n[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const C=c&&u-c;return C?Math.round(x*1e3/C):void 0}}function Fn(e,t){let n=0,r=1e3/t,s,i;const o=(u,c=Date.now())=>{n=c,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?o(u,c):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>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,u=s(p),c=o<=l;r=o;const d={loaded:o,total:l,progress:l?o/l:void 0,bytes:p,rate:u||void 0,estimated:u&&l&&c?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(d)},n)},Ie=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Le=e=>(...t)=>a.asap(()=>e(...t)),Pn=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,Nn=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 Be=e=>e instanceof _?{...e}:e;function M(e,t){t=t||{};const n={};function r(u,c,d,x){return a.isPlainObject(u)&&a.isPlainObject(c)?a.merge.call({caseless:x},u,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(u,c,d,x){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u,d,x)}else return r(u,c,d,x)}function i(u,c){if(!a.isUndefined(c))return r(void 0,c)}function o(u,c){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function l(u,c,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}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:(u,c,d)=>s(Be(u),Be(c),d,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const d=p[c]||s,x=d(e[c],t[c],c);a.isUndefined(x)&&d!==l||(n[c]=x)}),n}const ut=e=>{const t=M({},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(),u=["content-type","content-length"];Object.entries(p).forEach(([c,d])=>{u.includes(c.toLowerCase())&&o.set(c,d)})}}if(F.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Pn(t.url))){const p=s&&i&&Nn.read(i);p&&o.set(s,p)}return t},In=typeof XMLHttpRequest<"u",Ln=In&&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:u}=s,c,d,x,C,f;function y(){C&&C(),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 w(){if(!m)return;const S=_.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),j={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:S,config:e,request:m};lt(function(R){n(R),y()},function(R){r(R),y()},j),m=null}"onloadend"in m?m.onloadend=w:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(w)},m.onabort=function(){m&&(r(new g("Request aborted",g.ECONNABORTED,e,m)),m=null)},m.onerror=function(A){const j=A&&A.message?A.message:"Network Error",E=new g(j,g.ERR_NETWORK,e,m);E.event=A||null,r(E),m=null},m.ontimeout=function(){let A=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const j=s.transitional||ot;s.timeoutErrorMessage&&(A=s.timeoutErrorMessage),r(new g(A,j.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(A,j){m.setRequestHeader(j,A)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),u&&([x,f]=ce(u,!0),m.addEventListener("progress",x)),p&&m.upload&&([d,C]=ce(p),m.upload.addEventListener("progress",d),m.upload.addEventListener("loadend",C)),(s.cancelToken||s.signal)&&(c=S=>{m&&(r(!S||S.type?new G(null,e,m):S),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 g("Unsupported protocol "+O+":",g.ERR_BAD_REQUEST,e));return}m.send(i||null)})},Bn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,l();const c=u instanceof Error?u:this.reason;r.abort(c instanceof g?c:new G(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new g(`timeout ${t} of ms exceeded`,g.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal: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:u,value:c}=await s.next();if(u){l(),p.close();return}let d=c.byteLength;if(n){let x=i+=d;n(x)}p.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(p){return l(p),s.return()}},{highWaterMark:2})},ve=64*1024,{isFunction:oe}=a,qn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:ze,TextEncoder:qe}=a.global,He=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Hn=e=>{e=a.merge.call({skipUndefined:!0},qn,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 qe=="function"?(f=>y=>f.encode(y))(new qe):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=i&&l&&He(()=>{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&&He(()=>a.isReadableStream(new r("").body)),d={stream:c&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!d[f]&&(d[f]=(y,m)=>{let w=y&&y[f];if(w)return w.call(y);throw new g(`Response type '${f}' is not supported`,g.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},C=async(f,y)=>{const m=a.toFiniteNumber(f.getContentLength());return m??x(y)};return async f=>{let{url:y,method:m,data:w,signal:O,cancelToken:S,timeout:A,onDownloadProgress:j,onUploadProgress:E,responseType:R,headers:Y,withCredentials:$="same-origin",fetchOptions:re}=ut(f),z=t||fetch;R=R?(R+"").toLowerCase():"text";let W=Bn([O,S&&S.toAbortSignal()],A),b=null;const k=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let J;try{if(E&&u&&m!=="get"&&m!=="head"&&(J=await C(Y,w))!==0){let v=new n(y,{method:"POST",body:w,duplex:"half"}),V;if(a.isFormData(w)&&(V=v.headers.get("content-type"))&&Y.setContentType(V),v.body){const[me,se]=Ie(J,ce(Le(E)));w=De(v.body,ve,me,se)}}a.isString($)||($=$?"include":"omit");const I=i&&"credentials"in n.prototype,Ae={...re,signal:W,method:m.toUpperCase(),headers:Y.normalize().toJSON(),body:w,duplex:"half",credentials:I?$:void 0};b=i&&new n(y,Ae);let D=await(i?z(b,re):z(y,Ae));const je=c&&(R==="stream"||R==="response");if(c&&(j||je&&k)){const v={};["status","statusText","headers"].forEach(ke=>{v[ke]=D[ke]});const V=a.toFiniteNumber(D.headers.get("content-length")),[me,se]=j&&Ie(V,ce(Le(j),!0))||[];D=new r(De(D.body,ve,me,()=>{se&&se(),k&&k()}),v)}R=R||"text";let yt=await d[a.findKey(d,R)||"text"](D,f);return!je&&k&&k(),await new Promise((v,V)=>{lt(v,V,{data:yt,headers:_.from(D.headers),status:D.status,statusText:D.statusText,config:f,request:b})})}catch(I){throw k&&k(),I&&I.name==="TypeError"&&/Load failed|fetch/i.test(I.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,b),{cause:I.cause||I}):g.from(I,I&&I.code,f,b)}}},Mn=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,u,c=Mn;for(;l--;)p=i[l],u=c.get(p),u===void 0&&c.set(p,u=l?new Map:Hn(t)),c=u;return u};dt();const Oe={http:on,xhr:Ln,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 Me=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 g(`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,u])=>`adapter ${p} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
4
4
  `+o.map(Me).join(`
5
- `):" "+Me(o[0]):"as no adapter specified";throw new g("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 G(null,e)}function $e(e){return xe(e),e.headers=_.from(e.headers),e.data=ge.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=ge.call(e,e.transformResponse,r),r.headers=_.from(r.headers),r},function(r){return at(r)||(xe(e),r&&r.response&&(r.response.data=ge.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 g(s(o," has been removed"+(n?" in "+n:"")),g.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 g("options must be an object",g.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],h=l===void 0||o(l,i,e);if(h!==!0)throw new g("option "+i+" must be "+h,g.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new g("Unknown option "+i,g.ERR_BAD_OPTION)}}const le={assertOptions:Jn,validators:he},I=le.validators;let M=class{constructor(t){this.defaults=t||{},this.interceptors={request:new _e,response:new _e}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const 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 h=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(h=h&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let c,d=0,x;if(!h){const f=[$e.bind(this),void 0];for(f.unshift(...l),f.push(...u),x=f.length,c=Promise.resolve(n);d<x;)c=c.then(f[d++],f[d++]);return c}x=l.length;let C=n;for(;d<x;){const f=l[d++],y=l[d++];try{C=f(C)}catch(m){y.call(this,m);break}}try{c=$e.call(this,C)}catch(f){return Promise.reject(f)}for(d=0,x=u.length;d<x;)c=c.then(u[d++],u[d++]);return c}getUri(t){t=$(this.defaults,t);const n=ct(t.baseURL,t.url,t.allowAbsoluteUrls);return st(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){M.prototype[t]=function(n,r){return this.request($(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,l){return this.request($(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}M.prototype[t]=n(),M.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 G(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 M(e),n=Je(M.prototype.request,t);return a.extend(n,M.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return mt($(e,s))},n}const T=mt(ne);T.Axios=M;T.CanceledError=G;T.CancelToken=Vn;T.isCancel=at;T.VERSION=pt;T.toFormData=pe;T.AxiosError=g;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:sr,AxiosError:or,CanceledError:ir,isCancel:ar,CancelToken:lr,VERSION:cr,all:ur,Cancel:dr,isAxiosError:fr,spread:pr,toFormData:hr,AxiosHeaders:mr,HttpStatusCode:yr,formToJSON:gr,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=async(e,t)=>{const n={sessionId:e};try{const r=await T.post(t,n,{headers:{"Content-Type":"application/json"}});return r.data.n8n.message_found?r.data.n8n.chats:null}catch(r){throw console.error("Error fetching with chat API:",r),r}},Zn=({theme:e,chatBotData:t,trackFormSubmission:n})=>{const[r,s]=N.useState(""),[i,o]=N.useState(""),[l,h]=N.useState(""),[u,c]=N.useState(""),[d,x]=N.useState(!1),C=async E=>{if(E.preventDefault(),x(!0),c(""),!r.trim()||!i.trim()){c("Name and email are required"),x(!1);return}try{const R=await Gn(l,t.pineconeNamespace,t.initiateChatUrl,r,i);localStorage.setItem("clone67ChatSessionId",R.n8n.session_id),n(!0)}catch(R){console.log("error sending user details",R),c("Failed to submit. Please try again.")}finally{x(!1)}s(""),o(""),h("")},f={padding:"20px",flexShrink:0,background:e.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},y={display:"flex",flexDirection:"column",gap:"24px"},m={fontSize:"14px",fontWeight:"500",color:e.fontColor,margin:0,lineHeight:"1.4"},S={display:"flex",flexDirection:"column",gap:"20px"},O={fontSize:"14px",color:e.fontColor,fontWeight:"500"},w={width:"100%",padding:"12px 16px",background:e.backgroundColor,color:e.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:r.trim()&&i.trim()&&!d?"pointer":"not-allowed",opacity:r.trim()&&i.trim()&&!d?1:.5,background:`linear-gradient(135deg, ${e.primaryColor}, ${e.secondaryColor})`,color:e.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease"},j={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return p.jsx("div",{style:f,children:p.jsxs("form",{onSubmit:C,style:y,children:[u&&p.jsx("div",{style:j,role:"alert",children:u}),p.jsx("p",{style:m,children:t.welcomeText}),p.jsxs("div",{style:S,children:[p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[p.jsx("label",{style:O,children:"Full Name"}),p.jsx("input",{type:"text",placeholder:"Enter your full name",value:r,onChange:E=>{s(E.target.value),c("")},style:w,required:!0})]}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[p.jsx("label",{style:O,children:"Email Address"}),p.jsx("input",{type:"email",placeholder:"Enter your email",value:i,onChange:E=>{o(E.target.value),c("")},style:w,required:!0})]}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[p.jsx("label",{style:O,children:"Message"}),p.jsx("textarea",{placeholder:"Enter your message",value:l,onChange:E=>{h(E.target.value),c("")},style:{...w,minHeight:"60px",maxHeight:"80px",resize:"vertical"},required:!0})]})]}),p.jsx("button",{type:"submit",disabled:!r.trim()||!i.trim()||d,style:A,onMouseEnter:E=>{r.trim()&&i.trim()&&!d&&(E.currentTarget.style.transform="translateY(-2px)",E.currentTarget.style.boxShadow="0 10px 20px rgba(0,0,0,0.15)")},onMouseLeave:E=>{E.currentTarget.style.transform="translateY(0)",E.currentTarget.style.boxShadow="none"},children:d?"Submitting...":p.jsxs(p.Fragment,{children:[p.jsx(L.Send,{size:18}),"Submit"]})})]})})},er=({onClose:e,theme:t,chatBotData:n})=>{const[r,s]=N.useState([]),[i,o]=N.useState(!1),[l,h]=N.useState(!1),[u,c]=N.useState(!1),d=n.position==="left",x=localStorage.getItem("clone67ChatSessionId"),C=b=>{c(b)},f=async()=>{if(x){o(!0);try{const b=await Qn(x,n.fetchChatHistoryUrl);Array.isArray(b)?s(b):s(b?[b]:[]),console.log("chat history in layout",b)}catch(b){console.log("Error fetching chat history",b)}finally{o(!1)}}};N.useEffect(()=>{f()},[u,x]);const y=async b=>{o(!0),s(U=>[...U,{sender_type:"user",message:b}]);try{const U=await Yn(b,n.pineconeNamespace,n.onGoingChatUrl,x);s(F=>[...F,{sender_type:"bot",message:U.n8n.response,created_at:U.n8n.created_at,suggested_prompts:U.n8n.suggested_prompt}])}catch(U){console.error("Chat error:",U),s(F=>[...F,{sender_type:"bot",message:"Sorry, something went wrong."}])}finally{o(!1)}},m={position:"fixed",bottom:"112px",[d?"left":"right"]:"32px",zIndex:50,width:l?"684px":"384px",height:l?"620px":"520px",background:`${t.backgroundColor}cc`,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderRadius:"16px",border:"1px solid rgba(255, 255, 255, 0.3)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},S={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)"},O={position:"relative"},w={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},A={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},j={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},E={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},R={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},Y={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},W={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},re={fontWeight:"600"},z=(b,U)=>{b.currentTarget.style.background=U?"rgba(255,255,255,0.2)":"transparent"},J={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:t.fontColor,opacity:.9,fontSize:"14px"},H={animation:"spin 1s linear infinite"};return p.jsxs("div",{style:m,children:[p.jsx("style",{children:`
7
- @keyframes spin {
8
- from { transform: rotate(0deg); }
9
- to { transform: rotate(360deg); }
10
- }
11
- `}),p.jsxs("div",{style:S,children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[p.jsxs("div",{style:O,children:[p.jsx("div",{style:w,children:p.jsx(L.MessageCircle,{size:22})}),p.jsx("span",{style:A})]}),p.jsxs("div",{children:[p.jsx("h3",{style:j,children:n.name}),p.jsx("p",{style:E,children:n.subTitle})]})]}),p.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[p.jsx("button",{onClick:()=>h(b=>!b),"aria-label":"expand chat",style:R,onMouseEnter:b=>z(b,!0),onMouseLeave:b=>z(b,!1),children:l?p.jsx(L.Minimize2,{size:20}):p.jsx(L.Maximize2,{size:20})}),p.jsx("button",{onClick:e,"aria-label":"close chat",style:R,onMouseEnter:b=>z(b,!0),onMouseLeave:b=>z(b,!1),children:p.jsx(L.X,{size:20})})]})]}),x?p.jsx(p.Fragment,{children:i&&r.length===0?p.jsxs("div",{style:J,children:[p.jsx(L.Loader2,{size:18,style:H}),p.jsx("span",{children:"Checking server…"})]}):p.jsxs(p.Fragment,{children:[p.jsx(bt,{messages:r,isLoading:i,theme:t}),p.jsx(xt,{onSendMessage:y,isLoading:i,theme:t})]})}):p.jsx(Zn,{theme:t,chatBotData:n,trackFormSubmission:C}),p.jsx("div",{style:Y,children:p.jsxs("p",{style:W,children:["powered by ",p.jsx("span",{style:re,children:"clone67.com"})]})})]})},tr=({pineconeNamespace:e,onGoingChatUrl:t,initiateChatUrl:n,fetchChatHistoryUrl:r,primaryColor:s="#3b82f6",secondaryColor:i="#8b5cf6",backgroundColor:o="#ffffff",fontColor:l="#1f2937",placeholderColor:h="#9ca3af",position:u="right",name:c="Assistant",subTitle:d="Typically replies instantly",welcomeText:x="Hi! How can I help you today?"})=>{const[C,f]=N.useState(!1),y=()=>{f(R=>!R),localStorage.removeItem("clone67ChatSessionId")},m=()=>f(R=>!R),S={primaryColor:s,secondaryColor:i,backgroundColor:o,fontColor:l,placeholderColor:h,inputBackgroundColor:o},O={name:c,subTitle:d,welcomeText:x,onGoingChatUrl:t,fetchChatHistoryUrl:r,initiateChatUrl:n,pineconeNamespace:e,position:u},w=u==="left",A="32px",j={position:"fixed",bottom:"104px",[w?"left":"right"]:A,zIndex:9999,pointerEvents:"auto"},E={position:"fixed",bottom:"32px",[w?"left":"right"]:A,zIndex:1e4,pointerEvents:"auto"};return p.jsxs(p.Fragment,{children:[C&&p.jsx("div",{style:j,children:p.jsx(er,{onClose:y,theme:S,chatBotData:O})}),p.jsx("div",{style:E,children:p.jsx(gt,{onMinimise:m,isOpen:C,theme:S,chatBotData:O})})]})};module.exports=tr;
5
+ `):" "+Me(o[0]):"as no adapter specified";throw new g("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 G(null,e)}function $e(e){return xe(e),e.headers=_.from(e.headers),e.data=ge.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=ge.call(e,e.transformResponse,r),r.headers=_.from(r.headers),r},function(r){return at(r)||(xe(e),r&&r.response&&(r.response.data=ge.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 g(s(o," has been removed"+(n?" in "+n:"")),g.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 g("options must be an object",g.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 g("option "+i+" must be "+p,g.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new g("Unknown option "+i,g.ERR_BAD_OPTION)}}const le={assertOptions:Jn,validators:he},L=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=M(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&le.assertOptions(r,{silentJSONParsing:L.transitional(L.boolean),forcedJSONParsing:L.transitional(L.boolean),clarifyTimeoutError:L.transitional(L.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:le.assertOptions(s,{encode:L.function,serialize:L.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),le.assertOptions(n,{baseUrl:L.spelling("baseURL"),withXsrfToken:L.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 u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let c,d=0,x;if(!p){const f=[$e.bind(this),void 0];for(f.unshift(...l),f.push(...u),x=f.length,c=Promise.resolve(n);d<x;)c=c.then(f[d++],f[d++]);return c}x=l.length;let C=n;for(;d<x;){const f=l[d++],y=l[d++];try{C=f(C)}catch(m){y.call(this,m);break}}try{c=$e.call(this,C)}catch(f){return Promise.reject(f)}for(d=0,x=u.length;d<x;)c=c.then(u[d++],u[d++]);return c}getUri(t){t=M(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(M(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(M(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 G(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(M(e,s))},n}const T=mt(ne);T.Axios=H;T.CanceledError=G;T.CancelToken=Vn;T.isCancel=at;T.VERSION=pt;T.toFormData=pe;T.AxiosError=g;T.Cancel=T.CanceledError;T.all=function(t){return Promise.all(t)};T.spread=Kn;T.isAxiosError=Xn;T.mergeConfig=M;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:sr,AxiosError:or,CanceledError:ir,isCancel:ar,CancelToken:lr,VERSION:cr,all:ur,Cancel:dr,isAxiosError:fr,spread:pr,toFormData:hr,AxiosHeaders:mr,HttpStatusCode:yr,formToJSON:gr,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=async(e,t)=>{const n={sessionId:e};try{const r=await T.post(t,n,{headers:{"Content-Type":"application/json"}});return r.data.n8n.message_found?r.data.n8n.chats:null}catch(r){throw console.error("Error fetching with chat API:",r),r}},Zn=({theme:e,chatBotData:t,trackFormSubmission:n})=>{const[r,s]=P.useState(""),[i,o]=P.useState(""),[l,p]=P.useState(""),[u,c]=P.useState(""),[d,x]=P.useState(!1),C=async E=>{if(E.preventDefault(),x(!0),c(""),!r.trim()||!i.trim()){c("Name and email are required"),x(!1);return}try{const R=await Gn(l,t.pineconeNamespace,t.initiateChatUrl,r,i);localStorage.setItem("clone67ChatSessionId",R.n8n.session_id),n(!0)}catch(R){console.log("error sending user details",R),c("Failed to submit. Please try again.")}finally{x(!1)}s(""),o(""),p("")},f={padding:"20px",flexShrink:0,background:e.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},y={display:"flex",flexDirection:"column",gap:"24px"},m={fontSize:"14px",fontWeight:"500",color:e.fontColor,margin:0,lineHeight:"1.4"},w={display:"flex",flexDirection:"column",gap:"20px"},O={fontSize:"14px",color:e.fontColor,fontWeight:"500"},S={width:"100%",padding:"12px 16px",background:e.backgroundColor,color:e.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:r.trim()&&i.trim()&&!d?"pointer":"not-allowed",opacity:r.trim()&&i.trim()&&!d?1:.5,background:`linear-gradient(135deg, ${e.primaryColor}, ${e.secondaryColor})`,color:e.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease"},j={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return h.jsx("div",{style:f,children:h.jsxs("form",{onSubmit:C,style:y,children:[u&&h.jsx("div",{style:j,role:"alert",children:u}),h.jsx("p",{style:m,children:t.welcomeText}),h.jsxs("div",{style:w,children:[h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:O,children:"Full Name"}),h.jsx("input",{type:"text",placeholder:"Enter your full name",value:r,onChange:E=>{s(E.target.value),c("")},style:S,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:O,children:"Email Address"}),h.jsx("input",{type:"email",placeholder:"Enter your email",value:i,onChange:E=>{o(E.target.value),c("")},style:S,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:O,children:"Message"}),h.jsx("textarea",{placeholder:"Enter your message",value:l,onChange:E=>{p(E.target.value),c("")},style:{...S,minHeight:"60px",maxHeight:"80px",resize:"vertical"},required:!0})]})]}),h.jsx("button",{type:"submit",disabled:!r.trim()||!i.trim()||d,style:A,onMouseEnter:E=>{r.trim()&&i.trim()&&!d&&(E.currentTarget.style.transform="translateY(-2px)",E.currentTarget.style.boxShadow="0 10px 20px rgba(0,0,0,0.15)")},onMouseLeave:E=>{E.currentTarget.style.transform="translateY(0)",E.currentTarget.style.boxShadow="none"},children:d?"Submitting...":h.jsxs(h.Fragment,{children:[h.jsx(B.Send,{size:18}),"Submit"]})})]})})},er=({onClose:e,theme:t,chatBotData:n})=>{const[r,s]=P.useState([]),[i,o]=P.useState(!1),[l,p]=P.useState(!1),[u,c]=P.useState(!1),d=n.position==="left",x=localStorage.getItem("clone67ChatSessionId"),C=b=>{c(b)},f=async()=>{if(x){o(!0);try{const b=await Qn(x,n.fetchChatHistoryUrl);Array.isArray(b)?s(b):s(b?[b]:[]),console.log("chat history in layout",b)}catch(b){console.log("Error fetching chat history",b)}finally{o(!1)}}};P.useEffect(()=>{f()},[u,x]);const y=async b=>{o(!0),s(k=>[...k,{sender_type:"user",message:b}]);try{const k=await Yn(b,n.pineconeNamespace,n.onGoingChatUrl,x);s(J=>[...J,{sender_type:"bot",message:k.n8n.message,created_at:k.n8n.created_at,suggested_prompts:k.n8n.suggested_prompts}])}catch(k){console.error("Chat error:",k),s(J=>[...J,{sender_type:"bot",message:"Sorry, there was an error processing your request. Please try again.",created_at:new Date().toISOString(),suggested_prompts:[]}])}finally{o(!1)}},m={position:"fixed",bottom:"112px",[d?"left":"right"]:"32px",zIndex:50,width:l?"684px":"384px",height:l?"620px":"520px",background:`${t.backgroundColor}cc`,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderRadius:"16px",border:"1px solid rgba(255, 255, 255, 0.3)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif",boxShadow:"0 10px 25px -3px rgba(0,0,0,0.1)"},w={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)"},O={position:"relative"},S={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},A={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},j={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},E={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},R={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},Y={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},$={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},re={fontWeight:"600"},z=(b,k)=>{b.currentTarget.style.background=k?"rgba(255,255,255,0.2)":"transparent"},W={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:t.fontColor,opacity:.9,fontSize:"14px"};return h.jsxs("div",{style:m,children:[h.jsxs("div",{style:w,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[h.jsxs("div",{style:O,children:[h.jsx("div",{style:S,children:h.jsx(B.MessageCircle,{size:22})}),h.jsx("span",{style:A})]}),h.jsxs("div",{children:[h.jsx("h3",{style:j,children:n.name}),h.jsx("p",{style:E,children:n.subTitle})]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[h.jsx("button",{onClick:()=>p(b=>!b),"aria-label":"expand chat",style:R,onMouseEnter:b=>z(b,!0),onMouseLeave:b=>z(b,!1),children:l?h.jsx(B.Minimize2,{size:20}):h.jsx(B.Maximize2,{size:20})}),h.jsx("button",{onClick:e,"aria-label":"close chat",style:R,onMouseEnter:b=>z(b,!0),onMouseLeave:b=>z(b,!1),children:h.jsx(B.X,{size:20})})]})]}),x?h.jsx(h.Fragment,{children:i&&r.length===0?h.jsx("div",{style:W,children:h.jsx("span",{children:"connecting server...."})}):h.jsxs(h.Fragment,{children:[h.jsx(bt,{messages:r,isLoading:i,theme:t}),h.jsx(xt,{onSendMessage:y,isLoading:i,theme:t})]})}):h.jsx(Zn,{theme:t,chatBotData:n,trackFormSubmission:C}),h.jsx("div",{style:Y,children:h.jsxs("p",{style:$,children:["powered by ",h.jsx("span",{style:re,children:"clone67.com"})]})})]})},tr=({pineconeNamespace:e,onGoingChatUrl:t,initiateChatUrl:n,fetchChatHistoryUrl:r,primaryColor:s="#3b82f6",secondaryColor:i="#8b5cf6",backgroundColor:o="#ffffff",fontColor:l="#1f2937",placeholderColor:p="#9ca3af",position:u="right",name:c="Assistant",subTitle:d="Typically replies instantly",welcomeText:x="Hi! How can I help you today?"})=>{const[C,f]=P.useState(!1),y=()=>{f(R=>!R),localStorage.removeItem("clone67ChatSessionId")},m=()=>f(R=>!R),w={primaryColor:s,secondaryColor:i,backgroundColor:o,fontColor:l,placeholderColor:p,inputBackgroundColor:o},O={name:c,subTitle:d,welcomeText:x,onGoingChatUrl:t,fetchChatHistoryUrl:r,initiateChatUrl:n,pineconeNamespace:e,position:u},S=u==="left",A="32px",j={position:"fixed",bottom:"104px",[S?"left":"right"]:A,zIndex:9999,pointerEvents:"auto"},E={position:"fixed",bottom:"32px",[S?"left":"right"]:A,zIndex:1e4,pointerEvents:"auto"};return h.jsxs(h.Fragment,{children:[C&&h.jsx("div",{style:j,children:h.jsx(er,{onClose:y,theme:w,chatBotData:O})}),h.jsx("div",{style:E,children:h.jsx(gt,{onMinimise:m,isOpen:C,theme:w,chatBotData:O})})]})};module.exports=tr;