robodialog 0.1.3 → 0.1.5
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.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/loader.js +2 -0
- package/dist/loader.js.map +1 -0
- package/dist/widget.js +4 -4
- package/dist/widget.js.map +1 -1
- package/package.json +3 -2
package/dist/widget.js
CHANGED
|
@@ -3,10 +3,10 @@ var Ep=Object.defineProperty;var Ap=(be,Fe,N)=>Fe in be?Ep(be,Fe,{enumerable:!0,
|
|
|
3
3
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[Bi]=this[Bi]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=ln(o);r[a]||(qc(s,o),r[a]=!0)}return y.isArray(e)?e.forEach(i):i(e),this}};De.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),y.reduceDescriptors(De.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}}),y.freezeMethods(De);function Wr(n,e){const t=this||an,r=e||t,s=De.from(r.headers);let i=r.data;return y.forEach(n,function(a){i=a.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Hi(n){return!!(n&&n.__CANCEL__)}function Yt(n,e,t){L.call(this,n??"canceled",L.ERR_CANCELED,e,t),this.name="CanceledError"}y.inherits(Yt,L,{__CANCEL__:!0});function Wi(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new L("Request failed with status code "+t.status,[L.ERR_BAD_REQUEST,L.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Bc(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function Hc(n,e){n=n||10;const t=new Array(n),r=new Array(n);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=r[i];o||(o=c),t[s]=l,r[s]=c;let d=i,g=0;for(;d!==s;)g+=t[d++],d=d%n;if(s=(s+1)%n,s===i&&(i=(i+1)%n),c-o<e)return;const h=u&&c-u;return h?Math.round(g*1e3/h):void 0}}function Wc(n,e){let t=0,r=1e3/e,s,i;const o=(c,u=Date.now())=>{t=u,s=null,i&&(clearTimeout(i),i=null),n(...c)};return[(...c)=>{const u=Date.now(),d=u-t;d>=r?o(c,u):(s=c,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const Dn=(n,e,t=3)=>{let r=0;const s=Hc(50,250);return Wc(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,c=s(l),u=o<=a;r=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(d)},t)},Vi=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},Yi=n=>(...e)=>y.asap(()=>n(...e)),Vc=xe.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,xe.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(xe.origin),xe.navigator&&/(msie|trident)/i.test(xe.navigator.userAgent)):()=>!0,Yc=xe.hasStandardBrowserEnv?{write(n,e,t,r,s,i,o){if(typeof document>"u")return;const a=[`${n}=${encodeURIComponent(e)}`];y.isNumber(t)&&a.push(`expires=${new Date(t).toUTCString()}`),y.isString(r)&&a.push(`path=${r}`),y.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),y.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(n){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(n){this.write(n,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Xc(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Jc(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function Xi(n,e,t){let r=!Xc(e);return n&&(r||t==!1)?Jc(n,e):e}const Ji=n=>n instanceof De?{...n}:n;function Rt(n,e){e=e||{};const t={};function r(c,u,d,g){return y.isPlainObject(c)&&y.isPlainObject(u)?y.merge.call({caseless:g},c,u):y.isPlainObject(u)?y.merge({},u):y.isArray(u)?u.slice():u}function s(c,u,d,g){if(y.isUndefined(u)){if(!y.isUndefined(c))return r(void 0,c,d,g)}else return r(c,u,d,g)}function i(c,u){if(!y.isUndefined(u))return r(void 0,u)}function o(c,u){if(y.isUndefined(u)){if(!y.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in e)return r(c,u);if(d in n)return r(void 0,c)}const l={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:a,headers:(c,u,d)=>s(Ji(c),Ji(u),d,!0)};return y.forEach(Object.keys({...n,...e}),function(u){const d=l[u]||s,g=d(n[u],e[u],u);y.isUndefined(g)&&d!==a||(t[u]=g)}),t}const Zi=n=>{const e=Rt({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;if(e.headers=o=De.from(o),e.url=ji(Xi(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),y.isFormData(t)){if(xe.hasStandardBrowserEnv||xe.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(y.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&o.set(u,d)})}}if(xe.hasStandardBrowserEnv&&(r&&y.isFunction(r)&&(r=r(e)),r||r!==!1&&Vc(e.url))){const l=s&&i&&Yc.read(i);l&&o.set(s,l)}return e},Zc=typeof XMLHttpRequest<"u"&&function(n){return new Promise(function(t,r){const s=Zi(n);let i=s.data;const o=De.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,u,d,g,h,f;function m(){h&&h(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function v(){if(!b)return;const w=De.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),_={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:w,config:n,request:b};Wi(function(P){t(P),m()},function(P){r(P),m()},_),b=null}"onloadend"in b?b.onloadend=v:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(v)},b.onabort=function(){b&&(r(new L("Request aborted",L.ECONNABORTED,n,b)),b=null)},b.onerror=function(k){const _=k&&k.message?k.message:"Network Error",S=new L(_,L.ERR_NETWORK,n,b);S.event=k||null,r(S),b=null},b.ontimeout=function(){let k=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||zi;s.timeoutErrorMessage&&(k=s.timeoutErrorMessage),r(new L(k,_.clarifyTimeoutError?L.ETIMEDOUT:L.ECONNABORTED,n,b)),b=null},i===void 0&&o.setContentType(null),"setRequestHeader"in b&&y.forEach(o.toJSON(),function(k,_){b.setRequestHeader(_,k)}),y.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),a&&a!=="json"&&(b.responseType=s.responseType),c&&([g,f]=Dn(c,!0),b.addEventListener("progress",g)),l&&b.upload&&([d,h]=Dn(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",h)),(s.cancelToken||s.signal)&&(u=w=>{b&&(r(!w||w.type?new Yt(null,n,b):w),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const x=Bc(s.url);if(x&&xe.protocols.indexOf(x)===-1){r(new L("Unsupported protocol "+x+":",L.ERR_BAD_REQUEST,n));return}b.send(i||null)})},Gc=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,s;const i=function(c){if(!s){s=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof L?u:new Yt(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new L(`timeout ${e} of ms exceeded`,L.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),n=null)};n.forEach(c=>c.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>y.asap(a),l}},Kc=function*(n,e){let t=n.byteLength;if(t<e){yield n;return}let r=0,s;for(;r<t;)s=r+e,yield n.slice(r,s),r=s},Qc=async function*(n,e){for await(const t of eu(n))yield*Kc(t,e)},eu=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}const e=n.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},Gi=(n,e,t,r)=>{const s=Qc(n,e);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await s.next();if(c){a(),l.close();return}let d=u.byteLength;if(t){let g=i+=d;t(g)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},Ki=64*1024,{isFunction:In}=y,tu=(({Request:n,Response:e})=>({Request:n,Response:e}))(y.global),{ReadableStream:Qi,TextEncoder:eo}=y.global,to=(n,...e)=>{try{return!!n(...e)}catch{return!1}},nu=n=>{n=y.merge.call({skipUndefined:!0},tu,n);const{fetch:e,Request:t,Response:r}=n,s=e?In(e):typeof fetch=="function",i=In(t),o=In(r);if(!s)return!1;const a=s&&In(Qi),l=s&&(typeof eo=="function"?(f=>m=>f.encode(m))(new eo):async f=>new Uint8Array(await new t(f).arrayBuffer())),c=i&&a&&to(()=>{let f=!1;const m=new t(xe.origin,{body:new Qi,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!m}),u=o&&a&&to(()=>y.isReadableStream(new r("").body)),d={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!d[f]&&(d[f]=(m,b)=>{let v=m&&m[f];if(v)return v.call(m);throw new L(`Response type '${f}' is not supported`,L.ERR_NOT_SUPPORT,b)})});const g=async f=>{if(f==null)return 0;if(y.isBlob(f))return f.size;if(y.isSpecCompliantForm(f))return(await new t(xe.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(y.isArrayBufferView(f)||y.isArrayBuffer(f))return f.byteLength;if(y.isURLSearchParams(f)&&(f=f+""),y.isString(f))return(await l(f)).byteLength},h=async(f,m)=>{const b=y.toFiniteNumber(f.getContentLength());return b??g(m)};return async f=>{let{url:m,method:b,data:v,signal:x,cancelToken:w,timeout:k,onDownloadProgress:_,onUploadProgress:S,responseType:P,headers:T,withCredentials:A="same-origin",fetchOptions:D}=Zi(f),E=e||fetch;P=P?(P+"").toLowerCase():"text";let j=Gc([x,w&&w.toAbortSignal()],k),Z=null;const se=j&&j.unsubscribe&&(()=>{j.unsubscribe()});let Oe;try{if(S&&c&&b!=="get"&&b!=="head"&&(Oe=await h(T,v))!==0){let R=new t(m,{method:"POST",body:v,duplex:"half"}),$;if(y.isFormData(v)&&($=R.headers.get("content-type"))&&T.setContentType($),R.body){const[F,I]=Vi(Oe,Dn(Yi(S)));v=Gi(R.body,Ki,F,I)}}y.isString(A)||(A=A?"include":"omit");const G=i&&"credentials"in t.prototype,ye={...D,signal:j,method:b.toUpperCase(),headers:T.normalize().toJSON(),body:v,duplex:"half",credentials:G?A:void 0};Z=i&&new t(m,ye);let he=await(i?E(Z,D):E(m,ye));const Be=u&&(P==="stream"||P==="response");if(u&&(_||Be&&se)){const R={};["status","statusText","headers"].forEach(q=>{R[q]=he[q]});const $=y.toFiniteNumber(he.headers.get("content-length")),[F,I]=_&&Vi($,Dn(Yi(_),!0))||[];he=new r(Gi(he.body,Ki,F,()=>{I&&I(),se&&se()}),R)}P=P||"text";let C=await d[y.findKey(d,P)||"text"](he,f);return!Be&&se&&se(),await new Promise((R,$)=>{Wi(R,$,{data:C,headers:De.from(he.headers),status:he.status,statusText:he.statusText,config:f,request:Z})})}catch(G){throw se&&se(),G&&G.name==="TypeError"&&/Load failed|fetch/i.test(G.message)?Object.assign(new L("Network Error",L.ERR_NETWORK,f,Z),{cause:G.cause||G}):L.from(G,G&&G.code,f,Z)}}},ru=new Map,no=n=>{let e=n&&n.env||{};const{fetch:t,Request:r,Response:s}=e,i=[r,s,t];let o=i.length,a=o,l,c,u=ru;for(;a--;)l=i[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:nu(e)),u=c;return c};no();const Vr={http:Sc,xhr:Zc,fetch:{get:no}};y.forEach(Vr,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const ro=n=>`- ${n}`,su=n=>y.isFunction(n)||n===null||n===!1;function iu(n,e){n=y.isArray(n)?n:[n];const{length:t}=n;let r,s;const i={};for(let o=0;o<t;o++){r=n[o];let a;if(s=r,!su(r)&&(s=Vr[(a=String(r)).toLowerCase()],s===void 0))throw new L(`Unknown adapter '${a}'`);if(s&&(y.isFunction(s)||(s=s.get(e))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since :
|
|
4
4
|
`+o.map(ro).join(`
|
|
5
5
|
`):" "+ro(o[0]):"as no adapter specified";throw new L("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const so={getAdapter:iu,adapters:Vr};function Yr(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Yt(null,n)}function io(n){return Yr(n),n.headers=De.from(n.headers),n.data=Wr.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),so.getAdapter(n.adapter||an.adapter,n)(n).then(function(r){return Yr(n),r.data=Wr.call(n,n.transformResponse,r),r.headers=De.from(r.headers),r},function(r){return Hi(r)||(Yr(n),r&&r.response&&(r.response.data=Wr.call(n,n.transformResponse,r.response),r.response.headers=De.from(r.response.headers))),Promise.reject(r)})}const oo="1.13.2",$n={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{$n[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const ao={};$n.transitional=function(e,t,r){function s(i,o){return"[Axios v"+oo+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(e===!1)throw new L(s(o," has been removed"+(t?" in "+t:"")),L.ERR_DEPRECATED);return t&&!ao[o]&&(ao[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,a):!0}},$n.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function ou(n,e,t){if(typeof n!="object")throw new L("options must be an object",L.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let s=r.length;for(;s-- >0;){const i=r[s],o=e[i];if(o){const a=n[i],l=a===void 0||o(a,i,n);if(l!==!0)throw new L("option "+i+" must be "+l,L.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new L("Unknown option "+i,L.ERR_BAD_OPTION)}}const Nn={assertOptions:ou,validators:$n},tt=Nn.validators;let Ot=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ui,response:new Ui}}async request(e,t){try{return await this._request(e,t)}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(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Rt(this.defaults,t);const{transitional:r,paramsSerializer:s,headers:i}=t;r!==void 0&&Nn.assertOptions(r,{silentJSONParsing:tt.transitional(tt.boolean),forcedJSONParsing:tt.transitional(tt.boolean),clarifyTimeoutError:tt.transitional(tt.boolean)},!1),s!=null&&(y.isFunction(s)?t.paramsSerializer={serialize:s}:Nn.assertOptions(s,{encode:tt.function,serialize:tt.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Nn.assertOptions(t,{baseUrl:tt.spelling("baseURL"),withXsrfToken:tt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&y.merge(i.common,i[t.method]);i&&y.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),t.headers=De.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let u,d=0,g;if(!l){const f=[io.bind(this),void 0];for(f.unshift(...a),f.push(...c),g=f.length,u=Promise.resolve(t);d<g;)u=u.then(f[d++],f[d++]);return u}g=a.length;let h=t;for(;d<g;){const f=a[d++],m=a[d++];try{h=f(h)}catch(b){m.call(this,b);break}}try{u=io.call(this,h)}catch(f){return Promise.reject(f)}for(d=0,g=c.length;d<g;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=Rt(this.defaults,e);const t=Xi(e.baseURL,e.url,e.allowAbsoluteUrls);return ji(t,e.params,e.paramsSerializer)}};y.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(t,r){return this.request(Rt(r||{},{method:e,url:t,data:(r||{}).data}))}}),y.forEach(["post","put","patch"],function(e){function t(r){return function(i,o,a){return this.request(Rt(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Ot.prototype[e]=t(),Ot.prototype[e+"Form"]=t(!0)});let au=class Rl{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=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(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new Yt(i,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Rl(function(s){e=s}),cancel:e}}};function lu(n){return function(t){return n.apply(null,t)}}function cu(n){return y.isObject(n)&&n.isAxiosError===!0}const Xr={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(Xr).forEach(([n,e])=>{Xr[e]=n});function lo(n){const e=new Ot(n),t=Ti(Ot.prototype.request,e);return y.extend(t,Ot.prototype,e,{allOwnKeys:!0}),y.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return lo(Rt(n,s))},t}const pe=lo(an);pe.Axios=Ot,pe.CanceledError=Yt,pe.CancelToken=au,pe.isCancel=Hi,pe.VERSION=oo,pe.toFormData=On,pe.AxiosError=L,pe.Cancel=pe.CanceledError,pe.all=function(e){return Promise.all(e)},pe.spread=lu,pe.isAxiosError=cu,pe.mergeConfig=Rt,pe.AxiosHeaders=De,pe.formToJSON=n=>qi(y.isHTMLForm(n)?new FormData(n):n),pe.getAdapter=so.getAdapter,pe.HttpStatusCode=Xr,pe.default=pe;const{Axios:Np,AxiosError:Mp,CanceledError:Fp,isCancel:Lp,CancelToken:jp,VERSION:Up,all:zp,Cancel:qp,isAxiosError:Bp,spread:Hp,toFormData:Wp,AxiosHeaders:Vp,HttpStatusCode:Yp,formToJSON:Xp,getAdapter:Jp,mergeConfig:Zp}=pe,uu=(()=>{var t,r;if(typeof window>"u")return"https://api.robodialog.com";const n=document.currentScript;if((t=n==null?void 0:n.src)!=null&&t.includes("localhost")||(r=n==null?void 0:n.src)!=null&&r.includes("127.0.0.1"))return"http://localhost:4500";const e=document.getElementsByTagName("script");for(let s=0;s<e.length;s++){const i=e[s].src;if((i.includes("localhost")||i.includes("127.0.0.1"))&&(i.includes("robodialog")||i.includes("widget")))return"http://localhost:4500"}return"https://api.robodialog.com"})(),du="wss://realtime.robodialog.com/connection/websocket",co=`${uu}/api/v1`,Ie=pe.create({baseURL:co,headers:{"Content-Type":"application/json"}});function uo(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function hu(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}),t}function Pt(n){this._maxSize=n,this.clear()}Pt.prototype.clear=function(){this._size=0,this._values=Object.create(null)},Pt.prototype.get=function(n){return this._values[n]},Pt.prototype.set=function(n,e){return this._size>=this._maxSize&&this.clear(),n in this._values||this._size++,this._values[n]=e};var fu=/[^.^\]^[]+|(?=\[\]|\.\.)/g,ho=/^\d+$/,pu=/^\d/,gu=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,mu=/^\s*(['"]?)(.*?)(\1)\s*$/,Jr=512,fo=new Pt(Jr),po=new Pt(Jr),go=new Pt(Jr),Dt={Cache:Pt,split:Gr,normalizePath:Zr,setter:function(n){var e=Zr(n);return po.get(n)||po.set(n,function(r,s){for(var i=0,o=e.length,a=r;i<o-1;){var l=e[i];if(l==="__proto__"||l==="constructor"||l==="prototype")return r;a=a[e[i++]]}a[e[i]]=s})},getter:function(n,e){var t=Zr(n);return go.get(n)||go.set(n,function(s){for(var i=0,o=t.length;i<o;)if(s!=null||!e)s=s[t[i++]];else return;return s})},join:function(n){return n.reduce(function(e,t){return e+(Kr(t)||ho.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(n,e,t){bu(Array.isArray(n)?n:Gr(n),e,t)}};function Zr(n){return fo.get(n)||fo.set(n,Gr(n).map(function(e){return e.replace(mu,"$2")}))}function Gr(n){return n.match(fu)||[""]}function bu(n,e,t){var r=n.length,s,i,o,a;for(i=0;i<r;i++)s=n[i],s&&(yu(s)&&(s='"'+s+'"'),a=Kr(s),o=!a&&/^\d+$/.test(s),e.call(t,s,a,o,i,n))}function Kr(n){return typeof n=="string"&&n&&["'",'"'].indexOf(n.charAt(0))!==-1}function _u(n){return n.match(pu)&&!n.match(ho)}function vu(n){return gu.test(n)}function yu(n){return!Kr(n)&&(_u(n)||vu(n))}const xu=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,Mn=n=>n.match(xu)||[],Fn=n=>n[0].toUpperCase()+n.slice(1),Qr=(n,e)=>Mn(n).join(e).toLowerCase(),mo=n=>Mn(n).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");var es={words:Mn,upperFirst:Fn,camelCase:mo,pascalCase:n=>Fn(mo(n)),snakeCase:n=>Qr(n,"_"),kebabCase:n=>Qr(n,"-"),sentenceCase:n=>Fn(Qr(n," ")),titleCase:n=>Mn(n).map(Fn).join(" ")},ts={exports:{}};ts.exports=function(n){return bo(wu(n),n)},ts.exports.array=bo;function bo(n,e){var t=n.length,r=new Array(t),s={},i=t,o=ku(e),a=Tu(n);for(e.forEach(function(c){if(!a.has(c[0])||!a.has(c[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});i--;)s[i]||l(n[i],i,new Set);return r;function l(c,u,d){if(d.has(c)){var g;try{g=", node was:"+JSON.stringify(c)}catch{g=""}throw new Error("Cyclic dependency"+g)}if(!a.has(c))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(c));if(!s[u]){s[u]=!0;var h=o.get(c)||new Set;if(h=Array.from(h),u=h.length){d.add(c);do{var f=h[--u];l(f,a.get(f),d)}while(u);d.delete(c)}r[--t]=c}}}function wu(n){for(var e=new Set,t=0,r=n.length;t<r;t++){var s=n[t];e.add(s[0]),e.add(s[1])}return Array.from(e)}function ku(n){for(var e=new Map,t=0,r=n.length;t<r;t++){var s=n[t];e.has(s[0])||e.set(s[0],new Set),e.has(s[1])||e.set(s[1],new Set),e.get(s[0]).add(s[1])}return e}function Tu(n){for(var e=new Map,t=0,r=n.length;t<r;t++)e.set(n[t],t);return e}var Su=ts.exports;const Cu=uo(Su),Eu=Object.prototype.toString,Au=Error.prototype.toString,Ru=RegExp.prototype.toString,Ou=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Pu=/^Symbol\((.*)\)(.*)$/;function Du(n){return n!=+n?"NaN":n===0&&1/n<0?"-0":""+n}function _o(n,e=!1){if(n==null||n===!0||n===!1)return""+n;const t=typeof n;if(t==="number")return Du(n);if(t==="string")return e?`"${n}"`:n;if(t==="function")return"[Function "+(n.name||"anonymous")+"]";if(t==="symbol")return Ou.call(n).replace(Pu,"Symbol($1)");const r=Eu.call(n).slice(8,-1);return r==="Date"?isNaN(n.getTime())?""+n:n.toISOString(n):r==="Error"||n instanceof Error?"["+Au.call(n)+"]":r==="RegExp"?Ru.call(n):null}function ht(n,e){let t=_o(n,e);return t!==null?t:JSON.stringify(n,function(r,s){let i=_o(this[r],e);return i!==null?i:s},2)}function vo(n){return n==null?[]:[].concat(n)}let yo,xo,wo,Iu=/\$\{\s*(\w+)\s*\}/g;yo=Symbol.toStringTag;class ko{constructor(e,t,r,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[yo]="Error",this.name="ValidationError",this.value=t,this.path=r,this.type=s,this.errors=[],this.inner=[],vo(e).forEach(i=>{if(ve.isError(i)){this.errors.push(...i.errors);const o=i.inner.length?i.inner:[i];this.inner.push(...o)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}xo=Symbol.hasInstance,wo=Symbol.toStringTag;class ve extends Error{static formatError(e,t){const r=t.label||t.path||"this";return t=Object.assign({},t,{path:r,originalPath:t.path}),typeof e=="string"?e.replace(Iu,(s,i)=>ht(t[i])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,r,s,i){const o=new ko(e,t,r,s);if(i)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[wo]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,ve)}static[xo](e){return ko[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let nt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:n,type:e,value:t,originalValue:r})=>{const s=r!=null&&r!==t?` (cast from the value \`${ht(r,!0)}\`).`:".";return e!=="mixed"?`${n} must be a \`${e}\` type, but the final value was: \`${ht(t,!0)}\``+s:`${n} must match the configured type. The validated value was: \`${ht(t,!0)}\``+s}},$e={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},yt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},ns={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},rs={isValue:"${path} field must be ${value}"},Ln={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},jn={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"};Object.assign(Object.create(null),{mixed:nt,string:$e,number:yt,date:ns,object:Ln,array:jn,boolean:rs,tuple:{notType:n=>{const{path:e,value:t,spec:r}=n,s=r.types.length;if(Array.isArray(t)){if(t.length<s)return`${e} tuple value has too few items, expected a length of ${s} but got ${t.length} for value: \`${ht(t,!0)}\``;if(t.length>s)return`${e} tuple value has too many items, expected a length of ${s} but got ${t.length} for value: \`${ht(t,!0)}\``}return ve.formatError(nt.notType,n)}}});const Un=n=>n&&n.__isYupSchema__;class zn{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:s,otherwise:i}=t,o=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new zn(e,(a,l)=>{var c;let u=o(...a)?s:i;return(c=u==null?void 0:u(l))!=null?c:l})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let r=this.refs.map(i=>i.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),s=this.fn(r,e,t);if(s===void 0||s===e)return e;if(!Un(s))throw new TypeError("conditions must return a schema object");return s.resolve(t)}}const qn={context:"$",value:"."};class It{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===qn.context,this.isValue=this.key[0]===qn.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?qn.context:this.isValue?qn.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Dt.getter(this.path,!0),this.map=t.map}getValue(e,t,r){let s=this.isContext?r:this.isValue?e:t;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}It.prototype.__isYupRef=!0;const Ye=n=>n==null;function Xt(n){function e({value:t,path:r="",options:s,originalValue:i,schema:o},a,l){const{name:c,test:u,params:d,message:g,skipAbsent:h}=n;let{parent:f,context:m,abortEarly:b=o.spec.abortEarly,disableStackTrace:v=o.spec.disableStackTrace}=s;const x={value:t,parent:f,context:m};function w(E={}){const j=To(Object.assign({value:t,originalValue:i,label:o.spec.label,path:E.path||r,spec:o.spec,disableStackTrace:E.disableStackTrace||v},d,E.params),x),Z=new ve(ve.formatError(E.message||g,j),t,j.path,E.type||c,j.disableStackTrace);return Z.params=j,Z}const k=b?a:l;let _={path:r,parent:f,type:c,from:s.from,createError:w,resolve(E){return So(E,x)},options:s,originalValue:i,schema:o};const S=E=>{ve.isError(E)?k(E):E?l(null):k(w())},P=E=>{ve.isError(E)?k(E):a(E)};if(h&&Ye(t))return S(!0);let A;try{var D;if(A=u.call(_,t,_),typeof((D=A)==null?void 0:D.then)=="function"){if(s.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(A).then(S,P)}}catch(E){P(E);return}S(A)}return e.OPTIONS=n,e}function To(n,e){if(!n)return n;for(const t of Object.keys(n))n[t]=So(n[t],e);return n}function So(n,e){return It.isRef(n)?n.getValue(e.value,e.parent,e.context):n}function $u(n,e,t,r=t){let s,i,o;return e?(Dt.forEach(e,(a,l,c)=>{let u=l?a.slice(1,a.length-1):a;n=n.resolve({context:r,parent:s,value:t});let d=n.type==="tuple",g=c?parseInt(u,10):0;if(n.innerType||d){if(d&&!c)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(t&&g>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);s=t,t=t&&t[g],n=d?n.spec.types[g]:n.innerType}if(!c){if(!n.fields||!n.fields[u])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${o} which is a type: "${n.type}")`);s=t,t=t&&t[u],n=n.fields[u]}i=u,o=l?"["+a+"]":"."+a}),{schema:n,parent:s,parentPath:i}):{parent:s,parentPath:e,schema:n}}class Bn extends Set{describe(){const e=[];for(const t of this.values())e.push(It.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const r of this.values())t.push(e(r));return t}clone(){return new Bn(this.values())}merge(e,t){const r=this.clone();return e.forEach(s=>r.add(s)),t.forEach(s=>r.delete(s)),r}}function Jt(n,e=new Map){if(Un(n)||!n||typeof n!="object")return n;if(e.has(n))return e.get(n);let t;if(n instanceof Date)t=new Date(n.getTime()),e.set(n,t);else if(n instanceof RegExp)t=new RegExp(n),e.set(n,t);else if(Array.isArray(n)){t=new Array(n.length),e.set(n,t);for(let r=0;r<n.length;r++)t[r]=Jt(n[r],e)}else if(n instanceof Map){t=new Map,e.set(n,t);for(const[r,s]of n.entries())t.set(r,Jt(s,e))}else if(n instanceof Set){t=new Set,e.set(n,t);for(const r of n)t.add(Jt(r,e))}else if(n instanceof Object){t={},e.set(n,t);for(const[r,s]of Object.entries(n))t[r]=Jt(s,e)}else throw Error(`Unable to clone ${n}`);return t}function Nu(n){if(!(n!=null&&n.length))return;const e=[];let t="",r=!1,s=!1;for(let i=0;i<n.length;i++){const o=n[i];if(o==="["&&!s){t&&(e.push(...t.split(".").filter(Boolean)),t=""),r=!0;continue}if(o==="]"&&!s){t&&(/^\d+$/.test(t)?e.push(t):e.push(t.replace(/^"|"$/g,"")),t=""),r=!1;continue}if(o==='"'){s=!s;continue}if(o==="."&&!r&&!s){t&&(e.push(t),t="");continue}t+=o}return t&&e.push(...t.split(".").filter(Boolean)),e}function Mu(n,e){const t=e?`${e}.${n.path}`:n.path;return n.errors.map(r=>({message:r,path:Nu(t)}))}function Co(n,e){var t;if(!((t=n.inner)!=null&&t.length)&&n.errors.length)return Mu(n,e);const r=e?`${e}.${n.path}`:n.path;return n.inner.flatMap(s=>Co(s,r))}class Le{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Bn,this._blacklist=new Bn,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(nt.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=Jt(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=t,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,r=e.clone();const s=Object.assign({},t.spec,r.spec);return r.spec=s,r.internalTests=Object.assign({},t.internalTests,r.internalTests),r._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),r.tests=t.tests,r.exclusiveTests=t.exclusiveTests,r.withMutation(i=>{e.tests.forEach(o=>{i.test(o.OPTIONS)})}),r.transforms=[...t.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let r=t.conditions;t=t.clone(),t.conditions=[],t=r.reduce((s,i)=>i.resolve(s,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,r,s,i;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(s=e.recursive)!=null?s:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,t={}){let r=this.resolve(Object.assign({},t,{value:e})),s=t.assert==="ignore-optionality",i=r._cast(e,t);if(t.assert!==!1&&!r.isType(i)){if(s&&Ye(i))return i;let o=ht(e),a=ht(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
|
|
6
|
+
`+i):r.stack=i}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Rt(this.defaults,t);const{transitional:r,paramsSerializer:s,headers:i}=t;r!==void 0&&Nn.assertOptions(r,{silentJSONParsing:tt.transitional(tt.boolean),forcedJSONParsing:tt.transitional(tt.boolean),clarifyTimeoutError:tt.transitional(tt.boolean)},!1),s!=null&&(y.isFunction(s)?t.paramsSerializer={serialize:s}:Nn.assertOptions(s,{encode:tt.function,serialize:tt.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Nn.assertOptions(t,{baseUrl:tt.spelling("baseURL"),withXsrfToken:tt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&y.merge(i.common,i[t.method]);i&&y.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),t.headers=De.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let u,d=0,g;if(!l){const f=[io.bind(this),void 0];for(f.unshift(...a),f.push(...c),g=f.length,u=Promise.resolve(t);d<g;)u=u.then(f[d++],f[d++]);return u}g=a.length;let h=t;for(;d<g;){const f=a[d++],m=a[d++];try{h=f(h)}catch(b){m.call(this,b);break}}try{u=io.call(this,h)}catch(f){return Promise.reject(f)}for(d=0,g=c.length;d<g;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=Rt(this.defaults,e);const t=Xi(e.baseURL,e.url,e.allowAbsoluteUrls);return ji(t,e.params,e.paramsSerializer)}};y.forEach(["delete","get","head","options"],function(e){Ot.prototype[e]=function(t,r){return this.request(Rt(r||{},{method:e,url:t,data:(r||{}).data}))}}),y.forEach(["post","put","patch"],function(e){function t(r){return function(i,o,a){return this.request(Rt(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Ot.prototype[e]=t(),Ot.prototype[e+"Form"]=t(!0)});let au=class Rl{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=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(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new Yt(i,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Rl(function(s){e=s}),cancel:e}}};function lu(n){return function(t){return n.apply(null,t)}}function cu(n){return y.isObject(n)&&n.isAxiosError===!0}const Xr={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(Xr).forEach(([n,e])=>{Xr[e]=n});function lo(n){const e=new Ot(n),t=Ti(Ot.prototype.request,e);return y.extend(t,Ot.prototype,e,{allOwnKeys:!0}),y.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return lo(Rt(n,s))},t}const pe=lo(an);pe.Axios=Ot,pe.CanceledError=Yt,pe.CancelToken=au,pe.isCancel=Hi,pe.VERSION=oo,pe.toFormData=On,pe.AxiosError=L,pe.Cancel=pe.CanceledError,pe.all=function(e){return Promise.all(e)},pe.spread=lu,pe.isAxiosError=cu,pe.mergeConfig=Rt,pe.AxiosHeaders=De,pe.formToJSON=n=>qi(y.isHTMLForm(n)?new FormData(n):n),pe.getAdapter=so.getAdapter,pe.HttpStatusCode=Xr,pe.default=pe;const{Axios:Np,AxiosError:Mp,CanceledError:Fp,isCancel:Lp,CancelToken:jp,VERSION:Up,all:zp,Cancel:qp,isAxiosError:Bp,spread:Hp,toFormData:Wp,AxiosHeaders:Vp,HttpStatusCode:Yp,formToJSON:Xp,getAdapter:Jp,mergeConfig:Zp}=pe,uu="https://api.robodialog.com",du="wss://realtime.robodialog.com/connection/websocket",co=uu+"/api/v1",Ie=pe.create({baseURL:co,headers:{"Content-Type":"application/json"}});function uo(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function hu(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}),t}function Pt(n){this._maxSize=n,this.clear()}Pt.prototype.clear=function(){this._size=0,this._values=Object.create(null)},Pt.prototype.get=function(n){return this._values[n]},Pt.prototype.set=function(n,e){return this._size>=this._maxSize&&this.clear(),n in this._values||this._size++,this._values[n]=e};var fu=/[^.^\]^[]+|(?=\[\]|\.\.)/g,ho=/^\d+$/,pu=/^\d/,gu=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,mu=/^\s*(['"]?)(.*?)(\1)\s*$/,Jr=512,fo=new Pt(Jr),po=new Pt(Jr),go=new Pt(Jr),Dt={Cache:Pt,split:Gr,normalizePath:Zr,setter:function(n){var e=Zr(n);return po.get(n)||po.set(n,function(r,s){for(var i=0,o=e.length,a=r;i<o-1;){var l=e[i];if(l==="__proto__"||l==="constructor"||l==="prototype")return r;a=a[e[i++]]}a[e[i]]=s})},getter:function(n,e){var t=Zr(n);return go.get(n)||go.set(n,function(s){for(var i=0,o=t.length;i<o;)if(s!=null||!e)s=s[t[i++]];else return;return s})},join:function(n){return n.reduce(function(e,t){return e+(Kr(t)||ho.test(t)?"["+t+"]":(e?".":"")+t)},"")},forEach:function(n,e,t){bu(Array.isArray(n)?n:Gr(n),e,t)}};function Zr(n){return fo.get(n)||fo.set(n,Gr(n).map(function(e){return e.replace(mu,"$2")}))}function Gr(n){return n.match(fu)||[""]}function bu(n,e,t){var r=n.length,s,i,o,a;for(i=0;i<r;i++)s=n[i],s&&(yu(s)&&(s='"'+s+'"'),a=Kr(s),o=!a&&/^\d+$/.test(s),e.call(t,s,a,o,i,n))}function Kr(n){return typeof n=="string"&&n&&["'",'"'].indexOf(n.charAt(0))!==-1}function _u(n){return n.match(pu)&&!n.match(ho)}function vu(n){return gu.test(n)}function yu(n){return!Kr(n)&&(_u(n)||vu(n))}const xu=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,Mn=n=>n.match(xu)||[],Fn=n=>n[0].toUpperCase()+n.slice(1),Qr=(n,e)=>Mn(n).join(e).toLowerCase(),mo=n=>Mn(n).reduce((e,t)=>`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,"");var es={words:Mn,upperFirst:Fn,camelCase:mo,pascalCase:n=>Fn(mo(n)),snakeCase:n=>Qr(n,"_"),kebabCase:n=>Qr(n,"-"),sentenceCase:n=>Fn(Qr(n," ")),titleCase:n=>Mn(n).map(Fn).join(" ")},ts={exports:{}};ts.exports=function(n){return bo(wu(n),n)},ts.exports.array=bo;function bo(n,e){var t=n.length,r=new Array(t),s={},i=t,o=ku(e),a=Tu(n);for(e.forEach(function(c){if(!a.has(c[0])||!a.has(c[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});i--;)s[i]||l(n[i],i,new Set);return r;function l(c,u,d){if(d.has(c)){var g;try{g=", node was:"+JSON.stringify(c)}catch{g=""}throw new Error("Cyclic dependency"+g)}if(!a.has(c))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(c));if(!s[u]){s[u]=!0;var h=o.get(c)||new Set;if(h=Array.from(h),u=h.length){d.add(c);do{var f=h[--u];l(f,a.get(f),d)}while(u);d.delete(c)}r[--t]=c}}}function wu(n){for(var e=new Set,t=0,r=n.length;t<r;t++){var s=n[t];e.add(s[0]),e.add(s[1])}return Array.from(e)}function ku(n){for(var e=new Map,t=0,r=n.length;t<r;t++){var s=n[t];e.has(s[0])||e.set(s[0],new Set),e.has(s[1])||e.set(s[1],new Set),e.get(s[0]).add(s[1])}return e}function Tu(n){for(var e=new Map,t=0,r=n.length;t<r;t++)e.set(n[t],t);return e}var Su=ts.exports;const Cu=uo(Su),Eu=Object.prototype.toString,Au=Error.prototype.toString,Ru=RegExp.prototype.toString,Ou=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Pu=/^Symbol\((.*)\)(.*)$/;function Du(n){return n!=+n?"NaN":n===0&&1/n<0?"-0":""+n}function _o(n,e=!1){if(n==null||n===!0||n===!1)return""+n;const t=typeof n;if(t==="number")return Du(n);if(t==="string")return e?`"${n}"`:n;if(t==="function")return"[Function "+(n.name||"anonymous")+"]";if(t==="symbol")return Ou.call(n).replace(Pu,"Symbol($1)");const r=Eu.call(n).slice(8,-1);return r==="Date"?isNaN(n.getTime())?""+n:n.toISOString(n):r==="Error"||n instanceof Error?"["+Au.call(n)+"]":r==="RegExp"?Ru.call(n):null}function ht(n,e){let t=_o(n,e);return t!==null?t:JSON.stringify(n,function(r,s){let i=_o(this[r],e);return i!==null?i:s},2)}function vo(n){return n==null?[]:[].concat(n)}let yo,xo,wo,Iu=/\$\{\s*(\w+)\s*\}/g;yo=Symbol.toStringTag;class ko{constructor(e,t,r,s){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[yo]="Error",this.name="ValidationError",this.value=t,this.path=r,this.type=s,this.errors=[],this.inner=[],vo(e).forEach(i=>{if(ve.isError(i)){this.errors.push(...i.errors);const o=i.inner.length?i.inner:[i];this.inner.push(...o)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}xo=Symbol.hasInstance,wo=Symbol.toStringTag;class ve extends Error{static formatError(e,t){const r=t.label||t.path||"this";return t=Object.assign({},t,{path:r,originalPath:t.path}),typeof e=="string"?e.replace(Iu,(s,i)=>ht(t[i])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,r,s,i){const o=new ko(e,t,r,s);if(i)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[wo]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,ve)}static[xo](e){return ko[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let nt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:n,type:e,value:t,originalValue:r})=>{const s=r!=null&&r!==t?` (cast from the value \`${ht(r,!0)}\`).`:".";return e!=="mixed"?`${n} must be a \`${e}\` type, but the final value was: \`${ht(t,!0)}\``+s:`${n} must match the configured type. The validated value was: \`${ht(t,!0)}\``+s}},$e={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},yt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},ns={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},rs={isValue:"${path} field must be ${value}"},Ln={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},jn={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"};Object.assign(Object.create(null),{mixed:nt,string:$e,number:yt,date:ns,object:Ln,array:jn,boolean:rs,tuple:{notType:n=>{const{path:e,value:t,spec:r}=n,s=r.types.length;if(Array.isArray(t)){if(t.length<s)return`${e} tuple value has too few items, expected a length of ${s} but got ${t.length} for value: \`${ht(t,!0)}\``;if(t.length>s)return`${e} tuple value has too many items, expected a length of ${s} but got ${t.length} for value: \`${ht(t,!0)}\``}return ve.formatError(nt.notType,n)}}});const Un=n=>n&&n.__isYupSchema__;class zn{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:s,otherwise:i}=t,o=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new zn(e,(a,l)=>{var c;let u=o(...a)?s:i;return(c=u==null?void 0:u(l))!=null?c:l})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let r=this.refs.map(i=>i.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),s=this.fn(r,e,t);if(s===void 0||s===e)return e;if(!Un(s))throw new TypeError("conditions must return a schema object");return s.resolve(t)}}const qn={context:"$",value:"."};class It{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===qn.context,this.isValue=this.key[0]===qn.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?qn.context:this.isValue?qn.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Dt.getter(this.path,!0),this.map=t.map}getValue(e,t,r){let s=this.isContext?r:this.isValue?e:t;return this.getter&&(s=this.getter(s||{})),this.map&&(s=this.map(s)),s}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}It.prototype.__isYupRef=!0;const Ye=n=>n==null;function Xt(n){function e({value:t,path:r="",options:s,originalValue:i,schema:o},a,l){const{name:c,test:u,params:d,message:g,skipAbsent:h}=n;let{parent:f,context:m,abortEarly:b=o.spec.abortEarly,disableStackTrace:v=o.spec.disableStackTrace}=s;const x={value:t,parent:f,context:m};function w(E={}){const j=To(Object.assign({value:t,originalValue:i,label:o.spec.label,path:E.path||r,spec:o.spec,disableStackTrace:E.disableStackTrace||v},d,E.params),x),Z=new ve(ve.formatError(E.message||g,j),t,j.path,E.type||c,j.disableStackTrace);return Z.params=j,Z}const k=b?a:l;let _={path:r,parent:f,type:c,from:s.from,createError:w,resolve(E){return So(E,x)},options:s,originalValue:i,schema:o};const S=E=>{ve.isError(E)?k(E):E?l(null):k(w())},P=E=>{ve.isError(E)?k(E):a(E)};if(h&&Ye(t))return S(!0);let A;try{var D;if(A=u.call(_,t,_),typeof((D=A)==null?void 0:D.then)=="function"){if(s.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(A).then(S,P)}}catch(E){P(E);return}S(A)}return e.OPTIONS=n,e}function To(n,e){if(!n)return n;for(const t of Object.keys(n))n[t]=So(n[t],e);return n}function So(n,e){return It.isRef(n)?n.getValue(e.value,e.parent,e.context):n}function $u(n,e,t,r=t){let s,i,o;return e?(Dt.forEach(e,(a,l,c)=>{let u=l?a.slice(1,a.length-1):a;n=n.resolve({context:r,parent:s,value:t});let d=n.type==="tuple",g=c?parseInt(u,10):0;if(n.innerType||d){if(d&&!c)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(t&&g>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);s=t,t=t&&t[g],n=d?n.spec.types[g]:n.innerType}if(!c){if(!n.fields||!n.fields[u])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${o} which is a type: "${n.type}")`);s=t,t=t&&t[u],n=n.fields[u]}i=u,o=l?"["+a+"]":"."+a}),{schema:n,parent:s,parentPath:i}):{parent:s,parentPath:e,schema:n}}class Bn extends Set{describe(){const e=[];for(const t of this.values())e.push(It.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const r of this.values())t.push(e(r));return t}clone(){return new Bn(this.values())}merge(e,t){const r=this.clone();return e.forEach(s=>r.add(s)),t.forEach(s=>r.delete(s)),r}}function Jt(n,e=new Map){if(Un(n)||!n||typeof n!="object")return n;if(e.has(n))return e.get(n);let t;if(n instanceof Date)t=new Date(n.getTime()),e.set(n,t);else if(n instanceof RegExp)t=new RegExp(n),e.set(n,t);else if(Array.isArray(n)){t=new Array(n.length),e.set(n,t);for(let r=0;r<n.length;r++)t[r]=Jt(n[r],e)}else if(n instanceof Map){t=new Map,e.set(n,t);for(const[r,s]of n.entries())t.set(r,Jt(s,e))}else if(n instanceof Set){t=new Set,e.set(n,t);for(const r of n)t.add(Jt(r,e))}else if(n instanceof Object){t={},e.set(n,t);for(const[r,s]of Object.entries(n))t[r]=Jt(s,e)}else throw Error(`Unable to clone ${n}`);return t}function Nu(n){if(!(n!=null&&n.length))return;const e=[];let t="",r=!1,s=!1;for(let i=0;i<n.length;i++){const o=n[i];if(o==="["&&!s){t&&(e.push(...t.split(".").filter(Boolean)),t=""),r=!0;continue}if(o==="]"&&!s){t&&(/^\d+$/.test(t)?e.push(t):e.push(t.replace(/^"|"$/g,"")),t=""),r=!1;continue}if(o==='"'){s=!s;continue}if(o==="."&&!r&&!s){t&&(e.push(t),t="");continue}t+=o}return t&&e.push(...t.split(".").filter(Boolean)),e}function Mu(n,e){const t=e?`${e}.${n.path}`:n.path;return n.errors.map(r=>({message:r,path:Nu(t)}))}function Co(n,e){var t;if(!((t=n.inner)!=null&&t.length)&&n.errors.length)return Mu(n,e);const r=e?`${e}.${n.path}`:n.path;return n.inner.flatMap(s=>Co(s,r))}class Le{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Bn,this._blacklist=new Bn,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(nt.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=Jt(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=t,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,r=e.clone();const s=Object.assign({},t.spec,r.spec);return r.spec=s,r.internalTests=Object.assign({},t.internalTests,r.internalTests),r._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),r.tests=t.tests,r.exclusiveTests=t.exclusiveTests,r.withMutation(i=>{e.tests.forEach(o=>{i.test(o.OPTIONS)})}),r.transforms=[...t.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let r=t.conditions;t=t.clone(),t.conditions=[],t=r.reduce((s,i)=>i.resolve(s,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,r,s,i;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(s=e.recursive)!=null?s:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,t={}){let r=this.resolve(Object.assign({},t,{value:e})),s=t.assert==="ignore-optionality",i=r._cast(e,t);if(t.assert!==!1&&!r.isType(i)){if(s&&Ye(i))return i;let o=ht(e),a=ht(i);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
|
|
7
7
|
|
|
8
8
|
attempted value: ${o}
|
|
9
|
-
`+(a!==o?`result of cast: ${a}`:""))}return i}_cast(e,t){let r=e===void 0?e:this.transforms.reduce((s,i)=>i.call(this,s,e,this,t),e);return r===void 0&&(r=this.getDefault(t)),r}_validate(e,t={},r,s){let{path:i,originalValue:o=e,strict:a=this.spec.strict}=t,l=e;a||(l=this._cast(l,Object.assign({assert:!1},t)));let c=[];for(let u of Object.values(this.internalTests))u&&c.push(u);this.runTests({path:i,value:l,originalValue:o,options:t,tests:c},r,u=>{if(u.length)return s(u,l);this.runTests({path:i,value:l,originalValue:o,options:t,tests:this.tests},r,s)})}runTests(e,t,r){let s=!1,{tests:i,value:o,originalValue:a,path:l,options:c}=e,u=m=>{s||(s=!0,t(m,o))},d=m=>{s||(s=!0,r(m,o))},g=i.length,h=[];if(!g)return d([]);let f={value:o,originalValue:a,path:l,options:c,schema:this};for(let m=0;m<i.length;m++){const b=i[m];b(f,u,function(x){x&&(Array.isArray(x)?h.push(...x):h.push(x)),--g<=0&&d(h)})}}asNestedTest({key:e,index:t,parent:r,parentPath:s,originalParent:i,options:o}){const a=e??t;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let c=r[a];const u=Object.assign({},o,{strict:!0,parent:r,value:c,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${s||""}[${l?a:`"${a}"`}]`:(s?`${s}.`:"")+e});return(d,g,h)=>this.resolve(u)._validate(c,u,g,h)}validate(e,t){var r;let s=this.resolve(Object.assign({},t,{value:e})),i=(r=t==null?void 0:t.disableStackTrace)!=null?r:s.spec.disableStackTrace;return new Promise((o,a)=>s._validate(e,t,(l,c)=>{ve.isError(l)&&(l.value=c),a(l)},(l,c)=>{l.length?a(new ve(l,c,void 0,void 0,i)):o(c)}))}validateSync(e,t){var r;let s=this.resolve(Object.assign({},t,{value:e})),i,o=(r=t==null?void 0:t.disableStackTrace)!=null?r:s.spec.disableStackTrace;return s._validate(e,Object.assign({},t,{sync:!0}),(a,l)=>{throw ve.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new ve(a,e,void 0,void 0,o);i=l}),i}isValid(e,t){return this.validate(e,t).then(()=>!0,r=>{if(ve.isError(r))return!1;throw r})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(r){if(ve.isError(r))return!1;throw r}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):Jt(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const r=this.clone({nullable:e});return r.internalTests.nullable=Xt({message:t,name:"nullable",test(s){return s===null?this.schema.spec.nullable:!0}}),r}optionality(e,t){const r=this.clone({optional:e});return r.internalTests.optionality=Xt({message:t,name:"optionality",test(s){return s===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=nt.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=nt.notNull){return this.nullability(!1,e)}required(e=nt.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=nt.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),s=Xt(t),i=t.exclusive||t.name&&r.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(r.exclusiveTests[t.name]=!!t.exclusive),r.tests=r.tests.filter(o=>!(o.OPTIONS.name===t.name&&(i||o.OPTIONS.test===s.OPTIONS.test))),r.tests.push(s),r}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let r=this.clone(),s=vo(e).map(i=>new It(i));return s.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof t=="function"?new zn(s,t):zn.fromOptions(s,t)),r}typeError(e){let t=this.clone();return t.internalTests.typeError=Xt({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=nt.oneOf){let r=this.clone();return e.forEach(s=>{r._whitelist.add(s),r._blacklist.delete(s)}),r.internalTests.whiteList=Xt({message:t,name:"oneOf",skipAbsent:!0,test(s){let i=this.schema._whitelist,o=i.resolveAll(this.resolve);return o.includes(s)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:o}})}}),r}notOneOf(e,t=nt.notOneOf){let r=this.clone();return e.forEach(s=>{r._blacklist.add(s),r._whitelist.delete(s)}),r.internalTests.blacklist=Xt({message:t,name:"notOneOf",test(s){let i=this.schema._blacklist,o=i.resolveAll(this.resolve);return o.includes(s)?this.createError({params:{values:Array.from(i).join(", "),resolved:o}}):!0}}),r}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:r,meta:s,optional:i,nullable:o}=t.spec;return{meta:s,label:r,optional:i,nullable:o,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((l,c,u)=>u.findIndex(d=>d.OPTIONS.name===l.OPTIONS.name)===c).map(l=>{const c=l.OPTIONS.params&&e?To(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:c}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(s){if(s instanceof ve)return{issues:Co(s)};throw s}}}}}Le.prototype.__isYupSchema__=!0;for(const n of["validate","validateSync"])Le.prototype[`${n}At`]=function(e,t,r={}){const{parent:s,parentPath:i,schema:o}=$u(this,e,t,r.context);return o[n](s&&s[i],Object.assign({},r,{parent:s,path:e}))};for(const n of["equals","is"])Le.prototype[n]=Le.prototype.oneOf;for(const n of["not","nope"])Le.prototype[n]=Le.prototype.notOneOf;function ss(){return new Eo}class Eo extends Le{constructor(){super({type:"boolean",check(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e=="boolean"}}),this.withMutation(()=>{this.transform((e,t)=>{if(this.spec.coerce&&!this.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=rs.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(t){return Ye(t)||t===!0}})}isFalse(e=rs.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test(t){return Ye(t)||t===!1}})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}ss.prototype=Eo.prototype;const Fu=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Lu(n){const e=is(n);if(!e)return Date.parse?Date.parse(n):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function is(n){var e,t;const r=Fu.exec(n);return r?{year:ft(r[1]),month:ft(r[2],1)-1,day:ft(r[3],1),hour:ft(r[4]),minute:ft(r[5]),second:ft(r[6]),millisecond:r[7]?ft(r[7].substring(0,3)):0,precision:(e=(t=r[7])==null?void 0:t.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:ft(r[10]),minuteOffset:ft(r[11])}:null}function ft(n,e=0){return Number(n)||e}let ju=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Uu=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,zu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,qu="^\\d{4}-\\d{2}-\\d{2}",Bu="\\d{2}:\\d{2}:\\d{2}",Hu="(([+-]\\d{2}(:?\\d{2})?)|Z)",Wu=new RegExp(`${qu}T${Bu}(\\.\\d+)?${Hu}$`),Vu=n=>Ye(n)||n===n.trim(),Yu={}.toString();function Y(){return new Ao}class Ao extends Le{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===Yu?e:r})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||nt.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=$e.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,t=$e.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,t=$e.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,t){let r=!1,s,i;return t&&(typeof t=="object"?{excludeEmptyString:r=!1,message:s,name:i}=t:s=t),this.test({name:i||"matches",message:s||$e.matches,params:{regex:e},skipAbsent:!0,test:o=>o===""&&r||o.search(e)!==-1})}email(e=$e.email){return this.matches(ju,{name:"email",message:e,excludeEmptyString:!0})}url(e=$e.url){return this.matches(Uu,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=$e.uuid){return this.matches(zu,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",r,s;return e&&(typeof e=="object"?{message:t="",allowOffset:r=!1,precision:s=void 0}=e:t=e),this.matches(Wu,{name:"datetime",message:t||$e.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||$e.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const o=is(i);return o?!!o.z:!1}}).test({name:"datetime_precision",message:t||$e.datetime_precision,params:{precision:s},skipAbsent:!0,test:i=>{if(!i||s==null)return!0;const o=is(i);return o?o.precision===s:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=$e.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:Vu})}lowercase(e=$e.lowercase){return this.transform(t=>Ye(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ye(t)||t===t.toLowerCase()})}uppercase(e=$e.uppercase){return this.transform(t=>Ye(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ye(t)||t===t.toUpperCase()})}}Y.prototype=Ao.prototype;let Xu=n=>n!=+n;function cn(){return new Ro}class Ro extends Le{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!Xu(e)}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce)return e;let r=e;if(typeof r=="string"){if(r=r.replace(/\s/g,""),r==="")return NaN;r=+r}return this.isType(r)||r===null?r:parseFloat(r)})})}min(e,t=yt.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r>=this.resolve(e)}})}max(e,t=yt.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r<=this.resolve(e)}})}lessThan(e,t=yt.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(r){return r<this.resolve(e)}})}moreThan(e,t=yt.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(r){return r>this.resolve(e)}})}positive(e=yt.positive){return this.moreThan(0,e)}negative(e=yt.negative){return this.lessThan(0,e)}integer(e=yt.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Ye(e)?e:e|0)}round(e){var t;let r=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(r.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+r.join(", "));return this.transform(s=>Ye(s)?s:Math[e](s))}}cn.prototype=Ro.prototype;let Ju=new Date(""),Zu=n=>Object.prototype.toString.call(n)==="[object Date]";class os extends Le{constructor(){super({type:"date",check(e){return Zu(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Lu(e),isNaN(e)?os.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let r;if(It.isRef(e))r=e;else{let s=this.cast(e);if(!this._typeCheck(s))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);r=s}return r}min(e,t=ns.min){let r=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(r)}})}max(e,t=ns.max){let r=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(r)}})}}os.INVALID_DATE=Ju;function Gu(n,e=[]){let t=[],r=new Set,s=new Set(e.map(([o,a])=>`${o}-${a}`));function i(o,a){let l=Dt.split(o)[0];r.add(l),s.has(`${a}-${l}`)||t.push([a,l])}for(const o of Object.keys(n)){let a=n[o];r.add(o),It.isRef(a)&&a.isSibling?i(a.path,o):Un(a)&&"deps"in a&&a.deps.forEach(l=>i(l,o))}return Cu.array(Array.from(r),t).reverse()}function Oo(n,e){let t=1/0;return n.some((r,s)=>{var i;if((i=e.path)!=null&&i.includes(r))return t=s,!0}),t}function Po(n){return(e,t)=>Oo(n,e)-Oo(n,t)}const Do=(n,e,t)=>{if(typeof n!="string")return n;let r=n;try{r=JSON.parse(n)}catch{}return t.isType(r)?r:n};function Hn(n){if("fields"in n){const e={};for(const[t,r]of Object.entries(n.fields))e[t]=Hn(r);return n.setFields(e)}if(n.type==="array"){const e=n.optional();return e.innerType&&(e.innerType=Hn(e.innerType)),e}return n.type==="tuple"?n.optional().clone({types:n.spec.types.map(Hn)}):"optional"in n?n.optional():n}const Ku=(n,e)=>{const t=[...Dt.normalizePath(e)];if(t.length===1)return t[0]in n;let r=t.pop(),s=Dt.getter(Dt.join(t),!0)(n);return!!(s&&r in s)};let Io=n=>Object.prototype.toString.call(n)==="[object Object]";function $o(n,e){let t=Object.keys(n.fields);return Object.keys(e).filter(r=>t.indexOf(r)===-1)}const Qu=Po([]);function V(n){return new No(n)}class No extends Le{constructor(e){super({type:"object",check(t){return Io(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=Qu,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var r;let s=super._cast(e,t);if(s===void 0)return this.getDefault(t);if(!this._typeCheck(s))return s;let i=this.fields,o=(r=t.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(s).filter(d=>!this._nodes.includes(d))),l={},c=Object.assign({},t,{parent:l,__validating:t.__validating||!1}),u=!1;for(const d of a){let g=i[d],h=d in s,f=s[d];if(g){let m;c.path=(t.path?`${t.path}.`:"")+d,g=g.resolve({value:f,context:t.context,parent:l});let b=g instanceof Le?g.spec:void 0,v=b==null?void 0:b.strict;if(b!=null&&b.strip){u=u||d in s;continue}m=!t.__validating||!v?g.cast(f,c):f,m!==void 0&&(l[d]=m)}else h&&!o&&(l[d]=f);(h!==d in l||l[d]!==f)&&(u=!0)}return u?l:s}_validate(e,t={},r,s){let{from:i=[],originalValue:o=e,recursive:a=this.spec.recursive}=t;t.from=[{schema:this,value:o},...i],t.__validating=!0,t.originalValue=o,super._validate(e,t,r,(l,c)=>{if(!a||!Io(c)){s(l,c);return}o=o||c;let u=[];for(let d of this._nodes){let g=this.fields[d];!g||It.isRef(g)||u.push(g.asNestedTest({options:t,key:d,parent:c,parentPath:t.path,originalParent:o}))}this.runTests({tests:u,value:c,originalValue:o,options:t},r,d=>{s(d.sort(this._sortErrors).concat(l),c)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),r=t.fields;for(let[s,i]of Object.entries(this.fields)){const o=r[s];r[s]=o===void 0?i:o}return t.withMutation(s=>s.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(r=>{var s;const i=this.fields[r];let o=e;(s=o)!=null&&s.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[r]})),t[r]=i&&"getDefault"in i?i.getDefault(o):void 0}),t}setFields(e,t){let r=this.clone();return r.fields=e,r._nodes=Gu(e,t),r._sortErrors=Po(Object.keys(e)),t&&(r._excludedEdges=t),r}shape(e,t=[]){return this.clone().withMutation(r=>{let s=r._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),s=[...r._excludedEdges,...t]),r.setFields(Object.assign(r.fields,e),s)})}partial(){const e={};for(const[t,r]of Object.entries(this.fields))e[t]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Hn(this)}pick(e){const t={};for(const r of e)this.fields[r]&&(t[r]=this.fields[r]);return this.setFields(t,this._excludedEdges.filter(([r,s])=>e.includes(r)&&e.includes(s)))}omit(e){const t=[];for(const r of Object.keys(this.fields))e.includes(r)||t.push(r);return this.pick(t)}from(e,t,r){let s=Dt.getter(e,!0);return this.transform(i=>{if(!i)return i;let o=i;return Ku(i,e)&&(o=Object.assign({},i),r||delete o[e],o[t]=s(i)),o})}json(){return this.transform(Do)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Ln.exact,test(t){if(t==null)return!0;const r=$o(this.schema,t);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=Ln.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:t,test(s){if(s==null)return!0;const i=$o(this.schema,s);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,t=Ln.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const r={};for(const s of Object.keys(t))r[e(s)]=t[s];return r})}camelCase(){return this.transformKeys(es.camelCase)}snakeCase(){return this.transformKeys(es.snakeCase)}constantCase(){return this.transformKeys(e=>es.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,o]of Object.entries(t.fields)){var s;let a=e;(s=a)!=null&&s.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=o.describe(a)}return r}}V.prototype=No.prototype;function Wn(n){return new Mo(n)}class Mo extends Le{constructor(e){super({type:"array",spec:{types:e},check(t){return Array.isArray(t)}}),this.innerType=void 0,this.innerType=e}_cast(e,t){const r=super._cast(e,t);if(!this._typeCheck(r)||!this.innerType)return r;let s=!1;const i=r.map((o,a)=>{const l=this.innerType.cast(o,Object.assign({},t,{path:`${t.path||""}[${a}]`,parent:r,originalValue:o,value:o,index:a}));return l!==o&&(s=!0),l});return s?i:r}_validate(e,t={},r,s){var i;let o=this.innerType,a=(i=t.recursive)!=null?i:this.spec.recursive;t.originalValue!=null&&t.originalValue,super._validate(e,t,r,(l,c)=>{var u;if(!a||!o||!this._typeCheck(c)){s(l,c);return}let d=new Array(c.length);for(let h=0;h<c.length;h++){var g;d[h]=o.asNestedTest({options:t,index:h,parent:c,parentPath:t.path,originalParent:(g=t.originalValue)!=null?g:e})}this.runTests({value:c,tests:d,originalValue:(u=t.originalValue)!=null?u:e,options:t},r,h=>s(h.concat(l),c))})}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(Do)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!Un(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+ht(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=jn.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,t){return t=t||jn.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,t){return t=t||jn.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:t==null?[]:[].concat(t))}compact(e){let t=e?(r,s,i)=>!e(r,s,i):r=>!!r;return this.transform(r=>r!=null?r.filter(t):r)}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);if(t.innerType){var s;let i=e;(s=i)!=null&&s.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[0]})),r.innerType=t.innerType.describe(i)}return r}}Wn.prototype=Mo.prototype;const ge=(n,e=[])=>t=>{const r=t?Object.keys(t).filter(s=>!n.includes(s)&&!e.includes(s)):[];if(r.length>0)throw new ve(`Unknown properties: ${r.join(", ")}`,t,"custom-validation");return!0},ed=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",n=>ge(["id"],[])(n))}),td=V().shape({body:V().shape({userId:Y().trim().min(1,"User Id must be at least 1 character").max(1e3,"User Id cannot exceed 1000 characters").required("User Id is required"),visitor:ss().required("Visitor is required"),chatbotId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Chatbot Id").required("Chatbot Id is required")}).test("custom-validation","Custom validation failed",ge(["userId","visitor","chatbotId"]))}),Fo={readById:async n=>{await ed.validate({params:n.params},{abortEarly:!1});const{data:e}=await Ie.get(`/live/readById/${n.params.id}`);return e},generateToken:async n=>{await td.validate({body:n.body},{abortEarly:!1});const{data:e}=await Ie.post("/live/generateToken",n.body);return e}},nd=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),rd=V().shape({query:V().shape({skip:Y().trim().min(1,"Skip must be at least 1 character").max(1e4,"Skip cannot exceed 10000 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["skip"]))}),sd=V().shape({body:V().shape({currentNode:Y().trim().min(1,"Current Node must be at least 1 character").max(1e3,"Current Node cannot exceed 1000 characters").required("Current Node is required")}).test("custom-validation","Custom validation failed",ge(["currentNode"])),params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),id=V().shape({body:V().shape({assignType:Y().oneOf(["role","teamMember","everyone"]).required("Assign Type is required"),assignTo:Y().when("assignType",{is:"role",then:n=>n.min(1,"Role must be at least 1 character").max(500,"Role cannot exceed 500 characters").required("Role is required")}).when("assignType",{is:"teamMember",then:n=>n.trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Member Id").required("Member Id is required")}).when("assignType",{is:"everyone",then:n=>n.nullable()})}).test("custom-validation","Custom validation failed",ge(["assignType","assignTo"])),params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),od=V().shape({body:V().shape({chatflow:V().shape({key:Y().max(1e3,"Key cannot exceed 1000 characters").optional(),index:cn().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional(),nodeId:Y().trim().min(1,"Node ID must be at least 1 character").max(1e3,"Node ID cannot exceed 1000 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["chatflow","nodeId"]))}),$t={userRead:async(n,e)=>{await nd.validate({params:n.params},{abortEarly:!1});const{data:t}=await Ie.get(`/conversation/user/read/${n.params.id}`,{headers:{Authorization:`Bearer ${e}`}});return t},userReadAll:async(n,e)=>{await rd.validate({query:e==null?void 0:e.query},{abortEarly:!1});const{data:t}=await Ie.get("/conversation/user/readAll",{params:e==null?void 0:e.query,headers:{Authorization:`Bearer ${n}`}});return t},userUpdateCurrentNode:async(n,e)=>{await sd.validate({params:n.params,body:n.body},{abortEarly:!1});const{data:t}=await Ie.post(`/conversation/user/update/currentNode/${n.params.id}`,n.body,{headers:{Authorization:`Bearer ${e}`}});return t},userAssignToAgent:async(n,e)=>{await id.validate({params:n.params,body:n.body},{abortEarly:!1});const{data:t}=await Ie.post(`/conversation/user/update/assign/${n.params.id}`,n.body,{headers:{Authorization:`Bearer ${e}`}});return t},userCreate:async(n,e)=>{await od.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/conversation/user/create",n.body,{headers:{Authorization:`Bearer ${e}`}});return t}},ad=({className:n,style:e={}})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 256 256",className:n,style:e,children:p("path",{fill:"currentColor",d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})}),un=({className:n,width:e=16,height:t=16})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"})}),Zt=({className:n})=>p("svg",{width:"100%",height:"100%",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",className:n,children:p("path",{fill:"currentColor",d:"M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9964 9.5533 24.6256 6.24882 22.1884 3.81163C19.7512 1.37445 16.4467 0.00363977 13 0Z"})}),Lo=({className:n})=>p("svg",{width:"11",height:"6",viewBox:"0 0 11 6",xmlns:"http://www.w3.org/2000/svg",className:n,children:p("path",{fill:"currentColor",d:"M10.7884 1.18378L6.00738 5.79649C5.94076 5.861 5.86159 5.91218 5.77442 5.9471C5.68725 5.98202 5.59379 6 5.4994 6C5.40501 6 5.31156 5.98202 5.22438 5.9471C5.13721 5.91218 5.05805 5.861 4.99142 5.79649L0.210413 1.18378C0.0756879 1.0538 0 0.877507 0 0.693683C0 0.50986 0.0756879 0.333566 0.210413 0.203583C0.345138 0.0736001 0.527865 0.000576714 0.718395 0.000576712C0.908925 0.00057671 1.09165 0.0736001 1.22638 0.203583L5.5 4.32677L9.77362 0.203007C9.90835 0.0730239 10.0911 0 10.2816 0C10.4721 0 10.6549 0.0730239 10.7896 0.203007C10.9243 0.332989 11 0.509284 11 0.693107C11 0.87693 10.9243 1.05322 10.7896 1.18321Z"})}),ld=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"})}),jo=({className:n,width:e=32,height:t=32})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})}),cd=({className:n,width:e=32})=>p("svg",{width:e,height:e*2,viewBox:"0 0 9 14",xmlns:"http://www.w3.org/2000/svg",className:n,children:[p("circle",{cx:"6.99929",cy:"1.27273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"1.27273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"6.99929",cy:"7.00002",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"7.00002",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"6.99929",cy:"12.7273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"12.7273",r:"1.27273",fill:"currentColor"})]}),ud=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M231.87,114l-168-95.89A16,16,0,0,0,40.92,37.34L71.55,128,40.92,218.67A16,16,0,0,0,56,240a16.15,16.15,0,0,0,7.93-2.1l167.92-96.05a16,16,0,0,0,.05-27.89ZM56,224a.56.56,0,0,0,0-.12L85.74,136H144a8,8,0,0,0,0-16H85.74L56.06,32.16A.46.46,0,0,0,56,32l168,95.83Z"})}),dd=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"})}),hd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAAAxCAYAAAB+gjFbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALhSURBVHgB7ZlNbtpAFMf/MxC1qySIdNFVnRtwg5ATlJygdNdFCuYEgRPEVN2HnqD0BNAbJCeId13kA6SuKjUzfW8MgQbHGJi09ig/aWQbxpJ/fvPlNwLrcnxVhZAVSHFAVxUqu5OyKaEpWl1AYYjizyGC/THWQKxU27/chdpuQggfdkRSonu4U1/w+dVwlbvSybGU3j6h6j7+L0OIX+8RvA7TVF4u9/HKhyyQ2L+M1DJ0gG65taxWslzz5jQD0XqMkKJ4mBTFeDnTDHe+0lkV2SZRUMbeoncGyL4Y40G/GMD/4cX9uShnmqIZ2vPCRHC0MCb8Ledf1zPcx5IgQX328MdZn+PQ8hvginlFqCMEe/3p5SxyaquNPIsxWp7ON89IjqMm5DvkH49WMvXpRSQXRc0NpLgPUiQn5AHcoQKfFvVguWNz4sEllKzxQULKKlxDmM8wbpY6TxN2WoyTpP72Bi7yYeTxgOLBRV7CyGXoO80uEg7zLJdXnuXyii05ymWIQyr75qh0Cxrf6ffkZCrX0bpL9xzd3wucwxICzVuNTeEH/FSO/4L3R7xa8KBUtBKSMkQkECIoLcrzolcXBtgUelFF2OHxCAUlFuHSRyr0WqnzOOw0S5tLuN/SgyUs9Tldi8s+rYVEDZawNaBQEledYFOinSNr6Q6LUwGlBBuj9R+M8ziFwhnscW53nhO01dS4WT2CHDG7aUUzEtufxIVo0/RyOUlfJMPRalz3KGJ286UaF3ywNRU8xDMP3LzlHdJvNKn3qYyh7sYoblXoBXiUpXpLD1FdcfszHVqZacfOJJ41eLUTlEIH15aix2J85p6cQGd66pjcLGqMS3LhfNQYd+SEas1HjXFDTujO/L7clPzLGbFyO+6vfMsliDFPtUJ5asZRH9vrJVXKnxznXaSok1i4rGp+5CKpNrqlYdpbsi1nhPSQhoY+Sa2cFStS5qqDrKCpLxUkJ4ii7Fi3tFGy6A+7st8LQyzi5QAAAABJRU5ErkJggg==",as=n=>{const e=new Date(n);if(Number.isNaN(e.getTime()))return"Invalid date";const r=new Date().getTime()-e.getTime();if(r<0)return"in the future";const s=Math.floor(r/1e3),i=Math.floor(s/60),o=Math.floor(i/60),a=Math.floor(o/24),l=Math.floor(a/30),c=Math.floor(l/12);let d=[{limit:60*1e3,label:"just now"},{limit:60*60*1e3,label:`${i} minute${i!==1?"s":""}`},{limit:24*60*60*1e3,label:`${o} hour${o!==1?"s":""}`},{limit:30*24*60*60*1e3,label:`${a} day${a!==1?"s":""}`}].find(g=>r<g.limit);return d?d.label:l>0?`${l} month${l!==1?"s":""} ago`:`${c} year${c!==1?"s":""} ago`},fd=V().shape({name:Y().min(1,"Name must be at least 1 character").max(1e3,"Name cannot exceed 1000 characters").required("Name is required"),url:Y().min(1,"URL must be at least 1 character").max(1e3,"URL cannot exceed 1000 characters").required("URL is required")}).test("custom-validation","Custom validation failed",ge(["name","url"])),pd=V().shape({text:Y().min(1,"Text must be at least 1 character").max(1e3,"Text cannot exceed 1000 characters").optional(),file:fd.when("text",{is:n=>!n,then:n=>n.required(),otherwise:n=>n.strip()})}).test("text-or-file","Either 'text' or 'file' must be provided",function(n){const{text:e,file:t}=n;return!e&&!t?this.createError({path:"data",message:"Either 'text' or 'file' must be provided"}):!0}).test("custom-validation","Custom validation failed",ge([],["text","file"])),gd=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"]))}),md=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),skip:cn().min(0,"Skip must be at least 0").max(1e4,"Skip cannot exceed 10000").optional()}).test("custom-validation","Custom validation failed",ge(["conversationId"],["skip"]))}),Uo=V().shape({body:V().shape({owner:Y().oneOf(["ai","user"]).required("Owner must be 'ai' or 'user'"),conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),type:Y().oneOf(["AI Text","Human Text","External API","External API Text","AI Response"]).required("Type is required"),data:pd.required("Message data is required"),currentChatflow:V().shape({key:Y().max(1e3,"Key cannot exceed 1000 characters").optional(),index:cn().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional()}).test("custom-validation","Custom validation failed",ge(["owner","conversationId","type","data"],["currentChatflow"]))}),bd=V().shape({body:V().shape({queries:Wn().of(Y().min(1,"Query must be at least 1 character").max(1e3,"Query cannot exceed 1000 characters")).max(200,"Queries cannot exceed 200 items").optional(),conversationHistory:Wn().of(V().shape({user:Y().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:Y().min(1,"AI message must be at least 1 character").max(1e3,"AI message cannot exceed 1000 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["user","ai"]))).min(1,"Conversation history must have at least 1 entry").max(3,"Conversation history cannot exceed 3 entries").required("Conversation history is required")}).test("custom-validation","Custom validation failed",ge(["queries","conversationHistory"]))}),_d=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),conversationHistory:Wn().of(V().shape({user:Y().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:Y().min(1,"AI message must be at least 1 character").max(2500,"AI message cannot exceed 2500 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["user","ai"]))).min(1,"Conversation history must have at least 1 entry").max(8,"Conversation history cannot exceed 8 entries").required("Conversation history is required"),enableStreaming:ss().optional()}).test("custom-validation","Custom validation failed",ge(["conversationId","conversationHistory"],["enableStreaming"]))}),ls={userReadAll:async(n,e)=>{await md.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/readAll",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userUpdateSeen:async(n,e)=>{await gd.validate({params:n.params},{abortEarly:!1});const{data:t}=await Ie.post(`/message/user/update/seen/${n.params.id}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userCreate:async(n,e)=>{await Uo.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/create",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userAIContextMessage:async(n,e)=>{await _d.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/ai/message",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userAICheckQueries:async(n,e)=>{await bd.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/ai/checkQueries",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t}},vd={userUploadAsset:async(n,e)=>{const t=new FormData;t.append("file",n);const{data:r}=await Ie.post("/asset/userUpload",t,{headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e}`}});return r}};V().shape({rating:Y().trim().min(1).max(1),skip:Y().trim().min(1).max(1e3),limit:Y().trim().min(1).max(1e3)}).test("custom-validation","Custom validation failed",ge([],["rating","skip","limit"]));const yd=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Conversation Id is required"),chatbotId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Chatbot Id is required"),comment:Y().trim().max(500).min(3).required("Comment is required"),rating:cn().max(5).min(1).required("Rating is required")}).test("custom-validation","Custom validation failed",ge(["conversationId","chatbotId","comment","rating"]))}),xd={userCreate:async(n,e)=>{await yd.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/review/user/create",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t}};class wd{constructor(){this.buffer="",this.eventType=null,this.eventData=""}async parseStream(e,t,r){const s=e.body.getReader(),i=new TextDecoder;try{for(;;){const{done:o,value:a}=await s.read();if(o)break;this.buffer+=i.decode(a,{stream:!0}),this.processBuffer(t)}this.buffer.trim()&&this.processBuffer(t),t({type:"done",data:{}})}catch(o){console.error("SSE parsing failed:",o),r(o instanceof Error?o:new Error("Stream parsing failed"))}}processBuffer(e){const t=this.buffer.split(`
|
|
9
|
+
`+(a!==o?`result of cast: ${a}`:""))}return i}_cast(e,t){let r=e===void 0?e:this.transforms.reduce((s,i)=>i.call(this,s,e,this,t),e);return r===void 0&&(r=this.getDefault(t)),r}_validate(e,t={},r,s){let{path:i,originalValue:o=e,strict:a=this.spec.strict}=t,l=e;a||(l=this._cast(l,Object.assign({assert:!1},t)));let c=[];for(let u of Object.values(this.internalTests))u&&c.push(u);this.runTests({path:i,value:l,originalValue:o,options:t,tests:c},r,u=>{if(u.length)return s(u,l);this.runTests({path:i,value:l,originalValue:o,options:t,tests:this.tests},r,s)})}runTests(e,t,r){let s=!1,{tests:i,value:o,originalValue:a,path:l,options:c}=e,u=m=>{s||(s=!0,t(m,o))},d=m=>{s||(s=!0,r(m,o))},g=i.length,h=[];if(!g)return d([]);let f={value:o,originalValue:a,path:l,options:c,schema:this};for(let m=0;m<i.length;m++){const b=i[m];b(f,u,function(x){x&&(Array.isArray(x)?h.push(...x):h.push(x)),--g<=0&&d(h)})}}asNestedTest({key:e,index:t,parent:r,parentPath:s,originalParent:i,options:o}){const a=e??t;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let c=r[a];const u=Object.assign({},o,{strict:!0,parent:r,value:c,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${s||""}[${l?a:`"${a}"`}]`:(s?`${s}.`:"")+e});return(d,g,h)=>this.resolve(u)._validate(c,u,g,h)}validate(e,t){var r;let s=this.resolve(Object.assign({},t,{value:e})),i=(r=t==null?void 0:t.disableStackTrace)!=null?r:s.spec.disableStackTrace;return new Promise((o,a)=>s._validate(e,t,(l,c)=>{ve.isError(l)&&(l.value=c),a(l)},(l,c)=>{l.length?a(new ve(l,c,void 0,void 0,i)):o(c)}))}validateSync(e,t){var r;let s=this.resolve(Object.assign({},t,{value:e})),i,o=(r=t==null?void 0:t.disableStackTrace)!=null?r:s.spec.disableStackTrace;return s._validate(e,Object.assign({},t,{sync:!0}),(a,l)=>{throw ve.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new ve(a,e,void 0,void 0,o);i=l}),i}isValid(e,t){return this.validate(e,t).then(()=>!0,r=>{if(ve.isError(r))return!1;throw r})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(r){if(ve.isError(r))return!1;throw r}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):Jt(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const r=this.clone({nullable:e});return r.internalTests.nullable=Xt({message:t,name:"nullable",test(s){return s===null?this.schema.spec.nullable:!0}}),r}optionality(e,t){const r=this.clone({optional:e});return r.internalTests.optionality=Xt({message:t,name:"optionality",test(s){return s===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=nt.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=nt.notNull){return this.nullability(!1,e)}required(e=nt.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=nt.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),s=Xt(t),i=t.exclusive||t.name&&r.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(r.exclusiveTests[t.name]=!!t.exclusive),r.tests=r.tests.filter(o=>!(o.OPTIONS.name===t.name&&(i||o.OPTIONS.test===s.OPTIONS.test))),r.tests.push(s),r}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let r=this.clone(),s=vo(e).map(i=>new It(i));return s.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof t=="function"?new zn(s,t):zn.fromOptions(s,t)),r}typeError(e){let t=this.clone();return t.internalTests.typeError=Xt({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=nt.oneOf){let r=this.clone();return e.forEach(s=>{r._whitelist.add(s),r._blacklist.delete(s)}),r.internalTests.whiteList=Xt({message:t,name:"oneOf",skipAbsent:!0,test(s){let i=this.schema._whitelist,o=i.resolveAll(this.resolve);return o.includes(s)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:o}})}}),r}notOneOf(e,t=nt.notOneOf){let r=this.clone();return e.forEach(s=>{r._blacklist.add(s),r._whitelist.delete(s)}),r.internalTests.blacklist=Xt({message:t,name:"notOneOf",test(s){let i=this.schema._blacklist,o=i.resolveAll(this.resolve);return o.includes(s)?this.createError({params:{values:Array.from(i).join(", "),resolved:o}}):!0}}),r}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:r,meta:s,optional:i,nullable:o}=t.spec;return{meta:s,label:r,optional:i,nullable:o,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.filter((l,c,u)=>u.findIndex(d=>d.OPTIONS.name===l.OPTIONS.name)===c).map(l=>{const c=l.OPTIONS.params&&e?To(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:c}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(s){if(s instanceof ve)return{issues:Co(s)};throw s}}}}}Le.prototype.__isYupSchema__=!0;for(const n of["validate","validateSync"])Le.prototype[`${n}At`]=function(e,t,r={}){const{parent:s,parentPath:i,schema:o}=$u(this,e,t,r.context);return o[n](s&&s[i],Object.assign({},r,{parent:s,path:e}))};for(const n of["equals","is"])Le.prototype[n]=Le.prototype.oneOf;for(const n of["not","nope"])Le.prototype[n]=Le.prototype.notOneOf;function ss(){return new Eo}class Eo extends Le{constructor(){super({type:"boolean",check(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e=="boolean"}}),this.withMutation(()=>{this.transform((e,t)=>{if(this.spec.coerce&&!this.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=rs.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(t){return Ye(t)||t===!0}})}isFalse(e=rs.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test(t){return Ye(t)||t===!1}})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}ss.prototype=Eo.prototype;const Fu=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Lu(n){const e=is(n);if(!e)return Date.parse?Date.parse(n):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function is(n){var e,t;const r=Fu.exec(n);return r?{year:ft(r[1]),month:ft(r[2],1)-1,day:ft(r[3],1),hour:ft(r[4]),minute:ft(r[5]),second:ft(r[6]),millisecond:r[7]?ft(r[7].substring(0,3)):0,precision:(e=(t=r[7])==null?void 0:t.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:ft(r[10]),minuteOffset:ft(r[11])}:null}function ft(n,e=0){return Number(n)||e}let ju=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Uu=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,zu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,qu="^\\d{4}-\\d{2}-\\d{2}",Bu="\\d{2}:\\d{2}:\\d{2}",Hu="(([+-]\\d{2}(:?\\d{2})?)|Z)",Wu=new RegExp(`${qu}T${Bu}(\\.\\d+)?${Hu}$`),Vu=n=>Ye(n)||n===n.trim(),Yu={}.toString();function Y(){return new Ao}class Ao extends Le{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===Yu?e:r})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||nt.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=$e.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,t=$e.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,t=$e.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,t){let r=!1,s,i;return t&&(typeof t=="object"?{excludeEmptyString:r=!1,message:s,name:i}=t:s=t),this.test({name:i||"matches",message:s||$e.matches,params:{regex:e},skipAbsent:!0,test:o=>o===""&&r||o.search(e)!==-1})}email(e=$e.email){return this.matches(ju,{name:"email",message:e,excludeEmptyString:!0})}url(e=$e.url){return this.matches(Uu,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=$e.uuid){return this.matches(zu,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",r,s;return e&&(typeof e=="object"?{message:t="",allowOffset:r=!1,precision:s=void 0}=e:t=e),this.matches(Wu,{name:"datetime",message:t||$e.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||$e.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const o=is(i);return o?!!o.z:!1}}).test({name:"datetime_precision",message:t||$e.datetime_precision,params:{precision:s},skipAbsent:!0,test:i=>{if(!i||s==null)return!0;const o=is(i);return o?o.precision===s:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=$e.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:Vu})}lowercase(e=$e.lowercase){return this.transform(t=>Ye(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ye(t)||t===t.toLowerCase()})}uppercase(e=$e.uppercase){return this.transform(t=>Ye(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ye(t)||t===t.toUpperCase()})}}Y.prototype=Ao.prototype;let Xu=n=>n!=+n;function cn(){return new Ro}class Ro extends Le{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!Xu(e)}}),this.withMutation(()=>{this.transform((e,t)=>{if(!this.spec.coerce)return e;let r=e;if(typeof r=="string"){if(r=r.replace(/\s/g,""),r==="")return NaN;r=+r}return this.isType(r)||r===null?r:parseFloat(r)})})}min(e,t=yt.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r>=this.resolve(e)}})}max(e,t=yt.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r<=this.resolve(e)}})}lessThan(e,t=yt.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(r){return r<this.resolve(e)}})}moreThan(e,t=yt.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(r){return r>this.resolve(e)}})}positive(e=yt.positive){return this.moreThan(0,e)}negative(e=yt.negative){return this.lessThan(0,e)}integer(e=yt.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Ye(e)?e:e|0)}round(e){var t;let r=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(r.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+r.join(", "));return this.transform(s=>Ye(s)?s:Math[e](s))}}cn.prototype=Ro.prototype;let Ju=new Date(""),Zu=n=>Object.prototype.toString.call(n)==="[object Date]";class os extends Le{constructor(){super({type:"date",check(e){return Zu(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Lu(e),isNaN(e)?os.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let r;if(It.isRef(e))r=e;else{let s=this.cast(e);if(!this._typeCheck(s))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);r=s}return r}min(e,t=ns.min){let r=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(r)}})}max(e,t=ns.max){let r=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(r)}})}}os.INVALID_DATE=Ju;function Gu(n,e=[]){let t=[],r=new Set,s=new Set(e.map(([o,a])=>`${o}-${a}`));function i(o,a){let l=Dt.split(o)[0];r.add(l),s.has(`${a}-${l}`)||t.push([a,l])}for(const o of Object.keys(n)){let a=n[o];r.add(o),It.isRef(a)&&a.isSibling?i(a.path,o):Un(a)&&"deps"in a&&a.deps.forEach(l=>i(l,o))}return Cu.array(Array.from(r),t).reverse()}function Oo(n,e){let t=1/0;return n.some((r,s)=>{var i;if((i=e.path)!=null&&i.includes(r))return t=s,!0}),t}function Po(n){return(e,t)=>Oo(n,e)-Oo(n,t)}const Do=(n,e,t)=>{if(typeof n!="string")return n;let r=n;try{r=JSON.parse(n)}catch{}return t.isType(r)?r:n};function Hn(n){if("fields"in n){const e={};for(const[t,r]of Object.entries(n.fields))e[t]=Hn(r);return n.setFields(e)}if(n.type==="array"){const e=n.optional();return e.innerType&&(e.innerType=Hn(e.innerType)),e}return n.type==="tuple"?n.optional().clone({types:n.spec.types.map(Hn)}):"optional"in n?n.optional():n}const Ku=(n,e)=>{const t=[...Dt.normalizePath(e)];if(t.length===1)return t[0]in n;let r=t.pop(),s=Dt.getter(Dt.join(t),!0)(n);return!!(s&&r in s)};let Io=n=>Object.prototype.toString.call(n)==="[object Object]";function $o(n,e){let t=Object.keys(n.fields);return Object.keys(e).filter(r=>t.indexOf(r)===-1)}const Qu=Po([]);function V(n){return new No(n)}class No extends Le{constructor(e){super({type:"object",check(t){return Io(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=Qu,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var r;let s=super._cast(e,t);if(s===void 0)return this.getDefault(t);if(!this._typeCheck(s))return s;let i=this.fields,o=(r=t.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(s).filter(d=>!this._nodes.includes(d))),l={},c=Object.assign({},t,{parent:l,__validating:t.__validating||!1}),u=!1;for(const d of a){let g=i[d],h=d in s,f=s[d];if(g){let m;c.path=(t.path?`${t.path}.`:"")+d,g=g.resolve({value:f,context:t.context,parent:l});let b=g instanceof Le?g.spec:void 0,v=b==null?void 0:b.strict;if(b!=null&&b.strip){u=u||d in s;continue}m=!t.__validating||!v?g.cast(f,c):f,m!==void 0&&(l[d]=m)}else h&&!o&&(l[d]=f);(h!==d in l||l[d]!==f)&&(u=!0)}return u?l:s}_validate(e,t={},r,s){let{from:i=[],originalValue:o=e,recursive:a=this.spec.recursive}=t;t.from=[{schema:this,value:o},...i],t.__validating=!0,t.originalValue=o,super._validate(e,t,r,(l,c)=>{if(!a||!Io(c)){s(l,c);return}o=o||c;let u=[];for(let d of this._nodes){let g=this.fields[d];!g||It.isRef(g)||u.push(g.asNestedTest({options:t,key:d,parent:c,parentPath:t.path,originalParent:o}))}this.runTests({tests:u,value:c,originalValue:o,options:t},r,d=>{s(d.sort(this._sortErrors).concat(l),c)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),r=t.fields;for(let[s,i]of Object.entries(this.fields)){const o=r[s];r[s]=o===void 0?i:o}return t.withMutation(s=>s.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(r=>{var s;const i=this.fields[r];let o=e;(s=o)!=null&&s.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[r]})),t[r]=i&&"getDefault"in i?i.getDefault(o):void 0}),t}setFields(e,t){let r=this.clone();return r.fields=e,r._nodes=Gu(e,t),r._sortErrors=Po(Object.keys(e)),t&&(r._excludedEdges=t),r}shape(e,t=[]){return this.clone().withMutation(r=>{let s=r._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),s=[...r._excludedEdges,...t]),r.setFields(Object.assign(r.fields,e),s)})}partial(){const e={};for(const[t,r]of Object.entries(this.fields))e[t]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Hn(this)}pick(e){const t={};for(const r of e)this.fields[r]&&(t[r]=this.fields[r]);return this.setFields(t,this._excludedEdges.filter(([r,s])=>e.includes(r)&&e.includes(s)))}omit(e){const t=[];for(const r of Object.keys(this.fields))e.includes(r)||t.push(r);return this.pick(t)}from(e,t,r){let s=Dt.getter(e,!0);return this.transform(i=>{if(!i)return i;let o=i;return Ku(i,e)&&(o=Object.assign({},i),r||delete o[e],o[t]=s(i)),o})}json(){return this.transform(Do)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Ln.exact,test(t){if(t==null)return!0;const r=$o(this.schema,t);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=Ln.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:t,test(s){if(s==null)return!0;const i=$o(this.schema,s);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,t=Ln.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const r={};for(const s of Object.keys(t))r[e(s)]=t[s];return r})}camelCase(){return this.transformKeys(es.camelCase)}snakeCase(){return this.transformKeys(es.snakeCase)}constantCase(){return this.transformKeys(e=>es.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,o]of Object.entries(t.fields)){var s;let a=e;(s=a)!=null&&s.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=o.describe(a)}return r}}V.prototype=No.prototype;function Wn(n){return new Mo(n)}class Mo extends Le{constructor(e){super({type:"array",spec:{types:e},check(t){return Array.isArray(t)}}),this.innerType=void 0,this.innerType=e}_cast(e,t){const r=super._cast(e,t);if(!this._typeCheck(r)||!this.innerType)return r;let s=!1;const i=r.map((o,a)=>{const l=this.innerType.cast(o,Object.assign({},t,{path:`${t.path||""}[${a}]`,parent:r,originalValue:o,value:o,index:a}));return l!==o&&(s=!0),l});return s?i:r}_validate(e,t={},r,s){var i;let o=this.innerType,a=(i=t.recursive)!=null?i:this.spec.recursive;t.originalValue!=null&&t.originalValue,super._validate(e,t,r,(l,c)=>{var u;if(!a||!o||!this._typeCheck(c)){s(l,c);return}let d=new Array(c.length);for(let h=0;h<c.length;h++){var g;d[h]=o.asNestedTest({options:t,index:h,parent:c,parentPath:t.path,originalParent:(g=t.originalValue)!=null?g:e})}this.runTests({value:c,tests:d,originalValue:(u=t.originalValue)!=null?u:e,options:t},r,h=>s(h.concat(l),c))})}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(Do)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!Un(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+ht(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=jn.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,t){return t=t||jn.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,t){return t=t||jn.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:t==null?[]:[].concat(t))}compact(e){let t=e?(r,s,i)=>!e(r,s,i):r=>!!r;return this.transform(r=>r!=null?r.filter(t):r)}describe(e){const t=(e?this.resolve(e):this).clone(),r=super.describe(e);if(t.innerType){var s;let i=e;(s=i)!=null&&s.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[0]})),r.innerType=t.innerType.describe(i)}return r}}Wn.prototype=Mo.prototype;const ge=(n,e=[])=>t=>{const r=t?Object.keys(t).filter(s=>!n.includes(s)&&!e.includes(s)):[];if(r.length>0)throw new ve(`Unknown properties: ${r.join(", ")}`,t,"custom-validation");return!0},ed=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",n=>ge(["id"],[])(n))}),td=V().shape({body:V().shape({userId:Y().trim().min(1,"User Id must be at least 1 character").max(1e3,"User Id cannot exceed 1000 characters").required("User Id is required"),visitor:ss().required("Visitor is required"),chatbotId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Chatbot Id").required("Chatbot Id is required")}).test("custom-validation","Custom validation failed",ge(["userId","visitor","chatbotId"]))}),Fo={readById:async n=>{await ed.validate({params:n.params},{abortEarly:!1});const{data:e}=await Ie.get(`/live/readById/${n.params.id}`);return e},generateToken:async n=>{await td.validate({body:n.body},{abortEarly:!1});const{data:e}=await Ie.post("/live/generateToken",n.body);return e}},nd=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),rd=V().shape({query:V().shape({skip:Y().trim().min(1,"Skip must be at least 1 character").max(1e4,"Skip cannot exceed 10000 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["skip"]))}),sd=V().shape({body:V().shape({currentNode:Y().trim().min(1,"Current Node must be at least 1 character").max(1e3,"Current Node cannot exceed 1000 characters").required("Current Node is required")}).test("custom-validation","Custom validation failed",ge(["currentNode"])),params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),id=V().shape({body:V().shape({assignType:Y().oneOf(["role","teamMember","everyone"]).required("Assign Type is required"),assignTo:Y().when("assignType",{is:"role",then:n=>n.min(1,"Role must be at least 1 character").max(500,"Role cannot exceed 500 characters").required("Role is required")}).when("assignType",{is:"teamMember",then:n=>n.trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Member Id").required("Member Id is required")}).when("assignType",{is:"everyone",then:n=>n.nullable()})}).test("custom-validation","Custom validation failed",ge(["assignType","assignTo"])),params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"],[]))}),od=V().shape({body:V().shape({chatflow:V().shape({key:Y().max(1e3,"Key cannot exceed 1000 characters").optional(),index:cn().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional(),nodeId:Y().trim().min(1,"Node ID must be at least 1 character").max(1e3,"Node ID cannot exceed 1000 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["chatflow","nodeId"]))}),$t={userRead:async(n,e)=>{await nd.validate({params:n.params},{abortEarly:!1});const{data:t}=await Ie.get(`/conversation/user/read/${n.params.id}`,{headers:{Authorization:`Bearer ${e}`}});return t},userReadAll:async(n,e)=>{await rd.validate({query:e==null?void 0:e.query},{abortEarly:!1});const{data:t}=await Ie.get("/conversation/user/readAll",{params:e==null?void 0:e.query,headers:{Authorization:`Bearer ${n}`}});return t},userUpdateCurrentNode:async(n,e)=>{await sd.validate({params:n.params,body:n.body},{abortEarly:!1});const{data:t}=await Ie.post(`/conversation/user/update/currentNode/${n.params.id}`,n.body,{headers:{Authorization:`Bearer ${e}`}});return t},userAssignToAgent:async(n,e)=>{await id.validate({params:n.params,body:n.body},{abortEarly:!1});const{data:t}=await Ie.post(`/conversation/user/update/assign/${n.params.id}`,n.body,{headers:{Authorization:`Bearer ${e}`}});return t},userCreate:async(n,e)=>{await od.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/conversation/user/create",n.body,{headers:{Authorization:`Bearer ${e}`}});return t}},ad=({className:n,style:e={}})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 256 256",className:n,style:e,children:p("path",{fill:"currentColor",d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"})}),un=({className:n,width:e=16,height:t=16})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"})}),Zt=({className:n})=>p("svg",{width:"100%",height:"100%",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg",className:n,children:p("path",{fill:"currentColor",d:"M13 0C10.4288 0 7.91543 0.762437 5.77759 2.1909C3.63975 3.61935 1.97351 5.64968 0.989572 8.02512C0.0056327 10.4006 -0.251811 13.0144 0.249797 15.5362C0.751405 18.0579 1.98953 20.3743 3.80762 22.1924C5.6257 24.0105 7.94208 25.2486 10.4638 25.7502C12.9856 26.2518 15.5995 25.9944 17.9749 25.0104C20.3503 24.0265 22.3807 22.3603 23.8091 20.2224C25.2376 18.0846 26 15.5712 26 13C25.9964 9.5533 24.6256 6.24882 22.1884 3.81163C19.7512 1.37445 16.4467 0.00363977 13 0Z"})}),Lo=({className:n})=>p("svg",{width:"11",height:"6",viewBox:"0 0 11 6",xmlns:"http://www.w3.org/2000/svg",className:n,children:p("path",{fill:"currentColor",d:"M10.7884 1.18378L6.00738 5.79649C5.94076 5.861 5.86159 5.91218 5.77442 5.9471C5.68725 5.98202 5.59379 6 5.4994 6C5.40501 6 5.31156 5.98202 5.22438 5.9471C5.13721 5.91218 5.05805 5.861 4.99142 5.79649L0.210413 1.18378C0.0756879 1.0538 0 0.877507 0 0.693683C0 0.50986 0.0756879 0.333566 0.210413 0.203583C0.345138 0.0736001 0.527865 0.000576714 0.718395 0.000576712C0.908925 0.00057671 1.09165 0.0736001 1.22638 0.203583L5.5 4.32677L9.77362 0.203007C9.90835 0.0730239 10.0911 0 10.2816 0C10.4721 0 10.6549 0.0730239 10.7896 0.203007C10.9243 0.332989 11 0.509284 11 0.693107C11 0.87693 10.9243 1.05322 10.7896 1.18321Z"})}),ld=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"})}),jo=({className:n,width:e=32,height:t=32})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:t,viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})}),cd=({className:n,width:e=32})=>p("svg",{width:e,height:e*2,viewBox:"0 0 9 14",xmlns:"http://www.w3.org/2000/svg",className:n,children:[p("circle",{cx:"6.99929",cy:"1.27273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"1.27273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"6.99929",cy:"7.00002",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"7.00002",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"6.99929",cy:"12.7273",r:"1.27273",fill:"currentColor"}),p("circle",{cx:"1.27273",cy:"12.7273",r:"1.27273",fill:"currentColor"})]}),ud=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M231.87,114l-168-95.89A16,16,0,0,0,40.92,37.34L71.55,128,40.92,218.67A16,16,0,0,0,56,240a16.15,16.15,0,0,0,7.93-2.1l167.92-96.05a16,16,0,0,0,.05-27.89ZM56,224a.56.56,0,0,0,0-.12L85.74,136H144a8,8,0,0,0,0-16H85.74L56.06,32.16A.46.46,0,0,0,56,32l168,95.83Z"})}),dd=({className:n})=>p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",className:n,children:p("path",{fill:"currentColor",d:"M209.66,122.34a8,8,0,0,1,0,11.32l-82.05,82a56,56,0,0,1-79.2-79.21L147.67,35.73a40,40,0,1,1,56.61,56.55L105,193A24,24,0,1,1,71,159L154.3,74.38A8,8,0,1,1,165.7,85.6L82.39,170.31a8,8,0,1,0,11.27,11.36L192.93,81A24,24,0,1,0,159,47L59.76,147.68a40,40,0,1,0,56.53,56.62l82.06-82A8,8,0,0,1,209.66,122.34Z"})}),hd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADcAAAAxCAYAAAB+gjFbAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALhSURBVHgB7ZlNbtpAFMf/MxC1qySIdNFVnRtwg5ATlJygdNdFCuYEgRPEVN2HnqD0BNAbJCeId13kA6SuKjUzfW8MgQbHGJi09ig/aWQbxpJ/fvPlNwLrcnxVhZAVSHFAVxUqu5OyKaEpWl1AYYjizyGC/THWQKxU27/chdpuQggfdkRSonu4U1/w+dVwlbvSybGU3j6h6j7+L0OIX+8RvA7TVF4u9/HKhyyQ2L+M1DJ0gG65taxWslzz5jQD0XqMkKJ4mBTFeDnTDHe+0lkV2SZRUMbeoncGyL4Y40G/GMD/4cX9uShnmqIZ2vPCRHC0MCb8Ledf1zPcx5IgQX328MdZn+PQ8hvginlFqCMEe/3p5SxyaquNPIsxWp7ON89IjqMm5DvkH49WMvXpRSQXRc0NpLgPUiQn5AHcoQKfFvVguWNz4sEllKzxQULKKlxDmM8wbpY6TxN2WoyTpP72Bi7yYeTxgOLBRV7CyGXoO80uEg7zLJdXnuXyii05ymWIQyr75qh0Cxrf6ffkZCrX0bpL9xzd3wucwxICzVuNTeEH/FSO/4L3R7xa8KBUtBKSMkQkECIoLcrzolcXBtgUelFF2OHxCAUlFuHSRyr0WqnzOOw0S5tLuN/SgyUs9Tldi8s+rYVEDZawNaBQEledYFOinSNr6Q6LUwGlBBuj9R+M8ziFwhnscW53nhO01dS4WT2CHDG7aUUzEtufxIVo0/RyOUlfJMPRalz3KGJ286UaF3ywNRU8xDMP3LzlHdJvNKn3qYyh7sYoblXoBXiUpXpLD1FdcfszHVqZacfOJJ41eLUTlEIH15aix2J85p6cQGd66pjcLGqMS3LhfNQYd+SEas1HjXFDTujO/L7clPzLGbFyO+6vfMsliDFPtUJ5asZRH9vrJVXKnxznXaSok1i4rGp+5CKpNrqlYdpbsi1nhPSQhoY+Sa2cFStS5qqDrKCpLxUkJ4ii7Fi3tFGy6A+7st8LQyzi5QAAAABJRU5ErkJggg==",as=n=>{const e=new Date(n);if(Number.isNaN(e.getTime()))return"Invalid date";const r=new Date().getTime()-e.getTime();if(r<0)return"just now";const s=Math.floor(r/1e3),i=Math.floor(s/60),o=Math.floor(i/60),a=Math.floor(o/24),l=Math.floor(a/30),c=Math.floor(l/12);let d=[{limit:60*1e3,label:"just now"},{limit:60*60*1e3,label:`${i} minute${i!==1?"s":""}`},{limit:24*60*60*1e3,label:`${o} hour${o!==1?"s":""}`},{limit:30*24*60*60*1e3,label:`${a} day${a!==1?"s":""}`}].find(g=>r<g.limit);return d?d.label:l>0?`${l} month${l!==1?"s":""} ago`:`${c} year${c!==1?"s":""} ago`},fd=V().shape({name:Y().min(1,"Name must be at least 1 character").max(1e3,"Name cannot exceed 1000 characters").required("Name is required"),url:Y().min(1,"URL must be at least 1 character").max(1e3,"URL cannot exceed 1000 characters").required("URL is required")}).test("custom-validation","Custom validation failed",ge(["name","url"])),pd=V().shape({text:Y().min(1,"Text must be at least 1 character").max(1e3,"Text cannot exceed 1000 characters").optional(),file:fd.when("text",{is:n=>!n,then:n=>n.required(),otherwise:n=>n.strip()})}).test("text-or-file","Either 'text' or 'file' must be provided",function(n){const{text:e,file:t}=n;return!e&&!t?this.createError({path:"data",message:"Either 'text' or 'file' must be provided"}):!0}).test("custom-validation","Custom validation failed",ge([],["text","file"])),gd=V().shape({params:V().shape({id:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Id is required")}).test("custom-validation","Custom validation failed",ge(["id"]))}),md=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),skip:cn().min(0,"Skip must be at least 0").max(1e4,"Skip cannot exceed 10000").optional()}).test("custom-validation","Custom validation failed",ge(["conversationId"],["skip"]))}),Uo=V().shape({body:V().shape({owner:Y().oneOf(["ai","user"]).required("Owner must be 'ai' or 'user'"),conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),type:Y().oneOf(["AI Text","Human Text","External API","External API Text","AI Response"]).required("Type is required"),data:pd.required("Message data is required"),currentChatflow:V().shape({key:Y().max(1e3,"Key cannot exceed 1000 characters").optional(),index:cn().max(1e3,"Index cannot exceed 1000").optional()}).nullable().optional()}).test("custom-validation","Custom validation failed",ge(["owner","conversationId","type","data"],["currentChatflow"]))}),bd=V().shape({body:V().shape({queries:Wn().of(Y().min(1,"Query must be at least 1 character").max(1e3,"Query cannot exceed 1000 characters")).max(200,"Queries cannot exceed 200 items").optional(),conversationHistory:Wn().of(V().shape({user:Y().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:Y().min(1,"AI message must be at least 1 character").max(1e3,"AI message cannot exceed 1000 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["user","ai"]))).min(1,"Conversation history must have at least 1 entry").max(3,"Conversation history cannot exceed 3 entries").required("Conversation history is required")}).test("custom-validation","Custom validation failed",ge(["queries","conversationHistory"]))}),_d=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Conversation Id").required("Conversation Id is required"),conversationHistory:Wn().of(V().shape({user:Y().min(1,"User message must be at least 1 character").max(1e3,"User message cannot exceed 1000 characters").optional(),ai:Y().min(1,"AI message must be at least 1 character").max(2500,"AI message cannot exceed 2500 characters").optional()}).test("custom-validation","Custom validation failed",ge([],["user","ai"]))).min(1,"Conversation history must have at least 1 entry").max(8,"Conversation history cannot exceed 8 entries").required("Conversation history is required"),enableStreaming:ss().optional()}).test("custom-validation","Custom validation failed",ge(["conversationId","conversationHistory"],["enableStreaming"]))}),ls={userReadAll:async(n,e)=>{await md.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/readAll",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userUpdateSeen:async(n,e)=>{await gd.validate({params:n.params},{abortEarly:!1});const{data:t}=await Ie.post(`/message/user/update/seen/${n.params.id}`,{},{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userCreate:async(n,e)=>{await Uo.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/create",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userAIContextMessage:async(n,e)=>{await _d.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/ai/message",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t},userAICheckQueries:async(n,e)=>{await bd.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/message/user/ai/checkQueries",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t}},vd={userUploadAsset:async(n,e)=>{const t=new FormData;t.append("file",n);const{data:r}=await Ie.post("/asset/userUpload",t,{headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e}`}});return r}};V().shape({rating:Y().trim().min(1).max(1),skip:Y().trim().min(1).max(1e3),limit:Y().trim().min(1).max(1e3)}).test("custom-validation","Custom validation failed",ge([],["rating","skip","limit"]));const yd=V().shape({body:V().shape({conversationId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Conversation Id is required"),chatbotId:Y().trim().matches(/^[0-9a-fA-F]{24}$/,"Invalid Id").required("Chatbot Id is required"),comment:Y().trim().max(500).min(3).required("Comment is required"),rating:cn().max(5).min(1).required("Rating is required")}).test("custom-validation","Custom validation failed",ge(["conversationId","chatbotId","comment","rating"]))}),xd={userCreate:async(n,e)=>{await yd.validate({body:n.body},{abortEarly:!1});const{data:t}=await Ie.post("/review/user/create",n.body,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});return t}};class wd{constructor(){this.buffer="",this.eventType=null,this.eventData=""}async parseStream(e,t,r){const s=e.body.getReader(),i=new TextDecoder;try{for(;;){const{done:o,value:a}=await s.read();if(o)break;this.buffer+=i.decode(a,{stream:!0}),this.processBuffer(t)}this.buffer.trim()&&this.processBuffer(t),t({type:"done",data:{}})}catch(o){console.error("SSE parsing failed:",o),r(o instanceof Error?o:new Error("Stream parsing failed"))}}processBuffer(e){const t=this.buffer.split(`
|
|
10
10
|
`);this.buffer=t.pop()||"";for(const r of t)if(r.startsWith("event: "))this.eventType=r.replace("event: ","");else if(r.startsWith("data: "))this.eventData+=r.replace("data: ","");else if(r.trim()===""){if(this.eventType&&this.eventData)try{e({type:this.eventType,data:JSON.parse(this.eventData)})}catch{console.error("Failed to parse SSE data:",this.eventData)}this.eventType=null,this.eventData=""}}}const kd="token123",rt="3",Td=[{_id:"1",owner:"user",ownerId:rt,conversationId:"21",chatbotId:"7",conversationOwnerId:rt,chatbotOwnerId:"9",seen:!1,data:{text:"So, I was curious about RoboDialog"},type:"Human Text",createdAt:"2026-01-02T10:34:14.396Z",updatedAt:"2026-01-02T10:34:14.396Z"},{_id:"2",owner:"ai",ownerId:null,conversationId:"21",chatbotId:"7",conversationOwnerId:rt,chatbotOwnerId:"9",seen:!1,data:{text:`## 🤖 RoboDialog
|
|
11
11
|
**RoboDialog** is a friendly AI expert that helps businesses save time and money on customer support.
|
|
12
12
|
|
|
@@ -85,7 +85,7 @@ ${e}</tr>
|
|
|
85
85
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
|
|
86
86
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${pt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),i=oa(e);if(i===null)return s;e=i;let o='<a href="'+e+'"';return t&&(o+=' title="'+pt(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let i=oa(e);if(i===null)return pt(r);e=i;let o=`<img src="${e}" alt="${r}"`;return t&&(o+=` title="${pt(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:pt(e.text)}},ys=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Je=class Xs{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||Mt,this.options.renderer=this.options.renderer||new er,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ys}static parse(e,t){return new Xs(t).parse(e)}static parseInline(e,t){return new Xs(t).parseInline(e)}parse(e){var r,s;let t="";for(let i=0;i<e.length;i++){let o=e[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let l=o,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=c||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){var s,i;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=c||"";continue}}let l=a;switch(l.type){case"escape":{r+=t.text(l);break}case"html":{r+=t.html(l);break}case"link":{r+=t.link(l);break}case"image":{r+=t.image(l);break}case"checkbox":{r+=t.checkbox(l);break}case"strong":{r+=t.strong(l);break}case"em":{r+=t.em(l);break}case"codespan":{r+=t.codespan(l);break}case"br":{r+=t.br(l);break}case"del":{r+=t.del(l);break}case"text":{r+=t.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},gn=(mr=class{constructor(n){ne(this,"options");ne(this,"block");this.options=n||Mt}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?Xe.lex:Xe.lexInline}provideParser(){return this.block?Je.parse:Je.parseInline}},ne(mr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ne(mr,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),mr),gh=class{constructor(...e){ne(this,"defaults",ds());ne(this,"options",this.setOptions);ne(this,"parse",this.parseMarkdown(!0));ne(this,"parseInline",this.parseMarkdown(!1));ne(this,"Parser",Je);ne(this,"Renderer",er);ne(this,"TextRenderer",ys);ne(this,"Lexer",Xe);ne(this,"Tokenizer",Qn);ne(this,"Hooks",gn);this.use(...e)}walkTokens(e,t){var s,i;let r=[];for(let o of e)switch(r=r.concat(t.call(this,o)),o.type){case"table":{let a=o;for(let l of a.header)r=r.concat(this.walkTokens(l.tokens,t));for(let l of a.rows)for(let c of l)r=r.concat(this.walkTokens(c.tokens,t));break}case"list":{let a=o;r=r.concat(this.walkTokens(a.items,t));break}default:{let a=o;(i=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(l=>{let c=a[l].flat(1/0);r=r.concat(this.walkTokens(c,t))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=t.renderers[i.name];o?t.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[i.level];o?o.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),s.extensions=t),r.renderer){let i=this.defaults.renderer||new er(this.defaults);for(let o in r.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d||""}}s.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new Qn(this.defaults);for(let o in r.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}s.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new gn;for(let o in r.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],c=i[a];gn.passThroughHooks.has(o)?i[a]=u=>{if(this.defaults.async&&gn.passThroughHooksRespectAsync.has(o))return(async()=>{let g=await l.call(i,u);return c.call(i,g)})();let d=l.call(i,u);return c.call(i,d)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(i,u);return g===!1&&(g=await c.apply(i,u)),g})();let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}s.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Xe.lex(e,t??this.defaults)}parser(e,t){return Je.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let s={...r},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(t):t,l=await(i.hooks?await i.hooks.provideLexer():e?Xe.lex:Xe.lexInline)(a,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():e?Je.parse:Je.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let a=(i.hooks?i.hooks.provideLexer():e?Xe.lex:Xe.lexInline)(t,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let l=(i.hooks?i.hooks.provideParser():e?Je.parse:Je.parseInline)(a,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,t){return r=>{if(r.message+=`
|
|
87
87
|
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+pt(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},Ft=new gh;function K(n,e){return Ft.parse(n,e)}K.options=K.setOptions=function(n){return Ft.setOptions(n),K.defaults=Ft.defaults,Vo(K.defaults),K},K.getDefaults=ds,K.defaults=Mt,K.use=function(...n){return Ft.use(...n),K.defaults=Ft.defaults,Vo(K.defaults),K},K.walkTokens=function(n,e){return Ft.walkTokens(n,e)},K.parseInline=Ft.parseInline,K.Parser=Je,K.parser=Je.parse,K.Renderer=er,K.TextRenderer=ys,K.Lexer=Xe,K.lexer=Xe.lex,K.Tokenizer=Qn,K.Hooks=gn,K.parse=K,K.options,K.setOptions,K.use,K.walkTokens,K.parseInline,Je.parse,Xe.lex;const mh=({chatbot:n,conversations:e,messages:t,totalConversationsCount:r,conversationsLoading:s,loadMoreConversations:i,handleChangeConversation:o})=>{const a=[...t].sort((u,d)=>new Date(d.createdAt).getTime()-new Date(u.createdAt).getTime()),l=new Map;a.forEach(u=>{l.has(u.conversationId)||l.set(u.conversationId,u)});const c=Array.from(l.values()).map(u=>({conversation:e.find(d=>d._id===u.conversationId),latestMessage:u}));return p("div",{className:"conversationMainItemContainer",children:[c.map((u,d)=>p(_h,{chatbot:n,data:u,handleChangeConversation:o},d)),r>e.length&&p("button",{className:"newConversationBtn",onClick:i,children:s?p("div",{className:"newConversationLoading",children:p(un,{className:"base-text-color"})}):"Load More Conversations"})]})},bh=(n="")=>n.split(`
|
|
88
|
-
`)[0].replace(/#{1,6}\s+/g,"").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").trim(),_h=({chatbot:n,data:e,handleChangeConversation:t})=>{if(!e.conversation||e.conversation===void 0)return;const{conversation:r,latestMessage:s}=e,i=()=>{if(r.assignedTo){const a=n.teamMembers.members.find(l=>l.user._id===r.assignedTo);return a!=null&&a.user.profilePicture?p("img",{src:ie(a.user.profilePicture,70),alt:"User"},ie(a.user.profilePicture,70)):p(Zt,{className:"input-background-color"})}return p("img",{src:ie(n.appearance.images.popupChat,70),alt:"Bot"},ie(n.appearance.images.popupChat,70))},o=bh(s==null?void 0:s.data.text);return p("div",{className:"conversationMainItem",onClick:()=>t(r),children:[p("div",{children:p(i,{})}),p("div",{className:"textHolder",children:[p("p",{children:o||"Send a message"}),p("p",{children:as((s==null?void 0:s.createdAt)||(r==null?void 0:r.createdAt))})]}),p("div",{children:[p(Lo,{className:"base-color"}),s.owner==="agent"&&!s.seen&&p("div",{className:"unreadMessage"})]})]})},xs=({chatbot:n,className:e=""})=>p("div",{className:`agents ${e}`,children:n.teamMembers.members.filter(t=>t.joined).slice(0,3).map((t,r)=>p("div",{children:t.user.profilePicture?p("img",{src:ie(t.user.profilePicture,70),alt:"Agent"},ie(t.user.profilePicture,70)):p(Zt,{className:"input-text-color"})},r))}),vh=({chatbot:n,latestCurrentConversation:e})=>{var i;const t=(i=n.teamMembers.members.find(o=>o.user._id===(e==null?void 0:e.assignedTo)))==null?void 0:i.user,r=()=>e!=null&&e.assignedTo?t!=null&&t.profilePicture?p("div",{className:"headerImageWrapper",children:p("img",{src:ie(t.profilePicture,70),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},ie(t.profilePicture,70))}):p("div",{className:"headerImageWrapper",children:p(Zt,{className:"background-text-color"})}):p(xs,{chatbot:n}),s=()=>p("div",{className:"headerImageWrapper",children:p("img",{src:ie(n.appearance.images.popupChat,70),width:"100%",alt:"Chat"},ie(n.appearance.images.popupChat,70))});return p(Te,{children:e!=null&&e.assignedTo?r():s()})},yh=({email:n,chatbot:e,dataFromUser:t})=>{const[r,s]=M(()=>{const o={};if(n){const a=t.data.find(l=>l.type==="email");a&&(o[a.key]=n)}return o}),i=(o,a)=>{switch(o.type){case"text":return p("div",{children:[p("h3",{children:o.name}),p("input",{type:"text",required:o.required,placeholder:o.data.placeholder,value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})})]},`${a}-${o.key}`);case"dropdown":return p("div",{children:[p("h4",{children:o.name}),p("select",{required:o.required,name:o.name,onChange:l=>s({...r,[o.key]:l.target.value}),children:[p("option",{value:"",children:"Select"}),o.data.map(l=>p("option",{value:l.value,children:l.label},l.value))]})]},`${a}-${o.key}`);case"date":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,type:"date",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"time":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,type:"time",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"textarea":return p("div",{children:[p("h4",{children:o.name}),p("textarea",{required:o.required,placeholder:o.data.placeholder,rows:4,value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})})]},`${a}-${o.key}`);case"email":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,placeholder:o.data.placeholder,type:"email",value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})}),p("span",{className:"hint",children:o.error})]},`${a}-${o.key}`);default:return null}};return p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(e.appearance.images.chat,70),alt:"Bot"},ie(e.appearance.images.chat,70))}),p("div",{className:"messageDiv",children:p("form",{className:"messageP",onSubmit:o=>{o.preventDefault(),t.onSubmit(r)},children:[t.data.map((o,a)=>i(o,a)),p("div",{className:"livelinkSubmitDiv",children:p("button",{type:"submit",children:"Submit"})})]})})]})},xh=({chatbot:n,ratingFromUser:e})=>{const[t,r]=M({comment:"",rating:4});return p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.chat,70),alt:"Bot"},ie(n.appearance.images.chat,70))}),p("div",{className:"messageDiv",children:p("form",{className:"messageP",onSubmit:s=>{s.preventDefault(),t.rating!==0&&e.onSubmit(t)},children:[p("h3",{style:{fontWeight:"400"},children:"Please Leave a review"}),p("div",{children:[p("h4",{children:"Comment"}),p("textarea",{required:!0,minLength:3,maxLength:500,rows:4,onChange:s=>r({...t,comment:s.target.value})})]}),p("div",{style:{display:"flex"},children:[1,2,3,4,5].map(s=>p("div",{style:{cursor:"pointer"},onClick:()=>r({...t,rating:s}),children:p(ld,{className:t.rating>=s?"base-color":"input-text-color"})},s))}),p("div",{className:"livelinkSubmitDiv",children:p("button",{type:"submit",children:"Submit"})})]})})]})},wh=({chatbot:n,onlineAgents:e,currentConversation:t})=>{var s,i,o,a,l;const r=n.chatflow.nodes.find(c=>c.id===t.currentNode);return p("div",{className:"onlineAgents",children:[p("div",{children:p("span",{children:(i=(s=r==null?void 0:r.data)==null?void 0:s.expectedTime)!=null&&i.value?(o=r==null?void 0:r.data)==null?void 0:o.expectedTime.text:"Connecting to an Agent"})}),((l=(a=r==null?void 0:r.data)==null?void 0:a.expectedTime)==null?void 0:l.showOnlineAgents)&&e>0&&p("div",{children:[p(xs,{chatbot:n}),p("p",{children:["Online Agents: ",p("b",{children:e})]})]})]})},kh=({chatbot:n})=>p("div",{className:"mainMessageContainer mySelfTextDiv",children:p("div",{className:"messageDiv mySelfTextDiv",children:p("div",{className:"otherUserTextLoading",children:[p("div",{className:"loading1"}),p("div",{className:"loading2"}),p("div",{className:"loading3"})]})})}),Th=({chatbot:n})=>p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.chat,70),alt:"Bot"},ie(n.appearance.images.chat,70))}),p("div",{className:"messageDiv",children:p("div",{className:"otherUserTextLoading",children:[p("div",{className:"loading1"}),p("div",{className:"loading2"}),p("div",{className:"loading3"})]})})]}),Sh=({chatbot:n,message:e,AIControlNode:t})=>{var g,h;const r=e.owner==="agent",s=r?n.teamMembers.members.find(f=>f.user._id===e.ownerId):null,o=(((g=e.data.sources)==null?void 0:g.filter((f,m,b)=>b.indexOf(f)===m))||[]).filter(f=>f.startsWith("https://")).slice(0,3),a=(h=e.data.file)==null?void 0:h.name,l=a&&/\.(jpg|png|jpeg|gif|bmp)$/i.test(a),c=a&&/\.(mp4|avi|mov|mkv|wmv|flv|webm|mpeg)$/i.test(a),[u,d]=M("");return _e(()=>{const f=K.parse(e.data.text||"");typeof f=="string"?d(f):f.then(d)},[e.data.text]),p("div",{className:`mainMessageContainer ${e.owner==="user"?"mySelfTextDiv":""}`,children:[e.owner!=="user"&&(r?p("div",{className:"logoWithMessageDiv",children:s!=null&&s.user.profilePicture?p("img",{src:ie(s.user.profilePicture,70),alt:"Agent"},ie(s.user.profilePicture,70)):p(Zt,{className:"input-background-color"})}):p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.popupChat,70),alt:"Bot"},ie(n.appearance.images.popupChat,70))})),p("div",{className:`messageDiv ${e.owner==="user"?"mySelfTextDiv":""}`,children:[p("div",{className:"NameAndDate",children:e.owner!=="user"?p(Te,{children:[(s==null?void 0:s.user.name)||"AI"," -"," ",as(e.createdAt)]}):as(e.createdAt)}),l&&e.data.file&&p("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:p("img",{src:e.data.file.url,style:{height:"80px"},alt:"Image"},e.data.file.url)}),c&&e.data.file&&p("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:p("video",{src:e.data.file.url,style:{height:"80px"},controls:!0,children:"Video"})}),u&&p("div",{className:"messageP markdownText",dangerouslySetInnerHTML:{__html:u}}),p("div",{className:"sources",children:[e.data.file&&!l&&!c&&p("a",{target:"_blank",href:e.data.file.url,children:e.data.file.name}),(t==null?void 0:t.data.replySource.value)&&o.length>0&&o.map((f,m)=>p("a",{target:"_blank",href:f,children:f},`${f}-${m}`))]})]})]})},Ch=({chatbot:n})=>p("div",{className:"messagesLoading",children:p("div",{children:p(un,{className:"base-color"})})}),Eh=({hoveringMessageInner:n,chatbot:e})=>p("div",{className:"hoveringMessageInner",children:n.data.map((t,r)=>p("div",{onClick:()=>n.onClick(t),children:t.message},r))}),Ah=({file:n,setFile:e,chatbot:t})=>p("div",{className:"hoveringMessageInner",children:p("div",{onClick:()=>e(null),children:[p(jo,{className:"base-text-color",width:"16",height:"16"}),n.name]})}),Rh=({showHoveringMessage:n,hoveringMessages:e,chatbot:t,setShowHoveringMessage:r,coreState:s,conversationState:i,uiState:o,node:a,setChatOpen:l})=>{var j;const[c,u]=M(!1),{token:d,isChatbotDefault:g}=s,{newMessage:h,setNewMessage:f,setCurrentConversation:m,conversations:b,setConversations:v}=i,{callChatFlowRef:x,chatOpen:w}=o,[k,_]=M(Fr("robodialog-chatbot-closed")),S=(a==null?void 0:a.data.popupMessage.value)&&h,P=!g&&!S&&!k&&n,T=()=>{_(!0),Sn("robodialog-chatbot-closed",!0),f(null),r(!1)},A=(h==null?void 0:h.owner)==="agent"?(j=t.teamMembers.members.find(Z=>Z.user._id===h.ownerId))==null?void 0:j.user:null,D=()=>{r(!1),f(null);const Z=b.find(se=>(h==null?void 0:h.conversationId)===se._id);Z&&(x.current=!0,m(Z),l(!0))},E=A!=null&&A.profilePicture?p("div",{className:"headerImageWrapper",children:p("img",{src:ie(A.profilePicture,70),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},ie(A.profilePicture,70))}):p("div",{className:"headerImageWrapper",children:p(Zt,{className:"background-text-color"})});return!(n&&((e==null?void 0:e.length)??0)>0||S)||w?null:p("div",{className:"chatHoveringMessages",children:[(S||P)&&!k&&p("div",{onClick:T,className:"chatHoveringMessage closeMessages",children:c?p("div",{className:"loadingIcon",children:p("div",{style:{width:"16px",height:"16px"},children:p(un,{className:"background-text-color"})})}):p(jo,{className:"background-text-color",width:"16px",height:"16px"})}),S&&p("div",{className:"chatHoveringMessage",onClick:D,children:[p("div",{className:"chatHoveringMessageUser",children:[E,h.owner==="agent"?A==null?void 0:A.name:"AI"]}),p("div",{style:{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis"},children:h.data.text})]}),P&&(e==null?void 0:e.map((Z,se)=>p(Oh,{hoveringMessage:Z,chatbot:t,loading:c,setLoading:u,coreState:s,conversationState:i,uiState:o,setShowHoveringMessage:r,token:d,node:a,setChatOpen:l,conversations:b,setConversations:v,setCurrentConversation:m,callChatFlowRef:x},se)))]})},Oh=({hoveringMessage:n,chatbot:e,loading:t,setLoading:r,setShowHoveringMessage:s,token:i,setChatOpen:o,setConversations:a,conversations:l,setCurrentConversation:c,callChatFlowRef:u,coreState:d,conversationState:g,uiState:h})=>{var b;const f=async()=>{if(t)return;o(!0),r(!0);let v={};if(n.type==="query")v.chatflow={key:"end",index:0};else{const x=e.chatflow.edges.find(w=>w.sourceHandle===n.id);if(!x){r(!1);return}v.nodeId=x.target}try{const x=await $t.userCreate({body:v},i);if(!x.data)throw new Error("Conversation creation failed");const w=x.data;if(a([...l,w]),n.type==="query"){const k=e.chatflow.nodes.find(_=>_.id===w.currentNode);k&&(h.humanControl=k.data.control.type==="human"),c(w),await us({coreState:d,conversationState:g,uiState:h,userMessage:n.query,setUserMessage:()=>{},file:null,setFile:()=>{},showToast:()=>{},latestCurrentConversation:w})}else u.current=!0,c(w);s(!1)}catch(x){console.error("Chat hovering message error:",x)}finally{r(!1)}},m=n.showUser?(b=e.teamMembers.members.find(v=>{var x;return v.user._id===((x=n==null?void 0:n.user)==null?void 0:x._id)}))==null?void 0:b.user:null;return p("div",{className:"chatHoveringMessage",onClick:f,children:[n.showUser&&m&&p("div",{className:"chatHoveringMessageUser",children:[p("div",{children:m.profilePicture?p("img",{src:ie(m.profilePicture,70)},ie(m.profilePicture,70)):p(Zt,{className:"input-background-color"})}),n.title]}),p("div",{children:n.message})]})};var tr={exports:{}},ca={};function ua(n,e){for(var t in e)n[t]=e[t];return n}function ws(n,e){for(var t in n)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&n[r]!==e[r])return!0;return!1}function ks(n,e){var t=e(),r=M({t:{__:t,u:e}}),s=r[0].t,i=r[1];return Bt(function(){s.__=t,s.u=e,Ts(s)&&i({t:s})},[n,t,e]),_e(function(){return Ts(s)&&i({t:s}),n(function(){Ts(s)&&i({t:s})})},[n]),t}function Ts(n){var e,t,r=n.u,s=n.__;try{var i=r();return!((e=s)===(t=i)&&(e!==0||1/e==1/t)||e!=e&&t!=t)}catch{return!0}}function Ss(n){n()}function Cs(n){return n}function Es(){return[!1,Ss]}var As=Bt;function nr(n,e){this.props=n,this.context=e}function da(n,e){function t(s){var i=this.props.ref,o=i==s.ref;return!o&&i&&(i.call?i(null):i.current=null),e?!e(this.props,s)||!o:ws(this.props,s)}function r(s){return this.shouldComponentUpdate=t,Qe(n,s)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r.type=n,r}(nr.prototype=new We).isPureReactComponent=!0,nr.prototype.shouldComponentUpdate=function(n,e){return ws(this.props,n)||ws(this.state,e)};var ha=N.__b;N.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),ha&&ha(n)};var Ph=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function fa(n){function e(t){var r=ua({},t);return delete r.ref,n(r,t.ref||null)}return e.$$typeof=Ph,e.render=n,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(n.displayName||n.name)+")",e}var pa=function(n,e){return n==null?null:ut(ut(n).map(e))},ga={map:pa,forEach:pa,count:function(n){return n?ut(n).length:0},only:function(n){var e=ut(n);if(e.length!==1)throw"Children.only";return e[0]},toArray:ut},Dh=N.__e;N.__e=function(n,e,t,r){if(n.then){for(var s,i=e;i=i.__;)if((s=i.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(n,e)}Dh(n,e,t,r)};var ma=N.unmount;function ba(n,e,t){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),n.__c.__H=null),(n=ua({},n)).__c!=null&&(n.__c.__P===t&&(n.__c.__P=e),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(r){return ba(r,e,t)})),n}function _a(n,e,t){return n&&t&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(r){return _a(r,e,t)}),n.__c&&n.__c.__P===e&&(n.__e&&t.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=t)),n}function mn(){this.__u=0,this.o=null,this.__b=null}function va(n){var e=n.__.__c;return e&&e.__a&&e.__a(n)}function ya(n){var e,t,r,s=null;function i(o){if(e||(e=n()).then(function(a){a&&(s=a.default||a),r=!0},function(a){t=a,r=!0}),t)throw t;if(!r)throw e;return s?Qe(s,o):null}return i.displayName="Lazy",i.__f=!0,i}function Gt(){this.i=null,this.l=null}N.unmount=function(n){var e=n.__c;e&&e.__R&&e.__R(),e&&32&n.__u&&(n.type=null),ma&&ma(n)},(mn.prototype=new We).__c=function(n,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=va(r.__v),i=!1,o=function(){i||(i=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=_a(l,l.__c.__P,l.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.o.pop();)c.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(o,o)},mn.prototype.componentWillUnmount=function(){this.o=[]},mn.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=ba(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&Qe(Te,null,n.fallback);return s&&(s.__u&=-33),[Qe(Te,null,e.__a?null:n.children),s]};var xa=function(n,e,t){if(++t[1]===t[0]&&n.l.delete(e),n.props.revealOrder&&(n.props.revealOrder[0]!=="t"||!n.l.size))for(t=n.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;n.i=t=t[2]}};function Ih(n){return this.getChildContext=function(){return n.context},n.children}function $h(n){var e=this,t=n.h;if(e.componentWillUnmount=function(){Ct(null,e.v),e.v=null,e.h=null},e.h&&e.h!==t&&e.componentWillUnmount(),!e.v){for(var r=e.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;e.h=t,e.v={nodeType:1,parentNode:t,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(s,i){this.childNodes.push(s),e.h.insertBefore(s,i)},removeChild:function(s){this.childNodes.splice(this.childNodes.indexOf(s)>>>1,1),e.h.removeChild(s)}}}Ct(Qe(Ih,{context:e.context},n.__v),e.v)}function wa(n,e){var t=Qe($h,{__v:n,h:e});return t.containerInfo=e,t}(Gt.prototype=new We).__a=function(n){var e=this,t=va(e.__v),r=e.l.get(n);return r[0]++,function(s){var i=function(){e.props.revealOrder?(r.push(s),xa(e,n,r)):s()};t?t(i):i()}},Gt.prototype.render=function(n){this.i=null,this.l=new Map;var e=ut(n.children);n.revealOrder&&n.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return n.children},Gt.prototype.componentDidUpdate=Gt.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(e,t){xa(n,t,e)})};var ka=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Nh=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Mh=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Fh=/[A-Z0-9]/g,Lh=typeof document<"u",jh=function(n){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(n)};function Ta(n,e,t){return e.__k==null&&(e.textContent=""),Ct(n,e),typeof t=="function"&&t(),n?n.__c:null}function Sa(n,e,t){return di(n,e),typeof t=="function"&&t(),n?n.__c:null}We.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(We.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(e){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:e})}})});var Ca=N.event;function Uh(){}function zh(){return this.cancelBubble}function qh(){return this.defaultPrevented}N.event=function(n){return Ca&&(n=Ca(n)),n.persist=Uh,n.isPropagationStopped=zh,n.isDefaultPrevented=qh,n.nativeEvent=n};var Rs,Bh={enumerable:!1,configurable:!0,get:function(){return this.class}},Ea=N.vnode;N.vnode=function(n){typeof n.type=="string"&&function(e){var t=e.props,r=e.type,s={},i=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||Lh&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||jh(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Mh.test(o)&&(o=l):l=o="oninput":i&&Nh.test(o)?o=o.replace(Fh,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=ut(t.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=ut(t.children).forEach(function(c){c.props.selected=s.multiple?s.defaultValue.indexOf(c.props.value)!=-1:s.defaultValue==c.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",Bh)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s}(n),n.$$typeof=ka,Ea&&Ea(n)};var Aa=N.__r;N.__r=function(n){Aa&&Aa(n),Rs=n.__c};var Ra=N.diffed;N.diffed=function(n){Ra&&Ra(n);var e=n.props,t=n.__e;t!=null&&n.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),Rs=null};var Oa={ReactCurrentDispatcher:{current:{readContext:function(n){return Rs.__n[n.__c].props.value},useCallback:Ht,useContext:Dr,useDebugValue:Ir,useDeferredValue:Cs,useEffect:_e,useId:$r,useImperativeHandle:Pr,useInsertionEffect:As,useLayoutEffect:Bt,useMemo:vt,useReducer:kn,useRef:et,useState:M,useSyncExternalStore:ks,useTransition:Es}}},Hh="18.3.1";function Pa(n){return Qe.bind(null,n)}function bn(n){return!!n&&n.$$typeof===ka}function Da(n){return bn(n)&&n.type===Te}function Ia(n){return!!n&&!!n.displayName&&(typeof n.displayName=="string"||n.displayName instanceof String)&&n.displayName.startsWith("Memo(")}function $a(n){return bn(n)?Nl.apply(null,arguments):n}function Na(n){return!!n.__k&&(Ct(null,n),!0)}function Ma(n){return n&&(n.base||n.nodeType===1&&n)||null}var Fa=function(n,e){return n(e)},La=function(n,e){return n(e)},ja=Te,Ua=bn,Wh={useState:M,useId:$r,useReducer:kn,useEffect:_e,useLayoutEffect:Bt,useInsertionEffect:As,useTransition:Es,useDeferredValue:Cs,useSyncExternalStore:ks,startTransition:Ss,useRef:et,useImperativeHandle:Pr,useMemo:vt,useCallback:Ht,useContext:Dr,useDebugValue:Ir,version:"18.3.1",Children:ga,render:Ta,hydrate:Sa,unmountComponentAtNode:Na,createPortal:wa,createElement:Qe,createContext:hi,createFactory:Pa,cloneElement:$a,createRef:ni,Fragment:Te,isValidElement:bn,isElement:Ua,isFragment:Da,isMemo:Ia,findDOMNode:Ma,Component:We,PureComponent:nr,memo:da,forwardRef:fa,flushSync:La,unstable_batchedUpdates:Fa,StrictMode:ja,Suspense:mn,SuspenseList:Gt,lazy:ya,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Oa};const rr=hu(Object.freeze(Object.defineProperty({__proto__:null,Children:ga,Component:We,Fragment:Te,PureComponent:nr,StrictMode:ja,Suspense:mn,SuspenseList:Gt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Oa,cloneElement:$a,createContext:hi,createElement:Qe,createFactory:Pa,createPortal:wa,createRef:ni,default:Wh,findDOMNode:Ma,flushSync:La,forwardRef:fa,hydrate:Sa,isElement:Ua,isFragment:Da,isMemo:Ia,isValidElement:bn,lazy:ya,memo:da,render:Ta,startTransition:Ss,unmountComponentAtNode:Na,unstable_batchedUpdates:Fa,useCallback:Ht,useContext:Dr,useDebugValue:Ir,useDeferredValue:Cs,useEffect:_e,useErrorBoundary:Fl,useId:$r,useImperativeHandle:Pr,useInsertionEffect:As,useLayoutEffect:Bt,useMemo:vt,useReducer:kn,useRef:et,useState:M,useSyncExternalStore:ks,useTransition:Es,version:Hh},Symbol.toStringTag,{value:"Module"})));var Os={exports:{}},sr={exports:{}},Q={};/** @license React v16.13.1
|
|
88
|
+
`)[0].replace(/#{1,6}\s+/g,"").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").trim(),_h=({chatbot:n,data:e,handleChangeConversation:t})=>{if(!e.conversation||e.conversation===void 0)return;const{conversation:r,latestMessage:s}=e,i=()=>{if(r.assignedTo){const a=n.teamMembers.members.find(l=>l.user._id===r.assignedTo);return a!=null&&a.user.profilePicture?p("img",{src:ie(a.user.profilePicture,200),alt:"User"},ie(a.user.profilePicture,200)):p(Zt,{className:"input-background-color"})}return p("img",{src:ie(n.appearance.images.popupChat,200),alt:"Bot"},ie(n.appearance.images.popupChat,200))},o=bh(s==null?void 0:s.data.text);return p("div",{className:"conversationMainItem",onClick:()=>t(r),children:[p("div",{children:p(i,{})}),p("div",{className:"textHolder",children:[p("p",{children:o||"Send a message"}),p("p",{children:as((s==null?void 0:s.createdAt)||(r==null?void 0:r.createdAt))})]}),p("div",{children:[p(Lo,{className:"base-color"}),s.owner==="agent"&&!s.seen&&p("div",{className:"unreadMessage"})]})]})},xs=({chatbot:n,className:e=""})=>p("div",{className:`agents ${e}`,children:n.teamMembers.members.filter(t=>t.joined).slice(0,3).map((t,r)=>p("div",{children:t.user.profilePicture?p("img",{src:ie(t.user.profilePicture,200),alt:"Agent"},ie(t.user.profilePicture,200)):p(Zt,{className:"input-text-color"})},r))}),vh=({chatbot:n,latestCurrentConversation:e})=>{var i;const t=(i=n.teamMembers.members.find(o=>o.user._id===(e==null?void 0:e.assignedTo)))==null?void 0:i.user,r=()=>e!=null&&e.assignedTo?t!=null&&t.profilePicture?p("div",{className:"headerImageWrapper",children:p("img",{src:ie(t.profilePicture,200),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},ie(t.profilePicture,200))}):p("div",{className:"headerImageWrapper",children:p(Zt,{className:"background-text-color"})}):p(xs,{chatbot:n}),s=()=>p("div",{className:"headerImageWrapper",children:p("img",{src:ie(n.appearance.images.popupChat,200),width:"100%",alt:"Chat"},ie(n.appearance.images.popupChat,200))});return p(Te,{children:e!=null&&e.assignedTo?r():s()})},yh=({email:n,chatbot:e,dataFromUser:t})=>{const[r,s]=M(()=>{const o={};if(n){const a=t.data.find(l=>l.type==="email");a&&(o[a.key]=n)}return o}),i=(o,a)=>{switch(o.type){case"text":return p("div",{children:[p("h3",{children:o.name}),p("input",{type:"text",required:o.required,placeholder:o.data.placeholder,value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})})]},`${a}-${o.key}`);case"dropdown":return p("div",{children:[p("h4",{children:o.name}),p("select",{required:o.required,name:o.name,onChange:l=>s({...r,[o.key]:l.target.value}),children:[p("option",{value:"",children:"Select"}),o.data.map(l=>p("option",{value:l.value,children:l.label},l.value))]})]},`${a}-${o.key}`);case"date":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,type:"date",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"time":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,type:"time",onChange:l=>s({...r,[o.key]:l.target.value})})]},`${a}-${o.key}`);case"textarea":return p("div",{children:[p("h4",{children:o.name}),p("textarea",{required:o.required,placeholder:o.data.placeholder,rows:4,value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})})]},`${a}-${o.key}`);case"email":return p("div",{children:[p("h4",{children:o.name}),p("input",{required:o.required,placeholder:o.data.placeholder,type:"email",value:r[o.key]||"",onInput:l=>s({...r,[o.key]:l.currentTarget.value})}),p("span",{className:"hint",children:o.error})]},`${a}-${o.key}`);default:return null}};return p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(e.appearance.images.chat,200),alt:"Bot"},ie(e.appearance.images.chat,200))}),p("div",{className:"messageDiv",children:p("form",{className:"messageP",onSubmit:o=>{o.preventDefault(),t.onSubmit(r)},children:[t.data.map((o,a)=>i(o,a)),p("div",{className:"livelinkSubmitDiv",children:p("button",{type:"submit",children:"Submit"})})]})})]})},xh=({chatbot:n,ratingFromUser:e})=>{const[t,r]=M({comment:"",rating:4});return p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.chat,200),alt:"Bot"},ie(n.appearance.images.chat,200))}),p("div",{className:"messageDiv",children:p("form",{className:"messageP",onSubmit:s=>{s.preventDefault(),t.rating!==0&&e.onSubmit(t)},children:[p("h3",{style:{fontWeight:"400"},children:"Please Leave a review"}),p("div",{children:[p("h4",{children:"Comment"}),p("textarea",{required:!0,minLength:3,maxLength:500,rows:4,onChange:s=>r({...t,comment:s.target.value})})]}),p("div",{style:{display:"flex"},children:[1,2,3,4,5].map(s=>p("div",{style:{cursor:"pointer"},onClick:()=>r({...t,rating:s}),children:p(ld,{className:t.rating>=s?"base-color":"input-text-color"})},s))}),p("div",{className:"livelinkSubmitDiv",children:p("button",{type:"submit",children:"Submit"})})]})})]})},wh=({chatbot:n,onlineAgents:e,currentConversation:t})=>{var s,i,o,a,l;const r=n.chatflow.nodes.find(c=>c.id===t.currentNode);return p("div",{className:"onlineAgents",children:[p("div",{children:p("span",{children:(i=(s=r==null?void 0:r.data)==null?void 0:s.expectedTime)!=null&&i.value?(o=r==null?void 0:r.data)==null?void 0:o.expectedTime.text:"Connecting to an Agent"})}),((l=(a=r==null?void 0:r.data)==null?void 0:a.expectedTime)==null?void 0:l.showOnlineAgents)&&e>0&&p("div",{children:[p(xs,{chatbot:n}),p("p",{children:["Online Agents: ",p("b",{children:e})]})]})]})},kh=({chatbot:n})=>p("div",{className:"mainMessageContainer mySelfTextDiv",children:p("div",{className:"messageDiv mySelfTextDiv",children:p("div",{className:"otherUserTextLoading",children:[p("div",{className:"loading1"}),p("div",{className:"loading2"}),p("div",{className:"loading3"})]})})}),Th=({chatbot:n})=>p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.chat,200),alt:"Bot"},ie(n.appearance.images.chat,200))}),p("div",{className:"messageDiv",children:p("div",{className:"otherUserTextLoading",children:[p("div",{className:"loading1"}),p("div",{className:"loading2"}),p("div",{className:"loading3"})]})})]}),Sh=({chatbot:n,message:e,AIControlNode:t})=>{var g,h;const r=e.owner==="agent",s=r?n.teamMembers.members.find(f=>f.user._id===e.ownerId):null,o=(((g=e.data.sources)==null?void 0:g.filter((f,m,b)=>b.indexOf(f)===m))||[]).filter(f=>f.startsWith("https://")).slice(0,3),a=(h=e.data.file)==null?void 0:h.name,l=a&&/\.(jpg|png|jpeg|gif|bmp)$/i.test(a),c=a&&/\.(mp4|avi|mov|mkv|wmv|flv|webm|mpeg)$/i.test(a),[u,d]=M("");return _e(()=>{const f=K.parse(e.data.text||"");typeof f=="string"?d(f):f.then(d)},[e.data.text]),p("div",{className:`mainMessageContainer ${e.owner==="user"?"mySelfTextDiv":""}`,children:[e.owner!=="user"&&(r?p("div",{className:"logoWithMessageDiv",children:s!=null&&s.user.profilePicture?p("img",{src:ie(s.user.profilePicture,200),alt:"Agent"},ie(s.user.profilePicture,200)):p(Zt,{className:"input-background-color"})}):p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.popupChat,200),alt:"Bot"},ie(n.appearance.images.popupChat,200))})),p("div",{className:`messageDiv ${e.owner==="user"?"mySelfTextDiv":""}`,children:[p("div",{className:"NameAndDate",children:e.owner!=="user"?p(Te,{children:[(s==null?void 0:s.user.name)||"AI"," -"," ",as(e.createdAt)]}):as(e.createdAt)}),l&&e.data.file&&p("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:p("img",{src:e.data.file.url,style:{height:"80px"},alt:"Image"},e.data.file.url)}),c&&e.data.file&&p("a",{target:"_blank",rel:"noopener noreferrer",href:e.data.file.url,style:{borderRadius:"5px"},children:p("video",{src:e.data.file.url,style:{height:"80px"},controls:!0,children:"Video"})}),u&&p("div",{className:"messageP markdownText",dangerouslySetInnerHTML:{__html:u}}),p("div",{className:"sources",children:[e.data.file&&!l&&!c&&p("a",{target:"_blank",href:e.data.file.url,children:e.data.file.name}),(t==null?void 0:t.data.replySource.value)&&o.length>0&&o.map((f,m)=>p("a",{target:"_blank",href:f,children:f},`${f}-${m}`))]})]})]})},Ch=({chatbot:n})=>p("div",{className:"messagesLoading",children:p("div",{children:p(un,{className:"base-color"})})}),Eh=({hoveringMessageInner:n,chatbot:e})=>p("div",{className:"hoveringMessageInner",children:n.data.map((t,r)=>p("div",{onClick:()=>n.onClick(t),children:t.message},r))}),Ah=({file:n,setFile:e,chatbot:t})=>p("div",{className:"hoveringMessageInner",children:p("div",{onClick:()=>e(null),children:[p(jo,{className:"base-text-color",width:"16",height:"16"}),n.name]})}),Rh=({showHoveringMessage:n,hoveringMessages:e,chatbot:t,setShowHoveringMessage:r,coreState:s,conversationState:i,uiState:o,node:a,setChatOpen:l})=>{var j;const[c,u]=M(!1),{token:d,isChatbotDefault:g}=s,{newMessage:h,setNewMessage:f,setCurrentConversation:m,conversations:b,setConversations:v}=i,{callChatFlowRef:x,chatOpen:w}=o,[k,_]=M(Fr("robodialog-chatbot-closed")),S=(a==null?void 0:a.data.popupMessage.value)&&h,P=!g&&!S&&!k&&n,T=()=>{_(!0),Sn("robodialog-chatbot-closed",!0),f(null),r(!1)},A=(h==null?void 0:h.owner)==="agent"?(j=t.teamMembers.members.find(Z=>Z.user._id===h.ownerId))==null?void 0:j.user:null,D=()=>{r(!1),f(null);const Z=b.find(se=>(h==null?void 0:h.conversationId)===se._id);Z&&(x.current=!0,m(Z),l(!0))},E=A!=null&&A.profilePicture?p("div",{className:"headerImageWrapper",children:p("img",{src:ie(A.profilePicture,200),width:"100%",alt:"Profile",style:{borderRadius:"50%"}},ie(A.profilePicture,200))}):p("div",{className:"headerImageWrapper",children:p(Zt,{className:"background-text-color"})});return!(n&&((e==null?void 0:e.length)??0)>0||S)||w?null:p("div",{className:"chatHoveringMessages",children:[(S||P)&&!k&&p("div",{onClick:T,className:"chatHoveringMessage closeMessages",children:c?p("div",{className:"loadingIcon",children:p("div",{style:{width:"16px",height:"16px"},children:p(un,{className:"background-text-color"})})}):p(jo,{className:"background-text-color",width:"16px",height:"16px"})}),S&&p("div",{className:"chatHoveringMessage",onClick:D,children:[p("div",{className:"chatHoveringMessageUser",children:[E,h.owner==="agent"?A==null?void 0:A.name:"AI"]}),p("div",{style:{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis"},children:h.data.text})]}),P&&(e==null?void 0:e.map((Z,se)=>p(Oh,{hoveringMessage:Z,chatbot:t,loading:c,setLoading:u,coreState:s,conversationState:i,uiState:o,setShowHoveringMessage:r,token:d,node:a,setChatOpen:l,conversations:b,setConversations:v,setCurrentConversation:m,callChatFlowRef:x},se)))]})},Oh=({hoveringMessage:n,chatbot:e,loading:t,setLoading:r,setShowHoveringMessage:s,token:i,setChatOpen:o,setConversations:a,conversations:l,setCurrentConversation:c,callChatFlowRef:u,coreState:d,conversationState:g,uiState:h})=>{var b;const f=async()=>{if(t)return;o(!0),r(!0);let v={};if(n.type==="query")v.chatflow={key:"end",index:0};else{const x=e.chatflow.edges.find(w=>w.sourceHandle===n.id);if(!x){r(!1);return}v.nodeId=x.target}try{const x=await $t.userCreate({body:v},i);if(!x.data)throw new Error("Conversation creation failed");const w=x.data;if(a([...l,w]),n.type==="query"){const k=e.chatflow.nodes.find(_=>_.id===w.currentNode);k&&(h.humanControl=k.data.control.type==="human"),c(w),await us({coreState:d,conversationState:g,uiState:h,userMessage:n.query,setUserMessage:()=>{},file:null,setFile:()=>{},showToast:()=>{},latestCurrentConversation:w})}else u.current=!0,c(w);s(!1)}catch(x){console.error("Chat hovering message error:",x)}finally{r(!1)}},m=n.showUser?(b=e.teamMembers.members.find(v=>{var x;return v.user._id===((x=n==null?void 0:n.user)==null?void 0:x._id)}))==null?void 0:b.user:null;return p("div",{className:"chatHoveringMessage",onClick:f,children:[n.showUser&&m&&p("div",{className:"chatHoveringMessageUser",children:[p("div",{children:m.profilePicture?p("img",{src:ie(m.profilePicture,200)},ie(m.profilePicture,200)):p(Zt,{className:"input-background-color"})}),n.title]}),p("div",{children:n.message})]})};var tr={exports:{}},ca={};function ua(n,e){for(var t in e)n[t]=e[t];return n}function ws(n,e){for(var t in n)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&n[r]!==e[r])return!0;return!1}function ks(n,e){var t=e(),r=M({t:{__:t,u:e}}),s=r[0].t,i=r[1];return Bt(function(){s.__=t,s.u=e,Ts(s)&&i({t:s})},[n,t,e]),_e(function(){return Ts(s)&&i({t:s}),n(function(){Ts(s)&&i({t:s})})},[n]),t}function Ts(n){var e,t,r=n.u,s=n.__;try{var i=r();return!((e=s)===(t=i)&&(e!==0||1/e==1/t)||e!=e&&t!=t)}catch{return!0}}function Ss(n){n()}function Cs(n){return n}function Es(){return[!1,Ss]}var As=Bt;function nr(n,e){this.props=n,this.context=e}function da(n,e){function t(s){var i=this.props.ref,o=i==s.ref;return!o&&i&&(i.call?i(null):i.current=null),e?!e(this.props,s)||!o:ws(this.props,s)}function r(s){return this.shouldComponentUpdate=t,Qe(n,s)}return r.displayName="Memo("+(n.displayName||n.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r.type=n,r}(nr.prototype=new We).isPureReactComponent=!0,nr.prototype.shouldComponentUpdate=function(n,e){return ws(this.props,n)||ws(this.state,e)};var ha=N.__b;N.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),ha&&ha(n)};var Ph=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function fa(n){function e(t){var r=ua({},t);return delete r.ref,n(r,t.ref||null)}return e.$$typeof=Ph,e.render=n,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(n.displayName||n.name)+")",e}var pa=function(n,e){return n==null?null:ut(ut(n).map(e))},ga={map:pa,forEach:pa,count:function(n){return n?ut(n).length:0},only:function(n){var e=ut(n);if(e.length!==1)throw"Children.only";return e[0]},toArray:ut},Dh=N.__e;N.__e=function(n,e,t,r){if(n.then){for(var s,i=e;i=i.__;)if((s=i.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(n,e)}Dh(n,e,t,r)};var ma=N.unmount;function ba(n,e,t){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),n.__c.__H=null),(n=ua({},n)).__c!=null&&(n.__c.__P===t&&(n.__c.__P=e),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(r){return ba(r,e,t)})),n}function _a(n,e,t){return n&&t&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(r){return _a(r,e,t)}),n.__c&&n.__c.__P===e&&(n.__e&&t.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=t)),n}function mn(){this.__u=0,this.o=null,this.__b=null}function va(n){var e=n.__.__c;return e&&e.__a&&e.__a(n)}function ya(n){var e,t,r,s=null;function i(o){if(e||(e=n()).then(function(a){a&&(s=a.default||a),r=!0},function(a){t=a,r=!0}),t)throw t;if(!r)throw e;return s?Qe(s,o):null}return i.displayName="Lazy",i.__f=!0,i}function Gt(){this.i=null,this.l=null}N.unmount=function(n){var e=n.__c;e&&e.__R&&e.__R(),e&&32&n.__u&&(n.type=null),ma&&ma(n)},(mn.prototype=new We).__c=function(n,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=va(r.__v),i=!1,o=function(){i||(i=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=_a(l,l.__c.__P,l.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.o.pop();)c.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(o,o)},mn.prototype.componentWillUnmount=function(){this.o=[]},mn.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=ba(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&Qe(Te,null,n.fallback);return s&&(s.__u&=-33),[Qe(Te,null,e.__a?null:n.children),s]};var xa=function(n,e,t){if(++t[1]===t[0]&&n.l.delete(e),n.props.revealOrder&&(n.props.revealOrder[0]!=="t"||!n.l.size))for(t=n.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;n.i=t=t[2]}};function Ih(n){return this.getChildContext=function(){return n.context},n.children}function $h(n){var e=this,t=n.h;if(e.componentWillUnmount=function(){Ct(null,e.v),e.v=null,e.h=null},e.h&&e.h!==t&&e.componentWillUnmount(),!e.v){for(var r=e.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;e.h=t,e.v={nodeType:1,parentNode:t,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(s,i){this.childNodes.push(s),e.h.insertBefore(s,i)},removeChild:function(s){this.childNodes.splice(this.childNodes.indexOf(s)>>>1,1),e.h.removeChild(s)}}}Ct(Qe(Ih,{context:e.context},n.__v),e.v)}function wa(n,e){var t=Qe($h,{__v:n,h:e});return t.containerInfo=e,t}(Gt.prototype=new We).__a=function(n){var e=this,t=va(e.__v),r=e.l.get(n);return r[0]++,function(s){var i=function(){e.props.revealOrder?(r.push(s),xa(e,n,r)):s()};t?t(i):i()}},Gt.prototype.render=function(n){this.i=null,this.l=new Map;var e=ut(n.children);n.revealOrder&&n.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return n.children},Gt.prototype.componentDidUpdate=Gt.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(e,t){xa(n,t,e)})};var ka=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Nh=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Mh=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Fh=/[A-Z0-9]/g,Lh=typeof document<"u",jh=function(n){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(n)};function Ta(n,e,t){return e.__k==null&&(e.textContent=""),Ct(n,e),typeof t=="function"&&t(),n?n.__c:null}function Sa(n,e,t){return di(n,e),typeof t=="function"&&t(),n?n.__c:null}We.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(n){Object.defineProperty(We.prototype,n,{configurable:!0,get:function(){return this["UNSAFE_"+n]},set:function(e){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:e})}})});var Ca=N.event;function Uh(){}function zh(){return this.cancelBubble}function qh(){return this.defaultPrevented}N.event=function(n){return Ca&&(n=Ca(n)),n.persist=Uh,n.isPropagationStopped=zh,n.isDefaultPrevented=qh,n.nativeEvent=n};var Rs,Bh={enumerable:!1,configurable:!0,get:function(){return this.class}},Ea=N.vnode;N.vnode=function(n){typeof n.type=="string"&&function(e){var t=e.props,r=e.type,s={},i=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||Lh&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||jh(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":Mh.test(o)&&(o=l):l=o="oninput":i&&Nh.test(o)?o=o.replace(Fh,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=ut(t.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=ut(t.children).forEach(function(c){c.props.selected=s.multiple?s.defaultValue.indexOf(c.props.value)!=-1:s.defaultValue==c.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",Bh)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s}(n),n.$$typeof=ka,Ea&&Ea(n)};var Aa=N.__r;N.__r=function(n){Aa&&Aa(n),Rs=n.__c};var Ra=N.diffed;N.diffed=function(n){Ra&&Ra(n);var e=n.props,t=n.__e;t!=null&&n.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),Rs=null};var Oa={ReactCurrentDispatcher:{current:{readContext:function(n){return Rs.__n[n.__c].props.value},useCallback:Ht,useContext:Dr,useDebugValue:Ir,useDeferredValue:Cs,useEffect:_e,useId:$r,useImperativeHandle:Pr,useInsertionEffect:As,useLayoutEffect:Bt,useMemo:vt,useReducer:kn,useRef:et,useState:M,useSyncExternalStore:ks,useTransition:Es}}},Hh="18.3.1";function Pa(n){return Qe.bind(null,n)}function bn(n){return!!n&&n.$$typeof===ka}function Da(n){return bn(n)&&n.type===Te}function Ia(n){return!!n&&!!n.displayName&&(typeof n.displayName=="string"||n.displayName instanceof String)&&n.displayName.startsWith("Memo(")}function $a(n){return bn(n)?Nl.apply(null,arguments):n}function Na(n){return!!n.__k&&(Ct(null,n),!0)}function Ma(n){return n&&(n.base||n.nodeType===1&&n)||null}var Fa=function(n,e){return n(e)},La=function(n,e){return n(e)},ja=Te,Ua=bn,Wh={useState:M,useId:$r,useReducer:kn,useEffect:_e,useLayoutEffect:Bt,useInsertionEffect:As,useTransition:Es,useDeferredValue:Cs,useSyncExternalStore:ks,startTransition:Ss,useRef:et,useImperativeHandle:Pr,useMemo:vt,useCallback:Ht,useContext:Dr,useDebugValue:Ir,version:"18.3.1",Children:ga,render:Ta,hydrate:Sa,unmountComponentAtNode:Na,createPortal:wa,createElement:Qe,createContext:hi,createFactory:Pa,cloneElement:$a,createRef:ni,Fragment:Te,isValidElement:bn,isElement:Ua,isFragment:Da,isMemo:Ia,findDOMNode:Ma,Component:We,PureComponent:nr,memo:da,forwardRef:fa,flushSync:La,unstable_batchedUpdates:Fa,StrictMode:ja,Suspense:mn,SuspenseList:Gt,lazy:ya,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Oa};const rr=hu(Object.freeze(Object.defineProperty({__proto__:null,Children:ga,Component:We,Fragment:Te,PureComponent:nr,StrictMode:ja,Suspense:mn,SuspenseList:Gt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Oa,cloneElement:$a,createContext:hi,createElement:Qe,createFactory:Pa,createPortal:wa,createRef:ni,default:Wh,findDOMNode:Ma,flushSync:La,forwardRef:fa,hydrate:Sa,isElement:Ua,isFragment:Da,isMemo:Ia,isValidElement:bn,lazy:ya,memo:da,render:Ta,startTransition:Ss,unmountComponentAtNode:Na,unstable_batchedUpdates:Fa,useCallback:Ht,useContext:Dr,useDebugValue:Ir,useDeferredValue:Cs,useEffect:_e,useErrorBoundary:Fl,useId:$r,useImperativeHandle:Pr,useInsertionEffect:As,useLayoutEffect:Bt,useMemo:vt,useReducer:kn,useRef:et,useState:M,useSyncExternalStore:ks,useTransition:Es,version:Hh},Symbol.toStringTag,{value:"Module"})));var Os={exports:{}},sr={exports:{}},Q={};/** @license React v16.13.1
|
|
89
89
|
* react-is.production.min.js
|
|
90
90
|
*
|
|
91
91
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -106,7 +106,7 @@ object-assign
|
|
|
106
106
|
*/var Ps,Wa;function Xh(){if(Wa)return Ps;Wa=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function s(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var o={},a=0;a<10;a++)o["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(o).map(function(u){return o[u]});if(l.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ps=s()?Object.assign:function(i,o){for(var a,l=r(i),c,u=1;u<arguments.length;u++){a=Object(arguments[u]);for(var d in a)e.call(a,d)&&(l[d]=a[d]);if(n){c=n(a);for(var g=0;g<c.length;g++)t.call(a,c[g])&&(l[c[g]]=a[c[g]])}}return l},Ps}var Ds,Va;function Is(){if(Va)return Ds;Va=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ds=n,Ds}var $s,Ya;function Xa(){return Ya||(Ya=1,$s=Function.call.bind(Object.prototype.hasOwnProperty)),$s}var Ns,Ja;function Jh(){if(Ja)return Ns;Ja=1;var n=function(){};if(be.env.NODE_ENV!=="production"){var e=Is(),t={},r=Xa();n=function(i){var o="Warning: "+i;typeof console<"u"&&console.error(o);try{throw new Error(o)}catch{}}}function s(i,o,a,l,c){if(be.env.NODE_ENV!=="production"){for(var u in i)if(r(i,u)){var d;try{if(typeof i[u]!="function"){var g=Error((l||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}d=i[u](o,u,l,a,null,e)}catch(f){d=f}if(d&&!(d instanceof Error)&&n((l||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in t)){t[d.message]=!0;var h=c?c():"";n("Failed "+a+" type: "+d.message+(h??""))}}}}return s.resetWarningCache=function(){be.env.NODE_ENV!=="production"&&(t={})},Ns=s,Ns}var Ms,Za;function Zh(){if(Za)return Ms;Za=1;var n=Ha(),e=Xh(),t=Is(),r=Xa(),s=Jh(),i=function(){};be.env.NODE_ENV!=="production"&&(i=function(a){var l="Warning: "+a;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function o(){return null}return Ms=function(a,l){var c=typeof Symbol=="function"&&Symbol.iterator,u="@@iterator";function d(C){var R=C&&(c&&C[c]||C[u]);if(typeof R=="function")return R}var g="<<anonymous>>",h={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:x(),arrayOf:w,element:k(),elementType:_(),instanceOf:S,node:D(),objectOf:T,oneOf:P,oneOfType:A,shape:j,exact:Z};function f(C,R){return C===R?C!==0||1/C===1/R:C!==C&&R!==R}function m(C,R){this.message=C,this.data=R&&typeof R=="object"?R:{},this.stack=""}m.prototype=Error.prototype;function b(C){if(be.env.NODE_ENV!=="production")var R={},$=0;function F(q,U,z,H,X,W,le){if(H=H||g,W=W||z,le!==t){if(l){var O=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw O.name="Invariant Violation",O}else if(be.env.NODE_ENV!=="production"&&typeof console<"u"){var Ne=H+":"+z;!R[Ne]&&$<3&&(i("You are manually calling a React.PropTypes validation function for the `"+W+"` prop on `"+H+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),R[Ne]=!0,$++)}}return U[z]==null?q?U[z]===null?new m("The "+X+" `"+W+"` is marked as required "+("in `"+H+"`, but its value is `null`.")):new m("The "+X+" `"+W+"` is marked as required in "+("`"+H+"`, but its value is `undefined`.")):null:C(U,z,H,X,W)}var I=F.bind(null,!1);return I.isRequired=F.bind(null,!0),I}function v(C){function R($,F,I,q,U,z){var H=$[F],X=G(H);if(X!==C){var W=ye(H);return new m("Invalid "+q+" `"+U+"` of type "+("`"+W+"` supplied to `"+I+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(R)}function x(){return b(o)}function w(C){function R($,F,I,q,U){if(typeof C!="function")return new m("Property `"+U+"` of component `"+I+"` has invalid PropType notation inside arrayOf.");var z=$[F];if(!Array.isArray(z)){var H=G(z);return new m("Invalid "+q+" `"+U+"` of type "+("`"+H+"` supplied to `"+I+"`, expected an array."))}for(var X=0;X<z.length;X++){var W=C(z,X,I,q,U+"["+X+"]",t);if(W instanceof Error)return W}return null}return b(R)}function k(){function C(R,$,F,I,q){var U=R[$];if(!a(U)){var z=G(U);return new m("Invalid "+I+" `"+q+"` of type "+("`"+z+"` supplied to `"+F+"`, expected a single ReactElement."))}return null}return b(C)}function _(){function C(R,$,F,I,q){var U=R[$];if(!n.isValidElementType(U)){var z=G(U);return new m("Invalid "+I+" `"+q+"` of type "+("`"+z+"` supplied to `"+F+"`, expected a single ReactElement type."))}return null}return b(C)}function S(C){function R($,F,I,q,U){if(!($[F]instanceof C)){var z=C.name||g,H=Be($[F]);return new m("Invalid "+q+" `"+U+"` of type "+("`"+H+"` supplied to `"+I+"`, expected ")+("instance of `"+z+"`."))}return null}return b(R)}function P(C){if(!Array.isArray(C))return be.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),o;function R($,F,I,q,U){for(var z=$[F],H=0;H<C.length;H++)if(f(z,C[H]))return null;var X=JSON.stringify(C,function(le,O){var Ne=ye(O);return Ne==="symbol"?String(O):O});return new m("Invalid "+q+" `"+U+"` of value `"+String(z)+"` "+("supplied to `"+I+"`, expected one of "+X+"."))}return b(R)}function T(C){function R($,F,I,q,U){if(typeof C!="function")return new m("Property `"+U+"` of component `"+I+"` has invalid PropType notation inside objectOf.");var z=$[F],H=G(z);if(H!=="object")return new m("Invalid "+q+" `"+U+"` of type "+("`"+H+"` supplied to `"+I+"`, expected an object."));for(var X in z)if(r(z,X)){var W=C(z,X,I,q,U+"."+X,t);if(W instanceof Error)return W}return null}return b(R)}function A(C){if(!Array.isArray(C))return be.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var R=0;R<C.length;R++){var $=C[R];if(typeof $!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+he($)+" at index "+R+"."),o}function F(I,q,U,z,H){for(var X=[],W=0;W<C.length;W++){var le=C[W],O=le(I,q,U,z,H,t);if(O==null)return null;O.data&&r(O.data,"expectedType")&&X.push(O.data.expectedType)}var Ne=X.length>0?", expected one of type ["+X.join(", ")+"]":"";return new m("Invalid "+z+" `"+H+"` supplied to "+("`"+U+"`"+Ne+"."))}return b(F)}function D(){function C(R,$,F,I,q){return se(R[$])?null:new m("Invalid "+I+" `"+q+"` supplied to "+("`"+F+"`, expected a ReactNode."))}return b(C)}function E(C,R,$,F,I){return new m((C||"React class")+": "+R+" type `"+$+"."+F+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+I+"`.")}function j(C){function R($,F,I,q,U){var z=$[F],H=G(z);if(H!=="object")return new m("Invalid "+q+" `"+U+"` of type `"+H+"` "+("supplied to `"+I+"`, expected `object`."));for(var X in C){var W=C[X];if(typeof W!="function")return E(I,q,U,X,ye(W));var le=W(z,X,I,q,U+"."+X,t);if(le)return le}return null}return b(R)}function Z(C){function R($,F,I,q,U){var z=$[F],H=G(z);if(H!=="object")return new m("Invalid "+q+" `"+U+"` of type `"+H+"` "+("supplied to `"+I+"`, expected `object`."));var X=e({},$[F],C);for(var W in X){var le=C[W];if(r(C,W)&&typeof le!="function")return E(I,q,U,W,ye(le));if(!le)return new m("Invalid "+q+" `"+U+"` key `"+W+"` supplied to `"+I+"`.\nBad object: "+JSON.stringify($[F],null," ")+`
|
|
107
107
|
Valid keys: `+JSON.stringify(Object.keys(C),null," "));var O=le(z,W,I,q,U+"."+W,t);if(O)return O}return null}return b(R)}function se(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(se);if(C===null||a(C))return!0;var R=d(C);if(R){var $=R.call(C),F;if(R!==C.entries){for(;!(F=$.next()).done;)if(!se(F.value))return!1}else for(;!(F=$.next()).done;){var I=F.value;if(I&&!se(I[1]))return!1}}else return!1;return!0;default:return!1}}function Oe(C,R){return C==="symbol"?!0:R?R["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&R instanceof Symbol:!1}function G(C){var R=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":Oe(R,C)?"symbol":R}function ye(C){if(typeof C>"u"||C===null)return""+C;var R=G(C);if(R==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return R}function he(C){var R=ye(C);switch(R){case"array":case"object":return"an "+R;case"boolean":case"date":case"regexp":return"a "+R;default:return R}}function Be(C){return!C.constructor||!C.constructor.name?g:C.constructor.name}return h.checkPropTypes=s,h.resetWarningCache=s.resetWarningCache,h.PropTypes=h,h},Ms}var Fs,Ga;function Gh(){if(Ga)return Fs;Ga=1;var n=Is();function e(){}function t(){}return t.resetWarningCache=e,Fs=function(){function r(o,a,l,c,u,d){if(d!==n){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}r.isRequired=r;function s(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:t,resetWarningCache:e};return i.PropTypes=i,i},Fs}if(be.env.NODE_ENV!=="production"){var Kh=Ha(),Qh=!0;Os.exports=Zh()(Kh.isElement,Qh)}else Os.exports=Gh()();var Ka=Os.exports,Ls={exports:{}};function Qa(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var s=n.length;for(e=0;e<s;e++)n[e]&&(t=Qa(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function el(){for(var n,e,t=0,r="",s=arguments.length;t<s;t++)(n=arguments[t])&&(e=Qa(n))&&(r&&(r+=" "),r+=e);return r}Ls.exports=el,Ls.exports.clsx=el;var ef=Ls.exports,de={},it={};Object.defineProperty(it,"__esModule",{value:!0}),it.dontSetMe=of,it.findInArray=tf,it.int=sf,it.isFunction=nf,it.isNum=rf;function tf(n,e){for(let t=0,r=n.length;t<r;t++)if(e.apply(e,[n[t],t,n]))return n[t]}function nf(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Function]"}function rf(n){return typeof n=="number"&&!isNaN(n)}function sf(n){return parseInt(n,10)}function of(n,e,t){if(n[e])return new Error(`Invalid prop ${e} passed to ${t} - do not set this, set it on the child.`)}var Lt={};Object.defineProperty(Lt,"__esModule",{value:!0}),Lt.browserPrefixToKey=nl,Lt.browserPrefixToStyle=af,Lt.default=void 0,Lt.getPrefix=tl;const js=["Moz","Webkit","O","ms"];function tl(){var t,r;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const e=(r=(t=window.document)==null?void 0:t.documentElement)==null?void 0:r.style;if(!e||n in e)return"";for(let s=0;s<js.length;s++)if(nl(n,js[s])in e)return js[s];return""}function nl(n,e){return e?`${e}${lf(n)}`:n}function af(n,e){return e?`-${e.toLowerCase()}-${n}`:n}function lf(n){let e="",t=!0;for(let r=0;r<n.length;r++)t?(e+=n[r].toUpperCase(),t=!1):n[r]==="-"?t=!0:e+=n[r];return e}Lt.default=tl(),Object.defineProperty(de,"__esModule",{value:!0}),de.addClassName=al,de.addEvent=uf,de.addUserSelectStyles=xf,de.createCSSTransform=bf,de.createSVGTransform=_f,de.getTouch=vf,de.getTouchIdentifier=yf,de.getTranslation=Us,de.innerHeight=pf,de.innerWidth=gf,de.matchesSelector=il,de.matchesSelectorAndParentsTo=cf,de.offsetXYFromParent=mf,de.outerHeight=hf,de.outerWidth=ff,de.removeClassName=ll,de.removeEvent=df,de.scheduleRemoveUserSelectStyles=wf;var je=it,rl=sl(Lt);function sl(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(sl=function(s,i){if(!i&&s&&s.__esModule)return s;var o,a,l={__proto__:null,default:s};if(s===null||typeof s!="object"&&typeof s!="function")return l;if(o=i?r:t){if(o.has(s))return o.get(s);o.set(s,l)}for(const c in s)c!=="default"&&{}.hasOwnProperty.call(s,c)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(s,c))&&(a.get||a.set)?o(l,c,a):l[c]=s[c]);return l})(n,e)}let ir="";function il(n,e){return ir||(ir=(0,je.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return(0,je.isFunction)(n[t])})),(0,je.isFunction)(n[ir])?n[ir](e):!1}function cf(n,e,t){let r=n;do{if(il(r,e))return!0;if(r===t)return!1;r=r.parentNode}while(r);return!1}function uf(n,e,t,r){if(!n)return;const s={capture:!0,...r};n.addEventListener?n.addEventListener(e,t,s):n.attachEvent?n.attachEvent("on"+e,t):n["on"+e]=t}function df(n,e,t,r){if(!n)return;const s={capture:!0,...r};n.removeEventListener?n.removeEventListener(e,t,s):n.detachEvent?n.detachEvent("on"+e,t):n["on"+e]=null}function hf(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,je.int)(t.borderTopWidth),e+=(0,je.int)(t.borderBottomWidth),e}function ff(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e+=(0,je.int)(t.borderLeftWidth),e+=(0,je.int)(t.borderRightWidth),e}function pf(n){let e=n.clientHeight;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,je.int)(t.paddingTop),e-=(0,je.int)(t.paddingBottom),e}function gf(n){let e=n.clientWidth;const t=n.ownerDocument.defaultView.getComputedStyle(n);return e-=(0,je.int)(t.paddingLeft),e-=(0,je.int)(t.paddingRight),e}function mf(n,e,t){const s=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),i=(n.clientX+e.scrollLeft-s.left)/t,o=(n.clientY+e.scrollTop-s.top)/t;return{x:i,y:o}}function bf(n,e){const t=Us(n,e,"px");return{[(0,rl.browserPrefixToKey)("transform",rl.default)]:t}}function _f(n,e){return Us(n,e,"")}function Us(n,e,t){let{x:r,y:s}=n,i=`translate(${r}${t},${s}${t})`;if(e){const o=`${typeof e.x=="string"?e.x:e.x+t}`,a=`${typeof e.y=="string"?e.y:e.y+t}`;i=`translate(${o}, ${a})`+i}return i}function vf(n,e){return n.targetTouches&&(0,je.findInArray)(n.targetTouches,t=>e===t.identifier)||n.changedTouches&&(0,je.findInArray)(n.changedTouches,t=>e===t.identifier)}function yf(n){if(n.targetTouches&&n.targetTouches[0])return n.targetTouches[0].identifier;if(n.changedTouches&&n.changedTouches[0])return n.changedTouches[0].identifier}function xf(n){if(!n)return;let e=n.getElementById("react-draggable-style-el");e||(e=n.createElement("style"),e.type="text/css",e.id="react-draggable-style-el",e.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
108
108
|
`,e.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
109
|
-
`,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&al(n.body,"react-draggable-transparent-selection")}function wf(n){window.requestAnimationFrame?window.requestAnimationFrame(()=>{ol(n)}):ol(n)}function ol(n){if(n)try{if(n.body&&ll(n.body,"react-draggable-transparent-selection"),n.selection)n.selection.empty();else{const e=(n.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function al(n,e){n.classList?n.classList.add(e):n.className.match(new RegExp(`(?:^|\\s)${e}(?!\\S)`))||(n.className+=` ${e}`)}function ll(n,e){n.classList?n.classList.remove(e):n.className=n.className.replace(new RegExp(`(?:^|\\s)${e}(?!\\S)`,"g"),"")}var ot={};Object.defineProperty(ot,"__esModule",{value:!0}),ot.canDragX=Sf,ot.canDragY=Cf,ot.createCoreData=Af,ot.createDraggableData=Rf,ot.getBoundPosition=kf,ot.getControlPosition=Ef,ot.snapToGrid=Tf;var Ue=it,Kt=de;function kf(n,e,t){if(!n.props.bounds)return[e,t];let{bounds:r}=n.props;r=typeof r=="string"?r:Of(r);const s=zs(n);if(typeof r=="string"){const{ownerDocument:i}=s,o=i.defaultView;let a;if(r==="parent"?a=s.parentNode:a=s.getRootNode().querySelector(r),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=a,c=o.getComputedStyle(s),u=o.getComputedStyle(l);r={left:-s.offsetLeft+(0,Ue.int)(u.paddingLeft)+(0,Ue.int)(c.marginLeft),top:-s.offsetTop+(0,Ue.int)(u.paddingTop)+(0,Ue.int)(c.marginTop),right:(0,Kt.innerWidth)(l)-(0,Kt.outerWidth)(s)-s.offsetLeft+(0,Ue.int)(u.paddingRight)-(0,Ue.int)(c.marginRight),bottom:(0,Kt.innerHeight)(l)-(0,Kt.outerHeight)(s)-s.offsetTop+(0,Ue.int)(u.paddingBottom)-(0,Ue.int)(c.marginBottom)}}return(0,Ue.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,Ue.isNum)(r.bottom)&&(t=Math.min(t,r.bottom)),(0,Ue.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,Ue.isNum)(r.top)&&(t=Math.max(t,r.top)),[e,t]}function Tf(n,e,t){const r=Math.round(e/n[0])*n[0],s=Math.round(t/n[1])*n[1];return[r,s]}function Sf(n){return n.props.axis==="both"||n.props.axis==="x"}function Cf(n){return n.props.axis==="both"||n.props.axis==="y"}function Ef(n,e,t){const r=typeof e=="number"?(0,Kt.getTouch)(n,e):null;if(typeof e=="number"&&!r)return null;const s=zs(t),i=t.props.offsetParent||s.offsetParent||s.ownerDocument.body;return(0,Kt.offsetXYFromParent)(r||n,i,t.props.scale)}function Af(n,e,t){const r=!(0,Ue.isNum)(n.lastX),s=zs(n);return r?{node:s,deltaX:0,deltaY:0,lastX:e,lastY:t,x:e,y:t}:{node:s,deltaX:e-n.lastX,deltaY:t-n.lastY,lastX:n.lastX,lastY:n.lastY,x:e,y:t}}function Rf(n,e){const t=n.props.scale;return{node:e.node,x:n.state.x+e.deltaX/t,y:n.state.y+e.deltaY/t,deltaX:e.deltaX/t,deltaY:e.deltaY/t,lastX:n.state.x,lastY:n.state.y}}function Of(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}function zs(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var or={},ar={};Object.defineProperty(ar,"__esModule",{value:!0}),ar.default=Pf;function Pf(){}Object.defineProperty(or,"__esModule",{value:!0}),or.default=void 0;var qs=cl(rr),Ee=Hs(Ka),Df=Hs(rr),we=de,wt=ot,Bs=it,_n=Hs(ar);function Hs(n){return n&&n.__esModule?n:{default:n}}function cl(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(cl=function(s,i){if(!i&&s&&s.__esModule)return s;var o,a,l={__proto__:null,default:s};if(s===null||typeof s!="object"&&typeof s!="function")return l;if(o=i?r:t){if(o.has(s))return o.get(s);o.set(s,l)}for(const c in s)c!=="default"&&{}.hasOwnProperty.call(s,c)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(s,c))&&(a.get||a.set)?o(l,c,a):l[c]=s[c]);return l})(n,e)}function Ae(n,e,t){return(e=If(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function If(n){var e=$f(n,"string");return typeof e=="symbol"?e:e+""}function $f(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const Ze={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let kt=Ze.mouse,lr=class extends qs.Component{constructor(){super(...arguments),Ae(this,"dragging",!1),Ae(this,"lastX",NaN),Ae(this,"lastY",NaN),Ae(this,"touchIdentifier",null),Ae(this,"mounted",!1),Ae(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=t;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,we.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,we.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type==="touchstart"&&!this.props.allowMobileScroll&&e.preventDefault();const s=(0,we.getTouchIdentifier)(e);this.touchIdentifier=s;const i=(0,wt.getControlPosition)(e,s,this);if(i==null)return;const{x:o,y:a}=i,l=(0,wt.createCoreData)(this,o,a);(0,_n.default)("DraggableCore: handleDragStart: %j",l),(0,_n.default)("calling",this.props.onStart),!(this.props.onStart(e,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,we.addUserSelectStyles)(r),this.dragging=!0,this.lastX=o,this.lastY=a,(0,we.addEvent)(r,kt.move,this.handleDrag),(0,we.addEvent)(r,kt.stop,this.handleDragStop))}),Ae(this,"handleDrag",e=>{const t=(0,wt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:s}=t;if(Array.isArray(this.props.grid)){let a=r-this.lastX,l=s-this.lastY;if([a,l]=(0,wt.snapToGrid)(this.props.grid,a,l),!a&&!l)return;r=this.lastX+a,s=this.lastY+l}const i=(0,wt.createCoreData)(this,r,s);if((0,_n.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=s}),Ae(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,wt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:s}=t;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,c=s-this.lastY||0;[l,c]=(0,wt.snapToGrid)(this.props.grid,l,c),r=this.lastX+l,s=this.lastY+c}const i=(0,wt.createCoreData)(this,r,s);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,we.scheduleRemoveUserSelectStyles)(a.ownerDocument),(0,_n.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,_n.default)("DraggableCore: Removing handlers"),(0,we.removeEvent)(a.ownerDocument,kt.move,this.handleDrag),(0,we.removeEvent)(a.ownerDocument,kt.stop,this.handleDragStop))}),Ae(this,"onMouseDown",e=>(kt=Ze.mouse,this.handleDragStart(e))),Ae(this,"onMouseUp",e=>(kt=Ze.mouse,this.handleDragStop(e))),Ae(this,"onTouchStart",e=>(kt=Ze.touch,this.handleDragStart(e))),Ae(this,"onTouchEnd",e=>(kt=Ze.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,we.addEvent)(e,Ze.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,we.removeEvent)(t,Ze.mouse.move,this.handleDrag),(0,we.removeEvent)(t,Ze.touch.move,this.handleDrag),(0,we.removeEvent)(t,Ze.mouse.stop,this.handleDragStop),(0,we.removeEvent)(t,Ze.touch.stop,this.handleDragStop),(0,we.removeEvent)(e,Ze.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,we.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){var e,t,r;return(e=this.props)!=null&&e.nodeRef?(r=(t=this.props)==null?void 0:t.nodeRef)==null?void 0:r.current:Df.default.findDOMNode(this)}render(){return qs.cloneElement(qs.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};or.default=lr,Ae(lr,"displayName","DraggableCore"),Ae(lr,"propTypes",{allowAnyClick:Ee.default.bool,allowMobileScroll:Ee.default.bool,children:Ee.default.node.isRequired,disabled:Ee.default.bool,enableUserSelectHack:Ee.default.bool,offsetParent:function(n,e){if(n[e]&&n[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ee.default.arrayOf(Ee.default.number),handle:Ee.default.string,cancel:Ee.default.string,nodeRef:Ee.default.object,onStart:Ee.default.func,onDrag:Ee.default.func,onStop:Ee.default.func,onMouseDown:Ee.default.func,scale:Ee.default.number,className:Bs.dontSetMe,style:Bs.dontSetMe,transform:Bs.dontSetMe}),Ae(lr,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),n.default=void 0;var e=d(rr),t=u(Ka),r=u(rr),s=ef,i=de,o=ot,a=it,l=u(or),c=u(ar);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,x){if(typeof WeakMap=="function")var w=new WeakMap,k=new WeakMap;return(d=function(_,S){if(!S&&_&&_.__esModule)return _;var P,T,A={__proto__:null,default:_};if(_===null||typeof _!="object"&&typeof _!="function")return A;if(P=S?k:w){if(P.has(_))return P.get(_);P.set(_,A)}for(const D in _)D!=="default"&&{}.hasOwnProperty.call(_,D)&&((T=(P=Object.defineProperty)&&Object.getOwnPropertyDescriptor(_,D))&&(T.get||T.set)?P(A,D,T):A[D]=_[D]);return A})(v,x)}function g(){return g=Object.assign?Object.assign.bind():function(v){for(var x=1;x<arguments.length;x++){var w=arguments[x];for(var k in w)({}).hasOwnProperty.call(w,k)&&(v[k]=w[k])}return v},g.apply(null,arguments)}function h(v,x,w){return(x=f(x))in v?Object.defineProperty(v,x,{value:w,enumerable:!0,configurable:!0,writable:!0}):v[x]=w,v}function f(v){var x=m(v,"string");return typeof x=="symbol"?x:x+""}function m(v,x){if(typeof v!="object"||!v)return v;var w=v[Symbol.toPrimitive];if(w!==void 0){var k=w.call(v,x);if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(v)}class b extends e.Component{static getDerivedStateFromProps(x,w){let{position:k}=x,{prevPropsPosition:_}=w;return k&&(!_||k.x!==_.x||k.y!==_.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:k,prevPropsPosition:_}),{x:k.x,y:k.y,prevPropsPosition:{...k}}):null}constructor(x){super(x),h(this,"onDragStart",(w,k)=>{if((0,c.default)("Draggable: onDragStart: %j",k),this.props.onStart(w,(0,o.createDraggableData)(this,k))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),h(this,"onDrag",(w,k)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",k);const _=(0,o.createDraggableData)(this,k),S={x:_.x,y:_.y,slackX:0,slackY:0};if(this.props.bounds){const{x:T,y:A}=S;S.x+=this.state.slackX,S.y+=this.state.slackY;const[D,E]=(0,o.getBoundPosition)(this,S.x,S.y);S.x=D,S.y=E,S.slackX=this.state.slackX+(T-S.x),S.slackY=this.state.slackY+(A-S.y),_.x=S.x,_.y=S.y,_.deltaX=S.x-this.state.x,_.deltaY=S.y-this.state.y}if(this.props.onDrag(w,_)===!1)return!1;this.setState(S)}),h(this,"onDragStop",(w,k)=>{if(!this.state.dragging||this.props.onStop(w,(0,o.createDraggableData)(this,k))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",k);const S={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:T,y:A}=this.props.position;S.x=T,S.y=A}this.setState(S)}),this.state={dragging:!1,dragged:!1,x:x.position?x.position.x:x.defaultPosition.x,y:x.position?x.position.y:x.defaultPosition.y,prevPropsPosition:{...x.position},slackX:0,slackY:0,isElementSVG:!1},x.position&&!(x.onDrag||x.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){var x,w;return((w=(x=this.props)==null?void 0:x.nodeRef)==null?void 0:w.current)??r.default.findDOMNode(this)}render(){const{axis:x,bounds:w,children:k,defaultPosition:_,defaultClassName:S,defaultClassNameDragging:P,defaultClassNameDragged:T,position:A,positionOffset:D,scale:E,...j}=this.props;let Z={},se=null;const G=!!!A||this.state.dragging,ye=A||_,he={x:(0,o.canDragX)(this)&&G?this.state.x:ye.x,y:(0,o.canDragY)(this)&&G?this.state.y:ye.y};this.state.isElementSVG?se=(0,i.createSVGTransform)(he,D):Z=(0,i.createCSSTransform)(he,D);const Be=(0,s.clsx)(k.props.className||"",S,{[P]:this.state.dragging,[T]:this.state.dragged});return e.createElement(l.default,g({},j,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(k),{className:Be,style:{...k.props.style,...Z},transform:se}))}}n.default=b,h(b,"displayName","Draggable"),h(b,"propTypes",{...l.default.propTypes,axis:t.default.oneOf(["both","x","y","none"]),bounds:t.default.oneOfType([t.default.shape({left:t.default.number,right:t.default.number,top:t.default.number,bottom:t.default.number}),t.default.string,t.default.oneOf([!1])]),defaultClassName:t.default.string,defaultClassNameDragging:t.default.string,defaultClassNameDragged:t.default.string,defaultPosition:t.default.shape({x:t.default.number,y:t.default.number}),positionOffset:t.default.shape({x:t.default.oneOfType([t.default.number,t.default.string]),y:t.default.oneOfType([t.default.number,t.default.string])}),position:t.default.shape({x:t.default.number,y:t.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),h(b,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(ca);const{default:ul,DraggableCore:Nf}=ca;tr.exports=ul,tr.exports.default=ul,tr.exports.DraggableCore=Nf;var Mf=tr.exports;const Ff=uo(Mf),Lf=({chatbot:n,message:e})=>{const t=et(null),[r,s]=M(""),{thinking:i=[],text:o=""}=e.data;return _e(()=>{const a=K.parse(o||"");typeof a=="string"?s(a):a.then(s)},[o]),p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.popupChat,70),alt:"Bot"})}),p("div",{className:"messageDiv ",children:p("div",{className:"messageP markdownText ai-generating",children:[i.length>0&&p("div",{className:"thinkingContainer",ref:t,children:i.map((a,l)=>p("div",{className:"thinkingChunk",children:["• ",a]},l))}),r&&p("div",{dangerouslySetInnerHTML:{__html:r}})]})})]})},jf=({message:n,type:e,onDismiss:t})=>{const[r,s]=M(!0);return _e(()=>{const i=setTimeout(()=>{s(!1),t()},4e3);return()=>clearTimeout(i)},[t]),r?p("div",{className:`robodialog-toast robodialog-toast-${e}`,children:[p("span",{className:"robodialog-toast-message",children:n}),p("button",{className:"robodialog-toast-close",onClick:()=>{s(!1),t()},children:"×"})]}):null},Uf=()=>{const[n,e]=M([]),t=Ht((i,o="info")=>{const a=`${Date.now()}-${Math.random().toString(36).substring(2,9)}`;e(l=>[...l,{id:a,message:i,type:o}]),setTimeout(()=>{r(a)},4e3)},[]),r=Ht(i=>{e(o=>o.filter(a=>a.id!==i))},[]);return{showToast:t,ToastContainer:()=>n.length===0?null:p(Te,{children:n.map(i=>p(jf,{message:i.message,type:i.type,onDismiss:()=>r(i.id)},i.id))}),dismissToast:r}},zf=({handleChangeConversation:n,coreState:e,conversationState:t,uiState:r,showToast:s})=>{var _r;const i=et(null),[o,a]=M(null),[l,c]=M(!1),[u,d]=M(!1),[g,h]=M("auto"),[f,m]=M(""),{chatbot:b,token:v,fileSizeLimit:x,userData:w,isChatbotDefault:k,isDefaultExternalAPI:_}=e,{messageCallOneTime:S,messages:P,currentConversation:T,messagesRef:A,setMessages:D}=t,{ratingFromUser:E,canMessage:j,setCanMessage:Z,humanControl:se,aiLoading:Oe,hoveringMessageInner:G,userLoading:ye,dataFromUser:he,setHoveringMessageInner:Be,onlineAgents:C,setOnlineAgents:R,callChatFlowRef:$,callChatFlow:F,setCallChatFlow:I,setHumanControl:q,setAiLoading:U,setUserLoading:z,setDataFromUser:H,setRatingFromUser:X}=r,W=b.chatflow.nodes.find(B=>B.type==="AIControlNode"),le=(P&&T?P.filter(B=>B.conversationId===T._id):[]).sort((B,fe)=>new Date(fe.createdAt||"").getTime()-new Date(B.createdAt||"").getTime()),O=B=>{var at;const fe=B.target,Me=(at=fe.files)==null?void 0:at[0];if(Me&&!/^image\//.test(Me.type)){a(null),s("Only image files are allowed","error");return}if(Me){if(Me.size>x*1024*1024){d(!0),setTimeout(()=>d(!1),3e3),fe.value="";return}a(Me),fe.value=""}},Ne=Ht(B=>{const fe=B.currentTarget;m(fe.value),requestAnimationFrame(()=>{fe.style.height="auto",fe.style.height=`${fe.scrollHeight}px`,h(`${fe.scrollHeight}px`)})},[m]),mt=B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),f.trim()&&us({coreState:e,conversationState:t,uiState:r,userMessage:f,setUserMessage:m,file:o,setFile:a,showToast:s,latestCurrentConversation:T}))};async function jt(){var Me,at,bt;if(!T||(Me=S.current)!=null&&Me.call)return;const B=((at=S.current)==null?void 0:at.messagesCount[T._id])||-1,fe=((bt=S.current)==null?void 0:bt.messagesLength[T._id])||0;if(!(B<=fe&&B!==-1))try{c(!0),S.current.call=!0;const yn=fe===1?0:fe,He=await ls.userReadAll({body:{conversationId:T._id,skip:yn}},v);if(!He.data)throw new Error("Failed to load messages");D(oe=>{const ce=new Set(oe.map(ct=>ct._id)),lt=He.data.messages.filter(ct=>!ce.has(ct._id)),_t=[...oe,...lt];return A.current=_t,_t}),S.current.messagesCount[T._id]=He.data.count}catch{s("Failed to load messages","error")}finally{S.current.call=!1,c(!1)}}function br(){n(null),Z(!1),m(""),q(!1),U(!1),Be(null),z(!1),H(null),R(0),X(null),a(null)}return _e(()=>{$.current&&T&&!k&&(Xn({coreState:e,conversationState:t,uiState:r,showToast:s}),$.current=!1)},[T]),_e(()=>{if(!T||k)return;if(_){Xn({coreState:e,conversationState:t,uiState:r,showToast:s});return}F&&(jt(),Xn({coreState:e,conversationState:t,uiState:r,showToast:s}),I(!1));const B=i.current;if(!B||B.scrollEventAdded)return;let fe;const Me=at=>{const bt=at.target;bt.scrollTop*-1+bt.clientHeight===bt.scrollHeight&&jt()};return fe=requestAnimationFrame(()=>{B.addEventListener("scroll",Me),B.scrollEventAdded=!0}),()=>{cancelAnimationFrame(fe),B.removeEventListener("scroll",Me)}},[F,T==null?void 0:T._id]),_e(()=>{if(!(le!=null&&le.length))return;S.current.messagesLength[(T==null?void 0:T._id)||""]=le.length;const B=le[0];B.owner==="agent"&&!B.seen&&Ed(B,e,t,r,s)},[le.length]),T?p("div",{className:"conversationDetails",children:[p("div",{className:"conversationDetailsHeader",children:[p("div",{onClick:br,style:{pointerEvents:Oe||_?"none":"",opacity:Oe||_?"0.5":"1"},children:p(Lo,{className:"background-text-color"})}),p("div",{style:{display:"flex",gap:"5px",alignItems:"center",color:b.appearance.color.backgroundText},children:[p(vh,{chatbot:b,humanControl:se,latestCurrentConversation:T}),"Controlled By ",T!=null&&T.assignedTo?"Human":"AI"]}),p("div",{style:{width:"21px"}})]}),p("div",{className:"livelinkMsgs",ref:i,children:[G&&j&&!(T!=null&&T.assignedTo)&&!o&&p(Eh,{hoveringMessageInner:G,chatbot:b}),Oe&&!((_r=le[0])!=null&&_r._id.startsWith("streaming_"))&&p(Th,{chatbot:b}),ye&&p(kh,{chatbot:b}),he&&!(T!=null&&T.assignedTo)&&p(yh,{email:(w==null?void 0:w.email)||"",chatbot:b,dataFromUser:he}),E&&!(T!=null&&T.assignedTo)&&p(xh,{chatbot:b,ratingFromUser:E}),(T==null?void 0:T.assignType)&&!(T!=null&&T.assignedTo)&&p(wh,{currentConversation:T,chatbot:b,onlineAgents:C}),le.map((B,fe)=>{if(B._id.startsWith("streaming_"))return p(Lf,{chatbot:b,message:B},B._id);if(!B.data.path)return p(Sh,{AIControlNode:W,chatbot:b,message:B},B._id||fe)}),l&&p(Ch,{chatbot:b})]}),p("div",{children:[o&&p(Ah,{file:o,setFile:a,chatbot:b}),p("div",{className:"massageInputDivMain",style:{opacity:j||T!=null&&T.assignedTo?"1":"0.7",pointerEvents:j||T!=null&&T.assignedTo?"all":"none"},children:p("form",{onSubmit:B=>{B.preventDefault(),f.trim()&&us({coreState:e,conversationState:t,uiState:r,userMessage:f,setUserMessage:m,file:o,setFile:a,latestCurrentConversation:T,showToast:s})},children:[p("textarea",{style:{height:g},placeholder:u?"File Size Limit Reached":b.appearance.text.messagePlaceholder,maxLength:500,onChange:Ne,onKeyDown:mt,value:f,rows:1,disabled:u}),p("input",{type:"file",onChange:O,style:{display:"none"},id:"fileUpload",accept:"image/*"}),(T==null?void 0:T.assignedTo)&&p("label",{className:"inputArrowMassageImg attachment",htmlFor:"fileUpload",children:p(dd,{className:"input-text-color"})}),p("button",{className:"inputArrowMassageImg",type:"submit",disabled:!f.trim(),children:p(ud,{className:"input-text-color"})})]})})]})]}):null},qf=({handleChangeConversation:n,coreState:e,conversationState:t,uiState:r,showToast:s})=>{const{chatbot:i,token:o}=e,{setConversations:a,setCurrentConversation:l,conversations:c,messages:u,totalConversationsCount:d,setTotalConversationsCount:g,setMessages:h}=t,{setCallChatFlow:f}=r,[m,b]=M(!1),[v,x]=M(!1),[w,k]=M(!1);return p("div",{className:"conversationMain",children:[p("button",{className:"newConversationBtn",onClick:async()=>{var P,T,A,D;if(!(v||m))try{x(!0);const E=await $t.userCreate({body:{}},o);if(!E.data)throw new Error("Conversation creation failed");const j=E.data;l(j),a(Z=>[...Z,j]),f(!0)}catch(E){((T=(P=E.response)==null?void 0:P.data)==null?void 0:T.error)==="Limit Reached"&&b(!0),s(((D=(A=E.response)==null?void 0:A.data)==null?void 0:D.message)||"Failed to create conversation","error")}finally{x(!1)}},children:v?p("div",{className:"newConversationLoading",children:p(un,{className:"base-text-color",width:13,height:13})}):m?"Limit Reached":"+ Conversation"}),p(mh,{conversations:c,chatbot:i,handleChangeConversation:n,messages:u,totalConversationsCount:d,conversationsLoading:w,loadMoreConversations:async()=>{if(!w)try{k(!0);const P=await $t.userReadAll(o,{query:{skip:c.length.toString()}});if(!P.data)throw new Error("Failed to load conversations");h(T=>{const A=[...T,...P.data.messages];return t.messagesRef.current=A,A}),a(T=>[...T,...P.data.conversations]),g(P.data.count)}catch{s("Failed to load conversations","error")}finally{k(!1)}}})]})},Bf=({chatOpen:n,coreState:e,conversationState:t,uiState:r,isMobileVersion:s,fullScreen:i})=>{const{showToast:o,ToastContainer:a}=Uf(),{chatbot:l,token:c,isChatbotDefault:u}=e,{setCallChatFlow:d}=r,{setMessages:g,messagesRef:h,setConversations:f,setTotalConversationsCount:m,setCurrentConversation:b}=t,[v,x]=M(!u),w=_=>{b(_),_!==null&&!u&&d(!0)},k=async()=>{try{x(!0);const _=await $t.userReadAll(c);if(!_.data)throw new Error("Failed to load conversations");const S=_.data.messages||[];h.current=S,g(S),f(_.data.conversations||[]),m(_.data.count||0)}catch{o("Failed to initialize conversations","error")}finally{x(!1)}};return _e(()=>{u||k()},[c]),p("div",{className:`chatbotConversationContainer ${n?"open":""} ${i?"fullscreen":""}`,style:i?void 0:{maxHeight:`calc(95vh - 70px - ${l.appearance.others.position[s?"mobile":"desktop"].verticalSpace}px)`,maxWidth:`calc(95vw - ${l.appearance.others.position[s?"mobile":"desktop"].horizontalSpace}px)`},children:[p(a,{}),p("div",{className:"top-header",children:[p("h2",{children:l.appearance.text.heading}),p("h4",{children:l.appearance.text.description}),l.appearance.others.showAgents&&p(xs,{className:"mainAgents",chatbot:l})]}),p("div",{className:"liveLinkRightDiv",children:v?p("div",{className:"loadingDiv",children:p(un,{className:"background-text-color"})}):p(Te,{children:[p(zf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o}),p(qf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o})]})}),!l.appearance.others.removePoweredBy&&p("div",{className:"livelinkPoweredDiv2",children:[p("span",{children:"Powered By "}),p("img",{src:hd,alt:"Logo"}),p("a",{href:"https://robodialog.com",target:"_blank",children:"Robodialog"})]})]})},Hf=({coreState:n,conversationState:e,uiState:t,fullScreen:r})=>{var A;const[s,i]=M(!1),[o,a]=M(!0),l=Fr("robodialog-chatbot-opened"),[c,u]=M(null),{userData:d,chatbot:g}=n,{newMessage:h,setNewMessage:f}=e,{setInteracted:m,chatOpen:b,setChatOpen:v}=t,x=g.chatflow.nodes.find(D=>d!=null&&d.isUser?D.type==="StartNode"&&D.data.channel.users:D.type==="StartNode"&&D.data.channel.visitors),w=((A=x==null?void 0:x.data)==null?void 0:A.hoveringMessage)||null,k=()=>{v(!b)};typeof window<"u"&&(window.robodialog={...window.robodialog||{},openChat:k});const _=g.appearance.others.position,S=_[s?"mobile":"desktop"].position==="bottomleft",P={alignItems:s?_.mobile.position==="bottomleft"?"flex-start":"flex-end":_.desktop.position==="bottomleft"?"flex-start":"flex-end",bottom:s?`${_.mobile.verticalSpace}px`:`${_.desktop.verticalSpace}px`,[S?"left":"right"]:s?`${_.mobile.horizontalSpace}px`:`${_.desktop.horizontalSpace}px`};_e(()=>{const D=()=>{i(window.innerWidth<_.mobileStartsFrom)};return D(),window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[_.mobileStartsFrom]),_e(()=>{b&&(m(!0),a(!1),Sn("robodialog-chatbot-opened",!0))},[b]),_e(()=>{var D,E,j,Z;if(h&&((E=(D=x==null?void 0:x.data)==null?void 0:D.popupMessage)!=null&&E.value)){const se=(Z=(j=x==null?void 0:x.data)==null?void 0:j.popupMessage)==null?void 0:Z.duration;c&&clearTimeout(c);const Oe=window.setTimeout(()=>{f(null)},se*1e3);u(Oe)}return()=>{c&&clearTimeout(c)}},[h]),_e(()=>{var E;const D=(E=x==null?void 0:x.data)==null?void 0:E.automaticallyOpenConversation;!(D!=null&&D.value)||r||(D.type==="allTheTime"||D.type==="oncePerVisit"&&!l)&&(v(!0),a(!1),Sn("robodialog-chatbot-opened",!0))},[]),_e(()=>{r&&v(!0)},[r,v]);const T=p("div",{className:`chatbotMain ${r?"fullscreen":""}`,style:r?void 0:P,children:[p(Bf,{chatOpen:b,coreState:n,conversationState:e,uiState:t,isMobileVersion:s,fullScreen:r}),!r&&p(Te,{children:[p(Rh,{chatbot:g,showHoveringMessage:o,hoveringMessages:w,setShowHoveringMessage:a,coreState:n,conversationState:e,uiState:t,node:x,setChatOpen:v}),p("div",{className:"chatbotChat",style:{flexDirection:S?"row-reverse":"row"},children:[p("div",{className:"chatbotDrag handle",children:p(cd,{className:"background-text-color",width:10})}),p("div",{className:"chatbotChatInside",onClick:k,children:[p("img",{src:ie(g.appearance.images.chat,70),alt:"Chat",style:{display:b?"none":"block"}}),p(ad,{className:"background-text-color",style:{display:b?"block":"none"}})]})]})]})]});return r?T:p(Ff,{axis:"both",handle:".handle",defaultPosition:{x:0,y:0},position:b?{x:0,y:0}:void 0,scale:1,bounds:".robodialog-chatbot-app",children:T})};function ke(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(n,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function Wf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ws={exports:{}},Qt=typeof Reflect=="object"?Reflect:null,dl=Qt&&typeof Qt.apply=="function"?Qt.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},cr;Qt&&typeof Qt.ownKeys=="function"?cr=Qt.ownKeys:Object.getOwnPropertySymbols?cr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:cr=function(e){return Object.getOwnPropertyNames(e)};function Vf(n){console&&console.warn&&console.warn(n)}var hl=Number.isNaN||function(e){return e!==e};function te(){te.init.call(this)}Ws.exports=te,Ws.exports.once=Zf,te.EventEmitter=te,te.prototype._events=void 0,te.prototype._eventsCount=0,te.prototype._maxListeners=void 0;var fl=10;function ur(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(te,"defaultMaxListeners",{enumerable:!0,get:function(){return fl},set:function(n){if(typeof n!="number"||n<0||hl(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");fl=n}}),te.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},te.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||hl(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function pl(n){return n._maxListeners===void 0?te.defaultMaxListeners:n._maxListeners}te.prototype.getMaxListeners=function(){return pl(this)},te.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s=e==="error",i=this._events;if(i!==void 0)s=s&&i.error===void 0;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=i[e];if(l===void 0)return!1;if(typeof l=="function")dl(l,this,t);else for(var c=l.length,u=vl(l,c),r=0;r<c;++r)dl(u[r],this,t);return!0};function gl(n,e,t,r){var s,i,o;if(ur(t),i=n._events,i===void 0?(i=n._events=Object.create(null),n._eventsCount=0):(i.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),i=n._events),o=i[e]),o===void 0)o=i[e]=t,++n._eventsCount;else if(typeof o=="function"?o=i[e]=r?[t,o]:[o,t]:r?o.unshift(t):o.push(t),s=pl(n),s>0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,Vf(a)}return n}te.prototype.addListener=function(e,t){return gl(this,e,t,!1)},te.prototype.on=te.prototype.addListener,te.prototype.prependListener=function(e,t){return gl(this,e,t,!0)};function Yf(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ml(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},s=Yf.bind(r);return s.listener=t,r.wrapFn=s,s}te.prototype.once=function(e,t){return ur(t),this.on(e,ml(this,e,t)),this},te.prototype.prependOnceListener=function(e,t){return ur(t),this.prependListener(e,ml(this,e,t)),this},te.prototype.removeListener=function(e,t){var r,s,i,o,a;if(ur(t),s=this._events,s===void 0)return this;if(r=s[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;i===0?r.shift():Xf(r,i),r.length===1&&(s[e]=r[0]),s.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this},te.prototype.off=te.prototype.removeListener,te.prototype.removeAllListeners=function(e){var t,r,s;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var i=Object.keys(r),o;for(s=0;s<i.length;++s)o=i[s],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this};function bl(n,e,t){var r=n._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?t?[s.listener||s]:[s]:t?Jf(s):vl(s,s.length)}te.prototype.listeners=function(e){return bl(this,e,!0)},te.prototype.rawListeners=function(e){return bl(this,e,!1)},te.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):_l.call(n,e)},te.prototype.listenerCount=_l;function _l(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}te.prototype.eventNames=function(){return this._eventsCount>0?cr(this._events):[]};function vl(n,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=n[r];return t}function Xf(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Jf(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function Zf(n,e){return new Promise(function(t,r){function s(o){n.removeListener(e,i),r(o)}function i(){typeof n.removeListener=="function"&&n.removeListener("error",s),t([].slice.call(arguments))}yl(n,e,i,{once:!0}),e!=="error"&&Gf(n,s,{once:!0})})}function Gf(n,e,t){typeof n.on=="function"&&yl(n,"error",e,t)}function yl(n,e,t,r){if(typeof n.on=="function")r.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function s(i){r.once&&n.removeEventListener(e,s),t(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var Kf=Ws.exports,xl=Wf(Kf),ae;(function(n){n[n.timeout=1]="timeout",n[n.transportClosed=2]="transportClosed",n[n.clientDisconnected=3]="clientDisconnected",n[n.clientClosed=4]="clientClosed",n[n.clientConnectToken=5]="clientConnectToken",n[n.clientRefreshToken=6]="clientRefreshToken",n[n.subscriptionUnsubscribed=7]="subscriptionUnsubscribed",n[n.subscriptionSubscribeToken=8]="subscriptionSubscribeToken",n[n.subscriptionRefreshToken=9]="subscriptionRefreshToken",n[n.transportWriteError=10]="transportWriteError",n[n.connectionClosed=11]="connectionClosed",n[n.badConfiguration=12]="badConfiguration"})(ae||(ae={}));var Tt;(function(n){n[n.connectCalled=0]="connectCalled",n[n.transportClosed=1]="transportClosed",n[n.noPing=2]="noPing",n[n.subscribeTimeout=3]="subscribeTimeout",n[n.unsubscribeError=4]="unsubscribeError"})(Tt||(Tt={}));var vn;(function(n){n[n.disconnectCalled=0]="disconnectCalled",n[n.unauthorized=1]="unauthorized",n[n.badProtocol=2]="badProtocol",n[n.messageSizeLimit=3]="messageSizeLimit"})(vn||(vn={}));var dr;(function(n){n[n.subscribeCalled=0]="subscribeCalled",n[n.transportClosed=1]="transportClosed"})(dr||(dr={}));var hr;(function(n){n[n.unsubscribeCalled=0]="unsubscribeCalled",n[n.unauthorized=1]="unauthorized",n[n.clientClosed=2]="clientClosed"})(hr||(hr={}));var Vs;(function(n){n[n.channelCompaction=1]="channelCompaction"})(Vs||(Vs={}));var me;(function(n){n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected"})(me||(me={}));var Re;(function(n){n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed"})(Re||(Re={}));function Qf(n,e){return n.lastIndexOf(e,0)===0}function wl(n){return n==null?!1:typeof n=="function"}function ep(n,e){if(globalThis.console){const t=globalThis.console[n];wl(t)&&t.apply(globalThis.console,e)}}function tp(n,e){return Math.floor(Math.random()*(e-n+1)+n)}function fr(n,e,t){n>31&&(n=31);const r=tp(0,Math.min(t,e*Math.pow(2,n)));return Math.min(t,e+r)}function np(n){return"error"in n&&n.error!==null}function pr(n){return Math.min(n*1e3,2147483647)}class rp extends xl{constructor(e,t,r){super(),this._resubscribeTimeout=null,this._refreshTimeout=null,this.channel=t,this.state=Re.Unsubscribed,this._centrifuge=e,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._id=0,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._tagsFilter=null,this._prevValue=null,this._unsubPromise=Promise.resolve(),this._setOptions(r),this._centrifuge._debugEnabled?(this.on("state",s=>{this._debug("subscription state",t,s.oldState,"->",s.newState)}),this.on("error",s=>{this._debug("subscription error",t,s)})):this.on("error",function(){Function.prototype()})}ready(e){return this.state===Re.Unsubscribed?Promise.reject({code:ae.subscriptionUnsubscribed,message:this.state}):this.state===Re.Subscribed?Promise.resolve():new Promise((t,r)=>{const s={resolve:t,reject:r};e&&(s.timeout=setTimeout(function(){r({code:ae.timeout,message:"timeout"})},e)),this._promises[this._nextPromiseId()]=s})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(dr.subscribeCalled,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(hr.unsubscribeCalled,"unsubscribe called",!0)}publish(e){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.publish(this.channel,e)})}presence(){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presence(this.channel)})}presenceStats(){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presenceStats(this.channel)})}history(e){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.history(this.channel,e)})}setTagsFilter(e){if(e&&this._delta)throw new Error("cannot use delta and tagsFilter together");this._tagsFilter=e}setData(e){this._data=e}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:ae.subscriptionUnsubscribed,message:this.state}):new Promise((e,t)=>{const r=this._centrifuge._config.timeout,s=setTimeout(()=>{t({code:ae.timeout,message:"timeout"})},r);this._promises[this._nextPromiseId()]={timeout:s,resolve:e,reject:t}})}_nextPromiseId(){return++this._promiseId}_needRecover(){return this._recover===!0}_isUnsubscribed(){return this.state===Re.Unsubscribed}_isSubscribing(){return this.state===Re.Subscribing}_isSubscribed(){return this.state===Re.Subscribed}_setState(e){if(this.state!==e){const t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t,channel:this.channel}),!0}return!1}_usesToken(){return this._token!==""||this._getToken!==null}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout()}_setSubscribed(e){if(!this._isSubscribing())return;this._clearSubscribingState(),e.id&&(this._id=e.id),e.recoverable&&(this._recover=!0,this._offset=e.offset||0,this._epoch=e.epoch||""),e.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,this._setState(Re.Subscribed);const t=this._centrifuge._getSubscribeContext(this.channel,e);this.emit("subscribed",t),this._resolvePromises();const r=e.publications;if(r&&r.length>0)for(const s in r)r.hasOwnProperty(s)&&this._handlePublication(r[s]);e.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),pr(e.ttl)))}_setSubscribing(e,t){return ke(this,void 0,void 0,function*(){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState(Re.Subscribing)&&this.emit("subscribing",{channel:this.channel,code:e,reason:t}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&(yield this._unsubPromise),this._isSubscribing()&&this._subscribe())})}_subscribe(){return this._debug("subscribing on",this.channel),this._isTransportOpen()?this._inflight?null:(this._inflight=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():(this._getSubscriptionToken().then(e=>this._handleTokenResponse(e)).catch(e=>this._handleTokenError(e)),null)):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_getDataAndSubscribe(e){if(!this._getData){this._inflight=!1;return}this._getData({channel:this.channel}).then(t=>{if(!this._isSubscribing()){this._inflight=!1;return}this._data=t,this._sendSubscribe(e)}).catch(t=>this._handleGetDataError(t))}_handleGetDataError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof gt){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:ae.badConfiguration,message:(e==null?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_handleTokenResponse(e){if(!this._isSubscribing()){this._inflight=!1;return}if(!e){this._inflight=!1,this._failUnauthorized();return}this._token=e,this._getData?this._getDataAndSubscribe(e):this._sendSubscribe(e)}_handleTokenError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof gt){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:ae.subscriptionSubscribeToken,message:(e==null?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_sendSubscribe(e){if(!this._isTransportOpen())return this._inflight=!1,null;const t=this._buildSubscribeCommand(e);return this._centrifuge._call(t).then(r=>{this._inflight=!1;const s=r.reply.subscribe;this._handleSubscribeResponse(s),r.next&&r.next()},r=>{this._inflight=!1,this._handleSubscribeError(r.error),r.next&&r.next()}),t}_buildSubscribeCommand(e){const t={channel:this.channel};if(e&&(t.token=e),this._data&&(t.data=this._data),this._positioned&&(t.positioned=!0),this._recoverable&&(t.recoverable=!0),this._joinLeave&&(t.join_leave=!0),t.flag=Vs.channelCompaction,this._needRecover()){t.recover=!0;const r=this._getOffset();r&&(t.offset=r);const s=this._getEpoch();s&&(t.epoch=s)}return this._delta&&(t.delta=this._delta),this._tagsFilter&&(t.tf=this._tagsFilter),{subscribe:t}}_debug(...e){this._centrifuge._debug(...e)}_handleSubscribeError(e){if(this._isSubscribing()){if(e.code===ae.timeout){this._centrifuge._disconnect(Tt.subscribeTimeout,"subscribe timeout",!0);return}this._subscribeError(e)}}_handleSubscribeResponse(e){this._isSubscribing()&&this._setSubscribed(e)}_setUnsubscribed(e,t,r){if(this._isUnsubscribed())return Promise.resolve();let s=Promise.resolve();return this._isSubscribed()?(r&&(s=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&r&&(s=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._setState(Re.Unsubscribed)&&this.emit("unsubscribed",{channel:this.channel,code:e,reason:t}),this._rejectPromises({code:ae.subscriptionUnsubscribed,message:this.state}),s}_handlePublication(e){if(this._delta&&this._delta_negotiated){const{newData:r,newPrevValue:s}=this._centrifuge._codec.applyDeltaIfNeeded(e,this._prevValue);e.data=r,this._prevValue=s}const t=this._centrifuge._getPublicationContext(this.channel,e);this.emit("publication",t),e.offset&&(this._offset=e.offset)}_handleJoin(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("join",{channel:this.channel,info:t})}_handleLeave(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("leave",{channel:this.channel,info:t})}_resolvePromises(){for(const e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(const t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}_scheduleResubscribe(){if(!this._isSubscribing()){this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);return}const e=this,t=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout(function(){e._isSubscribing()&&e._subscribe()},t),this._debug("resubscribe scheduled after "+t,this.channel)}_subscribeError(e){if(this._isSubscribing())if(e.code<100||e.code===109||e.temporary===!0){e.code===109&&(this._token="");const t={channel:this.channel,type:"subscribe",error:e};this._centrifuge.state===me.Connected&&this.emit("error",t),this._scheduleResubscribe()}else this._setUnsubscribed(e.code,e.message,!1)}_getResubscribeDelay(){const e=fr(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,e}_setOptions(e){if(e){if(e.since&&(this._offset=e.since.offset||0,this._epoch=e.since.epoch||"",this._recover=!0),e.data&&(this._data=e.data),e.getData&&(this._getData=e.getData),e.minResubscribeDelay!==void 0&&(this._minResubscribeDelay=e.minResubscribeDelay),e.maxResubscribeDelay!==void 0&&(this._maxResubscribeDelay=e.maxResubscribeDelay),e.token&&(this._token=e.token),e.getToken&&(this._getToken=e.getToken),e.positioned===!0&&(this._positioned=!0),e.recoverable===!0&&(this._recoverable=!0),e.joinLeave===!0&&(this._joinLeave=!0),e.delta){if(e.delta!=="fossil")throw new Error("unsupported delta format");this._delta=e.delta}if(e.tagsFilter&&(this._tagsFilter=e.tagsFilter),this._tagsFilter&&this._delta)throw new Error("cannot use delta and tagsFilter together")}}_getOffset(){const e=this._offset;return e!==null?e:0}_getEpoch(){const e=this._epoch;return e!==null?e:""}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){this._resubscribeTimeout!==null&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);const e={channel:this.channel},t=this._getToken;return t===null?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:ae.badConfiguration,message:"provide a function to get channel subscription token"}}),Promise.reject(new gt(""))):t(e)}_refresh(){this._clearRefreshTimeout();const e=this;this._getSubscriptionToken().then(function(t){if(!e._isSubscribed())return;if(!t){e._failUnauthorized();return}e._token=t;const s={sub_refresh:{channel:e.channel,token:t}};e._centrifuge._call(s).then(i=>{const o=i.reply.sub_refresh;e._refreshResponse(o),i.next&&i.next()},i=>{e._refreshError(i.error),i.next&&i.next()})}).catch(function(t){if(t instanceof gt){e._failUnauthorized();return}e.emit("error",{type:"refreshToken",channel:e.channel,error:{code:ae.subscriptionRefreshToken,message:t!==void 0?t.toString():""}}),e._refreshTimeout=setTimeout(()=>e._refresh(),e._getRefreshRetryDelay())})}_refreshResponse(e){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),e.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),pr(e.ttl))))}_refreshError(e){this._isSubscribed()&&(e.code<100||e.temporary===!0?(this.emit("error",{type:"refresh",channel:this.channel,error:e}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._setUnsubscribed(e.code,e.message,!0))}_getRefreshRetryDelay(){return fr(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(hr.unauthorized,"unauthorized",!0)}}class sp{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return this.options.sockjs!==null}initialize(e,t){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=r=>{t.onError(r)},this._transport.onclose=r=>{t.onClose(r)},this._transport.onmessage=r=>{t.onMessage(r.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class kl{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return this.options.websocket!==void 0&&this.options.websocket!==null}initialize(e,t){let r="";e==="protobuf"&&(r="centrifuge-protobuf"),r!==""?this._transport=new this.options.websocket(this.endpoint,r):this._transport=new this.options.websocket(this.endpoint),e==="protobuf"&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=s=>{t.onError(s)},this._transport.onclose=s=>{t.onClose(s)},this._transport.onmessage=s=>{t.onMessage(s.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class ip{constructor(e,t){this.endpoint=e,this.options=t,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(e){if(!e.ok)throw new Error(e.status);return e}_fetchEventTarget(e,t,r){const s=new EventTarget,i=e.options.fetch;return i(t,r).then(e._handleErrors).then(o=>{s.dispatchEvent(new Event("open"));let a="",l=0,c=new Uint8Array;const u=o.body.getReader();return new e.options.readableStream({start(d){function g(){return u.read().then(({done:h,value:f})=>{if(h){s.dispatchEvent(new Event("close")),d.close();return}try{if(e._protocol==="json")for(a+=e._utf8decoder.decode(f);l<a.length;)if(a[l]===`
|
|
109
|
+
`,n.getElementsByTagName("head")[0].appendChild(e)),n.body&&al(n.body,"react-draggable-transparent-selection")}function wf(n){window.requestAnimationFrame?window.requestAnimationFrame(()=>{ol(n)}):ol(n)}function ol(n){if(n)try{if(n.body&&ll(n.body,"react-draggable-transparent-selection"),n.selection)n.selection.empty();else{const e=(n.defaultView||window).getSelection();e&&e.type!=="Caret"&&e.removeAllRanges()}}catch{}}function al(n,e){n.classList?n.classList.add(e):n.className.match(new RegExp(`(?:^|\\s)${e}(?!\\S)`))||(n.className+=` ${e}`)}function ll(n,e){n.classList?n.classList.remove(e):n.className=n.className.replace(new RegExp(`(?:^|\\s)${e}(?!\\S)`,"g"),"")}var ot={};Object.defineProperty(ot,"__esModule",{value:!0}),ot.canDragX=Sf,ot.canDragY=Cf,ot.createCoreData=Af,ot.createDraggableData=Rf,ot.getBoundPosition=kf,ot.getControlPosition=Ef,ot.snapToGrid=Tf;var Ue=it,Kt=de;function kf(n,e,t){if(!n.props.bounds)return[e,t];let{bounds:r}=n.props;r=typeof r=="string"?r:Of(r);const s=zs(n);if(typeof r=="string"){const{ownerDocument:i}=s,o=i.defaultView;let a;if(r==="parent"?a=s.parentNode:a=s.getRootNode().querySelector(r),!(a instanceof o.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');const l=a,c=o.getComputedStyle(s),u=o.getComputedStyle(l);r={left:-s.offsetLeft+(0,Ue.int)(u.paddingLeft)+(0,Ue.int)(c.marginLeft),top:-s.offsetTop+(0,Ue.int)(u.paddingTop)+(0,Ue.int)(c.marginTop),right:(0,Kt.innerWidth)(l)-(0,Kt.outerWidth)(s)-s.offsetLeft+(0,Ue.int)(u.paddingRight)-(0,Ue.int)(c.marginRight),bottom:(0,Kt.innerHeight)(l)-(0,Kt.outerHeight)(s)-s.offsetTop+(0,Ue.int)(u.paddingBottom)-(0,Ue.int)(c.marginBottom)}}return(0,Ue.isNum)(r.right)&&(e=Math.min(e,r.right)),(0,Ue.isNum)(r.bottom)&&(t=Math.min(t,r.bottom)),(0,Ue.isNum)(r.left)&&(e=Math.max(e,r.left)),(0,Ue.isNum)(r.top)&&(t=Math.max(t,r.top)),[e,t]}function Tf(n,e,t){const r=Math.round(e/n[0])*n[0],s=Math.round(t/n[1])*n[1];return[r,s]}function Sf(n){return n.props.axis==="both"||n.props.axis==="x"}function Cf(n){return n.props.axis==="both"||n.props.axis==="y"}function Ef(n,e,t){const r=typeof e=="number"?(0,Kt.getTouch)(n,e):null;if(typeof e=="number"&&!r)return null;const s=zs(t),i=t.props.offsetParent||s.offsetParent||s.ownerDocument.body;return(0,Kt.offsetXYFromParent)(r||n,i,t.props.scale)}function Af(n,e,t){const r=!(0,Ue.isNum)(n.lastX),s=zs(n);return r?{node:s,deltaX:0,deltaY:0,lastX:e,lastY:t,x:e,y:t}:{node:s,deltaX:e-n.lastX,deltaY:t-n.lastY,lastX:n.lastX,lastY:n.lastY,x:e,y:t}}function Rf(n,e){const t=n.props.scale;return{node:e.node,x:n.state.x+e.deltaX/t,y:n.state.y+e.deltaY/t,deltaX:e.deltaX/t,deltaY:e.deltaY/t,lastX:n.state.x,lastY:n.state.y}}function Of(n){return{left:n.left,top:n.top,right:n.right,bottom:n.bottom}}function zs(n){const e=n.findDOMNode();if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var or={},ar={};Object.defineProperty(ar,"__esModule",{value:!0}),ar.default=Pf;function Pf(){}Object.defineProperty(or,"__esModule",{value:!0}),or.default=void 0;var qs=cl(rr),Ee=Hs(Ka),Df=Hs(rr),we=de,wt=ot,Bs=it,_n=Hs(ar);function Hs(n){return n&&n.__esModule?n:{default:n}}function cl(n,e){if(typeof WeakMap=="function")var t=new WeakMap,r=new WeakMap;return(cl=function(s,i){if(!i&&s&&s.__esModule)return s;var o,a,l={__proto__:null,default:s};if(s===null||typeof s!="object"&&typeof s!="function")return l;if(o=i?r:t){if(o.has(s))return o.get(s);o.set(s,l)}for(const c in s)c!=="default"&&{}.hasOwnProperty.call(s,c)&&((a=(o=Object.defineProperty)&&Object.getOwnPropertyDescriptor(s,c))&&(a.get||a.set)?o(l,c,a):l[c]=s[c]);return l})(n,e)}function Ae(n,e,t){return(e=If(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function If(n){var e=$f(n,"string");return typeof e=="symbol"?e:e+""}function $f(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}const Ze={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let kt=Ze.mouse,lr=class extends qs.Component{constructor(){super(...arguments),Ae(this,"dragging",!1),Ae(this,"lastX",NaN),Ae(this,"lastY",NaN),Ae(this,"touchIdentifier",null),Ae(this,"mounted",!1),Ae(this,"handleDragStart",e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&typeof e.button=="number"&&e.button!==0)return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:r}=t;if(this.props.disabled||!(e.target instanceof r.defaultView.Node)||this.props.handle&&!(0,we.matchesSelectorAndParentsTo)(e.target,this.props.handle,t)||this.props.cancel&&(0,we.matchesSelectorAndParentsTo)(e.target,this.props.cancel,t))return;e.type==="touchstart"&&!this.props.allowMobileScroll&&e.preventDefault();const s=(0,we.getTouchIdentifier)(e);this.touchIdentifier=s;const i=(0,wt.getControlPosition)(e,s,this);if(i==null)return;const{x:o,y:a}=i,l=(0,wt.createCoreData)(this,o,a);(0,_n.default)("DraggableCore: handleDragStart: %j",l),(0,_n.default)("calling",this.props.onStart),!(this.props.onStart(e,l)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,we.addUserSelectStyles)(r),this.dragging=!0,this.lastX=o,this.lastY=a,(0,we.addEvent)(r,kt.move,this.handleDrag),(0,we.addEvent)(r,kt.stop,this.handleDragStop))}),Ae(this,"handleDrag",e=>{const t=(0,wt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:s}=t;if(Array.isArray(this.props.grid)){let a=r-this.lastX,l=s-this.lastY;if([a,l]=(0,wt.snapToGrid)(this.props.grid,a,l),!a&&!l)return;r=this.lastX+a,s=this.lastY+l}const i=(0,wt.createCoreData)(this,r,s);if((0,_n.default)("DraggableCore: handleDrag: %j",i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=r,this.lastY=s}),Ae(this,"handleDragStop",e=>{if(!this.dragging)return;const t=(0,wt.getControlPosition)(e,this.touchIdentifier,this);if(t==null)return;let{x:r,y:s}=t;if(Array.isArray(this.props.grid)){let l=r-this.lastX||0,c=s-this.lastY||0;[l,c]=(0,wt.snapToGrid)(this.props.grid,l,c),r=this.lastX+l,s=this.lastY+c}const i=(0,wt.createCoreData)(this,r,s);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,we.scheduleRemoveUserSelectStyles)(a.ownerDocument),(0,_n.default)("DraggableCore: handleDragStop: %j",i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,_n.default)("DraggableCore: Removing handlers"),(0,we.removeEvent)(a.ownerDocument,kt.move,this.handleDrag),(0,we.removeEvent)(a.ownerDocument,kt.stop,this.handleDragStop))}),Ae(this,"onMouseDown",e=>(kt=Ze.mouse,this.handleDragStart(e))),Ae(this,"onMouseUp",e=>(kt=Ze.mouse,this.handleDragStop(e))),Ae(this,"onTouchStart",e=>(kt=Ze.touch,this.handleDragStart(e))),Ae(this,"onTouchEnd",e=>(kt=Ze.touch,this.handleDragStop(e)))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&(0,we.addEvent)(e,Ze.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;(0,we.removeEvent)(t,Ze.mouse.move,this.handleDrag),(0,we.removeEvent)(t,Ze.touch.move,this.handleDrag),(0,we.removeEvent)(t,Ze.mouse.stop,this.handleDragStop),(0,we.removeEvent)(t,Ze.touch.stop,this.handleDragStop),(0,we.removeEvent)(e,Ze.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,we.scheduleRemoveUserSelectStyles)(t)}}findDOMNode(){var e,t,r;return(e=this.props)!=null&&e.nodeRef?(r=(t=this.props)==null?void 0:t.nodeRef)==null?void 0:r.current:Df.default.findDOMNode(this)}render(){return qs.cloneElement(qs.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};or.default=lr,Ae(lr,"displayName","DraggableCore"),Ae(lr,"propTypes",{allowAnyClick:Ee.default.bool,allowMobileScroll:Ee.default.bool,children:Ee.default.node.isRequired,disabled:Ee.default.bool,enableUserSelectHack:Ee.default.bool,offsetParent:function(n,e){if(n[e]&&n[e].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Ee.default.arrayOf(Ee.default.number),handle:Ee.default.string,cancel:Ee.default.string,nodeRef:Ee.default.object,onStart:Ee.default.func,onDrag:Ee.default.func,onStop:Ee.default.func,onMouseDown:Ee.default.func,scale:Ee.default.number,className:Bs.dontSetMe,style:Bs.dontSetMe,transform:Bs.dontSetMe}),Ae(lr,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(n){Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"DraggableCore",{enumerable:!0,get:function(){return l.default}}),n.default=void 0;var e=d(rr),t=u(Ka),r=u(rr),s=ef,i=de,o=ot,a=it,l=u(or),c=u(ar);function u(v){return v&&v.__esModule?v:{default:v}}function d(v,x){if(typeof WeakMap=="function")var w=new WeakMap,k=new WeakMap;return(d=function(_,S){if(!S&&_&&_.__esModule)return _;var P,T,A={__proto__:null,default:_};if(_===null||typeof _!="object"&&typeof _!="function")return A;if(P=S?k:w){if(P.has(_))return P.get(_);P.set(_,A)}for(const D in _)D!=="default"&&{}.hasOwnProperty.call(_,D)&&((T=(P=Object.defineProperty)&&Object.getOwnPropertyDescriptor(_,D))&&(T.get||T.set)?P(A,D,T):A[D]=_[D]);return A})(v,x)}function g(){return g=Object.assign?Object.assign.bind():function(v){for(var x=1;x<arguments.length;x++){var w=arguments[x];for(var k in w)({}).hasOwnProperty.call(w,k)&&(v[k]=w[k])}return v},g.apply(null,arguments)}function h(v,x,w){return(x=f(x))in v?Object.defineProperty(v,x,{value:w,enumerable:!0,configurable:!0,writable:!0}):v[x]=w,v}function f(v){var x=m(v,"string");return typeof x=="symbol"?x:x+""}function m(v,x){if(typeof v!="object"||!v)return v;var w=v[Symbol.toPrimitive];if(w!==void 0){var k=w.call(v,x);if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(v)}class b extends e.Component{static getDerivedStateFromProps(x,w){let{position:k}=x,{prevPropsPosition:_}=w;return k&&(!_||k.x!==_.x||k.y!==_.y)?((0,c.default)("Draggable: getDerivedStateFromProps %j",{position:k,prevPropsPosition:_}),{x:k.x,y:k.y,prevPropsPosition:{...k}}):null}constructor(x){super(x),h(this,"onDragStart",(w,k)=>{if((0,c.default)("Draggable: onDragStart: %j",k),this.props.onStart(w,(0,o.createDraggableData)(this,k))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),h(this,"onDrag",(w,k)=>{if(!this.state.dragging)return!1;(0,c.default)("Draggable: onDrag: %j",k);const _=(0,o.createDraggableData)(this,k),S={x:_.x,y:_.y,slackX:0,slackY:0};if(this.props.bounds){const{x:T,y:A}=S;S.x+=this.state.slackX,S.y+=this.state.slackY;const[D,E]=(0,o.getBoundPosition)(this,S.x,S.y);S.x=D,S.y=E,S.slackX=this.state.slackX+(T-S.x),S.slackY=this.state.slackY+(A-S.y),_.x=S.x,_.y=S.y,_.deltaX=S.x-this.state.x,_.deltaY=S.y-this.state.y}if(this.props.onDrag(w,_)===!1)return!1;this.setState(S)}),h(this,"onDragStop",(w,k)=>{if(!this.state.dragging||this.props.onStop(w,(0,o.createDraggableData)(this,k))===!1)return!1;(0,c.default)("Draggable: onDragStop: %j",k);const S={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:T,y:A}=this.props.position;S.x=T,S.y=A}this.setState(S)}),this.state={dragging:!1,dragged:!1,x:x.position?x.position.x:x.defaultPosition.x,y:x.position?x.position.y:x.defaultPosition.y,prevPropsPosition:{...x.position},slackX:0,slackY:0,isElementSVG:!1},x.position&&!(x.onDrag||x.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){var x,w;return((w=(x=this.props)==null?void 0:x.nodeRef)==null?void 0:w.current)??r.default.findDOMNode(this)}render(){const{axis:x,bounds:w,children:k,defaultPosition:_,defaultClassName:S,defaultClassNameDragging:P,defaultClassNameDragged:T,position:A,positionOffset:D,scale:E,...j}=this.props;let Z={},se=null;const G=!!!A||this.state.dragging,ye=A||_,he={x:(0,o.canDragX)(this)&&G?this.state.x:ye.x,y:(0,o.canDragY)(this)&&G?this.state.y:ye.y};this.state.isElementSVG?se=(0,i.createSVGTransform)(he,D):Z=(0,i.createCSSTransform)(he,D);const Be=(0,s.clsx)(k.props.className||"",S,{[P]:this.state.dragging,[T]:this.state.dragged});return e.createElement(l.default,g({},j,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),e.cloneElement(e.Children.only(k),{className:Be,style:{...k.props.style,...Z},transform:se}))}}n.default=b,h(b,"displayName","Draggable"),h(b,"propTypes",{...l.default.propTypes,axis:t.default.oneOf(["both","x","y","none"]),bounds:t.default.oneOfType([t.default.shape({left:t.default.number,right:t.default.number,top:t.default.number,bottom:t.default.number}),t.default.string,t.default.oneOf([!1])]),defaultClassName:t.default.string,defaultClassNameDragging:t.default.string,defaultClassNameDragged:t.default.string,defaultPosition:t.default.shape({x:t.default.number,y:t.default.number}),positionOffset:t.default.shape({x:t.default.oneOfType([t.default.number,t.default.string]),y:t.default.oneOfType([t.default.number,t.default.string])}),position:t.default.shape({x:t.default.number,y:t.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),h(b,"defaultProps",{...l.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})}(ca);const{default:ul,DraggableCore:Nf}=ca;tr.exports=ul,tr.exports.default=ul,tr.exports.DraggableCore=Nf;var Mf=tr.exports;const Ff=uo(Mf),Lf=({chatbot:n,message:e})=>{const t=et(null),[r,s]=M(""),{thinking:i=[],text:o=""}=e.data;return _e(()=>{const a=K.parse(o||"");typeof a=="string"?s(a):a.then(s)},[o]),p("div",{className:"mainMessageContainer",children:[p("div",{className:"logoWithMessageDiv",children:p("img",{src:ie(n.appearance.images.popupChat,200),alt:"Bot"})}),p("div",{className:"messageDiv ",children:p("div",{className:"messageP markdownText ai-generating",children:[i.length>0&&p("div",{className:"thinkingContainer",ref:t,children:i.map((a,l)=>p("div",{className:"thinkingChunk",children:["• ",a]},l))}),r&&p("div",{dangerouslySetInnerHTML:{__html:r}})]})})]})},jf=({message:n,type:e,onDismiss:t})=>{const[r,s]=M(!0);return _e(()=>{const i=setTimeout(()=>{s(!1),t()},4e3);return()=>clearTimeout(i)},[t]),r?p("div",{className:`robodialog-toast robodialog-toast-${e}`,children:[p("span",{className:"robodialog-toast-message",children:n}),p("button",{className:"robodialog-toast-close",onClick:()=>{s(!1),t()},children:"×"})]}):null},Uf=()=>{const[n,e]=M([]),t=Ht((i,o="info")=>{const a=`${Date.now()}-${Math.random().toString(36).substring(2,9)}`;e(l=>[...l,{id:a,message:i,type:o}]),setTimeout(()=>{r(a)},4e3)},[]),r=Ht(i=>{e(o=>o.filter(a=>a.id!==i))},[]);return{showToast:t,ToastContainer:()=>n.length===0?null:p(Te,{children:n.map(i=>p(jf,{message:i.message,type:i.type,onDismiss:()=>r(i.id)},i.id))}),dismissToast:r}},zf=({handleChangeConversation:n,coreState:e,conversationState:t,uiState:r,showToast:s})=>{var _r;const i=et(null),[o,a]=M(null),[l,c]=M(!1),[u,d]=M(!1),[g,h]=M("auto"),[f,m]=M(""),{chatbot:b,token:v,fileSizeLimit:x,userData:w,isChatbotDefault:k,isDefaultExternalAPI:_}=e,{messageCallOneTime:S,messages:P,currentConversation:T,messagesRef:A,setMessages:D}=t,{ratingFromUser:E,canMessage:j,setCanMessage:Z,humanControl:se,aiLoading:Oe,hoveringMessageInner:G,userLoading:ye,dataFromUser:he,setHoveringMessageInner:Be,onlineAgents:C,setOnlineAgents:R,callChatFlowRef:$,callChatFlow:F,setCallChatFlow:I,setHumanControl:q,setAiLoading:U,setUserLoading:z,setDataFromUser:H,setRatingFromUser:X}=r,W=b.chatflow.nodes.find(B=>B.type==="AIControlNode"),le=(P&&T?P.filter(B=>B.conversationId===T._id):[]).sort((B,fe)=>new Date(fe.createdAt||"").getTime()-new Date(B.createdAt||"").getTime()),O=B=>{var at;const fe=B.target,Me=(at=fe.files)==null?void 0:at[0];if(Me&&!/^image\//.test(Me.type)){a(null),s("Only image files are allowed","error");return}if(Me){if(Me.size>x*1024*1024){d(!0),setTimeout(()=>d(!1),3e3),fe.value="";return}a(Me),fe.value=""}},Ne=Ht(B=>{const fe=B.currentTarget;m(fe.value),requestAnimationFrame(()=>{fe.style.height="auto",fe.style.height=`${fe.scrollHeight}px`,h(`${fe.scrollHeight}px`)})},[m]),mt=B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),f.trim()&&us({coreState:e,conversationState:t,uiState:r,userMessage:f,setUserMessage:m,file:o,setFile:a,showToast:s,latestCurrentConversation:T}))};async function jt(){var Me,at,bt;if(!T||(Me=S.current)!=null&&Me.call)return;const B=((at=S.current)==null?void 0:at.messagesCount[T._id])||-1,fe=((bt=S.current)==null?void 0:bt.messagesLength[T._id])||0;if(!(B<=fe&&B!==-1))try{c(!0),S.current.call=!0;const yn=fe===1?0:fe,He=await ls.userReadAll({body:{conversationId:T._id,skip:yn}},v);if(!He.data)throw new Error("Failed to load messages");D(oe=>{const ce=new Set(oe.map(ct=>ct._id)),lt=He.data.messages.filter(ct=>!ce.has(ct._id)),_t=[...oe,...lt];return A.current=_t,_t}),S.current.messagesCount[T._id]=He.data.count}catch{s("Failed to load messages","error")}finally{S.current.call=!1,c(!1)}}function br(){n(null),Z(!1),m(""),q(!1),U(!1),Be(null),z(!1),H(null),R(0),X(null),a(null)}return _e(()=>{$.current&&T&&!k&&(Xn({coreState:e,conversationState:t,uiState:r,showToast:s}),$.current=!1)},[T]),_e(()=>{if(!T||k)return;if(_){Xn({coreState:e,conversationState:t,uiState:r,showToast:s});return}F&&(jt(),Xn({coreState:e,conversationState:t,uiState:r,showToast:s}),I(!1));const B=i.current;if(!B||B.scrollEventAdded)return;let fe;const Me=at=>{const bt=at.target;bt.scrollTop*-1+bt.clientHeight===bt.scrollHeight&&jt()};return fe=requestAnimationFrame(()=>{B.addEventListener("scroll",Me),B.scrollEventAdded=!0}),()=>{cancelAnimationFrame(fe),B.removeEventListener("scroll",Me)}},[F,T==null?void 0:T._id]),_e(()=>{if(!(le!=null&&le.length))return;S.current.messagesLength[(T==null?void 0:T._id)||""]=le.length;const B=le[0];B.owner==="agent"&&!B.seen&&Ed(B,e,t,r,s)},[le.length]),T?p("div",{className:"conversationDetails",children:[p("div",{className:"conversationDetailsHeader",children:[p("div",{onClick:br,style:{pointerEvents:Oe||_?"none":"",opacity:Oe||_?"0.5":"1"},children:p(Lo,{className:"background-text-color"})}),p("div",{style:{display:"flex",gap:"5px",alignItems:"center",color:b.appearance.color.backgroundText},children:[p(vh,{chatbot:b,humanControl:se,latestCurrentConversation:T}),"Controlled By ",T!=null&&T.assignedTo?"Human":"AI"]}),p("div",{style:{width:"21px"}})]}),p("div",{className:"livelinkMsgs",ref:i,children:[G&&j&&!(T!=null&&T.assignedTo)&&!o&&p(Eh,{hoveringMessageInner:G,chatbot:b}),Oe&&!((_r=le[0])!=null&&_r._id.startsWith("streaming_"))&&p(Th,{chatbot:b}),ye&&p(kh,{chatbot:b}),he&&!(T!=null&&T.assignedTo)&&p(yh,{email:(w==null?void 0:w.email)||"",chatbot:b,dataFromUser:he}),E&&!(T!=null&&T.assignedTo)&&p(xh,{chatbot:b,ratingFromUser:E}),(T==null?void 0:T.assignType)&&!(T!=null&&T.assignedTo)&&p(wh,{currentConversation:T,chatbot:b,onlineAgents:C}),le.map((B,fe)=>{if(B._id.startsWith("streaming_"))return p(Lf,{chatbot:b,message:B},B._id);if(!B.data.path)return p(Sh,{AIControlNode:W,chatbot:b,message:B},B._id||fe)}),l&&p(Ch,{chatbot:b})]}),p("div",{children:[o&&p(Ah,{file:o,setFile:a,chatbot:b}),p("div",{className:"massageInputDivMain",style:{opacity:j||T!=null&&T.assignedTo?"1":"0.7",pointerEvents:j||T!=null&&T.assignedTo?"all":"none"},children:p("form",{onSubmit:B=>{B.preventDefault(),f.trim()&&us({coreState:e,conversationState:t,uiState:r,userMessage:f,setUserMessage:m,file:o,setFile:a,latestCurrentConversation:T,showToast:s})},children:[p("textarea",{style:{height:g},placeholder:u?"File Size Limit Reached":b.appearance.text.messagePlaceholder,maxLength:500,onChange:Ne,onKeyDown:mt,value:f,rows:1,disabled:u}),p("input",{type:"file",onChange:O,style:{display:"none"},id:"fileUpload",accept:"image/*"}),(T==null?void 0:T.assignedTo)&&p("label",{className:"inputArrowMassageImg attachment",htmlFor:"fileUpload",children:p(dd,{className:"input-text-color"})}),p("button",{className:"inputArrowMassageImg",type:"submit",disabled:!f.trim(),children:p(ud,{className:"input-text-color"})})]})})]})]}):null},qf=({handleChangeConversation:n,coreState:e,conversationState:t,uiState:r,showToast:s})=>{const{chatbot:i,token:o}=e,{setConversations:a,setCurrentConversation:l,conversations:c,messages:u,totalConversationsCount:d,setTotalConversationsCount:g,setMessages:h}=t,{setCallChatFlow:f}=r,[m,b]=M(!1),[v,x]=M(!1),[w,k]=M(!1);return p("div",{className:"conversationMain",children:[p("button",{className:"newConversationBtn",onClick:async()=>{var P,T,A,D;if(!(v||m))try{x(!0);const E=await $t.userCreate({body:{}},o);if(!E.data)throw new Error("Conversation creation failed");const j=E.data;l(j),a(Z=>[...Z,j]),f(!0)}catch(E){((T=(P=E.response)==null?void 0:P.data)==null?void 0:T.error)==="Limit Reached"&&b(!0),s(((D=(A=E.response)==null?void 0:A.data)==null?void 0:D.message)||"Failed to create conversation","error")}finally{x(!1)}},children:v?p("div",{className:"newConversationLoading",children:p(un,{className:"base-text-color",width:13,height:13})}):m?"Limit Reached":"+ Conversation"}),p(mh,{conversations:c,chatbot:i,handleChangeConversation:n,messages:u,totalConversationsCount:d,conversationsLoading:w,loadMoreConversations:async()=>{if(!w)try{k(!0);const P=await $t.userReadAll(o,{query:{skip:c.length.toString()}});if(!P.data)throw new Error("Failed to load conversations");h(T=>{const A=[...T,...P.data.messages];return t.messagesRef.current=A,A}),a(T=>[...T,...P.data.conversations]),g(P.data.count)}catch{s("Failed to load conversations","error")}finally{k(!1)}}})]})},Bf=({chatOpen:n,coreState:e,conversationState:t,uiState:r,isMobileVersion:s,fullScreen:i})=>{const{showToast:o,ToastContainer:a}=Uf(),{chatbot:l,token:c,isChatbotDefault:u}=e,{setCallChatFlow:d}=r,{setMessages:g,messagesRef:h,setConversations:f,setTotalConversationsCount:m,setCurrentConversation:b}=t,[v,x]=M(!u),w=_=>{b(_),_!==null&&!u&&d(!0)},k=async()=>{try{x(!0);const _=await $t.userReadAll(c);if(!_.data)throw new Error("Failed to load conversations");const S=_.data.messages||[];h.current=S,g(S),f(_.data.conversations||[]),m(_.data.count||0)}catch{o("Failed to initialize conversations","error")}finally{x(!1)}};return _e(()=>{u||k()},[c]),p("div",{className:`chatbotConversationContainer ${n?"open":""} ${i?"fullscreen":""}`,style:i?void 0:{maxHeight:`calc(95vh - 70px - ${l.appearance.others.position[s?"mobile":"desktop"].verticalSpace}px)`,maxWidth:`calc(95vw - ${l.appearance.others.position[s?"mobile":"desktop"].horizontalSpace}px)`},children:[p(a,{}),p("div",{className:"top-header",children:[p("h2",{children:l.appearance.text.heading}),p("h4",{children:l.appearance.text.description}),l.appearance.others.showAgents&&p(xs,{className:"mainAgents",chatbot:l})]}),p("div",{className:"liveLinkRightDiv",children:v?p("div",{className:"loadingDiv",children:p(un,{className:"background-text-color"})}):p(Te,{children:[p(zf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o}),p(qf,{handleChangeConversation:w,coreState:e,conversationState:t,uiState:r,showToast:o})]})}),!l.appearance.others.removePoweredBy&&p("div",{className:"livelinkPoweredDiv2",children:[p("span",{children:"Powered By "}),p("img",{src:hd,alt:"Logo"}),p("a",{href:"https://robodialog.com",target:"_blank",children:"Robodialog"})]})]})},Hf=({coreState:n,conversationState:e,uiState:t,fullScreen:r})=>{var A;const[s,i]=M(!1),[o,a]=M(!0),l=Fr("robodialog-chatbot-opened"),[c,u]=M(null),{userData:d,chatbot:g}=n,{newMessage:h,setNewMessage:f}=e,{setInteracted:m,chatOpen:b,setChatOpen:v}=t,x=g.chatflow.nodes.find(D=>d!=null&&d.isUser?D.type==="StartNode"&&D.data.channel.users:D.type==="StartNode"&&D.data.channel.visitors),w=((A=x==null?void 0:x.data)==null?void 0:A.hoveringMessage)||null,k=()=>{v(!b)};typeof window<"u"&&(window.robodialog={...window.robodialog||{},openChat:k});const _=g.appearance.others.position,S=_[s?"mobile":"desktop"].position==="bottomleft",P={alignItems:s?_.mobile.position==="bottomleft"?"flex-start":"flex-end":_.desktop.position==="bottomleft"?"flex-start":"flex-end",bottom:s?`${_.mobile.verticalSpace}px`:`${_.desktop.verticalSpace}px`,[S?"left":"right"]:s?`${_.mobile.horizontalSpace}px`:`${_.desktop.horizontalSpace}px`};_e(()=>{const D=()=>{i(window.innerWidth<_.mobileStartsFrom)};return D(),window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[_.mobileStartsFrom]),_e(()=>{b&&(m(!0),a(!1),Sn("robodialog-chatbot-opened",!0))},[b]),_e(()=>{var D,E,j,Z;if(h&&((E=(D=x==null?void 0:x.data)==null?void 0:D.popupMessage)!=null&&E.value)){const se=(Z=(j=x==null?void 0:x.data)==null?void 0:j.popupMessage)==null?void 0:Z.duration;c&&clearTimeout(c);const Oe=window.setTimeout(()=>{f(null)},se*1e3);u(Oe)}return()=>{c&&clearTimeout(c)}},[h]),_e(()=>{var E;const D=(E=x==null?void 0:x.data)==null?void 0:E.automaticallyOpenConversation;!(D!=null&&D.value)||r||(D.type==="allTheTime"||D.type==="oncePerVisit"&&!l)&&(v(!0),a(!1),Sn("robodialog-chatbot-opened",!0))},[]),_e(()=>{r&&v(!0)},[r,v]);const T=p("div",{className:`chatbotMain ${r?"fullscreen":""}`,style:r?void 0:P,children:[p(Bf,{chatOpen:b,coreState:n,conversationState:e,uiState:t,isMobileVersion:s,fullScreen:r}),!r&&p(Te,{children:[p(Rh,{chatbot:g,showHoveringMessage:o,hoveringMessages:w,setShowHoveringMessage:a,coreState:n,conversationState:e,uiState:t,node:x,setChatOpen:v}),p("div",{className:"chatbotChat",style:{flexDirection:S?"row-reverse":"row"},children:[p("div",{className:"chatbotDrag handle",children:p(cd,{className:"background-text-color",width:10})}),p("div",{className:"chatbotChatInside",onClick:k,children:[p("img",{src:ie(g.appearance.images.chat,200),alt:"Chat",style:{display:b?"none":"block"}}),p(ad,{className:"background-text-color",style:{display:b?"block":"none"}})]})]})]})]});return r?T:p(Ff,{axis:"both",handle:".handle",defaultPosition:{x:0,y:0},position:b?{x:0,y:0}:void 0,scale:1,bounds:".robodialog-chatbot-app",children:T})};function ke(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(n,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function Wf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ws={exports:{}},Qt=typeof Reflect=="object"?Reflect:null,dl=Qt&&typeof Qt.apply=="function"?Qt.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},cr;Qt&&typeof Qt.ownKeys=="function"?cr=Qt.ownKeys:Object.getOwnPropertySymbols?cr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:cr=function(e){return Object.getOwnPropertyNames(e)};function Vf(n){console&&console.warn&&console.warn(n)}var hl=Number.isNaN||function(e){return e!==e};function te(){te.init.call(this)}Ws.exports=te,Ws.exports.once=Zf,te.EventEmitter=te,te.prototype._events=void 0,te.prototype._eventsCount=0,te.prototype._maxListeners=void 0;var fl=10;function ur(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(te,"defaultMaxListeners",{enumerable:!0,get:function(){return fl},set:function(n){if(typeof n!="number"||n<0||hl(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");fl=n}}),te.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},te.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||hl(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function pl(n){return n._maxListeners===void 0?te.defaultMaxListeners:n._maxListeners}te.prototype.getMaxListeners=function(){return pl(this)},te.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s=e==="error",i=this._events;if(i!==void 0)s=s&&i.error===void 0;else if(!s)return!1;if(s){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=i[e];if(l===void 0)return!1;if(typeof l=="function")dl(l,this,t);else for(var c=l.length,u=vl(l,c),r=0;r<c;++r)dl(u[r],this,t);return!0};function gl(n,e,t,r){var s,i,o;if(ur(t),i=n._events,i===void 0?(i=n._events=Object.create(null),n._eventsCount=0):(i.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),i=n._events),o=i[e]),o===void 0)o=i[e]=t,++n._eventsCount;else if(typeof o=="function"?o=i[e]=r?[t,o]:[o,t]:r?o.unshift(t):o.push(t),s=pl(n),s>0&&o.length>s&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,Vf(a)}return n}te.prototype.addListener=function(e,t){return gl(this,e,t,!1)},te.prototype.on=te.prototype.addListener,te.prototype.prependListener=function(e,t){return gl(this,e,t,!0)};function Yf(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ml(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},s=Yf.bind(r);return s.listener=t,r.wrapFn=s,s}te.prototype.once=function(e,t){return ur(t),this.on(e,ml(this,e,t)),this},te.prototype.prependOnceListener=function(e,t){return ur(t),this.prependListener(e,ml(this,e,t)),this},te.prototype.removeListener=function(e,t){var r,s,i,o,a;if(ur(t),s=this._events,s===void 0)return this;if(r=s[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;i===0?r.shift():Xf(r,i),r.length===1&&(s[e]=r[0]),s.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this},te.prototype.off=te.prototype.removeListener,te.prototype.removeAllListeners=function(e){var t,r,s;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var i=Object.keys(r),o;for(s=0;s<i.length;++s)o=i[s],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(s=t.length-1;s>=0;s--)this.removeListener(e,t[s]);return this};function bl(n,e,t){var r=n._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?t?[s.listener||s]:[s]:t?Jf(s):vl(s,s.length)}te.prototype.listeners=function(e){return bl(this,e,!0)},te.prototype.rawListeners=function(e){return bl(this,e,!1)},te.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):_l.call(n,e)},te.prototype.listenerCount=_l;function _l(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}te.prototype.eventNames=function(){return this._eventsCount>0?cr(this._events):[]};function vl(n,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=n[r];return t}function Xf(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Jf(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function Zf(n,e){return new Promise(function(t,r){function s(o){n.removeListener(e,i),r(o)}function i(){typeof n.removeListener=="function"&&n.removeListener("error",s),t([].slice.call(arguments))}yl(n,e,i,{once:!0}),e!=="error"&&Gf(n,s,{once:!0})})}function Gf(n,e,t){typeof n.on=="function"&&yl(n,"error",e,t)}function yl(n,e,t,r){if(typeof n.on=="function")r.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function s(i){r.once&&n.removeEventListener(e,s),t(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var Kf=Ws.exports,xl=Wf(Kf),ae;(function(n){n[n.timeout=1]="timeout",n[n.transportClosed=2]="transportClosed",n[n.clientDisconnected=3]="clientDisconnected",n[n.clientClosed=4]="clientClosed",n[n.clientConnectToken=5]="clientConnectToken",n[n.clientRefreshToken=6]="clientRefreshToken",n[n.subscriptionUnsubscribed=7]="subscriptionUnsubscribed",n[n.subscriptionSubscribeToken=8]="subscriptionSubscribeToken",n[n.subscriptionRefreshToken=9]="subscriptionRefreshToken",n[n.transportWriteError=10]="transportWriteError",n[n.connectionClosed=11]="connectionClosed",n[n.badConfiguration=12]="badConfiguration"})(ae||(ae={}));var Tt;(function(n){n[n.connectCalled=0]="connectCalled",n[n.transportClosed=1]="transportClosed",n[n.noPing=2]="noPing",n[n.subscribeTimeout=3]="subscribeTimeout",n[n.unsubscribeError=4]="unsubscribeError"})(Tt||(Tt={}));var vn;(function(n){n[n.disconnectCalled=0]="disconnectCalled",n[n.unauthorized=1]="unauthorized",n[n.badProtocol=2]="badProtocol",n[n.messageSizeLimit=3]="messageSizeLimit"})(vn||(vn={}));var dr;(function(n){n[n.subscribeCalled=0]="subscribeCalled",n[n.transportClosed=1]="transportClosed"})(dr||(dr={}));var hr;(function(n){n[n.unsubscribeCalled=0]="unsubscribeCalled",n[n.unauthorized=1]="unauthorized",n[n.clientClosed=2]="clientClosed"})(hr||(hr={}));var Vs;(function(n){n[n.channelCompaction=1]="channelCompaction"})(Vs||(Vs={}));var me;(function(n){n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected"})(me||(me={}));var Re;(function(n){n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed"})(Re||(Re={}));function Qf(n,e){return n.lastIndexOf(e,0)===0}function wl(n){return n==null?!1:typeof n=="function"}function ep(n,e){if(globalThis.console){const t=globalThis.console[n];wl(t)&&t.apply(globalThis.console,e)}}function tp(n,e){return Math.floor(Math.random()*(e-n+1)+n)}function fr(n,e,t){n>31&&(n=31);const r=tp(0,Math.min(t,e*Math.pow(2,n)));return Math.min(t,e+r)}function np(n){return"error"in n&&n.error!==null}function pr(n){return Math.min(n*1e3,2147483647)}class rp extends xl{constructor(e,t,r){super(),this._resubscribeTimeout=null,this._refreshTimeout=null,this.channel=t,this.state=Re.Unsubscribed,this._centrifuge=e,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._id=0,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._tagsFilter=null,this._prevValue=null,this._unsubPromise=Promise.resolve(),this._setOptions(r),this._centrifuge._debugEnabled?(this.on("state",s=>{this._debug("subscription state",t,s.oldState,"->",s.newState)}),this.on("error",s=>{this._debug("subscription error",t,s)})):this.on("error",function(){Function.prototype()})}ready(e){return this.state===Re.Unsubscribed?Promise.reject({code:ae.subscriptionUnsubscribed,message:this.state}):this.state===Re.Subscribed?Promise.resolve():new Promise((t,r)=>{const s={resolve:t,reject:r};e&&(s.timeout=setTimeout(function(){r({code:ae.timeout,message:"timeout"})},e)),this._promises[this._nextPromiseId()]=s})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(dr.subscribeCalled,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(hr.unsubscribeCalled,"unsubscribe called",!0)}publish(e){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.publish(this.channel,e)})}presence(){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presence(this.channel)})}presenceStats(){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.presenceStats(this.channel)})}history(e){return ke(this,void 0,void 0,function*(){return yield this._methodCall(),this._centrifuge.history(this.channel,e)})}setTagsFilter(e){if(e&&this._delta)throw new Error("cannot use delta and tagsFilter together");this._tagsFilter=e}setData(e){this._data=e}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:ae.subscriptionUnsubscribed,message:this.state}):new Promise((e,t)=>{const r=this._centrifuge._config.timeout,s=setTimeout(()=>{t({code:ae.timeout,message:"timeout"})},r);this._promises[this._nextPromiseId()]={timeout:s,resolve:e,reject:t}})}_nextPromiseId(){return++this._promiseId}_needRecover(){return this._recover===!0}_isUnsubscribed(){return this.state===Re.Unsubscribed}_isSubscribing(){return this.state===Re.Subscribing}_isSubscribed(){return this.state===Re.Subscribed}_setState(e){if(this.state!==e){const t=this.state;return this.state=e,this.emit("state",{newState:e,oldState:t,channel:this.channel}),!0}return!1}_usesToken(){return this._token!==""||this._getToken!==null}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout()}_setSubscribed(e){if(!this._isSubscribing())return;this._clearSubscribingState(),e.id&&(this._id=e.id),e.recoverable&&(this._recover=!0,this._offset=e.offset||0,this._epoch=e.epoch||""),e.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,this._setState(Re.Subscribed);const t=this._centrifuge._getSubscribeContext(this.channel,e);this.emit("subscribed",t),this._resolvePromises();const r=e.publications;if(r&&r.length>0)for(const s in r)r.hasOwnProperty(s)&&this._handlePublication(r[s]);e.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),pr(e.ttl)))}_setSubscribing(e,t){return ke(this,void 0,void 0,function*(){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState(Re.Subscribing)&&this.emit("subscribing",{channel:this.channel,code:e,reason:t}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&(yield this._unsubPromise),this._isSubscribing()&&this._subscribe())})}_subscribe(){return this._debug("subscribing on",this.channel),this._isTransportOpen()?this._inflight?null:(this._inflight=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():(this._getSubscriptionToken().then(e=>this._handleTokenResponse(e)).catch(e=>this._handleTokenError(e)),null)):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_getDataAndSubscribe(e){if(!this._getData){this._inflight=!1;return}this._getData({channel:this.channel}).then(t=>{if(!this._isSubscribing()){this._inflight=!1;return}this._data=t,this._sendSubscribe(e)}).catch(t=>this._handleGetDataError(t))}_handleGetDataError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof gt){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:ae.badConfiguration,message:(e==null?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_handleTokenResponse(e){if(!this._isSubscribing()){this._inflight=!1;return}if(!e){this._inflight=!1,this._failUnauthorized();return}this._token=e,this._getData?this._getDataAndSubscribe(e):this._sendSubscribe(e)}_handleTokenError(e){if(!this._isSubscribing()){this._inflight=!1;return}if(e instanceof gt){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:ae.subscriptionSubscribeToken,message:(e==null?void 0:e.toString())||""}}),this._inflight=!1,this._scheduleResubscribe()}_sendSubscribe(e){if(!this._isTransportOpen())return this._inflight=!1,null;const t=this._buildSubscribeCommand(e);return this._centrifuge._call(t).then(r=>{this._inflight=!1;const s=r.reply.subscribe;this._handleSubscribeResponse(s),r.next&&r.next()},r=>{this._inflight=!1,this._handleSubscribeError(r.error),r.next&&r.next()}),t}_buildSubscribeCommand(e){const t={channel:this.channel};if(e&&(t.token=e),this._data&&(t.data=this._data),this._positioned&&(t.positioned=!0),this._recoverable&&(t.recoverable=!0),this._joinLeave&&(t.join_leave=!0),t.flag=Vs.channelCompaction,this._needRecover()){t.recover=!0;const r=this._getOffset();r&&(t.offset=r);const s=this._getEpoch();s&&(t.epoch=s)}return this._delta&&(t.delta=this._delta),this._tagsFilter&&(t.tf=this._tagsFilter),{subscribe:t}}_debug(...e){this._centrifuge._debug(...e)}_handleSubscribeError(e){if(this._isSubscribing()){if(e.code===ae.timeout){this._centrifuge._disconnect(Tt.subscribeTimeout,"subscribe timeout",!0);return}this._subscribeError(e)}}_handleSubscribeResponse(e){this._isSubscribing()&&this._setSubscribed(e)}_setUnsubscribed(e,t,r){if(this._isUnsubscribed())return Promise.resolve();let s=Promise.resolve();return this._isSubscribed()?(r&&(s=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&r&&(s=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._setState(Re.Unsubscribed)&&this.emit("unsubscribed",{channel:this.channel,code:e,reason:t}),this._rejectPromises({code:ae.subscriptionUnsubscribed,message:this.state}),s}_handlePublication(e){if(this._delta&&this._delta_negotiated){const{newData:r,newPrevValue:s}=this._centrifuge._codec.applyDeltaIfNeeded(e,this._prevValue);e.data=r,this._prevValue=s}const t=this._centrifuge._getPublicationContext(this.channel,e);this.emit("publication",t),e.offset&&(this._offset=e.offset)}_handleJoin(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("join",{channel:this.channel,info:t})}_handleLeave(e){const t=this._centrifuge._getJoinLeaveContext(e.info);this.emit("leave",{channel:this.channel,info:t})}_resolvePromises(){for(const e in this._promises)this._promises.hasOwnProperty(e)&&(this._promises[e].timeout&&clearTimeout(this._promises[e].timeout),this._promises[e].resolve(),delete this._promises[e])}_rejectPromises(e){for(const t in this._promises)this._promises.hasOwnProperty(t)&&(this._promises[t].timeout&&clearTimeout(this._promises[t].timeout),this._promises[t].reject(e),delete this._promises[t])}_scheduleResubscribe(){if(!this._isSubscribing()){this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);return}const e=this,t=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout(function(){e._isSubscribing()&&e._subscribe()},t),this._debug("resubscribe scheduled after "+t,this.channel)}_subscribeError(e){if(this._isSubscribing())if(e.code<100||e.code===109||e.temporary===!0){e.code===109&&(this._token="");const t={channel:this.channel,type:"subscribe",error:e};this._centrifuge.state===me.Connected&&this.emit("error",t),this._scheduleResubscribe()}else this._setUnsubscribed(e.code,e.message,!1)}_getResubscribeDelay(){const e=fr(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,e}_setOptions(e){if(e){if(e.since&&(this._offset=e.since.offset||0,this._epoch=e.since.epoch||"",this._recover=!0),e.data&&(this._data=e.data),e.getData&&(this._getData=e.getData),e.minResubscribeDelay!==void 0&&(this._minResubscribeDelay=e.minResubscribeDelay),e.maxResubscribeDelay!==void 0&&(this._maxResubscribeDelay=e.maxResubscribeDelay),e.token&&(this._token=e.token),e.getToken&&(this._getToken=e.getToken),e.positioned===!0&&(this._positioned=!0),e.recoverable===!0&&(this._recoverable=!0),e.joinLeave===!0&&(this._joinLeave=!0),e.delta){if(e.delta!=="fossil")throw new Error("unsupported delta format");this._delta=e.delta}if(e.tagsFilter&&(this._tagsFilter=e.tagsFilter),this._tagsFilter&&this._delta)throw new Error("cannot use delta and tagsFilter together")}}_getOffset(){const e=this._offset;return e!==null?e:0}_getEpoch(){const e=this._epoch;return e!==null?e:""}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){this._resubscribeTimeout!==null&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);const e={channel:this.channel},t=this._getToken;return t===null?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:ae.badConfiguration,message:"provide a function to get channel subscription token"}}),Promise.reject(new gt(""))):t(e)}_refresh(){this._clearRefreshTimeout();const e=this;this._getSubscriptionToken().then(function(t){if(!e._isSubscribed())return;if(!t){e._failUnauthorized();return}e._token=t;const s={sub_refresh:{channel:e.channel,token:t}};e._centrifuge._call(s).then(i=>{const o=i.reply.sub_refresh;e._refreshResponse(o),i.next&&i.next()},i=>{e._refreshError(i.error),i.next&&i.next()})}).catch(function(t){if(t instanceof gt){e._failUnauthorized();return}e.emit("error",{type:"refreshToken",channel:e.channel,error:{code:ae.subscriptionRefreshToken,message:t!==void 0?t.toString():""}}),e._refreshTimeout=setTimeout(()=>e._refresh(),e._getRefreshRetryDelay())})}_refreshResponse(e){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),e.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),pr(e.ttl))))}_refreshError(e){this._isSubscribed()&&(e.code<100||e.temporary===!0?(this.emit("error",{type:"refresh",channel:this.channel,error:e}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._setUnsubscribed(e.code,e.message,!0))}_getRefreshRetryDelay(){return fr(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(hr.unauthorized,"unauthorized",!0)}}class sp{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return this.options.sockjs!==null}initialize(e,t){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=r=>{t.onError(r)},this._transport.onclose=r=>{t.onClose(r)},this._transport.onmessage=r=>{t.onMessage(r.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class kl{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return this.options.websocket!==void 0&&this.options.websocket!==null}initialize(e,t){let r="";e==="protobuf"&&(r="centrifuge-protobuf"),r!==""?this._transport=new this.options.websocket(this.endpoint,r):this._transport=new this.options.websocket(this.endpoint),e==="protobuf"&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{t.onOpen()},this._transport.onerror=s=>{t.onError(s)},this._transport.onclose=s=>{t.onClose(s)},this._transport.onmessage=s=>{t.onMessage(s.data)}}close(){this._transport.close()}send(e){this._transport.send(e)}}class ip{constructor(e,t){this.endpoint=e,this.options=t,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(e){if(!e.ok)throw new Error(e.status);return e}_fetchEventTarget(e,t,r){const s=new EventTarget,i=e.options.fetch;return i(t,r).then(e._handleErrors).then(o=>{s.dispatchEvent(new Event("open"));let a="",l=0,c=new Uint8Array;const u=o.body.getReader();return new e.options.readableStream({start(d){function g(){return u.read().then(({done:h,value:f})=>{if(h){s.dispatchEvent(new Event("close")),d.close();return}try{if(e._protocol==="json")for(a+=e._utf8decoder.decode(f);l<a.length;)if(a[l]===`
|
|
110
110
|
`){const m=a.substring(0,l);s.dispatchEvent(new MessageEvent("message",{data:m})),a=a.substring(l+1),l=0}else++l;else{const m=new Uint8Array(c.length+f.length);for(m.set(c),m.set(f,c.length),c=m;;){const b=e.options.decoder.decodeReply(c);if(b.ok){const v=c.slice(0,b.pos);s.dispatchEvent(new MessageEvent("message",{data:v})),c=c.slice(b.pos);continue}break}}}catch(m){s.dispatchEvent(new Event("error",{detail:m})),s.dispatchEvent(new Event("close")),d.close();return}g()}).catch(function(h){s.dispatchEvent(new Event("error",{detail:h})),s.dispatchEvent(new Event("close")),d.close()})}return g()}})}).catch(o=>{s.dispatchEvent(new Event("error",{detail:o})),s.dispatchEvent(new Event("close"))}),s}supported(){return this.options.fetch!==null&&this.options.readableStream!==null&&typeof TextDecoder<"u"&&typeof AbortController<"u"&&typeof EventTarget<"u"&&typeof Event<"u"&&typeof MessageEvent<"u"&&typeof Error<"u"}initialize(e,t,r){this._protocol=e,this._abortController=new AbortController;let s,i;e==="json"?(s={Accept:"application/json","Content-Type":"application/json"},i=r):(s={Accept:"application/octet-stream","Content-Type":"application/octet-stream"},i=r);const o={method:"POST",headers:s,body:i,mode:"cors",credentials:"same-origin",signal:this._abortController.signal},a=this._fetchEventTarget(this,this.endpoint,o);a.addEventListener("open",()=>{t.onOpen()}),a.addEventListener("error",l=>{this._abortController.abort(),t.onError(l)}),a.addEventListener("close",()=>{this._abortController.abort(),t.onClose({code:4,reason:"connection closed"})}),a.addEventListener("message",l=>{t.onMessage(l.data)})}close(){this._abortController.abort()}send(e,t,r){let s,i;const o={session:t,node:r,data:e};this._protocol==="json"?(s={"Content-Type":"application/json"},i=JSON.stringify(o)):(s={"Content-Type":"application/octet-stream"},i=this.options.encoder.encodeEmulationRequest(o));const a=this.options.fetch,l={method:"POST",headers:s,body:i,mode:"cors",credentials:"same-origin"};a(this.options.emulationEndpoint,l)}}class op{constructor(e,t){this.endpoint=e,this.options=t,this._protocol="json",this._transport=null,this._onClose=null}name(){return"sse"}subName(){return"sse"}emulation(){return!0}supported(){return this.options.eventsource!==null&&this.options.fetch!==null}initialize(e,t,r){let s;globalThis&&globalThis.document&&globalThis.document.baseURI?s=new URL(this.endpoint,globalThis.document.baseURI):s=new URL(this.endpoint),s.searchParams.append("cf_connect",r);const i={},o=new this.options.eventsource(s.toString(),i);this._transport=o;const a=this;o.onopen=function(){t.onOpen()},o.onerror=function(l){o.close(),t.onError(l),t.onClose({code:4,reason:"connection closed"})},o.onmessage=function(l){t.onMessage(l.data)},a._onClose=function(){t.onClose({code:4,reason:"connection closed"})}}close(){this._transport.close(),this._onClose!==null&&this._onClose()}send(e,t,r){const s={session:t,node:r,data:e},i={"Content-Type":"application/json"},o=JSON.stringify(s),a=this.options.fetch,l={method:"POST",headers:i,body:o,mode:"cors",credentials:"same-origin"};a(this.options.emulationEndpoint,l)}}class ap{constructor(e,t){this.endpoint=e,this.options=t,this._transport=null,this._stream=null,this._writer=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"webtransport"}subName(){return"webtransport"}emulation(){return!1}supported(){return this.options.webtransport!==void 0&&this.options.webtransport!==null}initialize(e,t){return ke(this,void 0,void 0,function*(){let r;globalThis&&globalThis.document&&globalThis.document.baseURI?r=new URL(this.endpoint,globalThis.document.baseURI):r=new URL(this.endpoint),e==="protobuf"&&r.searchParams.append("cf_protocol","protobuf"),this._protocol=e;const s=new EventTarget;this._transport=new this.options.webtransport(r.toString()),this._transport.closed.then(()=>{t.onClose({code:4,reason:"connection closed"})}).catch(()=>{t.onClose({code:4,reason:"connection closed"})});try{yield this._transport.ready}catch{this.close();return}let i;try{i=yield this._transport.createBidirectionalStream()}catch{this.close();return}this._stream=i,this._writer=this._stream.writable.getWriter(),s.addEventListener("close",()=>{t.onClose({code:4,reason:"connection closed"})}),s.addEventListener("message",o=>{t.onMessage(o.data)}),this._startReading(s),t.onOpen()})}_startReading(e){return ke(this,void 0,void 0,function*(){const t=this._stream.readable.getReader();let r="",s=0,i=new Uint8Array;try{for(;;){const{done:o,value:a}=yield t.read();if(a.length>0)if(this._protocol==="json")for(r+=this._utf8decoder.decode(a);s<r.length;)if(r[s]===`
|
|
111
111
|
`){const l=r.substring(0,s);e.dispatchEvent(new MessageEvent("message",{data:l})),r=r.substring(s+1),s=0}else++s;else{const l=new Uint8Array(i.length+a.length);for(l.set(i),l.set(a,i.length),i=l;;){const c=this.options.decoder.decodeReply(i);if(c.ok){const u=i.slice(0,c.pos);e.dispatchEvent(new MessageEvent("message",{data:u})),i=i.slice(c.pos);continue}break}}if(o)break}}catch{e.dispatchEvent(new Event("close"))}})}close(){return ke(this,void 0,void 0,function*(){try{this._writer&&(yield this._writer.close()),this._transport.close()}catch{}})}send(e){return ke(this,void 0,void 0,function*(){let t;this._protocol==="json"?t=new TextEncoder().encode(e+`
|
|
112
112
|
`):t=e;try{yield this._writer.write(t)}catch{this.close()}})}}const lp=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1];class cp{constructor(e){this.a=e,this.pos=0}haveBytes(){return this.pos<this.a.length}getByte(){const e=this.a[this.pos];if(this.pos++,this.pos>this.a.length)throw new RangeError("out of bounds");return e}getChar(){return String.fromCharCode(this.getByte())}getInt(){let e=0,t;for(;this.haveBytes()&&(t=lp[127&this.getByte()])>=0;)e=(e<<6)+t;return this.pos--,e>>>0}}class up{constructor(){this.a=[]}toByteArray(e){return Array.isArray(e)?this.a:new Uint8Array(this.a)}putArray(e,t,r){for(let s=t;s<r;s++)this.a.push(e[s])}}function dp(n){let e=0,t=0,r=0,s=0,i=0,o=n.length;for(;o>=16;)e=e+n[i+0]|0,t=t+n[i+1]|0,r=r+n[i+2]|0,s=s+n[i+3]|0,e=e+n[i+4]|0,t=t+n[i+5]|0,r=r+n[i+6]|0,s=s+n[i+7]|0,e=e+n[i+8]|0,t=t+n[i+9]|0,r=r+n[i+10]|0,s=s+n[i+11]|0,e=e+n[i+12]|0,t=t+n[i+13]|0,r=r+n[i+14]|0,s=s+n[i+15]|0,i+=16,o-=16;for(;o>=4;)e=e+n[i+0]|0,t=t+n[i+1]|0,r=r+n[i+2]|0,s=s+n[i+3]|0,i+=4,o-=4;switch(s=((s+(r<<8)|0)+(t<<16)|0)+(e<<24)|0,o){case 3:s=s+(n[i+2]<<8)|0;case 2:s=s+(n[i+1]<<16)|0;case 1:s=s+(n[i+0]<<24)|0}return s>>>0}function hp(n,e){let t=0;const r=new cp(e),s=n.length,i=e.length,o=r.getInt();if(r.getChar()!==`
|