shopify-chatbot-widget 0.5.0 → 0.5.1
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.
|
@@ -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 N=0,_=0,j=0;for(let L=0;L<=m;L++){const D=Math.round(L*M);if(D>N){const z=Math.round(_*y*o),U=z+Math.round(j*y*o)||1;let B=y-z;a.barAlign==="top"?B=0:a.barAlign==="bottom"&&(B=p-U),r[A](N*(E+T),B,E,U,O),N=D,_=0,j=0}const V=Math.abs(c[L]||0),H=Math.abs(f[L]||0);V>_&&(_=V),H>j&&(j=H)}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 N=y+(Math.round(T*y*o)||1)*(f===0?-1:1);r.lineTo(E,N),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,N=A+(a.barGap||A/2);y%N!=0&&(y=Math.floor(y/N)*N)}if(y===0)return;const E=A=>{if(A<0||A>=T||S[A])return;S[A]=!0;const N=A*y;let _=Math.min(p-N,y);if(a.barWidth||a.barGap){const L=a.barWidth||.5,D=L+(a.barGap||L/2);_=Math.floor(_/D)*D}if(_<=0)return;const j=t.map(L=>{const D=Math.floor(N/p*L.length),V=Math.floor((N+_)/p*L.length);return L.slice(D,V)});this.renderSingleCanvas(j,a,_,o,N,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:N}=this.scrollContainer,_=Math.floor(N/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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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}=jZ(),[S,E]=x.useState(!1),[T,O]=x.useState(!1),M=x.useRef(null),A=x.useRef(null),N=x.useRef([]),_=x.useRef(null),j=x.useRef(null),L=U=>{const B=U.target.files?.[0];B&&f(B)},D=()=>{f(null)},V=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}),B=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",J=new MediaRecorder(U,{mimeType:B});M.current=J,N.current=[],J.ondataavailable=X=>{X.data.size>0&&N.current.push(X.data)},J.onstop=()=>{const X=new Blob(N.current,{type:B});g(X),E(!1),U.getTracks().forEach(W=>W.stop())},J.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 H=()=>{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(c0,{style:{position:"absolute",top:"-0.5rem",right:"-0.5rem",fontSize:"14px",color:"#ef4444",background:"white",borderRadius:"9999px",cursor:"pointer"},onClick:U=>{U.stopPropagation(),D()}})]}):ae.jsx(p4,{style:{fontSize:"20px"}})}),ae.jsx("input",{disabled:p,type:"file",accept:"image/*",ref:A,onChange:L,style:{display:"none",padding:"0"}}),ae.jsx(Nd,{title:S?"Stop Recording":"Send Audio",children:ae.jsx("button",{onClick:V,style:{color:S?"#ef4444":"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:S?ae.jsx(y4,{style:{fontSize:"20px"}}):ae.jsx(f4,{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:H,children:T?ae.jsx(GT,{style:{fontSize:"24px"}}):ae.jsx(XT,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:_,style:{width:"100%",height:"2rem"}}),ae.jsx(c0,{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),D(),t("")):e.trim()&&(a(),t("")))}})}),ae.jsx("button",{disabled:p,onClick:()=>{const U=!!c,B=!!e.trim();U?(r(c,e),D(),t("")):!!m?(o(m),z()):B&&a()},"aria-label":y("chatInput.send"),style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:ae.jsx(g4,{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})=>!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(([S,E])=>{const T=t[S]||(E.length>0?E[0].variant_id:""),O=E.find(D=>D.variant_id===T)||E[0];if(!O)return null;const M=r[O.variant_id]||0,A=Array.from(new Set(E.map(D=>D.option?.trim()??"").filter(D=>D&&D.toLowerCase()!=="none"))),N=D=>{const V=E.find(H=>H.option===D);V&&a(H=>({...H,[S]:V.variant_id}))},_=async()=>{o(D=>({...D,[O.variant_id]:(D[O.variant_id]||0)+1})),await c(O.variant_id,O.name,1)},j=async()=>{M!==0&&(o(D=>({...D,[O.variant_id]:Math.max(0,(D[O.variant_id]||0)-1)})),await f(O.variant_id,1))},L=O.option??A[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(O.link,"_blank"),children:[ae.jsx("img",{src:O.image,alt:O.name,className:"sallaX-img",loading:"lazy"}),ae.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:D=>D.stopPropagation(),children:"View"})]}),ae.jsxs("div",{className:"sallaX-body",children:[ae.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:O.name,children:g(O.name)}),ae.jsx("div",{className:"sallaX-row",children:ae.jsx("span",{className:"sallaX-price","aria-label":"Price",children:O.price})}),A.length>0&&ae.jsxs("div",{className:"sallaX-selectWrap",children:[ae.jsx("label",{htmlFor:`sallaX-select-${S}`,className:"sallaX-selectLabel",children:"Choose an option"}),ae.jsx("select",{id:`sallaX-select-${S}`,className:"sallaX-select","aria-label":"Choose an option",value:L,onChange:D=>N(D.target.value),children:A.map(D=>ae.jsx("option",{value:D,children:D},D))})]}),ae.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:j,"aria-label":"Decrease quantity",disabled:M===0,children:"–"}),ae.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:M}),ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:_,"aria-label":"Increase quantity",children:"+"})]})]})]},S)})})});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 B=Math.floor(z);return B===U||B+1===U?z:U}function r(){return Date.now()}function o(z,U,B){if(U="data-keen-slider-"+U,B===null)return z.removeAttribute(U);z.setAttribute(U,B||"")}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,B,J,X){U.addListener?U.addListener(J):U.addEventListener(B,J,X),z.push([U,B,J,X])},input:function(U,B,J,X){this.add(U,B,function(W){return function(K){K.nativeEvent&&(K=K.nativeEvent);var re=K.changedTouches||[],F=K.targetTouches||[],G=K.detail&&K.detail.x?K.detail:null;return W({id:G?G.identifier?G.identifier:"i":F[0]?F[0]?F[0].identifier:"e":"d",idChanged:G?G.identifier?G.identifier:"i":re[0]?re[0]?re[0].identifier:"e":"d",raw:K,x:G&&G.x?G.x:F[0]?F[0].screenX:G?G.x:K.pageX,y:G&&G.y?G.y:F[0]?F[0].screenY:G?G.y:K.pageY})}}(J),X)},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,B){return Math.min(Math.max(z,U),B)}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,B,J){var X=z&&z[U];return X==null?B:J&&typeof X=="function"?X():X}function T(z){return Math.round(1e6*z)/1e6}function O(z,U){if(z===U)return!0;var B=typeof z;if(B!==typeof U)return!1;if(B!=="object"||z===null||U===null)return B==="function"&&z.toString()===U.toString();if(z.length!==U.length||Object.getOwnPropertyNames(z).length!==Object.getOwnPropertyNames(U).length)return!1;for(var J in z)if(!O(z[J],U[J]))return!1;return!0}var M=function(){return M=Object.assign||function(z){for(var U,B=1,J=arguments.length;B<J;B++)for(var X in U=arguments[B])Object.prototype.hasOwnProperty.call(U,X)&&(z[X]=U[X]);return z},M.apply(this,arguments)};function A(z,U,B){for(var J,X=0,W=U.length;X<W;X++)!J&&X in U||(J||(J=Array.prototype.slice.call(U,0,X)),J[X]=U[X]);return z.concat(J||Array.prototype.slice.call(U))}function N(z){var U,B,J,X,W,K;function re(k){K||(K=k),F(!0);var q=k-K;q>J&&(q=J);var ee=X[B];if(ee[3]<q)return B++,re(k);var ne=ee[2],oe=ee[4],le=ee[0],ce=ee[1]*(0,ee[5])(oe===0?1:(q-ne)/oe);if(ce&&z.track.to(le+ce),q<J)return Z();K=null,F(!1),G(null),z.emit("animationEnded")}function F(k){U.active=k}function G(k){U.targetIdx=k}function Z(){var k;k=re,W=window.requestAnimationFrame(k)}function se(){var k;k=W,window.cancelAnimationFrame(k),F(!1),G(null),K&&z.emit("animationStopped"),K=null}return U={active:!1,start:function(k){if(se(),z.track.details){var q=0,ee=z.track.details.position;B=0,J=0,X=k.map(function(ne){var oe,le=Number(ee),ce=(oe=ne.earlyExit)!==null&&oe!==void 0?oe:ne.duration,Ce=ne.easing,ze=ne.distance*Ce(ce/ne.duration)||0;ee+=ze;var $e=J;return J+=ce,q+=ze,[le,ne.distance,$e,J,ne.duration,Ce]}),G(z.track.distToIdx(q)),Z(),z.emit("animationStarted")}},stop:se,targetIdx:null}}function _(z){var U,B,J,X,W,K,re,F,G,Z,se,k,q,ee,ne=1/0,oe=[],le=null,ce=0;function Ce(Ee){we(ce+Ee)}function ze(Ee){var Te=$e(ce+Ee).abs;return ue(Te)?Te:null}function $e(Ee){var Te=Math.floor(Math.abs(T(Ee/B))),Ae=T((Ee%B+B)%B);Ae===B&&(Ae=0);var De=y(Ee),Ue=re.indexOf(A([],re).reduce(function(Le,it){return Math.abs(it-Ae)<Math.abs(Le-Ae)?it:Le})),Fe=Ue;return De<0&&Te++,Ue===K&&(Fe=0,Te+=De>0?1:-1),{abs:Fe+Te*K*De,origin:Ue,rel:Fe}}function ke(Ee,Te,Ae){var De;if(Te||!Ie())return ge(Ee,Ae);if(!ue(Ee))return null;var Ue=$e(Ae??ce),Fe=Ue.abs,Le=Ee-Ue.rel,it=Fe+Le;De=ge(it);var ut=ge(it-K*y(Le));return(ut!==null&&Math.abs(ut)<Math.abs(De)||De===null)&&(De=ut),T(De)}function ge(Ee,Te){if(Te==null&&(Te=T(ce)),!ue(Ee)||Ee===null)return null;Ee=Math.round(Ee);var Ae=$e(Te),De=Ae.abs,Ue=Ae.rel,Fe=Ae.origin,Le=ve(Ee),it=(Te%B+B)%B,ut=re[Fe],vt=Math.floor((Ee-(De-Ue))/K)*B;return T(ut-it-ut+re[Le]+vt+(Fe===K?B:0))}function ue(Ee){return Re(Ee)===Ee}function Re(Ee){return p(Ee,G,Z)}function Ie(){return X.loop}function ve(Ee){return(Ee%K+K)%K}function we(Ee){var Te;Te=Ee-ce,oe.push({distance:Te,timestamp:r()}),oe.length>6&&(oe=oe.slice(-6)),ce=T(Ee);var Ae=be().abs;if(Ae!==le){var De=le!==null;le=Ae,De&&z.emit("slideChanged")}}function be(Ee){var Te=Ee?null:function(){if(K){var Ae=Ie(),De=Ae?(ce%B+B)%B:ce,Ue=(Ae?ce%B:ce)-W[0][2],Fe=0-(Ue<0&&Ae?B-Math.abs(Ue):Ue),Le=0,it=$e(ce),ut=it.abs,vt=it.rel,At=W[vt][2],ht=W.map(function(jt,Vt){var _t=Fe+Le;(_t<0-jt[0]||_t>1)&&(_t+=(Math.abs(_t)>B-1&&Ae?B:0)*y(-_t));var Tt=Vt-vt,ct=y(Tt),gt=Tt+ut;Ae&&(ct===-1&&_t>At&&(gt+=K),ct===1&&_t<At&&(gt-=K),se!==null&><se&&(_t+=B),k!==null&>>k&&(_t-=B));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:X.rtl?-1*_t+1-jt[0]:_t,portion:lt,size:jt[0]}});return ut=Re(ut),vt=ve(ut),{abs:Re(ut),length:J,max:ee,maxIdx:Z,min:q,minIdx:G,position:ce,progress:Ae?De/B:ce/J,rel:vt,slides:ht,slidesLength:B}}}();return U.details=Te,z.emit("detailsChanged"),Te}return U={absToRel:ve,add:Ce,details:null,distToIdx:ze,idxToDist:ke,init:function(Ee){if(function(){if(X=z.options,W=(X.trackConfig||[]).map(function(Ue){return[E(Ue,"size",1),E(Ue,"spacing",0),E(Ue,"origin",0)]}),K=W.length){B=T(W.reduce(function(Ue,Fe){return Ue+Fe[0]+Fe[1]},0));var Ae,De=K-1;J=T(B+W[0][2]-W[De][0]-W[De][2]-W[De][1]),re=W.reduce(function(Ue,Fe){if(!Ue)return[0];var Le=W[Ue.length-1],it=Ue[Ue.length-1]+(Le[0]+Le[2])+Le[1];return it-=Fe[2],Ue[Ue.length-1]>it&&(it=Ue[Ue.length-1]),it=T(it),Ue.push(it),(!Ae||Ae<it)&&(F=Ue.length-1),Ae=it,Ue},null),J===0&&(F=0),re.push(T(B))}}(),!K)return be(!0);var Te;(function(){var Ae=z.options.range,De=z.options.loop;se=G=De?E(De,"min",-1/0):0,k=Z=De?E(De,"max",ne):F;var Ue=E(Ae,"min",null),Fe=E(Ae,"max",null);Ue!==null&&(G=Ue),Fe!==null&&(Z=Fe),q=G===-1/0?G:z.track.idxToDist(G||0,!0,0),ee=Z===ne?Z:ke(Z,!0,0),Fe===null&&(k=Z),E(Ae,"align",!1)&&Z!==ne&&W[ve(Z)][2]===0&&(ee-=1-W[ve(Z)][0],Z=ze(ee-ce)),q=T(q),ee=T(ee)})(),Te=Ee,Number(Te)===Te?Ce(ge(Re(Ee))):be()},to:we,velocity:function(){var Ee=r(),Te=oe.reduce(function(Ae,De){var Ue=De.distance,Fe=De.timestamp;return Ee-Fe>200||(y(Ue)!==y(Ae.distance)&&Ae.distance&&(Ae={distance:0,lastTimestamp:0,time:0}),Ae.time&&(Ae.distance+=Ue),Ae.lastTimestamp&&(Ae.time+=Fe-Ae.lastTimestamp),Ae.lastTimestamp=Fe),Ae},{distance:0,lastTimestamp:0,time:0});return Te.distance/Te.time||0}}}function j(z){var U,B,J,X,W,K,re,F;function G(le){return 2*le}function Z(le){return p(le,re,F)}function se(le){return 1-Math.pow(1-le,3)}function k(){return J?z.track.velocity():0}function q(){oe();var le=z.options.mode==="free-snap",ce=z.track,Ce=k();X=y(Ce);var ze=z.track.details,$e=[];if(Ce||!le){var ke=ee(Ce),ge=ke.dist,ue=ke.dur;if(ue=G(ue),ge*=X,le){var Re=ce.idxToDist(ce.distToIdx(ge),!0);Re&&(ge=Re)}$e.push({distance:ge,duration:ue,easing:se});var Ie=ze.position,ve=Ie+ge;if(ve<W||ve>K){var we=ve<W?W-Ie:K-Ie,be=0,Ee=Ce;if(y(we)===X){var Te=Math.min(Math.abs(we)/Math.abs(ge),1),Ae=function(Fe){return 1-Math.pow(1-Fe,1/3)}(Te)*ue;$e[0].earlyExit=Ae,Ee=Ce*(1-Te)}else $e[0].earlyExit=0,be+=we;var De=ee(Ee,100),Ue=De.dist*X;z.options.rubberband&&($e.push({distance:Ue,duration:G(De.dur),easing:se}),$e.push({distance:-Ue+be,duration:500,easing:se}))}z.animator.start($e)}else z.moveToIdx(Z(ze.abs),!0,{duration:500,easing:function(Fe){return 1+--Fe*Fe*Fe*Fe*Fe}})}function ee(le,ce){ce===void 0&&(ce=1e3);var Ce=147e-9+(le=Math.abs(le))/ce;return{dist:Math.pow(le,2)/Ce,dur:le/Ce}}function ne(){var le=z.track.details;le&&(W=le.min,K=le.max,re=le.minIdx,F=le.maxIdx)}function oe(){z.animator.stop()}z.on("updated",ne),z.on("optionsChanged",ne),z.on("created",ne),z.on("dragStarted",function(){J=!1,oe(),U=B=z.track.details.abs}),z.on("dragChecked",function(){J=!0}),z.on("dragEnded",function(){var le=z.options.mode;le==="snap"&&function(){var ce=z.track,Ce=z.track.details,ze=Ce.position,$e=y(k());(ze>K||ze<W)&&($e=0);var ke=U+$e;Ce.slides[ce.absToRel(ke)].portion===0&&(ke-=$e),U!==B&&(ke=B),y(ce.idxToDist(ke,!0))!==$e&&(ke+=$e),ke=Z(ke);var ge=ce.idxToDist(ke,!0);z.animator.start([{distance:ge,duration:500,easing:function(ue){return 1+--ue*ue*ue*ue*ue}}])}(),le!=="free"&&le!=="free-snap"||q()}),z.on("dragged",function(){B=z.track.details.abs})}function L(z){var U,B,J,X,W,K,re,F,G,Z,se,k,q,ee,ne,oe,le,ce,Ce=g();function ze(be){if(K&&F===be.id){var Ee=ue(be);if(G){if(!ge(be))return ke(be);Z=Ee,G=!1,z.emit("dragChecked")}if(oe)return Z=Ee;f(be);var Te=function(De){if(le===-1/0&&ce===1/0)return De;var Ue=z.track.details,Fe=Ue.length,Le=Ue.position,it=p(De,le-Le,ce-Le);if(Fe===0)return 0;if(!z.options.rubberband)return it;if(Le<=ce&&Le>=le||Le<le&&B>0||Le>ce&&B<0)return De;var ut=(Le<le?Le-le:Le-ce)/Fe,vt=X*Fe,At=Math.abs(ut*vt),ht=Math.max(0,1-At/W*2);return ht*ht*De}(re(Z-Ee)/X*J);B=y(Te);var Ae=z.track.details.position;(Ae>le&&Ae<ce||Ae===le&&B>0||Ae===ce&&B<0)&&m(be),se+=Te,!k&&Math.abs(se*X)>5&&(k=!0),z.track.add(Te),Z=Ee,z.emit("dragged")}}function $e(be){!K&&z.track.details&&z.track.details.length&&(se=0,K=!0,k=!1,G=!0,F=be.id,ge(be),Z=ue(be),z.emit("dragStarted"))}function ke(be){K&&F===be.idChanged&&(K=!1,z.emit("dragEnded"))}function ge(be){var Ee=Re(),Te=Ee?be.y:be.x,Ae=Ee?be.x:be.y,De=q!==void 0&&ee!==void 0&&Math.abs(ee-Ae)<=Math.abs(q-Te);return q=Te,ee=Ae,De}function ue(be){return Re()?be.y:be.x}function Re(){return z.options.vertical}function Ie(){X=z.size,W=Re()?window.innerHeight:window.innerWidth;var be=z.track.details;be&&(le=be.min,ce=be.max)}function ve(be){k&&(m(be),f(be))}function we(){if(Ce.purge(),z.options.drag&&!z.options.disabled){var be;be=z.options.dragSpeed||1,re=typeof be=="function"?be:function(Te){return Te*be},J=z.options.rtl?-1:1,Ie(),U=z.container,function(){var Te="data-keen-slider-clickable";c("[".concat(Te,"]:not([").concat(Te,"=false])"),U).map(function(Ae){Ce.add(Ae,"dragstart",m),Ce.add(Ae,"mousedown",m),Ce.add(Ae,"touchstart",m)})}(),Ce.add(U,"dragstart",function(Te){f(Te)}),Ce.add(U,"click",ve,{capture:!0}),Ce.input(U,"ksDragStart",$e),Ce.input(U,"ksDrag",ze),Ce.input(U,"ksDragEnd",ke),Ce.input(U,"mousedown",$e),Ce.input(U,"mousemove",ze),Ce.input(U,"mouseleave",ke),Ce.input(U,"mouseup",ke),Ce.input(U,"touchstart",$e,{passive:!0}),Ce.input(U,"touchmove",ze,{passive:!1}),Ce.input(U,"touchend",ke),Ce.input(U,"touchcancel",ke),Ce.add(window,"wheel",function(Te){K&&f(Te)});var Ee="data-keen-slider-scrollable";c("[".concat(Ee,"]:not([").concat(Ee,"=false])"),z.container).map(function(Te){return function(Ae){var De;Ce.input(Ae,"touchstart",function(Ue){De=ue(Ue),oe=!0,ne=!0},{passive:!0}),Ce.input(Ae,"touchmove",function(Ue){var Fe=Re(),Le=Fe?Ae.scrollHeight-Ae.clientHeight:Ae.scrollWidth-Ae.clientWidth,it=De-ue(Ue),ut=Fe?Ae.scrollTop:Ae.scrollLeft,vt=Fe&&Ae.style.overflowY==="scroll"||!Fe&&Ae.style.overflowX==="scroll";if(De=ue(Ue),(it<0&&ut>0||it>0&&ut<Le)&&ne&&vt)return oe=!0;ne=!1,f(Ue),oe=!1}),Ce.input(Ae,"touchend",function(){oe=!1})}(Te)})}}z.on("updated",Ie),z.on("optionsChanged",we),z.on("created",we),z.on("destroyed",Ce.purge)}function D(z){var U,B,J=null;function X(q,ee,ne){z.animator.active?K(q,ee,ne):requestAnimationFrame(function(){return K(q,ee,ne)})}function W(){X(!1,!1,B)}function K(q,ee,ne){var oe=0,le=z.size,ce=z.track.details;if(ce&&U){var Ce=ce.slides;U.forEach(function(ze,$e){if(q)!J&&ee&&F(ze,null,ne),G(ze,null,ne);else{if(!Ce[$e])return;var ke=Ce[$e].size*le;!J&&ee&&F(ze,ke,ne),G(ze,Ce[$e].distance*le-oe,ne),oe+=ke}})}}function re(q){return z.options.renderMode==="performance"?Math.round(q):q}function F(q,ee,ne){var oe=ne?"height":"width";ee!==null&&(ee=re(ee)+"px"),q.style["min-"+oe]=ee,q.style["max-"+oe]=ee}function G(q,ee,ne){if(ee!==null){ee=re(ee);var oe=ne?ee:0;ee="translate3d(".concat(ne?0:ee,"px, ").concat(oe,"px, 0)")}q.style.transform=ee,q.style["-webkit-transform"]=ee}function Z(){U&&(K(!0,!0,B),U=null),z.on("detailsChanged",W,!0)}function se(){X(!1,!0,B)}function k(){Z(),B=z.options.vertical,z.options.disabled||z.options.renderMode==="custom"||(J=E(z.options.slides,"perView",null)==="auto",z.on("detailsChanged",W),(U=z.slides).length&&se())}z.on("created",k),z.on("optionsChanged",k),z.on("beforeOptionsChanged",function(){Z()}),z.on("updated",se),z.on("destroyed",Z)}function V(z,U){return function(B){var J,X,W,K,re,F=g();function G(ge){var ue;o(B.container,"reverse",(ue=B.container,window.getComputedStyle(ue,null).getPropertyValue("direction")!=="rtl"||ge?null:"")),o(B.container,"v",B.options.vertical&&!ge?"":null),o(B.container,"disabled",B.options.disabled&&!ge?"":null)}function Z(){se()&&oe()}function se(){var ge=null;if(K.forEach(function(Re){Re.matches&&(ge=Re.__media)}),ge===J)return!1;J||B.emit("beforeOptionsChanged"),J=ge;var ue=ge?W.breakpoints[ge]:W;return B.options=M(M({},W),ue),G(),$e(),ke(),ce(),!0}function k(ge){var ue=S(ge);return(B.options.vertical?ue.height:ue.width)/B.size||1}function q(){return B.options.trackConfig.length}function ee(ge){for(var ue in J=!1,W=M(M({},U),ge),F.purge(),X=B.size,K=[],W.breakpoints||[]){var Re=window.matchMedia(ue);Re.__media=ue,K.push(Re),F.add(Re,"change",Z)}F.add(window,"orientationchange",ze),F.add(window,"resize",Ce),se()}function ne(ge){B.animator.stop();var ue=B.track.details;B.track.init(ge??(ue?ue.abs:0))}function oe(ge){ne(ge),B.emit("optionsChanged")}function le(ge,ue){if(ge)return ee(ge),void oe(ue);$e(),ke();var Re=q();ce(),q()!==Re?oe(ue):ne(ue),B.emit("updated")}function ce(){var ge=B.options.slides;if(typeof ge=="function")return B.options.trackConfig=ge(B.size,B.slides);for(var ue=B.slides,Re=ue.length,Ie=typeof ge=="number"?ge:E(ge,"number",Re,!0),ve=[],we=E(ge,"perView",1,!0),be=E(ge,"spacing",0,!0)/B.size||0,Ee=we==="auto"?be:be/we,Te=E(ge,"origin","auto"),Ae=0,De=0;De<Ie;De++){var Ue=we==="auto"?k(ue[De]):1/we-be+Ee,Fe=Te==="center"?.5-Ue/2:Te==="auto"?0:Te;ve.push({origin:Fe,size:Ue,spacing:be}),Ae+=Ue}if(Ae+=be*(Ie-1),Te==="auto"&&!B.options.loop&&we!==1){var Le=0;ve.map(function(it){var ut=Ae-Le;return Le+=it.size+be,ut>=1||(it.origin=1-ut-(Ae>1?0:1-Ae)),it})}B.options.trackConfig=ve}function Ce(){$e();var ge=B.size;B.options.disabled||ge===X||(X=ge,le())}function ze(){Ce(),setTimeout(Ce,500),setTimeout(Ce,2e3)}function $e(){var ge=S(B.container);B.size=(B.options.vertical?ge.height:ge.width)||1}function ke(){B.slides=c(B.options.selector,B.container)}B.container=(re=c(z,document)).length?re[0]:null,B.destroy=function(){F.purge(),B.emit("destroyed"),G(!0)},B.prev=function(){B.moveToIdx(B.track.details.abs-1,!0)},B.next=function(){B.moveToIdx(B.track.details.abs+1,!0)},B.update=le,ee(B.options)}}var H=function(z,U,B){try{return function(J,X){var W,K={};return W={emit:function(re){K[re]&&K[re].forEach(function(G){G(W)});var F=W.options&&W.options[re];F&&F(W)},moveToIdx:function(re,F,G){var Z=W.track.idxToDist(re,F);if(Z){var se=W.options.defaultAnimation;W.animator.start([{distance:Z,duration:E(G||se,"duration",500),easing:E(G||se,"easing",function(k){return 1+--k*k*k*k*k})}])}},on:function(re,F,G){G===void 0&&(G=!1),K[re]||(K[re]=[]);var Z=K[re].indexOf(F);Z>-1?G&&delete K[re][Z]:G||K[re].push(F)},options:J},function(){if(W.track=_(W),W.animator=N(W),X)for(var re=0,F=X;re<F.length;re++)(0,F[re])(W);W.track.init(W.options.initial||0),W.emit("created")}(),W}(U,A([V(z,{drag:!0,mode:"snap",renderMode:"precision",rubberband:!0,selector:".keen-slider__slide"}),D,L,j],B||[],!0))}catch(J){console.error(J)}};return nx.useKeenSlider=function(z,U){var B=e.useRef(null),J=e.useRef(!1),X=e.useRef(z),W=e.useCallback(function(K){K?(X.current=z,B.current=new H(K,z,U),J.current=!1):(B.current&&B.current.destroy&&B.current.destroy(),B.current=null)},[]);return e.useEffect(function(){O(X.current,z)||(X.current=z,B.current&&B.current.update(X.current))},[z]),[W,B]},nx}var EO=nK();const aK=({message:e,colorCode:t,handleAddToCart:a,handleRemoveFromCart:r})=>{const[o,c]=x.useState({}),[f,m]=x.useState({}),g=_=>{const j=/(https?:\/\/[^\s]+)/g;return _.split(j).map((L,D)=>j.test(L)?ae.jsx("a",{href:L.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:L},D):ae.jsx("span",{children:L},D))},p=_=>{const j=_.trim();if(!j.includes("Name:")||!j.includes("VariantId"))return null;const L=j.match(/Name\s*[:\-]\s*(.+)/i),D=j.match(/Price\s*[:\-]\s*(.+)/i),V=j.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),H=j.match(/VariantId\s*[:\-]\s*(.+)/i),z=j.match(/variant_tag_name\s*[:\-]\s*(.+)/i),U=j.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!L||!D||!V||!H||!z?null:{name:L[1].trim(),price:D[1].trim(),link:V[1].trim(),image:"",variant_id:H[1].trim(),variant_tag_name:z[1].trim(),option:U?.[1]?.trim()}},y=x.useMemo(()=>{const _=e.split("|||").map(D=>D.trim()).filter(Boolean),j=[];let L=null;return _.forEach(D=>{if(D.startsWith("img - ")){const V=D.replace(/^img\s*[-:]\s*/,"").trim();if(L)L.image=V;else{const H=[...j].reverse().find(z=>z.type==="product");H&&(H.data.image=V)}}else if(D.includes("Name:")&&D.includes("VariantId")){const V=p(D);V&&(j.push({type:"product",data:V}),L=V)}else j.push({type:"text",data:D}),L=null}),j},[e]),S=x.useMemo(()=>{const _={};return y.forEach(j=>{if(j.type==="product"){const L=j.data;_[L.variant_tag_name]=_[L.variant_tag_name]||[],_[L.variant_tag_name].push(L)}}),_},[y]),E=(_,j=22)=>_.length>j?_.slice(0,j)+"...":_,[T,O]=x.useState(0),M=Object.keys(S).length,[A,N]=EO.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(_){O(_.track.details.rel)}});return ae.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[y.filter(_=>_.type==="text").map((_,j)=>ae.jsx("p",{className:"whitespace-pre-wrap break-words",children:g(_.data)},j)),Object.keys(S).length>0&&ae.jsxs(ae.Fragment,{children:[Object.keys(S).length>1&&ae.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[ae.jsx(ri,{shape:"circle",icon:ae.jsx(km,{}),onClick:()=>N.current?.prev(),disabled:T===0}),ae.jsx(ri,{shape:"circle",icon:ae.jsx(z1,{}),onClick:()=>N.current?.next(),disabled:T===M-1})]}),ae.jsx("div",{ref:A,className:"keen-slider",children:ae.jsx(tK,{groupedProducts:S,selectedVariants:f,setSelectedVariants:m,counts:o,setCounts:c,handleAddToCart:a,handleRemoveFromCart:r,colorCode:t,shortenName:E,sliderInstance:N,currentSlide:T,totalSlides:M,sliderRef: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(GT,{style:{fontSize:"24px"}}):ae.jsx(XT,{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 Wu=(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=()=>{},Zu=()=>{};sK.NODE_ENV!=="production"&&(Zm=(e,t,a)=>{!e&&typeof console<"u"&&console.warn(MO(t,a))},Zu=(e,t,a)=>{if(!e)throw new Error(MO(t,a))});const Ku={},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,Qs=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)){Zu(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 Zu(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,L)=>(j[L]=vK(c),j),{}),{setup:m,read:g,resolveKeyframes:p,preUpdate:y,update:S,preRender:E,render:T,postRender:O}=f,M=()=>{const j=Ku.useManualTiming?o.timestamp:performance.now();a=!1,Ku.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,L)=>{const D=f[L];return j[L]=(V,H=!1,z=!1)=>(a||A(),D.schedule(V,H,z)),j},{}),cancel:j=>{for(let L=0;L<rx.length;L++)f[rx[L]].cancel(j)},state:o,steps:f}}const{schedule:Pa,cancel:nf,state:oi,steps:jO}=oz(typeof requestAnimationFrame<"u"?requestAnimationFrame:Sl,!0);let ix;function bK(){ix=void 0}const yo={now:()=>(ix===void 0&&yo.set(oi.isProcessing||Ku.useManualTiming?oi.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=>Wu(0,1,e)},ox={...Km,default:1},w0=e=>Math.round(e*1e5)/1e5,HO=/-?(?:\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,BO=(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(HO);return{[e]:parseFloat(o),[t]:parseFloat(c),[a]:parseFloat(f),alpha:m!==void 0?parseFloat(m):1}},wK=e=>Wu(0,255,e),PO={...Km,transform:e=>Math.round(wK(e))},Hd={test:BO("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:BO("#"),parse:TK,transform:Hd.transform},T0=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),af=T0("deg"),Js=T0("%"),on=T0("px"),OK=T0("vh"),RK=T0("vw"),uz={...Js,parse:e=>Js.parse(e)/100,transform:e=>Js.transform(e*100)},Qm={test:BO("hsl","hue"),parse:sz("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:a,alpha:r=1})=>"hsla("+Math.round(e)+", "+Js.transform(w0(t))+", "+Js.transform(w0(a))+", "+w0(E0.transform(r))+")"},xr={test:e=>Hd.test(e)||UO.test(e)||Qm.test(e),parse:e=>Hd.test(e)?Hd.parse(e):Qm.test(e)?Qm.parse(e):UO.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Hd.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(HO)?.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,Hd,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),Hd.transform(o))},FO=new Set(["none","hidden"]);function HK(e,t){return FO.has(e)?a=>a<=0?e:t:a=>a>=1?t:e}function BK(e,t){return a=>Za(e,t,a)}function qO(e){return typeof e=="number"?BK: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?HK(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:()=>oi.isProcessing?oi.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:Qs(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=Wu(Ka.minDamping,Ka.maxDamping,f),e=Wu(Ka.minDuration,Ka.maxDuration,Qs(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*Wu(.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:-Qs(a.velocity||0)}),O=E||0,M=p/(2*Math.sqrt(g*y)),A=f-c,N=Qs(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 D=YO(N,M);j=V=>{const H=Math.exp(-M*N*V);return f-H*((O+M*N*A)/D*Math.sin(D*V)+A*Math.cos(D*V))}}else if(M===1)j=D=>f-Math.exp(-N*D)*(A+(O+N*A)*D);else{const D=N*Math.sqrt(M*M-1);j=V=>{const H=Math.exp(-M*N*V),z=Math.min(D*V,300);return f-H*((O+M*N*A)*Math.sinh(z)+D*A*Math.cosh(z))/D}}const L={calculatedDuration:T&&S||null,next:D=>{const V=j(D);if(T)m.done=D>=S;else{let H=D===0?O:0;M<1&&(H=D===0?is(O):Sz(j,D,V));const z=Math.abs(H)<=r,U=Math.abs(f-V)<=o;m.done=z&&U}return m.value=m.done?f:V,m},toString:()=>{const D=Math.min(GO(L),sx),V=bz(H=>L.next(D*H).value,D,30);return D+"ms "+V},toTransition:()=>{}};return L}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,N=f===void 0?A:f(A);N!==A&&(M=N-S);const _=z=>-M*Math.exp(-z/r),j=z=>N+_(z),L=z=>{const U=_(z),B=j(z);E.done=Math.abs(U)<=p,E.value=E.done?N:B};let D,V;const H=z=>{T(E.value)&&(D=z,V=ux({keyframes:[E.value,O(E.value)],velocity:Sz(j,z,E.value),damping:o,stiffness:c,restDelta:p,restSpeed:y}))};return H(0),{calculatedDuration:null,next:z=>{let U=!1;return!V&&D===void 0&&(U=!0,L(z),H(z)),D!==void 0&&z>=D?V.next(z-D):(!U&&L(z),E)}}}function QK(e,t,a){const r=[],o=a||Ku.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(Zu(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(Wu(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&&Zu(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 N=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?N<0:N>o;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let j=this.currentTime,L=r;if(S){const z=Math.min(this.currentTime,o)/m;let U=Math.floor(z),B=z%1;!B&&z>=1&&(B=1),B===1&&U--,U=Math.min(U,S+1),!!(U%2)&&(E==="reverse"?(B=1-B,T&&(B-=T/m)):E==="mirror"&&(L=f)),j=Wu(0,1,B)*m}const D=_?{done:!1,value:y[0]}:L.next(j);c&&(D.value=c(D.value));let{done:V}=D;!_&&g!==null&&(V=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const H=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&V);return H&&O!==WO&&(D.value=ZO(y,this.options,A,this.speed)),M&&M(D.value),H&&this.finish(),D}then(t,a){return this.finished.then(t,a)}get duration(){return Qs(this.calculatedDuration)}get time(){return Qs(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=Qs(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 Bd=e=>e*180/Math.PI,JO=e=>{const t=Bd(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=>Bd(Math.atan(e[1])),skewY:e=>Bd(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(Bd(Math.atan2(e[6],e[5]))),rotateY:e=>eR(Bd(Math.atan2(-e[2],e[0]))),rotateZ:Ez,rotate:Ez,skewX:e=>Bd(Math.atan(e[4])),skewY:e=>Bd(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,Zu(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 Qs(Number(t))}get time(){return Qs(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)||((Ku.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){Zu(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]),HQ={test:e=>e==="auto",parse:e=>e},Hz=e=>t=>t.test(e),Bz=[Km,on,Js,af,RK,OK,HQ],Pz=e=>Bz.find(Hz(e));function BQ(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(HO)||[];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||BQ(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=[...Bz,xr,rf],iJ=e=>rJ.find(Hz(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 N=0,_=0,j=0;for(let L=0;L<=m;L++){const D=Math.round(L*M);if(D>N){const z=Math.round(_*y*o),U=z+Math.round(j*y*o)||1;let B=y-z;a.barAlign==="top"?B=0:a.barAlign==="bottom"&&(B=p-U),r[A](N*(E+T),B,E,U,O),N=D,_=0,j=0}const V=Math.abs(c[L]||0),H=Math.abs(f[L]||0);V>_&&(_=V),H>j&&(j=H)}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 N=y+(Math.round(T*y*o)||1)*(f===0?-1:1);r.lineTo(E,N),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,N=A+(a.barGap||A/2);y%N!=0&&(y=Math.floor(y/N)*N)}if(y===0)return;const E=A=>{if(A<0||A>=T||S[A])return;S[A]=!0;const N=A*y;let _=Math.min(p-N,y);if(a.barWidth||a.barGap){const L=a.barWidth||.5,D=L+(a.barGap||L/2);_=Math.floor(_/D)*D}if(_<=0)return;const j=t.map(L=>{const D=Math.floor(N/p*L.length),V=Math.floor((N+_)/p*L.length);return L.slice(D,V)});this.renderSingleCanvas(j,a,_,o,N,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:N}=this.scrollContainer,_=Math.floor(N/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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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 ii(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}=jZ(),[S,E]=x.useState(!1),[T,O]=x.useState(!1),M=x.useRef(null),A=x.useRef(null),N=x.useRef([]),_=x.useRef(null),j=x.useRef(null),L=U=>{const B=U.target.files?.[0];B&&f(B)},D=()=>{f(null)},V=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}),B=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/mp4",J=new MediaRecorder(U,{mimeType:B});M.current=J,N.current=[],J.ondataavailable=X=>{X.data.size>0&&N.current.push(X.data)},J.onstop=()=>{const X=new Blob(N.current,{type:B});g(X),E(!1),U.getTracks().forEach(W=>W.stop())},J.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 H=()=>{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(c0,{style:{position:"absolute",top:"-0.5rem",right:"-0.5rem",fontSize:"14px",color:"#ef4444",background:"white",borderRadius:"9999px",cursor:"pointer"},onClick:U=>{U.stopPropagation(),D()}})]}):ae.jsx(p4,{style:{fontSize:"20px"}})}),ae.jsx("input",{disabled:p,type:"file",accept:"image/*",ref:A,onChange:L,style:{display:"none",padding:"0"}}),ae.jsx(Nd,{title:S?"Stop Recording":"Send Audio",children:ae.jsx("button",{onClick:V,style:{color:S?"#ef4444":"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:S?ae.jsx(y4,{style:{fontSize:"20px"}}):ae.jsx(f4,{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:H,children:T?ae.jsx(GT,{style:{fontSize:"24px"}}):ae.jsx(XT,{style:{fontSize:"24px"}})}),ae.jsx("div",{ref:_,style:{width:"100%",height:"2rem"}}),ae.jsx(c0,{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),D(),t("")):e.trim()&&(a(),t("")))}})}),ae.jsx("button",{disabled:p,onClick:()=>{const U=!!c,B=!!e.trim();U?(r(c,e),D(),t("")):!!m?(o(m),z()):B&&a()},"aria-label":y("chatInput.send"),style:{color:"#6b7280",background:"none",border:"none",margin:"0 0.5rem",cursor:"pointer",padding:"0"},children:ae.jsx(g4,{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})=>!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(([S,E])=>{const T=t[S]||(E.length>0?E[0].variant_id:""),O=E.find(D=>D.variant_id===T)||E[0];if(!O)return null;const M=r[O.variant_id]||0,A=Array.from(new Set(E.map(D=>D.option?.trim()??"").filter(D=>D&&D.toLowerCase()!=="none"))),N=D=>{const V=E.find(H=>H.option===D);V&&a(H=>({...H,[S]:V.variant_id}))},_=async()=>{o(D=>({...D,[O.variant_id]:(D[O.variant_id]||0)+1})),await c(O.variant_id,O.name,1)},j=async()=>{M!==0&&(o(D=>({...D,[O.variant_id]:Math.max(0,(D[O.variant_id]||0)-1)})),await f(O.variant_id,1))},L=O.option??A[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(O.link,"_blank"),children:[ae.jsx("img",{src:O.image,alt:O.name,className:"sallaX-img",loading:"lazy"}),ae.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-visit","aria-label":"Open product page",onClick:D=>D.stopPropagation(),children:"View"})]}),ae.jsxs("div",{className:"sallaX-body",children:[ae.jsx("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",className:"sallaX-name",title:O.name,children:g(O.name)}),ae.jsx("div",{className:"sallaX-row",children:ae.jsx("span",{className:"sallaX-price","aria-label":"Price",children:O.price})}),A.length>1&&ae.jsxs("div",{className:"sallaX-selectWrap",children:[ae.jsx("label",{htmlFor:`sallaX-select-${S}`,className:"sallaX-selectLabel",children:"Choose an option"}),ae.jsx("select",{id:`sallaX-select-${S}`,className:"sallaX-select","aria-label":"Choose an option",value:L,onChange:D=>N(D.target.value),children:A.map(D=>ae.jsx("option",{value:D,children:D},D))})]}),ae.jsxs("div",{className:"sallaX-cta","aria-label":"Quantity controls",children:[ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--minus",onClick:j,"aria-label":"Decrease quantity",disabled:M===0,children:"–"}),ae.jsx("output",{className:"sallaX-qtyCount","aria-live":"polite","aria-atomic":"true",children:M}),ae.jsx("button",{type:"button",className:"sallaX-qty sallaX-qty--plus",onClick:_,"aria-label":"Increase quantity",children:"+"})]})]})]},S)})})});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 B=Math.floor(z);return B===U||B+1===U?z:U}function r(){return Date.now()}function o(z,U,B){if(U="data-keen-slider-"+U,B===null)return z.removeAttribute(U);z.setAttribute(U,B||"")}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,B,J,X){U.addListener?U.addListener(J):U.addEventListener(B,J,X),z.push([U,B,J,X])},input:function(U,B,J,X){this.add(U,B,function(W){return function(K){K.nativeEvent&&(K=K.nativeEvent);var re=K.changedTouches||[],F=K.targetTouches||[],G=K.detail&&K.detail.x?K.detail:null;return W({id:G?G.identifier?G.identifier:"i":F[0]?F[0]?F[0].identifier:"e":"d",idChanged:G?G.identifier?G.identifier:"i":re[0]?re[0]?re[0].identifier:"e":"d",raw:K,x:G&&G.x?G.x:F[0]?F[0].screenX:G?G.x:K.pageX,y:G&&G.y?G.y:F[0]?F[0].screenY:G?G.y:K.pageY})}}(J),X)},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,B){return Math.min(Math.max(z,U),B)}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,B,J){var X=z&&z[U];return X==null?B:J&&typeof X=="function"?X():X}function T(z){return Math.round(1e6*z)/1e6}function O(z,U){if(z===U)return!0;var B=typeof z;if(B!==typeof U)return!1;if(B!=="object"||z===null||U===null)return B==="function"&&z.toString()===U.toString();if(z.length!==U.length||Object.getOwnPropertyNames(z).length!==Object.getOwnPropertyNames(U).length)return!1;for(var J in z)if(!O(z[J],U[J]))return!1;return!0}var M=function(){return M=Object.assign||function(z){for(var U,B=1,J=arguments.length;B<J;B++)for(var X in U=arguments[B])Object.prototype.hasOwnProperty.call(U,X)&&(z[X]=U[X]);return z},M.apply(this,arguments)};function A(z,U,B){for(var J,X=0,W=U.length;X<W;X++)!J&&X in U||(J||(J=Array.prototype.slice.call(U,0,X)),J[X]=U[X]);return z.concat(J||Array.prototype.slice.call(U))}function N(z){var U,B,J,X,W,K;function re(k){K||(K=k),F(!0);var q=k-K;q>J&&(q=J);var ee=X[B];if(ee[3]<q)return B++,re(k);var ne=ee[2],oe=ee[4],le=ee[0],ce=ee[1]*(0,ee[5])(oe===0?1:(q-ne)/oe);if(ce&&z.track.to(le+ce),q<J)return Z();K=null,F(!1),G(null),z.emit("animationEnded")}function F(k){U.active=k}function G(k){U.targetIdx=k}function Z(){var k;k=re,W=window.requestAnimationFrame(k)}function se(){var k;k=W,window.cancelAnimationFrame(k),F(!1),G(null),K&&z.emit("animationStopped"),K=null}return U={active:!1,start:function(k){if(se(),z.track.details){var q=0,ee=z.track.details.position;B=0,J=0,X=k.map(function(ne){var oe,le=Number(ee),ce=(oe=ne.earlyExit)!==null&&oe!==void 0?oe:ne.duration,Ce=ne.easing,ze=ne.distance*Ce(ce/ne.duration)||0;ee+=ze;var $e=J;return J+=ce,q+=ze,[le,ne.distance,$e,J,ne.duration,Ce]}),G(z.track.distToIdx(q)),Z(),z.emit("animationStarted")}},stop:se,targetIdx:null}}function _(z){var U,B,J,X,W,K,re,F,G,Z,se,k,q,ee,ne=1/0,oe=[],le=null,ce=0;function Ce(Ee){we(ce+Ee)}function ze(Ee){var Te=$e(ce+Ee).abs;return ue(Te)?Te:null}function $e(Ee){var Te=Math.floor(Math.abs(T(Ee/B))),Ae=T((Ee%B+B)%B);Ae===B&&(Ae=0);var De=y(Ee),Ue=re.indexOf(A([],re).reduce(function(Le,it){return Math.abs(it-Ae)<Math.abs(Le-Ae)?it:Le})),Fe=Ue;return De<0&&Te++,Ue===K&&(Fe=0,Te+=De>0?1:-1),{abs:Fe+Te*K*De,origin:Ue,rel:Fe}}function ke(Ee,Te,Ae){var De;if(Te||!Ie())return ge(Ee,Ae);if(!ue(Ee))return null;var Ue=$e(Ae??ce),Fe=Ue.abs,Le=Ee-Ue.rel,it=Fe+Le;De=ge(it);var ut=ge(it-K*y(Le));return(ut!==null&&Math.abs(ut)<Math.abs(De)||De===null)&&(De=ut),T(De)}function ge(Ee,Te){if(Te==null&&(Te=T(ce)),!ue(Ee)||Ee===null)return null;Ee=Math.round(Ee);var Ae=$e(Te),De=Ae.abs,Ue=Ae.rel,Fe=Ae.origin,Le=ve(Ee),it=(Te%B+B)%B,ut=re[Fe],vt=Math.floor((Ee-(De-Ue))/K)*B;return T(ut-it-ut+re[Le]+vt+(Fe===K?B:0))}function ue(Ee){return Re(Ee)===Ee}function Re(Ee){return p(Ee,G,Z)}function Ie(){return X.loop}function ve(Ee){return(Ee%K+K)%K}function we(Ee){var Te;Te=Ee-ce,oe.push({distance:Te,timestamp:r()}),oe.length>6&&(oe=oe.slice(-6)),ce=T(Ee);var Ae=be().abs;if(Ae!==le){var De=le!==null;le=Ae,De&&z.emit("slideChanged")}}function be(Ee){var Te=Ee?null:function(){if(K){var Ae=Ie(),De=Ae?(ce%B+B)%B:ce,Ue=(Ae?ce%B:ce)-W[0][2],Fe=0-(Ue<0&&Ae?B-Math.abs(Ue):Ue),Le=0,it=$e(ce),ut=it.abs,vt=it.rel,At=W[vt][2],ht=W.map(function(jt,Vt){var _t=Fe+Le;(_t<0-jt[0]||_t>1)&&(_t+=(Math.abs(_t)>B-1&&Ae?B:0)*y(-_t));var Tt=Vt-vt,ct=y(Tt),gt=Tt+ut;Ae&&(ct===-1&&_t>At&&(gt+=K),ct===1&&_t<At&&(gt-=K),se!==null&><se&&(_t+=B),k!==null&>>k&&(_t-=B));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:X.rtl?-1*_t+1-jt[0]:_t,portion:lt,size:jt[0]}});return ut=Re(ut),vt=ve(ut),{abs:Re(ut),length:J,max:ee,maxIdx:Z,min:q,minIdx:G,position:ce,progress:Ae?De/B:ce/J,rel:vt,slides:ht,slidesLength:B}}}();return U.details=Te,z.emit("detailsChanged"),Te}return U={absToRel:ve,add:Ce,details:null,distToIdx:ze,idxToDist:ke,init:function(Ee){if(function(){if(X=z.options,W=(X.trackConfig||[]).map(function(Ue){return[E(Ue,"size",1),E(Ue,"spacing",0),E(Ue,"origin",0)]}),K=W.length){B=T(W.reduce(function(Ue,Fe){return Ue+Fe[0]+Fe[1]},0));var Ae,De=K-1;J=T(B+W[0][2]-W[De][0]-W[De][2]-W[De][1]),re=W.reduce(function(Ue,Fe){if(!Ue)return[0];var Le=W[Ue.length-1],it=Ue[Ue.length-1]+(Le[0]+Le[2])+Le[1];return it-=Fe[2],Ue[Ue.length-1]>it&&(it=Ue[Ue.length-1]),it=T(it),Ue.push(it),(!Ae||Ae<it)&&(F=Ue.length-1),Ae=it,Ue},null),J===0&&(F=0),re.push(T(B))}}(),!K)return be(!0);var Te;(function(){var Ae=z.options.range,De=z.options.loop;se=G=De?E(De,"min",-1/0):0,k=Z=De?E(De,"max",ne):F;var Ue=E(Ae,"min",null),Fe=E(Ae,"max",null);Ue!==null&&(G=Ue),Fe!==null&&(Z=Fe),q=G===-1/0?G:z.track.idxToDist(G||0,!0,0),ee=Z===ne?Z:ke(Z,!0,0),Fe===null&&(k=Z),E(Ae,"align",!1)&&Z!==ne&&W[ve(Z)][2]===0&&(ee-=1-W[ve(Z)][0],Z=ze(ee-ce)),q=T(q),ee=T(ee)})(),Te=Ee,Number(Te)===Te?Ce(ge(Re(Ee))):be()},to:we,velocity:function(){var Ee=r(),Te=oe.reduce(function(Ae,De){var Ue=De.distance,Fe=De.timestamp;return Ee-Fe>200||(y(Ue)!==y(Ae.distance)&&Ae.distance&&(Ae={distance:0,lastTimestamp:0,time:0}),Ae.time&&(Ae.distance+=Ue),Ae.lastTimestamp&&(Ae.time+=Fe-Ae.lastTimestamp),Ae.lastTimestamp=Fe),Ae},{distance:0,lastTimestamp:0,time:0});return Te.distance/Te.time||0}}}function j(z){var U,B,J,X,W,K,re,F;function G(le){return 2*le}function Z(le){return p(le,re,F)}function se(le){return 1-Math.pow(1-le,3)}function k(){return J?z.track.velocity():0}function q(){oe();var le=z.options.mode==="free-snap",ce=z.track,Ce=k();X=y(Ce);var ze=z.track.details,$e=[];if(Ce||!le){var ke=ee(Ce),ge=ke.dist,ue=ke.dur;if(ue=G(ue),ge*=X,le){var Re=ce.idxToDist(ce.distToIdx(ge),!0);Re&&(ge=Re)}$e.push({distance:ge,duration:ue,easing:se});var Ie=ze.position,ve=Ie+ge;if(ve<W||ve>K){var we=ve<W?W-Ie:K-Ie,be=0,Ee=Ce;if(y(we)===X){var Te=Math.min(Math.abs(we)/Math.abs(ge),1),Ae=function(Fe){return 1-Math.pow(1-Fe,1/3)}(Te)*ue;$e[0].earlyExit=Ae,Ee=Ce*(1-Te)}else $e[0].earlyExit=0,be+=we;var De=ee(Ee,100),Ue=De.dist*X;z.options.rubberband&&($e.push({distance:Ue,duration:G(De.dur),easing:se}),$e.push({distance:-Ue+be,duration:500,easing:se}))}z.animator.start($e)}else z.moveToIdx(Z(ze.abs),!0,{duration:500,easing:function(Fe){return 1+--Fe*Fe*Fe*Fe*Fe}})}function ee(le,ce){ce===void 0&&(ce=1e3);var Ce=147e-9+(le=Math.abs(le))/ce;return{dist:Math.pow(le,2)/Ce,dur:le/Ce}}function ne(){var le=z.track.details;le&&(W=le.min,K=le.max,re=le.minIdx,F=le.maxIdx)}function oe(){z.animator.stop()}z.on("updated",ne),z.on("optionsChanged",ne),z.on("created",ne),z.on("dragStarted",function(){J=!1,oe(),U=B=z.track.details.abs}),z.on("dragChecked",function(){J=!0}),z.on("dragEnded",function(){var le=z.options.mode;le==="snap"&&function(){var ce=z.track,Ce=z.track.details,ze=Ce.position,$e=y(k());(ze>K||ze<W)&&($e=0);var ke=U+$e;Ce.slides[ce.absToRel(ke)].portion===0&&(ke-=$e),U!==B&&(ke=B),y(ce.idxToDist(ke,!0))!==$e&&(ke+=$e),ke=Z(ke);var ge=ce.idxToDist(ke,!0);z.animator.start([{distance:ge,duration:500,easing:function(ue){return 1+--ue*ue*ue*ue*ue}}])}(),le!=="free"&&le!=="free-snap"||q()}),z.on("dragged",function(){B=z.track.details.abs})}function L(z){var U,B,J,X,W,K,re,F,G,Z,se,k,q,ee,ne,oe,le,ce,Ce=g();function ze(be){if(K&&F===be.id){var Ee=ue(be);if(G){if(!ge(be))return ke(be);Z=Ee,G=!1,z.emit("dragChecked")}if(oe)return Z=Ee;f(be);var Te=function(De){if(le===-1/0&&ce===1/0)return De;var Ue=z.track.details,Fe=Ue.length,Le=Ue.position,it=p(De,le-Le,ce-Le);if(Fe===0)return 0;if(!z.options.rubberband)return it;if(Le<=ce&&Le>=le||Le<le&&B>0||Le>ce&&B<0)return De;var ut=(Le<le?Le-le:Le-ce)/Fe,vt=X*Fe,At=Math.abs(ut*vt),ht=Math.max(0,1-At/W*2);return ht*ht*De}(re(Z-Ee)/X*J);B=y(Te);var Ae=z.track.details.position;(Ae>le&&Ae<ce||Ae===le&&B>0||Ae===ce&&B<0)&&m(be),se+=Te,!k&&Math.abs(se*X)>5&&(k=!0),z.track.add(Te),Z=Ee,z.emit("dragged")}}function $e(be){!K&&z.track.details&&z.track.details.length&&(se=0,K=!0,k=!1,G=!0,F=be.id,ge(be),Z=ue(be),z.emit("dragStarted"))}function ke(be){K&&F===be.idChanged&&(K=!1,z.emit("dragEnded"))}function ge(be){var Ee=Re(),Te=Ee?be.y:be.x,Ae=Ee?be.x:be.y,De=q!==void 0&&ee!==void 0&&Math.abs(ee-Ae)<=Math.abs(q-Te);return q=Te,ee=Ae,De}function ue(be){return Re()?be.y:be.x}function Re(){return z.options.vertical}function Ie(){X=z.size,W=Re()?window.innerHeight:window.innerWidth;var be=z.track.details;be&&(le=be.min,ce=be.max)}function ve(be){k&&(m(be),f(be))}function we(){if(Ce.purge(),z.options.drag&&!z.options.disabled){var be;be=z.options.dragSpeed||1,re=typeof be=="function"?be:function(Te){return Te*be},J=z.options.rtl?-1:1,Ie(),U=z.container,function(){var Te="data-keen-slider-clickable";c("[".concat(Te,"]:not([").concat(Te,"=false])"),U).map(function(Ae){Ce.add(Ae,"dragstart",m),Ce.add(Ae,"mousedown",m),Ce.add(Ae,"touchstart",m)})}(),Ce.add(U,"dragstart",function(Te){f(Te)}),Ce.add(U,"click",ve,{capture:!0}),Ce.input(U,"ksDragStart",$e),Ce.input(U,"ksDrag",ze),Ce.input(U,"ksDragEnd",ke),Ce.input(U,"mousedown",$e),Ce.input(U,"mousemove",ze),Ce.input(U,"mouseleave",ke),Ce.input(U,"mouseup",ke),Ce.input(U,"touchstart",$e,{passive:!0}),Ce.input(U,"touchmove",ze,{passive:!1}),Ce.input(U,"touchend",ke),Ce.input(U,"touchcancel",ke),Ce.add(window,"wheel",function(Te){K&&f(Te)});var Ee="data-keen-slider-scrollable";c("[".concat(Ee,"]:not([").concat(Ee,"=false])"),z.container).map(function(Te){return function(Ae){var De;Ce.input(Ae,"touchstart",function(Ue){De=ue(Ue),oe=!0,ne=!0},{passive:!0}),Ce.input(Ae,"touchmove",function(Ue){var Fe=Re(),Le=Fe?Ae.scrollHeight-Ae.clientHeight:Ae.scrollWidth-Ae.clientWidth,it=De-ue(Ue),ut=Fe?Ae.scrollTop:Ae.scrollLeft,vt=Fe&&Ae.style.overflowY==="scroll"||!Fe&&Ae.style.overflowX==="scroll";if(De=ue(Ue),(it<0&&ut>0||it>0&&ut<Le)&&ne&&vt)return oe=!0;ne=!1,f(Ue),oe=!1}),Ce.input(Ae,"touchend",function(){oe=!1})}(Te)})}}z.on("updated",Ie),z.on("optionsChanged",we),z.on("created",we),z.on("destroyed",Ce.purge)}function D(z){var U,B,J=null;function X(q,ee,ne){z.animator.active?K(q,ee,ne):requestAnimationFrame(function(){return K(q,ee,ne)})}function W(){X(!1,!1,B)}function K(q,ee,ne){var oe=0,le=z.size,ce=z.track.details;if(ce&&U){var Ce=ce.slides;U.forEach(function(ze,$e){if(q)!J&&ee&&F(ze,null,ne),G(ze,null,ne);else{if(!Ce[$e])return;var ke=Ce[$e].size*le;!J&&ee&&F(ze,ke,ne),G(ze,Ce[$e].distance*le-oe,ne),oe+=ke}})}}function re(q){return z.options.renderMode==="performance"?Math.round(q):q}function F(q,ee,ne){var oe=ne?"height":"width";ee!==null&&(ee=re(ee)+"px"),q.style["min-"+oe]=ee,q.style["max-"+oe]=ee}function G(q,ee,ne){if(ee!==null){ee=re(ee);var oe=ne?ee:0;ee="translate3d(".concat(ne?0:ee,"px, ").concat(oe,"px, 0)")}q.style.transform=ee,q.style["-webkit-transform"]=ee}function Z(){U&&(K(!0,!0,B),U=null),z.on("detailsChanged",W,!0)}function se(){X(!1,!0,B)}function k(){Z(),B=z.options.vertical,z.options.disabled||z.options.renderMode==="custom"||(J=E(z.options.slides,"perView",null)==="auto",z.on("detailsChanged",W),(U=z.slides).length&&se())}z.on("created",k),z.on("optionsChanged",k),z.on("beforeOptionsChanged",function(){Z()}),z.on("updated",se),z.on("destroyed",Z)}function V(z,U){return function(B){var J,X,W,K,re,F=g();function G(ge){var ue;o(B.container,"reverse",(ue=B.container,window.getComputedStyle(ue,null).getPropertyValue("direction")!=="rtl"||ge?null:"")),o(B.container,"v",B.options.vertical&&!ge?"":null),o(B.container,"disabled",B.options.disabled&&!ge?"":null)}function Z(){se()&&oe()}function se(){var ge=null;if(K.forEach(function(Re){Re.matches&&(ge=Re.__media)}),ge===J)return!1;J||B.emit("beforeOptionsChanged"),J=ge;var ue=ge?W.breakpoints[ge]:W;return B.options=M(M({},W),ue),G(),$e(),ke(),ce(),!0}function k(ge){var ue=S(ge);return(B.options.vertical?ue.height:ue.width)/B.size||1}function q(){return B.options.trackConfig.length}function ee(ge){for(var ue in J=!1,W=M(M({},U),ge),F.purge(),X=B.size,K=[],W.breakpoints||[]){var Re=window.matchMedia(ue);Re.__media=ue,K.push(Re),F.add(Re,"change",Z)}F.add(window,"orientationchange",ze),F.add(window,"resize",Ce),se()}function ne(ge){B.animator.stop();var ue=B.track.details;B.track.init(ge??(ue?ue.abs:0))}function oe(ge){ne(ge),B.emit("optionsChanged")}function le(ge,ue){if(ge)return ee(ge),void oe(ue);$e(),ke();var Re=q();ce(),q()!==Re?oe(ue):ne(ue),B.emit("updated")}function ce(){var ge=B.options.slides;if(typeof ge=="function")return B.options.trackConfig=ge(B.size,B.slides);for(var ue=B.slides,Re=ue.length,Ie=typeof ge=="number"?ge:E(ge,"number",Re,!0),ve=[],we=E(ge,"perView",1,!0),be=E(ge,"spacing",0,!0)/B.size||0,Ee=we==="auto"?be:be/we,Te=E(ge,"origin","auto"),Ae=0,De=0;De<Ie;De++){var Ue=we==="auto"?k(ue[De]):1/we-be+Ee,Fe=Te==="center"?.5-Ue/2:Te==="auto"?0:Te;ve.push({origin:Fe,size:Ue,spacing:be}),Ae+=Ue}if(Ae+=be*(Ie-1),Te==="auto"&&!B.options.loop&&we!==1){var Le=0;ve.map(function(it){var ut=Ae-Le;return Le+=it.size+be,ut>=1||(it.origin=1-ut-(Ae>1?0:1-Ae)),it})}B.options.trackConfig=ve}function Ce(){$e();var ge=B.size;B.options.disabled||ge===X||(X=ge,le())}function ze(){Ce(),setTimeout(Ce,500),setTimeout(Ce,2e3)}function $e(){var ge=S(B.container);B.size=(B.options.vertical?ge.height:ge.width)||1}function ke(){B.slides=c(B.options.selector,B.container)}B.container=(re=c(z,document)).length?re[0]:null,B.destroy=function(){F.purge(),B.emit("destroyed"),G(!0)},B.prev=function(){B.moveToIdx(B.track.details.abs-1,!0)},B.next=function(){B.moveToIdx(B.track.details.abs+1,!0)},B.update=le,ee(B.options)}}var H=function(z,U,B){try{return function(J,X){var W,K={};return W={emit:function(re){K[re]&&K[re].forEach(function(G){G(W)});var F=W.options&&W.options[re];F&&F(W)},moveToIdx:function(re,F,G){var Z=W.track.idxToDist(re,F);if(Z){var se=W.options.defaultAnimation;W.animator.start([{distance:Z,duration:E(G||se,"duration",500),easing:E(G||se,"easing",function(k){return 1+--k*k*k*k*k})}])}},on:function(re,F,G){G===void 0&&(G=!1),K[re]||(K[re]=[]);var Z=K[re].indexOf(F);Z>-1?G&&delete K[re][Z]:G||K[re].push(F)},options:J},function(){if(W.track=_(W),W.animator=N(W),X)for(var re=0,F=X;re<F.length;re++)(0,F[re])(W);W.track.init(W.options.initial||0),W.emit("created")}(),W}(U,A([V(z,{drag:!0,mode:"snap",renderMode:"precision",rubberband:!0,selector:".keen-slider__slide"}),D,L,j],B||[],!0))}catch(J){console.error(J)}};return nx.useKeenSlider=function(z,U){var B=e.useRef(null),J=e.useRef(!1),X=e.useRef(z),W=e.useCallback(function(K){K?(X.current=z,B.current=new H(K,z,U),J.current=!1):(B.current&&B.current.destroy&&B.current.destroy(),B.current=null)},[]);return e.useEffect(function(){O(X.current,z)||(X.current=z,B.current&&B.current.update(X.current))},[z]),[W,B]},nx}var EO=nK();const aK=({message:e,colorCode:t,handleAddToCart:a,handleRemoveFromCart:r})=>{const[o,c]=x.useState({}),[f,m]=x.useState({}),g=_=>{const j=/(https?:\/\/[^\s]+)/g;return _.split(j).map((L,D)=>j.test(L)?ae.jsx("a",{href:L.trim(),style:{color:"#00b3bc"},target:"_blank",rel:"noopener noreferrer",className:"underline break-words",children:L},D):ae.jsx("span",{children:L},D))},p=_=>{const j=_.trim();if(!j.includes("Name:")||!j.includes("VariantId"))return null;const L=j.match(/Name\s*[:\-]\s*(.+)/i),D=j.match(/Price\s*[:\-]\s*(.+)/i),V=j.match(/Link\s*[:\-]\s*(https?:\/\/[^\s]+)/i),H=j.match(/VariantId\s*[:\-]\s*(.+)/i),z=j.match(/variant_tag_name\s*[:\-]\s*(.+)/i),U=j.match(/options\s*[:\-]\s*([^|\r\n]+)/i);return!L||!D||!V||!H||!z?null:{name:L[1].trim(),price:D[1].trim(),link:V[1].trim(),image:"",variant_id:H[1].trim(),variant_tag_name:z[1].trim(),option:U?.[1]?.trim()}},y=x.useMemo(()=>{const _=e.split("|||").map(D=>D.trim()).filter(Boolean),j=[];let L=null;return _.forEach(D=>{if(D.startsWith("img - ")){const V=D.replace(/^img\s*[-:]\s*/,"").trim();if(L)L.image=V;else{const H=[...j].reverse().find(z=>z.type==="product");H&&(H.data.image=V)}}else if(D.includes("Name:")&&D.includes("VariantId")){const V=p(D);V&&(j.push({type:"product",data:V}),L=V)}else j.push({type:"text",data:D}),L=null}),j},[e]),S=x.useMemo(()=>{const _={};return y.forEach(j=>{if(j.type==="product"){const L=j.data;_[L.variant_tag_name]=_[L.variant_tag_name]||[],_[L.variant_tag_name].push(L)}}),_},[y]),E=(_,j=22)=>_.length>j?_.slice(0,j)+"...":_,[T,O]=x.useState(0),M=Object.keys(S).length,[A,N]=EO.useKeenSlider({loop:!1,mode:"free",slides:{perView:1,spacing:16},slideChanged(_){O(_.track.details.rel)}});return ae.jsxs("div",{className:"space-y-6 mt-4 h-fit",children:[y.filter(_=>_.type==="text").map((_,j)=>ae.jsx("p",{className:"whitespace-pre-wrap break-words",children:g(_.data)},j)),Object.keys(S).length>0&&ae.jsxs(ae.Fragment,{children:[Object.keys(S).length>1&&ae.jsxs("div",{style:{display:"flex",margin:0,marginBottom:"6px",justifyContent:"space-between",paddingInline:"4px"},children:[ae.jsx(ri,{shape:"circle",icon:ae.jsx(km,{}),onClick:()=>N.current?.prev(),disabled:T===0}),ae.jsx(ri,{shape:"circle",icon:ae.jsx(z1,{}),onClick:()=>N.current?.next(),disabled:T===M-1})]}),ae.jsx("div",{ref:A,className:"keen-slider",children:ae.jsx(tK,{groupedProducts:S,selectedVariants:f,setSelectedVariants:m,counts:o,setCounts:c,handleAddToCart:a,handleRemoveFromCart:r,colorCode:t,shortenName:E,sliderInstance:N,currentSlide:T,totalSlides:M,sliderRef: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(GT,{style:{fontSize:"24px"}}):ae.jsx(XT,{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 Wu=(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=()=>{},Zu=()=>{};sK.NODE_ENV!=="production"&&(Zm=(e,t,a)=>{!e&&typeof console<"u"&&console.warn(MO(t,a))},Zu=(e,t,a)=>{if(!e)throw new Error(MO(t,a))});const Ku={},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,Qs=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)){Zu(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 Zu(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,L)=>(j[L]=vK(c),j),{}),{setup:m,read:g,resolveKeyframes:p,preUpdate:y,update:S,preRender:E,render:T,postRender:O}=f,M=()=>{const j=Ku.useManualTiming?o.timestamp:performance.now();a=!1,Ku.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,L)=>{const D=f[L];return j[L]=(V,H=!1,z=!1)=>(a||A(),D.schedule(V,H,z)),j},{}),cancel:j=>{for(let L=0;L<rx.length;L++)f[rx[L]].cancel(j)},state:o,steps:f}}const{schedule:Pa,cancel:nf,state:oi,steps:jO}=oz(typeof requestAnimationFrame<"u"?requestAnimationFrame:Sl,!0);let ix;function bK(){ix=void 0}const yo={now:()=>(ix===void 0&&yo.set(oi.isProcessing||Ku.useManualTiming?oi.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=>Wu(0,1,e)},ox={...Km,default:1},w0=e=>Math.round(e*1e5)/1e5,HO=/-?(?:\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,BO=(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(HO);return{[e]:parseFloat(o),[t]:parseFloat(c),[a]:parseFloat(f),alpha:m!==void 0?parseFloat(m):1}},wK=e=>Wu(0,255,e),PO={...Km,transform:e=>Math.round(wK(e))},Hd={test:BO("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:BO("#"),parse:TK,transform:Hd.transform},T0=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),af=T0("deg"),Js=T0("%"),on=T0("px"),OK=T0("vh"),RK=T0("vw"),uz={...Js,parse:e=>Js.parse(e)/100,transform:e=>Js.transform(e*100)},Qm={test:BO("hsl","hue"),parse:sz("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:a,alpha:r=1})=>"hsla("+Math.round(e)+", "+Js.transform(w0(t))+", "+Js.transform(w0(a))+", "+w0(E0.transform(r))+")"},xr={test:e=>Hd.test(e)||UO.test(e)||Qm.test(e),parse:e=>Hd.test(e)?Hd.parse(e):Qm.test(e)?Qm.parse(e):UO.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Hd.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(HO)?.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,Hd,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),Hd.transform(o))},FO=new Set(["none","hidden"]);function HK(e,t){return FO.has(e)?a=>a<=0?e:t:a=>a>=1?t:e}function BK(e,t){return a=>Za(e,t,a)}function qO(e){return typeof e=="number"?BK: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?HK(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:()=>oi.isProcessing?oi.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:Qs(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=Wu(Ka.minDamping,Ka.maxDamping,f),e=Wu(Ka.minDuration,Ka.maxDuration,Qs(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*Wu(.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:-Qs(a.velocity||0)}),O=E||0,M=p/(2*Math.sqrt(g*y)),A=f-c,N=Qs(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 D=YO(N,M);j=V=>{const H=Math.exp(-M*N*V);return f-H*((O+M*N*A)/D*Math.sin(D*V)+A*Math.cos(D*V))}}else if(M===1)j=D=>f-Math.exp(-N*D)*(A+(O+N*A)*D);else{const D=N*Math.sqrt(M*M-1);j=V=>{const H=Math.exp(-M*N*V),z=Math.min(D*V,300);return f-H*((O+M*N*A)*Math.sinh(z)+D*A*Math.cosh(z))/D}}const L={calculatedDuration:T&&S||null,next:D=>{const V=j(D);if(T)m.done=D>=S;else{let H=D===0?O:0;M<1&&(H=D===0?is(O):Sz(j,D,V));const z=Math.abs(H)<=r,U=Math.abs(f-V)<=o;m.done=z&&U}return m.value=m.done?f:V,m},toString:()=>{const D=Math.min(GO(L),sx),V=bz(H=>L.next(D*H).value,D,30);return D+"ms "+V},toTransition:()=>{}};return L}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,N=f===void 0?A:f(A);N!==A&&(M=N-S);const _=z=>-M*Math.exp(-z/r),j=z=>N+_(z),L=z=>{const U=_(z),B=j(z);E.done=Math.abs(U)<=p,E.value=E.done?N:B};let D,V;const H=z=>{T(E.value)&&(D=z,V=ux({keyframes:[E.value,O(E.value)],velocity:Sz(j,z,E.value),damping:o,stiffness:c,restDelta:p,restSpeed:y}))};return H(0),{calculatedDuration:null,next:z=>{let U=!1;return!V&&D===void 0&&(U=!0,L(z),H(z)),D!==void 0&&z>=D?V.next(z-D):(!U&&L(z),E)}}}function QK(e,t,a){const r=[],o=a||Ku.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(Zu(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(Wu(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&&Zu(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 N=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?N<0:N>o;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let j=this.currentTime,L=r;if(S){const z=Math.min(this.currentTime,o)/m;let U=Math.floor(z),B=z%1;!B&&z>=1&&(B=1),B===1&&U--,U=Math.min(U,S+1),!!(U%2)&&(E==="reverse"?(B=1-B,T&&(B-=T/m)):E==="mirror"&&(L=f)),j=Wu(0,1,B)*m}const D=_?{done:!1,value:y[0]}:L.next(j);c&&(D.value=c(D.value));let{done:V}=D;!_&&g!==null&&(V=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const H=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&V);return H&&O!==WO&&(D.value=ZO(y,this.options,A,this.speed)),M&&M(D.value),H&&this.finish(),D}then(t,a){return this.finished.then(t,a)}get duration(){return Qs(this.calculatedDuration)}get time(){return Qs(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=Qs(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 Bd=e=>e*180/Math.PI,JO=e=>{const t=Bd(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=>Bd(Math.atan(e[1])),skewY:e=>Bd(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(Bd(Math.atan2(e[6],e[5]))),rotateY:e=>eR(Bd(Math.atan2(-e[2],e[0]))),rotateZ:Ez,rotate:Ez,skewX:e=>Bd(Math.atan(e[4])),skewY:e=>Bd(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,Zu(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 Qs(Number(t))}get time(){return Qs(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)||((Ku.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){Zu(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]),HQ={test:e=>e==="auto",parse:e=>e},Hz=e=>t=>t.test(e),Bz=[Km,on,Js,af,RK,OK,HQ],Pz=e=>Bz.find(Hz(e));function BQ(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(HO)||[];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||BQ(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=[...Bz,xr,rf],iJ=e=>rJ.find(Hz(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;
|