@botpress/webchat 2.2.17 → 2.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -5
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/webchat@2.2.
|
|
2
|
+
> @botpress/webchat@2.2.18 build /home/runner/work/echo/echo/packages/webchat-frontend
|
|
3
3
|
> vite build
|
|
4
4
|
|
|
5
5
|
[36mvite v4.4.11 [32mbuilding for production...[36m[39m
|
|
@@ -16,9 +16,9 @@ rendering chunks...
|
|
|
16
16
|
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
17
17
|
computing gzip size...
|
|
18
18
|
[2mdist/[22m[35mstyle.css [39m[1m[2m 29.84 kB[22m[1m[22m[2m │ gzip: 5.72 kB[22m
|
|
19
|
-
[2mdist/[22m[36mindex.js [39m[1m[33m1,044.
|
|
20
|
-
[32m[36m[vite:dts][32m Declaration files built in
|
|
19
|
+
[2mdist/[22m[36mindex.js [39m[1m[33m1,044.78 kB[39m[22m[2m │ gzip: 274.49 kB[22m
|
|
20
|
+
[32m[36m[vite:dts][32m Declaration files built in 14337ms.
|
|
21
21
|
[39m
|
|
22
22
|
[2mdist/[22m[35mstyle.css [39m[1m[2m 29.84 kB[22m[1m[22m[2m │ gzip: 5.72 kB[22m
|
|
23
|
-
[2mdist/[22m[36mindex.umd.cjs [39m[1m[33m712.
|
|
24
|
-
[32m✓ built in 24.
|
|
23
|
+
[2mdist/[22m[36mindex.umd.cjs [39m[1m[33m712.47 kB[39m[22m[2m │ gzip: 227.59 kB[22m
|
|
24
|
+
[32m✓ built in 24.02s[39m
|
package/dist/index.js
CHANGED
|
@@ -27565,7 +27565,7 @@ const az = su(
|
|
|
27565
27565
|
...r.poweredBy,
|
|
27566
27566
|
"data-hidden": d === !1,
|
|
27567
27567
|
hidden: d === !1,
|
|
27568
|
-
href: "https://botpress.com",
|
|
27568
|
+
href: "https://botpress.com/?from=webchat",
|
|
27569
27569
|
target: "_blank",
|
|
27570
27570
|
rel: "noopener noreferrer",
|
|
27571
27571
|
children: "⚡ by Botpress"
|
package/dist/index.umd.cjs
CHANGED
|
@@ -281,7 +281,7 @@ to {
|
|
|
281
281
|
* tabbable 6.2.0
|
|
282
282
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
283
283
|
*/var MU=["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])"],Yp=MU.join(","),dS=typeof Element>"u",ps=dS?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Nl=!dS&&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},Dl=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",a=i||n&&t&&e(t.parentNode);return a},NU=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},DU=function(t,n,r){if(Dl(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Yp));return n&&ps.call(t,Yp)&&o.unshift(t),o=o.filter(r),o},jU=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var a=i.shift();if(!Dl(a,!1))if(a.tagName==="SLOT"){var s=a.assignedElements(),c=s.length?s:a.children,l=e(c,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:a,candidates:l})}else{var u=ps.call(a,Yp);u&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var f=a.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(a),p=!Dl(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(f&&p){var d=e(f===!0?a.children:f.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:a,candidates:d})}else i.unshift.apply(i,a.children)}}return o},pS=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},hS=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||NU(t))&&!pS(t)?0:t.tabIndex},FU=function(t,n){var r=hS(t);return r<0&&n&&!pS(t)?0:r},LU=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},mS=function(t){return t.tagName==="INPUT"},BU=function(t){return mS(t)&&t.type==="hidden"},UU=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},zU=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},qU=function(t){if(!t.name)return!0;var n=t.form||Nl(t),r=function(s){return n.querySelectorAll('input[type="radio"][name="'+s+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(a){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",a.message),!1}var i=zU(o,t.form);return!i||i===t},HU=function(t){return mS(t)&&t.type==="radio"},VU=function(t){return HU(t)&&!qU(t)},WU=function(t){var n,r=t&&Nl(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var a,s,c;for(i=!!((a=o)!==null&&a!==void 0&&(s=a.ownerDocument)!==null&&s!==void 0&&s.contains(o)||t!=null&&(c=t.ownerDocument)!==null&&c!==void 0&&c.contains(t));!i&&o;){var l,u,f;r=Nl(o),o=(l=r)===null||l===void 0?void 0:l.host,i=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o))}}return i},yS=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},KU=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=ps.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(ps.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var s=t;t;){var c=t.parentElement,l=Nl(t);if(c&&!c.shadowRoot&&o(c)===!0)return yS(t);t.assignedSlot?t=t.assignedSlot:!c&&l!==t.ownerDocument?t=l.host:t=c}t=s}if(WU(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return yS(t);return!1},GU=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 o=n.children.item(r);if(o.tagName==="LEGEND")return ps.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},ZU=function(t,n){return!(n.disabled||Dl(n)||BU(n)||KU(n,t)||UU(n)||GU(n))},vS=function(t,n){return!(VU(n)||hS(n)<0||!ZU(t,n))},YU=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},JU=function e(t){var n=[],r=[];return t.forEach(function(o,i){var a=!!o.scopeParent,s=a?o.scopeParent:o,c=FU(s,a),l=a?e(o.candidates):s;c===0?a?n.push.apply(n,l):n.push(s):r.push({documentOrder:i,tabIndex:c,item:o,isScope:a,content:l})}),r.sort(LU).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},Jp=function(t,n){n=n||{};var r;return n.getShadowRoot?r=jU([t],n.includeContainer,{filter:vS.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:YU}):r=DU(t,n.includeContainer,vS.bind(null,n)),JU(r)};const Xp="ArrowUp",jl="ArrowDown",qi="ArrowLeft",hs="ArrowRight";function Fl(e,t,n){return Math.floor(e/t)!==n}function ms(e,t){return t<0||t>=e.current.length}function Qp(e,t){return nn(e,{disabledIndices:t})}function gS(e,t){return nn(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function nn(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:i=1}=t===void 0?{}:t;const a=e.current;let s=n;do{var c,l;s=s+(r?-i:i)}while(s>=0&&s<=a.length-1&&(o?o.includes(s):a[s]==null||(c=a[s])!=null&&c.hasAttribute("disabled")||((l=a[s])==null?void 0:l.getAttribute("aria-disabled"))==="true"));return s}function XU(e,t){let{event:n,orientation:r,loop:o,cols:i,disabledIndices:a,minIndex:s,maxIndex:c,prevIndex:l,stopEvent:u=!1}=t,f=l;if(n.key===Xp){if(u&&Wt(n),l===-1)f=c;else if(f=nn(e,{startingIndex:f,amount:i,decrement:!0,disabledIndices:a}),o&&(l-i<s||f<0)){const p=l%i,d=c%i,h=c-(d-p);d===p?f=c:f=d>p?h:h-i}ms(e,f)&&(f=l)}if(n.key===jl&&(u&&Wt(n),l===-1?f=s:(f=nn(e,{startingIndex:l,amount:i,disabledIndices:a}),o&&l+i>c&&(f=nn(e,{startingIndex:l%i-i,amount:i,disabledIndices:a}))),ms(e,f)&&(f=l)),r==="both"){const p=Ui(l/i);n.key===hs&&(u&&Wt(n),l%i!==i-1?(f=nn(e,{startingIndex:l,disabledIndices:a}),o&&Fl(f,i,p)&&(f=nn(e,{startingIndex:l-l%i-1,disabledIndices:a}))):o&&(f=nn(e,{startingIndex:l-l%i-1,disabledIndices:a})),Fl(f,i,p)&&(f=l)),n.key===qi&&(u&&Wt(n),l%i!==0?(f=nn(e,{startingIndex:l,disabledIndices:a,decrement:!0}),o&&Fl(f,i,p)&&(f=nn(e,{startingIndex:l+(i-l%i),decrement:!0,disabledIndices:a}))):o&&(f=nn(e,{startingIndex:l+(i-l%i),decrement:!0,disabledIndices:a})),Fl(f,i,p)&&(f=l));const d=Ui(c/i)===p;ms(e,f)&&(o&&d?f=n.key===qi?c:nn(e,{startingIndex:l-l%i-1,disabledIndices:a}):f=l)}return f}let bS=0;function Br(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(bS);const i=()=>e==null?void 0:e.focus({preventScroll:n});o?i():bS=requestAnimationFrame(i)}var Pt=typeof document<"u"?E.useLayoutEffect:E.useEffect;function Ll(){return Ll=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},Ll.apply(this,arguments)}let eh=!1,QU=0;const wS=()=>"floating-ui-"+QU++;function e9(){const[e,t]=C.useState(()=>eh?wS():void 0);return Pt(()=>{e==null&&t(wS())},[]),C.useEffect(()=>{eh||(eh=!0)},[]),e}const th=C["useId".toString()]||e9;function t9(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(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(o=>o!==n))||[])}}}const n9=C.createContext(null),r9=C.createContext(null),xS=()=>{var e;return((e=C.useContext(n9))==null?void 0:e.id)||null},Bl=()=>C.useContext(r9);function ys(e){return"data-floating-ui-"+e}function wo(e){const t=E.useRef(e);return Pt(()=>{t.current=e}),t}function o9(e,t){var n;let r=[],o=(n=e.find(i=>i.id===t))==null?void 0:n.parentId;for(;o;){const i=e.find(a=>a.id===o);o=i==null?void 0:i.parentId,i&&(r=r.concat(i))}return r}function Hi(e,t){let n=e.filter(o=>{var i;return o.parentId===t&&((i=o.context)==null?void 0:i.open)}),r=n;for(;r.length;)r=e.filter(o=>{var i;return(i=r)==null?void 0:i.some(a=>{var s;return o.parentId===a.id&&((s=o.context)==null?void 0:s.open)})}),n=n.concat(r);return n}function i9(e,t){let n,r=-1;function o(i,a){a>r&&(n=i,r=a),Hi(e,i).forEach(c=>{o(c.id,a+1)})}return o(t,0),e.find(i=>i.id===n)}let Vi=new WeakMap,Ul=new WeakSet,zl={},nh=0;const a9=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,SS=e=>e&&(e.host||SS(e.parentNode)),s9=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=SS(n);return e.contains(r)?r:null}).filter(n=>n!=null);function c9(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,a=s9(t,e),s=new Set,c=new Set(a),l=[];zl[o]||(zl[o]=new WeakMap);const u=zl[o];a.forEach(f),p(t),s.clear();function f(d){!d||s.has(d)||(s.add(d),d.parentNode&&f(d.parentNode))}function p(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,h=>{if(s.has(h))p(h);else{const m=i?h.getAttribute(i):null,v=m!==null&&m!=="false",y=(Vi.get(h)||0)+1,g=(u.get(h)||0)+1;Vi.set(h,y),u.set(h,g),l.push(h),y===1&&v&&Ul.add(h),g===1&&h.setAttribute(o,""),!v&&i&&h.setAttribute(i,"true")}})}return nh++,()=>{l.forEach(d=>{const h=(Vi.get(d)||0)-1,m=(u.get(d)||0)-1;Vi.set(d,h),u.set(d,m),h||(!Ul.has(d)&&i&&d.removeAttribute(i),Ul.delete(d)),m||d.removeAttribute(o)}),nh--,nh||(Vi=new WeakMap,Vi=new WeakMap,Ul=new WeakSet,zl={})}}function ES(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=Gn(e[0]).body;return c9(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const rh=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function _S(e,t){const n=Jp(e,rh());t==="prev"&&n.reverse();const r=n.indexOf(bo(Gn(e)));return n.slice(r+1)[0]}function $S(){return _S(document.body,"next")}function kS(){return _S(document.body,"prev")}function vs(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!yn(n,r)}function l9(e){Jp(e,rh()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function u9(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 oh={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 f9;function CS(e){e.key==="Tab"&&(e.target,clearTimeout(f9))}const ql=C.forwardRef(function(t,n){const[r,o]=C.useState();Pt(()=>(Yx()&&o("button"),document.addEventListener("keydown",CS),()=>{document.removeEventListener("keydown",CS)}),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[ys("focus-guard")]:"",style:oh};return C.createElement("span",Ll({},t,i))}),OS=C.createContext(null);function d9(e){let{id:t,root:n}=e===void 0?{}:e;const[r,o]=C.useState(null),i=th(),a=TS(),s=C.useMemo(()=>({id:t,root:n,portalContext:a,uniqueId:i}),[t,n,a,i]),c=C.useRef();return Pt(()=>()=>{r==null||r.remove()},[r,s]),Pt(()=>{if(c.current===s)return;c.current=s;const{id:l,root:u,portalContext:f,uniqueId:p}=s,d=l?document.getElementById(l):null,h=ys("portal");if(d){const m=document.createElement("div");m.id=p,m.setAttribute(h,""),d.appendChild(m),o(m)}else{let m=u||(f==null?void 0:f.portalNode);m&&!xt(m)&&(m=m.current),m=m||document.body;let v=null;l&&(v=document.createElement("div"),v.id=l,m.appendChild(v));const y=document.createElement("div");y.id=p,y.setAttribute(h,""),m=v||m,m.appendChild(y),o(y)}},[s]),r}function p9(e){let{children:t,id:n,root:r=null,preserveTabOrder:o=!0}=e;const i=d9({id:n,root:r}),[a,s]=C.useState(null),c=C.useRef(null),l=C.useRef(null),u=C.useRef(null),f=C.useRef(null),p=!!a&&!a.modal&&a.open&&o&&!!(r||i);return C.useEffect(()=>{if(!i||!o||a!=null&&a.modal)return;function d(h){i&&vs(h)&&(h.type==="focusin"?u9:l9)(i)}return i.addEventListener("focusin",d,!0),i.addEventListener("focusout",d,!0),()=>{i.removeEventListener("focusin",d,!0),i.removeEventListener("focusout",d,!0)}},[i,o,a==null?void 0:a.modal]),C.createElement(OS.Provider,{value:C.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:f,portalNode:i,setFocusManagerState:s}),[o,i])},p&&i&&C.createElement(ql,{"data-type":"outside",ref:c,onFocus:d=>{if(vs(d,i)){var h;(h=u.current)==null||h.focus()}else{const m=kS()||(a==null?void 0:a.refs.domReference.current);m==null||m.focus()}}}),p&&i&&C.createElement("span",{"aria-owns":i.id,style:oh}),i&&rr.createPortal(t,i),p&&i&&C.createElement(ql,{"data-type":"outside",ref:l,onFocus:d=>{if(vs(d,i)){var h;(h=f.current)==null||h.focus()}else{const m=$S()||(a==null?void 0:a.refs.domReference.current);m==null||m.focus(),a!=null&&a.closeOnFocusOut&&(a==null||a.onOpenChange(!1,d.nativeEvent))}}}))}const TS=()=>C.useContext(OS),h9=C.forwardRef(function(t,n){return C.createElement("button",Ll({},t,{type:"button",ref:n,tabIndex:-1,style:oh}))});function m9(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:a=0,returnFocus:s=!0,modal:c=!0,visuallyHiddenDismiss:l=!1,closeOnFocusOut:u=!0}=e,{open:f,refs:p,nodeId:d,onOpenChange:h,events:m,dataRef:v,elements:{domReference:y,floating:g}}=t,b=a9()?i:!0,k=wo(o),S=wo(a),$=wo(s),T=Bl(),R=TS(),B=typeof a=="number"&&a<0,O=C.useRef(null),M=C.useRef(null),H=C.useRef(!1),L=C.useRef(null),P=C.useRef(!1),N=R!=null,j=y&&y.getAttribute("role")==="combobox"&&Qx(y)&&B,W=C.useCallback(function(z){return z===void 0&&(z=g),z?Jp(z,rh()):[]},[g]),V=C.useCallback(z=>{const K=W(z);return k.current.map(_=>y&&_==="reference"?y:g&&_==="floating"?g:K).filter(Boolean).flat()},[y,g,k,W]);C.useEffect(()=>{if(r||!c)return;function z(_){if(_.key==="Tab"){yn(g,bo(Gn(g)))&&W().length===0&&!j&&Wt(_);const J=V(),ae=Xx(_);k.current[0]==="reference"&&ae===y&&(Wt(_),_.shiftKey?Br(J[J.length-1]):Br(J[1])),k.current[1]==="floating"&&ae===g&&_.shiftKey&&(Wt(_),Br(J[0]))}}const K=Gn(g);return K.addEventListener("keydown",z),()=>{K.removeEventListener("keydown",z)}},[r,y,g,c,k,p,j,W,V]),C.useEffect(()=>{if(r||!u)return;function z(){P.current=!0,setTimeout(()=>{P.current=!1})}function K(_){const J=_.relatedTarget;queueMicrotask(()=>{const ae=!(yn(y,J)||yn(g,J)||yn(J,g)||yn(R==null?void 0:R.portalNode,J)||J!=null&&J.hasAttribute(ys("focus-guard"))||T&&(Hi(T.nodesRef.current,d).find(re=>{var le,pe;return yn((le=re.context)==null?void 0:le.elements.floating,J)||yn((pe=re.context)==null?void 0:pe.elements.domReference,J)})||o9(T.nodesRef.current,d).find(re=>{var le,pe;return((le=re.context)==null?void 0:le.elements.floating)===J||((pe=re.context)==null?void 0:pe.elements.domReference)===J})));J&&ae&&!P.current&&J!==L.current&&(H.current=!0,h(!1,_))})}if(g&&tn(y))return y.addEventListener("focusout",K),y.addEventListener("pointerdown",z),!c&&g.addEventListener("focusout",K),()=>{y.removeEventListener("focusout",K),y.removeEventListener("pointerdown",z),!c&&g.removeEventListener("focusout",K)}},[r,y,g,c,d,T,R,h,u]),C.useEffect(()=>{var z;if(r)return;const K=Array.from((R==null||(z=R.portalNode)==null?void 0:z.querySelectorAll("["+ys("portal")+"]"))||[]);if(g){const _=[g,...K,O.current,M.current,k.current.includes("reference")||j?y:null].filter(ae=>ae!=null),J=c?ES(_,b,!b):ES(_);return()=>{J()}}},[r,y,g,c,k,R,j,b]),Pt(()=>{if(r||!g)return;const z=Gn(g),K=bo(z);queueMicrotask(()=>{const _=V(g),J=S.current,ae=(typeof J=="number"?_[J]:J.current)||g,re=yn(g,K);!B&&!re&&f&&Br(ae,{preventScroll:ae===g})})},[r,f,g,B,V,S]),Pt(()=>{if(r||!g)return;let z=!1;const K=Gn(g),_=bo(K),J=v.current;L.current=_;function ae(re){if(re.type==="escapeKey"&&p.domReference.current&&(L.current=p.domReference.current),["referencePress","escapeKey"].includes(re.type))return;const le=re.data.returnFocus;typeof le=="object"?(H.current=!1,z=le.preventScroll):H.current=!le}return m.on("dismiss",ae),()=>{m.off("dismiss",ae);const re=bo(K);(yn(g,re)||T&&Hi(T.nodesRef.current,d).some(pe=>{var me;return yn((me=pe.context)==null?void 0:me.elements.floating,re)})||J.openEvent&&["click","mousedown"].includes(J.openEvent.type))&&p.domReference.current&&(L.current=p.domReference.current),$.current&&tn(L.current)&&!H.current&&Br(L.current,{cancelPrevious:!1,preventScroll:z})}},[r,g,$,v,p,m,T,d]),Pt(()=>{if(!(r||!R))return R.setFocusManagerState({modal:c,closeOnFocusOut:u,open:f,onOpenChange:h,refs:p}),()=>{R.setFocusManagerState(null)}},[r,R,c,f,h,p,u]),Pt(()=>{if(!r&&g&&typeof MutationObserver=="function"&&!B){const z=()=>{const _=g.getAttribute("tabindex");k.current.includes("floating")||bo(Gn(g))!==p.domReference.current&&W().length===0?_!=="0"&&g.setAttribute("tabindex","0"):_!=="-1"&&g.setAttribute("tabindex","-1")};z();const K=new MutationObserver(z);return K.observe(g,{childList:!0,subtree:!0,attributes:!0}),()=>{K.disconnect()}}},[r,g,p,k,W,B]);function D(z){return r||!l||!c?null:C.createElement(h9,{ref:z==="start"?O:M,onClick:K=>h(!1,K.nativeEvent)},typeof l=="string"?l:"Dismiss")}const w=!r&&b&&!j&&(N||c);return C.createElement(C.Fragment,null,w&&C.createElement(ql,{"data-type":"inside",ref:R==null?void 0:R.beforeInsideRef,onFocus:z=>{if(c){const _=V();Br(o[0]==="reference"?_[0]:_[_.length-1])}else if(R!=null&&R.preserveTabOrder&&R.portalNode)if(H.current=!1,vs(z,R.portalNode)){const _=$S()||y;_==null||_.focus()}else{var K;(K=R.beforeOutsideRef.current)==null||K.focus()}}}),!j&&D("start"),n,D("end"),w&&C.createElement(ql,{"data-type":"inside",ref:R==null?void 0:R.afterInsideRef,onFocus:z=>{if(c)Br(V()[0]);else if(R!=null&&R.preserveTabOrder&&R.portalNode)if(u&&(H.current=!0),vs(z,R.portalNode)){const _=kS()||y;_==null||_.focus()}else{var K;(K=R.afterOutsideRef.current)==null||K.focus()}}}))}function AS(e){return tn(e.target)&&e.target.tagName==="BUTTON"}function PS(e){return Qx(e)}function y9(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:a=!0,event:s="click",toggle:c=!0,ignoreMouse:l=!1,keyboardHandlers:u=!0}=t,f=C.useRef(),p=C.useRef(!1);return C.useMemo(()=>a?{reference:{onPointerDown(d){f.current=d.pointerType},onMouseDown(d){d.button===0&&(Jx(f.current,!0)&&l||s!=="click"&&(n&&c&&(!o.current.openEvent||o.current.openEvent.type==="mousedown")?r(!1,d.nativeEvent):(d.preventDefault(),r(!0,d.nativeEvent))))},onClick(d){if(s==="mousedown"&&f.current){f.current=void 0;return}Jx(f.current,!0)&&l||(n&&c&&(!o.current.openEvent||o.current.openEvent.type==="click")?r(!1,d.nativeEvent):r(!0,d.nativeEvent))},onKeyDown(d){f.current=void 0,!(d.defaultPrevented||!u||AS(d))&&(d.key===" "&&!PS(i)&&(d.preventDefault(),p.current=!0),d.key==="Enter"&&r(!(n&&c),d.nativeEvent))},onKeyUp(d){d.defaultPrevented||!u||AS(d)||PS(i)||d.key===" "&&p.current&&(p.current=!1,r(!(n&&c),d.nativeEvent))}}}:{},[a,o,s,l,u,i,c,n,r])}const v9=C["useInsertionEffect".toString()]||(e=>e());function xo(e){const t=C.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return v9(()=>{t.current=e}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const g9={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},b9={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},w9=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 x9(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,nodeId:i,elements:{reference:a,domReference:s,floating:c},dataRef:l}=e,{enabled:u=!0,escapeKey:f=!0,outsidePress:p=!0,outsidePressEvent:d="pointerdown",referencePress:h=!1,referencePressEvent:m="pointerdown",ancestorScroll:v=!1,bubbles:y}=t,g=Bl(),b=xS()!=null,k=xo(typeof p=="function"?p:()=>!1),S=typeof p=="function"?k:p,$=C.useRef(!1),{escapeKeyBubbles:T,outsidePressBubbles:R}=w9(y),B=xo(M=>{if(!n||!u||!f||M.key!=="Escape")return;const H=g?Hi(g.nodesRef.current,i):[];if(!T&&(M.stopPropagation(),H.length>0)){let L=!0;if(H.forEach(P=>{var N;if((N=P.context)!=null&&N.open&&!P.context.dataRef.current.__escapeKeyBubbles){L=!1;return}}),!L)return}o.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),r(!1,cU(M)?M.nativeEvent:M)}),O=xo(M=>{const H=$.current;if($.current=!1,H||typeof S=="function"&&!S(M))return;const L=Xx(M),P="["+ys("inert")+"]",N=Gn(c).querySelectorAll(P);let j=xt(L)?L:null;for(;j&&!ds(j);){const D=Jo(j);if(D===Gn(c).body||!xt(D))break;j=D}if(N.length&&xt(L)&&!lU(L)&&!yn(L,c)&&Array.from(N).every(D=>!yn(j,D)))return;if(tn(L)&&c){const D=L.clientWidth>0&&L.scrollWidth>L.clientWidth,w=L.clientHeight>0&&L.scrollHeight>L.clientHeight;let z=w&&M.offsetX>L.clientWidth;if(w&&Cn(L).direction==="rtl"&&(z=M.offsetX<=L.offsetWidth-L.clientWidth),z||D&&M.offsetY>L.clientHeight)return}const W=g&&Hi(g.nodesRef.current,i).some(D=>{var w;return Gp(M,(w=D.context)==null?void 0:w.elements.floating)});if(Gp(M,c)||Gp(M,s)||W)return;const V=g?Hi(g.nodesRef.current,i):[];if(V.length>0){let D=!0;if(V.forEach(w=>{var z;if((z=w.context)!=null&&z.open&&!w.context.dataRef.current.__outsidePressBubbles){D=!1;return}}),!D)return}o.emit("dismiss",{type:"outsidePress",data:{returnFocus:b?{preventScroll:!0}:Gx(M)||Zx(M)}}),r(!1,M)});return C.useEffect(()=>{if(!n||!u)return;l.current.__escapeKeyBubbles=T,l.current.__outsidePressBubbles=R;function M(P){r(!1,P)}const H=Gn(c);f&&H.addEventListener("keydown",B),S&&H.addEventListener(d,O);let L=[];return v&&(xt(s)&&(L=go(s)),xt(c)&&(L=L.concat(go(c))),!xt(a)&&a&&a.contextElement&&(L=L.concat(go(a.contextElement)))),L=L.filter(P=>{var N;return P!==((N=H.defaultView)==null?void 0:N.visualViewport)}),L.forEach(P=>{P.addEventListener("scroll",M,{passive:!0})}),()=>{f&&H.removeEventListener("keydown",B),S&&H.removeEventListener(d,O),L.forEach(P=>{P.removeEventListener("scroll",M)})}},[l,c,s,a,f,S,d,n,r,v,u,T,R,B,O]),C.useEffect(()=>{$.current=!1},[S,d]),C.useMemo(()=>u?{reference:{onKeyDown:B,[g9[m]]:M=>{h&&(o.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),r(!1,M.nativeEvent))}},floating:{onKeyDown:B,[b9[d]]:()=>{$.current=!0}}}:{},[u,o,h,d,m,r,B])}let ih;process.env.NODE_ENV!=="production"&&(ih=new Set);function S9(e){var t;e===void 0&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e;if(process.env.NODE_ENV!=="production"){var i;const T="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((i=e.elements)!=null&&i.reference&&!xt(e.elements.reference)){var a;if(!((a=ih)!=null&&a.has(T))){var s;(s=ih)==null||s.add(T),console.error(T)}}}const[c,l]=C.useState(null),u=((t=e.elements)==null?void 0:t.reference)||c,f=RU(e),p=Bl(),d=xo((T,R)=>{T&&(m.current.openEvent=R),r==null||r(T,R)}),h=C.useRef(null),m=C.useRef({}),v=C.useState(()=>t9())[0],y=th(),g=C.useCallback(T=>{const R=xt(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;f.refs.setReference(R)},[f.refs]),b=C.useCallback(T=>{(xt(T)||T===null)&&(h.current=T,l(T)),(xt(f.refs.reference.current)||f.refs.reference.current===null||T!==null&&!xt(T))&&f.refs.setReference(T)},[f.refs]),k=C.useMemo(()=>({...f.refs,setReference:b,setPositionReference:g,domReference:h}),[f.refs,b,g]),S=C.useMemo(()=>({...f.elements,domReference:u}),[f.elements,u]),$=C.useMemo(()=>({...f,refs:k,elements:S,dataRef:m,nodeId:o,floatingId:y,events:v,open:n,onOpenChange:d}),[f,o,y,v,n,d,k,S]);return Pt(()=>{const T=p==null?void 0:p.nodesRef.current.find(R=>R.id===o);T&&(T.context=$)}),C.useMemo(()=>({...f,context:$,refs:k,elements:S}),[f,k,S,$])}function ah(e,t,n){const r=new Map;return{...n==="floating"&&{tabIndex:-1},...e,...t.map(o=>o?o[n]:null).concat(e).reduce((o,i)=>(i&&Object.entries(i).forEach(a=>{let[s,c]=a;if(s.indexOf("on")===0){if(r.has(s)||r.set(s,[]),typeof c=="function"){var l;(l=r.get(s))==null||l.push(c),o[s]=function(){for(var u,f=arguments.length,p=new Array(f),d=0;d<f;d++)p[d]=arguments[d];return(u=r.get(s))==null?void 0:u.map(h=>h(...p)).find(h=>h!==void 0)}}}else o[s]=c}),o),{})}}function E9(e){e===void 0&&(e=[]);const t=e,n=C.useCallback(i=>ah(i,e,"reference"),t),r=C.useCallback(i=>ah(i,e,"floating"),t),o=C.useCallback(i=>ah(i,e,"item"),e.map(i=>i==null?void 0:i.item));return C.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o}),[n,r,o])}let IS=!1;function Hl(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function RS(e,t){return Hl(t,e===Xp||e===jl,e===qi||e===hs)}function sh(e,t,n){return Hl(t,e===jl,n?e===qi:e===hs)||e==="Enter"||e==" "||e===""}function _9(e,t,n){return Hl(t,n?e===qi:e===hs,e===jl)}function MS(e,t,n){return Hl(t,n?e===hs:e===qi,e===Xp)}function $9(e,t){const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:a}}=e,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:f=null,allowEscape:p=!1,loop:d=!1,nested:h=!1,rtl:m=!1,virtual:v=!1,focusItemOnOpen:y="auto",focusItemOnHover:g=!0,openOnArrowKeyDown:b=!0,disabledIndices:k=void 0,orientation:S="vertical",cols:$=1,scrollItemIntoView:T=!0,virtualItemRef:R}=t;process.env.NODE_ENV!=="production"&&(p&&(d||console.warn(["Floating UI: `useListNavigation` looping must be enabled to allow","escaping."].join(" ")),v||console.warn(["Floating UI: `useListNavigation` must be virtual to allow","escaping."].join(" "))),S==="vertical"&&$>1&&console.warn(["Floating UI: In grid list navigation mode (`cols` > 1), the",'`orientation` should be either "horizontal" or "both".'].join(" ")));const B=xS(),O=Bl(),M=xo(l),H=C.useRef(y),L=C.useRef(f??-1),P=C.useRef(null),N=C.useRef(!0),j=C.useRef(M),W=C.useRef(!!a),V=C.useRef(!1),D=C.useRef(!1),w=wo(k),z=wo(n),K=wo(T),[_,J]=C.useState(),[ae,re]=C.useState(),le=xo(function(ce,Q,G){G===void 0&&(G=!1);const fe=ce.current[Q.current];fe&&(v?(J(fe.id),O==null||O.events.emit("virtualfocus",fe),R&&(R.current=fe)):Br(fe,{preventScroll:!0,sync:sU()&&Yx()?IS||V.current:!1}),requestAnimationFrame(()=>{const ve=K.current;ve&&fe&&(G||!N.current)&&(fe.scrollIntoView==null||fe.scrollIntoView(typeof ve=="boolean"?{block:"nearest",inline:"nearest"}:ve))}))});Pt(()=>{document.createElement("div").focus({get preventScroll(){return IS=!0,!1}})},[]),Pt(()=>{u&&(n&&a?H.current&&f!=null&&(D.current=!0,M(f)):W.current&&(L.current=-1,j.current(null)))},[u,n,a,f,M]),Pt(()=>{if(u&&n&&a)if(c==null){if(V.current=!1,f!=null)return;if(W.current&&(L.current=-1,le(s,L)),!W.current&&H.current&&(P.current!=null||H.current===!0&&P.current==null)){let ce=0;const Q=()=>{s.current[0]==null?(ce<2&&(ce?requestAnimationFrame:queueMicrotask)(Q),ce++):(L.current=P.current==null||sh(P.current,S,m)||h?Qp(s,w.current):gS(s,w.current),P.current=null,M(L.current))};Q()}}else ms(s,c)||(L.current=c,le(s,L,D.current),D.current=!1)},[u,n,a,c,f,h,s,S,m,M,le,w]),Pt(()=>{var ce,Q;if(!u||a||!O||v||!W.current)return;const G=O.nodesRef.current,fe=(ce=G.find(I=>I.id===B))==null||(Q=ce.context)==null?void 0:Q.elements.floating,ve=bo(Gn(a)),_e=G.some(I=>I.context&&yn(I.context.elements.floating,ve));fe&&!_e&&N.current&&fe.focus({preventScroll:!0})},[u,a,O,B,v]),Pt(()=>{if(!u||!O||!v||B)return;function ce(Q){re(Q.id),R&&(R.current=Q)}return O.events.on("virtualfocus",ce),()=>{O.events.off("virtualfocus",ce)}},[u,O,v,B,R]),Pt(()=>{j.current=M,W.current=!!a}),Pt(()=>{n||(P.current=null)},[n]);const pe=c!=null,me=C.useMemo(()=>{function ce(G){if(!n)return;const fe=s.current.indexOf(G);fe!==-1&&M(fe)}return{onFocus(G){let{currentTarget:fe}=G;ce(fe)},onClick:G=>{let{currentTarget:fe}=G;return fe.focus({preventScroll:!0})},...g&&{onMouseMove(G){let{currentTarget:fe}=G;ce(fe)},onPointerLeave(G){let{pointerType:fe}=G;!N.current||fe==="touch"||(L.current=-1,le(s,L),M(null),v||Br(o.floating.current,{preventScroll:!0}))}}}},[n,o,le,g,s,M,v]);return C.useMemo(()=>{if(!u)return{};const ce=w.current;function Q(I){if(N.current=!1,V.current=!0,!z.current&&I.currentTarget===o.floating.current)return;if(h&&MS(I.key,S,m)){Wt(I),r(!1,I.nativeEvent),tn(i)&&!v&&i.focus();return}const X=L.current,oe=Qp(s,ce),ee=gS(s,ce);if(I.key==="Home"&&(Wt(I),L.current=oe,M(L.current)),I.key==="End"&&(Wt(I),L.current=ee,M(L.current)),!($>1&&(L.current=XU(s,{event:I,orientation:S,loop:d,cols:$,disabledIndices:ce,minIndex:oe,maxIndex:ee,prevIndex:L.current,stopEvent:!0}),M(L.current),S==="both"))&&RS(I.key,S)){if(Wt(I),n&&!v&&bo(I.currentTarget.ownerDocument)===I.currentTarget){L.current=sh(I.key,S,m)?oe:ee,M(L.current);return}sh(I.key,S,m)?d?L.current=X>=ee?p&&X!==s.current.length?-1:oe:nn(s,{startingIndex:X,disabledIndices:ce}):L.current=Math.min(ee,nn(s,{startingIndex:X,disabledIndices:ce})):d?L.current=X<=oe?p&&X!==-1?s.current.length:ee:nn(s,{startingIndex:X,decrement:!0,disabledIndices:ce}):L.current=Math.max(oe,nn(s,{startingIndex:X,decrement:!0,disabledIndices:ce})),ms(s,L.current)?M(null):M(L.current)}}function G(I){y==="auto"&&Gx(I.nativeEvent)&&(H.current=!0)}function fe(I){H.current=y,y==="auto"&&Zx(I.nativeEvent)&&(H.current=!0)}const ve=v&&n&&pe&&{"aria-activedescendant":ae||_},_e=s.current.find(I=>(I==null?void 0:I.id)===_);return{reference:{...ve,onKeyDown(I){N.current=!1;const X=I.key.indexOf("Arrow")===0,oe=_9(I.key,S,m),ee=MS(I.key,S,m),Se=RS(I.key,S),xe=(h?oe:Se)||I.key==="Enter"||I.key.trim()==="";if(v&&n){const U=O==null?void 0:O.nodesRef.current.find(q=>q.parentId==null),Z=O&&U?i9(O.nodesRef.current,U.id):null;if(X&&Z&&R){const q=new KeyboardEvent("keydown",{key:I.key,bubbles:!0});if(oe||ee){var ke,Fe;const te=((ke=Z.context)==null?void 0:ke.elements.domReference)===I.currentTarget,de=ee&&!te?(Fe=Z.context)==null?void 0:Fe.elements.domReference:oe?_e:null;de&&(Wt(I),de.dispatchEvent(q),re(void 0))}if(Se&&Z.context&&Z.context.open&&Z.parentId&&I.currentTarget!==Z.context.elements.domReference){var Te;Wt(I),(Te=Z.context.elements.domReference)==null||Te.dispatchEvent(q);return}}return Q(I)}if(!(!n&&!b&&X)){if(xe&&(P.current=h&&Se?null:I.key),h){oe&&(Wt(I),n?(L.current=Qp(s,ce),M(L.current)):r(!0,I.nativeEvent));return}Se&&(f!=null&&(L.current=f),Wt(I),!n&&b?r(!0,I.nativeEvent):Q(I),n&&M(L.current))}},onFocus(){n&&M(null)},onPointerDown:fe,onMouseDown:G,onClick:G},floating:{"aria-orientation":S==="both"?void 0:S,...ve,onKeyDown:Q,onPointerMove(){N.current=!0}},item:me}},[i,o,_,ae,w,z,s,u,S,m,v,n,pe,h,f,b,p,$,d,y,M,r,me,O,R])}function k9(e,t){t===void 0&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,a=th();return C.useMemo(()=>{const s={id:r,role:i};return o?i==="tooltip"?{reference:{"aria-describedby":n?r:void 0},floating:s}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":i==="alertdialog"?"dialog":i,"aria-controls":n?r:void 0,...i==="listbox"&&{role:"combobox"},...i==="menu"&&{id:a}},floating:{...s,...i==="menu"&&{"aria-labelledby":a}}}:{}},[o,i,n,r,a])}function C9(e,t){var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:a,onMatch:s,onTypingChange:c,enabled:l=!0,findMatch:u=null,resetMs:f=750,ignoreKeys:p=[],selectedIndex:d=null}=t,h=C.useRef(),m=C.useRef(""),v=C.useRef((n=d??a)!=null?n:-1),y=C.useRef(null),g=xo(s),b=xo(c),k=wo(u),S=wo(p);return Pt(()=>{r&&(clearTimeout(h.current),y.current=null,m.current="")},[r]),Pt(()=>{if(r&&m.current===""){var $;v.current=($=d??a)!=null?$:-1}},[r,d,a]),C.useMemo(()=>{if(!l)return{};function $(B){B?o.current.typing||(o.current.typing=B,b(B)):o.current.typing&&(o.current.typing=B,b(B))}function T(B,O,M){const H=k.current?k.current(O,M):O.find(L=>(L==null?void 0:L.toLocaleLowerCase().indexOf(M.toLocaleLowerCase()))===0);return H?B.indexOf(H):-1}function R(B){const O=i.current;if(m.current.length>0&&m.current[0]!==" "&&(T(O,O,m.current)===-1?$(!1):B.key===" "&&Wt(B)),O==null||S.current.includes(B.key)||B.key.length!==1||B.ctrlKey||B.metaKey||B.altKey)return;r&&B.key!==" "&&(Wt(B),$(!0)),O.every(P=>{var N,j;return P?((N=P[0])==null?void 0:N.toLocaleLowerCase())!==((j=P[1])==null?void 0:j.toLocaleLowerCase()):!0})&&m.current===B.key&&(m.current="",v.current=y.current),m.current+=B.key,clearTimeout(h.current),h.current=setTimeout(()=>{m.current="",v.current=y.current,$(!1)},f);const H=v.current,L=T(O,[...O.slice((H||0)+1),...O.slice(0,(H||0)+1)],m.current);L!==-1?(g(L),y.current=L):B.key!==" "&&(m.current="",$(!1))}return{reference:{onKeyDown:R},floating:{onKeyDown:R,onKeyUp(B){B.key===" "&&$(!1)}}}},[l,r,o,i,f,S,k,g,b])}const O9=({options:e,label:t,reusable:n})=>{var j,W,V,D,w;const r=Pe(z=>z.sendTextMessage),o=Pe(z=>z.messageContainerRef),i=Pe(z=>z.isReadOnly),[a,s]=C.useState(!1),[c,l]=C.useState(null),[u,f]=C.useState(null),{message:{blocks:{dropdown:p}}}=ct,d=e.reduce((z,K)=>(z[K.label]=K.value,z),{}),h=d?Object.keys(d):[],m=z=>{s(u!==null&&!n?!1:z)},{refs:v,floatingStyles:y,context:g}=S9({placement:"bottom-start",open:a,onOpenChange:m,whileElementsMounted:PU,middleware:[pU(5),hU({padding:10,boundary:(o==null?void 0:o.current)??void 0,crossAxis:!0}),mU({apply({rects:z,elements:K,availableHeight:_}){Object.assign(K.floating.style,{maxHeight:`${_}px`,minWidth:`${z.reference.width}px`})},padding:10})]}),b=C.useRef([]),k=C.useRef(h),S=C.useRef(!1),$=y9(g,{event:"mousedown"}),T=x9(g),R=k9(g,{role:"listbox"}),B=$9(g,{listRef:b,activeIndex:c,selectedIndex:u,onNavigate:l,loop:!0}),O=C9(g,{listRef:k,activeIndex:c,selectedIndex:u,onMatch:a?l:f,onTypingChange(z){S.current=z}}),{getReferenceProps:M,getFloatingProps:H,getItemProps:L}=E9([T,R,B,O,$]),P=z=>{f(z),r(d[h[z]]),s(!1)},N=u!==null?h[u]:void 0;return F.jsxs(F.Fragment,{children:[F.jsxs("div",{tabIndex:0,ref:v.setReference,"aria-labelledby":"select-label","aria-autocomplete":"none","data-disabled":u!==null&&!n?"":void 0,...(j=p.button)==null?void 0:j.container,...M(),children:[F.jsx("span",{...(W=p.button)==null?void 0:W.text,children:N||t||"Select..."}),F.jsx(e7,{...(V=p.button)==null?void 0:V.icon})]}),a&&F.jsx(p9,{children:F.jsx(m9,{context:g,modal:!1,children:F.jsx("div",{ref:v.setFloating,className:(w=(D=p.content)==null?void 0:D.container)==null?void 0:w.className,style:{...y},...H(),children:h.map((z,K)=>{var _;return F.jsx("div",{ref:J=>{b.current[K]=J},role:"option",tabIndex:K===c?0:-1,"aria-selected":K===u&&K===c,"data-active":K===c?"":void 0,...(_=p.content)==null?void 0:_.item,...L({onClick(){i||P(K)},onKeyDown(J){i||(J.key==="Enter"&&(J.preventDefault(),P(K)),J.key===" "&&!S.current&&(J.preventDefault(),P(K)))}}),children:z},z)})})})})]})},T9=E.forwardRef(({type:e,title:t,url:n,...r},o)=>{const{message:{blocks:{file:i}}}=ct;return F.jsxs("a",{...r,...i.container,href:n,download:!0,ref:o,target:"_blank",rel:"noreferrer",children:[F.jsx("p",{...i.title,children:t||n}),F.jsx(n7,{...i.icon})]})}),NS={audio:G6,bubble:q6,button:U6,carousel:Q7,column:a7,dropdown:O9,file:T9,image:V6,location:i7,row:s7,text:FD,video:K6},Wi=({block:e,...t})=>{const r=Pe(i=>i.renderers)[e.type]??NS[e.type],o={...t,...e};return F.jsx(r,{...o})};function A9({title:e,titleId:t,...n},r){return C.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?C.createElement("title",{id:t},e):null,C.createElement("path",{fillRule:"evenodd",d:"M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z",clipRule:"evenodd"}))}const P9=C.forwardRef(A9);function I9({title:e,titleId:t,...n},r){return C.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?C.createElement("title",{id:t},e):null,C.createElement("path",{d:"M8 1a2 2 0 0 0-2 2v4a2 2 0 1 0 4 0V3a2 2 0 0 0-2-2Z"}),C.createElement("path",{d:"M4.5 7A.75.75 0 0 0 3 7a5.001 5.001 0 0 0 4.25 4.944V13.5h-1.5a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-1.5v-1.556A5.001 5.001 0 0 0 13 7a.75.75 0 0 0-1.5 0 3.5 3.5 0 1 1-7 0Z"}))}const R9=C.forwardRef(I9);function M9({title:e,titleId:t,...n},r){return C.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?C.createElement("title",{id:t},e):null,C.createElement("path",{d:"M8.75 3.75a.75.75 0 0 0-1.5 0v3.5h-3.5a.75.75 0 0 0 0 1.5h3.5v3.5a.75.75 0 0 0 1.5 0v-3.5h3.5a.75.75 0 0 0 0-1.5h-3.5v-3.5Z"}))}const N9=C.forwardRef(M9);function D9(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var j9=E.useLayoutEffect,F9=function(t){var n=C.useRef(t);return j9(function(){n.current=t}),n},DS=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},L9=function(t,n){var r=E.useRef();return E.useCallback(function(o){t.current=o,r.current&&DS(r.current,null),r.current=n,n&&DS(n,o)},[n])},jS={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},B9=function(t){Object.keys(jS).forEach(function(n){t.style.setProperty(n,jS[n],"important")})},FS=B9,un=null,LS=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function U9(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),un||(un=document.createElement("textarea"),un.setAttribute("tabindex","-1"),un.setAttribute("aria-hidden","true"),FS(un)),un.parentNode===null&&document.body.appendChild(un);var o=e.paddingSize,i=e.borderSize,a=e.sizingStyle,s=a.boxSizing;Object.keys(a).forEach(function(p){var d=p;un.style[d]=a[d]}),FS(un),un.value=t;var c=LS(un,e);un.value=t,c=LS(un,e),un.value="x";var l=un.scrollHeight-o,u=l*n;s==="border-box"&&(u=u+o+i),c=Math.max(u,c);var f=l*r;return s==="border-box"&&(f=f+o+i),c=Math.min(f,c),[c,l]}var BS=function(){},z9=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},q9=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],H9=!!document.documentElement.currentStyle,V9=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=z9(q9,n),o=r.boxSizing;if(o==="")return null;H9&&o==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),a=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:a}},W9=V9;function US(e,t,n){var r=F9(n);C.useLayoutEffect(function(){var o=function(a){return r.current(a)};if(e)return e.addEventListener(t,o),function(){return e.removeEventListener(t,o)}},[])}var K9=function(t){US(window,"resize",t)},G9=function(t){US(document.fonts,"loadingdone",t)},Z9=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],Y9=function(t,n){var r=t.cacheMeasurements,o=t.maxRows,i=t.minRows,a=t.onChange,s=a===void 0?BS:a,c=t.onHeightChange,l=c===void 0?BS:c,u=D9(t,Z9),f=u.value!==void 0,p=C.useRef(null),d=L9(p,n),h=C.useRef(0),m=C.useRef(),v=function(){var b=p.current,k=r&&m.current?m.current:W9(b);if(k){m.current=k;var S=U9(k,b.value||b.placeholder||"x",i,o),$=S[0],T=S[1];h.current!==$&&(h.current=$,b.style.setProperty("height",$+"px","important"),l($,{rowHeight:T}))}},y=function(b){f||v(),s(b)};return C.useLayoutEffect(v),K9(v),G9(v),C.createElement("textarea",no({},u,{onChange:y,ref:d}))},J9=C.forwardRef(Y9);const zS=E.memo(E.forwardRef(({children:e,...t},n)=>{const{composer:r}=ct,o=Pe(P=>P.disableComposer),i=Pe(P=>P.setIsTyping),a=Pe(P=>P.isReadOnly),s=Pe(P=>P.sendFile),c=Pe(P=>P.addMessage),l=Pe(P=>P.sendTextMessage),u=Pe(P=>P.allowFileUpload),f=Pe(P=>P.connected),{composerPlaceholder:p,showPoweredBy:d}=Mx(),[h,m]=E.useState(""),[v,y]=E.useState(-1),[g,b]=E.useState(!1),k=E.useRef(null),S=E.useRef(null),$=_n(P=>P.user),T=_n(P=>P.messageHistory);if(a)return null;const R=()=>{var P;k.current&&((P=k.current)==null||P.click())},B=o||a||!f,O=async P=>{var j;const N=(j=P.target.files)==null?void 0:j[0];if(N)try{const{fileUrl:W,type:V}=await s(N)??"";c({direction:"outgoing",sender:{name:"You"},timestamp:new Date,disableInput:!1,block:{type:V,url:W}})}catch(W){console.error("Error sending file:",W)}},M=window.SpeechRecognition||window.webkitSpeechRecognition,H=()=>{S.current||(S.current=new M);const P=S.current;P&&(P.continuous=!0,P.onresult=N=>{const j=N.results[0][0].transcript;m(j),P.stop(),b(!1)},g?(P.stop(),b(!1)):(P.start(),b(!0)))},L=()=>{h&&(l(h),setTimeout(()=>i(!0,9e3),500),m(""),y(-1))};return F.jsxs(F.Fragment,{children:[F.jsxs("div",{"data-disabled":B,...t,...r.container,ref:n,children:[u&&F.jsxs(F.Fragment,{children:[F.jsx("button",{type:"button",disabled:B,...r.uploadButton.container,onClick:R,children:F.jsx(N9,{...r.uploadButton.icon})}),F.jsx("input",{type:"file",ref:k,style:{display:"none"},onChange:O})]}),F.jsx(J9,{...r==null?void 0:r.input,placeholder:p??"Type your message...",disabled:B,value:h,"data-has-value":!!h,onChange:P=>m(P.target.value),maxRows:5,onKeyDown:P=>{if(!B){if(P.key==="Enter"&&P.shiftKey?(P.preventDefault(),m(`${h}
|
|
284
|
-
`)):P.key==="Enter"&&(P.preventDefault(),L()),P.key==="ArrowUp"){P.preventDefault();const N=T[($==null?void 0:$.userId)??""]??[];v<N.length-1&&m(N[v+1]),y(()=>Math.min(v+1,N.length-1))}if(P.key==="ArrowDown"){P.preventDefault();const N=T[($==null?void 0:$.userId)??""]??[];m(v===0?"":N[v-1]),y(()=>Math.max(v-1,-1))}}}}),h&&F.jsx("button",{type:"button","aria-label":"Send message",...r.button.container,disabled:!h||B,onClick:L,children:F.jsx(P9,{...r.button.icon})}),!h&&M&&F.jsx("button",{type:"button","aria-label":"Activate voice input",...r.voiceButton.container,disabled:!!h,onClick:H,"data-listens":!!g,children:F.jsx(R9,{...r.voiceButton.icon})})]}),F.jsx("a",{...r.poweredBy,"data-hidden":d===!1,hidden:d===!1,href:"https://botpress.com",target:"_blank",rel:"noopener noreferrer",children:"⚡ by Botpress"})]})})),qS=({children:e})=>{const[t,n]=E.useState(!1),[r,o]=E.useState(""),[i,a]=E.useState(null),s=({title:l,content:u})=>{o(l),a(u),n(!0)},c=()=>{n(!1)};return F.jsxs(Px.Provider,{value:{hideModal:c,showModal:s,title:r,content:i,open:t},children:[F.jsx(Eo,{open:t,onOpenChange:n,children:F.jsx(Eo.Content,{title:r,children:i})}),e]})},iue="";var HS={},ch={},Vl=be&&be.__assign||function(){return Vl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Vl.apply(this,arguments)};Object.defineProperty(ch,"__esModule",{value:!0});var X9={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function Q9(e){var t=Vl(Vl({},X9),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}ch.getSanitizedOptions=Q9;var lh={},uh={},Wl={},fh={},dh={};Object.defineProperty(dh,"__esModule",{value:!0});function e8(e){var t=Math.random()*e;return Math.round(t)}dh.fullJitter=e8;var ph={};Object.defineProperty(ph,"__esModule",{value:!0});function t8(e){return e}ph.noJitter=t8,Object.defineProperty(fh,"__esModule",{value:!0});var n8=dh,r8=ph;function o8(e){switch(e.jitter){case"full":return n8.fullJitter;case"none":default:return r8.noJitter}}fh.JitterFactory=o8,Object.defineProperty(Wl,"__esModule",{value:!0});var i8=fh,a8=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(n){return setTimeout(n,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=i8.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,n=this.options.timeMultiple,r=this.numOfDelayedAttempts,o=t*Math.pow(n,r);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Wl.Delay=a8;var s8=be&&be.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),c8=be&&be.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(u){try{l(r.next(u))}catch(f){a(f)}}function c(u){try{l(r.throw(u))}catch(f){a(f)}}function l(u){u.done?i(u.value):o(u.value).then(s,c)}l((r=r.apply(e,t||[])).next())})},l8=be&&be.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(u){l=[6,u],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Object.defineProperty(uh,"__esModule",{value:!0});var u8=Wl,f8=function(e){s8(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return c8(this,void 0,void 0,function(){return l8(this,function(n){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(u8.Delay);uh.SkipFirstDelay=f8;var hh={},d8=be&&be.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(hh,"__esModule",{value:!0});var p8=Wl,h8=function(e){d8(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(p8.Delay);hh.AlwaysDelay=h8,Object.defineProperty(lh,"__esModule",{value:!0});var m8=uh,y8=hh;function v8(e,t){var n=g8(e);return n.setAttemptNumber(t),n}lh.DelayFactory=v8;function g8(e){return e.delayFirstAttempt?new y8.AlwaysDelay(e):new m8.SkipFirstDelay(e)}var mh=be&&be.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(u){try{l(r.next(u))}catch(f){a(f)}}function c(u){try{l(r.throw(u))}catch(f){a(f)}}function l(u){u.done?i(u.value):o(u.value).then(s,c)}l((r=r.apply(e,t||[])).next())})},yh=be&&be.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(u){l=[6,u],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Object.defineProperty(HS,"__esModule",{value:!0});var b8=ch,w8=lh;function x8(e,t){return t===void 0&&(t={}),mh(this,void 0,void 0,function(){var n,r;return yh(this,function(o){switch(o.label){case 0:return n=b8.getSanitizedOptions(t),r=new E8(e,n),[4,r.execute()];case 1:return[2,o.sent()]}})})}var S8=HS.backOff=x8,E8=function(){function e(t,n){this.request=t,this.options=n,this.attemptNumber=0}return e.prototype.execute=function(){return mh(this,void 0,void 0,function(){var t,n;return yh(this,function(r){switch(r.label){case 0:if(this.attemptLimitReached)return[3,7];r.label=1;case 1:return r.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return r.sent(),[4,this.request()];case 3:return[2,r.sent()];case 4:return t=r.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(n=r.sent(),!n||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return mh(this,void 0,void 0,function(){var t;return yh(this,function(n){switch(n.label){case 0:return t=w8.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return n.sent(),[2]}})})},e}();const _8=({children:e,...t})=>{const n=E.useRef(),r=E.useRef(null),o=B6({...t,messageContainerRef:r});return n.current||(n.current=o),F.jsx(Rx.Provider,{value:{...t.configuration},children:F.jsx(Tx.Provider,{value:n.current,children:F.jsx($8,{children:e})})})},$8=({children:e})=>{const t=Pe(b=>b.client),n=Pe(b=>b.addMessage),r=Pe(b=>b.setMessages),o=Pe(b=>b.configuration),i=Pe(b=>b.setConnected),a=Pe(b=>b.userData),s=Pe(b=>b.userName),c=Pe(b=>b.userPictureUrl),l=Pe(b=>b.setIsTyping),u=Pe(b=>b.getMessages),f=Pe(b=>b.setHeaderMessage),p=Pe(b=>b.setDisableComposer),d=_n(b=>b.setConversationId),h=_n(b=>b.user),m=_n(b=>b.conversationId),v=_n(b=>b.setUser),[y,g]=E.useState(0);return E.useEffect(()=>{if(t)return t.on("messageSent",b=>{const k=u(),S=k[k.length-1];(k.length===0||S.block.type==="bubble"&&S.block.block.type==="text"&&S.block.block.text!==b)&&n({direction:"outgoing",sender:{name:"You"},timestamp:new Date,block:{type:"bubble",block:{type:"text",text:b}},disableInput:!1})})},[m]),E.useEffect(()=>{if(t)return t.on("message",b=>{try{const{payload:k,disableInput:S,id:$,conversationId:T}=b;if(m!==T)return;l(!1,0),n({id:$,direction:"incoming",sender:{name:o.botName??"Bot",avatar:o.botAvatar},timestamp:new Date(b.sentOn),block:k,disableInput:S})}catch{console.error("Invalid message payload")}})},[m]),E.useEffect(()=>{if(t)return t.on("conversation",b=>{d(b)})},[]),vx(async()=>{if(t)return t.on("error",()=>{g(b=>b+1)})}),vx(async()=>{if(!t||m&&t.conversationId===m)return;let b;try{f("Connecting..."),p(!0),b=await S8(()=>t.connect(h,a,{name:s,pictureUrl:c}),{maxDelay:1e4,numOfAttempts:1/0}),f(void 0),p(!1),i(!0)}catch(S){console.error(S),f("Connection failed. Please try again later."),i(!1);return}v(b),m&&await t.conversationExists(m)?await t.switchConversation(m):await t.newConversation();const k=[];for(const S of await t.listMessages())try{const{payload:$,authorId:T,sentOn:R,disableInput:B,id:O}=S,M=T===t.userId?"outgoing":"incoming";k.push({id:O,direction:M,sender:M==="outgoing"?{name:"You"}:{name:o.botName??"Bot",avatar:o.botAvatar},timestamp:new Date(R),block:$,disableInput:B})}catch{console.error("Invalid message payload")}return r(k.reverse()),()=>{t.disconnect()}},[y,m]),F.jsx(F.Fragment,{children:e})};function Ur(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}const k8=C["useId".toString()]||(()=>{});let C8=0;function Kl(e){const[t,n]=C.useState(k8());return Pa(()=>{e||n(r=>r??String(C8++))},[e]),e||(t?`radix-${t}`:"")}function VS({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=O8({defaultProp:t,onChange:n}),i=e!==void 0,a=i?e:r,s=to(n),c=E.useCallback(l=>{if(i){const f=typeof l=="function"?l(e):l;f!==e&&s(f)}else o(l)},[i,e,o,s]);return[a,c]}function O8({defaultProp:e,onChange:t}){const n=E.useState(e),[r]=n,o=E.useRef(r),i=to(t);return E.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function T8(e,t=globalThis==null?void 0:globalThis.document){const n=to(e);E.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const vh="dismissableLayer.update",A8="dismissableLayer.pointerDownOutside",P8="dismissableLayer.focusOutside";let WS;const I8=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),R8=E.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:s,onDismiss:c,...l}=e,u=E.useContext(I8),[f,p]=E.useState(null),d=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,h]=E.useState({}),m=Mo(t,R=>p(R)),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(y),b=f?v.indexOf(f):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=g,$=M8(R=>{const B=R.target,O=[...u.branches].some(M=>M.contains(B));!S||O||(i==null||i(R),s==null||s(R),R.defaultPrevented||c==null||c())},d),T=N8(R=>{const B=R.target;[...u.branches].some(M=>M.contains(B))||(a==null||a(R),s==null||s(R),R.defaultPrevented||c==null||c())},d);return T8(R=>{b===u.layers.size-1&&(o==null||o(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))},d),E.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(WS=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),KS(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=WS)}},[f,d,r,u]),E.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),KS())},[f,u]),E.useEffect(()=>{const R=()=>h({});return document.addEventListener(vh,R),()=>document.removeEventListener(vh,R)},[]),E.createElement(In.div,no({},l,{ref:m,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:Ur(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Ur(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Ur(e.onPointerDownCapture,$.onPointerDownCapture)}))});function M8(e,t=globalThis==null?void 0:globalThis.document){const n=to(e),r=E.useRef(!1),o=E.useRef(()=>{});return E.useEffect(()=>{const i=s=>{if(s.target&&!r.current){let l=function(){GS(A8,n,c,{discrete:!0})};const c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function N8(e,t=globalThis==null?void 0:globalThis.document){const n=to(e),r=E.useRef(!1);return E.useEffect(()=>{const o=i=>{i.target&&!r.current&&GS(P8,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function KS(){const e=new CustomEvent(vh);document.dispatchEvent(e)}function GS(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?AA(o,i):o.dispatchEvent(i)}const gh="focusScope.autoFocusOnMount",bh="focusScope.autoFocusOnUnmount",ZS={bubbles:!1,cancelable:!0},D8=E.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[s,c]=E.useState(null),l=to(o),u=to(i),f=E.useRef(null),p=Mo(t,m=>c(m)),d=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(r){let m=function(b){if(d.paused||!s)return;const k=b.target;s.contains(k)?f.current=k:So(f.current,{select:!0})},v=function(b){if(d.paused||!s)return;const k=b.relatedTarget;k!==null&&(s.contains(k)||So(f.current,{select:!0}))},y=function(b){const k=document.activeElement;for(const S of b)S.removedNodes.length>0&&(s!=null&&s.contains(k)||So(s))};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const g=new MutationObserver(y);return s&&g.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),g.disconnect()}}},[r,s,d.paused]),E.useEffect(()=>{if(s){XS.add(d);const m=document.activeElement;if(!s.contains(m)){const y=new CustomEvent(gh,ZS);s.addEventListener(gh,l),s.dispatchEvent(y),y.defaultPrevented||(j8(z8(YS(s)),{select:!0}),document.activeElement===m&&So(s))}return()=>{s.removeEventListener(gh,l),setTimeout(()=>{const y=new CustomEvent(bh,ZS);s.addEventListener(bh,u),s.dispatchEvent(y),y.defaultPrevented||So(m??document.body,{select:!0}),s.removeEventListener(bh,u),XS.remove(d)},0)}}},[s,l,u,d]);const h=E.useCallback(m=>{if(!n&&!r||d.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(v&&y){const g=m.currentTarget,[b,k]=F8(g);b&&k?!m.shiftKey&&y===k?(m.preventDefault(),n&&So(b,{select:!0})):m.shiftKey&&y===b&&(m.preventDefault(),n&&So(k,{select:!0})):y===g&&m.preventDefault()}},[n,r,d.paused]);return E.createElement(In.div,no({tabIndex:-1},a,{ref:p,onKeyDown:h}))});function j8(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(So(r,{select:t}),document.activeElement!==n)return}function F8(e){const t=YS(e),n=JS(t,e),r=JS(t.reverse(),e);return[n,r]}function YS(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function JS(e,t){for(const n of e)if(!L8(n,{upTo:t}))return n}function L8(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 B8(e){return e instanceof HTMLInputElement&&"select"in e}function So(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&B8(e)&&t&&e.select()}}const XS=U8();function U8(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=QS(e,t),e.unshift(t)},remove(t){var n;e=QS(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function QS(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function z8(e){return e.filter(t=>t.tagName!=="A")}function q8(e,t){return E.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Gl=e=>{const{present:t,children:n}=e,r=H8(t),o=typeof n=="function"?n({present:r.isPresent}):E.Children.only(n),i=Mo(r.ref,o.ref);return typeof n=="function"||r.isPresent?E.cloneElement(o,{ref:i}):null};Gl.displayName="Presence";function H8(e){const[t,n]=E.useState(),r=E.useRef({}),o=E.useRef(e),i=E.useRef("none"),a=e?"mounted":"unmounted",[s,c]=q8(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const l=Zl(r.current);i.current=s==="mounted"?l:"none"},[s]),Pa(()=>{const l=r.current,u=o.current;if(u!==e){const p=i.current,d=Zl(l);e?c("MOUNT"):d==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(u&&p!==d?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Pa(()=>{if(t){const l=f=>{const d=Zl(r.current).includes(f.animationName);f.target===t&&d&&rr.flushSync(()=>c("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=Zl(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(s),ref:E.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function Zl(e){return(e==null?void 0:e.animationName)||"none"}let wh=0;function V8(){E.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:eE()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:eE()),wh++,()=>{wh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),wh--}},[])}function eE(){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 gr=function(){return gr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},gr.apply(this,arguments)};function tE(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function W8(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Yl="right-scroll-bar-position",Jl="width-before-scroll-bar",K8="with-scroll-bars-hidden",G8="--removed-body-scroll-bar-size";function Z8(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Y8(e,t){var n=E.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function J8(e,t){return Y8(t||null,function(n){return e.forEach(function(r){return Z8(r,n)})})}function X8(e){return e}function Q8(e,t){t===void 0&&(t=X8);var n=[],r=!1,o={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(i){var a=t(i,r);return n.push(a),function(){n=n.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(r=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(s){return i(s)},filter:function(){return n}}},assignMedium:function(i){r=!0;var a=[];if(n.length){var s=n;n=[],s.forEach(i),a=n}var c=function(){var u=a;a=[],u.forEach(i)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(u){a.push(u),l()},filter:function(u){return a=a.filter(u),n}}}};return o}function ez(e){e===void 0&&(e={});var t=Q8(null);return t.options=gr({async:!0,ssr:!1},e),t}var nE=function(e){var t=e.sideCar,n=tE(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 C.createElement(r,gr({},n))};nE.isSideCarExport=!0;function tz(e,t){return e.useMedium(t),nE}var rE=ez(),xh=function(){},Xl=C.forwardRef(function(e,t){var n=C.useRef(null),r=C.useState({onScrollCapture:xh,onWheelCapture:xh,onTouchMoveCapture:xh}),o=r[0],i=r[1],a=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,d=e.noIsolation,h=e.inert,m=e.allowPinchZoom,v=e.as,y=v===void 0?"div":v,g=tE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),b=p,k=J8([n,t]),S=gr(gr({},g),o);return C.createElement(C.Fragment,null,u&&C.createElement(b,{sideCar:rE,removeScrollBar:l,shards:f,noIsolation:d,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:n}),a?C.cloneElement(C.Children.only(s),gr(gr({},S),{ref:k})):C.createElement(y,gr({},S,{className:c,ref:k}),s))});Xl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Xl.classNames={fullWidth:Jl,zeroRight:Yl};var oE,nz=function(){if(oE)return oE;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function rz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=nz();return t&&e.setAttribute("nonce",t),e}function oz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var az=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rz())&&(oz(t,n),iz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},sz=function(){var e=az();return function(t,n){C.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},iE=function(){var e=sz(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},cz={left:0,top:0,right:0,gap:0},Sh=function(e){return parseInt(e||"",10)||0},lz=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Sh(n),Sh(r),Sh(o)]},uz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return cz;var t=lz(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])}},fz=iE(),dz=function(e,t,n,r){var o=e.left,i=e.top,a=e.right,s=e.gap;return n===void 0&&(n="margin"),`
|
|
284
|
+
`)):P.key==="Enter"&&(P.preventDefault(),L()),P.key==="ArrowUp"){P.preventDefault();const N=T[($==null?void 0:$.userId)??""]??[];v<N.length-1&&m(N[v+1]),y(()=>Math.min(v+1,N.length-1))}if(P.key==="ArrowDown"){P.preventDefault();const N=T[($==null?void 0:$.userId)??""]??[];m(v===0?"":N[v-1]),y(()=>Math.max(v-1,-1))}}}}),h&&F.jsx("button",{type:"button","aria-label":"Send message",...r.button.container,disabled:!h||B,onClick:L,children:F.jsx(P9,{...r.button.icon})}),!h&&M&&F.jsx("button",{type:"button","aria-label":"Activate voice input",...r.voiceButton.container,disabled:!!h,onClick:H,"data-listens":!!g,children:F.jsx(R9,{...r.voiceButton.icon})})]}),F.jsx("a",{...r.poweredBy,"data-hidden":d===!1,hidden:d===!1,href:"https://botpress.com/?from=webchat",target:"_blank",rel:"noopener noreferrer",children:"⚡ by Botpress"})]})})),qS=({children:e})=>{const[t,n]=E.useState(!1),[r,o]=E.useState(""),[i,a]=E.useState(null),s=({title:l,content:u})=>{o(l),a(u),n(!0)},c=()=>{n(!1)};return F.jsxs(Px.Provider,{value:{hideModal:c,showModal:s,title:r,content:i,open:t},children:[F.jsx(Eo,{open:t,onOpenChange:n,children:F.jsx(Eo.Content,{title:r,children:i})}),e]})},iue="";var HS={},ch={},Vl=be&&be.__assign||function(){return Vl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Vl.apply(this,arguments)};Object.defineProperty(ch,"__esModule",{value:!0});var X9={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function Q9(e){var t=Vl(Vl({},X9),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}ch.getSanitizedOptions=Q9;var lh={},uh={},Wl={},fh={},dh={};Object.defineProperty(dh,"__esModule",{value:!0});function e8(e){var t=Math.random()*e;return Math.round(t)}dh.fullJitter=e8;var ph={};Object.defineProperty(ph,"__esModule",{value:!0});function t8(e){return e}ph.noJitter=t8,Object.defineProperty(fh,"__esModule",{value:!0});var n8=dh,r8=ph;function o8(e){switch(e.jitter){case"full":return n8.fullJitter;case"none":default:return r8.noJitter}}fh.JitterFactory=o8,Object.defineProperty(Wl,"__esModule",{value:!0});var i8=fh,a8=function(){function e(t){this.options=t,this.attempt=0}return e.prototype.apply=function(){var t=this;return new Promise(function(n){return setTimeout(n,t.jitteredDelay)})},e.prototype.setAttemptNumber=function(t){this.attempt=t},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){var t=i8.JitterFactory(this.options);return t(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var t=this.options.startingDelay,n=this.options.timeMultiple,r=this.numOfDelayedAttempts,o=t*Math.pow(n,r);return Math.min(o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();Wl.Delay=a8;var s8=be&&be.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),c8=be&&be.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(u){try{l(r.next(u))}catch(f){a(f)}}function c(u){try{l(r.throw(u))}catch(f){a(f)}}function l(u){u.done?i(u.value):o(u.value).then(s,c)}l((r=r.apply(e,t||[])).next())})},l8=be&&be.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(u){l=[6,u],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Object.defineProperty(uh,"__esModule",{value:!0});var u8=Wl,f8=function(e){s8(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.apply=function(){return c8(this,void 0,void 0,function(){return l8(this,function(n){return[2,this.isFirstAttempt?!0:e.prototype.apply.call(this)]})})},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(u8.Delay);uh.SkipFirstDelay=f8;var hh={},d8=be&&be.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(hh,"__esModule",{value:!0});var p8=Wl,h8=function(e){d8(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(p8.Delay);hh.AlwaysDelay=h8,Object.defineProperty(lh,"__esModule",{value:!0});var m8=uh,y8=hh;function v8(e,t){var n=g8(e);return n.setAttemptNumber(t),n}lh.DelayFactory=v8;function g8(e){return e.delayFirstAttempt?new y8.AlwaysDelay(e):new m8.SkipFirstDelay(e)}var mh=be&&be.__awaiter||function(e,t,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(u){try{l(r.next(u))}catch(f){a(f)}}function c(u){try{l(r.throw(u))}catch(f){a(f)}}function l(u){u.done?i(u.value):o(u.value).then(s,c)}l((r=r.apply(e,t||[])).next())})},yh=be&&be.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,o&&(i=l[0]&2?o.return:l[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,l[1])).done)return i;switch(o=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,o=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(u){l=[6,u],o=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}};Object.defineProperty(HS,"__esModule",{value:!0});var b8=ch,w8=lh;function x8(e,t){return t===void 0&&(t={}),mh(this,void 0,void 0,function(){var n,r;return yh(this,function(o){switch(o.label){case 0:return n=b8.getSanitizedOptions(t),r=new E8(e,n),[4,r.execute()];case 1:return[2,o.sent()]}})})}var S8=HS.backOff=x8,E8=function(){function e(t,n){this.request=t,this.options=n,this.attemptNumber=0}return e.prototype.execute=function(){return mh(this,void 0,void 0,function(){var t,n;return yh(this,function(r){switch(r.label){case 0:if(this.attemptLimitReached)return[3,7];r.label=1;case 1:return r.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return r.sent(),[4,this.request()];case 3:return[2,r.sent()];case 4:return t=r.sent(),this.attemptNumber++,[4,this.options.retry(t,this.attemptNumber)];case 5:if(n=r.sent(),!n||this.attemptLimitReached)throw t;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return mh(this,void 0,void 0,function(){var t;return yh(this,function(n){switch(n.label){case 0:return t=w8.DelayFactory(this.options,this.attemptNumber),[4,t.apply()];case 1:return n.sent(),[2]}})})},e}();const _8=({children:e,...t})=>{const n=E.useRef(),r=E.useRef(null),o=B6({...t,messageContainerRef:r});return n.current||(n.current=o),F.jsx(Rx.Provider,{value:{...t.configuration},children:F.jsx(Tx.Provider,{value:n.current,children:F.jsx($8,{children:e})})})},$8=({children:e})=>{const t=Pe(b=>b.client),n=Pe(b=>b.addMessage),r=Pe(b=>b.setMessages),o=Pe(b=>b.configuration),i=Pe(b=>b.setConnected),a=Pe(b=>b.userData),s=Pe(b=>b.userName),c=Pe(b=>b.userPictureUrl),l=Pe(b=>b.setIsTyping),u=Pe(b=>b.getMessages),f=Pe(b=>b.setHeaderMessage),p=Pe(b=>b.setDisableComposer),d=_n(b=>b.setConversationId),h=_n(b=>b.user),m=_n(b=>b.conversationId),v=_n(b=>b.setUser),[y,g]=E.useState(0);return E.useEffect(()=>{if(t)return t.on("messageSent",b=>{const k=u(),S=k[k.length-1];(k.length===0||S.block.type==="bubble"&&S.block.block.type==="text"&&S.block.block.text!==b)&&n({direction:"outgoing",sender:{name:"You"},timestamp:new Date,block:{type:"bubble",block:{type:"text",text:b}},disableInput:!1})})},[m]),E.useEffect(()=>{if(t)return t.on("message",b=>{try{const{payload:k,disableInput:S,id:$,conversationId:T}=b;if(m!==T)return;l(!1,0),n({id:$,direction:"incoming",sender:{name:o.botName??"Bot",avatar:o.botAvatar},timestamp:new Date(b.sentOn),block:k,disableInput:S})}catch{console.error("Invalid message payload")}})},[m]),E.useEffect(()=>{if(t)return t.on("conversation",b=>{d(b)})},[]),vx(async()=>{if(t)return t.on("error",()=>{g(b=>b+1)})}),vx(async()=>{if(!t||m&&t.conversationId===m)return;let b;try{f("Connecting..."),p(!0),b=await S8(()=>t.connect(h,a,{name:s,pictureUrl:c}),{maxDelay:1e4,numOfAttempts:1/0}),f(void 0),p(!1),i(!0)}catch(S){console.error(S),f("Connection failed. Please try again later."),i(!1);return}v(b),m&&await t.conversationExists(m)?await t.switchConversation(m):await t.newConversation();const k=[];for(const S of await t.listMessages())try{const{payload:$,authorId:T,sentOn:R,disableInput:B,id:O}=S,M=T===t.userId?"outgoing":"incoming";k.push({id:O,direction:M,sender:M==="outgoing"?{name:"You"}:{name:o.botName??"Bot",avatar:o.botAvatar},timestamp:new Date(R),block:$,disableInput:B})}catch{console.error("Invalid message payload")}return r(k.reverse()),()=>{t.disconnect()}},[y,m]),F.jsx(F.Fragment,{children:e})};function Ur(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}const k8=C["useId".toString()]||(()=>{});let C8=0;function Kl(e){const[t,n]=C.useState(k8());return Pa(()=>{e||n(r=>r??String(C8++))},[e]),e||(t?`radix-${t}`:"")}function VS({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=O8({defaultProp:t,onChange:n}),i=e!==void 0,a=i?e:r,s=to(n),c=E.useCallback(l=>{if(i){const f=typeof l=="function"?l(e):l;f!==e&&s(f)}else o(l)},[i,e,o,s]);return[a,c]}function O8({defaultProp:e,onChange:t}){const n=E.useState(e),[r]=n,o=E.useRef(r),i=to(t);return E.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function T8(e,t=globalThis==null?void 0:globalThis.document){const n=to(e);E.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const vh="dismissableLayer.update",A8="dismissableLayer.pointerDownOutside",P8="dismissableLayer.focusOutside";let WS;const I8=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),R8=E.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:s,onDismiss:c,...l}=e,u=E.useContext(I8),[f,p]=E.useState(null),d=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,h]=E.useState({}),m=Mo(t,R=>p(R)),v=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(y),b=f?v.indexOf(f):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=g,$=M8(R=>{const B=R.target,O=[...u.branches].some(M=>M.contains(B));!S||O||(i==null||i(R),s==null||s(R),R.defaultPrevented||c==null||c())},d),T=N8(R=>{const B=R.target;[...u.branches].some(M=>M.contains(B))||(a==null||a(R),s==null||s(R),R.defaultPrevented||c==null||c())},d);return T8(R=>{b===u.layers.size-1&&(o==null||o(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))},d),E.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(WS=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),KS(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=WS)}},[f,d,r,u]),E.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),KS())},[f,u]),E.useEffect(()=>{const R=()=>h({});return document.addEventListener(vh,R),()=>document.removeEventListener(vh,R)},[]),E.createElement(In.div,no({},l,{ref:m,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:Ur(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Ur(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Ur(e.onPointerDownCapture,$.onPointerDownCapture)}))});function M8(e,t=globalThis==null?void 0:globalThis.document){const n=to(e),r=E.useRef(!1),o=E.useRef(()=>{});return E.useEffect(()=>{const i=s=>{if(s.target&&!r.current){let l=function(){GS(A8,n,c,{discrete:!0})};const c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function N8(e,t=globalThis==null?void 0:globalThis.document){const n=to(e),r=E.useRef(!1);return E.useEffect(()=>{const o=i=>{i.target&&!r.current&&GS(P8,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function KS(){const e=new CustomEvent(vh);document.dispatchEvent(e)}function GS(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?AA(o,i):o.dispatchEvent(i)}const gh="focusScope.autoFocusOnMount",bh="focusScope.autoFocusOnUnmount",ZS={bubbles:!1,cancelable:!0},D8=E.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[s,c]=E.useState(null),l=to(o),u=to(i),f=E.useRef(null),p=Mo(t,m=>c(m)),d=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(r){let m=function(b){if(d.paused||!s)return;const k=b.target;s.contains(k)?f.current=k:So(f.current,{select:!0})},v=function(b){if(d.paused||!s)return;const k=b.relatedTarget;k!==null&&(s.contains(k)||So(f.current,{select:!0}))},y=function(b){const k=document.activeElement;for(const S of b)S.removedNodes.length>0&&(s!=null&&s.contains(k)||So(s))};document.addEventListener("focusin",m),document.addEventListener("focusout",v);const g=new MutationObserver(y);return s&&g.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",v),g.disconnect()}}},[r,s,d.paused]),E.useEffect(()=>{if(s){XS.add(d);const m=document.activeElement;if(!s.contains(m)){const y=new CustomEvent(gh,ZS);s.addEventListener(gh,l),s.dispatchEvent(y),y.defaultPrevented||(j8(z8(YS(s)),{select:!0}),document.activeElement===m&&So(s))}return()=>{s.removeEventListener(gh,l),setTimeout(()=>{const y=new CustomEvent(bh,ZS);s.addEventListener(bh,u),s.dispatchEvent(y),y.defaultPrevented||So(m??document.body,{select:!0}),s.removeEventListener(bh,u),XS.remove(d)},0)}}},[s,l,u,d]);const h=E.useCallback(m=>{if(!n&&!r||d.paused)return;const v=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(v&&y){const g=m.currentTarget,[b,k]=F8(g);b&&k?!m.shiftKey&&y===k?(m.preventDefault(),n&&So(b,{select:!0})):m.shiftKey&&y===b&&(m.preventDefault(),n&&So(k,{select:!0})):y===g&&m.preventDefault()}},[n,r,d.paused]);return E.createElement(In.div,no({tabIndex:-1},a,{ref:p,onKeyDown:h}))});function j8(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(So(r,{select:t}),document.activeElement!==n)return}function F8(e){const t=YS(e),n=JS(t,e),r=JS(t.reverse(),e);return[n,r]}function YS(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function JS(e,t){for(const n of e)if(!L8(n,{upTo:t}))return n}function L8(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 B8(e){return e instanceof HTMLInputElement&&"select"in e}function So(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&B8(e)&&t&&e.select()}}const XS=U8();function U8(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=QS(e,t),e.unshift(t)},remove(t){var n;e=QS(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function QS(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function z8(e){return e.filter(t=>t.tagName!=="A")}function q8(e,t){return E.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Gl=e=>{const{present:t,children:n}=e,r=H8(t),o=typeof n=="function"?n({present:r.isPresent}):E.Children.only(n),i=Mo(r.ref,o.ref);return typeof n=="function"||r.isPresent?E.cloneElement(o,{ref:i}):null};Gl.displayName="Presence";function H8(e){const[t,n]=E.useState(),r=E.useRef({}),o=E.useRef(e),i=E.useRef("none"),a=e?"mounted":"unmounted",[s,c]=q8(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const l=Zl(r.current);i.current=s==="mounted"?l:"none"},[s]),Pa(()=>{const l=r.current,u=o.current;if(u!==e){const p=i.current,d=Zl(l);e?c("MOUNT"):d==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(u&&p!==d?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Pa(()=>{if(t){const l=f=>{const d=Zl(r.current).includes(f.animationName);f.target===t&&d&&rr.flushSync(()=>c("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=Zl(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(s),ref:E.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function Zl(e){return(e==null?void 0:e.animationName)||"none"}let wh=0;function V8(){E.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:eE()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:eE()),wh++,()=>{wh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),wh--}},[])}function eE(){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 gr=function(){return gr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},gr.apply(this,arguments)};function tE(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function W8(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var Yl="right-scroll-bar-position",Jl="width-before-scroll-bar",K8="with-scroll-bars-hidden",G8="--removed-body-scroll-bar-size";function Z8(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Y8(e,t){var n=E.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function J8(e,t){return Y8(t||null,function(n){return e.forEach(function(r){return Z8(r,n)})})}function X8(e){return e}function Q8(e,t){t===void 0&&(t=X8);var n=[],r=!1,o={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(i){var a=t(i,r);return n.push(a),function(){n=n.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(r=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(s){return i(s)},filter:function(){return n}}},assignMedium:function(i){r=!0;var a=[];if(n.length){var s=n;n=[],s.forEach(i),a=n}var c=function(){var u=a;a=[],u.forEach(i)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(u){a.push(u),l()},filter:function(u){return a=a.filter(u),n}}}};return o}function ez(e){e===void 0&&(e={});var t=Q8(null);return t.options=gr({async:!0,ssr:!1},e),t}var nE=function(e){var t=e.sideCar,n=tE(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 C.createElement(r,gr({},n))};nE.isSideCarExport=!0;function tz(e,t){return e.useMedium(t),nE}var rE=ez(),xh=function(){},Xl=C.forwardRef(function(e,t){var n=C.useRef(null),r=C.useState({onScrollCapture:xh,onWheelCapture:xh,onTouchMoveCapture:xh}),o=r[0],i=r[1],a=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,d=e.noIsolation,h=e.inert,m=e.allowPinchZoom,v=e.as,y=v===void 0?"div":v,g=tE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),b=p,k=J8([n,t]),S=gr(gr({},g),o);return C.createElement(C.Fragment,null,u&&C.createElement(b,{sideCar:rE,removeScrollBar:l,shards:f,noIsolation:d,inert:h,setCallbacks:i,allowPinchZoom:!!m,lockRef:n}),a?C.cloneElement(C.Children.only(s),gr(gr({},S),{ref:k})):C.createElement(y,gr({},S,{className:c,ref:k}),s))});Xl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Xl.classNames={fullWidth:Jl,zeroRight:Yl};var oE,nz=function(){if(oE)return oE;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function rz(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=nz();return t&&e.setAttribute("nonce",t),e}function oz(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iz(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var az=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rz())&&(oz(t,n),iz(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},sz=function(){var e=az();return function(t,n){C.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},iE=function(){var e=sz(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},cz={left:0,top:0,right:0,gap:0},Sh=function(e){return parseInt(e||"",10)||0},lz=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Sh(n),Sh(r),Sh(o)]},uz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return cz;var t=lz(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])}},fz=iE(),dz=function(e,t,n,r){var o=e.left,i=e.top,a=e.right,s=e.gap;return n===void 0&&(n="margin"),`
|
|
285
285
|
.`.concat(K8,` {
|
|
286
286
|
overflow: hidden `).concat(r,`;
|
|
287
287
|
padding-right: `).concat(s,"px ").concat(r,`;
|