@flowengage/react-chatbot 8.0.95 → 8.0.104
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/dist/flowengage-embed-8.0.104.js +372 -0
- package/dist/flowengage-embed.js +23 -20
- package/dist/flowengage-react-chatbot.cjs +19 -16
- package/dist/flowengage-react-chatbot.mjs +3200 -2689
- package/package.json +3 -3
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
var FlowEngage=(function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e),f=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ee(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function te(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ne(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ne(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),ne(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=ne(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=ne(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ne(te(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function re(e,t,n){if(e==null)return e;var r=[],i=0;return ne(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ie(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var j=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},M={map:re,forEach:function(e,t,n){re(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return re(e,function(){t++}),t},toArray:function(e){return re(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=M,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ie}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,j)}catch(e){j(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.4`})),p=s(((e,t)=>{t.exports=f()})),m=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function ee(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(ee)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,k=O.port2;O.port1.onmessage=ee,D=function(){k.postMessage(null)}}else D=function(){_(ee,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=s(((e,t)=>{t.exports=m()})),g=s((e=>{var t=p();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.4`})),_=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=s((e=>{var t=h(),n=p(),r=_();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,m=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function re(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?re(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var ie=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},oe=[],se=-1;function ce(e){return{current:e}}function N(e){0>se||(e.current=oe[se],oe[se]=null,se--)}function P(e,t){se++,oe[se]=e.current,e.current=t}var le=ce(null),ue=ce(null),F=ce(null),de=ce(null);function fe(e,t){switch(P(F,t),P(ue,e),P(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}N(le),P(le,e)}function pe(){N(le),N(ue),N(F)}function me(e){e.memoizedState!==null&&P(de,e);var t=le.current,n=Wd(t,e.type);t!==n&&(P(ue,e),P(le,n))}function I(e){ue.current===e&&(N(le),N(ue)),de.current===e&&(N(de),ep._currentValue=ae)}var he,ge;function _e(e){if(he===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||``,ge=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+he+e+ge}var ve=!1;function ye(e,t){if(!e||ve)return``;ve=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
+
`),l=s.split(`
|
|
5
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ve=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?_e(n):``}function be(e,t){switch(e.tag){case 26:case 27:case 5:return _e(e.type);case 16:return _e(`Lazy`);case 13:return e.child!==t&&t!==null?_e(`Suspense Fallback`):_e(`Suspense`);case 19:return _e(`SuspenseList`);case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return _e(`Activity`);default:return``}}function xe(e){try{var t=``,n=null;do t+=be(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var Se=Object.prototype.hasOwnProperty,Ce=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,Te=t.unstable_shouldYield,Ee=t.unstable_requestPaint,De=t.unstable_now,Oe=t.unstable_getCurrentPriorityLevel,ke=t.unstable_ImmediatePriority,Ae=t.unstable_UserBlockingPriority,je=t.unstable_NormalPriority,Me=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Pe=t.log,L=t.unstable_setDisableYieldValue,Fe=null,Ie=null;function Le(e){if(typeof Pe==`function`&&L(e),Ie&&typeof Ie.setStrictMode==`function`)try{Ie.setStrictMode(Fe,e)}catch{}}var Re=Math.clz32?Math.clz32:Ve,ze=Math.log,Be=Math.LN2;function Ve(e){return e>>>=0,e===0?32:31-(ze(e)/Be|0)|0}var He=256,Ue=262144,We=4194304;function Ge(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ke(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ge(n))):i=Ge(o):i=Ge(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ge(n))):i=Ge(o)):i=Ge(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function qe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Je(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function R(){var e=We;return We<<=1,!(We&62914560)&&(We=4194304),e}function Ye(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ze(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Re(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Qe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Qe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Re(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function $e(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Re(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function et(e,t){var n=t&-t;return n=n&42?1:tt(n),(n&(e.suspendedLanes|t))===0?n:0}function tt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function nt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function rt(){var e=M.p;return e===0?(e=window.event,e===void 0?32:gp(e.type)):e}function it(e,t){var n=M.p;try{return M.p=e,t()}finally{M.p=n}}var at=Math.random().toString(36).slice(2),ot=`__reactFiber$`+at,st=`__reactProps$`+at,z=`__reactContainer$`+at,ct=`__reactEvents$`+at,lt=`__reactListeners$`+at,ut=`__reactHandles$`+at,dt=`__reactResources$`+at,ft=`__reactMarker$`+at;function pt(e){delete e[ot],delete e[st],delete e[ct],delete e[lt],delete e[ut]}function mt(e){var t=e[ot];if(t)return t;for(var n=e.parentNode;n;){if(t=n[z]||n[ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=pf(e);e!==null;){if(n=e[ot])return n;e=pf(e)}return t}e=n,n=e.parentNode}return null}function ht(e){if(e=e[ot]||e[z]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function gt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function _t(e){var t=e[dt];return t||=e[dt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function vt(e){e[ft]=!0}var yt=new Set,bt={};function xt(e,t){St(e,t),St(e+`Capture`,t)}function St(e,t){for(bt[e]=t,e=0;e<t.length;e++)yt.add(t[e])}var Ct=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),wt={},Tt={};function Et(e){return Se.call(Tt,e)?!0:Se.call(wt,e)?!1:Ct.test(e)?Tt[e]=!0:(wt[e]=!0,!1)}function Dt(e,t,n){if(Et(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ot(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function kt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function At(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function jt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Mt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Nt(e){if(!e._valueTracker){var t=jt(e)?`checked`:`value`;e._valueTracker=Mt(e,t,``+e[t])}}function Pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=jt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Ft(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var It=/[\n"\\]/g;function Lt(e){return e.replace(It,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Rt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+At(t)):e.value!==``+At(t)&&(e.value=``+At(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Bt(e,o,At(n)):Bt(e,o,At(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+At(s):e.removeAttribute(`name`)}function zt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Nt(e);return}n=n==null?``:``+At(n),t=t==null?n:``+At(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Nt(e)}function Bt(e,t,n){t===`number`&&Ft(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Vt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+At(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ht(e,t,n){if(t!=null&&(t=``+At(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+At(n)}function Ut(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ie(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=At(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Nt(e)}function Wt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Kt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Gt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function qt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Kt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Kt(e,o,t[o])}function Jt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Yt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Xt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Zt(e){return Xt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Qt(){}var $t=null;function en(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tn=null,nn=null;function rn(e){var t=ht(e);if(t&&(e=t.stateNode)){var n=e[st]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Rt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Lt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[st]||null;if(!a)throw Error(i(90));Rt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Pt(r)}break a;case`textarea`:Ht(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Vt(e,!!n.multiple,t,!1)}}}var an=!1;function B(e,t,n){if(an)return e(t,n);an=!0;try{return e(t)}finally{if(an=!1,(tn!==null||nn!==null)&&(bu(),tn&&(t=tn,e=nn,nn=tn=null,rn(t),e)))for(t=0;t<e.length;t++)rn(e[t])}}function on(e,t){var n=e.stateNode;if(n===null)return null;var r=n[st]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var sn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),cn=!1;if(sn)try{var ln={};Object.defineProperty(ln,`passive`,{get:function(){cn=!0}}),window.addEventListener(`test`,ln,ln),window.removeEventListener(`test`,ln,ln)}catch{cn=!1}var un=null,dn=null,fn=null;function pn(){if(fn)return fn;var e,t=dn,n=t.length,r,i=`value`in un?un.value:un.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return fn=i.slice(e,1<r?1-r:void 0)}function mn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function hn(){return!0}function gn(){return!1}function _n(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?hn:gn,this.isPropagationStopped=gn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=hn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=hn)},persist:function(){},isPersistent:hn}),t}var vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yn=_n(vn),bn=f({},vn,{view:0,detail:0}),xn=_n(bn),Sn,Cn,wn,Tn=f({},bn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:In,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==wn&&(wn&&e.type===`mousemove`?(Sn=e.screenX-wn.screenX,Cn=e.screenY-wn.screenY):Cn=Sn=0,wn=e),Sn)},movementY:function(e){return`movementY`in e?e.movementY:Cn}}),En=_n(Tn),Dn=_n(f({},Tn,{dataTransfer:0})),On=_n(f({},bn,{relatedTarget:0})),kn=_n(f({},vn,{animationName:0,elapsedTime:0,pseudoElement:0})),An=_n(f({},vn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),jn=_n(f({},vn,{data:0})),Mn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Nn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Pn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Fn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Pn[e])?!!t[e]:!1}function In(){return Fn}var Ln=_n(f({},bn,{key:function(e){if(e.key){var t=Mn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=mn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Nn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:In,charCode:function(e){return e.type===`keypress`?mn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?mn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Rn=_n(f({},Tn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),zn=_n(f({},bn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:In})),Bn=_n(f({},vn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Vn=_n(f({},Tn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Hn=_n(f({},vn,{newState:0,oldState:0})),Un=[9,13,27,32],Wn=sn&&`CompositionEvent`in window,Gn=null;sn&&`documentMode`in document&&(Gn=document.documentMode);var Kn=sn&&`TextEvent`in window&&!Gn,qn=sn&&(!Wn||Gn&&8<Gn&&11>=Gn),Jn=` `,Yn=!1;function Xn(e,t){switch(e){case`keyup`:return Un.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Zn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Qn=!1;function $n(e,t){switch(e){case`compositionend`:return Zn(t);case`keypress`:return t.which===32?(Yn=!0,Jn):null;case`textInput`:return e=t.data,e===Jn&&Yn?null:e;default:return null}}function er(e,t){if(Qn)return e===`compositionend`||!Wn&&Xn(e,t)?(e=pn(),fn=dn=un=null,Qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return qn&&t.locale!==`ko`?null:t.data;default:return null}}var tr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function nr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!tr[e.type]:t===`textarea`}function rr(e,t,n,r){tn?nn?nn.push(r):nn=[r]:tn=r,t=Dd(t,`onChange`),0<t.length&&(n=new yn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ir=null,ar=null;function or(e){bd(e,0)}function sr(e){if(Pt(gt(e)))return e}function cr(e,t){if(e===`change`)return t}var lr=!1;if(sn){var ur;if(sn){var dr=`oninput`in document;if(!dr){var fr=document.createElement(`div`);fr.setAttribute(`oninput`,`return;`),dr=typeof fr.oninput==`function`}ur=dr}else ur=!1;lr=ur&&(!document.documentMode||9<document.documentMode)}function pr(){ir&&(ir.detachEvent(`onpropertychange`,mr),ar=ir=null)}function mr(e){if(e.propertyName===`value`&&sr(ar)){var t=[];rr(t,ar,e,en(e)),B(or,t)}}function hr(e,t,n){e===`focusin`?(pr(),ir=t,ar=n,ir.attachEvent(`onpropertychange`,mr)):e===`focusout`&&pr()}function gr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return sr(ar)}function _r(e,t){if(e===`click`)return sr(t)}function vr(e,t){if(e===`input`||e===`change`)return sr(t)}function yr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var br=typeof Object.is==`function`?Object.is:yr;function xr(e,t){if(br(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Se.call(t,i)||!br(e[i],t[i]))return!1}return!0}function Sr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Cr(e,t){var n=Sr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Sr(n)}}function wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ft(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ft(e.document)}return t}function Er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Dr=sn&&`documentMode`in document&&11>=document.documentMode,Or=null,kr=null,Ar=null,jr=!1;function Mr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jr||Or==null||Or!==Ft(r)||(r=Or,`selectionStart`in r&&Er(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ar&&xr(Ar,r)||(Ar=r,r=Dd(kr,`onSelect`),0<r.length&&(t=new yn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Or)))}function Nr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Pr={animationend:Nr(`Animation`,`AnimationEnd`),animationiteration:Nr(`Animation`,`AnimationIteration`),animationstart:Nr(`Animation`,`AnimationStart`),transitionrun:Nr(`Transition`,`TransitionRun`),transitionstart:Nr(`Transition`,`TransitionStart`),transitioncancel:Nr(`Transition`,`TransitionCancel`),transitionend:Nr(`Transition`,`TransitionEnd`)},Fr={},Ir={};sn&&(Ir=document.createElement(`div`).style,`AnimationEvent`in window||(delete Pr.animationend.animation,delete Pr.animationiteration.animation,delete Pr.animationstart.animation),`TransitionEvent`in window||delete Pr.transitionend.transition);function Lr(e){if(Fr[e])return Fr[e];if(!Pr[e])return e;var t=Pr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ir)return Fr[e]=t[n];return e}var Rr=Lr(`animationend`),zr=Lr(`animationiteration`),Br=Lr(`animationstart`),Vr=Lr(`transitionrun`),Hr=Lr(`transitionstart`),Ur=Lr(`transitioncancel`),Wr=Lr(`transitionend`),Gr=new Map,Kr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Kr.push(`scrollEnd`);function qr(e,t){Gr.set(e,t),xt(t,[e])}var Jr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Yr=[],Xr=0,Zr=0;function Qr(){for(var e=Xr,t=Zr=Xr=0;t<e;){var n=Yr[t];Yr[t++]=null;var r=Yr[t];Yr[t++]=null;var i=Yr[t];Yr[t++]=null;var a=Yr[t];if(Yr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ni(n,i,a)}}function $r(e,t,n,r){Yr[Xr++]=e,Yr[Xr++]=t,Yr[Xr++]=n,Yr[Xr++]=r,Zr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ei(e,t,n,r){return $r(e,t,n,r),ri(e)}function ti(e,t){return $r(e,null,null,t),ri(e)}function ni(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Re(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ri(e){if(50<du)throw du=0,fu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ii={};function ai(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function oi(e,t,n,r){return new ai(e,t,n,r)}function si(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ci(e,t){var n=e.alternate;return n===null?(n=oi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function li(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function V(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)si(e)&&(s=1);else if(typeof e==`string`)s=Gf(e,n,le.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case O:return e=oi(31,n,t,a),e.elementType=O,e.lanes=o,e;case y:return ui(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=oi(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=oi(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=oi(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case ee:s=14;break a;case D:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=oi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ui(e,t,n,r){return e=oi(7,e,r,t),e.lanes=n,e}function di(e,t,n){return e=oi(6,e,null,t),e.lanes=n,e}function fi(e){var t=oi(18,null,null,0);return t.stateNode=e,t}function pi(e,t,n){return t=oi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var mi=new WeakMap;function hi(e,t){if(typeof e==`object`&&e){var n=mi.get(e);return n===void 0?(t={value:e,source:t,stack:xe(t)},mi.set(e,t),t):n}return{value:e,source:t,stack:xe(t)}}var gi=[],_i=0,vi=null,yi=0,bi=[],xi=0,Si=null,Ci=1,wi=``;function Ti(e,t){gi[_i++]=yi,gi[_i++]=vi,vi=e,yi=t}function Ei(e,t,n){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Si=e;var r=Ci;e=wi;var i=32-Re(r)-1;r&=~(1<<i),n+=1;var a=32-Re(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ci=1<<32-Re(t)+i|n<<i|r,wi=a+e}else Ci=1<<a|n<<i|r,wi=e}function Di(e){e.return!==null&&(Ti(e,1),Ei(e,1,0))}function Oi(e){for(;e===vi;)vi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null;for(;e===Si;)Si=bi[--xi],bi[xi]=null,wi=bi[--xi],bi[xi]=null,Ci=bi[--xi],bi[xi]=null}function ki(e,t){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Ci=t.id,wi=t.overflow,Si=e}var Ai=null,ji=null,H=!1,Mi=null,Ni=!1,Pi=Error(i(519));function Fi(e){throw Vi(hi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Pi}function Ii(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ot]=e,t[st]=r,n){case`dialog`:Z(`cancel`,t),Z(`close`,t);break;case`iframe`:case`object`:case`embed`:Z(`load`,t);break;case`video`:case`audio`:for(n=0;n<vd.length;n++)Z(vd[n],t);break;case`source`:Z(`error`,t);break;case`img`:case`image`:case`link`:Z(`error`,t),Z(`load`,t);break;case`details`:Z(`toggle`,t);break;case`input`:Z(`invalid`,t),zt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Z(`invalid`,t);break;case`textarea`:Z(`invalid`,t),Ut(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Nd(t.textContent,n)?(r.popover!=null&&(Z(`beforetoggle`,t),Z(`toggle`,t)),r.onScroll!=null&&Z(`scroll`,t),r.onScrollEnd!=null&&Z(`scrollend`,t),r.onClick!=null&&(t.onclick=Qt),t=!0):t=!1,t||Fi(e,!0)}function Li(e){for(Ai=e.return;Ai;)switch(Ai.tag){case 5:case 31:case 13:Ni=!1;return;case 27:case 3:Ni=!0;return;default:Ai=Ai.return}}function Ri(e){if(e!==Ai)return!1;if(!H)return Li(e),H=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Gd(e.type,e.memoizedProps)),n=!n),n&&ji&&Fi(e),Li(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ji=ff(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ji=ff(e)}else t===27?(t=ji,$d(e.type)?(e=df,df=null,ji=e):ji=t):ji=Ai?uf(e.stateNode.nextSibling):null;return!0}function zi(){ji=Ai=null,H=!1}function Bi(){var e=Mi;return e!==null&&(X===null?X=e:X.push.apply(X,e),Mi=null),e}function Vi(e){Mi===null?Mi=[e]:Mi.push(e)}var Hi=ce(null),Ui=null,Wi=null;function Gi(e,t,n){P(Hi,t._currentValue),t._currentValue=n}function Ki(e){e._currentValue=Hi.current,N(Hi)}function qi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ji(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),qi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),qi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Yi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;br(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===de.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ep]:e.push(ep))}a=a.return}e!==null&&Ji(t,e,n,r),t.flags|=262144}function Xi(e){for(e=e.firstContext;e!==null;){if(!br(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Zi(e){Ui=e,Wi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Qi(e){return ea(Ui,e)}function $i(e,t){return Ui===null&&Zi(e),ea(e,t)}function ea(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Wi===null){if(e===null)throw Error(i(308));Wi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wi=Wi.next=t;return n}var ta=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},na=t.unstable_scheduleCallback,ra=t.unstable_NormalPriority,ia={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function aa(){return{controller:new ta,data:new Map,refCount:0}}function oa(e){e.refCount--,e.refCount===0&&na(ra,function(){e.controller.abort()})}var sa=null,ca=0,la=0,U=null;function ua(e,t){if(sa===null){var n=sa=[];ca=0,la=fd(),U={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ca++,t.then(da,da),t}function da(){if(--ca===0&&sa!==null){U!==null&&(U.status=`fulfilled`);var e=sa;sa=null,la=0,U=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function fa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var pa=j.S;j.S=function(e,t){eu=De(),typeof t==`object`&&t&&typeof t.then==`function`&&ua(e,t),pa!==null&&pa(e,t)};var ma=ce(null);function ha(){var e=ma.current;return e===null?Rl.pooledCache:e}function ga(e,t){t===null?P(ma,ma.current):P(ma,t.pool)}function _a(){var e=ha();return e===null?null:{parent:ia._currentValue,pool:e}}var va=Error(i(460)),ya=Error(i(474)),ba=Error(i(542)),xa={then:function(){}};function Sa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ca(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Qt,Qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Da(e),e;default:if(typeof t.status==`string`)t.then(Qt,Qt);else{if(e=Rl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Da(e),e}throw Ta=t,va}}function wa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ta=e,va):e}}var Ta=null;function Ea(){if(Ta===null)throw Error(i(459));var e=Ta;return Ta=null,e}function Da(e){if(e===va||e===ba)throw Error(i(483))}var Oa=null,ka=0;function Aa(e){var t=ka;return ka+=1,Oa===null&&(Oa=[]),Ca(Oa,e,t)}function ja(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ma(e,t){throw t.$$typeof===m?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Na(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ci(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=di(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===D&&wa(i)===t.type)?(t=a(t,n.props),ja(t,n),t.return=e,t):(t=V(n.type,n.key,n.props,null,e.mode,r),ja(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=pi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ui(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=di(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=V(t.type,t.key,t.props,null,e.mode,n),ja(n,t),n.return=e,n;case v:return t=pi(t,e.mode,n),t.return=e,t;case D:return t=wa(t),f(e,t,n)}if(ie(t)||te(t))return t=ui(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Aa(t),n);if(t.$$typeof===C)return f(e,$i(e,t),n);Ma(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case g:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case D:return n=wa(n),p(e,t,n,r)}if(ie(n)||te(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Aa(n),r);if(n.$$typeof===C)return p(e,t,$i(e,n),r);Ma(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case g:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case D:return r=wa(r),m(e,t,n,r,i)}if(ie(r)||te(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Aa(r),i);if(r.$$typeof===C)return m(e,t,n,$i(t,r),i);Ma(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),H&&Ti(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return H&&Ti(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),H&&Ti(i,h),l}function _(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),H&&Ti(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return H&&Ti(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),H&&Ti(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case g:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&wa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ja(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ui(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=V(o.type,o.key,o.props,null,e.mode,c),ja(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=pi(o,e.mode,c),c.return=e,e=c}return s(e);case D:return o=wa(o),b(e,r,o,c)}if(ie(o))return h(e,r,o,c);if(te(o)){if(l=te(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),_(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Aa(o),c);if(o.$$typeof===C)return b(e,r,$i(e,o),c);Ma(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ka=0;var i=b(e,t,n,r);return Oa=null,i}catch(t){if(t===va||t===ba)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Pa=Na(!0),Fa=Na(!1),Ia=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ra(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function za(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function W(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=U;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Ia=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Y&p)===p:(r&p)===p){p!==0&&p===la&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Ia=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Kl|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ga(n[e],t)}var qa=ce(null),Ja=ce(0);function Ya(e,t){e=Wl,P(Ja,e),P(qa,t),Wl=e|t.baseLanes}function Xa(){P(Ja,Wl),P(qa,qa.current)}function Za(){Wl=Ja.current,N(qa),N(Ja)}var Qa=ce(null),$a=null;function eo(e){var t=e.alternate;P(ao,ao.current&1),P(Qa,e),$a===null&&(t===null||qa.current!==null||t.memoizedState!==null)&&($a=e)}function to(e){P(ao,ao.current),P(Qa,e),$a===null&&($a=e)}function no(e){e.tag===22?(P(ao,ao.current),P(Qa,e),$a===null&&($a=e)):ro(e)}function ro(){P(ao,ao.current),P(Qa,Qa.current)}function io(e){N(Qa),$a===e&&($a=null),N(ao)}var ao=ce(0);function oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||sf(n)||cf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var so=0,G=null,co=null,K=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(i(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!br(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return so=a,G=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?Is:Ls,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){j.H=Fs;var t=co!==null&&co.next!==null;if(so=0,K=co=G=null,lo=!1,mo=0,ho=null,t)throw Error(i(300));e===null||ec||(e=e.dependencies,e!==null&&Xi(e)&&(ec=!0))}function xo(e,t,n,r){G=e;var a=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=a)throw Error(i(301));if(a+=1,K=co=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}j.H=Rs,o=t(n,r)}while(uo);return o}function So(){var e=j.H,t=e.useState()[0];return t=typeof t.then==`function`?ko(t):t,e=e.useState()[0],(co===null?null:co.memoizedState)!==e&&(G.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}so=0,K=co=G=null,uo=!1,mo=po=0,ho=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return K===null?G.memoizedState=K=e:K=K.next=e,K}function Do(){if(co===null){var e=G.alternate;e=e===null?null:e.memoizedState}else e=co.next;var t=K===null?G.memoizedState:K.next;if(t!==null)K=t,co=e;else{if(e===null)throw G.alternate===null?Error(i(467)):Error(i(310));co=e,e={memoizedState:co.memoizedState,baseState:co.baseState,baseQueue:co.baseQueue,queue:co.queue,next:null},K===null?G.memoizedState=K=e:K=K.next=e}return K}function Oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=Ca(ho,e,t),t=G,(K===null?t.memoizedState:K.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?Is:Ls),e}function Ao(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ko(e);if(e.$$typeof===C)return Qi(e)}throw Error(i(438,String(e)))}function jo(e){var t=null,n=G.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=G.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Oo(),G.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=k;return t.index++,n}function Mo(e,t){return typeof t==`function`?t(e):t}function No(e){return Po(Do(),co,e)}function Po(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(so&f)===f:(Y&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===la&&(d=!0);else if((so&p)===p){u=u.next,p===la&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,G.lanes|=p,Kl|=p;f=u.action,fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,G.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!br(o,e.memoizedState)&&(ec=!0,d&&(n=U,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Fo(e){var t=Do(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);br(o,t.memoizedState)||(ec=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Io(e,t,n){var r=G,a=Do(),o=H;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!br((co||a).memoizedState,n);if(s&&(a.memoizedState=n,ec=!0),a=a.queue,ss(zo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||K!==null&&K.memoizedState.tag&1){if(r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,a,n,t),null),Rl===null)throw Error(i(349));o||so&127||Lo(r,t,n)}return n}function Lo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=G.updateQueue,t===null?(t=Oo(),G.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ro(e,t,n,r){t.value=n,t.getSnapshot=r,Bo(t)&&Vo(e)}function zo(e,t,n){return n(function(){Bo(t)&&Vo(e)})}function Bo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!br(e,n)}catch{return!0}}function Vo(e){var t=ti(e,2);t!==null&&hu(t,e,2)}function Ho(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),fo){Le(!0);try{n()}finally{Le(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:e},t}function Uo(e,t,n,r){return e.baseState=n,Po(e,co,typeof r==`function`?r:Mo)}function Wo(e,t,n,r,a){if(Ms(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};j.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Go(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Go(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=j.T,o={};j.T=o;try{var s=n(i,r),c=j.S;c!==null&&c(o,s),Ko(e,t,s)}catch(n){Jo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),j.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){Jo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qo(e,t,n)},function(n){return Jo(e,t,n)}):qo(e,t,n)}function qo(e,t,n){t.status=`fulfilled`,t.value=n,Yo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function Jo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yo(t),t=t.next;while(t!==r)}e.action=null}function Yo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xo(e,t){return t}function Zo(e,t){if(H){var n=Rl.formState;if(n!==null){a:{var r=G;if(H){if(ji){b:{for(var i=ji,a=Ni;i.nodeType!==8;){if(!a){i=null;break b}if(i=uf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ji=uf(i.nextSibling),r=i.data===`F!`;break a}}Fi(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:t},n.queue=r,n=ks.bind(null,G,r),r.dispatch=n,r=Ho(!1),a=js.bind(null,G,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wo.bind(null,G,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Qo(e){return $o(Do(),co,e)}function $o(e,t,n){if(t=Po(e,t,Xo)[0],e=No(Mo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ko(t)}catch(e){throw e===va?ba:e}else r=t;t=Do();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(G.flags|=2048,ns(9,{destroy:void 0},es.bind(null,i,n),null)),[r,a,e]}function es(e,t){e.action=t}function ts(e){var t=Do(),n=co;if(n!==null)return $o(t,n,e);Do(),t=t.memoizedState,n=Do();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ns(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=G.updateQueue,t===null&&(t=Oo(),G.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function rs(){return Do().memoizedState}function is(e,t,n,r){var i=Eo();G.flags|=e,i.memoizedState=ns(1|t,{destroy:void 0},n,r===void 0?null:r)}function as(e,t,n,r){var i=Do();r=r===void 0?null:r;var a=i.memoizedState.inst;co!==null&&r!==null&&vo(r,co.memoizedState.deps)?i.memoizedState=ns(t,a,n,r):(G.flags|=e,i.memoizedState=ns(1|t,a,n,r))}function os(e,t){is(8390656,8,e,t)}function ss(e,t){as(2048,8,e,t)}function cs(e){G.flags|=4;var t=G.updateQueue;if(t===null)t=Oo(),G.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ls(e){var t=Do().memoizedState;return cs({ref:t,nextImpl:e}),function(){if(q&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function us(e,t){return as(4,2,e,t)}function ds(e,t){return as(4,4,e,t)}function fs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ps(e,t,n){n=n==null?null:n.concat([e]),as(4,4,fs.bind(null,t,e),n)}function ms(){}function hs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function gs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r}function _s(e,t,n){return n===void 0||so&1073741824&&!(Y&261930)?e.memoizedState=t:(e.memoizedState=n,e=mu(),G.lanes|=e,Kl|=e,n)}function vs(e,t,n,r){return br(n,t)?n:qa.current===null?!(so&42)||so&1073741824&&!(Y&261930)?(ec=!0,e.memoizedState=n):(e=mu(),G.lanes|=e,Kl|=e,t):(e=_s(e,n,r),br(e,t)||(ec=!0),e)}function ys(e,t,n,r,i){var a=M.p;M.p=a!==0&&8>a?a:8;var o=j.T,s={};j.T=s,js(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,fa(c,r),pu(e)):As(e,t,r,pu(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ss(e).queue;ys(e,a,t,ae,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:ae},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},pu())}function ws(){return Qi(ep)}function Ts(){return Do().memoizedState}function Es(){return Do().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=za(n);var r=W(t,e,n);r!==null&&(hu(r,t,n),Ba(r,t,n)),t={cache:aa()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=ei(e,t,n,r),n!==null&&(hu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,pu())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,br(s,o))return $r(e,t,i,0),Rl===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return hu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:fd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(i(479))}else t=ei(e,n,r,2),t!==null&&hu(t,e,2)}function Ms(e){var t=e.alternate;return e===G||t!==null&&t===G}function Ns(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$e(e,n)}}var Fs={readContext:Qi,use:Ao,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Fs.useEffectEvent=_o;var Is={readContext:Qi,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Qi,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){Le(!0);try{e()}finally{Le(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){Le(!0);try{n(t)}finally{Le(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Os.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=ks.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=ys.bind(null,G,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,a=Eo();if(H){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Rl===null)throw Error(i(349));Y&127||Lo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,os(zo.bind(null,r,o,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=Rl.identifierPrefix;if(H){var n=wi,r=Ci;n=(r&~(1<<32-Re(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ws,useFormState:Zo,useActionState:Zo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=js.bind(null,G,!0,n),n.dispatch=t,[e,t]},useMemoCache:jo,useCacheRefresh:function(){return Eo().memoizedState=Ds.bind(null,G)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(q&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ls={readContext:Qi,use:Ao,useCallback:hs,useContext:Qi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:No,useRef:rs,useState:function(){return No(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){return vs(Do(),co.memoizedState,e,t)},useTransition:function(){var e=No(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){return Uo(Do(),co,e,t)},useMemoCache:jo,useCacheRefresh:Es};Ls.useEffectEvent=ls;var Rs={readContext:Qi,use:Ao,useCallback:hs,useContext:Qi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:Fo,useRef:rs,useState:function(){return Fo(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){var n=Do();return co===null?_s(n,e,t):vs(n,co.memoizedState,e,t)},useTransition:function(){var e=Fo(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){var n=Do();return co===null?(n.baseState=e,[e,n.queue.dispatch]):Uo(n,co,e,t)},useMemoCache:jo,useCacheRefresh:Es};Rs.useEffectEvent=ls;function zs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=pu(),i=za(r);i.payload=t,n!=null&&(i.callback=n),t=W(e,i,r),t!==null&&(hu(t,e,r),Ba(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=pu(),i=za(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=W(e,i,r),t!==null&&(hu(t,e,r),Ba(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=pu(),r=za(n);r.tag=2,t!=null&&(r.callback=t),t=W(e,r,n),t!==null&&(hu(t,e,n),Ba(t,e,n))}};function Vs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!xr(n,r)||!xr(i,a):!0}function Hs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Bs.enqueueReplaceState(t,t.state,null)}function Us(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ws(e){Jr(e)}function Gs(e){console.error(e)}function Ks(e){Jr(e)}function qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ys(e,t,n){return n=za(n),n.tag=3,n.payload={element:null},n.callback=function(){qs(e,t)},n}function Xs(e){return e=za(e),e.tag=3,e}function Zs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Js(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Js(t,n,r),typeof i!=`function`&&(ru===null?ru=new Set([this]):ru.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Qs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Yi(t,n,a,!0),n=Qa.current,n!==null){switch(n.tag){case 31:case 13:return $a===null?Du():n.alternate===null&&Gl===0&&(Gl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Ku(e,r,a)),!1;case 22:return n.flags|=65536,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Ku(e,r,a)),!1}throw Error(i(435,n.tag))}return Ku(e,r,a),Du(),!1}if(H)return t=Qa.current,t===null?(r!==Pi&&(t=Error(i(423),{cause:r}),Vi(hi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=hi(r,n),a=Ys(e.stateNode,r,a),Va(e,a),Gl!==4&&(Gl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Pi&&(e=Error(i(422),{cause:r}),Vi(hi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=hi(o,n),Zl===null?Zl=[o]:Zl.push(o),Gl!==4&&(Gl=2),t===null)return!0;r=hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ys(n.stateNode,r,e),Va(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(ru===null||!ru.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Xs(a),Zs(a,e,n,r),Va(n,a),!1}n=n.return}while(n!==null);return!1}var $s=Error(i(461)),ec=!1;function tc(e,t,n,r){t.child=e===null?Fa(t,null,n,r):Pa(t,e.child,n,r)}function nc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Zi(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(H&&s&&Di(t),t.flags|=1,tc(e,t,r,i),t.child)}function rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!si(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ic(e,t,a,r,i)):(e=V(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Dc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?xr:n,n(o,r)&&e.ref===t.ref)return Ec(e,t,i)}return t.flags|=1,e=ci(a,r),e.ref=t.ref,e.return=t,t.child=e}function ic(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(xr(a,r)&&e.ref===t.ref)if(ec=!1,t.pendingProps=r=a,Dc(e,i))e.flags&131072&&(ec=!0);else return t.lanes=e.lanes,Ec(e,t,i)}return fc(e,t,n,r,i)}function ac(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return sc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ga(t,a===null?null:a.cachePool),a===null?Xa():Ya(t,a),no(t);else return r=t.lanes=536870912,sc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ga(t,null),Xa(),ro(t)):(ga(t,a.cachePool),Ya(t,a),ro(t),t.memoizedState=null);return tc(e,t,i,n),t.child}function oc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sc(e,t,n,r,i){var a=ha();return a=a===null?null:{parent:ia._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ga(t,null),Xa(),no(t),e!==null&&Yi(e,t,r,!0),t.childLanes=i,null}function cc(e,t){return t=xc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function lc(e,t,n){return Pa(t,e.child,null,n),e=cc(t,t.pendingProps),e.flags|=2,io(t),t.memoizedState=null,e}function uc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(H){if(r.mode===`hidden`)return e=cc(t,r),t.lanes=536870912,oc(null,e);if(to(t),(e=ji)?(e=of(e,Ni),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,Ai=t,ji=null)):e=null,e===null)throw Fi(t);return t.lanes=536870912,null}return cc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(to(t),a)if(t.flags&256)t.flags&=-257,t=lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ec||Yi(e,t,n,!1),a=(n&e.childLanes)!==0,ec||a){if(r=Rl,r!==null&&(s=et(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ti(e,s),hu(r,e,s),$s;Du(),t=lc(e,t,n)}else e=o.treeContext,ji=uf(s.nextSibling),Ai=t,H=!0,Mi=null,Ni=!1,e!==null&&ki(t,e),t=cc(t,r),t.flags|=4096;return t}return e=ci(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function dc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function fc(e,t,n,r,i){return Zi(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(H&&r&&Di(t),t.flags|=1,tc(e,t,n,i),t.child)}function pc(e,t,n,r,i,a){return Zi(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!ec?(wo(e,t,a),Ec(e,t,a)):(H&&r&&Di(t),t.flags|=1,tc(e,t,n,a),t.child)}function mc(e,t,n,r,i){if(Zi(t),t.stateNode===null){var a=ii,o=n.contextType;typeof o==`object`&&o&&(a=Qi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Bs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},La(t),o=n.contextType,a.context=typeof o==`object`&&o?Qi(o):ii,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(zs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Bs.enqueueReplaceState(a,a.state,null),Wa(t,r,a,i),Ua(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Us(n,s);a.props=c;var l=a.context,u=n.contextType;o=ii,typeof u==`object`&&u&&(o=Qi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Hs(t,a,r,o),Ia=!1;var f=t.memoizedState;a.state=f,Wa(t,r,a,i),Ua(),l=t.memoizedState,s||f!==l||Ia?(typeof d==`function`&&(zs(t,n,d,r),l=t.memoizedState),(c=Ia||Vs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ra(e,t),o=t.memoizedProps,u=Us(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ii,typeof l==`object`&&l&&(c=Qi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Hs(t,a,r,c),Ia=!1,f=t.memoizedState,a.state=f,Wa(t,r,a,i),Ua();var p=t.memoizedState;o!==d||f!==p||Ia||e!==null&&e.dependencies!==null&&Xi(e.dependencies)?(typeof s==`function`&&(zs(t,n,s,r),p=t.memoizedState),(u=Ia||Vs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Xi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,dc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Pa(t,e.child,null,i),t.child=Pa(t,null,n,i)):tc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ec(e,t,i),e}function hc(e,t,n,r){return zi(),t.flags|=256,tc(e,t,n,r),t.child}var gc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _c(e){return{baseLanes:e,cachePool:_a()}}function vc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function yc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(ao.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(H){if(a?eo(t):ro(t),(e=ji)?(e=of(e,Ni),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,Ai=t,ji=null)):e=null,e===null)throw Fi(t);return cf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(ro(t),a=t.mode,c=xc({mode:`hidden`,children:c},a),r=ui(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(null,r)):(eo(t),bc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(eo(t),t.flags&=-257,t=Sc(e,t,n)):t.memoizedState===null?(ro(t),c=r.fallback,a=t.mode,r=xc({mode:`visible`,children:r.children},a),c=ui(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Pa(t,e.child,null,n),r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,t=oc(null,r)):(ro(t),t.child=e.child,t.flags|=128,t=null);else if(eo(t),cf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Vi({value:r,source:null,stack:null}),t=Sc(e,t,n)}else if(ec||Yi(e,t,n,!1),s=(n&e.childLanes)!==0,ec||s){if(s=Rl,s!==null&&(r=et(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ti(e,r),hu(s,e,r),$s;sf(c)||Du(),t=Sc(e,t,n)}else sf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,ji=uf(c.nextSibling),Ai=t,H=!0,Mi=null,Ni=!1,e!==null&&ki(t,e),t=bc(t,r.children),t.flags|=4096);return t}return a?(ro(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ci(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ui(c,a,n,null),c.flags|=2):c=ci(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,oc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=_c(n):(a=c.cachePool,a===null?a=_a():(l=ia._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(e.child,r)):(eo(t),n=e.child,e=n.sibling,n=ci(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function bc(e,t){return t=xc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function xc(e,t){return e=oi(22,e,null,t),e.lanes=0,e}function Sc(e,t,n){return Pa(t,e.child,null,n),e=bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),qi(e.return,t,n)}function wc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Tc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ao.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,P(ao,o),tc(e,t,r,n),r=H?yi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cc(e,n,t);else if(e.tag===19)Cc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&oo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),wc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&oo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}wc(t,!0,n,null,a,r);break;case`together`:wc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ec(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Yi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ci(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ci(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Dc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Xi(e))):!0}function Oc(e,t,n){switch(t.tag){case 3:fe(t,t.stateNode.containerInfo),Gi(t,ia,e.memoizedState.cache),zi();break;case 27:case 5:me(t);break;case 4:fe(t,t.stateNode.containerInfo);break;case 10:Gi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,to(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(eo(t),e=Ec(e,t,n),e===null?null:e.sibling):yc(e,t,n):(eo(t),t.flags|=128,null);eo(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Yi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Tc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),P(ao,ao.current),r)break;return null;case 22:return t.lanes=0,ac(e,t,n,t.pendingProps);case 24:Gi(t,ia,e.memoizedState.cache)}return Ec(e,t,n)}function kc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ec=!0;else{if(!Dc(e,n)&&!(t.flags&128))return ec=!1,Oc(e,t,n);ec=!!(e.flags&131072)}else ec=!1,H&&t.flags&1048576&&Ei(t,yi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=wa(t.elementType),t.type=e,typeof e==`function`)si(e)?(r=Us(e,r),t.tag=1,t=mc(null,t,e,r,n)):(t.tag=0,t=fc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=nc(null,t,e,r,n);break a}else if(a===ee){t.tag=14,t=rc(null,t,e,r,n);break a}}throw t=re(e)||e,Error(i(306,t,``))}}return t;case 0:return fc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Us(r,t.pendingProps),mc(e,t,r,a,n);case 3:a:{if(fe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ra(e,t),Wa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Gi(t,ia,r),r!==o.cache&&Ji(t,[ia],n,!0),Ua(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=hc(e,t,r,n);break a}else if(r!==a){a=hi(Error(i(424)),t),Vi(a),t=hc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ji=uf(e.firstChild),Ai=t,H=!0,Mi=null,Ni=!0,n=Fa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(zi(),r===a){t=Ec(e,t,n);break a}tc(e,t,r,n)}t=t.child}return t;case 26:return dc(e,t),e===null?(n=jf(t.type,null,t.pendingProps,null))?t.memoizedState=n:H||(n=t.type,e=t.pendingProps,r=Hd(F.current).createElement(n),r[ot]=t,r[st]=e,Id(r,n,e),vt(r),t.stateNode=r):t.memoizedState=jf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return me(t),e===null&&H&&(r=t.stateNode=mf(t.type,t.pendingProps,F.current),Ai=t,Ni=!0,a=ji,$d(t.type)?(df=a,ji=uf(r.firstChild)):ji=a),tc(e,t,t.pendingProps.children,n),dc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&H&&((a=r=ji)&&(r=rf(r,t.type,t.pendingProps,Ni),r===null?a=!1:(t.stateNode=r,Ai=t,ji=uf(r.firstChild),Ni=!1,a=!0)),a||Fi(t)),me(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Gd(a,o)?r=null:s!==null&&Gd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=yo(e,t,So,null,null,n),ep._currentValue=a),dc(e,t),tc(e,t,r,n),t.child;case 6:return e===null&&H&&((e=n=ji)&&(n=af(n,t.pendingProps,Ni),n===null?e=!1:(t.stateNode=n,Ai=t,ji=null,e=!0)),e||Fi(t)),null;case 13:return yc(e,t,n);case 4:return fe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pa(t,null,r,n):tc(e,t,r,n),t.child;case 11:return nc(e,t,t.type,t.pendingProps,n);case 7:return tc(e,t,t.pendingProps,n),t.child;case 8:return tc(e,t,t.pendingProps.children,n),t.child;case 12:return tc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Gi(t,t.type,r.value),tc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Zi(t),a=Qi(a),r=r(a),t.flags|=1,tc(e,t,r,n),t.child;case 14:return rc(e,t,t.type,t.pendingProps,n);case 15:return ic(e,t,t.type,t.pendingProps,n);case 19:return Tc(e,t,n);case 31:return uc(e,t,n);case 22:return ac(e,t,n,t.pendingProps);case 24:return Zi(t),r=Qi(ia),e===null?(a=ha(),a===null&&(a=Rl,o=aa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},La(t),Gi(t,ia,a)):((e.lanes&n)!==0&&(Ra(e,t),Wa(t,null,null,n),Ua()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Gi(t,ia,r),r!==a.cache&&Ji(t,[ia],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Gi(t,ia,r))),tc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ac(e){e.flags|=4}function jc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(wu())e.flags|=8192;else throw Ta=xa,ya}else e.flags&=-16777217}function Mc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Kf(t))if(wu())e.flags|=8192;else throw Ta=xa,ya}function Nc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:R(),e.lanes|=t,Xl|=t)}function Pc(e,t){if(!H)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Fc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ic(e,t,n){var r=t.pendingProps;switch(Oi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fc(t),null;case 1:return Fc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ki(ia),pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ri(t)?Ac(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Bi())),Fc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ac(t),o===null?(Fc(t),jc(t,a,null,r,n)):(Fc(t),Mc(t,o))):o?o===e.memoizedState?(Fc(t),t.flags&=-16777217):(Ac(t),Fc(t),Mc(t,o)):(e=e.memoizedProps,e!==r&&Ac(t),Fc(t),jc(t,a,e,r,n)),null;case 27:if(I(t),n=F.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Fc(t),null}e=le.current,Ri(t)?Ii(t,e):(e=mf(a,r,n),t.stateNode=e,Ac(t))}return Fc(t),null;case 5:if(I(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Fc(t),null}if(o=le.current,Ri(t))Ii(t,o);else{var s=Hd(F.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[ot]=t,o[st]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Id(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ac(t)}}return Fc(t),jc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=F.current,Ri(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ai,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Nd(e.nodeValue,n)),e||Fi(t,!0)}else e=Hd(e).createTextNode(r),e[ot]=t,t.stateNode=e}return Fc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ri(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[ot]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),e=!1}else n=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(i(558))}return Fc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ri(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[ot]=t}else zi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),a=!1}else a=Bi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Nc(t,t.updateQueue),Fc(t),null);case 4:return pe(),e===null&&Cd(t.stateNode.containerInfo),Fc(t),null;case 10:return Ki(t.type),Fc(t),null;case 19:if(N(ao),r=t.memoizedState,r===null)return Fc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Pc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=oo(e),o!==null){for(t.flags|=128,Pc(r,!1),e=o.updateQueue,t.updateQueue=e,Nc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)li(n,e),n=n.sibling;return P(ao,ao.current&1|2),H&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&De()>tu&&(t.flags|=128,a=!0,Pc(r,!1),t.lanes=4194304)}else{if(!a)if(e=oo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Nc(t,e),Pc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!H)return Fc(t),null}else 2*De()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,a=!0,Pc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Fc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=De(),e.sibling=null,n=ao.current,P(ao,a?n&1|2:n&1),H&&Ti(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Fc(t),t.subtreeFlags&6&&(t.flags|=8192)):Fc(t),n=t.updateQueue,n!==null&&Nc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&N(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ki(ia),Fc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Lc(e,t){switch(Oi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ki(ia),pe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return I(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(i(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));zi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return N(ao),null;case 4:return pe(),null;case 10:return Ki(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&N(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ki(ia),null;case 25:return null;default:return null}}function Rc(e,t){switch(Oi(t),t.tag){case 3:Ki(ia),pe();break;case 26:case 27:case 5:I(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:N(ao);break;case 10:Ki(t.type);break;case 22:case 23:io(t),Za(),e!==null&&N(ma);break;case 24:Ki(ia)}}function zc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Gu(t,t.return,e)}}function Bc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Gu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Gu(t,t.return,e)}}function Vc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Gu(e,e.return,t)}}}function Hc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Gu(e,t,n)}}function Uc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Gu(e,t,n)}}function Wc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Gu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Gu(e,t,n)}else n.current=null}function Gc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Gu(e,e.return,t)}}function Kc(e,t,n){try{var r=e.stateNode;Ld(r,e.type,n,t),r[st]=t}catch(t){Gu(e,e.return,t)}}function qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&$d(e.type)||e.tag===4}function Jc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||qc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&$d(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&$d(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Id(t,r,n),t[ot]=e,t[st]=n}catch(t){Gu(e,e.return,t)}}var Qc=!1,$c=!1,el=!1,tl=typeof WeakSet==`function`?WeakSet:Set,nl=null;function rl(e,t){if(e=e.containerInfo,Bd=lp,e=Tr(e),Er(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Vd={focusedElem:e,selectionRange:n},lp=!1,nl=t;nl!==null;)if(t=nl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,nl=e;else for(;nl!==null;){switch(t=nl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Us(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Gu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)nf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:nf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,nl=e;break}nl=t.return}}function il(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:yl(e,n),r&4&&zc(5,n);break;case 1:if(yl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Gu(n,n.return,e)}else{var i=Us(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Gu(n,n.return,e)}}r&64&&Vc(n),r&512&&Uc(n,n.return);break;case 3:if(yl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ka(e,t)}catch(e){Gu(n,n.return,e)}}break;case 27:t===null&&r&4&&Zc(n);case 26:case 5:yl(e,n),t===null&&r&4&&Gc(n),r&512&&Uc(n,n.return);break;case 12:yl(e,n);break;case 31:yl(e,n),r&4&&ul(e,n);break;case 13:yl(e,n),r&4&&dl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Yu.bind(null,n),lf(e,n))));break;case 22:if(r=n.memoizedState!==null||Qc,!r){t=t!==null&&t.memoizedState!==null||$c,i=Qc;var a=$c;Qc=r,($c=t)&&!a?xl(e,n,(n.subtreeFlags&8772)!=0):yl(e,n),Qc=i,$c=a}break;case 30:break;default:yl(e,n)}}function al(e){var t=e.alternate;t!==null&&(e.alternate=null,al(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&pt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ol=null,sl=!1;function cl(e,t,n){for(n=n.child;n!==null;)ll(e,t,n),n=n.sibling}function ll(e,t,n){if(Ie&&typeof Ie.onCommitFiberUnmount==`function`)try{Ie.onCommitFiberUnmount(Fe,n)}catch{}switch(n.tag){case 26:$c||Wc(n,t),cl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:$c||Wc(n,t);var r=ol,i=sl;$d(n.type)&&(ol=n.stateNode,sl=!1),cl(e,t,n),hf(n.stateNode),ol=r,sl=i;break;case 5:$c||Wc(n,t);case 6:if(r=ol,i=sl,ol=null,cl(e,t,n),ol=r,sl=i,ol!==null)if(sl)try{(ol.nodeType===9?ol.body:ol.nodeName===`HTML`?ol.ownerDocument.body:ol).removeChild(n.stateNode)}catch(e){Gu(n,t,e)}else try{ol.removeChild(n.stateNode)}catch(e){Gu(n,t,e)}break;case 18:ol!==null&&(sl?(e=ol,ef(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Fp(e)):ef(ol,n.stateNode));break;case 4:r=ol,i=sl,ol=n.stateNode.containerInfo,sl=!0,cl(e,t,n),ol=r,sl=i;break;case 0:case 11:case 14:case 15:Bc(2,n,t),$c||Bc(4,n,t),cl(e,t,n);break;case 1:$c||(Wc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Hc(n,t,r)),cl(e,t,n);break;case 21:cl(e,t,n);break;case 22:$c=(r=$c)||n.memoizedState!==null,cl(e,t,n),$c=r;break;default:cl(e,t,n)}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Fp(e)}catch(e){Gu(t,t.return,e)}}}function dl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fp(e)}catch(e){Gu(t,t.return,e)}}function fl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new tl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new tl),t;default:throw Error(i(435,e.tag))}}function pl(e,t){var n=fl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Xu.bind(null,e,t);t.then(r,r)}})}function ml(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if($d(c.type)){ol=c.stateNode,sl=!1;break a}break;case 5:ol=c.stateNode,sl=!1;break a;case 3:case 4:ol=c.stateNode.containerInfo,sl=!0;break a}c=c.return}if(ol===null)throw Error(i(160));ll(o,s,a),ol=null,sl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gl(t,e),t=t.sibling}var hl=null;function gl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ml(t,e),_l(e),r&4&&(Bc(3,e,e.return),zc(3,e),Bc(5,e,e.return));break;case 1:ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),r&64&&Qc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=hl;if(ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ft]||o[ot]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Id(o,r,n),o[ot]=e,vt(o),r=o;break a;case`link`:var s=Uf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Id(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Uf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Id(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ot]=e,vt(o),r=o}e.stateNode=r}else Wf(a,e.type,e.stateNode);else e.stateNode=Rf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Kc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Wf(a,e.type,e.stateNode):Rf(a,r,e.memoizedProps))}break;case 27:ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),n!==null&&r&4&&Kc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),e.flags&32){a=e.stateNode;try{Wt(a,``)}catch(t){Gu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Kc(e,a,n===null?a:n.memoizedProps)),r&1024&&(el=!0);break;case 6:if(ml(t,e),_l(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Gu(e,e.return,t)}}break;case 3:if(Hf=null,a=hl,hl=vf(t.containerInfo),ml(t,e),hl=a,_l(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fp(t.containerInfo)}catch(t){Gu(e,e.return,t)}el&&(el=!1,vl(e));break;case 4:r=hl,hl=vf(e.stateNode.containerInfo),ml(t,e),_l(e),hl=r;break;case 12:ml(t,e),_l(e);break;case 31:ml(t,e),_l(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 13:ml(t,e),_l(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&($l=De()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Qc,d=$c;if(Qc=u||a,$c=d||l,ml(t,e),$c=d,Qc=u,_l(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Qc||$c||bl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Gu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Gu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?tf(m,!0):tf(l.stateNode,!1)}catch(e){Gu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,pl(e,n))));break;case 19:ml(t,e),_l(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 30:break;case 21:break;default:ml(t,e),_l(e)}}function _l(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(qc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Xc(e,Jc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Wt(o,``),n.flags&=-33),Xc(e,Jc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Yc(e,Jc(e),s);break;default:throw Error(i(161))}}catch(t){Gu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function vl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;vl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function yl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)il(e,t.alternate,t),t=t.sibling}function bl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Bc(4,t,t.return),bl(t);break;case 1:Wc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Hc(t,t.return,n),bl(t);break;case 27:hf(t.stateNode);case 26:case 5:Wc(t,t.return),bl(t);break;case 22:t.memoizedState===null&&bl(t);break;case 30:bl(t);break;default:bl(t)}e=e.sibling}}function xl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:xl(i,a,n),zc(4,a);break;case 1:if(xl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Gu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ga(c[i],s)}catch(e){Gu(r,r.return,e)}}n&&o&64&&Vc(a),Uc(a,a.return);break;case 27:Zc(a);case 26:case 5:xl(i,a,n),n&&r===null&&o&4&&Gc(a),Uc(a,a.return);break;case 12:xl(i,a,n);break;case 31:xl(i,a,n),n&&o&4&&ul(i,a);break;case 13:xl(i,a,n),n&&o&4&&dl(i,a);break;case 22:a.memoizedState===null&&xl(i,a,n),Uc(a,a.return);break;case 30:break;default:xl(i,a,n)}t=t.sibling}}function Sl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&oa(n))}function Cl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oa(e))}function wl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Tl(e,t,n,r),t=t.sibling}function Tl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:wl(e,t,n,r),i&2048&&zc(9,t);break;case 1:wl(e,t,n,r);break;case 3:wl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&oa(e)));break;case 12:if(i&2048){wl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Gu(t,t.return,e)}}else wl(e,t,n,r);break;case 31:wl(e,t,n,r);break;case 13:wl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?wl(e,t,n,r):(a._visibility|=2,El(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?wl(e,t,n,r):Dl(e,t),i&2048&&Sl(o,t);break;case 24:wl(e,t,n,r),i&2048&&Cl(t.alternate,t);break;default:wl(e,t,n,r)}}function El(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:El(a,o,s,c,i),zc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,El(a,o,s,c,i)):u._visibility&2?El(a,o,s,c,i):Dl(a,o),i&&l&2048&&Sl(o.alternate,o);break;case 24:El(a,o,s,c,i),i&&l&2048&&Cl(o.alternate,o);break;default:El(a,o,s,c,i)}t=t.sibling}}function Dl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Dl(n,r),i&2048&&Sl(r.alternate,r);break;case 24:Dl(n,r),i&2048&&Cl(r.alternate,r);break;default:Dl(n,r)}t=t.sibling}}var Ol=8192;function kl(e,t,n){if(e.subtreeFlags&Ol)for(e=e.child;e!==null;)Al(e,t,n),e=e.sibling}function Al(e,t,n){switch(e.tag){case 26:kl(e,t,n),e.flags&Ol&&e.memoizedState!==null&&qf(n,hl,e.memoizedState,e.memoizedProps);break;case 5:kl(e,t,n);break;case 3:case 4:var r=hl;hl=vf(e.stateNode.containerInfo),kl(e,t,n),hl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ol,Ol=16777216,kl(e,t,n),Ol=r):kl(e,t,n));break;default:kl(e,t,n)}}function jl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nl=r,Fl(r,e)}jl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Nl(e),e=e.sibling}function Nl(e){switch(e.tag){case 0:case 11:case 15:Ml(e),e.flags&2048&&Bc(9,e,e.return);break;case 3:Ml(e);break;case 12:Ml(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):Ml(e);break;default:Ml(e)}}function Pl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nl=r,Fl(r,e)}jl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Bc(8,t,t.return),Pl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function Fl(e,t){for(;nl!==null;){var n=nl;switch(n.tag){case 0:case 11:case 15:Bc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:oa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,nl=r;else a:for(n=e;nl!==null;){r=nl;var i=r.sibling,a=r.return;if(al(r),r===n){nl=null;break a}if(i!==null){i.return=a,nl=i;break a}nl=a}}}var Il={getCacheForType:function(e){var t=Qi(ia),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Qi(ia).controller.signal}},Ll=typeof WeakMap==`function`?WeakMap:Map,q=0,Rl=null,J=null,Y=0,zl=0,Bl=null,Vl=!1,Hl=!1,Ul=!1,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,X=null,Ql=!1,$l=0,eu=0,tu=1/0,nu=null,ru=null,iu=0,au=null,ou=null,su=0,cu=0,lu=null,uu=null,du=0,fu=null;function pu(){return q&2&&Y!==0?Y&-Y:j.T===null?rt():fd()}function mu(){if(Yl===0)if(!(Y&536870912)||H){var e=Ue;Ue<<=1,!(Ue&3932160)&&(Ue=262144),Yl=e}else Yl=536870912;return e=Qa.current,e!==null&&(e.flags|=32),Yl}function hu(e,t,n){(e===Rl&&(zl===2||zl===9)||e.cancelPendingCommit!==null)&&(Su(e,0),yu(e,Y,Yl,!1)),Xe(e,n),(!(q&2)||e!==Rl)&&(e===Rl&&(!(q&2)&&(ql|=n),Gl===4&&yu(e,Y,Yl,!1)),id(e))}function gu(e,t,n){if(q&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||qe(e,t),a=r?Au(e,t):Ou(e,t,!0),o=r;do{if(a===0){Hl&&!r&&yu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!vu(n)){a=Ou(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Su(c,s).flags|=256),s=Ou(c,s,!1),s!==2){if(Ul&&!l){c.errorRecoveryDisabledLanes|=o,ql|=o,a=4;break a}o=X,X=a,o!==null&&(X===null?X=o:X.push.apply(X,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Su(e,0),yu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:yu(r,t,Yl,!Vl);break a;case 2:X=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=$l+300-De(),10<a)){if(yu(r,t,Yl,!Vl),Ke(r,0,!0)!==0)break a;su=t,r.timeoutHandle=Jd(_u.bind(null,r,n,X,nu,Ql,t,Yl,ql,Xl,Vl,o,`Throttled`,-0,0),a);break a}_u(r,n,X,nu,Ql,t,Yl,ql,Xl,Vl,o,null,-0,0)}}break}while(1);id(e)}function _u(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qt},Al(t,a,d);var m=(a&62914560)===a?$l-De():(a&4194048)===a?eu-De():0;if(m=Yf(d,m),m!==null){su=a,e.cancelPendingCommit=m(Lu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),yu(e,a,o,!l);return}}Lu(e,t,a,n,r,i,o,s,c)}function vu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!br(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function yu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Re(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Qe(e,n,t)}function bu(){return q&6?!0:(ad(0,!1),!1)}function xu(){if(J!==null){if(zl===0)var e=J.return;else e=J,Wi=Ui=null,To(e),Oa=null,ka=0,e=J;for(;e!==null;)Rc(e.alternate,e),e=e.return;J=null}}function Su(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Yd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),su=0,xu(),Rl=e,J=n=ci(e.current,null),Y=t,zl=0,Bl=null,Vl=!1,Hl=qe(e,t),Ul=!1,Xl=Yl=Jl=ql=Kl=Gl=0,X=Zl=null,Ql=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Re(r),a=1<<i;t|=e[i],r&=~a}return Wl=t,Qr(),n}function Cu(e,t){G=null,j.H=Fs,t===va||t===ba?(t=Ea(),zl=3):t===ya?(t=Ea(),zl=4):zl=t===$s?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Bl=t,J===null&&(Gl=1,qs(e,hi(t,e.current)))}function wu(){var e=Qa.current;return e===null?!0:(Y&4194048)===Y?$a===null:(Y&62914560)===Y||Y&536870912?e===$a:!1}function Tu(){var e=j.H;return j.H=Fs,e===null?Fs:e}function Eu(){var e=j.A;return j.A=Il,e}function Du(){Gl=4,Vl||(Y&4194048)!==Y&&Qa.current!==null||(Hl=!0),!(Kl&134217727)&&!(ql&134217727)||Rl===null||yu(Rl,Y,Yl,!1)}function Ou(e,t,n){var r=q;q|=2;var i=Tu(),a=Eu();(Rl!==e||Y!==t)&&(nu=null,Su(e,t)),t=!1;var o=Gl;a:do try{if(zl!==0&&J!==null){var s=J,c=Bl;switch(zl){case 8:xu(),o=6;break a;case 3:case 2:case 9:case 6:Qa.current===null&&(t=!0);var l=zl;if(zl=0,Bl=null,Pu(e,s,c,l),n&&Hl){o=0;break a}break;default:l=zl,zl=0,Bl=null,Pu(e,s,c,l)}}ku(),o=Gl;break}catch(t){Cu(e,t)}while(1);return t&&e.shellSuspendCounter++,Wi=Ui=null,q=r,j.H=i,j.A=a,J===null&&(Rl=null,Y=0,Qr()),o}function ku(){for(;J!==null;)Mu(J)}function Au(e,t){var n=q;q|=2;var r=Tu(),a=Eu();Rl!==e||Y!==t?(nu=null,tu=De()+500,Su(e,t)):Hl=qe(e,t);a:do try{if(zl!==0&&J!==null){t=J;var o=Bl;b:switch(zl){case 1:zl=0,Bl=null,Pu(e,t,o,1);break;case 2:case 9:if(Sa(o)){zl=0,Bl=null,Nu(t);break}t=function(){zl!==2&&zl!==9||Rl!==e||(zl=7),id(e)},o.then(t,t);break a;case 3:zl=7;break a;case 4:zl=5;break a;case 7:Sa(o)?(zl=0,Bl=null,Nu(t)):(zl=0,Bl=null,Pu(e,t,o,7));break;case 5:var s=null;switch(J.tag){case 26:s=J.memoizedState;case 5:case 27:var c=J;if(s?Kf(s):c.stateNode.complete){zl=0,Bl=null;var l=c.sibling;if(l!==null)J=l;else{var u=c.return;u===null?J=null:(J=u,Fu(u))}break b}}zl=0,Bl=null,Pu(e,t,o,5);break;case 6:zl=0,Bl=null,Pu(e,t,o,6);break;case 8:xu(),Gl=6;break a;default:throw Error(i(462))}}ju();break}catch(t){Cu(e,t)}while(1);return Wi=Ui=null,j.H=r,j.A=a,q=n,J===null?(Rl=null,Y=0,Qr(),Gl):0}function ju(){for(;J!==null&&!Te();)Mu(J)}function Mu(e){var t=kc(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,t===null?Fu(e):J=t}function Nu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pc(n,t,t.pendingProps,t.type,void 0,Y);break;case 11:t=pc(n,t,t.pendingProps,t.type.render,t.ref,Y);break;case 5:To(t);default:Rc(n,t),t=J=li(t,Wl),t=kc(n,t,Wl)}e.memoizedProps=e.pendingProps,t===null?Fu(e):J=t}function Pu(e,t,n,r){Wi=Ui=null,To(t),Oa=null,ka=0;var i=t.return;try{if(Qs(e,i,t,n,Y)){Gl=1,qs(e,hi(n,e.current)),J=null;return}}catch(t){if(i!==null)throw J=i,t;Gl=1,qs(e,hi(n,e.current)),J=null;return}t.flags&32768?(H||r===1?e=!0:Hl||Y&536870912?e=!1:(Vl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Iu(t,e)):Fu(t)}function Fu(e){var t=e;do{if(t.flags&32768){Iu(t,Vl);return}e=t.return;var n=Ic(t.alternate,t,Wl);if(n!==null){J=n;return}if(t=t.sibling,t!==null){J=t;return}J=t=e}while(t!==null);Gl===0&&(Gl=5)}function Iu(e,t){do{var n=Lc(e.alternate,e);if(n!==null){n.flags&=32767,J=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){J=e;return}J=e=n}while(e!==null);Gl=6,J=null}function Lu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Hu();while(iu!==0);if(q&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Zr,Ze(e,n,o,s,c,l),e===Rl&&(J=Rl=null,Y=0),ou=t,au=e,su=n,cu=o,lu=a,uu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Zu(je,function(){return Uu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=j.T,j.T=null,a=M.p,M.p=2,s=q,q|=4;try{rl(e,t,n)}finally{q=s,M.p=a,j.T=r}}iu=1,Ru(),zu(),Bu()}}function Ru(){if(iu===1){iu=0;var e=au,t=ou,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=q;q|=4;try{gl(t,e);var a=Vd,o=Tr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&wr(s.ownerDocument.documentElement,s)){if(c!==null&&Er(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Cr(s,h),v=Cr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}lp=!!Bd,Vd=Bd=null}finally{q=i,M.p=r,j.T=n}}e.current=t,iu=2}}function zu(){if(iu===2){iu=0;var e=au,t=ou,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=q;q|=4;try{il(e,t.alternate,t)}finally{q=i,M.p=r,j.T=n}}iu=3}}function Bu(){if(iu===4||iu===3){iu=0,Ee();var e=au,t=ou,n=su,r=uu;t.subtreeFlags&10256||t.flags&10256?iu=5:(iu=0,ou=au=null,Vu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ru=null),nt(n),t=t.stateNode,Ie&&typeof Ie.onCommitFiberRoot==`function`)try{Ie.onCommitFiberRoot(Fe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=j.T,i=M.p,M.p=2,j.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{j.T=t,M.p=i}}su&3&&Hu(),id(e),i=e.pendingLanes,n&261930&&i&42?e===fu?du++:(du=0,fu=e):du=0,ad(0,!1)}}function Vu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,oa(t)))}function Hu(){return Ru(),zu(),Bu(),Uu()}function Uu(){if(iu!==5)return!1;var e=au,t=cu;cu=0;var n=nt(su),r=j.T,a=M.p;try{M.p=32>n?32:n,j.T=null,n=lu,lu=null;var o=au,s=su;if(iu=0,ou=au=null,su=0,q&6)throw Error(i(331));var c=q;if(q|=4,Nl(o.current),Tl(o,o.current,s,n),q=c,ad(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot==`function`)try{Ie.onPostCommitFiberRoot(Fe,o)}catch{}return!0}finally{M.p=a,j.T=r,Vu(e,t)}}function Wu(e,t,n){t=hi(n,t),t=Ys(e.stateNode,t,2),e=W(e,t,2),e!==null&&(Xe(e,2),id(e))}function Gu(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=hi(n,e),n=Xs(2),r=W(t,n,2),r!==null&&(Zs(n,r,t,e),Xe(r,2),id(r));break}}t=t.return}}function Ku(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ll;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=qu.bind(null,e,t,n),t.then(e,e))}function qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Rl===e&&(Y&n)===n&&(Gl===4||Gl===3&&(Y&62914560)===Y&&300>De()-$l?!(q&2)&&Su(e,0):Jl|=n,Xl===Y&&(Xl=0)),id(e)}function Ju(e,t){t===0&&(t=R()),e=ti(e,t),e!==null&&(Xe(e,t),id(e))}function Yu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ju(e,n)}function Xu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Ju(e,n)}function Zu(e,t){return Ce(e,t)}var Qu=null,$u=null,ed=!1,td=!1,nd=!1,rd=0;function id(e){e!==$u&&e.next===null&&($u===null?Qu=$u=e:$u=$u.next=e),td=!0,ed||(ed=!0,dd())}function ad(e,t){if(!nd&&td){nd=!0;do for(var n=!1,r=Qu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Re(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ud(r,a))}else a=Y,a=Ke(r,r===Rl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||qe(r,a)||(n=!0,ud(r,a));r=r.next}while(n);nd=!1}}function od(){sd()}function sd(){td=ed=!1;var e=0;rd!==0&&qd()&&(e=rd);for(var t=De(),n=null,r=Qu;r!==null;){var i=r.next,a=cd(r,t);a===0?(r.next=null,n===null?Qu=i:n.next=i,i===null&&($u=n)):(n=r,(e!==0||a&3)&&(td=!0)),r=i}iu!==0&&iu!==5||ad(e,!1),rd!==0&&(rd=0)}function cd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Re(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Je(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Rl,n=Y,n=Ke(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(zl===2||zl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&we(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||qe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&we(r),nt(n)){case 2:case 8:n=Ae;break;case 32:n=je;break;case 268435456:n=Ne;break;default:n=je}return r=ld.bind(null,e),n=Ce(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&we(r),e.callbackPriority=2,e.callbackNode=null,2}function ld(e,t){if(iu!==0&&iu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Hu()&&e.callbackNode!==n)return null;var r=Y;return r=Ke(e,e===Rl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(gu(e,r,t),cd(e,De()),e.callbackNode!=null&&e.callbackNode===n?ld.bind(null,e):null)}function ud(e,t){if(Hu())return null;gu(e,t,!0)}function dd(){Zd(function(){q&6?Ce(ke,od):sd()})}function fd(){if(rd===0){var e=la;e===0&&(e=He,He<<=1,!(He&261888)&&(He=256)),rd=e}return rd}function pd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Zt(``+e)}function md(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function hd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=pd((i[st]||null).action),o=r.submitter;o&&(t=(t=o[st]||null)?pd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new yn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(rd!==0){var e=o?md(i,o):new FormData(i);xs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?md(i,o):new FormData(i),xs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var gd=0;gd<Kr.length;gd++){var _d=Kr[gd];qr(_d.toLowerCase(),`on`+(_d[0].toUpperCase()+_d.slice(1)))}qr(Rr,`onAnimationEnd`),qr(zr,`onAnimationIteration`),qr(Br,`onAnimationStart`),qr(`dblclick`,`onDoubleClick`),qr(`focusin`,`onFocus`),qr(`focusout`,`onBlur`),qr(Vr,`onTransitionRun`),qr(Hr,`onTransitionStart`),qr(Ur,`onTransitionCancel`),qr(Wr,`onTransitionEnd`),St(`onMouseEnter`,[`mouseout`,`mouseover`]),St(`onMouseLeave`,[`mouseout`,`mouseover`]),St(`onPointerEnter`,[`pointerout`,`pointerover`]),St(`onPointerLeave`,[`pointerout`,`pointerover`]),xt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),xt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),xt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),xt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var vd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),yd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(vd));function bd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Jr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Jr(e)}i.currentTarget=null,a=c}}}}function Z(e,t){var n=t[ct];n===void 0&&(n=t[ct]=new Set);var r=e+`__bubble`;n.has(r)||(wd(t,e,2,!1),n.add(r))}function xd(e,t,n){var r=0;t&&(r|=4),wd(n,e,r,t)}var Sd=`_reactListening`+Math.random().toString(36).slice(2);function Cd(e){if(!e[Sd]){e[Sd]=!0,yt.forEach(function(t){t!==`selectionchange`&&(yd.has(t)||xd(t,!1,e),xd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Sd]||(t[Sd]=!0,xd(`selectionchange`,!1,t))}}function wd(e,t,n,r){switch(gp(t)){case 2:var i=up;break;case 8:i=dp;break;default:i=fp}n=i.bind(null,t,n,e),i=void 0,!cn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Td(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=mt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}B(function(){var r=a,i=en(n),s=[];a:{var c=Gr.get(e);if(c!==void 0){var l=yn,u=e;switch(e){case`keypress`:if(mn(n)===0)break a;case`keydown`:case`keyup`:l=Ln;break;case`focusin`:u=`focus`,l=On;break;case`focusout`:u=`blur`,l=On;break;case`beforeblur`:case`afterblur`:l=On;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=En;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Dn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=zn;break;case Rr:case zr:case Br:l=kn;break;case Wr:l=Bn;break;case`scroll`:case`scrollend`:l=xn;break;case`wheel`:l=Vn;break;case`copy`:case`cut`:case`paste`:l=An;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Rn;break;case`toggle`:case`beforetoggle`:l=Hn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=on(m,p),g!=null&&d.push(Ed(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==$t&&(u=n.relatedTarget||n.fromElement)&&(mt(u)||u[z]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?mt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=En,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Rn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:gt(l),h=u==null?c:gt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,mt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Od,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&kd(s,c,l,d,!1),u!==null&&f!==null&&kd(s,f,u,d,!0)}}a:{if(c=r?gt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=cr;else if(nr(c))if(lr)v=vr;else{v=gr;var y=hr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Jt(r.elementType)&&(v=cr):v=_r;if(v&&=v(e,r)){rr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Bt(c,`number`,c.value)}switch(y=r?gt(r):window,e){case`focusin`:(nr(y)||y.contentEditable===`true`)&&(Or=y,kr=r,Ar=null);break;case`focusout`:Ar=kr=Or=null;break;case`mousedown`:jr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:jr=!1,Mr(s,n,i);break;case`selectionchange`:if(Dr)break;case`keydown`:case`keyup`:Mr(s,n,i)}var b;if(Wn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Qn?Xn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(qn&&n.locale!==`ko`&&(Qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Qn&&(b=pn()):(un=i,dn=`value`in un?un.value:un.textContent,Qn=!0)),y=Dd(r,x),0<y.length&&(x=new jn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Zn(n),b!==null&&(x.data=b)))),(b=Kn?$n(e,n):er(e,n))&&(x=Dd(r,`onBeforeInput`),0<x.length&&(y=new jn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),hd(s,e,r,n,i)}bd(s,t)})}function Ed(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Dd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=on(e,n),i!=null&&r.unshift(Ed(e,i,a)),i=on(e,t),i!=null&&r.push(Ed(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Od(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=on(n,a),l!=null&&o.unshift(Ed(n,l,c))):i||(l=on(n,a),l!=null&&o.push(Ed(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Ad=/\r\n?/g,jd=/\u0000|\uFFFD/g;function Md(e){return(typeof e==`string`?e:``+e).replace(Ad,`
|
|
9
|
+
`).replace(jd,``)}function Nd(e,t){return t=Md(t),Md(e)===t}function Pd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Wt(e,``+r);break;case`className`:Ot(e,`class`,r);break;case`tabIndex`:Ot(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ot(e,n,r);break;case`style`:qt(e,r,o);break;case`data`:if(t!==`object`){Ot(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Pd(e,t,`name`,a.name,a,null),Pd(e,t,`formEncType`,a.formEncType,a,null),Pd(e,t,`formMethod`,a.formMethod,a,null),Pd(e,t,`formTarget`,a.formTarget,a,null)):(Pd(e,t,`encType`,a.encType,a,null),Pd(e,t,`method`,a.method,a,null),Pd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`onScroll`:r!=null&&Z(`scroll`,e);break;case`onScrollEnd`:r!=null&&Z(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Zt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Z(`beforetoggle`,e),Z(`toggle`,e),Dt(e,`popover`,r);break;case`xlinkActuate`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Dt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Yt.get(n)||n,Dt(e,n,r))}}function Fd(e,t,n,r,a,o){switch(n){case`style`:qt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Wt(e,``+r);break;case`onScroll`:r!=null&&Z(`scroll`,e);break;case`onScrollEnd`:r!=null&&Z(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!bt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[st]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Dt(e,n,r)}}}function Id(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Z(`error`,e),Z(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Pd(e,t,o,s,n,null)}}a&&Pd(e,t,`srcSet`,n.srcSet,n,null),r&&Pd(e,t,`src`,n.src,n,null);return;case`input`:Z(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Pd(e,t,r,d,n,null)}}zt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Z(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Pd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Vt(e,!!r,n,!0):Vt(e,!!r,t,!1);return;case`textarea`:for(s in Z(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Pd(e,t,s,c,n,null)}Ut(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Pd(e,t,l,r,n,null)}return;case`dialog`:Z(`beforetoggle`,e),Z(`toggle`,e),Z(`cancel`,e),Z(`close`,e);break;case`iframe`:case`object`:Z(`load`,e);break;case`video`:case`audio`:for(r=0;r<vd.length;r++)Z(vd[r],e);break;case`image`:Z(`error`,e),Z(`load`,e);break;case`details`:Z(`toggle`,e);break;case`embed`:case`source`:case`link`:Z(`error`,e),Z(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Pd(e,t,u,r,n,null)}return;default:if(Jt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Fd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Pd(e,t,c,r,n,null))}function Ld(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Pd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Pd(e,t,p,m,r,f)}}Rt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Pd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Pd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Vt(e,!!n,n?[]:``,!1):Vt(e,!!n,t,!0)):Vt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Pd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Pd(e,t,s,a,r,o)}Ht(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Pd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Pd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Pd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Pd(e,t,u,p,r,m)}return;default:if(Jt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Fd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Fd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Pd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Pd(e,t,f,p,r,m)}function Rd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function zd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Rd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Rd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Bd=null,Vd=null;function Hd(e){return e.nodeType===9?e:e.ownerDocument}function Ud(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Wd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Gd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Kd=null;function qd(){var e=window.event;return e&&e.type===`popstate`?e===Kd?!1:(Kd=e,!0):(Kd=null,!1)}var Jd=typeof setTimeout==`function`?setTimeout:void 0,Yd=typeof clearTimeout==`function`?clearTimeout:void 0,Xd=typeof Promise==`function`?Promise:void 0,Zd=typeof queueMicrotask==`function`?queueMicrotask:Xd===void 0?Jd:function(e){return Xd.resolve(null).then(e).catch(Qd)};function Qd(e){setTimeout(function(){throw e})}function $d(e){return e===`head`}function ef(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Fp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)hf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,hf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ft]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&hf(e.ownerDocument.body);n=i}while(n);Fp(t)}function tf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function nf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nf(n),pt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ft])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=uf(e.nextSibling),e===null)break}return null}function af(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=uf(e.nextSibling),e===null))return null;return e}function of(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=uf(e.nextSibling),e===null))return null;return e}function sf(e){return e.data===`$?`||e.data===`$~`}function cf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function lf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function uf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var df=null;function ff(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return uf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function pf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function mf(e,t,n){switch(t=Hd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function hf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);pt(e)}var gf=new Map,_f=new Set;function vf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var yf=M.d;M.d={f:bf,r:xf,D:wf,C:Tf,L:Ef,m:Df,X:kf,S:Of,M:Af};function bf(){var e=yf.f(),t=bu();return e||t}function xf(e){var t=ht(e);t!==null&&t.tag===5&&t.type===`form`?Cs(t):yf.r(e)}var Sf=typeof document>`u`?null:document;function Cf(e,t,n){var r=Sf;if(r&&typeof t==`string`&&t){var i=Lt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),_f.has(i)||(_f.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Id(t,`link`,e),vt(t),r.head.appendChild(t)))}}function wf(e){yf.D(e),Cf(`dns-prefetch`,e,null)}function Tf(e,t){yf.C(e,t),Cf(`preconnect`,e,t)}function Ef(e,t,n){yf.L(e,t,n);var r=Sf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Lt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Lt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Lt(n.imageSizes)+`"]`)):i+=`[href="`+Lt(e)+`"]`;var a=i;switch(t){case`style`:a=Mf(e);break;case`script`:a=If(e)}gf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),gf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Nf(a))||t===`script`&&r.querySelector(Lf(a))||(t=r.createElement(`link`),Id(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Df(e,t){yf.m(e,t);var n=Sf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Lt(r)+`"][href="`+Lt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=If(e)}if(!gf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),gf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Lf(a)))return}r=n.createElement(`link`),Id(r,`link`,e),vt(r),n.head.appendChild(r)}}}function Of(e,t,n){yf.S(e,t,n);var r=Sf;if(r&&e){var i=_t(r).hoistableStyles,a=Mf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Nf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=gf.get(a))&&Bf(e,n);var c=o=r.createElement(`link`);vt(c),Id(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,zf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function kf(e,t){yf.X(e,t);var n=Sf;if(n&&e){var r=_t(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=f({src:e,async:!0},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),vt(a),Id(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Af(e,t){yf.M(e,t);var n=Sf;if(n&&e){var r=_t(n).hoistableScripts,i=If(e),a=r.get(i);a||(a=n.querySelector(Lf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=gf.get(i))&&Vf(e,t),a=n.createElement(`script`),vt(a),Id(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function jf(e,t,n,r){var a=(a=F.current)?vf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Mf(n.href),n=_t(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Mf(n.href);var o=_t(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Nf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),gf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},gf.set(e,n),o||Ff(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=If(n),n=_t(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Mf(e){return`href="`+Lt(e)+`"`}function Nf(e){return`link[rel="stylesheet"][`+e+`]`}function Pf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Ff(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Id(t,`link`,n),vt(t),e.head.appendChild(t))}function If(e){return`[src="`+Lt(e)+`"]`}function Lf(e){return`script[async]`+e}function Rf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Lt(n.href)+`"]`);if(r)return t.instance=r,vt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),vt(r),Id(r,`style`,a),zf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Mf(n.href);var o=e.querySelector(Nf(a));if(o)return t.state.loading|=4,t.instance=o,vt(o),o;r=Pf(n),(a=gf.get(a))&&Bf(r,a),o=(e.ownerDocument||e).createElement(`link`),vt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Id(o,`link`,r),t.state.loading|=4,zf(o,n.precedence,e),t.instance=o;case`script`:return o=If(n.src),(a=e.querySelector(Lf(o)))?(t.instance=a,vt(a),a):(r=n,(a=gf.get(o))&&(r=f({},n),Vf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),vt(a),Id(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,zf(r,n.precedence,e));return t.instance}function zf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Bf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Hf=null;function Uf(e,t,n){if(Hf===null){var r=new Map,i=Hf=new Map;i.set(n,r)}else i=Hf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ft]||a[ot]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Wf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Gf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Kf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function qf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Mf(r.href),a=t.querySelector(Nf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Xf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,vt(a);return}a=t.ownerDocument||t,r=Pf(r),(i=gf.get(i))&&Bf(r,i),a=a.createElement(`link`),vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Id(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Xf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Jf=0;function Yf(e,t){return e.stylesheets&&e.count===0&&Qf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Qf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Jf===0&&(Jf=62500*zd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Qf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Jf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Xf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Zf=null;function Qf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Zf=new Map,t.forEach($f,e),Zf=null,Xf.call(e))}function $f(e,t){if(!(t.state.loading&4)){var n=Zf.get(e);if(n)var r=n.get(null);else{n=new Map,Zf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Xf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ep={$$typeof:C,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function tp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function np(e,t,n,r,i,a,o,s,c,l,u,d){return e=new tp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=oi(3,null,null,t),e.current=a,a.stateNode=e,t=aa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},La(a),e}function rp(e){return e?(e=ii,e):ii}function ip(e,t,n,r,i,a){i=rp(i),r.context===null?r.context=i:r.pendingContext=i,r=za(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=W(e,r,t),n!==null&&(hu(n,e,t),Ba(n,e,t))}function ap(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function op(e,t){ap(e,t),(e=e.alternate)&&ap(e,t)}function sp(e){if(e.tag===13||e.tag===31){var t=ti(e,67108864);t!==null&&hu(t,e,67108864),op(e,67108864)}}function cp(e){if(e.tag===13||e.tag===31){var t=pu();t=tt(t);var n=ti(e,t);n!==null&&hu(n,e,t),op(e,t)}}var lp=!0;function up(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=2,fp(e,t,n,r)}finally{M.p=a,j.T=i}}function dp(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=8,fp(e,t,n,r)}finally{M.p=a,j.T=i}}function fp(e,t,n,r){if(lp){var i=pp(r);if(i===null)Td(e,t,r,mp,n),Tp(e,r);else if(Dp(i,e,t,n,r))r.stopPropagation();else if(Tp(e,r),t&4&&-1<wp.indexOf(e)){for(;i!==null;){var a=ht(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ge(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Re(o);s.entanglements[1]|=c,o&=~c}id(a),!(q&6)&&(tu=De()+500,ad(0,!1))}}break;case 31:case 13:s=ti(a,2),s!==null&&hu(s,a,2),bu(),op(a,2)}if(a=pp(r),a===null&&Td(e,t,r,mp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Td(e,t,r,null,n)}}function pp(e){return e=en(e),hp(e)}var mp=null;function hp(e){if(mp=null,e=mt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return mp=e,null}function gp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Oe()){case ke:return 2;case Ae:return 8;case je:case Me:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var _p=!1,vp=null,yp=null,bp=null,xp=new Map,Sp=new Map,Cp=[],wp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Tp(e,t){switch(e){case`focusin`:case`focusout`:vp=null;break;case`dragenter`:case`dragleave`:yp=null;break;case`mouseover`:case`mouseout`:bp=null;break;case`pointerover`:case`pointerout`:xp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Sp.delete(t.pointerId)}}function Ep(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ht(t),t!==null&&sp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Dp(e,t,n,r,i){switch(t){case`focusin`:return vp=Ep(vp,e,t,n,r,i),!0;case`dragenter`:return yp=Ep(yp,e,t,n,r,i),!0;case`mouseover`:return bp=Ep(bp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return xp.set(a,Ep(xp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Sp.set(a,Ep(Sp.get(a)||null,e,t,n,r,i)),!0}return!1}function Op(e){var t=mt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,it(e.priority,function(){cp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,it(e.priority,function(){cp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function kp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=pp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);$t=r,n.target.dispatchEvent(r),$t=null}else return t=ht(n),t!==null&&sp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ap(e,t,n){kp(e)&&n.delete(t)}function jp(){_p=!1,vp!==null&&kp(vp)&&(vp=null),yp!==null&&kp(yp)&&(yp=null),bp!==null&&kp(bp)&&(bp=null),xp.forEach(Ap),Sp.forEach(Ap)}function Mp(e,n){e.blockedOn===n&&(e.blockedOn=null,_p||(_p=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,jp)))}var Np=null;function Pp(e){Np!==e&&(Np=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Np===e&&(Np=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(hp(r||n)===null)continue;break}var a=ht(n);a!==null&&(e.splice(t,3),t-=3,xs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Fp(e){function t(t){return Mp(t,e)}vp!==null&&Mp(vp,e),yp!==null&&Mp(yp,e),bp!==null&&Mp(bp,e),xp.forEach(t),Sp.forEach(t);for(var n=0;n<Cp.length;n++){var r=Cp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Cp.length&&(n=Cp[0],n.blockedOn===null);)Op(n),n.blockedOn===null&&Cp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[st]||null;if(typeof a==`function`)o||Pp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[st]||null)s=o.formAction;else if(hp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Pp(n)}}}function Ip(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Lp(e){this._internalRoot=e}Rp.prototype.render=Lp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ip(n,pu(),e,t,null,null)},Rp.prototype.unmount=Lp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ip(e.current,2,null,e,null,null),bu(),t[z]=null}};function Rp(e){this._internalRoot=e}Rp.prototype.unstable_scheduleHydration=function(e){if(e){var t=rt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Cp.length&&t!==0&&t<Cp[n].priority;n++);Cp.splice(n,0,e),n===0&&Op(e)}};var zp=n.version;if(zp!==`19.2.4`)throw Error(i(527,zp,`19.2.4`));M.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Bp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:j,reconcilerVersion:`19.2.4`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Vp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vp.isDisabled&&Vp.supportsFiber)try{Fe=Vp.inject(Bp),Ie=Vp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ws,s=Gs,c=Ks;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=np(e,1,!1,null,null,n,r,null,o,s,c,Ip),e[z]=t.current,Cd(e),new Lp(t)}})),y=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=u(p()),x=y(),S=e=>{if(!e||typeof e!=`object`)throw Error(`FlowEngage config is required`);if(!e.siteId||typeof e.siteId!=`string`)throw Error(`[FlowEngage] config.siteId is required. Pass it as <FlowEngageProvider siteId="your-site-id" /> or config={{ siteId: 'your-site-id' }}.`);let t=(e.apiBaseUrl||`https://be-flowengage-dev.oslabs.app`).replace(/\/+$/,``);return{siteId:e.siteId.trim(),apiBaseUrl:t}},C=(e,t)=>{let n=Number.parseInt(String(e??``),10);return Number.isFinite(n)&&n>0?n:t},w=C(void 0,1e4),T=C(void 0,15e3),E={chatId:`flowengage.chatId`,isOpen:`flowengage.isOpen`,activeScreen:`flowengage.activeScreen`,isHumanHandled:`flowengage.isHumanHandled`,agentName:`flowengage.agentName`,agentHeadshot:`flowengage.agentHeadshot`,visitorEmail:`flowengage.visitorEmail`},ee=6e4,D=480*60,O=3e4,k=typeof window<`u`,A=e=>e?`flowengage.visitorEmail.${e}`:null,te=()=>{if(!k)return null;let e=window.localStorage.getItem(E.chatId);return e&&String(e).trim()?String(e).trim():null},ne=()=>{if(k)try{window.localStorage.removeItem(E.chatId)}catch{}},re=()=>k?typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`:`server-chat-id`,ie=e=>e?`flowengage.entrySeen.${e}`:null,j=e=>{if(!k||!e)return!1;try{let t=ie(e);return t?window.localStorage.getItem(t)===`1`:!1}catch{return!1}},M=e=>{if(!(!k||!e))try{let t=ie(e);t&&window.localStorage.setItem(t,`1`)}catch{}},ae=e=>e?`flowengage.persistedChatId.${e}`:null,oe=e=>{if(!k||!e)return null;try{let t=ae(e),n=t?window.localStorage.getItem(t):null;return n&&String(n).trim()?String(n).trim():null}catch{return null}},se=e=>{if(!(!k||!e))try{let t=ae(e);t&&window.localStorage.removeItem(t)}catch{}},ce=(e,t)=>{if(!(!k||!e||!t))try{let n=ae(e);n&&window.localStorage.setItem(n,String(t).trim())}catch{}},N=()=>k?{isOpen:!1,activeScreen:window.sessionStorage.getItem(E.activeScreen)||`ai`,isHumanHandled:window.sessionStorage.getItem(E.isHumanHandled)===`true`,agentName:window.sessionStorage.getItem(E.agentName),agentHeadshot:window.sessionStorage.getItem(E.agentHeadshot),visitorEmail:``}:{isOpen:!1,activeScreen:`ai`,isHumanHandled:!1,agentName:null,agentHeadshot:null,visitorEmail:``},P=e=>{k&&Object.entries(e).forEach(([e,t])=>{let n=E[e];if(n){if(t==null||t===!1){window.sessionStorage.removeItem(n);return}window.sessionStorage.setItem(n,String(t))}})},le=e=>{if(!k||!e)return``;let t=A(e),n=window.localStorage.getItem(t);if(!n){let e=window.sessionStorage.getItem(E.visitorEmail);e&&(window.localStorage.setItem(t,e),window.sessionStorage.removeItem(E.visitorEmail),n=e)}return n||``},ue=(e,t)=>{if(!k)return;let n=A(t);if(!n)return;let r=typeof e==`string`?e.trim():``;if(!r){window.localStorage.removeItem(n),window.sessionStorage.removeItem(E.visitorEmail);return}window.localStorage.setItem(n,r),window.sessionStorage.removeItem(E.visitorEmail)},F=e=>e?`flowengage.visitorId.${e}`:null,de=()=>`v_${Date.now().toString(36)}_${typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID().replace(/-/g,``).slice(0,16):Math.random().toString(36).slice(2,18)}`,fe=e=>{if(!k||!e)return null;try{let t=F(e),n=t?window.localStorage.getItem(t):null;return n&&String(n).trim()?String(n).trim():null}catch{return null}},pe=e=>{if(!k||!e)return null;try{let t=fe(e);if(t)return t;let n=de(),r=F(e);return r&&window.localStorage.setItem(r,n),n}catch{return de()}},me=`flowengage.tabId`,I=()=>{if(!k)return`default`;try{let e=window.sessionStorage.getItem(me);return e||(e=typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID().replace(/-/g,``).slice(0,12):Math.random().toString(36).slice(2,14),window.sessionStorage.setItem(me,e)),e}catch{return`default`}},he=e=>e?`flowengage.voice.transcript.${e}.${I()}`:null,ge=600*1e3,_e=(e,t,n={})=>{if(!k||!e)return;let r=typeof t==`string`?t.trim():``;if(!r)return;let i=Number.isFinite(n.ttlMs)?n.ttlMs:ge,a={transcript:r,expiresAt:Date.now()+i};try{let t=he(e);t&&window.localStorage.setItem(t,JSON.stringify(a))}catch{}},ve=e=>{if(!k||!e)return null;try{let t=he(e),n=t?window.localStorage.getItem(t):null;if(!n)return null;let r=JSON.parse(n);return!r||typeof r.transcript!=`string`?null:Number.isFinite(r.expiresAt)&&Date.now()>r.expiresAt?(window.localStorage.removeItem(t),null):r}catch{return null}},ye=e=>{if(!(!k||!e))try{let t=he(e);t&&window.localStorage.removeItem(t)}catch{}},be=`flowengage.voice.pendingResume`,xe=()=>{if(k)try{window.sessionStorage.setItem(be,`1`)}catch{}},Se=()=>{if(!k)return!1;try{return window.sessionStorage.getItem(be)===`1`?(window.sessionStorage.removeItem(be),!0):!1}catch{return!1}},Ce=`flowengage.chat.pendingReopen`,we=()=>{if(k)try{window.sessionStorage.setItem(Ce,`1`)}catch{}},Te=()=>{if(!k)return!1;try{return window.sessionStorage.getItem(Ce)===`1`?(window.sessionStorage.removeItem(Ce),!0):!1}catch{return!1}},Ee=()=>{if(!k)return!1;try{return window.sessionStorage.getItem(be)===`1`}catch{return!1}},De=e=>e?`flowengage.voice.navState.${e}.${I()}`:null,Oe=(e,t,n,r)=>{if(!(!k||!e||!t))try{let i=De(e);i&&window.sessionStorage.setItem(i,JSON.stringify({previousPage:String(t),targetPath:n?new URL(String(n),window.location.href).pathname:null,pageName:r||null,ts:Date.now()}))}catch{}},ke=e=>{if(!k||!e)return null;try{let t=De(e);if(!t)return null;let n=window.sessionStorage.getItem(t);if(!n)return null;window.sessionStorage.removeItem(t);let r=JSON.parse(n);return!r||typeof r.previousPage!=`string`||Number.isFinite(r.ts)&&Date.now()-r.ts>6e4||r.targetPath&&(window.location.pathname.replace(/\/$/,``)||`/`)!==(r.targetPath.replace(/\/$/,``)||`/`)?null:{previousPage:r.previousPage,pageName:r.pageName||null}}catch{return null}},Ae=async e=>{let t=await e.json().catch(()=>({}));if(!e.ok){let n=Error(t.message||t.error||`Request failed with status ${e.status}`);throw n.status=e.status,n}return t},je=async(e,t={})=>{try{return await fetch(e,{mode:`cors`,...t})}catch(t){let n=Error(`Network error reaching ${e}. Check: (1) backend is running, (2) CORS allows this origin, (3) siteId is correct. Original: ${t.message}`);throw n.status=0,n.cause=t,n}},Me=async({apiBaseUrl:e,userId:t,siteId:n,priorChatId:r=null,forceNew:i=!1,resumeChatId:a=null,visitorId:o=null})=>{let s=`${e}/api/visitors/resolve-session`,c={siteId:n};return r&&String(r).trim()&&(c.priorChatId=String(r).trim()),i&&(c.forceNew=!0),a&&(c.resumeChatId=a),o&&(c.visitorId=o),Ae(await je(s,{method:`POST`,mode:`cors`,headers:{"Content-Type":`application/json`,"x-user-id":t==null?``:String(t),...n?{"x-site-id":n}:{},...o?{"x-visitor-id":o}:{}},body:JSON.stringify(c)}))},Ne=async({apiBaseUrl:e,siteId:t})=>{let n=typeof window<`u`?window.location.origin:`http://localhost`;return(await Ae(await je(`${e}/api/widget/chatbot-loader?${new URLSearchParams({siteId:t,origin:n}).toString()}`,{method:`GET`}))).data},Pe=({apiBaseUrl:e,userId:t,siteId:n,visitorId:r=null})=>{let i=(t,n)=>{let r=`${e}${t}`,i=JSON.stringify(n);if(typeof navigator<`u`&&navigator.sendBeacon)try{let e=new Blob([i],{type:`application/json`});return navigator.sendBeacon(r,e)}catch{}return typeof fetch<`u`?(fetch(r,{method:`POST`,mode:`cors`,keepalive:!0,headers:{"Content-Type":`application/json`},body:i}).catch(()=>{}),!0):!1},a=async(i,a={})=>Ae(await je(`${e}${i}`,{...a,headers:{"Content-Type":`application/json`,"x-user-id":t,...n?{"x-site-id":n}:{},...r?{"x-visitor-id":r}:{},...a.headers||{}}})),o=async(r,i,a={})=>{let o={"x-user-id":t,...n?{"x-site-id":n}:{},...a.headers||{}};return Ae(await je(`${e}${r}`,{...a,body:i,headers:o}))};return{async loadHistory(e,t=`en`,n=``){return a(`/api/ai/chat`,{method:`POST`,body:JSON.stringify({session_id:e,user_query:``,lang:t,category:n})})},async sendAiMessage(i,o,s=`en`,c=``,l=null,u={},d=null){let f={session_id:i,user_query:o,lang:s,category:c,...u||{},...l||{}};if(typeof d!=`function`)return a(`/api/ai/chat`,{method:`POST`,body:JSON.stringify(f)});let p=await je(`${e}/api/ai/chat`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-user-id":t,...n?{"x-site-id":n}:{},...r?{"x-visitor-id":r}:{}},body:JSON.stringify({...f,stream:!0})});if(!(p.headers.get(`content-type`)||``).includes(`text/event-stream`))return Ae(p);let m=p.body.getReader(),h=new TextDecoder,g=``,_=null,v=e=>{let t=e.split(`
|
|
10
|
+
`).find(e=>e.startsWith(`data: `));if(t)try{let e=JSON.parse(t.slice(6));e.type===`delta`&&e.text?d(e.text):e.type===`done`&&(_=e.payload)}catch{}};for(;;){let{done:e,value:t}=await m.read();if(e)break;g+=h.decode(t,{stream:!0});let n;for(;(n=g.indexOf(`
|
|
11
|
+
|
|
12
|
+
`))!==-1;)v(g.slice(0,n)),g=g.slice(n+2)}if(!_){let e=Error(`The response stream ended unexpectedly — please try again.`);throw e.status=0,e}return _},async uploadChatFile(e){let t=new FormData;return t.append(`file`,e),o(`/api/upload`,t,{method:`POST`})},async checkHumanHandled(e){return a(`/api/ai/check_human_handled`,{method:`POST`,body:JSON.stringify({session_id:e})})},async setChatMode(e,t){return a(`/api/ai/set_chat_mode`,{method:`POST`,body:JSON.stringify({session_id:e,mode:t})})},async toggleVoice(e){return a(`/api/ai/voice/toggle`,{method:`POST`,body:JSON.stringify({session_id:e})})},async syncVoice(e,r){return a(`/api/ai/voice/sync`,{method:`POST`,body:JSON.stringify({session_id:e,messages:r,...t?{userId:String(t)}:{},...n?{siteId:String(n)}:{}})})},async trackVisitor(e){return a(`/api/visitors/track`,{method:`POST`,body:JSON.stringify(e)})},async updateChatStatus(e,t){return a(`/api/chat/status`,{method:`POST`,body:JSON.stringify({chatId:e,type:t})})},async startConversation(e,t=`en`){return a(`/api/chat/status`,{method:`POST`,body:JSON.stringify({chatId:e,type:`open`,lang:t})})},async endConversation(e){return a(`/api/chat/status`,{method:`POST`,body:JSON.stringify({chatId:e,type:`closed`})})},async getVisitorChatHistory(){return a(`/api/visitors/my-chats`,{method:`GET`})},async getVisitorChatThread(e){return a(`/api/visitors/my-chats/${e}`,{method:`GET`})},async acceptCall(e,t){return a(`/api/calls/${e}/accept`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n})})},async rejectCall(e,t){return a(`/api/calls/${e}/reject`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n})})},async getIceServersConfig(){return Ae(await je(`${e}/api/calls/ice-config`,{method:`GET`,headers:{"x-user-id":t,...n?{"x-site-id":n}:{}}}))},async endWebRTCCall(e,t){return a(`/api/calls/${e}/end`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n,endedBy:`customer`})})},async markCustomerUnavailable(e,t){return a(`/api/calls/${e}/customer-unavailable`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n})})},async uploadRecording(e,t,n){let r=new FormData,i=`call-rec-${Date.now()}.webm`;return r.append(`audio`,t,i),r.append(`duration`,String(n)),o(`/api/calls/${e}/recording`,r,{method:`POST`})},beaconEndWebRTCCall(e,t){return i(`/api/calls/${e}/end`,{session_id:t,site_id:n,endedBy:`customer`})},beaconCustomerUnavailable(e,t){return i(`/api/calls/${e}/customer-unavailable`,{session_id:t,site_id:n})},beaconSyncVoice(r,i){if(typeof navigator>`u`||!navigator.sendBeacon)return!1;let a=new URLSearchParams;return a.append(`session_id`,r),a.append(`messages`,JSON.stringify(i)),t&&a.append(`userId`,String(t)),n&&a.append(`siteId`,String(n)),navigator.sendBeacon(`${e}/api/ai/voice/sync`,a)},beaconWidgetClosed(r){if(typeof navigator>`u`||!navigator.sendBeacon)return!1;let i=new URLSearchParams;return i.append(`chatId`,r),i.append(`type`,`widget_closed`),t&&i.append(`userId`,String(t)),n&&i.append(`siteId`,String(n)),navigator.sendBeacon(`${e}/api/chat/status`,i)}}},L=Object.create(null);L.open=`0`,L.close=`1`,L.ping=`2`,L.pong=`3`,L.message=`4`,L.upgrade=`5`,L.noop=`6`;var Fe=Object.create(null);Object.keys(L).forEach(e=>{Fe[L[e]]=e});var Ie={type:`error`,data:`parser error`},Le=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,Re=typeof ArrayBuffer==`function`,ze=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Be=({type:e,data:t},n,r)=>Le&&t instanceof Blob?n?r(t):Ve(t,r):Re&&(t instanceof ArrayBuffer||ze(t))?n?r(t):Ve(new Blob([t]),r):r(L[e]+(t||``)),Ve=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function He(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Ue;function We(e,t){if(Le&&e.data instanceof Blob)return e.data.arrayBuffer().then(He).then(t);if(Re&&(e.data instanceof ArrayBuffer||ze(e.data)))return t(He(e.data));Be(e,!1,e=>{Ue||=new TextEncoder,t(Ue.encode(e))})}var Ge=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ke=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Ke[Ge.charCodeAt(e)]=e;var qe=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=Ke[e.charCodeAt(r)],o=Ke[e.charCodeAt(r+1)],s=Ke[e.charCodeAt(r+2)],c=Ke[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Je=typeof ArrayBuffer==`function`,R=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:Xe(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:Ye(e.substring(1),t)}:Fe[n]?e.length>1?{type:Fe[n],data:e.substring(1)}:{type:Fe[n]}:Ie},Ye=(e,t)=>Je?Xe(qe(e),t):{base64:!0,data:e},Xe=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},Ze=``,Qe=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{Be(e,!1,e=>{r[a]=e,++i===n&&t(r.join(Ze))})})},$e=(e,t)=>{let n=e.split(Ze),r=[];for(let e=0;e<n.length;e++){let i=R(n[e],t);if(r.push(i),i.type===`error`)break}return r};function et(){return new TransformStream({transform(e,t){We(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var tt;function nt(e){return e.reduce((e,t)=>e+t.length,0)}function rt(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function it(e,t){tt||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(nt(n)<1)break;let e=rt(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(nt(n)<2)break;let e=rt(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(nt(n)<8)break;let e=rt(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(Ie);break}i=a*2**32+t.getUint32(4),r=3}else{if(nt(n)<i)break;let e=rt(n,i);s.enqueue(R(a?e:tt.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(Ie);break}}}})}function at(e){if(e)return ot(e)}function ot(e){for(var t in at.prototype)e[t]=at.prototype[t];return e}at.prototype.on=at.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},at.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},at.prototype.off=at.prototype.removeListener=at.prototype.removeAllListeners=at.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},at.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},at.prototype.emitReserved=at.prototype.emit,at.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},at.prototype.hasListeners=function(e){return!!this.listeners(e).length};var st=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),z=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),ct=`arraybuffer`;function lt(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var ut=z.setTimeout,dt=z.clearTimeout;function ft(e,t){t.useNativeTimers?(e.setTimeoutFn=ut.bind(z),e.clearTimeoutFn=dt.bind(z)):(e.setTimeoutFn=z.setTimeout.bind(z),e.clearTimeoutFn=z.clearTimeout.bind(z))}var pt=1.33;function mt(e){return typeof e==`string`?ht(e):Math.ceil((e.byteLength||e.size)*pt)}function ht(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function gt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function _t(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function vt(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var yt=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},bt=class extends at{constructor(e){super(),this.writable=!1,ft(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new yt(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=R(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=_t(e);return t.length?`?`+t:``}},xt=class extends bt{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){$e(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,Qe(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=gt()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},St=!1;try{St=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var Ct=St;function wt(){}var Tt=class extends xt{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},Et=class e extends at{constructor(e,t,n){super(),this.createRequest=e,ft(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=lt(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=wt,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(Et.requestsCount=0,Et.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,Dt);else if(typeof addEventListener==`function`){let e=`onpagehide`in z?`pagehide`:`unload`;addEventListener(e,Dt,!1)}}function Dt(){for(let e in Et.requests)Et.requests.hasOwnProperty(e)&&Et.requests[e].abort()}var Ot=(function(){let e=At({xdomain:!1});return e&&e.responseType!==null})(),kt=class extends Tt{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ot&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Et(At,this.uri(),e)}};function At(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||Ct))return new XMLHttpRequest}catch{}if(!t)try{return new z[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var jt=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,Mt=class extends bt{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=jt?{}:lt(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;Be(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&st(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=gt()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Nt=z.WebSocket||z.MozWebSocket,Pt={websocket:class extends Mt{createSocket(e,t,n){return jt?new Nt(e,t,n):t?new Nt(e,t):new Nt(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends bt{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=it(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=et();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&st(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:kt},Ft=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,It=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function Lt(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=Ft.exec(e||``),a={},o=14;for(;o--;)a[It[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=Rt(a,a.path),a.queryKey=zt(a,a.query),a}function Rt(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function zt(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var Bt=typeof addEventListener==`function`&&typeof removeEventListener==`function`,Vt=[];Bt&&addEventListener(`offline`,()=>{Vt.forEach(e=>e())},!1);var Ht=class e extends at{constructor(e,t){if(super(),this.binaryType=ct,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=Lt(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Lt(t.host).host);ft(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=vt(this.opts.query)),Bt&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},Vt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=mt(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,st(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),Bt&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=Vt.indexOf(this._offlineEventListener);e!==-1&&Vt.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};Ht.protocol=4;var Ut=class extends Ht{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Ht.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;Ht.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},Wt=class extends Ut{constructor(e,t={}){let n=typeof e==`object`?e:t;(!n.transports||n.transports&&typeof n.transports[0]==`string`)&&(n.transports=(n.transports||[`polling`,`websocket`,`webtransport`]).map(e=>Pt[e]).filter(e=>!!e)),super(e,n)}};Wt.protocol;function Gt(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=Lt(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var Kt=typeof ArrayBuffer==`function`,qt=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Jt=Object.prototype.toString,Yt=typeof Blob==`function`||typeof Blob<`u`&&Jt.call(Blob)===`[object BlobConstructor]`,Xt=typeof File==`function`||typeof File<`u`&&Jt.call(File)===`[object FileConstructor]`;function Zt(e){return Kt&&(e instanceof ArrayBuffer||qt(e))||Yt&&e instanceof Blob||Xt&&e instanceof File}function Qt(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Qt(e[t]))return!0;return!1}if(Zt(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return Qt(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Qt(e[t]))return!0;return!1}function $t(e){let t=[],n=e.data,r=e;return r.data=en(n,t),r.attachments=t.length,{packet:r,buffers:t}}function en(e,t){if(!e)return e;if(Zt(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=en(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=en(e[r],t));return n}return e}function tn(e,t){return e.data=nn(e.data,t),delete e.attachments,e}function nn(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=nn(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=nn(e[n],t));return e}var rn=c({Decoder:()=>sn,Encoder:()=>on,PacketType:()=>B,isPacketValid:()=>mn,protocol:()=>5}),an=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],B;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(B||={});var on=class{constructor(e){this.replacer=e}encode(e){return(e.type===B.EVENT||e.type===B.ACK)&&Qt(e)?this.encodeAsBinary({type:e.type===B.EVENT?B.BINARY_EVENT:B.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===B.BINARY_EVENT||e.type===B.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=$t(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},sn=class e extends at{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===B.BINARY_EVENT;n||t.type===B.BINARY_ACK?(t.type=n?B.EVENT:B.ACK,this.reconstructor=new cn(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(Zt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(B[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===B.BINARY_EVENT||r.type===B.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!un(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case B.CONNECT:return fn(t);case B.DISCONNECT:return t===void 0;case B.CONNECT_ERROR:return typeof t==`string`||fn(t);case B.EVENT:case B.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&an.indexOf(t[0])===-1);case B.ACK:case B.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},cn=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=tn(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function ln(e){return typeof e==`string`}var un=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function dn(e){return e===void 0||un(e)}function fn(e){return Object.prototype.toString.call(e)===`[object Object]`}function pn(e,t){switch(e){case B.CONNECT:return t===void 0||fn(t);case B.DISCONNECT:return t===void 0;case B.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&an.indexOf(t[0])===-1);case B.ACK:return Array.isArray(t);case B.CONNECT_ERROR:return typeof t==`string`||fn(t);default:return!1}}function mn(e){return ln(e.nsp)&&dn(e.id)&&pn(e.type,e.data)}function hn(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var gn=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),_n=class extends at{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[hn(e,`open`,this.onopen.bind(this)),hn(e,`packet`,this.onpacket.bind(this)),hn(e,`error`,this.onerror.bind(this)),hn(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(gn.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:B.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:B.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case B.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case B.EVENT:case B.BINARY_EVENT:this.onevent(e);break;case B.ACK:case B.BINARY_ACK:this.onack(e);break;case B.DISCONNECT:this.ondisconnect();break;case B.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:B.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:B.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function vn(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}vn.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},vn.prototype.reset=function(){this.attempts=0},vn.prototype.setMin=function(e){this.ms=e},vn.prototype.setMax=function(e){this.max=e},vn.prototype.setJitter=function(e){this.jitter=e};var yn=class extends at{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,ft(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new vn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||rn;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new Wt(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=hn(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=hn(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(hn(e,`ping`,this.onping.bind(this)),hn(e,`data`,this.ondata.bind(this)),hn(e,`error`,this.onerror.bind(this)),hn(e,`close`,this.onclose.bind(this)),hn(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){st(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new _n(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},bn={};function xn(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=Gt(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=bn[i]&&a in bn[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new yn(r,t):(bn[i]||(bn[i]=new yn(r,t)),c=bn[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(xn,{Manager:yn,Socket:_n,io:xn,connect:xn});var Sn=({apiBaseUrl:e,userId:t,chatId:n,siteId:r})=>xn(e,{transports:[`polling`,`websocket`],upgrade:!0,rememberUpgrade:!1,auth:{userId:t,chatId:n,siteId:r},query:{chatId:n,siteId:r}}),Cn=({socket:e,chatId:t})=>{if(!e||!t||typeof window>`u`)return()=>{};let n=window.location.pathname+window.location.search,r=Date.now(),i=null,a=null,o=()=>{console.log(`[FlowEngageTracking] visitor:session_start`,{chatId:t,path:n}),e.emit(`visitor:session_start`,{chatId:t,path:n,title:document.title,referrer:document.referrer,userAgent:navigator.userAgent,timestamp:Date.now()})},s=()=>{console.log(`[FlowEngageTracking] visitor:page_enter`,{chatId:t,path:n}),e.emit(`visitor:page_enter`,{chatId:t,path:n,title:document.title,timestamp:Date.now()})},c=(n,r)=>{console.log(`[FlowEngageTracking] visitor:page_leave`,{chatId:t,path:n,duration:Math.max(0,Math.floor((Date.now()-r)/1e3))}),e.emit(`visitor:page_leave`,{chatId:t,path:n,duration:Math.max(0,Math.floor((Date.now()-r)/1e3)),timestamp:Date.now()})},l=()=>{console.log(`[FlowEngageTracking] visitor:heartbeat`,{chatId:t,path:n}),e.emit(`visitor:heartbeat`,{chatId:t,path:n,title:document.title,timestamp:Date.now()})},u=()=>{i&&window.clearInterval(i),i=window.setInterval(l,w)},d=()=>{i&&=(window.clearInterval(i),null)},f=r=>{console.log(`[FlowEngageTracking] visitor:visibility`,{chatId:t,state:r}),e.emit(`visitor:visibility`,{chatId:t,state:r,path:n,title:document.title,timestamp:Date.now()})},p=()=>{if(document.hidden){a&&window.clearTimeout(a),a=window.setTimeout(()=>{a=null,d(),f(`hidden`)},T);return}a&&=(window.clearTimeout(a),null),f(`visible`),l(),u()},m=()=>{let e=window.location.pathname+window.location.search;if(e===n){console.log(`[FlowEngageTracking] route unchanged`,{currentPath:n});return}console.log(`[FlowEngageTracking] route changed`,{from:n,to:e}),c(n,r),n=e,r=Date.now(),s()},h=window.history.pushState.bind(window.history),g=window.history.replaceState.bind(window.history);window.history.pushState=(...e)=>{h(...e),m()},window.history.replaceState=(...e)=>{g(...e),m()};let _=()=>{c(n,r),e.emit(`visitor:session_end`,{chatId:t,timestamp:Date.now()})},v=()=>{_()},y=e=>{e.persisted||_()};return window.addEventListener(`popstate`,m),window.addEventListener(`hashchange`,m),window.addEventListener(`beforeunload`,v),window.addEventListener(`pagehide`,y),window.addEventListener(`visibilitychange`,p),o(),document.hidden?a=window.setTimeout(()=>{a=null,d(),f(`hidden`)},T):(l(),u()),{notifyRouteChange:m,cleanup:()=>{a&&=(window.clearTimeout(a),null),d(),window.history.pushState=h,window.history.replaceState=g,window.removeEventListener(`popstate`,m),window.removeEventListener(`hashchange`,m),window.removeEventListener(`beforeunload`,v),window.removeEventListener(`pagehide`,y),window.removeEventListener(`visibilitychange`,p)}}},wn=(0,b.createContext)(null),Tn=()=>{let e=(0,b.useContext)(wn);if(!e)throw Error(`useFlowEngage must be used inside FlowEngageProvider`);return e};function En(){if(typeof window>`u`)return!1;try{let e=window.localStorage?.getItem(`FE_DEBUG_VOICE`);if(e===`0`||e===`false`)return!1;if(e===`1`||e===`true`)return!0}catch{}return window.__FE_DEBUG_VOICE_TOOLS__===!1?!1:window.__FE_DEBUG_VOICE_TOOLS__===!0}var Dn=80;function On(e){requestAnimationFrame(()=>{let t=e.getBoundingClientRect(),n=t.top+t.height/2,r=Dn+(window.innerHeight-Dn)/2,i=window.pageYOffset+n-r;window.scrollTo({top:Math.max(0,i),behavior:`smooth`})})}function kn(e){e&&(e.hasAttribute(`data-fe-highlighted`)||(An(),e.classList?.remove(`fe-highlight-section`,`fe-highlight-speaking`,`fe-highlight-exiting`),On(e),e.setAttribute(`data-fe-orig-style`,e.style.cssText),e.setAttribute(`data-fe-highlighted`,`true`),e.style.outline=`3px solid #2563eb`,e.style.outlineOffset=`8px`,e.style.background=`rgba(37, 99, 235, 0.08)`,e.style.borderRadius=`8px`,e.style.padding=`12px 16px`,e.style.transition=`all 0.4s ease`))}function An(){let e=document.querySelector(`[data-fe-highlighted]`);e&&(e.style.cssText=e.getAttribute(`data-fe-orig-style`)||``,e.removeAttribute(`data-fe-highlighted`),e.removeAttribute(`data-fe-orig-style`))}var jn=`#flowengage-root, .flowengage-shell, .flowengage-widget-root`;function Mn(e){if(!e||typeof e.closest!=`function`)return!1;try{return!!e.closest(jn)}catch{return!1}}function Nn(e){let t=e.cloneNode(!0);return t.querySelectorAll(`[aria-hidden], svg, .icon, [class*="icon"]`).forEach(e=>e.remove()),t.textContent.replace(/\s+/g,` `).trim()}function Pn(...e){En()&&console.log(`[FlowEngage:shadowNavigate]`,...e)}var Fn=`fe_pending_nav_section`,In=15e3,Ln=`fe_voice_nav_state`,Rn=2e4,zn=!1,Bn=null;function Vn(e=3e3){zn=!0,Bn&&clearTimeout(Bn),Bn=setTimeout(()=>{zn=!1,Bn=null},e)}function Hn(){return zn}var Un=!1,Wn=null;function Gn(){Un||typeof window>`u`||(Un=!0,window.addEventListener(`popstate`,async()=>{let e=window.location.href;if(Pn(`popstate: body-swap to`,e),Wn){try{er(Wn)}catch{}try{rr(Wn)}catch{}}try{if(await vr(e,{skipPushState:!0,isBack:!0})){Pn(`popstate: body-swap succeeded`);return}}catch(e){console.warn(`[FlowEngage] popstate body-swap error:`,e)}Pn(`popstate: body-swap failed, falling back to reload`),window.location.reload()}))}var Kn=!1;function qn(){Kn||typeof window>`u`||typeof document>`u`||(Kn=!0,document.addEventListener(`click`,async e=>{try{if(!window.history.state?.flowengageSpa)return}catch{return}let t=e.target.closest?.(`a[href]`);if(!t||t.closest(`#flowengage-root, .flowengage-shell, .flowengage-widget-root`))return;let n=t.getAttribute(`href`)||``;if(!n||n===`#`||n.startsWith(`javascript:`)||n.startsWith(`mailto:`)||n.startsWith(`tel:`)||t.hasAttribute(`download`)||t.target===`_blank`||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let r;try{if(r=new URL(n,window.location.href),r.origin!==window.location.origin)return}catch{return}if(!(r.pathname===window.location.pathname&&r.hash)&&!(r.pathname===window.location.pathname&&r.search===window.location.search)){e.preventDefault(),e.stopPropagation(),Pn(`link-intercept: body-swap to`,r.href),sr();try{try{er()}catch{}try{rr()}catch{}if(await vr(r.href)){Pn(`link-intercept: body-swap succeeded`);return}}catch(e){console.warn(`[FlowEngage] link-intercept body-swap error:`,e)}Pn(`link-intercept: body-swap failed, falling back to normal navigation`),cr(),window.location.href=r.href}},!0))}var Jn=null;function Yn(e){Jn=e===`spa`||e===`traditional`?e:null}function Xn(){if(typeof window>`u`||Jn===`traditional`)return null;if(window.next?.router||window.__NEXT_ROUTER__)return`nextjs`;if(window.__remixRouter||window.__staticRouterHydrationData)return`react-router`;if(window.___gatsby||window.___navigate)return`gatsby`;if(window.__VUE_ROUTER__)return`vue-router`;if(window.__NUXT__||window.$nuxt)return`nuxt`;if(window.ng?.getComponent||document.querySelector(`[ng-version]`))return`angular`;if(window[Symbol.for(`wouter_v3`)])return`wouter`;if(window.__sveltekit_data||document.querySelector(`[data-sveltekit-hydrate]`))return`sveltekit`;if(document.querySelector(`[data-astro-transition]`))return`astro`;for(let e of document.body.children)if(e.tagName?.toUpperCase()===`DIV`&&e.id!==`flowengage-root`&&(e.id===`root`||e.id===`app`)&&e.children.length>0)return`generic-spa`;return Jn===`spa`?`backend-spa`:null}var Zn=`data-fe-swap-css`;function Qn(){typeof document>`u`||document.querySelectorAll(`[${Zn}]`).forEach(e=>e.remove())}var $n=`fe_form_state:`;function er(e){if(typeof document>`u`||typeof sessionStorage>`u`)return;let t=document.querySelectorAll(`form`);if(!t.length)return;let n=[];if(t.forEach((e,t)=>{let r={};e.querySelectorAll(`input, textarea, select`).forEach(e=>{let t=e.name||e.id;t&&(e.type===`password`||e.type===`hidden`||(e.type===`checkbox`||e.type===`radio`?r[t+`::`+e.value]=e.checked:r[t]=e.value))}),Object.keys(r).length&&n.push({formIndex:t,fields:r})}),n.length)try{let t=$n+(e||window.location.pathname);sessionStorage.setItem(t,JSON.stringify({state:n,ts:Date.now()}))}catch{}}function tr(){if(typeof document>`u`||typeof sessionStorage>`u`)return;let e=$n+window.location.pathname,t;try{t=JSON.parse(sessionStorage.getItem(e)||`null`)}catch{return}if(!t||!t.state)return;if(Date.now()-t.ts>1800*1e3){try{sessionStorage.removeItem(e)}catch{}return}let n=document.querySelectorAll(`form`);for(let{formIndex:e,fields:r}of t.state){let t=n[e];if(t)for(let[e,n]of Object.entries(r))if(e.includes(`::`)){let[r,i]=e.split(`::`),a=t.querySelector(`input[name="${r}"][value="${i}"], input[id="${r}"][value="${i}"]`);a&&(a.checked=!!n)}else{let r=t.querySelector(`[name="${e}"], [id="${e}"]`);if(r&&r.type!==`file`){r.value=n;try{r.dispatchEvent(new Event(`input`,{bubbles:!0}))}catch{}try{r.dispatchEvent(new Event(`change`,{bubbles:!0}))}catch{}}}}try{sessionStorage.removeItem(e)}catch{}}var nr=`fe_scroll:`;function rr(e){if(!(typeof window>`u`||typeof sessionStorage>`u`))try{let t=nr+(e||window.location.pathname);sessionStorage.setItem(t,JSON.stringify({y:window.scrollY,ts:Date.now()}))}catch{}}function ir(){if(typeof window>`u`||typeof sessionStorage>`u`)return;let e=nr+window.location.pathname,t;try{t=JSON.parse(sessionStorage.getItem(e)||`null`)}catch{return}if(t){try{sessionStorage.removeItem(e)}catch{}Date.now()-t.ts>1800*1e3||setTimeout(()=>{window.scrollTo({top:t.y,behavior:`instant`})},80)}}function ar(e){if(!(typeof window>`u`))try{window.dispatchEvent(new CustomEvent(`flowengage:pageswap`,{detail:{url:e,timestamp:Date.now()}}))}catch{}}var or=`fe-nav-loader`;function sr(){if(typeof document>`u`||document.getElementById(or))return;let e=document.createElement(`div`);e.id=or,e.style.cssText=[`position:fixed`,`top:0`,`left:0`,`width:0`,`height:3px`,`background:linear-gradient(90deg,#7c3aed,#6366f1)`,`z-index:2147483647`,`transition:width 0.4s ease`,`pointer-events:none`].join(`;`),document.body.appendChild(e),requestAnimationFrame(()=>{e.style.width=`70%`})}function cr(){if(typeof document>`u`)return;let e=document.getElementById(or);e&&(e.style.width=`100%`,setTimeout(()=>{e.style.opacity=`0`,e.style.transition=`opacity 0.3s ease`,setTimeout(()=>e.remove(),350)},200))}function lr(){if(typeof window>`u`||typeof document>`u`)return;try{window.history.state?.flowengageSpa&&Gn()}catch{}let e;try{e=JSON.parse(sessionStorage.getItem(Fn)||`null`)}catch{return}if(!e)return;try{sessionStorage.removeItem(Fn)}catch{}let{sectionText:t,ts:n}=e;if(!t)return;if(Date.now()-n>In){Pn(`initNavigationHighlight: pending section expired, skipping:`,t);return}Pn(`initNavigationHighlight: replaying section highlight:`,t);let r=0,i=()=>{r+=1;let e=dr(null,t);if(e){fr(e),Pn(`initNavigationHighlight: highlighted on attempt`,r);return}r<8?setTimeout(i,300):Pn(`initNavigationHighlight: could not find element after 8 attempts:`,t)};setTimeout(i,250)}var ur=()=>{if(typeof document>`u`||document.getElementById(`fe-highlight-styles`))return;let e=document.createElement(`style`);e.id=`fe-highlight-styles`,e.textContent=`
|
|
13
|
+
.fe-highlight-section {
|
|
14
|
+
outline: 3px solid #7c3aed !important;
|
|
15
|
+
box-shadow: 0 0 15px rgba(124, 58, 237, 0.6) !important;
|
|
16
|
+
transition: outline-color 0.3s ease, box-shadow 0.3s ease !important;
|
|
17
|
+
border-radius: 8px !important;
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
/* Smooth fade-in for the speaking highlight */
|
|
21
|
+
.fe-highlight-section.fe-highlight-speaking {
|
|
22
|
+
outline-color: #6366f1 !important;
|
|
23
|
+
box-shadow: 0 0 20px rgba(99, 102, 241, 0.45), 0 0 4px rgba(99, 102, 241, 0.3) !important;
|
|
24
|
+
animation: fe-hl-pulse 2s ease-in-out infinite !important;
|
|
25
|
+
}
|
|
26
|
+
@keyframes fe-hl-pulse {
|
|
27
|
+
0%, 100% { box-shadow: 0 0 15px rgba(99, 102, 241, 0.40), 0 0 4px rgba(99, 102, 241, 0.25); }
|
|
28
|
+
50% { box-shadow: 0 0 25px rgba(99, 102, 241, 0.55), 0 0 8px rgba(99, 102, 241, 0.35); }
|
|
29
|
+
}
|
|
30
|
+
/* Exit transition — the old highlight fades out */
|
|
31
|
+
.fe-highlight-exiting {
|
|
32
|
+
outline: 3px solid transparent !important;
|
|
33
|
+
box-shadow: none !important;
|
|
34
|
+
transition: outline-color 0.25s ease, box-shadow 0.25s ease !important;
|
|
35
|
+
}
|
|
36
|
+
`,document.head.appendChild(e)};function dr(e,t){if(typeof document>`u`)return null;if(e){let n=document.getElementById(e)||document.querySelector(`[data-section="${e}"]`);if(n)return n;t||=e.replace(/[-_]+/g,` `).trim()}if(!t)return null;let n=t.toLowerCase().trim(),r=n.split(/\s+/).filter(e=>e.length>2),i=Array.from(document.querySelectorAll(`h1.h2.h3.h4.h5.h6.[data-section].section[id].[id].main li.article li.[role='main'] li.[class*='card'].[class*='Card'].[class*='feature'].[class*='Feature'].[class*='tier'].[class*='Tier'].[class*='plan'].[class*='Plan'].[class*='pricing'].[class*='Pricing'].[class*='testimonial'].[class*='Testimonial'].[class*='team'].[class*='Team'].[class*='service'].[class*='Service'].[class*='block'].[role='listitem'].[role='article'].[role='region'].dt.dd`.split(`.`).join(`, `))).filter(e=>{if(Mn(e))return!1;let t=e.textContent.trim();return!(t.length<3||t.length>5e3||e.closest(`nav, footer, header, aside, .nav, .footer, .header`))});for(let e of i)if(Nn(e).toLowerCase()===n)return e;for(let e of i){let t=Nn(e).toLowerCase();if(t.startsWith(n)||t.endsWith(n))return e}let a=[];for(let e of i){let t=Nn(e).toLowerCase();t.includes(n)&&a.push({el:e,len:t.length})}if(a.length)return a.sort((e,t)=>e.len-t.len),a[0].el;for(let e of i){let t=Nn(e).toLowerCase();if(t.length>3&&n.includes(t))return e}if(r.length>0){let e=null,t=0;for(let n of i){let i=Nn(n).toLowerCase(),a=0;for(let e of r)i.includes(e)&&a++;let o=a/r.length;o>t&&o>=.6&&(t=o,e=n)}if(e)return e}let o=Array.from(document.querySelectorAll(`main [role='group']`)).filter(e=>!Mn(e)),s=[];for(let e of o){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();t.length<15||t.length>8e3||t.includes(n)&&s.push({el:e,len:t.length})}if(s.length)return s.sort((e,t)=>e.len-t.len),s[0].el;if(r.length>0){let e=Array.from(document.querySelectorAll(`main a[href], article a[href], .views-row a[href], h2 a[href], h3 a[href], .card a[href], [class*='teaser'] a[href]`)).filter(e=>{if(Mn(e))return!1;try{let t=e.getAttribute(`href`)||``;if(!t||t===`#`||t.startsWith(`javascript:`))return!1}catch{return!1}let t=e.textContent.replace(/\s+/g,` `).trim();return t.length>=3&&t.length<=220}),t=null,n=0;for(let i of e){let e=i.textContent.replace(/\s+/g,` `).toLowerCase(),a=0;for(let t of r)e.includes(t)&&a++;let o=a/r.length;o>n&&o>=.5&&(n=o,t=i)}if(t)return t.closest(`article`)||t.closest(`.views-row`)||t}let c=document.querySelectorAll(`section, article, .card, [class*='feature'], [class*='service']`);for(let e of c){if(Mn(e))continue;let t=e.querySelector(`h1, h2, h3, h4, h5, h6`);if(t){let r=t.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(r.includes(n)||n.includes(r))return e}}let l=document.querySelectorAll(`li, strong, blockquote, dt`);for(let e of l){if(Mn(e))continue;let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<500)return e.tagName===`STRONG`&&e.parentElement?.tagName===`LI`?e.parentElement:e}let u=Array.from(document.querySelectorAll(`a[href]`)).filter(e=>!Mn(e));u.sort((e,t)=>(e.textContent||``).trim().length-(t.textContent||``).trim().length);for(let e of u){let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<500)return e}let d=document.querySelectorAll(`p`);for(let e of d){if(Mn(e))continue;let t=e.textContent.replace(/\s+/g,` `).toLowerCase().trim();if(t.includes(n)&&t.length<800)return e}return null}function fr(e,{speaking:t=!1,scroll:n=!0}={}){if(!e||typeof document>`u`)return;ur();let r=document.querySelectorAll(`.fe-highlight-section`);for(let t of r)t!==e&&(t.classList.remove(`fe-highlight-section`,`fe-highlight-speaking`),t.classList.add(`fe-highlight-exiting`),setTimeout(()=>t.classList.remove(`fe-highlight-exiting`),300));if(e.classList.remove(`fe-highlight-exiting`),e.classList.add(`fe-highlight-section`),t?e.classList.add(`fe-highlight-speaking`):e.classList.remove(`fe-highlight-speaking`),n)try{e.scrollIntoView({behavior:`smooth`,block:`center`})}catch{try{e.scrollIntoView(!0)}catch{}}}function pr(){typeof document>`u`||(document.querySelectorAll(`.fe-highlight-section, .fe-highlight-exiting`).forEach(e=>e.classList.remove(`fe-highlight-section`,`fe-highlight-speaking`,`fe-highlight-exiting`)),An())}function mr(e){if(typeof window>`u`)return e;try{let t=new URL(String(e).trim(),window.location.href);return!/^https?:$/i.test(t.protocol)||t.origin===window.location.origin?t.href:new URL(t.pathname+t.search+t.hash,window.location.origin).href}catch{return e}}async function hr(e){if(typeof window>`u`)return!1;try{let t=new URL(String(e).trim(),window.location.href),n=t.origin===window.location.origin?t.href:new URL(t.pathname+t.search+t.hash,window.location.origin).href;return(await fetch(n,{method:`HEAD`,mode:`same-origin`,cache:`no-store`})).ok}catch{return!1}}async function gr(e,{siteId:t,apiBaseUrl:n}){if(!e)return{allowed:!1,correctedUrl:null};let r=!1;try{r=!!Xn()}catch{r=!1}let i=async()=>({allowed:r?!1:await hr(e),correctedUrl:null});if(!t||!n)return console.warn(`[FlowEngage] shouldProceedWithNavigation: missing siteId or apiBaseUrl`),i();let a=String(n).replace(/\/$/,``),o=new URLSearchParams({siteId:String(t),url:String(e).trim()});try{let e=await(await fetch(`${a}/api/widget/navigate-allowed?${o.toString()}`)).json().catch(()=>({}));return e.success&&e.allowed?{allowed:!0,correctedUrl:e.correctedUrl||null}:i()}catch(e){return console.warn(`[FlowEngage] navigate-allowed check failed:`,e?.message),i()}}function _r(e){if(!(!e||typeof sessionStorage>`u`))try{sessionStorage.setItem(Fn,JSON.stringify({sectionText:e,ts:Date.now()}))}catch{}}async function vr(e,{skipPushState:t=!1,isBack:n=!1}={}){if(typeof window>`u`||typeof document>`u`)return!1;try{if(new URL(e,window.location.href).origin!==window.location.origin)return!1}catch{return!1}sr();let r=new AbortController,i=setTimeout(()=>r.abort(),8e3);try{let a=await fetch(e,{credentials:`same-origin`,cache:`no-store`,signal:r.signal});if(clearTimeout(i),!a.ok)return cr(),!1;let o=await a.text(),s=new DOMParser().parseFromString(o,`text/html`),c=document.getElementById(`flowengage-root`);if(!c)return cr(),!1;try{typeof window.Drupal?.detachBehaviors==`function`&&window.Drupal.detachBehaviors(document.body,window.drupalSettings)}catch{}document.querySelectorAll(`script`).forEach(e=>{e.setAttribute(`data-fe-original`,`true`)}),Array.from(document.body.children).forEach(e=>{if(e===c)return;let t=e.tagName?.toUpperCase();t===`AUDIO`||t===`VIDEO`||e.remove()}),Qn();let l=new Set(Array.from(document.querySelectorAll(`link[rel='stylesheet']`)).map(e=>{try{return new URL(e.getAttribute(`href`)||``,window.location.href).href}catch{return``}}));for(let t of Array.from(s.head.querySelectorAll(`link[rel='stylesheet']`))){let n=t.getAttribute(`href`);if(!n)continue;let r;try{r=new URL(n,e).href}catch{continue}if(l.has(r))continue;let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=r,i.setAttribute(Zn,`true`),t.media&&(i.media=t.media),document.head.appendChild(i)}for(let e of Array.from(s.head.querySelectorAll(`style`))){if(!e.textContent.trim())continue;let t=e.textContent.trim().slice(0,120);if(Array.from(document.head.querySelectorAll(`style:not([data-fe-swap-css])`)).some(e=>e.textContent.trim().slice(0,120)===t))continue;let n=document.createElement(`style`);n.textContent=e.textContent,n.setAttribute(Zn,`true`),document.head.appendChild(n)}Array.from(s.body.children).forEach(e=>{e.tagName?.toUpperCase()!==`SCRIPT`&&document.body.insertBefore(document.importNode(e,!0),c)});let u=document.querySelectorAll(`script:not([data-fe-replayed])`);for(let e of u){if(e.closest(`#flowengage-root, .flowengage-shell`)||e.hasAttribute(`data-fe-original`)||e.hasAttribute(`data-fe-replayed`))continue;let t=e.getAttribute(`src`),n=e.getAttribute(`type`)||``;if(!(n&&n!==`text/javascript`&&n!==``&&!n.includes(`drupal-ajax`))){if(n.includes(`drupal-ajax`)){e.setAttribute(`data-fe-replayed`,`true`);try{let t=JSON.parse(e.textContent);if(Array.isArray(t))for(let e of t){if((e.command===`insert`||e.command===`insert_new_content`)&&e.selector&&e.data){let t=document.querySelector(e.selector);t&&(e.method===`replaceWith`?t.outerHTML=e.data:e.method===`html`||e.method===`replace`?t.innerHTML=e.data:e.method===`append`?t.insertAdjacentHTML(`beforeend`,e.data):e.method===`prepend`?t.insertAdjacentHTML(`afterbegin`,e.data):t.innerHTML=e.data,Pn(`trySpaNavigate: BigPipe replacement →`,e.selector))}if(e.command===`settings`&&e.settings)try{window.drupalSettings&&typeof window.drupalSettings==`object`&&Object.assign(window.drupalSettings,e.settings)}catch{}}}catch(e){Pn(`trySpaNavigate: BigPipe parse error:`,e.message)}continue}if(!t&&e.textContent.trim()){let t=e.textContent;if(/window\.location\s*[.=]|location\s*\.\s*(href|assign|replace|reload)\s*[=(]/i.test(t)){e.setAttribute(`data-fe-replayed`,`true`);continue}let n=document.createElement(`script`);n.textContent=t,n.setAttribute(`data-fe-replayed`,`true`),e.parentNode.replaceChild(n,e)}}}try{for(let e of Array.from(s.querySelectorAll(`script`))){let t=(e.textContent||``).match(/drupalSettings\s*[,=]\s*(\{[\s\S]*?\})\s*[;)]/);if(t){try{let e=JSON.parse(t[1]);window.drupalSettings&&typeof window.drupalSettings==`object`?Object.assign(window.drupalSettings,e):window.drupalSettings=e,Pn(`trySpaNavigate: updated drupalSettings from new page`)}catch{}break}}}catch{}let d=window.location.assign.bind(window.location),f=window.location.replace.bind(window.location),p=!0;window.location.assign=e=>{if(p){Pn(`trySpaNavigate: blocked location.assign from replayed script:`,e);return}return d(e)},window.location.replace=e=>{if(p){Pn(`trySpaNavigate: blocked location.replace from replayed script:`,e);return}return f(e)};function m(e){let t=e.toLowerCase();return!!(/\/jquery[.\-\/]/.test(t)||/\/jquery\.min\.js/.test(t)||/\/jquery-once/.test(t)||/\/jquery\.once/.test(t)||/\/jquery\.ui[\./]/.test(t)||/\/jqueryui/.test(t)||/\/core\/misc\//.test(t)||/\/core\/modules\//.test(t)||/\/misc\/drupal\.js/.test(t)||/\/lodash[.\-\/]/.test(t)||/\/underscore[.\-\/]/.test(t)||/\/backbone[.\-\/]/.test(t)||/\/modernizr[.\-\/]/.test(t)||/\/popper[.\-\/]/.test(t)||/\/bootstrap\.min\.js/.test(t)||/\/bootstrap\.bundle/.test(t))}let h=new Set(Array.from(document.querySelectorAll(`script[src]`)).map(e=>{try{return new URL(e.getAttribute(`src`)||``,window.location.href).href}catch{return``}}));function g(t,n){let r=t.getAttribute(`src`)||``;if(r.includes(`flowengage`))return;let i=document.createElement(`script`);if(r){let n;try{n=new URL(r,e).href}catch{return}if(h.has(n)){if(m(n))return;Pn(`trySpaNavigate: re-running theme/custom script:`,n)}h.add(n),i.src=n,i.async=t.async,i.defer=t.defer}else if(t.textContent.trim()){let e=t.textContent;if(/window\.location\s*[.=]|location\s*\.\s*(href|assign|replace|reload)\s*[=(]/i.test(e)){Pn(`trySpaNavigate: skipping inline script with navigation:`,e.slice(0,120));return}if(/^\s*\(?\s*(?:window\.)?drupalSettings\s*[,=]/.test(e))return;i.textContent=e}else return;let a=t.getAttribute(`type`);a&&a!==`text/javascript`&&a!==``&&(i.type=a),n.parentNode.insertBefore(i,n)}for(let e of Array.from(s.head.querySelectorAll(`script`)))g(e,c);for(let e of Array.from(s.body.querySelectorAll(`script`)))g(e,c);try{typeof window.Drupal?.attachBehaviors==`function`&&window.Drupal.attachBehaviors(document.body,window.drupalSettings)}catch{}try{typeof window.jQuery==`function`&&(window.jQuery(document).trigger(`ready`),window.dispatchEvent(new Event(`resize`)))}catch{}try{document.dispatchEvent(new Event(`DOMContentLoaded`,{bubbles:!0,cancelable:!1}))}catch{}try{window.dispatchEvent(new Event(`load`))}catch{}try{let e=document.querySelectorAll(`iframe:not([data-fe-skip-reload])`);for(let t of e){if(t.closest(`#flowengage-root, .flowengage-shell`))continue;let e=t.getAttribute(`src`)||t.src;e&&e!==`about:blank`&&!e.startsWith(`javascript:`)&&(Pn(`trySpaNavigate: reloading iframe:`,e),t.src=e)}}catch{}try{let e=document.querySelectorAll(`.g-recaptcha, [data-sitekey]`);if(e.length>0){if(typeof window.grecaptcha?.render==`function`){for(let t of e)if(!t.closest(`#flowengage-root`)){t.innerHTML=``;try{window.grecaptcha.render(t,{sitekey:t.getAttribute(`data-sitekey`)||``}),Pn(`trySpaNavigate: re-rendered reCAPTCHA`)}catch{}}}else if(!document.querySelector(`script[src*='recaptcha']`)){let e=document.createElement(`script`);e.src=`https://www.google.com/recaptcha/api.js?render=explicit`,e.async=!0,document.head.appendChild(e),Pn(`trySpaNavigate: injected reCAPTCHA script`)}}}catch{}if(setTimeout(()=>{p=!1,window.location.assign=d,window.location.replace=f},2e3),s.title&&(document.title=s.title),!t)try{history.pushState({flowengageSpa:!0},``,e)}catch{}if(Gn(),qn(),n){try{tr()}catch{}try{ir()}catch{}}else window.scrollTo(0,0);cr(),ar(e);try{sessionStorage.removeItem(Fn)}catch{}try{sessionStorage.removeItem(Ln)}catch{}try{Wn=new URL(e,window.location.origin).pathname}catch{}return Pn(`trySpaNavigate: succeeded →`,e),!0}catch{return clearTimeout(i),cr(),!1}}function yr(e){if(!(!e||typeof sessionStorage>`u`))try{sessionStorage.setItem(Ln,JSON.stringify({voiceWasActive:!0,targetUrl:String(e),ts:Date.now()}))}catch{}}function br(){if(!(typeof sessionStorage>`u`))try{sessionStorage.removeItem(Ln)}catch{}}function xr(){if(typeof window>`u`||typeof sessionStorage>`u`)return{shouldResumeVoice:!1,targetUrl:null};let e;try{e=JSON.parse(sessionStorage.getItem(Ln)||`null`)}catch{return{shouldResumeVoice:!1,targetUrl:null}}if(!e)return{shouldResumeVoice:!1,targetUrl:null};try{sessionStorage.removeItem(Ln)}catch{}return e.voiceWasActive?Date.now()-e.ts>Rn?(Pn(`initVoiceNavResume: state expired, skipping`),{shouldResumeVoice:!1,targetUrl:null}):(Pn(`initVoiceNavResume: voice was active during navigation to`,e.targetUrl),{shouldResumeVoice:!0,targetUrl:e.targetUrl||null}):{shouldResumeVoice:!1,targetUrl:null}}function Sr(){if(typeof document>`u`)return!1;let e=/(^|\W)(404|page not found|not found|page (?:doesn'?t|does not) exist|no longer exists|couldn'?t find (?:this|that|the) page|error 404|oops[!,. ].*(?:not found|doesn'?t exist))(\W|$)/i,t=(document.title||``).trim();if(t&&e.test(t))return!0;let n=document.querySelector(`main, [role="main"], #content, .content`)||document.body;if(n){let t=n.querySelectorAll(`h1, h2`);for(let n of t){let t=(n.textContent||``).replace(/\s+/g,` `).trim();if(t&&t.length<80&&e.test(t))return!0}}return!1}var Cr=6e3,wr=250,Tr=700;async function Er(){if(typeof window>`u`)return;let e=window.__fe_agentAudioPlaying;if(typeof e!=`function`){await new Promise(e=>setTimeout(e,Tr));return}let t=Date.now()+Cr;for(;Date.now()<t;){let t=!1;try{t=e()}catch{t=!1}if(!t)break;await new Promise(e=>setTimeout(e,100))}await new Promise(e=>setTimeout(e,wr))}async function Dr(e,t={}){if(typeof window>`u`)return{navigated:!1};let{sectionText:n,voiceActive:r=!1}=t;try{let t=mr(e),i=new URL(t,window.location.origin);if(i.hash&&i.pathname===window.location.pathname){let e=document.getElementById(i.hash.slice(1));if(e)return e.scrollIntoView({behavior:`smooth`,block:`start`}),{navigated:!0}}if(i.pathname===window.location.pathname&&i.search===window.location.search&&!i.hash)return{navigated:!1,reason:`already-on-page`};let a=i.pathname+i.search+i.hash;if(window.Shopify)return n&&_r(n),r||we(),r?Er().then(()=>window.location.assign(i.href)):window.location.assign(i.href),{navigated:!0};let o=window.next?.router;if(o?.push)return new Promise(e=>{let t=()=>{o.events?.off(`routeChangeComplete`,t),e({navigated:!0})};o.events?.on(`routeChangeComplete`,t),o.push(a),setTimeout(t,5e3)});if(window.__NEXT_ROUTER__?.push)return window.__NEXT_ROUTER__.push(a),{navigated:!0};if(Xn()){n&&_r(n);let e=window.location.href;try{window.history.pushState({},``,i.href),window.dispatchEvent(new PopStateEvent(`popstate`,{state:{}}))}catch{}if(await new Promise(e=>setTimeout(e,400)),Sr()){try{window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`,{state:{}}))}catch{}return n&&_r(n),r||we(),window.location.assign(i.href),{navigated:!0}}return{navigated:!0}}return n&&_r(n),r||we(),window.location.assign(i.href),{navigated:!0}}catch(t){console.warn(`[FlowEngage] shadowNavigate error:`,t),n&&_r(n);try{window.location.href=mr(e)}catch{window.location.href=e}return{navigated:!0}}}var Or=!1,kr=null;function Ar(e){kr=e,typeof window<`u`&&(window.__fe_triggerVoiceNavHooks=()=>{try{e.onBeforeNavigate()}catch{}}),!Or&&(Or=!0,!(typeof document>`u`)&&(document.addEventListener(`click`,e=>{if(!kr)return;let t=e.target.closest?.(`a[href]`);if(!t||t.closest(`#flowengage-root, .flowengage-shell, .flowengage-widget-root`))return;let n=t.getAttribute(`href`)||``;if(!n||n===`#`||n.startsWith(`javascript:`)||n.startsWith(`mailto:`)||n.startsWith(`tel:`)||t.hasAttribute(`download`)||t.target===`_blank`||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let r;try{if(r=new URL(n,window.location.href),r.origin!==window.location.origin)return}catch{return}if(!(r.pathname===window.location.pathname&&r.hash)&&!(r.pathname===window.location.pathname&&r.search===window.location.search&&!r.hash)){Pn(`voice-link-hook: saving state before navigation →`,r.href);try{kr.onBeforeNavigate()}catch{}}},!0),document.addEventListener(`submit`,e=>{if(kr&&!e.target?.closest?.(`#flowengage-root, .flowengage-shell, .flowengage-widget-root`)){Pn(`voice-form-hook: saving state before form submit`);try{kr.onBeforeNavigate()}catch{}}},!0)))}function jr(){kr=null,Pn(`voice-nav-hooks: deactivated`)}var Mr=4e3,Nr=null;function Pr(){let e=typeof window<`u`&&window.Shopify?.routes?.root||`/`;return e.endsWith(`/`)?e:`${e}/`}async function Fr(e,t={}){let n=new AbortController,r=setTimeout(()=>n.abort(),Mr);try{let r=await fetch(e,{credentials:`same-origin`,signal:n.signal,...t,headers:{Accept:`application/json`,...t.body?{"Content-Type":`application/json`}:{},...t.headers||{}}}),i=await r.json().catch(()=>({}));if(!r.ok){let e=Error(i.description||i.message||`Cart request failed (${r.status})`);throw e.status=r.status,r.status===422&&i.description&&(e.userMessage=i.description),e}return i}finally{clearTimeout(r)}}async function Ir(){if(Nr!==null)return Nr;if(typeof window>`u`)return Nr=!1;if(window.Shopify)return Nr=!0;try{let e=await Fr(`${Pr()}cart.js`);Nr=e&&typeof e.item_count==`number`}catch{Nr=!1}return Nr}async function Lr(){return Fr(`${Pr()}cart.js`)}function Rr(){return typeof window>`u`?null:window.__flowengageCustomer?.id||null}function zr(e){return typeof e!=`number`||Number.isNaN(e)?null:(e/100).toFixed(2)}async function Br(){try{if(!await Ir())return null;let e=await Lr();return{itemCount:e.item_count,subtotal:zr(e.items_subtotal_price),currency:e.currency||null,items:(e.items||[]).map(e=>({title:e.product_title||e.title,variantTitle:e.variant_title||null,quantity:e.quantity,linePrice:zr(e.final_line_price??e.line_price),handle:e.handle||null}))}}catch{return null}}async function Vr(e,t=null){let n=await Fr(`${Pr()}products/${encodeURIComponent(e)}.js`),r=n.variants||[];if(!r.length){let t=Error(`No variants for ${e}`);throw t.userMessage=`"${n.title||e}" has no purchasable options right now.`,t}let i=null;if(t){let e=t.toLowerCase();if(i=r.find(t=>(t.title||``).toLowerCase()===e)||r.find(t=>{let n=[t.title,...t.options||[]].join(` `).toLowerCase();return e.split(/[\s/,-]+/).filter(Boolean).every(e=>n.includes(e))}),!i){let e=Error(`Variant not found: ${t}`);throw e.userMessage=`I couldn't find a "${t}" option for ${n.title}. Available: ${r.map(e=>e.title).slice(0,6).join(`, `)}.`,e}}else i=r.find(e=>e.available)||r[0];if(!i.available){let e=Error(`Variant unavailable: ${i.title}`);throw e.userMessage=`Sorry — ${n.title}${i.title&&i.title!==`Default Title`?` (${i.title})`:``} is currently sold out.`,e}return{variant:i,product:n}}async function Hr(e,t=1){return Fr(`${Pr()}cart/add.js`,{method:`POST`,body:JSON.stringify({items:[{id:e,quantity:t}]})})}async function Ur(e,t){return Fr(`${Pr()}cart/change.js`,{method:`POST`,body:JSON.stringify({line:e,quantity:t})})}function Wr(){return`${Pr()}cart`}function Gr(){return`${Pr()}checkout`}function Kr(e){return`${Pr()}products/${encodeURIComponent(e)}`}async function qr(e,t=6){let n=new URLSearchParams({q:e,"resources[type]":`product`,"resources[limit]":String(t)});try{return((await Fr(`${Pr()}search/suggest.json?${n.toString()}`))?.resources?.results?.products||[]).map(e=>({title:e.title,handle:e.handle,price:e.price||null,url:e.url||null}))}catch{return[]}}function Jr(){return typeof window>`u`?!1:/\/cart\/?$/.test(window.location.pathname)}var Yr=[`form[action*="/cart"]`,`cart-items`,`cart-drawer-items`,`.cart-items`,`.cart__items`,`#main-cart-items`,`[data-cart-items]`].join(`, `);function Xr(e){if(/cart/i.test(e.id))return!0;try{return!!e.querySelector(Yr)}catch{return!1}}async function Zr(){if(typeof document>`u`)return!1;let e=Array.from(document.querySelectorAll(`[id^="shopify-section-"]`)).filter(Xr);if(!e.length)return!1;let t=e.map(e=>e.id.replace(/^shopify-section-/,``));try{let e=await Fr(`${window.location.pathname}?sections=${encodeURIComponent(t.join(`,`))}`),n=!1;for(let[t,r]of Object.entries(e||{})){if(!r||typeof r!=`string`)continue;let e=document.getElementById(`shopify-section-${t}`);if(!e)continue;let i=document.createElement(`div`);i.innerHTML=r;let a=i.querySelector(`#shopify-section-${t}`)||i.firstElementChild;a&&(e.innerHTML=a.innerHTML,n=!0)}return n}catch{return!1}}var Qr=[`[data-cart-count]`,`.cart-count-bubble`,`.cart-count`,`#CartCount`,`.cart-link__bubble`,`.site-header__cart-count`,`#cart-icon-bubble`];function $r(e){if(typeof document>`u`)return;let t=String(e);for(let e of Qr)document.querySelectorAll(e).forEach(e=>{e.hasAttribute(`data-cart-count`)&&e.setAttribute(`data-cart-count`,t),e.querySelectorAll(`span, div, sup`).forEach(e=>{e.children.length===0&&/\d/.test(e.textContent||``)&&(e.textContent=(e.textContent||``).replace(/\d+/,t))}),e.children.length===0&&/^\s*\d+\s*$/.test(e.textContent||``)&&(e.textContent=t)})}function ei(e){if(typeof document>`u`)return;let t={cart:e,source:`flowengage`};[`cart:updated`,`cart:refresh`,`cart:change`,`cart-drawer:refresh`].forEach(e=>{try{document.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0}))}catch{}});try{window.dispatchEvent(new CustomEvent(`cart:refresh`,{detail:t}))}catch{}}async function ti(e){let t=await Zr();return!t&&Jr()&&(await new Promise(e=>setTimeout(e,600)),t=await Zr()),e&&typeof e.item_count==`number`&&$r(e.item_count),ei(e||null),{sectionsSwapped:t}}async function ni(e){try{let{sectionsSwapped:t}=await ti(e);if(!t&&Jr())return` (The list on this page may need a quick refresh to show it.)`}catch{}return``}function ri(e){let t=zr(e.items_subtotal_price),n=e.item_count;return t==null?``:` Your cart now has ${n} item${n===1?``:`s`} — subtotal ${t}${e.currency?` ${e.currency}`:``}.`}function ii(e,t){let n=t.title&&t.title!==`Default Title`;return`${e.title}${n?` (${t.title})`:``}`}function ai(e,t){return e?.userMessage||t}var oi={async add(e){let{variant:t,product:n}=await Vr(e.productHandle,e.variantTitle||null);await Hr(t.id,e.quantity||1);let r=await Lr(),i=await ni(r);return{message:`✅ Added ${e.quantity||1} × ${ii(n,t)} to your cart.${ri(r)}${i}`}},async update(e){let t=(await Lr()).items?.[e.line-1];if(!t)return{message:`⚠️ I couldn't find item #${e.line} in your cart — it may have changed. Ask me "what's in my cart?" to see the current list.`};let n=await Ur(e.line,e.quantity),r=await ni(n);return{message:`✅ Updated ${t.product_title||t.title} to quantity ${e.quantity}.${ri(n)}${r}`}},async remove(e){let t=(await Lr()).items?.[e.line-1];if(!t)return{message:`⚠️ I couldn't find item #${e.line} in your cart — it may have changed. Ask me "what's in my cart?" to see the current list.`};let n=await Ur(e.line,0),r=await ni(n);return{message:`🗑️ Removed ${t.product_title||t.title} from your cart.${ri(n)}${r}`}},async view_cart(){return{message:`Opening your cart…`,navigateTo:Wr()}},async checkout(){return(await Lr()).item_count?{message:`Taking you to checkout…`,navigateTo:Gr()}:{message:`Your cart is empty — add something first and I'll take you straight to checkout.`}},async view_product(e){return{message:`Opening the product page…`,navigateTo:Kr(e.productHandle)}}},si={add:`⚠️ I couldn't add that to your cart — please try from the product page.`,update:`⚠️ I couldn't update that cart item — please try again.`,remove:`⚠️ I couldn't remove that cart item — please try again.`,view_cart:`⚠️ I couldn't open the cart page.`,checkout:`⚠️ I couldn't start checkout — you can open the cart and check out from there.`,view_product:`⚠️ I couldn't open that product page.`};async function ci(e){let t={messages:[],navigateTo:null};if(!Array.isArray(e)||e.length===0)return t;if(!await Ir())return t.messages.push(`⚠️ Cart actions only work on the store's own website — please try from the shop page.`),t;for(let n of e){let e=oi[n?.type];if(e)try{let r=await e(n);r.message&&t.messages.push(r.message),r.navigateTo&&(t.navigateTo=r.navigateTo)}catch(e){console.warn(`[FlowEngage:Cart] ${n.type} failed:`,e),t.messages.push(ai(e,si[n.type]))}}return t}var li=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),V=s(((e,t)=>{t.exports=li()}))(),ui=e=>!e||typeof e!=`string`?e:e.replace(/<human_assistance_request[^>]*>/gi,``).replace(/<\/human_assistance_request>/gi,``).replace(/<navigate[^>]*\/>/gi,``).replace(/<navigate[^>]*>[\s\S]*?<\/navigate>/gi,``).replace(/<[a-z]+(?:_[a-z]+)+[^>]*>[\s\S]*?<\/[a-z]+(?:_[a-z]+)+>/gi,``).replace(/<[a-z]+(?:_[a-z]+)+[^>]*\/>/gi,``).trim(),di=(e=[])=>e.filter(e=>e.type!==`call_recording`&&!(typeof e.message==`string`&&e.message.includes(`AI chat recording`))).map(e=>({...e,message:ui(e.message),isPending:!1,id:e.messageId||`${e.sender}-${e.timestamp||Date.now()}-${Math.random()}`}));function fi(e){if(!e||typeof e!=`string`)return null;let t=e.match(/<navigate([^>]*?)(?:\/>|>[\s\S]*?<\/navigate>)/i);if(!t)return null;let n=t[1],r=n.match(/url=["']([^"']+)["']/i);if(!r)return null;let i=n.match(/section=["']([^"']+)["']/i)||n.match(/highlight=["']([^"']+)["']/i);return{url:r[1].trim(),section:i?.[1]?.trim()||null}}var pi=(e,t)=>e?typeof e==`string`?e:e.message||e.error||e.reason||t:t,mi=(e={})=>{if(!e?.candidate)return null;if(typeof e.candidate==`object`)return e.candidate;let t=e.sdpMid!==void 0&&e.sdpMid!==null&&e.sdpMid!==``,n=e.sdpMLineIndex!==void 0&&e.sdpMLineIndex!==null;return!t&&!n?null:{candidate:e.candidate,...t?{sdpMid:e.sdpMid}:{},...n?{sdpMLineIndex:e.sdpMLineIndex}:{}}},hi=(e=[],t=`Agent`)=>{for(let t of e)if(typeof t==`string`&&t.trim())return t.trim();return t},gi=(e=[],t,n=6)=>!t?.message||e.slice(-n).some(e=>e.sender===`system`&&e.message===t.message)?e:[...e,t];function _i({siteId:e,config:t,children:n,language:r=`en`}){let i=(0,b.useMemo)(()=>e?{...t||{},siteId:e}:t||null,[e,t]),[a,o]=(0,b.useState)(0),[s,c]=(0,b.useState)(`booting`),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(``),[h,g]=(0,b.useState)([]),_=(0,b.useCallback)(()=>{g(e=>[...e,{id:`nav-fail-${e.length}-${Math.random().toString(36).slice(2,8)}`,sender:`bot`,message:`I couldn't find that page on our site — could you tell me more about what you're looking for?`,timestamp:new Date().toISOString()}])},[]),v=(0,b.useCallback)(e=>{ci(e).then(({messages:e,navigateTo:t})=>{e.length&&g(t=>[...t,...e.map((e,n)=>({id:`cart-${t.length+n}-${Math.random().toString(36).slice(2,8)}`,sender:`bot`,message:e,timestamp:new Date().toISOString()}))]),t&&setTimeout(()=>{window.location.assign(t)},900)})},[]),y=(0,b.useCallback)(()=>{g(e=>e.slice(-3).some(e=>(e.sender===`bot`||e.sender===`assistant`)&&/already on (that|this|the)\b/i.test(String(e.message||``)))?e:[...e,{id:`nav-already-${e.length}-${Math.random().toString(36).slice(2,8)}`,sender:`bot`,message:`Looks like you're already on this page!`,timestamp:new Date().toISOString()}])},[]),[x,C]=(0,b.useState)(N().isOpen),[w,T]=(0,b.useState)(N().activeScreen),[E,k]=(0,b.useState)(N().isHumanHandled),[A,ie]=(0,b.useState)(N().agentName),[j,M]=(0,b.useState)(N().agentHeadshot),[ae,F]=(0,b.useState)(()=>le(i?.siteId)),[de,fe]=(0,b.useState)(!1),[me,I]=(0,b.useState)(!1),[he,ge]=(0,b.useState)(`idle`),[_e,ve]=(0,b.useState)(!1),[ye,be]=(0,b.useState)(!1),[Se,Ce]=(0,b.useState)(``),[we,Te]=(0,b.useState)(!1),[Ee,De]=(0,b.useState)(0),[Oe,ke]=(0,b.useState)(0),[Ae,je]=(0,b.useState)(!1),[L,Fe]=(0,b.useState)(null),[Ie,Le]=(0,b.useState)(null),[Re,ze]=(0,b.useState)(`idle`),[Be,Ve]=(0,b.useState)(null),[He,Ue]=(0,b.useState)(!1),[We,Ge]=(0,b.useState)(``),[Ke,qe]=(0,b.useState)(!1),Je=(0,b.useRef)(null),R=(0,b.useRef)(null),Ye=(0,b.useRef)(``),Xe=(0,b.useRef)(!1),Ze=(0,b.useRef)(null),Qe=(0,b.useRef)(null),$e=(0,b.useRef)(null),et=(0,b.useRef)(null),tt=(0,b.useRef)(null),nt=(0,b.useRef)(null),rt=(0,b.useRef)(null),it=(0,b.useRef)(!1),at=(0,b.useRef)({url:null,at:0}),ot=(0,b.useCallback)((e,t)=>{Vn(6e3);let n=e;try{n=new URL(e,window.location.origin).href}catch{}let r=at.current;return r.url===n&&Date.now()-r.at<4e3?Promise.resolve({navigated:!0,deduped:!0}):(at.current={url:n,at:Date.now()},Dr(e,t))},[]),st=(0,b.useRef)([]),z=(0,b.useRef)(null),ct=(0,b.useRef)(null),lt=(0,b.useRef)(null),ut=(0,b.useRef)(!1),dt=(0,b.useRef)(!1),ft=(0,b.useRef)(``),pt=(0,b.useRef)(null),mt=(0,b.useRef)(null),ht=(0,b.useRef)([]),gt=(0,b.useRef)(0),_t=(0,b.useRef)(A),vt=(0,b.useRef)([]),yt=(0,b.useRef)(!1),bt=(0,b.useRef)(!1),xt=(0,b.useRef)(i),St=(0,b.useRef)({notifyRouteChange:()=>{},cleanup:()=>{}}),Ct=(0,b.useCallback)((e={})=>{let t=!!e.is_human_handled;return k(t),t?(T(`agent`),e.agent_info?.name&&ie(e.agent_info.name),e.agent_info?.headshot&&M(e.agent_info.headshot),t):(T(`ai`),t)},[]),wt=(0,b.useMemo)(()=>{let e=d?.widgetSettings?.call?.maxDurationSeconds??i?.widgetSettings?.call?.maxDurationSeconds??i?.callMaxDurationSeconds,t=Number(e);return Number.isFinite(t)&&t>0?t:D},[i,d]);(0,b.useEffect)(()=>{Qe.current=L},[L]),(0,b.useEffect)(()=>{_t.current=A},[A]),(0,b.useEffect)(()=>{bt.current=we},[we]),(0,b.useEffect)(()=>{xt.current=i},[i]);let Tt=()=>{Ge(``)},Et=(0,b.useCallback)(()=>{lt.current&&=(window.clearTimeout(lt.current),null)},[]),Dt=e=>{let t=typeof e==`string`?e.trim().toLowerCase():``;return F(t),ue(t,i?.siteId),t};(0,b.useEffect)(()=>{let e=i?.siteId;if(!e)return;let t=le(e);if(t){F(t);return}F(t=>(t&&ue(t,e),t))},[i?.siteId]);let Ot=(e=`unspecified`)=>{let t=z.current||nt.current?.callId,n=gt.current,r=pt.current;if(pt.current=null,gt.current=0,r&&r.state!==`inactive`){r.onstop=()=>{let e=ht.current;if(ht.current=[],e.length>0&&t&&R.current){let r=new Blob(e,{type:e[0].type}),i=n>0?Math.round((Date.now()-n)/1e3):0;R.current.uploadRecording(t,r,i).then(e=>console.log(`[FlowEngageCall] recording upload success`,e)).catch(e=>console.warn(`[FlowEngageCall] recording upload failed`,e))}};try{r.stop()}catch{r.onstop=null,ht.current=[]}}else if(r&&r.state===`inactive`){let e=ht.current;if(ht.current=[],e.length>0&&t&&R.current){let r=new Blob(e,{type:e[0].type}),i=n>0?Math.round((Date.now()-n)/1e3):0;R.current.uploadRecording(t,r,i).then(e=>console.log(`[FlowEngageCall] recording upload success`,e)).catch(e=>console.warn(`[FlowEngageCall] recording upload failed`,e))}}else ht.current=[];if(mt.current){try{mt.current.close()}catch{}mt.current=null}$e.current&&=($e.current.close(),null),et.current&&=(et.current.getTracks().forEach(e=>e.stop()),null),tt.current&&=(tt.current.srcObject=null,tt.current.remove(),null),Et(),nt.current=null,st.current=[],z.current=null,ct.current=null,ut.current=!1,Ue(!1),Fe(null),Le(null),ze(`idle`),Ve(null)},kt=(e=new Date().toISOString())=>{let t=Je.current,n=z.current||nt.current?.callId;if(!(!t?.connected||!n||ut.current)){ut.current=!0,t.emit(`call:connected`,{callId:n,chatId:Ye.current,connectedAt:e});try{let e=et.current,t=tt.current?.srcObject;if(e&&t&&!pt.current){ht.current=[];let n=new(window.AudioContext||window.webkitAudioContext);mt.current=n;let r=n.createMediaStreamDestination();n.createMediaStreamSource(e).connect(r),n.createMediaStreamSource(t).connect(r);let i=window.MediaRecorder.isTypeSupported(`audio/webm`)?`audio/webm`:`audio/mp4`,a=new window.MediaRecorder(r.stream,{mimeType:i});a.ondataavailable=e=>{e.data&&e.data.size>0&&ht.current.push(e.data)},pt.current=a,gt.current=Date.now(),a.start(1e3),setTimeout(()=>{try{if(!window.speechSynthesis)return;let e=new SpeechSynthesisUtterance(`This call is being recorded for quality and training purposes.`);if(e.rate=.95,e.pitch=1,e.volume=1,window.MediaStreamTrackGenerator||window.AudioContext)try{let t=n.createMediaStreamDestination();e.onstart=()=>{try{let i=document.createElement(`audio`);i.style.display=`none`,i.srcObject=t.stream,document.body.appendChild(i),i.play().catch(()=>{});let a=n.createMediaStreamSource(t.stream);a.connect(r),e.onend=()=>{try{a.disconnect()}catch{}try{i.remove()}catch{}}}catch{}}}catch{}window.speechSynthesis.speak(e)}catch{}},200)}}catch{}}},At=(e={})=>{if(!e.callId)return;let t=ct.current===e.callId,n=z.current===e.callId,r=Qe.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(Et(),Fe(null),t||n){z.current=e.callId,Le(e.callId),ze(e=>e===`connected`?e:`connecting`),C(!0);return}ze(`idle`)}},jt=(e={})=>{if(!e.callId)return;let t=ct.current===e.callId,n=z.current===e.callId,r=Qe.current?.callId===e.callId;if(!(!t&&!n&&!r)){if(Et(),n){Ot();return}ct.current=null,nt.current=null,st.current=[],Fe(null),ze(`idle`)}},Mt=async(e={})=>{let t=$e.current,n=Je.current,r=e.sdpOffer||e.offer?.sdp;if(!t||!n?.connected||!r||!e.callId){console.log(`[FlowEngageProvider] deferring remote offer until peer/socket ready`,{callId:e.callId,chatId:Ye.current,hasPeerConnection:!!t,socketConnected:!!n?.connected,hasOffer:!!r}),nt.current=e;return}if(await t.setRemoteDescription(new RTCSessionDescription({type:`offer`,sdp:r})),st.current.length>0){console.log(`[FlowEngageProvider] flushing queued agent ICE candidates after remote offer`,{callId:e.callId,chatId:Ye.current,queuedCount:st.current.length});for(let e of st.current)await t.addIceCandidate(new RTCIceCandidate(e));st.current=[]}let i=await t.createAnswer();await t.setLocalDescription(i),n.emit(`call:answer`,{callId:e.callId,sdpAnswer:i.sdp,chatId:Ye.current})};(0,b.useEffect)(()=>{P({isOpen:x,activeScreen:w,isHumanHandled:E,agentName:A,agentHeadshot:j})},[x,w,E,A,j]),(0,b.useEffect)(()=>{let e=!0;return(async()=>{qe(!0);try{let t=S(i),n=await Ne(t);if(!e)return;let a=t.siteId,o=oe(a),s=pe(a),l=``;try{let e=Xe.current,r=Ze.current;if(Xe.current=!1,Ze.current=null,l=(await Me({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:a,priorChatId:e||r?null:o||te(),forceNew:e,resumeChatId:r,visitorId:s}))?.data?.chatId,!l)throw Error(`resolve-session returned no chatId`);ne(),ce(a,l)}catch(e){console.warn(`[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id`,e?.message||e),l=o||re(),ce(a,l)}Ye.current=l;let u=Pe({apiBaseUrl:t.apiBaseUrl,userId:n.userId,siteId:t.siteId,visitorId:s});R.current=u,f({...n,apiBaseUrl:t.apiBaseUrl}),m(l);let d=n?.widgetSettings?.branding?.fallbackAgentName||`Agent`,p=Sn({apiBaseUrl:t.apiBaseUrl,userId:n.userId,chatId:l,siteId:t.siteId});Je.current=p,p.on(`connect`,async()=>{ge(`connected`);let e=Ye.current;if(e&&R.current)try{Ct(await R.current.checkHumanHandled(e))}catch{}}),p.on(`disconnect`,()=>{ge(`disconnected`)}),p.on(`aiTyping`,()=>{I(!0)}),p.on(`ai:typing`,()=>{I(!0)}),p.on(`messageReceived`,e=>{let t=e.message||e,n={...t,message:ui(t.message)};I(!1),fe(!1),!(n.type===`call_recording`||typeof n.message==`string`&&n.message.includes(`AI chat recording`))&&g(e=>[...e.filter(e=>!e.isPending),{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}])}),p.on(`conversationStarted`,e=>{e?.message&&g(t=>[...t,{id:`system-start-${Date.now()}`,sender:`system`,message:e.message,timestamp:new Date().toISOString(),isPending:!1}])}),p.on(`message:new`,e=>{let t=e.message||e,n={...t,message:ui(t.message)};I(!1),!(n.type===`call_recording`||typeof n.message==`string`&&n.message.includes(`AI chat recording`))&&((n.sender===`agent`||n.agent_name||n.sender===`ai`||n.sender===`bot`)&&fe(!1),g(e=>n.sender===`bot`||n.sender===`ai`?[...e,{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}]:e.some(e=>e.id===n.messageId||e.sender===n.sender&&e.message===n.message&&e.isPending)?e.map(e=>e.sender===n.sender&&e.message===n.message&&e.isPending?{...n,isPending:!1,id:n.messageId||e.id}:e):[...e,{...n,isPending:!1,id:n.messageId||`${n.sender}-${Date.now()}-${Math.random()}`}]),(n.sender===`agent`||n.agent_name)&&(k(!0),T(`agent`),ie(hi([n.agent_name,n.agentName,n.metadata?.agentName],d)),n.sender_headshot&&M(n.sender_headshot),C(!0),De(e=>e+1)))});let h=(e={})=>{let t=hi([e.agent?.name,e.agentName,e.agent_name,_t.current],d);k(!0),T(`agent`),ie(t),M(e.agent?.headshot||null),C(!0),De(e=>e+1),g(e=>gi(e,{id:`agent-joined-${Date.now()}`,sender:`system`,message:`${t} has joined the chat.`,timestamp:new Date().toISOString(),isPending:!1}))},v=(e={})=>{let t=hi([e.agent?.name,e.agentName,e.agent_name,_t.current],d);k(!1),T(`ai`),g(e=>gi(e,{id:`agent-left-${Date.now()}`,sender:`system`,message:`${t} has left the chat.`,timestamp:new Date().toISOString(),isPending:!1}))};p.on(`agent:joined`,h),p.on(`agentJoined`,h),p.on(`agent:left`,v),p.on(`agentLeft`,v),p.on(`conversationEnded`,e=>{je(!0);let t=e?.message||`This conversation has ended. Thank you for reaching out!`;g(e=>[...e,{id:`conversation-ended-${Date.now()}`,sender:`system`,message:t,timestamp:new Date().toISOString(),isPending:!1}])}),p.on(`chat:history_update`,e=>{let t=di(e.chat_history||[]);g(t),t.length===0&&(je(!1),k(!1),T(`ai`),I(!1),fe(!1))}),p.on(`conversation:reset`,()=>{g([]),je(!1),k(!1),T(`ai`),I(!1),fe(!1)}),p.on(`voice:end_session`,(e={})=>{console.log(`[FlowEngageProvider] voice:end_session received — ending voice session`),ke(e=>e+1),C(!0),De(e=>e+1)}),p.on(`typing:start`,e=>{e.sender===`agent`&&fe(!0)}),p.on(`typing:stop`,e=>{e.sender===`agent`&&fe(!1)}),p.on(`call:incoming`,(e={})=>{let t=hi([e.agentName,e.ownerName,e.agent?.name,_t.current],`Agent`);Tt(),Et(),ut.current=!1,Fe({callId:e.callId,from:e.from||`owner`,agentId:e.agentId||null,agentName:t}),ie(e=>hi([t,e],`Agent`)),ze(`incoming`),Ve(null),C(!0)}),p.on(`call:offer`,async(e={})=>{nt.current=e;try{await Mt(e)}catch(e){console.error(`[FlowEngageProvider] failed to apply remote offer`,e)}}),p.on(`call:ice-candidate-from-agent`,async(e={})=>{if(e.candidate)try{let t=mi(e);if(!t){console.warn(`[FlowEngageProvider] ignoring invalid ICE candidate payload`,e);return}if(!$e.current||!$e.current.remoteDescription){console.log(`[FlowEngageProvider] queueing agent ICE candidate until peer/remote description is ready`,{callId:e.callId,chatId:e.chatId||Ye.current,queueSize:st.current.length+1}),st.current.push(t);return}await $e.current.addIceCandidate(new RTCIceCandidate(t))}catch(e){console.error(`[FlowEngageProvider] failed to add ICE candidate`,e)}}),p.on(`call:ended`,()=>{Tt(),Ot(`socket:call_ended`)}),p.on(`call:accepted`,(e={})=>{At(e)}),p.on(`call:accepted_by_other`,(e={})=>{At(e)}),p.on(`call:rejected`,(e={})=>{jt(e)}),p.on(`call:missed`,(e={})=>{jt(e)}),p.on(`call:failed`,(e={})=>{jt(e)}),p.on(`call:connected`,(e={})=>{if(!e.callId)return;let t=ct.current===e.callId,n=z.current===e.callId,r=nt.current?.callId===e.callId,i=Qe.current?.callId===e.callId;if(!t&&!n&&!r){i&&(Fe(null),ze(`idle`));return}ut.current=!0,ct.current=null,z.current=e.callId,Le(e.callId),Fe(null),ze(`connected`),Ve(e.connectedAt||new Date().toISOString()),C(!0)}),p.on(`call:unavailable`,(e={})=>{Ot(`socket:call_unavailable`),Ge(pi(e,`This visitor is not available for a call right now.`)),C(!0)}),p.on(`call:error`,(e={})=>{Ot(`socket:call_error`),Ge(pi(e,`We couldn't connect the call right now.`)),C(!0)}),p.on(`visitor:navigate`,async({url:e,section:t,highlight:n}={})=>{e&&ot(e,{voiceActive:bt.current}).then(({navigated:e,reason:r})=>{if(!e){r===`not-found`?_():r===`already-on-page`&&y();return}let i=t||n;i&&setTimeout(()=>{let e=dr(null,i);e&&fr(e)},300)})}),p.on(`visitor:highlight`,({sectionId:e,sectionText:t}={})=>{if(!e&&!t)return;let n=dr(e||null,t||null);n&&fr(n)}),p.on(`visitor:clear_highlight`,()=>{pr()}),St.current=Cn({socket:p,chatId:l});let b=await u.loadHistory(l,r);if(!e)return;g(di(b.chat_history||[])),k(!!b.is_human_handled),T(b.is_human_handled?`agent`:w);let x=b?.visitor_email||b?.visitorEmail;if(x&&String(x).trim()&&Dt(String(x).trim()),await new Promise(e=>setTimeout(e,500)),!e)return;c(`ready`)}catch(t){if(!e)return;u(t),c(`error`)}finally{e&&qe(!1)}})(),()=>{e=!1,St.current?.cleanup?.(),Ot(),Je.current?.disconnect()}},[i,r,a]),(0,b.useEffect)(()=>()=>{if(we&&!yt.current&&vt.current.length>0){let e=Ye.current,t=vt.current,n=R.current;n&&e&&t.length>0&&(console.log(`[FlowEngageProvider] safety-net: syncing voice transcript on unmount`),n.beaconSyncVoice(e,t)||n.syncVoice(e,t).catch(()=>{}),yt.current=!0)}},[we,d]);let Nt=(0,b.useRef)(null);(0,b.useEffect)(()=>{let e=R.current;!e||!p||Nt.current!==x&&(x&&Nt.current!==null?e.updateChatStatus(p,`open`).catch(()=>{}):Nt.current===!0&&e.updateChatStatus(p,`widget_closed`).catch(()=>{}),Nt.current=x)},[x,p]),(0,b.useEffect)(()=>{let e=()=>{let e=Ye.current,t=R.current;!e||!t||typeof navigator>`u`||t.beaconWidgetClosed?.(e)||t.updateChatStatus(e,`widget_closed`).catch(()=>{})};return window.addEventListener(`pagehide`,e),()=>window.removeEventListener(`pagehide`,e)},[]);let Pt=async()=>{if(!(!L?.callId||!R.current||!Je.current||!p)){Tt(),ct.current=L.callId,Et();try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});et.current=e;let t=[{urls:`stun:stun.l.google.com:19302`}];try{let e=await R.current.getIceServersConfig();e?.data?.iceServers?.length&&(t=e.data.iceServers)}catch(e){console.warn(`[FlowEngageProvider] ice-config fetch failed, using STUN default`,e)}let n=new RTCPeerConnection({iceServers:t});$e.current=n,n.onconnectionstatechange=()=>{let e=n.connectionState;if(e===`connected`){let e=new Date().toISOString();ze(`connected`),Ve(t=>t||e),kt(e);return}if(e===`connecting`){ze(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`closed`)&&Ot(`peer:connection_${e}`)},n.oniceconnectionstatechange=()=>{let e=n.iceConnectionState;if(e===`connected`||e===`completed`){let e=new Date().toISOString();ze(`connected`),Ve(t=>t||e),kt(e);return}if(e===`checking`||e===`new`){ze(e=>e===`connected`?e:`connecting`);return}(e===`failed`||e===`closed`)&&Ot(`peer:ice_${e}`)},n.onsignalingstatechange=()=>{},n.onicegatheringstatechange=()=>{},e.getTracks().forEach(t=>{n.addTrack(t,e)}),n.onicecandidate=e=>{if(!e.candidate||!Je.current?.connected)return;let t=e.candidate;Je.current.emit(`call:ice-candidate`,{callId:L.callId,candidate:t.candidate,sdpMid:t.sdpMid,sdpMLineIndex:t.sdpMLineIndex,chatId:p,from:`customer`})},n.ontrack=e=>{let[t]=e.streams||[],[n]=t?.getAudioTracks?.()||[];if(!tt.current){let e=document.createElement(`audio`);e.id=`flowengage-remote-audio`,e.autoplay=!0,e.playsInline=!0,e.onplay=()=>{},e.onpause=()=>{},e.onended=()=>{},e.onerror=e=>{},tt.current=e,document.body.appendChild(e)}tt.current.srcObject=e.streams[0];let r=L?.callId,i=r&&(ct.current===r||z.current===r);if(!ut.current&&i){let e=new Date().toISOString();ze(`connected`),Ve(t=>t||e),z.current=r,Le(r),kt(e)}tt.current.srcObject=t||null;let a=tt.current.play?.();a?.catch&&a.catch(e=>{})};let r=nt.current;r&&(console.log(`[FlowEngageProvider] found pending remote offer during accept`,{callId:r.callId||L.callId,chatId:p}),await Mt({...r,callId:r.callId||L.callId})),await R.current.acceptCall(L.callId,p),Je.current?.emit(`call:accepted`,{callId:L.callId,chatId:p}),z.current=L.callId,Le(L.callId),ze(e=>e===`connected`||ut.current?`connected`:`connecting`),Fe(null),C(!0)}catch(e){if(ct.current=null,Ot(`accept_call_failed`),e?.status===404||e?.status===409||e?.status===422){Ge(pi(e,`This visitor call is no longer available.`));return}if(e?.name===`NotAllowedError`||e?.name===`PermissionDeniedError`){try{await R.current.rejectCall(L.callId,p)}catch(e){console.error(`[FlowEngageProvider] failed to reject call after microphone denial`,e)}Ge(`Microphone access was denied. Please allow microphone access to accept the call.`);return}Ge(`We couldn't connect the call right now. Please try again.`)}}},Ft=async()=>{if(!L?.callId||!R.current||!p){Ot(`reject_call_without_server_context`);return}let e=L.callId;Et(),Tt(),Je.current?.emit(`call:rejected`,{callId:e,chatId:p,reason:`visitor_declined`});try{await R.current.rejectCall(e,p)}catch(e){Ge(pi(e,`We couldn't decline the call cleanly.`))}finally{Ot(`reject_call_finally`)}},It=(0,b.useRef)(Ft);It.current=Ft,(0,b.useEffect)(()=>{if(!L?.callId||Ie){Et();return}let e=L.callId;return Et(),lt.current=window.setTimeout(()=>{Qe.current?.callId===e&&ct.current!==e&&z.current!==e&&It.current()},O),()=>{lt.current&&=(window.clearTimeout(lt.current),null)}},[Ie,Et,L?.callId]);let Lt=async()=>{if(!Ie||!R.current||!p){Ot(`end_call_without_server_context`);return}Tt();try{await R.current.endWebRTCCall(Ie,p)}catch(e){Ge(pi(e,`The call ended locally, but the server could not be updated.`))}finally{Ot(`end_call_finally`)}},Rt=()=>{let e=et.current?.getAudioTracks?.()||[],t=$e.current?.getSenders?.().map(e=>e.track).filter(e=>e?.kind===`audio`)||[],n=[...e,...t].filter(Boolean);if(n.length===0)return;let r=!He;n.forEach(e=>{e.enabled=!r}),Ue(r)},zt=async(e={})=>{let t=e.notifyChatInitiated===!0;if(C(!0),!(!t||!R.current||!p||typeof window>`u`)){try{await R.current.trackVisitor({chatId:p,currentPagePath:window.location.pathname||`/`})}catch{}try{await R.current.updateChatStatus(p,`open`)}catch{}}},Bt=async e=>{let t=Dt(e);if(!t||!R.current||!Ye.current)return t;try{await R.current.trackVisitor({chatId:Ye.current,currentPagePath:typeof window<`u`&&window.location.pathname||`/`,email:t})}catch(e){console.error(`[FlowEngageProvider] failed to persist visitor email`,e)}return t},Vt=()=>{!p||!Je.current?.connected||dt.current||(dt.current=!0,Je.current.emit(`typing:start`,{chatId:p,sender:`user`}))},Ht=()=>{!p||!Je.current?.connected||!dt.current||(dt.current=!1,Je.current.emit(`typing:stop`,{chatId:p,sender:`user`}))},Ut=(e=``)=>{let t=typeof e==`string`?e:``;!p||!Je.current?.connected||t!==``&&ft.current===t||(ft.current=t,Je.current.emit(`typing:update`,{chatId:p,sender:`user`,text:t}))};function Wt(){if(typeof document>`u`)return null;try{let e=(document.querySelector(`main`)||document.querySelector(`[role='main']`)||document.querySelector(`article`)||document.querySelector(`#content`)||document.querySelector(`.content`)||document.body).cloneNode(!0);e.querySelectorAll(`nav, footer, header, aside, script, style, noscript, #flowengage-root, .flowengage-shell, .flowengage-widget-root, [id*='flowengage'], [class*='flowengage']`).forEach(e=>e.remove());let t=e.textContent.replace(/\s+/g,` `).trim();return t.length>0?t.substring(0,3e3):null}catch{return null}}let Gt=async(e,t=``,n=null,i={})=>{let a=typeof e==`string`?e.trim():``;if(!a||!R.current||!p||s!==`ready`||Ae)return;Ht(),it.current=!1;let o=/^\s*(yes|yeah|sure|ok|okay|go ahead|take me(?: there)?(?!\s+\w)|navigate(?!\s+(?:me\s+)?to\s+\w)|yep|absolutely|please do|do it|let'?s go|go there|show me(?!\s+(?:the|a|an)\s+\w)|go to it|bring me there|navigate me there)\b/i,c=/^\s*(?:yes|yeah|sure|ok|okay|yep|absolutely)\s+(?!(?:please|do\s+it|let'?s|that|this|there|it|thanks|go|cool|great|perfect|sounds|alright|proceed)\b)\w/i,l=/\b(take me|navigate|go to|show me|bring me|open|go there|navigate to|take me to|let'?s go to)\b/i;if(rt.current&&o.test(a)&&!c.test(a)){let{url:e,section:t}=rt.current;rt.current=null,it.current=!0,console.log(`[FWH Nav] Client-side nav firing →`,e),ot(e,{voiceActive:bt.current}).then(({navigated:e,reason:n})=>{if(!e){n===`not-found`?_():n===`already-on-page`&&y();return}!t||!bt.current||setTimeout(()=>{let e=dr(null,t);e&&fr(e)},300)})}else o.test(a)||(rt.current=null);let d=`pending-user-${Date.now()}`,f={id:d,sender:`user`,message:e,timestamp:new Date().toISOString(),isPending:!0,type:i?.type||`text`,metadata:i?.metadata||void 0,...n||{}};g(e=>[...e,f]);let m=E;if(m)try{m=Ct(await R.current.checkHumanHandled(p))}catch{}if(m&&Je.current?.connected){Je.current.emit(`customer:message`,{chatId:p,content:e,sender:`user`,email:ae||void 0,type:i?.type||`text`,metadata:i?.metadata||{},...n||{}});return}ve(!0);try{let o=await Br(),s=Rr(),c=`stream-preview-${Date.now().toString(36)}`,u=e=>{I(!1),g(t=>{let n=t.findIndex(e=>e.id===c);if(n===-1)return[...t,{id:c,sender:`bot`,message:e,timestamp:new Date().toISOString(),isStreaming:!0}];let r=[...t];return r[n]={...r[n],message:r[n].message+e},r})},d=await R.current.sendAiMessage(p,e,r,t,{...n||{},...ae?{email:ae}:{}},{...i,currentPageUrl:typeof window<`u`?window.location.href:void 0,currentPageTitle:typeof window<`u`?document.title:void 0,currentPagePath:typeof window<`u`?window.location.pathname:void 0,currentPageContent:Wt()||void 0,...o?{shopifyCart:o}:{},...s?{shopifyCustomerId:s}:{}},u),f=d.chat_history||[];if(console.log(`[FWH Nav Debug] API response fields:`,{has_navigate:!!d.navigate,navigate:d.navigate,has_pending_navigate:!!d.pending_navigate,pending_navigate:d.pending_navigate,last_bot_msg:[...f].reverse().find(e=>e.sender===`bot`)?.message?.substring(0,80)}),d.pending_navigate?.url){let e={url:d.pending_navigate.url,section:d.pending_navigate.section||null};l.test(a)?(console.log(`[FWH Nav] Auto-navigating (intent detected) →`,e.url),ot(e.url,{voiceActive:bt.current}).then(({navigated:t,reason:n})=>{if(!t){n===`not-found`?_():n===`already-on-page`&&y();return}e.section&&setTimeout(()=>{let t=dr(null,e.section);t&&fr(t)},300)})):(rt.current=e,console.log(`[FWH Nav] Stored pending nav →`,rt.current))}if(d.navigate?.url)if(it.current)it.current=!1;else{let{url:e,section:t}=d.navigate;ot(e,{voiceActive:bt.current}).then(({navigated:e,reason:n})=>{if(!e){n===`not-found`?_():n===`already-on-page`&&y();return}t&&setTimeout(()=>{let e=dr(null,t);e&&fr(e)},300)})}else if(d.highlight?.section){let e=d.highlight.section;setTimeout(()=>{let t=dr(null,e);t&&fr(t)},150)}else{let e=[...f].reverse().find(e=>e.sender===`bot`||e.sender===`assistant`);if(e?.message){let t=fi(e.message);t&&gr(t.url,{siteId:xt.current?.siteId,apiBaseUrl:xt.current?.apiBaseUrl}).then(({allowed:e,correctedUrl:n})=>{if(!e){_();return}ot(n||t.url,{voiceActive:bt.current}).then(({navigated:e,reason:n})=>{if(!e){n===`not-found`?_():n===`already-on-page`&&y();return}!t.section||!bt.current||setTimeout(()=>{let e=dr(null,t.section);e&&fr(e)},300)})})}}g(di(f)),Array.isArray(d.cart_actions)&&d.cart_actions.length&&v(d.cart_actions),k(!!d.is_human_handled),T(d.is_human_handled?`agent`:`ai`),I(!1),ve(!1),await R.current.updateChatStatus(p,`messageSent`)}catch(e){g(e=>e.filter(e=>e.id!==d&&!e.isStreaming)),I(!1),ve(!1),e.status===429?(be(!0),Ce(e.message),window.setTimeout(()=>{be(!1),Ce(``)},ee)):u(e)}},Kt=async e=>{if(!R.current||!e)throw Error(`Upload is unavailable right now.`);return R.current.uploadChatFile(e)},qt=async e=>{if(!(!R.current||!p)){try{let t=e?`voice`:`text`;await R.current.setChatMode(p,t)}catch{}Te(e),e&&(yt.current=!1)}},Jt=async e=>{if(yt.current)return;if(yt.current=!0,!R.current||!p||!e?.length){Te(!1);return}let t=()=>{let t=di(e);g(e=>{if(!e.length)return t;let n=e[e.length-1],r=t[0];return n&&r&&n.sender===r.sender&&n.message===r.message?e:[...e,...t]})};try{let n=await R.current.syncVoice(p,e);if(n?.chat_history?.length)g(di(n.chat_history));else if(n?.success)try{let e=await R.current.loadHistory(p,r);e?.chat_history?.length?g(di(e.chat_history)):t()}catch{t()}else t()}catch{t()}finally{Te(!1)}},Yt=async()=>{if(!(!R.current||!p)){we&&!yt.current&&vt.current.length>0&&await Jt(vt.current);try{await R.current.endConversation(p)}catch{try{await R.current.updateChatStatus(p,`ended`)}catch{}}je(!0),g(e=>[...e,{id:`conversation-ended-${Date.now()}`,sender:`system`,message:`This conversation has ended. Thank you for reaching out!`,timestamp:new Date().toISOString(),isPending:!1}])}};(0,b.useEffect)(()=>{if(Re!==`connected`||!Ie||!p||!Be||!wt)return;let e=new Date(Be).getTime(),t=Number.isFinite(e)?Date.now()-e:0,n=Math.max(0,wt*1e3-t),r=window.setTimeout(()=>{Ge(`The call ended because it reached the time limit.`),Lt()},n);return()=>window.clearTimeout(r)},[Ie,Be,Re,p,Lt,wt]),(0,b.useEffect)(()=>{let e=()=>{let e=Ye.current,t=R.current;if(!t||!e)return;if(bt.current&&vt.current.length>0&&xe(),!yt.current&&vt.current.length>0&&(t.beaconSyncVoice(e,vt.current)||t.syncVoice(e,vt.current).catch(()=>{}),yt.current=!0),z.current){t.beaconEndWebRTCCall(z.current,e);return}let n=ct.current||Qe.current?.callId;n&&t.beaconCustomerUnavailable(n,e)};return window.addEventListener(`pagehide`,e),window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`pagehide`,e),window.removeEventListener(`beforeunload`,e)}},[]);let Xt=(0,b.useCallback)(()=>{let e=i?.siteId;se(e),Xe.current=!0,Ze.current=null,Je.current?.disconnect(),g([]),m(``),Ye.current=``,je(!1),k(!1),ie(null),M(null),qe(!0),o(e=>e+1)},[i?.siteId]),Zt=(0,b.useCallback)(e=>{i?.siteId,Xe.current=!1,Ze.current=e,Je.current?.disconnect(),g([]),m(``),Ye.current=``,je(!1),k(!1),ie(null),M(null),qe(!0),o(e=>e+1)},[i?.siteId]),Qt=(0,b.useMemo)(()=>({status:s,error:l,runtimeConfig:d,resolvedConfig:i,chatId:p,chatHistory:h,isOpen:x,activeScreen:w,isHumanHandled:E,agentName:A,agentHeadshot:j,visitorEmail:ae,isAgentTyping:de,isAiTyping:me,connectionStatus:he,isLoading:_e,isVoiceMode:we,isRateLimited:ye,rateLimitMessage:Se,isConversationEnded:Ae,isSessionRestoring:Ke,openToChatCounter:Ee,voiceEndCounter:Oe,incomingCall:L,activeCallId:Ie,callConnectionState:Re,callConnectedAt:Be,isCallMuted:He,webRTCError:We,language:r,historyRef:vt,hasSyncedRef:yt,dismissCallError:Tt,captureVisitorEmail:Bt,startTyping:Vt,stopTyping:Ht,updateTypingDraft:Ut,notifyRouteChange:()=>St.current?.notifyRouteChange?.(),openWidget:zt,closeWidget:()=>C(!1),toggleWidget:()=>{if(x){C(!1);return}zt({notifyChatInitiated:!0})},sendMessage:Gt,uploadChatFile:Kt,setVoiceMode:qt,onMessageSync:Jt,endConversation:Yt,startNewChat:Xt,resumeChat:Zt,getVisitorChatHistory:()=>R.current?.getVisitorChatHistory?.(),getVisitorChatThread:e=>R.current?.getVisitorChatThread?.(e),acceptCall:Pt,rejectCall:Ft,endWebRTCCall:Lt,toggleCallMute:Rt}),[s,l,d,i,p,h,x,w,E,A,j,ae,de,me,he,_e,we,ye,Se,Ae,Ke,Ee,Oe,L,Ie,Re,Be,He,We,r,Bt,Vt,Ht,Ut,Pt,Ft,Lt,Rt,zt,Gt,Kt,qt,Jt,Yt,Xt,Tt]);return(0,V.jsx)(wn.Provider,{value:Qt,children:n})}var vi=(0,b.createContext)({});function yi(e){let t=(0,b.useRef)(null);return t.current===null&&(t.current=e()),t.current}var bi=typeof window<`u`?b.useLayoutEffect:b.useEffect,xi=(0,b.createContext)(null);function Si(e,t){e.indexOf(t)===-1&&e.push(t)}function Ci(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var wi=(e,t,n)=>n>t?t:n<e?e:n,Ti={},Ei=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Di(e){return typeof e==`object`&&!!e}var Oi=e=>/^0[^.\s]+$/u.test(e);function ki(e){let t;return()=>(t===void 0&&(t=e()),t)}var Ai=e=>e,ji=(e,t)=>n=>t(e(n)),H=(...e)=>e.reduce(ji),Mi=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Ni=class{constructor(){this.subscriptions=[]}add(e){return Si(this.subscriptions,e),()=>Ci(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Pi=e=>e*1e3,Fi=e=>e/1e3;function Ii(e,t){return t?1e3/t*e:0}var Li=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Ri=1e-7,zi=12;function Bi(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Li(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Ri&&++s<zi);return o}function Vi(e,t,n,r){if(e===t&&n===r)return Ai;let i=t=>Bi(t,0,1,e,n);return e=>e===0||e===1?e:Li(i(e),t,r)}var Hi=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ui=e=>t=>1-e(1-t),Wi=Vi(.33,1.53,.69,.99),Gi=Ui(Wi),Ki=Hi(Gi),qi=e=>e>=1?1:(e*=2)<1?.5*Gi(e):.5*(2-2**(-10*(e-1))),Ji=e=>1-Math.sin(Math.acos(e)),Yi=Ui(Ji),Xi=Hi(Ji),Zi=Vi(.42,0,1,1),Qi=Vi(0,0,.58,1),$i=Vi(.42,0,.58,1),ea=e=>Array.isArray(e)&&typeof e[0]!=`number`,ta=e=>Array.isArray(e)&&typeof e[0]==`number`,na={linear:Ai,easeIn:Zi,easeInOut:$i,easeOut:Qi,circIn:Ji,circInOut:Xi,circOut:Yi,backIn:Gi,backInOut:Ki,backOut:Wi,anticipate:qi},ra=e=>typeof e==`string`,ia=e=>{if(ta(e)){e.length;let[t,n,r,i]=e;return Vi(t,n,r,i)}else if(ra(e))return na[e],`${e}`,na[e];return e},aa=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],oa={value:null,addProjectionMetrics:null};function sa(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&oa.value&&oa.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var ca=40;function la(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=aa.reduce((e,n)=>(e[n]=sa(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Ti.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,ca),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:aa.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<aa.length;t++)o[aa[t]].cancel(e)},state:i,steps:o}}var{schedule:U,cancel:ua,state:da,steps:fa}=la(typeof requestAnimationFrame<`u`?requestAnimationFrame:Ai,!0),pa;function ma(){pa=void 0}var ha={now:()=>(pa===void 0&&ha.set(da.isProcessing||Ti.useManualTiming?da.timestamp:performance.now()),pa),set:e=>{pa=e,queueMicrotask(ma)}},ga={layout:0,mainThread:0,waapi:0},_a=e=>t=>typeof t==`string`&&t.startsWith(e),va=_a(`--`),ya=_a(`var(--`),ba=e=>ya(e)?xa.test(e.split(`/*`)[0].trim()):!1,xa=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Sa(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Ca={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},wa={...Ca,transform:e=>wi(0,1,e)},Ta={...Ca,default:1},Ea=e=>Math.round(e*1e5)/1e5,Da=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Oa(e){return e==null}var ka=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Aa=(e,t)=>n=>!!(typeof n==`string`&&ka.test(n)&&n.startsWith(e)||t&&!Oa(n)&&Object.prototype.hasOwnProperty.call(n,t)),ja=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Da);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Ma=e=>wi(0,255,e),Na={...Ca,transform:e=>Math.round(Ma(e))},Pa={test:Aa(`rgb`,`red`),parse:ja(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Na.transform(e)+`, `+Na.transform(t)+`, `+Na.transform(n)+`, `+Ea(wa.transform(r))+`)`};function Fa(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Ia={test:Aa(`#`),parse:Fa,transform:Pa.transform},La=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ra=La(`deg`),za=La(`%`),W=La(`px`),Ba=La(`vh`),Va=La(`vw`),Ha={...za,parse:e=>za.parse(e)/100,transform:e=>za.transform(e*100)},Ua={test:Aa(`hsl`,`hue`),parse:ja(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+za.transform(Ea(t))+`, `+za.transform(Ea(n))+`, `+Ea(wa.transform(r))+`)`},Wa={test:e=>Pa.test(e)||Ia.test(e)||Ua.test(e),parse:e=>Pa.test(e)?Pa.parse(e):Ua.test(e)?Ua.parse(e):Ia.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Pa.transform(e):Ua.transform(e),getAnimatableNone:e=>{let t=Wa.parse(e);return t.alpha=0,Wa.transform(t)}},Ga=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Ka(e){return isNaN(e)&&typeof e==`string`&&(e.match(Da)?.length||0)+(e.match(Ga)?.length||0)>0}var qa=`number`,Ja=`color`,Ya=`var`,Xa=`var(`,Za="${}",Qa=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function $a(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Qa,e=>(Wa.test(e)?(r.color.push(a),i.push(Ja),n.push(Wa.parse(e))):e.startsWith(Xa)?(r.var.push(a),i.push(Ya),n.push(e)):(r.number.push(a),i.push(qa),n.push(parseFloat(e))),++a,Za)).split(Za),indexes:r,types:i}}function eo(e){return $a(e).values}function to({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===qa?i+=Ea(r[a]):e===Ja?i+=Wa.transform(r[a]):i+=r[a]}return i}}function no(e){return to($a(e))}var ro=e=>typeof e==`number`?0:Wa.test(e)?Wa.getAnimatableNone(e):e,io=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:ro(e);function ao(e){let t=$a(e);return to(t)(t.values.map((e,n)=>io(e,t.split[n])))}var oo={test:Ka,parse:eo,createTransformer:no,getAnimatableNone:ao};function so(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function G({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=so(s,r,e+1/3),a=so(s,r,e),o=so(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function co(e,t){return n=>n>0?t:e}var K=(e,t,n)=>e+(t-e)*n,lo=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},uo=[Ia,Pa,Ua],fo=e=>uo.find(t=>t.test(e));function po(e){let t=fo(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Ua&&(n=G(n)),n}var mo=(e,t)=>{let n=po(e),r=po(t);if(!n||!r)return co(e,t);let i={...n};return e=>(i.red=lo(n.red,r.red,e),i.green=lo(n.green,r.green,e),i.blue=lo(n.blue,r.blue,e),i.alpha=K(n.alpha,r.alpha,e),Pa.transform(i))},ho=new Set([`none`,`hidden`]);function go(e,t){return ho.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function _o(e,t){return n=>K(e,t,n)}function vo(e){return typeof e==`number`?_o:typeof e==`string`?ba(e)?co:Wa.test(e)?mo:So:Array.isArray(e)?yo:typeof e==`object`?Wa.test(e)?mo:bo:co}function yo(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>vo(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function bo(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=vo(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function xo(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var So=(e,t)=>{let n=oo.createTransformer(t),r=$a(e),i=$a(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?ho.has(e)&&!i.values.length||ho.has(t)&&!r.values.length?go(e,t):H(yo(xo(r,i),i.values),n):(`${e}${t}`,co(e,t))};function Co(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?K(e,t,n):vo(e)(e,t)}var wo=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>U.update(t,e),stop:()=>ua(t),now:()=>da.isProcessing?da.timestamp:ha.now()}},To=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Eo=2e4;function Do(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function Oo(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Do(r),Eo);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Fi(i)}}var ko={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Ao(e,t){return e*Math.sqrt(1-t*t)}var jo=12;function Mo(e,t,n){let r=n;for(let n=1;n<jo;n++)r-=e(r)/t(r);return r}var No=.001;function Po({duration:e=ko.duration,bounce:t=ko.bounce,velocity:n=ko.velocity,mass:r=ko.mass}){let i,a;ko.maxDuration;let o=1-t;o=wi(ko.minDamping,ko.maxDamping,o),e=wi(ko.minDuration,ko.maxDuration,Fi(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Ao(t,o),c=Math.exp(-i);return No-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Ao(t**2,o);return(-i(t)+No>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-No+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=Mo(i,a,s);if(e=Pi(e),isNaN(c))return{stiffness:ko.stiffness,damping:ko.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Fo=[`duration`,`bounce`],Io=[`stiffness`,`damping`,`mass`];function Lo(e,t){return t.some(t=>e[t]!==void 0)}function Ro(e){let t={velocity:ko.velocity,stiffness:ko.stiffness,damping:ko.damping,mass:ko.mass,isResolvedFromDuration:!1,...e};if(!Lo(e,Io)&&Lo(e,Fo))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*wi(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:ko.mass,stiffness:i,damping:a}}else{let n=Po({...e,velocity:0});t={...t,...n,mass:ko.mass},t.isResolvedFromDuration=!0}return t}function zo(e=ko.visualDuration,t=ko.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Ro({...n,velocity:-Fi(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Fi(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?ko.restSpeed.granular:ko.restSpeed.default,i||=v?ko.restDelta.granular:ko.restDelta.default;let y,b,x,S,C,w;if(h<1)x=Ao(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>Pi(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=Pi(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=Pi(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Do(T),Eo),t=To(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}zo.applyToOptions=e=>{let t=Oo(e,100,zo);return e.ease=t.ease,e.duration=Pi(t.duration),e.type=`keyframes`,e};var Bo=5;function Vo(e,t,n){let r=Math.max(t-Bo,0);return Ii(n-e(r),t-r)}function Ho({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=zo({keyframes:[f.value,m(f.value)],velocity:Vo(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function Uo(e,t,n){let r=[],i=n||Ti.mix||Co,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=H(Array.isArray(t)?t[n]||Ai:t,a)),r.push(a)}return r}function Wo(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=Uo(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Mi(e[r],e[r+1],n);return s[r](i)};return n?t=>l(wi(e[0],e[a-1],t)):l}function Go(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Mi(0,t,r);e.push(K(n,1,i))}}function Ko(e){let t=[0];return Go(t,e.length-1),t}function qo(e,t){return e.map(e=>e*t)}function Jo(e,t){return e.map(()=>t||$i).splice(0,e.length-1)}function Yo({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ea(r)?r.map(ia):ia(r),a={done:!1,value:t[0]},o=Wo(qo(n&&n.length===t.length?n:Ko(t),e),t,{ease:Array.isArray(i)?i:Jo(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Xo=e=>e!==null;function Zo(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Xo),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Qo={decay:Ho,inertia:Ho,tween:Yo,keyframes:Yo,spring:zo};function $o(e){typeof e.type==`string`&&(e.type=Qo[e.type])}var es=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},ts=e=>e/100,ns=class extends es{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==ha.now()&&this.tick(ha.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},ga.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;$o(e);let{type:t=Yo,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Yo;s!==Yo&&typeof o[0]!=`number`&&(this.mixKeyframes=H(ts,Co(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Do(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=wi(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Ho&&(b.value=Zo(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Fi(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Fi(e)}get time(){return Fi(this.currentTime)}set time(e){e=Pi(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return Vo(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(ha.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Fi(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=wo,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(ha.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,ga.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function rs(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var is=e=>e*180/Math.PI,as=e=>ss(is(Math.atan2(e[1],e[0]))),os={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:as,rotateZ:as,skewX:e=>is(Math.atan(e[1])),skewY:e=>is(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},ss=e=>(e%=360,e<0&&(e+=360),e),cs=as,ls=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),us=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),ds={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ls,scaleY:us,scale:e=>(ls(e)+us(e))/2,rotateX:e=>ss(is(Math.atan2(e[6],e[5]))),rotateY:e=>ss(is(Math.atan2(-e[2],e[0]))),rotateZ:cs,rotate:cs,skewX:e=>is(Math.atan(e[4])),skewY:e=>is(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function fs(e){return e.includes(`scale`)?1:0}function ps(e,t){if(!e||e===`none`)return fs(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=ds,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=os,i=t}if(!i)return fs(t);let a=r[t],o=i[1].split(`,`).map(hs);return typeof a==`function`?a(o):o[a]}var ms=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return ps(n,t)};function hs(e){return parseFloat(e.trim())}var gs=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],_s=new Set(gs),vs=e=>e===Ca||e===W,ys=new Set([`x`,`y`,`z`]),bs=gs.filter(e=>!ys.has(e));function xs(e){let t=[];return bs.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t}var Ss={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>ps(t,`x`),y:(e,{transform:t})=>ps(t,`y`)};Ss.translateX=Ss.x,Ss.translateY=Ss.y;var Cs=new Set,ws=!1,Ts=!1,Es=!1;function Ds(){if(Ts){let e=Array.from(Cs).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=xs(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Ts=!1,ws=!1,Cs.forEach(e=>e.complete(Es)),Cs.clear()}function Os(){Cs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ts=!0)})}function ks(){Es=!0,Os(),Ds(),Es=!1}var As=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Cs.add(this),ws||(ws=!0,U.read(Os),U.resolveKeyframes(Ds))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}rs(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Cs.delete(this)}cancel(){this.state===`scheduled`&&(Cs.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},js=e=>e.startsWith(`--`);function Ms(e,t,n){js(t)?e.style.setProperty(t,n):e.style[t]=n}var Ns={};function Ps(e,t){let n=ki(e);return()=>Ns[t]??n()}var Fs=Ps(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Is=Ps(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Ls=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Rs={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Ls([0,.65,.55,1]),circOut:Ls([.55,0,1,.45]),backIn:Ls([.31,.01,.66,-.59]),backOut:Ls([.33,1.53,.69,.99])};function zs(e,t){if(e)return typeof e==`function`?Is()?To(e,t):`ease-out`:ta(e)?Ls(e):Array.isArray(e)?e.map(e=>zs(e,t)||Rs.easeOut):Rs[e]}function Bs(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=zs(s,i);Array.isArray(d)&&(u.easing=d),oa.value&&ga.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return oa.value&&p.finished.finally(()=>{ga.waapi--}),p}function Vs(e){return typeof e==`function`&&`applyToOptions`in e}function Hs({type:e,...t}){return Vs(e)&&Is()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Us=class extends es{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Hs(e);this.animation=Bs(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Zo(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),Ms(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Fi(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Fi(e)}get time(){return Fi(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Pi(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Fs()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Ai):r(this)}},Ws={anticipate:qi,backInOut:Ki,circInOut:Xi};function Gs(e){return e in Ws}function Ks(e){typeof e.ease==`string`&&Gs(e.ease)&&(e.ease=Ws[e.ease])}var qs=10,Js=class extends Us{constructor(e){Ks(e),$o(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new ns({...a,autoplay:!1}),s=Math.max(qs,ha.now()-this.startTime),c=wi(0,qs,s-qs),l=o.sample(s).value,{name:u}=this.options;i&&u&&Ms(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},Ys=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(oo.test(e)||e===`0`)&&!e.startsWith(`url(`));function Xs(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Zs(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=Ys(i,t),s=Ys(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:Xs(e)||(n===`spring`||Vs(n))&&r}function Qs(e){e.duration=0,e.type=`keyframes`}var $s=new Set([`opacity`,`clipPath`,`filter`,`transform`]),ec=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function tc(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&ec.test(e[t]))return!0;return!1}var nc=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),rc=ki(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function ic(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return rc()&&n&&($s.has(n)||nc.has(n)&&tc(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var ac=40,oc=class extends es{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=ha.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||As)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=ha.now();let u=!0;Zs(e,i,a,o)||(u=!1,(Ti.instantAnimations||!s)&&l?.(Zo(e,n,t)),e[0]=e[e.length-1],Qs(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>ac?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&ic(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new Js({...d,element:p})}catch{m=new ns(d)}else m=new ns(d);m.finished.then(()=>{this.notifyFinished()}).catch(Ai),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),ks()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function sc(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var cc=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function lc(e){let t=cc.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function uc(e,t,n=1){`${e}`;let[r,i]=lc(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Ei(e)?parseFloat(e):e}return ba(i)?uc(i,t,n+1):i}var dc={type:`spring`,stiffness:500,damping:25,restSpeed:10},fc=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),pc={type:`keyframes`,duration:.8},mc={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},hc=(e,{keyframes:t})=>t.length>2?pc:_s.has(e)?e.startsWith(`scale`)?fc(t[1]):dc:mc;function gc(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function _c(e,t){let n=e?.[t]??e?.default??e;return n===e?n:gc(n,e)}var vc=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function yc(e){for(let t in e)if(!vc.has(t))return!0;return!1}var bc=(e,t,n,r={},i,a)=>o=>{let s=_c(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Pi(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};yc(s)||Object.assign(u,hc(e,u)),u.duration&&=Pi(u.duration),u.repeatDelay&&=Pi(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Qs(u),u.delay===0&&(d=!0)),(Ti.instantAnimations||Ti.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,Qs(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Zo(u.keyframes,s);if(e!==void 0){U.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new ns(u):new oc(u)};function xc(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Sc(e,t,n,r){if(typeof t==`function`){let[i,a]=xc(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=xc(r);t=t(n===void 0?e.custom:n,i,a)}return t}function Cc(e,t,n){let r=e.getProps();return Sc(r,t,n===void 0?r.custom:n,e)}var wc=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...gs]),Tc=30,Ec=e=>!isNaN(parseFloat(e)),Dc={current:void 0},Oc=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=ha.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=ha.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Ec(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Ni);let n=this.events[e].add(t);return e===`change`?()=>{n(),U.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Dc.current&&Dc.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=ha.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Tc)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Tc);return Ii(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function kc(e,t){return new Oc(e,t)}var Ac=e=>Array.isArray(e);function jc(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,kc(n))}function Mc(e){return Ac(e)?e[e.length-1]||0:e}function Nc(e,t){let{transitionEnd:n={},transition:r={},...i}=Cc(e,t)||{};i={...i,...n};for(let t in i)jc(e,t,Mc(i[t]))}var Pc=e=>!!(e&&e.getVelocity);function Fc(e){return!!(Pc(e)&&e.add)}function Ic(e,t){let n=e.getValue(`willChange`);if(Fc(n))return n.add(t);if(!n&&Ti.WillChange){let n=new Ti.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function Lc(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Rc=`data-`+Lc(`framerAppearId`);function zc(e){return e.props[Rc]}function Bc({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Vc(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?gc(a,c):c;let l=a?.reduceMotion;r&&(a=r);let u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||d&&Bc(d,t))continue;let o={delay:n,..._c(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){U.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=zc(e);if(n){let e=window.MotionHandoffAnimation(n,t,U);e!==null&&(o.startTime=e,f=!0)}}Ic(e,t);let p=l??e.shouldReduceMotion;r.start(bc(t,r,i,p&&wc.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>U.update(()=>{o&&Nc(e,o)});u.length?Promise.all(u).then(t):t()}return u}function Hc(e,t,n={}){let r=Cc(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Vc(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Uc(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function Uc(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(Hc(c,t,{...o,delay:n+(typeof r==`function`?0:r)+sc(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Wc(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Hc(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Hc(e,t,n);else{let i=typeof t==`function`?Cc(e,t,n.custom):t;r=Promise.all(Vc(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var Gc={test:e=>e===`auto`,parse:e=>e},Kc=e=>t=>t.test(e),qc=[Ca,W,za,Ra,Va,Ba,Gc],Jc=e=>qc.find(Kc(e));function Yc(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Oi(e)}var Xc=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Zc(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Da)||[];if(!r)return e;let i=n.replace(r,``),a=Xc.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var Qc=/\b([a-z-]*)\(.*?\)/gu,$c={...oo,getAnimatableNone:e=>{let t=e.match(Qc);return t?t.map(Zc).join(` `):e}},el={...oo,getAnimatableNone:e=>{let t=oo.parse(e);return oo.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},tl={...Ca,transform:Math.round},nl={borderWidth:W,borderTopWidth:W,borderRightWidth:W,borderBottomWidth:W,borderLeftWidth:W,borderRadius:W,borderTopLeftRadius:W,borderTopRightRadius:W,borderBottomRightRadius:W,borderBottomLeftRadius:W,width:W,maxWidth:W,height:W,maxHeight:W,top:W,right:W,bottom:W,left:W,inset:W,insetBlock:W,insetBlockStart:W,insetBlockEnd:W,insetInline:W,insetInlineStart:W,insetInlineEnd:W,padding:W,paddingTop:W,paddingRight:W,paddingBottom:W,paddingLeft:W,paddingBlock:W,paddingBlockStart:W,paddingBlockEnd:W,paddingInline:W,paddingInlineStart:W,paddingInlineEnd:W,margin:W,marginTop:W,marginRight:W,marginBottom:W,marginLeft:W,marginBlock:W,marginBlockStart:W,marginBlockEnd:W,marginInline:W,marginInlineStart:W,marginInlineEnd:W,fontSize:W,backgroundPositionX:W,backgroundPositionY:W,rotate:Ra,rotateX:Ra,rotateY:Ra,rotateZ:Ra,scale:Ta,scaleX:Ta,scaleY:Ta,scaleZ:Ta,skew:Ra,skewX:Ra,skewY:Ra,distance:W,translateX:W,translateY:W,translateZ:W,x:W,y:W,z:W,perspective:W,transformPerspective:W,opacity:wa,originX:Ha,originY:Ha,originZ:W,zIndex:tl,fillOpacity:wa,strokeOpacity:wa,numOctaves:tl},rl={...nl,color:Wa,backgroundColor:Wa,outlineColor:Wa,fill:Wa,stroke:Wa,borderColor:Wa,borderTopColor:Wa,borderRightColor:Wa,borderBottomColor:Wa,borderLeftColor:Wa,filter:$c,WebkitFilter:$c,mask:el,WebkitMask:el},il=e=>rl[e],al=new Set([$c,el]);function ol(e,t){let n=il(e);return al.has(n)||(n=oo),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var sl=new Set([`auto`,`none`,`0`]);function cl(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!sl.has(t)&&$a(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=ol(n,i)}var ll=class extends As{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),ba(r))){let i=uc(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!wc.has(n)||e.length!==2)return;let[r,i]=e,a=Jc(r),o=Jc(i);if(Sa(r)!==Sa(i)&&Ss[n]){this.needsMeasurement=!0;return}if(a!==o)if(vs(a)&&vs(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else Ss[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Yc(e[t]))&&n.push(t);n.length&&cl(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ss[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=Ss[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function ul(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var dl=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function fl(e){return Di(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:pl,cancel:ml}=la(queueMicrotask,!1),hl={x:!1,y:!1};function gl(){return hl.x||hl.y}function _l(e){return e===`x`||e===`y`?hl[e]?null:(hl[e]=!0,()=>{hl[e]=!1}):hl.x||hl.y?null:(hl.x=hl.y=!0,()=>{hl.x=hl.y=!1})}function vl(e,t){let n=ul(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function yl(e){return!(e.pointerType===`touch`||gl())}function bl(e,t,n={}){let[r,i,a]=vl(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!yl(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var xl=(e,t)=>t?e===t?!0:xl(e,t.parentElement):!1,Sl=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Cl=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function wl(e){return Cl.has(e.tagName)||e.isContentEditable===!0}var Tl=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function El(e){return Tl.has(e.tagName)||e.isContentEditable===!0}var Dl=new WeakSet;function Ol(e){return t=>{t.key===`Enter`&&e(t)}}function kl(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Al=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Ol(()=>{if(Dl.has(n))return;kl(n,`down`);let e=Ol(()=>{kl(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>kl(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function jl(e){return Sl(e)&&!gl()}var Ml=new WeakSet;function Nl(e,t,n={}){let[r,i,a]=vl(e,n),o=e=>{let r=e.currentTarget;if(!jl(e)||Ml.has(e))return;Dl.add(r),n.stopPropagation&&Ml.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Dl.has(r)&&Dl.delete(r),jl(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||xl(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),fl(e)&&(e.addEventListener(`focus`,e=>Al(e,i)),!wl(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Pl(e){return Di(e)&&`ownerSVGElement`in e}var Fl=new WeakMap,Il,Ll=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:Pl(r)&&`getBBox`in r?r.getBBox()[t]:r[n],q=Ll(`inline`,`width`,`offsetWidth`),Rl=Ll(`block`,`height`,`offsetHeight`);function J({target:e,borderBoxSize:t}){Fl.get(e)?.forEach(n=>{n(e,{get width(){return q(e,t)},get height(){return Rl(e,t)}})})}function Y(e){e.forEach(J)}function zl(){typeof ResizeObserver>`u`||(Il=new ResizeObserver(Y))}function Bl(e,t){Il||zl();let n=ul(e);return n.forEach(e=>{let n=Fl.get(e);n||(n=new Set,Fl.set(e,n)),n.add(t),Il?.observe(e)}),()=>{n.forEach(e=>{let n=Fl.get(e);n?.delete(t),n?.size||Il?.unobserve(e)})}}var Vl=new Set,Hl;function Ul(){Hl=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Vl.forEach(t=>t(e))},window.addEventListener(`resize`,Hl)}function Wl(e){return Vl.add(e),Hl||Ul(),()=>{Vl.delete(e),!Vl.size&&typeof Hl==`function`&&(window.removeEventListener(`resize`,Hl),Hl=void 0)}}function Gl(e,t){return typeof e==`function`?Wl(e):Bl(e,t)}function Kl(e){return Pl(e)&&e.tagName===`svg`}var ql=[...qc,Wa,oo],Jl=e=>ql.find(Kc(e)),Yl=()=>({translate:0,scale:1,origin:0,originPoint:0}),Xl=()=>({x:Yl(),y:Yl()}),Zl=()=>({min:0,max:0}),X=()=>({x:Zl(),y:Zl()}),Ql=new WeakMap;function $l(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function eu(e){return typeof e==`string`||Array.isArray(e)}var tu=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],nu=[`initial`,...tu];function ru(e){return $l(e.animate)||nu.some(t=>eu(e[t]))}function iu(e){return!!(ru(e)||e.variants)}function au(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Pc(i))e.addValue(r,i);else if(Pc(a))e.addValue(r,kc(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,kc(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var ou={current:null},su={current:!1},cu=typeof window<`u`;function lu(){if(su.current=!0,cu)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>ou.current=e.matches;e.addEventListener(`change`,t),t()}else ou.current=!1}var uu=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],du={};function fu(e){du=e}function pu(){return du}var mu=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=As,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=ha.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,U.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=ru(t),this.isVariantNode=iu(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&Pc(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,Ql.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(su.current||lu(),this.shouldReduceMotion=ou.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),ua(this.notifyUpdate),ua(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&$s.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Us({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Pi(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=_s.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&U.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in du){let t=du[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):X()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<uu.length;t++){let n=uu[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=au(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=kc(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(Ei(n)||Oi(n))?n=parseFloat(n):!Jl(n)&&oo.test(t)&&(n=ol(e,t)),this.setBaseTarget(e,Pc(n)?n.get():n)),Pc(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=Sc(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Pc(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new Ni),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){pl.render(this.render)}},hu=class extends mu{constructor(){super(...arguments),this.KeyframeResolver=ll}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;Pc(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},gu=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function _u({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function vu({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function yu(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function bu(e){return e===void 0||e===1}function xu({scale:e,scaleX:t,scaleY:n}){return!bu(e)||!bu(t)||!bu(n)}function Su(e){return xu(e)||Cu(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Cu(e){return wu(e.x)||wu(e.y)}function wu(e){return e&&e!==`0%`}function Tu(e,t,n){return n+t*(e-n)}function Eu(e,t,n,r,i){return i!==void 0&&(e=Tu(e,i,r)),Tu(e,n,r)+t}function Du(e,t=0,n=1,r,i){e.min=Eu(e.min,t,n,r,i),e.max=Eu(e.max,t,n,r,i)}function Ou(e,{x:t,y:n}){Du(e.x,t.translate,t.scale,t.originPoint),Du(e.y,n.translate,n.scale,n.originPoint)}var ku=.999999999999,Au=1.0000000000001;function ju(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(Mu(e.x,-a.scroll.offset.x),Mu(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Ou(e,o)),r&&Su(a.latestValues)&&Fu(e,a.latestValues,a.layout?.layoutBox))}t.x<Au&&t.x>ku&&(t.x=1),t.y<Au&&t.y>ku&&(t.y=1)}function Mu(e,t){e.min+=t,e.max+=t}function Nu(e,t,n,r,i=.5){Du(e,t,n,K(e.min,e.max,i),r)}function Pu(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Fu(e,t,n){let r=n??e;Nu(e.x,Pu(t.x,r.x),t.scaleX,t.scale,t.originX),Nu(e.y,Pu(t.y,r.y),t.scaleY,t.scale,t.originY)}function Iu(e,t){return _u(yu(e.getBoundingClientRect(),t))}function Lu(e,t,n){let r=Iu(e,n),{scroll:i}=t;return i&&(Mu(r.x,i.offset.x),Mu(r.y,i.offset.y)),r}var Ru={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},zu=gs.length;function Bu(e,t,n){let r=``,i=!0;for(let a=0;a<zu;a++){let o=gs[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===(o.startsWith(`scale`)?1:0);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=dl(s,nl[o]);if(!c){i=!1;let t=Ru[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Vu(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(_s.has(e)){o=!0;continue}else if(va(e)){i[e]=n;continue}else{let t=dl(n,nl[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Bu(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function Hu(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Uu(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Wu={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(W.test(e))e=parseFloat(e);else return e;return`${Uu(e,t.target.x)}% ${Uu(e,t.target.y)}%`}},Gu={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=oo.parse(e);if(i.length>5)return r;let a=oo.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=K(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Ku={borderRadius:{...Wu,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:Wu,borderTopRightRadius:Wu,borderBottomLeftRadius:Wu,borderBottomRightRadius:Wu,boxShadow:Gu};function qu(e,{layout:t,layoutId:n}){return _s.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Ku[e]||e===`opacity`)}function Ju(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Pc(r[t])||i&&Pc(i[t])||qu(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Yu(e){return window.getComputedStyle(e)}var Xu=class extends hu{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Hu}readValueFromInstance(e,t){if(_s.has(t))return this.projection?.isProjecting?fs(t):ms(e,t);{let n=Yu(e),r=(va(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Iu(e,t)}build(e,t,n){Vu(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Ju(e,t,n)}},Zu={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Qu={offset:`strokeDashoffset`,array:`strokeDasharray`};function $u(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Zu:Qu;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var ed=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function td(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Vu(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of ed)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&$u(d,i,a,o,!1)}var nd=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),rd=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function id(e,t,n,r){Hu(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(nd.has(n)?n:Lc(n),t.attrs[n])}function ad(e,t,n){let r=Ju(e,t,n);for(let n in e)if(Pc(e[n])||Pc(t[n])){let t=gs.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var od=class extends hu{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=X}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(_s.has(t)){let e=il(t);return e&&e.default||0}return t=nd.has(t)?t:Lc(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return ad(e,t,n)}build(e,t,n){td(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){id(e,t,n,r)}mount(e){this.isSVGTag=rd(e.tagName),super.mount(e)}},sd=nu.length;function cd(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&cd(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<sd;n++){let r=nu[n],i=e.props[r];(eu(i)||i===!1)&&(t[r]=i)}return t}function ld(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var ud=[...tu].reverse(),dd=tu.length;function fd(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Wc(e,t,n)))}function pd(e){let t=fd(e),n=gd(),r=!0,i=!1,a=t=>(n,r)=>{let i=Cc(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=cd(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<dd;t++){let p=ud[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=eu(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||$l(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=md(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=Ac(t)&&Ac(n)?!ld(t,n):t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let ee=v&&y;b&&(!ee||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!ee&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Cc(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=sc(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=Cc(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=gd(),i=!0}}}function md(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!ld(t,e):!1}function hd(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function gd(){return{animate:hd(!0),whileInView:hd(),whileHover:hd(),whileTap:hd(),whileDrag:hd(),whileFocus:hd(),exit:hd()}}function _d(e,t){e.min=t.min,e.max=t.max}function vd(e,t){_d(e.x,t.x),_d(e.y,t.y)}function yd(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var bd=1e-4,Z=1-bd,xd=1+bd,Sd=.01,Cd=0-Sd,wd=0+Sd;function Td(e){return e.max-e.min}function Ed(e,t,n){return Math.abs(e-t)<=n}function Dd(e,t,n,r=.5){e.origin=r,e.originPoint=K(t.min,t.max,e.origin),e.scale=Td(n)/Td(t),e.translate=K(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Z&&e.scale<=xd||isNaN(e.scale))&&(e.scale=1),(e.translate>=Cd&&e.translate<=wd||isNaN(e.translate))&&(e.translate=0)}function Od(e,t,n,r){Dd(e.x,t.x,n.x,r?r.originX:void 0),Dd(e.y,t.y,n.y,r?r.originY:void 0)}function kd(e,t,n,r=0){e.min=(r?K(n.min,n.max,r):n.min)+t.min,e.max=e.min+Td(t)}function Ad(e,t,n,r){kd(e.x,t.x,n.x,r?.x),kd(e.y,t.y,n.y,r?.y)}function jd(e,t,n,r=0){let i=r?K(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Td(t)}function Md(e,t,n,r){jd(e.x,t.x,n.x,r?.x),jd(e.y,t.y,n.y,r?.y)}function Nd(e,t,n,r,i){return e-=t,e=Tu(e,1/n,r),i!==void 0&&(e=Tu(e,1/i,r)),e}function Pd(e,t=0,n=1,r=.5,i,a=e,o=e){if(za.test(t)&&(t=parseFloat(t),t=K(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=K(a.min,a.max,r);e===a&&(s-=t),e.min=Nd(e.min,t,n,s,i),e.max=Nd(e.max,t,n,s,i)}function Fd(e,t,[n,r,i],a,o){Pd(e,t[n],t[r],t[i],t.scale,a,o)}var Id=[`x`,`scaleX`,`originX`],Ld=[`y`,`scaleY`,`originY`];function Rd(e,t,n,r){Fd(e.x,t,Id,n?n.x:void 0,r?r.x:void 0),Fd(e.y,t,Ld,n?n.y:void 0,r?r.y:void 0)}function zd(e){return e.translate===0&&e.scale===1}function Bd(e){return zd(e.x)&&zd(e.y)}function Vd(e,t){return e.min===t.min&&e.max===t.max}function Hd(e,t){return Vd(e.x,t.x)&&Vd(e.y,t.y)}function Ud(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Wd(e,t){return Ud(e.x,t.x)&&Ud(e.y,t.y)}function Gd(e){return Td(e.x)/Td(e.y)}function Kd(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function qd(e){return[e(`x`),e(`y`)]}function Jd(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Yd=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],Xd=Yd.length,Zd=e=>typeof e==`string`?parseFloat(e):e,Qd=e=>typeof e==`number`||W.test(e);function $d(e,t,n,r,i,a){i?(e.opacity=K(0,n.opacity??1,tf(r)),e.opacityExit=K(t.opacity??1,0,nf(r))):a&&(e.opacity=K(t.opacity??1,n.opacity??1,r));for(let i=0;i<Xd;i++){let a=Yd[i],o=ef(t,a),s=ef(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Qd(o)===Qd(s)?(e[a]=Math.max(K(Zd(o),Zd(s),r),0),(za.test(s)||za.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=K(t.rotate||0,n.rotate||0,r))}function ef(e,t){return e[t]===void 0?e.borderRadius:e[t]}var tf=rf(0,.5,Yi),nf=rf(.5,.95,Ai);function rf(e,t,n){return r=>r<e?0:r>t?1:n(Mi(e,t,r))}function af(e,t,n){let r=Pc(e)?e:kc(e);return r.start(bc(``,r,t,n)),r.animation}function of(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var sf=(e,t)=>e.depth-t.depth,cf=class{constructor(){this.children=[],this.isDirty=!1}add(e){Si(this.children,e),this.isDirty=!0}remove(e){Ci(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(sf),this.isDirty=!1,this.children.forEach(e)}};function lf(e,t){let n=ha.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(ua(r),e(a-t))};return U.setup(r,!0),()=>ua(r)}function uf(e){return Pc(e)?e.get():e}var df=class{constructor(){this.members=[]}add(e){Si(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Ci(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Ci(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},ff={hasAnimatedSinceResize:!0,hasEverUpdated:!1},pf={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},mf=[``,`X`,`Y`,`Z`],hf=1e3,gf=0;function _f(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function vf(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=zc(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,U,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&vf(r)}function yf({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=gf++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,oa.value&&(pf.nodes=pf.calculatedTargetDeltas=pf.calculatedProjections=0),this.nodes.forEach(Sf),this.nodes.forEach(jf),this.nodes.forEach(Mf),this.nodes.forEach(Cf),oa.addProjectionMetrics&&oa.addProjectionMetrics(pf)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new cf)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Ni),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=Pl(t)&&!Kl(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;U.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=lf(i,250),ff.hasAnimatedSinceResize&&(ff.hasAnimatedSinceResize=!1,this.nodes.forEach(Af)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||zf,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Wd(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={..._c(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||Af(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ua(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Nf),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&vf(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(Ef),this.nodes.forEach(Tf);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Df);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Of),this.nodes.forEach(kf),this.nodes.forEach(bf),this.nodes.forEach(xf)):this.nodes.forEach(Df),this.clearAllSnapshots();let e=ha.now();da.delta=wi(0,1e3/60,e-da.timestamp),da.timestamp=e,da.isProcessing=!0,fa.update.process(da),fa.preRender.process(da),fa.render.process(da),da.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,pl.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(wf),this.sharedNodes.forEach(Pf)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,U.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){U.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Td(this.snapshot.measuredBox.x)&&!Td(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=X(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!Bd(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||Su(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),Uf(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return X();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Gf))){let{scroll:e}=this.root;e&&(Mu(t.x,e.offset.x),Mu(t.y,e.offset.y))}return t}removeElementScroll(e){let t=X();if(vd(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&vd(t,e),Mu(t.x,i.offset.x),Mu(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||X();vd(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(Mu(r.x,-n.scroll.offset.x),Mu(r.y,-n.scroll.offset.y)),Su(n.latestValues)&&Fu(r,n.latestValues,n.layout?.layoutBox)}return Su(this.latestValues)&&Fu(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=X();vd(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!Su(n.latestValues))continue;let r;n.instance&&(xu(n.latestValues)&&n.updateSnapshot(),r=X(),vd(r,n.measurePageBox())),Rd(t,n.latestValues,n.snapshot?.layoutBox,r)}return Su(this.latestValues)&&Rd(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==da.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=da.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=X(),this.targetWithTransforms=X()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Ad(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):vd(this.target,this.layout.layoutBox),Ou(this.target,this.targetDelta)):vd(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),oa.value&&pf.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||xu(this.parent.latestValues)||Cu(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=X(),this.relativeTargetOrigin=X(),Md(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),vd(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===da.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;vd(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;ju(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=X());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(yd(this.prevProjectionDelta.x,this.projectionDelta.x),yd(this.prevProjectionDelta.y,this.projectionDelta.y)),Od(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Kd(this.projectionDelta.x,this.prevProjectionDelta.x)||!Kd(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),oa.value&&pf.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Xl(),this.projectionDelta=Xl(),this.projectionDeltaWithTransform=Xl()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=Xl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=X(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(Rf));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;Ff(a.x,e.x,n),Ff(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Md(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Lf(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&Hd(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=X(),vd(d,this.relativeTarget)),s&&(this.animationValues=i,$d(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(ua(this.pendingAnimation),void 0),this.pendingAnimation=U.update(()=>{ff.hasAnimatedSinceResize=!0,ga.layout++,this.motionValue||=kc(0),this.motionValue.jump(0,!1),this.currentAnimation=af(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{ga.layout--},onComplete:()=>{ga.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(hf),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&Wf(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||X();let t=Td(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Td(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}vd(t,n),Fu(t,i),Od(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new df),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&_f(`z`,e,r,this.animationValues);for(let t=0;t<mf.length;t++)_f(`rotate${mf[t]}`,e,r,this.animationValues),_f(`skew${mf[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=uf(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=uf(t?.pointerEvents)||``),this.hasProjected&&!Su(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Jd(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Ku){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Ku[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?uf(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(Tf),this.root.sharedNodes.clear()}}}function bf(e){e.updateLayout()}function xf(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)qd(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Td(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;_d(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else Wf(i,t.layoutBox,n)&&qd(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Td(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Xl();Od(o,n,t.layoutBox);let s=Xl();a?Od(s,e.applyTransform(r,!0),t.measuredBox):Od(s,n,t.layoutBox);let c=!Bd(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=X();Md(s,t.layoutBox,i.layoutBox,o);let c=X();Md(c,n,a.layoutBox,o),Wd(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Sf(e){oa.value&&pf.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Cf(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function wf(e){e.clearSnapshot()}function Tf(e){e.clearMeasurements()}function Ef(e){e.isLayoutDirty=!0,e.updateLayout()}function Df(e){e.isLayoutDirty=!1}function Of(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function kf(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function Af(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function jf(e){e.resolveTargetDelta()}function Mf(e){e.calcProjection()}function Nf(e){e.resetSkewAndRotation()}function Pf(e){e.removeLeadSnapshot()}function Ff(e,t,n){e.translate=K(t.translate,0,n),e.scale=K(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function If(e,t,n,r){e.min=K(t.min,n.min,r),e.max=K(t.max,n.max,r)}function Lf(e,t,n,r){If(e.x,t.x,n.x,r),If(e.y,t.y,n.y,r)}function Rf(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var zf={duration:.45,ease:[.4,0,.1,1]},Bf=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Vf=Bf(`applewebkit/`)&&!Bf(`chrome/`)?Math.round:Ai;function Hf(e){e.min=Vf(e.min),e.max=Vf(e.max)}function Uf(e){Hf(e.x),Hf(e.y)}function Wf(e,t,n){return e===`position`||e===`preserve-aspect`&&!Ed(Gd(t),Gd(n),.2)}function Gf(e){return e!==e.root&&e.scroll?.wasRoot}var Kf=yf({attachResizeListener:(e,t)=>of(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),qf={current:void 0},Jf=yf({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!qf.current){let e=new Kf({});e.mount(window),e.setOptions({layoutScroll:!0}),qf.current=e}return qf.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),Yf=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Xf(e=!0){let t=(0,b.useContext)(xi);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,b.useId)();(0,b.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,b.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var Zf=(0,b.createContext)({strict:!1}),Qf={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},$f=!1;function ep(){if($f)return;let e={};for(let t in Qf)e[t]={isEnabled:e=>Qf[t].some(t=>!!e[t])};fu(e),$f=!0}function tp(){return ep(),pu()}function np(e){let t=tp();for(let n in e)t[n]={...t[n],...e[n]};fu(t)}var rp=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function ip(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||rp.has(e)}var ap=c({default:()=>op}),op,sp=o((()=>{throw op={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),cp=e=>!ip(e);function lp(e){typeof e==`function`&&(cp=t=>t.startsWith(`on`)?!ip(t):e(t))}try{lp((sp(),d(ap)).default)}catch{}function up(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||Pc(e[i])||(cp(i)||n===!0&&ip(i)||!t&&!ip(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var dp=(0,b.createContext)({});function fp(e,t){if(ru(e)){let{initial:t,animate:n}=e;return{initial:t===!1||eu(t)?t:void 0,animate:eu(n)?n:void 0}}return e.inherit===!1?{}:t}function pp(e){let{initial:t,animate:n}=fp(e,(0,b.useContext)(dp));return(0,b.useMemo)(()=>({initial:t,animate:n}),[mp(t),mp(n)])}function mp(e){return Array.isArray(e)?e.join(` `):e}var hp=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function gp(e,t,n){for(let r in t)!Pc(t[r])&&!qu(r,n)&&(e[r]=t[r])}function _p({transformTemplate:e},t){return(0,b.useMemo)(()=>{let n=hp();return Vu(n,t,e),Object.assign({},n.vars,n.style)},[t])}function vp(e,t){let n=e.style||{},r={};return gp(r,n,e),Object.assign(r,_p(e,t)),r}function yp(e,t){let n={},r=vp(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var bp=()=>({...hp(),attrs:{}});function xp(e,t,n,r){let i=(0,b.useMemo)(()=>{let n=bp();return td(n,t,rd(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};gp(t,e.style,e),i.style={...t,...i.style}}return i}var Sp=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Cp(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Sp.indexOf(e)>-1||/[A-Z]/u.test(e))}function wp(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??Cp(e)?xp:yp)(t,r,i,e),c=up(t,typeof e==`string`,a),l=e===b.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,b.useMemo)(()=>Pc(u)?u.get():u,[u]);return(0,b.createElement)(e,{...l,children:d})}function Tp({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Ep(n,r,i,e),renderState:t()}}function Ep(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=uf(a[e]);let{initial:o,animate:s}=e,c=ru(e),l=iu(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!$l(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=Sc(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var Dp=e=>(t,n)=>{let r=(0,b.useContext)(dp),i=(0,b.useContext)(xi),a=()=>Tp(e,t,r,i);return n?a():yi(a)},Op=Dp({scrapeMotionValuesFromProps:Ju,createRenderState:hp}),kp=Dp({scrapeMotionValuesFromProps:ad,createRenderState:bp}),Ap=Symbol.for(`motionComponentSymbol`);function jp(e,t,n){let r=(0,b.useRef)(n);(0,b.useInsertionEffect)(()=>{r.current=n});let i=(0,b.useRef)(null);return(0,b.useCallback)(n=>{n&&e.onMount?.(n);let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n);t&&(n?t.mount(n):t.unmount())},[t])}var Mp=(0,b.createContext)({});function Np(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function Pp(e,t,n,r,i,a){let{visualElement:o}=(0,b.useContext)(dp),s=(0,b.useContext)(Zf),c=(0,b.useContext)(xi),l=(0,b.useContext)(Yf),u=l.reducedMotion,d=l.skipAnimations,f=(0,b.useRef)(null),p=(0,b.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,b.useContext)(Mp);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&Fp(f.current,n,i,h);let g=(0,b.useRef)(!1);(0,b.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[Rc],v=(0,b.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return bi(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,b.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function Fp(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:Ip(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&Np(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function Ip(e){if(e)return e.options.allowProjection===!1?Ip(e.parent):e.projection}function Lp(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&np(r);let a=n?n===`svg`:Cp(e),o=a?kp:Op;function s(n,s){let c,l={...(0,b.useContext)(Yf),...n,layoutId:Rp(n)},{isStatic:u}=l,d=pp(n),f=o(n,u);if(!u&&typeof window<`u`){zp(l,r);let t=Bp(l);c=t.MeasureLayout,d.visualElement=Pp(e,f,l,i,t.ProjectionNode,a)}return(0,V.jsxs)(dp.Provider,{value:d,children:[c&&d.visualElement?(0,V.jsx)(c,{visualElement:d.visualElement,...l}):null,wp(e,n,jp(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,b.forwardRef)(s);return c[Ap]=e,c}function Rp({layoutId:e}){let t=(0,b.useContext)(vi).id;return t&&e!==void 0?t+`-`+e:e}function zp(e,t){(0,b.useContext)(Zf).strict}function Bp(e){let{drag:t,layout:n}=tp();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Vp(e,t){if(typeof Proxy>`u`)return Lp;let n=new Map,r=(n,r)=>Lp(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,Lp(a,void 0,e,t)),n.get(a))})}var Hp=(e,t)=>t.isSVG??Cp(e)?new od(t):new Xu(t,{allowProjection:e!==b.Fragment}),Up=class extends gu{constructor(e){super(e),e.animationState||=pd(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();$l(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},Wp=0,Gp={animation:{Feature:Up},exit:{Feature:class extends gu{constructor(){super(...arguments),this.id=Wp++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`){let n=Cc(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function Kp(e){return{point:{x:e.pageX,y:e.pageY}}}var qp=e=>t=>Sl(t)&&e(t,Kp(t));function Jp(e,t,n,r){return of(e,t,qp(n),r)}var Yp=({current:e})=>e?e.ownerDocument.defaultView:null,Xp=(e,t)=>Math.abs(e-t);function Zp(e,t){let n=Xp(e.x,t.x),r=Xp(e.y,t.y);return Math.sqrt(n**2+r**2)}var Qp=new Set([`auto`,`scroll`]),$p=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=em(this.lastRawMoveEventInfo,this.transformPagePoint));let e=nm(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=Zp(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=da;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=em(t,this.transformPagePoint),U.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=nm(e.type===`pointercancel`?this.lastMoveEventInfo:em(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!Sl(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=em(Kp(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=da;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,nm(s,this.history)),this.removeListeners=H(Jp(this.contextWindow,`pointermove`,this.handlePointerMove),Jp(this.contextWindow,`pointerup`,this.handlePointerUp),Jp(this.contextWindow,`pointercancel`,this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Qp.has(e.overflowX)||Qp.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),U.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ua(this.updatePoint)}};function em(e,t){return t?{point:t(e.point)}:e}function tm(e,t){return{x:e.x-t.x,y:e.y-t.y}}function nm({point:e},t){return{point:e,delta:tm(e,im(t)),offset:tm(e,rm(t)),velocity:am(t,.1)}}function rm(e){return e[0]}function im(e){return e[e.length-1]}function am(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=im(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Pi(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Pi(t)*2&&(r=e[1]);let a=Fi(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function om(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?K(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?K(n,e,r.max):Math.min(e,n)),e}function sm(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function cm(e,{top:t,left:n,bottom:r,right:i}){return{x:sm(e.x,n,i),y:sm(e.y,t,r)}}function lm(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function um(e,t){return{x:lm(e.x,t.x),y:lm(e.y,t.y)}}function dm(e,t){let n=.5,r=Td(e),i=Td(t);return i>r?n=Mi(t.min,t.max-r,e.min):r>i&&(n=Mi(e.min,e.max-i,t.min)),wi(0,1,n)}function fm(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var pm=.35;function mm(e=pm){return e===!1?e=0:e===!0&&(e=pm),{x:hm(e,`left`,`right`),y:hm(e,`top`,`bottom`)}}function hm(e,t,n){return{min:gm(e,t),max:gm(e,n)}}function gm(e,t){return typeof e==`number`?e:e[t]||0}var _m=new WeakMap,vm=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=X(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(Kp(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=_l(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),qd(e=>{let t=this.getAxisMotionValue(e).get()||0;if(za.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=Td(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&U.update(()=>i(e,t),!1,!0),Ic(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=Sm(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&U.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new $p(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:Yp(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&U.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!xm(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=om(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&Np(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=cm(n.layoutBox,e):this.constraints=!1,this.elastic=mm(t),r!==this.constraints&&!Np(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&qd(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=fm(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Np(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;let i=Lu(n,r.root,this.visualElement.getTransformPagePoint()),a=um(r.layout.layoutBox,i);if(t){let e=t(vu(a));this.hasMutatedConstraints=!!e,e&&(a=_u(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=qd(o=>{if(!xm(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return Ic(this.visualElement,e),n.start(bc(e,n,0,t,this.visualElement,!1))}stopAnimation(){qd(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){qd(t=>{let{drag:n}=this.getProps();if(!xm(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-K(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Np(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};qd(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=dm({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),qd(t=>{if(!xm(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(K(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;_m.set(this.visualElement,this);let e=this.visualElement.current,t=Jp(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&El(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();Np(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=bm(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),U.read(r);let o=of(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(qd(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=pm,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function ym(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function bm(e,t,n){let r=Gl(e,ym(n)),i=Gl(t,ym(n));return()=>{r(),i()}}function xm(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Sm(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var Cm=class extends gu{constructor(e){super(e),this.removeGroupControls=Ai,this.removeListeners=Ai,this.controls=new vm(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ai}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},wm=e=>(t,n)=>{e&&U.update(()=>e(t,n),!1,!0)},Tm=class extends gu{constructor(){super(...arguments),this.removePointerDownListener=Ai}onPointerDown(e){this.session=new $p(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Yp(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:wm(e),onStart:wm(t),onMove:wm(n),onEnd:(e,t)=>{delete this.session,r&&U.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=Jp(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Em=!1,Dm=class extends b.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Em&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ff.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Em=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||U.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),pl.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Em=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function Om(e){let[t,n]=Xf(),r=(0,b.useContext)(vi);return(0,V.jsx)(Dm,{...e,layoutGroup:r,switchLayoutGroup:(0,b.useContext)(Mp),isPresent:t,safeToRemove:n})}var km={pan:{Feature:Tm},drag:{Feature:Cm,ProjectionNode:Jf,MeasureLayout:Om}};function Am(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&U.postRender(()=>i(t,Kp(t)))}var jm=class extends gu{mount(){let{current:e}=this.node;e&&(this.unmount=bl(e,(e,t)=>(Am(this.node,t,`Start`),e=>Am(this.node,e,`End`))))}unmount(){}},Mm=class extends gu{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=H(of(this.node.current,`focus`,()=>this.onFocus()),of(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Nm(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&U.postRender(()=>i(t,Kp(t)))}var Pm=class extends gu{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Nl(e,(e,t)=>(Nm(this.node,t,`Start`),(e,{success:t})=>Nm(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Fm=new WeakMap,Im=new WeakMap,Lm=e=>{let t=Fm.get(e.target);t&&t(e)},Rm=e=>{e.forEach(Lm)};function zm({root:e,...t}){let n=e||document;Im.has(n)||Im.set(n,{});let r=Im.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Rm,{root:e,...t})),r[i]}function Bm(e,t,n){let r=zm(t);return Fm.set(e,n),r.observe(e),()=>{Fm.delete(e),r.unobserve(e)}}var Vm={some:0,all:1},Hm=class extends gu{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Vm[r]};this.stopObserver=Bm(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Um(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Um({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Wm={inView:{Feature:Hm},tap:{Feature:Pm},focus:{Feature:Mm},hover:{Feature:jm}},Gm={layout:{ProjectionNode:Jf,MeasureLayout:Om}},Km=Vp({...Gp,...Wm,...km,...Gm},Hp),qm=24e3,Jm=2048,Ym=1200,Xm=.05,Zm=4,Qm=.03,$m=2,eh=11;function th(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t/e.length)}function nh(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n++){let r=Math.max(-1,Math.min(1,e[n]));t[n]=r<0?r*32768:r*32767}return t}function rh(e){let t=new Float32Array(e.length);for(let n=0;n<e.length;n++)t[n]=e[n]/32768;return t}var ih=.09,ah=[`audio/webm`,`audio/mp4`];function oh(){return typeof window>`u`||window.MediaRecorder===void 0?null:ah.find(e=>window.MediaRecorder.isTypeSupported(e))||null}function sh(e,t,n,r,i){if(!r.length||!n||!e)return;let a=new Blob(r,{type:i}),o=new FormData;o.append(`audio`,a,`aichat-${n}.webm`),o.append(`voiceSessionId`,n),o.append(`siteId`,t||``),fetch(`${e}/api/voice/upload-chat-recording`,{method:`POST`,body:o}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(e=>console.warn(`[FlowEngage] voice recording upload failed:`,e.message))}function ch(e,t,n){let r=0,i=0,a=[],o=()=>{a.forEach(e=>{try{e.stop()}catch{}}),a=[],r=0},s=()=>r>e.currentTime;return{enqueue:o=>{let c=rh(o),l=e.createBuffer(1,c.length,qm);l.copyToChannel(c,0);let u=e.createBufferSource();u.buffer=l,u.connect(e.destination),n&&u.connect(n);let d=!s(),f=d?e.currentTime+ih:r;d&&(i=f),u.start(f),r=f+l.duration,a.push(u),u.onended=()=>{a=a.filter(e=>e!==u),!a.length&&!s()&&t?.()}},stop:o,isPlaying:s,playedMs:()=>Math.max(0,(e.currentTime-i)*1e3)}}async function lh(e,t,n){let r=new URLSearchParams({siteId:t||``});n&&r.set(`chatId`,n);let i=Rr();i&&r.set(`shopifyCustomerId`,String(i));let a=await fetch(`${e}/api/voice/session?${r.toString()}`,{method:`GET`,headers:{"Content-Type":`application/json`}});if(a.status===429){let e=await a.json().catch(()=>({}));throw Error(e.message||`Too many voice sessions started. Please wait a minute before trying again.`)}if(!a.ok)throw Error(`Could not start a voice session.`);let o=await a.json();if(!o?.success||!o.wsUrl)throw Error(o?.error||`Voice session was refused.`);return o}async function uh(e){let{apiBaseUrl:t,siteId:n,chatId:r,clientTools:i={},onConnect:a,onDisconnect:o,onMessage:s,onModeChange:c,onError:l,onUnhandledClientToolCall:u,onAgentTurnEnd:d,onSessionInfo:f,onSessionEnding:p}=e,m=await lh(t,n,r);f?.({emailOnFile:!!m.emailOnFile});let h={type:`Start`};e.greeting!==void 0&&(h.greeting=e.greeting||null);let g=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),_=new(window.AudioContext||window.webkitAudioContext)({sampleRate:qm});_.state===`suspended`&&await _.resume();let v=_.createMediaStreamDestination(),y=oh(),b=[],x=null,S=r||n||null;y&&(x=new window.MediaRecorder(v.stream,{mimeType:y}),x.ondataavailable=e=>{e.data&&e.data.size>0&&b.push(e.data)},x.start());let C=new WebSocket(m.wsUrl);C.binaryType=`arraybuffer`;let w=new Set,T={role:null,text:``,timer:null,debug:null},E=``,ee=()=>{T.timer&&=(clearTimeout(T.timer),null);let e=T.text.trim(),t=T.role,n=T.debug;if(T.text=``,T.role=null,T.debug=null,!(!e||!t)){if(t===`agent`){if(e===E){console.debug(`[FlowEngage] duplicate agent turn suppressed`);return}E=e}s?.({role:t,message:e,debug:n})}},D=(e,t,n)=>{t&&(T.role&&T.role!==e&&ee(),T.role=e,T.text=T.text?`${T.text} ${t}`.replace(/\s+/g,` `):t,n&&(T.debug=n),T.timer&&clearTimeout(T.timer),T.timer=setTimeout(ee,Ym))},O=!1,k=!1,A=!1,te=!1,ne=!0,re=0,ie=!1,j=!1,M=Xm,ae=Zm,oe=null,se=!1,ce=!1,N=()=>{oe&&clearTimeout(oe);let e=()=>{if(!O){if(P.isPlaying()){oe=setTimeout(e,150);return}if(oe=null,se){p?.();return}!O&&C.readyState===WebSocket.OPEN&&C.send(JSON.stringify({type:`PlaybackDrained`})),ce&&(ce=!1,d?.())}};oe=setTimeout(e,150)},P=ch(_,()=>{te&&(te=!1,c?.({mode:`listening`}))},v);typeof window<`u`&&(window.__fe_agentAudioPlaying=()=>P.isPlaying());let le=_.createMediaStreamSource(g);le.connect(v);let ue=_.createScriptProcessor(Jm,1,1),F=!1,de=0,fe=0;ue.onaudioprocess=e=>{if(O||C.readyState!==WebSocket.OPEN)return;let t=e.inputBuffer.getChannelData(0),n=()=>C.send(new Int16Array(t.length).buffer);if(k){A||(A=!0,console.debug(`[FlowEngage] mic held — streaming silence to keep socket alive`)),F=!1,de=0,fe=0,n();return}let r=th(t);if(P.isPlaying()||j?(F=!1,de=0,fe=0):r>=Qm?(fe=0,de+=1,!F&&de>=$m&&(F=!0,c?.({mode:`user-speaking`}))):(de=0,F&&++fe>=eh&&(F=!1,fe=0,c?.({mode:`thinking`,tentative:!0}))),(P.isPlaying()||j)&&!ie){if(r<M)re=0;else if(++re>=ae){ie=!0,re=0;let e=P.playedMs();P.stop(),ne=!1,j=!1,oe&&!se&&(clearTimeout(oe),oe=null),ce=!1,C.send(JSON.stringify({type:`VisitorInterrupted`,played_ms:Math.round(e)})),console.debug(`[FlowEngage] barge-in — visitor spoke over the agent`)}}C.send(nh(t).buffer)},le.connect(ue),ue.connect(_.destination);let pe=()=>{if(!O){O=!0,oe&&=(clearTimeout(oe),null),ee(),P.stop(),typeof window<`u`&&delete window.__fe_agentAudioPlaying;try{ue.disconnect(),le.disconnect()}catch{}if(g.getTracks().forEach(e=>e.stop()),x&&x.state!==`inactive`){x.onstop=()=>sh(t,n,S,b,y);try{x.stop()}catch{x.onstop=null}}else b.length&&sh(t,n,S,b,y);_.close().catch(()=>{}),(C.readyState===WebSocket.OPEN||C.readyState===WebSocket.CONNECTING)&&C.close()}},me=async e=>{let t=i[e.name];if(!t)return u?.({tool_name:e.name}),{error:`Unknown tool ${e.name}`};let n={};try{n=JSON.parse(e.arguments||`{}`)}catch{}try{return await t(n)}catch(e){return{error:e?.message||`Tool execution failed`}}},I=async e=>{for(let t of e.functions||[]){if(!t.client_side)continue;let e=await me(t);if(O||C.readyState!==WebSocket.OPEN)return;C.send(JSON.stringify({type:`FunctionCallResponse`,id:t.id,name:t.name,content:typeof e==`string`?e:JSON.stringify(e??{})}))}},he=e=>{switch(e.type){case`Welcome`:Number.isFinite(e.barge_in_rms)&&e.barge_in_rms>0&&(M=e.barge_in_rms),Number.isFinite(e.barge_in_frames)&&e.barge_in_frames>0&&(ae=e.barge_in_frames),S=e.session_id||r||n||null,a?.({conversationId:S});break;case`ConversationText`:{let t=String(e.content||``);if(e.role===`user`){let e=t.trim();if(w.has(e)){w.delete(e);break}if(/^\[SYSTEM:/i.test(e)||/^Continue (now )?to the next section/i.test(e)||/^That was the last section/i.test(e)){console.debug(`[FlowEngage] widget instruction hidden from transcript`);break}}D(e.role===`user`?`user`:`agent`,t,e.debug);break}case`UserStartedSpeaking`:ee(),P.stop(),j=!1,ne=!1,te=!1,oe&&!se&&(clearTimeout(oe),oe=null),ce=!1,c?.({mode:`listening`});break;case`AgentStartedSpeaking`:ne=!0,te=!0,ie=!1,re=0,c?.({mode:`speaking`});break;case`AgentAudioDone`:j=!1,ee(),N(),P.isPlaying()||(te=!1,c?.({mode:`listening`}));break;case`FunctionCallRequest`:I(e);break;case`AgentPreparing`:j=!0;break;case`AgentTurnComplete`:ce=!0,N();break;case`SessionEnding`:console.debug(`[FlowEngage] server is ending the session:`,e.reason||`unspecified`),se=!0;break;case`AgentThinking`:c?.({mode:`thinking`});break;case`PromptUpdated`:break;case`Error`:console.error(`[FlowEngage:Voice]`,e.code||``,e.description||e),l?.(Error(e.description||`Voice service error`));break;case`Warning`:console.warn(`[FlowEngage:Voice]`,e.code||``,e.description||``);break;default:break}};return C.onopen=()=>C.send(JSON.stringify(h)),C.onmessage=e=>{if(e.data instanceof ArrayBuffer){ne&&P.enqueue(new Int16Array(e.data));return}try{he(JSON.parse(e.data))}catch{}},C.onerror=()=>l?.(Error(`Voice connection failed`)),C.onclose=()=>{pe(),o?.()},{endSession:async()=>pe(),sendContextualUpdate:e=>{O||C.readyState!==WebSocket.OPEN||!e||C.send(JSON.stringify({type:`UpdatePrompt`,prompt:e}))},sendUserMessage:(e,{silent:t=!0,suppressQuestion:n=!1}={})=>{O||C.readyState!==WebSocket.OPEN||!e||(t&&w.add(e.trim()),C.send(JSON.stringify({type:`InjectUserMessage`,content:e,suppress_question:n})))},injectAgentSpeech:(e,t=`interrupt`)=>{O||C.readyState!==WebSocket.OPEN||!e||C.send(JSON.stringify({type:`InjectAgentMessage`,message:e,behavior:t}))},setWalkthroughActive:e=>{O||C.readyState!==WebSocket.OPEN||C.send(JSON.stringify({type:`WalkthroughActive`,active:!!e}))},setMicMuted:e=>{k=!!e,!O&&C.readyState===WebSocket.OPEN&&C.send(JSON.stringify({type:`MicHeld`,held:k}))},get status(){return O?`disconnected`:`connected`}}}var dh={startSession:uh},fh=({size:e=18,color:t=`currentColor`})=>(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,V.jsx)(`path`,{d:`M12 1a4 4 0 014 4v6a4 4 0 01-8 0V5a4 4 0 014-4z`,fill:t}),(0,V.jsx)(`path`,{d:`M19 10a7 7 0 01-14 0M12 19v4M8 23h8`,stroke:t,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),ph=({size:e=20})=>(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{d:`M10.68 13.31a16 16 0 003.41 2.6l1.27-1.27a2 2 0 012.11-.45 12.84 12.84 0 002.81.7 2 2 0 011.72 2v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07A19.42 19.42 0 013.07 8.62 19.79 19.79 0 01.1 2 2 2 0 012.11 0h3a2 2 0 012 1.72c.127.96.361 1.903.7 2.81a2 2 0 01-.45 2.11L6.18 7.84`}),(0,V.jsx)(`line`,{x1:`23`,y1:`1`,x2:`1`,y2:`23`})]}),mh=({size:e=18})=>(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`5`}),(0,V.jsx)(`polyline`,{points:`5 12 12 5 19 12`})]}),hh=()=>(0,V.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`polyline`,{points:`9 17 4 12 9 7`}),(0,V.jsx)(`path`,{d:`M20 18v-2a4 4 0 00-4-4H4`})]}),gh=()=>(0,V.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`path`,{d:`M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.42 19.42 0 01-6.12-6.11A19.79 19.79 0 012 4.11 2 2 0 014.11 2h3a2 2 0 012 1.72c.13.96.37 1.91.71 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.9.34 1.85.58 2.81.71A2 2 0 0122 16.92z`})}),_h=({className:e=``})=>(0,V.jsxs)(`svg`,{className:e,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,V.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,V.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),vh=({size:e=14})=>(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{d:`M12 8V4H8`}),(0,V.jsx)(`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`}),(0,V.jsx)(`path`,{d:`M2 14h2`}),(0,V.jsx)(`path`,{d:`M20 14h2`}),(0,V.jsx)(`path`,{d:`M15 13v2`}),(0,V.jsx)(`path`,{d:`M9 13v2`})]}),yh=({size:e=20,strokeWidth:t=2,color:n=`currentColor`})=>(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:n,strokeWidth:t,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,V.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),bh=({size:e=20,color:t=`currentColor`})=>(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,V.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.5`,fill:t}),(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`,fill:t}),(0,V.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.5`,fill:t})]}),xh=({size:e=20,color:t=`currentColor`})=>(0,V.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,V.jsx)(`path`,{d:`M22 11.5667C22 16.8499 17.5222 21.1334 12 21.1334C11.3507 21.1343 10.7032 21.0742 10.0654 20.9545C9.60633 20.8682 9.37678 20.8251 9.21653 20.8496C9.05627 20.8741 8.82918 20.9948 8.37499 21.2364C7.09014 21.9197 5.59195 22.161 4.15111 21.893C4.69874 21.2194 5.07275 20.4112 5.23778 19.5448C5.33778 19.0148 5.09 18.5 4.71889 18.1231C3.03333 16.4115 2 14.1051 2 11.5667C2 6.28357 6.47778 2 12 2C17.5222 2 22 6.28357 22 11.5667Z`,stroke:`white`,"stroke-width":`1.5`,"stroke-linejoin":`round`}),(0,V.jsx)(`path`,{d:`M11.9955 12H12.0045M15.991 12H16M8 12H8.00897`,stroke:`white`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]}),Sh=()=>(0,V.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,V.jsx)(`path`,{d:`M16.7133 8.59374C18.1939 8.98463 19.2229 9.47922 20.1589 10.0848C21.5432 10.9804 22.1367 12.5944 21.9737 14.1517C21.9049 14.8099 21.3744 15.1246 20.7592 14.9544L19.3705 14.57C18.2697 14.2653 17.7193 14.1129 17.3837 13.71C17.0481 13.307 17.0086 12.751 16.9296 11.6391L16.7133 8.59374ZM16.7133 8.59374C13.7164 7.80255 10.2871 7.80163 7.28669 8.59374M7.28669 8.59374C5.80606 8.98463 4.77711 9.47923 3.84113 10.0848C2.45683 10.9804 1.86334 12.5944 2.02628 14.1517C2.09514 14.8099 2.62563 15.1246 3.24078 14.9544L4.62954 14.57C5.73032 14.2653 6.28071 14.1129 6.61631 13.71C6.95191 13.307 6.9914 12.751 7.07038 11.6391L7.28669 8.59374Z`,stroke:`#E30C12`,"stroke-width":`1.5`,"stroke-linejoin":`round`})}),Ch=({size:e=24})=>(0,V.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{d:`M12 19v3`}),(0,V.jsx)(`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`}),(0,V.jsx)(`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`}),(0,V.jsx)(`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`}),(0,V.jsx)(`path`,{d:`m2 2 20 20`}),(0,V.jsx)(`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`})]}),wh=(e=``)=>String(e).replace(/<[^>]+>/g,``).replace(/\s+/g,` `).trim(),Th=(e=``)=>String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),Eh=new Set([`p`,`br`,`ul`,`ol`,`li`,`strong`,`em`,`b`,`i`,`a`]),Dh=/^https?:\/\//i;function Oh(e){let t=Array.from(e.childNodes);for(let n of t)if(n.nodeType===Node.ELEMENT_NODE){let t=n.tagName.toLowerCase();if(!Eh.has(t)){e.replaceChild(document.createTextNode(n.textContent),n);continue}let r={};if(t===`a`){let e=n.getAttribute(`href`)||``;Dh.test(e)&&(r.href=e),r.target=`_blank`,r.rel=`noopener noreferrer`}for(;n.attributes.length>0;)n.removeAttribute(n.attributes[0].name);for(let[e,t]of Object.entries(r))n.setAttribute(e,t);Oh(n)}else n.nodeType!==Node.TEXT_NODE&&e.removeChild(n)}function kh(e){let t=document.createElement(`div`);return t.innerHTML=e,Oh(t),t.innerHTML}function Ah(e){let t=String(e||``).trim();if(!t)return t;let n=/^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);if(n&&!/<\/?strong\b/i.test(n[1]))return`<p>${n[1]}</p>`;let r=/^<strong>([\s\S]*?)<\/strong>$/i.exec(t);if(r&&!/<\/?strong\b/i.test(r[1])){let e=r[1].trim();return/^<(?:p|ul|ol)\b/i.test(e)?e:`<p>${e}</p>`}return e}var jh=(e=``)=>{let t=String(e||``).trim();if(!t)return``;if(/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t))return Ah(kh(t));let n=t.replace(/\r\n/g,`
|
|
37
|
+
`).replace(/\n{3,}/g,`
|
|
38
|
+
|
|
39
|
+
`).split(/\n\s*\n/).map(e=>e.trim()).filter(Boolean),r=e=>Th(e).replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g,`<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>`).replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`).replace(/\*([^*\n]+)\*/g,`<em>$1</em>`);return Ah(n.map(e=>{let t=e.split(`
|
|
40
|
+
`).map(e=>e.trim()).filter(Boolean),n=t.filter(e=>/^[-*]\s+/.test(e));if(n.length>=2&&n.length===t.length)return`<ul>${n.map(e=>`<li>${r(e.replace(/^[-*]\s+/,``))}</li>`).join(``)}</ul>`;let i=e.split(/\s+(?=[-*]\s+\*\*?)/).map(e=>e.trim()).filter(Boolean);return i.length>=2&&i.every(e=>/^[-*]\s+/.test(e))?`<ul>${i.map(e=>`<li>${r(e.replace(/^[-*]\s+/,``))}</li>`).join(``)}</ul>`:`<p>${r(e).replace(/\n/g,`<br />`)}</p>`}).join(``))},Mh=new Set([`application/pdf`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`]),Nh=new Set([`.pdf`,`.docx`,`.png`,`.jpg`,`.jpeg`]),Ph=`image/png,image/jpeg,.pdf,.docx`;function Fh(e){if(!e)return!1;let t=typeof e.name==`string`?e.name.toLowerCase():``,n=t.includes(`.`)?`.${t.split(`.`).pop()}`:``,r=typeof e.type==`string`?e.type.toLowerCase():``;return r===`image/png`||r===`image/jpeg`||Mh.has(r)||Nh.has(n)}function Ih(e){return e?Fh(e)?e.size>2097152?`File must be 2 MB or smaller.`:``:`Only PNG, JPEG, PDF, and DOCX files are allowed.`:`No file selected.`}function Lh(e=0){if(!Number.isFinite(e)||e<=0)return``;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;let i=n>=10||r===0?0:1;return`${n.toFixed(i)} ${t[r]}`}function Rh(e){return e?e.name||`Attachment`:``}function zh(e){if(!e||typeof e!=`string`)return`?`;let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/).filter(Boolean);return n.length>=2?`${n[0][0]}${n[n.length-1][0]}`.toUpperCase():t.slice(0,2).toUpperCase()}function Bh({src:e,name:t,imgStyle:n,initialsSpanStyle:r}){let[i,a]=(0,b.useState)(null),o=typeof e==`string`?e.trim():``;return(0,b.useEffect)(()=>{if(!o){a(null);return}a(null);let e=!1,t=new window.Image;return t.onload=()=>{e||a(o)},t.onerror=()=>{e||a(null)},t.src=o,()=>{e=!0}},[o]),i?(0,V.jsx)(`img`,{src:i,alt:``,style:n,onError:()=>a(null)}):(0,V.jsx)(`span`,{style:r,children:zh(t)})}function Vh({chatHistory:e,isAiTyping:t,isLoading:n,isAgentTyping:r,setReplyContext:i,primaryColor:a=`#3B82F6`,agentHeadshot:o=null,agentDisplayName:s=`Agent`,botAvatarNode:c=null}){let{resolvedConfig:l}=Tn(),u=(0,b.useRef)(null),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(null),h=(0,b.useRef)(e.length),g=(0,b.useRef)(!0),_=(0,b.useRef)(null),v=(0,b.useCallback)(e=>{let t=e.target.closest(`a[href]`);if(!t)return;let n=t.getAttribute(`href`)||``;if(!(!n||n.startsWith(`mailto:`)||n.startsWith(`tel:`)||n.startsWith(`javascript:`)))try{let t=new URL(n,window.location.href);if(t.origin!==window.location.origin){e.preventDefault(),window.open(t.href,`_blank`,`noopener,noreferrer`);return}e.preventDefault(),gr(t.href,{siteId:l?.siteId,apiBaseUrl:l?.apiBaseUrl}).then(({allowed:e,correctedUrl:n})=>{e&&Dr(n||t.href)})}catch{}},[l]),y=e=>{if(!e)return`just now`;let t=new Date,n=new Date(e),r=Math.max(0,Math.floor((t-n)/1e3));if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return`${i} min${i>1?`s`:``} ago`;let a=Math.floor(i/60);if(a<24)return`${a} hr${a>1?`s`:``} ago`;let o=Math.floor(a/24);return`${o} day${o>1?`s`:``} ago`};return(0,b.useEffect)(()=>{if(g.current){g.current=!1,h.current=e.length,_.current&&(_.current.scrollTop=_.current.scrollHeight);return}let n=e.length>h.current;h.current=e.length,(n||t||r)&&u.current?.scrollIntoView({behavior:`smooth`})},[e.length,t,n,r]),(0,V.jsxs)(`div`,{ref:_,style:{flex:1,overflowY:`auto`,overscrollBehavior:`contain`,padding:`10px 16px 20px`,display:`flex`,flexDirection:`column`,background:`transparent`},children:[e.map(e=>{if(e.type===`call_recording`||typeof e.message==`string`&&e.message.includes(`AI chat recording`))return null;let t=e.sender===`system`,n=e.sender===`user`,r=e.sender===`ai`||e.sender===`bot`,l=e.sender===`agent`,u=e.isPending,d=e.type===`file`&&e.metadata?.fileUrl,h=e.agent_name||e.agentName||e.metadata?.agentName||s,g=typeof e.sender_headshot==`string`&&e.sender_headshot.trim()||typeof o==`string`&&o.trim()||null,_=wh(e.replyToContent||e.replyContext?.message||``),b=e.replyToSender===`user`?`You`:e.replyToSender===`agent`?`Agent`:e.replyToSender===`ai`||e.replyToSender===`bot`?`AI Assistant`:`Message`;return t?(0,V.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,margin:`8px 0`},children:(0,V.jsx)(`div`,{style:{padding:`6px 12px`,borderRadius:`9999px`,background:`#f3f4f6`,color:`#6b7280`,fontSize:`12px`,fontWeight:500},children:e.message})},e.id):(0,V.jsxs)(`div`,{style:{display:`flex`,justifyContent:n?`flex-end`:`flex-start`,alignItems:`flex-start`,marginBottom:`16px`,gap:`8px`,flexDirection:`row`},children:[!n&&(r||l)&&(0,V.jsx)(`div`,{style:{width:`32px`,height:`32px`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`50%`,background:l?`#f3f4f6`:c&&r?`transparent`:`var(--flowengage-primary)`,color:l?a:`#fff`,boxShadow:l?`0 2px 8px rgba(0,0,0,0.06)`:c&&r?`none`:`0 8px 20px rgba(59,130,246,0.24)`,overflow:`hidden`,border:l?`1px solid ${a}22`:`none`,fontSize:`12px`,fontWeight:800,marginTop:!u&&(r||l)?`22px`:`0px`},children:r?c||(0,V.jsx)(vh,{size:16}):(0,V.jsx)(Bh,{src:g||``,name:h,imgStyle:{width:`100%`,height:`100%`,objectFit:`cover`},initialsSpanStyle:{lineHeight:1}})}),(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:n?`flex-end`:`flex-start`,maxWidth:`75%`,minWidth:0},children:[!u&&l&&(0,V.jsxs)(`button`,{type:`button`,onClick:()=>i(e),style:{opacity:1,marginBottom:`4px`,display:`flex`,alignItems:`center`,gap:`4px`,fontSize:`11px`,color:`#9ca3af`,background:`transparent`,border:0,cursor:`pointer`,padding:0,marginLeft:`2px`},onMouseEnter:e=>{e.currentTarget.style.color=`#4b5563`},onMouseLeave:e=>{e.currentTarget.style.color=`#9ca3af`},children:[(0,V.jsx)(hh,{}),`Reply`]}),(0,V.jsxs)(`div`,{style:{padding:`8px 16px`,borderRadius:n?`20px 6px 20px 20px`:`6px 20px 20px 20px`,lineHeight:1.8,letterSpacing:0,boxShadow:`0 2px 8px rgba(0,0,0,0.06)`,background:n?`var(--flowengage-primary)`:`rgba(255,255,255,0.92)`,color:n?`#fff`:`#111827`,fontSize:`14px`,fontWeight:400,opacity:u?.55:1,transition:`opacity 0.3s ease`,wordBreak:`break-word`,width:`fit-content`},children:[_&&(0,V.jsxs)(`div`,{style:{marginBottom:`8px`,borderRadius:`14px`,borderLeft:n?`2px solid rgba(255,255,255,0.8)`:`2px solid var(--flowengage-primary)`,padding:`8px 12px`,fontSize:`12px`,background:n?`rgba(255,255,255,0.15)`:`#f9fafb`,color:n?`rgba(255,255,255,0.9)`:`#6b7280`},children:[(0,V.jsx)(`div`,{style:{marginBottom:`2px`,fontWeight:600},children:b}),(0,V.jsx)(`div`,{style:{display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`,overflow:`hidden`},children:_})]}),d?(()=>{let t=e.metadata.fileType||``,r=e.metadata.fileName||e.message||`File`,i=Lh(e.metadata.fileSize),a=t.startsWith(`image/`),o=`shared file: ${r}`.toLowerCase(),s=(e.message||``).trim(),c=s&&s.toLowerCase()!==o&&!s.toLowerCase().startsWith(`shared file:`),l=t===`application/pdf`?{color:`#ef4444`,label:`PDF`}:t.includes(`word`)||t.includes(`docx`)?{color:`#3b82f6`,label:`DOCX`}:t.includes(`excel`)||t.includes(`sheet`)||t===`text/csv`?{color:`#10b981`,label:`XLSX`}:{color:`#6b7280`,label:`FILE`};return(0,V.jsxs)(`div`,{style:{minWidth:`200px`,maxWidth:`240px`},children:[c&&(0,V.jsx)(`div`,{style:{marginBottom:`6px`,fontSize:`14px`,color:n?`#fff`:`#111827`,whiteSpace:`normal`,wordBreak:`break-word`},children:s}),a?(0,V.jsx)(`button`,{type:`button`,onClick:()=>f({url:e.metadata.fileUrl,name:r}),onMouseEnter:()=>m(e.id),onMouseLeave:()=>m(null),style:{display:`block`,width:`100%`,background:`transparent`,border:0,padding:0,margin:0,textAlign:`left`,cursor:`pointer`},children:(0,V.jsxs)(`div`,{style:{position:`relative`},children:[(0,V.jsx)(`img`,{src:e.metadata.fileUrl,alt:r,style:{width:`100%`,borderRadius:`10px`,display:`block`,maxHeight:`180px`,objectFit:`cover`}}),(0,V.jsx)(`div`,{style:{position:`absolute`,inset:0,borderRadius:`10px`,background:p===e.id?`rgba(17,24,39,0.32)`:`rgba(17,24,39,0)`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#fff`,fontSize:`13px`,fontWeight:700,letterSpacing:`0.02em`,opacity:p===e.id?1:0,transition:`background 0.18s ease, opacity 0.18s ease`,pointerEvents:`none`},children:`Preview`})]})}):(0,V.jsx)(`a`,{href:e.metadata.fileUrl,target:`_blank`,rel:`noopener noreferrer`,style:{textDecoration:`none`,display:`block`},children:(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`,background:n?`rgba(255,255,255,0.15)`:`#f3f4f6`,borderRadius:`12px`,padding:`10px 12px`},children:[(0,V.jsxs)(`div`,{style:{width:`38px`,height:`46px`,borderRadius:`8px`,background:n?`rgba(255,255,255,0.22)`:`#fff`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,flexShrink:0,boxShadow:`0 1px 4px rgba(0,0,0,0.1)`,gap:`3px`},children:[(0,V.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:n?`#fff`:l.color,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`}),(0,V.jsx)(`polyline`,{points:`14 2 14 8 20 8`})]}),(0,V.jsx)(`span`,{style:{fontSize:`7px`,fontWeight:800,letterSpacing:`0.04em`,color:n?`#fff`:l.color,lineHeight:1},children:l.label})]}),(0,V.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,V.jsx)(`div`,{style:{fontSize:`13px`,fontWeight:600,color:n?`#fff`:`#111827`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r}),i&&(0,V.jsx)(`div`,{style:{fontSize:`11px`,marginTop:`3px`,color:n?`rgba(255,255,255,0.6)`:`#9ca3af`},children:i})]}),(0,V.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:n?`rgba(255,255,255,0.65)`:`#9ca3af`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,V.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,V.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,V.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]})]})})]})})():r?(0,V.jsx)(`div`,{className:`flowengage-message-content fe-bot-message`,dangerouslySetInnerHTML:{__html:jh(e.message)},onClick:v}):(0,V.jsx)(`div`,{style:{whiteSpace:`pre-wrap`},children:e.message})]}),(0,V.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`,marginTop:`4px`,padding:`0 4px`,alignSelf:n?`flex-end`:`flex-start`},children:u?(0,V.jsx)(`span`,{style:{fontSize:`10px`,color:`#9ca3af`,fontWeight:500,fontStyle:`italic`},children:`sending…`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{style:{fontSize:`10px`,color:`#9ca3af`,fontWeight:500},children:y(e.timestamp||e.createdAt)}),(0,V.jsx)(`span`,{style:{fontSize:`10px`,fontWeight:700,color:n?`var(--flowengage-primary)`:`#9ca3af`},children:`✓`})]})})]})]},e.id)}),(t||n)&&(0,V.jsxs)(`div`,{style:{marginBottom:`16px`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,V.jsx)(`div`,{style:{width:`32px`,height:`32px`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`50%`,background:c?`transparent`:`var(--flowengage-primary)`,color:`#fff`,boxShadow:c?`none`:`0 8px 20px rgba(59,130,246,0.24)`,overflow:`hidden`},children:c||(0,V.jsx)(vh,{size:16})}),(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`2px`,color:`#374151`,fontSize:`13px`,fontWeight:500,fontStyle:`italic`},children:[`Analysing`,[0,1,2].map(e=>(0,V.jsx)(`span`,{style:{animation:`fe-dot-bounce 1.2s ease-in-out ${e*.2}s infinite`,display:`inline-block`},children:`.`},e))]})]}),r&&(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`8px`,marginBottom:`12px`},children:[(0,V.jsx)(`div`,{style:{width:`32px`,height:`32px`,flexShrink:0,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`50%`,overflow:`hidden`},children:(0,V.jsx)(Bh,{src:o||``,name:s,imgStyle:{width:`100%`,height:`100%`,objectFit:`cover`},initialsSpanStyle:{lineHeight:1}})}),(0,V.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`5px`,padding:`12px 16px`,borderRadius:`18px`,background:`#fff`,boxShadow:`0 2px 6px rgba(0,0,0,0.04)`},children:[0,1,2].map(e=>(0,V.jsx)(`span`,{style:{width:`7px`,height:`7px`,borderRadius:`50%`,background:`#9ca3af`,animation:`fe-dot-bounce 1.2s ease-in-out ${e*.2}s infinite`,display:`inline-block`}},e))})]}),(0,V.jsx)(`div`,{ref:u}),d&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>f(null),style:{position:`fixed`,inset:0,zIndex:1e4,border:0,padding:`16px`,margin:0,background:`rgba(2,6,23,0.88)`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`default`},children:(0,V.jsxs)(`div`,{style:{position:`relative`,maxWidth:`min(96vw, 1100px)`,maxHeight:`96vh`,width:`100%`,display:`flex`,flexDirection:`column`,gap:`10px`,alignItems:`center`},children:[(0,V.jsx)(`img`,{src:d.url,alt:d.name,style:{width:`100%`,maxHeight:`calc(96vh - 72px)`,objectFit:`contain`,borderRadius:`16px`,boxShadow:`0 30px 80px rgba(0,0,0,0.42)`}}),(0,V.jsx)(`div`,{style:{maxWidth:`100%`,padding:`8px 14px`,borderRadius:`9999px`,background:`rgba(255,255,255,0.92)`,color:`#0f172a`,fontSize:`12px`,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:d.name})]})})]})}var Hh=typeof window<`u`&&(window.matchMedia?.(`(pointer: coarse)`).matches||navigator.maxTouchPoints>0);function Uh({input:e,setInput:t,onSubmit:n,isConversationEnded:r,callUiActive:i,handleToggleVoice:a,activeScreen:o,inputDisabled:s,replyContext:c,clearReplyContext:l,requiresEmail:u,emailInput:d,setEmailInput:f,emailError:p,showVoiceToggle:m=!1,voiceEnabled:h=!0,onFileSelect:g,selectedFile:_=null,onRemoveSelectedFile:v,attachmentError:y=``,isUploadingAttachment:x=!1,inputPlaceholder:S=`Type your message`}){let C=(0,b.useRef)(null),w=(0,b.useRef)(null),T=e=>{e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,120)}px`)};(0,b.useEffect)(()=>{u||T(w.current)},[e,u]),(0,b.useEffect)(()=>{u||Hh||e||s||w.current?.focus()},[e,u,s]);let E=e=>{e.key===`Enter`&&(Hh||e.shiftKey||e.altKey||e.ctrlKey||e.metaKey||(e.preventDefault(),e.currentTarget.form?.requestSubmit()))},ee=c?.sender===`user`?`You`:c?.sender===`agent`?`Agent`:`AI Assistant`,D=u?!!d?.trim():!!e?.trim()||!!_,O=s||x||!D,k=!u&&h&&m;return(0,V.jsxs)(`div`,{style:{padding:`0 16px`,background:`transparent`},children:[c&&(0,V.jsxs)(`div`,{style:{marginBottom:`8px`,display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:`12px`,borderRadius:`16px`,border:`1px solid rgba(0,0,0,0.05)`,background:`#fff`,padding:`12px 16px`,boxShadow:`0 8px 24px rgba(0,0,0,0.05)`},children:[(0,V.jsxs)(`div`,{style:{minWidth:0,flex:1,borderLeft:`2px solid var(--flowengage-primary)`,paddingLeft:`12px`},children:[(0,V.jsxs)(`div`,{style:{fontSize:`12px`,fontWeight:600,color:`var(--flowengage-primary)`},children:[`Replying to `,ee]}),(0,V.jsx)(`div`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontSize:`12px`,color:`#6b7280`},children:c.replyToContent||c.message})]}),(0,V.jsx)(`button`,{type:`button`,style:{width:`28px`,height:`28px`,borderRadius:`9999px`,border:0,background:`#f3f4f6`,color:`#6b7280`,transition:`color 0.2s ease, background 0.2s ease`,cursor:`pointer`},onClick:l,"aria-label":`Cancel reply`,onMouseEnter:e=>{e.currentTarget.style.background=`#e5e7eb`,e.currentTarget.style.color=`#374151`},onMouseLeave:e=>{e.currentTarget.style.background=`#f3f4f6`,e.currentTarget.style.color=`#6b7280`},children:`×`})]}),u&&(0,V.jsx)(`div`,{style:{marginBottom:`8px`,padding:`0 8px`},children:(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`8px`,color:`#111827`,fontSize:`14px`,fontWeight:500,textAlign:`center`},children:[(0,V.jsx)(`span`,{style:{display:`inline-flex`,width:`22px`,height:`22px`,borderRadius:`9999px`,alignItems:`center`,justifyContent:`center`,background:`rgba(59,130,246,0.08)`,color:`var(--flowengage-primary)`},children:(0,V.jsx)(vh,{size:13})}),(0,V.jsx)(`span`,{children:`Please provide your email address so we can help you.`})]})}),_&&!u&&(0,V.jsxs)(`div`,{style:{marginBottom:`10px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`12px`,borderRadius:`16px`,border:`1px solid rgba(0,0,0,0.06)`,background:`#fff`,padding:`12px 14px`,boxShadow:`0 8px 24px rgba(0,0,0,0.05)`},children:[(0,V.jsxs)(`div`,{style:{minWidth:0,flex:1},children:[(0,V.jsx)(`div`,{style:{fontSize:`12px`,fontWeight:600,color:`var(--flowengage-primary)`,marginBottom:`2px`},children:`Attachment ready`}),(0,V.jsx)(`div`,{style:{fontSize:`13px`,color:`#111827`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:Rh(_)}),(0,V.jsx)(`div`,{style:{fontSize:`12px`,color:`#6b7280`,marginTop:`2px`},children:Lh(_.size)})]}),(0,V.jsx)(`button`,{type:`button`,style:{width:`28px`,height:`28px`,borderRadius:`9999px`,border:0,background:`#f3f4f6`,color:`#6b7280`,transition:`color 0.2s ease, background 0.2s ease`,cursor:`pointer`,flexShrink:0},onClick:v,"aria-label":`Remove attachment`,onMouseEnter:e=>{e.currentTarget.style.background=`#e5e7eb`,e.currentTarget.style.color=`#374151`},onMouseLeave:e=>{e.currentTarget.style.background=`#f3f4f6`,e.currentTarget.style.color=`#6b7280`},children:`×`})]}),(0,V.jsxs)(`form`,{style:{display:`flex`,alignItems:`flex-end`,gap:`8px`,minHeight:`40px`,padding:`4px`,border:`1px solid rgba(0,0,0,0.06)`,borderRadius:`20px`,background:`#fff`,boxShadow:`0 4px 14px rgba(0,0,0,0.04)`,opacity:1},onSubmit:n,children:[k?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`input`,{ref:C,type:`file`,accept:Ph,style:{display:`none`},onChange:e=>{let t=e.target.files?.[0];t&&g?.(t),e.target.value=``}}),(0,V.jsx)(`button`,{type:`button`,style:{width:`32px`,height:`32px`,borderRadius:`9999px`,background:`#f3f4f8`,color:`var(--flowengage-primary)`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`background 0.2s ease, opacity 0.2s ease`,border:0,cursor:`pointer`,flexShrink:0},onClick:()=>C.current?.click(),title:`Attach file`,"aria-label":`Attach file`,disabled:x,onMouseEnter:e=>{e.currentTarget.style.opacity=`0.8`},onMouseLeave:e=>{e.currentTarget.style.opacity=`1`},children:(0,V.jsx)(yh,{size:16,color:`currentColor`})})]}):null,u?(0,V.jsx)(`input`,{className:`flowengage-chat-text-input`,style:{flex:1,minWidth:0,border:`none`,fontFamily:`inherit`,fontSize:`14px`,outline:`none`,padding:0,paddingLeft:k?`0`:`8px`,color:`#111827`,background:`transparent`,cursor:`text`,alignSelf:`center`},value:d,onChange:e=>f(e.target.value),placeholder:`Enter your Email`,disabled:s,type:`email`,autoComplete:`email`}):(0,V.jsx)(`textarea`,{ref:w,className:`flowengage-chat-text-input`,rows:1,style:{flex:1,minWidth:0,border:`none`,fontFamily:`inherit`,fontSize:`14px`,lineHeight:`20px`,outline:`none`,padding:`6px 0`,paddingLeft:k?`0`:`8px`,color:`#111827`,background:`transparent`,cursor:`text`,resize:`none`,maxHeight:`120px`,overflowY:`auto`},value:e,onChange:e=>{t(e.target.value),T(e.target)},onKeyDown:E,placeholder:o===`agent`?`Message the agent…`:S,disabled:s,autoComplete:`off`}),(0,V.jsx)(`button`,{type:`submit`,style:{width:`32px`,height:`32px`,borderRadius:`9999px`,background:`var(--flowengage-primary)`,color:`#fff`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`opacity 0.2s ease`,cursor:O?`not-allowed`:`pointer`,opacity:O?.45:1,flexShrink:0},disabled:O,onMouseEnter:e=>{O||(e.currentTarget.style.opacity=`0.85`)},onMouseLeave:e=>{e.currentTarget.style.opacity=`1`},children:(0,V.jsx)(mh,{size:16})})]}),!u&&y&&(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`5px`,padding:`7px 4px 0`},children:[(0,V.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`#dc2626`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:[(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,V.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,V.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),(0,V.jsx)(`span`,{style:{fontSize:`11px`,color:`#dc2626`,fontWeight:500},children:y})]}),u&&p&&(0,V.jsx)(`div`,{style:{padding:`8px 16px 0`,fontSize:`12px`,fontWeight:500,color:`#f43f5e`},children:p})]})}function Wh({webRTCError:e,micError:t,setMicError:n,dismissCallError:r,isRateLimited:i,rateLimitMessage:a}){return(0,V.jsxs)(V.Fragment,{children:[(e||t)&&(0,V.jsxs)(`div`,{style:{margin:`0 20px 10px`,padding:`12px 16px`,borderRadius:`12px`,background:`#fef2f2`,border:`1px solid #fee2e2`,display:`flex`,alignItems:`flex-start`,gap:`10px`},children:[(0,V.jsx)(_h,{className:``}),(0,V.jsx)(`span`,{style:{fontSize:`12px`,color:`#b91c1c`,lineHeight:1.5,flex:1},children:e||t}),(0,V.jsx)(`button`,{style:{flexShrink:0,background:`transparent`,border:0,color:`#f87171`,cursor:`pointer`,fontSize:`18px`,lineHeight:1},onClick:()=>{n(null),r()},onMouseEnter:e=>{e.currentTarget.style.color=`#dc2626`},onMouseLeave:e=>{e.currentTarget.style.color=`#f87171`},children:`×`})]}),i&&(0,V.jsx)(`div`,{style:{margin:`0 20px 10px`,padding:`12px 16px`,fontSize:`13px`,borderRadius:`12px`,background:`#fee2e2`,color:`#991b1b`},children:a})]})}var Gh=[`#135bd8`,`#ef334b`,`#ffbd2e`];function Kh(e){return!Array.isArray(e)||e.length===0?Gh:e.length===1?[e[0],e[0],e[0]]:e.length===2?[e[0],e[1],e[0]]:[e[0],e[1],e[2]]}var qh={idle:3,listening:.75,thinking:1,speaking:1.4,muted:.75,error:.08};function Jh(e){if(!e||typeof e!=`string`)return[0,0,0];let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;return[parseInt(n.slice(0,2),16)/255,parseInt(n.slice(2,4),16)/255,parseInt(n.slice(4,6),16)/255]}function Yh(e,t){if(!e||typeof e!=`string`)return`rgba(0,0,0,${t})`;if(e.startsWith(`rgb`))return e.replace(/[\d.]+\)$/,`${t})`);let n=e.replace(`#`,``),r=n.length===3?n.split(``).map(e=>e+e).join(``):n;return`rgba(${parseInt(r.slice(0,2),16)},${parseInt(r.slice(2,4),16)},${parseInt(r.slice(4,6),16)},${t})`}var Xh=`
|
|
41
|
+
attribute vec2 a_pos;
|
|
42
|
+
varying vec2 v_uv;
|
|
43
|
+
void main() {
|
|
44
|
+
v_uv = a_pos * 0.5 + 0.5;
|
|
45
|
+
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
46
|
+
}
|
|
47
|
+
`,Zh=`
|
|
48
|
+
precision highp float;
|
|
49
|
+
|
|
50
|
+
varying vec2 v_uv;
|
|
51
|
+
uniform float u_time;
|
|
52
|
+
uniform float u_speed;
|
|
53
|
+
uniform vec3 u_c1;
|
|
54
|
+
uniform vec3 u_c2;
|
|
55
|
+
uniform vec3 u_c3;
|
|
56
|
+
|
|
57
|
+
// ── Gradient noise ─────────────────────────────────────────────────────────
|
|
58
|
+
vec2 hash2(vec2 p) {
|
|
59
|
+
p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));
|
|
60
|
+
return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);
|
|
61
|
+
}
|
|
62
|
+
float gnoise(vec2 p) {
|
|
63
|
+
vec2 i = floor(p), f = fract(p);
|
|
64
|
+
vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);
|
|
65
|
+
return mix(
|
|
66
|
+
mix(dot(hash2(i), f),
|
|
67
|
+
dot(hash2(i+vec2(1,0)), f-vec2(1,0)), u.x),
|
|
68
|
+
mix(dot(hash2(i+vec2(0,1)), f-vec2(0,1)),
|
|
69
|
+
dot(hash2(i+vec2(1,1)), f-vec2(1,1)), u.x),
|
|
70
|
+
u.y
|
|
71
|
+
) * 0.5 + 0.5;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ── 3-octave FBM normalised to [0,1] — fewer octaves → larger, softer blobs
|
|
75
|
+
float fbm(vec2 p) {
|
|
76
|
+
float v = 0.0, a = 0.5;
|
|
77
|
+
for (int i = 0; i < 3; i++) {
|
|
78
|
+
v += a * gnoise(p);
|
|
79
|
+
p = p * 2.1 + vec2(100.0);
|
|
80
|
+
a *= 0.5;
|
|
81
|
+
}
|
|
82
|
+
return v / 0.875;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ── Scalar hash for grain ──────────────────────────────────────────────────
|
|
86
|
+
float hash1(vec2 p) {
|
|
87
|
+
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
void main() {
|
|
91
|
+
vec2 uv = v_uv;
|
|
92
|
+
float t = u_time * u_speed + 47.3;
|
|
93
|
+
|
|
94
|
+
// ── ① Two-level domain warp — deep organic folding and swirling ───────────
|
|
95
|
+
// First pass: large-scale sweep
|
|
96
|
+
vec2 q = vec2(
|
|
97
|
+
fbm(uv * 1.8 + vec2( t * 0.13, t * 0.11)) * 2.0 - 1.0,
|
|
98
|
+
fbm(uv * 1.8 + vec2( t * 0.11 + 3.7, -t * 0.14 + 1.1)) * 2.0 - 1.0
|
|
99
|
+
);
|
|
100
|
+
// Second pass: warp the warp — creates curling, folding sub-currents
|
|
101
|
+
vec2 r = vec2(
|
|
102
|
+
fbm(uv * 1.8 + q * 0.55 + vec2( t * 0.09, t * 0.07)) * 2.0 - 1.0,
|
|
103
|
+
fbm(uv * 1.8 + q * 0.55 + vec2(-t * 0.07 + 5.1, t * 0.10 + 2.3)) * 2.0 - 1.0
|
|
104
|
+
);
|
|
105
|
+
vec2 wp = uv + r * 0.38;
|
|
106
|
+
|
|
107
|
+
// ── ② Three independent fields — each drifts inward from its source edge ──
|
|
108
|
+
// Asymmetric velocities: dominant axis matches the inflow direction so the
|
|
109
|
+
// noise texture visually streams inward (left→right, right→left, bottom→top).
|
|
110
|
+
float f1 = fbm(wp * 0.85 + vec2(-t * 0.18, t * 0.04)); // LEFT → right
|
|
111
|
+
float f2 = fbm(wp * 0.85 + vec2( t * 0.18 + 5.3, t * 0.04 + 1.7)); // RIGHT → left
|
|
112
|
+
float f3 = fbm(wp * 0.85 + vec2( t * 0.04 - 3.2, -t * 0.18 + 6.4)); // BOTTOM → up
|
|
113
|
+
|
|
114
|
+
// ── ③ Breathing blobs — sin pulse makes each field expand and contract ────
|
|
115
|
+
float p1 = 0.88 + 0.12 * sin(t * 0.61);
|
|
116
|
+
float p2 = 0.88 + 0.12 * sin(t * 0.47 + 2.09);
|
|
117
|
+
float p3 = 0.88 + 0.12 * sin(t * 0.53 + 4.19);
|
|
118
|
+
|
|
119
|
+
// Wide smoothstep (0.26 → 0.70) → soft, diffused blob edges that dissolve
|
|
120
|
+
// gradually into each other, like dye spreading through water.
|
|
121
|
+
float b1 = smoothstep(0.26, 0.70, f1 * p1);
|
|
122
|
+
float b2 = smoothstep(0.26, 0.70, f2 * p2);
|
|
123
|
+
float b3 = smoothstep(0.26, 0.70, f3 * p3);
|
|
124
|
+
|
|
125
|
+
// ── ④ Directional origin gradients.
|
|
126
|
+
// Each color owns its home edge (value = 1.0) and smoothly fades to zero
|
|
127
|
+
// before reaching the opposite side. The transition windows are offset so
|
|
128
|
+
// they overlap only in the center third — that overlap zone is where the
|
|
129
|
+
// three colors meet and blend, while the edges stay uncontaminated.
|
|
130
|
+
float d1 = 1.0 - smoothstep(0.20, 0.74, uv.x); // c1: LEFT → full at x<0.20, zero by x=0.74
|
|
131
|
+
float d2 = 1.0 - smoothstep(0.20, 0.74, 1.0 - uv.x); // c2: RIGHT → full at x>0.80, zero by x=0.26
|
|
132
|
+
float d3 = 1.0 - smoothstep(0.18, 0.68, uv.y); // c3: BOTTOM → full at y<0.18, zero by y=0.68
|
|
133
|
+
|
|
134
|
+
float w1 = b1 * d1;
|
|
135
|
+
float w2 = b2 * d2;
|
|
136
|
+
float w3 = b3 * d3;
|
|
137
|
+
|
|
138
|
+
// ── ⑤ Dye-mixing colour blend ──────────────────────────────────────────────
|
|
139
|
+
// dyeColor is the weighted average of all active colours — exactly how dyes
|
|
140
|
+
// mix in water: overlapping streams blend smoothly, no hard edges.
|
|
141
|
+
float total = w1 + w2 + w3;
|
|
142
|
+
vec3 dyeColor = (u_c1 * w1 + u_c2 * w2 + u_c3 * w3) / max(total, 0.001);
|
|
143
|
+
|
|
144
|
+
// Boost brightness of the dye to make colors pop and seem less dull
|
|
145
|
+
dyeColor *= 1.65;
|
|
146
|
+
|
|
147
|
+
// Exponential coverage: cores are rich and opaque; edges dissolve into the
|
|
148
|
+
// near-white base. White only shows through where dye concentration is thin.
|
|
149
|
+
float coverage = 1.0 - exp(-total * 5.0);
|
|
150
|
+
vec3 col = mix(vec3(1.0, 1.0, 1.0), dyeColor, coverage);
|
|
151
|
+
col = clamp(col, 0.0, 1.0);
|
|
152
|
+
|
|
153
|
+
// ── ⑥ Sphere shading — subtle edge vignette only, no specular ─────────────
|
|
154
|
+
vec2 uvc = v_uv * 2.0 - 1.0;
|
|
155
|
+
|
|
156
|
+
// ── ⑦ Subtle grain — breaks gradient banding, adds filmic texture ──────────
|
|
157
|
+
float grain = hash1(v_uv * 437.3 + fract(t)) * 2.0 - 1.0;
|
|
158
|
+
col += grain * 0.018;
|
|
159
|
+
|
|
160
|
+
gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);
|
|
161
|
+
}
|
|
162
|
+
`;function Qh(e,t,n){let r=(t,n)=>{let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS)?r:(console.error(`[AnimatedOrb shader]`,e.getShaderInfoLog(r)),null)},i=r(e.VERTEX_SHADER,t),a=r(e.FRAGMENT_SHADER,n);if(!i||!a)return null;let o=e.createProgram();return e.attachShader(o,i),e.attachShader(o,a),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS)?o:(console.error(`[AnimatedOrb link]`,e.getProgramInfoLog(o)),null)}function $h({size:e=94,voiceState:t=`idle`,isMuted:n=!1,colors:r,onClick:i,style:a,className:o}){let[s,c,l]=Kh(r),u=t===`speaking`,d=e<=50,f=(0,b.useRef)(null),p=(0,b.useRef)(qh[t]??.35);(0,b.useEffect)(()=>{p.current=qh[t]??.35},[t]),(0,b.useEffect)(()=>{let t=f.current;if(!t)return;let n=Math.min(window.devicePixelRatio||1,2);t.width=e*n,t.height=e*n;let r=t.getContext(`webgl`,{alpha:!0,antialias:!0})||t.getContext(`experimental-webgl`,{alpha:!0,antialias:!0});if(!r){console.warn(`[AnimatedOrb] WebGL unavailable.`);return}let i=Qh(r,Xh,Zh);if(!i){console.error(`[AnimatedOrb] WebGL program failed to compile/link`);return}r.useProgram(i);let a=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,a),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),r.STATIC_DRAW);let o=r.getAttribLocation(i,`a_pos`);r.enableVertexAttribArray(o),r.vertexAttribPointer(o,2,r.FLOAT,!1,0,0);let u={time:r.getUniformLocation(i,`u_time`),speed:r.getUniformLocation(i,`u_speed`),c1:r.getUniformLocation(i,`u_c1`),c2:r.getUniformLocation(i,`u_c2`),c3:r.getUniformLocation(i,`u_c3`)};r.uniform3fv(u.c1,Jh(s)),r.uniform3fv(u.c2,Jh(c)),r.uniform3fv(u.c3,Jh(l)),r.viewport(0,0,t.width,t.height);let d=performance.now(),m,h=e=>{r.uniform1f(u.time,(e-d)/1e3),r.uniform1f(u.speed,p.current),r.drawArrays(r.TRIANGLES,0,6),m=requestAnimationFrame(h)};return m=requestAnimationFrame(h),()=>{cancelAnimationFrame(m),r.deleteProgram(i),r.deleteBuffer(a)}},[s,c,l,e]);let m=n?`saturate(0.3) brightness(1.1)`:t===`error`?`saturate(0.4) hue-rotate(28deg)`:`none`;return(0,V.jsxs)(`div`,{style:{position:`relative`,width:e,height:e,flexShrink:0,cursor:i?`pointer`:`default`,...a},className:o,onClick:i,children:[u&&!d&&(0,V.jsx)(Km.div,{style:{position:`absolute`,inset:-10,borderRadius:`50%`,background:`radial-gradient(circle, ${Yh(s,.18)} 0%, transparent 70%)`,pointerEvents:`none`},animate:{opacity:[.3,.75]},transition:{duration:1,repeat:1/0,repeatType:`mirror`,ease:`easeInOut`}}),(0,V.jsx)(`div`,{style:{width:e,height:e,borderRadius:`50%`,overflow:`hidden`,WebkitMaskImage:`-webkit-radial-gradient(white, black)`,filter:m,transition:`filter 1.2s ease`},children:(0,V.jsx)(`canvas`,{ref:f,style:{width:`100%`,height:`100%`,display:`block`}})}),u&&(0,V.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`50%`,pointerEvents:`none`,zIndex:1},children:(0,V.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`3px`},children:[4,8,12,8,4].map((e,t)=>(0,V.jsx)(Km.div,{style:{width:`3px`,borderRadius:`3px`,background:`rgba(255,255,255,0.85)`},animate:{height:[4,e+8,4]},transition:{duration:.48,delay:t*.08,repeat:1/0,ease:`easeInOut`}},t))})})]})}var eg=`
|
|
163
|
+
@keyframes fe-call-ring-pulse {
|
|
164
|
+
0% { transform: scale(1); opacity: 0.55; }
|
|
165
|
+
70% { transform: scale(1.85); opacity: 0; }
|
|
166
|
+
100% { transform: scale(1.85); opacity: 0; }
|
|
167
|
+
}
|
|
168
|
+
@keyframes fe-call-spin {
|
|
169
|
+
to { transform: rotate(360deg); }
|
|
170
|
+
}
|
|
171
|
+
@keyframes fe-call-slide-up {
|
|
172
|
+
from { opacity: 0; transform: translateY(24px); }
|
|
173
|
+
to { opacity: 1; transform: translateY(0); }
|
|
174
|
+
}
|
|
175
|
+
@keyframes fe-call-fade-in {
|
|
176
|
+
from { opacity: 0; }
|
|
177
|
+
to { opacity: 1; }
|
|
178
|
+
}
|
|
179
|
+
@keyframes fe-call-bar-slide-in {
|
|
180
|
+
from { opacity: 0; transform: translateY(10px) scale(0.97); }
|
|
181
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
182
|
+
}
|
|
183
|
+
@keyframes fe-call-dot-blink {
|
|
184
|
+
0%, 100% { opacity: 1; }
|
|
185
|
+
50% { opacity: 0.35; }
|
|
186
|
+
}
|
|
187
|
+
@keyframes fe-call-avatar-breathe {
|
|
188
|
+
0%, 100% { opacity: 0.5; transform: scale(1); }
|
|
189
|
+
50% { opacity: 0.9; transform: scale(1.12); }
|
|
190
|
+
}
|
|
191
|
+
`;function tg(e){let t=(e||``).replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;return`${parseInt(n.slice(0,2),16)},${parseInt(n.slice(2,4),16)},${parseInt(n.slice(4,6),16)}`}function ng(e){if(!e||typeof e!=`string`)return`#1a1a1a`;let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=parseInt(n.slice(0,2),16)/255,i=parseInt(n.slice(2,4),16)/255,a=parseInt(n.slice(4,6),16)/255,o=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;return .2126*o(r)+.7152*o(i)+.0722*o(a)>.179?`#1a1a1a`:`#ffffff`}function rg(e,t){let n=Array.isArray(e)&&e.length>0?e:[t||`#3B82F6`],[r,i,a]=n;return n.length===1?[`radial-gradient(ellipse 110% 65% at 50% -5%, ${r}28 0%, transparent 68%)`,`radial-gradient(ellipse 90% 55% at 50% 108%, ${r}1a 0%, transparent 65%)`,`#f7f8fa`].join(`, `):n.length===2?[`radial-gradient(ellipse 80% 100% at -10% 50%, ${r}22 0%, transparent 70%)`,`radial-gradient(ellipse 80% 100% at 110% 50%, ${i}1a 0%, transparent 70%)`,`#f7f8fa`].join(`, `):[`radial-gradient(ellipse 80% 70% at -10% 50%, ${r}22 0%, transparent 70%)`,`radial-gradient(ellipse 70% 80% at 110% 30%, ${i}1a 0%, transparent 70%)`,`radial-gradient(ellipse 80% 60% at 50% 110%, ${a}1a 0%, transparent 70%)`,`#f7f8fa`].join(`, `)}function ig({headshot:e,name:t,size:n=80,primaryColor:r=`#3B82F6`}){let i=(t||`A`)[0].toUpperCase(),a=ng(r),o=n>48?{boxShadow:`0 0 0 3px ${r}44`,border:`3px solid rgba(255,255,255,0.15)`}:{border:`1.5px solid ${r}55`};return e?(0,V.jsx)(`img`,{src:e,alt:t||`Agent`,style:{width:n,height:n,borderRadius:`50%`,objectFit:`cover`,position:`relative`,zIndex:1,flexShrink:0,...o}}):(0,V.jsx)(`div`,{style:{width:n,height:n,borderRadius:`50%`,background:`linear-gradient(135deg, ${r}, ${r}99)`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:Math.round(n*.36)+`px`,fontWeight:700,color:a,position:`relative`,zIndex:1,flexShrink:0,...o},children:i})}function ag(e){let t=(0,b.useRef)(null),n=(0,b.useCallback)(()=>{if(!t.current)return;let{audioContext:e,oscillator:n,interval:r,toneTimeout:i}=t.current;window.clearInterval(r),window.clearTimeout(i);try{n.stop()}catch{}try{e.close()}catch{}t.current=null},[]),r=(0,b.useCallback)(()=>{if(t.current||typeof window>`u`)return;let e=window.AudioContext||window.webkitAudioContext||null;if(e)try{let n=new e,r=n.createOscillator(),i=n.createGain();r.connect(i),i.connect(n.destination),r.frequency.value=0,r.type=`sine`,i.gain.value=.3;let a=()=>{t.current&&(window.clearTimeout(t.current.toneTimeout),r.frequency.value=440,t.current.toneTimeout=window.setTimeout(()=>{r.frequency.value=0},400))};n.state===`suspended`&&n.resume().catch(e=>{console.warn(`[FlowEngage] ringtone autoplay blocked`,e)}),r.start(),t.current={audioContext:n,oscillator:r,interval:null,toneTimeout:null},a(),t.current.interval=window.setInterval(a,1e3)}catch(e){console.warn(`[FlowEngage] failed to start ringtone`,e)}},[]);return(0,b.useEffect)(()=>{if(e){r();return}n()},[e,r,n]),(0,b.useEffect)(()=>()=>n(),[n]),n}function og({incomingCall:e,activeCallId:t,callConnectionState:n,callDurationSeconds:r,isCallMuted:i,agentName:a,agentHeadshot:o,fallbackAgentName:s,acceptCall:c,rejectCall:l,endWebRTCCall:u,toggleCallMute:d,formatCallDuration:f,onMinimize:p,primaryColor:m=`#3B82F6`,orbColors:h,chatHistory:g=[]}){let _=a||s||`Agent`,v=e?`incoming`:n===`connecting`?`connecting`:`ongoing`,y=ag(!!e),b=async()=>{y(),await c()},x=async()=>{y(),await l()},S=i?`muted`:n===`connecting`?`idle`:`listening`,C=v===`ongoing`,w={position:`absolute`,inset:0,zIndex:10,display:`flex`,flexDirection:`column`,borderRadius:`inherit`,overflow:`hidden`,background:rg(h,m),animation:C?`fe-call-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)`:`fe-call-fade-in 0.32s ease`};if(v===`incoming`){let e=Array.isArray(h)&&h.length>0?h:[m];return(0,V.jsxs)(`div`,{style:w,children:[(0,V.jsx)(`style`,{children:eg}),(0,V.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`space-between`,padding:`60px 32px 56px`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`22px`},children:[(0,V.jsxs)(`div`,{style:{position:`relative`,width:`96px`,height:`96px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,V.jsx)(`div`,{style:{position:`absolute`,width:`96px`,height:`96px`,borderRadius:`50%`,background:`radial-gradient(circle, rgba(${tg(e[0])},0.2) 0%, transparent 70%)`,filter:`blur(10px)`,zIndex:0}}),[0,.5,1].map((t,n)=>(0,V.jsx)(`div`,{style:{position:`absolute`,width:`96px`,height:`96px`,borderRadius:`50%`,border:`1.5px solid ${e[n%e.length]}`,animation:`fe-call-ring-pulse 2.6s cubic-bezier(0.215,0.61,0.355,1) ${t}s infinite`,zIndex:1}},n)),(0,V.jsx)(ig,{headshot:o,name:_,size:82,primaryColor:m})]}),(0,V.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,V.jsx)(`div`,{style:{fontSize:`22px`,fontWeight:700,color:`#111827`,letterSpacing:`-0.015em`,lineHeight:1.2},children:_}),(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`6px`,marginTop:`8px`},children:[(0,V.jsx)(`div`,{style:{width:`7px`,height:`7px`,borderRadius:`50%`,background:e[0],boxShadow:`0 0 5px ${e[0]}88`,animation:`fe-call-dot-blink 1.4s ease-in-out infinite`}}),(0,V.jsx)(`span`,{style:{fontSize:`13px`,color:`#6b7280`,letterSpacing:`0.01em`},children:`Incoming call`})]})]})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,gap:`56px`,alignItems:`flex-end`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`button`,{type:`button`,onClick:x,style:{width:`68px`,height:`68px`,borderRadius:`50%`,background:`#ef4444`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`white`,boxShadow:`0 6px 24px rgba(239,68,68,0.5)`,transition:`transform 0.15s ease, box-shadow 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.08)`,e.currentTarget.style.boxShadow=`0 8px 28px rgba(239,68,68,0.65)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`,e.currentTarget.style.boxShadow=`0 6px 24px rgba(239,68,68,0.5)`},"aria-label":`Decline call`,children:(0,V.jsx)(ph,{size:26})}),(0,V.jsx)(`span`,{style:{fontSize:`12px`,color:`#6b7280`,fontWeight:500,letterSpacing:`0.01em`},children:`Decline`})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`10px`},children:[(0,V.jsx)(`button`,{type:`button`,onClick:b,style:{width:`68px`,height:`68px`,borderRadius:`50%`,background:`#22c55e`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`white`,boxShadow:`0 6px 24px rgba(34,197,94,0.5)`,transition:`transform 0.15s ease, box-shadow 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.08)`,e.currentTarget.style.boxShadow=`0 8px 28px rgba(34,197,94,0.65)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`,e.currentTarget.style.boxShadow=`0 6px 24px rgba(34,197,94,0.5)`},"aria-label":`Accept call`,children:(0,V.jsx)(gh,{})}),(0,V.jsx)(`span`,{style:{fontSize:`12px`,color:`#6b7280`,fontWeight:500,letterSpacing:`0.01em`},children:`Accept`})]})]})]})]})}return v===`connecting`?(0,V.jsxs)(`div`,{style:w,children:[(0,V.jsx)(`style`,{children:eg}),(0,V.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`24px`},children:[(0,V.jsx)(ig,{headshot:o,name:_,size:64,primaryColor:m}),(0,V.jsx)(`div`,{style:{width:`48px`,height:`48px`,borderRadius:`50%`,border:`3px solid rgba(255,255,255,0.12)`,borderTopColor:Array.isArray(h)&&h[0]||m,animation:`fe-call-spin 0.9s linear infinite`}}),(0,V.jsx)(`span`,{style:{fontSize:`15px`,color:`#6b7280`,letterSpacing:`0.01em`},children:`Connecting…`})]})]}):(0,V.jsxs)(`div`,{style:w,children:[(0,V.jsx)(`style`,{children:eg}),(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`16px 16px 10px`,gap:`10px`,flexShrink:0},children:[(0,V.jsx)(`button`,{type:`button`,onClick:p,style:{width:`40px`,height:`40px`,borderRadius:`50%`,background:`rgba(0,0,0,0.06)`,border:`1px solid rgba(0,0,0,0.1)`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#374151`,transition:`background 0.15s ease`,flexShrink:0},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(0,0,0,0.11)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(0,0,0,0.06)`},"aria-label":`Minimize call`,children:(0,V.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`polyline`,{points:`15 18 9 12 15 6`})})}),(0,V.jsx)($h,{colors:h,size:36,voiceState:S}),(0,V.jsx)(`div`,{style:{flex:1,minWidth:0,fontSize:`15px`,fontWeight:600,color:`#111827`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:_}),(0,V.jsx)(`div`,{style:{flexShrink:0,padding:`3px 10px`,borderRadius:`999px`,background:`${m}18`,border:`1px solid ${m}44`,display:`flex`,alignItems:`center`},children:(0,V.jsx)(`span`,{style:{fontSize:`11px`,fontWeight:600,color:m,letterSpacing:`0.02em`,lineHeight:1},children:`On Call`})})]}),(0,V.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`16px`,padding:`0 24px 16px`},children:[(0,V.jsx)(ig,{headshot:o,name:_,size:116,primaryColor:m}),(0,V.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,V.jsx)(`div`,{style:{fontSize:`20px`,fontWeight:700,color:`#111827`,letterSpacing:`-0.01em`},children:_}),(0,V.jsx)(`div`,{style:{marginTop:`8px`,fontSize:`24px`,fontWeight:300,color:`#9ca3af`,letterSpacing:`0.06em`,fontVariantNumeric:`tabular-nums`},children:f(r)})]})]}),(0,V.jsxs)(`div`,{style:{flexShrink:0,display:`flex`,gap:`12px`,padding:`16px 24px 40px`},children:[(0,V.jsxs)(`button`,{type:`button`,onClick:d,style:{flex:1,height:`54px`,borderRadius:`14px`,background:i?`rgba(239,68,68,0.1)`:`rgba(0,0,0,0.06)`,border:i?`1.5px solid rgba(239,68,68,0.4)`:`1.5px solid rgba(0,0,0,0.1)`,cursor:`pointer`,color:i?`#ef4444`:`#374151`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`8px`,fontSize:`14px`,fontWeight:600,transition:`all 0.2s ease`},"aria-label":i?`Unmute`:`Mute`,children:[i?(0,V.jsx)(Ch,{size:18}):(0,V.jsx)(fh,{size:18}),i?`Unmute`:`Mute`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:u,style:{flex:1,height:`54px`,borderRadius:`14px`,background:`rgba(239,68,68,0.9)`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`8px`,color:`white`,fontSize:`14px`,fontWeight:600,boxShadow:`0 4px 20px rgba(239,68,68,0.38)`,transition:`transform 0.15s ease, background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#ef4444`,e.currentTarget.style.transform=`scale(1.02)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(239,68,68,0.9)`,e.currentTarget.style.transform=`scale(1)`},"aria-label":`End call`,children:[(0,V.jsx)(ph,{size:18}),`End Call`]})]})]})}function sg({agentName:e,agentHeadshot:t,fallbackAgentName:n,callDurationSeconds:r,isCallMuted:i,formatCallDuration:a,toggleCallMute:o,endWebRTCCall:s,onExpand:c,primaryColor:l=`#3B82F6`}){let u=e||n||`Agent`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`style`,{children:eg}),(0,V.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:c,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&c?.()},onMouseEnter:e=>{e.currentTarget.style.boxShadow=`0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.95)`,e.currentTarget.style.transform=`translateY(-2px)`},onMouseLeave:e=>{e.currentTarget.style.boxShadow=`0 4px 20px rgba(0,0,0,0.09), 0 1px 6px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.9)`,e.currentTarget.style.transform=`translateY(0)`},style:{display:`flex`,alignItems:`center`,gap:`12px`,padding:`10px 12px 10px 10px`,margin:`0 12px 8px`,borderRadius:`18px`,background:`rgba(255,255,255,0.88)`,backdropFilter:`blur(20px)`,WebkitBackdropFilter:`blur(20px)`,border:`1px solid rgba(255,255,255,0.65)`,boxShadow:`0 4px 20px rgba(0,0,0,0.09), 0 1px 6px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.9)`,cursor:`pointer`,animation:`fe-call-bar-slide-in 0.3s cubic-bezier(0.16,1,0.3,1)`,flexShrink:0,userSelect:`none`,outline:`none`,transition:`box-shadow 0.22s ease, transform 0.18s ease`},children:[(0,V.jsxs)(`div`,{style:{position:`relative`,flexShrink:0,width:`42px`,height:`42px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[(0,V.jsx)(`div`,{style:{position:`absolute`,inset:`-4px`,borderRadius:`50%`,background:`${l}28`,animation:`fe-call-avatar-breathe 2.8s ease-in-out infinite`}}),(0,V.jsx)(`div`,{style:{position:`absolute`,inset:`-2px`,borderRadius:`50%`,border:`1.5px solid ${l}55`}}),(0,V.jsx)(ig,{headshot:t,name:u,size:38,primaryColor:l})]}),(0,V.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,V.jsx)(`div`,{style:{fontSize:`13px`,fontWeight:600,color:`#111827`,lineHeight:1.3,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:u}),(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`5px`,marginTop:`3px`},children:[(0,V.jsx)(`div`,{style:{width:`6px`,height:`6px`,borderRadius:`50%`,background:`#22c55e`,flexShrink:0,boxShadow:`0 0 4px rgba(34,197,94,0.6)`,animation:`fe-call-dot-blink 1.6s ease-in-out infinite`}}),(0,V.jsxs)(`span`,{style:{fontSize:`12px`,color:`#6b7280`,fontVariantNumeric:`tabular-nums`,letterSpacing:`0.01em`},children:[`On Call\xA0•\xA0`,a(r)]})]})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`,flexShrink:0},children:[(0,V.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o()},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.12)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},style:{width:`36px`,height:`36px`,borderRadius:`50%`,background:i?`${l}18`:`rgba(0,0,0,0.05)`,border:i?`1.5px solid ${l}55`:`1.5px solid rgba(0,0,0,0.08)`,cursor:`pointer`,color:i?l:`#6b7280`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,transition:`all 0.18s ease`,boxShadow:i?`0 0 0 3px ${l}12`:`none`},"aria-label":i?`Unmute`:`Mute`,children:i?(0,V.jsx)(Ch,{size:15}):(0,V.jsx)(fh,{size:15})}),(0,V.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),s()},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.12)`,e.currentTarget.style.boxShadow=`0 4px 16px rgba(239,68,68,0.55)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`,e.currentTarget.style.boxShadow=`0 2px 10px rgba(239,68,68,0.35)`},style:{width:`36px`,height:`36px`,borderRadius:`50%`,background:`#ef4444`,border:`none`,cursor:`pointer`,color:`white`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,boxShadow:`0 2px 10px rgba(239,68,68,0.35)`,transition:`all 0.18s ease`},"aria-label":`End call`,children:(0,V.jsx)(ph,{size:16})})]})]})]})}function cg(e,t={}){let n=t.maxChars??4500;if(!Array.isArray(e)||e.length===0)return``;let r=[];for(let t of e){if(!t||t.isPending)continue;let e=String(t.sender||``).toLowerCase(),n=null;if(e===`user`?n=`Visitor`:(e===`bot`||e===`ai`||e===`agent`)&&(n=`Assistant`),!n)continue;let i=String(t.message||``).replace(/<[^>]+>/g,` `).replace(/\s+/g,` `).trim().slice(0,1200);i&&r.push(`${n}: ${i}`)}if(r.length===0)return``;let i=r.join(`
|
|
192
|
+
`);return i.length>n&&(i=`…(earlier messages omitted)
|
|
193
|
+
`+i.slice(-n)),i}var Q=`fe-vv`;function lg(){if(typeof document>`u`||document.getElementById(`${Q}-styles`))return;let e=`
|
|
194
|
+
/* ── Action toast ───────────────────────────────────────────────────────────── */
|
|
195
|
+
#${Q}-toast {
|
|
196
|
+
position: fixed;
|
|
197
|
+
top: 16px;
|
|
198
|
+
left: 50%;
|
|
199
|
+
transform: translateX(-50%) translateY(-160%);
|
|
200
|
+
background: rgba(10, 10, 20, 0.88);
|
|
201
|
+
color: #f1f5f9;
|
|
202
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
203
|
+
font-size: 13px;
|
|
204
|
+
font-weight: 500;
|
|
205
|
+
line-height: 1.4;
|
|
206
|
+
padding: 9px 18px 9px 14px;
|
|
207
|
+
border-radius: 999px;
|
|
208
|
+
z-index: 2147483640;
|
|
209
|
+
pointer-events: none;
|
|
210
|
+
opacity: 0;
|
|
211
|
+
transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
|
|
212
|
+
white-space: nowrap;
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: 9px;
|
|
216
|
+
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.2);
|
|
217
|
+
backdrop-filter: blur(12px);
|
|
218
|
+
-webkit-backdrop-filter: blur(12px);
|
|
219
|
+
border: 1px solid rgba(255,255,255,0.08);
|
|
220
|
+
max-width: 90vw;
|
|
221
|
+
overflow: hidden;
|
|
222
|
+
text-overflow: ellipsis;
|
|
223
|
+
}
|
|
224
|
+
#${Q}-toast.${Q}-show {
|
|
225
|
+
transform: translateX(-50%) translateY(0);
|
|
226
|
+
opacity: 1;
|
|
227
|
+
}
|
|
228
|
+
#${Q}-toast .${Q}-spin {
|
|
229
|
+
width: 13px;
|
|
230
|
+
height: 13px;
|
|
231
|
+
border: 2px solid rgba(255,255,255,0.25);
|
|
232
|
+
border-top-color: #a78bfa;
|
|
233
|
+
border-radius: 50%;
|
|
234
|
+
animation: ${Q}-spin 0.65s linear infinite;
|
|
235
|
+
flex-shrink: 0;
|
|
236
|
+
}
|
|
237
|
+
#${Q}-toast .${Q}-icon {
|
|
238
|
+
font-size: 14px;
|
|
239
|
+
flex-shrink: 0;
|
|
240
|
+
line-height: 1;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/* ── Navigation progress bar ────────────────────────────────────────────────── */
|
|
244
|
+
#${Q}-bar {
|
|
245
|
+
position: fixed;
|
|
246
|
+
top: 0;
|
|
247
|
+
left: 0;
|
|
248
|
+
width: 0%;
|
|
249
|
+
height: 3px;
|
|
250
|
+
background: linear-gradient(90deg, #7c3aed, #06b6d4, #7c3aed);
|
|
251
|
+
background-size: 200% 100%;
|
|
252
|
+
z-index: 2147483647;
|
|
253
|
+
pointer-events: none;
|
|
254
|
+
opacity: 0;
|
|
255
|
+
transition: width 0.35s ease, opacity 0.25s ease;
|
|
256
|
+
box-shadow: 0 0 12px #7c3aed88;
|
|
257
|
+
animation: ${Q}-bar-shimmer 1.5s linear infinite;
|
|
258
|
+
}
|
|
259
|
+
#${Q}-bar.${Q}-bar-active {
|
|
260
|
+
opacity: 1;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* ── Field active highlight (about to fill) ─────────────────────────────────── */
|
|
264
|
+
.${Q}-field-active {
|
|
265
|
+
outline: 2.5px solid #7c3aed !important;
|
|
266
|
+
outline-offset: 3px !important;
|
|
267
|
+
box-shadow: 0 0 0 5px rgba(124, 58, 237, 0.14), 0 0 20px rgba(124, 58, 237, 0.28) !important;
|
|
268
|
+
border-radius: 5px !important;
|
|
269
|
+
transition: outline 0.18s ease, box-shadow 0.18s ease !important;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* ── Field filled confirmation (green flash) ────────────────────────────────── */
|
|
273
|
+
.${Q}-field-filled {
|
|
274
|
+
outline: 2px solid #10b981 !important;
|
|
275
|
+
outline-offset: 3px !important;
|
|
276
|
+
box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12), 0 0 16px rgba(16, 185, 129, 0.22) !important;
|
|
277
|
+
border-radius: 5px !important;
|
|
278
|
+
animation: ${Q}-fill-flash 0.45s ease forwards !important;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* ── Ghost cursor ────────────────────────────────────────────────────────────── */
|
|
282
|
+
#${Q}-cursor {
|
|
283
|
+
position: fixed;
|
|
284
|
+
width: 22px;
|
|
285
|
+
height: 22px;
|
|
286
|
+
pointer-events: none;
|
|
287
|
+
z-index: 2147483645;
|
|
288
|
+
opacity: 0;
|
|
289
|
+
transition:
|
|
290
|
+
left 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94),
|
|
291
|
+
top 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94),
|
|
292
|
+
opacity 0.2s ease;
|
|
293
|
+
transform: translate(-4px, -4px);
|
|
294
|
+
}
|
|
295
|
+
#${Q}-cursor.${Q}-cursor-visible {
|
|
296
|
+
opacity: 1;
|
|
297
|
+
}
|
|
298
|
+
#${Q}-cursor.${Q}-cursor-click {
|
|
299
|
+
animation: ${Q}-cursor-click 0.25s ease;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* ── Click ripple ────────────────────────────────────────────────────────────── */
|
|
303
|
+
.${Q}-ripple {
|
|
304
|
+
position: absolute;
|
|
305
|
+
border-radius: 50%;
|
|
306
|
+
transform: scale(0);
|
|
307
|
+
background: rgba(124, 58, 237, 0.35);
|
|
308
|
+
animation: ${Q}-ripple-anim 0.55s linear forwards;
|
|
309
|
+
pointer-events: none;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* ── Keyframes ───────────────────────────────────────────────────────────────── */
|
|
313
|
+
@keyframes ${Q}-spin {
|
|
314
|
+
to { transform: rotate(360deg); }
|
|
315
|
+
}
|
|
316
|
+
@keyframes ${Q}-bar-shimmer {
|
|
317
|
+
0% { background-position: 0% 0%; }
|
|
318
|
+
100% { background-position: 200% 0%; }
|
|
319
|
+
}
|
|
320
|
+
@keyframes ${Q}-fill-flash {
|
|
321
|
+
0% { background-color: rgba(16, 185, 129, 0.10); }
|
|
322
|
+
40% { background-color: rgba(16, 185, 129, 0.22); }
|
|
323
|
+
100% { background-color: transparent; }
|
|
324
|
+
}
|
|
325
|
+
@keyframes ${Q}-ripple-anim {
|
|
326
|
+
to { transform: scale(3.5); opacity: 0; }
|
|
327
|
+
}
|
|
328
|
+
@keyframes ${Q}-cursor-click {
|
|
329
|
+
0% { transform: translate(-4px,-4px) scale(1); }
|
|
330
|
+
50% { transform: translate(-4px,-4px) scale(0.82); }
|
|
331
|
+
100% { transform: translate(-4px,-4px) scale(1); }
|
|
332
|
+
}
|
|
333
|
+
`,t=document.createElement(`style`);t.id=`${Q}-styles`,t.textContent=e,(document.head||document.documentElement).appendChild(t)}var ug=null,dg=null;function fg(){return(!ug||!ug.isConnected)&&(ug=document.createElement(`div`),ug.id=`${Q}-toast`,document.body.appendChild(ug)),ug}function pg(e,{spinner:t=!0,icon:n=null,duration:r=0}={}){if(typeof document>`u`)return;lg(),dg&&=(clearTimeout(dg),null);let i=fg();if(i.innerHTML=``,n){let e=document.createElement(`span`);e.className=`${Q}-icon`,e.textContent=n,i.appendChild(e)}else if(t){let e=document.createElement(`span`);e.className=`${Q}-spin`,i.appendChild(e)}let a=document.createElement(`span`);a.textContent=e,i.appendChild(a),i.classList.remove(`${Q}-show`),i.offsetHeight,i.classList.add(`${Q}-show`),r>0&&(dg=setTimeout(()=>mg(),r))}function mg(e=0){ug&&(e>0?dg=setTimeout(()=>{ug&&ug.classList.remove(`${Q}-show`)},e):ug&&ug.classList.remove(`${Q}-show`))}var hg=null,gg=[];function _g(){return(!hg||!hg.isConnected)&&(hg=document.createElement(`div`),hg.id=`${Q}-bar`,document.body.appendChild(hg)),hg}function vg(){if(typeof document>`u`)return;lg(),gg.forEach(clearTimeout),gg=[];let e=_g();e.style.transition=`none`,e.style.width=`0%`,e.classList.add(`${Q}-bar-active`),e.offsetHeight,e.style.transition=`width 0.35s ease, opacity 0.25s ease`;let t=[[80,`width 0.6s ease`],[92,`width 1.2s ease`]],n=50;for(let[e,r]of t){let t=n,i=e,a=r;gg.push(setTimeout(()=>{hg&&(hg.style.transition=a,hg.style.width=`${i}%`)},t)),n+=800}}function yg(){hg&&(gg.forEach(clearTimeout),gg=[],hg.style.transition=`width 0.2s ease`,hg.style.width=`100%`,gg.push(setTimeout(()=>{hg&&(hg.style.transition=`opacity 0.35s ease`,hg.style.opacity=`0`,gg.push(setTimeout(()=>{hg&&(hg.style.width=`0%`,hg.classList.remove(`${Q}-bar-active`))},380)))},220)))}var bg=`<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
|
|
334
|
+
<filter id="${Q}-csh">
|
|
335
|
+
<feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
|
|
336
|
+
</filter>
|
|
337
|
+
<path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
|
|
338
|
+
fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
|
|
339
|
+
filter="url(#${Q}-csh)"/>
|
|
340
|
+
</svg>`,xg=null,Sg=!1;function Cg(){return(!xg||!xg.isConnected)&&(xg=document.createElement(`div`),xg.id=`${Q}-cursor`,xg.innerHTML=bg,document.body.appendChild(xg),Sg=!1),xg}async function wg(e){if(typeof document>`u`||!e)return;lg();let t;try{t=e.getBoundingClientRect()}catch{return}let n=t.left+Math.min(16,t.width*.2),r=t.top+Math.min(12,t.height*.25),i=Cg();Sg||=(i.style.transition=`none`,i.style.left=`${window.innerWidth/2}px`,i.style.top=`${window.innerHeight*.4}px`,i.classList.add(`${Q}-cursor-visible`),i.offsetHeight,i.style.transition=`left 0.32s cubic-bezier(0.25,0.46,0.45,0.94), top 0.32s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease`,!0),i.style.left=`${n}px`,i.style.top=`${r}px`,await Og(360)}function Tg(e=!1){xg&&(e?(xg.classList.remove(`${Q}-cursor-visible`),Sg=!1):(xg.classList.remove(`${Q}-cursor-visible`),setTimeout(()=>{Sg=!1},250)))}async function Eg(e){xg&&(xg.classList.add(`${Q}-cursor-click`),await Og(280),xg.classList.remove(`${Q}-cursor-click`))}function Dg(e){if(!e||typeof document>`u`)return;lg();let t;try{t=e.getBoundingClientRect()}catch{return}let n=e.style.position,r=e.style.overflow,i=window.getComputedStyle(e).position;[`relative`,`absolute`,`fixed`,`sticky`].includes(i)||(e.style.position=`relative`),e.style.overflow=`hidden`;let a=document.createElement(`span`);a.className=`${Q}-ripple`;let o=Math.max(t.width,t.height)*1.2;Object.assign(a.style,{width:`${o}px`,height:`${o}px`,left:`${t.width/2-o/2}px`,top:`${t.height/2-o/2}px`}),e.appendChild(a),setTimeout(()=>{a.remove(),e.style.position=n,e.style.overflow=r},650)}function Og(e){return new Promise(t=>setTimeout(t,e))}var kg=/^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;function Ag(e){return String(e||``).replace(kg,``).replace(/\/+$/,``).toLowerCase()||`/`}function jg(e,t){return Ag(e)===Ag(t)}function $(...e){En()&&console.log(`[FlowEngage:voice-tools]`,...e)}function Mg(e){try{let t=e.ownerDocument?.defaultView;if(t)return t.getComputedStyle(e)}catch{}return window.getComputedStyle(e)}function Ng(e){let t=new Set;function n(r){if(!r||t.has(r))return;t.add(r),e(r);let i=r.querySelectorAll(`iframe`);for(let e of i)if(!Mn(e))try{let t=e.contentDocument;t&&n(t)}catch{}}typeof document<`u`&&n(document)}function Pg(e){return e==null?null:String(e).replace(/\u00a0/g,` `).replace(/\s*\*+\s*$/u,``).replace(/\s+/g,` `).trim()}function Fg(e){let t=e.ownerDocument||document,n=e.getAttribute(`aria-labelledby`);if(n){let e=n.trim().split(/\s+/).filter(Boolean),r=[];for(let n of e)try{let e=t.getElementById(n);e?.textContent&&r.push(e.textContent.trim())}catch{}if(r.length)return Pg(r.join(` `))}if(e.labels&&e.labels.length)return Pg(e.labels[0].textContent);let r=e.id;if(r)try{let e=t.querySelector(`label[for="${CSS.escape(r)}"]`);if(e)return Pg(e.textContent)}catch{let e=t.querySelector(`label[for="${r.replace(/"/g,`\\"`)}"]`);if(e)return Pg(e.textContent)}let i=e.previousElementSibling;for(let e=0;e<6&&i;e+=1){if(i.tagName===`LABEL`)return Pg(i.textContent);let e=(i.className||``).toString().toLowerCase();if(/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)){let e=Pg(i.textContent);if(e)return e}i=i.previousElementSibling}let a=e.parentElement;for(let e=0;e<5&&a;e+=1){if(a.tagName===`LABEL`)return Pg(a.textContent);let e=a.querySelector?.(`:scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']`);if(e?.textContent)return Pg(e.textContent);a=a.parentElement}let o=e.getAttribute(`aria-label`);return o?Pg(o):null}function Ig(){let e=[];return Ng(t=>{e.push(...Array.from(t.querySelectorAll(`input, select, textarea`)).filter(e=>{if(Mn(e))return!1;let t=(e.type||``).toLowerCase();if([`hidden`,`submit`,`button`,`image`].includes(t)||e.disabled||e.readOnly)return!1;try{let t=Mg(e);if(t.display===`none`||t.visibility===`hidden`)return!1}catch{}return!0}))}),e}function Lg(){return Ig().map((e,t)=>{let n={formIndex:0,fieldIndex:t,tag:e.tagName,type:e.type||`text`,name:e.name||null,id:e.id||null,label:Fg(e),placeholder:e.placeholder||null};return e.tagName===`SELECT`&&(n.options=Array.from(e.options).filter(e=>e.value!==``&&!e.disabled).map(e=>({value:e.value,text:e.text.trim()})),n.currentValue=e.value||null),n})}function Rg(){let e=[];return Ng(t=>{e.push(...Array.from(t.querySelectorAll(`button, [role="button"], input[type="submit"], input[type="button"]`)).filter(e=>{if(Mn(e)||e.disabled)return!1;try{let t=Mg(e);if(t.display===`none`||t.visibility===`hidden`)return!1}catch{}return!0}))}),e.slice(0,60).map((e,t)=>({index:t,text:(e.textContent||e.value||``).replace(/\s+/g,` `).trim().slice(0,120)||null,ariaLabel:e.getAttribute(`aria-label`),type:e.type||e.tagName}))}function zg(e,t){try{if(!e?.getBoundingClientRect||!t?.getBoundingClientRect)return 1/0;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return Math.hypot(i.x-a.x,i.y-a.y)}catch{return 1/0}}function Bg(e,t){let n=String(t||``).toLowerCase().trim();if(!n)return 0;let r=(e.innerText||e.textContent||``).replace(/\s+/g,` `).trim(),i=[r,e.value,e.getAttribute(`aria-label`),e.getAttribute(`title`),e.getAttribute(`data-text`),e.getAttribute(`data-label`)].filter(Boolean).join(` `).toLowerCase().replace(/\s+/g,` `);if(i.includes(n)||r.toLowerCase()===n)return 100;let a=n.split(/\s+/).filter(e=>e.length>1);if(!a.length)return 0;let o=0;for(let e of a)i.includes(e)&&(o+=1);return o/a.length*92}function Vg(e,t,n=6){let r=String(t||``).toLowerCase().trim();if(!r)return!1;let i=e;for(let e=0;e<n&&i&&(i=i.parentElement,i);e++)if((i.innerText||i.textContent||``).toLowerCase().includes(r))return!0;return!1}function Hg(e,t,n){let r=[];Ng(e=>{let t=Array.from(e.querySelectorAll(`button, [role="button"], input[type="submit"], input[type="button"], a[href]`));r.push(...t.filter(e=>{if(Mn(e)||e.disabled)return!1;try{let t=Mg(e);if(t.display===`none`||t.visibility===`hidden`||t.opacity===`0`)return!1}catch{}return!0}))});let i=0,a=r.map(t=>({el:t,s:Bg(t,e)}));for(let{s:e}of a)e>i&&(i=e);if(i<28)return null;let o=a.filter(({s:e})=>e===i).map(({el:e})=>e);if(o.length===1)return o[0];if(n){let e=o.filter(e=>Vg(e,n));if(e.length===1)return e[0];e.length>1&&(o=e)}let s=Array.isArray(t)?t.filter(e=>e&&e.isConnected):[];if(s.length){let e=o[0],t=1/0;for(let n of o)for(let r of s){let i=zg(n,r);i<t&&(t=i,e=n)}return e}return o[0]}function Ug(e){if(e==null)return{};if(typeof e==`string`){let t=e.trim();if(!t)return{};try{return JSON.parse(t)}catch{return{url:t}}}return e}function Wg(e){if(!e||typeof e!=`object`)return null;let t=e.url??e.target_url??e.page_url??e.pageUrl??e.link??e.href??e.path;return t==null?null:String(t).trim()||null}function Gg(){let e={};document.querySelectorAll(`h1, h2, h3, h4, h5, h6`).forEach(t=>{if(t.id)return;let n=t.textContent.trim();if(!n)return;let r=n.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).substring(0,60);if(e[r]){let t=2;for(;e[r+`-`+t];)t++;r=r+`-`+t}e[r]=!0,t.id=r})}function Kg(){let e=e=>{let t=Array.from(e).filter(e=>!e.closest(`#flowengage-root, .flowengage-shell, .flowengage-widget-root`)&&!e.closest(`nav, footer, header, aside, .nav, .footer, .header, .sidebar`)),n=[],r=0;for(;r<t.length;){let e=t[r],i=Nn(e);if(!i||i.length<2){r++;continue}let a=i;if(i.length<40&&!/[.!?:;]$/.test(i)&&r+1<t.length){let n=t[r+1],o=Nn(n);o&&n.tagName===e.tagName&&o.length<60&&(e.nextElementSibling===n||e.parentElement===n.parentElement)&&(a=`${i} ${o}`,r++)}a.length>2&&a.length<200&&n.push(a),r++}return n},t=document.querySelector(`main, [role='main']`)||document.body,n=e(t.querySelectorAll(`h1, h2, h3, h4, h5`));n.length||(n=e(document.body.querySelectorAll(`h1, h2, h3, h4, h5`)));let r=[...new Set(n)].slice(0,30),i=Array.from(t.querySelectorAll(`h1`)).filter(e=>!e.closest(`#flowengage-root, .flowengage-shell, .flowengage-widget-root`)&&!e.closest(`nav, footer, header, aside, .nav, .footer, .header, .sidebar`)),a=null;if(i.length===1){let e=Nn(i[0]);e&&r[0]&&r[0].toLowerCase().trim()===e.toLowerCase().trim()&&(a=r[0])}let o=``;try{let e=t.querySelector(`h1, h2, h3, h4, h5`);if(e){let n=document.createRange();n.setStart(t,0),n.setEndBefore(e);let r=n.cloneContents(),i=[];r.querySelectorAll(`p, li`).forEach(e=>{let t=e.textContent.replace(/\s+/g,` `).trim();t.length>20&&i.push(t)}),o=i.join(` `).slice(0,600)}}catch{}return{headings:r,pageTitleHeading:a,introText:o}}function qg(e){if(!e||typeof document>`u`)return``;let t=new Set([`script`,`style`,`noscript`,`svg`,`iframe`,`nav`,`footer`,`header`,`aside`]),n=parseInt(e.tagName[1],10),r=Array.from({length:n},(e,t)=>`h${t+1}`).join(`, `),i=Array.from(document.querySelectorAll(r)).filter(e=>!e.closest(jn)),a=i.indexOf(e),o=a===-1?null:i[a+1],s=document.createRange();try{if(s.setStartAfter(e),o)s.setEndBefore(o);else{let e=document.querySelector(`main, [role='main'], article`)||document.body;s.setEnd(e,e.childNodes.length)}}catch{return e.textContent.replace(/\s+/g,` `).trim()}let c;try{c=s.cloneContents()}catch{return e.textContent.replace(/\s+/g,` `).trim()}let l=[];function u(e){if(e.nodeType===Node.TEXT_NODE){let t=e.textContent.replace(/\s+/g,` `).trim();t&&l.push(t);return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e.tagName.toLowerCase();if(!t.has(n)){if(n===`ul`||n===`ol`){let t=Array.from(e.querySelectorAll(`:scope > li`)).map(e=>{let t=e.textContent.replace(/\s+/g,` `).trim();return t?`• ${t}`:null}).filter(Boolean);t.length&&l.push(t.join(`
|
|
341
|
+
`));return}if(n===`table`){let t=Array.from(e.querySelectorAll(`tr`)).map(e=>Array.from(e.querySelectorAll(`td, th`)).map(e=>e.textContent.replace(/\s+/g,` `).trim()).filter(Boolean).join(` | `)).filter(Boolean);t.length&&l.push(t.join(`
|
|
342
|
+
`));return}if(n===`form`){let t=Array.from(e.querySelectorAll(`input, textarea, select`)).map(e=>{let t=(e.getAttribute(`type`)||`text`).toLowerCase();if([`hidden`,`submit`,`button`,`reset`].includes(t))return null;let n=e.getAttribute(`placeholder`)||e.getAttribute(`aria-label`)||e.getAttribute(`name`)||t;return n?String(n).trim().slice(0,40):null}).filter(Boolean),n=e.querySelector(`button[type="submit"], input[type="submit"]`),r=n?(n.textContent||n.value||`Submit`).trim().slice(0,40):`Submit`;t.length&&l.push(`[FORM PRESENT: ${t.length} field(s) — ${t.join(`, `)}. Submit button: "${r}"]`);return}if(n===`p`||n===`blockquote`){let t=e.textContent.replace(/\s+/g,` `).trim();t.length>2&&l.push(t);return}if(/^h[1-6]$/.test(n)){let t=e.textContent.replace(/\s+/g,` `).trim();t.length>2&&l.push(t);return}for(let t of e.childNodes)u(t)}}for(let e of c.childNodes)u(e);let d=new Set;return l.filter(e=>{let t=e.substring(0,80);return d.has(t)?!1:(d.add(t),!0)}).join(`
|
|
343
|
+
`).replace(/\n{3,}/g,`
|
|
344
|
+
|
|
345
|
+
`).trim()}function Jg(e){let t=e.siteId||null,n=(e.apiBaseUrl||``).replace(/\/$/,``),r=typeof e.getLastUserVoiceText==`function`?e.getLastUserVoiceText:null,i=[],a={"fwh-navigate-mvp":async n=>{if($(`fwh-navigate-mvp ▶ raw parameters:`,n),e?.isWalkthroughActive?.())return $(`fwh-navigate-mvp ✖ blocked — walkthrough in progress`),`NAVIGATION_BLOCKED_DURING_WALKTHROUGH. A walkthrough of the current page is in progress, so navigation is not allowed. Do NOT tell the visitor you navigated or offer to. Describe the requested section using the CURRENT page's own content (fwh-read-content-mvp), then stop.`;let i=Ug(n),a=Wg(i),o=i.section_text??i.sectionText??i.section,s=Array.isArray(i.expected_landmarks)?i.expected_landmarks:Array.isArray(i.expectedLandmarks)?i.expectedLandmarks:[];if($(`fwh-navigate-mvp · coerced:`,{url:a,sectionText:o,expectedLandmarks:s}),!a){let e=`Missing url: pass a string url, path like /pricing, or JSON with a url field.`;return $(`fwh-navigate-mvp ✖`,e),e}if(typeof window<`u`)try{let e=new URL(a,window.location.href);if(e.hostname===window.location.hostname&&e.origin!==window.location.origin)a=e.pathname+e.search+e.hash,$(`fwh-navigate-mvp · cross-protocol same-host URL normalized →`,a);else if(e.origin!==window.location.origin&&/^https?:$/i.test(e.protocol)){let t=e.hostname;return $(`fwh-navigate-mvp ✖ external URL blocked:`,e.href),`EXTERNAL_LINK_BLOCKED: The URL "${a}" points to an external site (${t}) that opens in a new tab. I cannot open new tabs or navigate to external sites. Tell the visitor exactly this: "That link opens an external app — I'm not able to open it for you, but you can click the link directly in the navigation header."`}}catch{}if(typeof window<`u`){try{let e=new URL(a,window.location.href);if(e.pathname===window.location.pathname&&e.search===window.location.search)return $(`fwh-navigate-mvp ✖ already on page, skipping`),`OK_ALREADY_ON_PAGE. The visitor is already on this page. Do not navigate. Proceed directly with highlights, answering the question, or reading page content.`}catch{}let e=window.__fe_user_nav_during_speech;if(e&&Date.now()-e.ts<3e4)try{if(new URL(a,window.location.href).pathname===e.fromPath)return $(`flowengage_navigate ✖ blocked — would navigate back to page visitor just left`,e),`NAV_BLOCKED: The visitor just left "${e.fromPageName}" and is now on "${e.toPageName}". Do NOT navigate them back. If they said "continue", resume verbally from where you left off — no navigation needed. If they want to return, they will navigate themselves.`}catch{}}let{allowed:c,correctedUrl:l}=await gr(a,{siteId:t,apiBaseUrl:e.apiBaseUrl});if(!c){let e=`PAGE_NOT_IN_SITE: "${a}" is NOT a real page on this site — do NOT guess or invent URL paths. Do NOT tell the visitor you are taking them there. Instead, find the REAL page: look at your Popular Pages / Site Pages list for the closest actual match, or call fwh-list-nav-links-mvp (to read the site's real menu links) or fwh-search-mvp (to find the right page). If a close match exists (e.g. the visitor said "support" and the site has "Technical Support"), tell them the ACTUAL page name and ask "we don't have a page called that, but we do have [real page] — would you like me to take you there?" Then navigate only to that verified URL.`;return $(`fwh-navigate-mvp ✖ blocked`,e),e}l&&l!==a&&($(`fwh-navigate-mvp · corrected url:`,{requested:a,correctedUrl:l}),a=l);try{pg(`Navigating to ${a}...`,{spinner:!0}),vg(),An();try{let e=r?r():``;if(e&&t){let n=cg([{sender:`user`,message:e}]);n&&_e(t,n)}}catch{}xe();let e=a;try{e=new URL(a,typeof window<`u`?window.location.href:``).href}catch{}let n=`this`;try{let e=new URL(a,window.location.href).pathname.split(`/`).filter(Boolean).pop()||``;n=e?e.replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()):`Home`}catch{}t&&typeof window<`u`&&Oe(t,window.location.href,e,n),yr(e);try{window.__fe_agent_nav={path:new URL(e,window.location.href).pathname,ts:Date.now()}}catch{}$(`fwh-navigate-mvp → real navigation`,a);let i=typeof window<`u`&&!window.Shopify&&!!Xn();if(typeof window<`u`&&window.__fe_triggerVoiceNavHooks&&window.__fe_triggerVoiceNavHooks(),i&&Vn(12e3),Dr(a,{voiceActive:!0}).catch(()=>{}),i)try{let e=new URL(a,window.location.origin).pathname,t=window.location.pathname,n=Date.now()+2e3;for(;Date.now()<n&&!(typeof window<`u`&&window.location.pathname===e);)await new Promise(e=>setTimeout(e,80));let r=typeof window<`u`?window.location.pathname:e,i=typeof window<`u`?window.location.href:a;(r.split(`/`).filter(Boolean).pop()||``).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()),$(`fwh-navigate-mvp → SPA nav complete. target:`,e,`actual:`,r);try{typeof window<`u`&&window.scrollTo(0,0)}catch{}let o=[],s=null,c=``,l=Date.now()+12e3;for(;Date.now()<l&&(await new Promise(e=>setTimeout(e,300)),{headings:o,pageTitleHeading:s,introText:c}=Kg(),!(o.length>=1)););Gg(),$(`fwh-navigate-mvp → page headings collected:`,o,`titleHeading:`,s);let u=o.length?o.join(` | `):`none`,d=o.length?`Use ONLY these exact heading strings for fwh-highlight-mvp — never invent or abbreviate.`:`No headings collected yet — call fwh-get-current-page-mvp immediately (no speech) to get the live headings before speaking or highlighting.`,f=s?` "${s}" is the PAGE TITLE, not a content section — do not fwh-highlight-mvp it separately; if doing a walkthrough, just fold this intro into your opening line: "${c||`(no intro text found)`}"`:c?` No separate page-title heading detected, but this intro text precedes the first section — mention it briefly before covering sections: "${c}"`:``,p=``;try{if(o.length>0){let e=o.slice(0,3),t=[];for(let n of e){let e=dr(null,n);if(e){let r=qg(e).substring(0,800);r&&t.push(`[Section: ${n}] ${r}`)}}t.length>0&&(p=` CONTENT FOR FIRST FEW SECTIONS: ${t.join(` | `)}. Use this content to answer immediately if the visitor asks about one of these sections.`)}}catch{}if(Sr())return br(),$(`fwh-navigate-mvp ✖ landed on a not-found/404 page:`,i),`NAVIGATION_PAGE_NOT_FOUND. The page at ${i} does not exist — it shows a "not found"/404 error, not real content. Do NOT offer a page overview, do NOT describe or highlight any sections, do NOT claim the navigation succeeded. Tell the visitor EXACTLY: "It looks like that page doesn't exist — I couldn't find it. Would you like me to take you somewhere else?" Then STOP and wait for their reply.`;let m=Date.now()+4e3,h=typeof window<`u`?window.location.pathname:r;for(;Date.now()<m&&!jg(h,e)&&jg(h,t);)await new Promise(e=>setTimeout(e,120)),h=window.location.pathname;$(`fwh-navigate-mvp route settle:`,{startPath:t,targetPath:e,settledPath:h});let g=typeof window<`u`?window.location.href:i,_=(h.split(`/`).filter(Boolean).pop()||``).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())||`Home`,v=jg(h,e),y=!jg(h,t),b=v||y;return $(`fwh-navigate-mvp settled:`,h,`target:`,e,`match:`,b),b?(br(),`OK_NAVIGATE_SPA. Visitor is now on: ${g} (page: "${_}") | Section headings: ${u}.${f} ${d}${p} Now confirm the arrival in ONE short sentence phrased for what the visitor actually asked for — mention the page by name and what it lets them do (e.g. for a contact request: "I've taken you to the Contact Us page — filling in this form sends your query straight to our team."). Do NOT use a fixed template. Then, in the same breath, offer either a specific section or a full overview. Then STOP — wait for their reply.`):(br(),`NAVIGATION_DID_NOT_HAPPEN. The visitor is STILL on ${g} (page: "${_}") — the navigation did not go through. Do NOT say "I have navigated you". Do NOT claim success. Tell the visitor EXACTLY: "Sorry, I couldn't open that page just now. Would you like me to try again, or is there something else I can help with?" Then STOP and wait for their reply.`)}catch{}return`OK_NAVIGATE_RELOADING. The page is reloading now and this session is ending. Say NOTHING further — do not confirm the navigation, do not describe the page. The arrival greeting is spoken automatically on the new page; you resume from the visitor's next reply.`}catch(e){let t=`Navigation error: ${e?.message||String(e)}`;return $(`fwh-navigate-mvp ✖`,t),pg(`Navigation failed`,{spinner:!1,icon:`⚠️`,duration:1800}),t}finally{yg(),mg(900)}},"fwh-highlight-mvp":async e=>{$(`fwh-highlight-mvp ▶`,e);let t=Ug(e),n=t?.section_id||t?.sectionId,r=t?.section_text||t?.sectionText;if(Vn(3e3),typeof window<`u`&&window.__fe_user_nav_during_speech){let e=window.__fe_user_nav_during_speech,t=window.location.pathname;if(Date.now()-e.ts>=3e4)window.__fe_user_nav_during_speech=null;else return $(`flowengage_highlight ✖ blocked — user navigated during speech`,e),`NAV_CHANGED: The visitor navigated from "${e.fromPageName}" to "${e.toPageName}" (current path: ${t}) while you were speaking. STOP the current walkthrough immediately. DO NOT call fwh-highlight-mvp again. Say out loud: "I see you've navigated to the ${e.toPageName} page — do you want me to continue what I was explaining, or shall I guide you through this page?" Wait for the visitor's answer before doing anything else.`}Gg();let i=(e=>e&&e.replace(/^\d+\.\s*/,``).replace(/^["']|["']$/g,``).trim())(r),a=dr(n||null,i||null);if(!a&&i){let e=Date.now()+600;for(;!a&&Date.now()<e;)await new Promise(e=>setTimeout(e,50)),Gg(),a=dr(null,i)}if(!a){$(`fwh-highlight-mvp ✖ no element for:`,i||n);let{headings:e}=Kg(),t=e.length?`Page headings: ${e.map(e=>`"${e}"`).join(` | `)}. Use one of these EXACT strings for section_text — no numbers, no quotes around them.`:`No headings found — skip highlight and continue speaking.`;return`HIGHLIGHT_NOT_FOUND: "${i||n}" on the current page. ${t}`}return kn(a),$(`fwh-highlight-mvp ✓`,i||n),`OK_HIGHLIGHT: "${i||n}". Your NEXT response must be speech only (no tool call) describing THIS section — "${i||n}" — using its own content. Do not ask whether to continue.`},"fwh-read-content-mvp":async e=>{$(`fwh-read-content-mvp ▶`,e);let t=Ug(e),n=t?.section_text||t?.sectionText||``;try{let e=``;if(n){let t=dr(null,n);if(!t)return`Could not find section "${n}" on the page.`;e=qg(t)}else{let t=(document.querySelector(`main`)||document.querySelector(`article`)||document.querySelector(`[role="main"]`)||document.querySelector(`#content`)||document.querySelector(`.content`)||document.body).cloneNode(!0);t.querySelectorAll(`nav, footer, header, aside, script, style, noscript, .nav, .footer, .header, .sidebar, #flowengage-root, .flowengage-shell, .flowengage-widget-root`).forEach(e=>e.remove()),e=t.textContent.replace(/\s+/g,` `).trim()}return e.length>8e3&&(e=e.substring(0,8e3)+`... (truncated)`),$(`fwh-read-content-mvp ✓`,`${e.length} chars`),e||`No readable content found on this page.`}catch(e){return $(`fwh-read-content-mvp ✖`,e.message),`Could not read page content: ${e.message}`}},"fwh-page-content-mvp":async e=>{$(`fwh-page-content-mvp ▶`,e);let r=Ug(e),i=r?.url||r?.page_url||``;if($(`fwh-page-content-mvp · url:`,i,`siteId:`,t,`apiBase:`,n||`(empty)`),!i)return $(`fwh-page-content-mvp ✖ missing url`),`Missing url parameter.`;if(!t)return $(`fwh-page-content-mvp ✖ no siteId`),`Site is not configured.`;if(!n)return $(`fwh-page-content-mvp ✖ no api base`),`API base URL is missing; cannot fetch page content.`;try{let e=`${n}/api/site-tools/page-content`;$(`fwh-page-content-mvp → POST`,e);let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({siteId:t,url:i})}),a=await r.json();if($(`fwh-page-content-mvp · HTTP`,r.status,`success:`,a.success),!a.success){let e=a.error||`Failed to get page content.`;return $(`fwh-page-content-mvp ✖`,e),`${e} FALLBACK REQUIRED: This page is not in the search index. Call fwh-read-content-mvp (no parameters) immediately to read the live page content directly from the visitor's browser — do NOT tell the visitor you cannot access the page.`}return $(`fwh-page-content-mvp ✓`,`title: ${a.title}`,`sections: ${(a.sections||[]).length}`,`content: ${(a.content||``).length} chars`),JSON.stringify({title:a.title,url:a.url,sections:a.sections,content:a.content})}catch(e){let t=`Page content error: ${e.message||`network`}`;return $(`fwh-page-content-mvp ✖`,t),t}},"fwh-search-mvp":async e=>{$(`fwh-search-mvp ▶`,e);let r=Ug(e).query;if(!r)return $(`fwh-search-mvp ✖ missing query`),`Missing query parameter.`;if(!t)return $(`fwh-search-mvp ✖ no siteId`),`Search unavailable (no siteId configured).`;if(!n)return $(`fwh-search-mvp ✖ no api base`),`Search unavailable (no API base URL).`;try{let e=`${n}/api/site-tools/search`;$(`fwh-search-mvp → POST`,e);let i=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({siteId:t,query:r,currentUrl:typeof window<`u`?window.location.href:``})}),a=await i.json();if($(`fwh-search-mvp · HTTP`,i.status,`success:`,a.success),!a.success||!a.results?.length)return`No results found for that query. Try rephrasing, or use fwh-read-content-mvp to read the current page.`;let o=a.results.slice(0,5).map((e,t)=>`${t+1}. ${e.title||e.url} (${e.url})${e.snippet?` — ${e.snippet}`:``}`).join(`
|
|
346
|
+
`);return $(`fwh-search-mvp ✓`,`${a.results.length} result(s)`),`SEARCH_RESULTS:\n${o}`}catch(e){return $(`fwh-search-mvp ✖`,e.message),`Search failed. Use fwh-read-content-mvp to read the current page instead.`}},"fwh-list-nav-links-mvp":async()=>{if($(`fwh-list-nav-links-mvp ▶`),typeof window>`u`)return`Cannot read navigation (no browser context).`;let e=new Map,t=[],n=[`nav a`,`[role='navigation'] a`,`header a`,`.navbar a`,`.nav a`,`.menu a`,`.navigation a`,`.header a`,`[class*='nav'] a`,`[class*='menu'] a`,`[class*='header'] a`];if(Ng(t=>{for(let r of n)try{t.querySelectorAll(r).forEach(t=>{if(Mn(t))return;let n=t.getAttribute(`href`),r=(t.textContent||``).replace(/\s+/g,` `).trim();if(!r||!n||n===`#`||n.startsWith(`javascript:`))return;try{let e=t.parentElement;if(e&&Mg(e).display===`none`&&!e.closest(`nav, [role='navigation'], header, [class*='nav'], [class*='menu']`))return}catch{}let i=r.toLowerCase()+`|`+n;e.has(i)||e.set(i,{text:r,href:n})})}catch{}t.querySelectorAll(`select`).forEach(t=>{if(Mn(t))return;let n=Fg(t);/nav|menu|page|section|go to/i.test(n||t.name||t.id||``)&&Array.from(t.options).forEach(r=>{if(!r.value||r.disabled)return;let i=r.text.trim();if(!i)return;let a=i.toLowerCase()+`|`+r.value;e.has(a)||e.set(a,{text:i,href:r.value,isSelectOption:!0,selectLabel:n||t.name||`dropdown`})})})}),e.forEach(e=>t.push(e)),!t.length)return`NAV_LINKS: No navigation links found on this page. Use fwh-read-content-mvp to read page content or fwh-search-mvp to search the site.`;let r=t.slice(0,50).map((e,t)=>`${t+1}. "${e.text}"${e.isSelectOption?` (dropdown option in "${e.selectLabel}")`:``} → ${e.href}`).join(`
|
|
347
|
+
`);return $(`fwh-list-nav-links-mvp ✓`,`${t.length} links`),`NAV_LINKS (${t.length} total, showing up to 50):\n${r}\n\nIMPORTANT: Use the EXACT text shown above when reading link names to the visitor. Do NOT rename, abbreviate, or invent options not listed here. To navigate, call fwh-navigate-mvp with the href value.`},"fwh-end-session-mvp":async()=>($(`fwh-end-session-mvp ▶`),typeof e.requestEndSession==`function`&&e.requestEndSession(),`Voice session is ending.`),"fwh-request-email-mvp":async()=>($(`fwh-request-email-mvp ▶`),typeof e.requestEmailCollection==`function`&&e.requestEmailCollection(),`EMAIL_BOX_SHOWN. An email input text box is now visible to the visitor. Say EXACTLY: "Please enter your email in the text box to continue." Then stop and wait silently — do NOT ask them to say it aloud, do NOT repeat, and do NOT answer any other question until you receive the EMAIL_SAVED message.`),"fwh-get-current-page-mvp":async()=>{if($(`fwh-get-current-page-mvp ▶`),typeof window>`u`)return`Cannot determine current page (no browser context).`;let e=window.location.href,t=window.location.pathname,n=document.title||``;if(Sr())return $(`fwh-get-current-page-mvp ✓ 404 detected`,{url:e}),`CURRENT_PAGE_NOT_FOUND. The visitor is currently on a 404 / page-not-found error page (${e}). There is no real content here. Do NOT describe this page, do NOT list sections, do NOT offer a walkthrough, and do NOT describe it from your own knowledge. Tell the visitor plainly that the page they are on doesn't exist, and offer to take them somewhere that does.`;let{headings:r,pageTitleHeading:i,introText:a}=Kg();$(`fwh-get-current-page-mvp ✓`,{url:e,path:t,title:n}),$(`fwh-get-current-page-mvp → page headings collected:`,r,`titleHeading:`,i);let o=i?` NOTE: "${i}" is the PAGE TITLE, not a content section — do NOT fwh-highlight-mvp it or list it as a separate section in a walkthrough. Instead, open with a brief 1-2 sentence summary of this intro text before covering the real sections: "${a||`(no intro text captured)`}"`:a?` NOTE: no separate page-title heading was detected, but this intro text appears before the first section — open your walkthrough with a brief 1-2 sentence summary of it before covering sections: "${a}"`:``;if(!r.length)return`CURRENT_PAGE. URL: ${e} | Title: ${n} |${o} No structured section headings found on this page. If there is intro text above, describe it; otherwise describe the page from your knowledge. Do not call this tool again.`;let s=r.map(e=>`"${e}"`).join(` | `);return`CURRENT_PAGE. URL: ${e} | Title: ${n} | Page sections (${r.length} total): ${s}.${o} *** WALKTHROUGH: do NOT drive it yourself. Do not call fwh-highlight-mvp and do not decide the order — highlighting and section order are handled for you. You will be told which section to describe, one at a time. When told, describe ONLY that section in 3-4 sentences and then stop; never announce another section, never ask whether to continue. ***`},"fwh-list-forms-mvp":async()=>{let e=Lg(),t=Rg();$(`fwh-list-forms-mvp ✓`,`${e.length} field(s)`,`${t.length} button(s)`);let n=e.map(e=>({...e,inputCategory:e.tag===`SELECT`?`dropdown_select`:`text_input`}));return JSON.stringify({fields:n,buttons:t,hint:`field_key: use the label/placeholder/name shown above. CRITICAL: fields with inputCategory='dropdown_select' are SELECT elements — their field_key must match the SELECT's own label (e.g. 'Company Size'), NOT the option text (e.g. 'Small Business') and NOT a nearby text input label. Never fill a SELECT option value into a text input.`})},"fwh-fill-form-mvp":async()=>`FORM_FILLING_DISABLED: Form filling is not available at this time. Tell the visitor what fields are present (use fwh-list-forms-mvp) and ask them to fill the form themselves.`,"fwh-click-button-mvp":async e=>{let t=Ug(e),n=(t.button_text??t.buttonText??t.text??``).trim(),r=(t.card_context??t.cardContext??``).trim();if($(`fwh-click-button-mvp ▶`,n,r?`(card_context: ${r})`:``),!n)return`Missing button_text: pass the visible label, e.g. Conduct Audit.`;let a=Hg(n,i,r);if(!a)return $(`fwh-click-button-mvp ✖ no match`),`Could not find a button matching "${n}". Call fwh-list-forms-mvp to see button texts.`;try{pg(`Clicking ${n}...`,{spinner:!0});try{a.scrollIntoView({block:`center`,inline:`nearest`})}catch{a.scrollIntoView(!0)}await wg(a),a.focus?.(),await Eg(a),Dg(a),a.click();let e=(a.textContent||a.value||a.getAttribute(`aria-label`)||``).trim().slice(0,80)||`button`,t=`OK_CLICK ${e}`;return $(`fwh-click-button-mvp ✓`,t),pg(`Clicked ${e}`,{spinner:!1,icon:`✅`,duration:1200}),t}catch(e){let t=`Click failed: ${e?.message||String(e)}`;return $(`fwh-click-button-mvp ✖`,t),pg(`Click failed`,{spinner:!1,icon:`⚠️`,duration:1800}),t}finally{Tg(),mg(700)}},"fwh-cart-get-mvp":async()=>{$(`fwh-cart-get-mvp ▶`);try{let e=await Br();if(!e)return`CART_UNAVAILABLE: this page is not a Shopify storefront, so there is no cart to read.`;let t=e.items.map((e,t)=>{let n=e.variantTitle&&e.variantTitle!==`Default Title`?` (${e.variantTitle})`:``;return`${t+1}. ${e.title}${n} — qty ${e.quantity} — ${e.linePrice}${e.handle?` — handle: ${e.handle}`:``}`}),n=`CART. Items: ${e.itemCount} | Subtotal: ${e.subtotal}${e.currency?` ${e.currency}`:``}${t.length?` | ${t.join(` | `)}`:` | (cart is empty)`}`;return $(`fwh-cart-get-mvp ✓`,n),n}catch(e){return $(`fwh-cart-get-mvp ✖`,e),`CART_ERROR: ${e?.userMessage||e?.message||`could not read the cart`}`}},"fwh-shop-search-mvp":async e=>{let t=String((e||{}).query||``).trim();if($(`fwh-shop-search-mvp ▶`,t),!t)return`Missing query: pass the product name or keyword to search.`;try{let e=await qr(t);if(!e.length)return`NO_PRODUCTS_FOUND for "${t}". Tell the visitor no matching product was found — do not invent products.`;let n=e.map(e=>`"${e.title}" — handle: ${e.handle}${e.price?` — price: ${e.price}`:``}`).join(` | `);return $(`fwh-shop-search-mvp ✓`,n),`PRODUCTS_FOUND: ${n}. Use the handle with fwh-cart-add-mvp or fwh-view-product-mvp.`}catch(e){return $(`fwh-shop-search-mvp ✖`,e),`SEARCH_ERROR: ${e?.message||`product search failed`}`}},"fwh-cart-add-mvp":async e=>{let t=e||{},n=String(t.product_handle||t.productHandle||``).trim().toLowerCase(),r=String(t.variant||``).trim()||null,i=Math.min(20,Math.max(1,parseInt(t.quantity,10)||1));if($(`fwh-cart-add-mvp ▶`,{handle:n,variantText:r,quantity:i}),!n)return`Missing product_handle: search the product first with fwh-shop-search-mvp.`;try{let{variant:e,product:t}=await Vr(n,r);await Hr(e.id,i);let a=await Lr(),s=await o(a),c=e.title&&e.title!==`Default Title`?` (${e.title})`:``,l=`ADDED ${i} × ${t.title}${c}. Cart now has ${a.item_count} item(s), subtotal ${zr(a.items_subtotal_price)}${a.currency?` ${a.currency}`:``}.${s}`;return $(`fwh-cart-add-mvp ✓`,l),l}catch(e){return $(`fwh-cart-add-mvp ✖`,e),`ADD_FAILED: ${e?.userMessage||e?.message||`could not add the item`}. Relay this reason to the visitor.`}},"fwh-cart-update-mvp":async e=>{let t=e||{},n=parseInt(t.line,10),r=Math.min(20,Math.max(0,parseInt(t.quantity,10)));if($(`fwh-cart-update-mvp ▶`,{line:n,quantity:r}),!Number.isFinite(n)||n<1)return`Missing/invalid line: call fwh-cart-get-mvp first and use the item's 1-based number.`;if(!Number.isFinite(r))return`Missing/invalid quantity.`;try{let e=await Lr(),t=e.items?.[n-1];if(!t)return`NO_SUCH_LINE: the cart has ${e.items?.length||0} item(s). Call fwh-cart-get-mvp for the current list.`;let i=await Ur(n,r),a=await o(i),s=`UPDATED ${t.product_title||t.title} to qty ${r}. Cart now has ${i.item_count} item(s), subtotal ${zr(i.items_subtotal_price)}${i.currency?` ${i.currency}`:``}.${a}`;return $(`fwh-cart-update-mvp ✓`,s),s}catch(e){return $(`fwh-cart-update-mvp ✖`,e),`UPDATE_FAILED: ${e?.userMessage||e?.message||`could not update the item`}`}},"fwh-cart-remove-mvp":async e=>{let t=parseInt((e||{}).line,10);if($(`fwh-cart-remove-mvp ▶`,{line:t}),!Number.isFinite(t)||t<1)return`Missing/invalid line: call fwh-cart-get-mvp first and use the item's 1-based number.`;try{let e=await Lr(),n=e.items?.[t-1];if(!n)return`NO_SUCH_LINE: the cart has ${e.items?.length||0} item(s). Call fwh-cart-get-mvp for the current list.`;let r=await Ur(t,0),i=await o(r),a=`REMOVED ${n.product_title||n.title}. Cart now has ${r.item_count} item(s), subtotal ${zr(r.items_subtotal_price)}${r.currency?` ${r.currency}`:``}.${i}`;return $(`fwh-cart-remove-mvp ✓`,a),a}catch(e){return $(`fwh-cart-remove-mvp ✖`,e),`REMOVE_FAILED: ${e?.userMessage||e?.message||`could not remove the item`}`}},"fwh-cart-open-mvp":async()=>($(`fwh-cart-open-mvp ▶`),s(Wr(),`Cart`)),"fwh-checkout-mvp":async()=>{$(`fwh-checkout-mvp ▶`);try{if(!(await Lr()).item_count)return`CART_EMPTY: do not go to checkout. Tell the visitor their cart is empty and offer to help find products.`}catch{}return s(Gr(),`Checkout`)},"fwh-view-product-mvp":async e=>{let t=e||{},n=String(t.product_handle||t.productHandle||``).trim().toLowerCase();return $(`fwh-view-product-mvp ▶`,{handle:n}),n?s(Kr(n),n.replace(/[-_]/g,` `)):`Missing product_handle: search the product first with fwh-shop-search-mvp.`}};async function o(e){try{let{sectionsSwapped:t}=await ti(e);if(!t&&Jr())return` NOTE: the cart list on this page could not be re-rendered — briefly tell the visitor the page may need a quick refresh to show the change.`}catch{}return``}function s(e,n){if(typeof window>`u`)return`NAV_FAILED: no browser context.`;let r=e;try{r=new URL(e,window.location.href).href}catch{}return t&&Oe(t,window.location.href,r,n),yr(r),Er().then(()=>{window.location.assign(r)}),`OK_NAVIGATING to ${n}. The page is loading — say one short phrase like "Here you go." and nothing more.`}return{...a,highlightOnPage:a[`fwh-highlight-mvp`],getPageContent:a[`fwh-page-content-mvp`],endVoiceSession:a[`fwh-end-session-mvp`],listPageForms:a[`fwh-list-forms-mvp`],fillFormFields:a[`fwh-fill-form-mvp`],clickPageButton:a[`fwh-click-button-mvp`]}}var Yg=/^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;function Xg(){try{let{headings:e,pageTitleHeading:t}=Kg();return(e||[]).map(e=>typeof e==`string`?e:e?.text||``).filter(Boolean).filter(e=>!t||e.trim()!==t.trim()).filter(e=>!Yg.test(e.trim()))}catch{return[]}}function Zg(e){return!e||typeof e!=`object`?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,async n=>{let r=En();r?console.log(`[FlowEngage:voice-tool] ▶`,e,n):console.info(`[FlowEngage] voice tool » ${e}`);let i;try{i=await t(n)}catch(t){let n=`Tool error: ${t?.message||String(t)}`;return console.error(`[FlowEngage] voice tool ${e} threw:`,t),n}let a=typeof i==`string`?i.length>220?`${i.slice(0,220)}…`:i:String(i);return r?console.log(`[FlowEngage:voice-tool] ◀`,e,a):console.info(`[FlowEngage] voice tool « ${e}:`,a),i}]))}var Qg={blue:`#135bd8`,red:`#ef334b`,yellow:`#ffbd2e`,dark:`#0d1b2a`,highlight:`rgba(255,255,255,0.9)`,green:`#10b981`};function $g(e){if(!Array.isArray(e)||e.length<2)return`linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa`;let[t,n,r]=e;return e.length>=3&&r?[`radial-gradient(ellipse 80% 70% at -10% 50%, ${t}1a 0%, transparent 70%)`,`radial-gradient(ellipse 70% 80% at 110% 30%, ${n}1a 0%, transparent 70%)`,`radial-gradient(ellipse 80% 60% at 50% 110%, ${r}1a 0%, transparent 70%)`,`#f7f8fa`].join(`, `):[`radial-gradient(ellipse 80% 100% at -10% 50%, ${t}1a 0%, transparent 70%)`,`radial-gradient(ellipse 80% 100% at 110% 50%, ${n}1a 0%, transparent 70%)`,`#f7f8fa`].join(`, `)}function e_(e){if(!e||typeof e!=`string`)return`#1a1a1a`;let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=parseInt(n.slice(0,2),16)/255,i=parseInt(n.slice(2,4),16)/255,a=parseInt(n.slice(4,6),16)/255,o=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4;return .2126*o(r)+.7152*o(i)+.0722*o(a)>.179?`#1a1a1a`:`#ffffff`}function t_(e){let[t,n]=b.useState(null),r=typeof e==`string`?e.trim():``;return b.useEffect(()=>{if(!r){n(null);return}n(null);let e=!1,t=new window.Image;return t.onload=()=>{e||n(r)},t.onerror=()=>{e||n(null)},t.src=r,()=>{e=!0}},[r]),t}function n_({logo:e,style:t}){let n=t_(typeof e==`string`?e:null);if(!e)return null;if(typeof e==`string`)return n?(0,V.jsx)(`img`,{src:n,alt:``,style:{objectFit:`contain`,flexShrink:0,display:`block`,...t}}):null;let r=typeof e==`function`?b.createElement(e):b.isValidElement(e)?e:null;return r?(0,V.jsx)(`span`,{className:`fe-logo-slot`,style:{display:`inline-flex`,alignItems:`center`,flexShrink:0,overflow:`hidden`,...t},children:r}):null}function r_({title:e}){return(0,V.jsx)(`div`,{style:{width:`100%`,height:`100%`,borderRadius:`16px`,background:`linear-gradient(135deg, rgba(59,130,246,0.16) 0%, rgba(59,130,246,0.08) 100%)`,color:`#2563eb`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`18px`,fontWeight:700,letterSpacing:`-0.03em`},children:String(e||`FE`).split(/\s+/).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()||``).join(``)||`FE`})}function i_(e,t){let n=(t||``).trim();return n?!!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n)||/\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n)||/\b(hang\s+up|disconnect)\b/i.test(n)||e===`bot`&&(/\b(that'?s all|we'?re done)\b/i.test(n)||/\b(goodbye|bye)\b/i.test(n)||/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n)||/\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n)||/\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n)||/\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n)||/\b(wrapping\s+up|signing\s+off)\b/i.test(n))):!1}function a_({orbColors:e,...t}){return(0,V.jsx)($h,{colors:e,...t})}function o_({copy:e,orbColors:t,primaryColor:n,onYes:r,onLater:i,isMobile:a,isClosing:o}){let s=n||Qg.green,c=e_(s),l=a?72:94,u=(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:a?`flex-end`:`center`,gap:a?`7px`:`9px`},children:[(0,V.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,V.jsx)(Km.p,{initial:{x:-16,opacity:0},animate:{x:0,opacity:1},transition:{type:`spring`,stiffness:260,damping:24,delay:.36},style:{margin:`0 0 14px`,fontSize:`14px`,fontWeight:700,color:`white`,lineHeight:1.4,textShadow:`0 1px 4px rgba(0,0,0,0.35)`,maxWidth:`210px`,wordBreak:`break-word`,overflow:`hidden`,display:`-webkit-box`,WebkitLineClamp:4,WebkitBoxOrient:`vertical`},children:e.entryPrompt}),(0,V.jsxs)(Km.div,{initial:{y:10,opacity:0},animate:{y:0,opacity:1},transition:{type:`spring`,stiffness:260,damping:24,delay:.54},style:{display:`flex`,gap:`16px`,flexWrap:`nowrap`},children:[(0,V.jsx)(`button`,{onClick:r,style:{height:`31px`,boxSizing:`border-box`,padding:`0 16px`,borderRadius:`999px`,background:s,color:c,fontWeight:400,fontSize:`14px`,border:`none`,cursor:`pointer`,whiteSpace:`nowrap`,boxShadow:`0 4px 16px ${s}66`,transition:`transform 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.04)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:e.yesLabel}),(0,V.jsx)(`button`,{onClick:i,style:{height:`31px`,boxSizing:`border-box`,padding:`0 16px`,borderRadius:`999px`,background:`transparent`,color:`white`,fontWeight:400,fontSize:`14px`,border:`2px solid rgba(255,255,255,0.55)`,cursor:`pointer`,whiteSpace:`nowrap`,transition:`border-color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`rgba(255,255,255,0.9)`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`rgba(255,255,255,0.55)`},children:e.laterLabel})]})]}),(0,V.jsx)(Km.div,{initial:{x:120,opacity:0},animate:{x:0,opacity:1},transition:{type:`spring`,stiffness:220,damping:22,delay:0},style:{flexShrink:0},children:(0,V.jsx)(a_,{size:l,orbColors:t})})]});return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Km.div,{initial:{opacity:0},animate:{opacity:o?0:1},transition:{duration:.28},style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.72)`,zIndex:-1}}),a?(0,V.jsx)(`div`,{style:{position:`absolute`,bottom:0,left:0,right:0,padding:`24px 20px 40px`,overflow:`hidden`,animation:o?`fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards`:``},children:u}):(0,V.jsx)(`div`,{style:{animation:o?`fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards`:``},children:u})]})}function s_({copy:e,orbColors:t,primaryColor:n,onVoice:r,onText:i,onClose:a,isMobile:o,isClosing:s}){let c=n||Qg.green,l=e_(c);return(0,V.jsxs)(Km.div,{initial:{scale:50/350,borderRadius:`50%`},animate:s?{scale:50/350,opacity:0,borderRadius:`50%`}:{scale:1,borderRadius:`16px`,opacity:1},transition:{type:`spring`,stiffness:260,damping:26},style:{transformOrigin:o?`bottom center`:`bottom right`,background:`white`,width:o?`100%`:`350px`,height:`245px`,padding:`24px 40px 32px`,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`space-between`,boxShadow:`0 20px 60px rgba(0,0,0,0.2)`,position:`relative`,overflow:`hidden`},children:[(0,V.jsx)(`button`,{onClick:a,style:{position:`absolute`,top:`14px`,right:`14px`,background:`none`,border:`none`,cursor:`pointer`,color:`#9ca3af`,padding:`4px`,display:`flex`,alignItems:`center`,justifyContent:`center`,borderRadius:`50%`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=`#374151`},onMouseLeave:e=>{e.currentTarget.style.color=`#9ca3af`},children:(0,V.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})}),(0,V.jsx)(a_,{size:72,orbColors:t}),(0,V.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,V.jsx)(`p`,{style:{margin:0,fontSize:`16px`,fontWeight:400,color:`#111827`,lineHeight:1.4},children:e.connectionTitle}),e.connectionSubtitle&&(0,V.jsx)(`p`,{style:{margin:`6px 0 0`,fontSize:`13px`,fontWeight:400,color:`#6b7280`,lineHeight:1.4},children:e.connectionSubtitle})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,gap:`16px`,width:`100%`},children:[(0,V.jsx)(`button`,{onClick:r,style:{width:`127px`,height:`43px`,borderRadius:`999px`,background:c,color:l,fontWeight:400,fontSize:`16px`,border:`none`,cursor:`pointer`,transition:`transform 0.15s ease`,boxShadow:`0 4px 12px ${c}55`},onMouseEnter:e=>{e.currentTarget.style.transform=`scale(1.03)`},onMouseLeave:e=>{e.currentTarget.style.transform=`scale(1)`},children:e.voiceLabel}),(0,V.jsx)(`button`,{onClick:i,style:{width:`127px`,height:`43px`,borderRadius:`999px`,background:`transparent`,color:`#111827`,fontWeight:400,fontSize:`16px`,border:`1.5px solid #d1d5db`,cursor:`pointer`,transition:`border-color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.borderColor=`#6b7280`},onMouseLeave:e=>{e.currentTarget.style.borderColor=`#d1d5db`},children:e.textLabel})]})]})}function c_({orbColors:e,onEnterChat:t,onEndChat:n,agentId:r,siteId:i,apiBaseUrl:a,chatId:o,historyRef:s,onMessageSync:c,voiceEndCounter:l,websiteName:u,voiceFirstMessage:d,captureVisitorEmail:f,emailRequired:p,emailCaptureEnabled:m=!0,listeningLabel:h=`Listening...`,thinkingLabel:g=`Thinking...`,enterChatModeLabel:_=`Enter Chat Mode`,endConversationLabel:v=`End Conversation`}){(0,b.useEffect)(()=>(console.log(`[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED`),()=>console.log(`[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED`)),[]);let[y,x]=(0,b.useState)(`idle`),[S,C]=(0,b.useState)(!1),[w,T]=(0,b.useState)(!1),[E,ee]=(0,b.useState)(!1),[D,O]=(0,b.useState)(``),[k,A]=(0,b.useState)(``),te=(0,b.useRef)(!1),ne=(0,b.useRef)(!1),re=(0,b.useRef)(null),ie=(0,b.useRef)(0),j=(0,b.useRef)(``),M=(0,b.useRef)(!1),ae=(0,b.useRef)(0),oe=(0,b.useRef)(!1),se=(0,b.useRef)(!1),ce=(0,b.useRef)(!1),N=(0,b.useRef)([]),P=(0,b.useRef)(null),le=e=>{oe.current=e,e||(se.current=!1),F.current?.setWalkthroughActive?.(e)};P.current=async()=>{if(se.current)return;let e=N.current;ue.current+=1;let t=ue.current,n=e[t];if(!n){if(le(!1),e.length)F.current?.sendUserMessage?.(`That was the last section. Say so in one short sentence and ask if they want to explore any section further.`);else if(t===0){let e=``;try{let t=await de.current?.[`fwh-read-content-mvp`]?.({});typeof t==`string`&&t&&!/^Could not/i.test(t)&&(e=t.slice(0,2800))}catch{}F.current?.sendUserMessage?.(e?`Give the visitor a complete spoken overview of this page in 4-6 sentences, based ONLY on this page content:\n"""${e}"""\nThen ask which part they'd like to hear more about. Do not call any tool.`:`Give the visitor a complete spoken overview of this page in 4-6 sentences based on what you know about it, then ask which part they'd like to hear more about. Do not call any tool.`,{suppressQuestion:!0})}return}try{await de.current?.highlightOnPage?.({section_text:n})}catch(e){console.warn(`[FlowEngage] walkthrough highlight failed:`,e?.message||e)}console.debug(`[FlowEngage] walkthrough step ${t+1}/${e.length}: ${n}`);let r=``;try{let e=await de.current?.[`fwh-read-content-mvp`]?.({section_text:n});typeof e==`string`&&e&&!/^Could not/i.test(e)&&(r=e.slice(0,2500))}catch{}let i=r?`Here is this section's full content — describe it from THIS text only, and do not call any tool:\n"""${r}"""\n`:`read the section's content silently first (fwh-read-content-mvp) if you don't already have it. `;F.current?.sendUserMessage?.(`Describe the section titled "${n}" in 3-4 sentences, starting with ${t===0?`Starting with`:`Next —`} ${n}. Describe ONLY this section. If this section contains named sub-items (steps, checklist entries, cards, plans, FAQs, team members), name EVERY one of them in order with a short phrase each — never skip or collapse them into a summary; `+i+`This section is ON THE PAGE THE VISITOR IS ALREADY ON — do NOT call fwh-navigate-mvp, do not go to a product/detail page, and do not offer to, even if this section's name also matches a page name. Do not mention any other section, do not ask whether to continue, then stop.`,{suppressQuestion:!0})};let ue=(0,b.useRef)(0),F=(0,b.useRef)(null),de=(0,b.useRef)(null),fe=(0,b.useRef)(``),pe=(0,b.useRef)(async()=>{}),me=(0,b.useRef)(!1),I=(0,b.useRef)(!1),he=(0,b.useRef)(!1),ge=(0,b.useRef)(!1),be=(0,b.useRef)(`minimized`),Se=(0,b.useRef)(null),Ce=(0,b.useRef)(null),we=(0,b.useRef)(null),Te=(0,b.useRef)(0),De=(0,b.useRef)(!1),Oe=(0,b.useRef)(`idle`),Ae=(0,b.useRef)(null),je=(0,b.useRef)(!1),Me=(0,b.useRef)(null),Ne=(0,b.useCallback)((e=`minimized`)=>{console.warn(`[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called`,{destination:e,stack:Error().stack?.split(`
|
|
348
|
+
`).slice(1,4).join(` | `)}),be.current=e,ge.current=!0,queueMicrotask(()=>{me.current||(me.current=!0,pe.current?.())})},[s]),Pe=(0,b.useCallback)(()=>{re.current&&=(clearTimeout(re.current),null)},[]);(0,b.useEffect)(()=>{if(p){te.current=!1;return}if(te.current=!0,ne.current=!1,ee(!1),Pe(),M.current){M.current=!1,F.current?.setMicMuted?.(!1);let e=j.current;j.current=``,F.current?.injectAgentSpeech?.(`Thanks — I already have your email on file.`,`interrupt`),e&&F.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`)}F.current?.sendContextualUpdate?.(`EMAIL REQUIREMENT SATISFIED — the visitor's email is already on file. All earlier instructions about requiring or asking for an email are VOID. Never ask for it again.`)},[p,Pe]);let L=/(walk\s*(me\s*)?through|walkthrough|take me through|(complete|full|detailed) (overview|understanding|walkthrough|picture|breakdown|explanation)|give me (a|an|the) (overview|tour|walk)|tell me about (each|all)|go through (it|them|each|all)|overview of|one by one|tell me everything|explain (me )?(this|the) (whole |entire |full )?page|everything (about|on) this page|show me (each|all|around))/i,Fe=/(that covers everything|that was all|covered everything|that(?:'|’)?s everything)/i,Ie=/^((uh+|um+|so|well|okay|ok|yeah)[,.\s]+)*(yes|yeah|yep|yup|sure|ok(ay)?|please|continue|go on|next|keep going|carry on|go ahead|resume|back to the tour)[\s.!,]*$/i,Le=(0,b.useCallback)(()=>{Pe(),re.current=setTimeout(()=>{if(!(!ne.current||te.current))if(ie.current<3){ie.current+=1;try{F.current?.injectAgentSpeech?.(`I still need your email in the box below to continue — could you enter it, please?`,`queue`)}catch{}Le()}else{try{F.current?.injectAgentSpeech?.(`Since I haven't received your email, I'll close this session for now. Feel free to come back anytime — take care!`,`queue`)}catch{}ne.current=!1,ee(!1),Pe(),De.current=!0}},1e4)},[Pe]),Re=(0,b.useCallback)(async e=>{ge.current=!0;try{An()}catch{}if(i)try{ke(i)}catch{}try{await F.current?.endSession?.()}catch{}let t=Se.current,n=Ce.current;if(t&&o&&a){let e=n?Math.round((Date.now()-n)/1e3):0;fetch(`${a}/api/voice/save-chat-recording`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({chatId:o,voiceSessionId:t,duration:e,siteId:i})}).catch(e=>console.warn(`[FlowEngage] save-chat-recording failed:`,e.message))}if(Se.current=null,Ce.current=null,F.current=null,x(`idle`),C(!1),me.current=!1,jr(),i)try{ye(i)}catch{}typeof c==`function`&&await c(s.current),e?.()},[s,c,i,o,a]);pe.current=()=>Re(be.current===`chat`?t:n),(0,b.useEffect)(()=>{I.current=S},[S]),(0,b.useEffect)(()=>{l&&Ne(`chat`)},[l]),(0,b.useEffect)(()=>{let e=!1,l=null,f=null,h=null;return(async()=>{if(!i){x(`error`);return}try{if((await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),e)return;s.current=[],fe.current=``,me.current=!1,he.current=!1,ge.current=!1,be.current=`minimized`,Ar({onBeforeNavigate:()=>{if(i&&s.current.length>0)try{let e=cg(s.current);e&&_e(i,e)}catch{}if(!Xn()){let e=Se.current,t=Ce.current;if(e&&o&&a)try{let n=t?Math.round((Date.now()-t)/1e3):0,r=JSON.stringify({chatId:o,voiceSessionId:e,duration:n,siteId:i}),s=`${a}/api/voice/save-chat-recording`;fetch(s,{method:`POST`,headers:{"Content-Type":`application/json`},body:r,keepalive:!0}).catch(()=>{}),Se.current=null,Ce.current=null}catch{}}xe()}});let t=Zg(Jg({siteId:i||null,apiBaseUrl:a||null,chatId:o||null,getLastUserVoiceText:()=>fe.current,isWalkthroughActive:()=>oe.current&&!se.current,requestEndSession:()=>{De.current=!0},requestEmailCollection:()=>{m&&(te.current||ne.current||(ne.current=!0,ie.current=0,ee(!0),Le()))}})),n=i?ve(i):null,r=!!n?.transcript,c=i?ke(i):null,g=!!c,_=typeof window<`u`?window.location.pathname:`/`,v=typeof document<`u`?document.title:``,y=_.replace(/^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i,``)||`/`,b=y===`/`||y===``,S={apiBaseUrl:a,siteId:i,chatId:o,clientTools:t};de.current=t;let w=(_.split(`/`).filter(Boolean).pop()||``).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase()),T=``;v&&v.includes(`|`)&&(T=v.split(`|`).map(e=>e.trim()).filter(Boolean).reduce((e,t)=>e.length<=t.length?e:t));let E=T||w||``,D=E?`the ${E} page`:`this page`,O=(()=>{if(!c?.targetUrl)return!0;try{return new URL(c.targetUrl,window.location.href).pathname.replace(/\/$/,``)===window.location.pathname.replace(/\/$/,``)}catch{return!0}})(),k=(()=>{if(!c?.targetUrl)return null;try{return new URL(c.targetUrl,window.location.href).pathname}catch{return null}})();if(g&&!O)S.greeting=`You're on ${D}. What would you like to know?`,console.warn(`[FlowEngage] nav target "${c?.pageName}" not reached — on "${E}" instead; not claiming navigation`);else if(g){let e=c?.pageName?`the ${c.pageName} page`:D;S.greeting=`I have navigated you to ${e}. Do you want to know about any specific section or want a complete overview?`,console.log(`[FlowEngage] 🔄 Agent-nav resume: greeting set for "${e}" (${_})`)}else if(r)S.greeting=`Welcome back! I see you're now on ${D}. Would you like me to continue what I was explaining before, or would you like to know about this page instead?`;else{let e=u||``;S.greeting=d||(b?e?`Hi, welcome to ${e}! How may I help you?`:`Hi, welcome! How may I help you?`:`Welcome to ${D}! How may I help you?`),b||console.log(`[FlowEngage] 🏠 Page-context greeting: "${E}" for ${_}`)}let A=!1,re=g?`NAVIGATION COMPLETE — The exact phrase "I have navigated you to the [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript?`Prior transcript:\n${n.transcript}\n`:`(no prior transcript)`}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.`:null,pe=!1,ye=!g&&!r?`Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead.`:null,we=r&&!g,Re=!1,ze=we?`The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript?`Prior transcript:\n${n.transcript}\n`:`(no prior transcript, or the visitor navigated before saying much)`}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.`:null,Be=!1,Ve=!1,He=m&&!!p&&!ce.current,Ue=await dh.startSession({...S,onConnect:({conversationId:e})=>{Se.current=e,Ce.current=Date.now(),console.log(`[FlowEngage] 🎙️ AI chat session connected:`,e)},onUnhandledClientToolCall:e=>console.error(`[FlowEngage] Unhandled tool:`,e?.tool_name),onSessionInfo:({emailOnFile:e})=>{ce.current=!!e,e&&(te.current=!0,ne.current=!1,ee(!1),Pe(),console.log(`[FlowEngage] email already on file per server — gate disabled`))},onAgentTurnEnd:()=>{e||oe.current&&(se.current||M.current||setTimeout(()=>P.current?.(),250))},onSessionEnding:()=>{e||Ne(`minimized`)},onModeChange:({mode:t,tentative:n})=>{if(!e){if(t===`speaking`){Ae.current&&=(clearTimeout(Ae.current),null),Me.current&&=(clearTimeout(Me.current),null),x(`speaking`),Oe.current=`speaking`,je.current=!1;return}if(t===`user-speaking`){if(Me.current&&=(clearTimeout(Me.current),null),Oe.current===`speaking`)return;try{An()}catch{}Ae.current&&=(clearTimeout(Ae.current),null),Oe.current!==`listening`&&(x(`listening`),Oe.current=`listening`);return}if(t===`thinking`){if(Ae.current&&=(clearTimeout(Ae.current),null),Me.current&&=(clearTimeout(Me.current),null),Oe.current===`speaking`)return;x(`thinking`),Oe.current=`thinking`,n&&(Me.current=setTimeout(()=>{Me.current=null,!(e||Oe.current!==`thinking`)&&(Oe.current=`listening`,x(`listening`))},4e3));return}if(Oe.current=`listening`,De.current){De.current=!1,Ne();return}if(He&&!Ve&&!te.current&&!ce.current){Ve=!0,A=!0,pe=!0;try{F.current?.sendContextualUpdate?.(`CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. Do NOT speak right now. Wait silently for the visitor to speak first. The MOMENT the visitor says ANYTHING — a question, a request, or just a greeting — your ENTIRE next response must be EXACTLY this one sentence: "Before I answer that, could you please enter your email in the text box below?" Do NOT answer their question. Do NOT say anything about the topic. Do NOT begin an answer and then switch — your first word must be "Before". After you say that sentence, stay completely silent until you receive an EMAIL_SAVED message, then thank them briefly and answer their question in full.`)}catch{}}if(re&&!A){A=!0;try{F.current?.sendContextualUpdate?.(re)}catch{}}if(ze&&!Re){Re=!0;try{F.current?.sendContextualUpdate?.(ze)}catch{}}if(ye&&!pe){pe=!0;try{F.current?.sendContextualUpdate?.(ye)}catch{}}Ae.current&&clearTimeout(Ae.current),Ae.current=setTimeout(()=>{e||Oe.current!==`speaking`&&(je.current||(Ae.current=null,Oe.current=`listening`,x(`listening`)))},1200)}},onMessage:t=>{if(e||M.current&&t.role!==`user`&&!/email/i.test(String(t.message||``)))return;let n=t.role===`user`&&/^(Describe the section titled "|\[SYSTEM:|Give the visitor a complete spoken overview|That was the last section)/.test(String(t.message||``).trim()),r=/\b(?:this|that|the)\s+(?:case\s*stud(?:y|ies)|product|article|blog|post|item|service)\b/i.test(String(t.message||``));if(!n&&!r&&t.role===`user`&&L.test(String(t.message||``)))typeof window<`u`&&(window.__fe_user_nav_during_speech=null),le(!0),se.current=!1,ae.current=0,ue.current=-1,N.current=Xg(),setTimeout(()=>P.current?.(),400),console.log(`[FlowEngage] walkthrough armed — ${N.current.length} sections on this page`);else if(!n&&t.role===`user`&&oe.current){let e=String(t.message||``).trim();Ie.test(e)?se.current&&(se.current=!1,console.debug(`[FlowEngage] walkthrough resumed by visitor`),setTimeout(()=>P.current?.(),300)):(se.current=!0,console.debug(`[FlowEngage] walkthrough paused — visitor interjected`))}if(t.role!==`user`&&Fe.test(String(t.message||``))){let e=N.current.length;!e||ue.current>=e-1?le(!1):console.debug(`[FlowEngage] agent claimed completion at step ${ue.current+1}/${e} — ignoring, tour continues`)}let a=t.role===`user`?`user`:`bot`,o=t.message||t.text||t.content||``;if(o){if(a===`user`&&(fe.current=o,typeof window<`u`&&(window.__fe_user_nav_during_speech=null),je.current=!0,Ae.current&&=(clearTimeout(Ae.current),null),Oe.current!==`speaking`&&(x(`thinking`),Oe.current=`thinking`),He&&!Be&&!te.current&&!ce.current&&(Be=!0,j.current=o,M.current=!0,F.current?.injectAgentSpeech?.(`Before I answer that, could you please enter your email in the text box below?`,`interrupt`),F.current?.setMicMuted?.(!0),ne.current||(ne.current=!0,ie.current=0,ee(!0),Le()))),s.current=[...s.current,{sender:a,message:o,timestamp:new Date().toISOString(),debug:t.debug}],i)try{let e=cg(s.current);e&&_e(i,e)}catch{}if(i_(a,o)){De.current=!0;return}if(I.current&&a===`bot`&&/are you still there|still there\??|hello\?|anyone there|checking in|you there|are you available|is anyone|did you step away/i.test(o))if(Te.current+=1,Te.current===2)try{F.current?.sendContextualUpdate?.(`IMPORTANT: The visitor is muted and has not responded to your last 2 checks. Make exactly ONE more check. If there is still no response, say: 'I feel like you are not active, so I'm ending this session. You can connect with me anytime.' then immediately call the fwh-end-session-mvp tool to end the voice session. Do NOT ask again after that.`)}catch{}else Te.current>=5&&Ne(`minimized`)}},onError:t=>{if(!e&&!ge.current&&!he.current&&!Ee()){he.current=!0,console.error(`[FlowEngageVoiceCall] session:error`,{message:t?.message,name:t?.name,raw:t});try{F.current?.setMicMuted?.(!0)}catch{}C(!0),x(`error`),Ne(`chat`)}},onDisconnect:t=>{if(e||ge.current||he.current||Ee())return;let n=s.current?.length||0;console.warn(`[FlowEngageVoiceCall] session:disconnected`,{historyCount:n,reason:t?.reason,closeCode:t?.context?.code,closeReason:t?.context?.reason||t?.message,lastUserText:fe.current||``,wasMuted:I.current}),he.current=!0;try{F.current?.setMicMuted?.(!0)}catch{}C(!0),Ne(`chat`)}});if(e){console.warn(`[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately`),Ue.endSession().catch(()=>{});return}l=Ue,F.current=Ue,x(`listening`);try{sessionStorage.setItem(`el_conv_${i}`,Ue.getId())}catch{}parent.postMessage({type:`AGENT_EXPAND`},`*`);try{let e=typeof window<`u`?window.location.href:``,a=`[]`;try{a=await t[`fwh-list-forms-mvp`]()}catch{}let o=`none`;if(typeof window<`u`&&typeof document<`u`)try{let e=`#flowengage-root, .flowengage-shell, .flowengage-widget-root`,t=document.querySelector(`main, [role='main']`)||document.body,n=Array.from(t.querySelectorAll(`h1, h2, h3`)).filter(t=>!t.closest(e)).map(e=>e.textContent.replace(/\s+/g,` `).trim()).filter(e=>e.length>2&&e.length<200);n.length||(n=Array.from(document.body.querySelectorAll(`h1, h2, h3`)).filter(t=>!t.closest(e)).map(e=>e.textContent.replace(/\s+/g,` `).trim()).filter(e=>e.length>2&&e.length<200)),n.length&&(o=[...new Set(n)].slice(0,15).join(` | `))}catch{}let s=r&&!g?`RESUMING PRIOR SESSION — DO NOT GREET. The visitor is continuing the same conversation after a page reload. Do not introduce yourself or re-state your capabilities. Wait silently until the visitor speaks; if you must speak first, briefly acknowledge where you left off in one short sentence.\nPrior transcript:\n${n?.transcript||``}\n\n`:``;Ue.sendContextualUpdate(`${s}SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${o}. SiteId: ${i||`unknown`}. Forms: ${a}. ${p?``:`Visitor's email is already on file from a prior session — do NOT ask for it again. `}The visitor is ALREADY on this page — do NOT offer to navigate there. WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. The approximate headings above are for routing awareness ONLY — they are NOT precise enough for fwh-highlight-mvp. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`)}catch{}if(typeof window<`u`){let t=window.location.pathname,n=Date.now(),r=e=>{try{return(decodeURIComponent(e||`/`).replace(/\/+$/,``)||`/`).toLowerCase()}catch{return((e||`/`).replace(/\/+$/,``)||`/`).toLowerCase()}},i=()=>{if(e)return;let i=window.location.pathname;if(r(i)===r(t)){t=i;return}if(Date.now()-n<8e3){t=i;return}let a=typeof window<`u`&&window.__fe_agent_nav||null,o=k&&r(i)===r(k)||Hn()||a&&Date.now()-a.ts<15e3&&r(a.path)===r(i),s=t;t=i;let c=window.location.href,l=typeof document<`u`?document.title:``,u=typeof document<`u`?Array.from(document.querySelectorAll(`h1, h2, h3, h4`)).filter(e=>!e.closest(`#flowengage-root, .flowengage-shell`)).map(e=>({tag:e.tagName,text:e.textContent.trim()})).filter(e=>e.text.length>0&&e.text.length<200).slice(0,20):[];try{An()}catch{}let d=e=>(e.split(`/`).filter(Boolean).pop()||``).replace(/[-_]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())||`Home`,f=d(s),p=d(i);if(o){typeof window<`u`&&(window.__fe_agent_nav=null),console.log(`[FlowEngage] agent-driven navigation settled: "${s}" → "${i}"`);try{F.current?.sendUserMessage?.(`[SYSTEM: YOU just navigated the visitor to the "${p}" page (${c}) at their request — this was YOUR action, not theirs. Page title: "${l}". Sections: ${JSON.stringify(u)}. Say: "Here we are on the ${p} page." Then introduce this page in 2-3 sentences, and finish by asking: "Would you like me to walk you through it section by section?" NEVER say "I see you've navigated" — the visitor did not navigate, you did. Do NOT call fwh-navigate-mvp again. Wait for their answer before describing sections.]`,{suppressQuestion:!0})}catch{}return}typeof window<`u`&&(window.__fe_user_nav_during_speech={fromPath:s,toPath:i,fromPageName:f,toPageName:p,ts:Date.now()}),console.log(`[FlowEngage] visitor navigation detected: "${s}" → "${i}" (agent target: ${k||`none`})`);try{F.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${p}" page (${c}). Page title: "${l}". Sections: ${JSON.stringify(u)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${p} page — would you like me to continue what I was explaining, or shall I walk you through this page?" Then wait for my answer. IF I say continue/yes/carry on: resume speaking verbally from where you left off — do NOT call fwh-navigate-mvp, do NOT call fwh-highlight-mvp, the visitor will navigate themselves if needed. IF I want to hear about this page: call fwh-highlight-mvp for sections of "${p}" only.]`)}catch{}};f=window.history.pushState.bind(window.history),window.history.pushState=(...e)=>{f(...e),setTimeout(i,50)},h=()=>setTimeout(i,50),window.addEventListener(`popstate`,h)}}catch(r){e||(console.error(`[FlowEngage] startSession failed`,r),r.message&&r.message.includes(`Too many voice sessions`)?(alert(r.message),n&&n(`minimized`)):(x(`error`),be.current=`chat`,window.setTimeout(()=>{e||t?.()},0)))}})(),()=>{console.warn(`[FlowEngage:VoiceDebug] ⚠️ useEffect CLEANUP fired — session will be killed`,{agentId:r,siteId:i,apiBaseUrl:a}),e=!0,ge.current=!0;try{An()}catch{}if(i)try{ke(i)}catch{}typeof window<`u`&&(window.__fe_user_nav_during_speech=null),jr(),Ae.current&&=(clearTimeout(Ae.current),null),Me.current&&=(clearTimeout(Me.current),null),re.current&&=(clearTimeout(re.current),null),je.current=!1,Oe.current=`idle`,f&&typeof window<`u`&&(window.history.pushState=f),h&&typeof window<`u`&&window.removeEventListener(`popstate`,h);let t=l||F.current,n=Se.current,u=Ce.current;if(t?.endSession?.().catch(()=>{}),n&&o&&a){let e=u?Math.round((Date.now()-u)/1e3):0,t=JSON.stringify({chatId:o,voiceSessionId:n,duration:e,siteId:i}),r=`${a}/api/voice/save-chat-recording`;typeof navigator<`u`&&navigator.sendBeacon&&navigator.sendBeacon(r,new Blob([t],{type:`application/json`}))||fetch(r,{method:`POST`,headers:{"Content-Type":`application/json`},body:t,keepalive:!0}).catch(()=>{}),Se.current=null,Ce.current=null}typeof c==`function`&&s.current.length>0&&c(s.current).catch?.(()=>{})}},[r,i,a,Ne]),(0,b.useEffect)(()=>{if(!w)return;let e=e=>{let t=e.composedPath?.()?.[0]||e.target;we.current&&!we.current.contains(t)&&T(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[w]);let ze=async()=>{if(F.current)try{if(S){Te.current=0,await F.current.setMicMuted?.(!1),C(!1);try{F.current.sendContextualUpdate?.(`The visitor has unmuted. Resume normal interaction and wait for them to speak.`)}catch{}}else{Te.current=0,await F.current.setMicMuted?.(!0),C(!0);try{F.current.sendContextualUpdate?.(`The visitor has muted their microphone. Do NOT speak, ask if they are there, or prompt them in any way. Stay completely silent until they unmute.`)}catch{}}}catch{}},Be=(0,b.useCallback)(async e=>{e?.preventDefault?.();let t=D.trim().toLowerCase();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)){A(`Please enter a valid email address.`);return}A(``),te.current=!0,ne.current=!1,Pe(),ee(!1),O(``),M.current=!1;try{typeof f==`function`&&await f(t)}catch{}F.current?.setMicMuted?.(!1);let n=j.current;j.current=``;try{F.current?.injectAgentSpeech?.(`Thank you for submitting your email.`),F.current?.sendUserMessage?.(n||`The visitor's email is on file. Carry on helping them and never ask for it again.`)}catch{}},[D,f,Pe]),Ve=Array.isArray(e)&&e[0]||`#3B82F6`;return(0,V.jsxs)(`div`,{ref:we,style:{position:`relative`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`14px`,animation:`fe-orb-slide-up 0.42s cubic-bezier(0.16,1,0.3,1)`},children:[E&&(0,V.jsxs)(`form`,{onSubmit:Be,style:{width:`270px`,maxWidth:`calc(100vw - 40px)`,boxSizing:`border-box`,background:`rgba(15,22,36,0.97)`,backdropFilter:`blur(14px)`,WebkitBackdropFilter:`blur(14px)`,borderRadius:`16px`,boxShadow:`0 10px 40px rgba(0,0,0,0.45)`,padding:`16px`,display:`flex`,flexDirection:`column`,gap:`10px`,animation:`fe-orb-fade-in 0.18s ease`},children:[(0,V.jsx)(`span`,{style:{color:`white`,fontSize:`13px`,fontWeight:600,lineHeight:1.4},children:`Please enter your email to continue`}),(0,V.jsx)(`input`,{type:`email`,inputMode:`email`,autoComplete:`email`,autoFocus:!0,value:D,onChange:e=>{O(e.target.value),k&&A(``)},placeholder:`you@example.com`,style:{width:`100%`,boxSizing:`border-box`,padding:`10px 12px`,borderRadius:`10px`,border:k?`1.5px solid #ef4444`:`1.5px solid #4b5563`,background:`#1f2937`,color:`white`,fontSize:`14px`,outline:`none`}}),k&&(0,V.jsx)(`span`,{style:{color:`#f87171`,fontSize:`12px`},children:k}),(0,V.jsx)(`button`,{type:`submit`,disabled:!D.trim(),style:{width:`100%`,padding:`10px 12px`,borderRadius:`10px`,border:`none`,background:D.trim()?Ve:`#374151`,color:`white`,fontSize:`14px`,fontWeight:600,cursor:D.trim()?`pointer`:`default`,transition:`background 0.2s ease`},children:`Submit`})]}),(0,V.jsxs)(`div`,{style:{position:`relative`},children:[(y===`listening`||y===`thinking`)&&!S&&(0,V.jsx)(`span`,{style:{position:`absolute`,right:`100%`,marginRight:`18px`,top:`50%`,transform:`translateY(-50%)`,color:`white`,fontSize:`18px`,fontWeight:600,letterSpacing:`0.01em`,textShadow:`0 2px 4px rgba(0,0,0,0.4)`,whiteSpace:`nowrap`},children:y===`thinking`?g:h}),S&&(0,V.jsx)(`span`,{style:{position:`absolute`,right:`100%`,marginRight:`18px`,top:`50%`,transform:`translateY(-50%)`,color:`#f87171`,fontSize:`16px`,fontWeight:600,letterSpacing:`0.01em`,textShadow:`0 2px 4px rgba(0,0,0,0.4)`,whiteSpace:`nowrap`},children:`Muted`}),(0,V.jsx)(a_,{size:72,voiceState:y,isMuted:S,orbColors:e})]}),y===`error`&&(0,V.jsx)(`span`,{style:{color:`#f87171`,fontSize:`13px`,fontWeight:500},children:`Could not start voice session.`}),(0,V.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,alignItems:`center`},children:[(0,V.jsx)(`button`,{onClick:ze,title:S?`Unmute`:`Mute`,style:{width:`24px`,height:`24px`,borderRadius:`50%`,background:S?`#7f1d1d`:`#1f2937`,border:S?`1.5px solid #ef4444`:`1.5px solid #4b5563`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:S?`#f87171`:`white`,transition:`all 0.2s ease`,boxShadow:`0 2px 8px rgba(0,0,0,0.4)`,padding:0,flexShrink:0},children:S?(0,V.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`line`,{x1:`1`,y1:`1`,x2:`23`,y2:`23`}),(0,V.jsx)(`path`,{d:`M9 9v3a3 3 0 005.12 2.12M15 9.34V4a3 3 0 00-5.94-.6`}),(0,V.jsx)(`path`,{d:`M17 16.95A7 7 0 015 12v-2m14 0v2a7 7 0 01-.11 1.23`}),(0,V.jsx)(`line`,{x1:`12`,y1:`19`,x2:`12`,y2:`23`}),(0,V.jsx)(`line`,{x1:`8`,y1:`23`,x2:`16`,y2:`23`})]}):(0,V.jsx)(fh,{size:16,color:`currentColor`})}),(0,V.jsx)(`button`,{onClick:()=>T(e=>!e),style:{width:`24px`,height:`24px`,borderRadius:`50%`,background:`#1f2937`,border:`1.5px solid #4b5563`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`white`,transition:`background 0.2s ease`,boxShadow:`0 2px 8px rgba(0,0,0,0.4)`,padding:0,flexShrink:0},children:(0,V.jsx)(bh,{size:16,color:`currentColor`})})]}),w&&(0,V.jsxs)(`div`,{style:{position:`absolute`,bottom:0,right:0,width:`230px`,zIndex:9999,background:`rgba(15,22,36,0.96)`,backdropFilter:`blur(14px)`,WebkitBackdropFilter:`blur(14px)`,borderRadius:`16px`,boxShadow:`0 10px 40px rgba(0,0,0,0.45)`,animation:`fe-orb-fade-in 0.18s ease`,padding:`12px 12px 40px`},children:[(0,V.jsxs)(`button`,{onClick:()=>{T(!1),be.current=`chat`,Re(t)},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`12px 16px`,background:`none`,border:`none`,color:`white`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`,borderRadius:`8px`,whiteSpace:`nowrap`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,V.jsx)(xh,{}),_]}),(0,V.jsxs)(`button`,{onClick:()=>{T(!1),be.current=`minimized`,Re(n)},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`12px 16px`,background:`none`,border:`none`,color:`#E30C12`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`,borderRadius:`8px`,whiteSpace:`nowrap`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(227,12,18,0.1)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,V.jsx)(Sh,{}),v]}),(0,V.jsx)(`button`,{onClick:()=>T(!1),style:{position:`absolute`,bottom:`8px`,right:`8px`,width:`24px`,height:`24px`,borderRadius:`50%`,background:`rgba(255,255,255,0.15)`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:`white`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.25)`},onMouseLeave:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.15)`},children:(0,V.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,V.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})]})}function l_({orbColors:e}){let t=Array.isArray(e)&&e.length>0?e:[`#135bd8`,`#ef334b`,`#ffbd2e`],n=t[0],r=t[1]||t[0],i=t[2]||t[0];return(0,V.jsx)(`div`,{style:{width:`32px`,height:`32px`,borderRadius:`50%`,flexShrink:0,background:`
|
|
349
|
+
radial-gradient(circle at 18% 50%, ${n} 0%, ${n}99 35%, transparent 65%),
|
|
350
|
+
radial-gradient(circle at 82% 50%, ${r} 0%, ${r}99 35%, transparent 65%),
|
|
351
|
+
radial-gradient(circle at 50% 82%, ${i} 0%, ${i}99 30%, transparent 58%),
|
|
352
|
+
white
|
|
353
|
+
`.replace(/\s+/g,` `).trim()}})}var u_=()=>(0,V.jsx)(`div`,{style:{display:`flex`,marginBottom:`12px`,justifyContent:`flex-start`},children:(0,V.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`5px`,padding:`12px 16px`,borderRadius:`18px`,background:`#fff`,boxShadow:`0 2px 6px rgba(0,0,0,0.04)`},children:[0,1,2].map(e=>(0,V.jsx)(`span`,{style:{width:`7px`,height:`7px`,borderRadius:`50%`,background:`#9ca3af`,animation:`fe-dot-bounce 1.2s ease-in-out ${e*.2}s infinite`,display:`inline-block`}},e))})});function d_({copy:e,orbColors:t,primaryColor:n,chatBgGradient:r,logo:i,quickChatOptions:a,onQuickChatSelect:o,isMobile:s,chatHistory:c,isAiTyping:l,isAgentTyping:u,activeScreen:d,agentName:f,agentHeadshot:p,fallbackAgentName:m,input:h,setInput:g,onSubmit:_,isConversationEnded:v,isLoading:y,isRateLimited:x,rateLimitMessage:S,selectedFile:C,onFileSelect:w,onRemoveSelectedFile:T,attachmentError:E,isUploadingAttachment:ee,requiresEmail:D,emailInput:O,setEmailInput:k,emailError:A,emailCaptureSuccess:te,replyContext:ne,setReplyContext:re,webRTCError:ie,micError:j,setMicError:M,dismissCallError:ae,activeCallId:oe,isCallMuted:se,toggleCallMute:ce,endWebRTCCall:N,formatCallDuration:P,callDurationSeconds:le,isCallMinimized:ue,onExpand:F,onCollapse:de,onStartVoice:fe,voiceEnabled:pe,headerBgColor:me,onNewChat:I,showPoweredBy:he,privacyPolicyUrl:ge,getVisitorChatHistory:_e,resumeChat:ve,isSessionRestoring:ye,isClosing:be}){let xe=c.length>0,Se=y||x||v,Ce=!!oe,[we,Te]=(0,b.useState)(!1),[Ee,De]=(0,b.useState)(!1),[Oe,ke]=(0,b.useState)([]),[Ae,je]=(0,b.useState)(!1),Me=(0,b.useRef)(null),[Ne,Pe]=(0,b.useState)(()=>typeof window<`u`?window.visualViewport?.height??window.innerHeight:600),[L,Fe]=(0,b.useState)(0);(0,b.useEffect)(()=>{if(!s)return;let e=window.visualViewport;if(!e)return;let t=()=>{Pe(e.height),Fe(Math.max(0,window.innerHeight-e.offsetTop-e.height))};return e.addEventListener(`resize`,t),e.addEventListener(`scroll`,t),t(),()=>{e.removeEventListener(`resize`,t),e.removeEventListener(`scroll`,t)}},[s]);let Ie=s&&window.innerHeight-Ne>150,Le=async()=>{Te(!1),De(!0),je(!0);try{let e=await _e();e?.data&&ke(e.data)}catch(e){console.error(e)}finally{je(!1)}},Re=async e=>{De(!1),ve?.(e.chatId)};return(0,b.useEffect)(()=>{if(!we)return;let e=e=>{let t=e.composedPath?.()?.[0]||e.target;Me.current&&!Me.current.contains(t)&&Te(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[we]),(0,V.jsxs)(`div`,{style:s?{"--flowengage-primary":n,"--flowengage-accent":n,position:`fixed`,left:`0`,right:`0`,bottom:`${L}px`,height:Ne>0?`${Math.round(Ne*(Ie?1:.92))}px`:`90dvh`,background:r,borderRadius:`16px 16px 0 0`,display:`flex`,flexDirection:`column`,overflow:`hidden`,animation:be?`fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards`:`fe-orb-slide-up 0.28s cubic-bezier(0.16,1,0.3,1)`}:{"--flowengage-primary":n,"--flowengage-accent":n,width:`min(350px, calc(100vw - 40px))`,height:`min(640px, calc(100vh - 120px))`,background:r,borderRadius:`22px`,boxShadow:`0 24px 64px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08)`,display:`flex`,flexDirection:`column`,overflow:`hidden`,position:`relative`,animation:be?`fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards`:`fe-orb-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)`},children:[(0,V.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`40px minmax(0, 1fr) 40px`,alignItems:`center`,columnGap:`14px`,padding:`16px 10px 14px`,background:me||`transparent`,flexShrink:0,position:`relative`,zIndex:30},children:[(0,V.jsx)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:(0,V.jsx)(`button`,{onClick:de,style:{width:`40px`,height:`40px`,background:`none`,border:`none`,cursor:`pointer`,color:`#6b7280`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`4px`,borderRadius:`10px`,transition:`color 0.15s ease`,flexShrink:0},onMouseEnter:e=>{e.currentTarget.style.color=`#111827`},onMouseLeave:e=>{e.currentTarget.style.color=`#6b7280`},children:(0,V.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})})}),(()=>{let t=!!i,n=!!e.hasCustomTitle,r=t||n,a=t||!r,o=n||!r,c=a&&o;return(0,V.jsxs)(`div`,{style:{minWidth:0,maxWidth:s?`100%`:`250px`,width:`100%`,justifySelf:`center`,display:`grid`,gridTemplateColumns:c?`minmax(72px, 40%) minmax(0, 60%)`:`1fr`,columnGap:c?`12px`:0,alignItems:`center`,justifyItems:c?`stretch`:`center`},children:[a&&(0,V.jsx)(`div`,{style:{minWidth:0,display:`flex`,alignItems:`center`,justifyContent:`center`,height:`40px`},children:i?(0,V.jsx)(n_,{logo:i,style:{height:`34px`,width:`100%`,maxWidth:`96px`}}):(0,V.jsx)(`div`,{style:{width:`40px`,height:`40px`,flexShrink:0},children:(0,V.jsx)(r_,{title:e.chatTitle})})}),o&&(0,V.jsx)(`div`,{style:{minWidth:0,display:`flex`,alignItems:`center`,justifyContent:c?`flex-start`:`center`},children:(0,V.jsx)(`span`,{style:{fontSize:`15px`,fontWeight:600,color:`#111827`,letterSpacing:`-0.01em`,lineHeight:1.2,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.chatTitle,children:e.chatTitle})})]})})(),(0,V.jsxs)(`div`,{style:{position:`relative`,isolation:`isolate`,zIndex:10},ref:Me,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>Te(e=>!e),style:{width:`40px`,height:`40px`,background:`none`,border:`none`,cursor:`pointer`,color:`#6b7280`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`4px`,borderRadius:`10px`,transition:`color 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.color=`#111827`},onMouseLeave:e=>{e.currentTarget.style.color=`#6b7280`},"aria-label":`Chat options`,children:(0,V.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`currentColor`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,V.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1.5`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`}),(0,V.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1.5`})]})}),we&&(0,V.jsxs)(`div`,{style:{position:`absolute`,top:`34px`,right:0,background:`rgba(15,22,36,0.96)`,backdropFilter:`blur(14px)`,WebkitBackdropFilter:`blur(14px)`,borderRadius:`16px`,overflow:`hidden`,boxShadow:`0 10px 40px rgba(0,0,0,0.45)`,minWidth:`210px`,border:`1px solid rgba(255,255,255,0.07)`,animation:`fe-orb-fade-in 0.18s ease`},children:[pe&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{Te(!1),fe?.()},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`14px 18px`,background:`none`,border:`none`,color:`white`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,V.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{d:`M12 1a4 4 0 014 4v6a4 4 0 01-8 0V5a4 4 0 014-4z`}),(0,V.jsx)(`path`,{d:`M19 10a7 7 0 01-14 0M12 19v4M8 23h8`})]}),`Enter Voice Mode`]}),(0,V.jsx)(`div`,{style:{height:`1px`,background:`rgba(255,255,255,0.07)`,margin:`0 14px`}})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{Te(!1),I?.()},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`14px 18px`,background:`none`,border:`none`,color:`white`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,V.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`path`,{d:`M12 5H5a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-7`}),(0,V.jsx)(`path`,{d:`M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z`})]}),`Start new chat`]}),_e&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{style:{height:`1px`,background:`rgba(255,255,255,0.07)`,margin:`0 14px`}}),(0,V.jsxs)(`button`,{type:`button`,onClick:Le,style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`14px 18px`,background:`none`,border:`none`,color:`white`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(255,255,255,0.08)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,V.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`path`,{d:`M12 8v4l3 3M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z`})}),`Chat history`]})]}),(0,V.jsx)(`div`,{style:{height:`1px`,background:`rgba(255,255,255,0.07)`,margin:`0 14px`}}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{Te(!1),de?.()},style:{display:`flex`,alignItems:`center`,gap:`12px`,width:`100%`,padding:`14px 18px`,background:`none`,border:`none`,color:`#f87171`,fontSize:`14px`,fontWeight:500,cursor:`pointer`,textAlign:`left`,transition:`background 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`rgba(248,113,113,0.1)`},onMouseLeave:e=>{e.currentTarget.style.background=`none`},children:[(0,V.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,V.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,V.jsx)(`line`,{x1:`15`,y1:`9`,x2:`9`,y2:`15`}),(0,V.jsx)(`line`,{x1:`9`,y1:`9`,x2:`15`,y2:`15`})]}),`Close conversation`]})]})]})]}),(0,V.jsx)(Wh,{webRTCError:ie,micError:j,setMicError:M,dismissCallError:ae,isRateLimited:x,rateLimitMessage:S}),ue&&(0,V.jsx)(sg,{agentName:f,agentHeadshot:p,fallbackAgentName:m,callDurationSeconds:le,isCallMuted:se,formatCallDuration:P,toggleCallMute:ce,endWebRTCCall:N,onExpand:F,primaryColor:n}),(0,V.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0,background:`transparent`,position:`relative`},children:[Ee?(0,V.jsxs)(`div`,{style:{position:`absolute`,inset:0,background:`white`,zIndex:20,display:`flex`,flexDirection:`column`,animation:`fe-orb-fade-in 0.2s ease`},children:[(0,V.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,padding:`16px`,borderBottom:`1px solid #f3f4f6`,flexShrink:0},children:(0,V.jsxs)(`button`,{onClick:()=>De(!1),style:{background:`none`,border:`none`,cursor:`pointer`,display:`flex`,alignItems:`center`,color:`#6b7280`},children:[(0,V.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,V.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),(0,V.jsx)(`span`,{style:{marginLeft:`8px`,fontWeight:500,fontSize:`15px`},children:`Return to Chat`})]})}),(0,V.jsx)(`div`,{style:{flex:1,overflowY:`auto`,position:`relative`},children:Ae?(0,V.jsx)(`div`,{style:{padding:`40px 20px`,textAlign:`center`,color:`#6b7280`,fontSize:`14px`},children:`Loading past conversations...`}):Oe.length>0?(0,V.jsx)(`div`,{children:Oe.map(e=>(0,V.jsxs)(`div`,{onClick:()=>Re(e),style:{padding:`16px 20px`,borderBottom:`1px solid #f3f4f6`,cursor:`pointer`,transition:`background 0.15s ease`},onMouseEnter:e=>e.currentTarget.style.background=`#f9fafb`,onMouseLeave:e=>e.currentTarget.style.background=`white`,children:[(0,V.jsxs)(`div`,{style:{fontSize:`12px`,color:`#6b7280`,marginBottom:`6px`,fontWeight:500},children:[new Date(e.createdAt).toLocaleDateString(void 0,{month:`short`,day:`numeric`}),` at `,new Date(e.createdAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})]}),(0,V.jsx)(`div`,{style:{fontSize:`14.5px`,color:`#111827`,opacity:.9,overflow:`hidden`,textOverflow:`ellipsis`,display:`-webkit-box`,WebkitLineClamp:2,WebkitBoxOrient:`vertical`,lineHeight:1.4},children:e.message||`Conversation`})]},e.chatId))}):(0,V.jsx)(`div`,{style:{padding:`40px 20px`,textAlign:`center`,color:`#9ca3af`,fontSize:`14px`},children:`No previous chats found.`})})]}):null,xe?(0,V.jsx)(Vh,{chatHistory:c,isAiTyping:l,isLoading:y,isAgentTyping:u,setReplyContext:re,TypingDots:u_,primaryColor:n,agentHeadshot:p,agentDisplayName:f||m,botAvatarNode:(0,V.jsx)(l_,{orbColors:t})}):ye?(0,V.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`16px`},children:[(0,V.jsx)(`div`,{style:{width:`28px`,height:`28px`,border:`3px solid #f3f4f6`,borderTop:`3px solid ${n}`,borderRadius:`50%`,animation:`spin 1s linear infinite`},children:(0,V.jsx)(`style`,{children:`@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }`})}),(0,V.jsx)(`div`,{style:{color:`#6b7280`,fontSize:`14px`,fontWeight:500,animation:`fe-orb-fade-in 1s infinite alternate`},children:`Loading chat...`})]}):(0,V.jsxs)(`div`,{style:{flex:1,overflowY:`auto`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`22px`,padding:`28px 24px`},children:[(0,V.jsx)(a_,{size:94,orbColors:t}),(0,V.jsx)(`p`,{style:{margin:0,textAlign:`center`,fontSize:`16px`,color:`#374151`,lineHeight:1.55,maxWidth:`270px`},children:e.introGreeting}),a.length>0&&(0,V.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`8px`,justifyContent:`center`,width:`100%`,padding:`0 8px`},children:a.map(e=>(0,V.jsx)(`button`,{onClick:()=>o?.(e),style:{padding:`8px 16px`,borderRadius:`999px`,background:`white`,border:`1.5px solid ${n}33`,color:n||`#374151`,fontSize:`13px`,fontWeight:500,cursor:`pointer`,transition:`all 0.15s ease`,boxShadow:`0 1px 4px rgba(0,0,0,0.06)`},onMouseEnter:e=>{e.currentTarget.style.background=`${n}12`,e.currentTarget.style.borderColor=n},onMouseLeave:e=>{e.currentTarget.style.background=`white`,e.currentTarget.style.borderColor=`${n}33`},children:e.label||e.text},e.id))})]})]}),te&&(0,V.jsxs)(`div`,{style:{margin:`0 16px 8px`,padding:`9px 14px`,borderRadius:`12px`,background:`#ecfdf5`,border:`1px solid #6ee7b7`,display:`flex`,alignItems:`center`,gap:`8px`,animation:`fe-orb-fade-in 0.2s ease`,flexShrink:0},children:[(0,V.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`#10b981`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{flexShrink:0},children:(0,V.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),(0,V.jsx)(`span`,{style:{fontSize:`13px`,fontWeight:500,color:`#065f46`},children:`Email saved — we'll be in touch!`})]}),(0,V.jsx)(`div`,{style:{background:`transparent`,flexShrink:0,position:`relative`,zIndex:1,padding:D?`6px 0 0`:`12px 0 0`},children:(0,V.jsx)(Uh,{input:h,setInput:g,onSubmit:_,isConversationEnded:v,callUiActive:Ce,handleToggleVoice:fe,showVoiceToggle:d===`agent`,activeScreen:d,inputDisabled:Se,replyContext:ne,clearReplyContext:()=>re(null),onFileSelect:w,selectedFile:C,onRemoveSelectedFile:T,attachmentError:E,isUploadingAttachment:ee,requiresEmail:D,emailInput:O,setEmailInput:k,emailError:A,inputPlaceholder:e.inputPlaceholder})}),!Ie&&(0,V.jsxs)(`div`,{style:{flexShrink:0,textAlign:`center`,padding:`8px 20px`,paddingBottom:`max(12px, env(safe-area-inset-bottom, 12px))`,pointerEvents:`none`},children:[ge&&(0,V.jsxs)(`p`,{style:{margin:`0 0 4px`,fontSize:`10px`,color:`#9ca3af`,lineHeight:1.4,userSelect:`none`,pointerEvents:`auto`},children:[`This conversation is recorded for quality assurance purposes.`,` `,(0,V.jsx)(`a`,{href:ge,target:`_blank`,rel:`noopener noreferrer`,style:{color:`#6b7280`,textDecoration:`underline`},children:`See our privacy policy`})]}),he&&(0,V.jsxs)(`span`,{style:{fontSize:`11px`,color:`#9ca3af`,letterSpacing:`0.01em`,userSelect:`none`},children:[`Powered by `,(0,V.jsx)(`strong`,{style:{fontWeight:600,color:`#6b7280`},children:`FlowEngage`})]})]})]})}function f_(){let{status:e,runtimeConfig:t,resolvedConfig:n,chatHistory:r,isOpen:i,activeScreen:a,isHumanHandled:o,agentName:s,agentHeadshot:c,visitorEmail:l,isAgentTyping:u,isAiTyping:d,isLoading:f,isRateLimited:p,rateLimitMessage:m,isConversationEnded:h,incomingCall:g,activeCallId:_,callConnectionState:v,callConnectedAt:y,isCallMuted:x,webRTCError:S,language:C,chatId:w,historyRef:T,onMessageSync:E,sendMessage:ee,uploadChatFile:D,openWidget:O,captureVisitorEmail:k,setVoiceMode:A,endConversation:te,startNewChat:ne,acceptCall:re,rejectCall:ie,endWebRTCCall:ae,toggleCallMute:oe,dismissCallError:se,startTyping:ce,stopTyping:N,updateTypingDraft:P,getVisitorChatHistory:le,resumeChat:ue,isSessionRestoring:F,openToChatCounter:de,voiceEndCounter:fe}=Tn();(0,b.useEffect)(()=>{try{lr()}catch{}},[]),(0,b.useEffect)(()=>{de&&Ze!==`voice_mode`&&Ze!==`text_chat`&&Ze!==`call_screen`&&(A?.(!1),Qe(`text_chat`))},[de]);let pe=t?.widgetSettings||{},me=n?.widgetSettings||{},I={...pe.branding||{},...me.branding||{}},he={...pe.theme||{},...me.theme||{}},ge={...pe.features||{},...me.features||{}},_e=ge.voice!==!1,be=Array.isArray(he.orbColors)&&he.orbColors.length>0?he.orbColors:null,xe=he.buttonColor||he.primaryColor||be?.[0]||`#3B82F6`,Ce={small:50,medium:64,large:80},we=Ce[he.orbSize]||Ce.small,Ee=he.position||`bottom-right`,De=I.fallbackAgentName||`Agent`,Oe=$g(be??he.chatBgColors),ke=I.logo||I.logoUrl||null,Ae=C||`en`,je=pe.recommendations?.[Ae]||[],Me=(me.recommendations?.[Ae]??je).filter(e=>String(e?.label??``).trim()).map((e,t)=>({id:e.key||`qr-${t}`,label:e.label,message:e.label,text:e.label})),Ne=Array.isArray(I.quickChatOptions)&&I.quickChatOptions.length>0?I.quickChatOptions:Me,Pe=I.hideWatermark===!0?!1:I.showPoweredBy!==!1,L=I.headerBgColor||null,Fe=he.bottomPosition==null?`1.5rem`:`${he.bottomPosition}px`,Ie=I.privacyPolicyUrl||null,Le=I.chatbotEnabled!==!1&&he.chatbotEnabled!==!1,[Re,ze]=(0,b.useState)(()=>typeof window<`u`?window.location.pathname:`/`);(0,b.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>ze(window.location.pathname),t=window.history.pushState.bind(window.history);return window.history.pushState=(...n)=>{t(...n),setTimeout(e,50)},window.addEventListener(`popstate`,e),()=>{window.history.pushState=t,window.removeEventListener(`popstate`,e)}},[]);let Be=(()=>{let e={...pe.pageVisibility||{},...me.pageVisibility||{}};return Array.isArray(e.allowedPaths)?e.allowedPaths.filter(Boolean):[]})(),Ve=Be.length===0||Be.some(e=>e===`*`||e===`/*`?!0:e.endsWith(`/*`)?Re.startsWith(e.slice(0,-1)):Re.replace(/\/$/,``)===e.replace(/\/$/,``)),He=pe.greetings?.[C]||me.greetings?.[C]||I.introGreeting||`Hello, I'm here to help you know more about OpenSense Labs.`,Ue={entryPrompt:I.entryPrompt||`Do you want to explore in a new way?`,yesLabel:I.yesLabel||`Yes`,laterLabel:I.laterLabel||`Later`,connectionTitle:I.connectionTitle||`How would you like to connect?`,connectionSubtitle:I.connectionSubtitle||``,voiceLabel:I.voiceLabel||`Voice`,textLabel:I.textLabel||`Text`,chatTitle:I.headerName||`Chat with FlowEngage`,hasCustomTitle:!!(I.headerName&&String(I.headerName).trim()),introGreeting:He,inputPlaceholder:I.inputPlaceholder||`Type your message`,analysingLabel:I.analysingLabel||`analysing...`},We=me.elevenLabsAgentId||t?.elevenLabsAgentId||null,Ge=t?.siteId||n?.siteId||null,Ke=t?.apiBaseUrl||``;(0,b.useEffect)(()=>{Yn(t?.siteType||null)},[t?.siteType]);let qe=(0,b.useMemo)(()=>s&&String(s).trim()||t?.ownerName&&String(t.ownerName).trim()||t?.websiteName&&String(t.websiteName).trim()||`Agent`,[s,t?.ownerName,t?.websiteName]),Je=c&&String(c).trim()||t?.ownerProfileImageUrl&&String(t.ownerProfileImageUrl).trim()||null,R=r.some(e=>e.sender===`user`),Ye=(0,b.useMemo)(()=>{let e=r.findIndex(e=>e.sender===`user`);return e===-1?!1:r.slice(e+1).some(e=>e.sender===`bot`||e.sender===`ai`||e.sender===`agent`)},[r]),Xe=!!(me._dashboardLivePreview||pe._dashboardLivePreview),[Ze,Qe]=(0,b.useState)(()=>Xe?`text_chat`:`entry_prompt`),[$e,et]=(0,b.useState)(``),[tt,nt]=(0,b.useState)(null),[rt,it]=(0,b.useState)(l||``),[at,ot]=(0,b.useState)(``),[st,z]=(0,b.useState)(!1),[ct,lt]=(0,b.useState)(0),[ut,dt]=(0,b.useState)(null),[ft,pt]=(0,b.useState)(null),[mt,ht]=(0,b.useState)(``),[gt,_t]=(0,b.useState)(!1),[vt,yt]=(0,b.useState)(!1),[bt,xt]=(0,b.useState)(!1),St=(0,b.useRef)(null),Ct=(0,b.useRef)(!1),wt=!l&&R&&Ye&&Ze!==`voice_mode`;(0,b.useLayoutEffect)(()=>{if(e!==`ready`||Ct.current)return;if(Ct.current=!0,!_e){Qe(`minimized_orb`);return}let t=!1;try{t=xr().shouldResumeVoice}catch{}let n=Se(),r=Ge?ve(Ge):null,i=n||!!r?.transcript;if(t){O?.({notifyChatInitiated:!0}),A?.(!0),Qe(`voice_mode`);return}if(Te()){O?.({notifyChatInitiated:!1}),Qe(`text_chat`);return}if(i){if((typeof performance<`u`?performance.getEntriesByType?.(`navigation`)?.[0]?.type??`navigate`:`navigate`)===`reload`){Qe(`minimized_orb`);return}O?.({notifyChatInitiated:!0}),A?.(!0),Qe(`voice_mode`);return}if(Ge)try{ye(Ge)}catch{}if(j(Ge)){Qe(`minimized_orb`);return}},[e,r]);let[Tt,Et]=(0,b.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: 640px)`).matches);(0,b.useEffect)(()=>{let e=window.matchMedia(`(max-width: 640px)`),t=e=>Et(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,b.useEffect)(()=>{it(l||``),l&&ot(``)},[l]);let Dt=(0,b.useCallback)(()=>{pt(null),ht(``)},[]),Ot=(0,b.useCallback)(e=>{let t=Ih(e);if(t){pt(null),ht(t);return}pt(e),ht(``)},[]);(0,b.useEffect)(()=>{if(!y||v!==`connected`){lt(0);return}let e=()=>{let e=new Date(y).getTime();isNaN(e)||lt(Math.max(0,Math.floor((Date.now()-e)/1e3)))};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)},[y,v]);let kt=(0,b.useCallback)(()=>{Qe(`call_screen`),yt(!1)},[]),At=(0,b.useCallback)(()=>{Qe(`text_chat`),yt(!0)},[]);(0,b.useEffect)(()=>{let e=g?.callId||_||null;if(!e){St.current=null;return}if(g?.callId||v===`connecting`||v===`connected`){if(Ze===`minimized_orb`&&vt&&_&&!g?.callId){St.current=e;return}!(!i||Ze===`minimized_orb`||Ze===`voice_mode`)&&St.current===e||(console.log(`[FlowEngageWidget] forcing call UI to front`,{forcedKey:e,isOpen:i,surface:Ze,hasIncomingCall:!!g?.callId,activeCallId:_,callConnectionState:v}),St.current=e,Ze===`voice_mode`&&A?.(!1),O?.(),kt())}},[_,v,kt,g?.callId,i,O,A,Ze]),(0,b.useEffect)(()=>{!g&&!_&&Ze===`call_screen`&&Qe(`text_chat`)},[g,_,Ze]),(0,b.useEffect)(()=>{!_&&vt&&yt(!1)},[_,vt]),(0,b.useEffect)(()=>{if(!o||h){P?.(``),N?.();return}if(!$e.trim()||ft){P?.(``);let e=window.setTimeout(()=>N?.(),100);return()=>window.clearTimeout(e)}ce?.();let e=window.setTimeout(()=>P?.($e),120),t=window.setTimeout(()=>N?.(),1200);return()=>{window.clearTimeout(e),window.clearTimeout(t)}},[$e,ft,o,h,ce,N,P]);let jt=e=>e?{replyTo:e.messageId||e.id||null,replyToContent:(e.replyToContent||e.message||``).replace(/<[^>]+>/g,``).trim().slice(0,200),replyToSender:e.sender||null}:null,Mt=async e=>{if(e.preventDefault(),h)return;if(wt){let e=rt.trim().toLowerCase();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)){ot(`Please enter a valid email so we can continue helping you.`);return}await k(e),ot(``),z(!0),setTimeout(()=>z(!1),3e3);return}let t=jt(tt);if(!$e.trim()&&!ft)return;if(ft){try{_t(!0),ht(``);let e=await D(ft),n=e?.data||e,r=$e.trim()||`Shared file: ${Rh(ft)}`;et(``),nt(null),Dt(),await ee(r,``,t,{type:`file`,metadata:{fileUrl:n?.fileUrl,fileName:n?.fileName||ft.name,fileType:n?.fileType||ft.type,fileSize:n?.fileSize||ft.size}})}catch(e){ht(e?.message||`Failed to upload the selected file.`)}finally{_t(!1)}return}let n=$e.trim();et(``),nt(null),await ee(n,``,t)},Nt=(0,b.useCallback)(()=>{r.length!==0&&ne?.()},[r.length,ne]),Pt=e=>{let t=Math.floor(e/60);return`${String(t).padStart(2,`0`)}:${String(e%60).padStart(2,`0`)}`},Ft=(0,b.useCallback)(async e=>{if(h||f)return;let t=e.message||e.label||e.text||``;t.trim()&&await ee(t.trim(),``)},[h,f,ee]),It=Tt&&Ze===`entry_prompt`?{inset:0}:Tt&&Ze===`text_chat`?{left:0,right:0,bottom:0}:Tt&&Ze===`call_screen`?{left:0,right:0,bottom:0,height:`90dvh`,overflow:`hidden`,borderRadius:`16px 16px 0 0`}:Tt&&Ze===`connection_modal`?{left:`12px`,right:`12px`,bottom:`12px`}:Ze===`call_screen`?{width:`min(350px, calc(100vw - 40px))`,height:`min(640px, calc(100vh - 120px))`,borderRadius:`22px`,overflow:`hidden`,...Ee===`bottom-left`?{left:`1.5rem`,bottom:Fe}:{right:`1.5rem`,bottom:Fe}}:Ee===`bottom-left`?{left:`1.5rem`,bottom:Fe}:{right:`1.5rem`,bottom:Fe},Lt=(0,b.useCallback)(()=>{Ze!==`minimized_orb`&&(xt(!0),setTimeout(()=>{Qe(`minimized_orb`),xt(!1),_&&yt(!0)},280))},[_,Ze]),Rt=()=>Qe(`connection_modal`),zt=()=>{try{let e=window.AudioContext||window.webkitAudioContext;if(e){let t=new e;t.resume().catch(()=>{}),setTimeout(()=>t.close().catch(()=>{}),3e3)}}catch{}O({notifyChatInitiated:!0}),A?.(!0),Qe(`voice_mode`)},Bt=()=>{O({notifyChatInitiated:!0}),A?.(!1),Qe(`text_chat`)},Vt=()=>{A?.(!1),Lt()};return e!==`ready`||!Le||ge.chat===!1||!Ve?null:(0,V.jsxs)(`div`,{className:`flowengage-widget-root`,style:{position:`fixed`,zIndex:999999,...It},onWheel:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),children:[Ze===`entry_prompt`&&(0,V.jsx)(o_,{copy:Ue,orbColors:be,primaryColor:xe,onYes:()=>{M(Ge),zt()},onLater:()=>{M(Ge),Lt()},isMobile:Tt,isClosing:bt}),Ze===`minimized_orb`&&(0,V.jsxs)(Km.div,{layoutId:`fe-main-orb`,initial:{scale:.4,opacity:0},animate:{scale:1,opacity:1},transition:{type:`spring`,stiffness:280,damping:18},style:{transformOrigin:`bottom right`,display:`inline-flex`,flexDirection:`column`,alignItems:Ee===`bottom-left`?`flex-start`:`flex-end`,gap:`10px`},children:[_&&(0,V.jsxs)(`button`,{type:`button`,onClick:kt,style:{maxWidth:Tt?`220px`:`240px`,padding:`10px 14px`,borderRadius:`18px`,border:`1px solid rgba(255,255,255,0.7)`,background:`rgba(255,255,255,0.94)`,backdropFilter:`blur(18px)`,WebkitBackdropFilter:`blur(18px)`,boxShadow:`0 10px 26px rgba(15,23,42,0.14)`,display:`flex`,alignItems:`center`,gap:`10px`,cursor:`pointer`,textAlign:`left`},children:[(0,V.jsx)(`span`,{style:{width:`9px`,height:`9px`,borderRadius:`50%`,background:`#22c55e`,boxShadow:`0 0 0 4px rgba(34,197,94,0.16)`,flexShrink:0}}),(0,V.jsxs)(`span`,{style:{minWidth:0},children:[(0,V.jsx)(`span`,{style:{display:`block`,fontSize:`12px`,fontWeight:700,color:`#111827`,lineHeight:1.2},children:v===`connected`?`Call in progress`:`Call is active`}),(0,V.jsx)(`span`,{style:{display:`block`,fontSize:`11px`,color:`#6b7280`,lineHeight:1.3,marginTop:`2px`,whiteSpace:`nowrap`},children:v===`connected`?`${Pt(ct)} with ${qe}`:`Tap to return to ${qe}`})]})]}),(0,V.jsx)(a_,{size:we,orbColors:be,onClick:_?kt:_e?Rt:Bt})]}),Ze===`connection_modal`&&(0,V.jsx)(s_,{copy:Ue,orbColors:be,primaryColor:xe,onVoice:zt,onText:Bt,onClose:Lt,isMobile:Tt,isClosing:bt}),Ze===`voice_mode`&&(0,V.jsx)(c_,{orbColors:be,onEnterChat:Bt,onEndChat:Vt,agentId:We,siteId:Ge,apiBaseUrl:Ke,chatId:w,historyRef:T,onMessageSync:E,voiceEndCounter:fe,websiteName:t?.websiteName,voiceFirstMessage:pe.voiceFirstMessage||null,captureVisitorEmail:k,emailRequired:!l,emailCaptureEnabled:I.disableEmailCapture!==!0,listeningLabel:I.voiceListeningLabel||`Listening...`,thinkingLabel:I.voiceThinkingLabel||`Thinking...`,enterChatModeLabel:I.voiceEnterChatLabel||`Enter Chat Mode`,endConversationLabel:I.voiceEndConversationLabel||`End Conversation`},`voice`),Ze===`call_screen`&&(0,V.jsx)(og,{incomingCall:g,activeCallId:_,callConnectionState:v,callDurationSeconds:ct,isCallMuted:x,agentName:qe,agentHeadshot:Je,fallbackAgentName:De,acceptCall:re,rejectCall:ie,endWebRTCCall:ae,toggleCallMute:oe,formatCallDuration:Pt,onMinimize:At,primaryColor:xe,orbColors:be,chatHistory:r}),Ze===`text_chat`&&(0,V.jsx)(d_,{isClosing:bt,copy:Ue,orbColors:be,primaryColor:xe,chatBgGradient:Oe,logo:ke,quickChatOptions:Ne,onQuickChatSelect:Ft,isMobile:Tt,chatHistory:r,isAiTyping:d,isAgentTyping:u,activeScreen:a,agentName:qe,agentHeadshot:Je,fallbackAgentName:De,input:$e,setInput:et,onSubmit:Mt,isConversationEnded:h,isLoading:f,isRateLimited:p,rateLimitMessage:m,selectedFile:ft,onFileSelect:Ot,onRemoveSelectedFile:Dt,attachmentError:mt,isUploadingAttachment:gt,requiresEmail:wt,emailInput:rt,setEmailInput:it,emailError:at,emailCaptureSuccess:st,replyContext:tt,setReplyContext:nt,webRTCError:S,micError:ut,setMicError:dt,dismissCallError:se,activeCallId:_,isCallMuted:x,toggleCallMute:oe,endWebRTCCall:ae,formatCallDuration:Pt,callDurationSeconds:ct,onCollapse:Lt,onStartVoice:zt,voiceEnabled:_e,onNewChat:Nt,onMinimize:At,onExpand:kt,isCallMinimized:!!_,showPoweredBy:Pe,privacyPolicyUrl:Ie,headerBgColor:L,getVisitorChatHistory:le,resumeChat:ue,isSessionRestoring:F}),(0,V.jsx)(`style`,{children:`
|
|
354
|
+
/* Force any SVG (or img) inside LogoSlot to fill the container height
|
|
355
|
+
regardless of whether the component forwards its style prop. */
|
|
356
|
+
.fe-logo-slot svg,
|
|
357
|
+
.fe-logo-slot img { height: 100%; width: auto; display: block; }
|
|
358
|
+
|
|
359
|
+
@keyframes fe-orb-breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }
|
|
360
|
+
@keyframes fe-orb-breathe-subtle { 0%,100%{transform:scale(1)} 50%{transform:scale(1.025)} }
|
|
361
|
+
@keyframes fe-orb-pulse { 0%{transform:scale(1);opacity:.65} 50%{transform:scale(1.28);opacity:.1} 100%{transform:scale(1);opacity:.65} }
|
|
362
|
+
@keyframes fe-orb-glow { from{opacity:.35} to{opacity:.75} }
|
|
363
|
+
@keyframes fe-orb-fade-in { from{opacity:0} to{opacity:1} }
|
|
364
|
+
@keyframes fe-orb-slide-up { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }
|
|
365
|
+
@keyframes fe-orb-slide-down { from{opacity:1;transform:translateY(0)} to{opacity:0;transform:translateY(24px)} }
|
|
366
|
+
@keyframes fe-orb-bar-0 { from{height:6px} to{height:18px} }
|
|
367
|
+
@keyframes fe-orb-bar-1 { from{height:10px} to{height:22px} }
|
|
368
|
+
@keyframes fe-orb-bar-2 { from{height:14px} to{height:26px} }
|
|
369
|
+
@keyframes fe-orb-bar-3 { from{height:8px} to{height:20px} }
|
|
370
|
+
@keyframes fe-orb-bar-4 { from{height:6px} to{height:16px} }
|
|
371
|
+
@keyframes fe-dot-bounce { 0%,80%,100%{transform:translateY(0);opacity:.5} 40%{transform:translateY(-5px);opacity:1} }
|
|
372
|
+
`})]})}var p_=class extends b.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){console.error(`[FlowEngage] Widget crashed:`,e,t.componentStack)}render(){return this.state.hasError?this.props.fallback??null:this.props.children}},m_=`@import "https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap";:host{all:initial;box-sizing:border-box!important;color:#111827!important;-webkit-font-smoothing:antialiased!important;z-index:2147483647!important;background:0 0!important;border:none!important;margin:0!important;padding:0!important;font-family:Poppins,system-ui,-apple-system,sans-serif!important;font-size:16px!important;line-height:1.5!important;display:block!important;position:relative!important}:host *,:host :before,:host :after{box-sizing:border-box}.flowengage-widget-root{-moz-osx-font-smoothing:grayscale;text-rendering:optimizelegibility;color:#111827!important;-webkit-font-smoothing:antialiased!important;font-family:Poppins,system-ui,-apple-system,sans-serif!important;font-size:16px!important;line-height:1.5!important}.flowengage-widget-root *,.flowengage-widget-root :before,.flowengage-widget-root :after{font-family:inherit!important}.flowengage-widget-root input,.flowengage-widget-root textarea,.flowengage-widget-root button,.flowengage-widget-root select,.flowengage-widget-root optgroup,.flowengage-widget-root option{font-size:inherit;line-height:inherit;font-family:inherit!important}.flowengage-shell,.flowengage-shell *{font-family:inherit!important}.flowengage-chat-panel{border:none;border-radius:0;outline:none;flex-direction:column;width:100%;height:100%;display:flex;position:relative;overflow:hidden;box-shadow:0 20px 50px #00000026}.flowengage-chat-text-input{margin:0!important}.flowengage-chat-text-input:focus{box-shadow:none!important;border:none!important;outline:none!important}@media (width>=768px){.flowengage-chat-panel{border-radius:24px;width:min(350px,100vw - 40px);height:min(700px,100vh - 120px)}}.flowengage-shell[data-open=true]{inset:0}@media (width>=768px){.flowengage-shell[data-open=true]{inset:auto 1.5rem 1.5rem auto}}.flowengage-logo-fallback{background:conic-gradient(from 180deg, var(--flowengage-primary) 0%, var(--flowengage-accent) 45%, var(--flowengage-primary) 100%)}.fe-bot-message p{margin:0 0 .5em}.fe-bot-message p:last-child{margin-bottom:0}.fe-bot-message ul,.fe-bot-message ol{margin:.4em 0 .4em 1.2em;padding:0}.fe-bot-message li{margin-bottom:.25em}.fe-bot-message strong{font-weight:600}.fe-bot-message a{color:var(--flowengage-primary);text-decoration:underline}.fe-bot-message a:hover{opacity:.8}.incoming-call-overlay{z-index:1000;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#1a1a2ef2;justify-content:center;align-items:center;transition:all .3s ease-in-out;display:flex;position:absolute;left:0;right:0}.incoming-call-overlay.bottom-mode{border-top:2px solid #ffffff1a;min-height:120px;animation:.4s cubic-bezier(.16,1,.3,1) slideUpBanner;top:auto;bottom:0;box-shadow:0 -10px 30px #00000080}.incoming-call-overlay.header-mode{border-bottom:2px solid #ffffff1a;min-height:80px;animation:.4s cubic-bezier(.16,1,.3,1) slideDownBanner;top:0;bottom:auto;box-shadow:0 10px 30px #00000080}.incoming-call-container{justify-content:space-between;align-items:center;gap:14px;width:100%;padding:14px 16px;display:flex}.incoming-call-container.connected-layout{flex-direction:column;justify-content:center;align-items:stretch;gap:14px}.call-connected-top{justify-content:space-between;align-items:center;gap:16px;width:100%;display:flex}.call-connected-identity{flex:1;align-items:center;gap:14px;min-width:0;display:flex}.call-icon-wrapper{color:#fff;z-index:1;border-radius:9999px;flex-shrink:0;justify-content:center;align-items:center;width:54px;height:54px;margin-right:4px;display:flex;position:relative}.call-icon-wrapper.incoming{background:linear-gradient(135deg,#4caf50,#45a049);animation:1s ease-in-out infinite bounce}.call-icon-wrapper.connecting{background:linear-gradient(135deg,#2196f3,#1976d2)}.call-icon-wrapper.connected{background:linear-gradient(135deg,#4caf50,#45a049)}.call-pulse-animation{z-index:-1;background:#4caf504d;border-radius:50%;width:120px;height:120px;animation:1.5s ease-out infinite pulse;position:absolute}.call-connecting-animation{z-index:-1;border:3px solid #0000;border-top-color:#2196f3;border-radius:50%;width:100px;height:100px;animation:1s linear infinite spin;position:absolute}.call-info-group{flex-direction:column;flex:1;min-width:0;margin-right:8px;display:flex}.call-title{color:#fff;white-space:normal;text-overflow:clip;margin:0;font-size:16px;font-weight:700;line-height:1.2;overflow:visible}.call-subtitle{color:#ffffffb3;white-space:normal;text-overflow:clip;margin:4px 0 0;font-size:12px;line-height:1.35;overflow:visible}.call-timer{text-align:center;color:#fff;flex-shrink:0;min-width:54px;font-size:13px;font-weight:700}.call-actions{flex-shrink:0;align-items:center;gap:8px;display:flex}.call-actions.connected{justify-content:center;width:100%}.flowengage-call-btn{cursor:pointer;color:#fff;border:none;border-radius:8px;justify-content:center;align-items:center;gap:6px;min-width:92px;padding:8px 12px;font-size:12px;font-weight:600;line-height:1;transition:transform .2s,box-shadow .2s,background .2s;display:flex}.flowengage-call-btn svg{flex-shrink:0;display:block}.flowengage-call-btn span{justify-content:center;align-items:center;line-height:1;display:flex}.flowengage-call-btn.icon-only{border-radius:9999px;width:46px;min-width:46px;height:46px;padding:0}.flowengage-call-btn-accept{background:linear-gradient(135deg,#4caf50,#45a049);box-shadow:0 8px 24px #4caf5066}.flowengage-call-btn-reject,.flowengage-call-btn-end{background:linear-gradient(135deg,#f44336,#d32f2f);box-shadow:0 4px 12px #f4433666}.flowengage-call-btn-mute{background:#ffffff1a;border:2px solid #fff3}.flowengage-call-btn-mute.active{background:#f443364d;border-color:#f44336}.flowengage-call-btn:hover:not(:disabled){transform:scale(1.05)}.incoming-call-overlay.header-mode .flowengage-call-btn{border-radius:9999px!important;width:36px!important;min-width:36px!important;height:36px!important;padding:0!important}.incoming-call-overlay.header-mode .flowengage-call-btn span{display:none!important}.incoming-call-overlay.header-mode .call-icon-wrapper{width:40px;height:40px;margin-right:0}.incoming-call-overlay.header-mode .call-info-group{min-width:0}.incoming-call-overlay.header-mode .call-title,.incoming-call-overlay.header-mode .call-subtitle{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}@media (width<=640px){.incoming-call-container{align-items:flex-start;gap:10px;padding:12px 14px}.incoming-call-container.connected-layout{align-items:stretch}.call-connected-top{flex-direction:column;align-items:flex-start;gap:10px}.call-connected-identity{width:100%}.call-info-group{margin-right:0}.call-actions{flex-wrap:wrap;align-self:stretch;gap:6px}.call-actions.connected{justify-content:stretch}.call-actions.connected .flowengage-call-btn{flex:1}.flowengage-call-btn{min-width:78px;padding:8px 10px}}@keyframes slideUpBanner{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideDownBanner{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes bounce{0%,to{transform:translateY(0)}50%{transform:translateY(-10px)}}@keyframes pulse{0%{opacity:1;transform:scale(.8)}to{opacity:0;transform:scale(2)}}@keyframes spin{to{transform:rotate(360deg)}}.fe-screen-fade-in{animation:.4s cubic-bezier(.16,1,.3,1) forwards feFadeIn}@keyframes feFadeIn{0%{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}.flowengage-initial-bg{background-color:#fff;position:relative;overflow:hidden}.flowengage-initial-bg:before{content:"";background:linear-gradient(to bottom, var(--flowengage-primary) 0%, var(--flowengage-accent) 55%, white 82%);opacity:0;pointer-events:none;z-index:0;transition:opacity .6s cubic-bezier(.4,0,.2,1);position:absolute;inset:0}.flowengage-initial-bg.is-initial:before{opacity:1}.flowengage-content-wrapper{z-index:1;flex-direction:column;flex:1;min-height:0;display:flex;position:relative}`,h_=null,g_=!1;function __(){let e=document.createElement(`div`);e.id=`flowengage-root`;let t=e.attachShadow({mode:`open`}),n=document.createElement(`style`);n.textContent=m_,t.appendChild(n);let r=document.createElement(`div`);return r.setAttribute(`data-flowengage-mount`,`true`),r.className=`flowengage-widget-root`,t.appendChild(r),{host:e,mount:r}}function v_(e){if(document.body){e();return}let t=new MutationObserver(()=>{document.body&&(t.disconnect(),e())});t.observe(document.documentElement,{childList:!0})}function y_({siteId:e,language:t=`en`,widgetSettings:n={},apiBaseUrl:r}){if(g_){console.warn(`[FlowEngage] Already initialized. Call FlowEngage.destroy() first to re-initialize.`);return}if(!e){console.error(`[FlowEngage] siteId is required. Pass it via data-site-id attribute or FlowEngage.init({ siteId: 'YOUR_SITE_ID' }).`);return}if(!document.body){console.error(`[FlowEngage] document.body is not available yet. The widget will auto-retry once the DOM is ready.`),v_(()=>y_({siteId:e,language:t,widgetSettings:n,apiBaseUrl:r}));return}if(document.getElementById(`flowengage-root`)){console.warn(`[FlowEngage] #flowengage-root already exists. Skipping duplicate mount.`);return}let{host:i,mount:a}=__();document.body.appendChild(i),h_=(0,x.createRoot)(a);let o={widgetSettings:n,...r&&{apiBaseUrl:r}};h_.render(b.createElement(p_,null,b.createElement(_i,{siteId:e,language:t,config:o},b.createElement(f_)))),g_=!0}var b_={init({siteId:e,language:t=`en`,widgetSettings:n={},apiBaseUrl:r}={}){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>v_(()=>y_({siteId:e,language:t,widgetSettings:n,apiBaseUrl:r}))):v_(()=>y_({siteId:e,language:t,widgetSettings:n,apiBaseUrl:r}))},destroy(){h_&&=(h_.unmount(),null);let e=document.getElementById(`flowengage-root`);e&&e.remove();let t=document.getElementById(`flowengage-styles`);t&&t.remove(),g_=!1}},x_=()=>{let e=document.currentScript;(!e||!e.getAttribute(`data-site-id`)&&!e.getAttribute(`data-shop-domain`))&&(e=document.querySelector(`script[data-site-id], script[data-shop-domain]`));let t=e?.getAttribute(`data-site-id`),n=e?.getAttribute(`data-shop-domain`);if(!t&&!n)return;let r=e?.getAttribute(`data-language`)||`en`,i=e?.getAttribute(`data-api-url`)||void 0,a={};try{let t=e?.getAttribute(`data-widget-settings`);t&&(a=JSON.parse(t))}catch{}if(t){v_(()=>y_({siteId:t,language:r,widgetSettings:a,apiBaseUrl:i}));return}let o=(i||`https://be-flowengage-dev.oslabs.app`).replace(/\/+$/,``);fetch(`${o}/api/widget/resolve-shopify-tenant?shopDomain=${encodeURIComponent(n)}`).then(e=>e.json()).then(e=>{if(!e?.success||!e.siteId){console.error(`[FlowEngage] Could not resolve a FlowEngage account for shop:`,n,e?.message);return}v_(()=>y_({siteId:e.siteId,language:r,widgetSettings:a,apiBaseUrl:i}))}).catch(e=>console.error(`[FlowEngage] Failed to resolve shop tenant:`,e))};return document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,x_):x_(),typeof window<`u`&&(window.FlowEngage=b_),b_})();
|