shopify-chatbot-widget 0.7.0 → 0.7.3

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.
@@ -321,7 +321,7 @@ You might need to use a local HTTP server (instead of file://): https://react.de
321
321
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...a){const r=new this(t);return a.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[YM]=this[YM]={accessors:{}}).accessors,o=this.prototype;function c(f){const m=Av(f);r[m]||(TV(o,f),r[m]=!0)}return Xe.isArray(t)?t.forEach(c):c(t),this}};go.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Xe.reduceDescriptors(go.prototype,({value:e},t)=>{let a=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[a]=r}}}),Xe.freezeMethods(go);function SE(e,t){const a=this||Rv,r=t||a,o=go.from(r.headers);let c=r.data;return Xe.forEach(e,function(m){c=m.call(a,c,o.normalize(),t?t.status:void 0)}),o.normalize(),c}function WM(e){return!!(e&&e.__CANCEL__)}function bm(e,t,a){Cn.call(this,e??"canceled",Cn.ERR_CANCELED,t,a),this.name="CanceledError"}Xe.inherits(bm,Cn,{__CANCEL__:!0});function ZM(e,t,a){const r=a.config.validateStatus;!a.status||!r||r(a.status)?e(a):t(new Cn("Request failed with status code "+a.status,[Cn.ERR_BAD_REQUEST,Cn.ERR_BAD_RESPONSE][Math.floor(a.status/100)-4],a.config,a.request,a))}function OV(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function RV(e,t){e=e||10;const a=new Array(e),r=new Array(e);let o=0,c=0,f;return t=t!==void 0?t:1e3,function(g){const p=Date.now(),y=r[c];f||(f=p),a[o]=g,r[o]=p;let S=c,E=0;for(;S!==o;)E+=a[S++],S=S%e;if(o=(o+1)%e,o===c&&(c=(c+1)%e),p-f<t)return;const T=y&&p-y;return T?Math.round(E*1e3/T):void 0}}function AV(e,t){let a=0,r=1e3/t,o,c;const f=(p,y=Date.now())=>{a=y,o=null,c&&(clearTimeout(c),c=null),e.apply(null,p)};return[(...p)=>{const y=Date.now(),S=y-a;S>=r?f(p,y):(o=p,c||(c=setTimeout(()=>{c=null,f(o)},r-S)))},()=>o&&f(o)]}const zS=(e,t,a=3)=>{let r=0;const o=RV(50,250);return AV(c=>{const f=c.loaded,m=c.lengthComputable?c.total:void 0,g=f-r,p=o(g),y=f<=m;r=f;const S={loaded:f,total:m,progress:m?f/m:void 0,bytes:g,rate:p||void 0,estimated:p&&m&&y?(m-f)/p:void 0,event:c,lengthComputable:m!=null,[t?"download":"upload"]:!0};e(S)},a)},KM=(e,t)=>{const a=e!=null;return[r=>t[0]({lengthComputable:a,total:e,loaded:r}),t[1]]},QM=e=>(...t)=>Xe.asap(()=>e(...t)),MV=yi.hasStandardBrowserEnv?((e,t)=>a=>(a=new URL(a,yi.origin),e.protocol===a.protocol&&e.host===a.host&&(t||e.port===a.port)))(new URL(yi.origin),yi.navigator&&/(msie|trident)/i.test(yi.navigator.userAgent)):()=>!0,_V=yi.hasStandardBrowserEnv?{write(e,t,a,r,o,c){const f=[e+"="+encodeURIComponent(t)];Xe.isNumber(a)&&f.push("expires="+new Date(a).toGMTString()),Xe.isString(r)&&f.push("path="+r),Xe.isString(o)&&f.push("domain="+o),c===!0&&f.push("secure"),document.cookie=f.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function DV(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function NV(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function JM(e,t,a){let r=!DV(t);return e&&(r||a==!1)?NV(e,t):t}const e_=e=>e instanceof go?{...e}:e;function Td(e,t){t=t||{};const a={};function r(p,y,S,E){return Xe.isPlainObject(p)&&Xe.isPlainObject(y)?Xe.merge.call({caseless:E},p,y):Xe.isPlainObject(y)?Xe.merge({},y):Xe.isArray(y)?y.slice():y}function o(p,y,S,E){if(Xe.isUndefined(y)){if(!Xe.isUndefined(p))return r(void 0,p,S,E)}else return r(p,y,S,E)}function c(p,y){if(!Xe.isUndefined(y))return r(void 0,y)}function f(p,y){if(Xe.isUndefined(y)){if(!Xe.isUndefined(p))return r(void 0,p)}else return r(void 0,y)}function m(p,y,S){if(S in t)return r(p,y);if(S in e)return r(void 0,p)}const g={url:c,method:c,data:c,baseURL:f,transformRequest:f,transformResponse:f,paramsSerializer:f,timeout:f,timeoutMessage:f,withCredentials:f,withXSRFToken:f,adapter:f,responseType:f,xsrfCookieName:f,xsrfHeaderName:f,onUploadProgress:f,onDownloadProgress:f,decompress:f,maxContentLength:f,maxBodyLength:f,beforeRedirect:f,transport:f,httpAgent:f,httpsAgent:f,cancelToken:f,socketPath:f,responseEncoding:f,validateStatus:m,headers:(p,y,S)=>o(e_(p),e_(y),S,!0)};return Xe.forEach(Object.keys(Object.assign({},e,t)),function(y){const S=g[y]||o,E=S(e[y],t[y],y);Xe.isUndefined(E)&&S!==m||(a[y]=E)}),a}const t_=e=>{const t=Td({},e);let{data:a,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:c,headers:f,auth:m}=t;t.headers=f=go.from(f),t.url=FM(JM(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),m&&f.set("Authorization","Basic "+btoa((m.username||"")+":"+(m.password?unescape(encodeURIComponent(m.password)):"")));let g;if(Xe.isFormData(a)){if(yi.hasStandardBrowserEnv||yi.hasStandardBrowserWebWorkerEnv)f.setContentType(void 0);else if((g=f.getContentType())!==!1){const[p,...y]=g?g.split(";").map(S=>S.trim()).filter(Boolean):[];f.setContentType([p||"multipart/form-data",...y].join("; "))}}if(yi.hasStandardBrowserEnv&&(r&&Xe.isFunction(r)&&(r=r(t)),r||r!==!1&&MV(t.url))){const p=o&&c&&_V.read(c);p&&f.set(o,p)}return t},$V=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(a,r){const o=t_(e);let c=o.data;const f=go.from(o.headers).normalize();let{responseType:m,onUploadProgress:g,onDownloadProgress:p}=o,y,S,E,T,O;function M(){T&&T(),O&&O(),o.cancelToken&&o.cancelToken.unsubscribe(y),o.signal&&o.signal.removeEventListener("abort",y)}let A=new XMLHttpRequest;A.open(o.method.toUpperCase(),o.url,!0),A.timeout=o.timeout;function D(){if(!A)return;const j=go.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),N={data:!m||m==="text"||m==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:j,config:e,request:A};ZM(function(B){a(B),M()},function(B){r(B),M()},N),A=null}"onloadend"in A?A.onloadend=D:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(D)},A.onabort=function(){A&&(r(new Cn("Request aborted",Cn.ECONNABORTED,e,A)),A=null)},A.onerror=function(){r(new Cn("Network Error",Cn.ERR_NETWORK,e,A)),A=null},A.ontimeout=function(){let V=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const N=o.transitional||GM;o.timeoutErrorMessage&&(V=o.timeoutErrorMessage),r(new Cn(V,N.clarifyTimeoutError?Cn.ETIMEDOUT:Cn.ECONNABORTED,e,A)),A=null},c===void 0&&f.setContentType(null),"setRequestHeader"in A&&Xe.forEach(f.toJSON(),function(V,N){A.setRequestHeader(N,V)}),Xe.isUndefined(o.withCredentials)||(A.withCredentials=!!o.withCredentials),m&&m!=="json"&&(A.responseType=o.responseType),p&&([E,O]=zS(p,!0),A.addEventListener("progress",E)),g&&A.upload&&([S,T]=zS(g),A.upload.addEventListener("progress",S),A.upload.addEventListener("loadend",T)),(o.cancelToken||o.signal)&&(y=j=>{A&&(r(!j||j.type?new bm(null,e,A):j),A.abort(),A=null)},o.cancelToken&&o.cancelToken.subscribe(y),o.signal&&(o.signal.aborted?y():o.signal.addEventListener("abort",y)));const _=OV(o.url);if(_&&yi.protocols.indexOf(_)===-1){r(new Cn("Unsupported protocol "+_+":",Cn.ERR_BAD_REQUEST,e));return}A.send(c||null)})},zV=(e,t)=>{const{length:a}=e=e?e.filter(Boolean):[];if(t||a){let r=new AbortController,o;const c=function(p){if(!o){o=!0,m();const y=p instanceof Error?p:this.reason;r.abort(y instanceof Cn?y:new bm(y instanceof Error?y.message:y))}};let f=t&&setTimeout(()=>{f=null,c(new Cn(`timeout ${t} of ms exceeded`,Cn.ETIMEDOUT))},t);const m=()=>{e&&(f&&clearTimeout(f),f=null,e.forEach(p=>{p.unsubscribe?p.unsubscribe(c):p.removeEventListener("abort",c)}),e=null)};e.forEach(p=>p.addEventListener("abort",c));const{signal:g}=r;return g.unsubscribe=()=>Xe.asap(m),g}},jV=function*(e,t){let a=e.byteLength;if(a<t){yield e;return}let r=0,o;for(;r<a;)o=r+t,yield e.slice(r,o),r=o},LV=async function*(e,t){for await(const a of VV(e))yield*jV(a,t)},VV=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:a,value:r}=await t.read();if(a)break;yield r}}finally{await t.cancel()}},n_=(e,t,a,r)=>{const o=LV(e,t);let c=0,f,m=g=>{f||(f=!0,r&&r(g))};return new ReadableStream({async pull(g){try{const{done:p,value:y}=await o.next();if(p){m(),g.close();return}let S=y.byteLength;if(a){let E=c+=S;a(E)}g.enqueue(new Uint8Array(y))}catch(p){throw m(p),p}},cancel(g){return m(g),o.return()}},{highWaterMark:2})},jS=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",a_=jS&&typeof ReadableStream=="function",BV=jS&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),r_=(e,...t)=>{try{return!!e(...t)}catch{return!1}},HV=a_&&r_(()=>{let e=!1;const t=new Request(yi.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),i_=64*1024,xE=a_&&r_(()=>Xe.isReadableStream(new Response("").body)),LS={stream:xE&&(e=>e.body)};jS&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!LS[t]&&(LS[t]=Xe.isFunction(e[t])?a=>a[t]():(a,r)=>{throw new Cn(`Response type '${t}' is not supported`,Cn.ERR_NOT_SUPPORT,r)})})})(new Response);const PV=async e=>{if(e==null)return 0;if(Xe.isBlob(e))return e.size;if(Xe.isSpecCompliantForm(e))return(await new Request(yi.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(Xe.isArrayBufferView(e)||Xe.isArrayBuffer(e))return e.byteLength;if(Xe.isURLSearchParams(e)&&(e=e+""),Xe.isString(e))return(await BV(e)).byteLength},UV=async(e,t)=>{const a=Xe.toFiniteNumber(e.getContentLength());return a??PV(t)},CE={http:sV,xhr:$V,fetch:jS&&(async e=>{let{url:t,method:a,data:r,signal:o,cancelToken:c,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:p,headers:y,withCredentials:S="same-origin",fetchOptions:E}=t_(e);p=p?(p+"").toLowerCase():"text";let T=zV([o,c&&c.toAbortSignal()],f),O;const M=T&&T.unsubscribe&&(()=>{T.unsubscribe()});let A;try{if(g&&HV&&a!=="get"&&a!=="head"&&(A=await UV(y,r))!==0){let N=new Request(t,{method:"POST",body:r,duplex:"half"}),L;if(Xe.isFormData(r)&&(L=N.headers.get("content-type"))&&y.setContentType(L),N.body){const[B,z]=KM(A,zS(QM(g)));r=n_(N.body,i_,B,z)}}Xe.isString(S)||(S=S?"include":"omit");const D="credentials"in Request.prototype;O=new Request(t,{...E,signal:T,method:a.toUpperCase(),headers:y.normalize().toJSON(),body:r,duplex:"half",credentials:D?S:void 0});let _=await fetch(O,E);const j=xE&&(p==="stream"||p==="response");if(xE&&(m||j&&M)){const N={};["status","statusText","headers"].forEach(U=>{N[U]=_[U]});const L=Xe.toFiniteNumber(_.headers.get("content-length")),[B,z]=m&&KM(L,zS(QM(m),!0))||[];_=new Response(n_(_.body,i_,B,()=>{z&&z(),M&&M()}),N)}p=p||"text";let V=await LS[Xe.findKey(LS,p)||"text"](_,e);return!j&&M&&M(),await new Promise((N,L)=>{ZM(N,L,{data:V,headers:go.from(_.headers),status:_.status,statusText:_.statusText,config:e,request:O})})}catch(D){throw M&&M(),D&&D.name==="TypeError"&&/Load failed|fetch/i.test(D.message)?Object.assign(new Cn("Network Error",Cn.ERR_NETWORK,e,O),{cause:D.cause||D}):Cn.from(D,D&&D.code,e,O)}})};Xe.forEach(CE,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const o_=e=>`- ${e}`,IV=e=>Xe.isFunction(e)||e===null||e===!1,l_={getAdapter:e=>{e=Xe.isArray(e)?e:[e];const{length:t}=e;let a,r;const o={};for(let c=0;c<t;c++){a=e[c];let f;if(r=a,!IV(a)&&(r=CE[(f=String(a)).toLowerCase()],r===void 0))throw new Cn(`Unknown adapter '${f}'`);if(r)break;o[f||"#"+c]=r}if(!r){const c=Object.entries(o).map(([m,g])=>`adapter ${m} `+(g===!1?"is not supported by the environment":"is not available in the build"));let f=t?c.length>1?`since :
322
322
  `+c.map(o_).join(`
323
323
  `):" "+o_(c[0]):"as no adapter specified";throw new Cn("There is no suitable adapter to dispatch the request "+f,"ERR_NOT_SUPPORT")}return r},adapters:CE};function EE(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new bm(null,e)}function s_(e){return EE(e),e.headers=go.from(e.headers),e.data=SE.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),l_.getAdapter(e.adapter||Rv.adapter)(e).then(function(r){return EE(e),r.data=SE.call(e,e.transformResponse,r),r.headers=go.from(r.headers),r},function(r){return WM(r)||(EE(e),r&&r.response&&(r.response.data=SE.call(e,e.transformResponse,r.response),r.response.headers=go.from(r.response.headers))),Promise.reject(r)})}const u_="1.10.0",VS={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{VS[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const c_={};VS.transitional=function(t,a,r){function o(c,f){return"[Axios v"+u_+"] Transitional option '"+c+"'"+f+(r?". "+r:"")}return(c,f,m)=>{if(t===!1)throw new Cn(o(f," has been removed"+(a?" in "+a:"")),Cn.ERR_DEPRECATED);return a&&!c_[f]&&(c_[f]=!0,console.warn(o(f," has been deprecated since v"+a+" and will be removed in the near future"))),t?t(c,f,m):!0}},VS.spelling=function(t){return(a,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function kV(e,t,a){if(typeof e!="object")throw new Cn("options must be an object",Cn.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const c=r[o],f=t[c];if(f){const m=e[c],g=m===void 0||f(m,c,e);if(g!==!0)throw new Cn("option "+c+" must be "+g,Cn.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new Cn("Unknown option "+c,Cn.ERR_BAD_OPTION)}}const BS={assertOptions:kV,validators:VS},Fs=BS.validators;let Od=class{constructor(t){this.defaults=t||{},this.interceptors={request:new qM,response:new qM}}async request(t,a){try{return await this._request(t,a)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const c=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?c&&!String(r.stack).endsWith(c.replace(/^.+\n.+\n/,""))&&(r.stack+=`
