@botpress/webchat 2.1.15 → 2.1.16

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @botpress/webchat@2.1.15 build /home/runner/work/echo/echo/packages/webchat-frontend
2
+ > @botpress/webchat@2.1.16 build /home/runner/work/echo/echo/packages/webchat-frontend
3
3
  > vite build
4
4
 
5
5
  vite v4.4.11 building for production...
@@ -12,8 +12,8 @@ rendering chunks...
12
12
  
13
13
  [vite:dts] Start generate declaration files...
14
14
  computing gzip size...
15
- [vite:dts] Declaration files built in 15134ms.
15
+ [vite:dts] Declaration files built in 15671ms.
16
16
  
17
- dist/index.js 1,289.13 kB │ gzip: 316.71 kB
18
- dist/index.umd.cjs 902.56 kB │ gzip: 264.69 kB
19
- ✓ built in 23.09s
17
+ dist/index.js 1,289.15 kB │ gzip: 316.71 kB
18
+ dist/index.umd.cjs 902.58 kB │ gzip: 264.70 kB
19
+ ✓ built in 24.18s
package/dist/index.js CHANGED
@@ -36201,7 +36201,7 @@ const CV = ({ styles: e, type: t, options: n, label: r, reusable: i }) => {
36201
36201
  if (t)
36202
36202
  return t.on("messageSent", (g) => {
36203
36203
  const v = u(), b = v[v.length - 1];
36204
- b.block.type !== "bubble" || b.block.block.type !== "text" || b.block.block.text === g || n({
36204
+ (v.length === 0 || b.block.type === "bubble" && b.block.block.type === "text" && b.block.block.text !== g) && n({
36205
36205
  direction: "outgoing",
36206
36206
  sender: { name: "You" },
36207
36207
  timestamp: /* @__PURE__ */ new Date(),
@@ -360,7 +360,7 @@ to {
360
360
  * tabbable 6.2.0
361
361
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
362
362
  */var p9=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Tm=p9.join(","),zE=typeof Element>"u",Ja=zE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,hd=!zE&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},md=function e(t,n){var r;n===void 0&&(n=!0);var i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),o=i===""||i==="true",s=o||n&&t&&e(t.parentNode);return s},h9=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},m9=function(t,n,r){if(md(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(Tm));return n&&Ja.call(t,Tm)&&i.unshift(t),i=i.filter(r),i},y9=function e(t,n,r){for(var i=[],o=Array.from(t);o.length;){var s=o.shift();if(!md(s,!1))if(s.tagName==="SLOT"){var a=s.assignedElements(),c=a.length?a:s.children,l=e(c,!0,r);r.flatten?i.push.apply(i,l):i.push({scopeParent:s,candidates:l})}else{var u=Ja.call(s,Tm);u&&r.filter(s)&&(n||!t.includes(s))&&i.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!md(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&p){var f=e(d===!0?s.children:d.children,!0,r);r.flatten?i.push.apply(i,f):i.push({scopeParent:s,candidates:f})}else o.unshift.apply(o,s.children)}}return i},ZE=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},VE=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||h9(t))&&!ZE(t)?0:t.tabIndex},g9=function(t,n){var r=VE(t);return r<0&&n&&!ZE(t)?0:r},v9=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},HE=function(t){return t.tagName==="INPUT"},b9=function(t){return HE(t)&&t.type==="hidden"},w9=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},x9=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},_9=function(t){if(!t.name)return!0;var n=t.form||hd(t),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(t.name));else try{i=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var o=x9(i,t.form);return!o||o===t},S9=function(t){return HE(t)&&t.type==="radio"},E9=function(t){return S9(t)&&!_9(t)},k9=function(t){var n,r=t&&hd(t),i=(n=r)===null||n===void 0?void 0:n.host,o=!1;if(r&&r!==t){var s,a,c;for(o=!!((s=i)!==null&&s!==void 0&&(a=s.ownerDocument)!==null&&a!==void 0&&a.contains(i)||t!=null&&(c=t.ownerDocument)!==null&&c!==void 0&&c.contains(t));!o&&i;){var l,u,d;r=hd(i),i=(l=r)===null||l===void 0?void 0:l.host,o=!!((u=i)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(i))}}return o},WE=function(t){var n=t.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},C9=function(t,n){var r=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var o=Ja.call(t,"details>summary:first-of-type"),s=o?t.parentElement:t;if(Ja.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var a=t;t;){var c=t.parentElement,l=hd(t);if(c&&!c.shadowRoot&&i(c)===!0)return WE(t);t.assignedSlot?t=t.assignedSlot:!c&&l!==t.ownerDocument?t=l.host:t=c}t=a}if(k9(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return WE(t);return!1},T9=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return Ja.call(n,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}n=n.parentElement}return!1},A9=function(t,n){return!(n.disabled||md(n)||b9(n)||C9(n,t)||w9(n)||T9(n))},KE=function(t,n){return!(E9(n)||VE(n)<0||!A9(t,n))},O9=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},I9=function e(t){var n=[],r=[];return t.forEach(function(i,o){var s=!!i.scopeParent,a=s?i.scopeParent:i,c=g9(a,s),l=s?e(i.candidates):a;c===0?s?n.push.apply(n,l):n.push(a):r.push({documentOrder:o,tabIndex:c,item:i,isScope:s,content:l})}),r.sort(v9).reduce(function(i,o){return o.isScope?i.push.apply(i,o.content):i.push(o.content),i},[]).concat(n)},Am=function(t,n){n=n||{};var r;return n.getShadowRoot?r=y9([t],n.includeContainer,{filter:KE.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:O9}):r=m9(t,n.includeContainer,KE.bind(null,n)),I9(r)};const Om="ArrowUp",yd="ArrowDown",_s="ArrowLeft",Ya="ArrowRight";function gd(e,t,n){return Math.floor(e/t)!==n}function Ga(e,t){return t<0||t>=e.current.length}function Im(e,t){return $n(e,{disabledIndices:t})}function JE(e,t){return $n(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function $n(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:i,amount:o=1}=t===void 0?{}:t;const s=e.current;let a=n;do{var c,l;a=a+(r?-o:o)}while(a>=0&&a<=s.length-1&&(i?i.includes(a):s[a]==null||(c=s[a])!=null&&c.hasAttribute("disabled")||((l=s[a])==null?void 0:l.getAttribute("aria-disabled"))==="true"));return a}function R9(e,t){let{event:n,orientation:r,loop:i,cols:o,disabledIndices:s,minIndex:a,maxIndex:c,prevIndex:l,stopEvent:u=!1}=t,d=l;if(n.key===Om){if(u&&xn(n),l===-1)d=c;else if(d=$n(e,{startingIndex:d,amount:o,decrement:!0,disabledIndices:s}),i&&(l-o<a||d<0)){const p=l%o,f=c%o,h=c-(f-p);f===p?d=c:d=f>p?h:h-o}Ga(e,d)&&(d=l)}if(n.key===yd&&(u&&xn(n),l===-1?d=a:(d=$n(e,{startingIndex:l,amount:o,disabledIndices:s}),i&&l+o>c&&(d=$n(e,{startingIndex:l%o-o,amount:o,disabledIndices:s}))),Ga(e,d)&&(d=l)),r==="both"){const p=ws(l/o);n.key===Ya&&(u&&xn(n),l%o!==o-1?(d=$n(e,{startingIndex:l,disabledIndices:s}),i&&gd(d,o,p)&&(d=$n(e,{startingIndex:l-l%o-1,disabledIndices:s}))):i&&(d=$n(e,{startingIndex:l-l%o-1,disabledIndices:s})),gd(d,o,p)&&(d=l)),n.key===_s&&(u&&xn(n),l%o!==0?(d=$n(e,{startingIndex:l,disabledIndices:s,decrement:!0}),i&&gd(d,o,p)&&(d=$n(e,{startingIndex:l+(o-l%o),decrement:!0,disabledIndices:s}))):i&&(d=$n(e,{startingIndex:l+(o-l%o),decrement:!0,disabledIndices:s})),gd(d,o,p)&&(d=l));const f=ws(c/o)===p;Ga(e,d)&&(i&&f?d=n.key===_s?c:$n(e,{startingIndex:l-l%o-1,disabledIndices:s}):d=l)}return d}let YE=0;function fi(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(YE);const o=()=>e==null?void 0:e.focus({preventScroll:n});i?o():YE=requestAnimationFrame(o)}var an=typeof document<"u"?w.useLayoutEffect:w.useEffect;function vd(){return vd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vd.apply(this,arguments)}let Rm=!1,P9=0;const GE=()=>"floating-ui-"+P9++;function $9(){const[e,t]=N.useState(()=>Rm?GE():void 0);return an(()=>{e==null&&t(GE())},[]),N.useEffect(()=>{Rm||(Rm=!0)},[]),e}const Pm=N["useId".toString()]||$9;function D9(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(i=>i(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(i=>i!==n))||[])}}}const N9=N.createContext(null),j9=N.createContext(null),XE=()=>{var e;return((e=N.useContext(N9))==null?void 0:e.id)||null},bd=()=>N.useContext(j9);function Xa(e){return"data-floating-ui-"+e}function Fi(e){const t=w.useRef(e);return an(()=>{t.current=e}),t}function M9(e,t){var n;let r=[],i=(n=e.find(o=>o.id===t))==null?void 0:n.parentId;for(;i;){const o=e.find(s=>s.id===i);i=o==null?void 0:o.parentId,o&&(r=r.concat(o))}return r}function Ss(e,t){let n=e.filter(i=>{var o;return i.parentId===t&&((o=i.context)==null?void 0:o.open)}),r=n;for(;r.length;)r=e.filter(i=>{var o;return(o=r)==null?void 0:o.some(s=>{var a;return i.parentId===s.id&&((a=i.context)==null?void 0:a.open)})}),n=n.concat(r);return n}function q9(e,t){let n,r=-1;function i(o,s){s>r&&(n=o,r=s),Ss(e,o).forEach(c=>{i(c.id,s+1)})}return i(t,0),e.find(o=>o.id===n)}let Es=new WeakMap,wd=new WeakSet,xd={},$m=0;const L9=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,QE=e=>e&&(e.host||QE(e.parentNode)),F9=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=QE(n);return e.contains(r)?r:null}).filter(n=>n!=null);function U9(e,t,n,r){const i="data-floating-ui-inert",o=r?"inert":n?"aria-hidden":null,s=F9(t,e),a=new Set,c=new Set(s),l=[];xd[i]||(xd[i]=new WeakMap);const u=xd[i];s.forEach(d),p(t),a.clear();function d(f){!f||a.has(f)||(a.add(f),f.parentNode&&d(f.parentNode))}function p(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,h=>{if(a.has(h))p(h);else{const m=o?h.getAttribute(o):null,y=m!==null&&m!=="false",g=(Es.get(h)||0)+1,v=(u.get(h)||0)+1;Es.set(h,g),u.set(h,v),l.push(h),g===1&&y&&wd.add(h),v===1&&h.setAttribute(i,""),!y&&o&&h.setAttribute(o,"true")}})}return $m++,()=>{l.forEach(f=>{const h=(Es.get(f)||0)-1,m=(u.get(f)||0)-1;Es.set(f,h),u.set(f,m),h||(!wd.has(f)&&o&&f.removeAttribute(o),wd.delete(f)),m||f.removeAttribute(i)}),$m--,$m||(Es=new WeakMap,Es=new WeakMap,wd=new WeakSet,xd={})}}function ek(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=Tr(e[0]).body;return U9(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const Dm=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function tk(e,t){const n=Am(e,Dm());t==="prev"&&n.reverse();const r=n.indexOf(Li(Tr(e)));return n.slice(r+1)[0]}function nk(){return tk(document.body,"next")}function rk(){return tk(document.body,"prev")}function Qa(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Wn(n,r)}function B9(e){Am(e,Dm()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function z9(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const Nm={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};let Z9;function ik(e){e.key==="Tab"&&(e.target,clearTimeout(Z9))}const _d=N.forwardRef(function(t,n){const[r,i]=N.useState();an(()=>(TE()&&i("button"),document.addEventListener("keydown",ik),()=>{document.removeEventListener("keydown",ik)}),[]);const o={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Xa("focus-guard")]:"",style:Nm};return N.createElement("span",vd({},t,o))}),ok=N.createContext(null);function V9(e){let{id:t,root:n}=e===void 0?{}:e;const[r,i]=N.useState(null),o=Pm(),s=sk(),a=N.useMemo(()=>({id:t,root:n,portalContext:s,uniqueId:o}),[t,n,s,o]),c=N.useRef();return an(()=>()=>{r==null||r.remove()},[r,a]),an(()=>{if(c.current===a)return;c.current=a;const{id:l,root:u,portalContext:d,uniqueId:p}=a,f=l?document.getElementById(l):null,h=Xa("portal");if(f){const m=document.createElement("div");m.id=p,m.setAttribute(h,""),f.appendChild(m),i(m)}else{let m=u||(d==null?void 0:d.portalNode);m&&!Jt(m)&&(m=m.current),m=m||document.body;let y=null;l&&(y=document.createElement("div"),y.id=l,m.appendChild(y));const g=document.createElement("div");g.id=p,g.setAttribute(h,""),m=y||m,m.appendChild(g),i(g)}},[a]),r}function H9(e){let{children:t,id:n,root:r=null,preserveTabOrder:i=!0}=e;const o=V9({id:n,root:r}),[s,a]=N.useState(null),c=N.useRef(null),l=N.useRef(null),u=N.useRef(null),d=N.useRef(null),p=!!s&&!s.modal&&s.open&&i&&!!(r||o);return N.useEffect(()=>{if(!o||!i||s!=null&&s.modal)return;function f(h){o&&Qa(h)&&(h.type==="focusin"?z9:B9)(o)}return o.addEventListener("focusin",f,!0),o.addEventListener("focusout",f,!0),()=>{o.removeEventListener("focusin",f,!0),o.removeEventListener("focusout",f,!0)}},[o,i,s==null?void 0:s.modal]),N.createElement(ok.Provider,{value:N.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:d,portalNode:o,setFocusManagerState:a}),[i,o])},p&&o&&N.createElement(_d,{"data-type":"outside",ref:c,onFocus:f=>{if(Qa(f,o)){var h;(h=u.current)==null||h.focus()}else{const m=rk()||(s==null?void 0:s.refs.domReference.current);m==null||m.focus()}}}),p&&o&&N.createElement("span",{"aria-owns":o.id,style:Nm}),o&&Ar.createPortal(t,o),p&&o&&N.createElement(_d,{"data-type":"outside",ref:l,onFocus:f=>{if(Qa(f,o)){var h;(h=d.current)==null||h.focus()}else{const m=nk()||(s==null?void 0:s.refs.domReference.current);m==null||m.focus(),s!=null&&s.closeOnFocusOut&&(s==null||s.onOpenChange(!1,f.nativeEvent))}}}))}const sk=()=>N.useContext(ok),W9=N.forwardRef(function(t,n){return N.createElement("button",vd({},t,{type:"button",ref:n,tabIndex:-1,style:Nm}))});function K9(e){const{context:t,children:n,disabled:r=!1,order:i=["content"],guards:o=!0,initialFocus:s=0,returnFocus:a=!0,modal:c=!0,visuallyHiddenDismiss:l=!1,closeOnFocusOut:u=!0}=e,{open:d,refs:p,nodeId:f,onOpenChange:h,events:m,dataRef:y,elements:{domReference:g,floating:v}}=t,b=L9()?o:!0,S=Fi(i),E=Fi(s),_=Fi(a),I=bd(),P=sk(),$=typeof s=="number"&&s<0,O=N.useRef(null),q=N.useRef(null),H=N.useRef(!1),B=N.useRef(null),F=N.useRef(!1),D=P!=null,M=g&&g.getAttribute("role")==="combobox"&&IE(g)&&$,Z=N.useCallback(function(te){return te===void 0&&(te=v),te?Am(te,Dm()):[]},[v]),W=N.useCallback(te=>{const fe=Z(te);return S.current.map(A=>g&&A==="reference"?g:v&&A==="floating"?v:fe).filter(Boolean).flat()},[g,v,S,Z]);N.useEffect(()=>{if(r||!c)return;function te(A){if(A.key==="Tab"){Wn(v,Li(Tr(v)))&&Z().length===0&&!M&&xn(A);const we=W(),Te=OE(A);S.current[0]==="reference"&&Te===g&&(xn(A),A.shiftKey?fi(we[we.length-1]):fi(we[1])),S.current[1]==="floating"&&Te===v&&A.shiftKey&&(xn(A),fi(we[0]))}}const fe=Tr(v);return fe.addEventListener("keydown",te),()=>{fe.removeEventListener("keydown",te)}},[r,g,v,c,S,p,M,Z,W]),N.useEffect(()=>{if(r||!u)return;function te(){F.current=!0,setTimeout(()=>{F.current=!1})}function fe(A){const we=A.relatedTarget;queueMicrotask(()=>{const Te=!(Wn(g,we)||Wn(v,we)||Wn(we,v)||Wn(P==null?void 0:P.portalNode,we)||we!=null&&we.hasAttribute(Xa("focus-guard"))||I&&(Ss(I.nodesRef.current,f).find(Ee=>{var $e,Fe;return Wn(($e=Ee.context)==null?void 0:$e.elements.floating,we)||Wn((Fe=Ee.context)==null?void 0:Fe.elements.domReference,we)})||M9(I.nodesRef.current,f).find(Ee=>{var $e,Fe;return(($e=Ee.context)==null?void 0:$e.elements.floating)===we||((Fe=Ee.context)==null?void 0:Fe.elements.domReference)===we})));we&&Te&&!F.current&&we!==B.current&&(H.current=!0,h(!1,A))})}if(v&&Pn(g))return g.addEventListener("focusout",fe),g.addEventListener("pointerdown",te),!c&&v.addEventListener("focusout",fe),()=>{g.removeEventListener("focusout",fe),g.removeEventListener("pointerdown",te),!c&&v.removeEventListener("focusout",fe)}},[r,g,v,c,f,I,P,h,u]),N.useEffect(()=>{var te;if(r)return;const fe=Array.from((P==null||(te=P.portalNode)==null?void 0:te.querySelectorAll("["+Xa("portal")+"]"))||[]);if(v){const A=[v,...fe,O.current,q.current,S.current.includes("reference")||M?g:null].filter(Te=>Te!=null),we=c?ek(A,b,!b):ek(A);return()=>{we()}}},[r,g,v,c,S,P,M,b]),an(()=>{if(r||!v)return;const te=Tr(v),fe=Li(te);queueMicrotask(()=>{const A=W(v),we=E.current,Te=(typeof we=="number"?A[we]:we.current)||v,Ee=Wn(v,fe);!$&&!Ee&&d&&fi(Te,{preventScroll:Te===v})})},[r,d,v,$,W,E]),an(()=>{if(r||!v)return;let te=!1;const fe=Tr(v),A=Li(fe),we=y.current;B.current=A;function Te(Ee){if(Ee.type==="escapeKey"&&p.domReference.current&&(B.current=p.domReference.current),["referencePress","escapeKey"].includes(Ee.type))return;const $e=Ee.data.returnFocus;typeof $e=="object"?(H.current=!1,te=$e.preventScroll):H.current=!$e}return m.on("dismiss",Te),()=>{m.off("dismiss",Te);const Ee=Li(fe);(Wn(v,Ee)||I&&Ss(I.nodesRef.current,f).some(Fe=>{var Pe;return Wn((Pe=Fe.context)==null?void 0:Pe.elements.floating,Ee)})||we.openEvent&&["click","mousedown"].includes(we.openEvent.type))&&p.domReference.current&&(B.current=p.domReference.current),_.current&&Pn(B.current)&&!H.current&&fi(B.current,{cancelPrevious:!1,preventScroll:te})}},[r,v,_,y,p,m,I,f]),an(()=>{if(!(r||!P))return P.setFocusManagerState({modal:c,closeOnFocusOut:u,open:d,onOpenChange:h,refs:p}),()=>{P.setFocusManagerState(null)}},[r,P,c,d,h,p,u]),an(()=>{if(!r&&v&&typeof MutationObserver=="function"&&!$){const te=()=>{const A=v.getAttribute("tabindex");S.current.includes("floating")||Li(Tr(v))!==p.domReference.current&&Z().length===0?A!=="0"&&v.setAttribute("tabindex","0"):A!=="-1"&&v.setAttribute("tabindex","-1")};te();const fe=new MutationObserver(te);return fe.observe(v,{childList:!0,subtree:!0,attributes:!0}),()=>{fe.disconnect()}}},[r,v,p,S,Z,$]);function Q(te){return r||!l||!c?null:N.createElement(W9,{ref:te==="start"?O:q,onClick:fe=>h(!1,fe.nativeEvent)},typeof l=="string"?l:"Dismiss")}const C=!r&&b&&!M&&(D||c);return N.createElement(N.Fragment,null,C&&N.createElement(_d,{"data-type":"inside",ref:P==null?void 0:P.beforeInsideRef,onFocus:te=>{if(c){const A=W();fi(i[0]==="reference"?A[0]:A[A.length-1])}else if(P!=null&&P.preserveTabOrder&&P.portalNode)if(H.current=!1,Qa(te,P.portalNode)){const A=nk()||g;A==null||A.focus()}else{var fe;(fe=P.beforeOutsideRef.current)==null||fe.focus()}}}),!M&&Q("start"),n,Q("end"),C&&N.createElement(_d,{"data-type":"inside",ref:P==null?void 0:P.afterInsideRef,onFocus:te=>{if(c)fi(W()[0]);else if(P!=null&&P.preserveTabOrder&&P.portalNode)if(u&&(H.current=!0),Qa(te,P.portalNode)){const A=rk()||g;A==null||A.focus()}else{var fe;(fe=P.afterOutsideRef.current)==null||fe.focus()}}}))}function ak(e){return Pn(e.target)&&e.target.tagName==="BUTTON"}function ck(e){return IE(e)}function J9(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:i,elements:{domReference:o}}=e,{enabled:s=!0,event:a="click",toggle:c=!0,ignoreMouse:l=!1,keyboardHandlers:u=!0}=t,d=N.useRef(),p=N.useRef(!1);return N.useMemo(()=>s?{reference:{onPointerDown(f){d.current=f.pointerType},onMouseDown(f){f.button===0&&(AE(d.current,!0)&&l||a!=="click"&&(n&&c&&(!i.current.openEvent||i.current.openEvent.type==="mousedown")?r(!1,f.nativeEvent):(f.preventDefault(),r(!0,f.nativeEvent))))},onClick(f){if(a==="mousedown"&&d.current){d.current=void 0;return}AE(d.current,!0)&&l||(n&&c&&(!i.current.openEvent||i.current.openEvent.type==="click")?r(!1,f.nativeEvent):r(!0,f.nativeEvent))},onKeyDown(f){d.current=void 0,!(f.defaultPrevented||!u||ak(f))&&(f.key===" "&&!ck(o)&&(f.preventDefault(),p.current=!0),f.key==="Enter"&&r(!(n&&c),f.nativeEvent))},onKeyUp(f){f.defaultPrevented||!u||ak(f)||ck(o)||f.key===" "&&p.current&&(p.current=!1,r(!(n&&c),f.nativeEvent))}}}:{},[s,i,a,l,u,o,c,n,r])}const Y9=N["useInsertionEffect".toString()]||(e=>e());function Ui(e){const t=N.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Y9(()=>{t.current=e}),N.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}const G9={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},X9={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Q9=e=>{var t,n;return{escapeKeyBubbles:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePressBubbles:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function e8(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:i,nodeId:o,elements:{reference:s,domReference:a,floating:c},dataRef:l}=e,{enabled:u=!0,escapeKey:d=!0,outsidePress:p=!0,outsidePressEvent:f="pointerdown",referencePress:h=!1,referencePressEvent:m="pointerdown",ancestorScroll:y=!1,bubbles:g}=t,v=bd(),b=XE()!=null,S=Ui(typeof p=="function"?p:()=>!1),E=typeof p=="function"?S:p,_=N.useRef(!1),{escapeKeyBubbles:I,outsidePressBubbles:P}=Q9(g),$=Ui(q=>{if(!n||!u||!d||q.key!=="Escape")return;const H=v?Ss(v.nodesRef.current,o):[];if(!I&&(q.stopPropagation(),H.length>0)){let B=!0;if(H.forEach(F=>{var D;if((D=F.context)!=null&&D.open&&!F.context.dataRef.current.__escapeKeyBubbles){B=!1;return}}),!B)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),r(!1,U7(q)?q.nativeEvent:q)}),O=Ui(q=>{const H=_.current;if(_.current=!1,H||typeof E=="function"&&!E(q))return;const B=OE(q),F="["+Xa("inert")+"]",D=Tr(c).querySelectorAll(F);let M=Jt(B)?B:null;for(;M&&!Ka(M);){const Q=xo(M);if(Q===Tr(c).body||!Jt(Q))break;M=Q}if(D.length&&Jt(B)&&!B7(B)&&!Wn(B,c)&&Array.from(D).every(Q=>!Wn(M,Q)))return;if(Pn(B)&&c){const Q=B.clientWidth>0&&B.scrollWidth>B.clientWidth,C=B.clientHeight>0&&B.scrollHeight>B.clientHeight;let te=C&&q.offsetX>B.clientWidth;if(C&&nr(B).direction==="rtl"&&(te=q.offsetX<=B.offsetWidth-B.clientWidth),te||Q&&q.offsetY>B.clientHeight)return}const Z=v&&Ss(v.nodesRef.current,o).some(Q=>{var C;return km(q,(C=Q.context)==null?void 0:C.elements.floating)});if(km(q,c)||km(q,a)||Z)return;const W=v?Ss(v.nodesRef.current,o):[];if(W.length>0){let Q=!0;if(W.forEach(C=>{var te;if((te=C.context)!=null&&te.open&&!C.context.dataRef.current.__outsidePressBubbles){Q=!1;return}}),!Q)return}i.emit("dismiss",{type:"outsidePress",data:{returnFocus:b?{preventScroll:!0}:kE(q)||CE(q)}}),r(!1,q)});return N.useEffect(()=>{if(!n||!u)return;l.current.__escapeKeyBubbles=I,l.current.__outsidePressBubbles=P;function q(F){r(!1,F)}const H=Tr(c);d&&H.addEventListener("keydown",$),E&&H.addEventListener(f,O);let B=[];return y&&(Jt(a)&&(B=qi(a)),Jt(c)&&(B=B.concat(qi(c))),!Jt(s)&&s&&s.contextElement&&(B=B.concat(qi(s.contextElement)))),B=B.filter(F=>{var D;return F!==((D=H.defaultView)==null?void 0:D.visualViewport)}),B.forEach(F=>{F.addEventListener("scroll",q,{passive:!0})}),()=>{d&&H.removeEventListener("keydown",$),E&&H.removeEventListener(f,O),B.forEach(F=>{F.removeEventListener("scroll",q)})}},[l,c,a,s,d,E,f,n,r,y,u,I,P,$,O]),N.useEffect(()=>{_.current=!1},[E,f]),N.useMemo(()=>u?{reference:{onKeyDown:$,[G9[m]]:q=>{h&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),r(!1,q.nativeEvent))}},floating:{onKeyDown:$,[X9[f]]:()=>{_.current=!0}}}:{},[u,i,h,f,m,r,$])}let jm;process.env.NODE_ENV!=="production"&&(jm=new Set);function t8(e){var t;e===void 0&&(e={});const{open:n=!1,onOpenChange:r,nodeId:i}=e;if(process.env.NODE_ENV!=="production"){var o;const I="Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead.";if((o=e.elements)!=null&&o.reference&&!Jt(e.elements.reference)){var s;if(!((s=jm)!=null&&s.has(I))){var a;(a=jm)==null||a.add(I),console.error(I)}}}const[c,l]=N.useState(null),u=((t=e.elements)==null?void 0:t.reference)||c,d=f9(e),p=bd(),f=Ui((I,P)=>{I&&(m.current.openEvent=P),r==null||r(I,P)}),h=N.useRef(null),m=N.useRef({}),y=N.useState(()=>D9())[0],g=Pm(),v=N.useCallback(I=>{const P=Jt(I)?{getBoundingClientRect:()=>I.getBoundingClientRect(),contextElement:I}:I;d.refs.setReference(P)},[d.refs]),b=N.useCallback(I=>{(Jt(I)||I===null)&&(h.current=I,l(I)),(Jt(d.refs.reference.current)||d.refs.reference.current===null||I!==null&&!Jt(I))&&d.refs.setReference(I)},[d.refs]),S=N.useMemo(()=>({...d.refs,setReference:b,setPositionReference:v,domReference:h}),[d.refs,b,v]),E=N.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),_=N.useMemo(()=>({...d,refs:S,elements:E,dataRef:m,nodeId:i,floatingId:g,events:y,open:n,onOpenChange:f}),[d,i,g,y,n,f,S,E]);return an(()=>{const I=p==null?void 0:p.nodesRef.current.find(P=>P.id===i);I&&(I.context=_)}),N.useMemo(()=>({...d,context:_,refs:S,elements:E}),[d,S,E,_])}function Mm(e,t,n){const r=new Map;return{...n==="floating"&&{tabIndex:-1},...e,...t.map(i=>i?i[n]:null).concat(e).reduce((i,o)=>(o&&Object.entries(o).forEach(s=>{let[a,c]=s;if(a.indexOf("on")===0){if(r.has(a)||r.set(a,[]),typeof c=="function"){var l;(l=r.get(a))==null||l.push(c),i[a]=function(){for(var u,d=arguments.length,p=new Array(d),f=0;f<d;f++)p[f]=arguments[f];return(u=r.get(a))==null?void 0:u.map(h=>h(...p)).find(h=>h!==void 0)}}}else i[a]=c}),i),{})}}function n8(e){e===void 0&&(e=[]);const t=e,n=N.useCallback(o=>Mm(o,e,"reference"),t),r=N.useCallback(o=>Mm(o,e,"floating"),t),i=N.useCallback(o=>Mm(o,e,"item"),e.map(o=>o==null?void 0:o.item));return N.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:i}),[n,r,i])}let lk=!1;function Sd(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function uk(e,t){return Sd(t,e===Om||e===yd,e===_s||e===Ya)}function qm(e,t,n){return Sd(t,e===yd,n?e===_s:e===Ya)||e==="Enter"||e==" "||e===""}function r8(e,t,n){return Sd(t,n?e===_s:e===Ya,e===yd)}function dk(e,t,n){return Sd(t,n?e===Ya:e===_s,e===Om)}function i8(e,t){const{open:n,onOpenChange:r,refs:i,elements:{domReference:o,floating:s}}=e,{listRef:a,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:p=!1,loop:f=!1,nested:h=!1,rtl:m=!1,virtual:y=!1,focusItemOnOpen:g="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:b=!0,disabledIndices:S=void 0,orientation:E="vertical",cols:_=1,scrollItemIntoView:I=!0,virtualItemRef:P}=t;process.env.NODE_ENV!=="production"&&(p&&(f||console.warn(["Floating UI: `useListNavigation` looping must be enabled to allow","escaping."].join(" ")),y||console.warn(["Floating UI: `useListNavigation` must be virtual to allow","escaping."].join(" "))),E==="vertical"&&_>1&&console.warn(["Floating UI: In grid list navigation mode (`cols` > 1), the",'`orientation` should be either "horizontal" or "both".'].join(" ")));const $=XE(),O=bd(),q=Ui(l),H=N.useRef(g),B=N.useRef(d??-1),F=N.useRef(null),D=N.useRef(!0),M=N.useRef(q),Z=N.useRef(!!s),W=N.useRef(!1),Q=N.useRef(!1),C=Fi(S),te=Fi(n),fe=Fi(I),[A,we]=N.useState(),[Te,Ee]=N.useState(),$e=Ui(function(he,de,_e){_e===void 0&&(_e=!1);const pe=he.current[de.current];pe&&(y?(we(pe.id),O==null||O.events.emit("virtualfocus",pe),P&&(P.current=pe)):fi(pe,{preventScroll:!0,sync:F7()&&TE()?lk||W.current:!1}),requestAnimationFrame(()=>{const De=fe.current;De&&pe&&(_e||!D.current)&&(pe.scrollIntoView==null||pe.scrollIntoView(typeof De=="boolean"?{block:"nearest",inline:"nearest"}:De))}))});an(()=>{document.createElement("div").focus({get preventScroll(){return lk=!0,!1}})},[]),an(()=>{u&&(n&&s?H.current&&d!=null&&(Q.current=!0,q(d)):Z.current&&(B.current=-1,M.current(null)))},[u,n,s,d,q]),an(()=>{if(u&&n&&s)if(c==null){if(W.current=!1,d!=null)return;if(Z.current&&(B.current=-1,$e(a,B)),!Z.current&&H.current&&(F.current!=null||H.current===!0&&F.current==null)){let he=0;const de=()=>{a.current[0]==null?(he<2&&(he?requestAnimationFrame:queueMicrotask)(de),he++):(B.current=F.current==null||qm(F.current,E,m)||h?Im(a,C.current):JE(a,C.current),F.current=null,q(B.current))};de()}}else Ga(a,c)||(B.current=c,$e(a,B,Q.current),Q.current=!1)},[u,n,s,c,d,h,a,E,m,q,$e,C]),an(()=>{var he,de;if(!u||s||!O||y||!Z.current)return;const _e=O.nodesRef.current,pe=(he=_e.find(L=>L.id===$))==null||(de=he.context)==null?void 0:de.elements.floating,De=Li(Tr(s)),et=_e.some(L=>L.context&&Wn(L.context.elements.floating,De));pe&&!et&&D.current&&pe.focus({preventScroll:!0})},[u,s,O,$,y]),an(()=>{if(!u||!O||!y||$)return;function he(de){Ee(de.id),P&&(P.current=de)}return O.events.on("virtualfocus",he),()=>{O.events.off("virtualfocus",he)}},[u,O,y,$,P]),an(()=>{M.current=q,Z.current=!!s}),an(()=>{n||(F.current=null)},[n]);const Fe=c!=null,Pe=N.useMemo(()=>{function he(_e){if(!n)return;const pe=a.current.indexOf(_e);pe!==-1&&q(pe)}return{onFocus(_e){let{currentTarget:pe}=_e;he(pe)},onClick:_e=>{let{currentTarget:pe}=_e;return pe.focus({preventScroll:!0})},...v&&{onMouseMove(_e){let{currentTarget:pe}=_e;he(pe)},onPointerLeave(_e){let{pointerType:pe}=_e;!D.current||pe==="touch"||(B.current=-1,$e(a,B),q(null),y||fi(i.floating.current,{preventScroll:!0}))}}}},[n,i,$e,v,a,q,y]);return N.useMemo(()=>{if(!u)return{};const he=C.current;function de(L){if(D.current=!1,W.current=!0,!te.current&&L.currentTarget===i.floating.current)return;if(h&&dk(L.key,E,m)){xn(L),r(!1,L.nativeEvent),Pn(o)&&!y&&o.focus();return}const oe=B.current,ce=Im(a,he),ue=JE(a,he);if(L.key==="Home"&&(xn(L),B.current=ce,q(B.current)),L.key==="End"&&(xn(L),B.current=ue,q(B.current)),!(_>1&&(B.current=R9(a,{event:L,orientation:E,loop:f,cols:_,disabledIndices:he,minIndex:ce,maxIndex:ue,prevIndex:B.current,stopEvent:!0}),q(B.current),E==="both"))&&uk(L.key,E)){if(xn(L),n&&!y&&Li(L.currentTarget.ownerDocument)===L.currentTarget){B.current=qm(L.key,E,m)?ce:ue,q(B.current);return}qm(L.key,E,m)?f?B.current=oe>=ue?p&&oe!==a.current.length?-1:ce:$n(a,{startingIndex:oe,disabledIndices:he}):B.current=Math.min(ue,$n(a,{startingIndex:oe,disabledIndices:he})):f?B.current=oe<=ce?p&&oe!==-1?a.current.length:ue:$n(a,{startingIndex:oe,decrement:!0,disabledIndices:he}):B.current=Math.max(ce,$n(a,{startingIndex:oe,decrement:!0,disabledIndices:he})),Ga(a,B.current)?q(null):q(B.current)}}function _e(L){g==="auto"&&kE(L.nativeEvent)&&(H.current=!0)}function pe(L){H.current=g,g==="auto"&&CE(L.nativeEvent)&&(H.current=!0)}const De=y&&n&&Fe&&{"aria-activedescendant":Te||A},et=a.current.find(L=>(L==null?void 0:L.id)===A);return{reference:{...De,onKeyDown(L){D.current=!1;const oe=L.key.indexOf("Arrow")===0,ce=r8(L.key,E,m),ue=dk(L.key,E,m),Ne=uk(L.key,E),Se=(h?ce:Ne)||L.key==="Enter"||L.key.trim()==="";if(y&&n){const K=O==null?void 0:O.nodesRef.current.find(ae=>ae.parentId==null),ie=O&&K?q9(O.nodesRef.current,K.id):null;if(oe&&ie&&P){const ae=new KeyboardEvent("keydown",{key:L.key,bubbles:!0});if(ce||ue){var Be,pt;const Ae=((Be=ie.context)==null?void 0:Be.elements.domReference)===L.currentTarget,Je=ue&&!Ae?(pt=ie.context)==null?void 0:pt.elements.domReference:ce?et:null;Je&&(xn(L),Je.dispatchEvent(ae),Ee(void 0))}if(Ne&&ie.context&&ie.context.open&&ie.parentId&&L.currentTarget!==ie.context.elements.domReference){var Ge;xn(L),(Ge=ie.context.elements.domReference)==null||Ge.dispatchEvent(ae);return}}return de(L)}if(!(!n&&!b&&oe)){if(Se&&(F.current=h&&Ne?null:L.key),h){ce&&(xn(L),n?(B.current=Im(a,he),q(B.current)):r(!0,L.nativeEvent));return}Ne&&(d!=null&&(B.current=d),xn(L),!n&&b?r(!0,L.nativeEvent):de(L),n&&q(B.current))}},onFocus(){n&&q(null)},onPointerDown:pe,onMouseDown:_e,onClick:_e},floating:{"aria-orientation":E==="both"?void 0:E,...De,onKeyDown:de,onPointerMove(){D.current=!0}},item:Pe}},[o,i,A,Te,C,te,a,u,E,m,y,n,Fe,h,d,b,p,_,f,g,q,r,Pe,O,P])}function o8(e,t){t===void 0&&(t={});const{open:n,floatingId:r}=e,{enabled:i=!0,role:o="dialog"}=t,s=Pm();return N.useMemo(()=>{const a={id:r,role:o};return i?o==="tooltip"?{reference:{"aria-describedby":n?r:void 0},floating:a}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":o==="alertdialog"?"dialog":o,"aria-controls":n?r:void 0,...o==="listbox"&&{role:"combobox"},...o==="menu"&&{id:s}},floating:{...a,...o==="menu"&&{"aria-labelledby":s}}}:{}},[i,o,n,r,s])}function s8(e,t){var n;const{open:r,dataRef:i}=e,{listRef:o,activeIndex:s,onMatch:a,onTypingChange:c,enabled:l=!0,findMatch:u=null,resetMs:d=750,ignoreKeys:p=[],selectedIndex:f=null}=t,h=N.useRef(),m=N.useRef(""),y=N.useRef((n=f??s)!=null?n:-1),g=N.useRef(null),v=Ui(a),b=Ui(c),S=Fi(u),E=Fi(p);return an(()=>{r&&(clearTimeout(h.current),g.current=null,m.current="")},[r]),an(()=>{if(r&&m.current===""){var _;y.current=(_=f??s)!=null?_:-1}},[r,f,s]),N.useMemo(()=>{if(!l)return{};function _($){$?i.current.typing||(i.current.typing=$,b($)):i.current.typing&&(i.current.typing=$,b($))}function I($,O,q){const H=S.current?S.current(O,q):O.find(B=>(B==null?void 0:B.toLocaleLowerCase().indexOf(q.toLocaleLowerCase()))===0);return H?$.indexOf(H):-1}function P($){const O=o.current;if(m.current.length>0&&m.current[0]!==" "&&(I(O,O,m.current)===-1?_(!1):$.key===" "&&xn($)),O==null||E.current.includes($.key)||$.key.length!==1||$.ctrlKey||$.metaKey||$.altKey)return;r&&$.key!==" "&&(xn($),_(!0)),O.every(F=>{var D,M;return F?((D=F[0])==null?void 0:D.toLocaleLowerCase())!==((M=F[1])==null?void 0:M.toLocaleLowerCase()):!0})&&m.current===$.key&&(m.current="",y.current=g.current),m.current+=$.key,clearTimeout(h.current),h.current=setTimeout(()=>{m.current="",y.current=g.current,_(!1)},d);const H=y.current,B=I(O,[...O.slice((H||0)+1),...O.slice(0,(H||0)+1)],m.current);B!==-1?(v(B),g.current=B):$.key!==" "&&(m.current="",_(!1))}return{reference:{onKeyDown:P},floating:{onKeyDown:P,onKeyUp($){$.key===" "&&_(!1)}}}},[l,r,i,o,d,E,S,v,b])}const a8=({styles:e,type:t,options:n,label:r,reusable:i})=>{var Z,W,Q,C,te,fe,A,we,Te,Ee,$e,Fe;const o=Ie(Pe=>Pe.sendTextMessage),s=Ie(Pe=>Pe.messageContainerRef),a=Ie(Pe=>Pe.isReadOnly),[c,l]=N.useState(!1),[u,d]=N.useState(null),[p,f]=N.useState(null),h=n.reduce((Pe,he)=>(Pe[he.label]=he.value,Pe),{}),m=h?Object.keys(h):[],y=Pe=>{l(p!==null&&!i?!1:Pe)},{refs:g,floatingStyles:v,context:b}=t8({placement:"bottom-start",open:c,onOpenChange:y,whileElementsMounted:u9,middleware:[H7(5),W7({padding:10,boundary:(s==null?void 0:s.current)??void 0,crossAxis:!0}),K7({apply({rects:Pe,elements:he,availableHeight:de}){Object.assign(he.floating.style,{maxHeight:`${de}px`,minWidth:`${Pe.reference.width}px`})},padding:10})]}),S=N.useRef([]),E=N.useRef(m),_=N.useRef(!1),I=J9(b,{event:"mousedown"}),P=e8(b),$=o8(b,{role:"listbox"}),O=i8(b,{listRef:S,activeIndex:u,selectedIndex:p,onNavigate:d,loop:!0}),q=s8(b,{listRef:E,activeIndex:u,selectedIndex:p,onMatch:c?d:f,onTypingChange(Pe){_.current=Pe}}),{getReferenceProps:H,getFloatingProps:B,getItemProps:F}=n8([P,$,O,q,I]),D=Pe=>{f(Pe),o(h[m[Pe]]),l(!1)},M=p!==null?m[p]:void 0;return U.jsxs(U.Fragment,{children:[U.jsxs("div",{tabIndex:0,ref:g.setReference,"aria-labelledby":"select-label","aria-autocomplete":"none","data-disabled":p!==null&&!i?"":void 0,...(W=(Z=e==null?void 0:e[t])==null?void 0:Z.button)==null?void 0:W.container,...H(),children:[U.jsx("span",{...(C=(Q=e==null?void 0:e[t])==null?void 0:Q.button)==null?void 0:C.text,children:M||r||"Select..."}),U.jsx(RZ,{...(fe=(te=e==null?void 0:e[t])==null?void 0:te.button)==null?void 0:fe.icon})]}),c&&U.jsx(H9,{children:U.jsx(K9,{context:b,modal:!1,children:U.jsx("div",{ref:g.setFloating,className:(Te=(we=(A=e==null?void 0:e[t])==null?void 0:A.content)==null?void 0:we.container)==null?void 0:Te.className,style:{...v,...(Fe=($e=(Ee=e==null?void 0:e[t])==null?void 0:Ee.content)==null?void 0:$e.container)==null?void 0:Fe.style},...B(),children:m.map((Pe,he)=>{var de,_e;return U.jsx("div",{ref:pe=>{S.current[he]=pe},role:"option",tabIndex:he===u?0:-1,"aria-selected":he===p&&he===u,"data-active":he===u?"":void 0,...(_e=(de=e==null?void 0:e[t])==null?void 0:de.content)==null?void 0:_e.item,...F({onClick(){a||D(he)},onKeyDown(pe){a||(pe.key==="Enter"&&(pe.preventDefault(),D(he)),pe.key===" "&&!_.current&&(pe.preventDefault(),D(he)))}}),children:Pe},Pe)})})})})]})},c8=w.forwardRef(({type:e,title:t,styles:n,url:r,...i},o)=>{var s,a,c;return U.jsxs("a",{...i,...(s=n==null?void 0:n[e])==null?void 0:s.container,href:r,download:!0,ref:o,target:"_blank",children:[U.jsx("p",{...(a=n==null?void 0:n[e])==null?void 0:a.title,children:t||r}),U.jsx($Z,{...(c=n==null?void 0:n[e])==null?void 0:c.icon})]})}),fk={audio:SZ,bubble:vZ,button:yZ,carousel:P7,column:LZ,dropdown:a8,file:c8,image:wZ,location:qZ,row:FZ,text:vL,video:_Z},ks=({block:e,styles:t,...n})=>{const i=Ie(s=>s.renderers)[e.type]??fk[e.type],o={...n,styles:t,...e};return U.jsx(i,{...o})},pk=w.memo(w.forwardRef((e,t)=>{const{composer:n}=Ie(d=>d.theme),r=Ie(d=>d.sendTextMessage),i=Ie(d=>d.disableComposer),o=Ie(d=>d.isReadOnly),[s,a]=w.useState(""),[c,l]=w.useState(-1);if(o)return null;const u=()=>{s&&(r(s),a(""),l(-1))};return U.jsx(aE.Provider,{value:{value:s,setValue:a,historyIndex:c,setHistoryIndex:l,sendMessage:u},children:U.jsx("div",{"data-disabled":i,...e,...n==null?void 0:n.container,ref:t})})})),hk=w.memo(e=>{const{composer:t}=Ie(g=>g.theme),n=Ie(g=>g.configuration),r=Ie(g=>g.disableComposer),i=Ie(g=>g.setIsTyping),{value:o,setValue:s,historyIndex:a,setHistoryIndex:c,sendMessage:l}=cE(),u=w.useRef(null),d=Qn(g=>g.user),p=Qn(g=>g.messageHistory),[f,h]=w.useState(!1);bL(u.current,o);function m({key:g}){g==="Shift"&&h(!0)}function y({key:g}){g==="Shift"&&h(!1)}return w.useEffect(()=>(window.addEventListener("keydown",m),window.addEventListener("keyup",y),()=>{window.removeEventListener("keydown",m),window.removeEventListener("keyup",y)}),[]),U.jsx("textarea",{...t==null?void 0:t.input,placeholder:(n==null?void 0:n.composerPlaceholder)??"Type your message...",disabled:r,ref:u,value:o,"data-has-value":!!o,onChange:g=>s(g.target.value),onKeyDown:g=>{if(!r){if(g.key==="Enter"&&(g.preventDefault(),f?(s(`${o}
363
- `),setTimeout(()=>{var v;return(v=u.current)==null?void 0:v.scroll({behavior:"instant",top:u.current.scrollHeight})},0)):(l(),setTimeout(()=>i(!0,9e3),500))),g.key==="ArrowUp"){g.preventDefault();const v=p[(d==null?void 0:d.userId)??""]??[];a<v.length-1&&s(v[a+1]),c(()=>Math.min(a+1,v.length-1))}if(g.key==="ArrowDown"){g.preventDefault();const v=p[(d==null?void 0:d.userId)??""]??[];s(a===0?"":v[a-1]),c(()=>Math.max(a-1,-1))}}},...e})}),mk=w.memo(w.forwardRef(({icon:e=MZ,...t},n)=>{var u,d;const{composer:r}=Ie(p=>p.theme),i=Ie(p=>p.sendFile),o=Ie(p=>p.addMessage),s=w.useRef(null);if(!Ie(p=>p.allowFileUpload))return null;const c=()=>{var p;s.current&&((p=s.current)==null||p.click())},l=async p=>{var h;const f=(h=p.target.files)==null?void 0:h[0];if(f)try{const{fileUrl:m,type:y}=await i(f)??"";o({direction:"outgoing",sender:{name:"You"},timestamp:new Date,disableInput:!1,block:{type:y,url:m}})}catch(m){console.error("Error sending file:",m)}};return U.jsxs(U.Fragment,{children:[U.jsx("button",{type:"button",ref:n,...t,...(u=r==null?void 0:r.uploadButton)==null?void 0:u.container,onClick:c,children:U.jsx(e,{...(d=r==null?void 0:r.uploadButton)==null?void 0:d.icon})}),U.jsx("input",{type:"file",ref:s,style:{display:"none"},onChange:l})]})})),yk=w.memo(w.forwardRef(({icon:e=OZ,...t},n)=>{var s,a;const{value:r,sendMessage:i}=cE(),{composer:o}=Ie(c=>c.theme);return U.jsx("button",{type:"button",ref:n,...t,...(s=o==null?void 0:o.button)==null?void 0:s.container,disabled:!r,onClick:i,children:U.jsx(e,{...(a=o==null?void 0:o.button)==null?void 0:a.icon})})})),gk=({children:e})=>{const[t,n]=w.useState(!1),[r,i]=w.useState(""),[o,s]=w.useState(null),a=({title:l,content:u})=>{i(l),s(u),n(!0)},c=()=>{n(!1)};return U.jsxs(uE.Provider,{value:{hideModal:c,showModal:a,title:r,content:o,open:t},children:[U.jsx(Zi,{open:t,onOpenChange:n,children:U.jsx(Zi.Content,{title:r,children:o})}),e]})},l8=({children:e,...t})=>{const n=w.useRef(),r=w.useRef(null),i=mZ({...t,messageContainerRef:r});return n.current||(n.current=i),U.jsx(sE.Provider,{value:n.current,children:U.jsx(u8,{children:e})})},u8=({children:e})=>{const t=Ie(g=>g.client),n=Ie(g=>g.addMessage),r=Ie(g=>g.setMessages),i=Ie(g=>g.configuration),o=Ie(g=>g.setConnected),s=Ie(g=>g.userData),a=Ie(g=>g.userName),c=Ie(g=>g.userPictureUrl),l=Ie(g=>g.setIsTyping),u=Ie(g=>g.getMessages),d=Qn(g=>g.setConversationId),p=Qn(g=>g.user),f=Qn(g=>g.conversationId),h=Qn(g=>g.setUser),[m,y]=w.useState(0);return w.useEffect(()=>{if(t)return t.on("messageSent",g=>{const v=u(),b=v[v.length-1];b.block.type!=="bubble"||b.block.block.type!=="text"||b.block.block.text===g||n({direction:"outgoing",sender:{name:"You"},timestamp:new Date,block:{type:"bubble",block:{type:"text",text:g}},disableInput:!1})})},[f]),w.useEffect(()=>{if(t)return t.on("message",g=>{try{const{payload:v,disableInput:b,id:S,conversationId:E}=g;if(f!==E)return;l(!1,0),n({id:S,direction:"incoming",sender:{name:i.botName??"Bot",avatar:i.botAvatar},timestamp:new Date(g.sentOn),block:v,disableInput:b})}catch{console.error("Invalid message payload")}})},[f]),w.useEffect(()=>{if(t)return t.on("conversation",g=>{d(g)})},[]),WS(async()=>{if(t)return t.on("error",()=>{y(g=>g+1)})}),WS(async()=>{if(!t||f&&t.conversationId===f)return;let g;try{g=await t.connect(p,s,{name:a,pictureUrl:c}),o(!0)}catch(b){console.error(b),o(!1);return}h(g),f&&await t.conversationExists(f)?await t.switchConversation(f):await t.newConversation();const v=[];for(const b of await t.listMessages())try{const{payload:S,authorId:E,sentOn:_,disableInput:I,id:P}=b,$=E===t.userId?"outgoing":"incoming";v.push({id:P,direction:$,sender:$==="outgoing"?{name:"You"}:{name:i.botName??"Bot",avatar:i.botAvatar},timestamp:new Date(_),block:S,disableInput:I})}catch{console.error("Invalid message payload")}return r(v.reverse()),()=>{t.disconnect()}},[m,f]),U.jsx(U.Fragment,{children:e})};function Dn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}const d8=N["useId".toString()]||(()=>{});let f8=0;function Ed(e){const[t,n]=N.useState(d8());return zo(()=>{e||n(r=>r??String(f8++))},[e]),e||(t?`radix-${t}`:"")}function vk({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=p8({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=Mn(n),c=w.useCallback(l=>{if(o){const d=typeof l=="function"?l(e):l;d!==e&&a(d)}else i(l)},[o,e,i,a]);return[s,c]}function p8({defaultProp:e,onChange:t}){const n=w.useState(e),[r]=n,i=w.useRef(r),o=Mn(t);return w.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function h8(e,t=globalThis==null?void 0:globalThis.document){const n=Mn(e);w.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const Lm="dismissableLayer.update",m8="dismissableLayer.pointerDownOutside",y8="dismissableLayer.focusOutside";let bk;const g8=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),v8=w.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...l}=e,u=w.useContext(g8),[d,p]=w.useState(null),f=(n=d==null?void 0:d.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,h]=w.useState({}),m=Jn(t,P=>p(P)),y=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=y.indexOf(g),b=d?y.indexOf(d):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,E=b>=v,_=b8(P=>{const $=P.target,O=[...u.branches].some(q=>q.contains($));!E||O||(o==null||o(P),a==null||a(P),P.defaultPrevented||c==null||c())},f),I=w8(P=>{const $=P.target;[...u.branches].some(q=>q.contains($))||(s==null||s(P),a==null||a(P),P.defaultPrevented||c==null||c())},f);return h8(P=>{b===u.layers.size-1&&(i==null||i(P),!P.defaultPrevented&&c&&(P.preventDefault(),c()))},f),w.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(bk=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),wk(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=bk)}},[d,f,r,u]),w.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),wk())},[d,u]),w.useEffect(()=>{const P=()=>h({});return document.addEventListener(Lm,P),()=>document.removeEventListener(Lm,P)},[]),w.createElement(bn.div,Xi({},l,{ref:m,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:Dn(e.onFocusCapture,I.onFocusCapture),onBlurCapture:Dn(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Dn(e.onPointerDownCapture,_.onPointerDownCapture)}))});function b8(e,t=globalThis==null?void 0:globalThis.document){const n=Mn(e),r=w.useRef(!1),i=w.useRef(()=>{});return w.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let l=function(){xk(m8,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function w8(e,t=globalThis==null?void 0:globalThis.document){const n=Mn(e),r=w.useRef(!1);return w.useEffect(()=>{const i=o=>{o.target&&!r.current&&xk(y8,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function wk(){const e=new CustomEvent(Lm);document.dispatchEvent(e)}function xk(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?F$(i,o):i.dispatchEvent(o)}const Fm="focusScope.autoFocusOnMount",Um="focusScope.autoFocusOnUnmount",_k={bubbles:!1,cancelable:!0},x8=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[a,c]=w.useState(null),l=Mn(i),u=Mn(o),d=w.useRef(null),p=Jn(t,m=>c(m)),f=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let m=function(b){if(f.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:Bi(d.current,{select:!0})},y=function(b){if(f.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||Bi(d.current,{select:!0}))},g=function(b){const S=document.activeElement;for(const E of b)E.removedNodes.length>0&&(a!=null&&a.contains(S)||Bi(a))};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const v=new MutationObserver(g);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),v.disconnect()}}},[r,a,f.paused]),w.useEffect(()=>{if(a){kk.add(f);const m=document.activeElement;if(!a.contains(m)){const g=new CustomEvent(Fm,_k);a.addEventListener(Fm,l),a.dispatchEvent(g),g.defaultPrevented||(_8(T8(Sk(a)),{select:!0}),document.activeElement===m&&Bi(a))}return()=>{a.removeEventListener(Fm,l),setTimeout(()=>{const g=new CustomEvent(Um,_k);a.addEventListener(Um,u),a.dispatchEvent(g),g.defaultPrevented||Bi(m??document.body,{select:!0}),a.removeEventListener(Um,u),kk.remove(f)},0)}}},[a,l,u,f]);const h=w.useCallback(m=>{if(!n&&!r||f.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(y&&g){const v=m.currentTarget,[b,S]=S8(v);b&&S?!m.shiftKey&&g===S?(m.preventDefault(),n&&Bi(b,{select:!0})):m.shiftKey&&g===b&&(m.preventDefault(),n&&Bi(S,{select:!0})):g===v&&m.preventDefault()}},[n,r,f.paused]);return w.createElement(bn.div,Xi({tabIndex:-1},s,{ref:p,onKeyDown:h}))});function _8(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Bi(r,{select:t}),document.activeElement!==n)return}function S8(e){const t=Sk(e),n=Ek(t,e),r=Ek(t.reverse(),e);return[n,r]}function Sk(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ek(e,t){for(const n of e)if(!E8(n,{upTo:t}))return n}function E8(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function k8(e){return e instanceof HTMLInputElement&&"select"in e}function Bi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&k8(e)&&t&&e.select()}}const kk=C8();function C8(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ck(e,t),e.unshift(t)},remove(t){var n;e=Ck(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function Ck(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function T8(e){return e.filter(t=>t.tagName!=="A")}function A8(e,t){return w.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const zi=e=>{const{present:t,children:n}=e,r=O8(t),i=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),o=Jn(r.ref,i.ref);return typeof n=="function"||r.isPresent?w.cloneElement(i,{ref:o}):null};zi.displayName="Presence";function O8(e){const[t,n]=w.useState(),r=w.useRef({}),i=w.useRef(e),o=w.useRef("none"),s=e?"mounted":"unmounted",[a,c]=A8(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const l=kd(r.current);o.current=a==="mounted"?l:"none"},[a]),zo(()=>{const l=r.current,u=i.current;if(u!==e){const p=o.current,f=kd(l);e?c("MOUNT"):f==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(u&&p!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),zo(()=>{if(t){const l=d=>{const f=kd(r.current).includes(d.animationName);d.target===t&&f&&Ar.flushSync(()=>c("ANIMATION_END"))},u=d=>{d.target===t&&(o.current=kd(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function kd(e){return(e==null?void 0:e.animationName)||"none"}let Bm=0;function I8(){w.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:Tk()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:Tk()),Bm++,()=>{Bm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Bm--}},[])}function Tk(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Vr=function(){return Vr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Vr.apply(this,arguments)};function Ak(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function R8(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Cd="right-scroll-bar-position",Td="width-before-scroll-bar",P8="with-scroll-bars-hidden",$8="--removed-body-scroll-bar-size";function D8(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function N8(e,t){var n=w.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}function j8(e,t){return N8(t||null,function(n){return e.forEach(function(r){return D8(r,n)})})}function M8(e){return e}function q8(e,t){t===void 0&&(t=M8);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var s=t(o,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(o){for(r=!0;n.length;){var s=n;n=[],s.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(o),s=n}var c=function(){var u=s;s=[],u.forEach(o)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(u){s.push(u),l()},filter:function(u){return s=s.filter(u),n}}}};return i}function L8(e){e===void 0&&(e={});var t=q8(null);return t.options=Vr({async:!0,ssr:!1},e),t}var Ok=function(e){var t=e.sideCar,n=Ak(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return N.createElement(r,Vr({},n))};Ok.isSideCarExport=!0;function F8(e,t){return e.useMedium(t),Ok}var Ik=L8(),zm=function(){},Ad=N.forwardRef(function(e,t){var n=N.useRef(null),r=N.useState({onScrollCapture:zm,onWheelCapture:zm,onTouchMoveCapture:zm}),i=r[0],o=r[1],s=e.forwardProps,a=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,f=e.noIsolation,h=e.inert,m=e.allowPinchZoom,y=e.as,g=y===void 0?"div":y,v=Ak(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),b=p,S=j8([n,t]),E=Vr(Vr({},v),i);return N.createElement(N.Fragment,null,u&&N.createElement(b,{sideCar:Ik,removeScrollBar:l,shards:d,noIsolation:f,inert:h,setCallbacks:o,allowPinchZoom:!!m,lockRef:n}),s?N.cloneElement(N.Children.only(a),Vr(Vr({},E),{ref:S})):N.createElement(g,Vr({},E,{className:c,ref:S}),a))});Ad.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ad.classNames={fullWidth:Td,zeroRight:Cd};var Rk,U8=function(){if(Rk)return Rk;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function B8(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=U8();return t&&e.setAttribute("nonce",t),e}function z8(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Z8(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var V8=function(){var e=0,t=null;return{add:function(n){e==0&&(t=B8())&&(z8(t,n),Z8(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},H8=function(){var e=V8();return function(t,n){N.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Pk=function(){var e=H8(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},W8={left:0,top:0,right:0,gap:0},Zm=function(e){return parseInt(e||"",10)||0},K8=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Zm(n),Zm(r),Zm(i)]},J8=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return W8;var t=K8(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Y8=Pk(),G8=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
363
+ `),setTimeout(()=>{var v;return(v=u.current)==null?void 0:v.scroll({behavior:"instant",top:u.current.scrollHeight})},0)):(l(),setTimeout(()=>i(!0,9e3),500))),g.key==="ArrowUp"){g.preventDefault();const v=p[(d==null?void 0:d.userId)??""]??[];a<v.length-1&&s(v[a+1]),c(()=>Math.min(a+1,v.length-1))}if(g.key==="ArrowDown"){g.preventDefault();const v=p[(d==null?void 0:d.userId)??""]??[];s(a===0?"":v[a-1]),c(()=>Math.max(a-1,-1))}}},...e})}),mk=w.memo(w.forwardRef(({icon:e=MZ,...t},n)=>{var u,d;const{composer:r}=Ie(p=>p.theme),i=Ie(p=>p.sendFile),o=Ie(p=>p.addMessage),s=w.useRef(null);if(!Ie(p=>p.allowFileUpload))return null;const c=()=>{var p;s.current&&((p=s.current)==null||p.click())},l=async p=>{var h;const f=(h=p.target.files)==null?void 0:h[0];if(f)try{const{fileUrl:m,type:y}=await i(f)??"";o({direction:"outgoing",sender:{name:"You"},timestamp:new Date,disableInput:!1,block:{type:y,url:m}})}catch(m){console.error("Error sending file:",m)}};return U.jsxs(U.Fragment,{children:[U.jsx("button",{type:"button",ref:n,...t,...(u=r==null?void 0:r.uploadButton)==null?void 0:u.container,onClick:c,children:U.jsx(e,{...(d=r==null?void 0:r.uploadButton)==null?void 0:d.icon})}),U.jsx("input",{type:"file",ref:s,style:{display:"none"},onChange:l})]})})),yk=w.memo(w.forwardRef(({icon:e=OZ,...t},n)=>{var s,a;const{value:r,sendMessage:i}=cE(),{composer:o}=Ie(c=>c.theme);return U.jsx("button",{type:"button",ref:n,...t,...(s=o==null?void 0:o.button)==null?void 0:s.container,disabled:!r,onClick:i,children:U.jsx(e,{...(a=o==null?void 0:o.button)==null?void 0:a.icon})})})),gk=({children:e})=>{const[t,n]=w.useState(!1),[r,i]=w.useState(""),[o,s]=w.useState(null),a=({title:l,content:u})=>{i(l),s(u),n(!0)},c=()=>{n(!1)};return U.jsxs(uE.Provider,{value:{hideModal:c,showModal:a,title:r,content:o,open:t},children:[U.jsx(Zi,{open:t,onOpenChange:n,children:U.jsx(Zi.Content,{title:r,children:o})}),e]})},l8=({children:e,...t})=>{const n=w.useRef(),r=w.useRef(null),i=mZ({...t,messageContainerRef:r});return n.current||(n.current=i),U.jsx(sE.Provider,{value:n.current,children:U.jsx(u8,{children:e})})},u8=({children:e})=>{const t=Ie(g=>g.client),n=Ie(g=>g.addMessage),r=Ie(g=>g.setMessages),i=Ie(g=>g.configuration),o=Ie(g=>g.setConnected),s=Ie(g=>g.userData),a=Ie(g=>g.userName),c=Ie(g=>g.userPictureUrl),l=Ie(g=>g.setIsTyping),u=Ie(g=>g.getMessages),d=Qn(g=>g.setConversationId),p=Qn(g=>g.user),f=Qn(g=>g.conversationId),h=Qn(g=>g.setUser),[m,y]=w.useState(0);return w.useEffect(()=>{if(t)return t.on("messageSent",g=>{const v=u(),b=v[v.length-1];(v.length===0||b.block.type==="bubble"&&b.block.block.type==="text"&&b.block.block.text!==g)&&n({direction:"outgoing",sender:{name:"You"},timestamp:new Date,block:{type:"bubble",block:{type:"text",text:g}},disableInput:!1})})},[f]),w.useEffect(()=>{if(t)return t.on("message",g=>{try{const{payload:v,disableInput:b,id:S,conversationId:E}=g;if(f!==E)return;l(!1,0),n({id:S,direction:"incoming",sender:{name:i.botName??"Bot",avatar:i.botAvatar},timestamp:new Date(g.sentOn),block:v,disableInput:b})}catch{console.error("Invalid message payload")}})},[f]),w.useEffect(()=>{if(t)return t.on("conversation",g=>{d(g)})},[]),WS(async()=>{if(t)return t.on("error",()=>{y(g=>g+1)})}),WS(async()=>{if(!t||f&&t.conversationId===f)return;let g;try{g=await t.connect(p,s,{name:a,pictureUrl:c}),o(!0)}catch(b){console.error(b),o(!1);return}h(g),f&&await t.conversationExists(f)?await t.switchConversation(f):await t.newConversation();const v=[];for(const b of await t.listMessages())try{const{payload:S,authorId:E,sentOn:_,disableInput:I,id:P}=b,$=E===t.userId?"outgoing":"incoming";v.push({id:P,direction:$,sender:$==="outgoing"?{name:"You"}:{name:i.botName??"Bot",avatar:i.botAvatar},timestamp:new Date(_),block:S,disableInput:I})}catch{console.error("Invalid message payload")}return r(v.reverse()),()=>{t.disconnect()}},[m,f]),U.jsx(U.Fragment,{children:e})};function Dn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}const d8=N["useId".toString()]||(()=>{});let f8=0;function Ed(e){const[t,n]=N.useState(d8());return zo(()=>{e||n(r=>r??String(f8++))},[e]),e||(t?`radix-${t}`:"")}function vk({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=p8({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=Mn(n),c=w.useCallback(l=>{if(o){const d=typeof l=="function"?l(e):l;d!==e&&a(d)}else i(l)},[o,e,i,a]);return[s,c]}function p8({defaultProp:e,onChange:t}){const n=w.useState(e),[r]=n,i=w.useRef(r),o=Mn(t);return w.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function h8(e,t=globalThis==null?void 0:globalThis.document){const n=Mn(e);w.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const Lm="dismissableLayer.update",m8="dismissableLayer.pointerDownOutside",y8="dismissableLayer.focusOutside";let bk;const g8=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),v8=w.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:c,...l}=e,u=w.useContext(g8),[d,p]=w.useState(null),f=(n=d==null?void 0:d.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,h]=w.useState({}),m=Jn(t,P=>p(P)),y=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=y.indexOf(g),b=d?y.indexOf(d):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,E=b>=v,_=b8(P=>{const $=P.target,O=[...u.branches].some(q=>q.contains($));!E||O||(o==null||o(P),a==null||a(P),P.defaultPrevented||c==null||c())},f),I=w8(P=>{const $=P.target;[...u.branches].some(q=>q.contains($))||(s==null||s(P),a==null||a(P),P.defaultPrevented||c==null||c())},f);return h8(P=>{b===u.layers.size-1&&(i==null||i(P),!P.defaultPrevented&&c&&(P.preventDefault(),c()))},f),w.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(bk=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),wk(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=bk)}},[d,f,r,u]),w.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),wk())},[d,u]),w.useEffect(()=>{const P=()=>h({});return document.addEventListener(Lm,P),()=>document.removeEventListener(Lm,P)},[]),w.createElement(bn.div,Xi({},l,{ref:m,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:Dn(e.onFocusCapture,I.onFocusCapture),onBlurCapture:Dn(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Dn(e.onPointerDownCapture,_.onPointerDownCapture)}))});function b8(e,t=globalThis==null?void 0:globalThis.document){const n=Mn(e),r=w.useRef(!1),i=w.useRef(()=>{});return w.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let l=function(){xk(m8,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function w8(e,t=globalThis==null?void 0:globalThis.document){const n=Mn(e),r=w.useRef(!1);return w.useEffect(()=>{const i=o=>{o.target&&!r.current&&xk(y8,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function wk(){const e=new CustomEvent(Lm);document.dispatchEvent(e)}function xk(e,t,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?F$(i,o):i.dispatchEvent(o)}const Fm="focusScope.autoFocusOnMount",Um="focusScope.autoFocusOnUnmount",_k={bubbles:!1,cancelable:!0},x8=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=e,[a,c]=w.useState(null),l=Mn(i),u=Mn(o),d=w.useRef(null),p=Jn(t,m=>c(m)),f=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let m=function(b){if(f.paused||!a)return;const S=b.target;a.contains(S)?d.current=S:Bi(d.current,{select:!0})},y=function(b){if(f.paused||!a)return;const S=b.relatedTarget;S!==null&&(a.contains(S)||Bi(d.current,{select:!0}))},g=function(b){const S=document.activeElement;for(const E of b)E.removedNodes.length>0&&(a!=null&&a.contains(S)||Bi(a))};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const v=new MutationObserver(g);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),v.disconnect()}}},[r,a,f.paused]),w.useEffect(()=>{if(a){kk.add(f);const m=document.activeElement;if(!a.contains(m)){const g=new CustomEvent(Fm,_k);a.addEventListener(Fm,l),a.dispatchEvent(g),g.defaultPrevented||(_8(T8(Sk(a)),{select:!0}),document.activeElement===m&&Bi(a))}return()=>{a.removeEventListener(Fm,l),setTimeout(()=>{const g=new CustomEvent(Um,_k);a.addEventListener(Um,u),a.dispatchEvent(g),g.defaultPrevented||Bi(m??document.body,{select:!0}),a.removeEventListener(Um,u),kk.remove(f)},0)}}},[a,l,u,f]);const h=w.useCallback(m=>{if(!n&&!r||f.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(y&&g){const v=m.currentTarget,[b,S]=S8(v);b&&S?!m.shiftKey&&g===S?(m.preventDefault(),n&&Bi(b,{select:!0})):m.shiftKey&&g===b&&(m.preventDefault(),n&&Bi(S,{select:!0})):g===v&&m.preventDefault()}},[n,r,f.paused]);return w.createElement(bn.div,Xi({tabIndex:-1},s,{ref:p,onKeyDown:h}))});function _8(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Bi(r,{select:t}),document.activeElement!==n)return}function S8(e){const t=Sk(e),n=Ek(t,e),r=Ek(t.reverse(),e);return[n,r]}function Sk(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ek(e,t){for(const n of e)if(!E8(n,{upTo:t}))return n}function E8(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function k8(e){return e instanceof HTMLInputElement&&"select"in e}function Bi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&k8(e)&&t&&e.select()}}const kk=C8();function C8(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ck(e,t),e.unshift(t)},remove(t){var n;e=Ck(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function Ck(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function T8(e){return e.filter(t=>t.tagName!=="A")}function A8(e,t){return w.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const zi=e=>{const{present:t,children:n}=e,r=O8(t),i=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),o=Jn(r.ref,i.ref);return typeof n=="function"||r.isPresent?w.cloneElement(i,{ref:o}):null};zi.displayName="Presence";function O8(e){const[t,n]=w.useState(),r=w.useRef({}),i=w.useRef(e),o=w.useRef("none"),s=e?"mounted":"unmounted",[a,c]=A8(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const l=kd(r.current);o.current=a==="mounted"?l:"none"},[a]),zo(()=>{const l=r.current,u=i.current;if(u!==e){const p=o.current,f=kd(l);e?c("MOUNT"):f==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(u&&p!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),zo(()=>{if(t){const l=d=>{const f=kd(r.current).includes(d.animationName);d.target===t&&f&&Ar.flushSync(()=>c("ANIMATION_END"))},u=d=>{d.target===t&&(o.current=kd(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",l),t.addEventListener("animationend",l),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",l),t.removeEventListener("animationend",l)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function kd(e){return(e==null?void 0:e.animationName)||"none"}let Bm=0;function I8(){w.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:Tk()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:Tk()),Bm++,()=>{Bm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Bm--}},[])}function Tk(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var Vr=function(){return Vr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Vr.apply(this,arguments)};function Ak(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function R8(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Cd="right-scroll-bar-position",Td="width-before-scroll-bar",P8="with-scroll-bars-hidden",$8="--removed-body-scroll-bar-size";function D8(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function N8(e,t){var n=w.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}function j8(e,t){return N8(t||null,function(n){return e.forEach(function(r){return D8(r,n)})})}function M8(e){return e}function q8(e,t){t===void 0&&(t=M8);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var s=t(o,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(o){for(r=!0;n.length;){var s=n;n=[],s.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(o),s=n}var c=function(){var u=s;s=[],u.forEach(o)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(u){s.push(u),l()},filter:function(u){return s=s.filter(u),n}}}};return i}function L8(e){e===void 0&&(e={});var t=q8(null);return t.options=Vr({async:!0,ssr:!1},e),t}var Ok=function(e){var t=e.sideCar,n=Ak(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return N.createElement(r,Vr({},n))};Ok.isSideCarExport=!0;function F8(e,t){return e.useMedium(t),Ok}var Ik=L8(),zm=function(){},Ad=N.forwardRef(function(e,t){var n=N.useRef(null),r=N.useState({onScrollCapture:zm,onWheelCapture:zm,onTouchMoveCapture:zm}),i=r[0],o=r[1],s=e.forwardProps,a=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,p=e.sideCar,f=e.noIsolation,h=e.inert,m=e.allowPinchZoom,y=e.as,g=y===void 0?"div":y,v=Ak(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),b=p,S=j8([n,t]),E=Vr(Vr({},v),i);return N.createElement(N.Fragment,null,u&&N.createElement(b,{sideCar:Ik,removeScrollBar:l,shards:d,noIsolation:f,inert:h,setCallbacks:o,allowPinchZoom:!!m,lockRef:n}),s?N.cloneElement(N.Children.only(a),Vr(Vr({},E),{ref:S})):N.createElement(g,Vr({},E,{className:c,ref:S}),a))});Ad.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ad.classNames={fullWidth:Td,zeroRight:Cd};var Rk,U8=function(){if(Rk)return Rk;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function B8(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=U8();return t&&e.setAttribute("nonce",t),e}function z8(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Z8(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var V8=function(){var e=0,t=null;return{add:function(n){e==0&&(t=B8())&&(z8(t,n),Z8(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},H8=function(){var e=V8();return function(t,n){N.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Pk=function(){var e=H8(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},W8={left:0,top:0,right:0,gap:0},Zm=function(e){return parseInt(e||"",10)||0},K8=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Zm(n),Zm(r),Zm(i)]},J8=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return W8;var t=K8(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Y8=Pk(),G8=function(e,t,n,r){var i=e.left,o=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
364
364
  .`.concat(P8,` {
365
365
  overflow: hidden `).concat(r,`;
366
366
  padding-right: `).concat(a,"px ").concat(r,`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/webchat",
3
- "version": "2.1.15",
3
+ "version": "2.1.16",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.umd.cjs",