react-aichatbot-widget 1.5.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1 @@
1
- "use strict";const p=require("react/jsx-runtime"),P=require("react"),D=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"),h={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 p.jsxs("button",{onClick:e,style:h,children:[t?p.jsx(D.Minus,{size:20,strokeWidth:2.5}):p.jsx(D.MessageCircle,{size:20,strokeWidth:2.5}),!t&&l&&p.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},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(D.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%"}),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(D.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(D.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:St}=Object.prototype,{getPrototypeOf:Re}=Object,{iterator:de,toStringTag:Ve}=Symbol,fe=(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=>fe(t)===e),pe=e=>t=>typeof t===e,{isArray:X}=Array,K=pe("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=pe("string"),N=pe("function"),Xe=pe("number"),ee=e=>e!==null&&typeof e=="object",Ct=e=>e===!0||e===!1,ae=e=>{if(fe(e)!=="object")return!1;const t=Re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ve in e)&&!(de 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=fe(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 H=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ye=e=>!K(e)&&e!==H;function Se(){const{caseless:e,skipUndefined:t}=Ye(this)&&this||{},n={},r=(s,i)=>{const o=e&&Ge(n,i)||i;ae(n[o])&&ae(s)?n[o]=Se(n[o],s):ae(s)?n[o]=Se({},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&&Re(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"&&Re(Uint8Array)),$t=(e,t)=>{const r=(e&&e[de]).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[de])}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=U("AsyncFunction"),nn=e=>e&&(ee(e)||N(e))&&N(e.then)&&N(e.catch),Ze=((e,t)=>e?setImmediate:t?((n,r)=>(H.addEventListener("message",({source:s,data:i})=>{s===H&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),H.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",N(H.postMessage)),rn=typeof queueMicrotask<"u"?queueMicrotask.bind(H):typeof process<"u"&&process.nextTick||Ze,sn=e=>e!=null&&N(e[de]),a={isArray:X,isArrayBuffer:Ke,isBuffer:Z,isFormData:Ft,isArrayBufferView:wt,isString:Et,isNumber:Xe,isBoolean:Ct,isObject:ee,isPlainObject:ae,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:Se,extend:Bt,trim:Lt,stripBOM:Dt,inherits:vt,toFlatObject:zt,kindOf:fe,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:H,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 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(we)}const ln=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function he(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(b,j){!(a.isUndefined(b)||b===null)&&t.append(o===!0?Pe([y],j,i):o===null?y:y+"[]",u(b))}),!1}return we(f)?!0:(t.append(Pe(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,A){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(A)?A.trim():A,y,x))===!0&&C(S,y?y.concat(A):[A])}),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 Te(e,t){this._pairs=[],e&&he(e,this,t)}const rt=Te.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 Te(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:Te,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"]},Oe=typeof window<"u"&&typeof document<"u",Ee=typeof navigator=="object"&&navigator||void 0,hn=Oe&&(!Ee||["ReactNative","NativeScript","NS"].indexOf(Ee.product)<0),mn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yn=Oe&&window.location.href||"http://localhost",gn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Oe,hasStandardBrowserEnv:hn,hasStandardBrowserWebWorkerEnv:mn,navigator:Ee,origin:yn},Symbol.toStringTag,{value:"Module"})),F={...gn,...pn};function xn(e,t){return he(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),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]=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 h=this.env&&this.env.FormData;return he(l?{"files[]":t}:t,h&&new h,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 le(e){return e===!1||e==null?e:a.isArray(e)?e.map(le):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 ge(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]=le(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||ge(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||ge(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||ge(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]=le(s),delete n[i];return}const l=t?On(i):String(i).trim();l!==i&&delete n[i],n[l]=le(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 xe(e,t){const n=this||ne,r=t||n,s=_.from(r.headers);let i=r.data;return a.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function at(e){return!!(e&&e.__CANCEL__)}function 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 ue=(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)},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 $(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(Be(u),Be(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(F.hasStandardBrowserEnv||F.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(F.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Pn(t.url))){const h=s&&i&&Nn.read(i);h&&o.set(s,h)}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: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 b=_.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),k={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:b,config:e,request:m};lt(function(T){n(T),y()},function(T){r(T),y()},k),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(j){const k=j&&j.message?j.message:"Network Error",E=new g(k,g.ERR_NETWORK,e,m);E.event=j||null,r(E),m=null},m.ontimeout=function(){let j=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const k=s.transitional||ot;s.timeoutErrorMessage&&(j=s.timeoutErrorMessage),r(new g(j,k.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(j,k){m.setRequestHeader(k,j)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),u&&([x,f]=ue(u,!0),m.addEventListener("progress",x)),h&&m.upload&&([d,C]=ue(h),m.upload.addEventListener("progress",d),m.upload.addEventListener("loadend",C)),(s.cancelToken||s.signal)&&(c=b=>{m&&(r(!b||b.type?new G(null,e,m):b),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const A=jn(s.url);if(A&&F.protocols.indexOf(A)===-1){r(new g("Unsupported protocol "+A+":",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: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:ie}=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?ie(t):typeof fetch=="function",i=ie(n),o=ie(r);if(!s)return!1;const l=s&&ie(ze),h=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 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(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 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:A,cancelToken:b,timeout:j,onDownloadProgress:k,onUploadProgress:E,responseType:T,headers:Y,withCredentials:q="same-origin",fetchOptions:re}=ut(f),se=t||fetch;T=T?(T+"").toLowerCase():"text";let W=Bn([A,b&&b.toAbortSignal()],j),I=null;const L=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let w;try{if(E&&u&&m!=="get"&&m!=="head"&&(w=await C(Y,S))!==0){let z=new n(y,{method:"POST",body:S,duplex:"half"}),V;if(a.isFormData(S)&&(V=z.headers.get("content-type"))&&Y.setContentType(V),z.body){const[ye,oe]=Ie(w,ue(Le(E)));S=De(z.body,ve,ye,oe)}}a.isString(q)||(q=q?"include":"omit");const O=i&&"credentials"in n.prototype,J={...re,signal:W,method:m.toUpperCase(),headers:Y.normalize().toJSON(),body:S,duplex:"half",credentials:O?q:void 0};I=i&&new n(y,J);let v=await(i?se(I,re):se(y,J));const je=c&&(T==="stream"||T==="response");if(c&&(k||je&&L)){const z={};["status","statusText","headers"].forEach(ke=>{z[ke]=v[ke]});const V=a.toFiniteNumber(v.headers.get("content-length")),[ye,oe]=k&&Ie(V,ue(Le(k),!0))||[];v=new r(De(v.body,ve,ye,()=>{oe&&oe(),L&&L()}),z)}T=T||"text";let yt=await d[a.findKey(d,T)||"text"](v,f);return!je&&L&&L(),await new Promise((z,V)=>{lt(z,V,{data:yt,headers:_.from(v.headers),status:v.status,statusText:v.statusText,config:f,request:I})})}catch(O){throw L&&L(),O&&O.name==="TypeError"&&/Load failed|fetch/i.test(O.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,I),{cause:O.cause||O}):g.from(O,O&&O.code,f,I)}}},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:Hn(t)),c=u;return u};dt();const Ae={http:on,xhr:Ln,fetch:{get:dt}};a.forEach(Ae,(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=Ae[(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 :
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:Ae};function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new G(null,e)}function $e(e){return be(e),e.headers=_.from(e.headers),e.data=xe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ft.getAdapter(e.adapter||ne.adapter,e)(e).then(function(r){return be(e),r.data=xe.call(e,e.transformResponse,r),r.headers=_.from(r.headers),r},function(r){return at(r)||(be(e),r&&r.response&&(r.response.data=xe.call(e,e.transformResponse,r.response),r.response.headers=_.from(r.response.headers))),Promise.reject(r)})}const pt="1.13.2",me={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{me[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const We={};me.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}};me.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 ce={assertOptions:Jn,validators:me},B=ce.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&&ce.assertOptions(r,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ce.assertOptions(s,{encode:B.function,serialize:B.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ce.assertOptions(n,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.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 Ce={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(Ce).forEach(([e,t])=>{Ce[t]=e});function mt(e){const t=new M(e),n=Je(M.prototype.request,t);return a.extend(n,M.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return mt($(e,s))},n}const R=mt(ne);R.Axios=M;R.CanceledError=G;R.CancelToken=Vn;R.isCancel=at;R.VERSION=pt;R.toFormData=he;R.AxiosError=g;R.Cancel=R.CanceledError;R.all=function(t){return Promise.all(t)};R.spread=Kn;R.isAxiosError=Xn;R.mergeConfig=$;R.AxiosHeaders=_;R.formToJSON=e=>it(a.isHTMLForm(e)?new FormData(e):e);R.getAdapter=ft.getAdapter;R.HttpStatusCode=Ce;R.default=R;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}=R,Gn=async(e,t,n,r,s)=>{const i={chatInput:e,metadata:{pinecone_namespace:t,name:r,email:s}};try{return(await R.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 R.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 R.post(t,n,{headers:{"Content-Type":"application/json"}});return console.log("Fetch chat history response:",r),r.data.n8n}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,h]=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 T=await Gn(l,t.pineconeNamespace,t.initiateChatUrl,r,i);localStorage.setItem("clone67ChatSessionId",T.n8n.session_id),n(!0)}catch(T){console.log("error sending user details",T),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"},A={fontSize:"14px",color:e.fontColor,fontWeight:"500"},b={width:"100%",padding:"12px 16px",background:e.backgroundColor,color:e.fontColor,border:"1px solid #a1a1aa",borderRadius:"12px",fontSize:"15px",outline:"none",boxSizing:"border-box"},j={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"},k={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:k,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:A,children:"Full Name"}),p.jsx("input",{type:"text",placeholder:"Enter your full name",value:r,onChange:E=>{s(E.target.value),c("")},style:b,required:!0})]}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[p.jsx("label",{style:A,children:"Email Address"}),p.jsx("input",{type:"email",placeholder:"Enter your email",value:i,onChange:E=>{o(E.target.value),c("")},style:b,required:!0})]}),p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[p.jsx("label",{style:A,children:"Message"}),p.jsx("textarea",{placeholder:"Enter your message",value:l,onChange:E=>{h(E.target.value),c("")},style:{...b,minHeight:"60px",maxHeight:"80px",resize:"vertical"},required:!0})]})]}),p.jsx("button",{type:"submit",disabled:!r.trim()||!i.trim()||d,style:j,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(D.Send,{size:18}),"Submit"]})})]})})},er=({onClose:e,theme:t,chatBotData:n})=>{const[r,s]=P.useState([]),[i,o]=P.useState(!1),[l,h]=P.useState(!1),[u,c]=P.useState(!1),[d,x]=P.useState(null),C=n.position==="left",f=localStorage.getItem("clone67ChatSessionId"),y=w=>{c(w)},m=async()=>{if(f){o(!0);try{const w=await Qn(f,n.fetchChatHistoryUrl),O=w.chats;if(w.status==="error"){x(w.message);return}w.status==="success"&&(s(O),x(null))}catch(w){console.log("Error fetching chat history",w)}finally{o(!1)}}};P.useEffect(()=>{m()},[u,f]);const S=async w=>{o(!0),s(O=>[...O,{sender_type:"user",message:w}]);try{const O=await Yn(w,n.pineconeNamespace,n.onGoingChatUrl,f);s(J=>[...J,{sender_type:"bot",message:O.n8n.message,created_at:O.n8n.created_at,suggested_prompts:O.n8n.suggested_prompts}])}catch(O){console.error("Chat error:",O),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)}},A={position:"fixed",bottom:"112px",[C?"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)"},b={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)"},j={position:"relative"},k={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},E={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},T={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},Y={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},q={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},re={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},se={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},W={fontWeight:"600"},I=(w,O)=>{w.currentTarget.style.background=O?"rgba(255,255,255,0.2)":"transparent"},L={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",color:t.fontColor,opacity:.9,fontSize:"14px"};return p.jsxs("div",{style:A,children:[p.jsxs("div",{style:b,children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[p.jsxs("div",{style:j,children:[p.jsx("div",{style:k,children:p.jsx(D.MessageCircle,{size:22})}),p.jsx("span",{style:E})]}),p.jsxs("div",{children:[p.jsx("h3",{style:T,children:n.name}),p.jsx("p",{style:Y,children:n.subTitle})]})]}),p.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[p.jsx("button",{onClick:()=>h(w=>!w),"aria-label":"expand chat",style:q,onMouseEnter:w=>I(w,!0),onMouseLeave:w=>I(w,!1),children:l?p.jsx(D.Minimize2,{size:20}):p.jsx(D.Maximize2,{size:20})}),p.jsx("button",{onClick:e,"aria-label":"close chat",style:q,onMouseEnter:w=>I(w,!0),onMouseLeave:w=>I(w,!1),children:p.jsx(D.X,{size:20})})]})]}),f?p.jsx(p.Fragment,{children:i&&r.length===0?p.jsx("div",{style:L,children:p.jsx("span",{children:"connecting server...."})}):p.jsx(p.Fragment,{children:d?p.jsx("div",{style:L,children:p.jsx("span",{children:d})}):p.jsxs(p.Fragment,{children:[p.jsx(bt,{messages:r,isLoading:i,theme:t}),p.jsx(xt,{onSendMessage:S,isLoading:i,theme:t})]})})}):p.jsx(Zn,{theme:t,chatBotData:n,trackFormSubmission:y}),p.jsx("div",{style:re,children:p.jsxs("p",{style:se,children:["powered by ",p.jsx("span",{style:W,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]=P.useState(!1),y=()=>{f(T=>!T),localStorage.removeItem("clone67ChatSessionId")},m=()=>f(T=>!T),S={primaryColor:s,secondaryColor:i,backgroundColor:o,fontColor:l,placeholderColor:h,inputBackgroundColor:o},A={name:c,subTitle:d,welcomeText:x,onGoingChatUrl:t,fetchChatHistoryUrl:r,initiateChatUrl:n,pineconeNamespace:e,position:u},b=u==="left",j="32px",k={position:"fixed",bottom:"104px",[b?"left":"right"]:j,zIndex:9999,pointerEvents:"auto"},E={position:"fixed",bottom:"32px",[b?"left":"right"]:j,zIndex:1e4,pointerEvents:"auto"};return p.jsxs(p.Fragment,{children:[C&&p.jsx("div",{style:k,children:p.jsx(er,{onClose:y,theme:S,chatBotData:A})}),p.jsx("div",{style:E,children:p.jsx(gt,{onMinimise:m,isOpen:C,theme:S,chatBotData:A})})]})};module.exports=tr;
1
+ "use strict";const e=require("react/jsx-runtime"),x=require("react"),v=require("lucide-react"),E=({onMinimise:o,isOpen:t,theme:r,chatBotData:i})=>{const f=i.position==="left",d=f?"32px":"auto",p=f?"auto":"32px",u=localStorage.getItem("clone67ChatSessionId"),g={position:"fixed",bottom:"32px",left:d,right:p,background:`linear-gradient(135deg, ${r.primaryColor}, ${r.secondaryColor})`,color:r.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 e.jsxs("button",{onClick:o,style:g,children:[t?e.jsx(v.Minus,{size:20,strokeWidth:2.5}):e.jsx(v.MessageCircle,{size:20,strokeWidth:2.5}),!t&&u&&e.jsx("span",{style:h})]})},a=[];for(let o=0;o<256;++o)a.push((o+256).toString(16).slice(1));function T(o,t=0){return(a[o[t+0]]+a[o[t+1]]+a[o[t+2]]+a[o[t+3]]+"-"+a[o[t+4]]+a[o[t+5]]+"-"+a[o[t+6]]+a[o[t+7]]+"-"+a[o[t+8]]+a[o[t+9]]+"-"+a[o[t+10]]+a[o[t+11]]+a[o[t+12]]+a[o[t+13]]+a[o[t+14]]+a[o[t+15]]).toLowerCase()}let W;const M=new Uint8Array(16);function D(){if(!W){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");W=crypto.getRandomValues.bind(crypto)}return W(M)}const L=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),R={randomUUID:L};function $(o,t,r){o=o||{};const i=o.random??o.rng?.()??D();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,T(i)}function U(o,t,r){return R.randomUUID&&!o?R.randomUUID():$(o)}const B=({messages:o,chatBotData:t,theme:r,isLoading:i})=>{const[f,d]=x.useState([]),p=x.useRef(null),u=s=>{if(s==="")return null;try{return JSON.parse(s)}catch(y){return console.error("Error parsing message string to JSON:",y),null}},g=s=>new Date(s).toLocaleString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!0});x.useEffect(()=>{const s=u(o);s&&d(y=>[...y,s])},[o]),x.useEffect(()=>{p.current?.scrollIntoView({behavior:"smooth"})},[f]);const h=f.flat(),S={height:"290px",overflowY:"auto",padding:"20px",background:r.backgroundColor,color:r.fontColor,borderTop:"1px solid rgba(255, 255, 255, 0.2)",display:"flex",flexDirection:"column",gap:"16px"},c=s=>({display:"flex",justifyContent:s==="user"?"flex-end":"flex-start",width:"100%"}),m={display:"flex",flexDirection:"column",maxWidth:"80%"},b=s=>({padding:"12px 16px",borderRadius:s==="user"?"16px 0 16px 16px":"0 16px 16px 16px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",fontSize:"14px",lineHeight:"1.5",background:s==="user"?r.primaryColor:"#f5f5f5",color:r.fontColor,wordWrap:"break-word"}),C={...b("bot"),animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s"};return e.jsxs("div",{style:S,children:[h.map((s,y)=>e.jsx("div",{style:c(s.sender_type),children:e.jsxs("div",{style:m,children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:s.sender_type==="user"?"flex-end":"flex-start",marginRight:"4px",marginBottom:"2px"},children:e.jsx("span",{style:{fontSize:"10px",opacity:.55,color:r.fontColor},children:s.sender_type==="user"?"You":`${t.name}`})}),e.jsx("div",{style:s.sender_type==="user"?b("user"):b("ai"),children:s.message}),e.jsx("span",{style:{fontSize:"10px",opacity:.55,color:r.fontColor,alignSelf:s.sender_type==="user"?"flex-end":"flex-start",marginTop:"4px"},children:`${g(s.created_at)}`})]})},y)),i&&e.jsx("div",{style:C,children:"Typing..."}),e.jsx("div",{ref:p})]})},O=(o,t)=>({socket:new WebSocket(`wss://handle-chat-session.clone67.com?chatbotNamespace=${t}&sessionId=${o}`)}),F=({chatBotData:o,theme:t,onlineStatus:r})=>{const[i,f]=x.useState(null),[d,p]=x.useState(""),[u,g]=x.useState("Connecting to server..."),[h,S]=x.useState(""),[c,m]=x.useState(!1);x.useEffect(()=>{var n=localStorage.getItem("clone67ChatSessionId");n===null&&(n=U(),localStorage.setItem("clone67ChatSessionId",n));const{socket:l}=O(n,o.pineconeNamespace);f(l),l.onopen=()=>{g("Server connected"),setTimeout(()=>{g("")},2e3),r("online")},l.onmessage=async I=>{m(!0);try{const z=await I.data;S(z)}catch(z){console.error("Error handling server message:",z)}finally{m(!1)}},l.onerror=I=>{g("Server error occurred"),console.error("WebSocket error:",I),r("offline")},l.onclose=()=>{g("Server disconnected"),r("offline")}},[]);const b=async()=>{i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify(d));const n={created_at:Date.now(),sender_type:"user",message:d};S(JSON.stringify(n)),p("")},C=n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),b())},s={flex:1,padding:"12px 16px",background:t.backgroundColor,color:t.fontColor,border:`1px solid ${t.fontColor}`,borderRadius:"12px",fontSize:"14px",outline:"none",transition:"all 0.2s ease",opacity:c?.5:1,cursor:c?"not-allowed":"text",boxShadow:"none"},y={padding:"12px 20px",borderRadius:"12px",background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,border:"none",cursor:c||!d.trim()?"not-allowed":"pointer",opacity:c||!d.trim()?.5:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontWeight:"600",fontSize:"14px",transition:"all 0.2s ease",minWidth:"48px"},k={padding:"16px",borderTop:"1px solid rgba(255, 255, 255, 0.2)",borderColor:t.fontColor,background:t.backgroundColor,flexShrink:0},w={display:"flex",gap:"12px",alignItems:"center"},j={textAlign:"center",padding:"2px",backgroundColor:u==="Server connected"||u==="online"?"#09BA00":u==="Connecting to server..."?"#DED000":"#FF3408",color:"#ffffff",fontSize:"10px"};return e.jsxs("div",{children:[u&&e.jsx("p",{style:j,children:u}),e.jsx(B,{messages:h,chatBotData:o,theme:t,isLoading:c}),e.jsx("div",{style:k,children:e.jsxs("form",{onSubmit:b,style:w,children:[e.jsx("input",{type:"text",placeholder:"Type a message...",value:d,onChange:n=>p(n.target.value),onKeyDown:C,disabled:c,style:s,onFocus:n=>{n.target.style.boxShadow="0 0 0 3px rgba(100, 150, 255, 0.3)",n.target.style.borderColor="#60a5fa"},onBlur:n=>{n.target.style.boxShadow="none",n.target.style.borderColor=t.fontColor}}),e.jsx("button",{onClick:b,disabled:c||!d.trim(),style:y,"aria-label":"Send message",onMouseEnter:n=>{!c&&d.trim()&&(n.currentTarget.style.transform="translateY(-2px)",n.currentTarget.style.boxShadow="0 8px 16px rgba(0,0,0,0.15)")},onMouseLeave:n=>{n.currentTarget.style.transform="translateY(0)",n.currentTarget.style.boxShadow="none"},children:e.jsx(v.Send,{size:18})})]})})]})},N=({onClose:o,theme:t,chatBotData:r})=>{const[i,f]=x.useState(!1),[d,p]=x.useState(!1),g={position:"fixed",bottom:"112px",[r.position==="left"?"left":"right"]:"32px",zIndex:50,width:i?"684px":"384px",height:i?"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)"},h={padding:"16px 20px",background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,borderRadius:"16px 16px 0 0",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)"},S={position:"relative"},c={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},m={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:d?"#00BF49":"#F54927",borderRadius:"50%",border:"3px solid white"},b={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},C={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},s={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},y={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},k={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},w={fontWeight:"600"},j=(l,I)=>{l.currentTarget.style.background=I?"rgba(255,255,255,0.2)":"transparent"},n=l=>{p(l==="online")};return e.jsxs("div",{style:g,children:[e.jsxs("div",{style:h,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[e.jsxs("div",{style:S,children:[e.jsx("div",{style:c,children:e.jsx(v.MessageCircle,{size:22})}),e.jsx("span",{style:m})]}),e.jsxs("div",{children:[e.jsx("h3",{style:b,children:r.name}),e.jsx("p",{style:C,children:r.subTitle})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[e.jsx("button",{onClick:()=>f(l=>!l),"aria-label":"expand chat",style:s,onMouseEnter:l=>j(l,!0),onMouseLeave:l=>j(l,!1),children:i?e.jsx(v.Minimize2,{size:20}):e.jsx(v.Maximize2,{size:20})}),e.jsx("button",{onClick:o,"aria-label":"close chat",style:s,onMouseEnter:l=>j(l,!0),onMouseLeave:l=>j(l,!1),children:e.jsx(v.X,{size:20})})]})]}),e.jsx(F,{chatBotData:r,theme:t,onlineStatus:n}),e.jsx("div",{style:y,children:e.jsxs("p",{style:k,children:["powered by ",e.jsx("span",{style:w,children:"clone67.com"})]})})]})},_=({pineconeNamespace:o,primaryColor:t="#3b82f6",secondaryColor:r="#8b5cf6",backgroundColor:i="#ffffff",fontColor:f="#1f2937",placeholderColor:d="#9ca3af",position:p="right",name:u="Assistant",subTitle:g="Typically replies instantly",welcomeText:h="Hi! How can I help you today?"})=>{const[S,c]=x.useState(!1),m=()=>{c(n=>!n),localStorage.removeItem("clone67ChatSessionId")},b=()=>c(n=>!n),C={primaryColor:t,secondaryColor:r,backgroundColor:i,fontColor:f,placeholderColor:d,inputBackgroundColor:i},s={name:u,subTitle:g,welcomeText:h,pineconeNamespace:o,position:p},y=p==="left",k="32px",w={position:"fixed",bottom:"104px",[y?"left":"right"]:k,zIndex:9999,pointerEvents:"auto"},j={position:"fixed",bottom:"32px",[y?"left":"right"]:k,zIndex:1e4,pointerEvents:"auto"};return e.jsxs(e.Fragment,{children:[S&&e.jsx("div",{style:w,children:e.jsx(N,{onClose:m,theme:C,chatBotData:s})}),e.jsx("div",{style:j,children:e.jsx(E,{onMinimise:b,isOpen:S,theme:C,chatBotData:s})})]})};module.exports=_;