324
- `+c):r.stack=c}catch{}}throw r}}_request(t,a){typeof t=="string"?(a=a||{},a.url=t):a=t||{},a=Td(this.defaults,a);const{transitional:r,paramsSerializer:o,headers:c}=a;r!==void 0&&BS.assertOptions(r,{silentJSONParsing:Fs.transitional(Fs.boolean),forcedJSONParsing:Fs.transitional(Fs.boolean),clarifyTimeoutError:Fs.transitional(Fs.boolean)},!1),o!=null&&(Xe.isFunction(o)?a.paramsSerializer={serialize:o}:BS.assertOptions(o,{encode:Fs.function,serialize:Fs.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),BS.assertOptions(a,{baseUrl:Fs.spelling("baseURL"),withXsrfToken:Fs.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let f=c&&Xe.merge(c.common,c[a.method]);c&&Xe.forEach(["delete","get","head","post","put","patch","common"],O=>{delete c[O]}),a.headers=go.concat(f,c);const m=[];let g=!0;this.interceptors.request.forEach(function(M){typeof M.runWhen=="function"&&M.runWhen(a)===!1||(g=g&&M.synchronous,m.unshift(M.fulfilled,M.rejected))});const p=[];this.interceptors.response.forEach(function(M){p.push(M.fulfilled,M.rejected)});let y,S=0,E;if(!g){const O=[s_.bind(this),void 0];for(O.unshift.apply(O,m),O.push.apply(O,p),E=O.length,y=Promise.resolve(a);S<E;)y=y.then(O[S++],O[S++]);return y}E=m.length;let T=a;for(S=0;S<E;){const O=m[S++],M=m[S++];try{T=O(T)}catch(A){M.call(this,A);break}}try{y=s_.call(this,T)}catch(O){return Promise.reject(O)}for(S=0,E=p.length;S<E;)y=y.then(p[S++],p[S++]);return y}getUri(t){t=Td(this.defaults,t);const a=JM(t.baseURL,t.url,t.allowAbsoluteUrls);return FM(a,t.params,t.paramsSerializer)}};Xe.forEach(["delete","get","head","options"],function(t){Od.prototype[t]=function(a,r){return this.request(Td(r||{},{method:t,url:a,data:(r||{}).data}))}}),Xe.forEach(["post","put","patch"],function(t){function a(r){return function(c,f,m){return this.request(Td(m||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:f}))}}Od.prototype[t]=a(),Od.prototype[t+"Form"]=a(!0)});let FV=class u8{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(c){a=c});const r=this;this.promise.then(o=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](o);r._listeners=null}),this.promise.then=o=>{let c;const f=new Promise(m=>{r.subscribe(m),c=m}).then(o);return f.cancel=function(){r.unsubscribe(c)},f},t(function(c,f,m){r.reason||(r.reason=new bm(c,f,m),a(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const a=this._listeners.indexOf(t);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const t=new AbortController,a=r=>{t.abort(r)};return this.subscribe(a),t.signal.unsubscribe=()=>this.unsubscribe(a),t.signal}static source(){let t;return{token:new u8(function(o){t=o}),cancel:t}}};function qV(e){return function(a){return e.apply(null,a)}}function GV(e){return Xe.isObject(e)&&e.isAxiosError===!0}const wE={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};Object.entries(wE).forEach(([e,t])=>{wE[t]=e});function f_(e){const t=new Od(e),a=MM(Od.prototype.request,t);return Xe.extend(a,Od.prototype,t,{allOwnKeys:!0}),Xe.extend(a,t,null,{allOwnKeys:!0}),a.create=function(o){return f_(Td(e,o))},a}const $a=f_(Rv);$a.Axios=Od,$a.CanceledError=bm,$a.CancelToken=FV,$a.isCancel=WM,$a.VERSION=u_,$a.toFormData=NS,$a.AxiosError=Cn,$a.Cancel=$a.CanceledError,$a.all=function(t){return Promise.all(t)},$a.spread=qV,$a.isAxiosError=GV,$a.mergeConfig=Td,$a.AxiosHeaders=go,$a.formToJSON=e=>XM(Xe.isHTMLForm(e)?new FormData(e):e),$a.getAdapter=l_.getAdapter,$a.HttpStatusCode=wE,$a.default=$a;const{Axios:Uie,AxiosError:Iie,CanceledError:kie,isCancel:Fie,CancelToken:qie,VERSION:Gie,all:Xie,Cancel:Yie,isAxiosError:Wie,spread:Zie,toFormData:Kie,AxiosHeaders:Qie,HttpStatusCode:Jie,formToJSON:eoe,getAdapter:toe,mergeConfig:noe}=$a,bi={apiUrl:"http://localhost:8000/api/",websocketUrl:"ws://localhost:8000/ws"},sn=e=>typeof e=="string",Mv=()=>{let e,t;const a=new Promise((r,o)=>{e=r,t=o});return a.resolve=e,a.reject=t,a},d_=e=>e==null?"":""+e,XV=(e,t,a)=>{e.forEach(r=>{t[r]&&(a[r]=t[r])})},YV=/###/g,h_=e=>e&&e.indexOf("###")>-1?e.replace(YV,"."):e,m_=e=>!e||sn(e),_v=(e,t,a)=>{const r=sn(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(m_(e))return{};const c=h_(r[o]);!e[c]&&a&&(e[c]=new a),Object.prototype.hasOwnProperty.call(e,c)?e=e[c]:e={},++o}return m_(e)?{}:{obj:e,k:h_(r[o])}},p_=(e,t,a)=>{const{obj:r,k:o}=_v(e,t,Object);if(r!==void 0||t.length===1){r[o]=a;return}let c=t[t.length-1],f=t.slice(0,t.length-1),m=_v(e,f,Object);for(;m.obj===void 0&&f.length;)c=`${f[f.length-1]}.${c}`,f=f.slice(0,f.length-1),m=_v(e,f,Object),m?.obj&&typeof m.obj[`${m.k}.${c}`]<"u"&&(m.obj=void 0);m.obj[`${m.k}.${c}`]=a},WV=(e,t,a,r)=>{const{obj:o,k:c}=_v(e,t,Object);o[c]=o[c]||[],o[c].push(a)},HS=(e,t)=>{const{obj:a,k:r}=_v(e,t);if(a&&Object.prototype.hasOwnProperty.call(a,r))return a[r]},ZV=(e,t,a)=>{const r=HS(e,a);return r!==void 0?r:HS(t,a)},g_=(e,t,a)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?sn(e[r])||e[r]instanceof String||sn(t[r])||t[r]instanceof String?a&&(e[r]=t[r]):g_(e[r],t[r],a):e[r]=t[r]);return e},Sm=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var KV={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const QV=e=>sn(e)?e.replace(/[&<>"'\/]/g,t=>KV[t]):e;class JV{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const a=this.regExpMap.get(t);if(a!==void 0)return a;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const eB=[" ",",","?","!",";"],tB=new JV(20),nB=(e,t,a)=>{t=t||"",a=a||"";const r=eB.filter(f=>t.indexOf(f)<0&&a.indexOf(f)<0);if(r.length===0)return!0;const o=tB.getRegExp(`(${r.map(f=>f==="?"?"\\?":f).join("|")})`);let c=!o.test(e);if(!c){const f=e.indexOf(a);f>0&&!o.test(e.substring(0,f))&&(c=!0)}return c},TE=(e,t,a=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(a);let o=e;for(let c=0;c<r.length;){if(!o||typeof o!="object")return;let f,m="";for(let g=c;g<r.length;++g)if(g!==c&&(m+=a),m+=r[g],f=o[m],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&g<r.length-1)continue;c+=g-c+1;break}o=f}return o},Dv=e=>e?.replace("_","-"),aB={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class PS{constructor(t,a={}){this.init(t,a)}init(t,a={}){this.prefix=a.prefix||"i18next:",this.logger=t||aB,this.options=a,this.debug=a.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,a,r,o){return o&&!this.debug?null:(sn(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[a](t))}create(t){return new PS(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new PS(this.logger,t)}}var qs=new PS;class US{constructor(){this.observers={}}on(t,a){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(a)||0;this.observers[r].set(a,o+1)}),this}off(t,a){if(this.observers[t]){if(!a){delete this.observers[t];return}this.observers[t].delete(a)}}emit(t,...a){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o.apply(o,[t,...a])})}}class v_ extends US{constructor(t,a={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const a=this.options.ns.indexOf(t);a>-1&&this.options.ns.splice(a,1)}getResource(t,a,r,o={}){const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,f=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let m;t.indexOf(".")>-1?m=t.split("."):(m=[t,a],r&&(Array.isArray(r)?m.push(...r):sn(r)&&c?m.push(...r.split(c)):m.push(r)));const g=HS(this.data,m);return!g&&!a&&!r&&t.indexOf(".")>-1&&(t=m[0],a=m[1],r=m.slice(2).join(".")),g||!f||!sn(r)?g:TE(this.data?.[t]?.[a],r,c)}addResource(t,a,r,o,c={silent:!1}){const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let m=[t,a];r&&(m=m.concat(f?r.split(f):r)),t.indexOf(".")>-1&&(m=t.split("."),o=a,a=m[1]),this.addNamespaces(a),p_(this.data,m,o),c.silent||this.emit("added",t,a,r,o)}addResources(t,a,r,o={silent:!1}){for(const c in r)(sn(r[c])||Array.isArray(r[c]))&&this.addResource(t,a,c,r[c],{silent:!0});o.silent||this.emit("added",t,a,r)}addResourceBundle(t,a,r,o,c,f={silent:!1,skipCopy:!1}){let m=[t,a];t.indexOf(".")>-1&&(m=t.split("."),o=r,r=a,a=m[1]),this.addNamespaces(a);let g=HS(this.data,m)||{};f.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?g_(g,r,c):g={...g,...r},p_(this.data,m,g),f.silent||this.emit("added",t,a,r)}removeResourceBundle(t,a){this.hasResourceBundle(t,a)&&delete this.data[t][a],this.removeNamespaces(a),this.emit("removed",t,a)}hasResourceBundle(t,a){return this.getResource(t,a)!==void 0}getResourceBundle(t,a){return a||(a=this.options.defaultNS),this.getResource(t,a)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const a=this.getDataByLanguage(t);return!!(a&&Object.keys(a)||[]).find(o=>a[o]&&Object.keys(a[o]).length>0)}toJSON(){return this.data}}var y_={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,r,o){return e.forEach(c=>{t=this.processors[c]?.process(t,a,r,o)??t}),t}};const b_={},S_=e=>!sn(e)&&typeof e!="boolean"&&typeof e!="number";class IS extends US{constructor(t,a={}){super(),XV(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=qs.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,a={interpolation:{}}){const r={...a};return t==null?!1:this.resolve(t,r)?.res!==void 0}extractFromKey(t,a){let r=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let c=a.ns||this.options.defaultNS||[];const f=r&&t.indexOf(r)>-1,m=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!nB(t,r,o);if(f&&!m){const g=t.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:t,namespaces:sn(c)?[c]:c};const p=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(p[0])>-1)&&(c=p.shift()),t=p.join(o)}return{key:t,namespaces:sn(c)?[c]:c}}translate(t,a,r){let o=typeof a=="object"?{...a}:a;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(o={...o}),o||(o={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const c=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,f=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:m,namespaces:g}=this.extractFromKey(t[t.length-1],o),p=g[g.length-1];let y=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const S=o.lng||this.language,E=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(S?.toLowerCase()==="cimode")return E?c?{res:`${p}${y}${m}`,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:`${p}${y}${m}`:c?{res:m,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:m;const T=this.resolve(t,o);let O=T?.res;const M=T?.usedKey||m,A=T?.exactUsedKey||m,D=["[object Number]","[object Function]","[object RegExp]"],_=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,V=o.count!==void 0&&!sn(o.count),N=IS.hasDefaultValue(o),L=V?this.pluralResolver.getSuffix(S,o.count,o):"",B=o.ordinal&&V?this.pluralResolver.getSuffix(S,o.count,{ordinal:!1}):"",z=V&&!o.ordinal&&o.count===0,U=z&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${L}`]||o[`defaultValue${B}`]||o.defaultValue;let H=O;j&&!O&&N&&(H=U);const te=S_(H),Y=Object.prototype.toString.apply(H);if(j&&H&&te&&D.indexOf(Y)<0&&!(sn(_)&&Array.isArray(H))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Z=this.options.returnedObjectHandler?this.options.returnedObjectHandler(M,H,{...o,ns:g}):`key '${m} (${this.language})' returned an object instead of string.`;return c?(T.res=Z,T.usedParams=this.getUsedParamsDetails(o),T):Z}if(f){const Z=Array.isArray(H),W=Z?[]:{},ie=Z?A:M;for(const G in H)if(Object.prototype.hasOwnProperty.call(H,G)){const F=`${ie}${f}${G}`;N&&!O?W[G]=this.translate(F,{...o,defaultValue:S_(U)?U[G]:void 0,joinArrays:!1,ns:g}):W[G]=this.translate(F,{...o,joinArrays:!1,ns:g}),W[G]===F&&(W[G]=H[G])}O=W}}else if(j&&sn(_)&&Array.isArray(O))O=O.join(_),O&&(O=this.extendTranslation(O,t,o,r));else{let Z=!1,W=!1;!this.isValidLookup(O)&&N&&(Z=!0,O=U),this.isValidLookup(O)||(W=!0,O=m);const G=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&W?void 0:O,F=N&&U!==O&&this.options.updateMissing;if(W||Z||F){if(this.logger.log(F?"updateKey":"missingKey",S,p,m,F?U:O),f){const q=this.resolve(m,{...o,keySeparator:!1});q&&q.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Q=[];const se=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&se&&se[0])for(let q=0;q<se.length;q++)Q.push(se[q]);else this.options.saveMissingTo==="all"?Q=this.languageUtils.toResolveHierarchy(o.lng||this.language):Q.push(o.lng||this.language);const k=(q,J,ne)=>{const oe=N&&ne!==O?ne:G;this.options.missingKeyHandler?this.options.missingKeyHandler(q,p,J,oe,F,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(q,p,J,oe,F,o),this.emit("missingKey",q,p,J,O)};this.options.saveMissing&&(this.options.saveMissingPlurals&&V?Q.forEach(q=>{const J=this.pluralResolver.getSuffixes(q,o);z&&o[`defaultValue${this.options.pluralSeparator}zero`]&&J.indexOf(`${this.options.pluralSeparator}zero`)<0&&J.push(`${this.options.pluralSeparator}zero`),J.forEach(ne=>{k([q],m+ne,o[`defaultValue${ne}`]||U)})}):k(Q,m,U))}O=this.extendTranslation(O,t,o,T,r),W&&O===m&&this.options.appendNamespaceToMissingKey&&(O=`${p}${y}${m}`),(W||Z)&&this.options.parseMissingKeyHandler&&(O=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${y}${m}`:m,Z?O:void 0,o))}return c?(T.res=O,T.usedParams=this.getUsedParamsDetails(o),T):O}extendTranslation(t,a,r,o,c){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const g=sn(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(g){const S=t.match(this.interpolator.nestingRegexp);p=S&&S.length}let y=r.replace&&!sn(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(y={...this.options.interpolation.defaultVariables,...y}),t=this.interpolator.interpolate(t,y,r.lng||this.language||o.usedLng,r),g){const S=t.match(this.interpolator.nestingRegexp),E=S&&S.length;p<E&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...S)=>c?.[0]===S[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${S[0]} in key: ${a[0]}`),null):this.translate(...S,a),r)),r.interpolation&&this.interpolator.reset()}const f=r.postProcess||this.options.postProcess,m=sn(f)?[f]:f;return t!=null&&m?.length&&r.applyPostProcessor!==!1&&(t=y_.handle(m,t,a,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,a={}){let r,o,c,f,m;return sn(t)&&(t=[t]),t.forEach(g=>{if(this.isValidLookup(r))return;const p=this.extractFromKey(g,a),y=p.key;o=y;let S=p.namespaces;this.options.fallbackNS&&(S=S.concat(this.options.fallbackNS));const E=a.count!==void 0&&!sn(a.count),T=E&&!a.ordinal&&a.count===0,O=a.context!==void 0&&(sn(a.context)||typeof a.context=="number")&&a.context!=="",M=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);S.forEach(A=>{this.isValidLookup(r)||(m=A,!b_[`${M[0]}-${A}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(m)&&(b_[`${M[0]}-${A}`]=!0,this.logger.warn(`key "${o}" for languages "${M.join(", ")}" won't get resolved as namespace "${m}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),M.forEach(D=>{if(this.isValidLookup(r))return;f=D;const _=[y];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(_,y,D,A,a);else{let V;E&&(V=this.pluralResolver.getSuffix(D,a.count,a));const N=`${this.options.pluralSeparator}zero`,L=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(E&&(_.push(y+V),a.ordinal&&V.indexOf(L)===0&&_.push(y+V.replace(L,this.options.pluralSeparator)),T&&_.push(y+N)),O){const B=`${y}${this.options.contextSeparator}${a.context}`;_.push(B),E&&(_.push(B+V),a.ordinal&&V.indexOf(L)===0&&_.push(B+V.replace(L,this.options.pluralSeparator)),T&&_.push(B+N))}}let j;for(;j=_.pop();)this.isValidLookup(r)||(c=j,r=this.getResource(D,A,j,a))}))})}),{res:r,usedKey:o,exactUsedKey:c,usedLng:f,usedNS:m}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,a,r,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,a,r,o):this.resourceStore.getResource(t,a,r,o)}getUsedParamsDetails(t={}){const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!sn(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const c of a)delete o[c]}return o}static hasDefaultValue(t){const a="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&a===r.substring(0,a.length)&&t[r]!==void 0)return!0;return!1}}class x_{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=qs.create("languageUtils")}getScriptPartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return null;const a=t.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return t;const a=t.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(t){if(sn(t)&&t.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(t)[0]}catch{}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let a;return t.forEach(r=>{if(a)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(a=o)}),!a&&this.options.supportedLngs&&t.forEach(r=>{if(a)return;const o=this.getScriptPartFromCode(r);if(this.isSupportedCode(o))return a=o;const c=this.getLanguagePartFromCode(r);if(this.isSupportedCode(c))return a=c;a=this.options.supportedLngs.find(f=>{if(f===c)return f;if(!(f.indexOf("-")<0&&c.indexOf("-")<0)&&(f.indexOf("-")>0&&c.indexOf("-")<0&&f.substring(0,f.indexOf("-"))===c||f.indexOf(c)===0&&c.length>1))return f})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(t,a){if(!t)return[];if(typeof t=="function"&&(t=t(a)),sn(t)&&(t=[t]),Array.isArray(t))return t;if(!a)return t.default||[];let r=t[a];return r||(r=t[this.getScriptPartFromCode(a)]),r||(r=t[this.formatLanguageCode(a)]),r||(r=t[this.getLanguagePartFromCode(a)]),r||(r=t.default),r||[]}toResolveHierarchy(t,a){const r=this.getFallbackCodes((a===!1?[]:a)||this.options.fallbackLng||[],t),o=[],c=f=>{f&&(this.isSupportedCode(f)?o.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return sn(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(t))):sn(t)&&c(this.formatLanguageCode(t)),r.forEach(f=>{o.indexOf(f)<0&&c(this.formatLanguageCode(f))}),o}}const C_={zero:0,one:1,two:2,few:3,many:4,other:5},E_={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class rB{constructor(t,a={}){this.languageUtils=t,this.options=a,this.logger=qs.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,a){this.rules[t]=a}clearCache(){this.pluralRulesCache={}}getRule(t,a={}){const r=Dv(t==="dev"?"en":t),o=a.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:r,type:o});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let f;try{f=new Intl.PluralRules(r,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),E_;if(!t.match(/-|_/))return E_;const g=this.languageUtils.getLanguagePartFromCode(t);f=this.getRule(g,a)}return this.pluralRulesCache[c]=f,f}needsPlural(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,a,r={}){return this.getSuffixes(t,r).map(o=>`${a}${o}`)}getSuffixes(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?r.resolvedOptions().pluralCategories.sort((o,c)=>C_[o]-C_[c]).map(o=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,a,r={}){const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(a)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",a,r))}}const w_=(e,t,a,r=".",o=!0)=>{let c=ZV(e,t,a);return!c&&o&&sn(a)&&(c=TE(e,a,r),c===void 0&&(c=TE(t,a,r))),c},OE=e=>e.replace(/\$/g,"$$$$");class iB{constructor(t={}){this.logger=qs.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(a=>a),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:a,escapeValue:r,useRawValueToEscape:o,prefix:c,prefixEscaped:f,suffix:m,suffixEscaped:g,formatSeparator:p,unescapeSuffix:y,unescapePrefix:S,nestingPrefix:E,nestingPrefixEscaped:T,nestingSuffix:O,nestingSuffixEscaped:M,nestingOptionsSeparator:A,maxReplaces:D,alwaysFormat:_}=t.interpolation;this.escape=a!==void 0?a:QV,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=c?Sm(c):f||"{{",this.suffix=m?Sm(m):g||"}}",this.formatSeparator=p||",",this.unescapePrefix=y?"":S||"-",this.unescapeSuffix=this.unescapePrefix?"":y||"",this.nestingPrefix=E?Sm(E):T||Sm("$t("),this.nestingSuffix=O?Sm(O):M||Sm(")"),this.nestingOptionsSeparator=A||",",this.maxReplaces=D||1e3,this.alwaysFormat=_!==void 0?_:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(a,r)=>a?.source===r?(a.lastIndex=0,a):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,a,r,o){let c,f,m;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=T=>{if(T.indexOf(this.formatSeparator)<0){const D=w_(a,g,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(D,void 0,r,{...o,...a,interpolationkey:T}):D}const O=T.split(this.formatSeparator),M=O.shift().trim(),A=O.join(this.formatSeparator).trim();return this.format(w_(a,g,M,this.options.keySeparator,this.options.ignoreJSONStructure),A,r,{...o,...a,interpolationkey:M})};this.resetRegExp();const y=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,S=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>OE(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?OE(this.escape(T)):OE(T)}].forEach(T=>{for(m=0;c=T.regex.exec(t);){const O=c[1].trim();if(f=p(O),f===void 0)if(typeof y=="function"){const A=y(t,c,o);f=sn(A)?A:""}else if(o&&Object.prototype.hasOwnProperty.call(o,O))f="";else if(S){f=c[0];continue}else this.logger.warn(`missed to pass in variable ${O} for interpolating ${t}`),f="";else!sn(f)&&!this.useRawValueToEscape&&(f=d_(f));const M=T.safeValue(f);if(t=t.replace(c[0],M),S?(T.regex.lastIndex+=f.length,T.regex.lastIndex-=c[0].length):T.regex.lastIndex=0,m++,m>=this.maxReplaces)break}}),t}nest(t,a,r={}){let o,c,f;const m=(g,p)=>{const y=this.nestingOptionsSeparator;if(g.indexOf(y)<0)return g;const S=g.split(new RegExp(`${y}[ ]*{`));let E=`{${S[1]}`;g=S[0],E=this.interpolate(E,f);const T=E.match(/'/g),O=E.match(/"/g);((T?.length??0)%2===0&&!O||O.length%2!==0)&&(E=E.replace(/'/g,'"'));try{f=JSON.parse(E),p&&(f={...p,...f})}catch(M){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,M),`${g}${y}${E}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,g};for(;o=this.nestingRegexp.exec(t);){let g=[];f={...r},f=f.replace&&!sn(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;const p=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(p!==-1&&(g=o[1].slice(p).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),o[1]=o[1].slice(0,p)),c=a(m.call(this,o[1].trim(),f),f),c&&o[0]===t&&!sn(c))return c;sn(c)||(c=d_(c)),c||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),c=""),g.length&&(c=g.reduce((y,S)=>this.format(y,S,r.lng,{...r,interpolationkey:o[1].trim()}),c.trim())),t=t.replace(o[0],c),this.regexp.lastIndex=0}return t}}const oB=e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?a.currency||(a.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?a.range||(a.range=o.trim()):o.split(";").forEach(f=>{if(f){const[m,...g]=f.split(":"),p=g.join(":").trim().replace(/^'+|'+$/g,""),y=m.trim();a[y]||(a[y]=p),p==="false"&&(a[y]=!1),p==="true"&&(a[y]=!0),isNaN(p)||(a[y]=parseInt(p,10))}})}return{formatName:t,formatOptions:a}},T_=e=>{const t={};return(a,r,o)=>{let c=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(c={...c,[o.interpolationkey]:void 0});const f=r+JSON.stringify(c);let m=t[f];return m||(m=e(Dv(r),o),t[f]=m),m(a)}},lB=e=>(t,a,r)=>e(Dv(a),r)(t);class sB{constructor(t={}){this.logger=qs.create("formatter"),this.options=t,this.init(t)}init(t,a={interpolation:{}}){this.formatSeparator=a.interpolation.formatSeparator||",";const r=a.cacheInBuiltFormats?T_:lB;this.formats={number:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c});return m=>f.format(m)}),currency:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c,style:"currency"});return m=>f.format(m)}),datetime:r((o,c)=>{const f=new Intl.DateTimeFormat(o,{...c});return m=>f.format(m)}),relativetime:r((o,c)=>{const f=new Intl.RelativeTimeFormat(o,{...c});return m=>f.format(m,c.range||"day")}),list:r((o,c)=>{const f=new Intl.ListFormat(o,{...c});return m=>f.format(m)})}}add(t,a){this.formats[t.toLowerCase().trim()]=a}addCached(t,a){this.formats[t.toLowerCase().trim()]=T_(a)}format(t,a,r,o={}){const c=a.split(this.formatSeparator);if(c.length>1&&c[0].indexOf("(")>1&&c[0].indexOf(")")<0&&c.find(m=>m.indexOf(")")>-1)){const m=c.findIndex(g=>g.indexOf(")")>-1);c[0]=[c[0],...c.splice(1,m)].join(this.formatSeparator)}return c.reduce((m,g)=>{const{formatName:p,formatOptions:y}=oB(g);if(this.formats[p]){let S=m;try{const E=o?.formatParams?.[o.interpolationkey]||{},T=E.locale||E.lng||o.locale||o.lng||r;S=this.formats[p](m,T,{...y,...o,...E})}catch(E){this.logger.warn(E)}return S}else this.logger.warn(`there was no format function for ${p}`);return m},t)}}const uB=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class cB extends US{constructor(t,a,r,o={}){super(),this.backend=t,this.store=a,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=qs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,o.backend,o)}queueLoad(t,a,r,o){const c={},f={},m={},g={};return t.forEach(p=>{let y=!0;a.forEach(S=>{const E=`${p}|${S}`;!r.reload&&this.store.hasResourceBundle(p,S)?this.state[E]=2:this.state[E]<0||(this.state[E]===1?f[E]===void 0&&(f[E]=!0):(this.state[E]=1,y=!1,f[E]===void 0&&(f[E]=!0),c[E]===void 0&&(c[E]=!0),g[S]===void 0&&(g[S]=!0)))}),y||(m[p]=!0)}),(Object.keys(c).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(c),pending:Object.keys(f),toLoadLanguages:Object.keys(m),toLoadNamespaces:Object.keys(g)}}loaded(t,a,r){const o=t.split("|"),c=o[0],f=o[1];a&&this.emit("failedLoading",c,f,a),!a&&r&&this.store.addResourceBundle(c,f,r,void 0,void 0,{skipCopy:!0}),this.state[t]=a?-1:2,a&&r&&(this.state[t]=0);const m={};this.queue.forEach(g=>{WV(g.loaded,[c],f),uB(g,t),a&&g.errors.push(a),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(p=>{m[p]||(m[p]={});const y=g.loaded[p];y.length&&y.forEach(S=>{m[p][S]===void 0&&(m[p][S]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",m),this.queue=this.queue.filter(g=>!g.done)}read(t,a,r,o=0,c=this.retryTimeout,f){if(!t.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:a,fcName:r,tried:o,wait:c,callback:f});return}this.readingCalls++;const m=(p,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const S=this.waitingReads.shift();this.read(S.lng,S.ns,S.fcName,S.tried,S.wait,S.callback)}if(p&&y&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,a,r,o+1,c*2,f)},c);return}f(p,y)},g=this.backend[r].bind(this.backend);if(g.length===2){try{const p=g(t,a);p&&typeof p.then=="function"?p.then(y=>m(null,y)).catch(m):m(null,p)}catch(p){m(p)}return}return g(t,a,m)}prepareLoading(t,a,r={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();sn(t)&&(t=this.languageUtils.toResolveHierarchy(t)),sn(a)&&(a=[a]);const c=this.queueLoad(t,a,r,o);if(!c.toLoad.length)return c.pending.length||o(),null;c.toLoad.forEach(f=>{this.loadOne(f)})}load(t,a,r){this.prepareLoading(t,a,{},r)}reload(t,a,r){this.prepareLoading(t,a,{reload:!0},r)}loadOne(t,a=""){const r=t.split("|"),o=r[0],c=r[1];this.read(o,c,"read",void 0,void 0,(f,m)=>{f&&this.logger.warn(`${a}loading namespace ${c} for language ${o} failed`,f),!f&&m&&this.logger.log(`${a}loaded namespace ${c} for language ${o}`,m),this.loaded(t,f,m)})}saveMissing(t,a,r,o,c,f={},m=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(a)){this.logger.warn(`did not save key "${r}" as the namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const g={...f,isUpdate:c},p=this.backend.create.bind(this.backend);if(p.length<6)try{let y;p.length===5?y=p(t,a,r,o,g):y=p(t,a,r,o),y&&typeof y.then=="function"?y.then(S=>m(null,S)).catch(m):m(null,y)}catch(y){m(y)}else p(t,a,r,o,m,g)}!t||!t[0]||this.store.addResource(t[0],a,r,o)}}}const O_=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),sn(e[1])&&(t.defaultValue=e[1]),sn(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const a=e[3]||e[2];Object.keys(a).forEach(r=>{t[r]=a[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),R_=e=>(sn(e.ns)&&(e.ns=[e.ns]),sn(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),sn(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),kS=()=>{},fB=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(a=>{typeof e[a]=="function"&&(e[a]=e[a].bind(e))})};class Nv extends US{constructor(t={},a){if(super(),this.options=R_(t),this.services={},this.logger=qs,this.modules={external:[]},fB(this),a&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,a),this;setTimeout(()=>{this.init(t,a)},0)}}init(t={},a){this.isInitializing=!0,typeof t=="function"&&(a=t,t={}),t.defaultNS==null&&t.ns&&(sn(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=O_();this.options={...r,...this.options,...R_(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?qs.init(o(this.modules.logger),this.options):qs.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=sB;const y=new x_(this.options);this.store=new v_(this.options.resources,this.options);const S=this.services;S.logger=qs,S.resourceStore=this.store,S.languageUtils=y,S.pluralResolver=new rB(y,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(S.formatter=o(p),S.formatter.init&&S.formatter.init(S,this.options),this.options.interpolation.format=S.formatter.format.bind(S.formatter)),S.interpolator=new iB(this.options),S.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},S.backendConnector=new cB(o(this.modules.backend),S.resourceStore,S,this.options),S.backendConnector.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.languageDetector&&(S.languageDetector=o(this.modules.languageDetector),S.languageDetector.init&&S.languageDetector.init(S,this.options.detection,this.options)),this.modules.i18nFormat&&(S.i18nFormat=o(this.modules.i18nFormat),S.i18nFormat.init&&S.i18nFormat.init(this)),this.translator=new IS(this.services,this.options),this.translator.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.external.forEach(T=>{T.init&&T.init(this)})}if(this.format=this.options.interpolation.format,a||(a=kS),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=(...y)=>this.store[p](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...y)=>(this.store[p](...y),this)});const m=Mv(),g=()=>{const p=(y,S)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),m.resolve(S),a(y,S)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?g():setTimeout(g,0),m}loadResources(t,a=kS){let r=a;const o=sn(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const c=[],f=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(p=>{p!=="cimode"&&c.indexOf(p)<0&&c.push(p)})};o?f(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(g=>f(g)),this.options.preload?.forEach?.(m=>f(m)),this.services.backendConnector.load(c,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(m)})}else r(null)}reloadResources(t,a,r){const o=Mv();return typeof t=="function"&&(r=t,t=void 0),typeof a=="function"&&(r=a,a=void 0),t||(t=this.languages),a||(a=this.options.ns),r||(r=kS),this.services.backendConnector.reload(t,a,c=>{o.resolve(),r(c)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&y_.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let a=0;a<this.languages.length;a++){const r=this.languages[a];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,a){this.isLanguageChangingTo=t;const r=Mv();this.emit("languageChanging",t);const o=m=>{this.language=m,this.languages=this.services.languageUtils.toResolveHierarchy(m),this.resolvedLanguage=void 0,this.setResolvedLanguage(m)},c=(m,g)=>{g?this.isLanguageChangingTo===t&&(o(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,r.resolve((...p)=>this.t(...p)),a&&a(m,(...p)=>this.t(...p))},f=m=>{!t&&!m&&this.services.languageDetector&&(m=[]);const g=sn(m)?m:m&&m[0],p=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(sn(m)?[m]:m);p&&(this.language||o(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector?.cacheUserLanguage?.(p)),this.loadResources(p,y=>{c(y,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(t),r}getFixedT(t,a,r){const o=(c,f,...m)=>{let g;typeof f!="object"?g=this.options.overloadTranslationOptionHandler([c,f].concat(m)):g={...f},g.lng=g.lng||o.lng,g.lngs=g.lngs||o.lngs,g.ns=g.ns||o.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||r||o.keyPrefix);const p=this.options.keySeparator||".";let y;return g.keyPrefix&&Array.isArray(c)?y=c.map(S=>`${g.keyPrefix}${p}${S}`):y=g.keyPrefix?`${g.keyPrefix}${p}${c}`:c,this.t(y,g)};return sn(t)?o.lng=t:o.lngs=t,o.ns=a,o.keyPrefix=r,o}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,a={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=a.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const f=(m,g)=>{const p=this.services.backendConnector.state[`${m}|${g}`];return p===-1||p===0||p===2};if(a.precheck){const m=a.precheck(this,f);if(m!==void 0)return m}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(r,t)&&(!o||f(c,t)))}loadNamespaces(t,a){const r=Mv();return this.options.ns?(sn(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),a&&a(o)}),r):(a&&a(),Promise.resolve())}loadLanguages(t,a){const r=Mv();sn(t)&&(t=[t]);const o=this.options.preload||[],c=t.filter(f=>o.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return c.length?(this.options.preload=o.concat(c),this.loadResources(f=>{r.resolve(),a&&a(f)}),r):(a&&a(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const o=new Intl.Locale(t);if(o&&o.getTextInfo){const c=o.getTextInfo();if(c&&c.direction)return c.direction}}catch{}const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new x_(O_());return t.toLowerCase().indexOf("-latn")>1?"ltr":a.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},a){return new Nv(t,a)}cloneInstance(t={},a=kS){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},c=new Nv(o);if((t.debug!==void 0||t.prefix!==void 0)&&(c.logger=c.logger.clone(t)),["store","services","language"].forEach(m=>{c[m]=this[m]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},r){const m=Object.keys(this.store.data).reduce((g,p)=>(g[p]={...this.store.data[p]},g[p]=Object.keys(g[p]).reduce((y,S)=>(y[S]={...g[p][S]},y),g[p]),g),{});c.store=new v_(m,o),c.services.resourceStore=c.store}return c.translator=new IS(c.services,o),c.translator.on("*",(m,...g)=>{c.emit(m,...g)}),c.init(o,a),c.translator.options=o,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Wr=Nv.createInstance();Wr.createInstance=Nv.createInstance,Wr.createInstance,Wr.dir,Wr.init,Wr.loadResources,Wr.reloadResources,Wr.use,Wr.changeLanguage,Wr.getFixedT,Wr.t,Wr.exists,Wr.setDefaultNamespace,Wr.hasLoadedNamespace,Wr.loadNamespaces,Wr.loadLanguages;const dB=(e,t,a,r)=>{const o=[a,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Rd(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...o):console?.warn&&console.warn(...o)},A_={},RE=(e,t,a,r)=>{Rd(a)&&A_[a]||(Rd(a)&&(A_[a]=new Date),dB(e,t,a,r))},M_=(e,t)=>()=>{if(e.isInitialized)t();else{const a=()=>{setTimeout(()=>{e.off("initialized",a)},0),t()};e.on("initialized",a)}},AE=(e,t,a)=>{e.loadNamespaces(t,M_(e,a))},__=(e,t,a,r)=>{if(Rd(a)&&(a=[a]),e.options.preload&&e.options.preload.indexOf(t)>-1)return AE(e,a,r);a.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,M_(e,r))},hB=(e,t,a={})=>!t.languages||!t.languages.length?(RE(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:a.lng,precheck:(r,o)=>{if(a.bindI18n?.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e))return!1}}),Rd=e=>typeof e=="string",mB=e=>typeof e=="object"&&e!==null,pB=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,gB={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},vB=e=>gB[e];let ME={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(pB,vB)};const yB=(e={})=>{ME={...ME,...e}},bB=()=>ME;let D_;const SB=e=>{D_=e},xB=()=>D_,CB={type:"3rdParty",init(e){yB(e.options.react),SB(e)}},EB=x.createContext();class wB{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(a=>{this.usedNamespaces[a]||(this.usedNamespaces[a]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const TB=(e,t)=>{const a=x.useRef();return x.useEffect(()=>{a.current=e},[e,t]),a.current},N_=(e,t,a,r)=>e.getFixedT(t,a,r),OB=(e,t,a,r)=>x.useCallback(N_(e,t,a,r),[e,t,a,r]),RB=(e,t={})=>{const{i18n:a}=t,{i18n:r,defaultNS:o}=x.useContext(EB)||{},c=a||r||xB();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new wB),!c){RE(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const V=(L,B)=>Rd(B)?B:mB(B)&&Rd(B.defaultValue)?B.defaultValue:Array.isArray(L)?L[L.length-1]:L,N=[V,{},!1];return N.t=V,N.i18n={},N.ready=!1,N}c.options.react?.wait&&RE(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const f={...bB(),...c.options.react,...t},{useSuspense:m,keyPrefix:g}=f;let p=o||c.options?.defaultNS;p=Rd(p)?[p]:p||["translation"],c.reportNamespaces.addUsedNamespaces?.(p);const y=(c.isInitialized||c.initializedStoreOnce)&&p.every(V=>hB(V,c,f)),S=OB(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),E=()=>S,T=()=>N_(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),[O,M]=x.useState(E);let A=p.join();t.lng&&(A=`${t.lng}${A}`);const D=TB(A),_=x.useRef(!0);x.useEffect(()=>{const{bindI18n:V,bindI18nStore:N}=f;_.current=!0,!y&&!m&&(t.lng?__(c,t.lng,p,()=>{_.current&&M(T)}):AE(c,p,()=>{_.current&&M(T)})),y&&D&&D!==A&&_.current&&M(T);const L=()=>{_.current&&M(T)};return V&&c?.on(V,L),N&&c?.store.on(N,L),()=>{_.current=!1,c&&V?.split(" ").forEach(B=>c.off(B,L)),N&&c&&N.split(" ").forEach(B=>c.store.off(B,L))}},[c,A]),x.useEffect(()=>{_.current&&y&&M(E)},[c,g,y]);const j=[O,c,y];if(j.t=O,j.i18n=c,j.ready=y,y||!y&&!m)return j;throw new Promise(V=>{t.lng?__(c,t.lng,p,()=>V()):AE(c,p,()=>V())})},AB={en:{translation:{welcome:"Hi there, you’re speaking with Jaweb AI Assistant."}},ar:{translation:{welcome:"مرحبًا، أنت تتحدث إلى مساعد Jaweb AI."}}};Wr.use(CB).init({resources:AB,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const MB=3,_B=3e3,DB=()=>{const[e,t]=x.useState(!0),[a,r]=x.useState(!1),[o,c]=x.useState(""),[f,m]=x.useState(""),[g,p]=x.useState(!1),[y,S]=x.useState(!1),[E,T]=x.useState(""),[O,M]=x.useState(""),[A,D]=x.useState(null),[_,j]=x.useState(""),[V,N]=x.useState([]),[L,B]=x.useState([]),[z,U]=x.useState(""),[H,te]=x.useState(!1),Y=async(Z=0)=>{const W=localStorage.getItem("company_username");console.log(W),t(!0);const ie={headers:{"Content-Type":"application/json",Accept:"application/json"},params:{username:W}};try{const F=(await $a.get(`${bi.apiUrl}chatbot-details/`,ie)).data.data;F.language==="Arabic"?Wr.changeLanguage("ar"):Wr.changeLanguage("en"),r(F.chatbot_form),c(F.chatbot_color),m(F.chatbot_logo),p(F.disable_chatbot_globally),S(F.remove_powered_by_jaweb),T(F.chatbot_initial_msg),M(F.status),U(F.mode),D(F.calendly_link??null),te(F.disable_checkout),console.log(F),F.calendly_link&&D(F.calendly_link),F.phone_number_id&&j(`+${F.phone_number_id}`);const Q=await $a.get(`${bi.apiUrl}chatbot-plugin-suggestions/`,ie);let se=[];Array.isArray(Q.data.data)?se=Q.data.data:Array.isArray(Q.data.user_questions)&&(se=Q.data.user_questions),se.length>0?(N(se.slice(0,3)),B(se.slice(3))):(N([]),B([])),t(!1)}catch(G){console.error("Error fetching data:",G),Z<MB?setTimeout(()=>Y(Z+1),_B):console.error("Max retries reached. Could not fetch data.")}};return x.useEffect(()=>{Y()},[]),{isFetchingDetails:e,disableForm:a,colorCode:o,chatbotLogo:f,disableChatbotGlobally:g,removePoweredByJaweb:y,initialMessageText:E,subscription:O,calendly:A,merchantPhone:_,messagesSuggestions:V,restSuggestions:L,userType:z,disbleCheckout:H}};var _E={exports:{}};/*!
324
+ `+c):r.stack=c}catch{}}throw r}}_request(t,a){typeof t=="string"?(a=a||{},a.url=t):a=t||{},a=Td(this.defaults,a);const{transitional:r,paramsSerializer:o,headers:c}=a;r!==void 0&&BS.assertOptions(r,{silentJSONParsing:Fs.transitional(Fs.boolean),forcedJSONParsing:Fs.transitional(Fs.boolean),clarifyTimeoutError:Fs.transitional(Fs.boolean)},!1),o!=null&&(Xe.isFunction(o)?a.paramsSerializer={serialize:o}:BS.assertOptions(o,{encode:Fs.function,serialize:Fs.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),BS.assertOptions(a,{baseUrl:Fs.spelling("baseURL"),withXsrfToken:Fs.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let f=c&&Xe.merge(c.common,c[a.method]);c&&Xe.forEach(["delete","get","head","post","put","patch","common"],O=>{delete c[O]}),a.headers=go.concat(f,c);const m=[];let g=!0;this.interceptors.request.forEach(function(M){typeof M.runWhen=="function"&&M.runWhen(a)===!1||(g=g&&M.synchronous,m.unshift(M.fulfilled,M.rejected))});const p=[];this.interceptors.response.forEach(function(M){p.push(M.fulfilled,M.rejected)});let y,S=0,E;if(!g){const O=[s_.bind(this),void 0];for(O.unshift.apply(O,m),O.push.apply(O,p),E=O.length,y=Promise.resolve(a);S<E;)y=y.then(O[S++],O[S++]);return y}E=m.length;let T=a;for(S=0;S<E;){const O=m[S++],M=m[S++];try{T=O(T)}catch(A){M.call(this,A);break}}try{y=s_.call(this,T)}catch(O){return Promise.reject(O)}for(S=0,E=p.length;S<E;)y=y.then(p[S++],p[S++]);return y}getUri(t){t=Td(this.defaults,t);const a=JM(t.baseURL,t.url,t.allowAbsoluteUrls);return FM(a,t.params,t.paramsSerializer)}};Xe.forEach(["delete","get","head","options"],function(t){Od.prototype[t]=function(a,r){return this.request(Td(r||{},{method:t,url:a,data:(r||{}).data}))}}),Xe.forEach(["post","put","patch"],function(t){function a(r){return function(c,f,m){return this.request(Td(m||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:c,data:f}))}}Od.prototype[t]=a(),Od.prototype[t+"Form"]=a(!0)});let FV=class u8{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(c){a=c});const r=this;this.promise.then(o=>{if(!r._listeners)return;let c=r._listeners.length;for(;c-- >0;)r._listeners[c](o);r._listeners=null}),this.promise.then=o=>{let c;const f=new Promise(m=>{r.subscribe(m),c=m}).then(o);return f.cancel=function(){r.unsubscribe(c)},f},t(function(c,f,m){r.reason||(r.reason=new bm(c,f,m),a(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const a=this._listeners.indexOf(t);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const t=new AbortController,a=r=>{t.abort(r)};return this.subscribe(a),t.signal.unsubscribe=()=>this.unsubscribe(a),t.signal}static source(){let t;return{token:new u8(function(o){t=o}),cancel:t}}};function qV(e){return function(a){return e.apply(null,a)}}function GV(e){return Xe.isObject(e)&&e.isAxiosError===!0}const wE={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};Object.entries(wE).forEach(([e,t])=>{wE[t]=e});function f_(e){const t=new Od(e),a=MM(Od.prototype.request,t);return Xe.extend(a,Od.prototype,t,{allOwnKeys:!0}),Xe.extend(a,t,null,{allOwnKeys:!0}),a.create=function(o){return f_(Td(e,o))},a}const $a=f_(Rv);$a.Axios=Od,$a.CanceledError=bm,$a.CancelToken=FV,$a.isCancel=WM,$a.VERSION=u_,$a.toFormData=NS,$a.AxiosError=Cn,$a.Cancel=$a.CanceledError,$a.all=function(t){return Promise.all(t)},$a.spread=qV,$a.isAxiosError=GV,$a.mergeConfig=Td,$a.AxiosHeaders=go,$a.formToJSON=e=>XM(Xe.isHTMLForm(e)?new FormData(e):e),$a.getAdapter=l_.getAdapter,$a.HttpStatusCode=wE,$a.default=$a;const{Axios:Uie,AxiosError:Iie,CanceledError:kie,isCancel:Fie,CancelToken:qie,VERSION:Gie,all:Xie,Cancel:Yie,isAxiosError:Wie,spread:Zie,toFormData:Kie,AxiosHeaders:Qie,HttpStatusCode:Jie,formToJSON:eoe,getAdapter:toe,mergeConfig:noe}=$a,bi={apiUrl:"https://jawebcrm.onrender.com/api/",websocketUrl:"wss://jawebcrm.onrender.com/ws"},sn=e=>typeof e=="string",Mv=()=>{let e,t;const a=new Promise((r,o)=>{e=r,t=o});return a.resolve=e,a.reject=t,a},d_=e=>e==null?"":""+e,XV=(e,t,a)=>{e.forEach(r=>{t[r]&&(a[r]=t[r])})},YV=/###/g,h_=e=>e&&e.indexOf("###")>-1?e.replace(YV,"."):e,m_=e=>!e||sn(e),_v=(e,t,a)=>{const r=sn(t)?t.split("."):t;let o=0;for(;o<r.length-1;){if(m_(e))return{};const c=h_(r[o]);!e[c]&&a&&(e[c]=new a),Object.prototype.hasOwnProperty.call(e,c)?e=e[c]:e={},++o}return m_(e)?{}:{obj:e,k:h_(r[o])}},p_=(e,t,a)=>{const{obj:r,k:o}=_v(e,t,Object);if(r!==void 0||t.length===1){r[o]=a;return}let c=t[t.length-1],f=t.slice(0,t.length-1),m=_v(e,f,Object);for(;m.obj===void 0&&f.length;)c=`${f[f.length-1]}.${c}`,f=f.slice(0,f.length-1),m=_v(e,f,Object),m?.obj&&typeof m.obj[`${m.k}.${c}`]<"u"&&(m.obj=void 0);m.obj[`${m.k}.${c}`]=a},WV=(e,t,a,r)=>{const{obj:o,k:c}=_v(e,t,Object);o[c]=o[c]||[],o[c].push(a)},HS=(e,t)=>{const{obj:a,k:r}=_v(e,t);if(a&&Object.prototype.hasOwnProperty.call(a,r))return a[r]},ZV=(e,t,a)=>{const r=HS(e,a);return r!==void 0?r:HS(t,a)},g_=(e,t,a)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?sn(e[r])||e[r]instanceof String||sn(t[r])||t[r]instanceof String?a&&(e[r]=t[r]):g_(e[r],t[r],a):e[r]=t[r]);return e},Sm=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var KV={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const QV=e=>sn(e)?e.replace(/[&<>"'\/]/g,t=>KV[t]):e;class JV{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const a=this.regExpMap.get(t);if(a!==void 0)return a;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const eB=[" ",",","?","!",";"],tB=new JV(20),nB=(e,t,a)=>{t=t||"",a=a||"";const r=eB.filter(f=>t.indexOf(f)<0&&a.indexOf(f)<0);if(r.length===0)return!0;const o=tB.getRegExp(`(${r.map(f=>f==="?"?"\\?":f).join("|")})`);let c=!o.test(e);if(!c){const f=e.indexOf(a);f>0&&!o.test(e.substring(0,f))&&(c=!0)}return c},TE=(e,t,a=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(a);let o=e;for(let c=0;c<r.length;){if(!o||typeof o!="object")return;let f,m="";for(let g=c;g<r.length;++g)if(g!==c&&(m+=a),m+=r[g],f=o[m],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&g<r.length-1)continue;c+=g-c+1;break}o=f}return o},Dv=e=>e?.replace("_","-"),aB={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class PS{constructor(t,a={}){this.init(t,a)}init(t,a={}){this.prefix=a.prefix||"i18next:",this.logger=t||aB,this.options=a,this.debug=a.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,a,r,o){return o&&!this.debug?null:(sn(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[a](t))}create(t){return new PS(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new PS(this.logger,t)}}var qs=new PS;class US{constructor(){this.observers={}}on(t,a){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const o=this.observers[r].get(a)||0;this.observers[r].set(a,o+1)}),this}off(t,a){if(this.observers[t]){if(!a){delete this.observers[t];return}this.observers[t].delete(a)}}emit(t,...a){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o(...a)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o.apply(o,[t,...a])})}}class v_ extends US{constructor(t,a={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const a=this.options.ns.indexOf(t);a>-1&&this.options.ns.splice(a,1)}getResource(t,a,r,o={}){const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,f=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let m;t.indexOf(".")>-1?m=t.split("."):(m=[t,a],r&&(Array.isArray(r)?m.push(...r):sn(r)&&c?m.push(...r.split(c)):m.push(r)));const g=HS(this.data,m);return!g&&!a&&!r&&t.indexOf(".")>-1&&(t=m[0],a=m[1],r=m.slice(2).join(".")),g||!f||!sn(r)?g:TE(this.data?.[t]?.[a],r,c)}addResource(t,a,r,o,c={silent:!1}){const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let m=[t,a];r&&(m=m.concat(f?r.split(f):r)),t.indexOf(".")>-1&&(m=t.split("."),o=a,a=m[1]),this.addNamespaces(a),p_(this.data,m,o),c.silent||this.emit("added",t,a,r,o)}addResources(t,a,r,o={silent:!1}){for(const c in r)(sn(r[c])||Array.isArray(r[c]))&&this.addResource(t,a,c,r[c],{silent:!0});o.silent||this.emit("added",t,a,r)}addResourceBundle(t,a,r,o,c,f={silent:!1,skipCopy:!1}){let m=[t,a];t.indexOf(".")>-1&&(m=t.split("."),o=r,r=a,a=m[1]),this.addNamespaces(a);let g=HS(this.data,m)||{};f.skipCopy||(r=JSON.parse(JSON.stringify(r))),o?g_(g,r,c):g={...g,...r},p_(this.data,m,g),f.silent||this.emit("added",t,a,r)}removeResourceBundle(t,a){this.hasResourceBundle(t,a)&&delete this.data[t][a],this.removeNamespaces(a),this.emit("removed",t,a)}hasResourceBundle(t,a){return this.getResource(t,a)!==void 0}getResourceBundle(t,a){return a||(a=this.options.defaultNS),this.getResource(t,a)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const a=this.getDataByLanguage(t);return!!(a&&Object.keys(a)||[]).find(o=>a[o]&&Object.keys(a[o]).length>0)}toJSON(){return this.data}}var y_={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,r,o){return e.forEach(c=>{t=this.processors[c]?.process(t,a,r,o)??t}),t}};const b_={},S_=e=>!sn(e)&&typeof e!="boolean"&&typeof e!="number";class IS extends US{constructor(t,a={}){super(),XV(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=qs.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,a={interpolation:{}}){const r={...a};return t==null?!1:this.resolve(t,r)?.res!==void 0}extractFromKey(t,a){let r=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let c=a.ns||this.options.defaultNS||[];const f=r&&t.indexOf(r)>-1,m=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!nB(t,r,o);if(f&&!m){const g=t.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:t,namespaces:sn(c)?[c]:c};const p=t.split(r);(r!==o||r===o&&this.options.ns.indexOf(p[0])>-1)&&(c=p.shift()),t=p.join(o)}return{key:t,namespaces:sn(c)?[c]:c}}translate(t,a,r){let o=typeof a=="object"?{...a}:a;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof options=="object"&&(o={...o}),o||(o={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const c=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,f=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:m,namespaces:g}=this.extractFromKey(t[t.length-1],o),p=g[g.length-1];let y=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const S=o.lng||this.language,E=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(S?.toLowerCase()==="cimode")return E?c?{res:`${p}${y}${m}`,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:`${p}${y}${m}`:c?{res:m,usedKey:m,exactUsedKey:m,usedLng:S,usedNS:p,usedParams:this.getUsedParamsDetails(o)}:m;const T=this.resolve(t,o);let O=T?.res;const M=T?.usedKey||m,A=T?.exactUsedKey||m,D=["[object Number]","[object Function]","[object RegExp]"],_=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,V=o.count!==void 0&&!sn(o.count),N=IS.hasDefaultValue(o),L=V?this.pluralResolver.getSuffix(S,o.count,o):"",B=o.ordinal&&V?this.pluralResolver.getSuffix(S,o.count,{ordinal:!1}):"",z=V&&!o.ordinal&&o.count===0,U=z&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${L}`]||o[`defaultValue${B}`]||o.defaultValue;let H=O;j&&!O&&N&&(H=U);const te=S_(H),Y=Object.prototype.toString.apply(H);if(j&&H&&te&&D.indexOf(Y)<0&&!(sn(_)&&Array.isArray(H))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Z=this.options.returnedObjectHandler?this.options.returnedObjectHandler(M,H,{...o,ns:g}):`key '${m} (${this.language})' returned an object instead of string.`;return c?(T.res=Z,T.usedParams=this.getUsedParamsDetails(o),T):Z}if(f){const Z=Array.isArray(H),W=Z?[]:{},ie=Z?A:M;for(const G in H)if(Object.prototype.hasOwnProperty.call(H,G)){const F=`${ie}${f}${G}`;N&&!O?W[G]=this.translate(F,{...o,defaultValue:S_(U)?U[G]:void 0,joinArrays:!1,ns:g}):W[G]=this.translate(F,{...o,joinArrays:!1,ns:g}),W[G]===F&&(W[G]=H[G])}O=W}}else if(j&&sn(_)&&Array.isArray(O))O=O.join(_),O&&(O=this.extendTranslation(O,t,o,r));else{let Z=!1,W=!1;!this.isValidLookup(O)&&N&&(Z=!0,O=U),this.isValidLookup(O)||(W=!0,O=m);const G=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&W?void 0:O,F=N&&U!==O&&this.options.updateMissing;if(W||Z||F){if(this.logger.log(F?"updateKey":"missingKey",S,p,m,F?U:O),f){const q=this.resolve(m,{...o,keySeparator:!1});q&&q.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let Q=[];const se=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&se&&se[0])for(let q=0;q<se.length;q++)Q.push(se[q]);else this.options.saveMissingTo==="all"?Q=this.languageUtils.toResolveHierarchy(o.lng||this.language):Q.push(o.lng||this.language);const k=(q,J,ne)=>{const oe=N&&ne!==O?ne:G;this.options.missingKeyHandler?this.options.missingKeyHandler(q,p,J,oe,F,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(q,p,J,oe,F,o),this.emit("missingKey",q,p,J,O)};this.options.saveMissing&&(this.options.saveMissingPlurals&&V?Q.forEach(q=>{const J=this.pluralResolver.getSuffixes(q,o);z&&o[`defaultValue${this.options.pluralSeparator}zero`]&&J.indexOf(`${this.options.pluralSeparator}zero`)<0&&J.push(`${this.options.pluralSeparator}zero`),J.forEach(ne=>{k([q],m+ne,o[`defaultValue${ne}`]||U)})}):k(Q,m,U))}O=this.extendTranslation(O,t,o,T,r),W&&O===m&&this.options.appendNamespaceToMissingKey&&(O=`${p}${y}${m}`),(W||Z)&&this.options.parseMissingKeyHandler&&(O=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${p}${y}${m}`:m,Z?O:void 0,o))}return c?(T.res=O,T.usedParams=this.getUsedParamsDetails(o),T):O}extendTranslation(t,a,r,o,c){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const g=sn(t)&&(r?.interpolation?.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(g){const S=t.match(this.interpolator.nestingRegexp);p=S&&S.length}let y=r.replace&&!sn(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(y={...this.options.interpolation.defaultVariables,...y}),t=this.interpolator.interpolate(t,y,r.lng||this.language||o.usedLng,r),g){const S=t.match(this.interpolator.nestingRegexp),E=S&&S.length;p<E&&(r.nest=!1)}!r.lng&&o&&o.res&&(r.lng=this.language||o.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...S)=>c?.[0]===S[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${S[0]} in key: ${a[0]}`),null):this.translate(...S,a),r)),r.interpolation&&this.interpolator.reset()}const f=r.postProcess||this.options.postProcess,m=sn(f)?[f]:f;return t!=null&&m?.length&&r.applyPostProcessor!==!1&&(t=y_.handle(m,t,a,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,a={}){let r,o,c,f,m;return sn(t)&&(t=[t]),t.forEach(g=>{if(this.isValidLookup(r))return;const p=this.extractFromKey(g,a),y=p.key;o=y;let S=p.namespaces;this.options.fallbackNS&&(S=S.concat(this.options.fallbackNS));const E=a.count!==void 0&&!sn(a.count),T=E&&!a.ordinal&&a.count===0,O=a.context!==void 0&&(sn(a.context)||typeof a.context=="number")&&a.context!=="",M=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);S.forEach(A=>{this.isValidLookup(r)||(m=A,!b_[`${M[0]}-${A}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(m)&&(b_[`${M[0]}-${A}`]=!0,this.logger.warn(`key "${o}" for languages "${M.join(", ")}" won't get resolved as namespace "${m}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),M.forEach(D=>{if(this.isValidLookup(r))return;f=D;const _=[y];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(_,y,D,A,a);else{let V;E&&(V=this.pluralResolver.getSuffix(D,a.count,a));const N=`${this.options.pluralSeparator}zero`,L=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(E&&(_.push(y+V),a.ordinal&&V.indexOf(L)===0&&_.push(y+V.replace(L,this.options.pluralSeparator)),T&&_.push(y+N)),O){const B=`${y}${this.options.contextSeparator}${a.context}`;_.push(B),E&&(_.push(B+V),a.ordinal&&V.indexOf(L)===0&&_.push(B+V.replace(L,this.options.pluralSeparator)),T&&_.push(B+N))}}let j;for(;j=_.pop();)this.isValidLookup(r)||(c=j,r=this.getResource(D,A,j,a))}))})}),{res:r,usedKey:o,exactUsedKey:c,usedLng:f,usedNS:m}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,a,r,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,a,r,o):this.resourceStore.getResource(t,a,r,o)}getUsedParamsDetails(t={}){const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!sn(t.replace);let o=r?t.replace:t;if(r&&typeof t.count<"u"&&(o.count=t.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!r){o={...o};for(const c of a)delete o[c]}return o}static hasDefaultValue(t){const a="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&a===r.substring(0,a.length)&&t[r]!==void 0)return!0;return!1}}class x_{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=qs.create("languageUtils")}getScriptPartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return null;const a=t.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(t){if(t=Dv(t),!t||t.indexOf("-")<0)return t;const a=t.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(t){if(sn(t)&&t.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(t)[0]}catch{}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let a;return t.forEach(r=>{if(a)return;const o=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(o))&&(a=o)}),!a&&this.options.supportedLngs&&t.forEach(r=>{if(a)return;const o=this.getScriptPartFromCode(r);if(this.isSupportedCode(o))return a=o;const c=this.getLanguagePartFromCode(r);if(this.isSupportedCode(c))return a=c;a=this.options.supportedLngs.find(f=>{if(f===c)return f;if(!(f.indexOf("-")<0&&c.indexOf("-")<0)&&(f.indexOf("-")>0&&c.indexOf("-")<0&&f.substring(0,f.indexOf("-"))===c||f.indexOf(c)===0&&c.length>1))return f})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(t,a){if(!t)return[];if(typeof t=="function"&&(t=t(a)),sn(t)&&(t=[t]),Array.isArray(t))return t;if(!a)return t.default||[];let r=t[a];return r||(r=t[this.getScriptPartFromCode(a)]),r||(r=t[this.formatLanguageCode(a)]),r||(r=t[this.getLanguagePartFromCode(a)]),r||(r=t.default),r||[]}toResolveHierarchy(t,a){const r=this.getFallbackCodes((a===!1?[]:a)||this.options.fallbackLng||[],t),o=[],c=f=>{f&&(this.isSupportedCode(f)?o.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return sn(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(t))):sn(t)&&c(this.formatLanguageCode(t)),r.forEach(f=>{o.indexOf(f)<0&&c(this.formatLanguageCode(f))}),o}}const C_={zero:0,one:1,two:2,few:3,many:4,other:5},E_={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class rB{constructor(t,a={}){this.languageUtils=t,this.options=a,this.logger=qs.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,a){this.rules[t]=a}clearCache(){this.pluralRulesCache={}}getRule(t,a={}){const r=Dv(t==="dev"?"en":t),o=a.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:r,type:o});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let f;try{f=new Intl.PluralRules(r,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),E_;if(!t.match(/-|_/))return E_;const g=this.languageUtils.getLanguagePartFromCode(t);f=this.getRule(g,a)}return this.pluralRulesCache[c]=f,f}needsPlural(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,a,r={}){return this.getSuffixes(t,r).map(o=>`${a}${o}`)}getSuffixes(t,a={}){let r=this.getRule(t,a);return r||(r=this.getRule("dev",a)),r?r.resolvedOptions().pluralCategories.sort((o,c)=>C_[o]-C_[c]).map(o=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(t,a,r={}){const o=this.getRule(t,r);return o?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o.select(a)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",a,r))}}const w_=(e,t,a,r=".",o=!0)=>{let c=ZV(e,t,a);return!c&&o&&sn(a)&&(c=TE(e,a,r),c===void 0&&(c=TE(t,a,r))),c},OE=e=>e.replace(/\$/g,"$$$$");class iB{constructor(t={}){this.logger=qs.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(a=>a),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:a,escapeValue:r,useRawValueToEscape:o,prefix:c,prefixEscaped:f,suffix:m,suffixEscaped:g,formatSeparator:p,unescapeSuffix:y,unescapePrefix:S,nestingPrefix:E,nestingPrefixEscaped:T,nestingSuffix:O,nestingSuffixEscaped:M,nestingOptionsSeparator:A,maxReplaces:D,alwaysFormat:_}=t.interpolation;this.escape=a!==void 0?a:QV,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=c?Sm(c):f||"{{",this.suffix=m?Sm(m):g||"}}",this.formatSeparator=p||",",this.unescapePrefix=y?"":S||"-",this.unescapeSuffix=this.unescapePrefix?"":y||"",this.nestingPrefix=E?Sm(E):T||Sm("$t("),this.nestingSuffix=O?Sm(O):M||Sm(")"),this.nestingOptionsSeparator=A||",",this.maxReplaces=D||1e3,this.alwaysFormat=_!==void 0?_:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(a,r)=>a?.source===r?(a.lastIndex=0,a):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,a,r,o){let c,f,m;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=T=>{if(T.indexOf(this.formatSeparator)<0){const D=w_(a,g,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(D,void 0,r,{...o,...a,interpolationkey:T}):D}const O=T.split(this.formatSeparator),M=O.shift().trim(),A=O.join(this.formatSeparator).trim();return this.format(w_(a,g,M,this.options.keySeparator,this.options.ignoreJSONStructure),A,r,{...o,...a,interpolationkey:M})};this.resetRegExp();const y=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,S=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>OE(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?OE(this.escape(T)):OE(T)}].forEach(T=>{for(m=0;c=T.regex.exec(t);){const O=c[1].trim();if(f=p(O),f===void 0)if(typeof y=="function"){const A=y(t,c,o);f=sn(A)?A:""}else if(o&&Object.prototype.hasOwnProperty.call(o,O))f="";else if(S){f=c[0];continue}else this.logger.warn(`missed to pass in variable ${O} for interpolating ${t}`),f="";else!sn(f)&&!this.useRawValueToEscape&&(f=d_(f));const M=T.safeValue(f);if(t=t.replace(c[0],M),S?(T.regex.lastIndex+=f.length,T.regex.lastIndex-=c[0].length):T.regex.lastIndex=0,m++,m>=this.maxReplaces)break}}),t}nest(t,a,r={}){let o,c,f;const m=(g,p)=>{const y=this.nestingOptionsSeparator;if(g.indexOf(y)<0)return g;const S=g.split(new RegExp(`${y}[ ]*{`));let E=`{${S[1]}`;g=S[0],E=this.interpolate(E,f);const T=E.match(/'/g),O=E.match(/"/g);((T?.length??0)%2===0&&!O||O.length%2!==0)&&(E=E.replace(/'/g,'"'));try{f=JSON.parse(E),p&&(f={...p,...f})}catch(M){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,M),`${g}${y}${E}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,g};for(;o=this.nestingRegexp.exec(t);){let g=[];f={...r},f=f.replace&&!sn(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;const p=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(p!==-1&&(g=o[1].slice(p).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),o[1]=o[1].slice(0,p)),c=a(m.call(this,o[1].trim(),f),f),c&&o[0]===t&&!sn(c))return c;sn(c)||(c=d_(c)),c||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${t}`),c=""),g.length&&(c=g.reduce((y,S)=>this.format(y,S,r.lng,{...r,interpolationkey:o[1].trim()}),c.trim())),t=t.replace(o[0],c),this.regexp.lastIndex=0}return t}}const oB=e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const o=r[1].substring(0,r[1].length-1);t==="currency"&&o.indexOf(":")<0?a.currency||(a.currency=o.trim()):t==="relativetime"&&o.indexOf(":")<0?a.range||(a.range=o.trim()):o.split(";").forEach(f=>{if(f){const[m,...g]=f.split(":"),p=g.join(":").trim().replace(/^'+|'+$/g,""),y=m.trim();a[y]||(a[y]=p),p==="false"&&(a[y]=!1),p==="true"&&(a[y]=!0),isNaN(p)||(a[y]=parseInt(p,10))}})}return{formatName:t,formatOptions:a}},T_=e=>{const t={};return(a,r,o)=>{let c=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(c={...c,[o.interpolationkey]:void 0});const f=r+JSON.stringify(c);let m=t[f];return m||(m=e(Dv(r),o),t[f]=m),m(a)}},lB=e=>(t,a,r)=>e(Dv(a),r)(t);class sB{constructor(t={}){this.logger=qs.create("formatter"),this.options=t,this.init(t)}init(t,a={interpolation:{}}){this.formatSeparator=a.interpolation.formatSeparator||",";const r=a.cacheInBuiltFormats?T_:lB;this.formats={number:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c});return m=>f.format(m)}),currency:r((o,c)=>{const f=new Intl.NumberFormat(o,{...c,style:"currency"});return m=>f.format(m)}),datetime:r((o,c)=>{const f=new Intl.DateTimeFormat(o,{...c});return m=>f.format(m)}),relativetime:r((o,c)=>{const f=new Intl.RelativeTimeFormat(o,{...c});return m=>f.format(m,c.range||"day")}),list:r((o,c)=>{const f=new Intl.ListFormat(o,{...c});return m=>f.format(m)})}}add(t,a){this.formats[t.toLowerCase().trim()]=a}addCached(t,a){this.formats[t.toLowerCase().trim()]=T_(a)}format(t,a,r,o={}){const c=a.split(this.formatSeparator);if(c.length>1&&c[0].indexOf("(")>1&&c[0].indexOf(")")<0&&c.find(m=>m.indexOf(")")>-1)){const m=c.findIndex(g=>g.indexOf(")")>-1);c[0]=[c[0],...c.splice(1,m)].join(this.formatSeparator)}return c.reduce((m,g)=>{const{formatName:p,formatOptions:y}=oB(g);if(this.formats[p]){let S=m;try{const E=o?.formatParams?.[o.interpolationkey]||{},T=E.locale||E.lng||o.locale||o.lng||r;S=this.formats[p](m,T,{...y,...o,...E})}catch(E){this.logger.warn(E)}return S}else this.logger.warn(`there was no format function for ${p}`);return m},t)}}const uB=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class cB extends US{constructor(t,a,r,o={}){super(),this.backend=t,this.store=a,this.services=r,this.languageUtils=r.languageUtils,this.options=o,this.logger=qs.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,o.backend,o)}queueLoad(t,a,r,o){const c={},f={},m={},g={};return t.forEach(p=>{let y=!0;a.forEach(S=>{const E=`${p}|${S}`;!r.reload&&this.store.hasResourceBundle(p,S)?this.state[E]=2:this.state[E]<0||(this.state[E]===1?f[E]===void 0&&(f[E]=!0):(this.state[E]=1,y=!1,f[E]===void 0&&(f[E]=!0),c[E]===void 0&&(c[E]=!0),g[S]===void 0&&(g[S]=!0)))}),y||(m[p]=!0)}),(Object.keys(c).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(c),pending:Object.keys(f),toLoadLanguages:Object.keys(m),toLoadNamespaces:Object.keys(g)}}loaded(t,a,r){const o=t.split("|"),c=o[0],f=o[1];a&&this.emit("failedLoading",c,f,a),!a&&r&&this.store.addResourceBundle(c,f,r,void 0,void 0,{skipCopy:!0}),this.state[t]=a?-1:2,a&&r&&(this.state[t]=0);const m={};this.queue.forEach(g=>{WV(g.loaded,[c],f),uB(g,t),a&&g.errors.push(a),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(p=>{m[p]||(m[p]={});const y=g.loaded[p];y.length&&y.forEach(S=>{m[p][S]===void 0&&(m[p][S]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",m),this.queue=this.queue.filter(g=>!g.done)}read(t,a,r,o=0,c=this.retryTimeout,f){if(!t.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:a,fcName:r,tried:o,wait:c,callback:f});return}this.readingCalls++;const m=(p,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const S=this.waitingReads.shift();this.read(S.lng,S.ns,S.fcName,S.tried,S.wait,S.callback)}if(p&&y&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,t,a,r,o+1,c*2,f)},c);return}f(p,y)},g=this.backend[r].bind(this.backend);if(g.length===2){try{const p=g(t,a);p&&typeof p.then=="function"?p.then(y=>m(null,y)).catch(m):m(null,p)}catch(p){m(p)}return}return g(t,a,m)}prepareLoading(t,a,r={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();sn(t)&&(t=this.languageUtils.toResolveHierarchy(t)),sn(a)&&(a=[a]);const c=this.queueLoad(t,a,r,o);if(!c.toLoad.length)return c.pending.length||o(),null;c.toLoad.forEach(f=>{this.loadOne(f)})}load(t,a,r){this.prepareLoading(t,a,{},r)}reload(t,a,r){this.prepareLoading(t,a,{reload:!0},r)}loadOne(t,a=""){const r=t.split("|"),o=r[0],c=r[1];this.read(o,c,"read",void 0,void 0,(f,m)=>{f&&this.logger.warn(`${a}loading namespace ${c} for language ${o} failed`,f),!f&&m&&this.logger.log(`${a}loaded namespace ${c} for language ${o}`,m),this.loaded(t,f,m)})}saveMissing(t,a,r,o,c,f={},m=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(a)){this.logger.warn(`did not save key "${r}" as the namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend?.create){const g={...f,isUpdate:c},p=this.backend.create.bind(this.backend);if(p.length<6)try{let y;p.length===5?y=p(t,a,r,o,g):y=p(t,a,r,o),y&&typeof y.then=="function"?y.then(S=>m(null,S)).catch(m):m(null,y)}catch(y){m(y)}else p(t,a,r,o,m,g)}!t||!t[0]||this.store.addResource(t[0],a,r,o)}}}const O_=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),sn(e[1])&&(t.defaultValue=e[1]),sn(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const a=e[3]||e[2];Object.keys(a).forEach(r=>{t[r]=a[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),R_=e=>(sn(e.ns)&&(e.ns=[e.ns]),sn(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),sn(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e),kS=()=>{},fB=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(a=>{typeof e[a]=="function"&&(e[a]=e[a].bind(e))})};class Nv extends US{constructor(t={},a){if(super(),this.options=R_(t),this.services={},this.logger=qs,this.modules={external:[]},fB(this),a&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,a),this;setTimeout(()=>{this.init(t,a)},0)}}init(t={},a){this.isInitializing=!0,typeof t=="function"&&(a=t,t={}),t.defaultNS==null&&t.ns&&(sn(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=O_();this.options={...r,...this.options,...R_(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const o=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?qs.init(o(this.modules.logger),this.options):qs.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:p=sB;const y=new x_(this.options);this.store=new v_(this.options.resources,this.options);const S=this.services;S.logger=qs,S.resourceStore=this.store,S.languageUtils=y,S.pluralResolver=new rB(y,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.warn("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),p&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(S.formatter=o(p),S.formatter.init&&S.formatter.init(S,this.options),this.options.interpolation.format=S.formatter.format.bind(S.formatter)),S.interpolator=new iB(this.options),S.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},S.backendConnector=new cB(o(this.modules.backend),S.resourceStore,S,this.options),S.backendConnector.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.languageDetector&&(S.languageDetector=o(this.modules.languageDetector),S.languageDetector.init&&S.languageDetector.init(S,this.options.detection,this.options)),this.modules.i18nFormat&&(S.i18nFormat=o(this.modules.i18nFormat),S.i18nFormat.init&&S.i18nFormat.init(this)),this.translator=new IS(this.services,this.options),this.translator.on("*",(T,...O)=>{this.emit(T,...O)}),this.modules.external.forEach(T=>{T.init&&T.init(this)})}if(this.format=this.options.interpolation.format,a||(a=kS),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=(...y)=>this.store[p](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=(...y)=>(this.store[p](...y),this)});const m=Mv(),g=()=>{const p=(y,S)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),m.resolve(S),a(y,S)};if(this.languages&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initAsync?g():setTimeout(g,0),m}loadResources(t,a=kS){let r=a;const o=sn(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const c=[],f=m=>{if(!m||m==="cimode")return;this.services.languageUtils.toResolveHierarchy(m).forEach(p=>{p!=="cimode"&&c.indexOf(p)<0&&c.push(p)})};o?f(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(g=>f(g)),this.options.preload?.forEach?.(m=>f(m)),this.services.backendConnector.load(c,this.options.ns,m=>{!m&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(m)})}else r(null)}reloadResources(t,a,r){const o=Mv();return typeof t=="function"&&(r=t,t=void 0),typeof a=="function"&&(r=a,a=void 0),t||(t=this.languages),a||(a=this.options.ns),r||(r=kS),this.services.backendConnector.reload(t,a,c=>{o.resolve(),r(c)}),o}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&y_.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let a=0;a<this.languages.length;a++){const r=this.languages[a];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,a){this.isLanguageChangingTo=t;const r=Mv();this.emit("languageChanging",t);const o=m=>{this.language=m,this.languages=this.services.languageUtils.toResolveHierarchy(m),this.resolvedLanguage=void 0,this.setResolvedLanguage(m)},c=(m,g)=>{g?this.isLanguageChangingTo===t&&(o(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,r.resolve((...p)=>this.t(...p)),a&&a(m,(...p)=>this.t(...p))},f=m=>{!t&&!m&&this.services.languageDetector&&(m=[]);const g=sn(m)?m:m&&m[0],p=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(sn(m)?[m]:m);p&&(this.language||o(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector?.cacheUserLanguage?.(p)),this.loadResources(p,y=>{c(y,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(t),r}getFixedT(t,a,r){const o=(c,f,...m)=>{let g;typeof f!="object"?g=this.options.overloadTranslationOptionHandler([c,f].concat(m)):g={...f},g.lng=g.lng||o.lng,g.lngs=g.lngs||o.lngs,g.ns=g.ns||o.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||r||o.keyPrefix);const p=this.options.keySeparator||".";let y;return g.keyPrefix&&Array.isArray(c)?y=c.map(S=>`${g.keyPrefix}${p}${S}`):y=g.keyPrefix?`${g.keyPrefix}${p}${c}`:c,this.t(y,g)};return sn(t)?o.lng=t:o.lngs=t,o.ns=a,o.keyPrefix=r,o}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,a={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=a.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const f=(m,g)=>{const p=this.services.backendConnector.state[`${m}|${g}`];return p===-1||p===0||p===2};if(a.precheck){const m=a.precheck(this,f);if(m!==void 0)return m}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(r,t)&&(!o||f(c,t)))}loadNamespaces(t,a){const r=Mv();return this.options.ns?(sn(t)&&(t=[t]),t.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{r.resolve(),a&&a(o)}),r):(a&&a(),Promise.resolve())}loadLanguages(t,a){const r=Mv();sn(t)&&(t=[t]);const o=this.options.preload||[],c=t.filter(f=>o.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return c.length?(this.options.preload=o.concat(c),this.loadResources(f=>{r.resolve(),a&&a(f)}),r):(a&&a(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const o=new Intl.Locale(t);if(o&&o.getTextInfo){const c=o.getTextInfo();if(c&&c.direction)return c.direction}}catch{}const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services?.languageUtils||new x_(O_());return t.toLowerCase().indexOf("-latn")>1?"ltr":a.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},a){return new Nv(t,a)}cloneInstance(t={},a=kS){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const o={...this.options,...t,isClone:!0},c=new Nv(o);if((t.debug!==void 0||t.prefix!==void 0)&&(c.logger=c.logger.clone(t)),["store","services","language"].forEach(m=>{c[m]=this[m]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},r){const m=Object.keys(this.store.data).reduce((g,p)=>(g[p]={...this.store.data[p]},g[p]=Object.keys(g[p]).reduce((y,S)=>(y[S]={...g[p][S]},y),g[p]),g),{});c.store=new v_(m,o),c.services.resourceStore=c.store}return c.translator=new IS(c.services,o),c.translator.on("*",(m,...g)=>{c.emit(m,...g)}),c.init(o,a),c.translator.options=o,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Wr=Nv.createInstance();Wr.createInstance=Nv.createInstance,Wr.createInstance,Wr.dir,Wr.init,Wr.loadResources,Wr.reloadResources,Wr.use,Wr.changeLanguage,Wr.getFixedT,Wr.t,Wr.exists,Wr.setDefaultNamespace,Wr.hasLoadedNamespace,Wr.loadNamespaces,Wr.loadLanguages;const dB=(e,t,a,r)=>{const o=[a,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(o,"warn","react-i18next::",!0);Rd(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...o):console?.warn&&console.warn(...o)},A_={},RE=(e,t,a,r)=>{Rd(a)&&A_[a]||(Rd(a)&&(A_[a]=new Date),dB(e,t,a,r))},M_=(e,t)=>()=>{if(e.isInitialized)t();else{const a=()=>{setTimeout(()=>{e.off("initialized",a)},0),t()};e.on("initialized",a)}},AE=(e,t,a)=>{e.loadNamespaces(t,M_(e,a))},__=(e,t,a,r)=>{if(Rd(a)&&(a=[a]),e.options.preload&&e.options.preload.indexOf(t)>-1)return AE(e,a,r);a.forEach(o=>{e.options.ns.indexOf(o)<0&&e.options.ns.push(o)}),e.loadLanguages(t,M_(e,r))},hB=(e,t,a={})=>!t.languages||!t.languages.length?(RE(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:a.lng,precheck:(r,o)=>{if(a.bindI18n?.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!o(r.isLanguageChangingTo,e))return!1}}),Rd=e=>typeof e=="string",mB=e=>typeof e=="object"&&e!==null,pB=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,gB={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},vB=e=>gB[e];let ME={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(pB,vB)};const yB=(e={})=>{ME={...ME,...e}},bB=()=>ME;let D_;const SB=e=>{D_=e},xB=()=>D_,CB={type:"3rdParty",init(e){yB(e.options.react),SB(e)}},EB=x.createContext();class wB{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(a=>{this.usedNamespaces[a]||(this.usedNamespaces[a]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const TB=(e,t)=>{const a=x.useRef();return x.useEffect(()=>{a.current=e},[e,t]),a.current},N_=(e,t,a,r)=>e.getFixedT(t,a,r),OB=(e,t,a,r)=>x.useCallback(N_(e,t,a,r),[e,t,a,r]),RB=(e,t={})=>{const{i18n:a}=t,{i18n:r,defaultNS:o}=x.useContext(EB)||{},c=a||r||xB();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new wB),!c){RE(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const V=(L,B)=>Rd(B)?B:mB(B)&&Rd(B.defaultValue)?B.defaultValue:Array.isArray(L)?L[L.length-1]:L,N=[V,{},!1];return N.t=V,N.i18n={},N.ready=!1,N}c.options.react?.wait&&RE(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const f={...bB(),...c.options.react,...t},{useSuspense:m,keyPrefix:g}=f;let p=o||c.options?.defaultNS;p=Rd(p)?[p]:p||["translation"],c.reportNamespaces.addUsedNamespaces?.(p);const y=(c.isInitialized||c.initializedStoreOnce)&&p.every(V=>hB(V,c,f)),S=OB(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),E=()=>S,T=()=>N_(c,t.lng||null,f.nsMode==="fallback"?p:p[0],g),[O,M]=x.useState(E);let A=p.join();t.lng&&(A=`${t.lng}${A}`);const D=TB(A),_=x.useRef(!0);x.useEffect(()=>{const{bindI18n:V,bindI18nStore:N}=f;_.current=!0,!y&&!m&&(t.lng?__(c,t.lng,p,()=>{_.current&&M(T)}):AE(c,p,()=>{_.current&&M(T)})),y&&D&&D!==A&&_.current&&M(T);const L=()=>{_.current&&M(T)};return V&&c?.on(V,L),N&&c?.store.on(N,L),()=>{_.current=!1,c&&V?.split(" ").forEach(B=>c.off(B,L)),N&&c&&N.split(" ").forEach(B=>c.store.off(B,L))}},[c,A]),x.useEffect(()=>{_.current&&y&&M(E)},[c,g,y]);const j=[O,c,y];if(j.t=O,j.i18n=c,j.ready=y,y||!y&&!m)return j;throw new Promise(V=>{t.lng?__(c,t.lng,p,()=>V()):AE(c,p,()=>V())})},AB={en:{translation:{welcome:"Hi there, you’re speaking with Jaweb AI Assistant."}},ar:{translation:{welcome:"مرحبًا، أنت تتحدث إلى مساعد Jaweb AI."}}};Wr.use(CB).init({resources:AB,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const MB=3,_B=3e3,DB=()=>{const[e,t]=x.useState(!0),[a,r]=x.useState(!1),[o,c]=x.useState(""),[f,m]=x.useState(""),[g,p]=x.useState(!1),[y,S]=x.useState(!1),[E,T]=x.useState(""),[O,M]=x.useState(""),[A,D]=x.useState(null),[_,j]=x.useState(""),[V,N]=x.useState([]),[L,B]=x.useState([]),[z,U]=x.useState(""),[H,te]=x.useState(!1),Y=async(Z=0)=>{const W=localStorage.getItem("company_username");console.log(W),t(!0);const ie={headers:{"Content-Type":"application/json",Accept:"application/json"},params:{username:W}};try{const F=(await $a.get(`${bi.apiUrl}chatbot-details/`,ie)).data.data;F.language==="Arabic"?Wr.changeLanguage("ar"):Wr.changeLanguage("en"),r(F.chatbot_form),c(F.chatbot_color),m(F.chatbot_logo),p(F.disable_chatbot_globally),S(F.remove_powered_by_jaweb),T(F.chatbot_initial_msg),M(F.status),U(F.mode),D(F.calendly_link??null),te(F.disable_checkout),console.log(F),F.calendly_link&&D(F.calendly_link),F.phone_number_id&&j(`+${F.phone_number_id}`);const Q=await $a.get(`${bi.apiUrl}chatbot-plugin-suggestions/`,ie);let se=[];Array.isArray(Q.data.data)?se=Q.data.data:Array.isArray(Q.data.user_questions)&&(se=Q.data.user_questions),se.length>0?(N(se.slice(0,3)),B(se.slice(3))):(N([]),B([])),t(!1)}catch(G){console.error("Error fetching data:",G),Z<MB?setTimeout(()=>Y(Z+1),_B):console.error("Max retries reached. Could not fetch data.")}};return x.useEffect(()=>{Y()},[]),{isFetchingDetails:e,disableForm:a,colorCode:o,chatbotLogo:f,disableChatbotGlobally:g,removePoweredByJaweb:y,initialMessageText:E,subscription:O,calendly:A,merchantPhone:_,messagesSuggestions:V,restSuggestions:L,userType:z,disbleCheckout:H}};var _E={exports:{}};/*!
325
325
  Copyright (c) 2018 Jed Watson.
326
326
  Licensed under the MIT License (MIT), see
327
327
  http://jedwatson.github.io/classnames
@@ -641,7 +641,7 @@ html body {
641
641
  <div class="cursor" part="cursor"></div>
642
642
  </div>
643
643
  </div>
644
- `,[t,a]}setOptions(t){if(this.options.container!==t.container){const a=this.parentFromOptionsContainer(t.container);a.appendChild(this.container),this.parent=a}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:a}=this.scrollContainer,r=a*t;this.setScroll(r)}destroy(){var t,a;this.subscriptions.forEach(r=>r()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(a=this.unsubscribeOnScroll)===null||a===void 0||a.forEach(r=>r()),this.unsubscribeOnScroll=[]}createDelay(t=10){let a,r;const o=()=>{a&&clearTimeout(a),r&&r()};return this.timeouts.push(o),()=>new Promise((c,f)=>{o(),r=f,a=setTimeout(()=>{a=void 0,r=void 0,c()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const a=document.createElement("canvas"),r=a.getContext("2d"),o=a.height*(window.devicePixelRatio||1),c=r.createLinearGradient(0,0,0,o),f=1/(t.length-1);return t.forEach((m,g)=>{const p=g*f;c.addColorStop(p,m)}),c}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,a,r,o){const c=t[0],f=t[1]||t[0],m=c.length,{width:g,height:p}=r.canvas,y=p/2,S=this.getPixelRatio(),E=a.barWidth?a.barWidth*S:1,T=a.barGap?a.barGap*S:a.barWidth?E/2:0,O=a.barRadius||0,M=g/(E+T)/m,A=O&&"roundRect"in r?"roundRect":"rect";r.beginPath();let D=0,_=0,j=0;for(let V=0;V<=m;V++){const N=Math.round(V*M);if(N>D){const z=Math.round(_*y*o),U=z+Math.round(j*y*o)||1;let H=y-z;a.barAlign==="top"?H=0:a.barAlign==="bottom"&&(H=p-U),r[A](D*(E+T),H,E,U,O),D=N,_=0,j=0}const L=Math.abs(c[V]||0),B=Math.abs(f[V]||0);L>_&&(_=L),B>j&&(j=B)}r.fill(),r.closePath()}renderLineWaveform(t,a,r,o){const c=f=>{const m=t[f]||t[0],g=m.length,{height:p}=r.canvas,y=p/2,S=r.canvas.width/g;r.moveTo(0,y);let E=0,T=0;for(let O=0;O<=g;O++){const M=Math.round(O*S);if(M>E){const D=y+(Math.round(T*y*o)||1)*(f===0?-1:1);r.lineTo(E,D),E=M,T=0}const A=Math.abs(m[O]||0);A>T&&(T=A)}r.lineTo(E,y)};r.beginPath(),c(0),c(1),r.fill(),r.closePath()}renderWaveform(t,a,r){if(r.fillStyle=this.convertColorValues(a.waveColor),a.renderFunction)return void a.renderFunction(t,r);let o=a.barHeight||1;if(a.normalize){const c=Array.from(t[0]).reduce((f,m)=>Math.max(f,Math.abs(m)),0);o=c?1/c:1}a.barWidth||a.barGap||a.barAlign?this.renderBarWaveform(t,a,r,o):this.renderLineWaveform(t,a,r,o)}renderSingleCanvas(t,a,r,o,c,f,m){const g=this.getPixelRatio(),p=document.createElement("canvas");p.width=Math.round(r*g),p.height=Math.round(o*g),p.style.width=`${r}px`,p.style.height=`${o}px`,p.style.left=`${Math.round(c)}px`,f.appendChild(p);const y=p.getContext("2d");if(this.renderWaveform(t,a,y),p.width>0&&p.height>0){const S=p.cloneNode(),E=S.getContext("2d");E.drawImage(p,0,0),E.globalCompositeOperation="source-in",E.fillStyle=this.convertColorValues(a.progressColor),E.fillRect(0,0,p.width,p.height),m.appendChild(S)}}renderMultiCanvas(t,a,r,o,c,f){const m=this.getPixelRatio(),{clientWidth:g}=this.scrollContainer,p=r/m;let y=Math.min(Ym.MAX_CANVAS_WIDTH,g,p),S={};if(a.barWidth||a.barGap){const A=a.barWidth||.5,D=A+(a.barGap||A/2);y%D!=0&&(y=Math.floor(y/D)*D)}if(y===0)return;const E=A=>{if(A<0||A>=T||S[A])return;S[A]=!0;const D=A*y;let _=Math.min(p-D,y);if(a.barWidth||a.barGap){const V=a.barWidth||.5,N=V+(a.barGap||V/2);_=Math.floor(_/N)*N}if(_<=0)return;const j=t.map(V=>{const N=Math.floor(D/p*V.length),L=Math.floor((D+_)/p*V.length);return V.slice(N,L)});this.renderSingleCanvas(j,a,_,o,D,c,f)},T=Math.ceil(p/y);if(!this.isScrollable){for(let A=0;A<T;A++)E(A);return}const O=this.scrollContainer.scrollLeft/p,M=Math.floor(O*T);if(E(M-1),E(M),E(M+1),T>1){const A=this.on("scroll",()=>{const{scrollLeft:D}=this.scrollContainer,_=Math.floor(D/p*T);Object.keys(S).length>Ym.MAX_NODES&&(c.innerHTML="",f.innerHTML="",S={}),E(_-1),E(_),E(_+1)});this.unsubscribeOnScroll.push(A)}}renderChannel(t,a,r,o){var{overlay:c}=a,f=function(y,S){var E={};for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&S.indexOf(T)<0&&(E[T]=y[T]);if(y!=null&&typeof Object.getOwnPropertySymbols=="function"){var O=0;for(T=Object.getOwnPropertySymbols(y);O<T.length;O++)S.indexOf(T[O])<0&&Object.prototype.propertyIsEnumerable.call(y,T[O])&&(E[T[O]]=y[T[O]])}return E}(a,["overlay"]);const m=document.createElement("div"),g=this.getHeight(f.height,f.splitChannels);m.style.height=`${g}px`,c&&o>0&&(m.style.marginTop=`-${g}px`),this.canvasWrapper.style.minHeight=`${g}px`,this.canvasWrapper.appendChild(m);const p=m.cloneNode();this.progressWrapper.appendChild(p),this.renderMultiCanvas(t,f,r,g,m,p)}render(t){return ri(this,void 0,void 0,function*(){var a;this.timeouts.forEach(g=>g()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const r=this.getPixelRatio(),o=this.scrollContainer.clientWidth,c=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=c>o;const f=this.options.fillParent&&!this.isScrollable,m=(f?o:c)*r;if(this.wrapper.style.width=f?"100%":`${c}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let g=0;g<t.numberOfChannels;g++){const p=Object.assign(Object.assign({},this.options),(a=this.options.splitChannels)===null||a===void 0?void 0:a[g]);this.renderChannel([t.getChannelData(g)],p,m,g)}else{const g=[t.getChannelData(0)];t.numberOfChannels>1&&g.push(t.getChannelData(1)),this.renderChannel(g,this.options,m,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(r=>r()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:a}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:r}=this.progressWrapper.getBoundingClientRect();let o=r-a;o*=2,o=o<0?Math.floor(o):Math.ceil(o),o/=2,this.scrollContainer.scrollLeft+=o}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,a=!1){const{scrollLeft:r,scrollWidth:o,clientWidth:c}=this.scrollContainer,f=t*o,m=r,g=r+c,p=c/2;if(this.isDragging)f+30>g?this.scrollContainer.scrollLeft+=30:f-30<m&&(this.scrollContainer.scrollLeft-=30);else{(f<m||f>g)&&(this.scrollContainer.scrollLeft=f-(this.options.autoCenter?p:0));const y=f-r-p;a&&this.options.autoCenter&&y>0&&(this.scrollContainer.scrollLeft+=Math.min(y,10))}{const y=this.scrollContainer.scrollLeft,S=y/o,E=(y+c)/o;this.emit("scroll",S,E,y,y+c)}}renderProgress(t,a){if(isNaN(t))return;const r=100*t;this.canvasWrapper.style.clipPath=`polygon(${r}% 0%, 100% 0%, 100% 100%, ${r}% 100%)`,this.progressWrapper.style.width=`${r}%`,this.cursor.style.left=`${r}%`,this.cursor.style.transform=`translateX(-${Math.round(r)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,a)}exportImage(t,a,r){return ri(this,void 0,void 0,function*(){const o=this.canvasWrapper.querySelectorAll("canvas");if(!o.length)throw new Error("No waveform data");if(r==="dataURL"){const c=Array.from(o).map(f=>f.toDataURL(t,a));return Promise.resolve(c)}return Promise.all(Array.from(o).map(c=>new Promise((f,m)=>{c.toBlob(g=>{g?f(g):m(new Error("Could not export image"))},t,a)})))})}}Ym.MAX_CANVAS_WIDTH=8e3,Ym.MAX_NODES=10;class WZ extends b0{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class CO extends b0{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return ri(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(a=>{if(a.status>=400)throw new Error(`Failed to fetch ${t}: ${a.status} (${a.statusText})`);return a.arrayBuffer()}).then(a=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(a)).then(a=>{this.currentSrc===t&&(this.buffer=a,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let a=this.playedDuration*this._playbackRate;(a>=this.duration||a<0)&&(a=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,a),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return ri(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const a=t-this.currentTime,r=this.bufferNode;r?.stop(this.audioContext.currentTime+a),r?.addEventListener("ended",()=>{r===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return ri(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const a=!this.paused;a&&this._pause(),this.playedDuration=t/this._playbackRate,a&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,a;return(t=this._duration)!==null&&t!==void 0?t:((a=this.buffer)===null||a===void 0?void 0:a.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const a=this.buffer.numberOfChannels;for(let r=0;r<a;r++)t.push(this.buffer.getChannelData(r));return t}}const ZZ={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class Wm extends YZ{static create(t){return new Wm(t)}constructor(t){const a=t.media||(t.backend==="WebAudio"?new CO:void 0);super({media:a,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},ZZ,t),this.timer=new WZ;const r=a?void 0:this.getMediaElement();this.renderer=new Ym(this.options,r),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const o=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:c,duration:f}=this.options;(o||c&&f)&&this.load(o,c,f).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,a)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,a))}),this.renderer.on("dblclick",(t,a)=>{this.emit("dblclick",t,a)}),this.renderer.on("scroll",(t,a,r,o)=>{const c=this.getDuration();this.emit("scroll",t*c,a*c,r,o)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",a=>{if(!this.options.interact)return;let r;this.renderer.renderProgress(a),clearTimeout(t),this.isPlaying()?r=0:this.options.dragToSeek===!0?r=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(r=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(a)},r),this.emit("interaction",a*this.getDuration()),this.emit("drag",a)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(a=>{this.registerPlugin(a)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=tx.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=tx.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){t._init(this),this.plugins.push(t);const a=t.once("destroy",()=>{this.plugins=this.plugins.filter(r=>r!==t),this.subscriptions=this.subscriptions.filter(r=>r!==a)});return this.subscriptions.push(a),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const a=t/this.getDuration();this.renderer.setScrollPercentage(a)}getActivePlugins(){return this.plugins}loadAudio(t,a,r,o){return ri(this,void 0,void 0,function*(){var c;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!a&&!r){const m=this.options.fetchParams||{};window.AbortController&&!m.signal&&(this.abortController=new AbortController,m.signal=(c=this.abortController)===null||c===void 0?void 0:c.signal);const g=y=>this.emit("loading",y);a=yield XZ.fetchBlob(t,g,m);const p=this.options.blobMimeType;p&&(a=new Blob([a],{type:p}))}this.setSrc(t,a);const f=yield new Promise(m=>{const g=o||this.getDuration();g?m(g):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>m(this.getDuration()),{once:!0}))});if(!t&&!a){const m=this.getMediaElement();m instanceof CO&&(m.duration=f)}if(r)this.decodedData=tx.createBuffer(r,f||0);else if(a){const m=yield a.arrayBuffer();this.decodedData=yield tx.decode(m,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,a,r){return ri(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,a,r)}catch(o){throw this.emit("error",o),o}})}loadBlob(t,a,r){return ri(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,a,r)}catch(o){throw this.emit("error",o),o}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:a=8e3,precision:r=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const o=Math.min(t,this.decodedData.numberOfChannels),c=[];for(let f=0;f<o;f++){const m=this.decodedData.getChannelData(f),g=[],p=m.length/a;for(let y=0;y<a;y++){const S=m.slice(Math.floor(y*p),Math.ceil((y+1)*p));let E=0;for(let T=0;T<S.length;T++){const O=S[T];Math.abs(O)>Math.abs(E)&&(E=O)}g.push(Math.round(E*r)/r)}c.push(g)}return c}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const a=this.getDuration()*t;this.setTime(a)}play(t,a){const r=Object.create(null,{play:{get:()=>super.play}});return ri(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const o=yield r.play.call(this);return a!=null&&(this.media instanceof CO?this.media.stopAt(a):this.stopAtPosition=a),o})}playPause(){return ri(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return ri(this,arguments,void 0,function*(t="image/png",a=1,r="dataURL"){return this.renderer.exportImage(t,a,r)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(a=>a.destroy()),this.subscriptions.forEach(a=>a()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}Wm.BasePlugin=class extends b0{constructor(e){super(),this.subscriptions=[],this.options=e}onInit(){}_init(e){this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(e=>e())}},Wm.dom=GZ;const KZ=({userMessage:e,setUserMessage:t,handleSendMessage:a,handleSendImage:r,handleSendVoice:o,selectedImage:c,setSelectedImage:f,audioBlob:m,setAudioBlob:g,isSending:p})=>{const{t:y}=RB(),[S,E]=x.useState(!1),[T,O]=x.useState(!1),M=x.useRef(null),A=x.useRef(null),D=x.useRef([]),_=x.useRef(null),j=x.useRef(null),V=U=>{const H=U.target.files?.[0];H&&f(H)},N=()=>{f(null)},L=async()=>{if(!navigator.mediaDevices?.getUserMedia){alert(y("chatInput.voice.notSupported"));return}if(S)M.current?.stop();else try{const U=await navigator.mediaDevices.getUserMedia({audio:!0}),H=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",te=new MediaRecorder(U,{mimeType:H});M.current=te,D.current=[],te.ondataavailable=Y=>{Y.data.size>0&&D.current.push(Y.data)},te.onstop=()=>{const Y=new Blob(D.current,{type:H});g(Y),E(!1),U.getTracks().forEach(Z=>Z.stop())},te.start(),E(!0)}catch(U){console.error(U),alert(y("chatInput.voice.permissionError"))}};x.useEffect(()=>{if(m&&_.current){j.current?.destroy();const U=URL.createObjectURL(m);j.current=Wm.create({container:_.current,waveColor:"#ccc",progressColor:"#7F28F8",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),j.current.load(U),j.current.on("finish",()=>O(!1))}},[m]);const B=()=>{j.current&&(j.current.playPause(),O(U=>!U))},z=()=>{E(!1),g(null),j.current?.destroy()};return ae.jsxs("div",{style:{display:"flex",alignItems:"center",backgroundColor:"white",border:"1px solid #d1d5db",borderRadius:"9999px",padding:"0.5rem 0.75rem",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",width:"95%",height:"56px"},children:[ae.jsx("button",{style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},onClick:()=>A.current?.click(),children:c?ae.jsxs("div",{style:{position:"relative"},children:[ae.jsx("img",{src:URL.createObjectURL(c),alt:y("chatInput.image.selectedAlt"),style:{width:"2rem",height:"2rem",borderRadius:"9999px",objectFit:"cover",padding:"0"}}),ae.jsx(y0,{style:{position:"absolute",top:"-0.5rem",right:"-0.5rem",fontSize:"14px",color:"#ef4444",background:"white",borderRadius:"9999px",cursor:"pointer"},onClick:U=>{U.stopPropagation(),N()}})]}):ae.jsx(b6,{style:{fontSize:"20px"}})}),ae.jsx("input",{disabled:p,type:"file",accept:"image/*",ref:A,onChange:V,style:{display:"none",padding:"0"}}),ae.jsx(Ld,{title:S?"Stop Recording":"Send Audio",children:ae.jsx("button",{onClick:L,style:{color:S?"#ef4444":"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:S?ae.jsx(C6,{style:{fontSize:"20px"}}):ae.jsx(p6,{style:{fontSize:"20px"}})})}),ae.jsx("div",{style:{flex:1,margin:"0 0.5rem",minWidth:0,maxWidth:"100%",display:"flex",alignItems:"center"},children:m?ae.jsxs("div",{style:{display:"flex",alignItems:"center",width:"100%",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem"},children:[ae.jsx("button",{style:{background:"none",border:"none",marginRight:"0.75rem",color:"#7f28f8",cursor:"pointer",padding:"0"},onClick:B,children:T?ae.jsx(uO,{style:{fontSize:"24px"}}):ae.jsx(cO,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:_,style:{width:"100%",height:"2rem"}}),ae.jsx(y0,{style:{fontSize:"18px",color:"#ef4444",marginLeft:"0.75rem",cursor:"pointer"},onClick:z})]}):S?ae.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem",animation:"pulse 2s infinite"},children:ae.jsx("span",{children:"Recording"})}):ae.jsx(Yu,{type:"text",value:e,onChange:U=>t(U.target.value),placeholder:"Message...",style:{width:"100%",border:"none",fontSize:"16px",margin:0,lineHeight:1.5,color:"#374151",padding:"0"},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),c?(r(c,e),N(),t("")):e.trim()&&(a(),t("")))}})}),ae.jsx("button",{disabled:p,onClick:()=>{const U=!!c,H=!!e.trim();U?(r(c,e),N(),t("")):!!m?(o(m),z()):H&&a()},"aria-label":y("chatInput.send"),style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:ae.jsx(S6,{style:{fontSize:"20px"}})})]})};function QZ({suggestions:e,colorCode:t,sendMessageSuggestion:a}){return ae.jsx("div",{style:{overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",paddingTop:"4px",paddingBottom:"8px",width:"100%",boxSizing:"border-box",marginLeft:"4%",marginTop:"4px",marginBottom:"4px"},children:ae.jsx("div",{style:{display:"inline-flex",gap:"0.5rem"},children:e?.map((r,o)=>ae.jsx("button",{onClick:()=>a(r),style:{whiteSpace:"nowrap",padding:"0.5rem 1rem",border:`1px solid ${t}`,borderRadius:"9999px",backgroundColor:"white",cursor:"pointer",fontSize:"14px",color:t,flexShrink:0},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="#f3f3f3"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="white"},children:r},o))})})}function JZ(){return ae.jsxs("div",{className:"jawebcss-powered-container",children:[ae.jsx("span",{className:"jawebcss-powered-label",children:"Powered by"}),ae.jsx("a",{href:"https://jaweb.me/",target:"_blank",className:"jawebcss-powered-link",rel:"noopener noreferrer",children:"Jaweb"})]})}const eK=()=>ae.jsxs("div",{className:"typing-animation",children:[ae.jsx("span",{children:"."}),ae.jsx("span",{children:"."}),ae.jsx("span",{children:"."})]}),tK=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y,disableCheckout:S=!1})=>!y||y===0?null:ae.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:ae.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([E,T])=>{const O=t[E]||(T.length>0?T[0].variant_id:""),M=T.find(L=>L.variant_id===O)||T[0];if(!M)return null;const A=r[M.variant_id]||0,D=Array.from(new Set(T.map(L=>L.option?.trim()??"").filter(L=>L&&L.toLowerCase()!=="none"))),_=L=>{const B=T.find(z=>z.option===L);B&&a(z=>({...z,[E]:B.variant_id}))},j=async()=>{o(L=>({...L,[M.variant_id]:(L[M.variant_id]||0)+1})),await c(M.variant_id,M.name,1)},V=async()=>{A!==0&&(o(L=>({...L,[M.variant_id]:Math.max(0,(L[M.variant_id]||0)-1)})),await f(M.variant_id,1))},N=M.option??D[0]??"";return ae.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[ae.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(M.link,"_blank"),children:[ae.jsx("img",{src:M.image,alt:M.name,className:"sallaX-img",loading:"lazy"}),ae.jsx("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:L=>L.stopPropagation(),children:"View"})]}),ae.jsxs("div",{className:"sallaX-body",children:[ae.jsx("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:M.name,children:g(M.name)}),ae.jsx("div",{className:"sallaX-row",children:ae.jsx("span",{className:"sallaX-price","aria-label":"Price",children:M.price})}),D.length>1&&ae.jsxs("div",{className:"sallaX-selectWrap",children:[ae.jsx("label",{htmlFor:`sallaX-select-${E}`,className:"sallaX-selectLabel",children:"Choose an option"}),ae.jsx("select",{id:`sallaX-select-${E}`,className:"sallaX-select","aria-label":"Choose an option",value:N,onChange:L=>_(L.target.value),children:D.map(L=>ae.jsx("option",{value:L,children:L},L))})]}),!S&&ae.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:V,"aria-label":"Decrease quantity",disabled:A===0,children:"–"}),ae.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:A}),ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:j,"aria-label":"Increase quantity",children:"+"})]})]})]},E)})})});var nx={},P6;function nK(){if(P6)return nx;P6=1,Object.defineProperty(nx,"__esModule",{value:!0});var e=Ed();function t(z){return Array.prototype.slice.call(z)}function a(z,U){var H=Math.floor(z);return H===U||H+1===U?z:U}function r(){return Date.now()}function o(z,U,H){if(U="data-keen-slider-"+U,H===null)return z.removeAttribute(U);z.setAttribute(U,H||"")}function c(z,U){return U=U||document,typeof z=="function"&&(z=z(U)),Array.isArray(z)?z:typeof z=="string"?t(U.querySelectorAll(z)):z instanceof HTMLElement?[z]:z instanceof NodeList?t(z):[]}function f(z){z.raw&&(z=z.raw),z.cancelable&&!z.defaultPrevented&&z.preventDefault()}function m(z){z.raw&&(z=z.raw),z.stopPropagation&&z.stopPropagation()}function g(){var z=[];return{add:function(U,H,te,Y){U.addListener?U.addListener(te):U.addEventListener(H,te,Y),z.push([U,H,te,Y])},input:function(U,H,te,Y){this.add(U,H,function(Z){return function(W){W.nativeEvent&&(W=W.nativeEvent);var ie=W.changedTouches||[],G=W.targetTouches||[],F=W.detail&&W.detail.x?W.detail:null;return Z({id:F?F.identifier?F.identifier:"i":G[0]?G[0]?G[0].identifier:"e":"d",idChanged:F?F.identifier?F.identifier:"i":ie[0]?ie[0]?ie[0].identifier:"e":"d",raw:W,x:F&&F.x?F.x:G[0]?G[0].screenX:F?F.x:W.pageX,y:F&&F.y?F.y:G[0]?G[0].screenY:F?F.y:W.pageY})}}(te),Y)},purge:function(){z.forEach(function(U){U[0].removeListener?U[0].removeListener(U[2]):U[0].removeEventListener(U[1],U[2],U[3])}),z=[]}}}function p(z,U,H){return Math.min(Math.max(z,U),H)}function y(z){return(z>0?1:0)-(z<0?1:0)||+z}function S(z){var U=z.getBoundingClientRect();return{height:a(U.height,z.offsetHeight),width:a(U.width,z.offsetWidth)}}function E(z,U,H,te){var Y=z&&z[U];return Y==null?H:te&&typeof Y=="function"?Y():Y}function T(z){return Math.round(1e6*z)/1e6}function O(z,U){if(z===U)return!0;var H=typeof z;if(H!==typeof U)return!1;if(H!=="object"||z===null||U===null)return H==="function"&&z.toString()===U.toString();if(z.length!==U.length||Object.getOwnPropertyNames(z).length!==Object.getOwnPropertyNames(U).length)return!1;for(var te in z)if(!O(z[te],U[te]))return!1;return!0}var M=function(){return M=Object.assign||function(z){for(var U,H=1,te=arguments.length;H<te;H++)for(var Y in U=arguments[H])Object.prototype.hasOwnProperty.call(U,Y)&&(z[Y]=U[Y]);return z},M.apply(this,arguments)};function A(z,U,H){for(var te,Y=0,Z=U.length;Y<Z;Y++)!te&&Y in U||(te||(te=Array.prototype.slice.call(U,0,Y)),te[Y]=U[Y]);return z.concat(te||Array.prototype.slice.call(U))}function D(z){var U,H,te,Y,Z,W;function ie(k){W||(W=k),G(!0);var q=k-W;q>te&&(q=te);var J=Y[H];if(J[3]<q)return H++,ie(k);var ne=J[2],oe=J[4],le=J[0],ue=J[1]*(0,J[5])(oe===0?1:(q-ne)/oe);if(ue&&z.track.to(le+ue),q<te)return Q();W=null,G(!1),F(null),z.emit("animationEnded")}function G(k){U.active=k}function F(k){U.targetIdx=k}function Q(){var k;k=ie,Z=window.requestAnimationFrame(k)}function se(){var k;k=Z,window.cancelAnimationFrame(k),G(!1),F(null),W&&z.emit("animationStopped"),W=null}return U={active:!1,start:function(k){if(se(),z.track.details){var q=0,J=z.track.details.position;H=0,te=0,Y=k.map(function(ne){var oe,le=Number(J),ue=(oe=ne.earlyExit)!==null&&oe!==void 0?oe:ne.duration,Ee=ne.easing,ze=ne.distance*Ee(ue/ne.duration)||0;J+=ze;var De=te;return te+=ue,q+=ze,[le,ne.distance,De,te,ne.duration,Ee]}),F(z.track.distToIdx(q)),Q(),z.emit("animationStarted")}},stop:se,targetIdx:null}}function _(z){var U,H,te,Y,Z,W,ie,G,F,Q,se,k,q,J,ne=1/0,oe=[],le=null,ue=0;function Ee(Re){ye(ue+Re)}function ze(Re){var Ae=De(ue+Re).abs;return he(Ae)?Ae:null}function De(Re){var Ae=Math.floor(Math.abs(T(Re/H))),we=T((Re%H+H)%H);we===H&&(we=0);var Te=y(Re),Ne=ie.indexOf(A([],ie).reduce(function(Le,it){return Math.abs(it-we)<Math.abs(Le-we)?it:Le})),ke=Ne;return Te<0&&Ae++,Ne===W&&(ke=0,Ae+=Te>0?1:-1),{abs:ke+Ae*W*Te,origin:Ne,rel:ke}}function Fe(Re,Ae,we){var Te;if(Ae||!Ue())return ve(Re,we);if(!he(Re))return null;var Ne=De(we??ue),ke=Ne.abs,Le=Re-Ne.rel,it=ke+Le;Te=ve(it);var ut=ve(it-W*y(Le));return(ut!==null&&Math.abs(ut)<Math.abs(Te)||Te===null)&&(Te=ut),T(Te)}function ve(Re,Ae){if(Ae==null&&(Ae=T(ue)),!he(Re)||Re===null)return null;Re=Math.round(Re);var we=De(Ae),Te=we.abs,Ne=we.rel,ke=we.origin,Le=me(Re),it=(Ae%H+H)%H,ut=ie[ke],vt=Math.floor((Re-(Te-Ne))/W)*H;return T(ut-it-ut+ie[Le]+vt+(ke===W?H:0))}function he(Re){return je(Re)===Re}function je(Re){return p(Re,F,Q)}function Ue(){return Y.loop}function me(Re){return(Re%W+W)%W}function ye(Re){var Ae;Ae=Re-ue,oe.push({distance:Ae,timestamp:r()}),oe.length>6&&(oe=oe.slice(-6)),ue=T(Re);var we=Se().abs;if(we!==le){var Te=le!==null;le=we,Te&&z.emit("slideChanged")}}function Se(Re){var Ae=Re?null:function(){if(W){var we=Ue(),Te=we?(ue%H+H)%H:ue,Ne=(we?ue%H:ue)-Z[0][2],ke=0-(Ne<0&&we?H-Math.abs(Ne):Ne),Le=0,it=De(ue),ut=it.abs,vt=it.rel,At=Z[vt][2],ht=Z.map(function(jt,Vt){var _t=ke+Le;(_t<0-jt[0]||_t>1)&&(_t+=(Math.abs(_t)>H-1&&we?H:0)*y(-_t));var Tt=Vt-vt,ct=y(Tt),gt=Tt+ut;we&&(ct===-1&&_t>At&&(gt+=W),ct===1&&_t<At&&(gt-=W),se!==null&&gt<se&&(_t+=H),k!==null&&gt>k&&(_t-=H));var at=_t+jt[0]+jt[1],lt=Math.max(_t>=0&&at<=1?1:at<0||_t>1?0:_t<0?Math.min(1,(jt[0]+_t)/jt[0]):(1-_t)/jt[0],0);return Le+=jt[0]+jt[1],{abs:gt,distance:Y.rtl?-1*_t+1-jt[0]:_t,portion:lt,size:jt[0]}});return ut=je(ut),vt=me(ut),{abs:je(ut),length:te,max:J,maxIdx:Q,min:q,minIdx:F,position:ue,progress:we?Te/H:ue/te,rel:vt,slides:ht,slidesLength:H}}}();return U.details=Ae,z.emit("detailsChanged"),Ae}return U={absToRel:me,add:Ee,details:null,distToIdx:ze,idxToDist:Fe,init:function(Re){if(function(){if(Y=z.options,Z=(Y.trackConfig||[]).map(function(Ne){return[E(Ne,"size",1),E(Ne,"spacing",0),E(Ne,"origin",0)]}),W=Z.length){H=T(Z.reduce(function(Ne,ke){return Ne+ke[0]+ke[1]},0));var we,Te=W-1;te=T(H+Z[0][2]-Z[Te][0]-Z[Te][2]-Z[Te][1]),ie=Z.reduce(function(Ne,ke){if(!Ne)return[0];var Le=Z[Ne.length-1],it=Ne[Ne.length-1]+(Le[0]+Le[2])+Le[1];return it-=ke[2],Ne[Ne.length-1]>it&&(it=Ne[Ne.length-1]),it=T(it),Ne.push(it),(!we||we<it)&&(G=Ne.length-1),we=it,Ne},null),te===0&&(G=0),ie.push(T(H))}}(),!W)return Se(!0);var Ae;(function(){var we=z.options.range,Te=z.options.loop;se=F=Te?E(Te,"min",-1/0):0,k=Q=Te?E(Te,"max",ne):G;var Ne=E(we,"min",null),ke=E(we,"max",null);Ne!==null&&(F=Ne),ke!==null&&(Q=ke),q=F===-1/0?F:z.track.idxToDist(F||0,!0,0),J=Q===ne?Q:Fe(Q,!0,0),ke===null&&(k=Q),E(we,"align",!1)&&Q!==ne&&Z[me(Q)][2]===0&&(J-=1-Z[me(Q)][0],Q=ze(J-ue)),q=T(q),J=T(J)})(),Ae=Re,Number(Ae)===Ae?Ee(ve(je(Re))):Se()},to:ye,velocity:function(){var Re=r(),Ae=oe.reduce(function(we,Te){var Ne=Te.distance,ke=Te.timestamp;return Re-ke>200||(y(Ne)!==y(we.distance)&&we.distance&&(we={distance:0,lastTimestamp:0,time:0}),we.time&&(we.distance+=Ne),we.lastTimestamp&&(we.time+=ke-we.lastTimestamp),we.lastTimestamp=ke),we},{distance:0,lastTimestamp:0,time:0});return Ae.distance/Ae.time||0}}}function j(z){var U,H,te,Y,Z,W,ie,G;function F(le){return 2*le}function Q(le){return p(le,ie,G)}function se(le){return 1-Math.pow(1-le,3)}function k(){return te?z.track.velocity():0}function q(){oe();var le=z.options.mode==="free-snap",ue=z.track,Ee=k();Y=y(Ee);var ze=z.track.details,De=[];if(Ee||!le){var Fe=J(Ee),ve=Fe.dist,he=Fe.dur;if(he=F(he),ve*=Y,le){var je=ue.idxToDist(ue.distToIdx(ve),!0);je&&(ve=je)}De.push({distance:ve,duration:he,easing:se});var Ue=ze.position,me=Ue+ve;if(me<Z||me>W){var ye=me<Z?Z-Ue:W-Ue,Se=0,Re=Ee;if(y(ye)===Y){var Ae=Math.min(Math.abs(ye)/Math.abs(ve),1),we=function(ke){return 1-Math.pow(1-ke,1/3)}(Ae)*he;De[0].earlyExit=we,Re=Ee*(1-Ae)}else De[0].earlyExit=0,Se+=ye;var Te=J(Re,100),Ne=Te.dist*Y;z.options.rubberband&&(De.push({distance:Ne,duration:F(Te.dur),easing:se}),De.push({distance:-Ne+Se,duration:500,easing:se}))}z.animator.start(De)}else z.moveToIdx(Q(ze.abs),!0,{duration:500,easing:function(ke){return 1+--ke*ke*ke*ke*ke}})}function J(le,ue){ue===void 0&&(ue=1e3);var Ee=147e-9+(le=Math.abs(le))/ue;return{dist:Math.pow(le,2)/Ee,dur:le/Ee}}function ne(){var le=z.track.details;le&&(Z=le.min,W=le.max,ie=le.minIdx,G=le.maxIdx)}function oe(){z.animator.stop()}z.on("updated",ne),z.on("optionsChanged",ne),z.on("created",ne),z.on("dragStarted",function(){te=!1,oe(),U=H=z.track.details.abs}),z.on("dragChecked",function(){te=!0}),z.on("dragEnded",function(){var le=z.options.mode;le==="snap"&&function(){var ue=z.track,Ee=z.track.details,ze=Ee.position,De=y(k());(ze>W||ze<Z)&&(De=0);var Fe=U+De;Ee.slides[ue.absToRel(Fe)].portion===0&&(Fe-=De),U!==H&&(Fe=H),y(ue.idxToDist(Fe,!0))!==De&&(Fe+=De),Fe=Q(Fe);var ve=ue.idxToDist(Fe,!0);z.animator.start([{distance:ve,duration:500,easing:function(he){return 1+--he*he*he*he*he}}])}(),le!=="free"&&le!=="free-snap"||q()}),z.on("dragged",function(){H=z.track.details.abs})}function V(z){var U,H,te,Y,Z,W,ie,G,F,Q,se,k,q,J,ne,oe,le,ue,Ee=g();function ze(Se){if(W&&G===Se.id){var Re=he(Se);if(F){if(!ve(Se))return Fe(Se);Q=Re,F=!1,z.emit("dragChecked")}if(oe)return Q=Re;f(Se);var Ae=function(Te){if(le===-1/0&&ue===1/0)return Te;var Ne=z.track.details,ke=Ne.length,Le=Ne.position,it=p(Te,le-Le,ue-Le);if(ke===0)return 0;if(!z.options.rubberband)return it;if(Le<=ue&&Le>=le||Le<le&&H>0||Le>ue&&H<0)return Te;var ut=(Le<le?Le-le:Le-ue)/ke,vt=Y*ke,At=Math.abs(ut*vt),ht=Math.max(0,1-At/Z*2);return ht*ht*Te}(ie(Q-Re)/Y*te);H=y(Ae);var we=z.track.details.position;(we>le&&we<ue||we===le&&H>0||we===ue&&H<0)&&m(Se),se+=Ae,!k&&Math.abs(se*Y)>5&&(k=!0),z.track.add(Ae),Q=Re,z.emit("dragged")}}function De(Se){!W&&z.track.details&&z.track.details.length&&(se=0,W=!0,k=!1,F=!0,G=Se.id,ve(Se),Q=he(Se),z.emit("dragStarted"))}function Fe(Se){W&&G===Se.idChanged&&(W=!1,z.emit("dragEnded"))}function ve(Se){var Re=je(),Ae=Re?Se.y:Se.x,we=Re?Se.x:Se.y,Te=q!==void 0&&J!==void 0&&Math.abs(J-we)<=Math.abs(q-Ae);return q=Ae,J=we,Te}function he(Se){return je()?Se.y:Se.x}function je(){return z.options.vertical}function Ue(){Y=z.size,Z=je()?window.innerHeight:window.innerWidth;var Se=z.track.details;Se&&(le=Se.min,ue=Se.max)}function me(Se){k&&(m(Se),f(Se))}function ye(){if(Ee.purge(),z.options.drag&&!z.options.disabled){var Se;Se=z.options.dragSpeed||1,ie=typeof Se=="function"?Se:function(Ae){return Ae*Se},te=z.options.rtl?-1:1,Ue(),U=z.container,function(){var Ae="data-keen-slider-clickable";c("[".concat(Ae,"]:not([").concat(Ae,"=false])"),U).map(function(we){Ee.add(we,"dragstart",m),Ee.add(we,"mousedown",m),Ee.add(we,"touchstart",m)})}(),Ee.add(U,"dragstart",function(Ae){f(Ae)}),Ee.add(U,"click",me,{capture:!0}),Ee.input(U,"ksDragStart",De),Ee.input(U,"ksDrag",ze),Ee.input(U,"ksDragEnd",Fe),Ee.input(U,"mousedown",De),Ee.input(U,"mousemove",ze),Ee.input(U,"mouseleave",Fe),Ee.input(U,"mouseup",Fe),Ee.input(U,"touchstart",De,{passive:!0}),Ee.input(U,"touchmove",ze,{passive:!1}),Ee.input(U,"touchend",Fe),Ee.input(U,"touchcancel",Fe),Ee.add(window,"wheel",function(Ae){W&&f(Ae)});var Re="data-keen-slider-scrollable";c("[".concat(Re,"]:not([").concat(Re,"=false])"),z.container).map(function(Ae){return function(we){var Te;Ee.input(we,"touchstart",function(Ne){Te=he(Ne),oe=!0,ne=!0},{passive:!0}),Ee.input(we,"touchmove",function(Ne){var ke=je(),Le=ke?we.scrollHeight-we.clientHeight:we.scrollWidth-we.clientWidth,it=Te-he(Ne),ut=ke?we.scrollTop:we.scrollLeft,vt=ke&&we.style.overflowY==="scroll"||!ke&&we.style.overflowX==="scroll";if(Te=he(Ne),(it<0&&ut>0||it>0&&ut<Le)&&ne&&vt)return oe=!0;ne=!1,f(Ne),oe=!1}),Ee.input(we,"touchend",function(){oe=!1})}(Ae)})}}z.on("updated",Ue),z.on("optionsChanged",ye),z.on("created",ye),z.on("destroyed",Ee.purge)}function N(z){var U,H,te=null;function Y(q,J,ne){z.animator.active?W(q,J,ne):requestAnimationFrame(function(){return W(q,J,ne)})}function Z(){Y(!1,!1,H)}function W(q,J,ne){var oe=0,le=z.size,ue=z.track.details;if(ue&&U){var Ee=ue.slides;U.forEach(function(ze,De){if(q)!te&&J&&G(ze,null,ne),F(ze,null,ne);else{if(!Ee[De])return;var Fe=Ee[De].size*le;!te&&J&&G(ze,Fe,ne),F(ze,Ee[De].distance*le-oe,ne),oe+=Fe}})}}function ie(q){return z.options.renderMode==="performance"?Math.round(q):q}function G(q,J,ne){var oe=ne?"height":"width";J!==null&&(J=ie(J)+"px"),q.style["min-"+oe]=J,q.style["max-"+oe]=J}function F(q,J,ne){if(J!==null){J=ie(J);var oe=ne?J:0;J="translate3d(".concat(ne?0:J,"px, ").concat(oe,"px, 0)")}q.style.transform=J,q.style["-webkit-transform"]=J}function Q(){U&&(W(!0,!0,H),U=null),z.on("detailsChanged",Z,!0)}function se(){Y(!1,!0,H)}function k(){Q(),H=z.options.vertical,z.options.disabled||z.options.renderMode==="custom"||(te=E(z.options.slides,"perView",null)==="auto",z.on("detailsChanged",Z),(U=z.slides).length&&se())}z.on("created",k),z.on("optionsChanged",k),z.on("beforeOptionsChanged",function(){Q()}),z.on("updated",se),z.on("destroyed",Q)}function L(z,U){return function(H){var te,Y,Z,W,ie,G=g();function F(ve){var he;o(H.container,"reverse",(he=H.container,window.getComputedStyle(he,null).getPropertyValue("direction")!=="rtl"||ve?null:"")),o(H.container,"v",H.options.vertical&&!ve?"":null),o(H.container,"disabled",H.options.disabled&&!ve?"":null)}function Q(){se()&&oe()}function se(){var ve=null;if(W.forEach(function(je){je.matches&&(ve=je.__media)}),ve===te)return!1;te||H.emit("beforeOptionsChanged"),te=ve;var he=ve?Z.breakpoints[ve]:Z;return H.options=M(M({},Z),he),F(),De(),Fe(),ue(),!0}function k(ve){var he=S(ve);return(H.options.vertical?he.height:he.width)/H.size||1}function q(){return H.options.trackConfig.length}function J(ve){for(var he in te=!1,Z=M(M({},U),ve),G.purge(),Y=H.size,W=[],Z.breakpoints||[]){var je=window.matchMedia(he);je.__media=he,W.push(je),G.add(je,"change",Q)}G.add(window,"orientationchange",ze),G.add(window,"resize",Ee),se()}function ne(ve){H.animator.stop();var he=H.track.details;H.track.init(ve??(he?he.abs:0))}function oe(ve){ne(ve),H.emit("optionsChanged")}function le(ve,he){if(ve)return J(ve),void oe(he);De(),Fe();var je=q();ue(),q()!==je?oe(he):ne(he),H.emit("updated")}function ue(){var ve=H.options.slides;if(typeof ve=="function")return H.options.trackConfig=ve(H.size,H.slides);for(var he=H.slides,je=he.length,Ue=typeof ve=="number"?ve:E(ve,"number",je,!0),me=[],ye=E(ve,"perView",1,!0),Se=E(ve,"spacing",0,!0)/H.size||0,Re=ye==="auto"?Se:Se/ye,Ae=E(ve,"origin","auto"),we=0,Te=0;Te<Ue;Te++){var Ne=ye==="auto"?k(he[Te]):1/ye-Se+Re,ke=Ae==="center"?.5-Ne/2:Ae==="auto"?0:Ae;me.push({origin:ke,size:Ne,spacing:Se}),we+=Ne}if(we+=Se*(Ue-1),Ae==="auto"&&!H.options.loop&&ye!==1){var Le=0;me.map(function(it){var ut=we-Le;return Le+=it.size+Se,ut>=1||(it.origin=1-ut-(we>1?0:1-we)),it})}H.options.trackConfig=me}function Ee(){De();var ve=H.size;H.options.disabled||ve===Y||(Y=ve,le())}function ze(){Ee(),setTimeout(Ee,500),setTimeout(Ee,2e3)}function De(){var ve=S(H.container);H.size=(H.options.vertical?ve.height:ve.width)||1}function Fe(){H.slides=c(H.options.selector,H.container)}H.container=(ie=c(z,document)).length?ie[0]:null,H.destroy=function(){G.purge(),H.emit("destroyed"),F(!0)},H.prev=function(){H.moveToIdx(H.track.details.abs-1,!0)},H.next=function(){H.moveToIdx(H.track.details.abs+1,!0)},H.update=le,J(H.options)}}var B=function(z,U,H){try{return function(te,Y){var Z,W={};return Z={emit:function(ie){W[ie]&&W[ie].forEach(function(F){F(Z)});var G=Z.options&&Z.options[ie];G&&G(Z)},moveToIdx:function(ie,G,F){var Q=Z.track.idxToDist(ie,G);if(Q){var se=Z.options.defaultAnimation;Z.animator.start([{distance:Q,duration:E(F||se,"duration",500),easing:E(F||se,"easing",function(k){return 1+--k*k*k*k*k})}])}},on:function(ie,G,F){F===void 0&&(F=!1),W[ie]||(W[ie]=[]);var Q=W[ie].indexOf(G);Q>-1?F&&delete W[ie][Q]:F||W[ie].push(G)},options:te},function(){if(Z.track=_(Z),Z.animator=D(Z),Y)for(var ie=0,G=Y;ie<G.length;ie++)(0,G[ie])(Z);Z.track.init(Z.options.initial||0),Z.emit("created")}(),Z}(U,A([L(z,{drag:!0,mode:"snap",renderMode:"precision",rubberband:!0,selector:".keen-slider__slide"}),N,V,j],H||[],!0))}catch(te){console.error(te)}};return nx.useKeenSlider=function(z,U){var H=e.useRef(null),te=e.useRef(!1),Y=e.useRef(z),Z=e.useCallback(function(W){W?(Y.current=z,H.current=new B(W,z,U),te.current=!1):(H.current&&H.current.destroy&&H.current.destroy(),H.current=null)},[]);return e.useEffect(function(){O(Y.current,z)||(Y.current=z,H.current&&H.current.update(Y.current))},[z]),[Z,H]},nx}var EO=nK();const aK=({message:e,colorCode:t,disableCheckout:a,handleAddToCart:r,handleRemoveFromCart:o})=>{const[c,f]=x.useState({}),[m,g]=x.useState({}),p=j=>{const V=/(https?:\/\/[^\s]+)/g;return j.split(V).map((N,L)=>V.test(N)?ae.jsx("a",{href:N.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:N},L):ae.jsx("span",{children:N},L))},y=j=>{const V=j.trim();if(!V.includes("Name:")||!V.includes("VariantId"))return null;const N=V.match(/Name\s*[:\-]\s*(.+)/i),L=V.match(/Price\s*[:\-]\s*(.+)/i),B=V.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),z=V.match(/VariantId\s*[:\-]\s*(.+)/i),U=V.match(/variant_tag_name\s*[:\-]\s*(.+)/i),H=V.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!N||!L||!B||!z||!U?null:{name:N[1].trim(),price:L[1].trim(),link:B[1].trim(),image:"",variant_id:z[1].trim(),variant_tag_name:U[1].trim(),option:H?.[1]?.trim()}},S=x.useMemo(()=>{const j=e.split("|||").map(L=>L.trim()).filter(Boolean),V=[];let N=null;return j.forEach(L=>{if(L.startsWith("img - ")){const B=L.replace(/^img\s*[-:]\s*/,"").trim();if(N)N.image=B;else{const z=[...V].reverse().find(U=>U.type==="product");z&&(z.data.image=B)}}else if(L.includes("Name:")&&L.includes("VariantId")){const B=y(L);B&&(V.push({type:"product",data:B}),N=B)}else V.push({type:"text",data:L}),N=null}),V},[e]),E=x.useMemo(()=>{const j={};return S.forEach(V=>{if(V.type==="product"){const N=V.data;j[N.variant_tag_name]=j[N.variant_tag_name]||[],j[N.variant_tag_name].push(N)}}),j},[S]),T=(j,V=22)=>j.length>V?j.slice(0,V)+"...":j,[O,M]=x.useState(0),A=Object.keys(E).length,[D,_]=EO.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(j){M(j.track.details.rel)}});return ae.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[S.filter(j=>j.type==="text").map((j,V)=>ae.jsx("p",{className:"whitespace-pre-wrap break-words",children:p(j.data)},V)),Object.keys(E).length>0&&ae.jsxs(ae.Fragment,{children:[Object.keys(E).length>1&&ae.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[ae.jsx(wi,{shape:"circle",icon:ae.jsx(Gm,{}),onClick:()=>_.current?.prev(),disabled:O===0}),ae.jsx(wi,{shape:"circle",icon:ae.jsx(K1,{}),onClick:()=>_.current?.next(),disabled:O===A-1})]}),ae.jsx("div",{ref:D,className:"keen-slider",children:ae.jsx(tK,{groupedProducts:E,selectedVariants:m,setSelectedVariants:g,counts:c,setCounts:f,handleAddToCart:r,handleRemoveFromCart:o,colorCode:t,shortenName:T,sliderInstance:_,currentSlide:O,totalSlides:A,sliderRef:D,disableCheckout:a})})]})]})},U6=({message:e})=>{const t=e.find(r=>r.type==="image_url")?.image_url?.url,a=e?.isBusiness;return ae.jsx("div",{children:ae.jsx("div",{children:t&&ae.jsx("div",{className:"mb-2 bg-transparent text-white ",children:ae.jsx("img",{src:t,alt:"Chat image",style:{width:200},className:`rounded-md bg-transparent mt-2 max-w-xs ${a?"border border-gray-300 shadow-sm":""}`})})})})},rK=({message:e,colorCode:t})=>{const a=e.find(o=>o.type==="text")?.text,r=o=>{const c=/(https?:\/\/[^\s]+)/g;return o.split(c).map((f,m)=>c.test(f)?ae.jsx("a",{href:f.trim(),style:{color:t},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:f},m):ae.jsx("span",{children:f},m))};return ae.jsx(ae.Fragment,{children:a&&ae.jsx("div",{style:{color:"white",border:1,backgroundColor:t,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word"},children:ae.jsx("p",{children:r(a)})})})},iK=({link:e,colorCode:t,transcription:a})=>{const r=x.useRef(null),o=x.useRef(null),[c,f]=x.useState(!1),[m,g]=x.useState(!1);x.useEffect(()=>{if(r.current)return o.current?.destroy(),o.current=Wm.create({container:r.current,waveColor:"white",progressColor:"white",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),o.current.load(e),o.current.on("finish",()=>f(!1)),()=>{o.current?.destroy()}},[e,t]);const p=()=>{o.current&&(o.current.playPause(),f(y=>!y))};return ae.jsxs("div",{style:{backgroundColor:t,padding:"12px",borderRadius:"20px",color:"white",maxWidth:"350px",marginBottom:"16px"},children:[ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[ae.jsx("button",{onClick:p,style:{background:"transparent",border:"none",color:"white",marginRight:"12px",cursor:"pointer"},children:c?ae.jsx(uO,{style:{fontSize:"24px"}}):ae.jsx(cO,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:r,style:{width:"130px",height:"40px",overflow:"hidden",color:"white"}})]}),a&&ae.jsxs("div",{style:{marginTop:"12px",fontSize:"14px",color:"rgba(255,255,255,0.85)"},children:[ae.jsx("button",{onClick:()=>g(!m),style:{background:"none",border:"none",color:"white",textDecoration:"underline",fontSize:"13px",cursor:"pointer",padding:0},children:m?"Hide transcript":"Show transcript"}),m&&ae.jsx("p",{style:{marginTop:"6px",lineHeight:"1.4"},children:a})]})]})},oK=({status:e,user:t})=>{if(!e||!t)return null;let a=`${t} is ${e}`;return e==="typing"?a=`${t} is typing...`:a="",ae.jsx(ae.Fragment,{children:a&&ae.jsx("div",{className:"flex justify-center mb-2",children:ae.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-500 text-sm rounded-full",children:a})})})},lK=({message:e})=>{const t=r=>{const o=/(https?:\/\/[^\s]+)/g;return r?.split(o).map((c,f)=>o.test(c)?ae.jsx("a",{href:c.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:c},f):ae.jsx("span",{children:c},f))};if(e?.startsWith("Add this to cart for me")&&e?.includes("name:")){const o=e?.match(/name:([^,]+)/i)?.[1]?.trim()||"Product";return ae.jsxs("div",{style:{backgroundColor:"#E8F5E9",border:"1px solid #C8E6C9",borderRadius:"12px",padding:"12px 16px",color:"#2E7D32",fontWeight:500,fontSize:"15px",maxWidth:"360px",margin:"0 auto",textAlign:"center"},children:["✅ ",ae.jsx("strong",{children:o})," has been added to your cart."]})}return ae.jsx("p",{style:{color:"white"},children:t(e)})},wO=x.createContext({});function TO(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const OO=typeof window<"u",I6=OO?x.useLayoutEffect:x.useEffect,ax=x.createContext(null);function RO(e,t){e.indexOf(t)===-1&&e.push(t)}function AO(e,t){const a=e.indexOf(t);a>-1&&e.splice(a,1)}const Zu=(e,t,a)=>a>t?t:a<e?e:a;function MO(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var sK={};let Zm=()=>{},Ku=()=>{};sK.NODE_ENV!=="production"&&(Zm=(e,t,a)=>{!e&&typeof console<"u"&&console.warn(MO(t,a))},Ku=(e,t,a)=>{if(!e)throw new Error(MO(t,a))});const Qu={},k6=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function F6(e){return typeof e=="object"&&e!==null}const q6=e=>/^0[^.\s]+$/u.test(e);function _O(e){let t;return()=>(t===void 0&&(t=e()),t)}const Sl=e=>e,uK=(e,t)=>a=>t(e(a)),S0=(...e)=>e.reduce(uK),x0=(e,t,a)=>{const r=t-e;return r===0?1:(a-e)/r};class DO{constructor(){this.subscriptions=[]}add(t){return RO(this.subscriptions,t),()=>AO(this.subscriptions,t)}notify(t,a,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,a,r);else for(let c=0;c<o;c++){const f=this.subscriptions[c];f&&f(t,a,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const is=e=>e*1e3,Js=e=>e/1e3;function G6(e,t){return t?e*(1e3/t):0}const X6=new Set;function NO(e,t,a){e||X6.has(t)||(console.warn(MO(t,a)),X6.add(t))}const Y6=(e,t,a)=>(((1-3*a+3*t)*e+(3*a-6*t))*e+3*t)*e,cK=1e-7,fK=12;function dK(e,t,a,r,o){let c,f,m=0;do f=t+(a-t)/2,c=Y6(f,r,o)-e,c>0?a=f:t=f;while(Math.abs(c)>cK&&++m<fK);return f}function C0(e,t,a,r){if(e===t&&a===r)return Sl;const o=c=>dK(c,0,1,e,a);return c=>c===0||c===1?c:Y6(o(c),t,r)}const W6=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Z6=e=>t=>1-e(1-t),K6=C0(.33,1.53,.69,.99),$O=Z6(K6),Q6=W6($O),J6=e=>(e*=2)<1?.5*$O(e):.5*(2-Math.pow(2,-10*(e-1))),zO=e=>1-Math.sin(Math.acos(e)),ez=Z6(zO),tz=W6(zO),hK=C0(.42,0,1,1),mK=C0(0,0,.58,1),nz=C0(.42,0,.58,1),pK=e=>Array.isArray(e)&&typeof e[0]!="number",az=e=>Array.isArray(e)&&typeof e[0]=="number",rz={linear:Sl,easeIn:hK,easeInOut:nz,easeOut:mK,circIn:zO,circInOut:tz,circOut:ez,backIn:$O,backInOut:Q6,backOut:K6,anticipate:J6},gK=e=>typeof e=="string",iz=e=>{if(az(e)){Ku(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,a,r,o]=e;return C0(t,a,r,o)}else if(gK(e))return Ku(rz[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),rz[e];return e},rx=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function vK(e,t){let a=new Set,r=new Set,o=!1,c=!1;const f=new WeakSet;let m={delta:0,timestamp:0,isProcessing:!1};function g(y){f.has(y)&&(p.schedule(y),e()),y(m)}const p={schedule:(y,S=!1,E=!1)=>{const O=E&&o?a:r;return S&&f.add(y),O.has(y)||O.add(y),y},cancel:y=>{r.delete(y),f.delete(y)},process:y=>{if(m=y,o){c=!0;return}o=!0,[a,r]=[r,a],a.forEach(g),a.clear(),o=!1,c&&(c=!1,p.process(y))}};return p}const yK=40;function oz(e,t){let a=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},c=()=>a=!0,f=rx.reduce((j,V)=>(j[V]=vK(c),j),{}),{setup:m,read:g,resolveKeyframes:p,preUpdate:y,update:S,preRender:E,render:T,postRender:O}=f,M=()=>{const j=Qu.useManualTiming?o.timestamp:performance.now();a=!1,Qu.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(j-o.timestamp,yK),1)),o.timestamp=j,o.isProcessing=!0,m.process(o),g.process(o),p.process(o),y.process(o),S.process(o),E.process(o),T.process(o),O.process(o),o.isProcessing=!1,a&&t&&(r=!1,e(M))},A=()=>{a=!0,r=!0,o.isProcessing||e(M)};return{schedule:rx.reduce((j,V)=>{const N=f[V];return j[V]=(L,B=!1,z=!1)=>(a||A(),N.schedule(L,B,z)),j},{}),cancel:j=>{for(let V=0;V<rx.length;V++)f[rx[V]].cancel(j)},state:o,steps:f}}const{schedule:Pa,cancel:nf,state:ii,steps:jO}=oz(typeof requestAnimationFrame<"u"?requestAnimationFrame:Sl,!0);let ix;function bK(){ix=void 0}const yo={now:()=>(ix===void 0&&yo.set(ii.isProcessing||Qu.useManualTiming?ii.timestamp:performance.now()),ix),set:e=>{ix=e,queueMicrotask(bK)}},lz=e=>t=>typeof t=="string"&&t.startsWith(e),LO=lz("--"),SK=lz("var(--"),VO=e=>SK(e)?xK.test(e.split("/*")[0].trim()):!1,xK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Km={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},E0={...Km,transform:e=>Zu(0,1,e)},ox={...Km,default:1},w0=e=>Math.round(e*1e5)/1e5,BO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function CK(e){return e==null}const EK=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,HO=(e,t)=>a=>!!(typeof a=="string"&&EK.test(a)&&a.startsWith(e)||t&&!CK(a)&&Object.prototype.hasOwnProperty.call(a,t)),sz=(e,t,a)=>r=>{if(typeof r!="string")return r;const[o,c,f,m]=r.match(BO);return{[e]:parseFloat(o),[t]:parseFloat(c),[a]:parseFloat(f),alpha:m!==void 0?parseFloat(m):1}},wK=e=>Zu(0,255,e),PO={...Km,transform:e=>Math.round(wK(e))},Bd={test:HO("rgb","red"),parse:sz("red","green","blue"),transform:({red:e,green:t,blue:a,alpha:r=1})=>"rgba("+PO.transform(e)+", "+PO.transform(t)+", "+PO.transform(a)+", "+w0(E0.transform(r))+")"};function TK(e){let t="",a="",r="",o="";return e.length>5?(t=e.substring(1,3),a=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),a=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,a+=a,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(a,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const UO={test:HO("#"),parse:TK,transform:Bd.transform},T0=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),af=T0("deg"),eu=T0("%"),on=T0("px"),OK=T0("vh"),RK=T0("vw"),uz={...eu,parse:e=>eu.parse(e)/100,transform:e=>eu.transform(e*100)},Qm={test:HO("hsl","hue"),parse:sz("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:a,alpha:r=1})=>"hsla("+Math.round(e)+", "+eu.transform(w0(t))+", "+eu.transform(w0(a))+", "+w0(E0.transform(r))+")"},xr={test:e=>Bd.test(e)||UO.test(e)||Qm.test(e),parse:e=>Bd.test(e)?Bd.parse(e):Qm.test(e)?Qm.parse(e):UO.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Bd.transform(e):Qm.transform(e),getAnimatableNone:e=>{const t=xr.parse(e);return t.alpha=0,xr.transform(t)}},AK=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function MK(e){return isNaN(e)&&typeof e=="string"&&(e.match(BO)?.length||0)+(e.match(AK)?.length||0)>0}const cz="number",fz="color",_K="var",DK="var(",dz="${}",NK=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function O0(e){const t=e.toString(),a=[],r={color:[],number:[],var:[]},o=[];let c=0;const m=t.replace(NK,g=>(xr.test(g)?(r.color.push(c),o.push(fz),a.push(xr.parse(g))):g.startsWith(DK)?(r.var.push(c),o.push(_K),a.push(g)):(r.number.push(c),o.push(cz),a.push(parseFloat(g))),++c,dz)).split(dz);return{values:a,split:m,indexes:r,types:o}}function hz(e){return O0(e).values}function mz(e){const{split:t,types:a}=O0(e),r=t.length;return o=>{let c="";for(let f=0;f<r;f++)if(c+=t[f],o[f]!==void 0){const m=a[f];m===cz?c+=w0(o[f]):m===fz?c+=xr.transform(o[f]):c+=o[f]}return c}}const $K=e=>typeof e=="number"?0:xr.test(e)?xr.getAnimatableNone(e):e;function zK(e){const t=hz(e);return mz(e)(t.map($K))}const rf={test:MK,parse:hz,createTransformer:mz,getAnimatableNone:zK};function IO(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+(t-e)*6*a:a<1/2?t:a<2/3?e+(t-e)*(2/3-a)*6:e}function jK({hue:e,saturation:t,lightness:a,alpha:r}){e/=360,t/=100,a/=100;let o=0,c=0,f=0;if(!t)o=c=f=a;else{const m=a<.5?a*(1+t):a+t-a*t,g=2*a-m;o=IO(g,m,e+1/3),c=IO(g,m,e),f=IO(g,m,e-1/3)}return{red:Math.round(o*255),green:Math.round(c*255),blue:Math.round(f*255),alpha:r}}function lx(e,t){return a=>a>0?t:e}const Za=(e,t,a)=>e+(t-e)*a,kO=(e,t,a)=>{const r=e*e,o=a*(t*t-r)+r;return o<0?0:Math.sqrt(o)},LK=[UO,Bd,Qm],VK=e=>LK.find(t=>t.test(e));function pz(e){const t=VK(e);if(Zm(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let a=t.parse(e);return t===Qm&&(a=jK(a)),a}const gz=(e,t)=>{const a=pz(e),r=pz(t);if(!a||!r)return lx(e,t);const o={...a};return c=>(o.red=kO(a.red,r.red,c),o.green=kO(a.green,r.green,c),o.blue=kO(a.blue,r.blue,c),o.alpha=Za(a.alpha,r.alpha,c),Bd.transform(o))},FO=new Set(["none","hidden"]);function BK(e,t){return FO.has(e)?a=>a<=0?e:t:a=>a>=1?t:e}function HK(e,t){return a=>Za(e,t,a)}function qO(e){return typeof e=="number"?HK:typeof e=="string"?VO(e)?lx:xr.test(e)?gz:IK:Array.isArray(e)?vz:typeof e=="object"?xr.test(e)?gz:PK:lx}function vz(e,t){const a=[...e],r=a.length,o=e.map((c,f)=>qO(c)(c,t[f]));return c=>{for(let f=0;f<r;f++)a[f]=o[f](c);return a}}function PK(e,t){const a={...e,...t},r={};for(const o in a)e[o]!==void 0&&t[o]!==void 0&&(r[o]=qO(e[o])(e[o],t[o]));return o=>{for(const c in r)a[c]=r[c](o);return a}}function UK(e,t){const a=[],r={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const c=t.types[o],f=e.indexes[c][r[c]],m=e.values[f]??0;a[o]=m,r[c]++}return a}const IK=(e,t)=>{const a=rf.createTransformer(t),r=O0(e),o=O0(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?FO.has(e)&&!o.values.length||FO.has(t)&&!r.values.length?BK(e,t):S0(vz(UK(r,o),o.values),a):(Zm(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),lx(e,t))};function yz(e,t,a){return typeof e=="number"&&typeof t=="number"&&typeof a=="number"?Za(e,t,a):qO(e)(e,t)}const kK=e=>{const t=({timestamp:a})=>e(a);return{start:(a=!0)=>Pa.update(t,a),stop:()=>nf(t),now:()=>ii.isProcessing?ii.timestamp:yo.now()}},bz=(e,t,a=10)=>{let r="";const o=Math.max(Math.round(t/a),2);for(let c=0;c<o;c++)r+=Math.round(e(c/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},sx=2e4;function GO(e){let t=0;const a=50;let r=e.next(t);for(;!r.done&&t<sx;)t+=a,r=e.next(t);return t>=sx?1/0:t}function FK(e,t=100,a){const r=a({...e,keyframes:[0,t]}),o=Math.min(GO(r),sx);return{type:"keyframes",ease:c=>r.next(o*c).value/t,duration:Js(o)}}const qK=5;function Sz(e,t,a){const r=Math.max(t-qK,0);return G6(a-e(r),t-r)}const Ka={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},XO=.001;function GK({duration:e=Ka.duration,bounce:t=Ka.bounce,velocity:a=Ka.velocity,mass:r=Ka.mass}){let o,c;Zm(e<=is(Ka.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let f=1-t;f=Zu(Ka.minDamping,Ka.maxDamping,f),e=Zu(Ka.minDuration,Ka.maxDuration,Js(e)),f<1?(o=p=>{const y=p*f,S=y*e,E=y-a,T=YO(p,f),O=Math.exp(-S);return XO-E/T*O},c=p=>{const S=p*f*e,E=S*a+a,T=Math.pow(f,2)*Math.pow(p,2)*e,O=Math.exp(-S),M=YO(Math.pow(p,2),f);return(-o(p)+XO>0?-1:1)*((E-T)*O)/M}):(o=p=>{const y=Math.exp(-p*e),S=(p-a)*e+1;return-XO+y*S},c=p=>{const y=Math.exp(-p*e),S=(a-p)*(e*e);return y*S});const m=5/e,g=YK(o,c,m);if(e=is(e),isNaN(g))return{stiffness:Ka.stiffness,damping:Ka.damping,duration:e};{const p=Math.pow(g,2)*r;return{stiffness:p,damping:f*2*Math.sqrt(r*p),duration:e}}}const XK=12;function YK(e,t,a){let r=a;for(let o=1;o<XK;o++)r=r-e(r)/t(r);return r}function YO(e,t){return e*Math.sqrt(1-t*t)}const WK=["duration","bounce"],ZK=["stiffness","damping","mass"];function xz(e,t){return t.some(a=>e[a]!==void 0)}function KK(e){let t={velocity:Ka.velocity,stiffness:Ka.stiffness,damping:Ka.damping,mass:Ka.mass,isResolvedFromDuration:!1,...e};if(!xz(e,ZK)&&xz(e,WK))if(e.visualDuration){const a=e.visualDuration,r=2*Math.PI/(a*1.2),o=r*r,c=2*Zu(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Ka.mass,stiffness:o,damping:c}}else{const a=GK(e);t={...t,...a,mass:Ka.mass},t.isResolvedFromDuration=!0}return t}function ux(e=Ka.visualDuration,t=Ka.bounce){const a=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=a;const c=a.keyframes[0],f=a.keyframes[a.keyframes.length-1],m={done:!1,value:c},{stiffness:g,damping:p,mass:y,duration:S,velocity:E,isResolvedFromDuration:T}=KK({...a,velocity:-Js(a.velocity||0)}),O=E||0,M=p/(2*Math.sqrt(g*y)),A=f-c,D=Js(Math.sqrt(g/y)),_=Math.abs(A)<5;r||(r=_?Ka.restSpeed.granular:Ka.restSpeed.default),o||(o=_?Ka.restDelta.granular:Ka.restDelta.default);let j;if(M<1){const N=YO(D,M);j=L=>{const B=Math.exp(-M*D*L);return f-B*((O+M*D*A)/N*Math.sin(N*L)+A*Math.cos(N*L))}}else if(M===1)j=N=>f-Math.exp(-D*N)*(A+(O+D*A)*N);else{const N=D*Math.sqrt(M*M-1);j=L=>{const B=Math.exp(-M*D*L),z=Math.min(N*L,300);return f-B*((O+M*D*A)*Math.sinh(z)+N*A*Math.cosh(z))/N}}const V={calculatedDuration:T&&S||null,next:N=>{const L=j(N);if(T)m.done=N>=S;else{let B=N===0?O:0;M<1&&(B=N===0?is(O):Sz(j,N,L));const z=Math.abs(B)<=r,U=Math.abs(f-L)<=o;m.done=z&&U}return m.value=m.done?f:L,m},toString:()=>{const N=Math.min(GO(V),sx),L=bz(B=>V.next(N*B).value,N,30);return N+"ms "+L},toTransition:()=>{}};return V}ux.applyToOptions=e=>{const t=FK(e,100,ux);return e.ease=t.ease,e.duration=is(t.duration),e.type="keyframes",e};function WO({keyframes:e,velocity:t=0,power:a=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:c=500,modifyTarget:f,min:m,max:g,restDelta:p=.5,restSpeed:y}){const S=e[0],E={done:!1,value:S},T=z=>m!==void 0&&z<m||g!==void 0&&z>g,O=z=>m===void 0?g:g===void 0||Math.abs(m-z)<Math.abs(g-z)?m:g;let M=a*t;const A=S+M,D=f===void 0?A:f(A);D!==A&&(M=D-S);const _=z=>-M*Math.exp(-z/r),j=z=>D+_(z),V=z=>{const U=_(z),H=j(z);E.done=Math.abs(U)<=p,E.value=E.done?D:H};let N,L;const B=z=>{T(E.value)&&(N=z,L=ux({keyframes:[E.value,O(E.value)],velocity:Sz(j,z,E.value),damping:o,stiffness:c,restDelta:p,restSpeed:y}))};return B(0),{calculatedDuration:null,next:z=>{let U=!1;return!L&&N===void 0&&(U=!0,V(z),B(z)),N!==void 0&&z>=N?L.next(z-N):(!U&&V(z),E)}}}function QK(e,t,a){const r=[],o=a||Qu.mix||yz,c=e.length-1;for(let f=0;f<c;f++){let m=o(e[f],e[f+1]);if(t){const g=Array.isArray(t)?t[f]||Sl:t;m=S0(g,m)}r.push(m)}return r}function JK(e,t,{clamp:a=!0,ease:r,mixer:o}={}){const c=e.length;if(Ku(c===t.length,"Both input and output ranges must be the same length","range-length"),c===1)return()=>t[0];if(c===2&&t[0]===t[1])return()=>t[1];const f=e[0]===e[1];e[0]>e[c-1]&&(e=[...e].reverse(),t=[...t].reverse());const m=QK(t,r,o),g=m.length,p=y=>{if(f&&y<e[0])return t[0];let S=0;if(g>1)for(;S<e.length-2&&!(y<e[S+1]);S++);const E=x0(e[S],e[S+1],y);return m[S](E)};return a?y=>p(Zu(e[0],e[c-1],y)):p}function eQ(e,t){const a=e[e.length-1];for(let r=1;r<=t;r++){const o=x0(0,t,r);e.push(Za(a,1,o))}}function tQ(e){const t=[0];return eQ(t,e.length-1),t}function nQ(e,t){return e.map(a=>a*t)}function aQ(e,t){return e.map(()=>t||nz).splice(0,e.length-1)}function Jm({duration:e=300,keyframes:t,times:a,ease:r="easeInOut"}){const o=pK(r)?r.map(iz):iz(r),c={done:!1,value:t[0]},f=nQ(a&&a.length===t.length?a:tQ(t),e),m=JK(f,t,{ease:Array.isArray(o)?o:aQ(t,o)});return{calculatedDuration:e,next:g=>(c.value=m(g),c.done=g>=e,c)}}const rQ=e=>e!==null;function ZO(e,{repeat:t,repeatType:a="loop"},r,o=1){const c=e.filter(rQ),m=o<0||t&&a!=="loop"&&t%2===1?0:c.length-1;return!m||r===void 0?c[m]:r}const iQ={decay:WO,inertia:WO,tween:Jm,keyframes:Jm,spring:ux};function Cz(e){typeof e.type=="string"&&(e.type=iQ[e.type])}class KO{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,a){return this.finished.then(t,a)}}var oQ={};const lQ=e=>e/100;class QO extends KO{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:a}=this.options;a&&a.updatedAt!==yo.now()&&this.tick(yo.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Cz(t);const{type:a=Jm,repeat:r=0,repeatDelay:o=0,repeatType:c,velocity:f=0}=t;let{keyframes:m}=t;const g=a||Jm;oQ.NODE_ENV!=="production"&&g!==Jm&&Ku(m.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${m}`,"spring-two-frames"),g!==Jm&&typeof m[0]!="number"&&(this.mixKeyframes=S0(lQ,yz(m[0],m[1])),m=[0,100]);const p=g({...t,keyframes:m});c==="mirror"&&(this.mirroredGenerator=g({...t,keyframes:[...m].reverse(),velocity:-f})),p.calculatedDuration===null&&(p.calculatedDuration=GO(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=p}updateTime(t){const a=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=a}tick(t,a=!1){const{generator:r,totalDuration:o,mixKeyframes:c,mirroredGenerator:f,resolvedDuration:m,calculatedDuration:g}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:y,repeat:S,repeatType:E,repeatDelay:T,type:O,onUpdate:M,finalKeyframe:A}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),a?this.currentTime=t:this.updateTime(t);const D=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?D<0:D>o;this.currentTime=Math.max(D,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let j=this.currentTime,V=r;if(S){const z=Math.min(this.currentTime,o)/m;let U=Math.floor(z),H=z%1;!H&&z>=1&&(H=1),H===1&&U--,U=Math.min(U,S+1),!!(U%2)&&(E==="reverse"?(H=1-H,T&&(H-=T/m)):E==="mirror"&&(V=f)),j=Zu(0,1,H)*m}const N=_?{done:!1,value:y[0]}:V.next(j);c&&(N.value=c(N.value));let{done:L}=N;!_&&g!==null&&(L=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&L);return B&&O!==WO&&(N.value=ZO(y,this.options,A,this.speed)),M&&M(N.value),B&&this.finish(),N}then(t,a){return this.finished.then(t,a)}get duration(){return Js(this.calculatedDuration)}get time(){return Js(this.currentTime)}set time(t){t=is(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(yo.now());const a=this.playbackSpeed!==t;this.playbackSpeed=t,a&&(this.time=Js(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=kK,startTime:a}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=a??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(yo.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function sQ(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Hd=e=>e*180/Math.PI,JO=e=>{const t=Hd(Math.atan2(e[1],e[0]));return eR(t)},uQ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:JO,rotateZ:JO,skewX:e=>Hd(Math.atan(e[1])),skewY:e=>Hd(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},eR=e=>(e=e%360,e<0&&(e+=360),e),Ez=JO,wz=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Tz=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),cQ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:wz,scaleY:Tz,scale:e=>(wz(e)+Tz(e))/2,rotateX:e=>eR(Hd(Math.atan2(e[6],e[5]))),rotateY:e=>eR(Hd(Math.atan2(-e[2],e[0]))),rotateZ:Ez,rotate:Ez,skewX:e=>Hd(Math.atan(e[4])),skewY:e=>Hd(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function tR(e){return e.includes("scale")?1:0}function nR(e,t){if(!e||e==="none")return tR(t);const a=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(a)r=cQ,o=a;else{const m=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=uQ,o=m}if(!o)return tR(t);const c=r[t],f=o[1].split(",").map(dQ);return typeof c=="function"?c(f):f[c]}const fQ=(e,t)=>{const{transform:a="none"}=getComputedStyle(e);return nR(a,t)};function dQ(e){return parseFloat(e.trim())}const ep=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],tp=new Set(ep),Oz=e=>e===Km||e===on,hQ=new Set(["x","y","z"]),mQ=ep.filter(e=>!hQ.has(e));function pQ(e){const t=[];return mQ.forEach(a=>{const r=e.getValue(a);r!==void 0&&(t.push([a,r.get()]),r.set(a.startsWith("scale")?1:0))}),t}const Pd={width:({x:e},{paddingLeft:t="0",paddingRight:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),height:({y:e},{paddingTop:t="0",paddingBottom:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>nR(t,"x"),y:(e,{transform:t})=>nR(t,"y")};Pd.translateX=Pd.x,Pd.translateY=Pd.y;const Ud=new Set;let aR=!1,rR=!1,iR=!1;function Rz(){if(rR){const e=Array.from(Ud).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),a=new Map;t.forEach(r=>{const o=pQ(r);o.length&&(a.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const o=a.get(r);o&&o.forEach(([c,f])=>{r.getValue(c)?.set(f)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}rR=!1,aR=!1,Ud.forEach(e=>e.complete(iR)),Ud.clear()}function Az(){Ud.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(rR=!0)})}function gQ(){iR=!0,Az(),Rz(),iR=!1}class oR{constructor(t,a,r,o,c,f=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=a,this.name=r,this.motionValue=o,this.element=c,this.isAsync=f}scheduleResolve(){this.state="scheduled",this.isAsync?(Ud.add(this),aR||(aR=!0,Pa.read(Az),Pa.resolveKeyframes(Rz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:a,element:r,motionValue:o}=this;if(t[0]===null){const c=o?.get(),f=t[t.length-1];if(c!==void 0)t[0]=c;else if(r&&a){const m=r.readValue(a,f);m!=null&&(t[0]=m)}t[0]===void 0&&(t[0]=f),o&&c===void 0&&o.set(t[0])}sQ(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ud.delete(this)}cancel(){this.state==="scheduled"&&(Ud.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const vQ=e=>e.startsWith("--");function yQ(e,t,a){vQ(t)?e.style.setProperty(t,a):e.style[t]=a}const bQ=_O(()=>window.ScrollTimeline!==void 0),SQ={};function xQ(e,t){const a=_O(e);return()=>SQ[t]??a()}const Mz=xQ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),R0=([e,t,a,r])=>`cubic-bezier(${e}, ${t}, ${a}, ${r})`,_z={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:R0([0,.65,.55,1]),circOut:R0([.55,0,1,.45]),backIn:R0([.31,.01,.66,-.59]),backOut:R0([.33,1.53,.69,.99])};function Dz(e,t){if(e)return typeof e=="function"?Mz()?bz(e,t):"ease-out":az(e)?R0(e):Array.isArray(e)?e.map(a=>Dz(a,t)||_z.easeOut):_z[e]}function CQ(e,t,a,{delay:r=0,duration:o=300,repeat:c=0,repeatType:f="loop",ease:m="easeOut",times:g}={},p=void 0){const y={[t]:a};g&&(y.offset=g);const S=Dz(m,o);Array.isArray(S)&&(y.easing=S);const E={delay:r,duration:o,easing:Array.isArray(S)?"linear":S,fill:"both",iterations:c+1,direction:f==="reverse"?"alternate":"normal"};return p&&(E.pseudoElement=p),e.animate(y,E)}function Nz(e){return typeof e=="function"&&"applyToOptions"in e}function EQ({type:e,...t}){return Nz(e)&&Mz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class wQ extends KO{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:a,name:r,keyframes:o,pseudoElement:c,allowFlatten:f=!1,finalKeyframe:m,onComplete:g}=t;this.isPseudoElement=!!c,this.allowFlatten=f,this.options=t,Ku(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const p=EQ(t);this.animation=CQ(a,r,o,p,c),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const y=ZO(o,this.options,m,this.speed);this.updateMotionValue?this.updateMotionValue(y):yQ(a,r,y),this.animation.cancel()}g?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Js(Number(t))}get time(){return Js(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=is(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:a}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&bQ()?(this.animation.timeline=t,Sl):a(this)}}const $z={anticipate:J6,backInOut:Q6,circInOut:tz};function TQ(e){return e in $z}function OQ(e){typeof e.ease=="string"&&TQ(e.ease)&&(e.ease=$z[e.ease])}const zz=10;class RQ extends wQ{constructor(t){OQ(t),Cz(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:a,onUpdate:r,onComplete:o,element:c,...f}=this.options;if(!a)return;if(t!==void 0){a.set(t);return}const m=new QO({...f,autoplay:!1}),g=is(this.finishedTime??this.time);a.setWithVelocity(m.sample(g-zz).value,m.sample(g).value,zz),m.stop()}}const jz=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(rf.test(e)||e==="0")&&!e.startsWith("url("));function AQ(e){const t=e[0];if(e.length===1)return!0;for(let a=0;a<e.length;a++)if(e[a]!==t)return!0}function MQ(e,t,a,r){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const c=e[e.length-1],f=jz(o,t),m=jz(c,t);return Zm(f===m,`You are trying to animate ${t} from "${o}" to "${c}". "${f?c:o}" is not an animatable value.`,"value-not-animatable"),!f||!m?!1:AQ(e)||(a==="spring"||Nz(a))&&r}const _Q=new Set(["opacity","clipPath","filter","transform"]),DQ=_O(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function NQ(e){const{motionValue:t,name:a,repeatDelay:r,repeatType:o,damping:c,type:f}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:g,transformTemplate:p}=t.owner.getProps();return DQ()&&a&&_Q.has(a)&&(a!=="transform"||!p)&&!g&&!r&&o!=="mirror"&&c!==0&&f!=="inertia"}const $Q=40;class zQ extends KO{constructor({autoplay:t=!0,delay:a=0,type:r="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:f="loop",keyframes:m,name:g,motionValue:p,element:y,...S}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=yo.now();const E={autoplay:t,delay:a,type:r,repeat:o,repeatDelay:c,repeatType:f,name:g,motionValue:p,element:y,...S},T=y?.KeyframeResolver||oR;this.keyframeResolver=new T(m,(O,M,A)=>this.onKeyframesResolved(O,M,E,!A),g,p,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,a,r,o){this.keyframeResolver=void 0;const{name:c,type:f,velocity:m,delay:g,isHandoff:p,onUpdate:y}=r;this.resolvedAt=yo.now(),MQ(t,c,f,m)||((Qu.instantAnimations||!g)&&y?.(ZO(t,r,a)),t[0]=t[t.length-1],r.duration=0,r.repeat=0);const E={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>$Q?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:a,...r,keyframes:t},T=!p&&NQ(E)?new RQ({...E,element:E.motionValue.owner.current}):new QO(E);T.finished.then(()=>this.notifyFinished()).catch(Sl),this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this.animation.finished:this._finished}then(t,a){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),gQ()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const jQ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LQ(e){const t=jQ.exec(e);if(!t)return[,];const[,a,r,o]=t;return[`--${a??r}`,o]}const VQ=4;function Lz(e,t,a=1){Ku(a<=VQ,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,o]=LQ(e);if(!r)return;const c=window.getComputedStyle(t).getPropertyValue(r);if(c){const f=c.trim();return k6(f)?parseFloat(f):f}return VO(o)?Lz(o,t,a+1):o}function lR(e,t){return e?.[t]??e?.default??e}const Vz=new Set(["width","height","top","left","right","bottom",...ep]),BQ={test:e=>e==="auto",parse:e=>e},Bz=e=>t=>t.test(e),Hz=[Km,on,eu,af,RK,OK,BQ],Pz=e=>Hz.find(Bz(e));function HQ(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||q6(e):!0}const PQ=new Set(["brightness","contrast","saturate","opacity"]);function UQ(e){const[t,a]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=a.match(BO)||[];if(!r)return e;const o=a.replace(r,"");let c=PQ.has(t)?1:0;return r!==a&&(c*=100),t+"("+c+o+")"}const IQ=/\b([a-z-]*)\(.*?\)/gu,sR={...rf,getAnimatableNone:e=>{const t=e.match(IQ);return t?t.map(UQ).join(" "):e}},Uz={...Km,transform:Math.round},uR={borderWidth:on,borderTopWidth:on,borderRightWidth:on,borderBottomWidth:on,borderLeftWidth:on,borderRadius:on,radius:on,borderTopLeftRadius:on,borderTopRightRadius:on,borderBottomRightRadius:on,borderBottomLeftRadius:on,width:on,maxWidth:on,height:on,maxHeight:on,top:on,right:on,bottom:on,left:on,padding:on,paddingTop:on,paddingRight:on,paddingBottom:on,paddingLeft:on,margin:on,marginTop:on,marginRight:on,marginBottom:on,marginLeft:on,backgroundPositionX:on,backgroundPositionY:on,...{rotate:af,rotateX:af,rotateY:af,rotateZ:af,scale:ox,scaleX:ox,scaleY:ox,scaleZ:ox,skew:af,skewX:af,skewY:af,distance:on,translateX:on,translateY:on,translateZ:on,x:on,y:on,z:on,perspective:on,transformPerspective:on,opacity:E0,originX:uz,originY:uz,originZ:on},zIndex:Uz,fillOpacity:E0,strokeOpacity:E0,numOctaves:Uz},kQ={...uR,color:xr,backgroundColor:xr,outlineColor:xr,fill:xr,stroke:xr,borderColor:xr,borderTopColor:xr,borderRightColor:xr,borderBottomColor:xr,borderLeftColor:xr,filter:sR,WebkitFilter:sR},Iz=e=>kQ[e];function kz(e,t){let a=Iz(e);return a!==sR&&(a=rf),a.getAnimatableNone?a.getAnimatableNone(t):void 0}const FQ=new Set(["auto","none","0"]);function qQ(e,t,a){let r=0,o;for(;r<e.length&&!o;){const c=e[r];typeof c=="string"&&!FQ.has(c)&&O0(c).values.length&&(o=e[r]),r++}if(o&&a)for(const c of t)e[c]=kz(a,o)}class GQ extends oR{constructor(t,a,r,o,c){super(t,a,r,o,c,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:a,name:r}=this;if(!a||!a.current)return;super.readKeyframes();for(let g=0;g<t.length;g++){let p=t[g];if(typeof p=="string"&&(p=p.trim(),VO(p))){const y=Lz(p,a.current);y!==void 0&&(t[g]=y),g===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!Vz.has(r)||t.length!==2)return;const[o,c]=t,f=Pz(o),m=Pz(c);if(f!==m)if(Oz(f)&&Oz(m))for(let g=0;g<t.length;g++){const p=t[g];typeof p=="string"&&(t[g]=parseFloat(p))}else Pd[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:a}=this,r=[];for(let o=0;o<t.length;o++)(t[o]===null||HQ(t[o]))&&r.push(o);r.length&&qQ(t,r,a)}measureInitialState(){const{element:t,unresolvedKeyframes:a,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Pd[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a[0]=this.measuredOrigin;const o=a[a.length-1];o!==void 0&&t.getValue(r,o).jump(o,!1)}measureEndState(){const{element:t,name:a,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const o=t.getValue(a);o&&o.jump(this.measuredOrigin,!1);const c=r.length-1,f=r[c];r[c]=Pd[a](t.measureViewportBox(),window.getComputedStyle(t.current)),f!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=f),this.removedTransforms?.length&&this.removedTransforms.forEach(([m,g])=>{t.getValue(m).set(g)}),this.resolveNoneKeyframes()}}function XQ(e,t,a){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const o=a?.[e]??r.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}const Fz=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function qz(e){return F6(e)&&"offsetHeight"in e}var YQ={};const Gz=30,WQ=e=>!isNaN(parseFloat(e));class ZQ{constructor(t,a={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,o=!0)=>{const c=yo.now();if(this.updatedAt!==c&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const f of this.dependents)f.dirty();o&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=a.owner}setCurrent(t){this.current=t,this.updatedAt=yo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=WQ(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return YQ.NODE_ENV!=="production"&&NO(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,a){this.events[t]||(this.events[t]=new DO);const r=this.events[t].add(a);return t==="change"?()=>{r(),Pa.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,a){this.passiveEffect=t,this.stopPassiveEffect=a}set(t,a=!0){!a||!this.passiveEffect?this.updateAndNotify(t,a):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,a,r){this.set(a),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,a=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,a&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=yo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Gz)return 0;const a=Math.min(this.updatedAt-this.prevUpdatedAt,Gz);return G6(parseFloat(this.current)-parseFloat(this.prevFrameValue),a)}start(t){return this.stop(),new Promise(a=>{this.hasAnimated=!0,this.animation=t(a),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function np(e,t){return new ZQ(e,t)}const{schedule:cR}=oz(queueMicrotask,!1),os={x:!1,y:!1};function Xz(){return os.x||os.y}function KQ(e){return e==="x"||e==="y"?os[e]?null:(os[e]=!0,()=>{os[e]=!1}):os.x||os.y?null:(os.x=os.y=!0,()=>{os.x=os.y=!1})}function Yz(e,t){const a=XQ(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[a,o,()=>r.abort()]}function Wz(e){return!(e.pointerType==="touch"||Xz())}function QQ(e,t,a={}){const[r,o,c]=Yz(e,a),f=m=>{if(!Wz(m))return;const{target:g}=m,p=t(g,m);if(typeof p!="function"||!g)return;const y=S=>{Wz(S)&&(p(S),g.removeEventListener("pointerleave",y))};g.addEventListener("pointerleave",y,o)};return r.forEach(m=>{m.addEventListener("pointerenter",f,o)}),c}const Zz=(e,t)=>t?e===t?!0:Zz(e,t.parentElement):!1,fR=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,JQ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function eJ(e){return JQ.has(e.tagName)||e.tabIndex!==-1}const cx=new WeakSet;function Kz(e){return t=>{t.key==="Enter"&&e(t)}}function dR(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const tJ=(e,t)=>{const a=e.currentTarget;if(!a)return;const r=Kz(()=>{if(cx.has(a))return;dR(a,"down");const o=Kz(()=>{dR(a,"up")}),c=()=>dR(a,"cancel");a.addEventListener("keyup",o,t),a.addEventListener("blur",c,t)});a.addEventListener("keydown",r,t),a.addEventListener("blur",()=>a.removeEventListener("keydown",r),t)};function Qz(e){return fR(e)&&!Xz()}function nJ(e,t,a={}){const[r,o,c]=Yz(e,a),f=m=>{const g=m.currentTarget;if(!Qz(m))return;cx.add(g);const p=t(g,m),y=(T,O)=>{window.removeEventListener("pointerup",S),window.removeEventListener("pointercancel",E),cx.has(g)&&cx.delete(g),Qz(T)&&typeof p=="function"&&p(T,{success:O})},S=T=>{y(T,g===window||g===document||a.useGlobalTarget||Zz(g,T.target))},E=T=>{y(T,!1)};window.addEventListener("pointerup",S,o),window.addEventListener("pointercancel",E,o)};return r.forEach(m=>{(a.useGlobalTarget?window:m).addEventListener("pointerdown",f,o),qz(m)&&(m.addEventListener("focus",p=>tJ(p,o)),!eJ(m)&&!m.hasAttribute("tabindex")&&(m.tabIndex=0))}),c}function Jz(e){return F6(e)&&"ownerSVGElement"in e}function aJ(e){return Jz(e)&&e.tagName==="svg"}const Ti=e=>!!(e&&e.getVelocity),rJ=[...Hz,xr,rf],iJ=e=>rJ.find(Bz(e)),hR=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class oJ extends x.Component{getSnapshotBeforeUpdate(t){const a=this.props.childRef.current;if(a&&t.isPresent&&!this.props.isPresent){const r=a.offsetParent,o=qz(r)&&r.offsetWidth||0,c=this.props.sizeRef.current;c.height=a.offsetHeight||0,c.width=a.offsetWidth||0,c.top=a.offsetTop,c.left=a.offsetLeft,c.right=o-c.width-c.left}return null}componentDidUpdate(){}render(){return this.props.children}}function lJ({children:e,isPresent:t,anchorX:a,root:r}){const o=x.useId(),c=x.useRef(null),f=x.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:m}=x.useContext(hR);return x.useInsertionEffect(()=>{const{width:g,height:p,top:y,left:S,right:E}=f.current;if(t||!c.current||!g||!p)return;const T=a==="left"?`left: ${S}`:`right: ${E}`;c.current.dataset.motionPopId=o;const O=document.createElement("style");m&&(O.nonce=m);const M=r??document.head;return M.appendChild(O),O.sheet&&O.sheet.insertRule(`
644
+ `,[t,a]}setOptions(t){if(this.options.container!==t.container){const a=this.parentFromOptionsContainer(t.container);a.appendChild(this.container),this.parent=a}t.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:a}=this.scrollContainer,r=a*t;this.setScroll(r)}destroy(){var t,a;this.subscriptions.forEach(r=>r()),this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(a=this.unsubscribeOnScroll)===null||a===void 0||a.forEach(r=>r()),this.unsubscribeOnScroll=[]}createDelay(t=10){let a,r;const o=()=>{a&&clearTimeout(a),r&&r()};return this.timeouts.push(o),()=>new Promise((c,f)=>{o(),r=f,a=setTimeout(()=>{a=void 0,r=void 0,c()},t)})}convertColorValues(t){if(!Array.isArray(t))return t||"";if(t.length<2)return t[0]||"";const a=document.createElement("canvas"),r=a.getContext("2d"),o=a.height*(window.devicePixelRatio||1),c=r.createLinearGradient(0,0,0,o),f=1/(t.length-1);return t.forEach((m,g)=>{const p=g*f;c.addColorStop(p,m)}),c}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(t,a,r,o){const c=t[0],f=t[1]||t[0],m=c.length,{width:g,height:p}=r.canvas,y=p/2,S=this.getPixelRatio(),E=a.barWidth?a.barWidth*S:1,T=a.barGap?a.barGap*S:a.barWidth?E/2:0,O=a.barRadius||0,M=g/(E+T)/m,A=O&&"roundRect"in r?"roundRect":"rect";r.beginPath();let D=0,_=0,j=0;for(let V=0;V<=m;V++){const N=Math.round(V*M);if(N>D){const z=Math.round(_*y*o),U=z+Math.round(j*y*o)||1;let H=y-z;a.barAlign==="top"?H=0:a.barAlign==="bottom"&&(H=p-U),r[A](D*(E+T),H,E,U,O),D=N,_=0,j=0}const L=Math.abs(c[V]||0),B=Math.abs(f[V]||0);L>_&&(_=L),B>j&&(j=B)}r.fill(),r.closePath()}renderLineWaveform(t,a,r,o){const c=f=>{const m=t[f]||t[0],g=m.length,{height:p}=r.canvas,y=p/2,S=r.canvas.width/g;r.moveTo(0,y);let E=0,T=0;for(let O=0;O<=g;O++){const M=Math.round(O*S);if(M>E){const D=y+(Math.round(T*y*o)||1)*(f===0?-1:1);r.lineTo(E,D),E=M,T=0}const A=Math.abs(m[O]||0);A>T&&(T=A)}r.lineTo(E,y)};r.beginPath(),c(0),c(1),r.fill(),r.closePath()}renderWaveform(t,a,r){if(r.fillStyle=this.convertColorValues(a.waveColor),a.renderFunction)return void a.renderFunction(t,r);let o=a.barHeight||1;if(a.normalize){const c=Array.from(t[0]).reduce((f,m)=>Math.max(f,Math.abs(m)),0);o=c?1/c:1}a.barWidth||a.barGap||a.barAlign?this.renderBarWaveform(t,a,r,o):this.renderLineWaveform(t,a,r,o)}renderSingleCanvas(t,a,r,o,c,f,m){const g=this.getPixelRatio(),p=document.createElement("canvas");p.width=Math.round(r*g),p.height=Math.round(o*g),p.style.width=`${r}px`,p.style.height=`${o}px`,p.style.left=`${Math.round(c)}px`,f.appendChild(p);const y=p.getContext("2d");if(this.renderWaveform(t,a,y),p.width>0&&p.height>0){const S=p.cloneNode(),E=S.getContext("2d");E.drawImage(p,0,0),E.globalCompositeOperation="source-in",E.fillStyle=this.convertColorValues(a.progressColor),E.fillRect(0,0,p.width,p.height),m.appendChild(S)}}renderMultiCanvas(t,a,r,o,c,f){const m=this.getPixelRatio(),{clientWidth:g}=this.scrollContainer,p=r/m;let y=Math.min(Ym.MAX_CANVAS_WIDTH,g,p),S={};if(a.barWidth||a.barGap){const A=a.barWidth||.5,D=A+(a.barGap||A/2);y%D!=0&&(y=Math.floor(y/D)*D)}if(y===0)return;const E=A=>{if(A<0||A>=T||S[A])return;S[A]=!0;const D=A*y;let _=Math.min(p-D,y);if(a.barWidth||a.barGap){const V=a.barWidth||.5,N=V+(a.barGap||V/2);_=Math.floor(_/N)*N}if(_<=0)return;const j=t.map(V=>{const N=Math.floor(D/p*V.length),L=Math.floor((D+_)/p*V.length);return V.slice(N,L)});this.renderSingleCanvas(j,a,_,o,D,c,f)},T=Math.ceil(p/y);if(!this.isScrollable){for(let A=0;A<T;A++)E(A);return}const O=this.scrollContainer.scrollLeft/p,M=Math.floor(O*T);if(E(M-1),E(M),E(M+1),T>1){const A=this.on("scroll",()=>{const{scrollLeft:D}=this.scrollContainer,_=Math.floor(D/p*T);Object.keys(S).length>Ym.MAX_NODES&&(c.innerHTML="",f.innerHTML="",S={}),E(_-1),E(_),E(_+1)});this.unsubscribeOnScroll.push(A)}}renderChannel(t,a,r,o){var{overlay:c}=a,f=function(y,S){var E={};for(var T in y)Object.prototype.hasOwnProperty.call(y,T)&&S.indexOf(T)<0&&(E[T]=y[T]);if(y!=null&&typeof Object.getOwnPropertySymbols=="function"){var O=0;for(T=Object.getOwnPropertySymbols(y);O<T.length;O++)S.indexOf(T[O])<0&&Object.prototype.propertyIsEnumerable.call(y,T[O])&&(E[T[O]]=y[T[O]])}return E}(a,["overlay"]);const m=document.createElement("div"),g=this.getHeight(f.height,f.splitChannels);m.style.height=`${g}px`,c&&o>0&&(m.style.marginTop=`-${g}px`),this.canvasWrapper.style.minHeight=`${g}px`,this.canvasWrapper.appendChild(m);const p=m.cloneNode();this.progressWrapper.appendChild(p),this.renderMultiCanvas(t,f,r,g,m,p)}render(t){return ri(this,void 0,void 0,function*(){var a;this.timeouts.forEach(g=>g()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const r=this.getPixelRatio(),o=this.scrollContainer.clientWidth,c=Math.ceil(t.duration*(this.options.minPxPerSec||0));this.isScrollable=c>o;const f=this.options.fillParent&&!this.isScrollable,m=(f?o:c)*r;if(this.wrapper.style.width=f?"100%":`${c}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=t,this.emit("render"),this.options.splitChannels)for(let g=0;g<t.numberOfChannels;g++){const p=Object.assign(Object.assign({},this.options),(a=this.options.splitChannels)===null||a===void 0?void 0:a[g]);this.renderChannel([t.getChannelData(g)],p,m,g)}else{const g=[t.getChannelData(0)];t.numberOfChannels>1&&g.push(t.getChannelData(1)),this.renderChannel(g,this.options,m,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(r=>r()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:a}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:r}=this.progressWrapper.getBoundingClientRect();let o=r-a;o*=2,o=o<0?Math.floor(o):Math.ceil(o),o/=2,this.scrollContainer.scrollLeft+=o}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,a=!1){const{scrollLeft:r,scrollWidth:o,clientWidth:c}=this.scrollContainer,f=t*o,m=r,g=r+c,p=c/2;if(this.isDragging)f+30>g?this.scrollContainer.scrollLeft+=30:f-30<m&&(this.scrollContainer.scrollLeft-=30);else{(f<m||f>g)&&(this.scrollContainer.scrollLeft=f-(this.options.autoCenter?p:0));const y=f-r-p;a&&this.options.autoCenter&&y>0&&(this.scrollContainer.scrollLeft+=Math.min(y,10))}{const y=this.scrollContainer.scrollLeft,S=y/o,E=(y+c)/o;this.emit("scroll",S,E,y,y+c)}}renderProgress(t,a){if(isNaN(t))return;const r=100*t;this.canvasWrapper.style.clipPath=`polygon(${r}% 0%, 100% 0%, 100% 100%, ${r}% 100%)`,this.progressWrapper.style.width=`${r}%`,this.cursor.style.left=`${r}%`,this.cursor.style.transform=`translateX(-${Math.round(r)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(t,a)}exportImage(t,a,r){return ri(this,void 0,void 0,function*(){const o=this.canvasWrapper.querySelectorAll("canvas");if(!o.length)throw new Error("No waveform data");if(r==="dataURL"){const c=Array.from(o).map(f=>f.toDataURL(t,a));return Promise.resolve(c)}return Promise.all(Array.from(o).map(c=>new Promise((f,m)=>{c.toBlob(g=>{g?f(g):m(new Error("Could not export image"))},t,a)})))})}}Ym.MAX_CANVAS_WIDTH=8e3,Ym.MAX_NODES=10;class WZ extends b0{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class CO extends b0{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return ri(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then(a=>{if(a.status>=400)throw new Error(`Failed to fetch ${t}: ${a.status} (${a.statusText})`);return a.arrayBuffer()}).then(a=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(a)).then(a=>{this.currentSrc===t&&(this.buffer=a,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var t;if(!this.paused)return;this.paused=!1,(t=this.bufferNode)===null||t===void 0||t.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let a=this.playedDuration*this._playbackRate;(a>=this.duration||a<0)&&(a=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,a),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return ri(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const a=t-this.currentTime,r=this.bufferNode;r?.stop(this.audioContext.currentTime+a),r?.addEventListener("ended",()=>{r===this.bufferNode&&(this.bufferNode=null,this.pause())},{once:!0})}setSinkId(t){return ri(this,void 0,void 0,function*(){return this.audioContext.setSinkId(t)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(t){const a=!this.paused;a&&this._pause(),this.playedDuration=t/this._playbackRate,a&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,a;return(t=this._duration)!==null&&t!==void 0?t:((a=this.buffer)===null||a===void 0?void 0:a.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const a=this.buffer.numberOfChannels;for(let r=0;r<a;r++)t.push(this.buffer.getChannelData(r));return t}}const ZZ={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class Wm extends YZ{static create(t){return new Wm(t)}constructor(t){const a=t.media||(t.backend==="WebAudio"?new CO:void 0);super({media:a,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},ZZ,t),this.timer=new WZ;const r=a?void 0:this.getMediaElement();this.renderer=new Ym(this.options,r),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const o=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:c,duration:f}=this.options;(o||c&&f)&&this.load(o,c,f).catch(()=>null)})}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const t=this.updateProgress();this.emit("timeupdate",t)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("emptied",()=>{this.timer.stop(),this.stopAtPosition=null}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(t,a)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,a))}),this.renderer.on("dblclick",(t,a)=>{this.emit("dblclick",t,a)}),this.renderer.on("scroll",(t,a,r,o)=>{const c=this.getDuration();this.emit("scroll",t*c,a*c,r,o)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",t=>{this.emit("dragstart",t)}),this.renderer.on("dragend",t=>{this.emit("dragend",t)}));{let t;this.subscriptions.push(this.renderer.on("drag",a=>{if(!this.options.interact)return;let r;this.renderer.renderProgress(a),clearTimeout(t),this.isPlaying()?r=0:this.options.dragToSeek===!0?r=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(r=this.options.dragToSeek.debounceTime),t=setTimeout(()=>{this.seekTo(a)},r),this.emit("interaction",a*this.getDuration()),this.emit("drag",a)}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach(a=>{this.registerPlugin(a)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(t=>t()),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=tx.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=tx.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){t._init(this),this.plugins.push(t);const a=t.once("destroy",()=>{this.plugins=this.plugins.filter(r=>r!==t),this.subscriptions=this.subscriptions.filter(r=>r!==a)});return this.subscriptions.push(a),t}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const a=t/this.getDuration();this.renderer.setScrollPercentage(a)}getActivePlugins(){return this.plugins}loadAudio(t,a,r,o){return ri(this,void 0,void 0,function*(){var c;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,!a&&!r){const m=this.options.fetchParams||{};window.AbortController&&!m.signal&&(this.abortController=new AbortController,m.signal=(c=this.abortController)===null||c===void 0?void 0:c.signal);const g=y=>this.emit("loading",y);a=yield XZ.fetchBlob(t,g,m);const p=this.options.blobMimeType;p&&(a=new Blob([a],{type:p}))}this.setSrc(t,a);const f=yield new Promise(m=>{const g=o||this.getDuration();g?m(g):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>m(this.getDuration()),{once:!0}))});if(!t&&!a){const m=this.getMediaElement();m instanceof CO&&(m.duration=f)}if(r)this.decodedData=tx.createBuffer(r,f||0);else if(a){const m=yield a.arrayBuffer();this.decodedData=yield tx.decode(m,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(t,a,r){return ri(this,void 0,void 0,function*(){try{return yield this.loadAudio(t,void 0,a,r)}catch(o){throw this.emit("error",o),o}})}loadBlob(t,a,r){return ri(this,void 0,void 0,function*(){try{return yield this.loadAudio("",t,a,r)}catch(o){throw this.emit("error",o),o}})}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:a=8e3,precision:r=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const o=Math.min(t,this.decodedData.numberOfChannels),c=[];for(let f=0;f<o;f++){const m=this.decodedData.getChannelData(f),g=[],p=m.length/a;for(let y=0;y<a;y++){const S=m.slice(Math.floor(y*p),Math.ceil((y+1)*p));let E=0;for(let T=0;T<S.length;T++){const O=S[T];Math.abs(O)>Math.abs(E)&&(E=O)}g.push(Math.round(E*r)/r)}c.push(g)}return c}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const a=this.getDuration()*t;this.setTime(a)}play(t,a){const r=Object.create(null,{play:{get:()=>super.play}});return ri(this,void 0,void 0,function*(){t!=null&&this.setTime(t);const o=yield r.play.call(this);return a!=null&&(this.media instanceof CO?this.media.stopAt(a):this.stopAtPosition=a),o})}playPause(){return ri(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return ri(this,arguments,void 0,function*(t="image/png",a=1,r="dataURL"){return this.renderer.exportImage(t,a,r)})}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach(a=>a.destroy()),this.subscriptions.forEach(a=>a()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}Wm.BasePlugin=class extends b0{constructor(e){super(),this.subscriptions=[],this.options=e}onInit(){}_init(e){this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(e=>e())}},Wm.dom=GZ;const KZ=({userMessage:e,setUserMessage:t,handleSendMessage:a,handleSendImage:r,handleSendVoice:o,selectedImage:c,setSelectedImage:f,audioBlob:m,setAudioBlob:g,isSending:p})=>{const{t:y}=RB(),[S,E]=x.useState(!1),[T,O]=x.useState(!1),M=x.useRef(null),A=x.useRef(null),D=x.useRef([]),_=x.useRef(null),j=x.useRef(null),V=U=>{const H=U.target.files?.[0];H&&f(H)},N=()=>{f(null)},L=async()=>{if(!navigator.mediaDevices?.getUserMedia){alert(y("chatInput.voice.notSupported"));return}if(S)M.current?.stop();else try{const U=await navigator.mediaDevices.getUserMedia({audio:!0}),H=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",te=new MediaRecorder(U,{mimeType:H});M.current=te,D.current=[],te.ondataavailable=Y=>{Y.data.size>0&&D.current.push(Y.data)},te.onstop=()=>{const Y=new Blob(D.current,{type:H});g(Y),E(!1),U.getTracks().forEach(Z=>Z.stop())},te.start(),E(!0)}catch(U){console.error(U),alert(y("chatInput.voice.permissionError"))}};x.useEffect(()=>{if(m&&_.current){j.current?.destroy();const U=URL.createObjectURL(m);j.current=Wm.create({container:_.current,waveColor:"#ccc",progressColor:"#7F28F8",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),j.current.load(U),j.current.on("finish",()=>O(!1))}},[m]);const B=()=>{j.current&&(j.current.playPause(),O(U=>!U))},z=()=>{E(!1),g(null),j.current?.destroy()};return ae.jsxs("div",{style:{display:"flex",alignItems:"center",backgroundColor:"white",border:"1px solid #d1d5db",borderRadius:"9999px",padding:"0.5rem 0.75rem",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",width:"95%",height:"56px"},children:[ae.jsx("button",{style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},onClick:()=>A.current?.click(),children:c?ae.jsxs("div",{style:{position:"relative"},children:[ae.jsx("img",{src:URL.createObjectURL(c),alt:y("chatInput.image.selectedAlt"),style:{width:"2rem",height:"2rem",borderRadius:"9999px",objectFit:"cover",padding:"0"}}),ae.jsx(y0,{style:{position:"absolute",top:"-0.5rem",right:"-0.5rem",fontSize:"14px",color:"#ef4444",background:"white",borderRadius:"9999px",cursor:"pointer"},onClick:U=>{U.stopPropagation(),N()}})]}):ae.jsx(b6,{style:{fontSize:"20px"}})}),ae.jsx("input",{disabled:p,type:"file",accept:"image/*",ref:A,onChange:V,style:{display:"none",padding:"0"}}),ae.jsx(Ld,{title:S?"Stop Recording":"Send Audio",children:ae.jsx("button",{onClick:L,style:{color:S?"#ef4444":"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:S?ae.jsx(C6,{style:{fontSize:"20px"}}):ae.jsx(p6,{style:{fontSize:"20px"}})})}),ae.jsx("div",{style:{flex:1,margin:"0 0.5rem",minWidth:0,maxWidth:"100%",display:"flex",alignItems:"center"},children:m?ae.jsxs("div",{style:{display:"flex",alignItems:"center",width:"100%",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem"},children:[ae.jsx("button",{style:{background:"none",border:"none",marginRight:"0.75rem",color:"#7f28f8",cursor:"pointer",padding:"0"},onClick:B,children:T?ae.jsx(uO,{style:{fontSize:"24px"}}):ae.jsx(cO,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:_,style:{width:"100%",height:"2rem"}}),ae.jsx(y0,{style:{fontSize:"18px",color:"#ef4444",marginLeft:"0.75rem",cursor:"pointer"},onClick:z})]}):S?ae.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f3f4f6",padding:"0.5rem 1rem",borderRadius:"0.5rem",animation:"pulse 2s infinite"},children:ae.jsx("span",{children:"Recording"})}):ae.jsx(Yu,{type:"text",value:e,onChange:U=>t(U.target.value),placeholder:"Message...",style:{width:"100%",border:"none",fontSize:"16px",margin:0,lineHeight:1.5,color:"#374151",padding:"0"},onKeyDown:U=>{U.key==="Enter"&&(U.preventDefault(),c?(r(c,e),N(),t("")):e.trim()&&(a(),t("")))}})}),ae.jsx("button",{disabled:p,onClick:()=>{const U=!!c,H=!!e.trim();U?(r(c,e),N(),t("")):!!m?(o(m),z()):H&&(a(),t(""))},"aria-label":y("chatInput.send"),style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:ae.jsx(S6,{style:{fontSize:"20px"}})})]})};function QZ({suggestions:e,colorCode:t,sendMessageSuggestion:a}){return ae.jsx("div",{style:{overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",paddingTop:"4px",paddingBottom:"8px",width:"100%",boxSizing:"border-box",marginLeft:"4%",marginTop:"4px",marginBottom:"4px"},children:ae.jsx("div",{style:{display:"inline-flex",gap:"0.5rem"},children:e?.map((r,o)=>ae.jsx("button",{onClick:()=>a(r),style:{whiteSpace:"nowrap",padding:"0.5rem 1rem",border:`1px solid ${t}`,borderRadius:"9999px",backgroundColor:"white",cursor:"pointer",fontSize:"14px",color:t,flexShrink:0},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="#f3f3f3"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="white"},children:r},o))})})}function JZ(){return ae.jsxs("div",{className:"jawebcss-powered-container",children:[ae.jsx("span",{className:"jawebcss-powered-label",children:"Powered by"}),ae.jsx("a",{href:"https://jaweb.me/",target:"_blank",className:"jawebcss-powered-link",rel:"noopener noreferrer",children:"Jaweb"})]})}const eK=()=>ae.jsxs("div",{className:"typing-animation",children:[ae.jsx("span",{children:"."}),ae.jsx("span",{children:"."}),ae.jsx("span",{children:"."})]}),tK=({groupedProducts:e,selectedVariants:t,setSelectedVariants:a,counts:r,setCounts:o,handleAddToCart:c,handleRemoveFromCart:f,colorCode:m="#7F28F8",shortenName:g,sliderRef:p,totalSlides:y,disableCheckout:S=!1})=>!y||y===0?null:ae.jsx("section",{className:"sallaX",style:{"--sallaX-accent":m},"aria-label":"Recommended products",children:ae.jsx("div",{ref:p,className:"keen-slider sallaX-slider",children:Object.entries(e).map(([E,T])=>{const O=t[E]||(T.length>0?T[0].variant_id:""),M=T.find(L=>L.variant_id===O)||T[0];if(!M)return null;const A=r[M.variant_id]||0,D=Array.from(new Set(T.map(L=>L.option?.trim()??"").filter(L=>L&&L.toLowerCase()!=="none"))),_=L=>{const B=T.find(z=>z.option===L);B&&a(z=>({...z,[E]:B.variant_id}))},j=async()=>{o(L=>({...L,[M.variant_id]:(L[M.variant_id]||0)+1})),await c(M.variant_id,M.name,1)},V=async()=>{A!==0&&(o(L=>({...L,[M.variant_id]:Math.max(0,(L[M.variant_id]||0)-1)})),await f(M.variant_id,1))},N=M.option??D[0]??"";return ae.jsxs("article",{className:"keen-slider__slide sallaX-card",role:"group","aria-roledescription":"slide",children:[ae.jsxs("div",{className:"sallaX-media",onClick:()=>window.open(M.link,"_blank"),children:[ae.jsx("img",{src:M.image,alt:M.name,className:"sallaX-img",loading:"lazy"}),ae.jsx("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:L=>L.stopPropagation(),children:"View"})]}),ae.jsxs("div",{className:"sallaX-body",children:[ae.jsx("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:M.name,children:g(M.name)}),ae.jsx("div",{className:"sallaX-row",children:ae.jsx("span",{className:"sallaX-price","aria-label":"Price",children:M.price})}),D.length>1&&ae.jsxs("div",{className:"sallaX-selectWrap",children:[ae.jsx("label",{htmlFor:`sallaX-select-${E}`,className:"sallaX-selectLabel",children:"Choose an option"}),ae.jsx("select",{id:`sallaX-select-${E}`,className:"sallaX-select","aria-label":"Choose an option",value:N,onChange:L=>_(L.target.value),children:D.map(L=>ae.jsx("option",{value:L,children:L},L))})]}),!S&&ae.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:V,"aria-label":"Decrease quantity",disabled:A===0,children:"–"}),ae.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:A}),ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:j,"aria-label":"Increase quantity",children:"+"})]})]})]},E)})})});var nx={},P6;function nK(){if(P6)return nx;P6=1,Object.defineProperty(nx,"__esModule",{value:!0});var e=Ed();function t(z){return Array.prototype.slice.call(z)}function a(z,U){var H=Math.floor(z);return H===U||H+1===U?z:U}function r(){return Date.now()}function o(z,U,H){if(U="data-keen-slider-"+U,H===null)return z.removeAttribute(U);z.setAttribute(U,H||"")}function c(z,U){return U=U||document,typeof z=="function"&&(z=z(U)),Array.isArray(z)?z:typeof z=="string"?t(U.querySelectorAll(z)):z instanceof HTMLElement?[z]:z instanceof NodeList?t(z):[]}function f(z){z.raw&&(z=z.raw),z.cancelable&&!z.defaultPrevented&&z.preventDefault()}function m(z){z.raw&&(z=z.raw),z.stopPropagation&&z.stopPropagation()}function g(){var z=[];return{add:function(U,H,te,Y){U.addListener?U.addListener(te):U.addEventListener(H,te,Y),z.push([U,H,te,Y])},input:function(U,H,te,Y){this.add(U,H,function(Z){return function(W){W.nativeEvent&&(W=W.nativeEvent);var ie=W.changedTouches||[],G=W.targetTouches||[],F=W.detail&&W.detail.x?W.detail:null;return Z({id:F?F.identifier?F.identifier:"i":G[0]?G[0]?G[0].identifier:"e":"d",idChanged:F?F.identifier?F.identifier:"i":ie[0]?ie[0]?ie[0].identifier:"e":"d",raw:W,x:F&&F.x?F.x:G[0]?G[0].screenX:F?F.x:W.pageX,y:F&&F.y?F.y:G[0]?G[0].screenY:F?F.y:W.pageY})}}(te),Y)},purge:function(){z.forEach(function(U){U[0].removeListener?U[0].removeListener(U[2]):U[0].removeEventListener(U[1],U[2],U[3])}),z=[]}}}function p(z,U,H){return Math.min(Math.max(z,U),H)}function y(z){return(z>0?1:0)-(z<0?1:0)||+z}function S(z){var U=z.getBoundingClientRect();return{height:a(U.height,z.offsetHeight),width:a(U.width,z.offsetWidth)}}function E(z,U,H,te){var Y=z&&z[U];return Y==null?H:te&&typeof Y=="function"?Y():Y}function T(z){return Math.round(1e6*z)/1e6}function O(z,U){if(z===U)return!0;var H=typeof z;if(H!==typeof U)return!1;if(H!=="object"||z===null||U===null)return H==="function"&&z.toString()===U.toString();if(z.length!==U.length||Object.getOwnPropertyNames(z).length!==Object.getOwnPropertyNames(U).length)return!1;for(var te in z)if(!O(z[te],U[te]))return!1;return!0}var M=function(){return M=Object.assign||function(z){for(var U,H=1,te=arguments.length;H<te;H++)for(var Y in U=arguments[H])Object.prototype.hasOwnProperty.call(U,Y)&&(z[Y]=U[Y]);return z},M.apply(this,arguments)};function A(z,U,H){for(var te,Y=0,Z=U.length;Y<Z;Y++)!te&&Y in U||(te||(te=Array.prototype.slice.call(U,0,Y)),te[Y]=U[Y]);return z.concat(te||Array.prototype.slice.call(U))}function D(z){var U,H,te,Y,Z,W;function ie(k){W||(W=k),G(!0);var q=k-W;q>te&&(q=te);var J=Y[H];if(J[3]<q)return H++,ie(k);var ne=J[2],oe=J[4],le=J[0],ue=J[1]*(0,J[5])(oe===0?1:(q-ne)/oe);if(ue&&z.track.to(le+ue),q<te)return Q();W=null,G(!1),F(null),z.emit("animationEnded")}function G(k){U.active=k}function F(k){U.targetIdx=k}function Q(){var k;k=ie,Z=window.requestAnimationFrame(k)}function se(){var k;k=Z,window.cancelAnimationFrame(k),G(!1),F(null),W&&z.emit("animationStopped"),W=null}return U={active:!1,start:function(k){if(se(),z.track.details){var q=0,J=z.track.details.position;H=0,te=0,Y=k.map(function(ne){var oe,le=Number(J),ue=(oe=ne.earlyExit)!==null&&oe!==void 0?oe:ne.duration,Ee=ne.easing,ze=ne.distance*Ee(ue/ne.duration)||0;J+=ze;var De=te;return te+=ue,q+=ze,[le,ne.distance,De,te,ne.duration,Ee]}),F(z.track.distToIdx(q)),Q(),z.emit("animationStarted")}},stop:se,targetIdx:null}}function _(z){var U,H,te,Y,Z,W,ie,G,F,Q,se,k,q,J,ne=1/0,oe=[],le=null,ue=0;function Ee(Re){ye(ue+Re)}function ze(Re){var Ae=De(ue+Re).abs;return he(Ae)?Ae:null}function De(Re){var Ae=Math.floor(Math.abs(T(Re/H))),we=T((Re%H+H)%H);we===H&&(we=0);var Te=y(Re),Ne=ie.indexOf(A([],ie).reduce(function(Le,it){return Math.abs(it-we)<Math.abs(Le-we)?it:Le})),ke=Ne;return Te<0&&Ae++,Ne===W&&(ke=0,Ae+=Te>0?1:-1),{abs:ke+Ae*W*Te,origin:Ne,rel:ke}}function Fe(Re,Ae,we){var Te;if(Ae||!Ue())return ve(Re,we);if(!he(Re))return null;var Ne=De(we??ue),ke=Ne.abs,Le=Re-Ne.rel,it=ke+Le;Te=ve(it);var ut=ve(it-W*y(Le));return(ut!==null&&Math.abs(ut)<Math.abs(Te)||Te===null)&&(Te=ut),T(Te)}function ve(Re,Ae){if(Ae==null&&(Ae=T(ue)),!he(Re)||Re===null)return null;Re=Math.round(Re);var we=De(Ae),Te=we.abs,Ne=we.rel,ke=we.origin,Le=me(Re),it=(Ae%H+H)%H,ut=ie[ke],vt=Math.floor((Re-(Te-Ne))/W)*H;return T(ut-it-ut+ie[Le]+vt+(ke===W?H:0))}function he(Re){return je(Re)===Re}function je(Re){return p(Re,F,Q)}function Ue(){return Y.loop}function me(Re){return(Re%W+W)%W}function ye(Re){var Ae;Ae=Re-ue,oe.push({distance:Ae,timestamp:r()}),oe.length>6&&(oe=oe.slice(-6)),ue=T(Re);var we=Se().abs;if(we!==le){var Te=le!==null;le=we,Te&&z.emit("slideChanged")}}function Se(Re){var Ae=Re?null:function(){if(W){var we=Ue(),Te=we?(ue%H+H)%H:ue,Ne=(we?ue%H:ue)-Z[0][2],ke=0-(Ne<0&&we?H-Math.abs(Ne):Ne),Le=0,it=De(ue),ut=it.abs,vt=it.rel,At=Z[vt][2],ht=Z.map(function(jt,Vt){var _t=ke+Le;(_t<0-jt[0]||_t>1)&&(_t+=(Math.abs(_t)>H-1&&we?H:0)*y(-_t));var Tt=Vt-vt,ct=y(Tt),gt=Tt+ut;we&&(ct===-1&&_t>At&&(gt+=W),ct===1&&_t<At&&(gt-=W),se!==null&&gt<se&&(_t+=H),k!==null&&gt>k&&(_t-=H));var at=_t+jt[0]+jt[1],lt=Math.max(_t>=0&&at<=1?1:at<0||_t>1?0:_t<0?Math.min(1,(jt[0]+_t)/jt[0]):(1-_t)/jt[0],0);return Le+=jt[0]+jt[1],{abs:gt,distance:Y.rtl?-1*_t+1-jt[0]:_t,portion:lt,size:jt[0]}});return ut=je(ut),vt=me(ut),{abs:je(ut),length:te,max:J,maxIdx:Q,min:q,minIdx:F,position:ue,progress:we?Te/H:ue/te,rel:vt,slides:ht,slidesLength:H}}}();return U.details=Ae,z.emit("detailsChanged"),Ae}return U={absToRel:me,add:Ee,details:null,distToIdx:ze,idxToDist:Fe,init:function(Re){if(function(){if(Y=z.options,Z=(Y.trackConfig||[]).map(function(Ne){return[E(Ne,"size",1),E(Ne,"spacing",0),E(Ne,"origin",0)]}),W=Z.length){H=T(Z.reduce(function(Ne,ke){return Ne+ke[0]+ke[1]},0));var we,Te=W-1;te=T(H+Z[0][2]-Z[Te][0]-Z[Te][2]-Z[Te][1]),ie=Z.reduce(function(Ne,ke){if(!Ne)return[0];var Le=Z[Ne.length-1],it=Ne[Ne.length-1]+(Le[0]+Le[2])+Le[1];return it-=ke[2],Ne[Ne.length-1]>it&&(it=Ne[Ne.length-1]),it=T(it),Ne.push(it),(!we||we<it)&&(G=Ne.length-1),we=it,Ne},null),te===0&&(G=0),ie.push(T(H))}}(),!W)return Se(!0);var Ae;(function(){var we=z.options.range,Te=z.options.loop;se=F=Te?E(Te,"min",-1/0):0,k=Q=Te?E(Te,"max",ne):G;var Ne=E(we,"min",null),ke=E(we,"max",null);Ne!==null&&(F=Ne),ke!==null&&(Q=ke),q=F===-1/0?F:z.track.idxToDist(F||0,!0,0),J=Q===ne?Q:Fe(Q,!0,0),ke===null&&(k=Q),E(we,"align",!1)&&Q!==ne&&Z[me(Q)][2]===0&&(J-=1-Z[me(Q)][0],Q=ze(J-ue)),q=T(q),J=T(J)})(),Ae=Re,Number(Ae)===Ae?Ee(ve(je(Re))):Se()},to:ye,velocity:function(){var Re=r(),Ae=oe.reduce(function(we,Te){var Ne=Te.distance,ke=Te.timestamp;return Re-ke>200||(y(Ne)!==y(we.distance)&&we.distance&&(we={distance:0,lastTimestamp:0,time:0}),we.time&&(we.distance+=Ne),we.lastTimestamp&&(we.time+=ke-we.lastTimestamp),we.lastTimestamp=ke),we},{distance:0,lastTimestamp:0,time:0});return Ae.distance/Ae.time||0}}}function j(z){var U,H,te,Y,Z,W,ie,G;function F(le){return 2*le}function Q(le){return p(le,ie,G)}function se(le){return 1-Math.pow(1-le,3)}function k(){return te?z.track.velocity():0}function q(){oe();var le=z.options.mode==="free-snap",ue=z.track,Ee=k();Y=y(Ee);var ze=z.track.details,De=[];if(Ee||!le){var Fe=J(Ee),ve=Fe.dist,he=Fe.dur;if(he=F(he),ve*=Y,le){var je=ue.idxToDist(ue.distToIdx(ve),!0);je&&(ve=je)}De.push({distance:ve,duration:he,easing:se});var Ue=ze.position,me=Ue+ve;if(me<Z||me>W){var ye=me<Z?Z-Ue:W-Ue,Se=0,Re=Ee;if(y(ye)===Y){var Ae=Math.min(Math.abs(ye)/Math.abs(ve),1),we=function(ke){return 1-Math.pow(1-ke,1/3)}(Ae)*he;De[0].earlyExit=we,Re=Ee*(1-Ae)}else De[0].earlyExit=0,Se+=ye;var Te=J(Re,100),Ne=Te.dist*Y;z.options.rubberband&&(De.push({distance:Ne,duration:F(Te.dur),easing:se}),De.push({distance:-Ne+Se,duration:500,easing:se}))}z.animator.start(De)}else z.moveToIdx(Q(ze.abs),!0,{duration:500,easing:function(ke){return 1+--ke*ke*ke*ke*ke}})}function J(le,ue){ue===void 0&&(ue=1e3);var Ee=147e-9+(le=Math.abs(le))/ue;return{dist:Math.pow(le,2)/Ee,dur:le/Ee}}function ne(){var le=z.track.details;le&&(Z=le.min,W=le.max,ie=le.minIdx,G=le.maxIdx)}function oe(){z.animator.stop()}z.on("updated",ne),z.on("optionsChanged",ne),z.on("created",ne),z.on("dragStarted",function(){te=!1,oe(),U=H=z.track.details.abs}),z.on("dragChecked",function(){te=!0}),z.on("dragEnded",function(){var le=z.options.mode;le==="snap"&&function(){var ue=z.track,Ee=z.track.details,ze=Ee.position,De=y(k());(ze>W||ze<Z)&&(De=0);var Fe=U+De;Ee.slides[ue.absToRel(Fe)].portion===0&&(Fe-=De),U!==H&&(Fe=H),y(ue.idxToDist(Fe,!0))!==De&&(Fe+=De),Fe=Q(Fe);var ve=ue.idxToDist(Fe,!0);z.animator.start([{distance:ve,duration:500,easing:function(he){return 1+--he*he*he*he*he}}])}(),le!=="free"&&le!=="free-snap"||q()}),z.on("dragged",function(){H=z.track.details.abs})}function V(z){var U,H,te,Y,Z,W,ie,G,F,Q,se,k,q,J,ne,oe,le,ue,Ee=g();function ze(Se){if(W&&G===Se.id){var Re=he(Se);if(F){if(!ve(Se))return Fe(Se);Q=Re,F=!1,z.emit("dragChecked")}if(oe)return Q=Re;f(Se);var Ae=function(Te){if(le===-1/0&&ue===1/0)return Te;var Ne=z.track.details,ke=Ne.length,Le=Ne.position,it=p(Te,le-Le,ue-Le);if(ke===0)return 0;if(!z.options.rubberband)return it;if(Le<=ue&&Le>=le||Le<le&&H>0||Le>ue&&H<0)return Te;var ut=(Le<le?Le-le:Le-ue)/ke,vt=Y*ke,At=Math.abs(ut*vt),ht=Math.max(0,1-At/Z*2);return ht*ht*Te}(ie(Q-Re)/Y*te);H=y(Ae);var we=z.track.details.position;(we>le&&we<ue||we===le&&H>0||we===ue&&H<0)&&m(Se),se+=Ae,!k&&Math.abs(se*Y)>5&&(k=!0),z.track.add(Ae),Q=Re,z.emit("dragged")}}function De(Se){!W&&z.track.details&&z.track.details.length&&(se=0,W=!0,k=!1,F=!0,G=Se.id,ve(Se),Q=he(Se),z.emit("dragStarted"))}function Fe(Se){W&&G===Se.idChanged&&(W=!1,z.emit("dragEnded"))}function ve(Se){var Re=je(),Ae=Re?Se.y:Se.x,we=Re?Se.x:Se.y,Te=q!==void 0&&J!==void 0&&Math.abs(J-we)<=Math.abs(q-Ae);return q=Ae,J=we,Te}function he(Se){return je()?Se.y:Se.x}function je(){return z.options.vertical}function Ue(){Y=z.size,Z=je()?window.innerHeight:window.innerWidth;var Se=z.track.details;Se&&(le=Se.min,ue=Se.max)}function me(Se){k&&(m(Se),f(Se))}function ye(){if(Ee.purge(),z.options.drag&&!z.options.disabled){var Se;Se=z.options.dragSpeed||1,ie=typeof Se=="function"?Se:function(Ae){return Ae*Se},te=z.options.rtl?-1:1,Ue(),U=z.container,function(){var Ae="data-keen-slider-clickable";c("[".concat(Ae,"]:not([").concat(Ae,"=false])"),U).map(function(we){Ee.add(we,"dragstart",m),Ee.add(we,"mousedown",m),Ee.add(we,"touchstart",m)})}(),Ee.add(U,"dragstart",function(Ae){f(Ae)}),Ee.add(U,"click",me,{capture:!0}),Ee.input(U,"ksDragStart",De),Ee.input(U,"ksDrag",ze),Ee.input(U,"ksDragEnd",Fe),Ee.input(U,"mousedown",De),Ee.input(U,"mousemove",ze),Ee.input(U,"mouseleave",Fe),Ee.input(U,"mouseup",Fe),Ee.input(U,"touchstart",De,{passive:!0}),Ee.input(U,"touchmove",ze,{passive:!1}),Ee.input(U,"touchend",Fe),Ee.input(U,"touchcancel",Fe),Ee.add(window,"wheel",function(Ae){W&&f(Ae)});var Re="data-keen-slider-scrollable";c("[".concat(Re,"]:not([").concat(Re,"=false])"),z.container).map(function(Ae){return function(we){var Te;Ee.input(we,"touchstart",function(Ne){Te=he(Ne),oe=!0,ne=!0},{passive:!0}),Ee.input(we,"touchmove",function(Ne){var ke=je(),Le=ke?we.scrollHeight-we.clientHeight:we.scrollWidth-we.clientWidth,it=Te-he(Ne),ut=ke?we.scrollTop:we.scrollLeft,vt=ke&&we.style.overflowY==="scroll"||!ke&&we.style.overflowX==="scroll";if(Te=he(Ne),(it<0&&ut>0||it>0&&ut<Le)&&ne&&vt)return oe=!0;ne=!1,f(Ne),oe=!1}),Ee.input(we,"touchend",function(){oe=!1})}(Ae)})}}z.on("updated",Ue),z.on("optionsChanged",ye),z.on("created",ye),z.on("destroyed",Ee.purge)}function N(z){var U,H,te=null;function Y(q,J,ne){z.animator.active?W(q,J,ne):requestAnimationFrame(function(){return W(q,J,ne)})}function Z(){Y(!1,!1,H)}function W(q,J,ne){var oe=0,le=z.size,ue=z.track.details;if(ue&&U){var Ee=ue.slides;U.forEach(function(ze,De){if(q)!te&&J&&G(ze,null,ne),F(ze,null,ne);else{if(!Ee[De])return;var Fe=Ee[De].size*le;!te&&J&&G(ze,Fe,ne),F(ze,Ee[De].distance*le-oe,ne),oe+=Fe}})}}function ie(q){return z.options.renderMode==="performance"?Math.round(q):q}function G(q,J,ne){var oe=ne?"height":"width";J!==null&&(J=ie(J)+"px"),q.style["min-"+oe]=J,q.style["max-"+oe]=J}function F(q,J,ne){if(J!==null){J=ie(J);var oe=ne?J:0;J="translate3d(".concat(ne?0:J,"px, ").concat(oe,"px, 0)")}q.style.transform=J,q.style["-webkit-transform"]=J}function Q(){U&&(W(!0,!0,H),U=null),z.on("detailsChanged",Z,!0)}function se(){Y(!1,!0,H)}function k(){Q(),H=z.options.vertical,z.options.disabled||z.options.renderMode==="custom"||(te=E(z.options.slides,"perView",null)==="auto",z.on("detailsChanged",Z),(U=z.slides).length&&se())}z.on("created",k),z.on("optionsChanged",k),z.on("beforeOptionsChanged",function(){Q()}),z.on("updated",se),z.on("destroyed",Q)}function L(z,U){return function(H){var te,Y,Z,W,ie,G=g();function F(ve){var he;o(H.container,"reverse",(he=H.container,window.getComputedStyle(he,null).getPropertyValue("direction")!=="rtl"||ve?null:"")),o(H.container,"v",H.options.vertical&&!ve?"":null),o(H.container,"disabled",H.options.disabled&&!ve?"":null)}function Q(){se()&&oe()}function se(){var ve=null;if(W.forEach(function(je){je.matches&&(ve=je.__media)}),ve===te)return!1;te||H.emit("beforeOptionsChanged"),te=ve;var he=ve?Z.breakpoints[ve]:Z;return H.options=M(M({},Z),he),F(),De(),Fe(),ue(),!0}function k(ve){var he=S(ve);return(H.options.vertical?he.height:he.width)/H.size||1}function q(){return H.options.trackConfig.length}function J(ve){for(var he in te=!1,Z=M(M({},U),ve),G.purge(),Y=H.size,W=[],Z.breakpoints||[]){var je=window.matchMedia(he);je.__media=he,W.push(je),G.add(je,"change",Q)}G.add(window,"orientationchange",ze),G.add(window,"resize",Ee),se()}function ne(ve){H.animator.stop();var he=H.track.details;H.track.init(ve??(he?he.abs:0))}function oe(ve){ne(ve),H.emit("optionsChanged")}function le(ve,he){if(ve)return J(ve),void oe(he);De(),Fe();var je=q();ue(),q()!==je?oe(he):ne(he),H.emit("updated")}function ue(){var ve=H.options.slides;if(typeof ve=="function")return H.options.trackConfig=ve(H.size,H.slides);for(var he=H.slides,je=he.length,Ue=typeof ve=="number"?ve:E(ve,"number",je,!0),me=[],ye=E(ve,"perView",1,!0),Se=E(ve,"spacing",0,!0)/H.size||0,Re=ye==="auto"?Se:Se/ye,Ae=E(ve,"origin","auto"),we=0,Te=0;Te<Ue;Te++){var Ne=ye==="auto"?k(he[Te]):1/ye-Se+Re,ke=Ae==="center"?.5-Ne/2:Ae==="auto"?0:Ae;me.push({origin:ke,size:Ne,spacing:Se}),we+=Ne}if(we+=Se*(Ue-1),Ae==="auto"&&!H.options.loop&&ye!==1){var Le=0;me.map(function(it){var ut=we-Le;return Le+=it.size+Se,ut>=1||(it.origin=1-ut-(we>1?0:1-we)),it})}H.options.trackConfig=me}function Ee(){De();var ve=H.size;H.options.disabled||ve===Y||(Y=ve,le())}function ze(){Ee(),setTimeout(Ee,500),setTimeout(Ee,2e3)}function De(){var ve=S(H.container);H.size=(H.options.vertical?ve.height:ve.width)||1}function Fe(){H.slides=c(H.options.selector,H.container)}H.container=(ie=c(z,document)).length?ie[0]:null,H.destroy=function(){G.purge(),H.emit("destroyed"),F(!0)},H.prev=function(){H.moveToIdx(H.track.details.abs-1,!0)},H.next=function(){H.moveToIdx(H.track.details.abs+1,!0)},H.update=le,J(H.options)}}var B=function(z,U,H){try{return function(te,Y){var Z,W={};return Z={emit:function(ie){W[ie]&&W[ie].forEach(function(F){F(Z)});var G=Z.options&&Z.options[ie];G&&G(Z)},moveToIdx:function(ie,G,F){var Q=Z.track.idxToDist(ie,G);if(Q){var se=Z.options.defaultAnimation;Z.animator.start([{distance:Q,duration:E(F||se,"duration",500),easing:E(F||se,"easing",function(k){return 1+--k*k*k*k*k})}])}},on:function(ie,G,F){F===void 0&&(F=!1),W[ie]||(W[ie]=[]);var Q=W[ie].indexOf(G);Q>-1?F&&delete W[ie][Q]:F||W[ie].push(G)},options:te},function(){if(Z.track=_(Z),Z.animator=D(Z),Y)for(var ie=0,G=Y;ie<G.length;ie++)(0,G[ie])(Z);Z.track.init(Z.options.initial||0),Z.emit("created")}(),Z}(U,A([L(z,{drag:!0,mode:"snap",renderMode:"precision",rubberband:!0,selector:".keen-slider__slide"}),N,V,j],H||[],!0))}catch(te){console.error(te)}};return nx.useKeenSlider=function(z,U){var H=e.useRef(null),te=e.useRef(!1),Y=e.useRef(z),Z=e.useCallback(function(W){W?(Y.current=z,H.current=new B(W,z,U),te.current=!1):(H.current&&H.current.destroy&&H.current.destroy(),H.current=null)},[]);return e.useEffect(function(){O(Y.current,z)||(Y.current=z,H.current&&H.current.update(Y.current))},[z]),[Z,H]},nx}var EO=nK();const aK=({message:e,colorCode:t,disableCheckout:a,handleAddToCart:r,handleRemoveFromCart:o})=>{const[c,f]=x.useState({}),[m,g]=x.useState({}),p=j=>{const V=/(https?:\/\/[^\s]+)/g;return j.split(V).map((N,L)=>V.test(N)?ae.jsx("a",{href:N.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:N},L):ae.jsx("span",{children:N},L))},y=j=>{const V=j.trim();if(!V.includes("Name:")||!V.includes("VariantId"))return null;const N=V.match(/Name\s*[:\-]\s*(.+)/i),L=V.match(/Price\s*[:\-]\s*(.+)/i),B=V.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),z=V.match(/VariantId\s*[:\-]\s*(.+)/i),U=V.match(/variant_tag_name\s*[:\-]\s*(.+)/i),H=V.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!N||!L||!B||!z||!U?null:{name:N[1].trim(),price:L[1].trim(),link:B[1].trim(),image:"",variant_id:z[1].trim(),variant_tag_name:U[1].trim(),option:H?.[1]?.trim()}},S=x.useMemo(()=>{const j=e.split("|||").map(L=>L.trim()).filter(Boolean),V=[];let N=null;return j.forEach(L=>{if(L.startsWith("img - ")){const B=L.replace(/^img\s*[-:]\s*/,"").trim();if(N)N.image=B;else{const z=[...V].reverse().find(U=>U.type==="product");z&&(z.data.image=B)}}else if(L.includes("Name:")&&L.includes("VariantId")){const B=y(L);B&&(V.push({type:"product",data:B}),N=B)}else V.push({type:"text",data:L}),N=null}),V},[e]),E=x.useMemo(()=>{const j={};return S.forEach(V=>{if(V.type==="product"){const N=V.data;j[N.variant_tag_name]=j[N.variant_tag_name]||[],j[N.variant_tag_name].push(N)}}),j},[S]),T=(j,V=22)=>j.length>V?j.slice(0,V)+"...":j,[O,M]=x.useState(0),A=Object.keys(E).length,[D,_]=EO.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(j){M(j.track.details.rel)}});return ae.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[S.filter(j=>j.type==="text").map((j,V)=>ae.jsx("p",{className:"whitespace-pre-wrap break-words",children:p(j.data)},V)),Object.keys(E).length>0&&ae.jsxs(ae.Fragment,{children:[Object.keys(E).length>1&&ae.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[ae.jsx(wi,{shape:"circle",icon:ae.jsx(Gm,{}),onClick:()=>_.current?.prev(),disabled:O===0}),ae.jsx(wi,{shape:"circle",icon:ae.jsx(K1,{}),onClick:()=>_.current?.next(),disabled:O===A-1})]}),ae.jsx("div",{ref:D,className:"keen-slider",children:ae.jsx(tK,{groupedProducts:E,selectedVariants:m,setSelectedVariants:g,counts:c,setCounts:f,handleAddToCart:r,handleRemoveFromCart:o,colorCode:t,shortenName:T,sliderInstance:_,currentSlide:O,totalSlides:A,sliderRef:D,disableCheckout:a})})]})]})},U6=({message:e})=>{const t=e.find(r=>r.type==="image_url")?.image_url?.url,a=e?.isBusiness;return ae.jsx("div",{children:ae.jsx("div",{children:t&&ae.jsx("div",{className:"mb-2 bg-transparent text-white ",children:ae.jsx("img",{src:t,alt:"Chat image",style:{width:200},className:`rounded-md bg-transparent mt-2 max-w-xs ${a?"border border-gray-300 shadow-sm":""}`})})})})},rK=({message:e,colorCode:t})=>{const a=e.find(o=>o.type==="text")?.text,r=o=>{const c=/(https?:\/\/[^\s]+)/g;return o.split(c).map((f,m)=>c.test(f)?ae.jsx("a",{href:f.trim(),style:{color:t},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:f},m):ae.jsx("span",{children:f},m))};return ae.jsx(ae.Fragment,{children:a&&ae.jsx("div",{style:{color:"white",border:1,backgroundColor:t,paddingTop:10,paddingBottom:10,paddingInline:14,maxWidth:"85%",lineHeight:1.4,borderRadius:"16px",wordBreak:"break-word"},children:ae.jsx("p",{children:r(a)})})})},iK=({link:e,colorCode:t,transcription:a})=>{const r=x.useRef(null),o=x.useRef(null),[c,f]=x.useState(!1),[m,g]=x.useState(!1);x.useEffect(()=>{if(r.current)return o.current?.destroy(),o.current=Wm.create({container:r.current,waveColor:"white",progressColor:"white",cursorWidth:0,barWidth:3,barHeight:1.5,barGap:2,height:40,interact:!0}),o.current.load(e),o.current.on("finish",()=>f(!1)),()=>{o.current?.destroy()}},[e,t]);const p=()=>{o.current&&(o.current.playPause(),f(y=>!y))};return ae.jsxs("div",{style:{backgroundColor:t,padding:"12px",borderRadius:"20px",color:"white",maxWidth:"350px",marginBottom:"16px"},children:[ae.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[ae.jsx("button",{onClick:p,style:{background:"transparent",border:"none",color:"white",marginRight:"12px",cursor:"pointer"},children:c?ae.jsx(uO,{style:{fontSize:"24px"}}):ae.jsx(cO,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:r,style:{width:"130px",height:"40px",overflow:"hidden",color:"white"}})]}),a&&ae.jsxs("div",{style:{marginTop:"12px",fontSize:"14px",color:"rgba(255,255,255,0.85)"},children:[ae.jsx("button",{onClick:()=>g(!m),style:{background:"none",border:"none",color:"white",textDecoration:"underline",fontSize:"13px",cursor:"pointer",padding:0},children:m?"Hide transcript":"Show transcript"}),m&&ae.jsx("p",{style:{marginTop:"6px",lineHeight:"1.4"},children:a})]})]})},oK=({status:e,user:t})=>{if(!e||!t)return null;let a=`${t} is ${e}`;return e==="typing"?a=`${t} is typing...`:a="",ae.jsx(ae.Fragment,{children:a&&ae.jsx("div",{className:"flex justify-center mb-2",children:ae.jsx("span",{className:"px-3 py-1 bg-gray-100 text-gray-500 text-sm rounded-full",children:a})})})},lK=({message:e})=>{const t=r=>{const o=/(https?:\/\/[^\s]+)/g;return r?.split(o).map((c,f)=>o.test(c)?ae.jsx("a",{href:c.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:c},f):ae.jsx("span",{children:c},f))};if(e?.startsWith("Add this to cart for me")&&e?.includes("name:")){const o=e?.match(/name:([^,]+)/i)?.[1]?.trim()||"Product";return ae.jsxs("div",{style:{backgroundColor:"#E8F5E9",border:"1px solid #C8E6C9",borderRadius:"12px",padding:"12px 16px",color:"#2E7D32",fontWeight:500,fontSize:"15px",maxWidth:"360px",margin:"0 auto",textAlign:"center"},children:["✅ ",ae.jsx("strong",{children:o})," has been added to your cart."]})}return ae.jsx("p",{style:{color:"white"},children:t(e)})},wO=x.createContext({});function TO(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const OO=typeof window<"u",I6=OO?x.useLayoutEffect:x.useEffect,ax=x.createContext(null);function RO(e,t){e.indexOf(t)===-1&&e.push(t)}function AO(e,t){const a=e.indexOf(t);a>-1&&e.splice(a,1)}const Zu=(e,t,a)=>a>t?t:a<e?e:a;function MO(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var sK={};let Zm=()=>{},Ku=()=>{};sK.NODE_ENV!=="production"&&(Zm=(e,t,a)=>{!e&&typeof console<"u"&&console.warn(MO(t,a))},Ku=(e,t,a)=>{if(!e)throw new Error(MO(t,a))});const Qu={},k6=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function F6(e){return typeof e=="object"&&e!==null}const q6=e=>/^0[^.\s]+$/u.test(e);function _O(e){let t;return()=>(t===void 0&&(t=e()),t)}const Sl=e=>e,uK=(e,t)=>a=>t(e(a)),S0=(...e)=>e.reduce(uK),x0=(e,t,a)=>{const r=t-e;return r===0?1:(a-e)/r};class DO{constructor(){this.subscriptions=[]}add(t){return RO(this.subscriptions,t),()=>AO(this.subscriptions,t)}notify(t,a,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](t,a,r);else for(let c=0;c<o;c++){const f=this.subscriptions[c];f&&f(t,a,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const is=e=>e*1e3,Js=e=>e/1e3;function G6(e,t){return t?e*(1e3/t):0}const X6=new Set;function NO(e,t,a){e||X6.has(t)||(console.warn(MO(t,a)),X6.add(t))}const Y6=(e,t,a)=>(((1-3*a+3*t)*e+(3*a-6*t))*e+3*t)*e,cK=1e-7,fK=12;function dK(e,t,a,r,o){let c,f,m=0;do f=t+(a-t)/2,c=Y6(f,r,o)-e,c>0?a=f:t=f;while(Math.abs(c)>cK&&++m<fK);return f}function C0(e,t,a,r){if(e===t&&a===r)return Sl;const o=c=>dK(c,0,1,e,a);return c=>c===0||c===1?c:Y6(o(c),t,r)}const W6=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Z6=e=>t=>1-e(1-t),K6=C0(.33,1.53,.69,.99),$O=Z6(K6),Q6=W6($O),J6=e=>(e*=2)<1?.5*$O(e):.5*(2-Math.pow(2,-10*(e-1))),zO=e=>1-Math.sin(Math.acos(e)),ez=Z6(zO),tz=W6(zO),hK=C0(.42,0,1,1),mK=C0(0,0,.58,1),nz=C0(.42,0,.58,1),pK=e=>Array.isArray(e)&&typeof e[0]!="number",az=e=>Array.isArray(e)&&typeof e[0]=="number",rz={linear:Sl,easeIn:hK,easeInOut:nz,easeOut:mK,circIn:zO,circInOut:tz,circOut:ez,backIn:$O,backInOut:Q6,backOut:K6,anticipate:J6},gK=e=>typeof e=="string",iz=e=>{if(az(e)){Ku(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,a,r,o]=e;return C0(t,a,r,o)}else if(gK(e))return Ku(rz[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),rz[e];return e},rx=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function vK(e,t){let a=new Set,r=new Set,o=!1,c=!1;const f=new WeakSet;let m={delta:0,timestamp:0,isProcessing:!1};function g(y){f.has(y)&&(p.schedule(y),e()),y(m)}const p={schedule:(y,S=!1,E=!1)=>{const O=E&&o?a:r;return S&&f.add(y),O.has(y)||O.add(y),y},cancel:y=>{r.delete(y),f.delete(y)},process:y=>{if(m=y,o){c=!0;return}o=!0,[a,r]=[r,a],a.forEach(g),a.clear(),o=!1,c&&(c=!1,p.process(y))}};return p}const yK=40;function oz(e,t){let a=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},c=()=>a=!0,f=rx.reduce((j,V)=>(j[V]=vK(c),j),{}),{setup:m,read:g,resolveKeyframes:p,preUpdate:y,update:S,preRender:E,render:T,postRender:O}=f,M=()=>{const j=Qu.useManualTiming?o.timestamp:performance.now();a=!1,Qu.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(j-o.timestamp,yK),1)),o.timestamp=j,o.isProcessing=!0,m.process(o),g.process(o),p.process(o),y.process(o),S.process(o),E.process(o),T.process(o),O.process(o),o.isProcessing=!1,a&&t&&(r=!1,e(M))},A=()=>{a=!0,r=!0,o.isProcessing||e(M)};return{schedule:rx.reduce((j,V)=>{const N=f[V];return j[V]=(L,B=!1,z=!1)=>(a||A(),N.schedule(L,B,z)),j},{}),cancel:j=>{for(let V=0;V<rx.length;V++)f[rx[V]].cancel(j)},state:o,steps:f}}const{schedule:Pa,cancel:nf,state:ii,steps:jO}=oz(typeof requestAnimationFrame<"u"?requestAnimationFrame:Sl,!0);let ix;function bK(){ix=void 0}const yo={now:()=>(ix===void 0&&yo.set(ii.isProcessing||Qu.useManualTiming?ii.timestamp:performance.now()),ix),set:e=>{ix=e,queueMicrotask(bK)}},lz=e=>t=>typeof t=="string"&&t.startsWith(e),LO=lz("--"),SK=lz("var(--"),VO=e=>SK(e)?xK.test(e.split("/*")[0].trim()):!1,xK=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Km={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},E0={...Km,transform:e=>Zu(0,1,e)},ox={...Km,default:1},w0=e=>Math.round(e*1e5)/1e5,BO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function CK(e){return e==null}const EK=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,HO=(e,t)=>a=>!!(typeof a=="string"&&EK.test(a)&&a.startsWith(e)||t&&!CK(a)&&Object.prototype.hasOwnProperty.call(a,t)),sz=(e,t,a)=>r=>{if(typeof r!="string")return r;const[o,c,f,m]=r.match(BO);return{[e]:parseFloat(o),[t]:parseFloat(c),[a]:parseFloat(f),alpha:m!==void 0?parseFloat(m):1}},wK=e=>Zu(0,255,e),PO={...Km,transform:e=>Math.round(wK(e))},Bd={test:HO("rgb","red"),parse:sz("red","green","blue"),transform:({red:e,green:t,blue:a,alpha:r=1})=>"rgba("+PO.transform(e)+", "+PO.transform(t)+", "+PO.transform(a)+", "+w0(E0.transform(r))+")"};function TK(e){let t="",a="",r="",o="";return e.length>5?(t=e.substring(1,3),a=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),a=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,a+=a,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(a,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const UO={test:HO("#"),parse:TK,transform:Bd.transform},T0=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),af=T0("deg"),eu=T0("%"),on=T0("px"),OK=T0("vh"),RK=T0("vw"),uz={...eu,parse:e=>eu.parse(e)/100,transform:e=>eu.transform(e*100)},Qm={test:HO("hsl","hue"),parse:sz("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:a,alpha:r=1})=>"hsla("+Math.round(e)+", "+eu.transform(w0(t))+", "+eu.transform(w0(a))+", "+w0(E0.transform(r))+")"},xr={test:e=>Bd.test(e)||UO.test(e)||Qm.test(e),parse:e=>Bd.test(e)?Bd.parse(e):Qm.test(e)?Qm.parse(e):UO.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Bd.transform(e):Qm.transform(e),getAnimatableNone:e=>{const t=xr.parse(e);return t.alpha=0,xr.transform(t)}},AK=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function MK(e){return isNaN(e)&&typeof e=="string"&&(e.match(BO)?.length||0)+(e.match(AK)?.length||0)>0}const cz="number",fz="color",_K="var",DK="var(",dz="${}",NK=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function O0(e){const t=e.toString(),a=[],r={color:[],number:[],var:[]},o=[];let c=0;const m=t.replace(NK,g=>(xr.test(g)?(r.color.push(c),o.push(fz),a.push(xr.parse(g))):g.startsWith(DK)?(r.var.push(c),o.push(_K),a.push(g)):(r.number.push(c),o.push(cz),a.push(parseFloat(g))),++c,dz)).split(dz);return{values:a,split:m,indexes:r,types:o}}function hz(e){return O0(e).values}function mz(e){const{split:t,types:a}=O0(e),r=t.length;return o=>{let c="";for(let f=0;f<r;f++)if(c+=t[f],o[f]!==void 0){const m=a[f];m===cz?c+=w0(o[f]):m===fz?c+=xr.transform(o[f]):c+=o[f]}return c}}const $K=e=>typeof e=="number"?0:xr.test(e)?xr.getAnimatableNone(e):e;function zK(e){const t=hz(e);return mz(e)(t.map($K))}const rf={test:MK,parse:hz,createTransformer:mz,getAnimatableNone:zK};function IO(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+(t-e)*6*a:a<1/2?t:a<2/3?e+(t-e)*(2/3-a)*6:e}function jK({hue:e,saturation:t,lightness:a,alpha:r}){e/=360,t/=100,a/=100;let o=0,c=0,f=0;if(!t)o=c=f=a;else{const m=a<.5?a*(1+t):a+t-a*t,g=2*a-m;o=IO(g,m,e+1/3),c=IO(g,m,e),f=IO(g,m,e-1/3)}return{red:Math.round(o*255),green:Math.round(c*255),blue:Math.round(f*255),alpha:r}}function lx(e,t){return a=>a>0?t:e}const Za=(e,t,a)=>e+(t-e)*a,kO=(e,t,a)=>{const r=e*e,o=a*(t*t-r)+r;return o<0?0:Math.sqrt(o)},LK=[UO,Bd,Qm],VK=e=>LK.find(t=>t.test(e));function pz(e){const t=VK(e);if(Zm(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let a=t.parse(e);return t===Qm&&(a=jK(a)),a}const gz=(e,t)=>{const a=pz(e),r=pz(t);if(!a||!r)return lx(e,t);const o={...a};return c=>(o.red=kO(a.red,r.red,c),o.green=kO(a.green,r.green,c),o.blue=kO(a.blue,r.blue,c),o.alpha=Za(a.alpha,r.alpha,c),Bd.transform(o))},FO=new Set(["none","hidden"]);function BK(e,t){return FO.has(e)?a=>a<=0?e:t:a=>a>=1?t:e}function HK(e,t){return a=>Za(e,t,a)}function qO(e){return typeof e=="number"?HK:typeof e=="string"?VO(e)?lx:xr.test(e)?gz:IK:Array.isArray(e)?vz:typeof e=="object"?xr.test(e)?gz:PK:lx}function vz(e,t){const a=[...e],r=a.length,o=e.map((c,f)=>qO(c)(c,t[f]));return c=>{for(let f=0;f<r;f++)a[f]=o[f](c);return a}}function PK(e,t){const a={...e,...t},r={};for(const o in a)e[o]!==void 0&&t[o]!==void 0&&(r[o]=qO(e[o])(e[o],t[o]));return o=>{for(const c in r)a[c]=r[c](o);return a}}function UK(e,t){const a=[],r={color:0,var:0,number:0};for(let o=0;o<t.values.length;o++){const c=t.types[o],f=e.indexes[c][r[c]],m=e.values[f]??0;a[o]=m,r[c]++}return a}const IK=(e,t)=>{const a=rf.createTransformer(t),r=O0(e),o=O0(t);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?FO.has(e)&&!o.values.length||FO.has(t)&&!r.values.length?BK(e,t):S0(vz(UK(r,o),o.values),a):(Zm(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),lx(e,t))};function yz(e,t,a){return typeof e=="number"&&typeof t=="number"&&typeof a=="number"?Za(e,t,a):qO(e)(e,t)}const kK=e=>{const t=({timestamp:a})=>e(a);return{start:(a=!0)=>Pa.update(t,a),stop:()=>nf(t),now:()=>ii.isProcessing?ii.timestamp:yo.now()}},bz=(e,t,a=10)=>{let r="";const o=Math.max(Math.round(t/a),2);for(let c=0;c<o;c++)r+=Math.round(e(c/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},sx=2e4;function GO(e){let t=0;const a=50;let r=e.next(t);for(;!r.done&&t<sx;)t+=a,r=e.next(t);return t>=sx?1/0:t}function FK(e,t=100,a){const r=a({...e,keyframes:[0,t]}),o=Math.min(GO(r),sx);return{type:"keyframes",ease:c=>r.next(o*c).value/t,duration:Js(o)}}const qK=5;function Sz(e,t,a){const r=Math.max(t-qK,0);return G6(a-e(r),t-r)}const Ka={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},XO=.001;function GK({duration:e=Ka.duration,bounce:t=Ka.bounce,velocity:a=Ka.velocity,mass:r=Ka.mass}){let o,c;Zm(e<=is(Ka.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let f=1-t;f=Zu(Ka.minDamping,Ka.maxDamping,f),e=Zu(Ka.minDuration,Ka.maxDuration,Js(e)),f<1?(o=p=>{const y=p*f,S=y*e,E=y-a,T=YO(p,f),O=Math.exp(-S);return XO-E/T*O},c=p=>{const S=p*f*e,E=S*a+a,T=Math.pow(f,2)*Math.pow(p,2)*e,O=Math.exp(-S),M=YO(Math.pow(p,2),f);return(-o(p)+XO>0?-1:1)*((E-T)*O)/M}):(o=p=>{const y=Math.exp(-p*e),S=(p-a)*e+1;return-XO+y*S},c=p=>{const y=Math.exp(-p*e),S=(a-p)*(e*e);return y*S});const m=5/e,g=YK(o,c,m);if(e=is(e),isNaN(g))return{stiffness:Ka.stiffness,damping:Ka.damping,duration:e};{const p=Math.pow(g,2)*r;return{stiffness:p,damping:f*2*Math.sqrt(r*p),duration:e}}}const XK=12;function YK(e,t,a){let r=a;for(let o=1;o<XK;o++)r=r-e(r)/t(r);return r}function YO(e,t){return e*Math.sqrt(1-t*t)}const WK=["duration","bounce"],ZK=["stiffness","damping","mass"];function xz(e,t){return t.some(a=>e[a]!==void 0)}function KK(e){let t={velocity:Ka.velocity,stiffness:Ka.stiffness,damping:Ka.damping,mass:Ka.mass,isResolvedFromDuration:!1,...e};if(!xz(e,ZK)&&xz(e,WK))if(e.visualDuration){const a=e.visualDuration,r=2*Math.PI/(a*1.2),o=r*r,c=2*Zu(.05,1,1-(e.bounce||0))*Math.sqrt(o);t={...t,mass:Ka.mass,stiffness:o,damping:c}}else{const a=GK(e);t={...t,...a,mass:Ka.mass},t.isResolvedFromDuration=!0}return t}function ux(e=Ka.visualDuration,t=Ka.bounce){const a=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:o}=a;const c=a.keyframes[0],f=a.keyframes[a.keyframes.length-1],m={done:!1,value:c},{stiffness:g,damping:p,mass:y,duration:S,velocity:E,isResolvedFromDuration:T}=KK({...a,velocity:-Js(a.velocity||0)}),O=E||0,M=p/(2*Math.sqrt(g*y)),A=f-c,D=Js(Math.sqrt(g/y)),_=Math.abs(A)<5;r||(r=_?Ka.restSpeed.granular:Ka.restSpeed.default),o||(o=_?Ka.restDelta.granular:Ka.restDelta.default);let j;if(M<1){const N=YO(D,M);j=L=>{const B=Math.exp(-M*D*L);return f-B*((O+M*D*A)/N*Math.sin(N*L)+A*Math.cos(N*L))}}else if(M===1)j=N=>f-Math.exp(-D*N)*(A+(O+D*A)*N);else{const N=D*Math.sqrt(M*M-1);j=L=>{const B=Math.exp(-M*D*L),z=Math.min(N*L,300);return f-B*((O+M*D*A)*Math.sinh(z)+N*A*Math.cosh(z))/N}}const V={calculatedDuration:T&&S||null,next:N=>{const L=j(N);if(T)m.done=N>=S;else{let B=N===0?O:0;M<1&&(B=N===0?is(O):Sz(j,N,L));const z=Math.abs(B)<=r,U=Math.abs(f-L)<=o;m.done=z&&U}return m.value=m.done?f:L,m},toString:()=>{const N=Math.min(GO(V),sx),L=bz(B=>V.next(N*B).value,N,30);return N+"ms "+L},toTransition:()=>{}};return V}ux.applyToOptions=e=>{const t=FK(e,100,ux);return e.ease=t.ease,e.duration=is(t.duration),e.type="keyframes",e};function WO({keyframes:e,velocity:t=0,power:a=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:c=500,modifyTarget:f,min:m,max:g,restDelta:p=.5,restSpeed:y}){const S=e[0],E={done:!1,value:S},T=z=>m!==void 0&&z<m||g!==void 0&&z>g,O=z=>m===void 0?g:g===void 0||Math.abs(m-z)<Math.abs(g-z)?m:g;let M=a*t;const A=S+M,D=f===void 0?A:f(A);D!==A&&(M=D-S);const _=z=>-M*Math.exp(-z/r),j=z=>D+_(z),V=z=>{const U=_(z),H=j(z);E.done=Math.abs(U)<=p,E.value=E.done?D:H};let N,L;const B=z=>{T(E.value)&&(N=z,L=ux({keyframes:[E.value,O(E.value)],velocity:Sz(j,z,E.value),damping:o,stiffness:c,restDelta:p,restSpeed:y}))};return B(0),{calculatedDuration:null,next:z=>{let U=!1;return!L&&N===void 0&&(U=!0,V(z),B(z)),N!==void 0&&z>=N?L.next(z-N):(!U&&V(z),E)}}}function QK(e,t,a){const r=[],o=a||Qu.mix||yz,c=e.length-1;for(let f=0;f<c;f++){let m=o(e[f],e[f+1]);if(t){const g=Array.isArray(t)?t[f]||Sl:t;m=S0(g,m)}r.push(m)}return r}function JK(e,t,{clamp:a=!0,ease:r,mixer:o}={}){const c=e.length;if(Ku(c===t.length,"Both input and output ranges must be the same length","range-length"),c===1)return()=>t[0];if(c===2&&t[0]===t[1])return()=>t[1];const f=e[0]===e[1];e[0]>e[c-1]&&(e=[...e].reverse(),t=[...t].reverse());const m=QK(t,r,o),g=m.length,p=y=>{if(f&&y<e[0])return t[0];let S=0;if(g>1)for(;S<e.length-2&&!(y<e[S+1]);S++);const E=x0(e[S],e[S+1],y);return m[S](E)};return a?y=>p(Zu(e[0],e[c-1],y)):p}function eQ(e,t){const a=e[e.length-1];for(let r=1;r<=t;r++){const o=x0(0,t,r);e.push(Za(a,1,o))}}function tQ(e){const t=[0];return eQ(t,e.length-1),t}function nQ(e,t){return e.map(a=>a*t)}function aQ(e,t){return e.map(()=>t||nz).splice(0,e.length-1)}function Jm({duration:e=300,keyframes:t,times:a,ease:r="easeInOut"}){const o=pK(r)?r.map(iz):iz(r),c={done:!1,value:t[0]},f=nQ(a&&a.length===t.length?a:tQ(t),e),m=JK(f,t,{ease:Array.isArray(o)?o:aQ(t,o)});return{calculatedDuration:e,next:g=>(c.value=m(g),c.done=g>=e,c)}}const rQ=e=>e!==null;function ZO(e,{repeat:t,repeatType:a="loop"},r,o=1){const c=e.filter(rQ),m=o<0||t&&a!=="loop"&&t%2===1?0:c.length-1;return!m||r===void 0?c[m]:r}const iQ={decay:WO,inertia:WO,tween:Jm,keyframes:Jm,spring:ux};function Cz(e){typeof e.type=="string"&&(e.type=iQ[e.type])}class KO{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,a){return this.finished.then(t,a)}}var oQ={};const lQ=e=>e/100;class QO extends KO{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:a}=this.options;a&&a.updatedAt!==yo.now()&&this.tick(yo.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Cz(t);const{type:a=Jm,repeat:r=0,repeatDelay:o=0,repeatType:c,velocity:f=0}=t;let{keyframes:m}=t;const g=a||Jm;oQ.NODE_ENV!=="production"&&g!==Jm&&Ku(m.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${m}`,"spring-two-frames"),g!==Jm&&typeof m[0]!="number"&&(this.mixKeyframes=S0(lQ,yz(m[0],m[1])),m=[0,100]);const p=g({...t,keyframes:m});c==="mirror"&&(this.mirroredGenerator=g({...t,keyframes:[...m].reverse(),velocity:-f})),p.calculatedDuration===null&&(p.calculatedDuration=GO(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=p}updateTime(t){const a=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=a}tick(t,a=!1){const{generator:r,totalDuration:o,mixKeyframes:c,mirroredGenerator:f,resolvedDuration:m,calculatedDuration:g}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:y,repeat:S,repeatType:E,repeatDelay:T,type:O,onUpdate:M,finalKeyframe:A}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-o/this.speed,this.startTime)),a?this.currentTime=t:this.updateTime(t);const D=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?D<0:D>o;this.currentTime=Math.max(D,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let j=this.currentTime,V=r;if(S){const z=Math.min(this.currentTime,o)/m;let U=Math.floor(z),H=z%1;!H&&z>=1&&(H=1),H===1&&U--,U=Math.min(U,S+1),!!(U%2)&&(E==="reverse"?(H=1-H,T&&(H-=T/m)):E==="mirror"&&(V=f)),j=Zu(0,1,H)*m}const N=_?{done:!1,value:y[0]}:V.next(j);c&&(N.value=c(N.value));let{done:L}=N;!_&&g!==null&&(L=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&L);return B&&O!==WO&&(N.value=ZO(y,this.options,A,this.speed)),M&&M(N.value),B&&this.finish(),N}then(t,a){return this.finished.then(t,a)}get duration(){return Js(this.calculatedDuration)}get time(){return Js(this.currentTime)}set time(t){t=is(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(yo.now());const a=this.playbackSpeed!==t;this.playbackSpeed=t,a&&(this.time=Js(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=kK,startTime:a}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=a??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(yo.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function sQ(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Hd=e=>e*180/Math.PI,JO=e=>{const t=Hd(Math.atan2(e[1],e[0]));return eR(t)},uQ={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:JO,rotateZ:JO,skewX:e=>Hd(Math.atan(e[1])),skewY:e=>Hd(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},eR=e=>(e=e%360,e<0&&(e+=360),e),Ez=JO,wz=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Tz=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),cQ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:wz,scaleY:Tz,scale:e=>(wz(e)+Tz(e))/2,rotateX:e=>eR(Hd(Math.atan2(e[6],e[5]))),rotateY:e=>eR(Hd(Math.atan2(-e[2],e[0]))),rotateZ:Ez,rotate:Ez,skewX:e=>Hd(Math.atan(e[4])),skewY:e=>Hd(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function tR(e){return e.includes("scale")?1:0}function nR(e,t){if(!e||e==="none")return tR(t);const a=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(a)r=cQ,o=a;else{const m=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=uQ,o=m}if(!o)return tR(t);const c=r[t],f=o[1].split(",").map(dQ);return typeof c=="function"?c(f):f[c]}const fQ=(e,t)=>{const{transform:a="none"}=getComputedStyle(e);return nR(a,t)};function dQ(e){return parseFloat(e.trim())}const ep=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],tp=new Set(ep),Oz=e=>e===Km||e===on,hQ=new Set(["x","y","z"]),mQ=ep.filter(e=>!hQ.has(e));function pQ(e){const t=[];return mQ.forEach(a=>{const r=e.getValue(a);r!==void 0&&(t.push([a,r.get()]),r.set(a.startsWith("scale")?1:0))}),t}const Pd={width:({x:e},{paddingLeft:t="0",paddingRight:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),height:({y:e},{paddingTop:t="0",paddingBottom:a="0"})=>e.max-e.min-parseFloat(t)-parseFloat(a),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>nR(t,"x"),y:(e,{transform:t})=>nR(t,"y")};Pd.translateX=Pd.x,Pd.translateY=Pd.y;const Ud=new Set;let aR=!1,rR=!1,iR=!1;function Rz(){if(rR){const e=Array.from(Ud).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),a=new Map;t.forEach(r=>{const o=pQ(r);o.length&&(a.set(r,o),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const o=a.get(r);o&&o.forEach(([c,f])=>{r.getValue(c)?.set(f)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}rR=!1,aR=!1,Ud.forEach(e=>e.complete(iR)),Ud.clear()}function Az(){Ud.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(rR=!0)})}function gQ(){iR=!0,Az(),Rz(),iR=!1}class oR{constructor(t,a,r,o,c,f=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=a,this.name=r,this.motionValue=o,this.element=c,this.isAsync=f}scheduleResolve(){this.state="scheduled",this.isAsync?(Ud.add(this),aR||(aR=!0,Pa.read(Az),Pa.resolveKeyframes(Rz))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:a,element:r,motionValue:o}=this;if(t[0]===null){const c=o?.get(),f=t[t.length-1];if(c!==void 0)t[0]=c;else if(r&&a){const m=r.readValue(a,f);m!=null&&(t[0]=m)}t[0]===void 0&&(t[0]=f),o&&c===void 0&&o.set(t[0])}sQ(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ud.delete(this)}cancel(){this.state==="scheduled"&&(Ud.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const vQ=e=>e.startsWith("--");function yQ(e,t,a){vQ(t)?e.style.setProperty(t,a):e.style[t]=a}const bQ=_O(()=>window.ScrollTimeline!==void 0),SQ={};function xQ(e,t){const a=_O(e);return()=>SQ[t]??a()}const Mz=xQ(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),R0=([e,t,a,r])=>`cubic-bezier(${e}, ${t}, ${a}, ${r})`,_z={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:R0([0,.65,.55,1]),circOut:R0([.55,0,1,.45]),backIn:R0([.31,.01,.66,-.59]),backOut:R0([.33,1.53,.69,.99])};function Dz(e,t){if(e)return typeof e=="function"?Mz()?bz(e,t):"ease-out":az(e)?R0(e):Array.isArray(e)?e.map(a=>Dz(a,t)||_z.easeOut):_z[e]}function CQ(e,t,a,{delay:r=0,duration:o=300,repeat:c=0,repeatType:f="loop",ease:m="easeOut",times:g}={},p=void 0){const y={[t]:a};g&&(y.offset=g);const S=Dz(m,o);Array.isArray(S)&&(y.easing=S);const E={delay:r,duration:o,easing:Array.isArray(S)?"linear":S,fill:"both",iterations:c+1,direction:f==="reverse"?"alternate":"normal"};return p&&(E.pseudoElement=p),e.animate(y,E)}function Nz(e){return typeof e=="function"&&"applyToOptions"in e}function EQ({type:e,...t}){return Nz(e)&&Mz()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class wQ extends KO{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:a,name:r,keyframes:o,pseudoElement:c,allowFlatten:f=!1,finalKeyframe:m,onComplete:g}=t;this.isPseudoElement=!!c,this.allowFlatten=f,this.options=t,Ku(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const p=EQ(t);this.animation=CQ(a,r,o,p,c),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const y=ZO(o,this.options,m,this.speed);this.updateMotionValue?this.updateMotionValue(y):yQ(a,r,y),this.animation.cancel()}g?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Js(Number(t))}get time(){return Js(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=is(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:a}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&bQ()?(this.animation.timeline=t,Sl):a(this)}}const $z={anticipate:J6,backInOut:Q6,circInOut:tz};function TQ(e){return e in $z}function OQ(e){typeof e.ease=="string"&&TQ(e.ease)&&(e.ease=$z[e.ease])}const zz=10;class RQ extends wQ{constructor(t){OQ(t),Cz(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:a,onUpdate:r,onComplete:o,element:c,...f}=this.options;if(!a)return;if(t!==void 0){a.set(t);return}const m=new QO({...f,autoplay:!1}),g=is(this.finishedTime??this.time);a.setWithVelocity(m.sample(g-zz).value,m.sample(g).value,zz),m.stop()}}const jz=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(rf.test(e)||e==="0")&&!e.startsWith("url("));function AQ(e){const t=e[0];if(e.length===1)return!0;for(let a=0;a<e.length;a++)if(e[a]!==t)return!0}function MQ(e,t,a,r){const o=e[0];if(o===null)return!1;if(t==="display"||t==="visibility")return!0;const c=e[e.length-1],f=jz(o,t),m=jz(c,t);return Zm(f===m,`You are trying to animate ${t} from "${o}" to "${c}". "${f?c:o}" is not an animatable value.`,"value-not-animatable"),!f||!m?!1:AQ(e)||(a==="spring"||Nz(a))&&r}const _Q=new Set(["opacity","clipPath","filter","transform"]),DQ=_O(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function NQ(e){const{motionValue:t,name:a,repeatDelay:r,repeatType:o,damping:c,type:f}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:g,transformTemplate:p}=t.owner.getProps();return DQ()&&a&&_Q.has(a)&&(a!=="transform"||!p)&&!g&&!r&&o!=="mirror"&&c!==0&&f!=="inertia"}const $Q=40;class zQ extends KO{constructor({autoplay:t=!0,delay:a=0,type:r="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:f="loop",keyframes:m,name:g,motionValue:p,element:y,...S}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=yo.now();const E={autoplay:t,delay:a,type:r,repeat:o,repeatDelay:c,repeatType:f,name:g,motionValue:p,element:y,...S},T=y?.KeyframeResolver||oR;this.keyframeResolver=new T(m,(O,M,A)=>this.onKeyframesResolved(O,M,E,!A),g,p,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,a,r,o){this.keyframeResolver=void 0;const{name:c,type:f,velocity:m,delay:g,isHandoff:p,onUpdate:y}=r;this.resolvedAt=yo.now(),MQ(t,c,f,m)||((Qu.instantAnimations||!g)&&y?.(ZO(t,r,a)),t[0]=t[t.length-1],r.duration=0,r.repeat=0);const E={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>$Q?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:a,...r,keyframes:t},T=!p&&NQ(E)?new RQ({...E,element:E.motionValue.owner.current}):new QO(E);T.finished.then(()=>this.notifyFinished()).catch(Sl),this.pendingTimeline&&(this.stopTimeline=T.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=T}get finished(){return this._animation?this.animation.finished:this._finished}then(t,a){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),gQ()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const jQ=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LQ(e){const t=jQ.exec(e);if(!t)return[,];const[,a,r,o]=t;return[`--${a??r}`,o]}const VQ=4;function Lz(e,t,a=1){Ku(a<=VQ,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,o]=LQ(e);if(!r)return;const c=window.getComputedStyle(t).getPropertyValue(r);if(c){const f=c.trim();return k6(f)?parseFloat(f):f}return VO(o)?Lz(o,t,a+1):o}function lR(e,t){return e?.[t]??e?.default??e}const Vz=new Set(["width","height","top","left","right","bottom",...ep]),BQ={test:e=>e==="auto",parse:e=>e},Bz=e=>t=>t.test(e),Hz=[Km,on,eu,af,RK,OK,BQ],Pz=e=>Hz.find(Bz(e));function HQ(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||q6(e):!0}const PQ=new Set(["brightness","contrast","saturate","opacity"]);function UQ(e){const[t,a]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=a.match(BO)||[];if(!r)return e;const o=a.replace(r,"");let c=PQ.has(t)?1:0;return r!==a&&(c*=100),t+"("+c+o+")"}const IQ=/\b([a-z-]*)\(.*?\)/gu,sR={...rf,getAnimatableNone:e=>{const t=e.match(IQ);return t?t.map(UQ).join(" "):e}},Uz={...Km,transform:Math.round},uR={borderWidth:on,borderTopWidth:on,borderRightWidth:on,borderBottomWidth:on,borderLeftWidth:on,borderRadius:on,radius:on,borderTopLeftRadius:on,borderTopRightRadius:on,borderBottomRightRadius:on,borderBottomLeftRadius:on,width:on,maxWidth:on,height:on,maxHeight:on,top:on,right:on,bottom:on,left:on,padding:on,paddingTop:on,paddingRight:on,paddingBottom:on,paddingLeft:on,margin:on,marginTop:on,marginRight:on,marginBottom:on,marginLeft:on,backgroundPositionX:on,backgroundPositionY:on,...{rotate:af,rotateX:af,rotateY:af,rotateZ:af,scale:ox,scaleX:ox,scaleY:ox,scaleZ:ox,skew:af,skewX:af,skewY:af,distance:on,translateX:on,translateY:on,translateZ:on,x:on,y:on,z:on,perspective:on,transformPerspective:on,opacity:E0,originX:uz,originY:uz,originZ:on},zIndex:Uz,fillOpacity:E0,strokeOpacity:E0,numOctaves:Uz},kQ={...uR,color:xr,backgroundColor:xr,outlineColor:xr,fill:xr,stroke:xr,borderColor:xr,borderTopColor:xr,borderRightColor:xr,borderBottomColor:xr,borderLeftColor:xr,filter:sR,WebkitFilter:sR},Iz=e=>kQ[e];function kz(e,t){let a=Iz(e);return a!==sR&&(a=rf),a.getAnimatableNone?a.getAnimatableNone(t):void 0}const FQ=new Set(["auto","none","0"]);function qQ(e,t,a){let r=0,o;for(;r<e.length&&!o;){const c=e[r];typeof c=="string"&&!FQ.has(c)&&O0(c).values.length&&(o=e[r]),r++}if(o&&a)for(const c of t)e[c]=kz(a,o)}class GQ extends oR{constructor(t,a,r,o,c){super(t,a,r,o,c,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:a,name:r}=this;if(!a||!a.current)return;super.readKeyframes();for(let g=0;g<t.length;g++){let p=t[g];if(typeof p=="string"&&(p=p.trim(),VO(p))){const y=Lz(p,a.current);y!==void 0&&(t[g]=y),g===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!Vz.has(r)||t.length!==2)return;const[o,c]=t,f=Pz(o),m=Pz(c);if(f!==m)if(Oz(f)&&Oz(m))for(let g=0;g<t.length;g++){const p=t[g];typeof p=="string"&&(t[g]=parseFloat(p))}else Pd[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:a}=this,r=[];for(let o=0;o<t.length;o++)(t[o]===null||HQ(t[o]))&&r.push(o);r.length&&qQ(t,r,a)}measureInitialState(){const{element:t,unresolvedKeyframes:a,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Pd[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a[0]=this.measuredOrigin;const o=a[a.length-1];o!==void 0&&t.getValue(r,o).jump(o,!1)}measureEndState(){const{element:t,name:a,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const o=t.getValue(a);o&&o.jump(this.measuredOrigin,!1);const c=r.length-1,f=r[c];r[c]=Pd[a](t.measureViewportBox(),window.getComputedStyle(t.current)),f!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=f),this.removedTransforms?.length&&this.removedTransforms.forEach(([m,g])=>{t.getValue(m).set(g)}),this.resolveNoneKeyframes()}}function XQ(e,t,a){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const o=a?.[e]??r.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e)}const Fz=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function qz(e){return F6(e)&&"offsetHeight"in e}var YQ={};const Gz=30,WQ=e=>!isNaN(parseFloat(e));class ZQ{constructor(t,a={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,o=!0)=>{const c=yo.now();if(this.updatedAt!==c&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const f of this.dependents)f.dirty();o&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=a.owner}setCurrent(t){this.current=t,this.updatedAt=yo.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=WQ(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return YQ.NODE_ENV!=="production"&&NO(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,a){this.events[t]||(this.events[t]=new DO);const r=this.events[t].add(a);return t==="change"?()=>{r(),Pa.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,a){this.passiveEffect=t,this.stopPassiveEffect=a}set(t,a=!0){!a||!this.passiveEffect?this.updateAndNotify(t,a):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,a,r){this.set(a),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,a=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,a&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=yo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Gz)return 0;const a=Math.min(this.updatedAt-this.prevUpdatedAt,Gz);return G6(parseFloat(this.current)-parseFloat(this.prevFrameValue),a)}start(t){return this.stop(),new Promise(a=>{this.hasAnimated=!0,this.animation=t(a),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function np(e,t){return new ZQ(e,t)}const{schedule:cR}=oz(queueMicrotask,!1),os={x:!1,y:!1};function Xz(){return os.x||os.y}function KQ(e){return e==="x"||e==="y"?os[e]?null:(os[e]=!0,()=>{os[e]=!1}):os.x||os.y?null:(os.x=os.y=!0,()=>{os.x=os.y=!1})}function Yz(e,t){const a=XQ(e),r=new AbortController,o={passive:!0,...t,signal:r.signal};return[a,o,()=>r.abort()]}function Wz(e){return!(e.pointerType==="touch"||Xz())}function QQ(e,t,a={}){const[r,o,c]=Yz(e,a),f=m=>{if(!Wz(m))return;const{target:g}=m,p=t(g,m);if(typeof p!="function"||!g)return;const y=S=>{Wz(S)&&(p(S),g.removeEventListener("pointerleave",y))};g.addEventListener("pointerleave",y,o)};return r.forEach(m=>{m.addEventListener("pointerenter",f,o)}),c}const Zz=(e,t)=>t?e===t?!0:Zz(e,t.parentElement):!1,fR=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,JQ=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function eJ(e){return JQ.has(e.tagName)||e.tabIndex!==-1}const cx=new WeakSet;function Kz(e){return t=>{t.key==="Enter"&&e(t)}}function dR(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const tJ=(e,t)=>{const a=e.currentTarget;if(!a)return;const r=Kz(()=>{if(cx.has(a))return;dR(a,"down");const o=Kz(()=>{dR(a,"up")}),c=()=>dR(a,"cancel");a.addEventListener("keyup",o,t),a.addEventListener("blur",c,t)});a.addEventListener("keydown",r,t),a.addEventListener("blur",()=>a.removeEventListener("keydown",r),t)};function Qz(e){return fR(e)&&!Xz()}function nJ(e,t,a={}){const[r,o,c]=Yz(e,a),f=m=>{const g=m.currentTarget;if(!Qz(m))return;cx.add(g);const p=t(g,m),y=(T,O)=>{window.removeEventListener("pointerup",S),window.removeEventListener("pointercancel",E),cx.has(g)&&cx.delete(g),Qz(T)&&typeof p=="function"&&p(T,{success:O})},S=T=>{y(T,g===window||g===document||a.useGlobalTarget||Zz(g,T.target))},E=T=>{y(T,!1)};window.addEventListener("pointerup",S,o),window.addEventListener("pointercancel",E,o)};return r.forEach(m=>{(a.useGlobalTarget?window:m).addEventListener("pointerdown",f,o),qz(m)&&(m.addEventListener("focus",p=>tJ(p,o)),!eJ(m)&&!m.hasAttribute("tabindex")&&(m.tabIndex=0))}),c}function Jz(e){return F6(e)&&"ownerSVGElement"in e}function aJ(e){return Jz(e)&&e.tagName==="svg"}const Ti=e=>!!(e&&e.getVelocity),rJ=[...Hz,xr,rf],iJ=e=>rJ.find(Bz(e)),hR=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class oJ extends x.Component{getSnapshotBeforeUpdate(t){const a=this.props.childRef.current;if(a&&t.isPresent&&!this.props.isPresent){const r=a.offsetParent,o=qz(r)&&r.offsetWidth||0,c=this.props.sizeRef.current;c.height=a.offsetHeight||0,c.width=a.offsetWidth||0,c.top=a.offsetTop,c.left=a.offsetLeft,c.right=o-c.width-c.left}return null}componentDidUpdate(){}render(){return this.props.children}}function lJ({children:e,isPresent:t,anchorX:a,root:r}){const o=x.useId(),c=x.useRef(null),f=x.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:m}=x.useContext(hR);return x.useInsertionEffect(()=>{const{width:g,height:p,top:y,left:S,right:E}=f.current;if(t||!c.current||!g||!p)return;const T=a==="left"?`left: ${S}`:`right: ${E}`;c.current.dataset.motionPopId=o;const O=document.createElement("style");m&&(O.nonce=m);const M=r??document.head;return M.appendChild(O),O.sheet&&O.sheet.insertRule(`
645
645
  [data-motion-pop-id="${o}"] {
646
646
  position: absolute !important;
647
647
  width: ${g}px !important;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shopify-chatbot-widget",
3
3
  "private": false,
4
- "version": "0.7.0",
4
+ "version": "0.7.3",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",