react-aichatbot-widget 2.0.9 → 2.0.10
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 +3 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";const y=require("react/jsx-runtime"),N=require("react"),$=require("lucide-react"),St=({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"),f={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"},d={position:"absolute",top:"-4px",right:"-4px",width:"16px",height:"16px",backgroundColor:"#34d399",borderRadius:"50%",border:"4px solid white",animation:"pulse 2s infinite"};return y.jsxs("button",{onClick:e,style:f,children:[t?y.jsx($.Minus,{size:20,strokeWidth:2.5}):y.jsx($.MessageCircle,{size:20,strokeWidth:2.5}),!t&&l&&y.jsx("span",{style:d})]})},A=[];for(let e=0;e<256;++e)A.push((e+256).toString(16).slice(1));function wt(e,t=0){return(A[e[t+0]]+A[e[t+1]]+A[e[t+2]]+A[e[t+3]]+"-"+A[e[t+4]]+A[e[t+5]]+"-"+A[e[t+6]]+A[e[t+7]]+"-"+A[e[t+8]]+A[e[t+9]]+"-"+A[e[t+10]]+A[e[t+11]]+A[e[t+12]]+A[e[t+13]]+A[e[t+14]]+A[e[t+15]]).toLowerCase()}let me;const Et=new Uint8Array(16);function Rt(){if(!me){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");me=crypto.getRandomValues.bind(crypto)}return me(Et)}const Ct=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Pe={randomUUID:Ct};function Ot(e,t,n){e=e||{};const r=e.random??e.rng?.()??Rt();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,wt(r)}function Tt(e,t,n){return Pe.randomUUID&&!e?Pe.randomUUID():Ot(e)}const At=({messages:e,chatBotData:t,theme:n,isExpand:r})=>{const[s,i]=N.useState([]),o=N.useRef(null),l=c=>{if(c==="")return null;try{return JSON.parse(c)}catch(m){return console.error("Error parsing message string to JSON:",m),null}},f=c=>new Date(c).toLocaleString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!0});N.useEffect(()=>{e===""&&i([{created_at:Date.now(),sender_type:"bot",message:t.aiInitialMessage,suggested_prompt:[]}]);const c=l(e);c&&i(m=>[...m,c])},[e]),N.useEffect(()=>{o.current?.scrollIntoView({behavior:"smooth"})},[s]);const d=s.flat(),u={height:r?"500px":"400px",overflowY:"auto",padding:"10px",background:n.backgroundColor,color:n.fontColor,borderTop:"1px solid rgba(255, 255, 255, 0.2)",display:"flex",flexDirection:"column"},h=c=>({display:"flex",justifyContent:c==="user"?"flex-end":"flex-start",width:"100%"}),x={display:"flex",flexDirection:"column",maxWidth:"80%"},S=c=>({padding:"10px",borderRadius:c==="user"?"12px 0 12px 12px":"0 12px 12px 12px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",fontSize:"14px",lineHeight:"1.5",background:c==="user"?n.primaryColor:"#f5f5f5",color:n.fontColor,wordWrap:"break-word"});return y.jsxs("div",{style:u,children:[d.map((c,m)=>y.jsx("div",{style:h(c.sender_type),children:y.jsxs("div",{style:x,children:[y.jsx("div",{style:c.sender_type==="user"?S("user"):S("ai"),children:c.message}),y.jsx("div",{style:{display:"flex",alignItems:"center",marginLeft:"4px",justifyContent:c.sender_type==="user"?"flex-end":"flex-start"},children:y.jsxs("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:[c.sender_type==="user"?"You":`${t.name}`," • ",f(c.created_at)]})})]})},m)),y.jsx("div",{ref:o})]})},jt=({theme:e})=>{const t={height:"100%",background:e.backgroundColor,color:e.fontColor,display:"flex",alignItems:"center",justifyContent:"center"},n={padding:"24px 32px",background:e.backgroundColor,display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"},r={fontSize:"14px",opacity:.85};return y.jsx("div",{style:t,children:y.jsxs("div",{style:n,children:[y.jsx($.Loader,{size:26}),y.jsx("p",{style:r,children:"Exiting chat… please wait"})]})})},kt=(e,t)=>({socket:new WebSocket(`wss://handle-chat-session.clone67.com?chatbotNamespace=${t}&sessionId=${e}`)});function Xe(e,t){return function(){return e.apply(t,arguments)}}const{toString:Nt}=Object.prototype,{getPrototypeOf:Re}=Object,{iterator:ce,toStringTag:Ge}=Symbol,ue=(e=>t=>{const n=Nt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),I=e=>(e=e.toLowerCase(),t=>ue(t)===e),de=e=>t=>typeof t===e,{isArray:K}=Array,V=de("undefined");function Y(e){return e!==null&&!V(e)&&e.constructor!==null&&!V(e.constructor)&&F(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Qe=I("ArrayBuffer");function Ft(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Qe(e.buffer),t}const Pt=de("string"),F=de("function"),Ye=de("number"),Z=e=>e!==null&&typeof e=="object",_t=e=>e===!0||e===!1,oe=e=>{if(ue(e)!=="object")return!1;const t=Re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ge in e)&&!(ce in e)},Ut=e=>{if(!Z(e)||Y(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},It=I("Date"),Lt=I("File"),Dt=I("Blob"),Bt=I("FileList"),vt=e=>Z(e)&&F(e.pipe),$t=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||F(e.append)&&((t=ue(e))==="formdata"||t==="object"&&F(e.toString)&&e.toString()==="[object FormData]"))},Ht=I("URLSearchParams"),[qt,Mt,zt,Wt]=["ReadableStream","Request","Response","Headers"].map(I),Jt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ee(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),K(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Y(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 Ze(e,t){if(Y(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const q=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,et=e=>!V(e)&&e!==q;function xe(){const{caseless:e,skipUndefined:t}=et(this)&&this||{},n={},r=(s,i)=>{const o=e&&Ze(n,i)||i;oe(n[o])&&oe(s)?n[o]=xe(n[o],s):oe(s)?n[o]=xe({},s):K(s)?n[o]=s.slice():(!t||!V(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&ee(arguments[s],r);return n}const Vt=(e,t,n,{allOwnKeys:r}={})=>(ee(t,(s,i)=>{n&&F(s)?e[i]=Xe(s,n):e[i]=s},{allOwnKeys:r}),e),Kt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Xt=(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)},Gt=(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},Yt=e=>{if(!e)return null;if(K(e))return e;let t=e.length;if(!Ye(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Zt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Re(Uint8Array)),en=(e,t)=>{const r=(e&&e[ce]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},tn=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},nn=I("HTMLFormElement"),rn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),_e=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),sn=I("RegExp"),tt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ee(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},on=e=>{tt(e,(t,n)=>{if(F(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(F(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+"'")})}})},an=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return K(e)?r(e):r(String(e).split(t)),n},ln=()=>{},cn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function un(e){return!!(e&&F(e.append)&&e[Ge]==="FormData"&&e[ce])}const dn=e=>{const t=new Array(10),n=(r,s)=>{if(Z(r)){if(t.indexOf(r)>=0)return;if(Y(r))return r;if(!("toJSON"in r)){t[s]=r;const i=K(r)?[]:{};return ee(r,(o,l)=>{const f=n(o,s+1);!V(f)&&(i[l]=f)}),t[s]=void 0,i}}return r};return n(e,0)},fn=I("AsyncFunction"),pn=e=>e&&(Z(e)||F(e))&&F(e.then)&&F(e.catch),nt=((e,t)=>e?setImmediate:t?((n,r)=>(q.addEventListener("message",({source:s,data:i})=>{s===q&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),q.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",F(q.postMessage)),hn=typeof queueMicrotask<"u"?queueMicrotask.bind(q):typeof process<"u"&&process.nextTick||nt,mn=e=>e!=null&&F(e[ce]),a={isArray:K,isArrayBuffer:Qe,isBuffer:Y,isFormData:$t,isArrayBufferView:Ft,isString:Pt,isNumber:Ye,isBoolean:_t,isObject:Z,isPlainObject:oe,isEmptyObject:Ut,isReadableStream:qt,isRequest:Mt,isResponse:zt,isHeaders:Wt,isUndefined:V,isDate:It,isFile:Lt,isBlob:Dt,isRegExp:sn,isFunction:F,isStream:vt,isURLSearchParams:Ht,isTypedArray:Zt,isFileList:Bt,forEach:ee,merge:xe,extend:Vt,trim:Jt,stripBOM:Kt,inherits:Xt,toFlatObject:Gt,kindOf:ue,kindOfTest:I,endsWith:Qt,toArray:Yt,forEachEntry:en,matchAll:tn,isHTMLForm:nn,hasOwnProperty:_e,hasOwnProp:_e,reduceDescriptors:tt,freezeMethods:on,toObjectSet:an,toCamelCase:rn,noop:ln,toFiniteNumber:cn,findKey:Ze,global:q,isContextDefined:et,isSpecCompliantForm:un,toJSONObject:dn,isAsyncFn:fn,isThenable:pn,setImmediate:nt,asap:hn,isIterable:mn};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 rt=g.prototype,st={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{st[e]={value:e}});Object.defineProperties(g,st);Object.defineProperty(rt,"isAxiosError",{value:!0});g.from=(e,t,n,r,s,i)=>{const o=Object.create(rt);a.toFlatObject(e,o,function(u){return u!==Error.prototype},d=>d!=="isAxiosError");const l=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return g.call(o,l,f,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const yn=null;function Se(e){return a.isPlainObject(e)||a.isArray(e)}function ot(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ue(e,t,n){return e?e.concat(t).map(function(s,i){return s=ot(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function bn(e){return a.isArray(e)&&!e.some(Se)}const gn=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function fe(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,p){return!a.isUndefined(p[m])});const r=n.metaTokens,s=n.visitor||u,i=n.dots,o=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function d(c){if(c===null)return"";if(a.isDate(c))return c.toISOString();if(a.isBoolean(c))return c.toString();if(!f&&a.isBlob(c))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(c)||a.isTypedArray(c)?f&&typeof Blob=="function"?new Blob([c]):Buffer.from(c):c}function u(c,m,p){let w=c;if(c&&!p&&typeof c=="object"){if(a.endsWith(m,"{}"))m=r?m:m.slice(0,-2),c=JSON.stringify(c);else if(a.isArray(c)&&bn(c)||(a.isFileList(c)||a.endsWith(m,"[]"))&&(w=a.toArray(c)))return m=ot(m),w.forEach(function(E,C){!(a.isUndefined(E)||E===null)&&t.append(o===!0?Ue([m],C,i):o===null?m:m+"[]",d(E))}),!1}return Se(c)?!0:(t.append(Ue(p,m,i),d(c)),!1)}const h=[],x=Object.assign(gn,{defaultVisitor:u,convertValue:d,isVisitable:Se});function S(c,m){if(!a.isUndefined(c)){if(h.indexOf(c)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(c),a.forEach(c,function(w,T){(!(a.isUndefined(w)||w===null)&&s.call(t,w,a.isString(T)?T.trim():T,m,x))===!0&&S(w,m?m.concat(T):[T])}),h.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return S(e),t}function Ie(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ce(e,t){this._pairs=[],e&&fe(e,this,t)}const it=Ce.prototype;it.append=function(t,n){this._pairs.push([t,n])};it.toString=function(t){const n=t?function(r){return t.call(this,r,Ie)}:Ie;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function xn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function at(e,t,n){if(!t)return e;const r=n&&n.encode||xn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new Ce(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Le{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const lt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Sn=typeof URLSearchParams<"u"?URLSearchParams:Ce,wn=typeof FormData<"u"?FormData:null,En=typeof Blob<"u"?Blob:null,Rn={isBrowser:!0,classes:{URLSearchParams:Sn,FormData:wn,Blob:En},protocols:["http","https","file","blob","url","data"]},Oe=typeof window<"u"&&typeof document<"u",we=typeof navigator=="object"&&navigator||void 0,Cn=Oe&&(!we||["ReactNative","NativeScript","NS"].indexOf(we.product)<0),On=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Tn=Oe&&window.location.href||"http://localhost",An=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Oe,hasStandardBrowserEnv:Cn,hasStandardBrowserWebWorkerEnv:On,navigator:we,origin:Tn},Symbol.toStringTag,{value:"Module"})),j={...An,...Rn};function jn(e,t){return fe(e,new j.classes.URLSearchParams,{visitor:function(n,r,s,i){return j.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function kn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Nn(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function ct(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),f=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,f?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=Nn(s[o])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(kn(r),s,n,0)}),n}return null}function Fn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const te={transitional:lt,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(ct(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return jn(t,this.formSerializer).toString();if((l=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return fe(l?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Fn(t)):t}],transformResponse:[function(t){const n=this.transitional||te.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const 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:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{te.headers[e]={}});const Pn=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"]),_n=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
1
|
+
"use strict";const y=require("react/jsx-runtime"),N=require("react"),$=require("lucide-react"),St=({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"),f={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"},d={position:"absolute",top:"-4px",right:"-4px",width:"16px",height:"16px",backgroundColor:"#34d399",borderRadius:"50%",border:"4px solid white",animation:"pulse 2s infinite"};return y.jsxs("button",{onClick:e,style:f,children:[t?y.jsx($.Minus,{size:20,strokeWidth:2.5}):y.jsx($.MessageCircle,{size:20,strokeWidth:2.5}),!t&&l&&y.jsx("span",{style:d})]})},A=[];for(let e=0;e<256;++e)A.push((e+256).toString(16).slice(1));function wt(e,t=0){return(A[e[t+0]]+A[e[t+1]]+A[e[t+2]]+A[e[t+3]]+"-"+A[e[t+4]]+A[e[t+5]]+"-"+A[e[t+6]]+A[e[t+7]]+"-"+A[e[t+8]]+A[e[t+9]]+"-"+A[e[t+10]]+A[e[t+11]]+A[e[t+12]]+A[e[t+13]]+A[e[t+14]]+A[e[t+15]]).toLowerCase()}let me;const Et=new Uint8Array(16);function Rt(){if(!me){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");me=crypto.getRandomValues.bind(crypto)}return me(Et)}const Ct=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Pe={randomUUID:Ct};function Ot(e,t,n){e=e||{};const r=e.random??e.rng?.()??Rt();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,wt(r)}function Tt(e,t,n){return Pe.randomUUID&&!e?Pe.randomUUID():Ot(e)}const At=({messages:e,chatBotData:t,theme:n,isExpand:r})=>{const[s,i]=N.useState([]),o=N.useRef(null),l=c=>{if(c==="")return null;try{return JSON.parse(c)}catch(m){return console.error("Error parsing message string to JSON:",m),null}},f=c=>new Date(c).toLocaleString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!0});N.useEffect(()=>{e===""&&i([{created_at:Date.now(),sender_type:"bot",message:t.aiInitialMessage,suggested_prompt:[]}]);const c=l(e);c&&i(m=>[...m,c])},[e]),N.useEffect(()=>{o.current?.scrollIntoView({behavior:"smooth"})},[s]);const d=s.flat(),u={height:r?"500px":"400px",overflowY:"auto",padding:"10px",background:n.backgroundColor,color:n.fontColor,borderTop:"1px solid rgba(255, 255, 255, 0.2)",display:"flex",flexDirection:"column"},h=c=>({display:"flex",justifyContent:c==="user"?"flex-end":"flex-start",width:"100%"}),x={display:"flex",flexDirection:"column",maxWidth:"80%"},S=c=>({padding:"10px",borderRadius:c==="user"?"12px 0 12px 12px":"0 12px 12px 12px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",fontSize:"14px",lineHeight:"1.5",background:c==="user"?n.primaryColor:"#f5f5f5",color:n.fontColor,wordWrap:"break-word"});return y.jsxs("div",{style:u,children:[d.map((c,m)=>y.jsx("div",{style:h(c.sender_type),children:y.jsxs("div",{style:x,children:[y.jsx("div",{style:c.sender_type==="user"?S("user"):S("ai"),children:c.message}),y.jsx("div",{style:{display:"flex",alignItems:"center",marginLeft:"4px",justifyContent:c.sender_type==="user"?"flex-end":"flex-start"},children:y.jsxs("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:[c.sender_type==="user"?"You":`${t.name}`," • ",f(c.created_at)]})})]})},m)),y.jsx("div",{ref:o})]})},jt=({theme:e})=>{const t={height:"100%",background:e.backgroundColor,color:e.fontColor,display:"flex",alignItems:"center",justifyContent:"center"},n={padding:"24px 32px",background:e.backgroundColor,display:"flex",flexDirection:"column",alignItems:"center",gap:"10px"},r={fontSize:"14px",opacity:.85};return y.jsx("div",{style:t,children:y.jsxs("div",{style:n,children:[y.jsx($.Loader,{size:26}),y.jsx("p",{style:r,children:"Exiting chat… please wait"})]})})},kt=(e,t)=>({socket:new WebSocket(`wss://handle-chat-session.clone67.com?chatbotNamespace=${t}&sessionId=${e}`)});function Xe(e,t){return function(){return e.apply(t,arguments)}}const{toString:Nt}=Object.prototype,{getPrototypeOf:Re}=Object,{iterator:ce,toStringTag:Ge}=Symbol,ue=(e=>t=>{const n=Nt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),I=e=>(e=e.toLowerCase(),t=>ue(t)===e),de=e=>t=>typeof t===e,{isArray:K}=Array,V=de("undefined");function Y(e){return e!==null&&!V(e)&&e.constructor!==null&&!V(e.constructor)&&F(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Qe=I("ArrayBuffer");function Ft(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Qe(e.buffer),t}const Pt=de("string"),F=de("function"),Ye=de("number"),Z=e=>e!==null&&typeof e=="object",_t=e=>e===!0||e===!1,oe=e=>{if(ue(e)!=="object")return!1;const t=Re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ge in e)&&!(ce in e)},Ut=e=>{if(!Z(e)||Y(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},It=I("Date"),Lt=I("File"),Dt=I("Blob"),Bt=I("FileList"),vt=e=>Z(e)&&F(e.pipe),$t=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||F(e.append)&&((t=ue(e))==="formdata"||t==="object"&&F(e.toString)&&e.toString()==="[object FormData]"))},qt=I("URLSearchParams"),[Ht,Mt,zt,Wt]=["ReadableStream","Request","Response","Headers"].map(I),Jt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ee(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),K(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Y(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 Ze(e,t){if(Y(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,et=e=>!V(e)&&e!==H;function xe(){const{caseless:e,skipUndefined:t}=et(this)&&this||{},n={},r=(s,i)=>{const o=e&&Ze(n,i)||i;oe(n[o])&&oe(s)?n[o]=xe(n[o],s):oe(s)?n[o]=xe({},s):K(s)?n[o]=s.slice():(!t||!V(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&ee(arguments[s],r);return n}const Vt=(e,t,n,{allOwnKeys:r}={})=>(ee(t,(s,i)=>{n&&F(s)?e[i]=Xe(s,n):e[i]=s},{allOwnKeys:r}),e),Kt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Xt=(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)},Gt=(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},Yt=e=>{if(!e)return null;if(K(e))return e;let t=e.length;if(!Ye(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Zt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Re(Uint8Array)),en=(e,t)=>{const r=(e&&e[ce]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},tn=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},nn=I("HTMLFormElement"),rn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),_e=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),sn=I("RegExp"),tt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ee(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},on=e=>{tt(e,(t,n)=>{if(F(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(F(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+"'")})}})},an=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return K(e)?r(e):r(String(e).split(t)),n},ln=()=>{},cn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function un(e){return!!(e&&F(e.append)&&e[Ge]==="FormData"&&e[ce])}const dn=e=>{const t=new Array(10),n=(r,s)=>{if(Z(r)){if(t.indexOf(r)>=0)return;if(Y(r))return r;if(!("toJSON"in r)){t[s]=r;const i=K(r)?[]:{};return ee(r,(o,l)=>{const f=n(o,s+1);!V(f)&&(i[l]=f)}),t[s]=void 0,i}}return r};return n(e,0)},fn=I("AsyncFunction"),pn=e=>e&&(Z(e)||F(e))&&F(e.then)&&F(e.catch),nt=((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",F(H.postMessage)),hn=typeof queueMicrotask<"u"?queueMicrotask.bind(H):typeof process<"u"&&process.nextTick||nt,mn=e=>e!=null&&F(e[ce]),a={isArray:K,isArrayBuffer:Qe,isBuffer:Y,isFormData:$t,isArrayBufferView:Ft,isString:Pt,isNumber:Ye,isBoolean:_t,isObject:Z,isPlainObject:oe,isEmptyObject:Ut,isReadableStream:Ht,isRequest:Mt,isResponse:zt,isHeaders:Wt,isUndefined:V,isDate:It,isFile:Lt,isBlob:Dt,isRegExp:sn,isFunction:F,isStream:vt,isURLSearchParams:qt,isTypedArray:Zt,isFileList:Bt,forEach:ee,merge:xe,extend:Vt,trim:Jt,stripBOM:Kt,inherits:Xt,toFlatObject:Gt,kindOf:ue,kindOfTest:I,endsWith:Qt,toArray:Yt,forEachEntry:en,matchAll:tn,isHTMLForm:nn,hasOwnProperty:_e,hasOwnProp:_e,reduceDescriptors:tt,freezeMethods:on,toObjectSet:an,toCamelCase:rn,noop:ln,toFiniteNumber:cn,findKey:Ze,global:H,isContextDefined:et,isSpecCompliantForm:un,toJSONObject:dn,isAsyncFn:fn,isThenable:pn,setImmediate:nt,asap:hn,isIterable:mn};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 rt=g.prototype,st={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{st[e]={value:e}});Object.defineProperties(g,st);Object.defineProperty(rt,"isAxiosError",{value:!0});g.from=(e,t,n,r,s,i)=>{const o=Object.create(rt);a.toFlatObject(e,o,function(u){return u!==Error.prototype},d=>d!=="isAxiosError");const l=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return g.call(o,l,f,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const yn=null;function Se(e){return a.isPlainObject(e)||a.isArray(e)}function ot(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ue(e,t,n){return e?e.concat(t).map(function(s,i){return s=ot(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function bn(e){return a.isArray(e)&&!e.some(Se)}const gn=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function fe(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,p){return!a.isUndefined(p[m])});const r=n.metaTokens,s=n.visitor||u,i=n.dots,o=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function d(c){if(c===null)return"";if(a.isDate(c))return c.toISOString();if(a.isBoolean(c))return c.toString();if(!f&&a.isBlob(c))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(c)||a.isTypedArray(c)?f&&typeof Blob=="function"?new Blob([c]):Buffer.from(c):c}function u(c,m,p){let w=c;if(c&&!p&&typeof c=="object"){if(a.endsWith(m,"{}"))m=r?m:m.slice(0,-2),c=JSON.stringify(c);else if(a.isArray(c)&&bn(c)||(a.isFileList(c)||a.endsWith(m,"[]"))&&(w=a.toArray(c)))return m=ot(m),w.forEach(function(E,C){!(a.isUndefined(E)||E===null)&&t.append(o===!0?Ue([m],C,i):o===null?m:m+"[]",d(E))}),!1}return Se(c)?!0:(t.append(Ue(p,m,i),d(c)),!1)}const h=[],x=Object.assign(gn,{defaultVisitor:u,convertValue:d,isVisitable:Se});function S(c,m){if(!a.isUndefined(c)){if(h.indexOf(c)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(c),a.forEach(c,function(w,T){(!(a.isUndefined(w)||w===null)&&s.call(t,w,a.isString(T)?T.trim():T,m,x))===!0&&S(w,m?m.concat(T):[T])}),h.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return S(e),t}function Ie(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ce(e,t){this._pairs=[],e&&fe(e,this,t)}const it=Ce.prototype;it.append=function(t,n){this._pairs.push([t,n])};it.toString=function(t){const n=t?function(r){return t.call(this,r,Ie)}:Ie;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function xn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function at(e,t,n){if(!t)return e;const r=n&&n.encode||xn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new Ce(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Le{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const lt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Sn=typeof URLSearchParams<"u"?URLSearchParams:Ce,wn=typeof FormData<"u"?FormData:null,En=typeof Blob<"u"?Blob:null,Rn={isBrowser:!0,classes:{URLSearchParams:Sn,FormData:wn,Blob:En},protocols:["http","https","file","blob","url","data"]},Oe=typeof window<"u"&&typeof document<"u",we=typeof navigator=="object"&&navigator||void 0,Cn=Oe&&(!we||["ReactNative","NativeScript","NS"].indexOf(we.product)<0),On=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Tn=Oe&&window.location.href||"http://localhost",An=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Oe,hasStandardBrowserEnv:Cn,hasStandardBrowserWebWorkerEnv:On,navigator:we,origin:Tn},Symbol.toStringTag,{value:"Module"})),j={...An,...Rn};function jn(e,t){return fe(e,new j.classes.URLSearchParams,{visitor:function(n,r,s,i){return j.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function kn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Nn(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function ct(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),f=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,f?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=Nn(s[o])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(kn(r),s,n,0)}),n}return null}function Fn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const te={transitional:lt,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(ct(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return jn(t,this.formSerializer).toString();if((l=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return fe(l?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Fn(t)):t}],transformResponse:[function(t){const n=this.transitional||te.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const 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:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{te.headers[e]={}});const Pn=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"]),_n=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
2
|
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Pn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},De=Symbol("internals");function Q(e){return e&&String(e).trim().toLowerCase()}function ie(e){return e===!1||e==null?e:a.isArray(e)?e.map(ie):String(e)}function Un(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 In=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 Ln(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Dn(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 P=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(l,f,d){const u=Q(f);if(!u)throw new Error("header name must be a non-empty string");const h=a.findKey(s,u);(!h||s[h]===void 0||d===!0||d===void 0&&s[h]!==!1)&&(s[h||f]=ie(l))}const o=(l,f)=>a.forEach(l,(d,u)=>i(d,u,f));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!In(t))o(_n(t),n);else if(a.isObject(t)&&a.isIterable(t)){let l={},f,d;for(const u of t){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[d=u[0]]=(f=l[d])?a.isArray(f)?[...f,u[1]]:[f,u[1]]:u[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 Un(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]=ie(s),delete n[i];return}const l=t?Ln(i):String(i).trim();l!==i&&delete n[i],n[l]=ie(s),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
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[De]=this[De]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=Q(o);r[l]||(Dn(s,o),r[l]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};P.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(P.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(P);function be(e,t){const n=this||te,r=t||n,s=P.from(r.headers);let i=r.data;return a.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function ut(e){return!!(e&&e.__CANCEL__)}function X(e,t,n){g.call(this,e??"canceled",g.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(X,g,{__CANCEL__:!0});function dt(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 Bn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function vn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const d=Date.now(),u=r[i];o||(o=d),n[s]=f,r[s]=d;let h=i,x=0;for(;h!==s;)x+=n[h++],h=h%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const S=u&&d-u;return S?Math.round(x*1e3/S):void 0}}function $n(e,t){let n=0,r=1e3/t,s,i;const o=(d,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),h=u-n;h>=r?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-h)))},()=>s&&o(s)]}const le=(e,t,n=3)=>{let r=0;const s=vn(50,250);return $n(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,f=o-r,d=s(f),u=o<=l;r=o;const h={loaded:o,total:l,progress:l?o/l:void 0,bytes:f,rate:d||void 0,estimated:d&&l&&u?(l-o)/d:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(h)},n)},Be=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ve=e=>(...t)=>a.asap(()=>e(...t)),Hn=j.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,j.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,qn=j.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 Mn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function zn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ft(e,t,n){let r=!Mn(t);return e&&(r||n==!1)?zn(e,t):t}const $e=e=>e instanceof P?{...e}:e;function z(e,t){t=t||{};const n={};function r(d,u,h,x){return a.isPlainObject(d)&&a.isPlainObject(u)?a.merge.call({caseless:x},d,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(d,u,h,x){if(a.isUndefined(u)){if(!a.isUndefined(d))return r(void 0,d,h,x)}else return r(d,u,h,x)}function i(d,u){if(!a.isUndefined(u))return r(void 0,u)}function o(d,u){if(a.isUndefined(u)){if(!a.isUndefined(d))return r(void 0,d)}else return r(void 0,u)}function l(d,u,h){if(h in t)return r(d,u);if(h in e)return r(void 0,d)}const f={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(d,u,h)=>s($e(d),$e(u),h,!0)};return a.forEach(Object.keys({...e,...t}),function(u){const h=f[u]||s,x=h(e[u],t[u],u);a.isUndefined(x)&&h!==l||(n[u]=x)}),n}const pt=e=>{const t=z({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=P.from(o),t.url=at(ft(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const f=n.getHeaders(),d=["content-type","content-length"];Object.entries(f).forEach(([u,h])=>{d.includes(u.toLowerCase())&&o.set(u,h)})}}if(j.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Hn(t.url))){const f=s&&i&&qn.read(i);f&&o.set(s,f)}return t},Wn=typeof XMLHttpRequest<"u",Jn=Wn&&function(e){return new Promise(function(n,r){const s=pt(e);let i=s.data;const o=P.from(s.headers).normalize();let{responseType:l,onUploadProgress:f,onDownloadProgress:d}=s,u,h,x,S,c;function m(){S&&S(),c&&c(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let p=new XMLHttpRequest;p.open(s.method.toUpperCase(),s.url,!0),p.timeout=s.timeout;function w(){if(!p)return;const E=P.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),O={data:!l||l==="text"||l==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:E,config:e,request:p};dt(function(b){n(b),m()},function(b){r(b),m()},O),p=null}"onloadend"in p?p.onloadend=w:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(w)},p.onabort=function(){p&&(r(new g("Request aborted",g.ECONNABORTED,e,p)),p=null)},p.onerror=function(C){const O=C&&C.message?C.message:"Network Error",U=new g(O,g.ERR_NETWORK,e,p);U.event=C||null,r(U),p=null},p.ontimeout=function(){let C=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const O=s.transitional||lt;s.timeoutErrorMessage&&(C=s.timeoutErrorMessage),r(new g(C,O.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,p)),p=null},i===void 0&&o.setContentType(null),"setRequestHeader"in p&&a.forEach(o.toJSON(),function(C,O){p.setRequestHeader(O,C)}),a.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),l&&l!=="json"&&(p.responseType=s.responseType),d&&([x,c]=le(d,!0),p.addEventListener("progress",x)),f&&p.upload&&([h,S]=le(f),p.upload.addEventListener("progress",h),p.upload.addEventListener("loadend",S)),(s.cancelToken||s.signal)&&(u=E=>{p&&(r(!E||E.type?new X(null,e,p):E),p.abort(),p=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const T=Bn(s.url);if(T&&j.protocols.indexOf(T)===-1){r(new g("Unsupported protocol "+T+":",g.ERR_BAD_REQUEST,e));return}p.send(i||null)})},Vn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(d){if(!s){s=!0,l();const u=d instanceof Error?d:this.reason;r.abort(u instanceof g?u:new X(u instanceof Error?u.message:u))}};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(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:f}=r;return f.unsubscribe=()=>a.asap(l),f}},Kn=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},Xn=async function*(e,t){for await(const n of Gn(e))yield*Kn(n,t)},Gn=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()}},He=(e,t,n,r)=>{const s=Xn(e,t);let i=0,o,l=f=>{o||(o=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:d,value:u}=await s.next();if(d){l(),f.close();return}let h=u.byteLength;if(n){let x=i+=h;n(x)}f.enqueue(new Uint8Array(u))}catch(d){throw l(d),d}},cancel(f){return l(f),s.return()}},{highWaterMark:2})},qe=64*1024,{isFunction:se}=a,Qn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Me,TextEncoder:ze}=a.global,We=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Yn=e=>{e=a.merge.call({skipUndefined:!0},Qn,e);const{fetch:t,Request:n,Response:r}=e,s=t?se(t):typeof fetch=="function",i=se(n),o=se(r);if(!s)return!1;const l=s&&se(Me),f=s&&(typeof ze=="function"?(c=>m=>c.encode(m))(new ze):async c=>new Uint8Array(await new n(c).arrayBuffer())),d=i&&l&&We(()=>{let c=!1;const m=new n(j.origin,{body:new Me,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!m}),u=o&&l&&We(()=>a.isReadableStream(new r("").body)),h={stream:u&&(c=>c.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(c=>{!h[c]&&(h[c]=(m,p)=>{let w=m&&m[c];if(w)return w.call(m);throw new g(`Response type '${c}' is not supported`,g.ERR_NOT_SUPPORT,p)})});const x=async c=>{if(c==null)return 0;if(a.isBlob(c))return c.size;if(a.isSpecCompliantForm(c))return(await new n(j.origin,{method:"POST",body:c}).arrayBuffer()).byteLength;if(a.isArrayBufferView(c)||a.isArrayBuffer(c))return c.byteLength;if(a.isURLSearchParams(c)&&(c=c+""),a.isString(c))return(await f(c)).byteLength},S=async(c,m)=>{const p=a.toFiniteNumber(c.getContentLength());return p??x(m)};return async c=>{let{url:m,method:p,data:w,signal:T,cancelToken:E,timeout:C,onDownloadProgress:O,onUploadProgress:U,responseType:b,headers:k,withCredentials:_="same-origin",fetchOptions:W}=pt(c),Ae=t||fetch;b=b?(b+"").toLowerCase():"text";let ne=Vn([T,E&&E.toAbortSignal()],C),G=null;const H=ne&&ne.unsubscribe&&(()=>{ne.unsubscribe()});let je;try{if(U&&d&&p!=="get"&&p!=="head"&&(je=await S(k,w))!==0){let v=new n(m,{method:"POST",body:w,duplex:"half"}),J;if(a.isFormData(w)&&(J=v.headers.get("content-type"))&&k.setContentType(J),v.body){const[he,re]=Be(je,le(ve(U)));w=He(v.body,qe,he,re)}}a.isString(_)||(_=_?"include":"omit");const L=i&&"credentials"in n.prototype,ke={...W,signal:ne,method:p.toUpperCase(),headers:k.normalize().toJSON(),body:w,duplex:"half",credentials:L?_:void 0};G=i&&new n(m,ke);let B=await(i?Ae(G,W):Ae(m,ke));const Ne=u&&(b==="stream"||b==="response");if(u&&(O||Ne&&H)){const v={};["status","statusText","headers"].forEach(Fe=>{v[Fe]=B[Fe]});const J=a.toFiniteNumber(B.headers.get("content-length")),[he,re]=O&&Be(J,le(ve(O),!0))||[];B=new r(He(B.body,qe,he,()=>{re&&re(),H&&H()}),v)}b=b||"text";let xt=await h[a.findKey(h,b)||"text"](B,c);return!Ne&&H&&H(),await new Promise((v,J)=>{dt(v,J,{data:xt,headers:P.from(B.headers),status:B.status,statusText:B.statusText,config:c,request:G})})}catch(L){throw H&&H(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,c,G),{cause:L.cause||L}):g.from(L,L&&L.code,c,G)}}},Zn=new Map,ht=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,f,d,u=Zn;for(;l--;)f=i[l],d=u.get(f),d===void 0&&u.set(f,d=l?new Map:Yn(t)),u=d;return d};ht();const Te={http:yn,xhr:Jn,fetch:{get:ht}};a.forEach(Te,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Je=e=>`- ${e}`,er=e=>a.isFunction(e)||e===null||e===!1;function tr(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,!er(r)&&(s=Te[(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(([f,d])=>`adapter ${f} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[De]=this[De]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=Q(o);r[l]||(Dn(s,o),r[l]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};P.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(P.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(P);function be(e,t){const n=this||te,r=t||n,s=P.from(r.headers);let i=r.data;return a.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function ut(e){return!!(e&&e.__CANCEL__)}function X(e,t,n){g.call(this,e??"canceled",g.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(X,g,{__CANCEL__:!0});function dt(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 Bn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function vn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const d=Date.now(),u=r[i];o||(o=d),n[s]=f,r[s]=d;let h=i,x=0;for(;h!==s;)x+=n[h++],h=h%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),d-o<t)return;const S=u&&d-u;return S?Math.round(x*1e3/S):void 0}}function $n(e,t){let n=0,r=1e3/t,s,i;const o=(d,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...d)};return[(...d)=>{const u=Date.now(),h=u-n;h>=r?o(d,u):(s=d,i||(i=setTimeout(()=>{i=null,o(s)},r-h)))},()=>s&&o(s)]}const le=(e,t,n=3)=>{let r=0;const s=vn(50,250);return $n(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,f=o-r,d=s(f),u=o<=l;r=o;const h={loaded:o,total:l,progress:l?o/l:void 0,bytes:f,rate:d||void 0,estimated:d&&l&&u?(l-o)/d:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(h)},n)},Be=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ve=e=>(...t)=>a.asap(()=>e(...t)),qn=j.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,j.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,Hn=j.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 Mn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function zn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ft(e,t,n){let r=!Mn(t);return e&&(r||n==!1)?zn(e,t):t}const $e=e=>e instanceof P?{...e}:e;function z(e,t){t=t||{};const n={};function r(d,u,h,x){return a.isPlainObject(d)&&a.isPlainObject(u)?a.merge.call({caseless:x},d,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(d,u,h,x){if(a.isUndefined(u)){if(!a.isUndefined(d))return r(void 0,d,h,x)}else return r(d,u,h,x)}function i(d,u){if(!a.isUndefined(u))return r(void 0,u)}function o(d,u){if(a.isUndefined(u)){if(!a.isUndefined(d))return r(void 0,d)}else return r(void 0,u)}function l(d,u,h){if(h in t)return r(d,u);if(h in e)return r(void 0,d)}const f={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(d,u,h)=>s($e(d),$e(u),h,!0)};return a.forEach(Object.keys({...e,...t}),function(u){const h=f[u]||s,x=h(e[u],t[u],u);a.isUndefined(x)&&h!==l||(n[u]=x)}),n}const pt=e=>{const t=z({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=P.from(o),t.url=at(ft(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const f=n.getHeaders(),d=["content-type","content-length"];Object.entries(f).forEach(([u,h])=>{d.includes(u.toLowerCase())&&o.set(u,h)})}}if(j.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&qn(t.url))){const f=s&&i&&Hn.read(i);f&&o.set(s,f)}return t},Wn=typeof XMLHttpRequest<"u",Jn=Wn&&function(e){return new Promise(function(n,r){const s=pt(e);let i=s.data;const o=P.from(s.headers).normalize();let{responseType:l,onUploadProgress:f,onDownloadProgress:d}=s,u,h,x,S,c;function m(){S&&S(),c&&c(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let p=new XMLHttpRequest;p.open(s.method.toUpperCase(),s.url,!0),p.timeout=s.timeout;function w(){if(!p)return;const E=P.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),O={data:!l||l==="text"||l==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:E,config:e,request:p};dt(function(b){n(b),m()},function(b){r(b),m()},O),p=null}"onloadend"in p?p.onloadend=w:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(w)},p.onabort=function(){p&&(r(new g("Request aborted",g.ECONNABORTED,e,p)),p=null)},p.onerror=function(C){const O=C&&C.message?C.message:"Network Error",U=new g(O,g.ERR_NETWORK,e,p);U.event=C||null,r(U),p=null},p.ontimeout=function(){let C=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const O=s.transitional||lt;s.timeoutErrorMessage&&(C=s.timeoutErrorMessage),r(new g(C,O.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,e,p)),p=null},i===void 0&&o.setContentType(null),"setRequestHeader"in p&&a.forEach(o.toJSON(),function(C,O){p.setRequestHeader(O,C)}),a.isUndefined(s.withCredentials)||(p.withCredentials=!!s.withCredentials),l&&l!=="json"&&(p.responseType=s.responseType),d&&([x,c]=le(d,!0),p.addEventListener("progress",x)),f&&p.upload&&([h,S]=le(f),p.upload.addEventListener("progress",h),p.upload.addEventListener("loadend",S)),(s.cancelToken||s.signal)&&(u=E=>{p&&(r(!E||E.type?new X(null,e,p):E),p.abort(),p=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const T=Bn(s.url);if(T&&j.protocols.indexOf(T)===-1){r(new g("Unsupported protocol "+T+":",g.ERR_BAD_REQUEST,e));return}p.send(i||null)})},Vn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(d){if(!s){s=!0,l();const u=d instanceof Error?d:this.reason;r.abort(u instanceof g?u:new X(u instanceof Error?u.message:u))}};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(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),e=null)};e.forEach(d=>d.addEventListener("abort",i));const{signal:f}=r;return f.unsubscribe=()=>a.asap(l),f}},Kn=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},Xn=async function*(e,t){for await(const n of Gn(e))yield*Kn(n,t)},Gn=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()}},qe=(e,t,n,r)=>{const s=Xn(e,t);let i=0,o,l=f=>{o||(o=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:d,value:u}=await s.next();if(d){l(),f.close();return}let h=u.byteLength;if(n){let x=i+=h;n(x)}f.enqueue(new Uint8Array(u))}catch(d){throw l(d),d}},cancel(f){return l(f),s.return()}},{highWaterMark:2})},He=64*1024,{isFunction:se}=a,Qn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Me,TextEncoder:ze}=a.global,We=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Yn=e=>{e=a.merge.call({skipUndefined:!0},Qn,e);const{fetch:t,Request:n,Response:r}=e,s=t?se(t):typeof fetch=="function",i=se(n),o=se(r);if(!s)return!1;const l=s&&se(Me),f=s&&(typeof ze=="function"?(c=>m=>c.encode(m))(new ze):async c=>new Uint8Array(await new n(c).arrayBuffer())),d=i&&l&&We(()=>{let c=!1;const m=new n(j.origin,{body:new Me,method:"POST",get duplex(){return c=!0,"half"}}).headers.has("Content-Type");return c&&!m}),u=o&&l&&We(()=>a.isReadableStream(new r("").body)),h={stream:u&&(c=>c.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(c=>{!h[c]&&(h[c]=(m,p)=>{let w=m&&m[c];if(w)return w.call(m);throw new g(`Response type '${c}' is not supported`,g.ERR_NOT_SUPPORT,p)})});const x=async c=>{if(c==null)return 0;if(a.isBlob(c))return c.size;if(a.isSpecCompliantForm(c))return(await new n(j.origin,{method:"POST",body:c}).arrayBuffer()).byteLength;if(a.isArrayBufferView(c)||a.isArrayBuffer(c))return c.byteLength;if(a.isURLSearchParams(c)&&(c=c+""),a.isString(c))return(await f(c)).byteLength},S=async(c,m)=>{const p=a.toFiniteNumber(c.getContentLength());return p??x(m)};return async c=>{let{url:m,method:p,data:w,signal:T,cancelToken:E,timeout:C,onDownloadProgress:O,onUploadProgress:U,responseType:b,headers:k,withCredentials:_="same-origin",fetchOptions:W}=pt(c),Ae=t||fetch;b=b?(b+"").toLowerCase():"text";let ne=Vn([T,E&&E.toAbortSignal()],C),G=null;const q=ne&&ne.unsubscribe&&(()=>{ne.unsubscribe()});let je;try{if(U&&d&&p!=="get"&&p!=="head"&&(je=await S(k,w))!==0){let v=new n(m,{method:"POST",body:w,duplex:"half"}),J;if(a.isFormData(w)&&(J=v.headers.get("content-type"))&&k.setContentType(J),v.body){const[he,re]=Be(je,le(ve(U)));w=qe(v.body,He,he,re)}}a.isString(_)||(_=_?"include":"omit");const L=i&&"credentials"in n.prototype,ke={...W,signal:ne,method:p.toUpperCase(),headers:k.normalize().toJSON(),body:w,duplex:"half",credentials:L?_:void 0};G=i&&new n(m,ke);let B=await(i?Ae(G,W):Ae(m,ke));const Ne=u&&(b==="stream"||b==="response");if(u&&(O||Ne&&q)){const v={};["status","statusText","headers"].forEach(Fe=>{v[Fe]=B[Fe]});const J=a.toFiniteNumber(B.headers.get("content-length")),[he,re]=O&&Be(J,le(ve(O),!0))||[];B=new r(qe(B.body,He,he,()=>{re&&re(),q&&q()}),v)}b=b||"text";let xt=await h[a.findKey(h,b)||"text"](B,c);return!Ne&&q&&q(),await new Promise((v,J)=>{dt(v,J,{data:xt,headers:P.from(B.headers),status:B.status,statusText:B.statusText,config:c,request:G})})}catch(L){throw q&&q(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,c,G),{cause:L.cause||L}):g.from(L,L&&L.code,c,G)}}},Zn=new Map,ht=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,f,d,u=Zn;for(;l--;)f=i[l],d=u.get(f),d===void 0&&u.set(f,d=l?new Map:Yn(t)),u=d;return d};ht();const Te={http:yn,xhr:Jn,fetch:{get:ht}};a.forEach(Te,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Je=e=>`- ${e}`,er=e=>a.isFunction(e)||e===null||e===!1;function tr(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,!er(r)&&(s=Te[(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(([f,d])=>`adapter ${f} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
|
|
4
4
|
`+o.map(Je).join(`
|
|
5
5
|
`):" "+Je(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 mt={getAdapter:tr,adapters:Te};function ge(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new X(null,e)}function Ve(e){return ge(e),e.headers=P.from(e.headers),e.data=be.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),mt.getAdapter(e.adapter||te.adapter,e)(e).then(function(r){return ge(e),r.data=be.call(e,e.transformResponse,r),r.headers=P.from(r.headers),r},function(r){return ut(r)||(ge(e),r&&r.response&&(r.response.data=be.call(e,e.transformResponse,r.response),r.response.headers=P.from(r.response.headers))),Promise.reject(r)})}const yt="1.13.2",pe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{pe[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ke={};pe.transitional=function(t,n,r){function s(i,o){return"[Axios v"+yt+"] 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&&!Ke[o]&&(Ke[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}};pe.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function nr(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],f=l===void 0||o(l,i,e);if(f!==!0)throw new g("option "+i+" must be "+f,g.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new g("Unknown option "+i,g.ERR_BAD_OPTION)}}const ae={assertOptions:nr,validators:pe},D=ae.validators;let M=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Le,response:new Le}}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=z(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ae.assertOptions(r,{silentJSONParsing:D.transitional(D.boolean),forcedJSONParsing:D.transitional(D.boolean),clarifyTimeoutError:D.transitional(D.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:D.function,serialize:D.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ae.assertOptions(n,{baseUrl:D.spelling("baseURL"),withXsrfToken:D.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"],c=>{delete i[c]}),n.headers=P.concat(o,i);const l=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const d=[];this.interceptors.response.forEach(function(m){d.push(m.fulfilled,m.rejected)});let u,h=0,x;if(!f){const c=[Ve.bind(this),void 0];for(c.unshift(...l),c.push(...d),x=c.length,u=Promise.resolve(n);h<x;)u=u.then(c[h++],c[h++]);return u}x=l.length;let S=n;for(;h<x;){const c=l[h++],m=l[h++];try{S=c(S)}catch(p){m.call(this,p);break}}try{u=Ve.call(this,S)}catch(c){return Promise.reject(c)}for(h=0,x=d.length;h<x;)u=u.then(d[h++],d[h++]);return u}getUri(t){t=z(this.defaults,t);const n=ft(t.baseURL,t.url,t.allowAbsoluteUrls);return at(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){M.prototype[t]=function(n,r){return this.request(z(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(z(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 rr=class bt{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 X(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 bt(function(s){t=s}),cancel:t}}};function sr(e){return function(n){return e.apply(null,n)}}function or(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 gt(e){const t=new M(e),n=Xe(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 gt(z(e,s))},n}const R=gt(te);R.Axios=M;R.CanceledError=X;R.CancelToken=rr;R.isCancel=ut;R.VERSION=yt;R.toFormData=fe;R.AxiosError=g;R.Cancel=R.CanceledError;R.all=function(t){return Promise.all(t)};R.spread=sr;R.isAxiosError=or;R.mergeConfig=z;R.AxiosHeaders=P;R.formToJSON=e=>ct(a.isHTMLForm(e)?new FormData(e):e);R.getAdapter=mt.getAdapter;R.HttpStatusCode=Ee;R.default=R;const{Axios:fr,AxiosError:pr,CanceledError:hr,isCancel:mr,CancelToken:yr,VERSION:br,all:gr,Cancel:xr,isAxiosError:Sr,spread:wr,toFormData:Er,AxiosHeaders:Rr,HttpStatusCode:Cr,formToJSON:Or,getAdapter:Tr,mergeConfig:Ar}=R,ir=async(e,t)=>{try{await R.get(`https://n8n.clone67.com/webhook/end-chat-session?chatbotNamespace=${t}&sessionId=${e}`)}catch{throw new Error}},ar=({chatBotData:e,theme:t,onlineStatus:n,isExpand:r,endSession:s})=>{const[i,o]=N.useState(null),[l,f]=N.useState(""),[d,u]=N.useState("Connecting to server..."),[h,x]=N.useState(""),[S,c]=N.useState(!1);N.useEffect(()=>{var b=localStorage.getItem("clone67ChatSessionId");b===null&&(b=Tt(),localStorage.setItem("clone67ChatSessionId",b));const{socket:k}=kt(b,e.pineconeNamespace);o(k),k.onopen=()=>{u("Server connected"),setTimeout(()=>{u("")},2e3),n("online")},k.onmessage=async _=>{try{const W=await _.data;x(W),c(!1)}catch(W){console.error("Error handling server message:",W)}},k.onerror=_=>{u("Server error occurred"),console.error("WebSocket error:",_),n("offline")},k.onclose=()=>{u("Server disconnected"),n("offline")}},[]),N.useEffect(()=>{(async()=>{if(!s)return;const k=localStorage.getItem("clone67ChatSessionId");if(i&&i.readyState===WebSocket.OPEN)try{h&&await ir(k,e.pineconeNamespace),i.send(JSON.stringify({type:"end_session"})),i.close(),localStorage.removeItem("clone67ChatSessionId")}catch(_){console.log("Error while saving messages",_)}})()},[s]);const m=async b=>{if(b.preventDefault(),i&&i.readyState===WebSocket.OPEN){const _={type:"chat",userInput:l};i.send(JSON.stringify(_))}c(!0);const k={created_at:Date.now(),sender_type:"user",message:l};x(JSON.stringify(k)),f("")},p=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),m(b))},w={flex:1,padding:"12px 16px",background:`${S?`${t.primaryColor}33`:t.backgroundColor}`,color:t.fontColor,border:`1px solid ${t.primaryColor}`,borderRadius:"12px",fontSize:"14px",outline:"none",transition:"all 0.2s ease",boxShadow:"none",cursor:S?"not-allowed":"auto"},T={padding:"12px 20px",borderRadius:"12px",background:S?`${t.primaryColor}33`:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,border:"none",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontWeight:"600",fontSize:"14px",transition:"all 0.2s ease",minWidth:"48px",cursor:S?"not-allowed":"pointer"},E={padding:"10px",borderColor:t.fontColor,background:t.backgroundColor,flexShrink:0},C={display:"flex",gap:"12px",alignItems:"center"},O={textAlign:"center",padding:"2px",backgroundColor:d==="Server connected"||d==="online"?"#09BA00":d==="Connecting to server..."?"#DED000":"#FF3408",color:"#ffffff",fontSize:"10px"},U={padding:"8px",animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s",fontSize:"10px",color:t.fontColor};return y.jsxs(y.Fragment,{children:[d&&y.jsx("p",{style:O,children:d}),s?y.jsx(jt,{theme:t}):y.jsxs(y.Fragment,{children:[y.jsx(At,{messages:h,chatBotData:e,theme:t,isExpand:r}),S&&y.jsx("div",{style:U,children:`${e.name} is typing...`}),y.jsx("div",{style:E,children:y.jsxs("form",{onSubmit:m,style:C,children:[y.jsx("input",{type:"text",placeholder:"Type a message...",value:l,onChange:b=>f(b.target.value),disabled:S,onKeyDown:p,style:w,onFocus:b=>{b.target.style.boxShadow=`0 0 0 1px ${t.primaryColor}`,b.target.style.borderColor=t.primaryColor},onBlur:b=>{b.target.style.boxShadow="none",b.target.style.borderColor=t.primaryColor}}),y.jsx("button",{onClick:m,style:T,disabled:S,"aria-label":"Send message",children:y.jsx($.Send,{size:18})})]})})]})]})},lr=({theme:e,chatBotData:t,onClose:n})=>{const[r,s]=N.useState(!1),[i,o]=N.useState(!1),[l,f]=N.useState(!1),u={position:"fixed",bottom:"112px",[t.position==="left"?"left":"right"]:"32px",zIndex:50,width:r?"684px":"384px",height:r?"620px":"520px",background:`${e.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, ${e.primaryColor}, ${e.secondaryColor})`,color:e.fontColor,borderRadius:"16px 16px 0 0",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)"},x={position:"relative"},S={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},c={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:i?"#00BF49":"#F54927",borderRadius:"50%",border:"3px solid white"},m={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},p={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},w={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},T={padding:"10px",borderTop:"1px solid rgba(255,255,255,0.2)",background:e.backgroundColor,textAlign:"center"},E={fontSize:"11px",color:e.fontColor,letterSpacing:"0.5px"},C={fontWeight:"600"},O=(b,k)=>{b.currentTarget.style.background=k?"rgba(255,255,255,0.2)":"transparent"},U=b=>{o(b==="online")};return y.jsxs("div",{style:u,children:[y.jsxs("div",{style:h,children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[y.jsxs("div",{style:x,children:[y.jsx("div",{style:S,children:y.jsx($.MessageCircle,{size:22})}),y.jsx("span",{style:c})]}),y.jsxs("div",{children:[y.jsx("h3",{style:m,children:t.name}),y.jsx("p",{style:p,children:t.subTitle})]})]}),y.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[y.jsx("button",{onClick:()=>s(b=>!b),"aria-label":"expand chat",style:w,onMouseEnter:b=>O(b,!0),onMouseLeave:b=>O(b,!1),children:r?y.jsx($.Minimize2,{size:20}):y.jsx($.Maximize2,{size:20})}),y.jsx("button",{onClick:()=>{f(!0),setTimeout(()=>{n()},2e3)},style:w,onMouseEnter:b=>O(b,!0),onMouseLeave:b=>O(b,!1),children:y.jsx($.X,{size:20})})]})]}),y.jsx(ar,{chatBotData:t,theme:e,onlineStatus:U,isExpand:r,endSession:l}),y.jsx("div",{style:T,children:y.jsxs("p",{style:E,children:["powered by ",y.jsx("span",{style:C,children:"clone67.com"})]})})]})},cr=({pineconeNamespace:e,primaryColor:t="#3b82f6",secondaryColor:n="#8b5cf6",backgroundColor:r="#ffffff",fontColor:s="#1f2937",placeholderColor:i="#9ca3af",position:o="right",name:l="AI Assistant",subTitle:f="AI powered assistant",welcomeText:d="Hi! How can I help you today?",aiInitialMessage:u=""})=>{const[h,x]=N.useState(!1),S=()=>x(O=>!O),c=()=>{x(!1)},m={primaryColor:t,secondaryColor:n,backgroundColor:r,fontColor:s,placeholderColor:i,inputBackgroundColor:r},p={name:l,subTitle:f,welcomeText:d,pineconeNamespace:e,position:o,aiInitialMessage:u};u===""&&(p.aiInitialMessage=`Hello! I'm ${p.name}, your AI assistant. How can I help you today?`);const w=o==="left",T="32px",E={position:"fixed",bottom:"104px",[w?"left":"right"]:T,zIndex:9999,pointerEvents:"auto"},C={position:"fixed",bottom:"32px",[w?"left":"right"]:T,zIndex:1e4,pointerEvents:"auto"};return y.jsxs(y.Fragment,{children:[h&&y.jsx("div",{style:E,children:y.jsx(lr,{onClose:c,theme:m,chatBotData:p})}),y.jsx("div",{style:C,children:y.jsx(St,{onMinimise:S,isOpen:h,theme:m,chatBotData:p})})]})};module.exports=cr;
|
|
6
|
+
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=z(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ae.assertOptions(r,{silentJSONParsing:D.transitional(D.boolean),forcedJSONParsing:D.transitional(D.boolean),clarifyTimeoutError:D.transitional(D.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:D.function,serialize:D.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ae.assertOptions(n,{baseUrl:D.spelling("baseURL"),withXsrfToken:D.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"],c=>{delete i[c]}),n.headers=P.concat(o,i);const l=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const d=[];this.interceptors.response.forEach(function(m){d.push(m.fulfilled,m.rejected)});let u,h=0,x;if(!f){const c=[Ve.bind(this),void 0];for(c.unshift(...l),c.push(...d),x=c.length,u=Promise.resolve(n);h<x;)u=u.then(c[h++],c[h++]);return u}x=l.length;let S=n;for(;h<x;){const c=l[h++],m=l[h++];try{S=c(S)}catch(p){m.call(this,p);break}}try{u=Ve.call(this,S)}catch(c){return Promise.reject(c)}for(h=0,x=d.length;h<x;)u=u.then(d[h++],d[h++]);return u}getUri(t){t=z(this.defaults,t);const n=ft(t.baseURL,t.url,t.allowAbsoluteUrls);return at(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){M.prototype[t]=function(n,r){return this.request(z(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(z(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 rr=class bt{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 X(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 bt(function(s){t=s}),cancel:t}}};function sr(e){return function(n){return e.apply(null,n)}}function or(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 gt(e){const t=new M(e),n=Xe(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 gt(z(e,s))},n}const R=gt(te);R.Axios=M;R.CanceledError=X;R.CancelToken=rr;R.isCancel=ut;R.VERSION=yt;R.toFormData=fe;R.AxiosError=g;R.Cancel=R.CanceledError;R.all=function(t){return Promise.all(t)};R.spread=sr;R.isAxiosError=or;R.mergeConfig=z;R.AxiosHeaders=P;R.formToJSON=e=>ct(a.isHTMLForm(e)?new FormData(e):e);R.getAdapter=mt.getAdapter;R.HttpStatusCode=Ee;R.default=R;const{Axios:fr,AxiosError:pr,CanceledError:hr,isCancel:mr,CancelToken:yr,VERSION:br,all:gr,Cancel:xr,isAxiosError:Sr,spread:wr,toFormData:Er,AxiosHeaders:Rr,HttpStatusCode:Cr,formToJSON:Or,getAdapter:Tr,mergeConfig:Ar}=R,ir=async(e,t)=>{try{await R.post(`https://request-n8n-end-chat-session.clone67.com?chatbotNamespace=${t}&sessionId=${e}`)}catch{throw new Error}},ar=({chatBotData:e,theme:t,onlineStatus:n,isExpand:r,endSession:s})=>{const[i,o]=N.useState(null),[l,f]=N.useState(""),[d,u]=N.useState("Connecting to server..."),[h,x]=N.useState(""),[S,c]=N.useState(!1);N.useEffect(()=>{var b=localStorage.getItem("clone67ChatSessionId");b===null&&(b=Tt(),localStorage.setItem("clone67ChatSessionId",b));const{socket:k}=kt(b,e.pineconeNamespace);o(k),k.onopen=()=>{u("Server connected"),setTimeout(()=>{u("")},2e3),n("online")},k.onmessage=async _=>{try{const W=await _.data;x(W),c(!1)}catch(W){console.error("Error handling server message:",W)}},k.onerror=_=>{u("Server error occurred"),console.error("WebSocket error:",_),n("offline")},k.onclose=()=>{u("Server disconnected"),n("offline")}},[]),N.useEffect(()=>{(async()=>{if(!s)return;const k=localStorage.getItem("clone67ChatSessionId");if(i&&i.readyState===WebSocket.OPEN)try{h&&await ir(k,e.pineconeNamespace),i.send(JSON.stringify({type:"end_session"})),i.close(),localStorage.removeItem("clone67ChatSessionId")}catch(_){console.log("Error while saving messages",_)}})()},[s]);const m=async b=>{if(b.preventDefault(),i&&i.readyState===WebSocket.OPEN){const _={type:"chat",userInput:l};i.send(JSON.stringify(_))}c(!0);const k={created_at:Date.now(),sender_type:"user",message:l};x(JSON.stringify(k)),f("")},p=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),m(b))},w={flex:1,padding:"12px 16px",background:`${S?`${t.primaryColor}33`:t.backgroundColor}`,color:t.fontColor,border:`1px solid ${t.primaryColor}`,borderRadius:"12px",fontSize:"14px",outline:"none",transition:"all 0.2s ease",boxShadow:"none",cursor:S?"not-allowed":"auto"},T={padding:"12px 20px",borderRadius:"12px",background:S?`${t.primaryColor}33`:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,border:"none",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontWeight:"600",fontSize:"14px",transition:"all 0.2s ease",minWidth:"48px",cursor:S?"not-allowed":"pointer"},E={padding:"10px",borderColor:t.fontColor,background:t.backgroundColor,flexShrink:0},C={display:"flex",gap:"12px",alignItems:"center"},O={textAlign:"center",padding:"2px",backgroundColor:d==="Server connected"||d==="online"?"#09BA00":d==="Connecting to server..."?"#DED000":"#FF3408",color:"#ffffff",fontSize:"10px"},U={padding:"8px",animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s",fontSize:"10px",color:t.fontColor};return y.jsxs(y.Fragment,{children:[d&&y.jsx("p",{style:O,children:d}),s?y.jsx(jt,{theme:t}):y.jsxs(y.Fragment,{children:[y.jsx(At,{messages:h,chatBotData:e,theme:t,isExpand:r}),S&&y.jsx("div",{style:U,children:`${e.name} is typing...`}),y.jsx("div",{style:E,children:y.jsxs("form",{onSubmit:m,style:C,children:[y.jsx("input",{type:"text",placeholder:"Type a message...",value:l,onChange:b=>f(b.target.value),disabled:S,onKeyDown:p,style:w,onFocus:b=>{b.target.style.boxShadow=`0 0 0 1px ${t.primaryColor}`,b.target.style.borderColor=t.primaryColor},onBlur:b=>{b.target.style.boxShadow="none",b.target.style.borderColor=t.primaryColor}}),y.jsx("button",{onClick:m,style:T,disabled:S,"aria-label":"Send message",children:y.jsx($.Send,{size:18})})]})})]})]})},lr=({theme:e,chatBotData:t,onClose:n})=>{const[r,s]=N.useState(!1),[i,o]=N.useState(!1),[l,f]=N.useState(!1),u={position:"fixed",bottom:"112px",[t.position==="left"?"left":"right"]:"32px",zIndex:50,width:r?"684px":"384px",height:r?"620px":"520px",background:`${e.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, ${e.primaryColor}, ${e.secondaryColor})`,color:e.fontColor,borderRadius:"16px 16px 0 0",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)"},x={position:"relative"},S={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},c={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:i?"#00BF49":"#F54927",borderRadius:"50%",border:"3px solid white"},m={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},p={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},w={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},T={padding:"10px",borderTop:"1px solid rgba(255,255,255,0.2)",background:e.backgroundColor,textAlign:"center"},E={fontSize:"11px",color:e.fontColor,letterSpacing:"0.5px"},C={fontWeight:"600"},O=(b,k)=>{b.currentTarget.style.background=k?"rgba(255,255,255,0.2)":"transparent"},U=b=>{o(b==="online")};return y.jsxs("div",{style:u,children:[y.jsxs("div",{style:h,children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[y.jsxs("div",{style:x,children:[y.jsx("div",{style:S,children:y.jsx($.MessageCircle,{size:22})}),y.jsx("span",{style:c})]}),y.jsxs("div",{children:[y.jsx("h3",{style:m,children:t.name}),y.jsx("p",{style:p,children:t.subTitle})]})]}),y.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[y.jsx("button",{onClick:()=>s(b=>!b),"aria-label":"expand chat",style:w,onMouseEnter:b=>O(b,!0),onMouseLeave:b=>O(b,!1),children:r?y.jsx($.Minimize2,{size:20}):y.jsx($.Maximize2,{size:20})}),y.jsx("button",{onClick:()=>{f(!0),setTimeout(()=>{n()},2e3)},style:w,onMouseEnter:b=>O(b,!0),onMouseLeave:b=>O(b,!1),children:y.jsx($.X,{size:20})})]})]}),y.jsx(ar,{chatBotData:t,theme:e,onlineStatus:U,isExpand:r,endSession:l}),y.jsx("div",{style:T,children:y.jsxs("p",{style:E,children:["powered by ",y.jsx("span",{style:C,children:"clone67.com"})]})})]})},cr=({pineconeNamespace:e,primaryColor:t="#3b82f6",secondaryColor:n="#8b5cf6",backgroundColor:r="#ffffff",fontColor:s="#1f2937",placeholderColor:i="#9ca3af",position:o="right",name:l="AI Assistant",subTitle:f="AI powered assistant",welcomeText:d="Hi! How can I help you today?",aiInitialMessage:u=""})=>{const[h,x]=N.useState(!1),S=()=>x(O=>!O),c=()=>{x(!1)},m={primaryColor:t,secondaryColor:n,backgroundColor:r,fontColor:s,placeholderColor:i,inputBackgroundColor:r},p={name:l,subTitle:f,welcomeText:d,pineconeNamespace:e,position:o,aiInitialMessage:u};u===""&&(p.aiInitialMessage=`Hello! I'm ${p.name}, your AI assistant. How can I help you today?`);const w=o==="left",T="32px",E={position:"fixed",bottom:"104px",[w?"left":"right"]:T,zIndex:9999,pointerEvents:"auto"},C={position:"fixed",bottom:"32px",[w?"left":"right"]:T,zIndex:1e4,pointerEvents:"auto"};return y.jsxs(y.Fragment,{children:[h&&y.jsx("div",{style:E,children:y.jsx(lr,{onClose:c,theme:m,chatBotData:p})}),y.jsx("div",{style:C,children:y.jsx(St,{onMinimise:S,isOpen:h,theme:m,chatBotData:p})})]})};module.exports=cr;
|
package/dist/index.js
CHANGED
|
@@ -1934,7 +1934,7 @@ const {
|
|
|
1934
1934
|
mergeConfig: vr
|
|
1935
1935
|
} = R, yr = async (e, t) => {
|
|
1936
1936
|
try {
|
|
1937
|
-
await R.
|
|
1937
|
+
await R.post(`https://request-n8n-end-chat-session.clone67.com?chatbotNamespace=${t}&sessionId=${e}`);
|
|
1938
1938
|
} catch {
|
|
1939
1939
|
throw new Error();
|
|
1940
1940
|
}
|