@freeday-ai/webchat 2025.12.1-7.11.1.5036 → 2025.12.1-7.13.16.8582

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.
@@ -253,4 +253,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
253
253
  ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function Yde(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function qde(){return Jk(/^Mac/)}function Gde(){return Jk(/^iPhone/)}function D9(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Kde(){return Jk(/^iPad/)||qde()&&navigator.maxTouchPoints>1}function L9(){return Gde()||Kde()}function Jk(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Qde=24,Xde=typeof window<"u"?S.useLayoutEffect:S.useEffect;function O9(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const $k=typeof document<"u"&&window.visualViewport;function N9(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function P9(e){for(N9(e)&&(e=e.parentElement);e&&!N9(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Zde=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let mE=0,e_;function Jde(e={}){let{isDisabled:t}=e;Xde(()=>{if(!t)return mE++,mE===1&&L9()&&(e_=$de()),()=>{mE--,mE===0&&e_?.()}},[t])}function $de(){let e,t=0,n=y=>{e=P9(y.target),!(e===document.documentElement&&e===document.body)&&(t=y.changedTouches[0].pageY)},r=y=>{if(!e||e===document.documentElement||e===document.body){y.preventDefault();return}let E=y.changedTouches[0].pageY,T=e.scrollTop,_=e.scrollHeight-e.clientHeight;_!==0&&((T<=0&&E>t||T>=_&&E<t)&&y.preventDefault(),t=E)},a=y=>{let E=y.target;t_(E)&&E!==document.activeElement&&(y.preventDefault(),E.style.transform="translateY(-2000px)",E.focus(),requestAnimationFrame(()=>{E.style.transform=""}))},s=y=>{let E=y.target;t_(E)&&(E.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{E.style.transform="",$k&&($k.height<window.innerHeight?requestAnimationFrame(()=>{I9(E)}):$k.addEventListener("resize",()=>I9(E),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},c=window.pageXOffset,h=window.pageYOffset,p=O9(efe(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let g=O9(Kv(document,"touchstart",n,{passive:!1,capture:!0}),Kv(document,"touchmove",r,{passive:!1,capture:!0}),Kv(document,"touchend",a,{passive:!1,capture:!0}),Kv(document,"focus",s,!0),Kv(window,"scroll",l));return()=>{p(),g(),window.scrollTo(c,h)}}function efe(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Kv(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function I9(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=P9(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,a=e.getBoundingClientRect().top,s=e.getBoundingClientRect().bottom;const l=n.getBoundingClientRect().bottom+Qde;s>l&&(n.scrollTop+=a-r)}e=n.parentElement}}function t_(e){return e instanceof HTMLInputElement&&!Zde.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function tfe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function nfe(...e){return t=>e.forEach(n=>tfe(n,t))}function M9(...e){return S.useCallback(nfe(...e),e)}const F9=new WeakMap;function Fi(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([a,s])=>{if(a.startsWith("--")){e.style.setProperty(a,s);return}r[a]=e.style[a],e.style[a]=s}),!n&&F9.set(e,r)}function rfe(e,t){if(!e||!(e instanceof HTMLElement))return;let n=F9.get(e);n&&(e.style[t]=n[t])}const ki=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function gE(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[ki(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/),a?parseFloat(a[1].split(", ")[ki(t)?5:4]):null)}function ife(e){return 8*(Math.log(e+1)-2)}function n_(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function afe(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const Zr={DURATION:.5,EASE:[.32,.72,0,1]},B9=.4,ofe=.25,sfe=100,H9=8,Qf=16,r_=26,i_="vaul-dragging";function U9(e){const t=ye.useRef(e);return ye.useEffect(()=>{t.current=e}),ye.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function lfe({defaultProp:e,onChange:t}){const n=ye.useState(e),[r]=n,a=ye.useRef(r),s=U9(t);return ye.useEffect(()=>{a.current!==r&&(s(r),a.current=r)},[r,a,s]),n}function z9({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,a]=lfe({defaultProp:t,onChange:n}),s=e!==void 0,l=s?e:r,c=U9(n),h=ye.useCallback(p=>{if(s){const y=typeof p=="function"?p(e):p;y!==e&&c(y)}else a(p)},[s,e,a,c]);return[l,h]}function ufe({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:s,onSnapPointChange:l,direction:c="bottom",container:h,snapToSequentialPoint:p}){const[g,y]=z9({prop:e,defaultProp:n?.[0],onChange:t}),[E,T]=ye.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);ye.useEffect(()=>{function X(){T({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",X),()=>window.removeEventListener("resize",X)},[]);const _=ye.useMemo(()=>g===n?.[n.length-1]||null,[n,g]),D=ye.useMemo(()=>{var X;return(X=n?.findIndex(ee=>ee===g))!=null?X:null},[n,g]),I=n&&n.length>0&&(s||s===0)&&!Number.isNaN(s)&&n[s]===g||!n,O=ye.useMemo(()=>{const X=h?{width:h.getBoundingClientRect().width,height:h.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var ee;return(ee=n?.map(he=>{const G=typeof he=="string";let pe=0;if(G&&(pe=parseInt(he,10)),ki(c)){const ne=G?pe:E?he*X.height:0;return E?c==="bottom"?X.height-ne:-X.height+ne:ne}const oe=G?pe:E?he*X.width:0;return E?c==="right"?X.width-oe:-X.width+oe:oe}))!=null?ee:[]},[n,E,h]),F=ye.useMemo(()=>D!==null?O?.[D]:null,[O,D]),H=ye.useCallback(X=>{var ee;const he=(ee=O?.findIndex(G=>G===X))!=null?ee:null;l(he),Fi(r.current,{transition:`transform ${Zr.DURATION}s cubic-bezier(${Zr.EASE.join(",")})`,transform:ki(c)?`translate3d(0, ${X}px, 0)`:`translate3d(${X}px, 0, 0)`}),O&&he!==O.length-1&&s!==void 0&&he!==s&&he<s?Fi(a.current,{transition:`opacity ${Zr.DURATION}s cubic-bezier(${Zr.EASE.join(",")})`,opacity:"0"}):Fi(a.current,{transition:`opacity ${Zr.DURATION}s cubic-bezier(${Zr.EASE.join(",")})`,opacity:"1"}),y(n?.[Math.max(he,0)])},[r.current,n,O,s,a,y]);ye.useEffect(()=>{if(g||e){var X;const ee=(X=n?.findIndex(he=>he===e||he===g))!=null?X:-1;O&&ee!==-1&&typeof O[ee]=="number"&&H(O[ee])}},[g,e,n,O,H]);function j({draggedDistance:X,closeDrawer:ee,velocity:he,dismissible:G}){if(s===void 0)return;const pe=c==="bottom"||c==="right"?(F??0)-X:(F??0)+X,oe=D===s-1,ne=D===0,se=X>0;if(oe&&Fi(a.current,{transition:`opacity ${Zr.DURATION}s cubic-bezier(${Zr.EASE.join(",")})`}),!p&&he>2&&!se){G?ee():H(O[0]);return}if(!p&&he>2&&se&&O&&n){H(O[n.length-1]);return}const me=O?.reduce((be,ae)=>typeof be!="number"||typeof ae!="number"?be:Math.abs(ae-pe)<Math.abs(be-pe)?ae:be),ve=ki(c)?window.innerHeight:window.innerWidth;if(he>B9&&Math.abs(X)<ve*.4){const be=se?1:-1;if(be>0&&_&&n){H(O[n.length-1]);return}if(ne&&be<0&&G&&ee(),D===null)return;H(O[D+be]);return}H(me)}function K({draggedDistance:X}){if(F===null)return;const ee=c==="bottom"||c==="right"?F-X:F+X;(c==="bottom"||c==="right")&&ee<O[O.length-1]||(c==="top"||c==="left")&&ee>O[O.length-1]||Fi(r.current,{transform:ki(c)?`translate3d(0, ${ee}px, 0)`:`translate3d(${ee}px, 0, 0)`})}function W(X,ee){if(!n||typeof D!="number"||!O||s===void 0)return null;const he=D===s-1;if(D>=s&&ee)return 0;if(he&&!ee)return 1;if(!I&&!he)return null;const pe=he?D+1:D-1,oe=he?O[pe]-O[pe-1]:O[pe+1]-O[pe],ne=X/Math.abs(oe);return he?1-ne:ne}return{isLastSnapPoint:_,activeSnapPoint:g,shouldFade:I,getPercentageDragged:W,setActiveSnapPoint:y,activeSnapPointIndex:D,onRelease:j,onDrag:K,snapPointsOffset:O}}const cfe=()=>()=>{};function dfe(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=Gv(),s=ye.useRef(null),l=S.useMemo(()=>document.body.style.backgroundColor,[]);function c(){return(window.innerWidth-r_)/window.innerWidth}ye.useEffect(()=>{if(t&&n){s.current&&clearTimeout(s.current);const h=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!h)return;afe(r&&!a?n_(document.body,{background:"black"}):cfe,n_(h,{transformOrigin:ki(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Zr.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Zr.EASE.join(",")})`}));const p=n_(h,{borderRadius:`${H9}px`,overflow:"hidden",...ki(e)?{transform:`scale(${c()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${c()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{p(),s.current=window.setTimeout(()=>{l?document.body.style.background=l:document.body.style.removeProperty("background")},Zr.DURATION*1e3)}}},[t,n,l])}let Qv=null;function ffe({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:s}){const[l,c]=ye.useState(()=>typeof window<"u"?window.location.href:""),h=ye.useRef(0),p=ye.useCallback(()=>{if(D9()&&Qv===null&&e&&!s){Qv={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:y,innerHeight:E}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-h.current}px`,left:`${-y}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const T=E-window.innerHeight;T&&h.current>=E&&(document.body.style.top=`${-(h.current+T)}px`)}),300)}},[e]),g=ye.useCallback(()=>{if(D9()&&Qv!==null&&!s){const y=-parseInt(document.body.style.top,10),E=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Qv),window.requestAnimationFrame(()=>{if(a&&l!==window.location.href){c(window.location.href);return}window.scrollTo(E,y)}),Qv=null}},[l]);return ye.useEffect(()=>{function y(){h.current=window.scrollY}return y(),window.addEventListener("scroll",y),()=>{window.removeEventListener("scroll",y)}},[]),ye.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||g()}},[t,g]),ye.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&p(),t||window.setTimeout(()=>{g()},500)):g())},[e,r,l,t,n,p,g]),{restorePositionSetting:g}}function hfe({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:a,snapPoints:s,shouldScaleBackground:l=!1,setBackgroundColorOnScale:c=!0,closeThreshold:h=ofe,scrollLockTimeout:p=sfe,dismissible:g=!0,handleOnly:y=!1,fadeFromIndex:E=s&&s.length-1,activeSnapPoint:T,setActiveSnapPoint:_,fixed:D,modal:I=!0,onClose:O,nested:F,noBodyStyles:H=!1,direction:j="bottom",defaultOpen:K=!1,disablePreventScroll:W=!0,snapToSequentialPoint:X=!1,preventScrollRestoration:ee=!1,repositionInputs:he=!0,onAnimationEnd:G,container:pe,autoFocus:oe=!1}){var ne,se;const[me=!1,ve]=z9({defaultProp:K,prop:e,onChange:ot=>{t?.(ot),!ot&&!F&&Ie(),setTimeout(()=>{G?.(ot)},Zr.DURATION*1e3),ot&&!I&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ot||(document.body.style.pointerEvents="auto")}}),[be,ae]=ye.useState(!1),[Le,U]=ye.useState(!1),[J,Se]=ye.useState(!1),V=ye.useRef(null),Ue=ye.useRef(null),Je=ye.useRef(null),it=ye.useRef(null),Ct=ye.useRef(null),$e=ye.useRef(!1),Lt=ye.useRef(null),Pt=ye.useRef(0),cn=ye.useRef(!1),xn=ye.useRef(!K),Mn=ye.useRef(0),ht=ye.useRef(null),Jn=ye.useRef(((ne=ht.current)==null?void 0:ne.getBoundingClientRect().height)||0),Vn=ye.useRef(((se=ht.current)==null?void 0:se.getBoundingClientRect().width)||0),bn=ye.useRef(0),Jr=ye.useCallback(ot=>{s&&ot===We.length-1&&(Ue.current=new Date)},[]),{activeSnapPoint:nr,activeSnapPointIndex:$,setActiveSnapPoint:ge,onRelease:Ce,snapPointsOffset:We,onDrag:Ge,shouldFade:je,getPercentageDragged:ue}=ufe({snapPoints:s,activeSnapPointProp:T,setActiveSnapPointProp:_,drawerRef:ht,fadeFromIndex:E,overlayRef:V,onSnapPointChange:Jr,direction:j,container:pe,snapToSequentialPoint:X});Jde({isDisabled:!me||Le||!I||J||!be||!he||!W});const{restorePositionSetting:Ie}=ffe({isOpen:me,modal:I,nested:F??!1,hasBeenOpened:be,preventScrollRestoration:ee,noBodyStyles:H});function et(){return(window.innerWidth-r_)/window.innerWidth}function _t(ot){var It,Mt;!g&&!s||ht.current&&!ht.current.contains(ot.target)||(Jn.current=((It=ht.current)==null?void 0:It.getBoundingClientRect().height)||0,Vn.current=((Mt=ht.current)==null?void 0:Mt.getBoundingClientRect().width)||0,U(!0),Je.current=new Date,L9()&&window.addEventListener("touchend",()=>$e.current=!1,{once:!0}),ot.target.setPointerCapture(ot.pointerId),Pt.current=ki(j)?ot.pageY:ot.pageX)}function zt(ot,It){var Mt;let Gt=ot;const Rn=(Mt=window.getSelection())==null?void 0:Mt.toString(),xt=ht.current?gE(ht.current,j):null,sn=new Date;if(Gt.tagName==="SELECT"||Gt.hasAttribute("data-vaul-no-drag")||Gt.closest("[data-vaul-no-drag]"))return!1;if(j==="right"||j==="left")return!0;if(Ue.current&&sn.getTime()-Ue.current.getTime()<500)return!1;if(xt!==null&&(j==="bottom"?xt>0:xt<0))return!0;if(Rn&&Rn.length>0)return!1;if(Ct.current&&sn.getTime()-Ct.current.getTime()<p&&xt===0||It)return Ct.current=sn,!1;for(;Gt;){if(Gt.scrollHeight>Gt.clientHeight){if(Gt.scrollTop!==0)return Ct.current=new Date,!1;if(Gt.getAttribute("role")==="dialog")return!0}Gt=Gt.parentNode}return!0}function ze(ot){if(ht.current&&Le){const It=j==="bottom"||j==="right"?1:-1,Mt=(Pt.current-(ki(j)?ot.pageY:ot.pageX))*It,Gt=Mt>0,Rn=s&&!g&&!Gt;if(Rn&&$===0)return;const xt=Math.abs(Mt),sn=document.querySelector("[data-vaul-drawer-wrapper]"),Wn=j==="bottom"||j==="top"?Jn.current:Vn.current;let Yn=xt/Wn;const zr=ue(xt,Gt);if(zr!==null&&(Yn=zr),Rn&&Yn>=1||!$e.current&&!zt(ot.target,Gt))return;if(ht.current.classList.add(i_),$e.current=!0,Fi(ht.current,{transition:"none"}),Fi(V.current,{transition:"none"}),s&&Ge({draggedDistance:Mt}),Gt&&!s){const jn=ife(Mt),Mr=Math.min(jn*-1,0)*It;Fi(ht.current,{transform:ki(j)?`translate3d(0, ${Mr}px, 0)`:`translate3d(${Mr}px, 0, 0)`});return}const zn=1-Yn;if((je||E&&$===E-1)&&(r?.(ot,Yn),Fi(V.current,{opacity:`${zn}`,transition:"none"},!0)),sn&&V.current&&l){const jn=Math.min(et()+Yn*(1-et()),1),Mr=8-Yn*8,Gn=Math.max(0,14-Yn*14);Fi(sn,{borderRadius:`${Mr}px`,transform:ki(j)?`scale(${jn}) translate3d(0, ${Gn}px, 0)`:`scale(${jn}) translate3d(${Gn}px, 0, 0)`,transition:"none"},!0)}if(!s){const jn=xt*It;Fi(ht.current,{transform:ki(j)?`translate3d(0, ${jn}px, 0)`:`translate3d(${jn}px, 0, 0)`})}}}ye.useEffect(()=>{window.requestAnimationFrame(()=>{xn.current=!0})},[]),ye.useEffect(()=>{var ot;function It(){if(!ht.current||!he)return;const Mt=document.activeElement;if(t_(Mt)||cn.current){var Gt;const Rn=((Gt=window.visualViewport)==null?void 0:Gt.height)||0,xt=window.innerHeight;let sn=xt-Rn;const Wn=ht.current.getBoundingClientRect().height||0,Yn=Wn>xt*.8;bn.current||(bn.current=Wn);const zr=ht.current.getBoundingClientRect().top;if(Math.abs(Mn.current-sn)>60&&(cn.current=!cn.current),s&&s.length>0&&We&&$){const zn=We[$]||0;sn+=zn}if(Mn.current=sn,Wn>Rn||cn.current){const zn=ht.current.getBoundingClientRect().height;let jn=zn;zn>Rn&&(jn=Rn-(Yn?zr:r_)),D?ht.current.style.height=`${zn-Math.max(sn,0)}px`:ht.current.style.height=`${Math.max(jn,Rn-zr)}px`}else Yde()||(ht.current.style.height=`${bn.current}px`);s&&s.length>0&&!cn.current?ht.current.style.bottom="0px":ht.current.style.bottom=`${Math.max(sn,0)}px`}}return(ot=window.visualViewport)==null||ot.addEventListener("resize",It),()=>{var Mt;return(Mt=window.visualViewport)==null?void 0:Mt.removeEventListener("resize",It)}},[$,s,We]);function st(ot){rn(),O?.(),ot||ve(!1),setTimeout(()=>{s&&ge(s[0])},Zr.DURATION*1e3)}function Nt(){if(!ht.current)return;const ot=document.querySelector("[data-vaul-drawer-wrapper]"),It=gE(ht.current,j);Fi(ht.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Zr.DURATION}s cubic-bezier(${Zr.EASE.join(",")})`}),Fi(V.current,{transition:`opacity ${Zr.DURATION}s cubic-bezier(${Zr.EASE.join(",")})`,opacity:"1"}),l&&It&&It>0&&me&&Fi(ot,{borderRadius:`${H9}px`,overflow:"hidden",...ki(j)?{transform:`scale(${et()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${et()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Zr.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Zr.EASE.join(",")})`},!0)}function rn(){!Le||!ht.current||(ht.current.classList.remove(i_),$e.current=!1,U(!1),it.current=new Date)}function Tn(ot){if(!Le||!ht.current)return;ht.current.classList.remove(i_),$e.current=!1,U(!1),it.current=new Date;const It=gE(ht.current,j);if(!ot||!zt(ot.target,!1)||!It||Number.isNaN(It)||Je.current===null)return;const Mt=it.current.getTime()-Je.current.getTime(),Gt=Pt.current-(ki(j)?ot.pageY:ot.pageX),Rn=Math.abs(Gt)/Mt;if(Rn>.05&&(Se(!0),setTimeout(()=>{Se(!1)},200)),s){Ce({draggedDistance:Gt*(j==="bottom"||j==="right"?1:-1),closeDrawer:st,velocity:Rn,dismissible:g}),a?.(ot,!0);return}if(j==="bottom"||j==="right"?Gt>0:Gt<0){Nt(),a?.(ot,!0);return}if(Rn>B9){st(),a?.(ot,!1);return}var xt;const sn=Math.min((xt=ht.current.getBoundingClientRect().height)!=null?xt:0,window.innerHeight);var Wn;const Yn=Math.min((Wn=ht.current.getBoundingClientRect().width)!=null?Wn:0,window.innerWidth),zr=j==="left"||j==="right";if(Math.abs(It)>=(zr?Yn:sn)*h){st(),a?.(ot,!1);return}a?.(ot,!0),Nt()}ye.useEffect(()=>(me&&(Fi(document.documentElement,{scrollBehavior:"auto"}),Ue.current=new Date),()=>{rfe(document.documentElement,"scrollBehavior")}),[me]);function Zt(ot){const It=ot?(window.innerWidth-Qf)/window.innerWidth:1,Mt=ot?-Qf:0;Lt.current&&window.clearTimeout(Lt.current),Fi(ht.current,{transition:`transform ${Zr.DURATION}s cubic-bezier(${Zr.EASE.join(",")})`,transform:ki(j)?`scale(${It}) translate3d(0, ${Mt}px, 0)`:`scale(${It}) translate3d(${Mt}px, 0, 0)`}),!ot&&ht.current&&(Lt.current=setTimeout(()=>{const Gt=gE(ht.current,j);Fi(ht.current,{transition:"none",transform:ki(j)?`translate3d(0, ${Gt}px, 0)`:`translate3d(${Gt}px, 0, 0)`})},500))}function Cn(ot,It){if(It<0)return;const Mt=(window.innerWidth-Qf)/window.innerWidth,Gt=Mt+It*(1-Mt),Rn=-Qf+It*Qf;Fi(ht.current,{transform:ki(j)?`scale(${Gt}) translate3d(0, ${Rn}px, 0)`:`scale(${Gt}) translate3d(${Rn}px, 0, 0)`,transition:"none"})}function _n(ot,It){const Mt=ki(j)?window.innerHeight:window.innerWidth,Gt=It?(Mt-Qf)/Mt:1,Rn=It?-Qf:0;It&&Fi(ht.current,{transition:`transform ${Zr.DURATION}s cubic-bezier(${Zr.EASE.join(",")})`,transform:ki(j)?`scale(${Gt}) translate3d(0, ${Rn}px, 0)`:`scale(${Gt}) translate3d(${Rn}px, 0, 0)`})}return ye.useEffect(()=>{I||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[I]),ye.createElement(OA,{defaultOpen:K,onOpenChange:ot=>{!g&&!ot||(ot?ae(!0):st(!0),ve(ot))},open:me},ye.createElement(R9.Provider,{value:{activeSnapPoint:nr,snapPoints:s,setActiveSnapPoint:ge,drawerRef:ht,overlayRef:V,onOpenChange:t,onPress:_t,onRelease:Tn,onDrag:ze,dismissible:g,shouldAnimate:xn,handleOnly:y,isOpen:me,isDragging:Le,shouldFade:je,closeDrawer:st,onNestedDrag:Cn,onNestedOpenChange:Zt,onNestedRelease:_n,keyboardIsOpen:cn,modal:I,snapPointsOffset:We,activeSnapPointIndex:$,direction:j,shouldScaleBackground:l,setBackgroundColorOnScale:c,noBodyStyles:H,container:pe,autoFocus:oe}},n))}const j9=ye.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:s,isOpen:l,modal:c,shouldAnimate:h}=Gv(),p=M9(t,n),g=r&&r.length>0;if(!c)return null;const y=ye.useCallback(E=>a(E),[a]);return ye.createElement(PA,{onMouseUp:y,ref:p,"data-vaul-overlay":"","data-vaul-snap-points":l&&g?"true":"false","data-vaul-snap-points-overlay":l&&s?"true":"false","data-vaul-animate":h?.current?"true":"false",...e})});j9.displayName="Drawer.Overlay";const V9=ye.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},a){const{drawerRef:s,onPress:l,onRelease:c,onDrag:h,keyboardIsOpen:p,snapPointsOffset:g,activeSnapPointIndex:y,modal:E,isOpen:T,direction:_,snapPoints:D,container:I,handleOnly:O,shouldAnimate:F,autoFocus:H}=Gv(),[j,K]=ye.useState(!1),W=M9(a,s),X=ye.useRef(null),ee=ye.useRef(null),he=ye.useRef(!1),G=D&&D.length>0;dfe();const pe=(ne,se,me=0)=>{if(he.current)return!0;const ve=Math.abs(ne.y),be=Math.abs(ne.x),ae=be>ve,Le=["bottom","right"].includes(se)?1:-1;if(se==="left"||se==="right"){if(!(ne.x*Le<0)&&be>=0&&be<=me)return ae}else if(!(ne.y*Le<0)&&ve>=0&&ve<=me)return!ae;return he.current=!0,!0};ye.useEffect(()=>{G&&window.requestAnimationFrame(()=>{K(!0)})},[]);function oe(ne){X.current=null,he.current=!1,c(ne)}return ye.createElement(Nw,{"data-vaul-drawer-direction":_,"data-vaul-drawer":"","data-vaul-delayed-snap-points":j?"true":"false","data-vaul-snap-points":T&&G?"true":"false","data-vaul-custom-container":I?"true":"false","data-vaul-animate":F?.current?"true":"false",...r,ref:W,style:g&&g.length>0?{"--snap-point-height":`${g[y??0]}px`,...t}:t,onPointerDown:ne=>{O||(r.onPointerDown==null||r.onPointerDown.call(r,ne),X.current={x:ne.pageX,y:ne.pageY},l(ne))},onOpenAutoFocus:ne=>{n?.(ne),H||ne.preventDefault()},onPointerDownOutside:ne=>{if(e?.(ne),!E||ne.defaultPrevented){ne.preventDefault();return}p.current&&(p.current=!1)},onFocusOutside:ne=>{if(!E){ne.preventDefault();return}},onPointerMove:ne=>{if(ee.current=ne,O||(r.onPointerMove==null||r.onPointerMove.call(r,ne),!X.current))return;const se=ne.pageY-X.current.y,me=ne.pageX-X.current.x,ve=ne.pointerType==="touch"?10:2;pe({x:me,y:se},_,ve)?h(ne):(Math.abs(me)>ve||Math.abs(se)>ve)&&(X.current=null)},onPointerUp:ne=>{r.onPointerUp==null||r.onPointerUp.call(r,ne),X.current=null,he.current=!1,c(ne)},onPointerOut:ne=>{r.onPointerOut==null||r.onPointerOut.call(r,ne),oe(ee.current)},onContextMenu:ne=>{r.onContextMenu==null||r.onContextMenu.call(r,ne),ee.current&&oe(ee.current)}})});V9.displayName="Drawer.Content";const pfe=250,mfe=120,gfe=ye.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:a,isDragging:s,snapPoints:l,activeSnapPoint:c,setActiveSnapPoint:h,dismissible:p,handleOnly:g,isOpen:y,onPress:E,onDrag:T}=Gv(),_=ye.useRef(null),D=ye.useRef(!1);function I(){if(D.current){H();return}window.setTimeout(()=>{O()},mfe)}function O(){if(s||e||D.current){H();return}if(H(),!l||l.length===0){p||a();return}if(c===l[l.length-1]&&p){a();return}const K=l.findIndex(X=>X===c);if(K===-1)return;const W=l[K+1];h(W)}function F(){_.current=window.setTimeout(()=>{D.current=!0},pfe)}function H(){_.current&&window.clearTimeout(_.current),D.current=!1}return ye.createElement("div",{onClick:I,onPointerCancel:H,onPointerDown:j=>{g&&E(j),F()},onPointerMove:j=>{g&&T(j)},ref:r,"data-vaul-drawer-visible":y?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},ye.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});gfe.displayName="Drawer.Handle";function vfe(e){const t=Gv(),{container:n=t.container,...r}=e;return ye.createElement(NA,{container:n,...r})}const nl={Root:hfe,Content:V9,Overlay:j9,Portal:vfe,Close:IA,Title:Pw,Description:Iw},W9=({shouldScaleBackground:e=!0,...t})=>P.jsx(nl.Root,{shouldScaleBackground:e,...t});W9.displayName="Drawer";const yfe=nl.Portal,bfe=nl.Close,Y9=S.forwardRef(({className:e,...t},n)=>P.jsx(nl.Overlay,{ref:n,className:Ar("fixed inset-0 z-50 bg-black/80",e),...t}));Y9.displayName=nl.Overlay.displayName;const q9=S.forwardRef(({className:e,children:t,onClose:n,...r},a)=>{const{state:s}=Kr();if(s.inShadowDom){const l=()=>{n&&n()},c=h=>{h.stopPropagation()};return P.jsxs("div",{className:"absolute inset-0 z-50 flex flex-col justify-end duration-300 animate-in fade-in-0",children:[P.jsx("button",{className:"absolute inset-0 bg-black/20",onClick:l,tabIndex:-1,"aria-hidden":"true"}),P.jsx(nl.Content,{ref:a,className:Ar("absolute w-full duration-300 animate-in slide-in-from-bottom",e),onClick:c,...r,children:t})]})}return P.jsxs(yfe,{children:[P.jsx(Y9,{}),P.jsx(nl.Content,{ref:a,className:Ar("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...r,children:t})]})});q9.displayName="DrawerContent";const G9=({className:e,...t})=>P.jsx("div",{className:Ar("sm:text-left grid gap-1.5 p-4 text-center",e),...t});G9.displayName="DrawerHeader";const a_=S.forwardRef(({className:e,...t},n)=>P.jsx(nl.Title,{ref:n,className:Ar("text-lg font-semibold leading-none tracking-tight",e),...t}));a_.displayName=nl.Title.displayName;const o_=S.forwardRef(({className:e,...t},n)=>P.jsx(nl.Description,{ref:n,className:Ar("text-base text-muted-foreground",e),...t}));o_.displayName=nl.Description.displayName;const wfe=({isOpen:e,onClose:t,children:n,modal:r=!0})=>P.jsx(W9,{open:e,onClose:t,modal:r,children:P.jsx("div",{className:"p-4",children:n})});var s_=(e=>(e.Drawer="drawer",e.Dialog="dialog",e))(s_||{});const K9=S.createContext(void 0),Efe=()=>{const e=S.useContext(K9);if(!e)throw new Error("useModal must be used within a ModalProvider");return e},xfe=({children:e})=>{const[t,n]=S.useState(!1),[r,a]=S.useState(null),[s,l]=S.useState(null),[c,h]=S.useState({modal:!0}),p=(y,E,T={modal:!0})=>{a(y),l(ye.cloneElement(E,{closeModal:g})),h(T),n(!0)},g=()=>{n(!1),setTimeout(()=>{a(null),l(null)})};return P.jsxs(K9.Provider,{value:{openModal:p,closeModal:g},children:[e,r==="drawer"&&P.jsx(wfe,{isOpen:t,onClose:g,modal:c.modal,children:s}),r==="dialog"&&P.jsx(Vde,{isOpen:t,onClose:g,children:s})]})};function Tfe({message:e,handleActionEvent:t,close:n}){return P.jsxs(Zk,{className:"sm:max-w-[425px]",children:[P.jsxs(A9,{children:[P.jsx(k9,{children:"Thank you for your response!"}),P.jsx(_9,{children:"Can you tell us what went wrong?"})]}),P.jsx(kfe,{message:e,handleActionEvent:t,close:n})]})}const Cfe=({title:e,description:t})=>P.jsxs("div",{className:"flex h-full min-h-[240px] w-full flex-1 flex-col items-center justify-center gap-4",children:[P.jsx(VL,{className:"mx-auto text-[#F7ADFC]",weight:"fill",size:30}),P.jsxs("div",{className:"text-center",children:[P.jsx(a_,{className:"font-brand text-center text-lg font-semibold text-primary-foreground",children:e}),P.jsx(o_,{className:"text-center text-primary-foreground/80",children:t})]})]});function Sfe({message:e,handleActionEvent:t,close:n}){const{t:r}=Gr(["common","feedback"]),[a,s]=S.useState(""),[l,c]=S.useState(!1),[h,p]=S.useState(!1),g=y=>{y.preventDefault(),c(!0),t("user-feedback-message",{id:e.id,value:a},"input"),s(""),p(!0),setTimeout(()=>{c(!1),setTimeout(n,1500)},1500)};return P.jsxs(q9,{className:"min-h-40 overflow-hidden rounded-t-[20px] border-primary bg-primary text-primary-foreground",children:[P.jsx(ad,{children:P.jsx(Ir.div,{layoutId:"underline",children:P.jsx(G9,{className:"",children:h?P.jsx(Cfe,{title:r("feedback:modalSubmittedTitle"),description:r("feedback:modalSubmittedDescription")}):P.jsxs("div",{className:"flex items-center justify-between",children:[P.jsx("div",{className:"relative w-12"}),P.jsxs("div",{className:"text-center",children:[P.jsx(a_,{className:"text-center",children:r("feedback:modalTitle")}),P.jsx(o_,{className:"text-primary-foreground/80",children:r("feedback:modalDescription")})]}),P.jsx(bfe,{className:"w-12",asChild:!0,children:P.jsx(Bf,{variant:"link",onClick:n,className:"text-right text-primary-foreground",children:P.jsx($0,{weight:"regular",size:20})})})]})})})}),h?P.jsx(P.Fragment,{}):P.jsxs(Ir.form,{onSubmit:g,className:"mt-auto flex flex-col gap-2 p-4 pt-2",children:[P.jsx($w,{className:"border border-white text-base text-white shadow-none ring-0 placeholder:text-white focus-visible:ring-0 widget:text-sm",placeholder:r("feedback:modalPlaceholder"),"data-testid":"feedback-form-textarea",value:a,rows:4,disabled:l,onChange:y=>s(y.target.value)}),P.jsx(Bf,{disabled:l||!a,type:"submit",variant:"secondary","data-testid":"feedback-form-button",children:r(l?"sending":"send")})]})]})}const md={container:"_container_1o4ld_1",button:"_button_1o4ld_8",buttonPositive:"_buttonPositive_1o4ld_17",active:"_active_1o4ld_17",buttonNegative:"_buttonNegative_1o4ld_26"},Afe=({message:e,handleActionEvent:t})=>{const{t:n}=Gr("common"),{openModal:r,closeModal:a}=Efe(),s=wA("(min-width: 768px)"),{state:l}=Kr(),c=h=>{h.preventDefault(),t("feedback-pressed",{id:e.id,value:"negative"}),s&&!l.inShadowDom?r(s_.Dialog,P.jsx(Tfe,{message:e,handleActionEvent:t,close:a})):r(s_.Drawer,P.jsx(Sfe,{message:e,handleActionEvent:t,close:a}))};return P.jsxs("div",{className:md.container,children:[P.jsxs(jl,{as:"span",variant:"caption",className:md.label,children:[n("feedback:thumbsUp"),"?"]}),P.jsxs("button",{className:Ar(md.button,md.buttonPositive,e.user_feedback_value==="positive"&&md.active),"data-testid":`thumbs-up thumbs-feedback-sentiment-${e.user_feedback_value==="positive"?e.user_feedback_value:"none"}`,onClick:h=>{h.preventDefault(),t("feedback-pressed",{id:e.id,value:"positive"})},children:[P.jsx(XL,{"aria-hidden":!0,focusable:"false",weight:e.user_feedback_value==="positive"?"fill":"regular",size:20})," "]}),P.jsxs("button",{className:Ar(md.button,md.buttonNegative,e.user_feedback_value==="negative"&&md.active),"data-testid":`thumbs-down thumbs-feedback-sentiment-${e.user_feedback_value==="negative"?e.user_feedback_value:"none"}`,onClick:c,children:[P.jsx(QL,{"aria-hidden":!0,focusable:"false",weight:e.user_feedback_value==="negative"?"fill":"regular",size:20})," "]})]})},kfe=({message:e,handleActionEvent:t,close:n,className:r})=>{const[a,s]=S.useState(""),[l,c]=S.useState(!1),h=p=>{p.preventDefault(),c(!0),t("user-feedback-message",{id:e.id,value:a},"input"),s(""),setTimeout(()=>{c(!1),n()},500)};return P.jsxs("form",{"data-testid":"feedback-form",onSubmit:h,className:Ar("mt-auto flex flex-col gap-2",r),children:[P.jsx($w,{className:"border-0 bg-white text-base text-black shadow-none ring-0 focus-visible:ring-0 widget:text-sm",placeholder:"Share your thoughts here..",value:a,disabled:l,"data-testid":"feedback-form-textarea",onChange:p=>s(p.target.value)}),P.jsx(Bf,{disabled:l||!a,type:"submit",variant:"secondary","data-testid":"feedback-form-button",children:"Send"})]})},_fe=({message:e,index:t,isLastInGroup:n,isFirstInGroup:r,...a})=>{const{state:s,handleActionEvent:l}=Kr(),c=t===s.messages.length-1,h=s.userId?Tf(e,s.userId):!1,p=h?"user":e.sender_id;return P.jsx("div",{...a,children:P.jsxs(x9,{settings:s.settings,testId:t.toString(),variant:p,isFirstInGroup:r,isLastInGroup:n,sentAt:c?e.sent_at:null,userName:e.sender_name?e.sender_name:s.settings?.digitalEmployeeName,className:"",children:[e.blocks.map(g=>w9(g,p)),P.jsx(ad,{children:e.request_user_feedback&&!h&&P.jsx(Ir.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3,ease:[.42,0,0,1],delay:.2},children:P.jsx(Afe,{message:e,handleActionEvent:l})})})]})})},l_={container:"_container_16hjh_1",text:"_text_16hjh_9",shimmerText:"_shimmerText_16hjh_16"},Rfe=({size:e=48})=>{const[t,n]=S.useState(0);S.useEffect(()=>{const h=setInterval(()=>n(p=>p+1),16);return()=>clearInterval(h)},[]);const r=t*.1,a=Math.abs(Math.sin(r)),s=32-a*16,l=t*1.5,c=1-(1-a)*.2;return P.jsxs("svg",{width:e,height:e,viewBox:"0 0 48 48",children:[P.jsx("ellipse",{cx:24,cy:40,rx:10-a*4,ry:3-a*1.5,fill:"var(--color-theme-regular)",opacity:.15}),P.jsx("g",{transform:`translate(24, ${s}) rotate(${l}) scale(${1/c}, ${c})`,children:[0,1,2,3,4,5].map(h=>{const p=h/6*Math.PI*2-Math.PI/2;return P.jsx("line",{x1:0,y1:0,x2:Math.cos(p)*10,y2:Math.sin(p)*10,stroke:"var(--color-theme-regular)",strokeWidth:3.5,strokeLinecap:"round"},h)})})]})},Dfe=()=>{const{state:e}=Kr(),{t}=Gr("common");return P.jsx(x9,{settings:e.settings,userName:e.settings?.digitalEmployeeName,testId:"loading",variant:"bot",isFirstInGroup:!0,isLastInGroup:!1,sentAt:null,className:"",children:P.jsx(pE,{variant:"bot",children:P.jsxs("div",{className:l_.container,children:[P.jsx(Ir.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.35,ease:[.42,0,0,1]},children:P.jsx(Rfe,{size:40})}),P.jsx(Ir.div,{initial:{opacity:0,x:-5},animate:{opacity:1,x:0},exit:{opacity:0,x:-5},transition:{duration:.35,delay:.4,ease:[.42,0,0,1]},children:P.jsx(jl,{as:"p",variant:"body",className:l_.text,children:P.jsx("span",{className:l_.shimmerText,children:t("isThinking")})})})]})})},"message-loading")},Lfe={spinner:"_spinner_mxybw_1"},Q9=({size:e=20,className:t=""})=>P.jsx("div",{className:`${Lfe.spinner} ${t}`,style:{width:e,height:e},"aria-hidden":"true"}),Zl={container:"_container_11d3g_1",bubble:"_bubble_11d3g_7",error:"_error_11d3g_11",uploadingPlaceholder:"_uploadingPlaceholder_11d3g_15",spinner:"_spinner_11d3g_22",uploadingText:"_uploadingText_11d3g_26",content:"_content_11d3g_30",errorContainer:"_errorContainer_11d3g_36",errorIcon:"_errorIcon_11d3g_42",errorText:"_errorText_11d3g_46"},Ofe=()=>{const{t:e}=Gr(),{error:t}=J0();return P.jsx("div",{className:Zl.container,children:P.jsx(pE,{variant:"user",className:Ra(Zl.bubble,{[Zl.error]:!!t}),children:P.jsx("div",{className:Zl.content,children:t?P.jsxs("div",{className:Zl.errorContainer,"data-testid":"upload-error",children:[P.jsx(ZL,{size:20,className:Zl.errorIcon}),P.jsx("span",{className:Zl.errorText,children:t})]}):P.jsxs("div",{className:Zl.uploadingPlaceholder,"data-testid":"upload-loading",children:[P.jsx(Q9,{size:18,className:Zl.spinner}),P.jsx("span",{className:Zl.uploadingText,children:e("upload:uploadingText")})]})})})})},Nfe=({item:e})=>{switch(e.type){case"message":return P.jsx(_fe,{message:e.message,index:e.index,isLastInGroup:e.isLastInGroup,isFirstInGroup:e.isFirstInGroup});case"typing-indicator":return P.jsx(Dfe,{});case"upload-bubble":return P.jsx(Ofe,{});default:return null}},Pfe=({group:e,placeholderMinHeight:t})=>P.jsx("div",{className:"flex flex-col gap-5",style:{minHeight:e.showPlaceholder?t:void 0},children:e.items.map(n=>P.jsx(Nfe,{item:n},n.id))},e.id);function Ife(e){return e?e.map(t=>({...t,blocks:t.blocks?t.blocks.filter(n=>Ode(n.type)):[]})):[]}function Mfe(e){return e?e.filter(t=>t.blocks&&t.blocks.length>0):[]}function Ffe(){const{state:e,endDivRef:t,scrollableDivRef:n}=Kr(),{scrollToBottom:r,isScrolledUp:a}=Pde(n.current),[s,l]=S.useState(!1),c=S.useMemo(()=>{const E=Ife(e.messages);return Mfe(E)},[e.messages]),{chatGroups:h,groupCount:p}=Mde({messages:c});S.useEffect(()=>{h.some(T=>T.showPlaceholder)&&n.current&&setTimeout(()=>{n.current?.scrollTo({top:n.current.scrollHeight,behavior:"smooth"})},100)},[p,n]),S.useEffect(()=>{!s&&e.messages.length>0&&(l(!0),setTimeout(()=>{n.current?.scrollTo({top:n.current?.scrollHeight})},0))},[e.messages,s]);const y=`${(n.current?.clientHeight||0)-24}px`;return P.jsxs("div",{className:"relative h-full w-full",children:[P.jsx(Ide,{}),P.jsx("div",{className:"scroll-bar h-full w-full overflow-y-auto overflow-x-hidden overscroll-contain",ref:n,children:P.jsx("div",{className:"flex h-[calc(100%+1px)] flex-col",children:P.jsx("div",{className:"relative flex grow flex-col gap-5 pb-6 pl-6 pr-3.5 pt-2",children:h.map(E=>P.jsx(Pfe,{group:E,placeholderMinHeight:y},E.id))})})}),P.jsx("div",{ref:t}),a&&P.jsx(Bf,{variant:"outline",size:"icon",onClick:r,className:"absolute bottom-6 left-1/2 -translate-x-1/2 border border-border p-1",children:P.jsx(zL,{size:18})})]})}const bm=(e,t="bot")=>({id:`group-${Math.floor(Math.random()*1e6)}`,items:[{id:"message",type:"message",message:{id:"1",type:"message",blocks:e,request_user_feedback:!1,user_feedback_value:null,sent_at:new Date().toISOString(),sender_name:"Assistant",sender_id:t==="user"?localStorage.getItem("freeday:user_id")?.replace(/"/g,"")??"":t},index:0,isFirstInGroup:!0,isLastInGroup:!0}],showPlaceholder:!1});bm([{id:"text-1",type:"text",text:"Hello! How can I help you today?"}]),bm([{id:"text-2",type:"text",text:"Can you show me examples of markdown formatting?"}],"user"),bm([{id:"markdown-1",type:"markdown",content:`
254
254
  ## Text Formatting
255
255
  You can use **bold text** for emphasis, *italic text* for subtle emphasis, and ***bold italic*** for maximum impact.
256
- `}]),bm([{id:"text-3",type:"text",text:"Thank you so much for your help!"}],"user"),bm([{id:"text-4",type:"text",text:"How can I help you today?"}],"integration"),bm([{id:"text-5",type:"image_reference",url:"https://cdn.prod.website-files.com/67580eaeabf02db2fa98f2b7/67b6062f265cc0b4f8228102_Screenshot%202025-02-19%20at%2017.25.47.avif",filename:"MJ.avif"}],"user");const Bfe=()=>{const{state:e}=Kr(),{t}=Gr(),[n,r]=S.useState(!0),[a,s]=S.useState(!1);S.useEffect(()=>{const c=setTimeout(()=>{s(!0)},300);return()=>clearTimeout(c)},[]),S.useEffect(()=>{if(!n)return;const c=h=>{!a||h.target.closest('[data-testid="chat-button"]')||r(!1)};return window.addEventListener("click",c),window.addEventListener("touchstart",c),()=>{window.removeEventListener("click",c),window.removeEventListener("touchstart",c)}},[a,n]);const l=()=>{r(!1)};return e.settings?.bannerTitle&&n?P.jsx("div",{className:"pb-7.5 absolute left-0 right-0 top-0 max-h-[500px] -translate-y-full gap-4 overflow-hidden rounded-t-[30px] bg-white transition-all duration-300 ease-in-out","data-testid":"banner",children:P.jsxs("div",{className:"flex h-full w-full flex-col justify-center rounded-t-[30px] bg-primary/10 p-6",children:[P.jsx("button",{onClick:l,className:"absolute right-8 top-8 flex -translate-y-1/2 translate-x-1/2 cursor-pointer rounded p-1 hover:bg-primary/10 focus:outline-none focus:ring-2 focus:ring-primary","aria-label":t("common:closeNotification"),"data-testid":"close-button",children:P.jsx($0,{weight:"regular",size:20,className:"text-primary"})}),P.jsx("p",{className:"text-sm font-semibold text-primary",children:e.settings?.bannerTitle}),e.settings?.bannerMessage&&P.jsx("p",{className:"whitespace-pre-line text-sm",children:e.settings?.bannerMessage})]})}):null},X9=["image/jpeg","image/jpg","image/png","image/webp"],Hfe=async(e,t=100)=>{const n=t*1024;if(e.size<=n)return e;let r=.9,a=e;for(;a.size>n&&r>.1;)a=await Wfe(e,r),r-=.1;return a},Ufe=(e,t,n=2048)=>e<=n&&t<=n?{width:e,height:t}:e>t?{width:n,height:t/e*n}:{width:e/t*n,height:n},zfe=e=>new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=()=>n(new Error("Failed to load image")),r.src=e}),jfe=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=a=>t(a.target?.result),r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(e)}),Vfe=(e,t,n,r)=>new Promise((a,s)=>{e.toBlob(l=>{if(!l){s(new Error("Failed to compress image"));return}const c=new File([l],t,{type:n,lastModified:Date.now()});a(c)},n,r)}),Wfe=async(e,t)=>{const n=await jfe(e),r=await zfe(n),a=document.createElement("canvas"),s=Ufe(r.width,r.height);a.width=s.width,a.height=s.height;const l=a.getContext("2d");if(!l)throw new Error("Failed to get canvas context");return l.drawImage(r,0,0,s.width,s.height),Vfe(a,e.name,e.type,t)},Z9=50,Yfe=()=>{const{t:e}=Gr(),{setError:t,setIsLoading:n,clearUploadedFile:r}=J0(),{state:a,sendNewMessage:s}=Kr(),l=async p=>{if(!a.settings?.channelId){c(e("upload:processingError"));return}t(null);const g=h(p);if(g){c(g),r();return}try{n(!0);const y=await Hfe(p,100),T=await new mC(a.settings.channelId,new Db(wC())).uploadAttachment(y);s({text:"",image:{url:T.url,filename:T.filename}})}catch(y){console.error("Error processing image:",y),c(e("upload:processingError"))}finally{n(!1)}},c=p=>{t(p),r()},h=p=>{if(!X9.includes(p.type))return e("upload:invalidFileType");const g=Z9*1024*1024;if(p.size>g)return e("upload:fileSizeExceeded",{maxSize:Z9})};return{uploadFile:l}},qfe=()=>{const{t:e}=Gr(),{fileInputRef:t,isLoading:n}=J0(),{uploadFile:r}=Yfe(),a=()=>{t.current?.click()},s=l=>{const c=l.target.files?.[0];c&&r(c)};return P.jsxs(P.Fragment,{children:[P.jsx("input",{ref:t,type:"file",accept:X9.join(","),style:{display:"none"},onChange:s,"aria-label":e("upload:uploadImageButton"),"data-testid":"upload-file-input"}),P.jsx(pv,{tooltipText:e("upload:uploadImageButton"),rounded:!0,size:"icon",onClick:a,disabled:n,"data-testid":"upload-attachment-button",children:n?P.jsx(Q9,{size:18}):P.jsx(GL,{size:20})})]})},vE={footer:"_footer_92zyl_1",disclaimerContainer:"_disclaimerContainer_92zyl_9",buttonGroupPortal:"_buttonGroupPortal_92zyl_14",formContainer:"_formContainer_92zyl_34"},J9={disclaimer:"_disclaimer_15gvs_1",link:"_link_15gvs_11"},Gfe=({disclaimer:e})=>P.jsx("div",{"data-testid":"chat-list-disclaimer",className:J9.disclaimer,children:P.jsx(gk,{rehypePlugins:[PF],skipHtml:!0,components:{a:Kfe},children:e})}),Kfe=({href:e="",children:t,...n})=>P.jsx("a",{href:e,className:J9.link,target:"_blank",rel:"noopener noreferrer",...n,children:t}),gd={inputWrapper:"_inputWrapper_17ycg_1",placeholder:"_placeholder_17ycg_10",textarea:"_textarea_17ycg_11",maxHeight:"_maxHeight_17ycg_48",sendButton:"_sendButton_17ycg_61",multiLine:"_multiLine_17ycg_78",disabled:"_disabled_17ycg_82",icon:"_icon_17ycg_95"},$9=({placeholder:e,value:t,disabled:n,...r})=>{const{t:a}=Gr(),s=S.useRef(null),[l,c]=S.useState(52);S.useEffect(()=>{if(s.current){const g=s.current.scrollHeight,y=Math.max(52,Math.min(g,164));c(y)}},[t,e]);const h=l>52,p=l>=164;return P.jsxs("div",{className:Ra(gd.inputWrapper,h&&gd.multiLine,p&&gd.maxHeight),style:{"--input-height":`${l}px`},children:[P.jsx("div",{ref:s,className:gd.placeholder,children:t||e}),P.jsx("label",{htmlFor:"input-textarea",className:"sr-only",children:e}),P.jsx("textarea",{id:"input-textarea",className:Ra("scroll-bar",gd.textarea),placeholder:e,wrap:"hard","data-testid":"text-input-field",rows:1,value:t,...r}),P.jsx("button",{"data-testid":"send-button",className:Ra(gd.sendButton,n&&gd.disabled),"aria-label":a("common:send"),disabled:n,children:P.jsx(nS,{weight:"fill",className:gd.icon})})]})},Qfe=({placeholder:e,isTyping:t,onSendMessage:n})=>{const{isLoading:r}=J0(),{state:a,buttonGroupPortalRef:s}=Kr(),[l,c]=S.useState(""),h=l.trim().length===0||t||r,p=E=>{c(E.target.value)},g=E=>{E?.preventDefault(),!h&&(n(l),c(""))},y=E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),g(E))};return P.jsxs("footer",{className:vE.footer,children:[P.jsx(Bfe,{}),P.jsx("div",{ref:s,className:vE.buttonGroupPortal}),P.jsx("form",{onSubmit:g,children:P.jsxs("div",{className:vE.formContainer,children:[a.settings?.enableAttachments&&P.jsx(qfe,{}),P.jsx($9,{placeholder:e,onKeyDown:y,onChange:p,value:l,disabled:h})]})}),P.jsx("div",{className:vE.disclaimerContainer,children:a.settings?.disclaimer&&P.jsx(Gfe,{disclaimer:a.settings.disclaimer})})]})};var e7=function(){},Xfe=typeof window<"u",Zfe=function(e,t,n){if(!Xfe)return[t,e7,e7];var r=JSON.parse,a=S.useRef(function(g){try{var y=n?n.raw?String:n.serializer:JSON.stringify,E=localStorage.getItem(g);return E!==null?r(E):(t&&localStorage.setItem(g,y(t)),t)}catch{return t}}),s=S.useState(function(){return a.current(e)}),l=s[0],c=s[1];S.useLayoutEffect(function(){return c(a.current(e))},[e]);var h=S.useCallback(function(g){try{var y=typeof g=="function"?g(l):g;if(typeof y>"u")return;var E=void 0;n||(E=JSON.stringify(y)),localStorage.setItem(e,E),c(r(E))}catch{}},[e,c]),p=S.useCallback(function(){try{localStorage.removeItem(e),c(void 0)}catch{}},[e,c]);return[l,h,p]};const Jfe={inputForm:"_inputForm_6ybb8_1"},$fe=()=>{const{state:e,sendNewMessage:t,handleEnd:n}=Kr(),{emit:r}=nw(),{t:a}=Gr(),[s,l]=Zfe("freeday:intro_seen",!1),[c,h]=S.useState(""),[p,g]=S.useState(!1);S.useEffect(()=>{g(!0)},[]);const y=D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),E(D))},E=D=>{D.preventDefault(),c.trim().length&&(t({text:c}),T())},T=()=>{l(!0)},_=()=>{r(mr.CLOSE,{}),globalThis.dispatchEvent(new Event(mr.CLOSE)),n()};return p?P.jsx(P.Fragment,{children:e.settings?.channelId==="6cdf9e75-e216-4aa6-89da-f96a51132723"?P.jsx(_v,{open:!s,onOpenChange:T,title:"Hallo, was kann ich für Sie tun?",titleSize:"lg",subtitle:"Zum Starten des Chats klicken Sie bitte auf ‘Jetzt Chat starten’. Mit dem Klick stimmen Sie den [Datenschutzbestimmungen](https://www.extrakarte.com/ihre-rechte/datenschutz-erkl%C3%A4rung) zu.",primaryButton:{label:"Jetzt Chat starten",onClick:T},disclaimer:e.settings?.disclaimer,onClose:_}):P.jsx(_v,{open:!s,onOpenChange:T,title:"Hello, how can we help you?",titleSize:"lg",disclaimer:e.settings?.disclaimer,onClose:_,children:P.jsx("form",{className:Jfe.inputForm,onSubmit:E,children:P.jsx($9,{placeholder:e.settings?.newMessagePlaceholder??a("footer:newMessagePlaceholder"),value:c,onChange:D=>h(D.target.value),onKeyDown:y,disabled:!c.trim().length})})})}):null},ehe=()=>{const{t:e}=Gr("resumeChat"),{state:t,handleRestart:n}=Kr(),[r,a]=S.useState(!1);S.useEffect(()=>{!t.hasResumedConversation&&the(t.messages)&&(t.hasResumedConversation=!0,a(!0))},[t.messages,t.hasResumedConversation]);const s=()=>{c(),h("continue")},l=()=>{n(),c(),h("start_new")},c=()=>{a(!1)},h=p=>{Rp("conversation_resume",{action:p,conversation_id:t.conversationId??"",last_message_at:t.messages.at(-1)?.sent_at})};return P.jsx(_v,{open:r,onOpenChange:a,title:[e("title"),e("subtitle")],primaryButton:{label:e("continueButton"),onClick:s},secondaryButton:{label:e("startNewButton"),onClick:l},onClose:c})},the=e=>e.some(t=>t.blocks.some(n=>n.type==="ended")),nhe=()=>{const{t:e}=Gr(),{sendNewMessage:t,state:n,chatWindowRef:r}=Kr();return P.jsxs("div",{ref:r,className:"contents",children:[n.settings?.theme!=="slim"&&P.jsx(dae,{}),P.jsx(Vae,{position:"top-center",expand:!0,pauseWhenPageIsHidden:!0,richColors:!0}),P.jsx("main",{className:"flex-1 space-y-2 overflow-hidden",children:P.jsx(ad,{initial:!0,children:P.jsx(Ir.div,{className:"h-full w-full",initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{duration:.3,ease:[.42,0,0,1],delay:.4},children:P.jsx(Ffe,{})})})}),P.jsx(Qfe,{placeholder:e(n.settings?.newMessagePlaceholder??e("footer:newMessagePlaceholder")),isTyping:n.isTyping,onSendMessage:a=>t({text:a})}),P.jsx(ehe,{}),P.jsx($fe,{})]})},rhe=e=>{const[t,n]=S.useState(null);return S.useEffect(()=>{if(!e)return;(async()=>{try{const s=await new mC(e,new Db(wC())).fetchWidgetSettings();s.primaryColor&&document.documentElement.style.setProperty("--freeday-primary",s.primaryColor),n(s)}catch(a){$i(a)}})()},[e]),{widgetSettings:t}},ihe=(e=!1)=>{const[t,n]=S.useState(e),[r,a]=S.useState(!1);return S.useEffect(()=>{const s=l=>{l.type===mr.CLOSE?(n(!1),a(!0)):l.type===mr.OPEN&&(n(!0),a(!1))};return globalThis.addEventListener(mr.CLOSE,s),globalThis.addEventListener(mr.OPEN,s),()=>{globalThis.removeEventListener(mr.CLOSE,s),globalThis.removeEventListener(mr.OPEN,s)}},[]),{isWidgetOpen:t,setIsWidgetOpen:n,hideChatBarInput:r}},ahe=e=>({handleOpen:()=>{Rp("widget:opened",{source:"widget_button",start_view:e?.startView}),globalThis.dispatchEvent(new Event(mr.OPEN)),globalThis.postMessage({event:mr.START,payload:e},globalThis.location.origin)},handleOpenAndSendMessage:r=>{setTimeout(()=>{globalThis.postMessage({event:mr.START,payload:{suggestionMessage:r}},globalThis.location.origin),globalThis.dispatchEvent(new Event(mr.OPEN))},400)}}),ohe="https://cdn.jsdelivr.net/npm/@freeday-ai/webchat",she=()=>{S.useEffect(()=>{const e=n=>{t7(n.error)},t=n=>{t7(n.reason)};return globalThis.addEventListener("error",e),globalThis.addEventListener("unhandledrejection",t),()=>{globalThis.removeEventListener("error",e),globalThis.removeEventListener("unhandledrejection",t)}},[])},t7=e=>{e?.stack?.includes(ohe)&&$i(e)};class lhe extends S.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){$i(t,"Uncaught rendering error",{componentStack:n.componentStack})}render(){return this.props.children}}function uhe(e){S.useEffect(()=>{if(!e)return;const t=document.body,n=window.scrollY,r=t.style.position,a=t.style.top,s=t.style.touchAction;return t.style.position="fixed",t.style.top=`-${n}px`,t.style.width="100%",t.style.touchAction="none",()=>{t.style.position=r,t.style.top=a,t.style.touchAction=s,window.scrollTo(0,n)}},[e])}const yE={chatWindowRenderer:"_chatWindowRenderer_xluqi_1",fullScreen:"_fullScreen_xluqi_26",widgetChatContainer:"_widgetChatContainer_xluqi_43",buttonContainer:"_buttonContainer_xluqi_49"},che=({threshold:e=100,enabled:t=!0})=>{const n=S.useMemo(()=>globalThis.visualViewport,[]),r=S.useMemo(()=>n?.height??0,[n]),a=S.useMemo(()=>()=>!t||!n?null:{width:n.width,height:n.height,offsetTop:n.offsetTop,offsetLeft:n.offsetLeft,scale:n.scale},[t,n]),[s,l]=S.useState(()=>a()),c=S.useMemo(()=>s&&r-s.height>e,[s,r,e]);return S.useEffect(()=>{if(!n)return;const h=()=>l(a());return n.addEventListener("resize",h),n.addEventListener("scroll",h),h(),()=>{n.removeEventListener("resize",h),n.removeEventListener("scroll",h)}},[n,a]),{viewport:s,keyboardOpen:c}},dhe=({channelId:e,metadata:t})=>{she();const{widgetSettings:n}=rhe(e);return!e||!n?null:P.jsx(lhe,{children:P.jsx(ZG,{config:{...n,metadata:t?JSON.parse(t):void 0},inShadowDom:!0,children:P.jsx(fhe,{widgetSettings:{...n,metadata:t?JSON.parse(t):void 0}})})})},fhe=({widgetSettings:e})=>{const t=S.useRef(null),n=e.startView===Vu.FULL_SCREEN,r=e.startView===Vu.UNFOLDED_CHAT_VIEW,a=n||r,{isWidgetOpen:s,setIsWidgetOpen:l}=ihe(a),{handleOpen:c,handleOpenAndSendMessage:h}=ahe(e),p=wA("(max-width: 640px)");uhe(s&&p);const{keyboardOpen:g}=che({enabled:s&&p});return S.useEffect(()=>{if(!a)return;l(!0);const y=requestAnimationFrame(c);return()=>cancelAnimationFrame(y)},[]),S.useEffect(()=>{g&&t.current&&t.current.scrollTo({top:t.current.scrollHeight})},[g]),P.jsxs(P.Fragment,{children:[P.jsx(ad,{children:s&&P.jsx(Ir.div,{className:Ar(yE.chatWindowRenderer,{[yE.fullScreen]:n}),"data-testid":"chat-window-renderer",initial:n?{opacity:0}:{opacity:0,y:10,x:10,scale:.6},animate:n?{opacity:1}:{opacity:1,y:0,x:0,scale:1,transition:{delay:.2,duration:.4,ease:[.42,0,0,1]}},exit:n?{opacity:0}:{opacity:0,scale:.8},transition:{duration:.3,ease:[.42,0,0,1]},children:P.jsx(xfe,{children:P.jsx("div",{ref:t,className:yE.widgetChatContainer,children:P.jsx(nhe,{})})})})}),!n&&P.jsx(ad,{children:!s&&P.jsx(Ir.div,{className:yE.buttonContainer,"data-testid":"button-container",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1,transition:{delay:.3}},exit:{opacity:0,scale:0},transition:{duration:.3,ease:[.42,0,0,1]},children:P.jsx(h$,{onOpen:c,onSendMessage:h})})})]})},n7=e=>{const{channelId:t,metadata:n}=e;document.body?r7(t,n):globalThis.addEventListener("DOMContentLoaded",()=>{r7(t,n)})},r7=(e,t)=>{const n=document.createElement("div"),r=document.createElement("freeday-widget");r.setAttribute("channelId",e),t&&r.setAttribute("metadata",JSON.stringify(t)),n.appendChild(r),document.body.appendChild(n),OW("freeday-widget",dhe,["channelId","metadata"])};return window.FreedayWidget={bootstrap:n7},c2.bootstrap=n7,Object.defineProperty(c2,Symbol.toStringTag,{value:"Module"}),c2})({});
256
+ `}]),bm([{id:"text-3",type:"text",text:"Thank you so much for your help!"}],"user"),bm([{id:"text-4",type:"text",text:"How can I help you today?"}],"integration"),bm([{id:"text-5",type:"image_reference",url:"https://cdn.prod.website-files.com/67580eaeabf02db2fa98f2b7/67b6062f265cc0b4f8228102_Screenshot%202025-02-19%20at%2017.25.47.avif",filename:"MJ.avif"}],"user");const Bfe=()=>{const{state:e}=Kr(),{t}=Gr(),[n,r]=S.useState(!0),[a,s]=S.useState(!1);S.useEffect(()=>{const c=setTimeout(()=>{s(!0)},300);return()=>clearTimeout(c)},[]),S.useEffect(()=>{if(!n)return;const c=h=>{!a||h.target.closest('[data-testid="chat-button"]')||r(!1)};return window.addEventListener("click",c),window.addEventListener("touchstart",c),()=>{window.removeEventListener("click",c),window.removeEventListener("touchstart",c)}},[a,n]);const l=()=>{r(!1)};return e.settings?.bannerTitle&&n?P.jsx("div",{className:"pb-7.5 absolute left-0 right-0 top-0 max-h-[500px] -translate-y-full gap-4 overflow-hidden rounded-t-[30px] bg-white transition-all duration-300 ease-in-out","data-testid":"banner",children:P.jsxs("div",{className:"flex h-full w-full flex-col justify-center rounded-t-[30px] bg-primary/10 p-6",children:[P.jsx("button",{onClick:l,className:"absolute right-8 top-8 flex -translate-y-1/2 translate-x-1/2 cursor-pointer rounded p-1 hover:bg-primary/10 focus:outline-none focus:ring-2 focus:ring-primary","aria-label":t("common:closeNotification"),"data-testid":"close-button",children:P.jsx($0,{weight:"regular",size:20,className:"text-primary"})}),P.jsx("p",{className:"text-sm font-semibold text-primary",children:e.settings?.bannerTitle}),e.settings?.bannerMessage&&P.jsx("p",{className:"whitespace-pre-line text-sm",children:e.settings?.bannerMessage})]})}):null},X9=["image/jpeg","image/jpg","image/png","image/webp"],Hfe=async(e,t=100)=>{const n=t*1024;if(e.size<=n)return e;let r=.9,a=e;for(;a.size>n&&r>.1;)a=await Wfe(e,r),r-=.1;return a},Ufe=(e,t,n=2048)=>e<=n&&t<=n?{width:e,height:t}:e>t?{width:n,height:t/e*n}:{width:e/t*n,height:n},zfe=e=>new Promise((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=()=>n(new Error("Failed to load image")),r.src=e}),jfe=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=a=>t(a.target?.result),r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(e)}),Vfe=(e,t,n,r)=>new Promise((a,s)=>{e.toBlob(l=>{if(!l){s(new Error("Failed to compress image"));return}const c=new File([l],t,{type:n,lastModified:Date.now()});a(c)},n,r)}),Wfe=async(e,t)=>{const n=await jfe(e),r=await zfe(n),a=document.createElement("canvas"),s=Ufe(r.width,r.height);a.width=s.width,a.height=s.height;const l=a.getContext("2d");if(!l)throw new Error("Failed to get canvas context");return l.drawImage(r,0,0,s.width,s.height),Vfe(a,e.name,e.type,t)},Z9=50,Yfe=()=>{const{t:e}=Gr(),{setError:t,setIsLoading:n,clearUploadedFile:r}=J0(),{state:a,sendNewMessage:s}=Kr(),l=async p=>{if(!a.settings?.channelId){c(e("upload:processingError"));return}t(null);const g=h(p);if(g){c(g),r();return}try{n(!0);const y=await Hfe(p,100),T=await new mC(a.settings.channelId,new Db(wC())).uploadAttachment(y);s({text:"",image:{url:T.url,filename:T.filename}})}catch(y){console.error("Error processing image:",y),c(e("upload:processingError"))}finally{n(!1)}},c=p=>{t(p),r()},h=p=>{if(!X9.includes(p.type))return e("upload:invalidFileType");const g=Z9*1024*1024;if(p.size>g)return e("upload:fileSizeExceeded",{maxSize:Z9})};return{uploadFile:l}},qfe=()=>{const{t:e}=Gr(),{fileInputRef:t,isLoading:n}=J0(),{uploadFile:r}=Yfe(),a=()=>{t.current?.click()},s=l=>{const c=l.target.files?.[0];c&&r(c)};return P.jsxs(P.Fragment,{children:[P.jsx("input",{ref:t,type:"file",accept:X9.join(","),style:{display:"none"},onChange:s,"aria-label":e("upload:uploadImageButton"),"data-testid":"upload-file-input"}),P.jsx(pv,{tooltipText:e("upload:uploadImageButton"),rounded:!0,size:"icon",onClick:a,disabled:n,"data-testid":"upload-attachment-button",children:n?P.jsx(Q9,{size:18}):P.jsx(GL,{size:20})})]})},vE={footer:"_footer_92zyl_1",disclaimerContainer:"_disclaimerContainer_92zyl_9",buttonGroupPortal:"_buttonGroupPortal_92zyl_14",formContainer:"_formContainer_92zyl_34"},J9={disclaimer:"_disclaimer_15gvs_1",link:"_link_15gvs_11"},Gfe=({disclaimer:e})=>P.jsx("div",{"data-testid":"chat-list-disclaimer",className:J9.disclaimer,children:P.jsx(gk,{rehypePlugins:[PF],skipHtml:!0,components:{a:Kfe},children:e})}),Kfe=({href:e="",children:t,...n})=>P.jsx("a",{href:e,className:J9.link,target:"_blank",rel:"noopener noreferrer",...n,children:t}),gd={inputWrapper:"_inputWrapper_17ycg_1",placeholder:"_placeholder_17ycg_10",textarea:"_textarea_17ycg_11",maxHeight:"_maxHeight_17ycg_48",sendButton:"_sendButton_17ycg_61",multiLine:"_multiLine_17ycg_78",disabled:"_disabled_17ycg_82",icon:"_icon_17ycg_95"},$9=({placeholder:e,value:t,disabled:n,...r})=>{const{t:a}=Gr(),s=S.useRef(null),[l,c]=S.useState(52);S.useEffect(()=>{if(s.current){const g=s.current.scrollHeight,y=Math.max(52,Math.min(g,164));c(y)}},[t,e]);const h=l>52,p=l>=164;return P.jsxs("div",{className:Ra(gd.inputWrapper,h&&gd.multiLine,p&&gd.maxHeight),style:{"--input-height":`${l}px`},children:[P.jsx("div",{ref:s,className:gd.placeholder,children:t||e}),P.jsx("label",{htmlFor:"input-textarea",className:"sr-only",children:e}),P.jsx("textarea",{id:"input-textarea",className:Ra("scroll-bar",gd.textarea),placeholder:e,wrap:"hard","data-testid":"text-input-field",rows:1,value:t,...r}),P.jsx("button",{"data-testid":"send-button",className:Ra(gd.sendButton,n&&gd.disabled),"aria-label":a("common:send"),disabled:n,children:P.jsx(nS,{weight:"fill",className:gd.icon})})]})},Qfe=({placeholder:e,isTyping:t,onSendMessage:n})=>{const{isLoading:r}=J0(),{state:a,buttonGroupPortalRef:s}=Kr(),[l,c]=S.useState(""),h=l.trim().length===0||t||r,p=E=>{c(E.target.value)},g=E=>{E?.preventDefault(),!h&&(n(l),c(""))},y=E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),g(E))};return P.jsxs("footer",{className:vE.footer,children:[P.jsx(Bfe,{}),P.jsx("div",{ref:s,className:vE.buttonGroupPortal}),P.jsx("form",{onSubmit:g,children:P.jsxs("div",{className:vE.formContainer,children:[a.settings?.enableAttachments&&P.jsx(qfe,{}),P.jsx($9,{placeholder:e,onKeyDown:y,onChange:p,value:l,disabled:h})]})}),P.jsx("div",{className:vE.disclaimerContainer,children:a.settings?.disclaimer&&P.jsx(Gfe,{disclaimer:a.settings.disclaimer})})]})};var e7=function(){},Xfe=typeof window<"u",Zfe=function(e,t,n){if(!Xfe)return[t,e7,e7];var r=JSON.parse,a=S.useRef(function(g){try{var y=n?n.raw?String:n.serializer:JSON.stringify,E=localStorage.getItem(g);return E!==null?r(E):(t&&localStorage.setItem(g,y(t)),t)}catch{return t}}),s=S.useState(function(){return a.current(e)}),l=s[0],c=s[1];S.useLayoutEffect(function(){return c(a.current(e))},[e]);var h=S.useCallback(function(g){try{var y=typeof g=="function"?g(l):g;if(typeof y>"u")return;var E=void 0;n||(E=JSON.stringify(y)),localStorage.setItem(e,E),c(r(E))}catch{}},[e,c]),p=S.useCallback(function(){try{localStorage.removeItem(e),c(void 0)}catch{}},[e,c]);return[l,h,p]};const Jfe={inputForm:"_inputForm_6ybb8_1"},$fe=()=>{const{state:e,sendNewMessage:t,handleEnd:n}=Kr(),{emit:r}=nw(),{t:a}=Gr(),[s,l]=Zfe("freeday:intro_seen",!1),[c,h]=S.useState(""),[p,g]=S.useState(!1);S.useEffect(()=>{g(!0)},[]);const y=D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),E(D))},E=D=>{D.preventDefault(),c.trim().length&&(t({text:c}),T())},T=()=>{l(!0)},_=()=>{r(mr.CLOSE,{}),globalThis.dispatchEvent(new Event(mr.CLOSE)),n()};return p?P.jsx(P.Fragment,{children:["6cdf9e75-e216-4aa6-89da-f96a51132723","82692670-22db-49ca-b515-800ed6c5f553"].includes(e.settings?.channelId??"")?P.jsx(_v,{open:!s,onOpenChange:T,title:"Hallo, was kann ich für Sie tun?",titleSize:"lg",subtitle:"Zum Starten des Chats klicken Sie bitte auf ‘Jetzt Chat starten’. Mit dem Klick stimmen Sie den [Datenschutzbestimmungen](https://www.extrakarte.com/ihre-rechte/datenschutz-erkl%C3%A4rung) zu.",primaryButton:{label:"Jetzt Chat starten",onClick:T},disclaimer:e.settings?.disclaimer,onClose:_}):P.jsx(_v,{open:!s,onOpenChange:T,title:"Hello, how can we help you?",titleSize:"lg",disclaimer:e.settings?.disclaimer,onClose:_,children:P.jsx("form",{className:Jfe.inputForm,onSubmit:E,children:P.jsx($9,{placeholder:e.settings?.newMessagePlaceholder??a("footer:newMessagePlaceholder"),value:c,onChange:D=>h(D.target.value),onKeyDown:y,disabled:!c.trim().length})})})}):null},ehe=()=>{const{t:e}=Gr("resumeChat"),{state:t,handleRestart:n}=Kr(),[r,a]=S.useState(!1);S.useEffect(()=>{!t.hasResumedConversation&&the(t.messages)&&(t.hasResumedConversation=!0,a(!0))},[t.messages,t.hasResumedConversation]);const s=()=>{c(),h("continue")},l=()=>{n(),c(),h("start_new")},c=()=>{a(!1)},h=p=>{Rp("conversation_resume",{action:p,conversation_id:t.conversationId??"",last_message_at:t.messages.at(-1)?.sent_at})};return P.jsx(_v,{open:r,onOpenChange:a,title:[e("title"),e("subtitle")],primaryButton:{label:e("continueButton"),onClick:s},secondaryButton:{label:e("startNewButton"),onClick:l},onClose:c})},the=e=>e.some(t=>t.blocks.some(n=>n.type==="ended")),nhe=()=>{const{t:e}=Gr(),{sendNewMessage:t,state:n,chatWindowRef:r}=Kr();return P.jsxs("div",{ref:r,className:"contents",children:[n.settings?.theme!=="slim"&&P.jsx(dae,{}),P.jsx(Vae,{position:"top-center",expand:!0,pauseWhenPageIsHidden:!0,richColors:!0}),P.jsx("main",{className:"flex-1 space-y-2 overflow-hidden",children:P.jsx(ad,{initial:!0,children:P.jsx(Ir.div,{className:"h-full w-full",initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{duration:.3,ease:[.42,0,0,1],delay:.4},children:P.jsx(Ffe,{})})})}),P.jsx(Qfe,{placeholder:e(n.settings?.newMessagePlaceholder??e("footer:newMessagePlaceholder")),isTyping:n.isTyping,onSendMessage:a=>t({text:a})}),P.jsx(ehe,{}),P.jsx($fe,{})]})},rhe=e=>{const[t,n]=S.useState(null);return S.useEffect(()=>{if(!e)return;(async()=>{try{const s=await new mC(e,new Db(wC())).fetchWidgetSettings();s.primaryColor&&document.documentElement.style.setProperty("--freeday-primary",s.primaryColor),n(s)}catch(a){$i(a)}})()},[e]),{widgetSettings:t}},ihe=(e=!1)=>{const[t,n]=S.useState(e),[r,a]=S.useState(!1);return S.useEffect(()=>{const s=l=>{l.type===mr.CLOSE?(n(!1),a(!0)):l.type===mr.OPEN&&(n(!0),a(!1))};return globalThis.addEventListener(mr.CLOSE,s),globalThis.addEventListener(mr.OPEN,s),()=>{globalThis.removeEventListener(mr.CLOSE,s),globalThis.removeEventListener(mr.OPEN,s)}},[]),{isWidgetOpen:t,setIsWidgetOpen:n,hideChatBarInput:r}},ahe=e=>({handleOpen:()=>{Rp("widget:opened",{source:"widget_button",start_view:e?.startView}),globalThis.dispatchEvent(new Event(mr.OPEN)),globalThis.postMessage({event:mr.START,payload:e},globalThis.location.origin)},handleOpenAndSendMessage:r=>{setTimeout(()=>{globalThis.postMessage({event:mr.START,payload:{suggestionMessage:r}},globalThis.location.origin),globalThis.dispatchEvent(new Event(mr.OPEN))},400)}}),ohe="https://cdn.jsdelivr.net/npm/@freeday-ai/webchat",she=()=>{S.useEffect(()=>{const e=n=>{t7(n.error)},t=n=>{t7(n.reason)};return globalThis.addEventListener("error",e),globalThis.addEventListener("unhandledrejection",t),()=>{globalThis.removeEventListener("error",e),globalThis.removeEventListener("unhandledrejection",t)}},[])},t7=e=>{e?.stack?.includes(ohe)&&$i(e)};class lhe extends S.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){$i(t,"Uncaught rendering error",{componentStack:n.componentStack})}render(){return this.props.children}}function uhe(e){S.useEffect(()=>{if(!e)return;const t=document.body,n=window.scrollY,r=t.style.position,a=t.style.top,s=t.style.touchAction;return t.style.position="fixed",t.style.top=`-${n}px`,t.style.width="100%",t.style.touchAction="none",()=>{t.style.position=r,t.style.top=a,t.style.touchAction=s,window.scrollTo(0,n)}},[e])}const yE={chatWindowRenderer:"_chatWindowRenderer_xluqi_1",fullScreen:"_fullScreen_xluqi_26",widgetChatContainer:"_widgetChatContainer_xluqi_43",buttonContainer:"_buttonContainer_xluqi_49"},che=({threshold:e=100,enabled:t=!0})=>{const n=S.useMemo(()=>globalThis.visualViewport,[]),r=S.useMemo(()=>n?.height??0,[n]),a=S.useMemo(()=>()=>!t||!n?null:{width:n.width,height:n.height,offsetTop:n.offsetTop,offsetLeft:n.offsetLeft,scale:n.scale},[t,n]),[s,l]=S.useState(()=>a()),c=S.useMemo(()=>s&&r-s.height>e,[s,r,e]);return S.useEffect(()=>{if(!n)return;const h=()=>l(a());return n.addEventListener("resize",h),n.addEventListener("scroll",h),h(),()=>{n.removeEventListener("resize",h),n.removeEventListener("scroll",h)}},[n,a]),{viewport:s,keyboardOpen:c}},dhe=({channelId:e,metadata:t})=>{she();const{widgetSettings:n}=rhe(e);return!e||!n?null:P.jsx(lhe,{children:P.jsx(ZG,{config:{...n,metadata:t?JSON.parse(t):void 0},inShadowDom:!0,children:P.jsx(fhe,{widgetSettings:{...n,metadata:t?JSON.parse(t):void 0}})})})},fhe=({widgetSettings:e})=>{const t=S.useRef(null),n=e.startView===Vu.FULL_SCREEN,r=e.startView===Vu.UNFOLDED_CHAT_VIEW,a=n||r,{isWidgetOpen:s,setIsWidgetOpen:l}=ihe(a),{handleOpen:c,handleOpenAndSendMessage:h}=ahe(e),p=wA("(max-width: 640px)");uhe(s&&p);const{keyboardOpen:g}=che({enabled:s&&p});return S.useEffect(()=>{if(!a)return;l(!0);const y=requestAnimationFrame(c);return()=>cancelAnimationFrame(y)},[]),S.useEffect(()=>{g&&t.current&&t.current.scrollTo({top:t.current.scrollHeight})},[g]),P.jsxs(P.Fragment,{children:[P.jsx(ad,{children:s&&P.jsx(Ir.div,{className:Ar(yE.chatWindowRenderer,{[yE.fullScreen]:n}),"data-testid":"chat-window-renderer",initial:n?{opacity:0}:{opacity:0,y:10,x:10,scale:.6},animate:n?{opacity:1}:{opacity:1,y:0,x:0,scale:1,transition:{delay:.2,duration:.4,ease:[.42,0,0,1]}},exit:n?{opacity:0}:{opacity:0,scale:.8},transition:{duration:.3,ease:[.42,0,0,1]},children:P.jsx(xfe,{children:P.jsx("div",{ref:t,className:yE.widgetChatContainer,children:P.jsx(nhe,{})})})})}),!n&&P.jsx(ad,{children:!s&&P.jsx(Ir.div,{className:yE.buttonContainer,"data-testid":"button-container",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1,transition:{delay:.3}},exit:{opacity:0,scale:0},transition:{duration:.3,ease:[.42,0,0,1]},children:P.jsx(h$,{onOpen:c,onSendMessage:h})})})]})},n7=e=>{const{channelId:t,metadata:n}=e;document.body?r7(t,n):globalThis.addEventListener("DOMContentLoaded",()=>{r7(t,n)})},r7=(e,t)=>{const n=document.createElement("div"),r=document.createElement("freeday-widget");r.setAttribute("channelId",e),t&&r.setAttribute("metadata",JSON.stringify(t)),n.appendChild(r),document.body.appendChild(n),OW("freeday-widget",dhe,["channelId","metadata"])};return window.FreedayWidget={bootstrap:n7},c2.bootstrap=n7,Object.defineProperty(c2,Symbol.toStringTag,{value:"Module"}),c2})({});
package/dist/webchat.mjs CHANGED
@@ -61851,7 +61851,10 @@ const Yye = "_inputForm_6ybb8_1", qye = {
61851
61851
  }, k = () => {
61852
61852
  r(yr.CLOSE, {}), globalThis.dispatchEvent(new Event(yr.CLOSE)), n();
61853
61853
  };
61854
- return p ? /* @__PURE__ */ P.jsx(P.Fragment, { children: e.settings?.channelId === "6cdf9e75-e216-4aa6-89da-f96a51132723" ? /* @__PURE__ */ P.jsx(
61854
+ return p ? /* @__PURE__ */ P.jsx(P.Fragment, { children: [
61855
+ "6cdf9e75-e216-4aa6-89da-f96a51132723",
61856
+ "82692670-22db-49ca-b515-800ed6c5f553"
61857
+ ].includes(e.settings?.channelId ?? "") ? /* @__PURE__ */ P.jsx(
61855
61858
  ky,
61856
61859
  {
61857
61860
  open: !s,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freeday-ai/webchat",
3
- "version": "2025.12.17.11.01.5036",
3
+ "version": "2025.12.17.13.16.8582",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"