@xapp/chat-widget 1.105.6 → 1.106.0
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/index.css +1 -1
- package/dist/index.es.js +30 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +30 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/chatAgentDiscovery.d.ts +0 -0
- package/dist/utils/fingerprint.d.ts +0 -0
- package/dist/xapp/MCPChat.d.ts +0 -0
- package/dist/xapp-chat-widget.css +1 -1
- package/dist/xapp-chat-widget.js +5 -5
- package/dist/xapp-chat-widget.js.map +1 -1
- package/package.json +3 -3
package/dist/xapp-chat-widget.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var XAppChatWidget=function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(){const e="prod";try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s={exports:{}},l={},c=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function d(e,t,n){var r=null;if(void 0!==n&&(r=""+n),void 0!==t.key&&(r=""+t.key),"key"in t)for(var i in n={},t)"key"!==i&&(n[i]=t[i]);else n=t;return t=n.ref,{$$typeof:c,type:e,key:r,ref:void 0!==t?t:null,props:n}}l.Fragment=u,l.jsx=d,l.jsxs=d,s.exports=l;var f=s.exports,h={exports:{}},p={},m={exports:{}},v={};!function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>i(l,n))c<o&&0>i(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<o&&0>i(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],c=[],u=1,d=null,f=3,h=!1,p=!1,m=!1,v=!1,g="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(l,i)}i=n(c)}}function x(e){if(m=!1,w(e),!p)if(null!==n(l))p=!0,S||(S=!0,k());else{var t=n(c);null!==t&&O(x,t.startTime-e)}}var k,S=!1,C=-1,_=5,E=-1;function N(){return!!v||!(e.unstable_now()-E<_)}function I(){if(v=!1,S){var t=e.unstable_now();E=t;var i=!0;try{e:{p=!1,m&&(m=!1,y(C),C=-1),h=!0;var o=f;try{t:{for(w(t),d=n(l);null!==d&&!(d.expirationTime>t&&N());){var a=d.callback;if("function"==typeof a){d.callback=null,f=d.priorityLevel;var s=a(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof s){d.callback=s,w(t),i=!0;break t}d===n(l)&&r(l),w(t)}else r(l);d=n(l)}if(null!==d)i=!0;else{var u=n(c);null!==u&&O(x,u.startTime-t),i=!1}}break e}finally{d=null,f=o,h=!1}i=void 0}}finally{i?k():S=!1}}}if("function"==typeof b)k=function(){b(I)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,j=T.port2;T.port1.onmessage=I,k=function(){j.postMessage(null)}}else k=function(){g(I,0)};function O(t,n){C=g(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"):_=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(){v=!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,o){var a=e.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?a+o:a:o=a,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 r={id:u++,callback:i,priorityLevel:r,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>a?(r.sortIndex=o,t(c,r),null===n(l)&&r===n(c)&&(m?(y(C),C=-1):m=!0,O(x,o-a))):(r.sortIndex=s,t(l,r),p||h||(p=!0,S||(S=!0,k()))),r},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(v),m.exports=v;var g=m.exports,y={exports:{}},b={},w=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),E=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),P=Symbol.iterator;var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,A={};function L(e,t,n){this.props=e,this.context=t,this.refs=A,this.updater=n||R}function D(){}function B(e,t,n){this.props=e,this.context=t,this.refs=A,this.updater=n||R}L.prototype.isReactComponent={},L.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)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")},L.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},D.prototype=L.prototype;var z=B.prototype=new D;z.constructor=B,M(z,L.prototype),z.isPureReactComponent=!0;var U=Array.isArray;function F(){}var q={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function W(e,t,n){var r=n.ref;return{$$typeof:w,type:e,key:t,ref:void 0!==r?r:null,props:n}}function V(e){return"object"==typeof e&&null!==e&&e.$$typeof===w}var $=/\/+/g;function K(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=""+e.key,r={"=":"=0",":":"=2"},"$"+n.replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function Q(e,t,n,r,i){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var a,s,l=!1;if(null===e)l=!0;else switch(o){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case w:case x:l=!0;break;case j:return Q((l=e._init)(e._payload),t,n,r,i)}}if(l)return i=i(e),l=""===r?"."+K(e,0):r,U(i)?(n="",null!=l&&(n=l.replace($,"$&/")+"/"),Q(i,t,n,"",function(e){return e})):null!=i&&(V(i)&&(a=i,s=n+(null==i.key||e&&e.key===i.key?"":(""+i.key).replace($,"$&/")+"/")+l,i=W(a.type,s,a.props)),t.push(i)),1;l=0;var c,u=""===r?".":r+":";if(U(e))for(var d=0;d<e.length;d++)l+=Q(r=e[d],t,n,o=u+K(r,d),i);else if("function"==typeof(d=null===(c=e)||"object"!=typeof c?null:"function"==typeof(c=P&&c[P]||c["@@iterator"])?c:null))for(e=d.call(e),d=0;!(r=e.next()).done;)l+=Q(r=r.value,t,n,o=u+K(r,d++),i);else if("object"===o){if("function"==typeof e.then)return Q(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(F,F):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),t,n,r,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return l}function J(e,t,n){if(null==e)return e;var r=[],i=0;return Q(e,r,"","",function(e){return t.call(n,e,i++)}),r}function Y(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var G="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},X={map:J,forEach:function(e,t,n){J(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return J(e,function(){t++}),t},toArray:function(e){return J(e,function(e){return e})||[]},only:function(e){if(!V(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};b.Activity=O,b.Children=X,b.Component=L,b.Fragment=k,b.Profiler=C,b.PureComponent=B,b.StrictMode=S,b.Suspense=I,b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,b.__COMPILER_RUNTIME={__proto__:null,c:function(e){return q.H.useMemoCache(e)}},b.cache=function(e){return function(){return e.apply(null,arguments)}},b.cacheSignal=function(){return null},b.cloneElement=function(e,t,n){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var r=M({},e.props),i=e.key;if(null!=t)for(o in void 0!==t.key&&(i=""+t.key),t)!H.call(t,o)||"key"===o||"__self"===o||"__source"===o||"ref"===o&&void 0===t.ref||(r[o]=t[o]);var o=arguments.length-2;if(1===o)r.children=n;else if(1<o){for(var a=Array(o),s=0;s<o;s++)a[s]=arguments[s+2];r.children=a}return W(e.type,i,r)},b.createContext=function(e){return(e={$$typeof:E,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:_,_context:e},e},b.createElement=function(e,t,n){var r,i={},o=null;if(null!=t)for(r in void 0!==t.key&&(o=""+t.key),t)H.call(t,r)&&"key"!==r&&"__self"!==r&&"__source"!==r&&(i[r]=t[r]);var a=arguments.length-2;if(1===a)i.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];i.children=s}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===i[r]&&(i[r]=a[r]);return W(e,o,i)},b.createRef=function(){return{current:null}},b.forwardRef=function(e){return{$$typeof:N,render:e}},b.isValidElement=V,b.lazy=function(e){return{$$typeof:j,_payload:{_status:-1,_result:e},_init:Y}},b.memo=function(e,t){return{$$typeof:T,type:e,compare:void 0===t?null:t}},b.startTransition=function(e){var t=q.T,n={};q.T=n;try{var r=e(),i=q.S;null!==i&&i(n,r),"object"==typeof r&&null!==r&&"function"==typeof r.then&&r.then(F,G)}catch(e){G(e)}finally{null!==t&&null!==n.types&&(t.types=n.types),q.T=t}},b.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},b.use=function(e){return q.H.use(e)},b.useActionState=function(e,t,n){return q.H.useActionState(e,t,n)},b.useCallback=function(e,t){return q.H.useCallback(e,t)},b.useContext=function(e){return q.H.useContext(e)},b.useDebugValue=function(){},b.useDeferredValue=function(e,t){return q.H.useDeferredValue(e,t)},b.useEffect=function(e,t){return q.H.useEffect(e,t)},b.useEffectEvent=function(e){return q.H.useEffectEvent(e)},b.useId=function(){return q.H.useId()},b.useImperativeHandle=function(e,t,n){return q.H.useImperativeHandle(e,t,n)},b.useInsertionEffect=function(e,t){return q.H.useInsertionEffect(e,t)},b.useLayoutEffect=function(e,t){return q.H.useLayoutEffect(e,t)},b.useMemo=function(e,t){return q.H.useMemo(e,t)},b.useOptimistic=function(e,t){return q.H.useOptimistic(e,t)},b.useReducer=function(e,t,n){return q.H.useReducer(e,t,n)},b.useRef=function(e){return q.H.useRef(e)},b.useState=function(e){return q.H.useState(e)},b.useSyncExternalStore=function(e,t,n){return q.H.useSyncExternalStore(e,t,n)},b.useTransition=function(){return q.H.useTransition()},b.version="19.2.5",y.exports=b;var Z=y.exports,ee=a(Z),te={exports:{}},ne={},re=Z;function ie(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 oe(){}var ae={d:{f:oe,r:function(){throw Error(ie(522))},D:oe,C:oe,L:oe,m:oe,X:oe,S:oe,M:oe},p:0,findDOMNode:null},se=Symbol.for("react.portal");var le=re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function ce(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}ne.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ae,ne.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error(ie(299));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:se,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},ne.flushSync=function(e){var t=le.T,n=ae.p;try{if(le.T=null,ae.p=2,e)return e()}finally{le.T=t,ae.p=n,ae.d.f()}},ne.preconnect=function(e,t){"string"==typeof e&&(t?t="string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:t=null,ae.d.C(e,t))},ne.prefetchDNS=function(e){"string"==typeof e&&ae.d.D(e)},ne.preinit=function(e,t){if("string"==typeof e&&t&&"string"==typeof t.as){var n=t.as,r=ce(n,t.crossOrigin),i="string"==typeof t.integrity?t.integrity:void 0,o="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===n?ae.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):"script"===n&&ae.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},ne.preinitModule=function(e,t){if("string"==typeof e)if("object"==typeof t&&null!==t){if(null==t.as||"script"===t.as){var n=ce(t.as,t.crossOrigin);ae.d.M(e,{crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})}}else null==t&&ae.d.M(e)},ne.preload=function(e,t){if("string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var n=t.as,r=ce(n,t.crossOrigin);ae.d.L(e,n,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},ne.preloadModule=function(e,t){if("string"==typeof e)if(t){var n=ce(t.as,t.crossOrigin);ae.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0})}else ae.d.m(e)},ne.requestFormReset=function(e){ae.d.r(e)},ne.unstable_batchedUpdates=function(e,t){return e(t)},ne.useFormState=function(e,t,n){return le.H.useFormState(e,t,n)},ne.useFormStatus=function(){return le.H.useHostTransitionStatus()},ne.version="19.2.5",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),te.exports=ne;var ue=te.exports,de=g,fe=Z,he=ue;function pe(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 me(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function ve(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function ge(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function ye(e){if(31===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function be(e){if(ve(e)!==e)throw Error(pe(188))}function we(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=we(e)))return t;e=e.sibling}return null}var xe=Object.assign,ke=Symbol.for("react.element"),Se=Symbol.for("react.transitional.element"),Ce=Symbol.for("react.portal"),_e=Symbol.for("react.fragment"),Ee=Symbol.for("react.strict_mode"),Ne=Symbol.for("react.profiler"),Ie=Symbol.for("react.consumer"),Te=Symbol.for("react.context"),je=Symbol.for("react.forward_ref"),Oe=Symbol.for("react.suspense"),Pe=Symbol.for("react.suspense_list"),Re=Symbol.for("react.memo"),Me=Symbol.for("react.lazy"),Ae=Symbol.for("react.activity"),Le=Symbol.for("react.memo_cache_sentinel"),De=Symbol.iterator;function Be(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=De&&e[De]||e["@@iterator"])?e:null}var ze=Symbol.for("react.client.reference");function Ue(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===ze?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case _e:return"Fragment";case Ne:return"Profiler";case Ee:return"StrictMode";case Oe:return"Suspense";case Pe:return"SuspenseList";case Ae:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case Ce:return"Portal";case Te:return e.displayName||"Context";case Ie:return(e._context.displayName||"Context")+".Consumer";case je:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case Re:return null!==(t=e.displayName||null)?t:Ue(e.type)||"Memo";case Me:t=e._payload,e=e._init;try{return Ue(e(t))}catch(e){}}return null}var Fe=Array.isArray,qe=fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,He=he.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,We={pending:!1,data:null,method:null,action:null},Ve=[],$e=-1;function Ke(e){return{current:e}}function Qe(e){0>$e||(e.current=Ve[$e],Ve[$e]=null,$e--)}function Je(e,t){$e++,Ve[$e]=e.current,e.current=t}var Ye,Ge,Xe=Ke(null),Ze=Ke(null),et=Ke(null),tt=Ke(null);function nt(e,t){switch(Je(et,t),Je(Ze,e),Je(Xe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ef(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=Nf(t=Ef(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Qe(Xe),Je(Xe,e)}function rt(){Qe(Xe),Qe(Ze),Qe(et)}function it(e){null!==e.memoizedState&&Je(tt,e);var t=Xe.current,n=Nf(t,e.type);t!==n&&(Je(Ze,e),Je(Xe,n))}function ot(e){Ze.current===e&&(Qe(Xe),Qe(Ze)),tt.current===e&&(Qe(tt),bh._currentValue=We)}function at(e){if(void 0===Ye)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ye=t&&t[1]||"",Ge=-1<e.stack.indexOf("\n at")?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+Ye+e+Ge}var st=!1;function lt(e,t){if(!e||st)return"";st=!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()}}),"object"==typeof Reflect&&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())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(e){if(e&&r&&"string"==typeof e.stack)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 o=r.DetermineComponentFrameRoot(),a=o[0],s=o[1];if(a&&s){var l=a.split("\n"),c=s.split("\n");for(i=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;i<c.length&&!c[i].includes("DetermineComponentFrameRoot");)i++;if(r===l.length||i===c.length)for(r=l.length-1,i=c.length-1;1<=r&&0<=i&&l[r]!==c[i];)i--;for(;1<=r&&0<=i;r--,i--)if(l[r]!==c[i]){if(1!==r||1!==i)do{if(r--,0>--i||l[r]!==c[i]){var u="\n"+l[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{st=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?at(n):""}function ct(e,t){switch(e.tag){case 26:case 27:case 5:return at(e.type);case 16:return at("Lazy");case 13:return e.child!==t&&null!==t?at("Suspense Fallback"):at("Suspense");case 19:return at("SuspenseList");case 0:case 15:return lt(e.type,!1);case 11:return lt(e.type.render,!1);case 1:return lt(e.type,!0);case 31:return at("Activity");default:return""}}function ut(e){try{var t="",n=null;do{t+=ct(e,n),n=e,e=e.return}while(e);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}var dt=Object.prototype.hasOwnProperty,ft=de.unstable_scheduleCallback,ht=de.unstable_cancelCallback,pt=de.unstable_shouldYield,mt=de.unstable_requestPaint,vt=de.unstable_now,gt=de.unstable_getCurrentPriorityLevel,yt=de.unstable_ImmediatePriority,bt=de.unstable_UserBlockingPriority,wt=de.unstable_NormalPriority,xt=de.unstable_LowPriority,kt=de.unstable_IdlePriority,St=de.log,Ct=de.unstable_setDisableYieldValue,_t=null,Et=null;function Nt(e){if("function"==typeof St&&Ct(e),Et&&"function"==typeof Et.setStrictMode)try{Et.setStrictMode(_t,e)}catch(e){}}var It=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(Tt(e)/jt|0)|0},Tt=Math.log,jt=Math.LN2;var Ot=256,Pt=262144,Rt=4194304;function Mt(e){var t=42&e;if(0!==t)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 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function At(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var i=0,o=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var s=134217727&r;return 0!==s?0!==(r=s&~o)?i=Mt(r):0!==(a&=s)?i=Mt(a):n||0!==(n=s&~e)&&(i=Mt(n)):0!==(s=r&~o)?i=Mt(s):0!==a?i=Mt(a):n||0!==(n=r&~e)&&(i=Mt(n)),0===i?0:0!==t&&t!==i&&0===(t&o)&&((o=i&-i)>=(n=t&-t)||32===o&&4194048&n)?t:i}function Lt(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Dt(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;default:return-1}}function Bt(){var e=Rt;return!(62914560&(Rt<<=1))&&(Rt=4194304),e}function zt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ut(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ft(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-It(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|261930&n}function qt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-It(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ht(e,t){var n=t&-t;return 0!==((n=42&n?1:Wt(n))&(e.suspendedLanes|t))?0:n}function Wt(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 Vt(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function $t(){var e=He.p;return 0!==e?e:void 0===(e=window.event)?32:Ah(e.type)}function Kt(e,t){var n=He.p;try{return He.p=e,t()}finally{He.p=n}}var Qt=Math.random().toString(36).slice(2),Jt="__reactFiber$"+Qt,Yt="__reactProps$"+Qt,Gt="__reactContainer$"+Qt,Xt="__reactEvents$"+Qt,Zt="__reactListeners$"+Qt,en="__reactHandles$"+Qt,tn="__reactResources$"+Qt,nn="__reactMarker$"+Qt;function rn(e){delete e[Jt],delete e[Yt],delete e[Xt],delete e[Zt],delete e[en]}function on(e){var t=e[Jt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gt]||n[Jt]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Vf(e);null!==e;){if(n=e[Jt])return n;e=Vf(e)}return t}n=(e=n).parentNode}return null}function an(e){if(e=e[Jt]||e[Gt]){var t=e.tag;if(5===t||6===t||13===t||31===t||26===t||27===t||3===t)return e}return null}function sn(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e.stateNode;throw Error(pe(33))}function ln(e){var t=e[tn];return t||(t=e[tn]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function cn(e){e[nn]=!0}var un=new Set,dn={};function fn(e,t){hn(e,t),hn(e+"Capture",t)}function hn(e,t){for(dn[e]=t,e=0;e<t.length;e++)un.add(t[e])}var pn=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]*$"),mn={},vn={};function gn(e,t,n){if(i=t,dt.call(vn,i)||!dt.call(mn,i)&&(pn.test(i)?vn[i]=!0:(mn[i]=!0,0)))if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var r=t.toLowerCase().slice(0,5);if("data-"!==r&&"aria-"!==r)return void e.removeAttribute(t)}e.setAttribute(t,""+n)}var i}function yn(e,t,n){if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+n)}}function bn(e,t,n,r){if(null===r)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(n)}e.setAttributeNS(t,n,""+r)}}function wn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function xn(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function kn(e){if(!e._valueTracker){var t=xn(e)?"checked":"value";e._valueTracker=function(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&void 0!==r&&"function"==typeof r.get&&"function"==typeof r.set){var i=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=""+e,o.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]}}}}(e,t,""+e[t])}}function Sn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=xn(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Cn(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var _n=/[\n"\\]/g;function En(e){return e.replace(_n,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Nn(e,t,n,r,i,o,a,s){e.name="",null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a?e.type=a:e.removeAttribute("type"),null!=t?"number"===a?(0===t&&""===e.value||e.value!=t)&&(e.value=""+wn(t)):e.value!==""+wn(t)&&(e.value=""+wn(t)):"submit"!==a&&"reset"!==a||e.removeAttribute("value"),null!=t?Tn(e,a,wn(t)):null!=n?Tn(e,a,wn(n)):null!=r&&e.removeAttribute("value"),null==i&&null!=o&&(e.defaultChecked=!!o),null!=i&&(e.checked=i&&"function"!=typeof i&&"symbol"!=typeof i),null!=s&&"function"!=typeof s&&"symbol"!=typeof s&&"boolean"!=typeof s?e.name=""+wn(s):e.removeAttribute("name")}function In(e,t,n,r,i,o,a,s){if(null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.type=o),null!=t||null!=n){if(("submit"===o||"reset"===o)&&null==t)return void kn(e);n=null!=n?""+wn(n):"",t=null!=t?""+wn(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=null!=r?r:i)&&"symbol"!=typeof r&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.name=a),kn(e)}function Tn(e,t,n){"number"===t&&Cn(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function jn(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=""+wn(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function On(e,t,n){null==t||((t=""+wn(t))!==e.value&&(e.value=t),null!=n)?e.defaultValue=null!=n?""+wn(n):"":e.defaultValue!==t&&(e.defaultValue=t)}function Pn(e,t,n,r){if(null==t){if(null!=r){if(null!=n)throw Error(pe(92));if(Fe(r)){if(1<r.length)throw Error(pe(93));r=r[0]}n=r}null==n&&(n=""),t=n}n=wn(t),e.defaultValue=n,(r=e.textContent)===n&&""!==r&&null!==r&&(e.value=r),kn(e)}function Rn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var Mn=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 An(e,t,n){var r=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?r?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":r?e.setProperty(t,n):"number"!=typeof n||0===n||Mn.has(t)?"float"===t?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Ln(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(pe(62));if(e=e.style,null!=n){for(var r in n)!n.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&An(e,i,r)}else for(var o in t)t.hasOwnProperty(o)&&An(e,o,t[o])}function Dn(e){if(-1===e.indexOf("-"))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 Bn=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"]]),zn=/^[\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 Un(e){return zn.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Fn(){}var qn=null;function Hn(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Wn=null,Vn=null;function $n(e){var t=an(e);if(t&&(e=t.stateNode)){var n=e[Yt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Nn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+En(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[Yt]||null;if(!i)throw Error(pe(90));Nn(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)(r=n[t]).form===e.form&&Sn(r)}break e;case"textarea":On(e,n.value,n.defaultValue);break e;case"select":null!=(t=n.value)&&jn(e,!!n.multiple,t,!1)}}}var Kn=!1;function Qn(e,t,n){if(Kn)return e(t,n);Kn=!0;try{return e(t)}finally{if(Kn=!1,(null!==Wn||null!==Vn)&&(sd(),Wn&&(t=Wn,e=Vn,Vn=Wn=null,$n(t),e)))for(t=0;t<e.length;t++)$n(e[t])}}function Jn(e,t){var n=e.stateNode;if(null===n)return null;var r=n[Yt]||null;if(null===r)return null;n=r[t];e: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)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(pe(231,t,typeof n));return n}var Yn=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Gn=!1;if(Yn)try{var Xn={};Object.defineProperty(Xn,"passive",{get:function(){Gn=!0}}),window.addEventListener("test",Xn,Xn),window.removeEventListener("test",Xn,Xn)}catch(e){Gn=!1}var Zn=null,er=null,tr=null;function nr(){if(tr)return tr;var e,t,n=er,r=n.length,i="value"in Zn?Zn.value:Zn.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===i[o-t];t++);return tr=i.slice(e,1<t?1-t:void 0)}function rr(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function ir(){return!0}function or(){return!1}function ar(e){function t(t,n,r,i,o){for(var a in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(a)&&(t=e[a],this[a]=t?t(i):i[a]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?ir:or,this.isPropagationStopped=or,this}return xe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=ir)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=ir)},persist:function(){},isPersistent:ir}),t}var sr,lr,cr,ur={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dr=ar(ur),fr=xe({},ur,{view:0,detail:0}),hr=ar(fr),pr=xe({},fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_r,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==cr&&(cr&&"mousemove"===e.type?(sr=e.screenX-cr.screenX,lr=e.screenY-cr.screenY):lr=sr=0,cr=e),sr)},movementY:function(e){return"movementY"in e?e.movementY:lr}}),mr=ar(pr),vr=ar(xe({},pr,{dataTransfer:0})),gr=ar(xe({},fr,{relatedTarget:0})),yr=ar(xe({},ur,{animationName:0,elapsedTime:0,pseudoElement:0})),br=ar(xe({},ur,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),wr=ar(xe({},ur,{data:0})),xr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kr={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"},Sr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Sr[e])&&!!t[e]}function _r(){return Cr}var Er=ar(xe({},fr,{key:function(e){if(e.key){var t=xr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=rr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?kr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_r,charCode:function(e){return"keypress"===e.type?rr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?rr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),Nr=ar(xe({},pr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ir=ar(xe({},fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_r})),Tr=ar(xe({},ur,{propertyName:0,elapsedTime:0,pseudoElement:0})),jr=ar(xe({},pr,{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})),Or=ar(xe({},ur,{newState:0,oldState:0})),Pr=[9,13,27,32],Rr=Yn&&"CompositionEvent"in window,Mr=null;Yn&&"documentMode"in document&&(Mr=document.documentMode);var Ar=Yn&&"TextEvent"in window&&!Mr,Lr=Yn&&(!Rr||Mr&&8<Mr&&11>=Mr),Dr=String.fromCharCode(32),Br=!1;function zr(e,t){switch(e){case"keyup":return-1!==Pr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ur(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Fr=!1;var qr={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 Hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!qr[e.type]:"textarea"===t}function Wr(e,t,n,r){Wn?Vn?Vn.push(r):Vn=[r]:Wn=r,0<(t=ff(t,"onChange")).length&&(n=new dr("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Vr=null,$r=null;function Kr(e){rf(e,0)}function Qr(e){if(Sn(sn(e)))return e}function Jr(e,t){if("change"===e)return t}var Yr=!1;if(Yn){var Gr;if(Yn){var Xr="oninput"in document;if(!Xr){var Zr=document.createElement("div");Zr.setAttribute("oninput","return;"),Xr="function"==typeof Zr.oninput}Gr=Xr}else Gr=!1;Yr=Gr&&(!document.documentMode||9<document.documentMode)}function ei(){Vr&&(Vr.detachEvent("onpropertychange",ti),$r=Vr=null)}function ti(e){if("value"===e.propertyName&&Qr($r)){var t=[];Wr(t,$r,e,Hn(e)),Qn(Kr,t)}}function ni(e,t,n){"focusin"===e?(ei(),$r=n,(Vr=t).attachEvent("onpropertychange",ti)):"focusout"===e&&ei()}function ri(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qr($r)}function ii(e,t){if("click"===e)return Qr(t)}function oi(e,t){if("input"===e||"change"===e)return Qr(t)}var ai="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function si(e,t){if(ai(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===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(!dt.call(t,i)||!ai(e[i],t[i]))return!1}return!0}function li(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ci(e,t){var n,r=li(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=li(r)}}function ui(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ui(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function di(e){for(var t=Cn((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Cn((e=t.contentWindow).document)}return t}function fi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var hi=Yn&&"documentMode"in document&&11>=document.documentMode,pi=null,mi=null,vi=null,gi=!1;function yi(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;gi||null==pi||pi!==Cn(r)||("selectionStart"in(r=pi)&&fi(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},vi&&si(vi,r)||(vi=r,0<(r=ff(mi,"onSelect")).length&&(t=new dr("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=pi)))}function bi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var wi={animationend:bi("Animation","AnimationEnd"),animationiteration:bi("Animation","AnimationIteration"),animationstart:bi("Animation","AnimationStart"),transitionrun:bi("Transition","TransitionRun"),transitionstart:bi("Transition","TransitionStart"),transitioncancel:bi("Transition","TransitionCancel"),transitionend:bi("Transition","TransitionEnd")},xi={},ki={};function Si(e){if(xi[e])return xi[e];if(!wi[e])return e;var t,n=wi[e];for(t in n)if(n.hasOwnProperty(t)&&t in ki)return xi[e]=n[t];return e}Yn&&(ki=document.createElement("div").style,"AnimationEvent"in window||(delete wi.animationend.animation,delete wi.animationiteration.animation,delete wi.animationstart.animation),"TransitionEvent"in window||delete wi.transitionend.transition);var Ci=Si("animationend"),_i=Si("animationiteration"),Ei=Si("animationstart"),Ni=Si("transitionrun"),Ii=Si("transitionstart"),Ti=Si("transitioncancel"),ji=Si("transitionend"),Oi=new Map,Pi="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(" ");function Ri(e,t){Oi.set(e,t),fn(t,[e])}Pi.push("scrollEnd");var Mi="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},Ai=[],Li=0,Di=0;function Bi(){for(var e=Li,t=Di=Li=0;t<e;){var n=Ai[t];Ai[t++]=null;var r=Ai[t];Ai[t++]=null;var i=Ai[t];Ai[t++]=null;var o=Ai[t];if(Ai[t++]=null,null!==r&&null!==i){var a=r.pending;null===a?i.next=i:(i.next=a.next,a.next=i),r.pending=i}0!==o&&qi(n,i,o)}}function zi(e,t,n,r){Ai[Li++]=e,Ai[Li++]=t,Ai[Li++]=n,Ai[Li++]=r,Di|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function Ui(e,t,n,r){return zi(e,t,n,r),Hi(e)}function Fi(e,t){return zi(e,null,null,t),Hi(e)}function qi(e,t,n){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n);for(var i=!1,o=e.return;null!==o;)o.childLanes|=n,null!==(r=o.alternate)&&(r.childLanes|=n),22===o.tag&&(null===(e=o.stateNode)||1&e._visibility||(i=!0)),e=o,o=o.return;return 3===e.tag?(o=e.stateNode,i&&null!==t&&(i=31-It(n),null===(r=(e=o.hiddenUpdates)[i])?e[i]=[t]:r.push(t),t.lane=536870912|n),o):null}function Hi(e){if(50<Xu)throw Xu=0,Zu=null,Error(pe(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var Wi={};function Vi(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 $i(e,t,n,r){return new Vi(e,t,n,r)}function Ki(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Qi(e,t){var n=e.alternate;return null===n?((n=$i(e.tag,t,e.key,e.mode)).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=65011712&e.flags,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=null===t?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 Ji(e,t){e.flags&=65011714;var n=e.alternate;return null===n?(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=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Yi(e,t,n,r,i,o){var a=0;if(r=e,"function"==typeof e)Ki(e)&&(a=1);else if("string"==typeof e)a=function(e,t,n){if(1===n||null!=t.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!=typeof t.precedence||"string"!=typeof t.href||""===t.href)break;return!0;case"link":if("string"!=typeof t.rel||"string"!=typeof t.href||""===t.href||t.onLoad||t.onError)break;return"stylesheet"!==t.rel||(e=t.disabled,"string"==typeof t.precedence&&null==e);case"script":if(t.async&&"function"!=typeof t.async&&"symbol"!=typeof t.async&&!t.onLoad&&!t.onError&&t.src&&"string"==typeof t.src)return!0}return!1}(e,n,Xe.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case Ae:return(e=$i(31,n,t,i)).elementType=Ae,e.lanes=o,e;case _e:return Gi(n.children,i,o,t);case Ee:a=8,i|=24;break;case Ne:return(e=$i(12,n,t,2|i)).elementType=Ne,e.lanes=o,e;case Oe:return(e=$i(13,n,t,i)).elementType=Oe,e.lanes=o,e;case Pe:return(e=$i(19,n,t,i)).elementType=Pe,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case Te:a=10;break e;case Ie:a=9;break e;case je:a=11;break e;case Re:a=14;break e;case Me:a=16,r=null;break e}a=29,n=Error(pe(130,null===e?"null":typeof e,"")),r=null}return(t=$i(a,n,t,i)).elementType=e,t.type=r,t.lanes=o,t}function Gi(e,t,n,r){return(e=$i(7,e,r,t)).lanes=n,e}function Xi(e,t,n){return(e=$i(6,e,null,t)).lanes=n,e}function Zi(e){var t=$i(18,null,null,0);return t.stateNode=e,t}function eo(e,t,n){return(t=$i(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var to=new WeakMap;function no(e,t){if("object"==typeof e&&null!==e){var n=to.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ut(t)},to.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var ro=[],io=0,oo=null,ao=0,so=[],lo=0,co=null,uo=1,fo="";function ho(e,t){ro[io++]=ao,ro[io++]=oo,oo=e,ao=t}function po(e,t,n){so[lo++]=uo,so[lo++]=fo,so[lo++]=co,co=e;var r=uo;e=fo;var i=32-It(r)-1;r&=~(1<<i),n+=1;var o=32-It(t)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,uo=1<<32-It(t)+i|n<<i|r,fo=o+e}else uo=1<<o|n<<i|r,fo=e}function mo(e){null!==e.return&&(ho(e,1),po(e,1,0))}function vo(e){for(;e===oo;)oo=ro[--io],ro[io]=null,ao=ro[--io],ro[io]=null;for(;e===co;)co=so[--lo],so[lo]=null,fo=so[--lo],so[lo]=null,uo=so[--lo],so[lo]=null}function go(e,t){so[lo++]=uo,so[lo++]=fo,so[lo++]=co,uo=t.id,fo=t.overflow,co=e}var yo=null,bo=null,wo=!1,xo=null,ko=!1,So=Error(pe(519));function Co(e){throw jo(no(Error(pe(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML","")),e)),So}function _o(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Jt]=e,t[Yt]=r,n){case"dialog":of("cancel",t),of("close",t);break;case"iframe":case"object":case"embed":of("load",t);break;case"video":case"audio":for(n=0;n<tf.length;n++)of(tf[n],t);break;case"source":of("error",t);break;case"img":case"image":case"link":of("error",t),of("load",t);break;case"details":of("toggle",t);break;case"input":of("invalid",t),In(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":of("invalid",t);break;case"textarea":of("invalid",t),Pn(t,r.value,r.defaultValue,r.children)}"string"!=typeof(n=r.children)&&"number"!=typeof n&&"bigint"!=typeof n||t.textContent===""+n||!0===r.suppressHydrationWarning||yf(t.textContent,n)?(null!=r.popover&&(of("beforetoggle",t),of("toggle",t)),null!=r.onScroll&&of("scroll",t),null!=r.onScrollEnd&&of("scrollend",t),null!=r.onClick&&(t.onclick=Fn),t=!0):t=!1,t||Co(e,!0)}function Eo(e){for(yo=e.return;yo;)switch(yo.tag){case 5:case 31:case 13:return void(ko=!1);case 27:case 3:return void(ko=!0);default:yo=yo.return}}function No(e){if(e!==yo)return!1;if(!wo)return Eo(e),wo=!0,!1;var t,n=e.tag;if((t=3!==n&&27!==n)&&((t=5===n)&&(t=!("form"!==(t=e.type)&&"button"!==t)||If(e.type,e.memoizedProps)),t=!t),t&&bo&&Co(e),Eo(e),13===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(pe(317));bo=Wf(e)}else if(31===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(pe(317));bo=Wf(e)}else 27===n?(n=bo,Af(e.type)?(e=Hf,Hf=null,bo=e):bo=n):bo=yo?qf(e.stateNode.nextSibling):null;return!0}function Io(){bo=yo=null,wo=!1}function To(){var e=xo;return null!==e&&(null===Bu?Bu=e:Bu.push.apply(Bu,e),xo=null),e}function jo(e){null===xo?xo=[e]:xo.push(e)}var Oo=Ke(null),Po=null,Ro=null;function Mo(e,t,n){Je(Oo,t._currentValue),t._currentValue=n}function Ao(e){e._currentValue=Oo.current,Qe(Oo)}function Lo(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Do(e,t,n,r){var i=e.child;for(null!==i&&(i.return=e);null!==i;){var o=i.dependencies;if(null!==o){var a=i.child;o=o.firstContext;e:for(;null!==o;){var s=o;o=i;for(var l=0;l<t.length;l++)if(s.context===t[l]){o.lanes|=n,null!==(s=o.alternate)&&(s.lanes|=n),Lo(o.return,n,e),r||(a=null);break e}o=s.next}}else if(18===i.tag){if(null===(a=i.return))throw Error(pe(341));a.lanes|=n,null!==(o=a.alternate)&&(o.lanes|=n),Lo(a,n,e),a=null}else a=i.child;if(null!==a)a.return=i;else for(a=i;null!==a;){if(a===e){a=null;break}if(null!==(i=a.sibling)){i.return=a.return,a=i;break}a=a.return}i=a}}function Bo(e,t,n,r){e=null;for(var i=t,o=!1;null!==i;){if(!o)if(524288&i.flags)o=!0;else if(262144&i.flags)break;if(10===i.tag){var a=i.alternate;if(null===a)throw Error(pe(387));if(null!==(a=a.memoizedProps)){var s=i.type;ai(i.pendingProps.value,a.value)||(null!==e?e.push(s):e=[s])}}else if(i===tt.current){if(null===(a=i.alternate))throw Error(pe(387));a.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(null!==e?e.push(bh):e=[bh])}i=i.return}null!==e&&Do(t,e,n,r),t.flags|=262144}function zo(e){for(e=e.firstContext;null!==e;){if(!ai(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Uo(e){Po=e,Ro=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Fo(e){return Ho(Po,e)}function qo(e,t){return null===Po&&Uo(e),Ho(e,t)}function Ho(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},null===Ro){if(null===e)throw Error(pe(308));Ro=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ro=Ro.next=t;return n}var Wo="undefined"!=typeof AbortController?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()})}},Vo=de.unstable_scheduleCallback,$o=de.unstable_NormalPriority,Ko={$$typeof:Te,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qo(){return{controller:new Wo,data:new Map,refCount:0}}function Jo(e){e.refCount--,0===e.refCount&&Vo($o,function(){e.controller.abort()})}var Yo=null,Go=0,Xo=0,Zo=null;function ea(){if(0===--Go&&null!==Yo){null!==Zo&&(Zo.status="fulfilled");var e=Yo;Yo=null,Xo=0,Zo=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var ta=qe.S;qe.S=function(e,t){Fu=vt(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===Yo){var n=Yo=[];Go=0,Xo=Yd(),Zo={status:"pending",value:void 0,then:function(e){n.push(e)}}}Go++,t.then(ea,ea)}(0,t),null!==ta&&ta(e,t)};var na=Ke(null);function ra(){var e=na.current;return null!==e?e:ku.pooledCache}function ia(e,t){Je(na,null===t?na.current:t.pool)}function oa(){var e=ra();return null===e?null:{parent:Ko._currentValue,pool:e}}var aa=Error(pe(460)),sa=Error(pe(474)),la=Error(pe(542)),ca={then:function(){}};function ua(e){return"fulfilled"===(e=e.status)||"rejected"===e}function da(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(Fn,Fn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw ma(e=t.reason),e;default:if("string"==typeof t.status)t.then(Fn,Fn);else{if(null!==(e=ku)&&100<e.shellSuspendCounter)throw Error(pe(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw ma(e=t.reason),e}throw ha=t,aa}}function fa(e){try{return(0,e._init)(e._payload)}catch(e){if(null!==e&&"object"==typeof e&&"function"==typeof e.then)throw ha=e,aa;throw e}}var ha=null;function pa(){if(null===ha)throw Error(pe(459));var e=ha;return ha=null,e}function ma(e){if(e===aa||e===la)throw Error(pe(483))}var va=null,ga=0;function ya(e){var t=ga;return ga+=1,null===va&&(va=[]),da(va,e,t)}function ba(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function wa(e,t){if(t.$$typeof===ke)throw Error(pe(525));throw e=Object.prototype.toString.call(t),Error(pe(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function xa(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function i(e,t){return(e=Qi(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=67108866,n):r:(t.flags|=67108866,n):(t.flags|=1048576,n)}function a(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Xi(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function l(e,t,n,r){var o=n.type;return o===_e?u(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===Me&&fa(o)===t.type)?(ba(t=i(t,n.props),n),t.return=e,t):(ba(t=Yi(n.type,n.key,n.props,null,e.mode,r),n),t.return=e,t)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=eo(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function u(e,t,n,r,o){return null===t||7!==t.tag?((t=Gi(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function d(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Xi(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case Se:return ba(n=Yi(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case Ce:return(t=eo(t,e.mode,n)).return=e,t;case Me:return d(e,t=fa(t),n)}if(Fe(t)||Be(t))return(t=Gi(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return d(e,ya(t),n);if(t.$$typeof===Te)return d(e,qo(e,t),n);wa(e,t)}return null}function f(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==i?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case Se:return n.key===i?l(e,t,n,r):null;case Ce:return n.key===i?c(e,t,n,r):null;case Me:return f(e,t,n=fa(n),r)}if(Fe(n)||Be(n))return null!==i?null:u(e,t,n,r,null);if("function"==typeof n.then)return f(e,t,ya(n),r);if(n.$$typeof===Te)return f(e,t,qo(e,n),r);wa(e,n)}return null}function h(e,t,n,r,i){if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return s(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case Se:return l(t,e=e.get(null===r.key?n:r.key)||null,r,i);case Ce:return c(t,e=e.get(null===r.key?n:r.key)||null,r,i);case Me:return h(e,t,n,r=fa(r),i)}if(Fe(r)||Be(r))return u(t,e=e.get(n)||null,r,i,null);if("function"==typeof r.then)return h(e,t,n,ya(r),i);if(r.$$typeof===Te)return h(e,t,n,qo(t,r),i);wa(t,r)}return null}function p(s,l,c,u){if("object"==typeof c&&null!==c&&c.type===_e&&null===c.key&&(c=c.props.children),"object"==typeof c&&null!==c){switch(c.$$typeof){case Se:e:{for(var m=c.key;null!==l;){if(l.key===m){if((m=c.type)===_e){if(7===l.tag){n(s,l.sibling),(u=i(l,c.props.children)).return=s,s=u;break e}}else if(l.elementType===m||"object"==typeof m&&null!==m&&m.$$typeof===Me&&fa(m)===l.type){n(s,l.sibling),ba(u=i(l,c.props),c),u.return=s,s=u;break e}n(s,l);break}t(s,l),l=l.sibling}c.type===_e?((u=Gi(c.props.children,s.mode,u,c.key)).return=s,s=u):(ba(u=Yi(c.type,c.key,c.props,null,s.mode,u),c),u.return=s,s=u)}return a(s);case Ce:e:{for(m=c.key;null!==l;){if(l.key===m){if(4===l.tag&&l.stateNode.containerInfo===c.containerInfo&&l.stateNode.implementation===c.implementation){n(s,l.sibling),(u=i(l,c.children||[])).return=s,s=u;break e}n(s,l);break}t(s,l),l=l.sibling}(u=eo(c,s.mode,u)).return=s,s=u}return a(s);case Me:return p(s,l,c=fa(c),u)}if(Fe(c))return function(i,a,s,l){for(var c=null,u=null,p=a,m=a=0,v=null;null!==p&&m<s.length;m++){p.index>m?(v=p,p=null):v=p.sibling;var g=f(i,p,s[m],l);if(null===g){null===p&&(p=v);break}e&&p&&null===g.alternate&&t(i,p),a=o(g,a,m),null===u?c=g:u.sibling=g,u=g,p=v}if(m===s.length)return n(i,p),wo&&ho(i,m),c;if(null===p){for(;m<s.length;m++)null!==(p=d(i,s[m],l))&&(a=o(p,a,m),null===u?c=p:u.sibling=p,u=p);return wo&&ho(i,m),c}for(p=r(p);m<s.length;m++)null!==(v=h(p,i,m,s[m],l))&&(e&&null!==v.alternate&&p.delete(null===v.key?m:v.key),a=o(v,a,m),null===u?c=v:u.sibling=v,u=v);return e&&p.forEach(function(e){return t(i,e)}),wo&&ho(i,m),c}(s,l,c,u);if(Be(c)){if("function"!=typeof(m=Be(c)))throw Error(pe(150));return function(i,a,s,l){if(null==s)throw Error(pe(151));for(var c=null,u=null,p=a,m=a=0,v=null,g=s.next();null!==p&&!g.done;m++,g=s.next()){p.index>m?(v=p,p=null):v=p.sibling;var y=f(i,p,g.value,l);if(null===y){null===p&&(p=v);break}e&&p&&null===y.alternate&&t(i,p),a=o(y,a,m),null===u?c=y:u.sibling=y,u=y,p=v}if(g.done)return n(i,p),wo&&ho(i,m),c;if(null===p){for(;!g.done;m++,g=s.next())null!==(g=d(i,g.value,l))&&(a=o(g,a,m),null===u?c=g:u.sibling=g,u=g);return wo&&ho(i,m),c}for(p=r(p);!g.done;m++,g=s.next())null!==(g=h(p,i,m,g.value,l))&&(e&&null!==g.alternate&&p.delete(null===g.key?m:g.key),a=o(g,a,m),null===u?c=g:u.sibling=g,u=g);return e&&p.forEach(function(e){return t(i,e)}),wo&&ho(i,m),c}(s,l,c=m.call(c),u)}if("function"==typeof c.then)return p(s,l,ya(c),u);if(c.$$typeof===Te)return p(s,l,qo(s,c),u);wa(s,c)}return"string"==typeof c&&""!==c||"number"==typeof c||"bigint"==typeof c?(c=""+c,null!==l&&6===l.tag?(n(s,l.sibling),(u=i(l,c)).return=s,s=u):(n(s,l),(u=Xi(c,s.mode,u)).return=s,s=u),a(s)):n(s,l)}return function(e,t,n,r){try{ga=0;var i=p(e,t,n,r);return va=null,i}catch(t){if(t===aa||t===la)throw t;var o=$i(29,t,null,e.mode);return o.lanes=r,o.return=e,o}}}var ka=xa(!0),Sa=xa(!1),Ca=!1;function _a(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ea(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 Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ia(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&xu){var i=r.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Hi(e),qi(e,null,n),t}return zi(e,r,t,n),Hi(e)}function Ta(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,qt(e,n)}}function ja(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===o?i=o=a:o=o.next=a,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,callbacks:r.callbacks},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Oa=!1;function Pa(){if(Oa){if(null!==Zo)throw Zo}}function Ra(e,t,n,r){Oa=!1;var i=e.updateQueue;Ca=!1;var o=i.firstBaseUpdate,a=i.lastBaseUpdate,s=i.shared.pending;if(null!==s){i.shared.pending=null;var l=s,c=l.next;l.next=null,null===a?o=c:a.next=c,a=l;var u=e.alternate;null!==u&&((s=(u=u.updateQueue).lastBaseUpdate)!==a&&(null===s?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(null!==o){var d=i.baseState;for(a=0,u=c=l=null,s=o;;){var f=-536870913&s.lane,h=f!==s.lane;if(h?(Cu&f)===f:(r&f)===f){0!==f&&f===Xo&&(Oa=!0),null!==u&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var p=e,m=s;f=t;var v=n;switch(m.tag){case 1:if("function"==typeof(p=m.payload)){d=p.call(v,d,f);break e}d=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null==(f="function"==typeof(p=m.payload)?p.call(v,d,f):p))break e;d=xe({},d,f);break e;case 2:Ca=!0}}null!==(f=s.callback)&&(e.flags|=64,h&&(e.flags|=8192),null===(h=i.callbacks)?i.callbacks=[f]:h.push(f))}else h={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===u?(c=u=h,l=d):u=u.next=h,a|=f;if(null===(s=s.next)){if(null===(s=i.shared.pending))break;s=(h=s).next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}null===u&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,null===o&&(i.shared.lanes=0),Pu|=a,e.lanes=a,e.memoizedState=d}}function Ma(e,t){if("function"!=typeof e)throw Error(pe(191,e));e.call(t)}function Aa(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)Ma(n[e],t)}var La=Ke(null),Da=Ke(0);function Ba(e,t){Je(Da,e=ju),Je(La,t),ju=e|t.baseLanes}function za(){Je(Da,ju),Je(La,La.current)}function Ua(){ju=Da.current,Qe(La),Qe(Da)}var Fa=Ke(null),qa=null;function Ha(e){var t=e.alternate;Je(Qa,1&Qa.current),Je(Fa,e),null===qa&&(null===t||null!==La.current||null!==t.memoizedState)&&(qa=e)}function Wa(e){Je(Qa,Qa.current),Je(Fa,e),null===qa&&(qa=e)}function Va(e){22===e.tag?(Je(Qa,Qa.current),Je(Fa,e),null===qa&&(qa=e)):$a()}function $a(){Je(Qa,Qa.current),Je(Fa,Fa.current)}function Ka(e){Qe(Fa),qa===e&&(qa=null),Qe(Qa)}var Qa=Ke(0);function Ja(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||Uf(n)||Ff(n)))return t}else if(19!==t.tag||"forwards"!==t.memoizedProps.revealOrder&&"backwards"!==t.memoizedProps.revealOrder&&"unstable_legacy-backwards"!==t.memoizedProps.revealOrder&&"together"!==t.memoizedProps.revealOrder){if(null!==t.child){t.child.return=t,t=t.child;continue}}else if(128&t.flags)return t;if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ya=0,Ga=null,Xa=null,Za=null,es=!1,ts=!1,ns=!1,rs=0,is=0,os=null,as=0;function ss(){throw Error(pe(321))}function ls(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ai(e[n],t[n]))return!1;return!0}function cs(e,t,n,r,i,o){return Ya=o,Ga=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,qe.H=null===e||null===e.memoizedState?Cl:_l,ns=!1,o=n(r,i),ns=!1,ts&&(o=ds(t,n,r,i)),us(e),o}function us(e){qe.H=Sl;var t=null!==Xa&&null!==Xa.next;if(Ya=0,Za=Xa=Ga=null,es=!1,is=0,os=null,t)throw Error(pe(300));null===e||Fl||null!==(e=e.dependencies)&&zo(e)&&(Fl=!0)}function ds(e,t,n,r){Ga=e;var i=0;do{if(ts&&(os=null),is=0,ts=!1,25<=i)throw Error(pe(301));if(i+=1,Za=Xa=null,null!=e.updateQueue){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,null!=o.memoCache&&(o.memoCache.index=0)}qe.H=El,o=t(n,r)}while(ts);return o}function fs(){var e=qe.H,t=e.useState()[0];return t="function"==typeof t.then?ys(t):t,e=e.useState()[0],(null!==Xa?Xa.memoizedState:null)!==e&&(Ga.flags|=1024),t}function hs(){var e=0!==rs;return rs=0,e}function ps(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ms(e){if(es){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}es=!1}Ya=0,Za=Xa=Ga=null,ts=!1,is=rs=0,os=null}function vs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Za?Ga.memoizedState=Za=e:Za=Za.next=e,Za}function gs(){if(null===Xa){var e=Ga.alternate;e=null!==e?e.memoizedState:null}else e=Xa.next;var t=null===Za?Ga.memoizedState:Za.next;if(null!==t)Za=t,Xa=e;else{if(null===e){if(null===Ga.alternate)throw Error(pe(467));throw Error(pe(310))}e={memoizedState:(Xa=e).memoizedState,baseState:Xa.baseState,baseQueue:Xa.baseQueue,queue:Xa.queue,next:null},null===Za?Ga.memoizedState=Za=e:Za=Za.next=e}return Za}function ys(e){var t=is;return is+=1,null===os&&(os=[]),e=da(os,e,t),t=Ga,null===(null===Za?t.memoizedState:Za.next)&&(t=t.alternate,qe.H=null===t||null===t.memoizedState?Cl:_l),e}function bs(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return ys(e);if(e.$$typeof===Te)return Fo(e)}throw Error(pe(438,String(e)))}function ws(e){var t=null,n=Ga.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var r=Ga.alternate;null!==r&&(null!==(r=r.updateQueue)&&(null!=(r=r.memoCache)&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(null==t&&(t={data:[],index:0}),null===n&&(n={lastEffect:null,events:null,stores:null,memoCache:null},Ga.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=Le;return t.index++,n}function xs(e,t){return"function"==typeof t?t(e):t}function ks(e){return Ss(gs(),Xa,e)}function Ss(e,t,n){var r=e.queue;if(null===r)throw Error(pe(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,null===i)e.memoizedState=o;else{var s=a=null,l=null,c=t=i.next,u=!1;do{var d=-536870913&c.lane;if(d!==c.lane?(Cu&d)===d:(Ya&d)===d){var f=c.revertLane;if(0===f)null!==l&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),d===Xo&&(u=!0);else{if((Ya&f)===f){c=c.next,f===Xo&&(u=!0);continue}d={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===l?(s=l=d,a=o):l=l.next=d,Ga.lanes|=f,Pu|=f}d=c.action,ns&&n(o,d),o=c.hasEagerState?c.eagerState:n(o,d)}else f={lane:d,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===l?(s=l=f,a=o):l=l.next=f,Ga.lanes|=d,Pu|=d;c=c.next}while(null!==c&&c!==t);if(null===l?a=o:l.next=s,!ai(o,e.memoizedState)&&(Fl=!0,u&&null!==(n=Zo)))throw n;e.memoizedState=o,e.baseState=a,e.baseQueue=l,r.lastRenderedState=o}return null===i&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Cs(e){var t=gs(),n=t.queue;if(null===n)throw Error(pe(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);ai(o,t.memoizedState)||(Fl=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function _s(e,t,n){var r=Ga,i=gs(),o=wo;if(o){if(void 0===n)throw Error(pe(407));n=n()}else n=t();var a=!ai((Xa||i).memoizedState,n);if(a&&(i.memoizedState=n,Fl=!0),i=i.queue,Ys(Is.bind(null,r,i,e),[e]),i.getSnapshot!==t||a||null!==Za&&1&Za.memoizedState.tag){if(r.flags|=2048,Vs(9,{destroy:void 0},Ns.bind(null,r,i,n,t),null),null===ku)throw Error(pe(349));o||127&Ya||Es(r,t,n)}return n}function Es(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Ga.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},Ga.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Ns(e,t,n,r){t.value=n,t.getSnapshot=r,Ts(t)&&js(e)}function Is(e,t,n){return n(function(){Ts(t)&&js(e)})}function Ts(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ai(e,n)}catch(e){return!0}}function js(e){var t=Fi(e,2);null!==t&&nd(t,e,2)}function Os(e){var t=vs();if("function"==typeof e){var n=e;if(e=n(),ns){Nt(!0);try{n()}finally{Nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:e},t}function Ps(e,t,n,r){return e.baseState=n,Ss(e,Xa,"function"==typeof r?r:xs)}function Rs(e,t,n,r,i){if(wl(e))throw Error(pe(485));if(null!==(e=t.action)){var o={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};null!==qe.T?n(!0):o.isTransition=!1,r(o),null===(n=t.pending)?(o.next=t.pending=o,Ms(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ms(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var o=qe.T,a={};qe.T=a;try{var s=n(i,r),l=qe.S;null!==l&&l(a,s),As(e,t,s)}catch(n){Ds(e,t,n)}finally{null!==o&&null!==a.types&&(o.types=a.types),qe.T=o}}else try{As(e,t,o=n(i,r))}catch(n){Ds(e,t,n)}}function As(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){Ls(e,t,n)},function(n){return Ds(e,t,n)}):Ls(e,t,n)}function Ls(e,t,n){t.status="fulfilled",t.value=n,Bs(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,Ms(e,n)))}function Ds(e,t,n){var r=e.pending;if(e.pending=null,null!==r){r=r.next;do{t.status="rejected",t.reason=n,Bs(t),t=t.next}while(t!==r)}e.action=null}function Bs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function zs(e,t){return t}function Us(e,t){if(wo){var n=ku.formState;if(null!==n){e:{var r=Ga;if(wo){if(bo){t:{for(var i=bo,o=ko;8!==i.nodeType;){if(!o){i=null;break t}if(null===(i=qf(i.nextSibling))){i=null;break t}}i="F!"===(o=i.data)||"F"===o?i:null}if(i){bo=qf(i.nextSibling),r="F!"===i.data;break e}}Co(r)}r=!1}r&&(t=n[0])}}return(n=vs()).memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:t},n.queue=r,n=gl.bind(null,Ga,r),r.dispatch=n,r=Os(!1),o=bl.bind(null,Ga,!1,r.queue),i={state:t,dispatch:null,action:e,pending:null},(r=vs()).queue=i,n=Rs.bind(null,Ga,i,o,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Fs(e){return qs(gs(),Xa,e)}function qs(e,t,n){if(t=Ss(e,t,zs)[0],e=ks(xs)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var r=ys(t)}catch(e){if(e===aa)throw la;throw e}else r=t;var i=(t=gs()).queue,o=i.dispatch;return n!==t.memoizedState&&(Ga.flags|=2048,Vs(9,{destroy:void 0},Hs.bind(null,i,n),null)),[r,o,e]}function Hs(e,t){e.action=t}function Ws(e){var t=gs(),n=Xa;if(null!==n)return qs(t,n,e);gs(),t=t.memoizedState;var r=(n=gs()).queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Vs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},null===(t=Ga.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},Ga.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function $s(){return gs().memoizedState}function Ks(e,t,n,r){var i=vs();Ga.flags|=e,i.memoizedState=Vs(1|t,{destroy:void 0},n,void 0===r?null:r)}function Qs(e,t,n,r){var i=gs();r=void 0===r?null:r;var o=i.memoizedState.inst;null!==Xa&&null!==r&&ls(r,Xa.memoizedState.deps)?i.memoizedState=Vs(t,o,n,r):(Ga.flags|=e,i.memoizedState=Vs(1|t,o,n,r))}function Js(e,t){Ks(8390656,8,e,t)}function Ys(e,t){Qs(2048,8,e,t)}function Gs(e){var t=gs().memoizedState;return function(e){Ga.flags|=4;var t=Ga.updateQueue;if(null===t)t={lastEffect:null,events:null,stores:null,memoCache:null},Ga.updateQueue=t,t.events=[e];else{var n=t.events;null===n?t.events=[e]:n.push(e)}}({ref:t,nextImpl:e}),function(){if(2&xu)throw Error(pe(440));return t.impl.apply(void 0,arguments)}}function Xs(e,t){return Qs(4,2,e,t)}function Zs(e,t){return Qs(4,4,e,t)}function el(e,t){if("function"==typeof t){e=e();var n=t(e);return function(){"function"==typeof n?n():t(null)}}if(null!=t)return e=e(),t.current=e,function(){t.current=null}}function tl(e,t,n){n=null!=n?n.concat([e]):null,Qs(4,4,el.bind(null,t,e),n)}function nl(){}function rl(e,t){var n=gs();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&ls(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function il(e,t){var n=gs();t=void 0===t?null:t;var r=n.memoizedState;if(null!==t&&ls(t,r[1]))return r[0];if(r=e(),ns){Nt(!0);try{e()}finally{Nt(!1)}}return n.memoizedState=[r,t],r}function ol(e,t,n){return void 0===n||1073741824&Ya&&!(261930&Cu)?e.memoizedState=t:(e.memoizedState=n,e=td(),Ga.lanes|=e,Pu|=e,n)}function al(e,t,n,r){return ai(n,t)?n:null!==La.current?(e=ol(e,n,r),ai(e,t)||(Fl=!0),e):42&Ya&&(!(1073741824&Ya)||261930&Cu)?(e=td(),Ga.lanes|=e,Pu|=e,t):(Fl=!0,e.memoizedState=n)}function sl(e,t,n,r,i){var o=He.p;He.p=0!==o&&8>o?o:8;var a,s,l,c=qe.T,u={};qe.T=u,bl(e,!1,t,n);try{var d=i(),f=qe.S;if(null!==f&&f(u,d),null!==d&&"object"==typeof d&&"function"==typeof d.then){var h=(a=r,s=[],l={status:"pending",value:null,reason:null,then:function(e){s.push(e)}},d.then(function(){l.status="fulfilled",l.value=a;for(var e=0;e<s.length;e++)(0,s[e])(a)},function(e){for(l.status="rejected",l.reason=e,e=0;e<s.length;e++)(0,s[e])(void 0)}),l);yl(e,t,h,ed())}else yl(e,t,r,ed())}catch(n){yl(e,t,{then:function(){},status:"rejected",reason:n},ed())}finally{He.p=o,null!==c&&null!==u.types&&(c.types=u.types),qe.T=c}}function ll(){}function cl(e,t,n,r){if(5!==e.tag)throw Error(pe(476));var i=ul(e).queue;sl(e,i,t,We,null===n?ll:function(){return dl(e),n(r)})}function ul(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:We,baseState:We,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:We},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function dl(e){var t=ul(e);null===t.next&&(t=e.alternate.memoizedState),yl(e,t.next.queue,{},ed())}function fl(){return Fo(bh)}function hl(){return gs().memoizedState}function pl(){return gs().memoizedState}function ml(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=ed(),r=Ia(t,e=Na(n),n);return null!==r&&(nd(r,t,n),Ta(r,t,n)),t={cache:Qo()},void(e.payload=t)}t=t.return}}function vl(e,t,n){var r=ed();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},wl(e)?xl(t,n):null!==(n=Ui(e,t,n,r))&&(nd(n,e,r),kl(n,t,r))}function gl(e,t,n){yl(e,t,n,ed())}function yl(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(wl(e))xl(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,ai(s,a))return zi(e,t,i,0),null===ku&&Bi(),!1}catch(e){}if(null!==(n=Ui(e,t,i,r)))return nd(n,e,r),kl(n,t,r),!0}return!1}function bl(e,t,n,r){if(r={lane:2,revertLane:Yd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},wl(e)){if(t)throw Error(pe(479))}else null!==(t=Ui(e,n,r,2))&&nd(t,e,2)}function wl(e){var t=e.alternate;return e===Ga||null!==t&&t===Ga}function xl(e,t){ts=es=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function kl(e,t,n){if(4194048&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,qt(e,n)}}var Sl={readContext:Fo,use:bs,useCallback:ss,useContext:ss,useEffect:ss,useImperativeHandle:ss,useLayoutEffect:ss,useInsertionEffect:ss,useMemo:ss,useReducer:ss,useRef:ss,useState:ss,useDebugValue:ss,useDeferredValue:ss,useTransition:ss,useSyncExternalStore:ss,useId:ss,useHostTransitionStatus:ss,useFormState:ss,useActionState:ss,useOptimistic:ss,useMemoCache:ss,useCacheRefresh:ss};Sl.useEffectEvent=ss;var Cl={readContext:Fo,use:bs,useCallback:function(e,t){return vs().memoizedState=[e,void 0===t?null:t],e},useContext:Fo,useEffect:Js,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,Ks(4194308,4,el.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ks(4194308,4,e,t)},useInsertionEffect:function(e,t){Ks(4,2,e,t)},useMemo:function(e,t){var n=vs();t=void 0===t?null:t;var r=e();if(ns){Nt(!0);try{e()}finally{Nt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=vs();if(void 0!==n){var i=n(t);if(ns){Nt(!0);try{n(t)}finally{Nt(!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=vl.bind(null,Ga,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},vs().memoizedState=e},useState:function(e){var t=(e=Os(e)).queue,n=gl.bind(null,Ga,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:nl,useDeferredValue:function(e,t){return ol(vs(),e,t)},useTransition:function(){var e=Os(!1);return e=sl.bind(null,Ga,e.queue,!0,!1),vs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Ga,i=vs();if(wo){if(void 0===n)throw Error(pe(407));n=n()}else{if(n=t(),null===ku)throw Error(pe(349));127&Cu||Es(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Js(Is.bind(null,r,o,e),[e]),r.flags|=2048,Vs(9,{destroy:void 0},Ns.bind(null,r,o,n,t),null),n},useId:function(){var e=vs(),t=ku.identifierPrefix;if(wo){var n=fo;t="_"+t+"R_"+(n=(uo&~(1<<32-It(uo)-1)).toString(32)+n),0<(n=rs++)&&(t+="H"+n.toString(32)),t+="_"}else t="_"+t+"r_"+(n=as++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:fl,useFormState:Us,useActionState:Us,useOptimistic:function(e){var t=vs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=bl.bind(null,Ga,!0,n),n.dispatch=t,[e,t]},useMemoCache:ws,useCacheRefresh:function(){return vs().memoizedState=ml.bind(null,Ga)},useEffectEvent:function(e){var t=vs(),n={impl:e};return t.memoizedState=n,function(){if(2&xu)throw Error(pe(440));return n.impl.apply(void 0,arguments)}}},_l={readContext:Fo,use:bs,useCallback:rl,useContext:Fo,useEffect:Ys,useImperativeHandle:tl,useInsertionEffect:Xs,useLayoutEffect:Zs,useMemo:il,useReducer:ks,useRef:$s,useState:function(){return ks(xs)},useDebugValue:nl,useDeferredValue:function(e,t){return al(gs(),Xa.memoizedState,e,t)},useTransition:function(){var e=ks(xs)[0],t=gs().memoizedState;return["boolean"==typeof e?e:ys(e),t]},useSyncExternalStore:_s,useId:hl,useHostTransitionStatus:fl,useFormState:Fs,useActionState:Fs,useOptimistic:function(e,t){return Ps(gs(),0,e,t)},useMemoCache:ws,useCacheRefresh:pl};_l.useEffectEvent=Gs;var El={readContext:Fo,use:bs,useCallback:rl,useContext:Fo,useEffect:Ys,useImperativeHandle:tl,useInsertionEffect:Xs,useLayoutEffect:Zs,useMemo:il,useReducer:Cs,useRef:$s,useState:function(){return Cs(xs)},useDebugValue:nl,useDeferredValue:function(e,t){var n=gs();return null===Xa?ol(n,e,t):al(n,Xa.memoizedState,e,t)},useTransition:function(){var e=Cs(xs)[0],t=gs().memoizedState;return["boolean"==typeof e?e:ys(e),t]},useSyncExternalStore:_s,useId:hl,useHostTransitionStatus:fl,useFormState:Ws,useActionState:Ws,useOptimistic:function(e,t){var n=gs();return null!==Xa?Ps(n,0,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:ws,useCacheRefresh:pl};function Nl(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:xe({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}El.useEffectEvent=Gs;var Il={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ed(),i=Na(r);i.payload=t,null!=n&&(i.callback=n),null!==(t=Ia(e,i,r))&&(nd(t,e,r),Ta(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ed(),i=Na(r);i.tag=1,i.payload=t,null!=n&&(i.callback=n),null!==(t=Ia(e,i,r))&&(nd(t,e,r),Ta(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ed(),r=Na(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=Ia(e,r,n))&&(nd(t,e,n),Ta(t,e,n))}};function Tl(e,t,n,r,i,o,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!t.prototype||!t.prototype.isPureReactComponent||(!si(n,r)||!si(i,o))}function jl(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Il.enqueueReplaceState(t,t.state,null)}function Ol(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=xe({},n)),e)void 0===n[i]&&(n[i]=e[i]);return n}function Pl(e){Mi(e)}function Rl(e){console.error(e)}function Ml(e){Mi(e)}function Al(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ll(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Dl(e,t,n){return(n=Na(n)).tag=3,n.payload={element:null},n.callback=function(){Al(e,t)},n}function Bl(e){return(e=Na(e)).tag=3,e}function zl(e,t,n,r){var i=n.type.getDerivedStateFromError;if("function"==typeof i){var o=r.value;e.payload=function(){return i(o)},e.callback=function(){Ll(t,n,r)}}var a=n.stateNode;null!==a&&"function"==typeof a.componentDidCatch&&(e.callback=function(){Ll(t,n,r),"function"!=typeof i&&(null===Wu?Wu=new Set([this]):Wu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Ul=Error(pe(461)),Fl=!1;function ql(e,t,n,r){t.child=null===e?Sa(t,null,n,r):ka(t,e.child,n,r)}function Hl(e,t,n,r,i){n=n.render;var o=t.ref;if("ref"in r){var a={};for(var s in r)"ref"!==s&&(a[s]=r[s])}else a=r;return Uo(t),r=cs(e,t,n,a,o,i),s=hs(),null===e||Fl?(wo&&s&&mo(t),t.flags|=1,ql(e,t,r,i),t.child):(ps(e,t,i),fc(e,t,i))}function Wl(e,t,n,r,i){if(null===e){var o=n.type;return"function"!=typeof o||Ki(o)||void 0!==o.defaultProps||null!==n.compare?((e=Yi(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Vl(e,t,o,r,i))}if(o=e.child,!hc(e,i)){var a=o.memoizedProps;if((n=null!==(n=n.compare)?n:si)(a,r)&&e.ref===t.ref)return fc(e,t,i)}return t.flags|=1,(e=Qi(o,r)).ref=t.ref,e.return=t,t.child=e}function Vl(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(si(o,r)&&e.ref===t.ref){if(Fl=!1,t.pendingProps=r=o,!hc(e,i))return t.lanes=e.lanes,fc(e,t,i);131072&e.flags&&(Fl=!0)}}return Xl(e,t,n,r,i)}function $l(e,t,n,r){var i=r.children,o=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===r.mode){if(128&t.flags){if(o=null!==o?o.baseLanes|n:n,null!==e){for(r=t.child=e.child,i=0;null!==r;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~o}else r=0,t.child=null;return Ql(e,t,o,n,r)}if(!(536870912&n))return r=t.lanes=536870912,Ql(e,t,null!==o?o.baseLanes|n:n,n,r);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&ia(0,null!==o?o.cachePool:null),null!==o?Ba(t,o):za(),Va(t)}else null!==o?(ia(0,o.cachePool),Ba(t,o),$a(),t.memoizedState=null):(null!==e&&ia(0,null),za(),$a());return ql(e,t,i,n),t.child}function Kl(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ql(e,t,n,r,i){var o=ra();return o=null===o?null:{parent:Ko._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},null!==e&&ia(0,null),za(),Va(t),null!==e&&Bo(e,t,r,!0),t.childLanes=i,null}function Jl(e,t){return(t=sc({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function Yl(e,t,n){return ka(t,e.child,null,n),(e=Jl(t,t.pendingProps)).flags|=2,Ka(t),t.memoizedState=null,e}function Gl(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(pe(284));null!==e&&e.ref===n||(t.flags|=4194816)}}function Xl(e,t,n,r,i){return Uo(t),n=cs(e,t,n,r,void 0,i),r=hs(),null===e||Fl?(wo&&r&&mo(t),t.flags|=1,ql(e,t,n,i),t.child):(ps(e,t,i),fc(e,t,i))}function Zl(e,t,n,r,i,o){return Uo(t),t.updateQueue=null,n=ds(t,r,n,i),us(e),r=hs(),null===e||Fl?(wo&&r&&mo(t),t.flags|=1,ql(e,t,n,o),t.child):(ps(e,t,o),fc(e,t,o))}function ec(e,t,n,r,i){if(Uo(t),null===t.stateNode){var o=Wi,a=n.contextType;"object"==typeof a&&null!==a&&(o=Fo(a)),o=new n(r,o),t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,o.updater=Il,t.stateNode=o,o._reactInternals=t,(o=t.stateNode).props=r,o.state=t.memoizedState,o.refs={},_a(t),a=n.contextType,o.context="object"==typeof a&&null!==a?Fo(a):Wi,o.state=t.memoizedState,"function"==typeof(a=n.getDerivedStateFromProps)&&(Nl(t,n,a,r),o.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(a=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),a!==o.state&&Il.enqueueReplaceState(o,o.state,null),Ra(t,r,o,i),Pa(),o.state=t.memoizedState),"function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){o=t.stateNode;var s=t.memoizedProps,l=Ol(n,s);o.props=l;var c=o.context,u=n.contextType;a=Wi,"object"==typeof u&&null!==u&&(a=Fo(u));var d=n.getDerivedStateFromProps;u="function"==typeof d||"function"==typeof o.getSnapshotBeforeUpdate,s=t.pendingProps!==s,u||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(s||c!==a)&&jl(t,o,r,a),Ca=!1;var f=t.memoizedState;o.state=f,Ra(t,r,o,i),Pa(),c=t.memoizedState,s||f!==c||Ca?("function"==typeof d&&(Nl(t,n,d,r),c=t.memoizedState),(l=Ca||Tl(t,n,l,r,f,c,a))?(u||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=a,r=l):("function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Ea(e,t),u=Ol(n,a=t.memoizedProps),o.props=u,d=t.pendingProps,f=o.context,c=n.contextType,l=Wi,"object"==typeof c&&null!==c&&(l=Fo(c)),(c="function"==typeof(s=n.getDerivedStateFromProps)||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==d||f!==l)&&jl(t,o,r,l),Ca=!1,f=t.memoizedState,o.state=f,Ra(t,r,o,i),Pa();var h=t.memoizedState;a!==d||f!==h||Ca||null!==e&&null!==e.dependencies&&zo(e.dependencies)?("function"==typeof s&&(Nl(t,n,s,r),h=t.memoizedState),(u=Ca||Tl(t,n,u,r,f,h,l)||null!==e&&null!==e.dependencies&&zo(e.dependencies))?(c||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(r,h,l),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,h,l)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),o.props=r,o.state=h,o.context=l,r=u):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return o=r,Gl(e,t),r=!!(128&t.flags),o||r?(o=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:o.render(),t.flags|=1,null!==e&&r?(t.child=ka(t,e.child,null,i),t.child=ka(t,null,n,i)):ql(e,t,n,i),t.memoizedState=o.state,e=t.child):e=fc(e,t,i),e}function tc(e,t,n,r){return Io(),t.flags|=256,ql(e,t,n,r),t.child}var nc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rc(e){return{baseLanes:e,cachePool:oa()}}function ic(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=Au),e}function oc(e,t,n){var r,i=t.pendingProps,o=!1,a=!!(128&t.flags);if((r=a)||(r=(null===e||null!==e.memoizedState)&&!!(2&Qa.current)),r&&(o=!0,t.flags&=-129),r=!!(32&t.flags),t.flags&=-33,null===e){if(wo){if(o?Ha(t):$a(),(e=bo)?null!==(e=null!==(e=zf(e,ko))&&"&"!==e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==co?{id:uo,overflow:fo}:null,retryLane:536870912,hydrationErrors:null},(n=Zi(e)).return=t,t.child=n,yo=t,bo=null):e=null,null===e)throw Co(t);return Ff(e)?t.lanes=32:t.lanes=536870912,null}var s=i.children;return i=i.fallback,o?($a(),s=sc({mode:"hidden",children:s},o=t.mode),i=Gi(i,o,n,null),s.return=t,i.return=t,s.sibling=i,t.child=s,(i=t.child).memoizedState=rc(n),i.childLanes=ic(e,r,n),t.memoizedState=nc,Kl(null,i)):(Ha(t),ac(t,s))}var l=e.memoizedState;if(null!==l&&null!==(s=l.dehydrated)){if(a)256&t.flags?(Ha(t),t.flags&=-257,t=lc(e,t,n)):null!==t.memoizedState?($a(),t.child=e.child,t.flags|=128,t=null):($a(),s=i.fallback,o=t.mode,i=sc({mode:"visible",children:i.children},o),(s=Gi(s,o,n,null)).flags|=2,i.return=t,s.return=t,i.sibling=s,t.child=i,ka(t,e.child,null,n),(i=t.child).memoizedState=rc(n),i.childLanes=ic(e,r,n),t.memoizedState=nc,t=Kl(null,i));else if(Ha(t),Ff(s)){if(r=s.nextSibling&&s.nextSibling.dataset)var c=r.dgst;r=c,(i=Error(pe(419))).stack="",i.digest=r,jo({value:i,source:null,stack:null}),t=lc(e,t,n)}else if(Fl||Bo(e,t,n,!1),r=0!==(n&e.childLanes),Fl||r){if(null!==(r=ku)&&(0!==(i=Ht(r,n))&&i!==l.retryLane))throw l.retryLane=i,Fi(e,i),nd(r,e,i),Ul;Uf(s)||pd(),t=lc(e,t,n)}else Uf(s)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,bo=qf(s.nextSibling),yo=t,wo=!0,xo=null,ko=!1,null!==e&&go(t,e),(t=ac(t,i.children)).flags|=4096);return t}return o?($a(),s=i.fallback,o=t.mode,c=(l=e.child).sibling,(i=Qi(l,{mode:"hidden",children:i.children})).subtreeFlags=65011712&l.subtreeFlags,null!==c?s=Qi(c,s):(s=Gi(s,o,n,null)).flags|=2,s.return=t,i.return=t,i.sibling=s,t.child=i,Kl(null,i),i=t.child,null===(s=e.child.memoizedState)?s=rc(n):(null!==(o=s.cachePool)?(l=Ko._currentValue,o=o.parent!==l?{parent:l,pool:l}:o):o=oa(),s={baseLanes:s.baseLanes|n,cachePool:o}),i.memoizedState=s,i.childLanes=ic(e,r,n),t.memoizedState=nc,Kl(e.child,i)):(Ha(t),e=(n=e.child).sibling,(n=Qi(n,{mode:"visible",children:i.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function ac(e,t){return(t=sc({mode:"visible",children:t},e.mode)).return=e,e.child=t}function sc(e,t){return(e=$i(22,e,null,t)).lanes=0,e}function lc(e,t,n){return ka(t,e.child,null,n),(e=ac(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function cc(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Lo(e.return,t,n)}function uc(e,t,n,r,i,o){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i,a.treeForkCount=o)}function dc(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;r=r.children;var a=Qa.current,s=!!(2&a);if(s?(a=1&a|2,t.flags|=128):a&=1,Je(Qa,a),ql(e,t,r,n),r=wo?ao:0,!s&&null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&cc(e,n,t);else if(19===e.tag)cc(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===Ja(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),uc(t,!1,i,n,o,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===Ja(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}uc(t,!0,n,null,o,r);break;case"together":uc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function fc(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Pu|=t.lanes,0===(n&t.childLanes)){if(null===e)return null;if(Bo(e,t,n,!1),0===(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(pe(153));if(null!==t.child){for(n=Qi(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Qi(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function hc(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!zo(e))}function pc(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Fl=!0;else{if(!(hc(e,n)||128&t.flags))return Fl=!1,function(e,t,n){switch(t.tag){case 3:nt(t,t.stateNode.containerInfo),Mo(0,Ko,e.memoizedState.cache),Io();break;case 27:case 5:it(t);break;case 4:nt(t,t.stateNode.containerInfo);break;case 10:Mo(0,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,Wa(t),null;break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(Ha(t),t.flags|=128,null):0!==(n&t.child.childLanes)?oc(e,t,n):(Ha(t),null!==(e=fc(e,t,n))?e.sibling:null);Ha(t);break;case 19:var i=!!(128&e.flags);if((r=0!==(n&t.childLanes))||(Bo(e,t,n,!1),r=0!==(n&t.childLanes)),i){if(r)return dc(e,t,n);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),Je(Qa,Qa.current),r)break;return null;case 22:return t.lanes=0,$l(e,t,n,t.pendingProps);case 24:Mo(0,Ko,e.memoizedState.cache)}return fc(e,t,n)}(e,t,n);Fl=!!(131072&e.flags)}else Fl=!1,wo&&1048576&t.flags&&po(t,ao,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=fa(t.elementType),t.type=e,"function"!=typeof e){if(null!=e){var i=e.$$typeof;if(i===je){t.tag=11,t=Hl(null,t,e,r,n);break e}if(i===Re){t.tag=14,t=Wl(null,t,e,r,n);break e}}throw t=Ue(e)||e,Error(pe(306,t,""))}Ki(e)?(r=Ol(e,r),t.tag=1,t=ec(null,t,e,r,n)):(t.tag=0,t=Xl(null,t,e,r,n))}return t;case 0:return Xl(e,t,t.type,t.pendingProps,n);case 1:return ec(e,t,r=t.type,i=Ol(r,t.pendingProps),n);case 3:e:{if(nt(t,t.stateNode.containerInfo),null===e)throw Error(pe(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,Ea(e,t),Ra(t,r,null,n);var a=t.memoizedState;if(r=a.cache,Mo(0,Ko,r),r!==o.cache&&Do(t,[Ko],n,!0),Pa(),r=a.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:a.cache},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=tc(e,t,r,n);break e}if(r!==i){jo(i=no(Error(pe(424)),t)),t=tc(e,t,r,n);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(bo=qf(e.firstChild),yo=t,wo=!0,xo=null,ko=!0,n=Sa(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(Io(),r===i){t=fc(e,t,n);break e}ql(e,t,r,n)}t=t.child}return t;case 26:return Gl(e,t),null===e?(n=eh(t.type,null,t.pendingProps,null))?t.memoizedState=n:wo||(n=t.type,e=t.pendingProps,(r=_f(et.current).createElement(n))[Jt]=t,r[Yt]=e,xf(r,n,e),cn(r),t.stateNode=r):t.memoizedState=eh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return it(t),null===e&&wo&&(r=t.stateNode=$f(t.type,t.pendingProps,et.current),yo=t,ko=!0,i=bo,Af(t.type)?(Hf=i,bo=qf(r.firstChild)):bo=i),ql(e,t,t.pendingProps.children,n),Gl(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&wo&&((i=r=bo)&&(null!==(r=function(e,t,n,r){for(;1===e.nodeType;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[nn])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(o=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(o!==i.rel||e.getAttribute("href")!==(null==i.href||""===i.href?null:i.href)||e.getAttribute("crossorigin")!==(null==i.crossOrigin?null:i.crossOrigin)||e.getAttribute("title")!==(null==i.title?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((o=e.getAttribute("src"))!==(null==i.src?null:i.src)||e.getAttribute("type")!==(null==i.type?null:i.type)||e.getAttribute("crossorigin")!==(null==i.crossOrigin?null:i.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var o=null==i.name?null:""+i.name;if("hidden"===i.type&&e.getAttribute("name")===o)return e}if(null===(e=qf(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,ko))?(t.stateNode=r,yo=t,bo=qf(r.firstChild),ko=!1,i=!0):i=!1),i||Co(t)),it(t),i=t.type,o=t.pendingProps,a=null!==e?e.memoizedProps:null,r=o.children,If(i,o)?r=null:null!==a&&If(i,a)&&(t.flags|=32),null!==t.memoizedState&&(i=cs(e,t,fs,null,null,n),bh._currentValue=i),Gl(e,t),ql(e,t,r,n),t.child;case 6:return null===e&&wo&&((e=n=bo)&&(null!==(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n)return null;if(null===(e=qf(e.nextSibling)))return null}return e}(n,t.pendingProps,ko))?(t.stateNode=n,yo=t,bo=null,e=!0):e=!1),e||Co(t)),null;case 13:return oc(e,t,n);case 4:return nt(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=ka(t,null,r,n):ql(e,t,r,n),t.child;case 11:return Hl(e,t,t.type,t.pendingProps,n);case 7:return ql(e,t,t.pendingProps,n),t.child;case 8:case 12:return ql(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Mo(0,t.type,r.value),ql(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Uo(t),r=r(i=Fo(i)),t.flags|=1,ql(e,t,r,n),t.child;case 14:return Wl(e,t,t.type,t.pendingProps,n);case 15:return Vl(e,t,t.type,t.pendingProps,n);case 19:return dc(e,t,n);case 31:return function(e,t,n){var r=t.pendingProps,i=!!(128&t.flags);if(t.flags&=-129,null===e){if(wo){if("hidden"===r.mode)return e=Jl(t,r),t.lanes=536870912,Kl(null,e);if(Wa(t),(e=bo)?null!==(e=null!==(e=zf(e,ko))&&"&"===e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==co?{id:uo,overflow:fo}:null,retryLane:536870912,hydrationErrors:null},(n=Zi(e)).return=t,t.child=n,yo=t,bo=null):e=null,null===e)throw Co(t);return t.lanes=536870912,null}return Jl(t,r)}var o=e.memoizedState;if(null!==o){var a=o.dehydrated;if(Wa(t),i)if(256&t.flags)t.flags&=-257,t=Yl(e,t,n);else{if(null===t.memoizedState)throw Error(pe(558));t.child=e.child,t.flags|=128,t=null}else if(Fl||Bo(e,t,n,!1),i=0!==(n&e.childLanes),Fl||i){if(null!==(r=ku)&&0!==(a=Ht(r,n))&&a!==o.retryLane)throw o.retryLane=a,Fi(e,a),nd(r,e,a),Ul;pd(),t=Yl(e,t,n)}else e=o.treeContext,bo=qf(a.nextSibling),yo=t,wo=!0,xo=null,ko=!1,null!==e&&go(t,e),(t=Jl(t,r)).flags|=4096;return t}return(e=Qi(e.child,{mode:r.mode,children:r.children})).ref=t.ref,t.child=e,e.return=t,e}(e,t,n);case 22:return $l(e,t,n,t.pendingProps);case 24:return Uo(t),r=Fo(Ko),null===e?(null===(i=ra())&&(i=ku,o=Qo(),i.pooledCache=o,o.refCount++,null!==o&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},_a(t),Mo(0,Ko,i)):(0!==(e.lanes&n)&&(Ea(e,t),Ra(t,null,null,n),Pa()),i=e.memoizedState,o=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=i),Mo(0,Ko,r)):(r=o.cache,Mo(0,Ko,r),r!==i.cache&&Do(t,[Ko],n,!0))),ql(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(pe(156,t.tag))}function mc(e){e.flags|=4}function vc(e,t,n,r,i){if((t=!!(32&e.mode))&&(t=!1),t){if(e.flags|=16777216,(335544128&i)===i)if(e.stateNode.complete)e.flags|=8192;else{if(!dd())throw ha=ca,sa;e.flags|=8192}}else e.flags&=-16777217}function gc(e,t){if("stylesheet"!==t.type||4&t.state.loading)e.flags&=-16777217;else if(e.flags|=16777216,!hh(t)){if(!dd())throw ha=ca,sa;e.flags|=8192}}function yc(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Bt():536870912,e.lanes|=t,Lu|=t)}function bc(e,t){if(!wo)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function wc(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=65011712&i.subtreeFlags,r|=65011712&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)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 xc(e,t,n){var r=t.pendingProps;switch(vo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return wc(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ao(Ko),rt(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(No(t)?mc(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,To())),wc(t),null;case 26:var i=t.type,o=t.memoizedState;return null===e?(mc(t),null!==o?(wc(t),gc(t,o)):(wc(t),vc(t,i,0,0,n))):o?o!==e.memoizedState?(mc(t),wc(t),gc(t,o)):(wc(t),t.flags&=-16777217):((e=e.memoizedProps)!==r&&mc(t),wc(t),vc(t,i,0,0,n)),null;case 27:if(ot(t),n=et.current,i=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&mc(t);else{if(!r){if(null===t.stateNode)throw Error(pe(166));return wc(t),null}e=Xe.current,No(t)?_o(t):(e=$f(i,r,n),t.stateNode=e,mc(t))}return wc(t),null;case 5:if(ot(t),i=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&mc(t);else{if(!r){if(null===t.stateNode)throw Error(pe(166));return wc(t),null}if(o=Xe.current,No(t))_o(t);else{var a=_f(et.current);switch(o){case 1:o=a.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:o=a.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":o=a.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":o=a.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":(o=a.createElement("div")).innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o="string"==typeof r.is?a.createElement("select",{is:r.is}):a.createElement("select"),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o="string"==typeof r.is?a.createElement(i,{is:r.is}):a.createElement(i)}}o[Jt]=t,o[Yt]=r;e:for(a=t.child;null!==a;){if(5===a.tag||6===a.tag)o.appendChild(a.stateNode);else if(4!==a.tag&&27!==a.tag&&null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;null===a.sibling;){if(null===a.return||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=o;e:switch(xf(o,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&mc(t)}}return wc(t),vc(t,t.type,null===e||e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&mc(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(pe(166));if(e=et.current,No(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(i=yo))switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Jt]=t,(e=!!(e.nodeValue===n||null!==r&&!0===r.suppressHydrationWarning||yf(e.nodeValue,n)))||Co(t,!0)}else(e=_f(e).createTextNode(r))[Jt]=t,t.stateNode=e}return wc(t),null;case 31:if(n=t.memoizedState,null===e||null!==e.memoizedState){if(r=No(t),null!==n){if(null===e){if(!r)throw Error(pe(318));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(pe(557));e[Jt]=t}else Io(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;wc(t),e=!1}else n=To(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return 256&t.flags?(Ka(t),t):(Ka(t),null);if(128&t.flags)throw Error(pe(558))}return wc(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(i=No(t),null!==r&&null!==r.dehydrated){if(null===e){if(!i)throw Error(pe(318));if(!(i=null!==(i=t.memoizedState)?i.dehydrated:null))throw Error(pe(317));i[Jt]=t}else Io(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;wc(t),i=!1}else i=To(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return 256&t.flags?(Ka(t),t):(Ka(t),null)}return Ka(t),128&t.flags?(t.lanes=n,t):(n=null!==r,e=null!==e&&null!==e.memoizedState,n&&(i=null,null!==(r=t.child).alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(i=r.alternate.memoizedState.cachePool.pool),o=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),yc(t,t.updateQueue),wc(t),null);case 4:return rt(),null===e&&lf(t.stateNode.containerInfo),wc(t),null;case 10:return Ao(t.type),wc(t),null;case 19:if(Qe(Qa),null===(r=t.memoizedState))return wc(t),null;if(i=!!(128&t.flags),null===(o=r.rendering))if(i)bc(r,!1);else{if(0!==Ou||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=Ja(e))){for(t.flags|=128,bc(r,!1),e=o.updateQueue,t.updateQueue=e,yc(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)Ji(n,e),n=n.sibling;return Je(Qa,1&Qa.current|2),wo&&ho(t,r.treeForkCount),t.child}e=e.sibling}null!==r.tail&&vt()>qu&&(t.flags|=128,i=!0,bc(r,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=Ja(o))){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,yc(t,e),bc(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate&&!wo)return wc(t),null}else 2*vt()-r.renderingStartTime>qu&&536870912!==n&&(t.flags|=128,i=!0,bc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(null!==(e=r.last)?e.sibling=o:t.child=o,r.last=o)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=vt(),e.sibling=null,n=Qa.current,Je(Qa,i?1&n|2:1&n),wo&&ho(t,r.treeForkCount),e):(wc(t),null);case 22:case 23:return Ka(t),Ua(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?!!(536870912&n)&&!(128&t.flags)&&(wc(t),6&t.subtreeFlags&&(t.flags|=8192)):wc(t),null!==(n=t.updateQueue)&&yc(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&Qe(na),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ao(Ko),wc(t),null;case 25:case 30:return null}throw Error(pe(156,t.tag))}function kc(e,t){switch(vo(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ao(Ko),rt(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return ot(t),null;case 31:if(null!==t.memoizedState){if(Ka(t),null===t.alternate)throw Error(pe(340));Io()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(Ka(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(pe(340));Io()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Qe(Qa),null;case 4:return rt(),null;case 10:return Ao(t.type),null;case 22:case 23:return Ka(t),Ua(),null!==e&&Qe(na),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return Ao(Ko),null;default:return null}}function Sc(e,t){switch(vo(t),t.tag){case 3:Ao(Ko),rt();break;case 26:case 27:case 5:ot(t);break;case 4:rt();break;case 31:null!==t.memoizedState&&Ka(t);break;case 13:Ka(t);break;case 19:Qe(Qa);break;case 10:Ao(t.type);break;case 22:case 23:Ka(t),Ua(),null!==e&&Qe(na);break;case 24:Ao(Ko)}}function Cc(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var o=n.create,a=n.inst;r=o(),a.destroy=r}n=n.next}while(n!==i)}}catch(e){Od(t,t.return,e)}}function _c(e,t,n){try{var r=t.updateQueue,i=null!==r?r.lastEffect:null;if(null!==i){var o=i.next;r=o;do{if((r.tag&e)===e){var a=r.inst,s=a.destroy;if(void 0!==s){a.destroy=void 0,i=t;var l=n,c=s;try{c()}catch(e){Od(i,l,e)}}}r=r.next}while(r!==o)}}catch(e){Od(t,t.return,e)}}function Ec(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{Aa(t,n)}catch(t){Od(e,e.return,t)}}}function Nc(e,t,n){n.props=Ol(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Od(e,t,n)}}function Ic(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;default:r=e.stateNode}"function"==typeof n?e.refCleanup=n(r):n.current=r}}catch(n){Od(e,t,n)}}function Tc(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(n){Od(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(n){Od(e,t,n)}else n.current=null}function jc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Od(e,e.return,t)}}function Oc(e,t,n){try{var r=e.stateNode;!function(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 i=null,o=null,a=null,s=null,l=null,c=null,u=null;for(h in n){var d=n[h];if(n.hasOwnProperty(h)&&null!=d)switch(h){case"checked":case"value":break;case"defaultValue":l=d;default:r.hasOwnProperty(h)||bf(e,t,h,null,r,d)}}for(var f in r){var h=r[f];if(d=n[f],r.hasOwnProperty(f)&&(null!=h||null!=d))switch(f){case"type":o=h;break;case"name":i=h;break;case"checked":c=h;break;case"defaultChecked":u=h;break;case"value":a=h;break;case"defaultValue":s=h;break;case"children":case"dangerouslySetInnerHTML":if(null!=h)throw Error(pe(137,t));break;default:h!==d&&bf(e,t,f,h,r,d)}}return void Nn(e,a,s,l,c,u,o,i);case"select":for(o in h=a=s=f=null,n)if(l=n[o],n.hasOwnProperty(o)&&null!=l)switch(o){case"value":break;case"multiple":h=l;default:r.hasOwnProperty(o)||bf(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(null!=o||null!=l))switch(i){case"value":f=o;break;case"defaultValue":s=o;break;case"multiple":a=o;default:o!==l&&bf(e,t,i,o,r,l)}return t=s,n=a,r=h,void(null!=f?jn(e,!!n,f,!1):!!r!=!!n&&(null!=t?jn(e,!!n,t,!0):jn(e,!!n,n?[]:"",!1)));case"textarea":for(s in h=f=null,n)if(i=n[s],n.hasOwnProperty(s)&&null!=i&&!r.hasOwnProperty(s))switch(s){case"value":case"children":break;default:bf(e,t,s,null,r,i)}for(a in r)if(i=r[a],o=n[a],r.hasOwnProperty(a)&&(null!=i||null!=o))switch(a){case"value":f=i;break;case"defaultValue":h=i;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=i)throw Error(pe(91));break;default:i!==o&&bf(e,t,a,i,r,o)}return void On(e,f,h);case"option":for(var p in n)if(f=n[p],n.hasOwnProperty(p)&&null!=f&&!r.hasOwnProperty(p))if("selected"===p)e.selected=!1;else bf(e,t,p,null,r,f);for(l in r)if(f=r[l],h=n[l],r.hasOwnProperty(l)&&f!==h&&(null!=f||null!=h))if("selected"===l)e.selected=f&&"function"!=typeof f&&"symbol"!=typeof f;else bf(e,t,l,f,r,h);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 m in n)f=n[m],n.hasOwnProperty(m)&&null!=f&&!r.hasOwnProperty(m)&&bf(e,t,m,null,r,f);for(c in r)if(f=r[c],h=n[c],r.hasOwnProperty(c)&&f!==h&&(null!=f||null!=h))switch(c){case"children":case"dangerouslySetInnerHTML":if(null!=f)throw Error(pe(137,t));break;default:bf(e,t,c,f,r,h)}return;default:if(Dn(t)){for(var v in n)f=n[v],n.hasOwnProperty(v)&&void 0!==f&&!r.hasOwnProperty(v)&&wf(e,t,v,void 0,r,f);for(u in r)f=r[u],h=n[u],!r.hasOwnProperty(u)||f===h||void 0===f&&void 0===h||wf(e,t,u,f,r,h);return}}for(var g in n)f=n[g],n.hasOwnProperty(g)&&null!=f&&!r.hasOwnProperty(g)&&bf(e,t,g,null,r,f);for(d in r)f=r[d],h=n[d],!r.hasOwnProperty(d)||f===h||null==f&&null==h||bf(e,t,d,f,r,h)}(r,e.type,n,t),r[Yt]=t}catch(t){Od(e,e.return,t)}}function Pc(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&Af(e.type)||4===e.tag}function Rc(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Pc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&Af(e.type))continue e;if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Mc(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?(9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).insertBefore(e,t):((t=9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Fn));else if(4!==r&&(27===r&&Af(e.type)&&(n=e.stateNode,t=null),null!==(e=e.child)))for(Mc(e,t,n),e=e.sibling;null!==e;)Mc(e,t,n),e=e.sibling}function Ac(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&(27===r&&Af(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(Ac(e,t,n),e=e.sibling;null!==e;)Ac(e,t,n),e=e.sibling}function Lc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);xf(t,r,n),t[Jt]=e,t[Yt]=n}catch(t){Od(e,e.return,t)}}var Dc=!1,Bc=!1,zc=!1,Uc="function"==typeof WeakSet?WeakSet:Set,Fc=null;function qc(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:nu(e,n),4&r&&Cc(5,n);break;case 1:if(nu(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(e){Od(n,n.return,e)}else{var i=Ol(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Od(n,n.return,e)}}64&r&&Ec(n),512&r&&Ic(n,n.return);break;case 3:if(nu(e,n),64&r&&null!==(e=n.updateQueue)){if(t=null,null!==n.child)switch(n.child.tag){case 27:case 5:case 1:t=n.child.stateNode}try{Aa(e,t)}catch(e){Od(n,n.return,e)}}break;case 27:null===t&&4&r&&Lc(n);case 26:case 5:nu(e,n),null===t&&4&r&&jc(n),512&r&&Ic(n,n.return);break;case 12:nu(e,n);break;case 31:nu(e,n),4&r&&Qc(e,n);break;case 13:nu(e,n),4&r&&Jc(e,n),64&r&&(null!==(e=n.memoizedState)&&(null!==(e=e.dehydrated)&&function(e,t){var n=e.ownerDocument;if("$~"===e.data)e._reactRetry=t;else if("$?"!==e.data||"loading"!==n.readyState)t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}(e,n=Ad.bind(null,n))));break;case 22:if(!(r=null!==n.memoizedState||Dc)){t=null!==t&&null!==t.memoizedState||Bc,i=Dc;var o=Bc;Dc=r,(Bc=t)&&!o?iu(e,n,!!(8772&n.subtreeFlags)):nu(e,n),Dc=i,Bc=o}break;case 30:break;default:nu(e,n)}}function Hc(e){var t=e.alternate;null!==t&&(e.alternate=null,Hc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&rn(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 Wc=null,Vc=!1;function $c(e,t,n){for(n=n.child;null!==n;)Kc(e,t,n),n=n.sibling}function Kc(e,t,n){if(Et&&"function"==typeof Et.onCommitFiberUnmount)try{Et.onCommitFiberUnmount(_t,n)}catch(e){}switch(n.tag){case 26:Bc||Tc(n,t),$c(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode).parentNode.removeChild(n);break;case 27:Bc||Tc(n,t);var r=Wc,i=Vc;Af(n.type)&&(Wc=n.stateNode,Vc=!1),$c(e,t,n),Kf(n.stateNode),Wc=r,Vc=i;break;case 5:Bc||Tc(n,t);case 6:if(r=Wc,i=Vc,Wc=null,$c(e,t,n),Vc=i,null!==(Wc=r))if(Vc)try{(9===Wc.nodeType?Wc.body:"HTML"===Wc.nodeName?Wc.ownerDocument.body:Wc).removeChild(n.stateNode)}catch(e){Od(n,t,e)}else try{Wc.removeChild(n.stateNode)}catch(e){Od(n,t,e)}break;case 18:null!==Wc&&(Vc?(Lf(9===(e=Wc).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,n.stateNode),Zh(e)):Lf(Wc,n.stateNode));break;case 4:r=Wc,i=Vc,Wc=n.stateNode.containerInfo,Vc=!0,$c(e,t,n),Wc=r,Vc=i;break;case 0:case 11:case 14:case 15:_c(2,n,t),Bc||_c(4,n,t),$c(e,t,n);break;case 1:Bc||(Tc(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount&&Nc(n,t,r)),$c(e,t,n);break;case 21:$c(e,t,n);break;case 22:Bc=(r=Bc)||null!==n.memoizedState,$c(e,t,n),Bc=r;break;default:$c(e,t,n)}}function Qc(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&null!==(e=e.memoizedState))){e=e.dehydrated;try{Zh(e)}catch(e){Od(t,t.return,e)}}}function Jc(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&(null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))))try{Zh(e)}catch(e){Od(t,t.return,e)}}function Yc(e,t){var n=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new Uc),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new Uc),t;default:throw Error(pe(435,e.tag))}}(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ld.bind(null,e,t);t.then(r,r)}})}function Gc(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r],o=e,a=t,s=a;e:for(;null!==s;){switch(s.tag){case 27:if(Af(s.type)){Wc=s.stateNode,Vc=!1;break e}break;case 5:Wc=s.stateNode,Vc=!1;break e;case 3:case 4:Wc=s.stateNode.containerInfo,Vc=!0;break e}s=s.return}if(null===Wc)throw Error(pe(160));Kc(o,a,i),Wc=null,Vc=!1,null!==(o=i.alternate)&&(o.return=null),i.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)Zc(t,e),t=t.sibling}var Xc=null;function Zc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Gc(t,e),eu(e),4&r&&(_c(3,e,e.return),Cc(3,e),_c(5,e,e.return));break;case 1:Gc(t,e),eu(e),512&r&&(Bc||null===n||Tc(n,n.return)),64&r&&Dc&&(null!==(e=e.updateQueue)&&(null!==(r=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?r:n.concat(r))));break;case 26:var i=Xc;if(Gc(t,e),eu(e),512&r&&(Bc||null===n||Tc(n,n.return)),4&r){var o=null!==n?n.memoizedState:null;if(r=e.memoizedState,null===n)if(null===r)if(null===e.stateNode){e:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":(!(o=i.getElementsByTagName("title")[0])||o[nn]||o[Jt]||"http://www.w3.org/2000/svg"===o.namespaceURI||o.hasAttribute("itemprop"))&&(o=i.createElement(r),i.head.insertBefore(o,i.querySelector("head > title"))),xf(o,r,n),o[Jt]=e,cn(o),r=o;break e;case"link":var a=dh("link","href",i).get(r+(n.href||""));if(a)for(var s=0;s<a.length;s++)if((o=a[s]).getAttribute("href")===(null==n.href||""===n.href?null:n.href)&&o.getAttribute("rel")===(null==n.rel?null:n.rel)&&o.getAttribute("title")===(null==n.title?null:n.title)&&o.getAttribute("crossorigin")===(null==n.crossOrigin?null:n.crossOrigin)){a.splice(s,1);break t}xf(o=i.createElement(r),r,n),i.head.appendChild(o);break;case"meta":if(a=dh("meta","content",i).get(r+(n.content||"")))for(s=0;s<a.length;s++)if((o=a[s]).getAttribute("content")===(null==n.content?null:""+n.content)&&o.getAttribute("name")===(null==n.name?null:n.name)&&o.getAttribute("property")===(null==n.property?null:n.property)&&o.getAttribute("http-equiv")===(null==n.httpEquiv?null:n.httpEquiv)&&o.getAttribute("charset")===(null==n.charSet?null:n.charSet)){a.splice(s,1);break t}xf(o=i.createElement(r),r,n),i.head.appendChild(o);break;default:throw Error(pe(468,r))}o[Jt]=e,cn(o),r=o}e.stateNode=r}else fh(i,e.type,e.stateNode);else e.stateNode=ah(i,r,e.memoizedProps);else o!==r?(null===o?null!==n.stateNode&&(n=n.stateNode).parentNode.removeChild(n):o.count--,null===r?fh(i,e.type,e.stateNode):ah(i,r,e.memoizedProps)):null===r&&null!==e.stateNode&&Oc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Gc(t,e),eu(e),512&r&&(Bc||null===n||Tc(n,n.return)),null!==n&&4&r&&Oc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Gc(t,e),eu(e),512&r&&(Bc||null===n||Tc(n,n.return)),32&e.flags){i=e.stateNode;try{Rn(i,"")}catch(t){Od(e,e.return,t)}}4&r&&null!=e.stateNode&&Oc(e,i=e.memoizedProps,null!==n?n.memoizedProps:i),1024&r&&(zc=!0);break;case 6:if(Gc(t,e),eu(e),4&r){if(null===e.stateNode)throw Error(pe(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Od(e,e.return,t)}}break;case 3:if(uh=null,i=Xc,Xc=Yf(t.containerInfo),Gc(t,e),Xc=i,eu(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Zh(t.containerInfo)}catch(t){Od(e,e.return,t)}zc&&(zc=!1,tu(e));break;case 4:r=Xc,Xc=Yf(e.stateNode.containerInfo),Gc(t,e),eu(e),Xc=r;break;case 12:default:Gc(t,e),eu(e);break;case 31:case 19:Gc(t,e),eu(e),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Yc(e,r)));break;case 13:Gc(t,e),eu(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(Uu=vt()),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Yc(e,r)));break;case 22:i=null!==e.memoizedState;var l=null!==n&&null!==n.memoizedState,c=Dc,u=Bc;if(Dc=c||i,Bc=u||l,Gc(t,e),Bc=u,Dc=c,eu(e),8192&r)e:for(t=e.stateNode,t._visibility=i?-2&t._visibility:1|t._visibility,i&&(null===n||l||Dc||Bc||ru(e)),n=null,t=e;;){if(5===t.tag||26===t.tag){if(null===n){l=n=t;try{if(o=l.stateNode,i)"function"==typeof(a=o.style).setProperty?a.setProperty("display","none","important"):a.display="none";else{s=l.stateNode;var d=l.memoizedProps.style,f=null!=d&&d.hasOwnProperty("display")?d.display:null;s.style.display=null==f||"boolean"==typeof f?"":(""+f).trim()}}catch(e){Od(l,l.return,e)}}}else if(6===t.tag){if(null===n){l=t;try{l.stateNode.nodeValue=i?"":l.memoizedProps}catch(e){Od(l,l.return,e)}}}else if(18===t.tag){if(null===n){l=t;try{var h=l.stateNode;i?Df(h,!0):Df(l.stateNode,!1)}catch(e){Od(l,l.return,e)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}4&r&&(null!==(r=e.updateQueue)&&(null!==(n=r.retryQueue)&&(r.retryQueue=null,Yc(e,n))));case 30:case 21:}}function eu(e){var t=e.flags;if(2&t){try{for(var n,r=e.return;null!==r;){if(Pc(r)){n=r;break}r=r.return}if(null==n)throw Error(pe(160));switch(n.tag){case 27:var i=n.stateNode;Ac(e,Rc(e),i);break;case 5:var o=n.stateNode;32&n.flags&&(Rn(o,""),n.flags&=-33),Ac(e,Rc(e),o);break;case 3:case 4:var a=n.stateNode.containerInfo;Mc(e,Rc(e),a);break;default:throw Error(pe(161))}}catch(t){Od(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function tu(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;tu(t),5===t.tag&&1024&t.flags&&t.stateNode.reset(),e=e.sibling}}function nu(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)qc(e,t.alternate,t),t=t.sibling}function ru(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:_c(4,t,t.return),ru(t);break;case 1:Tc(t,t.return);var n=t.stateNode;"function"==typeof n.componentWillUnmount&&Nc(t,t.return,n),ru(t);break;case 27:Kf(t.stateNode);case 26:case 5:Tc(t,t.return),ru(t);break;case 22:null===t.memoizedState&&ru(t);break;default:ru(t)}e=e.sibling}}function iu(e,t,n){for(n=n&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var r=t.alternate,i=e,o=t,a=o.flags;switch(o.tag){case 0:case 11:case 15:iu(i,o,n),Cc(4,o);break;case 1:if(iu(i,o,n),"function"==typeof(i=(r=o).stateNode).componentDidMount)try{i.componentDidMount()}catch(e){Od(r,r.return,e)}if(null!==(i=(r=o).updateQueue)){var s=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(null!==l)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)Ma(l[i],s)}catch(e){Od(r,r.return,e)}}n&&64&a&&Ec(o),Ic(o,o.return);break;case 27:Lc(o);case 26:case 5:iu(i,o,n),n&&null===r&&4&a&&jc(o),Ic(o,o.return);break;case 12:iu(i,o,n);break;case 31:iu(i,o,n),n&&4&a&&Qc(i,o);break;case 13:iu(i,o,n),n&&4&a&&Jc(i,o);break;case 22:null===o.memoizedState&&iu(i,o,n),Ic(o,o.return);break;case 30:break;default:iu(i,o,n)}t=t.sibling}}function ou(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&Jo(n))}function au(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Jo(e))}function su(e,t,n,r){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)lu(e,t,n,r),t=t.sibling}function lu(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:su(e,t,n,r),2048&i&&Cc(9,t);break;case 1:case 31:case 13:default:su(e,t,n,r);break;case 3:su(e,t,n,r),2048&i&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Jo(e)));break;case 12:if(2048&i){su(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,a=o.id,s=o.onPostCommit;"function"==typeof s&&s(a,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(e){Od(t,t.return,e)}}else su(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,a=t.alternate,null!==t.memoizedState?2&o._visibility?su(e,t,n,r):uu(e,t):2&o._visibility?su(e,t,n,r):(o._visibility|=2,cu(e,t,n,r,!!(10256&t.subtreeFlags)||!1)),2048&i&&ou(a,t);break;case 24:su(e,t,n,r),2048&i&&au(t.alternate,t)}}function cu(e,t,n,r,i){for(i=i&&(!!(10256&t.subtreeFlags)||!1),t=t.child;null!==t;){var o=e,a=t,s=n,l=r,c=a.flags;switch(a.tag){case 0:case 11:case 15:cu(o,a,s,l,i),Cc(8,a);break;case 23:break;case 22:var u=a.stateNode;null!==a.memoizedState?2&u._visibility?cu(o,a,s,l,i):uu(o,a):(u._visibility|=2,cu(o,a,s,l,i)),i&&2048&c&&ou(a.alternate,a);break;case 24:cu(o,a,s,l,i),i&&2048&c&&au(a.alternate,a);break;default:cu(o,a,s,l,i)}t=t.sibling}}function uu(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:uu(n,r),2048&i&&ou(r.alternate,r);break;case 24:uu(n,r),2048&i&&au(r.alternate,r);break;default:uu(n,r)}t=t.sibling}}var du=8192;function fu(e,t,n){if(e.subtreeFlags&du)for(e=e.child;null!==e;)hu(e,t,n),e=e.sibling}function hu(e,t,n){switch(e.tag){case 26:fu(e,t,n),e.flags&du&&null!==e.memoizedState&&function(e,t,n,r){if(!("stylesheet"!==n.type||"string"==typeof r.media&&!1===matchMedia(r.media).matches||4&n.state.loading)){if(null===n.instance){var i=th(r.href),o=t.querySelector(nh(i));if(o)return null!==(t=o._p)&&"object"==typeof t&&"function"==typeof t.then&&(e.count++,e=mh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,void cn(o);o=t.ownerDocument||t,r=rh(r),(i=Qf.get(i))&&lh(r,i),cn(o=o.createElement("link"));var a=o;a._p=new Promise(function(e,t){a.onload=e,a.onerror=t}),xf(o,"link",r),n.instance=o}null===e.stylesheets&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(3&n.state.loading)&&(e.count++,n=mh.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}(n,Xc,e.memoizedState,e.memoizedProps);break;case 5:default:fu(e,t,n);break;case 3:case 4:var r=Xc;Xc=Yf(e.stateNode.containerInfo),fu(e,t,n),Xc=r;break;case 22:null===e.memoizedState&&(null!==(r=e.alternate)&&null!==r.memoizedState?(r=du,du=16777216,fu(e,t,n),du=r):fu(e,t,n))}}function pu(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do{t=e.sibling,e.sibling=null,e=t}while(null!==e)}}function mu(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Fc=r,yu(r,e)}pu(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)vu(e),e=e.sibling}function vu(e){switch(e.tag){case 0:case 11:case 15:mu(e),2048&e.flags&&_c(9,e,e.return);break;case 3:case 12:default:mu(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,gu(e)):mu(e)}}function gu(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Fc=r,yu(r,e)}pu(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:_c(8,t,t.return),gu(t);break;case 22:2&(n=t.stateNode)._visibility&&(n._visibility&=-3,gu(t));break;default:gu(t)}e=e.sibling}}function yu(e,t){for(;null!==Fc;){var n=Fc;switch(n.tag){case 0:case 11:case 15:_c(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var r=n.memoizedState.cachePool.pool;null!=r&&r.refCount++}break;case 24:Jo(n.memoizedState.cache)}if(null!==(r=n.child))r.return=n,Fc=r;else e:for(n=e;null!==Fc;){var i=(r=Fc).sibling,o=r.return;if(Hc(r),r===n){Fc=null;break e}if(null!==i){i.return=o,Fc=i;break e}Fc=o}}}var bu={getCacheForType:function(e){var t=Fo(Ko),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Fo(Ko).controller.signal}},wu="function"==typeof WeakMap?WeakMap:Map,xu=0,ku=null,Su=null,Cu=0,_u=0,Eu=null,Nu=!1,Iu=!1,Tu=!1,ju=0,Ou=0,Pu=0,Ru=0,Mu=0,Au=0,Lu=0,Du=null,Bu=null,zu=!1,Uu=0,Fu=0,qu=1/0,Hu=null,Wu=null,Vu=0,$u=null,Ku=null,Qu=0,Ju=0,Yu=null,Gu=null,Xu=0,Zu=null;function ed(){return 2&xu&&0!==Cu?Cu&-Cu:null!==qe.T?Yd():$t()}function td(){if(0===Au)if(536870912&Cu&&!wo)Au=536870912;else{var e=Pt;!(3932160&(Pt<<=1))&&(Pt=262144),Au=e}return null!==(e=Fa.current)&&(e.flags|=32),Au}function nd(e,t,n){(e!==ku||2!==_u&&9!==_u)&&null===e.cancelPendingCommit||(cd(e,0),ad(e,Cu,Au,!1)),Ut(e,n),2&xu&&e===ku||(e===ku&&(!(2&xu)&&(Ru|=n),4===Ou&&ad(e,Cu,Au,!1)),Hd(e))}function rd(e,t,n){if(6&xu)throw Error(pe(327));for(var r=!n&&!(127&t)&&0===(t&e.expiredLanes)||Lt(e,t),i=r?function(e,t){var n=xu;xu|=2;var r=fd(),i=hd();ku!==e||Cu!==t?(Hu=null,qu=vt()+500,cd(e,t)):Iu=Lt(e,t);e:for(;;)try{if(0!==_u&&null!==Su){t=Su;var o=Eu;t:switch(_u){case 1:_u=0,Eu=null,wd(e,t,o,1);break;case 2:case 9:if(ua(o)){_u=0,Eu=null,bd(t);break}t=function(){2!==_u&&9!==_u||ku!==e||(_u=7),Hd(e)},o.then(t,t);break e;case 3:_u=7;break e;case 4:_u=5;break e;case 7:ua(o)?(_u=0,Eu=null,bd(t)):(_u=0,Eu=null,wd(e,t,o,7));break;case 5:var a=null;switch(Su.tag){case 26:a=Su.memoizedState;case 5:case 27:var s=Su;if(a?hh(a):s.stateNode.complete){_u=0,Eu=null;var l=s.sibling;if(null!==l)Su=l;else{var c=s.return;null!==c?(Su=c,xd(c)):Su=null}break t}}_u=0,Eu=null,wd(e,t,o,5);break;case 6:_u=0,Eu=null,wd(e,t,o,6);break;case 8:ld(),Ou=6;break e;default:throw Error(pe(462))}}gd();break}catch(t){ud(e,t)}return Ro=Po=null,qe.H=r,qe.A=i,xu=n,null!==Su?0:(ku=null,Cu=0,Bi(),Ou)}(e,t):md(e,t,!0),o=r;;){if(0===i){Iu&&!r&&ad(e,t,0,!1);break}if(n=e.current.alternate,!o||od(n)){if(2===i){if(o=t,e.errorRecoveryDisabledLanes&o)var a=0;else a=0!==(a=-536870913&e.pendingLanes)?a:536870912&a?536870912:0;if(0!==a){t=a;e:{var s=e;i=Du;var l=s.current.memoizedState.isDehydrated;if(l&&(cd(s,a).flags|=256),2!==(a=md(s,a,!1))){if(Tu&&!l){s.errorRecoveryDisabledLanes|=o,Ru|=o,i=4;break e}o=Bu,Bu=i,null!==o&&(null===Bu?Bu=o:Bu.push.apply(Bu,o))}i=a}if(o=!1,2!==i)continue}}if(1===i){cd(e,0),ad(e,t,0,!0);break}e:{switch(r=e,o=i){case 0:case 1:throw Error(pe(345));case 4:if((4194048&t)!==t)break;case 6:ad(r,t,Au,!Nu);break e;case 2:Bu=null;break;case 3:case 5:break;default:throw Error(pe(329))}if((62914560&t)===t&&10<(i=Uu+300-vt())){if(ad(r,t,Au,!Nu),0!==At(r,0,!0))break e;Qu=t,r.timeoutHandle=jf(id.bind(null,r,n,Bu,Hu,zu,t,Au,Ru,Lu,Nu,o,"Throttled",-0,0),i)}else id(r,n,Bu,Hu,zu,t,Au,Ru,Lu,Nu,o,null,-0,0)}break}i=md(e,t,!1),o=!1}Hd(e)}function id(e,t,n,r,i,o,a,s,l,c,u,d,f,h){if(e.timeoutHandle=-1,8192&(d=t.subtreeFlags)||!(16785408&~d)){hu(t,o,d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fn});var p=(62914560&o)===o?Uu-vt():(4194048&o)===o?Fu-vt():0;if(null!==(p=function(e,t){return e.stylesheets&&0===e.count&&gh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&gh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&0===ph&&(ph=62500*function(){if("function"==typeof performance.getEntriesByType){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var i=n[r],o=i.transferSize,a=i.initiatorType,s=i.duration;if(o&&s&&kf(a)){for(a=0,s=i.responseEnd,r+=1;r<n.length;r++){var l=n[r],c=l.startTime;if(c>s)break;var u=l.transferSize,d=l.initiatorType;u&&kf(d)&&(a+=u*((l=l.responseEnd)<s?1:(s-c)/(l-c)))}if(--r,t+=8*(o+a)/(i.duration/1e3),10<++e)break}}if(0<e)return t/e/1e6}return navigator.connection&&"number"==typeof(e=navigator.connection.downlink)?e:5}());var i=setTimeout(function(){if(e.waitingForImages=!1,0===e.count&&(e.stylesheets&&gh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ph?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}(d,p)))return Qu=o,e.cancelPendingCommit=p(Sd.bind(null,e,t,o,n,r,i,a,s,l,u,d,null,f,h)),void ad(e,o,a,!c)}Sd(e,t,o,n,r,i,a,s,l)}function od(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&(null!==(n=t.updateQueue)&&null!==(n=n.stores)))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!ai(o(),i))return!1}catch(e){return!1}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ad(e,t,n,r){t&=~Mu,t&=~Ru,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var o=31-It(i),a=1<<o;r[o]=-1,i&=~a}0!==n&&Ft(e,n,t)}function sd(){return!!(6&xu)||(Wd(0),!1)}function ld(){if(null!==Su){if(0===_u)var e=Su.return;else Ro=Po=null,ms(e=Su),va=null,ga=0,e=Su;for(;null!==e;)Sc(e.alternate,e),e=e.return;Su=null}}function cd(e,t){var n=e.timeoutHandle;-1!==n&&(e.timeoutHandle=-1,Of(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),Qu=0,ld(),ku=e,Su=n=Qi(e.current,null),Cu=t,_u=0,Eu=null,Nu=!1,Iu=Lt(e,t),Tu=!1,Lu=Au=Mu=Ru=Pu=Ou=0,Bu=Du=null,zu=!1,8&t&&(t|=32&t);var r=e.entangledLanes;if(0!==r)for(e=e.entanglements,r&=t;0<r;){var i=31-It(r),o=1<<i;t|=e[i],r&=~o}return ju=t,Bi(),n}function ud(e,t){Ga=null,qe.H=Sl,t===aa||t===la?(t=pa(),_u=3):t===sa?(t=pa(),_u=4):_u=t===Ul?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,Eu=t,null===Su&&(Ou=1,Al(e,no(t,e.current)))}function dd(){var e=Fa.current;return null===e||((4194048&Cu)===Cu?null===qa:!!((62914560&Cu)===Cu||536870912&Cu)&&e===qa)}function fd(){var e=qe.H;return qe.H=Sl,null===e?Sl:e}function hd(){var e=qe.A;return qe.A=bu,e}function pd(){Ou=4,Nu||(4194048&Cu)!==Cu&&null!==Fa.current||(Iu=!0),!(134217727&Pu)&&!(134217727&Ru)||null===ku||ad(ku,Cu,Au,!1)}function md(e,t,n){var r=xu;xu|=2;var i=fd(),o=hd();ku===e&&Cu===t||(Hu=null,cd(e,t)),t=!1;var a=Ou;e:for(;;)try{if(0!==_u&&null!==Su){var s=Su,l=Eu;switch(_u){case 8:ld(),a=6;break e;case 3:case 2:case 9:case 6:null===Fa.current&&(t=!0);var c=_u;if(_u=0,Eu=null,wd(e,s,l,c),n&&Iu){a=0;break e}break;default:c=_u,_u=0,Eu=null,wd(e,s,l,c)}}vd(),a=Ou;break}catch(t){ud(e,t)}return t&&e.shellSuspendCounter++,Ro=Po=null,xu=r,qe.H=i,qe.A=o,null===Su&&(ku=null,Cu=0,Bi()),a}function vd(){for(;null!==Su;)yd(Su)}function gd(){for(;null!==Su&&!pt();)yd(Su)}function yd(e){var t=pc(e.alternate,e,ju);e.memoizedProps=e.pendingProps,null===t?xd(e):Su=t}function bd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Zl(n,t,t.pendingProps,t.type,void 0,Cu);break;case 11:t=Zl(n,t,t.pendingProps,t.type.render,t.ref,Cu);break;case 5:ms(t);default:Sc(n,t),t=pc(n,t=Su=Ji(t,ju),ju)}e.memoizedProps=e.pendingProps,null===t?xd(e):Su=t}function wd(e,t,n,r){Ro=Po=null,ms(t),va=null,ga=0;var i=t.return;try{if(function(e,t,n,r,i){if(n.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=n.alternate)&&Bo(t,n,i,!0),null!==(n=Fa.current)){switch(n.tag){case 31:case 13:return null===qa?pd():null===n.alternate&&0===Ou&&(Ou=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===ca?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=new Set([r]):t.add(r),Pd(e,r,i)),!1;case 22:return n.flags|=65536,r===ca?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=new Set([r]):n.add(r),Pd(e,r,i)),!1}throw Error(pe(435,n.tag))}return Pd(e,r,i),pd(),!1}if(wo)return null!==(t=Fa.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==So&&jo(no(e=Error(pe(422),{cause:r}),n))):(r!==So&&jo(no(t=Error(pe(423),{cause:r}),n)),(e=e.current.alternate).flags|=65536,i&=-i,e.lanes|=i,r=no(r,n),ja(e,i=Dl(e.stateNode,r,i)),4!==Ou&&(Ou=2)),!1;var o=Error(pe(520),{cause:r});if(o=no(o,n),null===Du?Du=[o]:Du.push(o),4!==Ou&&(Ou=2),null===t)return!0;r=no(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,ja(n,e=Dl(n.stateNode,r,e)),!1;case 1:if(t=n.type,o=n.stateNode,!(128&n.flags||"function"!=typeof t.getDerivedStateFromError&&(null===o||"function"!=typeof o.componentDidCatch||null!==Wu&&Wu.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,zl(i=Bl(i),e,n,r),ja(n,i),!1}n=n.return}while(null!==n);return!1}(e,i,t,n,Cu))return Ou=1,Al(e,no(n,e.current)),void(Su=null)}catch(t){if(null!==i)throw Su=i,t;return Ou=1,Al(e,no(n,e.current)),void(Su=null)}32768&t.flags?(wo||1===r?e=!0:Iu||536870912&Cu?e=!1:(Nu=e=!0,(2===r||9===r||3===r||6===r)&&(null!==(r=Fa.current)&&13===r.tag&&(r.flags|=16384))),kd(t,e)):xd(t)}function xd(e){var t=e;do{if(32768&t.flags)return void kd(t,Nu);e=t.return;var n=xc(t.alternate,t,ju);if(null!==n)return void(Su=n);if(null!==(t=t.sibling))return void(Su=t);Su=t=e}while(null!==t);0===Ou&&(Ou=5)}function kd(e,t){do{var n=kc(e.alternate,e);if(null!==n)return n.flags&=32767,void(Su=n);if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling))return void(Su=e);Su=e=n}while(null!==e);Ou=6,Su=null}function Sd(e,t,n,r,i,o,a,s,l){e.cancelPendingCommit=null;do{Id()}while(0!==Vu);if(6&xu)throw Error(pe(327));if(null!==t){if(t===e.current)throw Error(pe(177));if(o=t.lanes|t.childLanes,function(e,t,n,r,i,o){var a=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,l=e.expirationTimes,c=e.hiddenUpdates;for(n=a&~n;0<n;){var u=31-It(n),d=1<<u;s[u]=0,l[u]=-1;var f=c[u];if(null!==f)for(c[u]=null,u=0;u<f.length;u++){var h=f[u];null!==h&&(h.lane&=-536870913)}n&=~d}0!==r&&Ft(e,r,0),0!==o&&0===i&&0!==e.tag&&(e.suspendedLanes|=o&~(a&~t))}(e,n,o|=Di,a,s,l),e===ku&&(Su=ku=null,Cu=0),Ku=t,$u=e,Qu=n,Ju=o,Yu=i,Gu=r,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,ft(wt,function(){return Td(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(13878&t.flags),13878&t.subtreeFlags||r){r=qe.T,qe.T=null,i=He.p,He.p=2,a=xu,xu|=4;try{!function(e,t){if(e=e.containerInfo,Sf=Ih,fi(e=di(e))){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(e){n=null;break e}var a=0,s=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var h;d!==n||0!==i&&3!==d.nodeType||(s=a+i),d!==o||0!==r&&3!==d.nodeType||(l=a+r),3===d.nodeType&&(a+=d.nodeValue.length),null!==(h=d.firstChild);)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++c===i&&(s=a),f===o&&++u===r&&(l=a),null!==(h=d.nextSibling))break;f=(d=f).parentNode}d=h}n=-1===s||-1===l?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Cf={focusedElem:e,selectionRange:n},Ih=!1,Fc=t;null!==Fc;)if(e=(t=Fc).child,1028&t.subtreeFlags&&null!==e)e.return=t,Fc=e;else for(;null!==Fc;){switch(o=(t=Fc).alternate,e=t.flags,t.tag){case 0:if(4&e&&null!==(e=null!==(e=t.updateQueue)?e.events:null))for(n=0;n<e.length;n++)(i=e[n]).ref.impl=i.nextImpl;break;case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(1024&e&&null!==o){e=void 0,n=t,i=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var p=Ol(n.type,i);e=r.getSnapshotBeforeUpdate(p,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Od(n,n.return,e)}}break;case 3:if(1024&e)if(9===(n=(e=t.stateNode.containerInfo).nodeType))Bf(e);else if(1===n)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Bf(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(pe(163))}if(null!==(e=t.sibling)){e.return=t.return,Fc=e;break}Fc=t.return}}(e,t)}finally{xu=a,He.p=i,qe.T=r}}Vu=1,Cd(),_d(),Ed()}}function Cd(){if(1===Vu){Vu=0;var e=$u,t=Ku,n=!!(13878&t.flags);if(13878&t.subtreeFlags||n){n=qe.T,qe.T=null;var r=He.p;He.p=2;var i=xu;xu|=4;try{Zc(t,e);var o=Cf,a=di(e.containerInfo),s=o.focusedElem,l=o.selectionRange;if(a!==s&&s&&s.ownerDocument&&ui(s.ownerDocument.documentElement,s)){if(null!==l&&fi(s)){var c=l.start,u=l.end;if(void 0===u&&(u=c),"selectionStart"in s)s.selectionStart=c,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var h=f.getSelection(),p=s.textContent.length,m=Math.min(l.start,p),v=void 0===l.end?m:Math.min(l.end,p);!h.extend&&m>v&&(a=v,v=m,m=a);var g=ci(s,m),y=ci(s,v);if(g&&y&&(1!==h.rangeCount||h.anchorNode!==g.node||h.anchorOffset!==g.offset||h.focusNode!==y.node||h.focusOffset!==y.offset)){var b=d.createRange();b.setStart(g.node,g.offset),h.removeAllRanges(),m>v?(h.addRange(b),h.extend(y.node,y.offset)):(b.setEnd(y.node,y.offset),h.addRange(b))}}}}for(d=[],h=s;h=h.parentNode;)1===h.nodeType&&d.push({element:h,left:h.scrollLeft,top:h.scrollTop});for("function"==typeof s.focus&&s.focus(),s=0;s<d.length;s++){var w=d[s];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}Ih=!!Sf,Cf=Sf=null}finally{xu=i,He.p=r,qe.T=n}}e.current=t,Vu=2}}function _d(){if(2===Vu){Vu=0;var e=$u,t=Ku,n=!!(8772&t.flags);if(8772&t.subtreeFlags||n){n=qe.T,qe.T=null;var r=He.p;He.p=2;var i=xu;xu|=4;try{qc(e,t.alternate,t)}finally{xu=i,He.p=r,qe.T=n}}Vu=3}}function Ed(){if(4===Vu||3===Vu){Vu=0,mt();var e=$u,t=Ku,n=Qu,r=Gu;10256&t.subtreeFlags||10256&t.flags?Vu=5:(Vu=0,Ku=$u=null,Nd(e,e.pendingLanes));var i=e.pendingLanes;if(0===i&&(Wu=null),Vt(n),t=t.stateNode,Et&&"function"==typeof Et.onCommitFiberRoot)try{Et.onCommitFiberRoot(_t,t,void 0,!(128&~t.current.flags))}catch(e){}if(null!==r){t=qe.T,i=He.p,He.p=2,qe.T=null;try{for(var o=e.onRecoverableError,a=0;a<r.length;a++){var s=r[a];o(s.value,{componentStack:s.stack})}}finally{qe.T=t,He.p=i}}3&Qu&&Id(),Hd(e),i=e.pendingLanes,261930&n&&42&i?e===Zu?Xu++:(Xu=0,Zu=e):Xu=0,Wd(0)}}function Nd(e,t){0===(e.pooledCacheLanes&=t)&&(null!=(t=e.pooledCache)&&(e.pooledCache=null,Jo(t)))}function Id(){return Cd(),_d(),Ed(),Td()}function Td(){if(5!==Vu)return!1;var e=$u,t=Ju;Ju=0;var n=Vt(Qu),r=qe.T,i=He.p;try{He.p=32>n?32:n,qe.T=null,n=Yu,Yu=null;var o=$u,a=Qu;if(Vu=0,Ku=$u=null,Qu=0,6&xu)throw Error(pe(331));var s=xu;if(xu|=4,vu(o.current),lu(o,o.current,a,n),xu=s,Wd(0,!1),Et&&"function"==typeof Et.onPostCommitFiberRoot)try{Et.onPostCommitFiberRoot(_t,o)}catch(e){}return!0}finally{He.p=i,qe.T=r,Nd(e,t)}}function jd(e,t,n){t=no(n,t),null!==(e=Ia(e,t=Dl(e.stateNode,t,2),2))&&(Ut(e,2),Hd(e))}function Od(e,t,n){if(3===e.tag)jd(e,e,n);else for(;null!==t;){if(3===t.tag){jd(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Wu||!Wu.has(r))){e=no(n,e),null!==(r=Ia(t,n=Bl(2),2))&&(zl(n,r,t,e),Ut(r,2),Hd(r));break}}t=t.return}}function Pd(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new wu;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(Tu=!0,i.add(n),e=Rd.bind(null,e,t,n),t.then(e,e))}function Rd(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ku===e&&(Cu&n)===n&&(4===Ou||3===Ou&&(62914560&Cu)===Cu&&300>vt()-Uu?!(2&xu)&&cd(e,0):Mu|=n,Lu===Cu&&(Lu=0)),Hd(e)}function Md(e,t){0===t&&(t=Bt()),null!==(e=Fi(e,t))&&(Ut(e,t),Hd(e))}function Ad(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Md(e,n)}function Ld(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(pe(314))}null!==r&&r.delete(t),Md(e,n)}var Dd=null,Bd=null,zd=!1,Ud=!1,Fd=!1,qd=0;function Hd(e){e!==Bd&&null===e.next&&(null===Bd?Dd=Bd=e:Bd=Bd.next=e),Ud=!0,zd||(zd=!0,Rf(function(){6&xu?ft(yt,Vd):$d()}))}function Wd(e,t){if(!Fd&&Ud){Fd=!0;do{for(var n=!1,r=Dd;null!==r;){if(0!==e){var i=r.pendingLanes;if(0===i)var o=0;else{var a=r.suspendedLanes,s=r.pingedLanes;o=(1<<31-It(42|e)+1)-1,o=201326741&(o&=i&~(a&~s))?201326741&o|1:o?2|o:0}0!==o&&(n=!0,Jd(r,o))}else o=Cu,!(3&(o=At(r,r===ku?o:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||Lt(r,o)||(n=!0,Jd(r,o));r=r.next}}while(n);Fd=!1}}function Vd(){$d()}function $d(){Ud=zd=!1;var e=0;0!==qd&&function(){var e=window.event;if(e&&"popstate"===e.type)return e!==Tf&&(Tf=e,!0);return Tf=null,!1}()&&(e=qd);for(var t=vt(),n=null,r=Dd;null!==r;){var i=r.next,o=Kd(r,t);0===o?(r.next=null,null===n?Dd=i:n.next=i,null===i&&(Bd=n)):(n=r,(0!==e||3&o)&&(Ud=!0)),r=i}0!==Vu&&5!==Vu||Wd(e),0!==qd&&(qd=0)}function Kd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=-62914561&e.pendingLanes;0<o;){var a=31-It(o),s=1<<a,l=i[a];-1===l?0!==(s&n)&&0===(s&r)||(i[a]=Dt(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}if(n=Cu,n=At(e,e===(t=ku)?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),r=e.callbackNode,0===n||e===t&&(2===_u||9===_u)||null!==e.cancelPendingCommit)return null!==r&&null!==r&&ht(r),e.callbackNode=null,e.callbackPriority=0;if(!(3&n)||Lt(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==r&&ht(r),Vt(n)){case 2:case 8:n=bt;break;case 32:default:n=wt;break;case 268435456:n=kt}return r=Qd.bind(null,e),n=ft(n,r),e.callbackPriority=t,e.callbackNode=n,t}return null!==r&&null!==r&&ht(r),e.callbackPriority=2,e.callbackNode=null,2}function Qd(e,t){if(0!==Vu&&5!==Vu)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Id()&&e.callbackNode!==n)return null;var r=Cu;return 0===(r=At(e,e===ku?r:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(rd(e,r,t),Kd(e,vt()),null!=e.callbackNode&&e.callbackNode===n?Qd.bind(null,e):null)}function Jd(e,t){if(Id())return null;rd(e,t,!0)}function Yd(){if(0===qd){var e=Xo;0===e&&(e=Ot,!(261888&(Ot<<=1))&&(Ot=256)),qd=e}return qd}function Gd(e){return null==e||"symbol"==typeof e||"boolean"==typeof e?null:"function"==typeof e?e:Un(""+e)}function Xd(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}for(var Zd=0;Zd<Pi.length;Zd++){var ef=Pi[Zd];Ri(ef.toLowerCase(),"on"+(ef[0].toUpperCase()+ef.slice(1)))}Ri(Ci,"onAnimationEnd"),Ri(_i,"onAnimationIteration"),Ri(Ei,"onAnimationStart"),Ri("dblclick","onDoubleClick"),Ri("focusin","onFocus"),Ri("focusout","onBlur"),Ri(Ni,"onTransitionRun"),Ri(Ii,"onTransitionStart"),Ri(Ti,"onTransitionCancel"),Ri(ji,"onTransitionEnd"),hn("onMouseEnter",["mouseout","mouseover"]),hn("onMouseLeave",["mouseout","mouseover"]),hn("onPointerEnter",["pointerout","pointerover"]),hn("onPointerLeave",["pointerout","pointerover"]),fn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fn("onBeforeInput",["compositionend","keypress","textInput","paste"]),fn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tf="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(" "),nf=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tf));function rf(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var a=r.length-1;0<=a;a--){var s=r[a],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==o&&i.isPropagationStopped())break e;o=s,i.currentTarget=c;try{o(i)}catch(e){Mi(e)}i.currentTarget=null,o=l}else for(a=0;a<r.length;a++){if(l=(s=r[a]).instance,c=s.currentTarget,s=s.listener,l!==o&&i.isPropagationStopped())break e;o=s,i.currentTarget=c;try{o(i)}catch(e){Mi(e)}i.currentTarget=null,o=l}}}}function of(e,t){var n=t[Xt];void 0===n&&(n=t[Xt]=new Set);var r=e+"__bubble";n.has(r)||(cf(t,e,2,!1),n.add(r))}function af(e,t,n){var r=0;t&&(r|=4),cf(n,e,r,t)}var sf="_reactListening"+Math.random().toString(36).slice(2);function lf(e){if(!e[sf]){e[sf]=!0,un.forEach(function(t){"selectionchange"!==t&&(nf.has(t)||af(t,!1,e),af(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[sf]||(t[sf]=!0,af("selectionchange",!1,t))}}function cf(e,t,n,r){switch(Ah(t)){case 2:var i=Th;break;case 8:i=jh;break;default:i=Oh}n=i.bind(null,t,n,e),i=void 0,!Gn||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),r?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function uf(e,t,n,r,i){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var a=r.tag;if(3===a||4===a){var s=r.stateNode.containerInfo;if(s===i)break;if(4===a)for(a=r.return;null!==a;){var l=a.tag;if((3===l||4===l)&&a.stateNode.containerInfo===i)return;a=a.return}for(;null!==s;){if(null===(a=on(s)))return;if(5===(l=a.tag)||6===l||26===l||27===l){r=o=a;continue e}s=s.parentNode}}r=r.return}Qn(function(){var r=o,i=Hn(n),a=[];e:{var s=Oi.get(e);if(void 0!==s){var l=dr,c=e;switch(e){case"keypress":if(0===rr(n))break e;case"keydown":case"keyup":l=Er;break;case"focusin":c="focus",l=gr;break;case"focusout":c="blur",l=gr;break;case"beforeblur":case"afterblur":l=gr;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=mr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=vr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Ir;break;case Ci:case _i:case Ei:l=yr;break;case ji:l=Tr;break;case"scroll":case"scrollend":l=hr;break;case"wheel":l=jr;break;case"copy":case"cut":case"paste":l=br;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Nr;break;case"toggle":case"beforetoggle":l=Or}var u=!!(4&t),d=!u&&("scroll"===e||"scrollend"===e),f=u?null!==s?s+"Capture":null:s;u=[];for(var h,p=r;null!==p;){var m=p;if(h=m.stateNode,5!==(m=m.tag)&&26!==m&&27!==m||null===h||null===f||null!=(m=Jn(p,f))&&u.push(df(p,m,h)),d)break;p=p.return}0<u.length&&(s=new l(s,c,null,n,i),a.push({event:s,listeners:u}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===qn||!(c=n.relatedTarget||n.fromElement)||!on(c)&&!c[Gt])&&(l||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,l?(l=r,null!==(c=(c=n.relatedTarget||n.toElement)?on(c):null)&&(d=ve(c),u=c.tag,c!==d||5!==u&&27!==u&&6!==u)&&(c=null)):(l=null,c=r),l!==c)){if(u=mr,m="onMouseLeave",f="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=Nr,m="onPointerLeave",f="onPointerEnter",p="pointer"),d=null==l?s:sn(l),h=null==c?s:sn(c),(s=new u(m,p+"leave",l,n,i)).target=d,s.relatedTarget=h,m=null,on(i)===r&&((u=new u(f,p+"enter",c,n,i)).target=h,u.relatedTarget=d,m=u),d=m,l&&c)e:{for(u=hf,p=c,h=0,m=f=l;m;m=u(m))h++;m=0;for(var v=p;v;v=u(v))m++;for(;0<h-m;)f=u(f),h--;for(;0<m-h;)p=u(p),m--;for(;h--;){if(f===p||null!==p&&f===p.alternate){u=f;break e}f=u(f),p=u(p)}u=null}else u=null;null!==l&&pf(a,s,l,u,!1),null!==c&&null!==d&&pf(a,d,c,u,!0)}if("select"===(l=(s=r?sn(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===l&&"file"===s.type)var g=Jr;else if(Hr(s))if(Yr)g=oi;else{g=ri;var y=ni}else!(l=s.nodeName)||"input"!==l.toLowerCase()||"checkbox"!==s.type&&"radio"!==s.type?r&&Dn(r.elementType)&&(g=Jr):g=ii;switch(g&&(g=g(e,r))?Wr(a,g,n,i):(y&&y(e,s,r),"focusout"===e&&r&&"number"===s.type&&null!=r.memoizedProps.value&&Tn(s,"number",s.value)),y=r?sn(r):window,e){case"focusin":(Hr(y)||"true"===y.contentEditable)&&(pi=y,mi=r,vi=null);break;case"focusout":vi=mi=pi=null;break;case"mousedown":gi=!0;break;case"contextmenu":case"mouseup":case"dragend":gi=!1,yi(a,n,i);break;case"selectionchange":if(hi)break;case"keydown":case"keyup":yi(a,n,i)}var b;if(Rr)e:{switch(e){case"compositionstart":var w="onCompositionStart";break e;case"compositionend":w="onCompositionEnd";break e;case"compositionupdate":w="onCompositionUpdate";break e}w=void 0}else Fr?zr(e,n)&&(w="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(w="onCompositionStart");w&&(Lr&&"ko"!==n.locale&&(Fr||"onCompositionStart"!==w?"onCompositionEnd"===w&&Fr&&(b=nr()):(er="value"in(Zn=i)?Zn.value:Zn.textContent,Fr=!0)),0<(y=ff(r,w)).length&&(w=new wr(w,e,null,n,i),a.push({event:w,listeners:y}),b?w.data=b:null!==(b=Ur(n))&&(w.data=b))),(b=Ar?function(e,t){switch(e){case"compositionend":return Ur(t);case"keypress":return 32!==t.which?null:(Br=!0,Dr);case"textInput":return(e=t.data)===Dr&&Br?null:e;default:return null}}(e,n):function(e,t){if(Fr)return"compositionend"===e||!Rr&&zr(e,t)?(e=nr(),tr=er=Zn=null,Fr=!1,e):null;switch(e){case"paste":default: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 Lr&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(w=ff(r,"onBeforeInput")).length&&(y=new wr("onBeforeInput","beforeinput",null,n,i),a.push({event:y,listeners:w}),y.data=b)),function(e,t,n,r,i){if("submit"===t&&n&&n.stateNode===i){var o=Gd((i[Yt]||null).action),a=r.submitter;a&&null!==(t=(t=a[Yt]||null)?Gd(t.formAction):a.getAttribute("formAction"))&&(o=t,a=null);var s=new dr("action","action",null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(0!==qd){var e=a?Xd(i,a):new FormData(i);cl(n,{pending:!0,data:e,method:i.method,action:o},null,e)}}else"function"==typeof o&&(s.preventDefault(),e=a?Xd(i,a):new FormData(i),cl(n,{pending:!0,data:e,method:i.method,action:o},o,e))},currentTarget:i}]})}}(a,e,r,n,i)}rf(a,t)})}function df(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ff(e,t){for(var n=t+"Capture",r=[];null!==e;){var i=e,o=i.stateNode;if(5!==(i=i.tag)&&26!==i&&27!==i||null===o||(null!=(i=Jn(e,n))&&r.unshift(df(e,i,o)),null!=(i=Jn(e,t))&&r.push(df(e,i,o))),3===e.tag)return r;e=e.return}return[]}function hf(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function pf(e,t,n,r,i){for(var o=t._reactName,a=[];null!==n&&n!==r;){var s=n,l=s.alternate,c=s.stateNode;if(s=s.tag,null!==l&&l===r)break;5!==s&&26!==s&&27!==s||null===c||(l=c,i?null!=(c=Jn(n,o))&&a.unshift(df(n,c,l)):i||null!=(c=Jn(n,o))&&a.push(df(n,c,l))),n=n.return}0!==a.length&&e.push({event:t,listeners:a})}var mf=/\r\n?/g,vf=/\u0000|\uFFFD/g;function gf(e){return("string"==typeof e?e:""+e).replace(mf,"\n").replace(vf,"")}function yf(e,t){return t=gf(t),gf(e)===t}function bf(e,t,n,r,i,o){switch(n){case"children":"string"==typeof r?"body"===t||"textarea"===t&&""===r||Rn(e,r):("number"==typeof r||"bigint"==typeof r)&&"body"!==t&&Rn(e,""+r);break;case"className":yn(e,"class",r);break;case"tabIndex":yn(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":yn(e,n,r);break;case"style":Ln(e,r,o);break;case"data":if("object"!==t){yn(e,"data",r);break}case"src":case"href":if(""===r&&("a"!==t||"href"!==n)){e.removeAttribute(n);break}if(null==r||"function"==typeof r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Un(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if("function"==typeof r){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}if("function"==typeof o&&("formAction"===n?("input"!==t&&bf(e,t,"name",i.name,i,null),bf(e,t,"formEncType",i.formEncType,i,null),bf(e,t,"formMethod",i.formMethod,i,null),bf(e,t,"formTarget",i.formTarget,i,null)):(bf(e,t,"encType",i.encType,i,null),bf(e,t,"method",i.method,i,null),bf(e,t,"target",i.target,i,null))),null==r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Un(""+r),e.setAttribute(n,r);break;case"onClick":null!=r&&(e.onclick=Fn);break;case"onScroll":null!=r&&of("scroll",e);break;case"onScrollEnd":null!=r&&of("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(pe(61));if(null!=(n=r.__html)){if(null!=i.children)throw Error(pe(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"muted":e.muted=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==r||"function"==typeof r||"boolean"==typeof r||"symbol"==typeof r){e.removeAttribute("xlink:href");break}n=Un(""+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":null!=r&&"function"!=typeof r&&"symbol"!=typeof r?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&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":!0===r?e.setAttribute(n,""):!1!==r&&null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":null!=r&&"function"!=typeof r&&"symbol"!=typeof r&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":null==r||"function"==typeof r||"symbol"==typeof r||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":of("beforetoggle",e),of("toggle",e),gn(e,"popover",r);break;case"xlinkActuate":bn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":bn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":bn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":bn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":bn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":bn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":bn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":bn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":bn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":gn(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])&&gn(e,n=Bn.get(n)||n,r)}}function wf(e,t,n,r,i,o){switch(n){case"style":Ln(e,r,o);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(pe(61));if(null!=(n=r.__html)){if(null!=i.children)throw Error(pe(60));e.innerHTML=n}}break;case"children":"string"==typeof r?Rn(e,r):("number"==typeof r||"bigint"==typeof r)&&Rn(e,""+r);break;case"onScroll":null!=r&&of("scroll",e);break;case"onScrollEnd":null!=r&&of("scrollend",e);break;case"onClick":null!=r&&(e.onclick=Fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:dn.hasOwnProperty(n)||("o"!==n[0]||"n"!==n[1]||(i=n.endsWith("Capture"),t=n.slice(2,i?n.length-7:void 0),"function"==typeof(o=null!=(o=e[Yt]||null)?o[n]:null)&&e.removeEventListener(t,o,i),"function"!=typeof r)?n in e?e[n]=r:!0===r?e.setAttribute(n,""):gn(e,n,r):("function"!=typeof o&&null!==o&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i)))}}function xf(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":of("error",e),of("load",e);var r,i=!1,o=!1;for(r in n)if(n.hasOwnProperty(r)){var a=n[r];if(null!=a)switch(r){case"src":i=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(pe(137,t));default:bf(e,t,r,a,n,null)}}return o&&bf(e,t,"srcSet",n.srcSet,n,null),void(i&&bf(e,t,"src",n.src,n,null));case"input":of("invalid",e);var s=r=a=o=null,l=null,c=null;for(i in n)if(n.hasOwnProperty(i)){var u=n[i];if(null!=u)switch(i){case"name":o=u;break;case"type":a=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":r=u;break;case"defaultValue":s=u;break;case"children":case"dangerouslySetInnerHTML":if(null!=u)throw Error(pe(137,t));break;default:bf(e,t,i,u,n,null)}}return void In(e,r,s,l,c,a,o,!1);case"select":for(o in of("invalid",e),i=a=r=null,n)if(n.hasOwnProperty(o)&&null!=(s=n[o]))switch(o){case"value":r=s;break;case"defaultValue":a=s;break;case"multiple":i=s;default:bf(e,t,o,s,n,null)}return t=r,n=a,e.multiple=!!i,void(null!=t?jn(e,!!i,t,!1):null!=n&&jn(e,!!i,n,!0));case"textarea":for(a in of("invalid",e),r=o=i=null,n)if(n.hasOwnProperty(a)&&null!=(s=n[a]))switch(a){case"value":i=s;break;case"defaultValue":o=s;break;case"children":r=s;break;case"dangerouslySetInnerHTML":if(null!=s)throw Error(pe(91));break;default:bf(e,t,a,s,n,null)}return void Pn(e,i,o,r);case"option":for(l in n)if(n.hasOwnProperty(l)&&null!=(i=n[l]))if("selected"===l)e.selected=i&&"function"!=typeof i&&"symbol"!=typeof i;else bf(e,t,l,i,n,null);return;case"dialog":of("beforetoggle",e),of("toggle",e),of("cancel",e),of("close",e);break;case"iframe":case"object":of("load",e);break;case"video":case"audio":for(i=0;i<tf.length;i++)of(tf[i],e);break;case"image":of("error",e),of("load",e);break;case"details":of("toggle",e);break;case"embed":case"source":case"link":of("error",e),of("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(c in n)if(n.hasOwnProperty(c)&&null!=(i=n[c]))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(pe(137,t));default:bf(e,t,c,i,n,null)}return;default:if(Dn(t)){for(u in n)n.hasOwnProperty(u)&&(void 0!==(i=n[u])&&wf(e,t,u,i,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(null!=(i=n[s])&&bf(e,t,s,i,n,null))}function kf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}var Sf=null,Cf=null;function _f(e){return 9===e.nodeType?e:e.ownerDocument}function Ef(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 Nf(e,t){if(0===e)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return 1===e&&"foreignObject"===t?0:e}function If(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"bigint"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Tf=null;var jf="function"==typeof setTimeout?setTimeout:void 0,Of="function"==typeof clearTimeout?clearTimeout:void 0,Pf="function"==typeof Promise?Promise:void 0,Rf="function"==typeof queueMicrotask?queueMicrotask:void 0!==Pf?function(e){return Pf.resolve(null).then(e).catch(Mf)}:jf;function Mf(e){setTimeout(function(){throw e})}function Af(e){return"head"===e}function Lf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&8===i.nodeType)if("/$"===(n=i.data)||"/&"===n){if(0===r)return e.removeChild(i),void Zh(t);r--}else if("$"===n||"$?"===n||"$~"===n||"$!"===n||"&"===n)r++;else if("html"===n)Kf(e.ownerDocument.documentElement);else if("head"===n){Kf(n=e.ownerDocument.head);for(var o=n.firstChild;o;){var a=o.nextSibling,s=o.nodeName;o[nn]||"SCRIPT"===s||"STYLE"===s||"LINK"===s&&"stylesheet"===o.rel.toLowerCase()||n.removeChild(o),o=a}}else"body"===n&&Kf(e.ownerDocument.body);n=i}while(n);Zh(t)}function Df(e,t){var n=e;e=0;do{var r=n.nextSibling;if(1===n.nodeType?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",""===n.getAttribute("style")&&n.removeAttribute("style")):3===n.nodeType&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&8===r.nodeType)if("/$"===(n=r.data)){if(0===e)break;e--}else"$"!==n&&"$?"!==n&&"$~"!==n&&"$!"!==n||e++;n=r}while(n)}function Bf(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Bf(n),rn(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===n.rel.toLowerCase())continue}e.removeChild(n)}}function zf(e,t){for(;8!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!t)return null;if(null===(e=qf(e.nextSibling)))return null}return e}function Uf(e){return"$?"===e.data||"$~"===e.data}function Ff(e){return"$!"===e.data||"$?"===e.data&&"loading"!==e.ownerDocument.readyState}function qf(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"$~"===t||"&"===t||"F!"===t||"F"===t)break;if("/$"===t||"/&"===t)return null}}return e}var Hf=null;function Wf(e){e=e.nextSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n||"/&"===n){if(0===t)return qf(e.nextSibling);t--}else"$"!==n&&"$!"!==n&&"$?"!==n&&"$~"!==n&&"&"!==n||t++}e=e.nextSibling}return null}function Vf(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n||"$~"===n||"&"===n){if(0===t)return e;t--}else"/$"!==n&&"/&"!==n||t++}e=e.previousSibling}return null}function $f(e,t,n){switch(t=_f(n),e){case"html":if(!(e=t.documentElement))throw Error(pe(452));return e;case"head":if(!(e=t.head))throw Error(pe(453));return e;case"body":if(!(e=t.body))throw Error(pe(454));return e;default:throw Error(pe(451))}}function Kf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);rn(e)}var Qf=new Map,Jf=new Set;function Yf(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Gf=He.d;He.d={f:function(){var e=Gf.f(),t=sd();return e||t},r:function(e){var t=an(e);null!==t&&5===t.tag&&"form"===t.type?dl(t):Gf.r(e)},D:function(e){Gf.D(e),Zf("dns-prefetch",e,null)},C:function(e,t){Gf.C(e,t),Zf("preconnect",e,t)},L:function(e,t,n){Gf.L(e,t,n);var r=Xf;if(r&&e&&t){var i='link[rel="preload"][as="'+En(t)+'"]';"image"===t&&n&&n.imageSrcSet?(i+='[imagesrcset="'+En(n.imageSrcSet)+'"]',"string"==typeof n.imageSizes&&(i+='[imagesizes="'+En(n.imageSizes)+'"]')):i+='[href="'+En(e)+'"]';var o=i;switch(t){case"style":o=th(e);break;case"script":o=ih(e)}Qf.has(o)||(e=xe({rel:"preload",href:"image"===t&&n&&n.imageSrcSet?void 0:e,as:t},n),Qf.set(o,e),null!==r.querySelector(i)||"style"===t&&r.querySelector(nh(o))||"script"===t&&r.querySelector(oh(o))||(xf(t=r.createElement("link"),"link",e),cn(t),r.head.appendChild(t)))}},m:function(e,t){Gf.m(e,t);var n=Xf;if(n&&e){var r=t&&"string"==typeof t.as?t.as:"script",i='link[rel="modulepreload"][as="'+En(r)+'"][href="'+En(e)+'"]',o=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=ih(e)}if(!Qf.has(o)&&(e=xe({rel:"modulepreload",href:e},t),Qf.set(o,e),null===n.querySelector(i))){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(oh(o)))return}xf(r=n.createElement("link"),"link",e),cn(r),n.head.appendChild(r)}}},X:function(e,t){Gf.X(e,t);var n=Xf;if(n&&e){var r=ln(n).hoistableScripts,i=ih(e),o=r.get(i);o||((o=n.querySelector(oh(i)))||(e=xe({src:e,async:!0},t),(t=Qf.get(i))&&ch(e,t),cn(o=n.createElement("script")),xf(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(i,o))}},S:function(e,t,n){Gf.S(e,t,n);var r=Xf;if(r&&e){var i=ln(r).hoistableStyles,o=th(e);t=t||"default";var a=i.get(o);if(!a){var s={loading:0,preload:null};if(a=r.querySelector(nh(o)))s.loading=5;else{e=xe({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Qf.get(o))&&lh(e,n);var l=a=r.createElement("link");cn(l),xf(l,"link",e),l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),l.addEventListener("load",function(){s.loading|=1}),l.addEventListener("error",function(){s.loading|=2}),s.loading|=4,sh(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:s},i.set(o,a)}}},M:function(e,t){Gf.M(e,t);var n=Xf;if(n&&e){var r=ln(n).hoistableScripts,i=ih(e),o=r.get(i);o||((o=n.querySelector(oh(i)))||(e=xe({src:e,async:!0,type:"module"},t),(t=Qf.get(i))&&ch(e,t),cn(o=n.createElement("script")),xf(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(i,o))}}};var Xf="undefined"==typeof document?null:document;function Zf(e,t,n){var r=Xf;if(r&&"string"==typeof t&&t){var i=En(t);i='link[rel="'+e+'"][href="'+i+'"]',"string"==typeof n&&(i+='[crossorigin="'+n+'"]'),Jf.has(i)||(Jf.add(i),e={rel:e,crossOrigin:n,href:t},null===r.querySelector(i)&&(xf(t=r.createElement("link"),"link",e),cn(t),r.head.appendChild(t)))}}function eh(e,t,n,r){var i,o,a,s,l=(l=et.current)?Yf(l):null;if(!l)throw Error(pe(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof n.precedence&&"string"==typeof n.href?(t=th(n.href),(r=(n=ln(l).hoistableStyles).get(t))||(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("stylesheet"===n.rel&&"string"==typeof n.href&&"string"==typeof n.precedence){e=th(n.href);var c=ln(l).hoistableStyles,u=c.get(e);if(u||(l=l.ownerDocument||l,u={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,u),(c=l.querySelector(nh(e)))&&!c._p&&(u.instance=c,u.state.loading=5),Qf.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},Qf.set(e,n),c||(i=l,o=e,a=n,s=u.state,i.querySelector('link[rel="preload"][as="style"]['+o+"]")?s.loading=1:(o=i.createElement("link"),s.preload=o,o.addEventListener("load",function(){return s.loading|=1}),o.addEventListener("error",function(){return s.loading|=2}),xf(o,"link",a),cn(o),i.head.appendChild(o))))),t&&null===r)throw Error(pe(528,""));return u}if(t&&null!==r)throw Error(pe(529,""));return null;case"script":return t=n.async,"string"==typeof(n=n.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=ih(n),(r=(n=ln(l).hoistableScripts).get(t))||(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(pe(444,e))}}function th(e){return'href="'+En(e)+'"'}function nh(e){return'link[rel="stylesheet"]['+e+"]"}function rh(e){return xe({},e,{"data-precedence":e.precedence,precedence:null})}function ih(e){return'[src="'+En(e)+'"]'}function oh(e){return"script[async]"+e}function ah(e,t,n){if(t.count++,null===t.instance)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+En(n.href)+'"]');if(r)return t.instance=r,cn(r),r;var i=xe({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return cn(r=(e.ownerDocument||e).createElement("style")),xf(r,"style",i),sh(r,n.precedence,e),t.instance=r;case"stylesheet":i=th(n.href);var o=e.querySelector(nh(i));if(o)return t.state.loading|=4,t.instance=o,cn(o),o;r=rh(n),(i=Qf.get(i))&&lh(r,i),cn(o=(e.ownerDocument||e).createElement("link"));var a=o;return a._p=new Promise(function(e,t){a.onload=e,a.onerror=t}),xf(o,"link",r),t.state.loading|=4,sh(o,n.precedence,e),t.instance=o;case"script":return o=ih(n.src),(i=e.querySelector(oh(o)))?(t.instance=i,cn(i),i):(r=n,(i=Qf.get(o))&&ch(r=xe({},n),i),cn(i=(e=e.ownerDocument||e).createElement("script")),xf(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(pe(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(r=t.instance,t.state.loading|=4,sh(r,n.precedence,e));return t.instance}function sh(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,o=i,a=0;a<r.length;a++){var s=r[a];if(s.dataset.precedence===t)o=s;else if(o!==i)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=9===n.nodeType?n.head:n).insertBefore(e,t.firstChild)}function lh(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function ch(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var uh=null;function dh(e,t,n){if(null===uh){var r=new Map,i=uh=new Map;i.set(n,r)}else(r=(i=uh).get(n))||(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 o=n[i];if(!(o[nn]||o[Jt]||"link"===e&&"stylesheet"===o.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==o.namespaceURI){var a=o.getAttribute(t)||"";a=e+a;var s=r.get(a);s?s.push(o):r.set(a,[o])}}return r}function fh(e,t,n){(e=e.ownerDocument||e).head.insertBefore(n,"title"===t?e.querySelector("head > title"):null)}function hh(e){return!!("stylesheet"!==e.type||3&e.state.loading)}var ph=0;function mh(){if(this.count--,0===this.count&&(0===this.imgCount||!this.waitingForImages))if(this.stylesheets)gh(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var vh=null;function gh(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,vh=new Map,t.forEach(yh,e),vh=null,mh.call(e))}function yh(e,t){if(!(4&t.state.loading)){var n=vh.get(e);if(n)var r=n.get(null);else{n=new Map,vh.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<i.length;o++){var a=i[o];"LINK"!==a.nodeName&&"not all"===a.getAttribute("media")||(n.set(a.dataset.precedence,a),r=a)}r&&n.set(null,r)}a=(i=t.instance).getAttribute("data-precedence"),(o=n.get(a)||r)===r&&n.set(null,i),n.set(a,i),this.count++,r=mh.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),o?o.parentNode.insertBefore(i,o.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(i,e.firstChild),t.state.loading|=4}}var bh={$$typeof:Te,Provider:null,Consumer:null,_currentValue:We,_currentValue2:We,_threadCount:0};function wh(e,t,n,r,i,o,a,s,l){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=zt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zt(0),this.hiddenUpdates=zt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=o,this.onRecoverableError=a,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function xh(e,t,n,r,i,o,a,s,l,c,u,d){return e=new wh(e,t,n,a,l,c,u,d,s),t=1,!0===o&&(t|=24),o=$i(3,null,null,t),e.current=o,o.stateNode=e,(t=Qo()).refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:r,isDehydrated:n,cache:t},_a(o),e}function kh(e){return e?e=Wi:Wi}function Sh(e,t,n,r,i,o){i=kh(i),null===r.context?r.context=i:r.pendingContext=i,(r=Na(t)).payload={element:n},null!==(o=void 0===o?null:o)&&(r.callback=o),null!==(n=Ia(e,r,t))&&(nd(n,0,t),Ta(n,e,t))}function Ch(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function _h(e,t){Ch(e,t),(e=e.alternate)&&Ch(e,t)}function Eh(e){if(13===e.tag||31===e.tag){var t=Fi(e,67108864);null!==t&&nd(t,0,67108864),_h(e,67108864)}}function Nh(e){if(13===e.tag||31===e.tag){var t=ed(),n=Fi(e,t=Wt(t));null!==n&&nd(n,0,t),_h(e,t)}}var Ih=!0;function Th(e,t,n,r){var i=qe.T;qe.T=null;var o=He.p;try{He.p=2,Oh(e,t,n,r)}finally{He.p=o,qe.T=i}}function jh(e,t,n,r){var i=qe.T;qe.T=null;var o=He.p;try{He.p=8,Oh(e,t,n,r)}finally{He.p=o,qe.T=i}}function Oh(e,t,n,r){if(Ih){var i=Ph(r);if(null===i)uf(e,t,r,Rh,n),Wh(e,r);else if(function(e,t,n,r,i){switch(t){case"focusin":return Dh=Vh(Dh,e,t,n,r,i),!0;case"dragenter":return Bh=Vh(Bh,e,t,n,r,i),!0;case"mouseover":return zh=Vh(zh,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return Uh.set(o,Vh(Uh.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,Fh.set(o,Vh(Fh.get(o)||null,e,t,n,r,i)),!0}return!1}(i,e,t,n,r))r.stopPropagation();else if(Wh(e,r),4&t&&-1<Hh.indexOf(e)){for(;null!==i;){var o=an(i);if(null!==o)switch(o.tag){case 3:if((o=o.stateNode).current.memoizedState.isDehydrated){var a=Mt(o.pendingLanes);if(0!==a){var s=o;for(s.pendingLanes|=2,s.entangledLanes|=2;a;){var l=1<<31-It(a);s.entanglements[1]|=l,a&=~l}Hd(o),!(6&xu)&&(qu=vt()+500,Wd(0))}}break;case 31:case 13:null!==(s=Fi(o,2))&&nd(s,0,2),sd(),_h(o,2)}if(null===(o=Ph(r))&&uf(e,t,r,Rh,n),o===i)break;i=o}null!==i&&r.stopPropagation()}else uf(e,t,r,null,n)}}function Ph(e){return Mh(e=Hn(e))}var Rh=null;function Mh(e){if(Rh=null,null!==(e=on(e))){var t=ve(e);if(null===t)e=null;else{var n=t.tag;if(13===n){if(null!==(e=ge(t)))return e;e=null}else if(31===n){if(null!==(e=ye(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Rh=e,null}function Ah(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(gt()){case yt:return 2;case bt:return 8;case wt:case xt:return 32;case kt:return 268435456;default:return 32}default:return 32}}var Lh=!1,Dh=null,Bh=null,zh=null,Uh=new Map,Fh=new Map,qh=[],Hh="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 Wh(e,t){switch(e){case"focusin":case"focusout":Dh=null;break;case"dragenter":case"dragleave":Bh=null;break;case"mouseover":case"mouseout":zh=null;break;case"pointerover":case"pointerout":Uh.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fh.delete(t.pointerId)}}function Vh(e,t,n,r,i,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},null!==t&&(null!==(t=an(t))&&Eh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function $h(e){var t=on(e.target);if(null!==t){var n=ve(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=ge(n)))return e.blockedOn=t,void Kt(e.priority,function(){Nh(n)})}else if(31===t){if(null!==(t=ye(n)))return e.blockedOn=t,void Kt(e.priority,function(){Nh(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Kh(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ph(e.nativeEvent);if(null!==n)return null!==(t=an(n))&&Eh(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);qn=r,n.target.dispatchEvent(r),qn=null,t.shift()}return!0}function Qh(e,t,n){Kh(e)&&n.delete(t)}function Jh(){Lh=!1,null!==Dh&&Kh(Dh)&&(Dh=null),null!==Bh&&Kh(Bh)&&(Bh=null),null!==zh&&Kh(zh)&&(zh=null),Uh.forEach(Qh),Fh.forEach(Qh)}function Yh(e,t){e.blockedOn===t&&(e.blockedOn=null,Lh||(Lh=!0,de.unstable_scheduleCallback(de.unstable_NormalPriority,Jh)))}var Gh=null;function Xh(e){Gh!==e&&(Gh=e,de.unstable_scheduleCallback(de.unstable_NormalPriority,function(){Gh===e&&(Gh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if("function"!=typeof r){if(null===Mh(r||n))continue;break}var o=an(n);null!==o&&(e.splice(t,3),t-=3,cl(o,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Zh(e){function t(t){return Yh(t,e)}null!==Dh&&Yh(Dh,e),null!==Bh&&Yh(Bh,e),null!==zh&&Yh(zh,e),Uh.forEach(t),Fh.forEach(t);for(var n=0;n<qh.length;n++){var r=qh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<qh.length&&null===(n=qh[0]).blockedOn;)$h(n),null===n.blockedOn&&qh.shift();if(null!=(n=(e.ownerDocument||e).$$reactFormReplay))for(r=0;r<n.length;r+=3){var i=n[r],o=n[r+1],a=i[Yt]||null;if("function"==typeof o)a||Xh(n);else if(a){var s=null;if(o&&o.hasAttribute("formAction")){if(i=o,a=o[Yt]||null)s=a.formAction;else if(null!==Mh(i))continue}else s=a.action;"function"==typeof s?n[r+1]=s:(n.splice(r,3),r-=3),Xh(n)}}}function ep(){function e(e){e.canIntercept&&"react-transition"===e.info&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:"manual",scroll:"manual"})}function t(){null!==i&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&null!=e.url&&navigation.navigate(e.url,{state:e.getState(),info:"react-transition",history:"replace"})}}if("object"==typeof navigation){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),null!==i&&(i(),i=null)}}}function tp(e){this._internalRoot=e}function np(e){this._internalRoot=e}np.prototype.render=tp.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(pe(409));Sh(t.current,ed(),e,t,null,null)},np.prototype.unmount=tp.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Sh(e.current,2,null,e,null,null),sd(),t[Gt]=null}},np.prototype.unstable_scheduleHydration=function(e){if(e){var t=$t();e={blockedOn:null,target:e,priority:t};for(var n=0;n<qh.length&&0!==t&&t<qh[n].priority;n++);qh.splice(n,0,e),0===n&&$h(e)}};var rp=fe.version;if("19.2.5"!==rp)throw Error(pe(527,rp,"19.2.5"));He.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(pe(188));throw e=Object.keys(e).join(","),Error(pe(268,e))}return e=function(e){var t=e.alternate;if(!t){if(null===(t=ve(e)))throw Error(pe(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return be(i),e;if(o===r)return be(i),t;o=o.sibling}throw Error(pe(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,s=i.child;s;){if(s===n){a=!0,n=i,r=o;break}if(s===r){a=!0,r=i,n=o;break}s=s.sibling}if(!a){for(s=o.child;s;){if(s===n){a=!0,n=o,r=i;break}if(s===r){a=!0,r=o,n=i;break}s=s.sibling}if(!a)throw Error(pe(189))}}if(n.alternate!==r)throw Error(pe(190))}if(3!==n.tag)throw Error(pe(188));return n.stateNode.current===n?e:t}(t),e=null===(e=null!==e?we(e):null)?null:e.stateNode};var ip={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:qe,reconcilerVersion:"19.2.5"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var op=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!op.isDisabled&&op.supportsFiber)try{_t=op.inject(ip),Et=op}catch(Gp){}}p.createRoot=function(e,t){if(!me(e))throw Error(pe(299));var n=!1,r="",i=Pl,o=Rl,a=Ml;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onUncaughtError&&(i=t.onUncaughtError),void 0!==t.onCaughtError&&(o=t.onCaughtError),void 0!==t.onRecoverableError&&(a=t.onRecoverableError)),t=xh(e,1,!1,null,0,n,r,null,i,o,a,ep),e[Gt]=t.current,lf(e),new tp(t)},p.hydrateRoot=function(e,t,n){if(!me(e))throw Error(pe(299));var r=!1,i="",o=Pl,a=Rl,s=Ml,l=null;return null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(i=n.identifierPrefix),void 0!==n.onUncaughtError&&(o=n.onUncaughtError),void 0!==n.onCaughtError&&(a=n.onCaughtError),void 0!==n.onRecoverableError&&(s=n.onRecoverableError),void 0!==n.formState&&(l=n.formState)),(t=xh(e,1,!0,t,0,r,i,l,o,a,s,ep)).context=kh(null),n=t.current,(i=Na(r=Wt(r=ed()))).callback=null,Ia(n,i,r),n=r,t.current.lanes=n,Ut(t,n),Hd(t),e[Gt]=t.current,lf(e),new np(t)},p.version="19.2.5",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),h.exports=p;var ap=h.exports,sp={exports:{}},lp={},cp=Z;var up="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},dp=cp.useSyncExternalStore,fp=cp.useRef,hp=cp.useEffect,pp=cp.useMemo,mp=cp.useDebugValue;lp.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=fp(null);if(null===o.current){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=pp(function(){function e(e){if(!l){if(l=!0,o=e,e=r(e),void 0!==i&&a.hasValue){var t=a.value;if(i(t,e))return s=t}return s=e}if(t=s,up(o,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(o=e,t):(o=e,s=n)}var o,s,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]);var s=dp(e,o[0],o[1]);return hp(function(){a.hasValue=!0,a.value=s},[s]),mp(s),s},sp.exports=lp;var vp=sp.exports;var gp={notify(){},get:()=>[]};var yp=(()=>!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement))(),bp=(()=>"undefined"!=typeof navigator&&"ReactNative"===navigator.product)(),wp=(()=>yp||bp?Z.useLayoutEffect:Z.useEffect)(),xp=Symbol.for("react-redux-context"),kp="undefined"!=typeof globalThis?globalThis:{};function Sp(){if(!Z.createContext)return{};const e=kp[xp]??=new Map;let t=e.get(Z.createContext);return t||(t=Z.createContext(null),e.set(Z.createContext,t)),t}var Cp=Sp();var _p=function(e){const{children:t,context:n,serverState:r,store:i}=e,o=Z.useMemo(()=>{const e=function(e){let t,n=gp,r=0,i=!1;function o(){l.onStateChange&&l.onStateChange()}function a(){r++,t||(t=e.subscribe(o),n=function(){let e=null,t=null;return{clear(){e=null,t=null},notify(){(()=>{let t=e;for(;t;)t.callback(),t=t.next})()},get(){const t=[];let n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){r&&null!==e&&(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}())}function s(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=gp)}const l={addNestedSub:function(e){a();const t=n.subscribe(e);let r=!1;return()=>{r||(r=!0,t(),s())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:o,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,a())},tryUnsubscribe:function(){i&&(i=!1,s())},getListeners:()=>n};return l}(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),a=Z.useMemo(()=>i.getState(),[i]);wp(()=>{const{subscription:e}=o;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),a!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[o,a]);const s=n||Cp;return Z.createElement(s.Provider,{value:o},t)};function Ep(e=Cp){return function(){return Z.useContext(e)}}var Np=Ep();function Ip(e=Cp){const t=e===Cp?Np:Ep(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var Tp=Ip();function jp(e=Cp){const t=e===Cp?Tp:Ip(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Op=jp(),Pp=(e,t)=>e===t;function Rp(e=Cp){const t=e===Cp?Np:Ep(e),n=(e,n={})=>{const{equalityFn:r=Pp}="function"==typeof n?{equalityFn:n}:n,i=t(),{store:o,subscription:a,getServerState:s}=i;Z.useRef(!0);const l=Z.useCallback({[e.name]:t=>e(t)}[e.name],[e]),c=vp.useSyncExternalStoreWithSelector(a.addNestedSub,o.getState,s||o.getState,l,r);return Z.useDebugValue(c),c};return Object.assign(n,{withTypes:()=>n}),n}var Mp=Rp();
|
|
2
|
-
/*! Copyright (c) 2021, XAPPmedia */function Ap(e){return!!e&&e.startsWith("agent:")}var Lp=function(){this.retries=5,this.timeout=1e3,this.log=!1},Dp=function(){function e(e){e&&(this.options=Object.assign(new Lp,e))}return e.prototype.fetch=function(e,t){return n(this,void 0,void 0,function(){var n,i,o,a;return r(this,function(r){switch(r.label){case 0:t||(t=this.options),r.label=1;case 1:return r.trys.push([1,3,,5]),n=new AbortController,i=setTimeout(function(){n.abort()},t.timeout),[4,e(n.signal)];case 2:return o=r.sent(),clearTimeout(i),[2,o];case 3:if(a=r.sent(),1===t.retries||t.retries<1)throw a;return[4,this.fetch(e,{timeout:t.timeout,retries:t.retries-1})];case 4:return[2,r.sent()];case 5:return[2]}})})},e}();var Bp="xapp-form-js",zp="https://form.xapp.ai/xapp-form-widget.js";function Up(e){return"".concat(zp,"?key=").concat(encodeURIComponent(e))}function Fp(e){if(document.getElementById(Bp))return!0;if(e)for(var t=Up(e),n=document.querySelectorAll("script[src]"),r=0;r<n.length;r++){var i=n[r].getAttribute("src");if(i&&(i===t||i.startsWith(zp)))return!0}return!1}function qp(e){return new Promise(function(t,n){var r=document.createElement("script");r.id=Bp,r.src=Up(e),r.async=!0,r.onload=function(){t()},r.onerror=function(){n(new Error("Failed to load form-widget script: ".concat(r.src)))},document.head.appendChild(r)})}function Hp(e){return n(this,arguments,void 0,function(e,t,n){var i,o,a;return void 0===t&&(t=3),void 0===n&&(n=1e3),r(this,function(r){switch(r.label){case 0:if(Fp(e))return[2];o=0,r.label=1;case 1:if(!(o<=t))return[3,8];r.label=2;case 2:return r.trys.push([2,6,,7]),o>0?((l=document.getElementById(Bp))&&l.remove(),console.log("[chat-widget] Retrying form-widget script load (attempt ".concat(o+1,"/").concat(t+1,")")),[4,(s=n,new Promise(function(e){return setTimeout(e,s)}))]):[3,4];case 3:r.sent(),r.label=4;case 4:return[4,qp(e)];case 5:return r.sent(),[2];case 6:return a=r.sent(),i=a,o===t&&console.error("[chat-widget] Failed to load form-widget script after all retries:",a),[3,7];case 7:return o++,[3,1];case 8:throw i||new Error("Failed to load form-widget script")}var s,l})})}function Wp(){var e;return"function"==typeof(null===(e=window.xafwControl)||void 0===e?void 0:e.openForm)}function Vp(e){return!!Wp()&&(window.xafwControl.openForm(e),!0)}function $p(e,t,n){return void 0===t&&(t=20),void 0===n&&(n=100),new Promise(function(r){if(Vp(e))r(!0);else var i=0,o=setInterval(function(){if(i++,Vp(e))return clearInterval(o),void r(!0);i>=t&&(clearInterval(o),console.warn("[chat-widget] Form widget not ready after waiting"),r(!1))},n)})}var Kp="xaLogLevel",Qp=localStorage.getItem(Kp);function Jp(){return(new Date).toISOString()+" ::"}function Yp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"debug"===window.xaLogLevel&&console.log.apply(console,i([Jp()],e,!1))}function Gp(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,i([Jp()],e,!1))}Object.getOwnPropertyDescriptor(window,"xaLogLevel")||Object.defineProperty(window,"xaLogLevel",{get:function(){return this._xaLogLevel},set:function(e){this._xaLogLevel=e,e?localStorage.setItem(Kp,e):localStorage.removeItem(Kp)},configurable:!0,enumerable:!0}),Qp&&(window.xaLogLevel=Qp),"undefined"!=typeof window&&(window.xapp=window.xapp||{},window.xapp.setLogLevel=function(e){"off"===e?(window.xaLogLevel=null,console.log("Log level set to: off (logs disabled)")):(window.xaLogLevel=e,console.log("Log level set to: ".concat(e)))},window.xapp.getLogLevel=function(){return window.xaLogLevel||"off"});function Xp(){var e=null===document||void 0===document?void 0:document.getElementById("xapp-js"),t=function(e){if(!e)return{path:e};var t=e.lastIndexOf("/"),n="";t>=0&&(n=e.substr(0,t));var r=new URL(e),i=r.hostname;i.endsWith("nitrocdn.com")&&(n="https://widget.xapp.ai");var o=new URLSearchParams(r.search),a=o.get("key");return{path:n,key:a}}(null==e?void 0:e.src);return t}var Zp=process.env.SERVER_URL;process.env.ACCOUNT_KEY;var em="48",tm="ScheduleButton";var nm=Z.createContext(null);function rm(){var e=Z.useContext(nm);return null==e?void 0:e.env}function im(e){return(null==e?void 0:e.connection)?e.connection:{serverUrl:null==e?void 0:e.serverUrl,accountKey:null==e?void 0:e.accountKey,type:(null==e?void 0:e.direct)?"direct":"websocket"}}function om(e,t){var n=im(e),r=n.accountKey,i=n.serverUrl,o=n.type,a=n.timeout,s=n.backgroundSleepDelay,l=n.mcp,c=null==e?void 0:e.channelId;return Z.useMemo(function(){return{accountKey:r,serverUrl:i,timeout:a,type:o,nonce:t,backgroundSleepDelay:s,mcp:am(l,c)}},[r,i,a,o,t,s,l,c])}function am(e,n){var r;return e?t(t({},e),{channelId:null!==(r=e.channelId)&&void 0!==r?r:n}):e}function sm(e){return e?im(e):{}}var lm=function(e){var t=e.label,n=e.disable,r=e.type,i=e.addClass,o=e.onClick;return f.jsx("button",{disabled:n,type:r,className:"action-button ".concat(i),onClick:function(e){e.stopPropagation(),o&&o(t)},children:t})},cm=Z.memo(function(e){var t=e.button,n=e.onClick,r=Z.useCallback(function(){n(t)},[t,n]);return f.jsx(lm,{onClick:r,addClass:"button-card",label:t.label})}),um=Z.memo(function(e){return f.jsx("div",{className:"buttons-container "+(e.className||""),children:e.buttons.map(function(t,n){return f.jsx(cm,{button:t,onClick:e.onClick},n)})})}),dm=function(e){var t=e.imageUrl.replace(/'/g,"%27"),n=f.jsx("div",{className:"chat-card-img__content",style:{backgroundImage:"url(".concat(t,")")}});return e.imageActionUrl?f.jsx("a",{href:e.imageActionUrl,"aria-label":"read more",target:"_blank",rel:"noopener noreferrer",className:"chat-card-img",children:n}):f.jsx("div",{className:"chat-card-img",children:n})},fm=function(e){var t,n,r,i,o=e.card;return o.imageUrl&&(r=f.jsx("div",{className:"chat-card-container__img",children:f.jsx(dm,{imageUrl:o.imageUrl,imageActionUrl:o.imageActionUrl})})),o.title&&(n=f.jsx("div",{className:"chat-card-title",children:f.jsx("span",{children:o.title})})),o.content&&(i=f.jsx("div",{className:"chat-card-sub-title",children:f.jsx("span",{children:o.content})})),f.jsxs("div",{className:"chat-card-container",children:[r,n,i,!!(null===(t=o.buttons)||void 0===t?void 0:t.length)&&f.jsx(um,{buttons:o.buttons,onClick:e.onButtonClick})]})},hm=function(e){var t,n,r,i,o,a,s={},l=e.entity,c=Z.useContext(nm),u=null==l?void 0:l.avatarPath;if(!u){var d=function(e){var t=(null==e?void 0:e.initials)||"?",n=(null==e?void 0:e.size)||40,r=(null==e?void 0:e.backgroundColor)||"#007bff",i=(null==e?void 0:e.textColor)||"#ffffff";return Z.useMemo(function(){return function(e,t,n,r){var i=document.createElement("canvas");i.width=t,i.height=t;var o=i.getContext("2d");o.fillStyle=n,o.fillRect(0,0,t,t),o.fillStyle=r,o.font="".concat(t/2,"px Arial"),o.textAlign="center",o.textBaseline="middle",o.fillText(e,t/2,t/2);var a=new Image;return a.src=i.toDataURL(),a}(t,n,r,i)},[t,n,r,i])}({initials:(null==l?void 0:l.displayName)?l.displayName.slice(0,2):"?",backgroundColor:null===(n=null===(t=null==c?void 0:c.env)||void 0===t?void 0:t.theme)||void 0===n?void 0:n.primaryColor,size:36});u=d.src}var h=l&&Ap(l.nick);h?(s.backgroundImage="url('".concat(u,"')"),s.backgroundColor="none"):a=f.jsx("svg",{width:"16",height:"19",viewBox:"0 0 16 19",style:{margin:"0 auto",display:"block"},children:f.jsx("path",{d:"M11.5 5c0-1.933-1.567-3.5-3.5-3.5S4.5 3.067 4.5 5 6.067 8.5 8 8.5s3.5-1.567 3.5-3.5zM3 5c0-2.76 2.24-5 5-5s5 2.24 5 5-2.24 5-5 5-5-2.24-5-5zM1.955 17.294c.21-.642.504-1.285.898-1.88C3.963 13.74 5.615 12.75 8 12.75c2.385 0 4.038.99 5.147 2.664.394.595.69 1.238.898 1.88.124.382.19.672.214.822.063.41.447.69.856.625.41-.063.69-.447.625-.856-.034-.225-.118-.59-.27-1.053-.247-.763-.598-1.527-1.073-2.244C13.024 12.51 10.917 11.25 8 11.25c-2.916 0-5.024 1.26-6.397 3.336-.475.717-.826 1.48-1.074 2.245-.152.463-.236.83-.27 1.054-.065.41.215.793.624.857.41.065.793-.215.857-.624.025-.15.09-.44.215-.822z",fill:"#FFF",fillRule:"evenodd"})});var p=!!s.backgroundImage||!!a,m=(null===(o=null===(i=null===(r=null==c?void 0:c.env)||void 0===r?void 0:r.connection)||void 0===i?void 0:i.mcp)||void 0===o?void 0:o.showAiBadge)&&(null==l?void 0:l.isAI);return f.jsxs("div",{className:"avatar ".concat(h?"avatar--agent":"avatar--visitor"," ").concat(p?"":"avatar--empty"),style:s,title:l?l.display_name:"Agent",children:[a,m&&f.jsx("span",{className:"avatar__ai-badge",children:"AI"})]})};function pm(e){return f.jsx("div",{className:"xappw-chat-msg-part__avatar",children:f.jsx(hm,{entity:e})})}var mm=function(e){var t,n=null!==(t=e.avatarPosition)&&void 0!==t?t:"left",r="xappw-chat-msg-part"+("below"===n?" xappw-chat-msg-part--avatar-below":"")+("bottom"===n?" xappw-chat-msg-part--avatar-bottom":"")+(e.fullWidth?" xappw-chat-msg-part--full-width":"")+(e.isStreaming?" xappw-chat-msg-part--streaming":""),i=e.user,o=e.hideUserInfo&&"bottom"===n;return f.jsx("div",{className:r,children:"left"===n?f.jsxs(f.Fragment,{children:[e.showAvatar&&pm(i),e.children]}):f.jsxs(f.Fragment,{children:[e.children,e.showAvatar&&!o&&f.jsxs("div",{className:"xappw-chat-msg-part__avatar-wrapper",children:[pm(i),(null==i?void 0:i.displayName)&&f.jsx("div",{className:"xappw-chat-msg-part__avatar-name",children:i.displayName})]})]})})};function vm(e,t,n){return{type:"synthetic",detail:{type:"write_msg",user:t,msg:e,timestamp:void 0!==n?n:+new Date}}}function gm(e,n){return function(r){return function(i,o){var a=o().attributes;a=t(t({},a),{currentUrl:window.location.href});var s=n||{},l=s.token,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(s,["token"]);a=t(t({},a),c);var u=o().visitor,d=+new Date;i(vm({text:l?"".concat(e," (from the list)"):e},u,d)),r.sendChatMsg({text:e,token:l,attributes:a},function(e){e&&Yp("Error sending message",e)})}}}function ym(e){return function(t){return function(){t.sendTyping(e)}}}function bm(e,t){return function(n){return function(){n.setVisitorInfo(e,t,function(e){e&&Yp(e)})}}}function wm(e){return{type:"account_status",detail:{status:e,timestamp:+new Date}}}function xm(e){return{type:"connection_update",detail:{status:e,timestamp:+new Date}}}function km(e){return{type:"ws_button_display",detail:{id:e.id,text:e.text,pressBehavior:e.pressBehavior,isPressed:e.isPressed,isDismissing:e.isDismissing,timestamp:+new Date}}}function Sm(e){throw new Error("Unknown kind "+e)}var Cm=function(){return Op()},_m=function(){function e(e){this.inner=e}return e.prototype.bargeOut=function(e){Yp("CLIENT: bargeOut"),this.inner.bargeOut(e)},e.prototype.bargeIn=function(e,t){Yp("CLIENT: bargeIn: ".concat(e)),this.inner.bargeIn(e,t)},e.prototype.init=function(e){this.inner.init(e)},e.prototype.sendOfflineMsg=function(e,t){Yp("CLIENT: sendOfflineMsg: ".concat(JSON.stringify(e))),this.inner.sendOfflineMsg(e,t)},e.prototype.sendChatMsg=function(e,t){Yp("CLIENT: sendChatMsg: ".concat(JSON.stringify(e))),this.inner.sendChatMsg(e,t)},e.prototype.sendChatMsgRequest=function(e,t){Yp("CLIENT: sendChatMsgRequest: ".concat(JSON.stringify(e))),this.inner.sendChatMsgRequest(e,t)},e.prototype.sendTyping=function(e){Yp("CLIENT: sendTyping: ".concat(JSON.stringify(e))),this.inner.sendTyping(e)},e.prototype.setVisitorInfo=function(e,t,n){Yp("CLIENT: setVisitorInfo: ".concat(JSON.stringify(e)," session id: ").concat(t)),this.inner.setVisitorInfo(e,t,n)},e.prototype.sendChatRating=function(e){Yp("CLIENT: sendChatRating: ".concat(JSON.stringify(e))),this.inner.sendChatRating(e)},e.prototype.sendFile=function(e,t){Yp("CLIENT: sendFile: ".concat(JSON.stringify(e))),this.inner.sendFile(e,t)},e.prototype.markAsRead=function(){Yp("CLIENT: markAsRead:"),this.inner.markAsRead()},e.prototype.flush=function(){Yp("CLIENT: flush:"),this.inner.flush()},e.prototype.dispose=function(){Yp("CLIENT: dispose:"),this.inner.dispose()},e.prototype.sleep=function(){Yp("CLIENT: sleep:"),this.inner.sleep()},e.prototype.wakeup=function(){Yp("CLIENT: wakeup:"),this.inner.wakeup()},e.prototype.sendButtonPressed=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return Yp("CLIENT: sendButtonPressed: ".concat(e)),this.inner.sendButtonPressed?[2,this.inner.sendButtonPressed(e)]:[2]})})},e.prototype.notifyDisconnecting=function(){Yp("CLIENT: notifyDisconnecting:"),this.inner.notifyDisconnecting&&this.inner.notifyDisconnecting()},e}(),Em=f,Nm=Z;var Im=function(e){var t=e.format,n=e.text;return Em.jsx("span",{"data-rich-text-type":"bold",className:"xapp-search-rich-text-bold-span",children:n.substring(t.start,t.end)})},Tm=function(e){var t=e.format,n=e.text,r=e.readOnly,i=e.onClick,o=t.text||n.substring(t.start,t.end),a=Nm.useState(o),s=a[0],l=a[1],c=Nm.useCallback(function(e){l(e.target.value)},[]),u=Nm.useCallback(function(e){i&&(!1===i(t)&&(e.preventDefault(),e.stopPropagation()))},[i,t]);return r?Em.jsx("span",{className:"xapp-search-rich-text-input-span xapp-search-rich-text-input-span--readonly",onClick:u,children:o}):Em.jsx("input",{type:"text",value:s,className:"xapp-search-rich-text-input-span","data-rich-text-type":"inputText",onChange:c,onClick:u,readOnly:r})},jm=function(e){var t=e.format,n=e.text;return Em.jsx("span",{"data-rich-text-type":"normal",className:"xapp-search-rich-text-normal-span",children:n.substring(t.start,t.end)})},Om=function(e){var t=e.format,n=e.text,r=e.readOnly,i=e.onClick,o=t.type;switch(o){case"normal":return Em.jsx(jm,{text:n,format:t,readOnly:r});case"bold":return Em.jsx(Im,{text:n,format:t,readOnly:r});case"inputText":return Em.jsx(Tm,{text:n,format:t,readOnly:r,onClick:i});default:!function(e){throw new Error("Unknown kind "+e)}(o)}};function Pm(e){var t=e.childNodes,n=[],r="";return t.forEach(function(e){if(e.nodeType===Node.ELEMENT_NODE){var t=e,i="INPUT"===t.tagName?t.value:t.innerText,o=t.dataset.richTextType;n.push({type:o,start:r.length,end:r.length+i.length}),r+=i}e.nodeType===Node.TEXT_NODE&&((i=e.nodeValue)&&(n.push({type:"normal",start:r.length,end:r.length+i.length}),r+=i))}),function(e){for(var t=e.text,n=[],r=0,i=e.formats;r<i.length;r++){var o=i[r],a=o.type;switch(a){case"normal":continue;case"inputText":n.push(o);break;case"bold":if(n.length>0){var s=n[n.length-1];s.type===a&&s.end===o.start&&(n.pop(),n.push({type:a,start:s.start,end:o.end}))}else n.push(o)}}return{text:t,formats:n}}({text:r,formats:n})}var Rm=function(e){var t=e.value,n=e.className,r=e.readOnly,i=e.onInput,o=e.onChange,a=e.onSpanClick,s=t.formats,l=t.text,c=Nm.useMemo(function(){return function(e,t){for(var n=[],r=0,i=0,o=e;i<o.length;i++){var a=o[i],s=a.start,l=a.end,c=a.type,u=a.text;r<s&&n.push({type:"normal",start:r,end:s}),n.push({type:c,start:s,end:l,text:u}),r=l}return r<t&&n.push({type:"normal",start:r,end:t}),n}(s,l.length)},[s,l.length]),u=Nm.useCallback(function(e){var t=Pm(e.currentTarget);i&&i(t)},[i]),d=Nm.useCallback(function(e){var t=e.currentTarget,n=Pm(t);!function(e){for(var t,n=[],r=e.childNodes,i=0;i<r.length;i++)(null==(s=r.item(i))?void 0:s.nodeType)===Node.TEXT_NODE&&n.push(s);for(var o=0,a=n;o<a.length;o++){var s=a[o];try{null===(t=s.parentElement)||void 0===t||t.removeChild(s)}catch(e){}}}(t),o&&o(n)},[o]);return Em.jsx("div",{id:e.id,className:"xapp-search-rich-text ".concat(n||""),contentEditable:!r,suppressContentEditableWarning:!0,onInput:u,onBlur:d,onKeyDown:e.onKeyDown,children:c.map(function(e,t){return Em.jsx(Om,{format:e,text:l,readOnly:r,onClick:a},t)})})},Mm=function(e){return Em.jsx("div",{className:"xappw-suggestions-group-heading",children:e.label})};var Am=function(e){var t=e.data,n=e.current,r=e.actions,i=e.onClick,o=e.onHover,a=e.onSpanClick,s=Nm.useCallback(function(){i(t)},[t,i]),l=Nm.useCallback(function(){o&&o(t)},[t,o]),c=Nm.useCallback(function(e){if(a)return a(t,e)},[a,t]),u=Nm.useRef(null);return Nm.useEffect(function(){var e=u.current;if(n&&e){var t=function(e){for(var t=e;t&&!t.classList.contains("xapp-search-result__suggestions");)t=t.parentElement;return t||void 0}(e);if(t){var r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),o=Math.max(r.top,i.top);Math.min(r.bottom,i.bottom)-o<.99*i.height&&e.scrollIntoView({behavior:"smooth"})}}},[n]),Em.jsxs("div",{ref:u,className:"xappw-suggestions-item ".concat(n?"xappw-suggestions-item--current":""),onClick:s,onMouseEnter:l,children:[Em.jsx(Rm,{value:t,className:"xappw-suggestions-item__texts",readOnly:!0,onSpanClick:c}),r&&Em.jsx("div",{className:"xappw-suggestions-item__actions",children:Em.jsx(r,{data:t,current:n})})]})},Lm=function(e){var t=e.group,n=e.currentIndex,r=e.itemActions,i=t.heading,o=t.items;return Em.jsxs("div",{className:"xappw-suggestions-group",children:[Em.jsx("div",{className:"xappw-suggestions-group__heading",children:Em.jsx(Mm,{label:i})}),Em.jsx("div",{className:"xappw-suggestions-group__items",children:o.map(function(t,i){return Em.jsx(Am,{data:t,current:n===i,actions:r,onClick:e.onItemClick,onHover:e.onItemHover,onSpanClick:e.onSpanClick},i)})})]})};function Dm(e){return e.reduce(function(e,t){return e+t.items.length},0)}var Bm=function(){return Bm=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Bm.apply(this,arguments)};function zm(e,t,n,r){return new(n||(n=Promise))(function(t,i){function o(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?t(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(o,a)}s((r=r.apply(e,[])).next())})}function Um(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function Fm(e,t,n){for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var qm=["FAQ","INTENT","HISTORICAL"].reduce(function(e,t,n){return e[t]=n,e},{});function Hm(e,t){return Fm([],e).sort(function(e,n){return function(e,t,n){return n*(qm[t.type]-qm[e.type])}(e,n,t)})}function Wm(e){var t=Object.keys(e)[0],n=e[t];if(!n)throw new Error;return{type:t,start:n.start,end:n.end}}function Vm(e){switch(e){case"FAQ":return"FAQs";case"INTENT":case"HISTORICAL":return"Suggestions";default:return e}}var $m={};function Km(){}var Qm=Fm(Fm([],["utm_source","utm_medium","utm_campaign","utm_term","utm_content"]),["gclid","gbraid","wbraid","msclkid","fbclid"]),Jm="xa_tracking_";var Ym="data-xapp-scroll-lock",Gm="data-xapp-scroll-lock-restore",Xm=["position","top","left","right","width","overflow"];function Zm(e){var t=Number(e.getAttribute(Ym));return Number.isFinite(t)&&t>0?t:0}function ev(){if("undefined"==typeof document||"undefined"==typeof window)return function(){};var e=document.body;if(0===Zm(e)){var t=function(e){var t=Xm.reduce(function(t,n){return t[n]=e.style.getPropertyValue(n),t},{});return{scrollY:window.scrollY||window.pageYOffset||0,inlineStyles:t}}(e);e.setAttribute(Gm,JSON.stringify(t)),e.style.position="fixed",e.style.top="-".concat(t.scrollY,"px"),e.style.left="0",e.style.right="0",e.style.width="100%",e.style.overflow="hidden"}e.setAttribute(Ym,String(Zm(e)+1));var n=!1;return function(){if(!n){n=!0;var t=Zm(e)-1;if(t>0)e.setAttribute(Ym,String(t));else if(!(t<0)){e.removeAttribute(Ym);var r=function(e){var t=e.getAttribute(Gm);e.removeAttribute(Gm);try{var n=JSON.parse(t||"");if(n&&"number"==typeof n.scrollY&&n.inlineStyles)return n}catch(e){}return{scrollY:0,inlineStyles:{}}}(e),i=r.scrollY,o=r.inlineStyles;Xm.forEach(function(t){o[t]?e.style.setProperty(t,o[t]):e.style.removeProperty(t)}),e.style.length||e.removeAttribute("style"),window.scrollTo(0,i)}}}}var tv="--xapp-viewport-height",nv="--xapp-viewport-offset-top",rv="--xapp-keyboard-inset",iv="data-xapp-viewport-subscribers";function ov(e){var t=Number(e.getAttribute(iv));return Number.isFinite(t)&&t>0?t:0}function av(e){var t="undefined"==typeof window?void 0:window.visualViewport;if(t){var n=t.height,r=t.offsetTop;if(n>0){var i=window.innerHeight||n,o=Math.max(0,i-n),a=o>=120?o:0;e.style.setProperty(tv,"".concat(Math.round(n),"px")),e.style.setProperty(nv,"".concat(Math.round(r),"px")),e.style.setProperty(rv,"".concat(Math.round(a),"px"))}}}function sv(){if("undefined"==typeof document)return function(){};var e=document.documentElement;e.setAttribute(iv,String(ov(e)+1)),av(e);var t,n="undefined"==typeof window?void 0:window.visualViewport,r=function(){void 0===t&&(t=window.requestAnimationFrame(function(){t=void 0,av(e)}))};null==n||n.addEventListener("resize",r),null==n||n.addEventListener("scroll",r);var i=!1;return function(){if(!i){i=!0,null==n||n.removeEventListener("resize",r),null==n||n.removeEventListener("scroll",r),void 0!==t&&(window.cancelAnimationFrame(t),t=void 0);var o=ov(e)-1;o>0?e.setAttribute(iv,String(o)):(e.removeAttribute(iv),function(e){e.style.removeProperty(tv),e.style.removeProperty(nv),e.style.removeProperty(rv)}(e))}}}var lv=function(e){var t=e.icon;return Em.jsx("div",{tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"xapp-search-icon-button ".concat(e.className||""),onClick:e.onClick,children:Em.jsx("div",{className:"xapp-search-icon-button__content",children:Em.jsx(t,{})})})},cv=function(e){var t=e.id,n=e.value,r=e.type,i=e.autoFocus,o=e.spellCheck,a=e.tabIndex,s=e.maxLength,l=e.enterKeyHint,c=e.onChange,u=e.onInput,d=e.onKeyDown,f=e.onSearch,h=n.formats.some(function(e){return"inputText"===e.type}),p=l||("search"===r?"search":"send"),m=Nm.useCallback(function(e){c&&c({text:e.target.value,formats:[]})},[c]),v=Nm.useCallback(function(e){c&&c(e)},[c]),g=Nm.useCallback(function(e){u&&u({text:e.target.value,formats:[]})},[u]),y=Nm.useCallback(function(e){u&&u(e)},[u]),b=Nm.useCallback(function(e){d&&d(e)},[d]),w=Nm.useRef(null),x=w.current;return Nm.useEffect(function(){if(x&&f){var e=function(e){var t=e.target;t&&f({text:t.value,formats:[]})};return x.addEventListener("search",e),function(){x.removeEventListener("search",e)}}},[x,f]),Em.jsx("div",{className:"xappw-rich-input ".concat(e.className),children:h?Em.jsx(Rm,{id:t,value:n,onChange:v,onInput:y,onKeyDown:b,className:"xappw-rich-input__input ".concat(e.className,"__input")}):Em.jsx("input",{id:t,ref:w,type:r,value:n.text,autoComplete:"off",enterKeyHint:p,autoFocus:i,placeholder:e.placeholder,spellCheck:o,tabIndex:a?Number(a):0,maxLength:s,className:"xappw-rich-input__input ".concat(e.className,"__input"),onFocus:e.onFocus,onChange:m,onInput:g,onKeyDown:b})})},uv=function(e){var t=e.suggestions,n=e.itemActions,r=e.className,i=Nm.useMemo(function(){return t?Dm(t):0},[t])>=0?e.index:NaN,o=0;return Em.jsx("div",{className:"xappw-suggestions-list ".concat(r||""),children:null==t?void 0:t.map(function(t,r){var a=Em.jsx(Lm,{group:t,currentIndex:i-o,itemActions:n,onItemClick:e.onItemClick,onItemHover:e.onItemHover,onSpanClick:e.onSpanClick},r);return o+=t.items.length,a})})},dv=function(e){return function(){try{return"1"===sessionStorage.getItem("xa_test")}catch(e){return!1}}()&&(e.xaTest=!0,delete e.rwg_token),e},fv=function(e,t){if(t>=0)for(var n=0,r=e;n<r.length;n++)for(var i=0,o=r[n].items;i<o.length;i++){var a=o[i];if(t<=0)return a;t--}},hv=function(e){void 0===e&&(e=window.location.href);var t,n=function(e){var t;try{t=new URL(e)}catch(e){return{}}var n={};return Qm.forEach(function(e){var r=t.searchParams.get(e);r&&function(e){return e.length<=255&&!/[<>"'\x00-\x1f]/.test(e)}(r)&&(n[e]=r)}),n}(e);return Object.keys(n).length>0&&function(e,t){void 0===t&&(t=30);var n=Date.now()+24*t*60*60*1e3;Object.entries(e).forEach(function(e){var t=e[0],r=e[1];if(r)try{localStorage.setItem("".concat(Jm).concat(t),JSON.stringify({value:r,expires:n}))}catch(e){}})}(n),Bm(Bm({},(t={},Qm.forEach(function(e){var n,r="".concat(Jm).concat(e);try{n=localStorage.getItem(r)}catch(e){return}if(n)try{var i=JSON.parse(n);i&&i.expires>Date.now()&&"string"==typeof i.value?t[e]=i.value:localStorage.removeItem(r)}catch(e){localStorage.removeItem(r)}}),t)),n)},pv=Dm,mv=function(e,t){if(void 0===t&&(t=1),e)return Hm(e.suggestions,t).reduce(function(e,t){var n,r,i={text:(n=t).suggestion,content:n.answer,formats:(r=n.format,r.map(Wm)),type:n.type};if(e.length){var o=e[e.length-1];if(o.heading===Vm(t.type))return o.items.push(i),e}return e.push({heading:Vm(t.type),items:[i]}),e},[])},vv=function(e){if(e)try{var t=new URL(e);return t.origin+t.pathname}catch(e){return}},gv=function(e){void 0===e&&(e=!0),Nm.useEffect(function(){if(e)return ev()},[e])},yv=function(e){var t=e.url,n=e.context,r=e.query,i=Nm.useMemo(function(){if(t){var e=new URLSearchParams;return e.append("size","5"),e.append("queryText",r),(null==n?void 0:n.length)&&e.append("activeContexts",n.join(",")),function(e,t){var n=new URL(e).searchParams;t.forEach(function(e,t){n.append(t,e)});var r=new URL(e);return r.search=n.toString(),r}(t,e)}},[r,n,t]),o=function(e,t){void 0===t&&(t=$m);var n=Nm.useState({state:"paused"}),r=n[0],i=n[1],o=t.pause;return Nm.useEffect(function(){if(o)return i({state:"paused"}),Km;var t=new AbortController,n=t.signal,r=!0;return function(){zm(this,0,void 0,function(){var t,o,a;return Um(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,5]),i({state:"fetching"}),[4,fetch(e,{signal:n})];case 1:return t=s.sent(),r?[4,t.json()]:[3,3];case 2:o=s.sent(),t.ok?i({state:"success",data:o}):i({state:"error",error:o}),s.label=3;case 3:return[3,5];case 4:if("AbortError"===(a=s.sent()).name)return i({state:"paused"}),[2];throw a;case 5:return[2]}})})}(),function(){r=!1,t.abort()}},[e,o]),r}(i?"".concat(i.toString()):"",{pause:!r||!t});return o},bv=function(e){void 0===e&&(e=!0),Nm.useEffect(function(){if(e)return sv()},[e])},wv=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-65xx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})},xv={},kv={},Sv={};function Cv(){return{data:"",event:"",id:"",retry:void 0}}function _v(e){var t=Number(null==e?void 0:e.statusCode);return!(Number.isFinite(t)&&t>=100&&t<=599)}Object.defineProperty(Sv,"__esModule",{value:!0}),Sv.getMessages=Sv.getLines=Sv.getBytes=void 0,Sv.getBytes=async function(e,t){const n=e.getReader();let r;for(;!(r=await n.read()).done;)t(r.value)},Sv.getLines=function(e){let t,n,r,i=!1;return function(o){void 0===t?(t=o,n=0,r=-1):t=function(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(t,o);const a=t.length;let s=0;for(;n<a;){i&&(10===t[n]&&(s=++n),i=!1);let o=-1;for(;n<a&&-1===o;++n)switch(t[n]){case 58:-1===r&&(r=n-s);break;case 13:i=!0;case 10:o=n}if(-1===o)break;e(t.subarray(s,o),r),s=n,r=-1}s===a?t=void 0:0!==s&&(t=t.subarray(s),n-=s)}},Sv.getMessages=function(e,t,n){let r=Cv();const i=new TextDecoder;return function(o,a){if(0===o.length)null==n||n(r),r=Cv();else if(a>0){const n=i.decode(o.subarray(0,a)),s=a+(32===o[a+1]?2:1),l=i.decode(o.subarray(s));switch(n){case"data":r.data=r.data?r.data+"\n"+l:l;break;case"event":r.event=l;break;case"id":e(r.id=l);break;case"retry":const n=parseInt(l,10);isNaN(n)||t(r.retry=n)}}}},function(e){var t=o&&o.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};Object.defineProperty(e,"__esModule",{value:!0}),e.fetchEventSource=e.EventStreamContentType=void 0;const n=Sv;e.EventStreamContentType="text/event-stream";const r="last-event-id";function i(t){const n=t.headers.get("content-type");if(!(null==n?void 0:n.startsWith(e.EventStreamContentType)))throw new Error(`Expected content-type to be ${e.EventStreamContentType}, Actual: ${n}`)}e.fetchEventSource=function(o,a){var{signal:s,headers:l,onopen:c,onmessage:u,onclose:d,onerror:f,openWhenHidden:h,fetch:p}=a,m=t(a,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((t,a)=>{const v=Object.assign({},l);let g;function y(){g.abort(),document.hidden||C()}v.accept||(v.accept=e.EventStreamContentType),h||document.addEventListener("visibilitychange",y);let b=1e3,w=0;function x(){document.removeEventListener("visibilitychange",y),window.clearTimeout(w),g.abort()}null==s||s.addEventListener("abort",()=>{x(),t()});const k=null!=p?p:window.fetch,S=null!=c?c:i;async function C(){var e;g=new AbortController;try{const e=await k(o,Object.assign(Object.assign({},m),{headers:v,signal:g.signal}));await S(e),await n.getBytes(e.body,n.getLines(n.getMessages(e=>{e?v[r]=e:delete v[r]},e=>{b=e},u))),null==d||d(),x(),t()}catch(t){if(!g.signal.aborted)try{const n=null!==(e=null==f?void 0:f(t))&&void 0!==e?e:b;window.clearTimeout(w),w=window.setTimeout(C,n)}catch(e){x(),a(e)}}}C()})}}(kv),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EventStreamContentType=e.fetchEventSource=void 0;var t=kv;Object.defineProperty(e,"fetchEventSource",{enumerable:!0,get:function(){return t.fetchEventSource}}),Object.defineProperty(e,"EventStreamContentType",{enumerable:!0,get:function(){return t.EventStreamContentType}})}(xv);var Ev="RATE_LIMITED",Nv=429,Iv="We're getting more requests than usual right now. Please try again in a few minutes.";function Tv(e){return(null==e?void 0:e.code)===Ev}function jv(e,t){var n=new Error(e||Iv);return n.statusCode=Nv,n.code=Ev,void 0!==t&&(n.retryAfter=t),e&&(n.serverMessage=e),n}function Ov(e){if(null!=e&&""!==e){var t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}}function Pv(e){return n(this,void 0,void 0,function(){var t,n,i,o,a,s,l,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),e.text?[4,e.text()]:[3,2];case 1:return i=r.sent(),[3,3];case 2:i="",r.label=3;case 3:return(o=(n=i)?JSON.parse(n):void 0)&&"object"==typeof o&&(t=o),[3,5];case 4:return r.sent(),[3,5];case 5:return a="string"==typeof(null==t?void 0:t.error)&&t.error.trim()?t.error:void 0,s=null!==(l=Ov(null==t?void 0:t.retryAfter))&&void 0!==l?l:Ov(null===(c=e.headers)||void 0===c?void 0:c.get("Retry-After")),[2,jv(a,s)]}})})}function Rv(e){var t=e.items,n=[{retry:0,delay:10,text:""}];if(Array.isArray(t)&&t.length>0)for(var r=0;r<t.length;r++)n.push({retry:r+1,delay:t[r].delay,text:t[r].text});return n}function Mv(e){return{type:"session_id",detail:{sessionId:e,timestamp:(new Date).getTime()}}}var Av=[{retry:0,delay:0,text:""},{retry:1,delay:3,text:"Having trouble connecting. Retrying in ${sec} seconds..."},{retry:2,delay:5,text:"Still having trouble. Retrying in ${sec} seconds..."},{retry:0,delay:0,text:"Unable to connect to the assistant. Please try again later."}],Lv="xapp_mcp_userId",Dv="xapp_mcp_sessionId";function Bv(e,t){if("undefined"!=typeof window&&window.localStorage)try{e&&localStorage.setItem(Lv,e),t&&localStorage.setItem(Dv,t)}catch(e){}}function zv(e){if("undefined"!=typeof window&&window.localStorage)try{localStorage.removeItem(Dv),e&&function(e){if("undefined"==typeof window||!window.sessionStorage)return;try{sessionStorage.removeItem("xapp_mcp_lastSeq_".concat(e))}catch(e){}}(e)}catch(e){}}function Uv(){if("undefined"!=typeof window){var e=hv(window.location.href);return Object.keys(e).length>0?e:void 0}}function Fv(e){var t,n=function(e){void 0===e&&(e=new Date);var t=-e.getTimezoneOffset(),n=t>=0?"+":"-",r=function(e){return String(Math.abs(e)).padStart(2,"0")},i=Math.floor(Math.abs(t)/60),o=Math.abs(t)%60;return"".concat(e.getFullYear(),"-").concat(r(e.getMonth()+1),"-").concat(r(e.getDate()))+"T".concat(r(e.getHours()),":").concat(r(e.getMinutes()),":").concat(r(e.getSeconds()))+"".concat(n).concat(r(i),":").concat(r(o))}();if(e&&Object.keys(e).length>0)return Yp("[getPageContext] Using override: ".concat(JSON.stringify(e))),{url:e.url,path:e.path,title:e.title,referrer:e.referrer,attribution:null!==(t=e.attribution)&&void 0!==t?t:Uv(),localTime:n};if("undefined"==typeof window)return{localTime:n};var r=window.location.origin+window.location.pathname,i=vv(document.referrer);return{url:r,path:window.location.pathname,title:document.title||void 0,referrer:i,attribution:Uv(),localTime:n}}var qv=function(){function e(e,t){var n;if(this._userId="",this._sessionId="",this._accessToken="",this._debugMode=!1,this._attributes={},this.streamBuffer="",this.isInitializingSession=!1,this.isValidatingSession=!1,this.conversationOnScreen=!1,this.currentToolCalls=[],this.isReplaying=!1,this.isSleeping=!1,this.isRequestingReplay=!1,this.needsReplayOnWakeup=!1,this.userIdIsServerAssigned=!1,this.sentMessageCount=0,this.config=e,this.options=t,this.configurableMessages=null==t?void 0:t.configurableMessages,this.isNewSession=!1,this._debugMode=null!==(n=e.debugMode)&&void 0!==n&&n,this.hooks=null==t?void 0:t.hooks,"business_owner"===(e.mode||"homeowner")&&!e.authToken)throw new Error("authToken is required for business_owner mode");var r=function(){if("undefined"==typeof window||!window.localStorage)return{};try{return{userId:localStorage.getItem(Lv)||void 0,sessionId:localStorage.getItem(Dv)||void 0}}catch(e){return{}}}();r.userId&&(this._userId=r.userId,this.userIdIsServerAssigned=!0,Yp("[MCPChat] Loaded stored userId: ".concat(this._userId))),r.sessionId&&(this._sessionId=r.sessionId,Yp("[MCPChat] Loaded stored sessionId: ".concat(this._sessionId))),e.sessionId&&(this._sessionId=e.sessionId),this._sessionId&&(this.lastSeq=function(e){if("undefined"!=typeof window&&window.sessionStorage)try{var t=sessionStorage.getItem("xapp_mcp_lastSeq_".concat(e));return t?parseInt(t,10):void 0}catch(e){return}}(this._sessionId),void 0!==this.lastSeq&&Yp("[MCPChat] Loaded stored lastSeq: ".concat(this.lastSeq)))}return e.prototype.init=function(e){this.dispatch=e,this.sessionStartTime=Date.now();var t=this.config.mode||"homeowner";Yp("MCPChat initialized with mode: ".concat(t)),"business_owner"!==t||this.config.serverUrl.startsWith("https://")||Gp("WARNING: Using non-HTTPS URL with authentication tokens. This is insecure in production."),this.setConnectionStatus("online"),this.setAccountStatus("online"),this.userJoined(this.getBot(void 0))},e.prototype.validateSession=function(){return n(this,void 0,void 0,function(){var e,n;return r(this,function(r){switch(r.label){case 0:e=this.getEndpoint(),Yp("Validating existing session at ".concat(e,", sessionId: ").concat(this._sessionId)),this.isValidatingSession=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload(t({resumeSession:!0},this.conversationOnScreen&&{continueConversation:!0})))];case 2:return r.sent(),Yp("Session validation complete"),[3,5];case 3:return n=r.sent(),Gp("Failed to validate session: ".concat(n)),Tv(n)?(this.stopTyping(),this.sendFailureMessage(0,0,this.getErrorMessage(n,Nv)),[2]):(zv(this._sessionId),this._sessionId="",this.lastSeq=void 0,this.initializeNewSession(),[3,5]);case 4:return this.isValidatingSession=!1,[7];case 5:return[2]}})})},e.prototype.buildRequestPayload=function(e){return void 0===e&&(e={}),t(t({userId:this._userId||void 0,sessionId:this._sessionId||void 0,fingerprint:this.config.disableFingerprinting?void 0:"undefined"==typeof window?{}:{userAgent:navigator.userAgent,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenResolution:"".concat(window.screen.width,"x").concat(window.screen.height),platform:(n=navigator.userAgentData,(null==n?void 0:n.platform)?n.platform:navigator.platform||void 0),colorDepth:window.screen.colorDepth,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0},pageContext:Fv(this.config.pageContextOverride),channelId:this.config.channelId||void 0,clientTime:(new Date).toISOString(),lastSeq:this.lastSeq},this._debugMode&&{debug:!0}),e);var n},e.prototype.initializeNewSession=function(){return n(this,void 0,void 0,function(){var e,t,n,i,o=this;return r(this,function(r){switch(r.label){case 0:if(this._debugMode=null!==(i=this.config.debugMode)&&void 0!==i&&i,this.isInitializingSession)return Yp("New session initialization already in progress, skipping"),[2];e=this.getEndpoint(),Yp("Initializing new session at ".concat(e)),this.isInitializingSession=!0,this.sessionInitPromise=new Promise(function(e){o.resolveSessionInit=e}),this.typing(),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload({newSession:!0,generateGreeting:!0}))];case 2:return r.sent(),[3,5];case 3:return t=r.sent(),n=null==t?void 0:t.statusCode,Gp("Failed to initialize new session: ".concat(t,", statusCode: ").concat(n)),this.stopTyping(),_v(t)&&this.setConnectionStatus("offline"),this.sendFailureMessage(0,0,this.getErrorMessage(t,n)),[3,5];case 4:return this.isInitializingSession=!1,this.resolveSessionInit&&(this.resolveSessionInit(),this.resolveSessionInit=void 0),this.sessionInitPromise=void 0,[7];case 5:return[2]}})})},e.prototype.setConnectionStatus=function(e){Yp("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(xm(e))},e.prototype.setAccountStatus=function(e){Yp("SERVER: account_status: ".concat(JSON.stringify(e))),this.dispatch(wm(e))},e.prototype.getEndpointPaths=function(){return"business_owner"===(this.config.mode||"homeowner")?["/api/chat/stream","/api/chat/close"]:["/chat/stream","/chat/close"]},e.prototype.getBaseUrl=function(){for(var e=this.config.serverUrl.replace(/\/+$/,""),t=0,n=this.getEndpointPaths();t<n.length;t++){var r=n[t];if(e.endsWith(r))return e.slice(0,-r.length)}return e},e.prototype.getEndpoint=function(){return"".concat(this.getBaseUrl()).concat(this.getEndpointPaths()[0])},e.prototype.getCloseEndpoint=function(){return"".concat(this.getBaseUrl()).concat(this.getEndpointPaths()[1])},e.prototype.sendNewMessage=function(e,t){Yp("SERVER: new message: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.msg",user:t||this.getBot(void 0),msg:e,timestamp:+new Date}})},e.prototype.userJoined=function(e){Yp("SERVER: user joined: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:e,timestamp:+new Date}})},e.prototype.typing=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:this.getBot(void 0),typing:!0,timestamp:+new Date}})},e.prototype.stopTyping=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:this.getBot(void 0),typing:!1,timestamp:+new Date}})},e.prototype.sendFailureMessage=function(e,t,n){this.stopTyping(),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:this.getBot(void 0),failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.getRetryConfig=function(){var e,t;return(null===(t=null===(e=this.configurableMessages)||void 0===e?void 0:e.items)||void 0===t?void 0:t.length)>0?Rv(this.configurableMessages):Av},e.prototype.delay=function(e){return new Promise(function(t){return setTimeout(t,1e3*e)})},e.prototype.getErrorMessage=function(e,t){if(Tv(e))return e.serverMessage||Iv;if(t===Nv)return Iv;if(401===t)return"Authentication failed. Please check your credentials.";if(403===t)return"Access denied. You don't have permission to access this resource.";if(t&&t>=500)return"The server is experiencing issues. Please try again later.";if(404===t)return"Service not found. Please check your configuration.";if(e instanceof TypeError&&(e.message.includes("fetch")||e.message.includes("network")))return"Unable to connect to the server. Please check your internet connection.";if(e instanceof Error){var n=e.message.toLowerCase();if(n.includes("failed to fetch")||n.includes("network")||n.includes("econnrefused"))return"Unable to reach the server. Please try again later."}return"Something went wrong. Please try again."},e.prototype.dispatchStreamStart=function(e,t){var n=this.getBot(t),r=+new Date;Yp("[dispatchStreamStart] Stream started: ".concat(e,", timestamp: ").concat(r)),this.dispatch({type:"chat",detail:{type:"chat.stream.start",user:n,messageId:e,timestamp:r}})},e.prototype.dispatchStreamChunk=function(e,t,n){this.dispatch({type:"chat",detail:{type:"chat.stream.chunk",user:this.getBot(n),messageId:e,text:t,timestamp:+new Date}})},e.prototype.dispatchStreamEnd=function(e,n,r){void 0===r&&(r={});var i=r.toolCalls,o=r.user,a=r.preserveChips;Yp("Stream ended: ".concat(e)),this.dispatch({type:"chat",detail:t(t({type:"chat.stream.end",user:this.getBot(o),messageId:e,msg:n,toolCalls:i},a&&{preserveChips:a}),{timestamp:+new Date})})},e.prototype.dispatchStreamAbort=function(e){Yp("[dispatchStreamAbort] Stream aborted: ".concat(e)),this.dispatch({type:"chat",detail:{type:"chat.stream.abort",user:this.getBot(void 0),messageId:e,timestamp:Date.now()}})},e.prototype.dispatchStreamResume=function(e){Yp("[dispatchStreamResume] Stream resumed: ".concat(e)),this.dispatch({type:"chat",detail:{type:"chat.stream.resume",user:this.getBot(void 0),messageId:e,timestamp:Date.now()}})},e.prototype.dispatchToolStart=function(e){this.dispatch({type:"chat",detail:{type:"chat.stream.tool_start",user:this.getBot(void 0),messageId:e.messageId,toolName:e.toolName,toolCallId:e.toolCallId,displayName:e.displayName,label:e.label,hidden:e.hidden,toolInput:e.toolInput,timestamp:+new Date}})},e.prototype.dispatchToolEnd=function(e){this.dispatch({type:"chat",detail:{type:"chat.stream.tool_end",user:this.getBot(void 0),messageId:e.messageId,toolName:e.toolName,toolCallId:e.toolCallId,displayName:e.displayName,label:e.label,toolInput:e.toolInput,hidden:e.hidden,toolResult:e.toolResult,toolError:e.toolError,timestamp:+new Date}})},e.prototype.startStreamThrottle=function(e){var t=this;this.streamBuffer="",this.streamingMessageIdForThrottle=e,this.streamThrottleTimer&&clearInterval(this.streamThrottleTimer),this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.streamThrottleTimer=setInterval(function(){if(t.streamBuffer.length>0&&t.streamingMessageIdForThrottle){var e=Math.min(3,t.streamBuffer.length),n=t.streamBuffer.slice(0,e);t.streamBuffer=t.streamBuffer.slice(e),t.dispatchStreamChunk(t.streamingMessageIdForThrottle,n)}},30),this.visibilityHandler=function(){"visible"===document.visibilityState?(Yp("[Visibility] Tab became visible, buffer length: ".concat(t.streamBuffer.length,", messageId: ").concat(t.streamingMessageIdForThrottle)),t.streamBuffer.length>0&&t.streamingMessageIdForThrottle&&(Yp("[Visibility] Flushing ".concat(t.streamBuffer.length," chars to UI")),t.dispatchStreamChunk(t.streamingMessageIdForThrottle,t.streamBuffer),t.streamBuffer="")):Yp("[Visibility] Tab hidden")},document.addEventListener("visibilitychange",this.visibilityHandler)},e.prototype.bufferStreamText=function(e){this.streamBuffer+=e},e.prototype.flushStreamBufferSync=function(){this.streamBuffer.length>0&&this.streamingMessageIdForThrottle&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer="")},e.prototype.flushStreamBuffer=function(){return n(this,void 0,void 0,function(){var e,t;return r(this,function(n){switch(n.label){case 0:return this.streamBuffer.length>0&&this.streamingMessageIdForThrottle?"hidden"!==document.visibilityState?[3,1]:(Yp("[flushStreamBuffer] Tab hidden, dispatching remaining ".concat(this.streamBuffer.length," chars immediately")),this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer="",[3,5]):[3,5];case 1:e=0,t=100,n.label=2;case 2:return this.streamBuffer.length>0&&e<t?[4,new Promise(function(e){return setTimeout(e,30)})]:[3,4];case 3:return n.sent(),e++,[3,2];case 4:this.streamBuffer.length>0&&this.streamingMessageIdForThrottle&&(Yp("[flushStreamBuffer] Timeout waiting for buffer, dispatching remaining ".concat(this.streamBuffer.length," chars")),this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),n.label=5;case 5:return this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0),this.streamingMessageIdForThrottle=void 0,[2]}})})},e.prototype.stopStreamThrottle=function(){this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0),this.streamBuffer="",this.streamingMessageIdForThrottle=void 0},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("bargeOut is not supported in MCP mode")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("bargeIn is not supported in MCP mode")})})},e.prototype.ensureAgentNick=function(e){return e?e.startsWith("agent:")?e:"agent:".concat(e):"agent:robot"},e.prototype.getBot=function(e){var n,r=null===(n=this.options)||void 0===n?void 0:n.bot;if(!e){var i=r||{nick:"agent:robot",displayName:"Assistant"};return t(t({},i),{nick:this.ensureAgentNick(i.nick),isAI:!0})}return e.displayName&&e.nick&&e.avatarPath?t(t({},e),{nick:this.ensureAgentNick(e.nick),isAI:!0}):t(t({},e),{nick:this.ensureAgentNick(e.nick||(null==r?void 0:r.nick)),displayName:e.displayName||(null==r?void 0:r.displayName)||"Assistant",avatarPath:e.avatarPath||(null==r?void 0:r.avatarPath),isAI:!0})},e.prototype.sendChatMsgRequest=function(e,t){return n(this,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.postMessage(e)];case 1:return r.sent(),t(),[3,3];case 2:return n=r.sent(),t(n),[3,3];case 3:return[2]}})})},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var t,n,i,o,a,s,l,c,u,d,f,h,p,m,v;return r(this,function(r){switch(r.label){case 0:return(null===(m=null===(p=e.msg)||void 0===p?void 0:p.text)||void 0===m?void 0:m.trim())||""?this.isInitializingSession&&this.sessionInitPromise?(Yp("Waiting for session initialization to complete before sending message..."),t=new Promise(function(e){return setTimeout(function(){return e("timeout")},1e4)}),[4,Promise.race([this.sessionInitPromise,t])]):[3,2]:(Yp("Ignoring empty message"),[2]);case 1:if("timeout"===r.sent()||this.isInitializingSession)return Gp("Session initialization timed out"),this.sendFailureMessage(0,0,"Chat is not ready. Please try again."),[2];r.label=2;case 2:n=this.getRetryConfig(),i=(null===(v=e.msg)||void 0===v?void 0:v.text)||"",o=!1,a=0,r.label=3;case 3:if(!(a<n.length))return[3,14];s=a===n.length-1,l=n[a],Yp("MCP attempt ".concat(a+1,"/").concat(n.length," for message: ").concat(i)),this.typing(),r.label=4;case 4:return r.trys.push([4,6,,13]),[4,this.attemptSSERequest(e)];case 5:return r.sent(),o=!0,[3,14];case 6:return c=r.sent(),this.stopTyping(),u=null==c?void 0:c.statusCode,Gp("MCP attempt ".concat(a+1," failed: ").concat(c,", statusCode: ").concat(u)),Yp("[postMessage] Error details:",{error:c,statusCode:u,messageText:i,sessionId:this._sessionId}),u&&u>=400&&u<500?(Yp("Client error ".concat(u,", not retrying")),f=this.getErrorMessage(c,u),this.sendFailureMessage(0,0,f),[2]):(_v(c)&&this.setConnectionStatus("offline"),s?(d=null==c?void 0:c.statusCode,f=l.text||this.getErrorMessage(c,d),this.sendFailureMessage(0,0,f),[3,12]):[3,7]);case 7:return a>0||l.text?(h=n[a+1])&&h.delay>0?(this.sendFailureMessage(h.retry,h.delay,h.text),[4,this.delay(h.delay)]):[3,9]:[3,10];case 8:r.sent(),r.label=9;case 9:return[3,12];case 10:return(h=n[a+1])&&h.delay>0?[4,this.delay(h.delay)]:[3,12];case 11:r.sent(),r.label=12;case 12:return[3,13];case 13:return a++,[3,3];case 14:return o?this.sentMessageCount++:Yp("All MCP retry attempts exhausted"),[2]}})})},e.prototype.attemptSSERequest=function(e){return n(this,void 0,void 0,function(){var n,i,o,a;return r(this,function(r){return"/debug"===(n=(null===(a=e.msg)||void 0===a?void 0:a.text)||"").trim().toLowerCase()?(this._debugMode=!this._debugMode,i=this._debugMode?"Debug mode enabled":"Debug mode disabled",Yp("[attemptSSERequest] ".concat(i)),o="debug-".concat(Date.now()),this.dispatch({type:"chat",detail:{type:"chat.stream.end",user:this.getBot(void 0),messageId:o,msg:{text:i},timestamp:+new Date}}),[2]):(Yp('[attemptSSERequest] Sending message: "'.concat(n,'", userId: ').concat(this._userId,", sessionId: ").concat(this._sessionId)),[2,this.performSSERequest(this.buildRequestPayload(t({message:n},this.conversationOnScreen&&{continueConversation:!0})))])})})},e.prototype.performSSERequest=function(e){return n(this,void 0,void 0,function(){var o,a,s,l,c,u,d,f,h=this;return r(this,function(p){return o=this.getEndpoint(),Yp("SSE request to ".concat(o,": ").concat(JSON.stringify(e))),this.abortController&&(this.abortController.abort(),this.abortController=void 0),this.abortController=new AbortController,a=wv(),this.currentMessageId=a,s=a,c=[],u=!1,[2,new Promise(function(p,m){xv.fetchEventSource(o,{method:"POST",headers:t({"Content-Type":"application/json"},"business_owner"===(h.config.mode||"homeowner")&&h.config.authToken?{Authorization:"Bearer ".concat(h.config.authToken)}:{}),body:JSON.stringify(e),signal:h.abortController.signal,openWhenHidden:!0,onopen:function(e){return n(h,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return d=e.status,e.status!==Nv?[3,2]:[4,Pv(e)];case 1:throw n.sent();case 2:if(!e.ok)throw(t=new Error("HTTP error! status: ".concat(e.status))).statusCode=e.status,t;return Yp("SSE connection opened"),this.setConnectionStatus("online"),[2]}})})},onmessage:function(e){var t;if(h.currentMessageId===a){Yp("SSE event: ".concat(e.event,", data: ").concat(e.data));var n=e.event||"message",r={};try{r=JSON.parse(e.data)}catch(e){return void Yp("Failed to parse SSE data: ".concat(e))}switch(void 0!==r.seq&&null!==r.seq&&(h.lastSeq=r.seq,h._sessionId&&function(e,t){if("undefined"!=typeof window&&window.sessionStorage)try{sessionStorage.setItem("xapp_mcp_lastSeq_".concat(e),String(t))}catch(e){}}(h._sessionId,r.seq)),n){case"connected":Yp("[SSE] Connected event received, messageId: ".concat(a,", isReturningUser: ").concat(r.isReturningUser,", isReplay: ").concat(r.isReplay)),h.conversationOnScreen=!0,r.isReplay&&(h.isReplaying=!0),r.user&&(l=r.user),(r.userId||r.sessionId)&&(r.userId&&(h._userId=r.userId,h.userIdIsServerAssigned=!0),r.sessionId&&(h._sessionId=r.sessionId,h.dispatch(Mv(h._sessionId))),Bv(r.userId,r.sessionId),Yp("[SSE] Identity from connected - userId: ".concat(r.userId,", sessionId: ").concat(r.sessionId))),h.currentToolCalls=[],h.stopTyping(),r.isReplay?h.dispatchStreamResume(s):h.dispatchStreamStart(s,l),h.startStreamThrottle(s);break;case"session_resumed":Yp("[SSE] Session resumed, sessionId: ".concat(r.sessionId,", hasHistory: ").concat(r.hasHistory)),h.conversationOnScreen=!0,r.userId&&(h._userId=r.userId,h.userIdIsServerAssigned=!0),r.sessionId&&(h._sessionId=r.sessionId,h.dispatch(Mv(h._sessionId))),Bv(r.userId,r.sessionId),h.stopTyping();break;case"session_expired":Yp("[SSE] Session expired: ".concat(r.reason||"Session not found")),h.conversationOnScreen=!1,zv(h._sessionId),h._sessionId="",h.lastSeq=void 0,h.stopTyping(),h.stopStreamThrottle(),h.isValidatingSession=!1,h.initializeNewSession(),p();break;case"message_start":Yp("[SSE] message_start — splitting bubble, user: ".concat(null===(t=r.user)||void 0===t?void 0:t.displayName)),h.flushStreamBufferSync(),h.dispatchStreamEnd(s,{text:c.join("")},{toolCalls:h.config.debugMode||h._debugMode?i([],h.currentToolCalls,!0):void 0,user:l,preserveChips:!0}),h.currentToolCalls=[],s=wv(),c=[],l=r.user,h.dispatchStreamStart(s,l),h.startStreamThrottle(s);break;case"text":r.text&&(Yp("[SSE] Text chunk received (".concat(r.text.length," chars), chunks in this bubble: ").concat(c.length+1,", isReplay: ").concat(r.isReplay)),c.push(r.text),r.isReplay||h.isSleeping?h.dispatchStreamChunk(s,r.text,l):h.bufferStreamText(r.text));break;case"tool_start":if(Yp("Tool execution started: ".concat(r.toolName,", toolCallId: ").concat(r.toolCallId,", displayName: ").concat(r.displayName,", label: ").concat(r.label,", hidden: ").concat(r.hidden)),r.toolName){var o={name:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,input:r.toolInput,startTime:Date.now(),isExecuting:!0};h.currentToolCalls.push(o),h.dispatchToolStart({messageId:s,toolName:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,toolInput:r.toolInput})}break;case"tool_end":if(Yp("Tool execution ended: ".concat(r.toolName,", toolCallId: ").concat(r.toolCallId,", displayName: ").concat(r.displayName,", label: ").concat(r.label,", hidden: ").concat(r.hidden)),r.toolName)(o=h.currentToolCalls.find(function(e){return r.toolCallId?e.toolCallId===r.toolCallId:e.name===r.toolName&&e.isExecuting}))&&(o.result=r.toolResult,o.error=r.toolError,o.label=r.label,o.hidden=r.hidden,o.endTime=r.toolBatchDurationMs&&null!=o.startTime?o.startTime+r.toolBatchDurationMs:Date.now(),o.isExecuting=!1,r.toolInput&&(o.input=r.toolInput)),"toggle_debug"===r.toolName&&(h._debugMode=!h._debugMode),h.dispatchToolEnd({messageId:s,toolName:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,toolInput:r.toolInput,toolResult:r.toolResult,toolError:r.toolError});break;case"done":if(h.stopTyping(),r.response){r.response.sessionId&&(h._sessionId=r.response.sessionId,h.dispatch(Mv(h._sessionId)),Bv(void 0,r.response.sessionId));var d=c.join("");Yp("[SSE] Done event received. Chunks in this bubble: ".concat(c.length,", accumulated text length: ").concat(d.length)),Yp("[SSE] First 100 chars of accumulated: ".concat(d.substring(0,100)));var f=r.response.suggestions,v=null==f?void 0:f.map(function(e){return{label:e.title,actionUrl:e.url||""}});(null==v?void 0:v.length)&&Yp("[SSE] Suggestions: ".concat(v.length," items"));var g=r.response.sources;(null==g?void 0:g.length)&&Yp("[SSE] Sources: ".concat(g.length," items"));var y={text:d||(s!==a?"":r.response.response)||"",options:v,sources:g,displays:r.response.displays},b=h.config.debugMode||h._debugMode?i([],h.currentToolCalls,!0):void 0;h.flushStreamBuffer().then(function(){h.dispatchStreamEnd(s,y,{toolCalls:b,user:l}),h.currentToolCalls=[],p()})}else h.stopStreamThrottle(),p();break;case"replay_complete":h.isReplaying=!1,Yp("[SSE] Replay complete: replayed ".concat(r.replayedCount," events, currentSeq: ").concat(r.currentSeq));break;case"replay_partial":h.isReplaying=!1,Yp("[SSE] Replay partial: some events unavailable, oldestAvailableSeq: ".concat(r.oldestAvailableSeq));break;case"error":if(u=!0,h.stopTyping(),h.stopStreamThrottle(),Gp("SSE error: ".concat(r.error)),r.code===Ev){m(jv(r.error,Ov(r.retryAfter)));break}m(new Error(r.error||"Server error during processing"))}}else Yp("[SSE] Ignoring stale event for messageId: ".concat(a,", current: ").concat(h.currentMessageId))},onerror:function(e){if(h.currentMessageId===a&&!u){u=!0,h.isReplaying=!1,h.isSleeping?(Yp("[MCPChat] SSE error during sleep - will request replay on wakeup"),h.needsReplayOnWakeup=!0,h.streamingMessageIdForThrottle&&h.dispatchStreamAbort(s),h.stopStreamThrottle()):h.stopStreamThrottle(),f=e instanceof Error?e:new Error(String(e));var t=(null==e?void 0:e.statusCode)||d;t&&(f.statusCode=t),Gp("SSE connection error: ".concat(e))}throw e}}).catch(function(e){if(h.stopStreamThrottle(),u||h.currentMessageId!==a)m(f||e);else{var t=(null==e?void 0:e.statusCode)||d,n=e instanceof Error?e:new Error(String(e));t&&(n.statusCode=t),m(n)}})})]})})},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(e,n,r){this.visitorInfo=e,this._attributes=t({},this.visitorInfo.attributes),this.conversationOnScreen=!0===e.hasConversation;var i=new URL(window.location.href);(null==i?void 0:i.host.toLowerCase().startsWith("localhost"))?this._attributes.isLocal=!0:this._attributes.currentUrl=window.location.href,this._accessToken=this.visitorInfo.accessToken,this.startSession(n),this._sessionId?this.validateSession():this.initializeNewSession(),this.isInitializingSession&&this.typing(),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t(new Error("File upload not supported in MCP mode"))},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){this.stopStreamThrottle(),this.abortController&&(this.abortController.abort(),this.abortController=void 0)},e.prototype.sleep=function(){this.isSleeping=!0,this.streamingMessageIdForThrottle?(this.needsReplayOnWakeup=!1,Yp("[MCPChat] sleep() - stream in progress, keeping SSE connection alive"),this.streamBuffer.length>0&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0)):(this.stopStreamThrottle(),this.isReplaying=!1,this.abortController&&(this.abortController.abort(),this.abortController=void 0))},e.prototype.wakeup=function(){if(this.isSleeping=!1,this.streamingMessageIdForThrottle&&this.abortController)Yp("[MCPChat] wakeup() - stream still in progress, restarting throttle"),this.streamBuffer.length>0&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),this.startStreamThrottle(this.streamingMessageIdForThrottle);else if(this.needsReplayOnWakeup){if(this.needsReplayOnWakeup=!1,void 0!==this.lastSeq&&this._sessionId)return Yp("[MCPChat] wakeup() - connection lost during sleep, requesting replay"),void this.requestReplay();Gp("[MCPChat] wakeup() - cannot replay, missing lastSeq (".concat(this.lastSeq,") or sessionId (").concat(this._sessionId,")"))}this._sessionId&&(Yp("[MCPChat] Wakeup - session exists, lastSeq: ".concat(this.lastSeq)),this.setConnectionStatus("online"))},e.prototype.requestReplay=function(){return n(this,void 0,void 0,function(){var e,t;return r(this,function(n){switch(n.label){case 0:if(this.isRequestingReplay)return Yp("[MCPChat] Replay already in progress, skipping"),[2];this.isRequestingReplay=!0,this.typing(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload())];case 2:return n.sent(),Yp("[MCPChat] Replay request completed"),[3,5];case 3:return e=n.sent(),t=null==e?void 0:e.statusCode,Gp("[MCPChat] Replay request failed: ".concat(e,", statusCode: ").concat(t)),_v(e)&&this.setConnectionStatus("offline"),[3,5];case 4:return this.stopTyping(),this.isRequestingReplay=!1,[7];case 5:return[2]}})})},e.prototype.notifyDisconnecting=function(e){if(void 0===e&&(e="close_tab"),this._sessionId){var t=this.getCloseEndpoint(),n=JSON.stringify({sessionId:this._sessionId,userId:this._userId||void 0,reason:e,messageCount:this.sentMessageCount,durationMs:void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:0});if(Yp("[MCPChat] notifyDisconnecting: reason=".concat(e,", endpoint=").concat(t)),"widget_close"===e&&"undefined"!=typeof fetch){var r={"Content-Type":"application/json"};return this.config.authToken&&(r.Authorization="Bearer ".concat(this.config.authToken)),void fetch(t,{method:"POST",headers:r,body:n,keepalive:!0})}if("undefined"!=typeof navigator&&navigator.sendBeacon){var i=new Blob([n],{type:"application/json"});navigator.sendBeacon(t,i)}}},e.prototype.startSession=function(e){this.userIdIsServerAssigned?Yp("[startSession] Preserving server-assigned userId: ".concat(this._userId)):this.visitorInfo.visitorId?this._userId="".concat(this.visitorInfo.visitorId):this.visitorInfo.email?this._userId="mcp-widget-user-".concat(this.visitorInfo.email):this._userId||(this._userId="mcp-widget-user-".concat(wv())),e?(this._sessionId=e,Yp("Using provided session id: ".concat(this._sessionId))):""===e?(this._sessionId="mcp-widget-session-".concat(wv()),this.dispatch(Mv(this._sessionId)),Yp("Using generated session id: ".concat(this._sessionId))):!this._sessionId&&this.config.sessionId?(this._sessionId=this.config.sessionId,Yp("Using config session id: ".concat(this._sessionId))):this._sessionId?Yp("Keeping existing session id: ".concat(this._sessionId)):(this._sessionId="mcp-widget-session-".concat(wv()),this.dispatch(Mv(this._sessionId)),Yp("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0},Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},enumerable:!1,configurable:!0}),e}();function Hv(e){if(e)return"string"==typeof e?{displayText:e}:e}function Wv(e,n){var r,i,o,a,s,l,c,u,d;if(void 0===n&&(n=(new Date).getTime()),!e)return l;var f=Hv(e.outputSpeech),h=Hv(e.reprompt);return f&&(c=f.displayText,u=f.html),"TRANSFER_CALL"===e.system?l={type:"handOff",timestamp:n,handoffMessage:c,handoffTarget:null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.transferPhoneNumber,endSession:!1,user:void 0}:(null===(i=e.system)||void 0===i?void 0:i.startsWith("PERMISSION_"))?l=function(e,t){var n,r=function(e){switch(e){case"PERMISSION_EMAIL":return"EMAIL";case"PERMISSION_LOCATION_PRECISE":return"LOCATION_PRECISE";default:throw new Error("Unsupported permission: ".concat(e))}}(e.system),i=Hv(e.outputSpeech),o=e.data.permissionPrimerAccepted,a=e.data.permissionDenied;return{type:"permissionRequest",timestamp:t,msg:{text:null!==(n=null==i?void 0:i.displayText)&&void 0!==n?n:"".concat(e.data.permissionRequestTTSContext),permissionRequest:{time:t,type:r,approve:"object"==typeof o?Wv({outputSpeech:o}).msg:void 0,deny:"object"==typeof a?Wv({outputSpeech:a}).msg:void 0}},endSession:!1,user:void 0}}(e,n):(d=!h||!(h.displayText||h.ssml),l={type:"msg",timestamp:n,msg:{displays:e.displays,context:null===(a=null===(o=e.context)||void 0===o?void 0:o.active)||void 0===a?void 0:a.map(function(e){return e.name})},endSession:d,user:void 0},c&&!u&&(l.msg=t(t({},l.msg),{text:c})),u&&(l.msg=t(t({},l.msg),{html:u})),(null===(s=null==f?void 0:f.suggestions)||void 0===s?void 0:s.length)&&(l.msg.options=f.suggestions.map(function(e){return"string"==typeof e?e:{label:e.title,actionUrl:e.url}}))),l}var Vv=function(){function e(e,t){this._userId="",this._sessionId="",this._accessToken="",this._attributes={},this.config=e,this.options=t,this.configurableMessages=t.configurableMessages,this.isNewSession=!1,this.hooks=t.hooks}return e.prototype.init=function(e){this.dispatch=e,Yp("got init auth: ".concat(this.config.key)),this.setConnectionStatus("online"),this.setAccountStatus("online")},e.prototype.setConnectionStatus=function(e){Yp("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(xm(e))},e.prototype.setAccountStatus=function(e){Yp("SERVER: account_status: ".concat(JSON.stringify(e))),this.dispatch(wm(e))},e.prototype.sendNewMessage=function(e){Yp("SERVER: new message: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.msg",user:t(t({},e.user),{nick:"agent:robot"}),msg:e.msg,timestamp:+new Date}})},e.prototype.userJoined=function(e){Yp("SERVER: user joined: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:t(t({},e.user),{nick:"agent:robot"}),timestamp:+new Date}})},e.prototype.typing=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!0,timestamp:+new Date}})},e.prototype.stopTyping=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!1,timestamp:+new Date}})},e.prototype.sendFailureMessage=function(e,t,n){this.stopTyping(),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:{nick:"agent:robot"},failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeOut")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeIn")})})},e.prototype.getBot=function(e){var n,r=null===(n=this.options)||void 0===n?void 0:n.bot;return e?e.displayName&&e.nick&&e.avatarPath?e:t(t({},e),{nick:e.nick||r.nick||"Bot",displayName:e.displayName||r.displayName||"Bot",avatarPath:e.avatarPath||r.avatarPath}):r},e.prototype.sendChatMsgRequest=function(e,i){return n(this,void 0,void 0,function(){var n,o;return r(this,function(r){switch(r.label){case 0:return[4,this.postMessage(e)];case 1:return n=r.sent(),(null===(o=n.user)||void 0===o?void 0:o.displayName)||(n=t(t({},n),{user:this.getBot(n.user)})),this.sendNewMessage(n),i(),[2]}})})},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(e,n,r){this.visitorInfo=e,this._attributes=t({},this.visitorInfo.attributes);var i=new URL(window.location.href);(null==i?void 0:i.host.toLowerCase().startsWith("localhost"))?this._attributes.isLocal=!0:this._attributes.currentUrl=window.location.href;var o=vv(document.referrer);o&&(this._attributes.referrer=o),this._accessToken=this.visitorInfo.accessToken,this.userJoined({user:this.getBot(void 0),token:""}),this.startSession(n),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var i,o,a,s,l,c,u,d,f,h,p,m,v,g,y,b,w,x,k,S,C,_,E,N,I,T,j,O,P,R,M,A=this;return r(this,function(L){switch(L.label){case 0:o=this._userId,a=this._sessionId,s=this._accessToken,l=function(e,n){for(var r=e||{},i=t({},n),o=0,a=Object.entries(r);o<a.length;o++){var s=a[o],l=s[0],c=s[1];void 0!==c&&(i[l]=c)}return i}(this._attributes,hv()),(c=localStorage.getItem("xa_rwg_token"))&&(l.rwg_token=c),(u=localStorage.getItem("xa_merchant_id"))&&(l.merchant_id=u),(d=localStorage.getItem("xa_environment"))&&(l.environment=d),(f=localStorage.getItem("xa_enablePreferredTime"))&&(l.enablePreferredTime=f),(h=localStorage.getItem("xa_service"))&&(l.service=h),(p=localStorage.getItem("xa_origin"))&&(l.origin=p),dv(l),l.currentTime=(new Date).toISOString(),m=(new Date).getTime(),this.isNewSession&&!(null===(j=null==e?void 0:e.msg)||void 0===j?void 0:j.text)?i={type:"LAUNCH_REQUEST",rawQuery:null===(O=null==e?void 0:e.msg)||void 0===O?void 0:O.text,sessionId:a,userId:o,isNewSession:!0,intentId:"LaunchRequest",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l}:(v=null===(P=e.msg)||void 0===P?void 0:P.permissionRequest)?(e=t(t({},e),{msg:t(t({},e.msg),{permissionRequest:void 0})}),g=m-v.time>3e5,y=null===(R=e.msg.text)||void 0===R?void 0:R.toLowerCase(),b=!g,w={id:this._userId},g||("EMAIL"===v.type&&(x=function(e){var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())}(y),b=x,w.email=this.visitorInfo.email,w.name=this.visitorInfo.displayName,this.visitorInfo.email=y),"LOCATION_PRECISE"===v.type&&(b=!!e.msg.location,w.preciseLocation=e.msg.location?{coordinates:{latitude:e.msg.location.latitude,longitude:e.msg.location.longitude}}:void 0)),i={type:"PERMISSION_GRANT",rawQuery:e.msg.text,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,granted:b,userProfile:w,intentId:"PermissionGrant",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l}):i="custom"===e.type?t(t({},JSON.parse(e.payload)),{sessionId:this._sessionId,userId:this._userId,isNewSession:!1,platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l}):e.msg.token?{type:"OPTION_SELECT_REQUEST",token:e.msg.token,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,intentId:"OptionSelect",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l}:{type:"INTENT_REQUEST",rawQuery:e.msg.text,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,intentId:"NLU_RESULT_PLACEHOLDER",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l},Yp("Visitor says: ".concat(JSON.stringify(i,void 0,2))),k=Rv(this.configurableMessages),C=!1,_=function(e){S=e,C=!0},E=function(e,t){return n(A,void 0,void 0,function(){var n,i,o;return r(this,function(r){return n=k[e].retry,i=k[e].delay,o=k[e].text,Gp("POST failed: ".concat(t)),this.sendFailureMessage(n,i,o),S={errorText:""},[2,new Promise(function(e){setTimeout(e,1e3*i)})]})})},N=1,L.label=1;case 1:return N<k.length?(I=this.config.timeout||22e3,Yp("POST attempt ".concat(N," with timeout ").concat(I)),this.typing(),[4,new Dp({retries:1,timeout:I}).fetch(function(e){return function(e,t,i,o){return n(this,void 0,void 0,function(){var n,a;return r(this,function(r){switch(r.label){case 0:return n=JSON.stringify(e),Yp("URL: ".concat(t)),Yp("BODY: ".concat(n)),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i)},body:n,mode:"cors",signal:o})];case 1:if(!(a=r.sent()).ok)throw new Error("Status ".concat(a.status,", Text: ").concat(a.statusText));return[2,a.json()]}})})}(i,A.config.url,A.config.key,e)}).then(_).catch(E.bind(this,N))]):[3,4];case 2:if(L.sent(),C)return[3,4];L.label=3;case 3:return N++,[3,1];case 4:return Yp("Bot says: ".concat(JSON.stringify(S,void 0,2))),this.isNewSession=!1,T=Wv(S),!(null==S?void 0:S.hasOwnProperty("errorText"))&&S||((T={type:"userLeft",timestamp:m,msg:{},user:void 0,endSession:!0}).msg={text:(null==S?void 0:S.hasOwnProperty("errorText"))?S.errorText:"The assistant is not responding right now. Please close the widget and open it again."}),"function"==typeof(null===(M=this.hooks)||void 0===M?void 0:M.onResponse)&&this.hooks.onResponse(S),this.stopTyping(),[2,T]}})})},e.prototype.startSession=function(e){this.visitorInfo.visitorId?this._userId="".concat(this.visitorInfo.visitorId):this.visitorInfo.email?this._userId="stentor-widget-user-".concat(this.visitorInfo.email):this._userId="stentor-widget-user-".concat(wv()),e?(this._sessionId=e,Yp("Using persisted session id: ".concat(this._sessionId))):(this._sessionId="stentor-widget-session-".concat(wv()),this.dispatch(Mv(this._sessionId)),Yp("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0},Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},enumerable:!1,configurable:!0}),e}();var $v=function(){function e(){}return e.prototype.init=function(){},e.prototype.sendOfflineMsg=function(){},e.prototype.sendChatMsg=function(){},e.prototype.sendChatMsgRequest=function(){},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(){},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(){},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){},e.prototype.bargeOut=function(){},e.prototype.bargeIn=function(){},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e}();function Kv(e,n,r,i,o,a,s){var l,c,u,d,f,h,p=(new Date).getTime();if(r&&!(null===(l=null==e?void 0:e.msg)||void 0===l?void 0:l.text))h={type:"LAUNCH_REQUEST",rawQuery:null===(c=null==e?void 0:e.msg)||void 0===c?void 0:c.text,sessionId:i,userId:n,isNewSession:!0,intentId:"LaunchRequest",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a};else{var m=null===(u=e.msg)||void 0===u?void 0:u.permissionRequest;if(m){e=t(t({},e),{msg:t(t({},e.msg),{permissionRequest:void 0})});var v=p-m.time>3e5,g=null===(d=e.msg.text)||void 0===d?void 0:d.toLowerCase(),y=!v,b={id:n};if(!v){if("EMAIL"===m.type){var w=function(e){var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())}(g);y=w,b.email=s.email,b.name=s.displayName,this.visitorInfo.email=g}"LOCATION_PRECISE"===m.type&&(y=!!e.msg.location,b.preciseLocation=e.msg.location?{coordinates:{latitude:e.msg.location.latitude,longitude:e.msg.location.longitude}}:void 0)}h={type:"PERMISSION_GRANT",rawQuery:e.msg.text,sessionId:i,userId:n,isNewSession:!1,granted:y,userProfile:b,intentId:"PermissionGrant",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a}}else h="custom"===e.type?t(t({},JSON.parse(e.payload)),{sessionId:i,userId:n,isNewSession:!1,platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a}):e.msg.token?{type:"OPTION_SELECT_REQUEST",token:e.msg.token,sessionId:i,userId:n,isNewSession:!1,intentId:"OptionSelect",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a}:{type:"INTENT_REQUEST",rawQuery:e.msg.text,sessionId:i,userId:n,isNewSession:!1,intentId:"NLU_RESULT_PLACEHOLDER",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a}}return(null===(f=e.msg)||void 0===f?void 0:f.attributes)&&(h.attributes=t(t({},h.attributes),e.msg.attributes)),h}var Qv="router",Jv={deviceId:"Router",userId:Qv,displayName:"XAPP Server"},Yv=function(){function e(e,t){var n,r,i,o,a;this.isDisposed=!1,this._userId="",this._sessionId="",this.accessToken="",this.attributes={},this.routerAttributes={},this.isAdmin=!1,this.urlAttributes={},this.handlers={},this.sleepTimeoutId=null,this.receivedMessageIds=new Set,this.MESSAGE_DEDUP_CACHE_SIZE=1e3,this.config=e,this.options=t;var s=new URL(this.config.url);this.appId=s.searchParams.get("appId");var l=new URL(window.location.href);if(this.isAdmin="true"===l.searchParams.get("isAdmin"),this.appId)this.serverUrl=this.config.url,this.urlAttributes.path=null===(n=s.pathname)||void 0===n?void 0:n.split("/");else{this.serverUrl="".concat(s.origin);var c=null===(r=s.pathname)||void 0===r?void 0:r.split("/");c&&c.length>1&&(this.serverUrl="".concat(this.serverUrl,"/").concat(c[1]),this.urlAttributes.path=c.slice(1))}Yp("WS url: ".concat(this.serverUrl," isAdmin: ").concat(this.isAdmin," attributes: ").concat(JSON.stringify(this.attributes)," appId: ").concat(this.appId)),this.configurableMessages=Rv(t.configurableMessages),this.noOfServerErrors=0,this.SLEEP_DELAY_MS=null!==(a=null===(o=null===(i=null==t?void 0:t.env)||void 0===i?void 0:i.connection)||void 0===o?void 0:o.backgroundSleepDelay)&&void 0!==a?a:6e4,Yp("Background sleep delay set to ".concat(this.SLEEP_DELAY_MS,"ms"))}return e.prototype.init=function(e){var n,r,i=this;this.dispatch=e,Yp("INIT called - setting initial accountStatus to OFFLINE"),this.setAccountStatus("offline"),this.handlers["connection update"]=function(e,t,n,r){Yp("Connection update received. Session created: ".concat(e.sessionCreated," Error: ").concat(e.errorMessage||"")),e.sessionCreated?(i.sessionCreated=!0,i.setConnectionStatus("online")):(Gp("SERVER: something is wrong. Going offline."),i.dispatch(wm("offline")),i.dispatch(xm("offline")))},this.handlers["account status"]=function(t,n,r,i){e({type:"account_status",detail:{status:"online",timestamp:r||(new Date).getTime()}})},this.handlers.failure=function(e,t,n,r){Gp("SERVER: something's failed: type: ".concat(e.type," tries: ").concat(e.tries," error: ").concat(e.error));var o=i.configurableMessages[e.tries],a=o.retry,s=o.delay,l=o.text;i.sendFailureMessage(a,e.delay||s,l,t)},this.handlers["new message"]=function(e,n,r,o,a){var s,l;if(a){if(a.length>256)return void Yp("Rejecting message with oversized messageId (".concat(a.length," chars)"));if(i.receivedMessageIds.has(a))return void Yp("Deduplicating message with id: ".concat(a));if(i.receivedMessageIds.add(a),i.receivedMessageIds.size>i.MESSAGE_DEDUP_CACHE_SIZE)for(var c=Math.floor(.1*i.MESSAGE_DEDUP_CACHE_SIZE),u=i.receivedMessageIds.values(),d=0;d<c;d++){var f=u.next().value;f&&i.receivedMessageIds.delete(f)}}if("Bot"===n.deviceId){var h=e;o&&"object"==typeof o&&Object.keys(o).length>0&&(i.routerAttributes=t({},o),Yp("Extracted router attributes: ".concat(JSON.stringify(i.routerAttributes)))),"function"==typeof(null===(s=i.options.hooks)||void 0===s?void 0:s.onResponse)&&i.options.hooks.onResponse(h),i.isNewSession&&(i.isNewSession=!1,Yp("Session initialized after receiving first bot response")),l=Wv(h)}else"Widget"===n.deviceId?l=function(e,t){if(void 0===t&&(t=(new Date).getTime()),e)return{type:"msg",timestamp:t,msg:{text:e.rawQuery},endSession:!1,user:void 0}}(e):Gp("Unknown sender device Id: ".concat(n.deviceId));i.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:n.displayName||n.email||n.userId,nick:Gv(n),avatarPath:n.avatarPath},msg:l.msg,timestamp:r||(new Date).getTime()}})},this.handlers["user joined"]=function(e,t,n,r){var o,a,s=Gv(t);Yp('Received "user joined" event - deviceId: '.concat(t.deviceId,", userId: ").concat(t.userId,", displayName: ").concat(t.displayName,", nick: ").concat(s)),Yp("Dispatching chat.memberjoin for ".concat(t.displayName||"Unknown"));var l=e;i.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{avatarPath:t.avatarPath||(null===(a=null===(o=i.options)||void 0===o?void 0:o.bot)||void 0===a?void 0:a.avatarPath),displayName:t.displayName,nick:s},timestamp:n||(new Date).getTime(),showDivider:null==l?void 0:l.showDivider,message:null==l?void 0:l.message,hideUserInfo:null==l?void 0:l.hideUserInfo}}),Yp("chat.memberjoin dispatched for nick: ".concat(s))},this.handlers["user left"]=function(e,t,n,r){var o=e;i.dispatch({type:"chat",detail:{type:"chat.memberleave",user:{avatarPath:t.avatarPath,displayName:t.displayName,nick:Gv(t)},timestamp:n||(new Date).getTime(),showDivider:null==o?void 0:o.showDivider,message:null==o?void 0:o.message}})},this.handlers.typing=function(e,t,n,r){i.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:Gv(t)},typing:!0,timestamp:n||(new Date).getTime()}})},this.handlers["stop typing"]=function(e,t,n,r){i.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:Gv(t)},typing:!1,timestamp:n||(new Date).getTime()}})},this.handlers.disconnect=function(){Yp("DISCONNECT event received from server"),Gp("SERVER: requested disconnect"),i.dispatch(wm("offline")),i.dispatch(xm("offline"))},this.handlers.reconnect=function(){i.dispatch(wm("online")),i.dispatch(xm("online"))},this.handlers["reconnect failed"]=function(e){Gp("SERVER: says re-connect failed"),i.dispatch(wm("offline")),i.dispatch(xm("offline"))},this.handlers["reconnect error"]=function(e){Gp("SERVER: says there was an error while re-connecting"),i.dispatch(wm("offline"))},this.handlers["display button"]=function(e,t,n,r){Yp('Received "display button" event - id: '.concat(e.id,", text: ").concat(e.text,", pressBehavior: ").concat(e.pressBehavior)),i.dispatch(km({id:e.id,text:e.text,pressBehavior:e.pressBehavior||"none"}))},this.handlers["dismiss button"]=function(e,t,n,r){Yp('Received "dismiss button" event - id: '.concat(e.id)),i.dispatch(km({id:e.id,text:"",pressBehavior:"none",isDismissing:!0})),setTimeout(function(){i.dispatch({type:"ws_button_dismiss",detail:{id:e.id,timestamp:+new Date}})},300)},this.handlers["system-message"]=function(e,t,n,r){Yp('Received "system-message" event - id: '.concat(e.id,", message: ").concat(e.message,", dismissId: ").concat(e.dismissId)),e.dismissId&&i.dispatch({type:"chat",detail:{type:"chat.systemmessagedismiss",user:{displayName:t.displayName||"System",nick:Gv(t)},id:e.dismissId,timestamp:n||(new Date).getTime()}}),i.dispatch({type:"chat",detail:{type:"chat.systemmessage",user:{displayName:t.displayName||"System",nick:Gv(t)},id:e.id,message:e.message,dismissId:e.dismissId,timestamp:n||(new Date).getTime()}})},this.handlers["system-message-dismiss"]=function(e,t,n,r){Yp('Received "system-message-dismiss" event - id: '.concat(e.id)),i.dispatch({type:"chat",detail:{type:"chat.systemmessagedismiss",user:{displayName:t.displayName||"System",nick:Gv(t)},id:e.id,timestamp:n||(new Date).getTime()}})},this.handlers["missed messages"]=function(e,t,n,r){var o,a=e;Yp('Received "missed messages" event with '.concat((null===(o=null==a?void 0:a.messages)||void 0===o?void 0:o.length)||0," messages")),(null==a?void 0:a.messages)&&Array.isArray(a.messages)&&a.messages.forEach(function(e){Yp("Processing missed message: event=".concat(e.event,", messageId=").concat(e.messageId));var t=i.handlers[e.event];t&&"missed messages"!==e.event?t(e.data,e.sender,e.timeMs,e.attributes,e.messageId):Yp("No handler for missed message event: ".concat(e.event))})},this.handlers["request missed messages"]=function(){Yp("Request missed messages handler (no-op on client side)")},this.handlers["user backgrounded"]=function(){Yp("User backgrounded handler (no-op on client side)")},this.handlers["user foregrounded"]=function(){Yp("User foregrounded handler (no-op on client side)")},this.handlers["user disconnecting"]=function(){Yp("User disconnecting handler (no-op on client side)")},this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{avatarPath:null===(r=null===(n=this.options)||void 0===n?void 0:n.bot)||void 0===r?void 0:r.avatarPath,displayName:Jv.displayName,nick:Gv(Jv)},timestamp:(new Date).getTime()}}),this.setAccountStatus("online"),this.setConnectionStatus("online")},e.prototype.autoReconnect=function(e){var t=this;0===this.noOfServerErrors&&this.setConnectionStatus("pending");var n=this.setAccountStatus.bind(this),r=this.setConnectionStatus.bind(this);function i(){var t=setInterval(function(){var o=e();o?(Yp("Re-created WS connection"),o.onopen=function(){Yp("Re-opened WS connection"),n("online"),r("online"),o.onclose=function(){Yp("WebSocket ONCLOSE event - connection closed unexpectedly"),Yp("Closed WS connection (onclosed was called)"),i()},clearInterval(t)}):clearInterval(t)},5e3)}Yp("Creating WS connection");var o=e();o&&(o.onclose=function(){Yp("WebSocket ONCLOSE event (initial) - connection closed"),Yp("Closed WS connection (onclosed was called)"),i()},this.ws.onopen=function(){Yp("WebSocket ONOPEN event - connection established"),Yp("Opened WS connection (onopen was called)"),t.setAccountStatus("online"),t.setConnectionStatus("online")})},e.prototype.wsClose=function(){this.ws&&(Yp("wsClose() - Closing WebSocket (readyState: ".concat(this.ws.readyState,")")),this.ws.onclose=null,this.ws.onerror=null,this.ws.onopen=null,this.ws.onmessage=null,this.ws.close())},e.prototype.wsCreate=function(e){var t=this;if(!this.isDisposed){Yp('Trying to re-connect. Reason: "'.concat(e,'"'));var n=new URL(this.serverUrl);if(n.searchParams.set("userId",this._userId),n.searchParams.set("isAdmin","".concat(this.isAdmin)),n.searchParams.set("createWsReason",e),this.ws&&this.ws.readyState!==WebSocket.CLOSED&&this.ws.readyState!==WebSocket.CLOSING){var r=this.ws.readyState;Yp("Forced WS close. State: ".concat(r));try{this.wsClose()}catch(e){e("Failed to close WS (ready state: ".concat(r,"): ").concat(e))}}return this.ws=new WebSocket(n.toString()),this.ws.onerror=function(e){var r;Gp("Error in WS connection. Url: ".concat(n.toString()," Type: ").concat(e?e.type:"?"," Ready State: ").concat(null===(r=t.ws)||void 0===r?void 0:r.readyState))},this.ws.onmessage=function(e){Yp("ROUTER says: ".concat(e.data));var n=JSON.parse(e.data);t.handlers[n.event]?t.handlers[n.event](n.data,n.sender,n.timeMs,n.attributes,n.messageId):Gp("Unknown router message event: ".concat(n.event))},this.ws}Yp("Stopping reconnect for disposed router connector")},e.prototype.checkConnection=function(){var e;return(null===(e=this.ws)||void 0===e?void 0:e.readyState)===WebSocket.OPEN},e.prototype.emit=function(e,t){return n(this,void 0,void 0,function(){var n,i,o=this;return r(this,function(r){switch(r.label){case 0:return n={event:e,data:t,sender:this.visitorInfo,sessionId:this._sessionId,timeMs:(new Date).getTime()},this.routerAttributes&&Object.keys(this.routerAttributes).length>0&&(n.attributes=this.routerAttributes,Yp("Adding router attributes to outgoing payload: ".concat(JSON.stringify(this.routerAttributes)))),i=JSON.stringify(n),Yp("Widget says: ".concat(i)),this.ws||this.autoReconnect(this.wsCreate.bind(this,"emitNoWs")),[4,Xv(this.checkConnection.bind(this),1e3,1e4,"connection").then(function(e){e>0&&Yp("Connection is ready in ".concat(e," ms")),o.ws.send(i),o.noOfServerErrors=0}).catch(function(e){Gp("Connection wait timed out in ".concat(e," ms (show error)")),o.setConnectionStatus("online")})];case 1:return r.sent(),[2]}})})},e.prototype.setAccountStatus=function(e){Yp("setAccountStatus: ".concat(e)),Yp("SERVER account_status: ".concat(JSON.stringify(e))),this.dispatch(wm(e))},e.prototype.setConnectionStatus=function(e){Yp("setConnectionStatus: ".concat(e)),Yp("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(xm(e))},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.sendFailureMessage=function(e,t,n,r){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:Gv(r)},typing:!1,timestamp:+new Date}}),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:{nick:Gv(r)},failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.sendDisconnectMessage=function(){this.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:"Server",nick:Gv(Jv),avatarPath:Jv.avatarPath},msg:{text:0===this.noOfServerErrors?"I cannot connect to the server. Please try later.":"Nope. Still no luck. I still cannot connect to the server. Please don't give up."},timestamp:(new Date).getTime()}}),this.noOfServerErrors++},e.prototype.checkSession=function(){return this.sessionCreated},e.prototype.sendChatMsgRequest=function(e,t){return n(this,void 0,void 0,function(){var n=this;return r(this,function(r){switch(r.label){case 0:return this.checkSession()||this.setConnectionStatus("pending"),[4,Xv(this.checkSession.bind(this),1e3,1e4,"session creation").then(function(t){t>0&&Yp("Session creation is ready in ".concat(t," ms")),n.postMessage(e)}).catch(function(e){Gp("Session creation wait timed out in ".concat(e," ms")),n.setConnectionStatus("online"),n.sendDisconnectMessage()})];case 1:return r.sent(),this.setConnectionStatus("online"),t(),[2]}})})},e.prototype.sendTyping=function(e){},e.prototype.setVisitorInfo=function(e,n,r){Yp("Visitor Info Message = ".concat(JSON.stringify(e))),this.visitorInfo={deviceId:"Widget",userId:e.userId,displayName:e.displayName||e.name,email:e.email,isAdmin:this.isAdmin,urlAttributes:this.urlAttributes},this.attributes=t(t(t({},e.attributes),this.attributes),{currentUrl:window.location.href}),this.accessToken=e.accessToken,this.startSession(n),this.postVisitorInfo(),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){Yp("DISPOSE called - cleaning up connection"),this.isDisposed=!0,this.sleepTimeoutId&&(clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null),this.ws&&this.wsClose(),Yp("Closed web socket (dispose)")},e.prototype.sleep=function(){var e=this;Yp("SLEEP called - scheduling delayed close"),this.checkConnection()&&(Yp("SLEEP - Notifying router of user backgrounded"),this.emit("user backgrounded")),this.sleepTimeoutId&&(clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null),this.sleepTimeoutId=window.setTimeout(function(){e.ws&&e.wsClose(),Yp("SLEEP - closed web socket after ".concat(e.SLEEP_DELAY_MS,"ms delay")),e.sleepTimeoutId=null},this.SLEEP_DELAY_MS),Yp("SLEEP - WebSocket will close in ".concat(this.SLEEP_DELAY_MS,"ms if not woken up"))},e.prototype.wakeup=function(){var e=this;if(Yp("WAKEUP called - userId:",this._userId),this.sleepTimeoutId)return clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null,Yp("WAKEUP - Cancelled pending sleep, keeping WebSocket open"),void(this.checkConnection()&&(Yp("WAKEUP - Notifying router of user foregrounded"),this.emit("user foregrounded")));this.isDisposed=!1,this._userId?(Yp("WAKEUP - Setting accountStatus and connectionStatus to ONLINE"),this.setAccountStatus("online"),this.setConnectionStatus("online"),Yp("Waking up - setting status to online"),Yp("WAKEUP - Calling autoReconnect"),this.autoReconnect(this.wsCreate.bind(this,"wakeup")),Xv(this.checkConnection.bind(this),100,5e3,"wakeup-connection").then(function(){Yp("WAKEUP - Notifying router of user foregrounded (after reconnect)"),e.emit("user foregrounded"),e.requestMissedMessages()}).catch(function(){Yp("WAKEUP - Connection not ready after 5s, skipping missed messages request")})):Yp("WAKEUP - No userId, returning early")},e.prototype.requestMissedMessages=function(){Yp("Requesting missed messages from server"),this.emit("request missed messages")},e.prototype.notifyDisconnecting=function(){if(this.checkConnection()){Yp("Notifying router of user disconnecting");var e=JSON.stringify({event:"user disconnecting",data:{reason:"tab_close"},sender:this.visitorInfo,sessionId:this._sessionId,timeMs:Date.now()});try{this.ws.send(e)}catch(e){Yp("Failed to send disconnect notification:",e)}}},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){return this.emit("barge out"),[2]})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(t){return this.visitorInfo.displayName=e,this.emit("barge in"),[2]})})},e.prototype.sendButtonPressed=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return Yp('Sending "button pressed" event - id: '.concat(e)),t={id:e},this.emit("button pressed",t),[2]})})},e.prototype.postVisitorInfo=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return this.sessionCreated=!1,this.emit("user joined"),[2]})})},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var t,n,i,o,a,s,l,c,u,d,f;return r(this,function(r){return t=this._userId,n=this._sessionId,i=this.accessToken,o=this.attributes||{},(a=localStorage.getItem("xa_rwg_token"))&&(o.rwg_token=a),(s=localStorage.getItem("xa_merchant_id"))&&(o.merchant_id=s),(l=localStorage.getItem("xa_environment"))&&(o.environment=l),(c=localStorage.getItem("xa_enablePreferredTime"))&&(o.enablePreferredTime=c),(u=localStorage.getItem("xa_service"))&&(o.service=u),(d=localStorage.getItem("xa_origin"))&&(o.origin=d),dv(o),o.currentTime=(new Date).toISOString(),f=Kv(e,t,this.isNewSession,n,i,o,this.visitorInfo),this.emit("new message",f),[2]})})},e.prototype.startSession=function(e){this.visitorInfo.userId?this._userId="".concat(this.visitorInfo.userId):this.visitorInfo.email?this._userId="stentor-widget-user-".concat(this.visitorInfo.email):this._userId="stentor-widget-user-".concat(wv());var t=new URL(window.location.href).searchParams.get("sessionId");t?(this._sessionId=t,this.dispatch(Mv(this._sessionId)),Yp("Using enforced session id: ".concat(this._sessionId))):e?(this._sessionId=e,Yp("Using persisted session id: ".concat(this._sessionId))):(this._sessionId="stentor-widget-session-".concat(wv()),this.dispatch(Mv(this._sessionId)),Yp("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0,Yp("Started session: ".concat(this._sessionId))},e}();function Gv(e){return"Bot"===e.deviceId?"agent:bot:".concat(e.userId):"agent:widget:".concat(e.userId)}function Xv(e,t,n,r){var i=0,o=function(a,s){i>=n?s(i):e()?a(i):(i+=t,r&&Yp("Still waiting for ".concat(r," (").concat(i," ms)")),setTimeout(function(e){return o(a,s)},t))};return new Promise(o)}const Zv=Object.create(null);Zv.open="0",Zv.close="1",Zv.ping="2",Zv.pong="3",Zv.message="4",Zv.upgrade="5",Zv.noop="6";const eg=Object.create(null);Object.keys(Zv).forEach(e=>{eg[Zv[e]]=e});const tg={type:"error",data:"parser error"},ng="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),rg="function"==typeof ArrayBuffer,ig=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,og=({type:e,data:t},n,r)=>ng&&t instanceof Blob?n?r(t):ag(t,r):rg&&(t instanceof ArrayBuffer||ig(t))?n?r(t):ag(new Blob([t]),r):r(Zv[e]+(t||"")),ag=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function sg(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let lg;const cg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ug="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)ug[cg.charCodeAt(e)]=e;const dg="function"==typeof ArrayBuffer,fg=(e,t)=>{if("string"!=typeof e)return{type:"message",data:pg(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:hg(e.substring(1),t)};return eg[n]?e.length>1?{type:eg[n],data:e.substring(1)}:{type:eg[n]}:tg},hg=(e,t)=>{if(dg){const n=(e=>{let t,n,r,i,o,a=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const c=new ArrayBuffer(a),u=new Uint8Array(c);for(t=0;t<s;t+=4)n=ug[e.charCodeAt(t)],r=ug[e.charCodeAt(t+1)],i=ug[e.charCodeAt(t+2)],o=ug[e.charCodeAt(t+3)],u[l++]=n<<2|r>>4,u[l++]=(15&r)<<4|i>>2,u[l++]=(3&i)<<6|63&o;return c})(e);return pg(n,t)}return{base64:!0,data:e}},pg=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,mg=String.fromCharCode(30);function vg(){return new TransformStream({transform(e,t){!function(e,t){ng&&e.data instanceof Blob?e.data.arrayBuffer().then(sg).then(t):rg&&(e.data instanceof ArrayBuffer||ig(e.data))?t(sg(e.data)):og(e,!1,e=>{lg||(lg=new TextEncoder),t(lg.encode(e))})}(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let gg;function yg(e){return e.reduce((e,t)=>e+t.length,0)}function bg(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let 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}var wg=xg;function xg(e){if(e)return function(e){for(var t in xg.prototype)e[t]=xg.prototype[t];return e}(e)}xg.prototype.on=xg.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},xg.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},xg.prototype.off=xg.prototype.removeListener=xg.prototype.removeAllListeners=xg.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},xg.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},xg.prototype.emitReserved=xg.prototype.emit,xg.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},xg.prototype.hasListeners=function(e){return!!this.listeners(e).length};const kg="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Sg="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function Cg(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const _g=Sg.setTimeout,Eg=Sg.clearTimeout;function Ng(e,t){t.useNativeTimers?(e.setTimeoutFn=_g.bind(Sg),e.clearTimeoutFn=Eg.bind(Sg)):(e.setTimeoutFn=Sg.setTimeout.bind(Sg),e.clearTimeoutFn=Sg.clearTimeout.bind(Sg))}function Ig(e){return"string"==typeof e?function(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}(e):Math.ceil(1.33*(e.byteLength||e.size))}function Tg(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class jg extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class Og extends wg{constructor(e){super(),this.writable=!1,Ng(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 jg(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=fg(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(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class Pg extends Og{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const 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,t)=>{const n=e.split(mg),r=[];for(let e=0;e<n.length;e++){const i=fg(n[e],t);if(r.push(i),"error"===i.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((e,o)=>{og(e,!1,e=>{r[o]=e,++i===n&&t(r.join(mg))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Tg()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let Rg=!1;try{Rg="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Gp){}const Mg=Rg;function Ag(){}class Lg extends Pg{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const 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}}class Dg extends wg{constructor(e,t,n){super(),this.createRequest=e,Ng(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=Cg(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=Dg.requestsCount++,Dg.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=Ag,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Dg.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Dg.requestsCount=0,Dg.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",Bg);else if("function"==typeof addEventListener){addEventListener("onpagehide"in Sg?"pagehide":"unload",Bg,!1)}function Bg(){for(let e in Dg.requests)Dg.requests.hasOwnProperty(e)&&Dg.requests[e].abort()}const zg=function(){const e=Ug({xdomain:!1});return e&&null!==e.responseType}();function Ug(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Mg))return new XMLHttpRequest}catch(e){}if(!t)try{return new(Sg[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Fg="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class qg extends Og{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Fg?{}:Cg(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++){const n=e[t],r=t===e.length-1;og(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&kg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Tg()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Hg=Sg.WebSocket||Sg.MozWebSocket;const Wg={websocket:class extends qg{createSocket(e,t,n){return Fg?new Hg(e,t,n):t?new Hg(e,t):new Hg(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends Og{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=>{const t=function(e,t){gg||(gg=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,s){for(n.push(a);;){if(0===r){if(yg(n)<1)break;const e=bg(n,1);o=!(128&~e[0]),i=127&e[0],r=i<126?3:126===i?1:2}else if(1===r){if(yg(n)<2)break;const e=bg(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(yg(n)<8)break;const e=bg(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){s.enqueue(tg);break}i=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(yg(n)<i)break;const e=bg(n,i);s.enqueue(fg(o?e:gg.decode(e),t)),r=0}if(0===i||i>e){s.enqueue(tg);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=vg();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&kg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends Lg{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=zg&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Dg(Ug,this.uri(),e)}}},Vg=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,$g=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Kg(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=Vg.exec(e||""),o={},a=14;for(;a--;)o[$g[a]]=i[a]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const Qg="function"==typeof addEventListener&&"function"==typeof removeEventListener,Jg=[];Qg&&addEventListener("offline",()=>{Jg.forEach(e=>e())},!1);class Yg extends wg{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=Kg(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Kg(t.host).host);Ng(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const 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?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(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}(this.opts.query)),Qg&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Jg.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const 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(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&Yg.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}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",Yg.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)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":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}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(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const 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,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=Ig(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,kg(()=>{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("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const 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"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(Yg.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Qg&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=Jg.indexOf(this._offlineEventListener);-1!==e&&Jg.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Yg.protocol=4;class Gg extends Yg{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&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;Yg.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Yg.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function i(){n||(n=!0,c(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,i(),this.emitReserved("upgradeError",n)};function a(){o("transport closed")}function s(){o("socket closed")}function l(e){t&&e.name!==t.name&&i()}const c=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",s),this.off("upgrading",l)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",s),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Xg=class extends Gg{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>Wg[e]).filter(e=>!!e)),super(e,n)}};const Zg="function"==typeof ArrayBuffer,ey=Object.prototype.toString,ty="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===ey.call(Blob),ny="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===ey.call(File);function ry(e){return Zg&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||ty&&e instanceof Blob||ny&&e instanceof File}function iy(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(iy(e[t]))return!0;return!1}if(ry(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return iy(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&iy(e[t]))return!0;return!1}function oy(e){const t=[],n=e.data,r=e;return r.data=ay(n,t),r.attachments=t.length,{packet:r,buffers:t}}function ay(e,t){if(!e)return e;if(ry(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=ay(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=ay(e[r],t));return n}return e}function sy(e,t){return e.data=ly(e.data,t),delete e.attachments,e}function ly(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=ly(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=ly(e[n],t));return e}const cy=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var uy;!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"}(uy||(uy={}));function dy(e){return"[object Object]"===Object.prototype.toString.call(e)}class fy extends wg{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===uy.BINARY_EVENT;n||t.type===uy.BINARY_ACK?(t.type=n?uy.EVENT:uy.ACK,this.reconstructor=new hy(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!ry(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===uy[n.type])throw new Error("unknown packet type "+n.type);if(n.type===uy.BINARY_EVENT||n.type===uy.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!fy.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case uy.CONNECT:return dy(t);case uy.DISCONNECT:return void 0===t;case uy.CONNECT_ERROR:return"string"==typeof t||dy(t);case uy.EVENT:case uy.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===cy.indexOf(t[0]));case uy.ACK:case uy.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class hy{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=sy(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var py=Object.freeze({__proto__:null,Decoder:fy,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==uy.EVENT&&e.type!==uy.ACK||!iy(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===uy.EVENT?uy.BINARY_EVENT:uy.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==uy.BINARY_EVENT&&e.type!==uy.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=oy(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return uy}});function my(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const vy=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class gy extends wg{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;const e=this.io;this.subs=[my(e,"open",this.onopen.bind(this)),my(e,"packet",this.onpacket.bind(this)),my(e,"error",this.onerror.bind(this)),my(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,i;if(vy.hasOwnProperty(e))throw new 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;const o={type:uy.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const a=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,s=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!a||(s?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=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,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{this._queue[0];return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const 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(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:uy.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)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case uy.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new 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 uy.EVENT:case uy.BINARY_EVENT:this.onevent(e);break;case uy.ACK:case uy.BINARY_ACK:this.onack(e);break;case uy.DISCONNECT:this.ondisconnect();break;case uy.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&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){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:uy.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(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()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:uy.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){const 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){const 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){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function yy(e){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}yy.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},yy.prototype.reset=function(){this.attempts=0},yy.prototype.setMin=function(e){this.ms=e},yy.prototype.setMax=function(e){this.max=e},yy.prototype.setJitter=function(e){this.jitter=e};class by extends wg{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,Ng(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new yy({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||py;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Xg(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=my(t,"open",function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=my(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(my(e,"ping",this.onping.bind(this)),my(e,"data",this.ondata.bind(this)),my(e,"error",this.onerror.bind(this)),my(e,"close",this.onclose.bind(this)),my(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){kg(()=>{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 gy(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const 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(),null===(n=this.engine)||void 0===n||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;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const 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(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const wy={};function xy(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=Kg(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+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}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=wy[i]&&o in wy[i].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new by(r,t):(wy[i]||(wy[i]=new by(r,t)),s=wy[i]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}Object.assign(xy,{Manager:by,Socket:gy,io:xy,connect:xy});var ky=function(){function e(e,t){this.config=e,this.token=t.token}return e.prototype.init=function(e){var t=this;Yp("[StentorServerChat] Creating new socket connection to ".concat(this.config.url)),this.socket=xy(this.config.url,{transports:["websocket"],reconnection:!0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:5}),this.dispatch=e,this.socket.on("connect",function(){Yp("[StentorServerChat] Socket CONNECTED - ID: ".concat(t.socket.id))}),this.socket.on("account_status",function(n){Yp("SERVER: account_status: ".concat(JSON.stringify(n))),t.token||(t.token=wv(),e({type:"receiveToken",detail:{token:t.token,timestamp:+new Date,type:"receiveToken",user:void 0}}),Yp("CLIENT: created token: ".concat(t.token))),t.socket.emit("connection update",t.token),e({type:"account_status",detail:{status:"online",timestamp:+new Date}})}),this.socket.on("new message",function(e){Yp("SERVER: new message: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:e.username,nick:"agent:robot"},msg:e.message,timestamp:+new Date}})}),this.socket.on("user joined",function(e){Yp("SERVER: user joined: ".concat(JSON.stringify(e))),t.visitorInfo.token=e.token,t.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{displayName:e.username,nick:e.nick||"agent:robot",avatarPath:e.avatarPath},timestamp:+new Date}})}),this.socket.on("user left",function(e){Yp("SERVER: user left: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.memberleave",user:{displayName:e.username,nick:"agent:robot"},timestamp:+new Date}})}),this.socket.on("typing",function(e){Yp("SERVER: typing: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!0,timestamp:+new Date}})}),this.socket.on("stop typing",function(e){Yp("SERVER: stop typing: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!1,timestamp:+new Date}})}),this.socket.on("disconnect",function(e){var n="string"==typeof e?e:String(e||"unknown");Yp("[StentorServerChat] Socket DISCONNECTED - Reason: ".concat(n)),Yp("SERVER: disconnect"),t.dispatch(wm("offline")),t.dispatch(xm("offline"))}),this.socket.on("reconnect",function(){Yp("SERVER: reconnect"),t.dispatch(wm("online")),t.dispatch(xm("online"))}),this.socket.on("reconnect_failed",function(e){Yp("SERVER: reconnect_failed",e),t.dispatch(wm("offline")),t.dispatch(xm("offline"))}),this.socket.on("reconnect_error",function(e){Yp("SERVER: reconnect_error",e),t.dispatch(wm("offline"))}),this.dispatch(xm("pending"))},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){this.socket.emit("new message",e),t()},e.prototype.sendChatMsgRequest=function(e,t){this.socket.emit("new message",e),t()},e.prototype.sendTyping=function(e){this.socket.emit(e?"typing":"stop typing")},e.prototype.setVisitorInfo=function(e,t,n){this.visitorInfo=e,this.socket.emit("add user",e),n()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){var e;Yp("[StentorServerChat] dispose() called - manually disconnecting socket"),null===(e=this.socket)||void 0===e||e.disconnect()},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeOut")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeIn")})})},e}();function Sy(e,t){return new _m(function(e,t){var n,r,i,o,a,s;switch(e.type){case"direct":return new Vv({url:e.serverUrl,key:e.accountKey,timeout:e.timeout},t);case"websocket":return new ky({url:e.serverUrl},t);case"websocketraw":return new Yv({url:e.serverUrl},t);case"mcp":return new qv({serverUrl:e.serverUrl,mode:null===(n=e.mcp)||void 0===n?void 0:n.mode,authToken:null===(r=e.mcp)||void 0===r?void 0:r.authToken,debugMode:null===(i=e.mcp)||void 0===i?void 0:i.debugMode,pageContextOverride:null===(o=e.mcp)||void 0===o?void 0:o.pageContextOverride,showAiBadge:null===(a=e.mcp)||void 0===a?void 0:a.showAiBadge,channelId:null===(s=e.mcp)||void 0===s?void 0:s.channelId},t);case"local":return new $v;default:throw Sm(e.type)}}(e,t))}var Cy=Z.createContext(null);function _y(){var e=Cm(),t=Z.useContext(Cy);return Z.useCallback(function(n){n?t&&e(n(t)):console.warn("react bug? Someone invokes with null")},[e,t])}function Ey(){var e=_y();return Z.useCallback(function(t,n){e(gm(t,n))},[e])}var Ny={type:"newWindow"};function Iy(e){return{type:"visual_status",detail:{status:e,timestamp:(new Date).getTime()}}}var Ty="xa_chat",jy="resume",Oy="Continue your conversation";function Py(e){return!!(null==e?void 0:e.some(function(e){return"chat.msg"===e.type}))}function Ry(e,n){var r=n.arrivedViaChatLink;if(!n.hasConversation||!(null==e?void 0:e.message)&&!r)return e;var i=r?{delay:0}:{},o=null==e?void 0:e.mobile;return t(t(t(t({},e),{message:Oy}),i),o&&{mobile:t(t(t({},o),("string"==typeof o.message||r)&&{message:Oy}),i)})}var My="(max-width: 640px), (max-height: 480px) and (pointer: coarse)";function Ay(e,t,n,r,i){var o,a,s;if(void 0===i&&(void 0===s&&(s=window),i="function"==typeof s.matchMedia&&s.matchMedia(My).matches),!t||!n)throw new Error("OpenUrl: No dispatch and/or visual.");if(e!==tm){try{var l=new URL(e),c=new URLSearchParams(l.search);c.has("utm_source")||c.append("utm_source","xapp"),l.search=c.toString(),e=l.toString()}catch(e){}var u=r.type;switch(u){case"newWindow":n.opened&&t(Iy({opened:!1})),window.open(e,"callout-option","toolbar=0,status=0,width=".concat(r.width||1e3,",height=").concat(r.height||700));break;case"newTab":n.opened&&t(Iy({opened:!1})),window.open(e,"_blank");break;case"sameWindow":i?t(Iy({opened:!1})):n.opened||t(Iy({opened:!0})),window.open(function(e,t){try{var n=new URL(e);return n.origin!==t||n.searchParams.get(Ty)===jy?e:(n.searchParams.set(Ty,jy),n.toString())}catch(t){return e}}(e,window.location.origin),"_self");break;default:Sm(u)}}else{var d=null===(o=window.xafwControl)||void 0===o?void 0:o.openForm;if(!d)return void Gp("Cannot find toggleForm! Update form widget!");var f=!1,h=null===(a=window.xafwControl)||void 0===a?void 0:a.formStatus;h?f=h().active:Gp("Cannot find formStatus! Update form widget!"),f||(d(),n.opened&&t(Iy({opened:!1})))}}function Ly(){var e=rm();return Z.useCallback(function(t,n,r,i){i||(i=(null==e?void 0:e.urls)?function(e,t){if(t.policies)for(var n=0,r=t.policies;n<r.length;n++){var i=r[n];try{if(new RegExp(i.pattern,"gi").test(e))return i.behavior}catch(e){}}return t.defaultBehavior||Ny}(t,e.urls):Ny),Ay(t,n,r,i)},[e])}function Dy(){var e=Ly(),t=Cm(),n=Mp(function(e){return e.visuals}),r=Ey();return Z.useCallback(function(i){i.actionUrl?e(i.actionUrl,t,n):r(i.label)},[t,r,e,n])}var By=function(e){var t=e.msg,n=e.ctx,r=Z.useMemo(function(){return function(e){var t=e;return{content:e.content,imageUrl:e.smallImageUrl||t.imageUrl,title:e.title,imageActionUrl:null==e?void 0:e.imageActionUrl,buttons:e.buttons?e.buttons.map(function(e){return{actionUrl:e.openUrlAction||e.url,label:e.title}}):void 0}}(t)},[t]),i=n.user,o=Dy();return f.jsx(mm,{showAvatar:!0,user:i,children:f.jsx("div",{className:"chat-msg",children:f.jsx(fm,{card:r,onButtonClick:o})})})};function zy(e){return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function Uy(e){var t,n=Z.useState(e.getArray()),r=n[0],i=n[1],o=(t=Z.useRef(!1),Z.useEffect(function(){return t.current=!0,function(){t.current=!1}},[]),Z.useCallback(function(){return t.current},[]));return Z.useEffect(function(){var t=e.subscribe(function(e){o()&&i(e)});return function(){t.unsubscribe()}},[o,e]),r}var Fy=[];function qy(e){var t=e.get()||Fy,n=Array.isArray(t)?function(e){var t=e||[],n=[];function r(){for(var e=0,r=n;e<r.length;e++)(0,r[e])(t)}return{getArray:function(){return t},push:function(e){t=i(i([],t,!0),[e],!1),r()},unshift:function(e){t=i([e],t,!0),r()},subscribe:function(e){return n.push(e),{unsubscribe:function(){var t=n.indexOf(e);t>=0&&n.splice(t,1)}}}}}(t):t;return n!==t&&e.set(n),Uy(n)}var Hy=function(e,t){return{get:function(){return e[t]},set:function(n){return e[t]=n}}}(globalThis,"xappMsgMiddlewares");function Wy(){return function(e){var t=qy(e);return Z.useMemo(function(){return zy(t)},[t])}(Hy)}function Vy(e){return e.hasOwnProperty("label")}function $y(e){return e.url||e.imageActionUrl}var Ky=function(e){var t=Cm(),n=Mp(function(e){return e.visuals}),r=e.url,i=e.className,o=e.onOpen,a=Z.useCallback(function(){o&&o(r,t,n)},[r,o]);return r?f.jsx("div",{onClick:a,className:i,children:e.children}):f.jsx("div",{onClick:e.onClick,className:i,children:e.children})},Qy=function(e){var t,n=e.item,r=e.onButtonClick,i=e.onExecute,o=1===(null===(t=n.buttons)||void 0===t?void 0:t.length),a=Z.useCallback(function(){var e;1===(null===(e=n.buttons)||void 0===e?void 0:e.length)?r(n.buttons[0]):i(n.title,n.token)},[n,i,r]),s="xappw-chat-action-item ".concat(o?"xappw-chat-action-item--action":""," ").concat(e.className);return f.jsx(Ky,{className:s,url:$y(n),onClick:a,onOpen:e.onOpenUrl,children:e.children})},Jy=function(e){var t,n=e.item,r=1===(null===(t=n.buttons)||void 0===t?void 0:t.length),i=$y(n);if(n.imageUrl){var o=r?null:n.imageActionUrl;return f.jsx("div",{className:e.className,children:f.jsx(dm,{imageUrl:n.imageUrl,imageActionUrl:!i&&o})})}return e.emptyImageVisible?f.jsx("div",{className:e.className}):f.jsx(f.Fragment,{})},Yy=function(e){var t,n=e.item;return f.jsx(Qy,{className:"chat-list-item-container",item:n,onButtonClick:e.onButtonClick,onExecute:e.onExecute,onOpenUrl:e.onOpenUrl,children:f.jsxs("div",{className:"chat-list-item",children:[f.jsx(Jy,{item:n,className:"chat-list-item__img",emptyImageVisible:e.emptyImageVisible}),n.title&&f.jsx("div",{className:"chat-list-item__title",children:f.jsx("span",{children:n.title})}),n.subTitle&&f.jsx("div",{className:"chat-list-item__subtitle",children:f.jsx("span",{children:n.subTitle})}),!!(null===(t=n.buttons)||void 0===t?void 0:t.length)&&f.jsx(um,{className:"chat-list-item__actions",buttons:n.buttons,onClick:e.onButtonClick})]})})};var Gy=function(e){return f.jsx("button",{onClick:e.onClick,className:"xa-chevron",children:f.jsx("svg",{viewBox:"-5 -18 10 36",children:f.jsx("path",{d:"M 2.5 -15 L -2.5 0 L 2.5 15",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"4px",fill:"none"})})})};var Xy=function(e){return f.jsx("button",{onClick:e.onClick,className:"xa-chevron",children:f.jsx("svg",{viewBox:"-5 -18 10 36",children:f.jsx("path",{d:"M -2.5 -15 L 2.5 0 L -2.5 15",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"4px",fill:"none"})})})},Zy=function(e){var t=Z.useRef(null),n=Z.useState(0),r=n[0],i=n[1];function o(e){var n,o,a=t.current;if(a){var s=a.getElementsByClassName("xappw-carousel-items__item"),l=s.length,c=r;1===e?r<l-1&&c++:r>0&&c--;for(var u=0,d=0;d<s.length&&d!==c;d++)u+=null!==(o=null===(n=s.item(d))||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:0;a.scrollLeft=u,i(c)}}var a=1===e.list.items.length,s=e.list.items.some(function(e){return e.imageUrl}),l=e.list.items.map(function(t,n){return f.jsx("div",{className:"xappw-carousel-items__item",children:f.jsx(Yy,{item:t,emptyImageVisible:s,onExecute:e.onExecute,onButtonClick:e.onButtonClick,onOpenUrl:e.onOpenUrl})},"item-key-".concat(n))});return f.jsxs("div",{className:"xappw-carousel",children:[!a&&f.jsx("div",{className:"xappw-carousel__prev",children:f.jsx(Gy,{onClick:function(){return o(-1)}})}),f.jsx("div",{ref:t,className:"xappw-carousel-items ".concat(a?"xappw-carousel-items--one-item":""),children:l}),!a&&f.jsx("div",{className:"xappw-carousel__next",children:f.jsx(Xy,{onClick:function(){return o(1)}})})]})};var eb=function(e){var t=e.url,n=Z.useCallback(function(e){e.preventDefault()},[]);return f.jsx("a",{href:t,"aria-label":"read more",target:"_blank",rel:"noreferrer",className:e.className,onClick:n,children:f.jsxs("svg",{viewBox:"0 0 20 20",children:[f.jsx("path",{d:"M17 17H3V3h5V1H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5h-2z"}),f.jsx("path",{d:"M19 1h-8l3.29 3.29-5.73 5.73 1.42 1.42 5.73-5.73L19 9V1z"})]})})};function tb(e,t){for(var n=-1,r=0,i=t;r<i.length;r++){var o=i[r],a=e.indexOf(o);a>=0&&(n<0||n>=0&&a<n)&&(n=a)}return n}var nb=[":","/"],rb=["/"],ib=["?","#"],ob=["#"],ab=[function(e){var t=e.indexOf("://");return t<0?t:t+3},function(e){return tb(e,nb)},function(e){return":"!==e.charAt(0)?-1:tb(e,rb)},function(e){var t=tb(e,ib);return t>=0?t:e.length},function(e){return tb(e,ob)}];var sb="/...";function lb(e,t){if(e.length<t)return e;var n=function(e){for(var t=[],n=e,r=0,i=ab;r<i.length;r++){var o=i[r],a=Math.max(0,o(n,e)),s=n.substring(0,a);t.push(s),n=n.substring(a)}return n&&t.push(n),t}(e);function r(){return n.join("")}function i(){return r().length>t}function o(e){i()&&(n[e]="")}if(":80"===n[2]&&"http://"===n[0]&&o(2),":443"===n[2]&&"https://"===n[0]&&o(2),o(5),o(4),o(2),o(0),i()){var a=n[3],s=r().length-a.length,l=t-s;if(l<0)n[3]="";else if(l<a.length){var c=a.length-l+4;n[3]=sb+a.substring(c)}}return r()}var cb=function(e){var t=e.url,n=e.className,r=Z.useCallback(function(e){e.preventDefault()},[]);return f.jsx("a",{href:t,"aria-label":"read more",target:"_blank",rel:"noreferrer",className:n,onClick:r,children:lb(t,40)})},ub=function(e){var t,n=e.item,r=e.layout||"normal",i=n.url||n.imageActionUrl;return f.jsx(Qy,{className:"xappw-vlist-item-container",item:n,onButtonClick:e.onButtonClick,onExecute:e.onExecute,onOpenUrl:e.onOpenUrl,children:f.jsxs("div",{className:"xappw-vlist-item xappw-vlist-item--".concat(r),children:[f.jsxs("div",{className:"xappw-vlist-item__description",children:[n.title&&f.jsx("div",{className:"xappw-vlist-item__title",children:f.jsx("span",{children:n.title})}),i&&!n.hideUrl&&f.jsxs("div",{className:"xappw-vlist-item__link-row",children:[f.jsx(cb,{url:i,className:"xappw-vlist-item__link"}),f.jsx(eb,{url:i,className:"xappw-vlist-item__external-link"})]}),n.subTitle&&f.jsx("div",{className:"xappw-vlist-item__subtitle",children:f.jsx("span",{children:n.subTitle})}),!!(null===(t=n.buttons)||void 0===t?void 0:t.length)&&f.jsx(um,{buttons:n.buttons,onClick:e.onButtonClick})]}),f.jsx("div",{className:"xappw-vlist-item__side",children:f.jsx(Jy,{item:n,className:"xappw-vlist-item__img",emptyImageVisible:e.emptyImageVisible})})]})})},db=function(e){var t=e.list,n=Z.useRef(null),r=t.items.some(function(e){return e.imageUrl}),i=!t.items.some(function(e){var t;return e.subTitle||(null===(t=e.buttons)||void 0===t?void 0:t.length)}),o=t.items.map(function(t,n){return f.jsx("div",{className:"xappw-vlist-container__item",children:f.jsx(ub,{item:t,layout:i?"titles":"normal",emptyImageVisible:r,onExecute:e.onExecute,onButtonClick:e.onButtonClick,onOpenUrl:e.onOpenUrl})},"item-key-".concat(n))});return f.jsx("div",{className:"xappw-vlist",children:f.jsxs("div",{ref:n,className:"xappw-vlist-container",children:[e.list.title&&f.jsx("div",{className:"xappw-vlist__header",children:e.list.title}),o]})})},fb=function(e){var t=e.msg,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(fb.name));var r=Z.useMemo(function(){return function(e){return{type:e.type,title:e.title,items:e.items.map(function(e){var t,n,r={title:e.title,subTitle:e.description,token:e.token,url:e.url,hideUrl:e.hideUrl,imageUrl:(null===(t=e.image)||void 0===t?void 0:t.url)||e.imageUrl,imageActionUrl:null===(n=e.image)||void 0===n?void 0:n.imageActionUrl},i=e.buttons;return i&&i.length>0&&(r.buttons=i.map(function(e){return{actionUrl:e.openUrlAction,label:e.title}})),r})}}(t)},[t]),i=Ey(),o=Z.useCallback(function(e,t,n){i(t,{token:n,action:"click",ui:e})},[i]),a=Dy(),s=n.user;return f.jsxs(mm,{showAvatar:!1,user:s,fullWidth:!0,children:["CAROUSEL"===r.type&&f.jsx("div",{className:"chat-msg chat-msg--fullwidth chat-msg--no-ava",children:f.jsx(Zy,{list:r,onExecute:o.bind(null,"carousel"),onButtonClick:a,onOpenUrl:n.openUrl})}),"LIST"===r.type&&f.jsx("div",{className:"chat-msg chat-msg--expand",children:f.jsx(db,{list:r,onExecute:o.bind(null,"list"),onButtonClick:a,onOpenUrl:n.openUrl})})]})},hb=function(){},pb=function(){function e(e){this.cache={},this.template=e}return e.prototype.resolve=function(e){var t,n,r;if(e){var i=this.cache,o=e.nick,a=i[o];return a||(a={user:e,send:null!==(t=this.template.send)&&void 0!==t?t:hb,write:null!==(n=this.template.write)&&void 0!==n?n:hb,openUrl:null!==(r=this.template.openUrl)&&void 0!==r?r:hb},i[o]=a),a}},e}(),mb=function(){return f.jsx(f.Fragment,{})},vb=function(e){var n=e.items,r=e.checked,i=e.onChange,o=Z.useCallback(function(e){var n,o=e.target.value;i(t(t({},r),((n={})[o]=!r[o],n)))},[r,i]);return f.jsx("ul",{className:"xappw-multiselect",children:null==n?void 0:n.map(function(e){return f.jsx("li",{children:f.jsxs("label",{children:[f.jsx("input",{type:"checkbox",checked:r[e.id]||!1,onChange:o,value:e.id}),f.jsx("span",{children:e.title})]})},e.id)})})};var gb=function(e){var t=e.msg,n=e.ctx,r=Z.useMemo(function(){return t.items},[t]),i=n.user,o=Z.useState({}),a=o[0],s=o[1],l=Z.useCallback(function(){n.send({type:"custom",payload:JSON.stringify({type:"OPTION_SELECT_REQUEST",intentId:"OptionSelect",selected:Object.keys(a).map(function(e){return{id:e}})})})},[n,a]);return f.jsx(mm,{showAvatar:!0,user:i,children:f.jsx("div",{className:"chat-msg",children:f.jsxs("div",{children:[f.jsx(vb,{items:r,checked:a,onChange:s}),f.jsx(lm,{label:"Submit",onClick:l})]})})})},yb=function(e){var t=e.table;return f.jsxs("div",{className:"xappw-table",children:[t.title&&f.jsx("div",{className:"xappw-table__header",children:t.title}),f.jsx("div",{className:"xappw-table__container",children:f.jsxs("table",{children:[f.jsx("thead",{children:f.jsx("tr",{children:t.headers.map(function(e,t){return f.jsx("th",{scope:"col",children:e},"".concat(e,"-").concat(t))})})}),f.jsx("tbody",{children:t.rows.map(function(e,t){return f.jsx("tr",{children:e.map(function(e,t){return f.jsx("td",{children:e},t)})},t)})})]})})]})},bb=function(e){var t=e.msg,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(bb.name));return f.jsx(mm,{showAvatar:!1,user:n.user,fullWidth:!0,children:f.jsx("div",{className:"chat-msg chat-msg--expand",children:f.jsx(yb,{table:t})})})},wb=zy([function(e){return function(t){var n,r=t.msg,i=t.ctx;return!(n=r)||"LIST"!==n.type&&"CAROUSEL"!==n.type?e(t):f.jsx(fb,{msg:r,ctx:i})}},function(e){return function(t){var n,r=t.msg,i=t.ctx;return(n=r)&&"CARD"===n.type?f.jsx(By,{msg:r,ctx:i}):e(t)}},function(e){return function(t){var n=t.msg,r=t.ctx;return"MultiSelect"===n.type?f.jsx(gb,{msg:n,ctx:r}):e(t)}},function(e){return function(t){var n,r=t.msg,i=t.ctx;return(n=r)&&"TABLE"===n.type&&Array.isArray(n.headers)&&Array.isArray(n.rows)?f.jsx(bb,{msg:r,ctx:i}):e(t)}}]);function xb(){var e,t=(e=Wy(),Z.useMemo(function(){return zy([e,wb])},[e]));return Z.useMemo(function(){return t(mb)},[t])}var kb=wb(mb);function Sb(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Cb=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),_b=()=>Math.random().toString(36).substring(7).split("").join("."),Eb={INIT:`@@redux/INIT${_b()}`,REPLACE:`@@redux/REPLACE${_b()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${_b()}`};function Nb(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function Ib(e,t,n){if("function"!=typeof e)throw new Error(Sb(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Sb(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Sb(1));return n(Ib)(e,t)}let r=e,i=t,o=new Map,a=o,s=0,l=!1;function c(){a===o&&(a=new Map,o.forEach((e,t)=>{a.set(t,e)}))}function u(){if(l)throw new Error(Sb(3));return i}function d(e){if("function"!=typeof e)throw new Error(Sb(4));if(l)throw new Error(Sb(5));let t=!0;c();const n=s++;return a.set(n,e),function(){if(t){if(l)throw new Error(Sb(6));t=!1,c(),a.delete(n),o=null}}}function f(e){if(!Nb(e))throw new Error(Sb(7));if(void 0===e.type)throw new Error(Sb(8));if("string"!=typeof e.type)throw new Error(Sb(17));if(l)throw new Error(Sb(9));try{l=!0,i=r(i,e)}finally{l=!1}return(o=a).forEach(e=>{e()}),e}f({type:Eb.INIT});return{dispatch:f,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Sb(10));r=e,f({type:Eb.REPLACE})},[Cb]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(Sb(11));function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[Cb](){return this}}}}}function Tb(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const i=t[r];"function"==typeof e[i]&&(n[i]=e[i])}const r=Object.keys(n);let i;try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:Eb.INIT}))throw new Error(Sb(12));if(void 0===n(void 0,{type:Eb.PROBE_UNKNOWN_ACTION()}))throw new Error(Sb(13))})}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let o=!1;const a={};for(let i=0;i<r.length;i++){const s=r[i],l=n[s],c=e[s],u=l(c,t);if(void 0===u)throw t&&t.type,new Error(Sb(14));a[s]=u,o=o||u!==c}return o=o||r.length!==Object.keys(e).length,o?a:e}}function jb(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function Ob(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var Pb=Ob(),Rb=Ob;const Mb="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?jb:jb.apply(null,arguments)};var Ab=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};const Lb=e=>t=>{setTimeout(t,e)},Db=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,o=!1,a=!1;const s=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?(c=window.requestAnimationFrame,u=100,e=>{let t,n,r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(t),clearTimeout(n),e())};t=c(i),n=setTimeout(i,u)}):Lb(10):"callback"===e.type?e.queueNotification:Lb(e.timeout);var c,u;const d=()=>{a=!1,o&&(o=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.RTK_autoBatch,o=!i,o&&(a||(a=!0,l(d))),r.dispatch(e)}finally{i=!0}}})};function Bb(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let o=new Ab;return t&&("boolean"==typeof t?o.push(Pb):o.push(Rb(t.extraArgument))),o},{reducer:n,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:a,enhancers:s}=e||{};let l;if("function"==typeof n)l=n;else{if(!Nb(n))throw new Error(`Minified Redux Toolkit error #${c=1}; visit https://redux-toolkit.js.org/Errors?code=${c} for the full message or use the non-minified dev environment for full errors. `);l=Tb(n)}var c;let u;u="function"==typeof r?r(t):t();let d=jb;i&&(d=Mb({trace:!1,..."object"==typeof i&&i}));const f=function(...e){return t=>(n,r)=>{const i=t(n,r);let o=()=>{throw new Error(Sb(15))};const a={getState:i.getState,dispatch:(e,...t)=>o(e,...t)},s=e.map(e=>e(a));return o=jb(...s)(i.dispatch),{...i,dispatch:o}}}(...u),h=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new Ab(e);return n&&r.push(Db("object"==typeof n?n:void 0)),r})(f);return Ib(l,a,d(..."function"==typeof s?s(h):h()))}var zb=function(){function e(e,t){this.innerStorage=e,this.key=t}return e.prototype.get=function(){return function(e){try{if(e)return JSON.parse(e)}catch(e){}}(this.innerStorage.getItem(this.key))},e.prototype.set=function(e){try{this.innerStorage.setItem(this.key,JSON.stringify(e))}catch(e){!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r={};r[e]||(r[e]=!0,Yp.apply(void 0,t))}("storage","Unable to store redux state")}},e}();function Ub(){return wv()}var Fb={displayName:"Visitor",nick:"visitor:",typing:!1};function qb(e,n){var r;e||(e={}),e.userId=e.userId?e.userId:Ub(),e.visitorId=e.userId;var i=!1;if("undefined"!=typeof window){var o=null===(r=window.localStorage)||void 0===r?void 0:r.getItem("xaErrorOverlay");"enabled"===o?i=!0:"disabled"===o?i=!1:((null==n?void 0:n.enableErrorOverlay)||void 0!==globalThis.__DEV__&&globalThis.__DEV__)&&(i=!0)}return t({connection:{connectionStatus:"offline",token:null,greetingRequested:!1},accountStatus:"offline",departments:{},visitor:Fb,agents:{},chats:[],lastTimestamp:0,lastRatingRequestTimestamp:0,hasRating:!1,isChatting:!1,queuePosition:0,failureMsg:null,visitorId:Ub(),chips:[],sessionExpiration:"24h",visuals:{},debugMode:i},e)}var Hb=qb(),Wb=function(){function e(){this.valuesMap=new Map}return e.prototype.getItem=function(e){var t=String(e);return this.valuesMap.has(e)?String(this.valuesMap.get(t)):null},e.prototype.setItem=function(e,t){this.valuesMap.set(String(e),String(t))},e.prototype.removeItem=function(e){this.valuesMap.delete(e)},e.prototype.clear=function(){this.valuesMap.clear()},e.prototype.key=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'key' on 'Storage': 1 argument required, but only 0 present.");return Array.from(this.valuesMap.keys())[e]},Object.defineProperty(e.prototype,"length",{get:function(){return this.valuesMap.size},enumerable:!1,configurable:!0}),e}();function Vb(e){return"chat.msg"===e.type}function $b(e,t){return function(e,t,n){if(!e.length)return e.push(t),e;if(1===e.length)return 0===(c=n(t,e[0]))?(t===e[0]||e.push(t),e):(c<0?e.unshift(t):e.push(t),e);for(var r=0,i=e.length-1;i-r>0;){var o=e[r],a=e[i],s=n(t,o);if(0===s)return t===o||e.splice(r+1,0,t),e;if(s<0)return e.splice(r,0,t),e;var l=n(t,a);if(0===l)return t===a||e.splice(i+1,0,t),e;if(l>0)return e.splice(i+1,0,t),e;if(i-r<=1)break;var c,u=Math.floor((r+i)/2),d=e[u];if(0===(c=n(d,t))&&t===d)return e;c<=0?r=u:c>0&&(i=u)}return e.splice(r+1,0,t),e}(i([],e,!0),t,function(e,t){return e.timestamp-t.timestamp})}function Kb(e){for(var t=e.length-1;t>=0;t--){var n=e[t];if(Vb(n)&&n.isStreaming)return t}return-1}function Qb(e,t){e.chats=$b(e.chats,t),"chat.msg"===t.type&&(e.activeContexts=t.msg.context)}function Jb(e,n){var r,o,a,s,l,c,u,d,f,h,p,m,v,g,y,b,w,x,k,S,C;if(void 0===e&&(e=Hb),Yp("action",n),"reset"===n.type)return function(e){var n;void 0===e&&(e=Hb);var r=qb({accessToken:e.accessToken,userId:e.userId,attributes:e.attributes,sessionExpiration:e.sessionExpiration}),i="online"===e.connection.connectionStatus,o=null===(n=e.visuals)||void 0===n?void 0:n.opened;return t(t({},r),{connection:t(t({},r.connection),{greetingRequested:!1,nonce:wv(),connectionStatus:i?"online":r.connection.connectionStatus}),accountStatus:i?"online":r.accountStatus,visitor:e.visitor,visitorId:e.visitorId,visuals:{opened:o,hasInteracted:!1}})}(e);switch(n.type){case"connection_update":case"receiveToken":case"sendGreeting":var _=function(e,n){switch(n.type){case"connection_update":return t(t({},e),{connectionStatus:n.detail.status});case"receiveToken":return t(t({},e),{token:n.detail.token});case"sendGreeting":return t(t({},e),{greetingRequested:!0})}return e}(e.connection,n);return e.connection!==_&&(e=t(t({},e),{lastTimestamp:null===(l=n.detail)||void 0===l?void 0:l.timestamp,connection:_})),e;case"account_status":return t(t({},e),{lastTimestamp:null===(c=n.detail)||void 0===c?void 0:c.timestamp,accountStatus:n.detail.status});case"session_id":return t(t({},e),{lastTimestamp:null===(u=n.detail)||void 0===u?void 0:u.timestamp,sessionId:n.detail.sessionId});case"visual_status":return t(t({},e),{lastTimestamp:null===(d=n.detail)||void 0===d?void 0:d.timestamp,visuals:t(t(t(t(t({},e.visuals||{}),void 0!==n.detail.status.drawer&&{drawer:n.detail.status.drawer}),void 0!==n.detail.status.opened&&{opened:n.detail.status.opened}),void 0!==n.detail.status.visible&&{visible:n.detail.status.visible}),void 0!==n.detail.status.hasInteracted&&{hasInteracted:n.detail.status.hasInteracted})});case"toggle_debug_mode":var E=!e.debugMode;return"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem("xaErrorOverlay",E?"enabled":"disabled"),t(t({},e),{debugMode:E});case"ws_button_display":return t(t({},e),{lastTimestamp:null===(f=n.detail)||void 0===f?void 0:f.timestamp,wsButton:{id:n.detail.id,text:n.detail.text||(null===(h=e.wsButton)||void 0===h?void 0:h.text)||"",pressBehavior:n.detail.pressBehavior,isPressed:null!==(p=n.detail.isPressed)&&void 0!==p&&p,isDismissing:null!==(m=n.detail.isDismissing)&&void 0!==m&&m}});case"ws_button_dismiss":return(null===(v=e.wsButton)||void 0===v?void 0:v.id)===n.detail.id?t(t({},e),{lastTimestamp:null===(g=n.detail)||void 0===g?void 0:g.timestamp,wsButton:void 0}):e;case"department_update":return t(t({},e),{lastTimestamp:null===(y=n.detail)||void 0===y?void 0:y.timestamp,departments:t(t({},e.departments),(r={},r[n.detail.id]=t({},n.detail),r))});case"visitor_update":return t(t({},e),{lastTimestamp:null===(b=n.detail)||void 0===b?void 0:b.timestamp,visitor:t(t({},e.visitor),n.detail)});case"agent_update":var N=e.agents[n.detail.nick];return t(t({},e),{lastTimestamp:null===(w=n.detail)||void 0===w?void 0:w.timestamp,agents:t(t({},e.agents),(o={},o[n.detail.nick]=t(t({},N),{user:t(t({},N.user),n.detail),typing:(N||{typing:!1}).typing}),o))});case"chat":var I=t(t({},e),{lastTimestamp:null===(x=n.detail)||void 0===x?void 0:x.timestamp});switch(n.detail.type){case"chat.memberjoin":return function(e,n){var r=t({},e.agents),i=e.agents[n.user.nick];if(r[n.user.nick]=t(t({},i),{user:t(t({},n.user),{displayName:n.user.displayName||"Agent"}),joined:!0,typing:!1,hideUserInfo:n.hideUserInfo}),Ap(n.user.nick)){var o=n.showDivider||n.message;return(null==i?void 0:i.joined)&&!o?Yp('DEDUPLICATION: Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") already joined. NOT adding duplicate join message to chat.")):Yp(o?'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining with special visuals (divider or custom message). Adding join message to chat."):'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining. Adding join message to chat.")),t(t({},e),{isChatting:!0,chats:(null==i?void 0:i.joined)&&!o?e.chats:$b(e.chats,n),agents:r})}return Yp('Non-agent member "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining. Adding join message to chat.")),t(t({},e),{isChatting:!0,chats:$b(e.chats,n),agents:r})}(e,n.detail);case"chat.memberleave":return function(e,n){var r=t({},e.agents),i=e.agents[n.user.nick];r[n.user.nick]=t(t({},i),{joined:!1,typing:!1});var o=Object.values(r).filter(function(e){return e.joined}).length>0;if(Ap(n.user.nick)){var a=n.showDivider||n.message;return(null==i?void 0:i.joined)?Yp(a?'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving with special visuals (divider or custom message). Adding leave message to chat."):'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving. Adding leave message to chat.")):Yp('DEDUPLICATION: Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") already left. NOT adding duplicate leave message to chat.")),t(t({},e),{isChatting:o,chats:(null==i?void 0:i.joined)?$b(e.chats,n):e.chats,agents:r})}return Yp('Non-agent member "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving. Adding leave message to chat.")),t(t({},e),{isChatting:o,chats:$b(e.chats,n),agents:r})}(e,n.detail);case"chat.systemmessage":return Qb(I,n.detail),I;case"chat.systemmessagedismiss":var T=n.detail.id;return t(t({},I),{chats:I.chats.filter(function(e){return!function(e){return"chat.systemmessage"===e.type}(e)||e.id!==T})});case"chat.queue.position":return I.queuePosition=n.detail.queuePosition,I;case"chat.request.rating":return Qb(I,n.detail),t(t({},I),{lastRatingRequestTimestamp:n.detail.timestamp});case"chat.rating":return Qb(I,n.detail),t(t({},I),{hasRating:!!n.detail.newRating});case"chat.file":case"chat.msg":Qb(I,n.detail);var j=n.detail,O="chat.msg"===j.type?j.msg:null;return I.chips=(null===(k=null==O?void 0:O.options)||void 0===k?void 0:k.length)?O.options:[],I;case"chat.failureMsg":var P,R=I.agents[n.detail.user.nick],M=n.detail.failureMsg.retry,A=I;if(1!==M){P=I.chats.filter(function(e){return"chat.failureMsg"===e.type&&e.failureMsg.retry<M})[0];var L=I.chats.filter(function(e){return e!==P});A=t(t({},I),{chats:L})}return Qb(A,n.detail),t(t({},A),{agents:t(t({},A.agents),(a={},a[n.detail.user.nick]=t(t({},R),{typing:!1,requestFailed:!0}),a)),failureMsg:n.detail.failureMsg});case"chat.typing":var D=e.agents[n.detail.user.nick];return t(t({},e),{lastTimestamp:null===(S=n.detail)||void 0===S?void 0:S.timestamp,agents:t(t({},e.agents),(s={},s[n.detail.user.nick]=t(t({},D),{typing:n.detail.typing}),s))});case"chat.stream.start":var B=I.chats.map(function(e){return Vb(e)&&e.isStreaming?t(t({},e),{isStreaming:!1,wasStreamed:!0}):e}),z=$b(B,{type:"chat.msg",user:n.detail.user,timestamp:n.detail.timestamp,msg:{text:""},isStreaming:!0});return t(t({},I),{chats:z,streamingMessageId:n.detail.messageId});case"chat.stream.chunk":var U=n.detail;if(e.streamingMessageId===U.messageId){var F=Kb(e.chats);if(F>=0){var q=U.text;return t(t({},e),{lastTimestamp:null==U?void 0:U.timestamp,chats:e.chats.map(function(e,n){var r;return n===F&&Vb(e)?t(t({},e),{msg:t(t({},e.msg),{text:((null===(r=e.msg)||void 0===r?void 0:r.text)||"")+q})}):e})})}}return e;case"chat.stream.tool_start":Yp("Tool execution started: ".concat(n.detail.toolName));var H=n.detail;if(e.streamingMessageId===H.messageId){var W=Kb(e.chats);if(W>=0)return t(t({},e),{lastTimestamp:H.timestamp,chats:e.chats.map(function(e,n){if(n===W&&Vb(e)){var r=e.toolCalls||[];return t(t({},e),{toolCalls:i(i([],r,!0),[{name:H.toolName,toolCallId:H.toolCallId,displayName:H.displayName,label:H.label,hidden:H.hidden,input:H.toolInput,startTime:H.timestamp,isExecuting:!0}],!1)})}return e})})}return e;case"chat.stream.tool_end":Yp("Tool execution ended: ".concat(n.detail.toolName));var V=n.detail;if(e.streamingMessageId===V.messageId){var $=Kb(e.chats);if($>=0)return t(t({},e),{lastTimestamp:V.timestamp,chats:e.chats.map(function(e,n){var r;if(n===$&&Vb(e)){var i=null===(r=e.toolCalls)||void 0===r?void 0:r.map(function(e){var n,r;return(V.toolCallId?e.toolCallId===V.toolCallId:e.name===V.toolName&&e.isExecuting)?t(t({},e),{displayName:V.displayName||e.displayName,label:V.label,hidden:null!==(n=V.hidden)&&void 0!==n?n:e.hidden,input:null!==(r=V.toolInput)&&void 0!==r?r:e.input,result:V.toolResult,error:V.toolError,endTime:V.timestamp,isExecuting:!1}):e});return t(t({},e),{toolCalls:i})}return e})})}return e;case"chat.stream.end":var K=n.detail;if(e.streamingMessageId===K.messageId){var Q=Kb(e.chats),J=Q>=0?e.chats[Q]:void 0;if(Q>=0&&J&&Vb(J)){var Y=K.msg,G=K.toolCalls||J.toolCalls,X=K.preserveChips?e.chips:(null===(C=null==Y?void 0:Y.options)||void 0===C?void 0:C.length)?Y.options:[];return t(t({},e),{lastTimestamp:null==K?void 0:K.timestamp,streamingMessageId:void 0,chips:X,chats:e.chats.map(function(e,n){return n===Q&&Vb(e)?t(t({},e),{msg:Y,isStreaming:!1,wasStreamed:!0,toolCalls:G}):e})})}}return e;case"chat.stream.abort":var Z=n.detail;if(e.streamingMessageId===Z.messageId){var ee=Kb(e.chats);if(ee>=0)return t(t({},e),{lastTimestamp:Z.timestamp,streamingMessageId:void 0,chats:e.chats.map(function(e,n){return n===ee&&Vb(e)?t(t({},e),{isStreaming:!1,wasStreamed:!0}):e})})}return e;case"chat.stream.resume":var te=n.detail;if(e.streamingMessageId)return e;for(var ne=-1,re=e.chats.length-1;re>=0;re--){var ie=e.chats[re];if(Vb(ie)&&ie.wasStreamed&&!ie.isStreaming){ne=re;break}}return ne>=0?t(t({},e),{lastTimestamp:te.timestamp,streamingMessageId:te.messageId,chats:e.chats.map(function(e,n){return n===ne&&Vb(e)?t(t({},e),{isStreaming:!0,wasStreamed:!1}):e})}):e;default:return e}default:return Yp("Unhandled redux action: ",n.type),e}}function Yb(e,t){if(void 0===e&&(e=Hb),"synthetic"===t.type){Yp("synthetic action",t);var n=function(e,t){var n;void 0===e&&(e=Hb);var r=((null===(n=t.detail)||void 0===n?void 0:n.timestamp)||+new Date)+1;switch(t.detail.type){case"write_msg":return{type:"chat",detail:{type:"chat.msg",user:t.detail.user,timestamp:r,msg:t.detail.msg}};case"visitor.send.file":return{type:"chat",detail:{type:"chat.file",user:{displayName:e.visitor.displayName,nick:"visitor:"},timestamp:r,attachment:t.detail.attachment}};default:throw new Error("Unknown synthetic action. Detail type: ".concat(t.detail.type))}}(e,t);return Jb(e,n)}return Jb(e,t)}var Gb="AdminAccessTimes";function Xb(e,n){var r;n||(n="undefined"!=typeof window?localStorage:new Wb);var i,o=e.connection,a=null===(r=new URL(window.location.href).searchParams)||void 0===r?void 0:r.get("sessionId"),s=(new Date).getTime();if(a){var l=n.getItem(Gb),c=l?JSON.parse(l):{};if(c[a])Yp("ChatStore: reusing session: ".concat(a)),c[a].lastAccessMs=s,i=c[a].dataStorageKey;else{if(Object.keys(c).length>=20){var u=function(e){for(var t,n=Number.MAX_VALUE,r=0,i=Object.keys(e);r<i.length;r++){var o=i[r];e[o].lastAccessMs<n&&(t=o,n=e[o].lastAccessMs)}return t}(c);Yp("ChatStore: evicting session: ".concat(u)),n.removeItem(c[u].dataStorageKey),c[u]=void 0}i=Zb(o,a),c[a]={lastAccessMs:s,dataStorageKey:i}}n.setItem(Gb,JSON.stringify(c))}else i=Zb(o);var d=function(e,n,r){var i,o=null!==(i=e.get())&&void 0!==i?i:n;return o&&o.visuals&&(o=t(t({},o),{visuals:t(t({},o.visuals),{hasInteracted:void 0,visible:void 0})})),function(t,n){void 0===t&&(t=o);var i=r(t,n);return e.set(i),i}}(new zb(n,i),qb({accessToken:e.accessToken,userId:e.userId,attributes:e.attributes,sessionExpiration:e.sessionExpiration},{enableErrorOverlay:e.enableErrorOverlay}),Yb);return Bb({reducer:d,middleware:function(e){return e({thunk:!0})},devTools:!1})}function Zb(e,t){var n="xappchat.".concat(e.serverUrl);return t?e.accountKey?"".concat(n,".").concat(e.accountKey,".").concat(t):"".concat(n,".").concat(t):e.accountKey?"".concat(n,".").concat(e.accountKey):n}function ew(e,t,n,r){return void 0===r&&(r=Date.now()),!!t&&(r-t>=1e3*function(e){var t=e.match(/(\d+)([dhms]?)/);if(!t)return Gp("Invalid time string: ".concat(e)),0;var n=parseInt(t[1]);switch(t[2]){case"d":return 24*n*60*60;case"h":return 60*n*60;case"m":return 60*n;default:return n}}(e||"4h")&&(i=r,o=new Date(t),a=new Date(i),!(o.getFullYear()===a.getFullYear()&&o.getMonth()===a.getMonth()&&o.getDate()===a.getDate())));var i,o,a}function tw(e){void 0===e&&(e=!1);var t=Z.useState(function(){return!e&&function(e){void 0===e&&(e=window);try{return new URL(e.location.href).searchParams.get(Ty)===jy}catch(e){return!1}}()})[0];return Z.useEffect(function(){t&&function(e){void 0===e&&(e=window);try{var t=new URL(e.location.href);if(!t.searchParams.has(Ty))return;t.searchParams.delete(Ty),e.history.replaceState(e.history.state,"",t.toString())}catch(e){}}()},[t]),t}function nw(e){Z.useEffect(function(){if(e){var t=function(e){for(var t="es-",n=0;n<e.length;n++)t+=rw(e.charAt(n));return t}(e);if(!document.getElementById(t)){var n=document.createElement("script");n.id=t,n.src=e,n.crossOrigin="anonymous",document.head.appendChild(n)}}},[e])}function rw(e){return e>="0"&&e<="9"||e>="a"&&e<="z"||e>="A"&&e<="Z"?e:"_".concat(e.charCodeAt(0),"_")}var iw="data-xapp-form-page";function ow(){return!("undefined"==typeof document||!document.body)&&"true"===document.body.getAttribute(iw)}function aw(){var e=Z.useState(ow),t=e[0],n=e[1];return Z.useEffect(function(){if("undefined"!=typeof document&&document.body&&(n(ow()),"undefined"!=typeof MutationObserver)){var e=new MutationObserver(function(){n(ow())});return e.observe(document.body,{attributes:!0,attributeFilter:[iw]}),function(){return e.disconnect()}}},[]),t}function sw(e){var n,r,i,o,a,s,l=(i=_y(),o=Mp(function(e){return e.visitorId||e.userId}),a=Mp(function(e){return e.accessToken}),s=Mp(function(e){return e.attributes}),Z.useMemo(function(){return{dispatch:i,visitorId:o,accessToken:a,userId:o,attributes:s}},[i,o,a,s])),c=Z.useRef(null),u=Z.useContext(nm),d=null!==(r=null===(n=null==u?void 0:u.env)||void 0===n?void 0:n.isAdmin)&&void 0!==r&&r,f=Mp(function(e){return e.sessionId}),h=Mp(function(e){return Py(e.chats)});Z.useEffect(function(){if(e&&c.current!==l&&(c.current=l,l.visitorId)){if(l.dispatch(bm({name:"Visitor",visitorId:l.visitorId,userId:l.userId,accessToken:l.accessToken,attributes:t(t({},l.attributes),{currentUrl:window.location.href}),hasConversation:h},f)),!d){var n=setTimeout(function(){var e,t=(void 0===e&&(e=!1),function(t){return function(n,r){e||r().connection.greetingRequested||(Yp("sending greeting"),t.sendChatMsg({text:void 0,attributes:{isGreeting:!0}},function(e){e&&Yp("Error sending message"),n({type:"sendGreeting",detail:void 0})}))}});l.dispatch(t)},1e3);return function(){clearTimeout(n)}}Yp("Admin widget. Not sending greeting.")}},[l,e,d])}var lw={},cw={};Object.defineProperty(cw,"__esModule",{value:!0}),cw.isActionBarChatButton=function(e){return"chat"===e.type},cw.isActionBarFormButton=function(e){return"form"===e.type},cw.isActionBarScheduleButton=function(e){return"schedule"===e.type},cw.isActionBarPhoneButton=function(e){return"phone"===e.type},cw.isActionBarUrlButton=function(e){return"url"===e.type},cw.isActionBarEmailButton=function(e){return"email"===e.type},cw.isActionBarHelpButton=function(e){return"help"===e.type},cw.isActionBarPaymentButton=function(e){return"payment"===e.type};var uw={},dw={};function fw(e,t=2){return(new Array(t).join("0")+e).slice(-t)}function hw(e){const t=null==e?void 0:e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/);if(t)return{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10),a:parseFloat(t[4])};const n=null==e?void 0:e.match(/^rgb?\((\d+),\s*(\d+),\s*(\d+)\)$/);return n?{r:parseInt(n[1],10),g:parseInt(n[2],10),b:parseInt(n[3],10)}:null}function pw(e,t,n){return.299*e+.587*t+.114*n>186}function mw(e,t){if(!e)return;let n=0===e.indexOf("#")?e.slice(1):e;if(3===n.length&&(n=n[0]+n[0]+n[1]+n[1]+n[2]+n[2]),6!==n.length)throw new Error("Invalid HEX color.");const r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),o=parseInt(n.slice(4,6),16);return t?pw(r,i,o)?"#000000":"#FFFFFF":`#${fw((255-r).toString(16))}${fw((255-i).toString(16))}${fw((255-o).toString(16))}`}function vw(e,t){const n=hw(e);if(!n)return e;const{r:r,g:i,b:o}=n;return t?pw(r,i,o)?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)":`rgba(${255-r}, ${255-i}, ${255-o}, 1)`}function gw(e){if(!e)return!1;if(e.startsWith("#")){const t=e.slice(1);return(3===t.length||6===t.length)&&/^[0-9a-f]+$/i.test(t)}return null!==hw(e)}
|
|
1
|
+
var XAppChatWidget=function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((r=r.apply(e,t||[])).next())})}function r(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function i(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(){const e="prod";try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s={exports:{}},l={},c=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function d(e,t,n){var r=null;if(void 0!==n&&(r=""+n),void 0!==t.key&&(r=""+t.key),"key"in t)for(var i in n={},t)"key"!==i&&(n[i]=t[i]);else n=t;return t=n.ref,{$$typeof:c,type:e,key:r,ref:void 0!==t?t:null,props:n}}l.Fragment=u,l.jsx=d,l.jsxs=d,s.exports=l;var f=s.exports,p={exports:{}},h={},m={exports:{}},v={};!function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<i(o,t)))break e;e[r]=t,e[n]=o,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>i(l,n))c<o&&0>i(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<o&&0>i(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],c=[],u=1,d=null,f=3,p=!1,h=!1,m=!1,v=!1,g="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var i=n(c);null!==i;){if(null===i.callback)r(c);else{if(!(i.startTime<=e))break;r(c),i.sortIndex=i.expirationTime,t(l,i)}i=n(c)}}function x(e){if(m=!1,w(e),!h)if(null!==n(l))h=!0,S||(S=!0,k());else{var t=n(c);null!==t&&O(x,t.startTime-e)}}var k,S=!1,C=-1,_=5,E=-1;function N(){return!!v||!(e.unstable_now()-E<_)}function I(){if(v=!1,S){var t=e.unstable_now();E=t;var i=!0;try{e:{h=!1,m&&(m=!1,y(C),C=-1),p=!0;var o=f;try{t:{for(w(t),d=n(l);null!==d&&!(d.expirationTime>t&&N());){var a=d.callback;if("function"==typeof a){d.callback=null,f=d.priorityLevel;var s=a(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof s){d.callback=s,w(t),i=!0;break t}d===n(l)&&r(l),w(t)}else r(l);d=n(l)}if(null!==d)i=!0;else{var u=n(c);null!==u&&O(x,u.startTime-t),i=!1}}break e}finally{d=null,f=o,p=!1}i=void 0}}finally{i?k():S=!1}}}if("function"==typeof b)k=function(){b(I)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,j=T.port2;T.port1.onmessage=I,k=function(){j.postMessage(null)}}else k=function(){g(I,0)};function O(t,n){C=g(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"):_=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(){v=!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,o){var a=e.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?a+o:a:o=a,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 r={id:u++,callback:i,priorityLevel:r,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>a?(r.sortIndex=o,t(c,r),null===n(l)&&r===n(c)&&(m?(y(C),C=-1):m=!0,O(x,o-a))):(r.sortIndex=s,t(l,r),h||p||(h=!0,S||(S=!0,k()))),r},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(v),m.exports=v;var g=m.exports,y={exports:{}},b={},w=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),E=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),P=Symbol.iterator;var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,M={};function L(e,t,n){this.props=e,this.context=t,this.refs=M,this.updater=n||A}function D(){}function B(e,t,n){this.props=e,this.context=t,this.refs=M,this.updater=n||A}L.prototype.isReactComponent={},L.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)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")},L.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},D.prototype=L.prototype;var z=B.prototype=new D;z.constructor=B,R(z,L.prototype),z.isPureReactComponent=!0;var U=Array.isArray;function F(){}var q={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function W(e,t,n){var r=n.ref;return{$$typeof:w,type:e,key:t,ref:void 0!==r?r:null,props:n}}function V(e){return"object"==typeof e&&null!==e&&e.$$typeof===w}var $=/\/+/g;function K(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=""+e.key,r={"=":"=0",":":"=2"},"$"+n.replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function Q(e,t,n,r,i){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var a,s,l=!1;if(null===e)l=!0;else switch(o){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case w:case x:l=!0;break;case j:return Q((l=e._init)(e._payload),t,n,r,i)}}if(l)return i=i(e),l=""===r?"."+K(e,0):r,U(i)?(n="",null!=l&&(n=l.replace($,"$&/")+"/"),Q(i,t,n,"",function(e){return e})):null!=i&&(V(i)&&(a=i,s=n+(null==i.key||e&&e.key===i.key?"":(""+i.key).replace($,"$&/")+"/")+l,i=W(a.type,s,a.props)),t.push(i)),1;l=0;var c,u=""===r?".":r+":";if(U(e))for(var d=0;d<e.length;d++)l+=Q(r=e[d],t,n,o=u+K(r,d),i);else if("function"==typeof(d=null===(c=e)||"object"!=typeof c?null:"function"==typeof(c=P&&c[P]||c["@@iterator"])?c:null))for(e=d.call(e),d=0;!(r=e.next()).done;)l+=Q(r=r.value,t,n,o=u+K(r,d++),i);else if("object"===o){if("function"==typeof e.then)return Q(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(F,F):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),t,n,r,i);throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return l}function J(e,t,n){if(null==e)return e;var r=[],i=0;return Q(e,r,"","",function(e){return t.call(n,e,i++)}),r}function Y(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var G="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},X={map:J,forEach:function(e,t,n){J(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return J(e,function(){t++}),t},toArray:function(e){return J(e,function(e){return e})||[]},only:function(e){if(!V(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};b.Activity=O,b.Children=X,b.Component=L,b.Fragment=k,b.Profiler=C,b.PureComponent=B,b.StrictMode=S,b.Suspense=I,b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,b.__COMPILER_RUNTIME={__proto__:null,c:function(e){return q.H.useMemoCache(e)}},b.cache=function(e){return function(){return e.apply(null,arguments)}},b.cacheSignal=function(){return null},b.cloneElement=function(e,t,n){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var r=R({},e.props),i=e.key;if(null!=t)for(o in void 0!==t.key&&(i=""+t.key),t)!H.call(t,o)||"key"===o||"__self"===o||"__source"===o||"ref"===o&&void 0===t.ref||(r[o]=t[o]);var o=arguments.length-2;if(1===o)r.children=n;else if(1<o){for(var a=Array(o),s=0;s<o;s++)a[s]=arguments[s+2];r.children=a}return W(e.type,i,r)},b.createContext=function(e){return(e={$$typeof:E,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:_,_context:e},e},b.createElement=function(e,t,n){var r,i={},o=null;if(null!=t)for(r in void 0!==t.key&&(o=""+t.key),t)H.call(t,r)&&"key"!==r&&"__self"!==r&&"__source"!==r&&(i[r]=t[r]);var a=arguments.length-2;if(1===a)i.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];i.children=s}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===i[r]&&(i[r]=a[r]);return W(e,o,i)},b.createRef=function(){return{current:null}},b.forwardRef=function(e){return{$$typeof:N,render:e}},b.isValidElement=V,b.lazy=function(e){return{$$typeof:j,_payload:{_status:-1,_result:e},_init:Y}},b.memo=function(e,t){return{$$typeof:T,type:e,compare:void 0===t?null:t}},b.startTransition=function(e){var t=q.T,n={};q.T=n;try{var r=e(),i=q.S;null!==i&&i(n,r),"object"==typeof r&&null!==r&&"function"==typeof r.then&&r.then(F,G)}catch(e){G(e)}finally{null!==t&&null!==n.types&&(t.types=n.types),q.T=t}},b.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},b.use=function(e){return q.H.use(e)},b.useActionState=function(e,t,n){return q.H.useActionState(e,t,n)},b.useCallback=function(e,t){return q.H.useCallback(e,t)},b.useContext=function(e){return q.H.useContext(e)},b.useDebugValue=function(){},b.useDeferredValue=function(e,t){return q.H.useDeferredValue(e,t)},b.useEffect=function(e,t){return q.H.useEffect(e,t)},b.useEffectEvent=function(e){return q.H.useEffectEvent(e)},b.useId=function(){return q.H.useId()},b.useImperativeHandle=function(e,t,n){return q.H.useImperativeHandle(e,t,n)},b.useInsertionEffect=function(e,t){return q.H.useInsertionEffect(e,t)},b.useLayoutEffect=function(e,t){return q.H.useLayoutEffect(e,t)},b.useMemo=function(e,t){return q.H.useMemo(e,t)},b.useOptimistic=function(e,t){return q.H.useOptimistic(e,t)},b.useReducer=function(e,t,n){return q.H.useReducer(e,t,n)},b.useRef=function(e){return q.H.useRef(e)},b.useState=function(e){return q.H.useState(e)},b.useSyncExternalStore=function(e,t,n){return q.H.useSyncExternalStore(e,t,n)},b.useTransition=function(){return q.H.useTransition()},b.version="19.2.5",y.exports=b;var Z=y.exports,ee=a(Z),te={exports:{}},ne={},re=Z;function ie(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 oe(){}var ae={d:{f:oe,r:function(){throw Error(ie(522))},D:oe,C:oe,L:oe,m:oe,X:oe,S:oe,M:oe},p:0,findDOMNode:null},se=Symbol.for("react.portal");var le=re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function ce(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}ne.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ae,ne.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error(ie(299));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:se,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},ne.flushSync=function(e){var t=le.T,n=ae.p;try{if(le.T=null,ae.p=2,e)return e()}finally{le.T=t,ae.p=n,ae.d.f()}},ne.preconnect=function(e,t){"string"==typeof e&&(t?t="string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:t=null,ae.d.C(e,t))},ne.prefetchDNS=function(e){"string"==typeof e&&ae.d.D(e)},ne.preinit=function(e,t){if("string"==typeof e&&t&&"string"==typeof t.as){var n=t.as,r=ce(n,t.crossOrigin),i="string"==typeof t.integrity?t.integrity:void 0,o="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===n?ae.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):"script"===n&&ae.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},ne.preinitModule=function(e,t){if("string"==typeof e)if("object"==typeof t&&null!==t){if(null==t.as||"script"===t.as){var n=ce(t.as,t.crossOrigin);ae.d.M(e,{crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})}}else null==t&&ae.d.M(e)},ne.preload=function(e,t){if("string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var n=t.as,r=ce(n,t.crossOrigin);ae.d.L(e,n,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},ne.preloadModule=function(e,t){if("string"==typeof e)if(t){var n=ce(t.as,t.crossOrigin);ae.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0})}else ae.d.m(e)},ne.requestFormReset=function(e){ae.d.r(e)},ne.unstable_batchedUpdates=function(e,t){return e(t)},ne.useFormState=function(e,t,n){return le.H.useFormState(e,t,n)},ne.useFormStatus=function(){return le.H.useHostTransitionStatus()},ne.version="19.2.5",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),te.exports=ne;var ue=te.exports,de=g,fe=Z,pe=ue;function he(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 me(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function ve(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function ge(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function ye(e){if(31===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function be(e){if(ve(e)!==e)throw Error(he(188))}function we(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=we(e)))return t;e=e.sibling}return null}var xe=Object.assign,ke=Symbol.for("react.element"),Se=Symbol.for("react.transitional.element"),Ce=Symbol.for("react.portal"),_e=Symbol.for("react.fragment"),Ee=Symbol.for("react.strict_mode"),Ne=Symbol.for("react.profiler"),Ie=Symbol.for("react.consumer"),Te=Symbol.for("react.context"),je=Symbol.for("react.forward_ref"),Oe=Symbol.for("react.suspense"),Pe=Symbol.for("react.suspense_list"),Ae=Symbol.for("react.memo"),Re=Symbol.for("react.lazy"),Me=Symbol.for("react.activity"),Le=Symbol.for("react.memo_cache_sentinel"),De=Symbol.iterator;function Be(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=De&&e[De]||e["@@iterator"])?e:null}var ze=Symbol.for("react.client.reference");function Ue(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===ze?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case _e:return"Fragment";case Ne:return"Profiler";case Ee:return"StrictMode";case Oe:return"Suspense";case Pe:return"SuspenseList";case Me:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case Ce:return"Portal";case Te:return e.displayName||"Context";case Ie:return(e._context.displayName||"Context")+".Consumer";case je:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case Ae:return null!==(t=e.displayName||null)?t:Ue(e.type)||"Memo";case Re:t=e._payload,e=e._init;try{return Ue(e(t))}catch(e){}}return null}var Fe=Array.isArray,qe=fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,He=pe.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,We={pending:!1,data:null,method:null,action:null},Ve=[],$e=-1;function Ke(e){return{current:e}}function Qe(e){0>$e||(e.current=Ve[$e],Ve[$e]=null,$e--)}function Je(e,t){$e++,Ve[$e]=e.current,e.current=t}var Ye,Ge,Xe=Ke(null),Ze=Ke(null),et=Ke(null),tt=Ke(null);function nt(e,t){switch(Je(et,t),Je(Ze,e),Je(Xe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ef(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=Nf(t=Ef(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Qe(Xe),Je(Xe,e)}function rt(){Qe(Xe),Qe(Ze),Qe(et)}function it(e){null!==e.memoizedState&&Je(tt,e);var t=Xe.current,n=Nf(t,e.type);t!==n&&(Je(Ze,e),Je(Xe,n))}function ot(e){Ze.current===e&&(Qe(Xe),Qe(Ze)),tt.current===e&&(Qe(tt),bp._currentValue=We)}function at(e){if(void 0===Ye)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ye=t&&t[1]||"",Ge=-1<e.stack.indexOf("\n at")?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+Ye+e+Ge}var st=!1;function lt(e,t){if(!e||st)return"";st=!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()}}),"object"==typeof Reflect&&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())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(e){if(e&&r&&"string"==typeof e.stack)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 o=r.DetermineComponentFrameRoot(),a=o[0],s=o[1];if(a&&s){var l=a.split("\n"),c=s.split("\n");for(i=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;i<c.length&&!c[i].includes("DetermineComponentFrameRoot");)i++;if(r===l.length||i===c.length)for(r=l.length-1,i=c.length-1;1<=r&&0<=i&&l[r]!==c[i];)i--;for(;1<=r&&0<=i;r--,i--)if(l[r]!==c[i]){if(1!==r||1!==i)do{if(r--,0>--i||l[r]!==c[i]){var u="\n"+l[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{st=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?at(n):""}function ct(e,t){switch(e.tag){case 26:case 27:case 5:return at(e.type);case 16:return at("Lazy");case 13:return e.child!==t&&null!==t?at("Suspense Fallback"):at("Suspense");case 19:return at("SuspenseList");case 0:case 15:return lt(e.type,!1);case 11:return lt(e.type.render,!1);case 1:return lt(e.type,!0);case 31:return at("Activity");default:return""}}function ut(e){try{var t="",n=null;do{t+=ct(e,n),n=e,e=e.return}while(e);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}var dt=Object.prototype.hasOwnProperty,ft=de.unstable_scheduleCallback,pt=de.unstable_cancelCallback,ht=de.unstable_shouldYield,mt=de.unstable_requestPaint,vt=de.unstable_now,gt=de.unstable_getCurrentPriorityLevel,yt=de.unstable_ImmediatePriority,bt=de.unstable_UserBlockingPriority,wt=de.unstable_NormalPriority,xt=de.unstable_LowPriority,kt=de.unstable_IdlePriority,St=de.log,Ct=de.unstable_setDisableYieldValue,_t=null,Et=null;function Nt(e){if("function"==typeof St&&Ct(e),Et&&"function"==typeof Et.setStrictMode)try{Et.setStrictMode(_t,e)}catch(e){}}var It=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(Tt(e)/jt|0)|0},Tt=Math.log,jt=Math.LN2;var Ot=256,Pt=262144,At=4194304;function Rt(e){var t=42&e;if(0!==t)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 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Mt(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var i=0,o=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var s=134217727&r;return 0!==s?0!==(r=s&~o)?i=Rt(r):0!==(a&=s)?i=Rt(a):n||0!==(n=s&~e)&&(i=Rt(n)):0!==(s=r&~o)?i=Rt(s):0!==a?i=Rt(a):n||0!==(n=r&~e)&&(i=Rt(n)),0===i?0:0!==t&&t!==i&&0===(t&o)&&((o=i&-i)>=(n=t&-t)||32===o&&4194048&n)?t:i}function Lt(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Dt(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;default:return-1}}function Bt(){var e=At;return!(62914560&(At<<=1))&&(At=4194304),e}function zt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ut(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ft(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-It(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|261930&n}function qt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-It(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ht(e,t){var n=t&-t;return 0!==((n=42&n?1:Wt(n))&(e.suspendedLanes|t))?0:n}function Wt(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 Vt(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function $t(){var e=He.p;return 0!==e?e:void 0===(e=window.event)?32:Mp(e.type)}function Kt(e,t){var n=He.p;try{return He.p=e,t()}finally{He.p=n}}var Qt=Math.random().toString(36).slice(2),Jt="__reactFiber$"+Qt,Yt="__reactProps$"+Qt,Gt="__reactContainer$"+Qt,Xt="__reactEvents$"+Qt,Zt="__reactListeners$"+Qt,en="__reactHandles$"+Qt,tn="__reactResources$"+Qt,nn="__reactMarker$"+Qt;function rn(e){delete e[Jt],delete e[Yt],delete e[Xt],delete e[Zt],delete e[en]}function on(e){var t=e[Jt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gt]||n[Jt]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Vf(e);null!==e;){if(n=e[Jt])return n;e=Vf(e)}return t}n=(e=n).parentNode}return null}function an(e){if(e=e[Jt]||e[Gt]){var t=e.tag;if(5===t||6===t||13===t||31===t||26===t||27===t||3===t)return e}return null}function sn(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e.stateNode;throw Error(he(33))}function ln(e){var t=e[tn];return t||(t=e[tn]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function cn(e){e[nn]=!0}var un=new Set,dn={};function fn(e,t){pn(e,t),pn(e+"Capture",t)}function pn(e,t){for(dn[e]=t,e=0;e<t.length;e++)un.add(t[e])}var hn=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]*$"),mn={},vn={};function gn(e,t,n){if(i=t,dt.call(vn,i)||!dt.call(mn,i)&&(hn.test(i)?vn[i]=!0:(mn[i]=!0,0)))if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var r=t.toLowerCase().slice(0,5);if("data-"!==r&&"aria-"!==r)return void e.removeAttribute(t)}e.setAttribute(t,""+n)}var i}function yn(e,t,n){if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+n)}}function bn(e,t,n,r){if(null===r)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(n)}e.setAttributeNS(t,n,""+r)}}function wn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function xn(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function kn(e){if(!e._valueTracker){var t=xn(e)?"checked":"value";e._valueTracker=function(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&void 0!==r&&"function"==typeof r.get&&"function"==typeof r.set){var i=r.get,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=""+e,o.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]}}}}(e,t,""+e[t])}}function Sn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=xn(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Cn(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var _n=/[\n"\\]/g;function En(e){return e.replace(_n,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Nn(e,t,n,r,i,o,a,s){e.name="",null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a?e.type=a:e.removeAttribute("type"),null!=t?"number"===a?(0===t&&""===e.value||e.value!=t)&&(e.value=""+wn(t)):e.value!==""+wn(t)&&(e.value=""+wn(t)):"submit"!==a&&"reset"!==a||e.removeAttribute("value"),null!=t?Tn(e,a,wn(t)):null!=n?Tn(e,a,wn(n)):null!=r&&e.removeAttribute("value"),null==i&&null!=o&&(e.defaultChecked=!!o),null!=i&&(e.checked=i&&"function"!=typeof i&&"symbol"!=typeof i),null!=s&&"function"!=typeof s&&"symbol"!=typeof s&&"boolean"!=typeof s?e.name=""+wn(s):e.removeAttribute("name")}function In(e,t,n,r,i,o,a,s){if(null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.type=o),null!=t||null!=n){if(("submit"===o||"reset"===o)&&null==t)return void kn(e);n=null!=n?""+wn(n):"",t=null!=t?""+wn(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=null!=r?r:i)&&"symbol"!=typeof r&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.name=a),kn(e)}function Tn(e,t,n){"number"===t&&Cn(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function jn(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=""+wn(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function On(e,t,n){null==t||((t=""+wn(t))!==e.value&&(e.value=t),null!=n)?e.defaultValue=null!=n?""+wn(n):"":e.defaultValue!==t&&(e.defaultValue=t)}function Pn(e,t,n,r){if(null==t){if(null!=r){if(null!=n)throw Error(he(92));if(Fe(r)){if(1<r.length)throw Error(he(93));r=r[0]}n=r}null==n&&(n=""),t=n}n=wn(t),e.defaultValue=n,(r=e.textContent)===n&&""!==r&&null!==r&&(e.value=r),kn(e)}function An(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var Rn=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 Mn(e,t,n){var r=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?r?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":r?e.setProperty(t,n):"number"!=typeof n||0===n||Rn.has(t)?"float"===t?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Ln(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(he(62));if(e=e.style,null!=n){for(var r in n)!n.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Mn(e,i,r)}else for(var o in t)t.hasOwnProperty(o)&&Mn(e,o,t[o])}function Dn(e){if(-1===e.indexOf("-"))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 Bn=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"]]),zn=/^[\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 Un(e){return zn.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Fn(){}var qn=null;function Hn(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Wn=null,Vn=null;function $n(e){var t=an(e);if(t&&(e=t.stateNode)){var n=e[Yt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Nn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+En(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[Yt]||null;if(!i)throw Error(he(90));Nn(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)(r=n[t]).form===e.form&&Sn(r)}break e;case"textarea":On(e,n.value,n.defaultValue);break e;case"select":null!=(t=n.value)&&jn(e,!!n.multiple,t,!1)}}}var Kn=!1;function Qn(e,t,n){if(Kn)return e(t,n);Kn=!0;try{return e(t)}finally{if(Kn=!1,(null!==Wn||null!==Vn)&&(sd(),Wn&&(t=Wn,e=Vn,Vn=Wn=null,$n(t),e)))for(t=0;t<e.length;t++)$n(e[t])}}function Jn(e,t){var n=e.stateNode;if(null===n)return null;var r=n[Yt]||null;if(null===r)return null;n=r[t];e: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)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(he(231,t,typeof n));return n}var Yn=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Gn=!1;if(Yn)try{var Xn={};Object.defineProperty(Xn,"passive",{get:function(){Gn=!0}}),window.addEventListener("test",Xn,Xn),window.removeEventListener("test",Xn,Xn)}catch(e){Gn=!1}var Zn=null,er=null,tr=null;function nr(){if(tr)return tr;var e,t,n=er,r=n.length,i="value"in Zn?Zn.value:Zn.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===i[o-t];t++);return tr=i.slice(e,1<t?1-t:void 0)}function rr(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function ir(){return!0}function or(){return!1}function ar(e){function t(t,n,r,i,o){for(var a in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(a)&&(t=e[a],this[a]=t?t(i):i[a]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?ir:or,this.isPropagationStopped=or,this}return xe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=ir)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=ir)},persist:function(){},isPersistent:ir}),t}var sr,lr,cr,ur={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dr=ar(ur),fr=xe({},ur,{view:0,detail:0}),pr=ar(fr),hr=xe({},fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_r,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==cr&&(cr&&"mousemove"===e.type?(sr=e.screenX-cr.screenX,lr=e.screenY-cr.screenY):lr=sr=0,cr=e),sr)},movementY:function(e){return"movementY"in e?e.movementY:lr}}),mr=ar(hr),vr=ar(xe({},hr,{dataTransfer:0})),gr=ar(xe({},fr,{relatedTarget:0})),yr=ar(xe({},ur,{animationName:0,elapsedTime:0,pseudoElement:0})),br=ar(xe({},ur,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),wr=ar(xe({},ur,{data:0})),xr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kr={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"},Sr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Sr[e])&&!!t[e]}function _r(){return Cr}var Er=ar(xe({},fr,{key:function(e){if(e.key){var t=xr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=rr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?kr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_r,charCode:function(e){return"keypress"===e.type?rr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?rr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),Nr=ar(xe({},hr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ir=ar(xe({},fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_r})),Tr=ar(xe({},ur,{propertyName:0,elapsedTime:0,pseudoElement:0})),jr=ar(xe({},hr,{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})),Or=ar(xe({},ur,{newState:0,oldState:0})),Pr=[9,13,27,32],Ar=Yn&&"CompositionEvent"in window,Rr=null;Yn&&"documentMode"in document&&(Rr=document.documentMode);var Mr=Yn&&"TextEvent"in window&&!Rr,Lr=Yn&&(!Ar||Rr&&8<Rr&&11>=Rr),Dr=String.fromCharCode(32),Br=!1;function zr(e,t){switch(e){case"keyup":return-1!==Pr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ur(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Fr=!1;var qr={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 Hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!qr[e.type]:"textarea"===t}function Wr(e,t,n,r){Wn?Vn?Vn.push(r):Vn=[r]:Wn=r,0<(t=ff(t,"onChange")).length&&(n=new dr("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Vr=null,$r=null;function Kr(e){rf(e,0)}function Qr(e){if(Sn(sn(e)))return e}function Jr(e,t){if("change"===e)return t}var Yr=!1;if(Yn){var Gr;if(Yn){var Xr="oninput"in document;if(!Xr){var Zr=document.createElement("div");Zr.setAttribute("oninput","return;"),Xr="function"==typeof Zr.oninput}Gr=Xr}else Gr=!1;Yr=Gr&&(!document.documentMode||9<document.documentMode)}function ei(){Vr&&(Vr.detachEvent("onpropertychange",ti),$r=Vr=null)}function ti(e){if("value"===e.propertyName&&Qr($r)){var t=[];Wr(t,$r,e,Hn(e)),Qn(Kr,t)}}function ni(e,t,n){"focusin"===e?(ei(),$r=n,(Vr=t).attachEvent("onpropertychange",ti)):"focusout"===e&&ei()}function ri(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qr($r)}function ii(e,t){if("click"===e)return Qr(t)}function oi(e,t){if("input"===e||"change"===e)return Qr(t)}var ai="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function si(e,t){if(ai(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===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(!dt.call(t,i)||!ai(e[i],t[i]))return!1}return!0}function li(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ci(e,t){var n,r=li(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=li(r)}}function ui(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ui(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function di(e){for(var t=Cn((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Cn((e=t.contentWindow).document)}return t}function fi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var pi=Yn&&"documentMode"in document&&11>=document.documentMode,hi=null,mi=null,vi=null,gi=!1;function yi(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;gi||null==hi||hi!==Cn(r)||("selectionStart"in(r=hi)&&fi(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},vi&&si(vi,r)||(vi=r,0<(r=ff(mi,"onSelect")).length&&(t=new dr("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=hi)))}function bi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var wi={animationend:bi("Animation","AnimationEnd"),animationiteration:bi("Animation","AnimationIteration"),animationstart:bi("Animation","AnimationStart"),transitionrun:bi("Transition","TransitionRun"),transitionstart:bi("Transition","TransitionStart"),transitioncancel:bi("Transition","TransitionCancel"),transitionend:bi("Transition","TransitionEnd")},xi={},ki={};function Si(e){if(xi[e])return xi[e];if(!wi[e])return e;var t,n=wi[e];for(t in n)if(n.hasOwnProperty(t)&&t in ki)return xi[e]=n[t];return e}Yn&&(ki=document.createElement("div").style,"AnimationEvent"in window||(delete wi.animationend.animation,delete wi.animationiteration.animation,delete wi.animationstart.animation),"TransitionEvent"in window||delete wi.transitionend.transition);var Ci=Si("animationend"),_i=Si("animationiteration"),Ei=Si("animationstart"),Ni=Si("transitionrun"),Ii=Si("transitionstart"),Ti=Si("transitioncancel"),ji=Si("transitionend"),Oi=new Map,Pi="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(" ");function Ai(e,t){Oi.set(e,t),fn(t,[e])}Pi.push("scrollEnd");var Ri="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},Mi=[],Li=0,Di=0;function Bi(){for(var e=Li,t=Di=Li=0;t<e;){var n=Mi[t];Mi[t++]=null;var r=Mi[t];Mi[t++]=null;var i=Mi[t];Mi[t++]=null;var o=Mi[t];if(Mi[t++]=null,null!==r&&null!==i){var a=r.pending;null===a?i.next=i:(i.next=a.next,a.next=i),r.pending=i}0!==o&&qi(n,i,o)}}function zi(e,t,n,r){Mi[Li++]=e,Mi[Li++]=t,Mi[Li++]=n,Mi[Li++]=r,Di|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function Ui(e,t,n,r){return zi(e,t,n,r),Hi(e)}function Fi(e,t){return zi(e,null,null,t),Hi(e)}function qi(e,t,n){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n);for(var i=!1,o=e.return;null!==o;)o.childLanes|=n,null!==(r=o.alternate)&&(r.childLanes|=n),22===o.tag&&(null===(e=o.stateNode)||1&e._visibility||(i=!0)),e=o,o=o.return;return 3===e.tag?(o=e.stateNode,i&&null!==t&&(i=31-It(n),null===(r=(e=o.hiddenUpdates)[i])?e[i]=[t]:r.push(t),t.lane=536870912|n),o):null}function Hi(e){if(50<Xu)throw Xu=0,Zu=null,Error(he(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var Wi={};function Vi(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 $i(e,t,n,r){return new Vi(e,t,n,r)}function Ki(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Qi(e,t){var n=e.alternate;return null===n?((n=$i(e.tag,t,e.key,e.mode)).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=65011712&e.flags,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=null===t?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 Ji(e,t){e.flags&=65011714;var n=e.alternate;return null===n?(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=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Yi(e,t,n,r,i,o){var a=0;if(r=e,"function"==typeof e)Ki(e)&&(a=1);else if("string"==typeof e)a=function(e,t,n){if(1===n||null!=t.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!=typeof t.precedence||"string"!=typeof t.href||""===t.href)break;return!0;case"link":if("string"!=typeof t.rel||"string"!=typeof t.href||""===t.href||t.onLoad||t.onError)break;return"stylesheet"!==t.rel||(e=t.disabled,"string"==typeof t.precedence&&null==e);case"script":if(t.async&&"function"!=typeof t.async&&"symbol"!=typeof t.async&&!t.onLoad&&!t.onError&&t.src&&"string"==typeof t.src)return!0}return!1}(e,n,Xe.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case Me:return(e=$i(31,n,t,i)).elementType=Me,e.lanes=o,e;case _e:return Gi(n.children,i,o,t);case Ee:a=8,i|=24;break;case Ne:return(e=$i(12,n,t,2|i)).elementType=Ne,e.lanes=o,e;case Oe:return(e=$i(13,n,t,i)).elementType=Oe,e.lanes=o,e;case Pe:return(e=$i(19,n,t,i)).elementType=Pe,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case Te:a=10;break e;case Ie:a=9;break e;case je:a=11;break e;case Ae:a=14;break e;case Re:a=16,r=null;break e}a=29,n=Error(he(130,null===e?"null":typeof e,"")),r=null}return(t=$i(a,n,t,i)).elementType=e,t.type=r,t.lanes=o,t}function Gi(e,t,n,r){return(e=$i(7,e,r,t)).lanes=n,e}function Xi(e,t,n){return(e=$i(6,e,null,t)).lanes=n,e}function Zi(e){var t=$i(18,null,null,0);return t.stateNode=e,t}function eo(e,t,n){return(t=$i(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var to=new WeakMap;function no(e,t){if("object"==typeof e&&null!==e){var n=to.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ut(t)},to.set(e,t),t)}return{value:e,source:t,stack:ut(t)}}var ro=[],io=0,oo=null,ao=0,so=[],lo=0,co=null,uo=1,fo="";function po(e,t){ro[io++]=ao,ro[io++]=oo,oo=e,ao=t}function ho(e,t,n){so[lo++]=uo,so[lo++]=fo,so[lo++]=co,co=e;var r=uo;e=fo;var i=32-It(r)-1;r&=~(1<<i),n+=1;var o=32-It(t)+i;if(30<o){var a=i-i%5;o=(r&(1<<a)-1).toString(32),r>>=a,i-=a,uo=1<<32-It(t)+i|n<<i|r,fo=o+e}else uo=1<<o|n<<i|r,fo=e}function mo(e){null!==e.return&&(po(e,1),ho(e,1,0))}function vo(e){for(;e===oo;)oo=ro[--io],ro[io]=null,ao=ro[--io],ro[io]=null;for(;e===co;)co=so[--lo],so[lo]=null,fo=so[--lo],so[lo]=null,uo=so[--lo],so[lo]=null}function go(e,t){so[lo++]=uo,so[lo++]=fo,so[lo++]=co,uo=t.id,fo=t.overflow,co=e}var yo=null,bo=null,wo=!1,xo=null,ko=!1,So=Error(he(519));function Co(e){throw jo(no(Error(he(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML","")),e)),So}function _o(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Jt]=e,t[Yt]=r,n){case"dialog":of("cancel",t),of("close",t);break;case"iframe":case"object":case"embed":of("load",t);break;case"video":case"audio":for(n=0;n<tf.length;n++)of(tf[n],t);break;case"source":of("error",t);break;case"img":case"image":case"link":of("error",t),of("load",t);break;case"details":of("toggle",t);break;case"input":of("invalid",t),In(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":of("invalid",t);break;case"textarea":of("invalid",t),Pn(t,r.value,r.defaultValue,r.children)}"string"!=typeof(n=r.children)&&"number"!=typeof n&&"bigint"!=typeof n||t.textContent===""+n||!0===r.suppressHydrationWarning||yf(t.textContent,n)?(null!=r.popover&&(of("beforetoggle",t),of("toggle",t)),null!=r.onScroll&&of("scroll",t),null!=r.onScrollEnd&&of("scrollend",t),null!=r.onClick&&(t.onclick=Fn),t=!0):t=!1,t||Co(e,!0)}function Eo(e){for(yo=e.return;yo;)switch(yo.tag){case 5:case 31:case 13:return void(ko=!1);case 27:case 3:return void(ko=!0);default:yo=yo.return}}function No(e){if(e!==yo)return!1;if(!wo)return Eo(e),wo=!0,!1;var t,n=e.tag;if((t=3!==n&&27!==n)&&((t=5===n)&&(t=!("form"!==(t=e.type)&&"button"!==t)||If(e.type,e.memoizedProps)),t=!t),t&&bo&&Co(e),Eo(e),13===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(he(317));bo=Wf(e)}else if(31===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(he(317));bo=Wf(e)}else 27===n?(n=bo,Mf(e.type)?(e=Hf,Hf=null,bo=e):bo=n):bo=yo?qf(e.stateNode.nextSibling):null;return!0}function Io(){bo=yo=null,wo=!1}function To(){var e=xo;return null!==e&&(null===Bu?Bu=e:Bu.push.apply(Bu,e),xo=null),e}function jo(e){null===xo?xo=[e]:xo.push(e)}var Oo=Ke(null),Po=null,Ao=null;function Ro(e,t,n){Je(Oo,t._currentValue),t._currentValue=n}function Mo(e){e._currentValue=Oo.current,Qe(Oo)}function Lo(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Do(e,t,n,r){var i=e.child;for(null!==i&&(i.return=e);null!==i;){var o=i.dependencies;if(null!==o){var a=i.child;o=o.firstContext;e:for(;null!==o;){var s=o;o=i;for(var l=0;l<t.length;l++)if(s.context===t[l]){o.lanes|=n,null!==(s=o.alternate)&&(s.lanes|=n),Lo(o.return,n,e),r||(a=null);break e}o=s.next}}else if(18===i.tag){if(null===(a=i.return))throw Error(he(341));a.lanes|=n,null!==(o=a.alternate)&&(o.lanes|=n),Lo(a,n,e),a=null}else a=i.child;if(null!==a)a.return=i;else for(a=i;null!==a;){if(a===e){a=null;break}if(null!==(i=a.sibling)){i.return=a.return,a=i;break}a=a.return}i=a}}function Bo(e,t,n,r){e=null;for(var i=t,o=!1;null!==i;){if(!o)if(524288&i.flags)o=!0;else if(262144&i.flags)break;if(10===i.tag){var a=i.alternate;if(null===a)throw Error(he(387));if(null!==(a=a.memoizedProps)){var s=i.type;ai(i.pendingProps.value,a.value)||(null!==e?e.push(s):e=[s])}}else if(i===tt.current){if(null===(a=i.alternate))throw Error(he(387));a.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(null!==e?e.push(bp):e=[bp])}i=i.return}null!==e&&Do(t,e,n,r),t.flags|=262144}function zo(e){for(e=e.firstContext;null!==e;){if(!ai(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Uo(e){Po=e,Ao=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Fo(e){return Ho(Po,e)}function qo(e,t){return null===Po&&Uo(e),Ho(e,t)}function Ho(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},null===Ao){if(null===e)throw Error(he(308));Ao=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ao=Ao.next=t;return n}var Wo="undefined"!=typeof AbortController?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()})}},Vo=de.unstable_scheduleCallback,$o=de.unstable_NormalPriority,Ko={$$typeof:Te,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qo(){return{controller:new Wo,data:new Map,refCount:0}}function Jo(e){e.refCount--,0===e.refCount&&Vo($o,function(){e.controller.abort()})}var Yo=null,Go=0,Xo=0,Zo=null;function ea(){if(0===--Go&&null!==Yo){null!==Zo&&(Zo.status="fulfilled");var e=Yo;Yo=null,Xo=0,Zo=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var ta=qe.S;qe.S=function(e,t){Fu=vt(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===Yo){var n=Yo=[];Go=0,Xo=Yd(),Zo={status:"pending",value:void 0,then:function(e){n.push(e)}}}Go++,t.then(ea,ea)}(0,t),null!==ta&&ta(e,t)};var na=Ke(null);function ra(){var e=na.current;return null!==e?e:ku.pooledCache}function ia(e,t){Je(na,null===t?na.current:t.pool)}function oa(){var e=ra();return null===e?null:{parent:Ko._currentValue,pool:e}}var aa=Error(he(460)),sa=Error(he(474)),la=Error(he(542)),ca={then:function(){}};function ua(e){return"fulfilled"===(e=e.status)||"rejected"===e}function da(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(Fn,Fn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw ma(e=t.reason),e;default:if("string"==typeof t.status)t.then(Fn,Fn);else{if(null!==(e=ku)&&100<e.shellSuspendCounter)throw Error(he(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw ma(e=t.reason),e}throw pa=t,aa}}function fa(e){try{return(0,e._init)(e._payload)}catch(e){if(null!==e&&"object"==typeof e&&"function"==typeof e.then)throw pa=e,aa;throw e}}var pa=null;function ha(){if(null===pa)throw Error(he(459));var e=pa;return pa=null,e}function ma(e){if(e===aa||e===la)throw Error(he(483))}var va=null,ga=0;function ya(e){var t=ga;return ga+=1,null===va&&(va=[]),da(va,e,t)}function ba(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function wa(e,t){if(t.$$typeof===ke)throw Error(he(525));throw e=Object.prototype.toString.call(t),Error(he(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function xa(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function i(e,t){return(e=Qi(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=67108866,n):r:(t.flags|=67108866,n):(t.flags|=1048576,n)}function a(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Xi(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function l(e,t,n,r){var o=n.type;return o===_e?u(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===Re&&fa(o)===t.type)?(ba(t=i(t,n.props),n),t.return=e,t):(ba(t=Yi(n.type,n.key,n.props,null,e.mode,r),n),t.return=e,t)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=eo(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function u(e,t,n,r,o){return null===t||7!==t.tag?((t=Gi(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function d(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Xi(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case Se:return ba(n=Yi(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case Ce:return(t=eo(t,e.mode,n)).return=e,t;case Re:return d(e,t=fa(t),n)}if(Fe(t)||Be(t))return(t=Gi(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return d(e,ya(t),n);if(t.$$typeof===Te)return d(e,qo(e,t),n);wa(e,t)}return null}function f(e,t,n,r){var i=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==i?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case Se:return n.key===i?l(e,t,n,r):null;case Ce:return n.key===i?c(e,t,n,r):null;case Re:return f(e,t,n=fa(n),r)}if(Fe(n)||Be(n))return null!==i?null:u(e,t,n,r,null);if("function"==typeof n.then)return f(e,t,ya(n),r);if(n.$$typeof===Te)return f(e,t,qo(e,n),r);wa(e,n)}return null}function p(e,t,n,r,i){if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return s(t,e=e.get(n)||null,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case Se:return l(t,e=e.get(null===r.key?n:r.key)||null,r,i);case Ce:return c(t,e=e.get(null===r.key?n:r.key)||null,r,i);case Re:return p(e,t,n,r=fa(r),i)}if(Fe(r)||Be(r))return u(t,e=e.get(n)||null,r,i,null);if("function"==typeof r.then)return p(e,t,n,ya(r),i);if(r.$$typeof===Te)return p(e,t,n,qo(t,r),i);wa(t,r)}return null}function h(s,l,c,u){if("object"==typeof c&&null!==c&&c.type===_e&&null===c.key&&(c=c.props.children),"object"==typeof c&&null!==c){switch(c.$$typeof){case Se:e:{for(var m=c.key;null!==l;){if(l.key===m){if((m=c.type)===_e){if(7===l.tag){n(s,l.sibling),(u=i(l,c.props.children)).return=s,s=u;break e}}else if(l.elementType===m||"object"==typeof m&&null!==m&&m.$$typeof===Re&&fa(m)===l.type){n(s,l.sibling),ba(u=i(l,c.props),c),u.return=s,s=u;break e}n(s,l);break}t(s,l),l=l.sibling}c.type===_e?((u=Gi(c.props.children,s.mode,u,c.key)).return=s,s=u):(ba(u=Yi(c.type,c.key,c.props,null,s.mode,u),c),u.return=s,s=u)}return a(s);case Ce:e:{for(m=c.key;null!==l;){if(l.key===m){if(4===l.tag&&l.stateNode.containerInfo===c.containerInfo&&l.stateNode.implementation===c.implementation){n(s,l.sibling),(u=i(l,c.children||[])).return=s,s=u;break e}n(s,l);break}t(s,l),l=l.sibling}(u=eo(c,s.mode,u)).return=s,s=u}return a(s);case Re:return h(s,l,c=fa(c),u)}if(Fe(c))return function(i,a,s,l){for(var c=null,u=null,h=a,m=a=0,v=null;null!==h&&m<s.length;m++){h.index>m?(v=h,h=null):v=h.sibling;var g=f(i,h,s[m],l);if(null===g){null===h&&(h=v);break}e&&h&&null===g.alternate&&t(i,h),a=o(g,a,m),null===u?c=g:u.sibling=g,u=g,h=v}if(m===s.length)return n(i,h),wo&&po(i,m),c;if(null===h){for(;m<s.length;m++)null!==(h=d(i,s[m],l))&&(a=o(h,a,m),null===u?c=h:u.sibling=h,u=h);return wo&&po(i,m),c}for(h=r(h);m<s.length;m++)null!==(v=p(h,i,m,s[m],l))&&(e&&null!==v.alternate&&h.delete(null===v.key?m:v.key),a=o(v,a,m),null===u?c=v:u.sibling=v,u=v);return e&&h.forEach(function(e){return t(i,e)}),wo&&po(i,m),c}(s,l,c,u);if(Be(c)){if("function"!=typeof(m=Be(c)))throw Error(he(150));return function(i,a,s,l){if(null==s)throw Error(he(151));for(var c=null,u=null,h=a,m=a=0,v=null,g=s.next();null!==h&&!g.done;m++,g=s.next()){h.index>m?(v=h,h=null):v=h.sibling;var y=f(i,h,g.value,l);if(null===y){null===h&&(h=v);break}e&&h&&null===y.alternate&&t(i,h),a=o(y,a,m),null===u?c=y:u.sibling=y,u=y,h=v}if(g.done)return n(i,h),wo&&po(i,m),c;if(null===h){for(;!g.done;m++,g=s.next())null!==(g=d(i,g.value,l))&&(a=o(g,a,m),null===u?c=g:u.sibling=g,u=g);return wo&&po(i,m),c}for(h=r(h);!g.done;m++,g=s.next())null!==(g=p(h,i,m,g.value,l))&&(e&&null!==g.alternate&&h.delete(null===g.key?m:g.key),a=o(g,a,m),null===u?c=g:u.sibling=g,u=g);return e&&h.forEach(function(e){return t(i,e)}),wo&&po(i,m),c}(s,l,c=m.call(c),u)}if("function"==typeof c.then)return h(s,l,ya(c),u);if(c.$$typeof===Te)return h(s,l,qo(s,c),u);wa(s,c)}return"string"==typeof c&&""!==c||"number"==typeof c||"bigint"==typeof c?(c=""+c,null!==l&&6===l.tag?(n(s,l.sibling),(u=i(l,c)).return=s,s=u):(n(s,l),(u=Xi(c,s.mode,u)).return=s,s=u),a(s)):n(s,l)}return function(e,t,n,r){try{ga=0;var i=h(e,t,n,r);return va=null,i}catch(t){if(t===aa||t===la)throw t;var o=$i(29,t,null,e.mode);return o.lanes=r,o.return=e,o}}}var ka=xa(!0),Sa=xa(!1),Ca=!1;function _a(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ea(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 Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ia(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&xu){var i=r.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Hi(e),qi(e,null,n),t}return zi(e,r,t,n),Hi(e)}function Ta(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,qt(e,n)}}function ja(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===o?i=o=a:o=o.next=a,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,callbacks:r.callbacks},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Oa=!1;function Pa(){if(Oa){if(null!==Zo)throw Zo}}function Aa(e,t,n,r){Oa=!1;var i=e.updateQueue;Ca=!1;var o=i.firstBaseUpdate,a=i.lastBaseUpdate,s=i.shared.pending;if(null!==s){i.shared.pending=null;var l=s,c=l.next;l.next=null,null===a?o=c:a.next=c,a=l;var u=e.alternate;null!==u&&((s=(u=u.updateQueue).lastBaseUpdate)!==a&&(null===s?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(null!==o){var d=i.baseState;for(a=0,u=c=l=null,s=o;;){var f=-536870913&s.lane,p=f!==s.lane;if(p?(Cu&f)===f:(r&f)===f){0!==f&&f===Xo&&(Oa=!0),null!==u&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var h=e,m=s;f=t;var v=n;switch(m.tag){case 1:if("function"==typeof(h=m.payload)){d=h.call(v,d,f);break e}d=h;break e;case 3:h.flags=-65537&h.flags|128;case 0:if(null==(f="function"==typeof(h=m.payload)?h.call(v,d,f):h))break e;d=xe({},d,f);break e;case 2:Ca=!0}}null!==(f=s.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=i.callbacks)?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===u?(c=u=p,l=d):u=u.next=p,a|=f;if(null===(s=s.next)){if(null===(s=i.shared.pending))break;s=(p=s).next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}null===u&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,null===o&&(i.shared.lanes=0),Pu|=a,e.lanes=a,e.memoizedState=d}}function Ra(e,t){if("function"!=typeof e)throw Error(he(191,e));e.call(t)}function Ma(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)Ra(n[e],t)}var La=Ke(null),Da=Ke(0);function Ba(e,t){Je(Da,e=ju),Je(La,t),ju=e|t.baseLanes}function za(){Je(Da,ju),Je(La,La.current)}function Ua(){ju=Da.current,Qe(La),Qe(Da)}var Fa=Ke(null),qa=null;function Ha(e){var t=e.alternate;Je(Qa,1&Qa.current),Je(Fa,e),null===qa&&(null===t||null!==La.current||null!==t.memoizedState)&&(qa=e)}function Wa(e){Je(Qa,Qa.current),Je(Fa,e),null===qa&&(qa=e)}function Va(e){22===e.tag?(Je(Qa,Qa.current),Je(Fa,e),null===qa&&(qa=e)):$a()}function $a(){Je(Qa,Qa.current),Je(Fa,Fa.current)}function Ka(e){Qe(Fa),qa===e&&(qa=null),Qe(Qa)}var Qa=Ke(0);function Ja(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||Uf(n)||Ff(n)))return t}else if(19!==t.tag||"forwards"!==t.memoizedProps.revealOrder&&"backwards"!==t.memoizedProps.revealOrder&&"unstable_legacy-backwards"!==t.memoizedProps.revealOrder&&"together"!==t.memoizedProps.revealOrder){if(null!==t.child){t.child.return=t,t=t.child;continue}}else if(128&t.flags)return t;if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ya=0,Ga=null,Xa=null,Za=null,es=!1,ts=!1,ns=!1,rs=0,is=0,os=null,as=0;function ss(){throw Error(he(321))}function ls(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ai(e[n],t[n]))return!1;return!0}function cs(e,t,n,r,i,o){return Ya=o,Ga=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,qe.H=null===e||null===e.memoizedState?Cl:_l,ns=!1,o=n(r,i),ns=!1,ts&&(o=ds(t,n,r,i)),us(e),o}function us(e){qe.H=Sl;var t=null!==Xa&&null!==Xa.next;if(Ya=0,Za=Xa=Ga=null,es=!1,is=0,os=null,t)throw Error(he(300));null===e||Fl||null!==(e=e.dependencies)&&zo(e)&&(Fl=!0)}function ds(e,t,n,r){Ga=e;var i=0;do{if(ts&&(os=null),is=0,ts=!1,25<=i)throw Error(he(301));if(i+=1,Za=Xa=null,null!=e.updateQueue){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,null!=o.memoCache&&(o.memoCache.index=0)}qe.H=El,o=t(n,r)}while(ts);return o}function fs(){var e=qe.H,t=e.useState()[0];return t="function"==typeof t.then?ys(t):t,e=e.useState()[0],(null!==Xa?Xa.memoizedState:null)!==e&&(Ga.flags|=1024),t}function ps(){var e=0!==rs;return rs=0,e}function hs(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ms(e){if(es){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}es=!1}Ya=0,Za=Xa=Ga=null,ts=!1,is=rs=0,os=null}function vs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Za?Ga.memoizedState=Za=e:Za=Za.next=e,Za}function gs(){if(null===Xa){var e=Ga.alternate;e=null!==e?e.memoizedState:null}else e=Xa.next;var t=null===Za?Ga.memoizedState:Za.next;if(null!==t)Za=t,Xa=e;else{if(null===e){if(null===Ga.alternate)throw Error(he(467));throw Error(he(310))}e={memoizedState:(Xa=e).memoizedState,baseState:Xa.baseState,baseQueue:Xa.baseQueue,queue:Xa.queue,next:null},null===Za?Ga.memoizedState=Za=e:Za=Za.next=e}return Za}function ys(e){var t=is;return is+=1,null===os&&(os=[]),e=da(os,e,t),t=Ga,null===(null===Za?t.memoizedState:Za.next)&&(t=t.alternate,qe.H=null===t||null===t.memoizedState?Cl:_l),e}function bs(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return ys(e);if(e.$$typeof===Te)return Fo(e)}throw Error(he(438,String(e)))}function ws(e){var t=null,n=Ga.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var r=Ga.alternate;null!==r&&(null!==(r=r.updateQueue)&&(null!=(r=r.memoCache)&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(null==t&&(t={data:[],index:0}),null===n&&(n={lastEffect:null,events:null,stores:null,memoCache:null},Ga.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=Le;return t.index++,n}function xs(e,t){return"function"==typeof t?t(e):t}function ks(e){return Ss(gs(),Xa,e)}function Ss(e,t,n){var r=e.queue;if(null===r)throw Error(he(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,null===i)e.memoizedState=o;else{var s=a=null,l=null,c=t=i.next,u=!1;do{var d=-536870913&c.lane;if(d!==c.lane?(Cu&d)===d:(Ya&d)===d){var f=c.revertLane;if(0===f)null!==l&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),d===Xo&&(u=!0);else{if((Ya&f)===f){c=c.next,f===Xo&&(u=!0);continue}d={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===l?(s=l=d,a=o):l=l.next=d,Ga.lanes|=f,Pu|=f}d=c.action,ns&&n(o,d),o=c.hasEagerState?c.eagerState:n(o,d)}else f={lane:d,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===l?(s=l=f,a=o):l=l.next=f,Ga.lanes|=d,Pu|=d;c=c.next}while(null!==c&&c!==t);if(null===l?a=o:l.next=s,!ai(o,e.memoizedState)&&(Fl=!0,u&&null!==(n=Zo)))throw n;e.memoizedState=o,e.baseState=a,e.baseQueue=l,r.lastRenderedState=o}return null===i&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Cs(e){var t=gs(),n=t.queue;if(null===n)throw Error(he(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);ai(o,t.memoizedState)||(Fl=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function _s(e,t,n){var r=Ga,i=gs(),o=wo;if(o){if(void 0===n)throw Error(he(407));n=n()}else n=t();var a=!ai((Xa||i).memoizedState,n);if(a&&(i.memoizedState=n,Fl=!0),i=i.queue,Ys(Is.bind(null,r,i,e),[e]),i.getSnapshot!==t||a||null!==Za&&1&Za.memoizedState.tag){if(r.flags|=2048,Vs(9,{destroy:void 0},Ns.bind(null,r,i,n,t),null),null===ku)throw Error(he(349));o||127&Ya||Es(r,t,n)}return n}function Es(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Ga.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},Ga.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Ns(e,t,n,r){t.value=n,t.getSnapshot=r,Ts(t)&&js(e)}function Is(e,t,n){return n(function(){Ts(t)&&js(e)})}function Ts(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ai(e,n)}catch(e){return!0}}function js(e){var t=Fi(e,2);null!==t&&nd(t,e,2)}function Os(e){var t=vs();if("function"==typeof e){var n=e;if(e=n(),ns){Nt(!0);try{n()}finally{Nt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:e},t}function Ps(e,t,n,r){return e.baseState=n,Ss(e,Xa,"function"==typeof r?r:xs)}function As(e,t,n,r,i){if(wl(e))throw Error(he(485));if(null!==(e=t.action)){var o={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};null!==qe.T?n(!0):o.isTransition=!1,r(o),null===(n=t.pending)?(o.next=t.pending=o,Rs(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Rs(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var o=qe.T,a={};qe.T=a;try{var s=n(i,r),l=qe.S;null!==l&&l(a,s),Ms(e,t,s)}catch(n){Ds(e,t,n)}finally{null!==o&&null!==a.types&&(o.types=a.types),qe.T=o}}else try{Ms(e,t,o=n(i,r))}catch(n){Ds(e,t,n)}}function Ms(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){Ls(e,t,n)},function(n){return Ds(e,t,n)}):Ls(e,t,n)}function Ls(e,t,n){t.status="fulfilled",t.value=n,Bs(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,Rs(e,n)))}function Ds(e,t,n){var r=e.pending;if(e.pending=null,null!==r){r=r.next;do{t.status="rejected",t.reason=n,Bs(t),t=t.next}while(t!==r)}e.action=null}function Bs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function zs(e,t){return t}function Us(e,t){if(wo){var n=ku.formState;if(null!==n){e:{var r=Ga;if(wo){if(bo){t:{for(var i=bo,o=ko;8!==i.nodeType;){if(!o){i=null;break t}if(null===(i=qf(i.nextSibling))){i=null;break t}}i="F!"===(o=i.data)||"F"===o?i:null}if(i){bo=qf(i.nextSibling),r="F!"===i.data;break e}}Co(r)}r=!1}r&&(t=n[0])}}return(n=vs()).memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zs,lastRenderedState:t},n.queue=r,n=gl.bind(null,Ga,r),r.dispatch=n,r=Os(!1),o=bl.bind(null,Ga,!1,r.queue),i={state:t,dispatch:null,action:e,pending:null},(r=vs()).queue=i,n=As.bind(null,Ga,i,o,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Fs(e){return qs(gs(),Xa,e)}function qs(e,t,n){if(t=Ss(e,t,zs)[0],e=ks(xs)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var r=ys(t)}catch(e){if(e===aa)throw la;throw e}else r=t;var i=(t=gs()).queue,o=i.dispatch;return n!==t.memoizedState&&(Ga.flags|=2048,Vs(9,{destroy:void 0},Hs.bind(null,i,n),null)),[r,o,e]}function Hs(e,t){e.action=t}function Ws(e){var t=gs(),n=Xa;if(null!==n)return qs(t,n,e);gs(),t=t.memoizedState;var r=(n=gs()).queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Vs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},null===(t=Ga.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},Ga.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function $s(){return gs().memoizedState}function Ks(e,t,n,r){var i=vs();Ga.flags|=e,i.memoizedState=Vs(1|t,{destroy:void 0},n,void 0===r?null:r)}function Qs(e,t,n,r){var i=gs();r=void 0===r?null:r;var o=i.memoizedState.inst;null!==Xa&&null!==r&&ls(r,Xa.memoizedState.deps)?i.memoizedState=Vs(t,o,n,r):(Ga.flags|=e,i.memoizedState=Vs(1|t,o,n,r))}function Js(e,t){Ks(8390656,8,e,t)}function Ys(e,t){Qs(2048,8,e,t)}function Gs(e){var t=gs().memoizedState;return function(e){Ga.flags|=4;var t=Ga.updateQueue;if(null===t)t={lastEffect:null,events:null,stores:null,memoCache:null},Ga.updateQueue=t,t.events=[e];else{var n=t.events;null===n?t.events=[e]:n.push(e)}}({ref:t,nextImpl:e}),function(){if(2&xu)throw Error(he(440));return t.impl.apply(void 0,arguments)}}function Xs(e,t){return Qs(4,2,e,t)}function Zs(e,t){return Qs(4,4,e,t)}function el(e,t){if("function"==typeof t){e=e();var n=t(e);return function(){"function"==typeof n?n():t(null)}}if(null!=t)return e=e(),t.current=e,function(){t.current=null}}function tl(e,t,n){n=null!=n?n.concat([e]):null,Qs(4,4,el.bind(null,t,e),n)}function nl(){}function rl(e,t){var n=gs();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&ls(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function il(e,t){var n=gs();t=void 0===t?null:t;var r=n.memoizedState;if(null!==t&&ls(t,r[1]))return r[0];if(r=e(),ns){Nt(!0);try{e()}finally{Nt(!1)}}return n.memoizedState=[r,t],r}function ol(e,t,n){return void 0===n||1073741824&Ya&&!(261930&Cu)?e.memoizedState=t:(e.memoizedState=n,e=td(),Ga.lanes|=e,Pu|=e,n)}function al(e,t,n,r){return ai(n,t)?n:null!==La.current?(e=ol(e,n,r),ai(e,t)||(Fl=!0),e):42&Ya&&(!(1073741824&Ya)||261930&Cu)?(e=td(),Ga.lanes|=e,Pu|=e,t):(Fl=!0,e.memoizedState=n)}function sl(e,t,n,r,i){var o=He.p;He.p=0!==o&&8>o?o:8;var a,s,l,c=qe.T,u={};qe.T=u,bl(e,!1,t,n);try{var d=i(),f=qe.S;if(null!==f&&f(u,d),null!==d&&"object"==typeof d&&"function"==typeof d.then){var p=(a=r,s=[],l={status:"pending",value:null,reason:null,then:function(e){s.push(e)}},d.then(function(){l.status="fulfilled",l.value=a;for(var e=0;e<s.length;e++)(0,s[e])(a)},function(e){for(l.status="rejected",l.reason=e,e=0;e<s.length;e++)(0,s[e])(void 0)}),l);yl(e,t,p,ed())}else yl(e,t,r,ed())}catch(n){yl(e,t,{then:function(){},status:"rejected",reason:n},ed())}finally{He.p=o,null!==c&&null!==u.types&&(c.types=u.types),qe.T=c}}function ll(){}function cl(e,t,n,r){if(5!==e.tag)throw Error(he(476));var i=ul(e).queue;sl(e,i,t,We,null===n?ll:function(){return dl(e),n(r)})}function ul(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:We,baseState:We,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:We},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function dl(e){var t=ul(e);null===t.next&&(t=e.alternate.memoizedState),yl(e,t.next.queue,{},ed())}function fl(){return Fo(bp)}function pl(){return gs().memoizedState}function hl(){return gs().memoizedState}function ml(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=ed(),r=Ia(t,e=Na(n),n);return null!==r&&(nd(r,t,n),Ta(r,t,n)),t={cache:Qo()},void(e.payload=t)}t=t.return}}function vl(e,t,n){var r=ed();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},wl(e)?xl(t,n):null!==(n=Ui(e,t,n,r))&&(nd(n,e,r),kl(n,t,r))}function gl(e,t,n){yl(e,t,n,ed())}function yl(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(wl(e))xl(t,i);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,ai(s,a))return zi(e,t,i,0),null===ku&&Bi(),!1}catch(e){}if(null!==(n=Ui(e,t,i,r)))return nd(n,e,r),kl(n,t,r),!0}return!1}function bl(e,t,n,r){if(r={lane:2,revertLane:Yd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},wl(e)){if(t)throw Error(he(479))}else null!==(t=Ui(e,n,r,2))&&nd(t,e,2)}function wl(e){var t=e.alternate;return e===Ga||null!==t&&t===Ga}function xl(e,t){ts=es=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function kl(e,t,n){if(4194048&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,qt(e,n)}}var Sl={readContext:Fo,use:bs,useCallback:ss,useContext:ss,useEffect:ss,useImperativeHandle:ss,useLayoutEffect:ss,useInsertionEffect:ss,useMemo:ss,useReducer:ss,useRef:ss,useState:ss,useDebugValue:ss,useDeferredValue:ss,useTransition:ss,useSyncExternalStore:ss,useId:ss,useHostTransitionStatus:ss,useFormState:ss,useActionState:ss,useOptimistic:ss,useMemoCache:ss,useCacheRefresh:ss};Sl.useEffectEvent=ss;var Cl={readContext:Fo,use:bs,useCallback:function(e,t){return vs().memoizedState=[e,void 0===t?null:t],e},useContext:Fo,useEffect:Js,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,Ks(4194308,4,el.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ks(4194308,4,e,t)},useInsertionEffect:function(e,t){Ks(4,2,e,t)},useMemo:function(e,t){var n=vs();t=void 0===t?null:t;var r=e();if(ns){Nt(!0);try{e()}finally{Nt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=vs();if(void 0!==n){var i=n(t);if(ns){Nt(!0);try{n(t)}finally{Nt(!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=vl.bind(null,Ga,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},vs().memoizedState=e},useState:function(e){var t=(e=Os(e)).queue,n=gl.bind(null,Ga,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:nl,useDeferredValue:function(e,t){return ol(vs(),e,t)},useTransition:function(){var e=Os(!1);return e=sl.bind(null,Ga,e.queue,!0,!1),vs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Ga,i=vs();if(wo){if(void 0===n)throw Error(he(407));n=n()}else{if(n=t(),null===ku)throw Error(he(349));127&Cu||Es(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Js(Is.bind(null,r,o,e),[e]),r.flags|=2048,Vs(9,{destroy:void 0},Ns.bind(null,r,o,n,t),null),n},useId:function(){var e=vs(),t=ku.identifierPrefix;if(wo){var n=fo;t="_"+t+"R_"+(n=(uo&~(1<<32-It(uo)-1)).toString(32)+n),0<(n=rs++)&&(t+="H"+n.toString(32)),t+="_"}else t="_"+t+"r_"+(n=as++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:fl,useFormState:Us,useActionState:Us,useOptimistic:function(e){var t=vs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=bl.bind(null,Ga,!0,n),n.dispatch=t,[e,t]},useMemoCache:ws,useCacheRefresh:function(){return vs().memoizedState=ml.bind(null,Ga)},useEffectEvent:function(e){var t=vs(),n={impl:e};return t.memoizedState=n,function(){if(2&xu)throw Error(he(440));return n.impl.apply(void 0,arguments)}}},_l={readContext:Fo,use:bs,useCallback:rl,useContext:Fo,useEffect:Ys,useImperativeHandle:tl,useInsertionEffect:Xs,useLayoutEffect:Zs,useMemo:il,useReducer:ks,useRef:$s,useState:function(){return ks(xs)},useDebugValue:nl,useDeferredValue:function(e,t){return al(gs(),Xa.memoizedState,e,t)},useTransition:function(){var e=ks(xs)[0],t=gs().memoizedState;return["boolean"==typeof e?e:ys(e),t]},useSyncExternalStore:_s,useId:pl,useHostTransitionStatus:fl,useFormState:Fs,useActionState:Fs,useOptimistic:function(e,t){return Ps(gs(),0,e,t)},useMemoCache:ws,useCacheRefresh:hl};_l.useEffectEvent=Gs;var El={readContext:Fo,use:bs,useCallback:rl,useContext:Fo,useEffect:Ys,useImperativeHandle:tl,useInsertionEffect:Xs,useLayoutEffect:Zs,useMemo:il,useReducer:Cs,useRef:$s,useState:function(){return Cs(xs)},useDebugValue:nl,useDeferredValue:function(e,t){var n=gs();return null===Xa?ol(n,e,t):al(n,Xa.memoizedState,e,t)},useTransition:function(){var e=Cs(xs)[0],t=gs().memoizedState;return["boolean"==typeof e?e:ys(e),t]},useSyncExternalStore:_s,useId:pl,useHostTransitionStatus:fl,useFormState:Ws,useActionState:Ws,useOptimistic:function(e,t){var n=gs();return null!==Xa?Ps(n,0,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:ws,useCacheRefresh:hl};function Nl(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:xe({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}El.useEffectEvent=Gs;var Il={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ed(),i=Na(r);i.payload=t,null!=n&&(i.callback=n),null!==(t=Ia(e,i,r))&&(nd(t,e,r),Ta(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ed(),i=Na(r);i.tag=1,i.payload=t,null!=n&&(i.callback=n),null!==(t=Ia(e,i,r))&&(nd(t,e,r),Ta(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ed(),r=Na(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=Ia(e,r,n))&&(nd(t,e,n),Ta(t,e,n))}};function Tl(e,t,n,r,i,o,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!t.prototype||!t.prototype.isPureReactComponent||(!si(n,r)||!si(i,o))}function jl(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Il.enqueueReplaceState(t,t.state,null)}function Ol(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=xe({},n)),e)void 0===n[i]&&(n[i]=e[i]);return n}function Pl(e){Ri(e)}function Al(e){console.error(e)}function Rl(e){Ri(e)}function Ml(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ll(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Dl(e,t,n){return(n=Na(n)).tag=3,n.payload={element:null},n.callback=function(){Ml(e,t)},n}function Bl(e){return(e=Na(e)).tag=3,e}function zl(e,t,n,r){var i=n.type.getDerivedStateFromError;if("function"==typeof i){var o=r.value;e.payload=function(){return i(o)},e.callback=function(){Ll(t,n,r)}}var a=n.stateNode;null!==a&&"function"==typeof a.componentDidCatch&&(e.callback=function(){Ll(t,n,r),"function"!=typeof i&&(null===Wu?Wu=new Set([this]):Wu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Ul=Error(he(461)),Fl=!1;function ql(e,t,n,r){t.child=null===e?Sa(t,null,n,r):ka(t,e.child,n,r)}function Hl(e,t,n,r,i){n=n.render;var o=t.ref;if("ref"in r){var a={};for(var s in r)"ref"!==s&&(a[s]=r[s])}else a=r;return Uo(t),r=cs(e,t,n,a,o,i),s=ps(),null===e||Fl?(wo&&s&&mo(t),t.flags|=1,ql(e,t,r,i),t.child):(hs(e,t,i),fc(e,t,i))}function Wl(e,t,n,r,i){if(null===e){var o=n.type;return"function"!=typeof o||Ki(o)||void 0!==o.defaultProps||null!==n.compare?((e=Yi(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Vl(e,t,o,r,i))}if(o=e.child,!pc(e,i)){var a=o.memoizedProps;if((n=null!==(n=n.compare)?n:si)(a,r)&&e.ref===t.ref)return fc(e,t,i)}return t.flags|=1,(e=Qi(o,r)).ref=t.ref,e.return=t,t.child=e}function Vl(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(si(o,r)&&e.ref===t.ref){if(Fl=!1,t.pendingProps=r=o,!pc(e,i))return t.lanes=e.lanes,fc(e,t,i);131072&e.flags&&(Fl=!0)}}return Xl(e,t,n,r,i)}function $l(e,t,n,r){var i=r.children,o=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===r.mode){if(128&t.flags){if(o=null!==o?o.baseLanes|n:n,null!==e){for(r=t.child=e.child,i=0;null!==r;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~o}else r=0,t.child=null;return Ql(e,t,o,n,r)}if(!(536870912&n))return r=t.lanes=536870912,Ql(e,t,null!==o?o.baseLanes|n:n,n,r);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&ia(0,null!==o?o.cachePool:null),null!==o?Ba(t,o):za(),Va(t)}else null!==o?(ia(0,o.cachePool),Ba(t,o),$a(),t.memoizedState=null):(null!==e&&ia(0,null),za(),$a());return ql(e,t,i,n),t.child}function Kl(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ql(e,t,n,r,i){var o=ra();return o=null===o?null:{parent:Ko._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},null!==e&&ia(0,null),za(),Va(t),null!==e&&Bo(e,t,r,!0),t.childLanes=i,null}function Jl(e,t){return(t=sc({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function Yl(e,t,n){return ka(t,e.child,null,n),(e=Jl(t,t.pendingProps)).flags|=2,Ka(t),t.memoizedState=null,e}function Gl(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(he(284));null!==e&&e.ref===n||(t.flags|=4194816)}}function Xl(e,t,n,r,i){return Uo(t),n=cs(e,t,n,r,void 0,i),r=ps(),null===e||Fl?(wo&&r&&mo(t),t.flags|=1,ql(e,t,n,i),t.child):(hs(e,t,i),fc(e,t,i))}function Zl(e,t,n,r,i,o){return Uo(t),t.updateQueue=null,n=ds(t,r,n,i),us(e),r=ps(),null===e||Fl?(wo&&r&&mo(t),t.flags|=1,ql(e,t,n,o),t.child):(hs(e,t,o),fc(e,t,o))}function ec(e,t,n,r,i){if(Uo(t),null===t.stateNode){var o=Wi,a=n.contextType;"object"==typeof a&&null!==a&&(o=Fo(a)),o=new n(r,o),t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,o.updater=Il,t.stateNode=o,o._reactInternals=t,(o=t.stateNode).props=r,o.state=t.memoizedState,o.refs={},_a(t),a=n.contextType,o.context="object"==typeof a&&null!==a?Fo(a):Wi,o.state=t.memoizedState,"function"==typeof(a=n.getDerivedStateFromProps)&&(Nl(t,n,a,r),o.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(a=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),a!==o.state&&Il.enqueueReplaceState(o,o.state,null),Aa(t,r,o,i),Pa(),o.state=t.memoizedState),"function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){o=t.stateNode;var s=t.memoizedProps,l=Ol(n,s);o.props=l;var c=o.context,u=n.contextType;a=Wi,"object"==typeof u&&null!==u&&(a=Fo(u));var d=n.getDerivedStateFromProps;u="function"==typeof d||"function"==typeof o.getSnapshotBeforeUpdate,s=t.pendingProps!==s,u||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(s||c!==a)&&jl(t,o,r,a),Ca=!1;var f=t.memoizedState;o.state=f,Aa(t,r,o,i),Pa(),c=t.memoizedState,s||f!==c||Ca?("function"==typeof d&&(Nl(t,n,d,r),c=t.memoizedState),(l=Ca||Tl(t,n,l,r,f,c,a))?(u||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=a,r=l):("function"==typeof o.componentDidMount&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Ea(e,t),u=Ol(n,a=t.memoizedProps),o.props=u,d=t.pendingProps,f=o.context,c=n.contextType,l=Wi,"object"==typeof c&&null!==c&&(l=Fo(c)),(c="function"==typeof(s=n.getDerivedStateFromProps)||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==d||f!==l)&&jl(t,o,r,l),Ca=!1,f=t.memoizedState,o.state=f,Aa(t,r,o,i),Pa();var p=t.memoizedState;a!==d||f!==p||Ca||null!==e&&null!==e.dependencies&&zo(e.dependencies)?("function"==typeof s&&(Nl(t,n,s,r),p=t.memoizedState),(u=Ca||Tl(t,n,u,r,f,p,l)||null!==e&&null!==e.dependencies&&zo(e.dependencies))?(c||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(r,p,l),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),o.props=r,o.state=p,o.context=l,r=u):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return o=r,Gl(e,t),r=!!(128&t.flags),o||r?(o=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:o.render(),t.flags|=1,null!==e&&r?(t.child=ka(t,e.child,null,i),t.child=ka(t,null,n,i)):ql(e,t,n,i),t.memoizedState=o.state,e=t.child):e=fc(e,t,i),e}function tc(e,t,n,r){return Io(),t.flags|=256,ql(e,t,n,r),t.child}var nc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rc(e){return{baseLanes:e,cachePool:oa()}}function ic(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=Mu),e}function oc(e,t,n){var r,i=t.pendingProps,o=!1,a=!!(128&t.flags);if((r=a)||(r=(null===e||null!==e.memoizedState)&&!!(2&Qa.current)),r&&(o=!0,t.flags&=-129),r=!!(32&t.flags),t.flags&=-33,null===e){if(wo){if(o?Ha(t):$a(),(e=bo)?null!==(e=null!==(e=zf(e,ko))&&"&"!==e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==co?{id:uo,overflow:fo}:null,retryLane:536870912,hydrationErrors:null},(n=Zi(e)).return=t,t.child=n,yo=t,bo=null):e=null,null===e)throw Co(t);return Ff(e)?t.lanes=32:t.lanes=536870912,null}var s=i.children;return i=i.fallback,o?($a(),s=sc({mode:"hidden",children:s},o=t.mode),i=Gi(i,o,n,null),s.return=t,i.return=t,s.sibling=i,t.child=s,(i=t.child).memoizedState=rc(n),i.childLanes=ic(e,r,n),t.memoizedState=nc,Kl(null,i)):(Ha(t),ac(t,s))}var l=e.memoizedState;if(null!==l&&null!==(s=l.dehydrated)){if(a)256&t.flags?(Ha(t),t.flags&=-257,t=lc(e,t,n)):null!==t.memoizedState?($a(),t.child=e.child,t.flags|=128,t=null):($a(),s=i.fallback,o=t.mode,i=sc({mode:"visible",children:i.children},o),(s=Gi(s,o,n,null)).flags|=2,i.return=t,s.return=t,i.sibling=s,t.child=i,ka(t,e.child,null,n),(i=t.child).memoizedState=rc(n),i.childLanes=ic(e,r,n),t.memoizedState=nc,t=Kl(null,i));else if(Ha(t),Ff(s)){if(r=s.nextSibling&&s.nextSibling.dataset)var c=r.dgst;r=c,(i=Error(he(419))).stack="",i.digest=r,jo({value:i,source:null,stack:null}),t=lc(e,t,n)}else if(Fl||Bo(e,t,n,!1),r=0!==(n&e.childLanes),Fl||r){if(null!==(r=ku)&&(0!==(i=Ht(r,n))&&i!==l.retryLane))throw l.retryLane=i,Fi(e,i),nd(r,e,i),Ul;Uf(s)||hd(),t=lc(e,t,n)}else Uf(s)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,bo=qf(s.nextSibling),yo=t,wo=!0,xo=null,ko=!1,null!==e&&go(t,e),(t=ac(t,i.children)).flags|=4096);return t}return o?($a(),s=i.fallback,o=t.mode,c=(l=e.child).sibling,(i=Qi(l,{mode:"hidden",children:i.children})).subtreeFlags=65011712&l.subtreeFlags,null!==c?s=Qi(c,s):(s=Gi(s,o,n,null)).flags|=2,s.return=t,i.return=t,i.sibling=s,t.child=i,Kl(null,i),i=t.child,null===(s=e.child.memoizedState)?s=rc(n):(null!==(o=s.cachePool)?(l=Ko._currentValue,o=o.parent!==l?{parent:l,pool:l}:o):o=oa(),s={baseLanes:s.baseLanes|n,cachePool:o}),i.memoizedState=s,i.childLanes=ic(e,r,n),t.memoizedState=nc,Kl(e.child,i)):(Ha(t),e=(n=e.child).sibling,(n=Qi(n,{mode:"visible",children:i.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function ac(e,t){return(t=sc({mode:"visible",children:t},e.mode)).return=e,e.child=t}function sc(e,t){return(e=$i(22,e,null,t)).lanes=0,e}function lc(e,t,n){return ka(t,e.child,null,n),(e=ac(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function cc(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Lo(e.return,t,n)}function uc(e,t,n,r,i,o){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i,a.treeForkCount=o)}function dc(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;r=r.children;var a=Qa.current,s=!!(2&a);if(s?(a=1&a|2,t.flags|=128):a&=1,Je(Qa,a),ql(e,t,r,n),r=wo?ao:0,!s&&null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&cc(e,n,t);else if(19===e.tag)cc(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===Ja(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),uc(t,!1,i,n,o,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===Ja(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}uc(t,!0,n,null,o,r);break;case"together":uc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function fc(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Pu|=t.lanes,0===(n&t.childLanes)){if(null===e)return null;if(Bo(e,t,n,!1),0===(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(he(153));if(null!==t.child){for(n=Qi(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Qi(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function pc(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!zo(e))}function hc(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Fl=!0;else{if(!(pc(e,n)||128&t.flags))return Fl=!1,function(e,t,n){switch(t.tag){case 3:nt(t,t.stateNode.containerInfo),Ro(0,Ko,e.memoizedState.cache),Io();break;case 27:case 5:it(t);break;case 4:nt(t,t.stateNode.containerInfo);break;case 10:Ro(0,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,Wa(t),null;break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(Ha(t),t.flags|=128,null):0!==(n&t.child.childLanes)?oc(e,t,n):(Ha(t),null!==(e=fc(e,t,n))?e.sibling:null);Ha(t);break;case 19:var i=!!(128&e.flags);if((r=0!==(n&t.childLanes))||(Bo(e,t,n,!1),r=0!==(n&t.childLanes)),i){if(r)return dc(e,t,n);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),Je(Qa,Qa.current),r)break;return null;case 22:return t.lanes=0,$l(e,t,n,t.pendingProps);case 24:Ro(0,Ko,e.memoizedState.cache)}return fc(e,t,n)}(e,t,n);Fl=!!(131072&e.flags)}else Fl=!1,wo&&1048576&t.flags&&ho(t,ao,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=fa(t.elementType),t.type=e,"function"!=typeof e){if(null!=e){var i=e.$$typeof;if(i===je){t.tag=11,t=Hl(null,t,e,r,n);break e}if(i===Ae){t.tag=14,t=Wl(null,t,e,r,n);break e}}throw t=Ue(e)||e,Error(he(306,t,""))}Ki(e)?(r=Ol(e,r),t.tag=1,t=ec(null,t,e,r,n)):(t.tag=0,t=Xl(null,t,e,r,n))}return t;case 0:return Xl(e,t,t.type,t.pendingProps,n);case 1:return ec(e,t,r=t.type,i=Ol(r,t.pendingProps),n);case 3:e:{if(nt(t,t.stateNode.containerInfo),null===e)throw Error(he(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,Ea(e,t),Aa(t,r,null,n);var a=t.memoizedState;if(r=a.cache,Ro(0,Ko,r),r!==o.cache&&Do(t,[Ko],n,!0),Pa(),r=a.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:a.cache},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=tc(e,t,r,n);break e}if(r!==i){jo(i=no(Error(he(424)),t)),t=tc(e,t,r,n);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(bo=qf(e.firstChild),yo=t,wo=!0,xo=null,ko=!0,n=Sa(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(Io(),r===i){t=fc(e,t,n);break e}ql(e,t,r,n)}t=t.child}return t;case 26:return Gl(e,t),null===e?(n=ep(t.type,null,t.pendingProps,null))?t.memoizedState=n:wo||(n=t.type,e=t.pendingProps,(r=_f(et.current).createElement(n))[Jt]=t,r[Yt]=e,xf(r,n,e),cn(r),t.stateNode=r):t.memoizedState=ep(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return it(t),null===e&&wo&&(r=t.stateNode=$f(t.type,t.pendingProps,et.current),yo=t,ko=!0,i=bo,Mf(t.type)?(Hf=i,bo=qf(r.firstChild)):bo=i),ql(e,t,t.pendingProps.children,n),Gl(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&wo&&((i=r=bo)&&(null!==(r=function(e,t,n,r){for(;1===e.nodeType;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[nn])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(o=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(o!==i.rel||e.getAttribute("href")!==(null==i.href||""===i.href?null:i.href)||e.getAttribute("crossorigin")!==(null==i.crossOrigin?null:i.crossOrigin)||e.getAttribute("title")!==(null==i.title?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((o=e.getAttribute("src"))!==(null==i.src?null:i.src)||e.getAttribute("type")!==(null==i.type?null:i.type)||e.getAttribute("crossorigin")!==(null==i.crossOrigin?null:i.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var o=null==i.name?null:""+i.name;if("hidden"===i.type&&e.getAttribute("name")===o)return e}if(null===(e=qf(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,ko))?(t.stateNode=r,yo=t,bo=qf(r.firstChild),ko=!1,i=!0):i=!1),i||Co(t)),it(t),i=t.type,o=t.pendingProps,a=null!==e?e.memoizedProps:null,r=o.children,If(i,o)?r=null:null!==a&&If(i,a)&&(t.flags|=32),null!==t.memoizedState&&(i=cs(e,t,fs,null,null,n),bp._currentValue=i),Gl(e,t),ql(e,t,r,n),t.child;case 6:return null===e&&wo&&((e=n=bo)&&(null!==(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n)return null;if(null===(e=qf(e.nextSibling)))return null}return e}(n,t.pendingProps,ko))?(t.stateNode=n,yo=t,bo=null,e=!0):e=!1),e||Co(t)),null;case 13:return oc(e,t,n);case 4:return nt(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=ka(t,null,r,n):ql(e,t,r,n),t.child;case 11:return Hl(e,t,t.type,t.pendingProps,n);case 7:return ql(e,t,t.pendingProps,n),t.child;case 8:case 12:return ql(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ro(0,t.type,r.value),ql(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Uo(t),r=r(i=Fo(i)),t.flags|=1,ql(e,t,r,n),t.child;case 14:return Wl(e,t,t.type,t.pendingProps,n);case 15:return Vl(e,t,t.type,t.pendingProps,n);case 19:return dc(e,t,n);case 31:return function(e,t,n){var r=t.pendingProps,i=!!(128&t.flags);if(t.flags&=-129,null===e){if(wo){if("hidden"===r.mode)return e=Jl(t,r),t.lanes=536870912,Kl(null,e);if(Wa(t),(e=bo)?null!==(e=null!==(e=zf(e,ko))&&"&"===e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==co?{id:uo,overflow:fo}:null,retryLane:536870912,hydrationErrors:null},(n=Zi(e)).return=t,t.child=n,yo=t,bo=null):e=null,null===e)throw Co(t);return t.lanes=536870912,null}return Jl(t,r)}var o=e.memoizedState;if(null!==o){var a=o.dehydrated;if(Wa(t),i)if(256&t.flags)t.flags&=-257,t=Yl(e,t,n);else{if(null===t.memoizedState)throw Error(he(558));t.child=e.child,t.flags|=128,t=null}else if(Fl||Bo(e,t,n,!1),i=0!==(n&e.childLanes),Fl||i){if(null!==(r=ku)&&0!==(a=Ht(r,n))&&a!==o.retryLane)throw o.retryLane=a,Fi(e,a),nd(r,e,a),Ul;hd(),t=Yl(e,t,n)}else e=o.treeContext,bo=qf(a.nextSibling),yo=t,wo=!0,xo=null,ko=!1,null!==e&&go(t,e),(t=Jl(t,r)).flags|=4096;return t}return(e=Qi(e.child,{mode:r.mode,children:r.children})).ref=t.ref,t.child=e,e.return=t,e}(e,t,n);case 22:return $l(e,t,n,t.pendingProps);case 24:return Uo(t),r=Fo(Ko),null===e?(null===(i=ra())&&(i=ku,o=Qo(),i.pooledCache=o,o.refCount++,null!==o&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},_a(t),Ro(0,Ko,i)):(0!==(e.lanes&n)&&(Ea(e,t),Aa(t,null,null,n),Pa()),i=e.memoizedState,o=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=i),Ro(0,Ko,r)):(r=o.cache,Ro(0,Ko,r),r!==i.cache&&Do(t,[Ko],n,!0))),ql(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(he(156,t.tag))}function mc(e){e.flags|=4}function vc(e,t,n,r,i){if((t=!!(32&e.mode))&&(t=!1),t){if(e.flags|=16777216,(335544128&i)===i)if(e.stateNode.complete)e.flags|=8192;else{if(!dd())throw pa=ca,sa;e.flags|=8192}}else e.flags&=-16777217}function gc(e,t){if("stylesheet"!==t.type||4&t.state.loading)e.flags&=-16777217;else if(e.flags|=16777216,!pp(t)){if(!dd())throw pa=ca,sa;e.flags|=8192}}function yc(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Bt():536870912,e.lanes|=t,Lu|=t)}function bc(e,t){if(!wo)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function wc(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=65011712&i.subtreeFlags,r|=65011712&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)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 xc(e,t,n){var r=t.pendingProps;switch(vo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return wc(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Mo(Ko),rt(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(No(t)?mc(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,To())),wc(t),null;case 26:var i=t.type,o=t.memoizedState;return null===e?(mc(t),null!==o?(wc(t),gc(t,o)):(wc(t),vc(t,i,0,0,n))):o?o!==e.memoizedState?(mc(t),wc(t),gc(t,o)):(wc(t),t.flags&=-16777217):((e=e.memoizedProps)!==r&&mc(t),wc(t),vc(t,i,0,0,n)),null;case 27:if(ot(t),n=et.current,i=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&mc(t);else{if(!r){if(null===t.stateNode)throw Error(he(166));return wc(t),null}e=Xe.current,No(t)?_o(t):(e=$f(i,r,n),t.stateNode=e,mc(t))}return wc(t),null;case 5:if(ot(t),i=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&mc(t);else{if(!r){if(null===t.stateNode)throw Error(he(166));return wc(t),null}if(o=Xe.current,No(t))_o(t);else{var a=_f(et.current);switch(o){case 1:o=a.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:o=a.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":o=a.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":o=a.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":(o=a.createElement("div")).innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o="string"==typeof r.is?a.createElement("select",{is:r.is}):a.createElement("select"),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o="string"==typeof r.is?a.createElement(i,{is:r.is}):a.createElement(i)}}o[Jt]=t,o[Yt]=r;e:for(a=t.child;null!==a;){if(5===a.tag||6===a.tag)o.appendChild(a.stateNode);else if(4!==a.tag&&27!==a.tag&&null!==a.child){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;null===a.sibling;){if(null===a.return||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=o;e:switch(xf(o,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&mc(t)}}return wc(t),vc(t,t.type,null===e||e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&mc(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(he(166));if(e=et.current,No(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(i=yo))switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Jt]=t,(e=!!(e.nodeValue===n||null!==r&&!0===r.suppressHydrationWarning||yf(e.nodeValue,n)))||Co(t,!0)}else(e=_f(e).createTextNode(r))[Jt]=t,t.stateNode=e}return wc(t),null;case 31:if(n=t.memoizedState,null===e||null!==e.memoizedState){if(r=No(t),null!==n){if(null===e){if(!r)throw Error(he(318));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(he(557));e[Jt]=t}else Io(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;wc(t),e=!1}else n=To(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return 256&t.flags?(Ka(t),t):(Ka(t),null);if(128&t.flags)throw Error(he(558))}return wc(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(i=No(t),null!==r&&null!==r.dehydrated){if(null===e){if(!i)throw Error(he(318));if(!(i=null!==(i=t.memoizedState)?i.dehydrated:null))throw Error(he(317));i[Jt]=t}else Io(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;wc(t),i=!1}else i=To(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return 256&t.flags?(Ka(t),t):(Ka(t),null)}return Ka(t),128&t.flags?(t.lanes=n,t):(n=null!==r,e=null!==e&&null!==e.memoizedState,n&&(i=null,null!==(r=t.child).alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(i=r.alternate.memoizedState.cachePool.pool),o=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),yc(t,t.updateQueue),wc(t),null);case 4:return rt(),null===e&&lf(t.stateNode.containerInfo),wc(t),null;case 10:return Mo(t.type),wc(t),null;case 19:if(Qe(Qa),null===(r=t.memoizedState))return wc(t),null;if(i=!!(128&t.flags),null===(o=r.rendering))if(i)bc(r,!1);else{if(0!==Ou||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=Ja(e))){for(t.flags|=128,bc(r,!1),e=o.updateQueue,t.updateQueue=e,yc(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)Ji(n,e),n=n.sibling;return Je(Qa,1&Qa.current|2),wo&&po(t,r.treeForkCount),t.child}e=e.sibling}null!==r.tail&&vt()>qu&&(t.flags|=128,i=!0,bc(r,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=Ja(o))){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,yc(t,e),bc(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate&&!wo)return wc(t),null}else 2*vt()-r.renderingStartTime>qu&&536870912!==n&&(t.flags|=128,i=!0,bc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(null!==(e=r.last)?e.sibling=o:t.child=o,r.last=o)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=vt(),e.sibling=null,n=Qa.current,Je(Qa,i?1&n|2:1&n),wo&&po(t,r.treeForkCount),e):(wc(t),null);case 22:case 23:return Ka(t),Ua(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?!!(536870912&n)&&!(128&t.flags)&&(wc(t),6&t.subtreeFlags&&(t.flags|=8192)):wc(t),null!==(n=t.updateQueue)&&yc(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&Qe(na),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Mo(Ko),wc(t),null;case 25:case 30:return null}throw Error(he(156,t.tag))}function kc(e,t){switch(vo(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Mo(Ko),rt(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return ot(t),null;case 31:if(null!==t.memoizedState){if(Ka(t),null===t.alternate)throw Error(he(340));Io()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(Ka(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(he(340));Io()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Qe(Qa),null;case 4:return rt(),null;case 10:return Mo(t.type),null;case 22:case 23:return Ka(t),Ua(),null!==e&&Qe(na),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return Mo(Ko),null;default:return null}}function Sc(e,t){switch(vo(t),t.tag){case 3:Mo(Ko),rt();break;case 26:case 27:case 5:ot(t);break;case 4:rt();break;case 31:null!==t.memoizedState&&Ka(t);break;case 13:Ka(t);break;case 19:Qe(Qa);break;case 10:Mo(t.type);break;case 22:case 23:Ka(t),Ua(),null!==e&&Qe(na);break;case 24:Mo(Ko)}}function Cc(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var o=n.create,a=n.inst;r=o(),a.destroy=r}n=n.next}while(n!==i)}}catch(e){Od(t,t.return,e)}}function _c(e,t,n){try{var r=t.updateQueue,i=null!==r?r.lastEffect:null;if(null!==i){var o=i.next;r=o;do{if((r.tag&e)===e){var a=r.inst,s=a.destroy;if(void 0!==s){a.destroy=void 0,i=t;var l=n,c=s;try{c()}catch(e){Od(i,l,e)}}}r=r.next}while(r!==o)}}catch(e){Od(t,t.return,e)}}function Ec(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{Ma(t,n)}catch(t){Od(e,e.return,t)}}}function Nc(e,t,n){n.props=Ol(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Od(e,t,n)}}function Ic(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;default:r=e.stateNode}"function"==typeof n?e.refCleanup=n(r):n.current=r}}catch(n){Od(e,t,n)}}function Tc(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(n){Od(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(n){Od(e,t,n)}else n.current=null}function jc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Od(e,e.return,t)}}function Oc(e,t,n){try{var r=e.stateNode;!function(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 i=null,o=null,a=null,s=null,l=null,c=null,u=null;for(p in n){var d=n[p];if(n.hasOwnProperty(p)&&null!=d)switch(p){case"checked":case"value":break;case"defaultValue":l=d;default:r.hasOwnProperty(p)||bf(e,t,p,null,r,d)}}for(var f in r){var p=r[f];if(d=n[f],r.hasOwnProperty(f)&&(null!=p||null!=d))switch(f){case"type":o=p;break;case"name":i=p;break;case"checked":c=p;break;case"defaultChecked":u=p;break;case"value":a=p;break;case"defaultValue":s=p;break;case"children":case"dangerouslySetInnerHTML":if(null!=p)throw Error(he(137,t));break;default:p!==d&&bf(e,t,f,p,r,d)}}return void Nn(e,a,s,l,c,u,o,i);case"select":for(o in p=a=s=f=null,n)if(l=n[o],n.hasOwnProperty(o)&&null!=l)switch(o){case"value":break;case"multiple":p=l;default:r.hasOwnProperty(o)||bf(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(null!=o||null!=l))switch(i){case"value":f=o;break;case"defaultValue":s=o;break;case"multiple":a=o;default:o!==l&&bf(e,t,i,o,r,l)}return t=s,n=a,r=p,void(null!=f?jn(e,!!n,f,!1):!!r!=!!n&&(null!=t?jn(e,!!n,t,!0):jn(e,!!n,n?[]:"",!1)));case"textarea":for(s in p=f=null,n)if(i=n[s],n.hasOwnProperty(s)&&null!=i&&!r.hasOwnProperty(s))switch(s){case"value":case"children":break;default:bf(e,t,s,null,r,i)}for(a in r)if(i=r[a],o=n[a],r.hasOwnProperty(a)&&(null!=i||null!=o))switch(a){case"value":f=i;break;case"defaultValue":p=i;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=i)throw Error(he(91));break;default:i!==o&&bf(e,t,a,i,r,o)}return void On(e,f,p);case"option":for(var h in n)if(f=n[h],n.hasOwnProperty(h)&&null!=f&&!r.hasOwnProperty(h))if("selected"===h)e.selected=!1;else bf(e,t,h,null,r,f);for(l in r)if(f=r[l],p=n[l],r.hasOwnProperty(l)&&f!==p&&(null!=f||null!=p))if("selected"===l)e.selected=f&&"function"!=typeof f&&"symbol"!=typeof f;else bf(e,t,l,f,r,p);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 m in n)f=n[m],n.hasOwnProperty(m)&&null!=f&&!r.hasOwnProperty(m)&&bf(e,t,m,null,r,f);for(c in r)if(f=r[c],p=n[c],r.hasOwnProperty(c)&&f!==p&&(null!=f||null!=p))switch(c){case"children":case"dangerouslySetInnerHTML":if(null!=f)throw Error(he(137,t));break;default:bf(e,t,c,f,r,p)}return;default:if(Dn(t)){for(var v in n)f=n[v],n.hasOwnProperty(v)&&void 0!==f&&!r.hasOwnProperty(v)&&wf(e,t,v,void 0,r,f);for(u in r)f=r[u],p=n[u],!r.hasOwnProperty(u)||f===p||void 0===f&&void 0===p||wf(e,t,u,f,r,p);return}}for(var g in n)f=n[g],n.hasOwnProperty(g)&&null!=f&&!r.hasOwnProperty(g)&&bf(e,t,g,null,r,f);for(d in r)f=r[d],p=n[d],!r.hasOwnProperty(d)||f===p||null==f&&null==p||bf(e,t,d,f,r,p)}(r,e.type,n,t),r[Yt]=t}catch(t){Od(e,e.return,t)}}function Pc(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&Mf(e.type)||4===e.tag}function Ac(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Pc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&Mf(e.type))continue e;if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Rc(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?(9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).insertBefore(e,t):((t=9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Fn));else if(4!==r&&(27===r&&Mf(e.type)&&(n=e.stateNode,t=null),null!==(e=e.child)))for(Rc(e,t,n),e=e.sibling;null!==e;)Rc(e,t,n),e=e.sibling}function Mc(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&(27===r&&Mf(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(Mc(e,t,n),e=e.sibling;null!==e;)Mc(e,t,n),e=e.sibling}function Lc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);xf(t,r,n),t[Jt]=e,t[Yt]=n}catch(t){Od(e,e.return,t)}}var Dc=!1,Bc=!1,zc=!1,Uc="function"==typeof WeakSet?WeakSet:Set,Fc=null;function qc(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:nu(e,n),4&r&&Cc(5,n);break;case 1:if(nu(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(e){Od(n,n.return,e)}else{var i=Ol(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Od(n,n.return,e)}}64&r&&Ec(n),512&r&&Ic(n,n.return);break;case 3:if(nu(e,n),64&r&&null!==(e=n.updateQueue)){if(t=null,null!==n.child)switch(n.child.tag){case 27:case 5:case 1:t=n.child.stateNode}try{Ma(e,t)}catch(e){Od(n,n.return,e)}}break;case 27:null===t&&4&r&&Lc(n);case 26:case 5:nu(e,n),null===t&&4&r&&jc(n),512&r&&Ic(n,n.return);break;case 12:nu(e,n);break;case 31:nu(e,n),4&r&&Qc(e,n);break;case 13:nu(e,n),4&r&&Jc(e,n),64&r&&(null!==(e=n.memoizedState)&&(null!==(e=e.dehydrated)&&function(e,t){var n=e.ownerDocument;if("$~"===e.data)e._reactRetry=t;else if("$?"!==e.data||"loading"!==n.readyState)t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}(e,n=Md.bind(null,n))));break;case 22:if(!(r=null!==n.memoizedState||Dc)){t=null!==t&&null!==t.memoizedState||Bc,i=Dc;var o=Bc;Dc=r,(Bc=t)&&!o?iu(e,n,!!(8772&n.subtreeFlags)):nu(e,n),Dc=i,Bc=o}break;case 30:break;default:nu(e,n)}}function Hc(e){var t=e.alternate;null!==t&&(e.alternate=null,Hc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&rn(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 Wc=null,Vc=!1;function $c(e,t,n){for(n=n.child;null!==n;)Kc(e,t,n),n=n.sibling}function Kc(e,t,n){if(Et&&"function"==typeof Et.onCommitFiberUnmount)try{Et.onCommitFiberUnmount(_t,n)}catch(e){}switch(n.tag){case 26:Bc||Tc(n,t),$c(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode).parentNode.removeChild(n);break;case 27:Bc||Tc(n,t);var r=Wc,i=Vc;Mf(n.type)&&(Wc=n.stateNode,Vc=!1),$c(e,t,n),Kf(n.stateNode),Wc=r,Vc=i;break;case 5:Bc||Tc(n,t);case 6:if(r=Wc,i=Vc,Wc=null,$c(e,t,n),Vc=i,null!==(Wc=r))if(Vc)try{(9===Wc.nodeType?Wc.body:"HTML"===Wc.nodeName?Wc.ownerDocument.body:Wc).removeChild(n.stateNode)}catch(e){Od(n,t,e)}else try{Wc.removeChild(n.stateNode)}catch(e){Od(n,t,e)}break;case 18:null!==Wc&&(Vc?(Lf(9===(e=Wc).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,n.stateNode),Zp(e)):Lf(Wc,n.stateNode));break;case 4:r=Wc,i=Vc,Wc=n.stateNode.containerInfo,Vc=!0,$c(e,t,n),Wc=r,Vc=i;break;case 0:case 11:case 14:case 15:_c(2,n,t),Bc||_c(4,n,t),$c(e,t,n);break;case 1:Bc||(Tc(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount&&Nc(n,t,r)),$c(e,t,n);break;case 21:$c(e,t,n);break;case 22:Bc=(r=Bc)||null!==n.memoizedState,$c(e,t,n),Bc=r;break;default:$c(e,t,n)}}function Qc(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&null!==(e=e.memoizedState))){e=e.dehydrated;try{Zp(e)}catch(e){Od(t,t.return,e)}}}function Jc(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&(null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))))try{Zp(e)}catch(e){Od(t,t.return,e)}}function Yc(e,t){var n=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new Uc),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new Uc),t;default:throw Error(he(435,e.tag))}}(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ld.bind(null,e,t);t.then(r,r)}})}function Gc(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r],o=e,a=t,s=a;e:for(;null!==s;){switch(s.tag){case 27:if(Mf(s.type)){Wc=s.stateNode,Vc=!1;break e}break;case 5:Wc=s.stateNode,Vc=!1;break e;case 3:case 4:Wc=s.stateNode.containerInfo,Vc=!0;break e}s=s.return}if(null===Wc)throw Error(he(160));Kc(o,a,i),Wc=null,Vc=!1,null!==(o=i.alternate)&&(o.return=null),i.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)Zc(t,e),t=t.sibling}var Xc=null;function Zc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Gc(t,e),eu(e),4&r&&(_c(3,e,e.return),Cc(3,e),_c(5,e,e.return));break;case 1:Gc(t,e),eu(e),512&r&&(Bc||null===n||Tc(n,n.return)),64&r&&Dc&&(null!==(e=e.updateQueue)&&(null!==(r=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?r:n.concat(r))));break;case 26:var i=Xc;if(Gc(t,e),eu(e),512&r&&(Bc||null===n||Tc(n,n.return)),4&r){var o=null!==n?n.memoizedState:null;if(r=e.memoizedState,null===n)if(null===r)if(null===e.stateNode){e:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":(!(o=i.getElementsByTagName("title")[0])||o[nn]||o[Jt]||"http://www.w3.org/2000/svg"===o.namespaceURI||o.hasAttribute("itemprop"))&&(o=i.createElement(r),i.head.insertBefore(o,i.querySelector("head > title"))),xf(o,r,n),o[Jt]=e,cn(o),r=o;break e;case"link":var a=dp("link","href",i).get(r+(n.href||""));if(a)for(var s=0;s<a.length;s++)if((o=a[s]).getAttribute("href")===(null==n.href||""===n.href?null:n.href)&&o.getAttribute("rel")===(null==n.rel?null:n.rel)&&o.getAttribute("title")===(null==n.title?null:n.title)&&o.getAttribute("crossorigin")===(null==n.crossOrigin?null:n.crossOrigin)){a.splice(s,1);break t}xf(o=i.createElement(r),r,n),i.head.appendChild(o);break;case"meta":if(a=dp("meta","content",i).get(r+(n.content||"")))for(s=0;s<a.length;s++)if((o=a[s]).getAttribute("content")===(null==n.content?null:""+n.content)&&o.getAttribute("name")===(null==n.name?null:n.name)&&o.getAttribute("property")===(null==n.property?null:n.property)&&o.getAttribute("http-equiv")===(null==n.httpEquiv?null:n.httpEquiv)&&o.getAttribute("charset")===(null==n.charSet?null:n.charSet)){a.splice(s,1);break t}xf(o=i.createElement(r),r,n),i.head.appendChild(o);break;default:throw Error(he(468,r))}o[Jt]=e,cn(o),r=o}e.stateNode=r}else fp(i,e.type,e.stateNode);else e.stateNode=ap(i,r,e.memoizedProps);else o!==r?(null===o?null!==n.stateNode&&(n=n.stateNode).parentNode.removeChild(n):o.count--,null===r?fp(i,e.type,e.stateNode):ap(i,r,e.memoizedProps)):null===r&&null!==e.stateNode&&Oc(e,e.memoizedProps,n.memoizedProps)}break;case 27:Gc(t,e),eu(e),512&r&&(Bc||null===n||Tc(n,n.return)),null!==n&&4&r&&Oc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Gc(t,e),eu(e),512&r&&(Bc||null===n||Tc(n,n.return)),32&e.flags){i=e.stateNode;try{An(i,"")}catch(t){Od(e,e.return,t)}}4&r&&null!=e.stateNode&&Oc(e,i=e.memoizedProps,null!==n?n.memoizedProps:i),1024&r&&(zc=!0);break;case 6:if(Gc(t,e),eu(e),4&r){if(null===e.stateNode)throw Error(he(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Od(e,e.return,t)}}break;case 3:if(up=null,i=Xc,Xc=Yf(t.containerInfo),Gc(t,e),Xc=i,eu(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Zp(t.containerInfo)}catch(t){Od(e,e.return,t)}zc&&(zc=!1,tu(e));break;case 4:r=Xc,Xc=Yf(e.stateNode.containerInfo),Gc(t,e),eu(e),Xc=r;break;case 12:default:Gc(t,e),eu(e);break;case 31:case 19:Gc(t,e),eu(e),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Yc(e,r)));break;case 13:Gc(t,e),eu(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(Uu=vt()),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Yc(e,r)));break;case 22:i=null!==e.memoizedState;var l=null!==n&&null!==n.memoizedState,c=Dc,u=Bc;if(Dc=c||i,Bc=u||l,Gc(t,e),Bc=u,Dc=c,eu(e),8192&r)e:for(t=e.stateNode,t._visibility=i?-2&t._visibility:1|t._visibility,i&&(null===n||l||Dc||Bc||ru(e)),n=null,t=e;;){if(5===t.tag||26===t.tag){if(null===n){l=n=t;try{if(o=l.stateNode,i)"function"==typeof(a=o.style).setProperty?a.setProperty("display","none","important"):a.display="none";else{s=l.stateNode;var d=l.memoizedProps.style,f=null!=d&&d.hasOwnProperty("display")?d.display:null;s.style.display=null==f||"boolean"==typeof f?"":(""+f).trim()}}catch(e){Od(l,l.return,e)}}}else if(6===t.tag){if(null===n){l=t;try{l.stateNode.nodeValue=i?"":l.memoizedProps}catch(e){Od(l,l.return,e)}}}else if(18===t.tag){if(null===n){l=t;try{var p=l.stateNode;i?Df(p,!0):Df(l.stateNode,!1)}catch(e){Od(l,l.return,e)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}4&r&&(null!==(r=e.updateQueue)&&(null!==(n=r.retryQueue)&&(r.retryQueue=null,Yc(e,n))));case 30:case 21:}}function eu(e){var t=e.flags;if(2&t){try{for(var n,r=e.return;null!==r;){if(Pc(r)){n=r;break}r=r.return}if(null==n)throw Error(he(160));switch(n.tag){case 27:var i=n.stateNode;Mc(e,Ac(e),i);break;case 5:var o=n.stateNode;32&n.flags&&(An(o,""),n.flags&=-33),Mc(e,Ac(e),o);break;case 3:case 4:var a=n.stateNode.containerInfo;Rc(e,Ac(e),a);break;default:throw Error(he(161))}}catch(t){Od(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function tu(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;tu(t),5===t.tag&&1024&t.flags&&t.stateNode.reset(),e=e.sibling}}function nu(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)qc(e,t.alternate,t),t=t.sibling}function ru(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:_c(4,t,t.return),ru(t);break;case 1:Tc(t,t.return);var n=t.stateNode;"function"==typeof n.componentWillUnmount&&Nc(t,t.return,n),ru(t);break;case 27:Kf(t.stateNode);case 26:case 5:Tc(t,t.return),ru(t);break;case 22:null===t.memoizedState&&ru(t);break;default:ru(t)}e=e.sibling}}function iu(e,t,n){for(n=n&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var r=t.alternate,i=e,o=t,a=o.flags;switch(o.tag){case 0:case 11:case 15:iu(i,o,n),Cc(4,o);break;case 1:if(iu(i,o,n),"function"==typeof(i=(r=o).stateNode).componentDidMount)try{i.componentDidMount()}catch(e){Od(r,r.return,e)}if(null!==(i=(r=o).updateQueue)){var s=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(null!==l)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)Ra(l[i],s)}catch(e){Od(r,r.return,e)}}n&&64&a&&Ec(o),Ic(o,o.return);break;case 27:Lc(o);case 26:case 5:iu(i,o,n),n&&null===r&&4&a&&jc(o),Ic(o,o.return);break;case 12:iu(i,o,n);break;case 31:iu(i,o,n),n&&4&a&&Qc(i,o);break;case 13:iu(i,o,n),n&&4&a&&Jc(i,o);break;case 22:null===o.memoizedState&&iu(i,o,n),Ic(o,o.return);break;case 30:break;default:iu(i,o,n)}t=t.sibling}}function ou(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&Jo(n))}function au(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Jo(e))}function su(e,t,n,r){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)lu(e,t,n,r),t=t.sibling}function lu(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:su(e,t,n,r),2048&i&&Cc(9,t);break;case 1:case 31:case 13:default:su(e,t,n,r);break;case 3:su(e,t,n,r),2048&i&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Jo(e)));break;case 12:if(2048&i){su(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,a=o.id,s=o.onPostCommit;"function"==typeof s&&s(a,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(e){Od(t,t.return,e)}}else su(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,a=t.alternate,null!==t.memoizedState?2&o._visibility?su(e,t,n,r):uu(e,t):2&o._visibility?su(e,t,n,r):(o._visibility|=2,cu(e,t,n,r,!!(10256&t.subtreeFlags)||!1)),2048&i&&ou(a,t);break;case 24:su(e,t,n,r),2048&i&&au(t.alternate,t)}}function cu(e,t,n,r,i){for(i=i&&(!!(10256&t.subtreeFlags)||!1),t=t.child;null!==t;){var o=e,a=t,s=n,l=r,c=a.flags;switch(a.tag){case 0:case 11:case 15:cu(o,a,s,l,i),Cc(8,a);break;case 23:break;case 22:var u=a.stateNode;null!==a.memoizedState?2&u._visibility?cu(o,a,s,l,i):uu(o,a):(u._visibility|=2,cu(o,a,s,l,i)),i&&2048&c&&ou(a.alternate,a);break;case 24:cu(o,a,s,l,i),i&&2048&c&&au(a.alternate,a);break;default:cu(o,a,s,l,i)}t=t.sibling}}function uu(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:uu(n,r),2048&i&&ou(r.alternate,r);break;case 24:uu(n,r),2048&i&&au(r.alternate,r);break;default:uu(n,r)}t=t.sibling}}var du=8192;function fu(e,t,n){if(e.subtreeFlags&du)for(e=e.child;null!==e;)pu(e,t,n),e=e.sibling}function pu(e,t,n){switch(e.tag){case 26:fu(e,t,n),e.flags&du&&null!==e.memoizedState&&function(e,t,n,r){if(!("stylesheet"!==n.type||"string"==typeof r.media&&!1===matchMedia(r.media).matches||4&n.state.loading)){if(null===n.instance){var i=tp(r.href),o=t.querySelector(np(i));if(o)return null!==(t=o._p)&&"object"==typeof t&&"function"==typeof t.then&&(e.count++,e=mp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,void cn(o);o=t.ownerDocument||t,r=rp(r),(i=Qf.get(i))&&lp(r,i),cn(o=o.createElement("link"));var a=o;a._p=new Promise(function(e,t){a.onload=e,a.onerror=t}),xf(o,"link",r),n.instance=o}null===e.stylesheets&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(3&n.state.loading)&&(e.count++,n=mp.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}(n,Xc,e.memoizedState,e.memoizedProps);break;case 5:default:fu(e,t,n);break;case 3:case 4:var r=Xc;Xc=Yf(e.stateNode.containerInfo),fu(e,t,n),Xc=r;break;case 22:null===e.memoizedState&&(null!==(r=e.alternate)&&null!==r.memoizedState?(r=du,du=16777216,fu(e,t,n),du=r):fu(e,t,n))}}function hu(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do{t=e.sibling,e.sibling=null,e=t}while(null!==e)}}function mu(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Fc=r,yu(r,e)}hu(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)vu(e),e=e.sibling}function vu(e){switch(e.tag){case 0:case 11:case 15:mu(e),2048&e.flags&&_c(9,e,e.return);break;case 3:case 12:default:mu(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,gu(e)):mu(e)}}function gu(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Fc=r,yu(r,e)}hu(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:_c(8,t,t.return),gu(t);break;case 22:2&(n=t.stateNode)._visibility&&(n._visibility&=-3,gu(t));break;default:gu(t)}e=e.sibling}}function yu(e,t){for(;null!==Fc;){var n=Fc;switch(n.tag){case 0:case 11:case 15:_c(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var r=n.memoizedState.cachePool.pool;null!=r&&r.refCount++}break;case 24:Jo(n.memoizedState.cache)}if(null!==(r=n.child))r.return=n,Fc=r;else e:for(n=e;null!==Fc;){var i=(r=Fc).sibling,o=r.return;if(Hc(r),r===n){Fc=null;break e}if(null!==i){i.return=o,Fc=i;break e}Fc=o}}}var bu={getCacheForType:function(e){var t=Fo(Ko),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Fo(Ko).controller.signal}},wu="function"==typeof WeakMap?WeakMap:Map,xu=0,ku=null,Su=null,Cu=0,_u=0,Eu=null,Nu=!1,Iu=!1,Tu=!1,ju=0,Ou=0,Pu=0,Au=0,Ru=0,Mu=0,Lu=0,Du=null,Bu=null,zu=!1,Uu=0,Fu=0,qu=1/0,Hu=null,Wu=null,Vu=0,$u=null,Ku=null,Qu=0,Ju=0,Yu=null,Gu=null,Xu=0,Zu=null;function ed(){return 2&xu&&0!==Cu?Cu&-Cu:null!==qe.T?Yd():$t()}function td(){if(0===Mu)if(536870912&Cu&&!wo)Mu=536870912;else{var e=Pt;!(3932160&(Pt<<=1))&&(Pt=262144),Mu=e}return null!==(e=Fa.current)&&(e.flags|=32),Mu}function nd(e,t,n){(e!==ku||2!==_u&&9!==_u)&&null===e.cancelPendingCommit||(cd(e,0),ad(e,Cu,Mu,!1)),Ut(e,n),2&xu&&e===ku||(e===ku&&(!(2&xu)&&(Au|=n),4===Ou&&ad(e,Cu,Mu,!1)),Hd(e))}function rd(e,t,n){if(6&xu)throw Error(he(327));for(var r=!n&&!(127&t)&&0===(t&e.expiredLanes)||Lt(e,t),i=r?function(e,t){var n=xu;xu|=2;var r=fd(),i=pd();ku!==e||Cu!==t?(Hu=null,qu=vt()+500,cd(e,t)):Iu=Lt(e,t);e:for(;;)try{if(0!==_u&&null!==Su){t=Su;var o=Eu;t:switch(_u){case 1:_u=0,Eu=null,wd(e,t,o,1);break;case 2:case 9:if(ua(o)){_u=0,Eu=null,bd(t);break}t=function(){2!==_u&&9!==_u||ku!==e||(_u=7),Hd(e)},o.then(t,t);break e;case 3:_u=7;break e;case 4:_u=5;break e;case 7:ua(o)?(_u=0,Eu=null,bd(t)):(_u=0,Eu=null,wd(e,t,o,7));break;case 5:var a=null;switch(Su.tag){case 26:a=Su.memoizedState;case 5:case 27:var s=Su;if(a?pp(a):s.stateNode.complete){_u=0,Eu=null;var l=s.sibling;if(null!==l)Su=l;else{var c=s.return;null!==c?(Su=c,xd(c)):Su=null}break t}}_u=0,Eu=null,wd(e,t,o,5);break;case 6:_u=0,Eu=null,wd(e,t,o,6);break;case 8:ld(),Ou=6;break e;default:throw Error(he(462))}}gd();break}catch(t){ud(e,t)}return Ao=Po=null,qe.H=r,qe.A=i,xu=n,null!==Su?0:(ku=null,Cu=0,Bi(),Ou)}(e,t):md(e,t,!0),o=r;;){if(0===i){Iu&&!r&&ad(e,t,0,!1);break}if(n=e.current.alternate,!o||od(n)){if(2===i){if(o=t,e.errorRecoveryDisabledLanes&o)var a=0;else a=0!==(a=-536870913&e.pendingLanes)?a:536870912&a?536870912:0;if(0!==a){t=a;e:{var s=e;i=Du;var l=s.current.memoizedState.isDehydrated;if(l&&(cd(s,a).flags|=256),2!==(a=md(s,a,!1))){if(Tu&&!l){s.errorRecoveryDisabledLanes|=o,Au|=o,i=4;break e}o=Bu,Bu=i,null!==o&&(null===Bu?Bu=o:Bu.push.apply(Bu,o))}i=a}if(o=!1,2!==i)continue}}if(1===i){cd(e,0),ad(e,t,0,!0);break}e:{switch(r=e,o=i){case 0:case 1:throw Error(he(345));case 4:if((4194048&t)!==t)break;case 6:ad(r,t,Mu,!Nu);break e;case 2:Bu=null;break;case 3:case 5:break;default:throw Error(he(329))}if((62914560&t)===t&&10<(i=Uu+300-vt())){if(ad(r,t,Mu,!Nu),0!==Mt(r,0,!0))break e;Qu=t,r.timeoutHandle=jf(id.bind(null,r,n,Bu,Hu,zu,t,Mu,Au,Lu,Nu,o,"Throttled",-0,0),i)}else id(r,n,Bu,Hu,zu,t,Mu,Au,Lu,Nu,o,null,-0,0)}break}i=md(e,t,!1),o=!1}Hd(e)}function id(e,t,n,r,i,o,a,s,l,c,u,d,f,p){if(e.timeoutHandle=-1,8192&(d=t.subtreeFlags)||!(16785408&~d)){pu(t,o,d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fn});var h=(62914560&o)===o?Uu-vt():(4194048&o)===o?Fu-vt():0;if(null!==(h=function(e,t){return e.stylesheets&&0===e.count&&gp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&gp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&0===hp&&(hp=62500*function(){if("function"==typeof performance.getEntriesByType){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var i=n[r],o=i.transferSize,a=i.initiatorType,s=i.duration;if(o&&s&&kf(a)){for(a=0,s=i.responseEnd,r+=1;r<n.length;r++){var l=n[r],c=l.startTime;if(c>s)break;var u=l.transferSize,d=l.initiatorType;u&&kf(d)&&(a+=u*((l=l.responseEnd)<s?1:(s-c)/(l-c)))}if(--r,t+=8*(o+a)/(i.duration/1e3),10<++e)break}}if(0<e)return t/e/1e6}return navigator.connection&&"number"==typeof(e=navigator.connection.downlink)?e:5}());var i=setTimeout(function(){if(e.waitingForImages=!1,0===e.count&&(e.stylesheets&&gp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>hp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}(d,h)))return Qu=o,e.cancelPendingCommit=h(Sd.bind(null,e,t,o,n,r,i,a,s,l,u,d,null,f,p)),void ad(e,o,a,!c)}Sd(e,t,o,n,r,i,a,s,l)}function od(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&(null!==(n=t.updateQueue)&&null!==(n=n.stores)))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!ai(o(),i))return!1}catch(e){return!1}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ad(e,t,n,r){t&=~Ru,t&=~Au,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var o=31-It(i),a=1<<o;r[o]=-1,i&=~a}0!==n&&Ft(e,n,t)}function sd(){return!!(6&xu)||(Wd(0),!1)}function ld(){if(null!==Su){if(0===_u)var e=Su.return;else Ao=Po=null,ms(e=Su),va=null,ga=0,e=Su;for(;null!==e;)Sc(e.alternate,e),e=e.return;Su=null}}function cd(e,t){var n=e.timeoutHandle;-1!==n&&(e.timeoutHandle=-1,Of(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),Qu=0,ld(),ku=e,Su=n=Qi(e.current,null),Cu=t,_u=0,Eu=null,Nu=!1,Iu=Lt(e,t),Tu=!1,Lu=Mu=Ru=Au=Pu=Ou=0,Bu=Du=null,zu=!1,8&t&&(t|=32&t);var r=e.entangledLanes;if(0!==r)for(e=e.entanglements,r&=t;0<r;){var i=31-It(r),o=1<<i;t|=e[i],r&=~o}return ju=t,Bi(),n}function ud(e,t){Ga=null,qe.H=Sl,t===aa||t===la?(t=ha(),_u=3):t===sa?(t=ha(),_u=4):_u=t===Ul?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,Eu=t,null===Su&&(Ou=1,Ml(e,no(t,e.current)))}function dd(){var e=Fa.current;return null===e||((4194048&Cu)===Cu?null===qa:!!((62914560&Cu)===Cu||536870912&Cu)&&e===qa)}function fd(){var e=qe.H;return qe.H=Sl,null===e?Sl:e}function pd(){var e=qe.A;return qe.A=bu,e}function hd(){Ou=4,Nu||(4194048&Cu)!==Cu&&null!==Fa.current||(Iu=!0),!(134217727&Pu)&&!(134217727&Au)||null===ku||ad(ku,Cu,Mu,!1)}function md(e,t,n){var r=xu;xu|=2;var i=fd(),o=pd();ku===e&&Cu===t||(Hu=null,cd(e,t)),t=!1;var a=Ou;e:for(;;)try{if(0!==_u&&null!==Su){var s=Su,l=Eu;switch(_u){case 8:ld(),a=6;break e;case 3:case 2:case 9:case 6:null===Fa.current&&(t=!0);var c=_u;if(_u=0,Eu=null,wd(e,s,l,c),n&&Iu){a=0;break e}break;default:c=_u,_u=0,Eu=null,wd(e,s,l,c)}}vd(),a=Ou;break}catch(t){ud(e,t)}return t&&e.shellSuspendCounter++,Ao=Po=null,xu=r,qe.H=i,qe.A=o,null===Su&&(ku=null,Cu=0,Bi()),a}function vd(){for(;null!==Su;)yd(Su)}function gd(){for(;null!==Su&&!ht();)yd(Su)}function yd(e){var t=hc(e.alternate,e,ju);e.memoizedProps=e.pendingProps,null===t?xd(e):Su=t}function bd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Zl(n,t,t.pendingProps,t.type,void 0,Cu);break;case 11:t=Zl(n,t,t.pendingProps,t.type.render,t.ref,Cu);break;case 5:ms(t);default:Sc(n,t),t=hc(n,t=Su=Ji(t,ju),ju)}e.memoizedProps=e.pendingProps,null===t?xd(e):Su=t}function wd(e,t,n,r){Ao=Po=null,ms(t),va=null,ga=0;var i=t.return;try{if(function(e,t,n,r,i){if(n.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=n.alternate)&&Bo(t,n,i,!0),null!==(n=Fa.current)){switch(n.tag){case 31:case 13:return null===qa?hd():null===n.alternate&&0===Ou&&(Ou=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===ca?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=new Set([r]):t.add(r),Pd(e,r,i)),!1;case 22:return n.flags|=65536,r===ca?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=new Set([r]):n.add(r),Pd(e,r,i)),!1}throw Error(he(435,n.tag))}return Pd(e,r,i),hd(),!1}if(wo)return null!==(t=Fa.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==So&&jo(no(e=Error(he(422),{cause:r}),n))):(r!==So&&jo(no(t=Error(he(423),{cause:r}),n)),(e=e.current.alternate).flags|=65536,i&=-i,e.lanes|=i,r=no(r,n),ja(e,i=Dl(e.stateNode,r,i)),4!==Ou&&(Ou=2)),!1;var o=Error(he(520),{cause:r});if(o=no(o,n),null===Du?Du=[o]:Du.push(o),4!==Ou&&(Ou=2),null===t)return!0;r=no(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,ja(n,e=Dl(n.stateNode,r,e)),!1;case 1:if(t=n.type,o=n.stateNode,!(128&n.flags||"function"!=typeof t.getDerivedStateFromError&&(null===o||"function"!=typeof o.componentDidCatch||null!==Wu&&Wu.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,zl(i=Bl(i),e,n,r),ja(n,i),!1}n=n.return}while(null!==n);return!1}(e,i,t,n,Cu))return Ou=1,Ml(e,no(n,e.current)),void(Su=null)}catch(t){if(null!==i)throw Su=i,t;return Ou=1,Ml(e,no(n,e.current)),void(Su=null)}32768&t.flags?(wo||1===r?e=!0:Iu||536870912&Cu?e=!1:(Nu=e=!0,(2===r||9===r||3===r||6===r)&&(null!==(r=Fa.current)&&13===r.tag&&(r.flags|=16384))),kd(t,e)):xd(t)}function xd(e){var t=e;do{if(32768&t.flags)return void kd(t,Nu);e=t.return;var n=xc(t.alternate,t,ju);if(null!==n)return void(Su=n);if(null!==(t=t.sibling))return void(Su=t);Su=t=e}while(null!==t);0===Ou&&(Ou=5)}function kd(e,t){do{var n=kc(e.alternate,e);if(null!==n)return n.flags&=32767,void(Su=n);if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling))return void(Su=e);Su=e=n}while(null!==e);Ou=6,Su=null}function Sd(e,t,n,r,i,o,a,s,l){e.cancelPendingCommit=null;do{Id()}while(0!==Vu);if(6&xu)throw Error(he(327));if(null!==t){if(t===e.current)throw Error(he(177));if(o=t.lanes|t.childLanes,function(e,t,n,r,i,o){var a=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,l=e.expirationTimes,c=e.hiddenUpdates;for(n=a&~n;0<n;){var u=31-It(n),d=1<<u;s[u]=0,l[u]=-1;var f=c[u];if(null!==f)for(c[u]=null,u=0;u<f.length;u++){var p=f[u];null!==p&&(p.lane&=-536870913)}n&=~d}0!==r&&Ft(e,r,0),0!==o&&0===i&&0!==e.tag&&(e.suspendedLanes|=o&~(a&~t))}(e,n,o|=Di,a,s,l),e===ku&&(Su=ku=null,Cu=0),Ku=t,$u=e,Qu=n,Ju=o,Yu=i,Gu=r,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,ft(wt,function(){return Td(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(13878&t.flags),13878&t.subtreeFlags||r){r=qe.T,qe.T=null,i=He.p,He.p=2,a=xu,xu|=4;try{!function(e,t){if(e=e.containerInfo,Sf=Ip,fi(e=di(e))){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(e){n=null;break e}var a=0,s=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var p;d!==n||0!==i&&3!==d.nodeType||(s=a+i),d!==o||0!==r&&3!==d.nodeType||(l=a+r),3===d.nodeType&&(a+=d.nodeValue.length),null!==(p=d.firstChild);)f=d,d=p;for(;;){if(d===e)break t;if(f===n&&++c===i&&(s=a),f===o&&++u===r&&(l=a),null!==(p=d.nextSibling))break;f=(d=f).parentNode}d=p}n=-1===s||-1===l?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Cf={focusedElem:e,selectionRange:n},Ip=!1,Fc=t;null!==Fc;)if(e=(t=Fc).child,1028&t.subtreeFlags&&null!==e)e.return=t,Fc=e;else for(;null!==Fc;){switch(o=(t=Fc).alternate,e=t.flags,t.tag){case 0:if(4&e&&null!==(e=null!==(e=t.updateQueue)?e.events:null))for(n=0;n<e.length;n++)(i=e[n]).ref.impl=i.nextImpl;break;case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(1024&e&&null!==o){e=void 0,n=t,i=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Ol(n.type,i);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Od(n,n.return,e)}}break;case 3:if(1024&e)if(9===(n=(e=t.stateNode.containerInfo).nodeType))Bf(e);else if(1===n)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Bf(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(he(163))}if(null!==(e=t.sibling)){e.return=t.return,Fc=e;break}Fc=t.return}}(e,t)}finally{xu=a,He.p=i,qe.T=r}}Vu=1,Cd(),_d(),Ed()}}function Cd(){if(1===Vu){Vu=0;var e=$u,t=Ku,n=!!(13878&t.flags);if(13878&t.subtreeFlags||n){n=qe.T,qe.T=null;var r=He.p;He.p=2;var i=xu;xu|=4;try{Zc(t,e);var o=Cf,a=di(e.containerInfo),s=o.focusedElem,l=o.selectionRange;if(a!==s&&s&&s.ownerDocument&&ui(s.ownerDocument.documentElement,s)){if(null!==l&&fi(s)){var c=l.start,u=l.end;if(void 0===u&&(u=c),"selectionStart"in s)s.selectionStart=c,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(),h=s.textContent.length,m=Math.min(l.start,h),v=void 0===l.end?m:Math.min(l.end,h);!p.extend&&m>v&&(a=v,v=m,m=a);var g=ci(s,m),y=ci(s,v);if(g&&y&&(1!==p.rangeCount||p.anchorNode!==g.node||p.anchorOffset!==g.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var b=d.createRange();b.setStart(g.node,g.offset),p.removeAllRanges(),m>v?(p.addRange(b),p.extend(y.node,y.offset)):(b.setEnd(y.node,y.offset),p.addRange(b))}}}}for(d=[],p=s;p=p.parentNode;)1===p.nodeType&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof s.focus&&s.focus(),s=0;s<d.length;s++){var w=d[s];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}Ip=!!Sf,Cf=Sf=null}finally{xu=i,He.p=r,qe.T=n}}e.current=t,Vu=2}}function _d(){if(2===Vu){Vu=0;var e=$u,t=Ku,n=!!(8772&t.flags);if(8772&t.subtreeFlags||n){n=qe.T,qe.T=null;var r=He.p;He.p=2;var i=xu;xu|=4;try{qc(e,t.alternate,t)}finally{xu=i,He.p=r,qe.T=n}}Vu=3}}function Ed(){if(4===Vu||3===Vu){Vu=0,mt();var e=$u,t=Ku,n=Qu,r=Gu;10256&t.subtreeFlags||10256&t.flags?Vu=5:(Vu=0,Ku=$u=null,Nd(e,e.pendingLanes));var i=e.pendingLanes;if(0===i&&(Wu=null),Vt(n),t=t.stateNode,Et&&"function"==typeof Et.onCommitFiberRoot)try{Et.onCommitFiberRoot(_t,t,void 0,!(128&~t.current.flags))}catch(e){}if(null!==r){t=qe.T,i=He.p,He.p=2,qe.T=null;try{for(var o=e.onRecoverableError,a=0;a<r.length;a++){var s=r[a];o(s.value,{componentStack:s.stack})}}finally{qe.T=t,He.p=i}}3&Qu&&Id(),Hd(e),i=e.pendingLanes,261930&n&&42&i?e===Zu?Xu++:(Xu=0,Zu=e):Xu=0,Wd(0)}}function Nd(e,t){0===(e.pooledCacheLanes&=t)&&(null!=(t=e.pooledCache)&&(e.pooledCache=null,Jo(t)))}function Id(){return Cd(),_d(),Ed(),Td()}function Td(){if(5!==Vu)return!1;var e=$u,t=Ju;Ju=0;var n=Vt(Qu),r=qe.T,i=He.p;try{He.p=32>n?32:n,qe.T=null,n=Yu,Yu=null;var o=$u,a=Qu;if(Vu=0,Ku=$u=null,Qu=0,6&xu)throw Error(he(331));var s=xu;if(xu|=4,vu(o.current),lu(o,o.current,a,n),xu=s,Wd(0,!1),Et&&"function"==typeof Et.onPostCommitFiberRoot)try{Et.onPostCommitFiberRoot(_t,o)}catch(e){}return!0}finally{He.p=i,qe.T=r,Nd(e,t)}}function jd(e,t,n){t=no(n,t),null!==(e=Ia(e,t=Dl(e.stateNode,t,2),2))&&(Ut(e,2),Hd(e))}function Od(e,t,n){if(3===e.tag)jd(e,e,n);else for(;null!==t;){if(3===t.tag){jd(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Wu||!Wu.has(r))){e=no(n,e),null!==(r=Ia(t,n=Bl(2),2))&&(zl(n,r,t,e),Ut(r,2),Hd(r));break}}t=t.return}}function Pd(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new wu;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(Tu=!0,i.add(n),e=Ad.bind(null,e,t,n),t.then(e,e))}function Ad(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ku===e&&(Cu&n)===n&&(4===Ou||3===Ou&&(62914560&Cu)===Cu&&300>vt()-Uu?!(2&xu)&&cd(e,0):Ru|=n,Lu===Cu&&(Lu=0)),Hd(e)}function Rd(e,t){0===t&&(t=Bt()),null!==(e=Fi(e,t))&&(Ut(e,t),Hd(e))}function Md(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Rd(e,n)}function Ld(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(he(314))}null!==r&&r.delete(t),Rd(e,n)}var Dd=null,Bd=null,zd=!1,Ud=!1,Fd=!1,qd=0;function Hd(e){e!==Bd&&null===e.next&&(null===Bd?Dd=Bd=e:Bd=Bd.next=e),Ud=!0,zd||(zd=!0,Af(function(){6&xu?ft(yt,Vd):$d()}))}function Wd(e,t){if(!Fd&&Ud){Fd=!0;do{for(var n=!1,r=Dd;null!==r;){if(0!==e){var i=r.pendingLanes;if(0===i)var o=0;else{var a=r.suspendedLanes,s=r.pingedLanes;o=(1<<31-It(42|e)+1)-1,o=201326741&(o&=i&~(a&~s))?201326741&o|1:o?2|o:0}0!==o&&(n=!0,Jd(r,o))}else o=Cu,!(3&(o=Mt(r,r===ku?o:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||Lt(r,o)||(n=!0,Jd(r,o));r=r.next}}while(n);Fd=!1}}function Vd(){$d()}function $d(){Ud=zd=!1;var e=0;0!==qd&&function(){var e=window.event;if(e&&"popstate"===e.type)return e!==Tf&&(Tf=e,!0);return Tf=null,!1}()&&(e=qd);for(var t=vt(),n=null,r=Dd;null!==r;){var i=r.next,o=Kd(r,t);0===o?(r.next=null,null===n?Dd=i:n.next=i,null===i&&(Bd=n)):(n=r,(0!==e||3&o)&&(Ud=!0)),r=i}0!==Vu&&5!==Vu||Wd(e),0!==qd&&(qd=0)}function Kd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=-62914561&e.pendingLanes;0<o;){var a=31-It(o),s=1<<a,l=i[a];-1===l?0!==(s&n)&&0===(s&r)||(i[a]=Dt(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}if(n=Cu,n=Mt(e,e===(t=ku)?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),r=e.callbackNode,0===n||e===t&&(2===_u||9===_u)||null!==e.cancelPendingCommit)return null!==r&&null!==r&&pt(r),e.callbackNode=null,e.callbackPriority=0;if(!(3&n)||Lt(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==r&&pt(r),Vt(n)){case 2:case 8:n=bt;break;case 32:default:n=wt;break;case 268435456:n=kt}return r=Qd.bind(null,e),n=ft(n,r),e.callbackPriority=t,e.callbackNode=n,t}return null!==r&&null!==r&&pt(r),e.callbackPriority=2,e.callbackNode=null,2}function Qd(e,t){if(0!==Vu&&5!==Vu)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Id()&&e.callbackNode!==n)return null;var r=Cu;return 0===(r=Mt(e,e===ku?r:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(rd(e,r,t),Kd(e,vt()),null!=e.callbackNode&&e.callbackNode===n?Qd.bind(null,e):null)}function Jd(e,t){if(Id())return null;rd(e,t,!0)}function Yd(){if(0===qd){var e=Xo;0===e&&(e=Ot,!(261888&(Ot<<=1))&&(Ot=256)),qd=e}return qd}function Gd(e){return null==e||"symbol"==typeof e||"boolean"==typeof e?null:"function"==typeof e?e:Un(""+e)}function Xd(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}for(var Zd=0;Zd<Pi.length;Zd++){var ef=Pi[Zd];Ai(ef.toLowerCase(),"on"+(ef[0].toUpperCase()+ef.slice(1)))}Ai(Ci,"onAnimationEnd"),Ai(_i,"onAnimationIteration"),Ai(Ei,"onAnimationStart"),Ai("dblclick","onDoubleClick"),Ai("focusin","onFocus"),Ai("focusout","onBlur"),Ai(Ni,"onTransitionRun"),Ai(Ii,"onTransitionStart"),Ai(Ti,"onTransitionCancel"),Ai(ji,"onTransitionEnd"),pn("onMouseEnter",["mouseout","mouseover"]),pn("onMouseLeave",["mouseout","mouseover"]),pn("onPointerEnter",["pointerout","pointerover"]),pn("onPointerLeave",["pointerout","pointerover"]),fn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fn("onBeforeInput",["compositionend","keypress","textInput","paste"]),fn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tf="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(" "),nf=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tf));function rf(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var a=r.length-1;0<=a;a--){var s=r[a],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==o&&i.isPropagationStopped())break e;o=s,i.currentTarget=c;try{o(i)}catch(e){Ri(e)}i.currentTarget=null,o=l}else for(a=0;a<r.length;a++){if(l=(s=r[a]).instance,c=s.currentTarget,s=s.listener,l!==o&&i.isPropagationStopped())break e;o=s,i.currentTarget=c;try{o(i)}catch(e){Ri(e)}i.currentTarget=null,o=l}}}}function of(e,t){var n=t[Xt];void 0===n&&(n=t[Xt]=new Set);var r=e+"__bubble";n.has(r)||(cf(t,e,2,!1),n.add(r))}function af(e,t,n){var r=0;t&&(r|=4),cf(n,e,r,t)}var sf="_reactListening"+Math.random().toString(36).slice(2);function lf(e){if(!e[sf]){e[sf]=!0,un.forEach(function(t){"selectionchange"!==t&&(nf.has(t)||af(t,!1,e),af(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[sf]||(t[sf]=!0,af("selectionchange",!1,t))}}function cf(e,t,n,r){switch(Mp(t)){case 2:var i=Tp;break;case 8:i=jp;break;default:i=Op}n=i.bind(null,t,n,e),i=void 0,!Gn||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),r?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function uf(e,t,n,r,i){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var a=r.tag;if(3===a||4===a){var s=r.stateNode.containerInfo;if(s===i)break;if(4===a)for(a=r.return;null!==a;){var l=a.tag;if((3===l||4===l)&&a.stateNode.containerInfo===i)return;a=a.return}for(;null!==s;){if(null===(a=on(s)))return;if(5===(l=a.tag)||6===l||26===l||27===l){r=o=a;continue e}s=s.parentNode}}r=r.return}Qn(function(){var r=o,i=Hn(n),a=[];e:{var s=Oi.get(e);if(void 0!==s){var l=dr,c=e;switch(e){case"keypress":if(0===rr(n))break e;case"keydown":case"keyup":l=Er;break;case"focusin":c="focus",l=gr;break;case"focusout":c="blur",l=gr;break;case"beforeblur":case"afterblur":l=gr;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=mr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=vr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Ir;break;case Ci:case _i:case Ei:l=yr;break;case ji:l=Tr;break;case"scroll":case"scrollend":l=pr;break;case"wheel":l=jr;break;case"copy":case"cut":case"paste":l=br;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=Nr;break;case"toggle":case"beforetoggle":l=Or}var u=!!(4&t),d=!u&&("scroll"===e||"scrollend"===e),f=u?null!==s?s+"Capture":null:s;u=[];for(var p,h=r;null!==h;){var m=h;if(p=m.stateNode,5!==(m=m.tag)&&26!==m&&27!==m||null===p||null===f||null!=(m=Jn(h,f))&&u.push(df(h,m,p)),d)break;h=h.return}0<u.length&&(s=new l(s,c,null,n,i),a.push({event:s,listeners:u}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===qn||!(c=n.relatedTarget||n.fromElement)||!on(c)&&!c[Gt])&&(l||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,l?(l=r,null!==(c=(c=n.relatedTarget||n.toElement)?on(c):null)&&(d=ve(c),u=c.tag,c!==d||5!==u&&27!==u&&6!==u)&&(c=null)):(l=null,c=r),l!==c)){if(u=mr,m="onMouseLeave",f="onMouseEnter",h="mouse","pointerout"!==e&&"pointerover"!==e||(u=Nr,m="onPointerLeave",f="onPointerEnter",h="pointer"),d=null==l?s:sn(l),p=null==c?s:sn(c),(s=new u(m,h+"leave",l,n,i)).target=d,s.relatedTarget=p,m=null,on(i)===r&&((u=new u(f,h+"enter",c,n,i)).target=p,u.relatedTarget=d,m=u),d=m,l&&c)e:{for(u=pf,h=c,p=0,m=f=l;m;m=u(m))p++;m=0;for(var v=h;v;v=u(v))m++;for(;0<p-m;)f=u(f),p--;for(;0<m-p;)h=u(h),m--;for(;p--;){if(f===h||null!==h&&f===h.alternate){u=f;break e}f=u(f),h=u(h)}u=null}else u=null;null!==l&&hf(a,s,l,u,!1),null!==c&&null!==d&&hf(a,d,c,u,!0)}if("select"===(l=(s=r?sn(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===l&&"file"===s.type)var g=Jr;else if(Hr(s))if(Yr)g=oi;else{g=ri;var y=ni}else!(l=s.nodeName)||"input"!==l.toLowerCase()||"checkbox"!==s.type&&"radio"!==s.type?r&&Dn(r.elementType)&&(g=Jr):g=ii;switch(g&&(g=g(e,r))?Wr(a,g,n,i):(y&&y(e,s,r),"focusout"===e&&r&&"number"===s.type&&null!=r.memoizedProps.value&&Tn(s,"number",s.value)),y=r?sn(r):window,e){case"focusin":(Hr(y)||"true"===y.contentEditable)&&(hi=y,mi=r,vi=null);break;case"focusout":vi=mi=hi=null;break;case"mousedown":gi=!0;break;case"contextmenu":case"mouseup":case"dragend":gi=!1,yi(a,n,i);break;case"selectionchange":if(pi)break;case"keydown":case"keyup":yi(a,n,i)}var b;if(Ar)e:{switch(e){case"compositionstart":var w="onCompositionStart";break e;case"compositionend":w="onCompositionEnd";break e;case"compositionupdate":w="onCompositionUpdate";break e}w=void 0}else Fr?zr(e,n)&&(w="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(w="onCompositionStart");w&&(Lr&&"ko"!==n.locale&&(Fr||"onCompositionStart"!==w?"onCompositionEnd"===w&&Fr&&(b=nr()):(er="value"in(Zn=i)?Zn.value:Zn.textContent,Fr=!0)),0<(y=ff(r,w)).length&&(w=new wr(w,e,null,n,i),a.push({event:w,listeners:y}),b?w.data=b:null!==(b=Ur(n))&&(w.data=b))),(b=Mr?function(e,t){switch(e){case"compositionend":return Ur(t);case"keypress":return 32!==t.which?null:(Br=!0,Dr);case"textInput":return(e=t.data)===Dr&&Br?null:e;default:return null}}(e,n):function(e,t){if(Fr)return"compositionend"===e||!Ar&&zr(e,t)?(e=nr(),tr=er=Zn=null,Fr=!1,e):null;switch(e){case"paste":default: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 Lr&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(w=ff(r,"onBeforeInput")).length&&(y=new wr("onBeforeInput","beforeinput",null,n,i),a.push({event:y,listeners:w}),y.data=b)),function(e,t,n,r,i){if("submit"===t&&n&&n.stateNode===i){var o=Gd((i[Yt]||null).action),a=r.submitter;a&&null!==(t=(t=a[Yt]||null)?Gd(t.formAction):a.getAttribute("formAction"))&&(o=t,a=null);var s=new dr("action","action",null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(0!==qd){var e=a?Xd(i,a):new FormData(i);cl(n,{pending:!0,data:e,method:i.method,action:o},null,e)}}else"function"==typeof o&&(s.preventDefault(),e=a?Xd(i,a):new FormData(i),cl(n,{pending:!0,data:e,method:i.method,action:o},o,e))},currentTarget:i}]})}}(a,e,r,n,i)}rf(a,t)})}function df(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ff(e,t){for(var n=t+"Capture",r=[];null!==e;){var i=e,o=i.stateNode;if(5!==(i=i.tag)&&26!==i&&27!==i||null===o||(null!=(i=Jn(e,n))&&r.unshift(df(e,i,o)),null!=(i=Jn(e,t))&&r.push(df(e,i,o))),3===e.tag)return r;e=e.return}return[]}function pf(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function hf(e,t,n,r,i){for(var o=t._reactName,a=[];null!==n&&n!==r;){var s=n,l=s.alternate,c=s.stateNode;if(s=s.tag,null!==l&&l===r)break;5!==s&&26!==s&&27!==s||null===c||(l=c,i?null!=(c=Jn(n,o))&&a.unshift(df(n,c,l)):i||null!=(c=Jn(n,o))&&a.push(df(n,c,l))),n=n.return}0!==a.length&&e.push({event:t,listeners:a})}var mf=/\r\n?/g,vf=/\u0000|\uFFFD/g;function gf(e){return("string"==typeof e?e:""+e).replace(mf,"\n").replace(vf,"")}function yf(e,t){return t=gf(t),gf(e)===t}function bf(e,t,n,r,i,o){switch(n){case"children":"string"==typeof r?"body"===t||"textarea"===t&&""===r||An(e,r):("number"==typeof r||"bigint"==typeof r)&&"body"!==t&&An(e,""+r);break;case"className":yn(e,"class",r);break;case"tabIndex":yn(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":yn(e,n,r);break;case"style":Ln(e,r,o);break;case"data":if("object"!==t){yn(e,"data",r);break}case"src":case"href":if(""===r&&("a"!==t||"href"!==n)){e.removeAttribute(n);break}if(null==r||"function"==typeof r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Un(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if("function"==typeof r){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}if("function"==typeof o&&("formAction"===n?("input"!==t&&bf(e,t,"name",i.name,i,null),bf(e,t,"formEncType",i.formEncType,i,null),bf(e,t,"formMethod",i.formMethod,i,null),bf(e,t,"formTarget",i.formTarget,i,null)):(bf(e,t,"encType",i.encType,i,null),bf(e,t,"method",i.method,i,null),bf(e,t,"target",i.target,i,null))),null==r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Un(""+r),e.setAttribute(n,r);break;case"onClick":null!=r&&(e.onclick=Fn);break;case"onScroll":null!=r&&of("scroll",e);break;case"onScrollEnd":null!=r&&of("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(he(61));if(null!=(n=r.__html)){if(null!=i.children)throw Error(he(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"muted":e.muted=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==r||"function"==typeof r||"boolean"==typeof r||"symbol"==typeof r){e.removeAttribute("xlink:href");break}n=Un(""+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":null!=r&&"function"!=typeof r&&"symbol"!=typeof r?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&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":!0===r?e.setAttribute(n,""):!1!==r&&null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":null!=r&&"function"!=typeof r&&"symbol"!=typeof r&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":null==r||"function"==typeof r||"symbol"==typeof r||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":of("beforetoggle",e),of("toggle",e),gn(e,"popover",r);break;case"xlinkActuate":bn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":bn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":bn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":bn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":bn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":bn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":bn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":bn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":bn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":gn(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])&&gn(e,n=Bn.get(n)||n,r)}}function wf(e,t,n,r,i,o){switch(n){case"style":Ln(e,r,o);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(he(61));if(null!=(n=r.__html)){if(null!=i.children)throw Error(he(60));e.innerHTML=n}}break;case"children":"string"==typeof r?An(e,r):("number"==typeof r||"bigint"==typeof r)&&An(e,""+r);break;case"onScroll":null!=r&&of("scroll",e);break;case"onScrollEnd":null!=r&&of("scrollend",e);break;case"onClick":null!=r&&(e.onclick=Fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:dn.hasOwnProperty(n)||("o"!==n[0]||"n"!==n[1]||(i=n.endsWith("Capture"),t=n.slice(2,i?n.length-7:void 0),"function"==typeof(o=null!=(o=e[Yt]||null)?o[n]:null)&&e.removeEventListener(t,o,i),"function"!=typeof r)?n in e?e[n]=r:!0===r?e.setAttribute(n,""):gn(e,n,r):("function"!=typeof o&&null!==o&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i)))}}function xf(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":of("error",e),of("load",e);var r,i=!1,o=!1;for(r in n)if(n.hasOwnProperty(r)){var a=n[r];if(null!=a)switch(r){case"src":i=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(he(137,t));default:bf(e,t,r,a,n,null)}}return o&&bf(e,t,"srcSet",n.srcSet,n,null),void(i&&bf(e,t,"src",n.src,n,null));case"input":of("invalid",e);var s=r=a=o=null,l=null,c=null;for(i in n)if(n.hasOwnProperty(i)){var u=n[i];if(null!=u)switch(i){case"name":o=u;break;case"type":a=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":r=u;break;case"defaultValue":s=u;break;case"children":case"dangerouslySetInnerHTML":if(null!=u)throw Error(he(137,t));break;default:bf(e,t,i,u,n,null)}}return void In(e,r,s,l,c,a,o,!1);case"select":for(o in of("invalid",e),i=a=r=null,n)if(n.hasOwnProperty(o)&&null!=(s=n[o]))switch(o){case"value":r=s;break;case"defaultValue":a=s;break;case"multiple":i=s;default:bf(e,t,o,s,n,null)}return t=r,n=a,e.multiple=!!i,void(null!=t?jn(e,!!i,t,!1):null!=n&&jn(e,!!i,n,!0));case"textarea":for(a in of("invalid",e),r=o=i=null,n)if(n.hasOwnProperty(a)&&null!=(s=n[a]))switch(a){case"value":i=s;break;case"defaultValue":o=s;break;case"children":r=s;break;case"dangerouslySetInnerHTML":if(null!=s)throw Error(he(91));break;default:bf(e,t,a,s,n,null)}return void Pn(e,i,o,r);case"option":for(l in n)if(n.hasOwnProperty(l)&&null!=(i=n[l]))if("selected"===l)e.selected=i&&"function"!=typeof i&&"symbol"!=typeof i;else bf(e,t,l,i,n,null);return;case"dialog":of("beforetoggle",e),of("toggle",e),of("cancel",e),of("close",e);break;case"iframe":case"object":of("load",e);break;case"video":case"audio":for(i=0;i<tf.length;i++)of(tf[i],e);break;case"image":of("error",e),of("load",e);break;case"details":of("toggle",e);break;case"embed":case"source":case"link":of("error",e),of("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(c in n)if(n.hasOwnProperty(c)&&null!=(i=n[c]))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(he(137,t));default:bf(e,t,c,i,n,null)}return;default:if(Dn(t)){for(u in n)n.hasOwnProperty(u)&&(void 0!==(i=n[u])&&wf(e,t,u,i,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(null!=(i=n[s])&&bf(e,t,s,i,n,null))}function kf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}var Sf=null,Cf=null;function _f(e){return 9===e.nodeType?e:e.ownerDocument}function Ef(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 Nf(e,t){if(0===e)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return 1===e&&"foreignObject"===t?0:e}function If(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"bigint"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Tf=null;var jf="function"==typeof setTimeout?setTimeout:void 0,Of="function"==typeof clearTimeout?clearTimeout:void 0,Pf="function"==typeof Promise?Promise:void 0,Af="function"==typeof queueMicrotask?queueMicrotask:void 0!==Pf?function(e){return Pf.resolve(null).then(e).catch(Rf)}:jf;function Rf(e){setTimeout(function(){throw e})}function Mf(e){return"head"===e}function Lf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&8===i.nodeType)if("/$"===(n=i.data)||"/&"===n){if(0===r)return e.removeChild(i),void Zp(t);r--}else if("$"===n||"$?"===n||"$~"===n||"$!"===n||"&"===n)r++;else if("html"===n)Kf(e.ownerDocument.documentElement);else if("head"===n){Kf(n=e.ownerDocument.head);for(var o=n.firstChild;o;){var a=o.nextSibling,s=o.nodeName;o[nn]||"SCRIPT"===s||"STYLE"===s||"LINK"===s&&"stylesheet"===o.rel.toLowerCase()||n.removeChild(o),o=a}}else"body"===n&&Kf(e.ownerDocument.body);n=i}while(n);Zp(t)}function Df(e,t){var n=e;e=0;do{var r=n.nextSibling;if(1===n.nodeType?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",""===n.getAttribute("style")&&n.removeAttribute("style")):3===n.nodeType&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&8===r.nodeType)if("/$"===(n=r.data)){if(0===e)break;e--}else"$"!==n&&"$?"!==n&&"$~"!==n&&"$!"!==n||e++;n=r}while(n)}function Bf(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Bf(n),rn(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===n.rel.toLowerCase())continue}e.removeChild(n)}}function zf(e,t){for(;8!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!t)return null;if(null===(e=qf(e.nextSibling)))return null}return e}function Uf(e){return"$?"===e.data||"$~"===e.data}function Ff(e){return"$!"===e.data||"$?"===e.data&&"loading"!==e.ownerDocument.readyState}function qf(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"$~"===t||"&"===t||"F!"===t||"F"===t)break;if("/$"===t||"/&"===t)return null}}return e}var Hf=null;function Wf(e){e=e.nextSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n||"/&"===n){if(0===t)return qf(e.nextSibling);t--}else"$"!==n&&"$!"!==n&&"$?"!==n&&"$~"!==n&&"&"!==n||t++}e=e.nextSibling}return null}function Vf(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n||"$~"===n||"&"===n){if(0===t)return e;t--}else"/$"!==n&&"/&"!==n||t++}e=e.previousSibling}return null}function $f(e,t,n){switch(t=_f(n),e){case"html":if(!(e=t.documentElement))throw Error(he(452));return e;case"head":if(!(e=t.head))throw Error(he(453));return e;case"body":if(!(e=t.body))throw Error(he(454));return e;default:throw Error(he(451))}}function Kf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);rn(e)}var Qf=new Map,Jf=new Set;function Yf(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Gf=He.d;He.d={f:function(){var e=Gf.f(),t=sd();return e||t},r:function(e){var t=an(e);null!==t&&5===t.tag&&"form"===t.type?dl(t):Gf.r(e)},D:function(e){Gf.D(e),Zf("dns-prefetch",e,null)},C:function(e,t){Gf.C(e,t),Zf("preconnect",e,t)},L:function(e,t,n){Gf.L(e,t,n);var r=Xf;if(r&&e&&t){var i='link[rel="preload"][as="'+En(t)+'"]';"image"===t&&n&&n.imageSrcSet?(i+='[imagesrcset="'+En(n.imageSrcSet)+'"]',"string"==typeof n.imageSizes&&(i+='[imagesizes="'+En(n.imageSizes)+'"]')):i+='[href="'+En(e)+'"]';var o=i;switch(t){case"style":o=tp(e);break;case"script":o=ip(e)}Qf.has(o)||(e=xe({rel:"preload",href:"image"===t&&n&&n.imageSrcSet?void 0:e,as:t},n),Qf.set(o,e),null!==r.querySelector(i)||"style"===t&&r.querySelector(np(o))||"script"===t&&r.querySelector(op(o))||(xf(t=r.createElement("link"),"link",e),cn(t),r.head.appendChild(t)))}},m:function(e,t){Gf.m(e,t);var n=Xf;if(n&&e){var r=t&&"string"==typeof t.as?t.as:"script",i='link[rel="modulepreload"][as="'+En(r)+'"][href="'+En(e)+'"]',o=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=ip(e)}if(!Qf.has(o)&&(e=xe({rel:"modulepreload",href:e},t),Qf.set(o,e),null===n.querySelector(i))){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(op(o)))return}xf(r=n.createElement("link"),"link",e),cn(r),n.head.appendChild(r)}}},X:function(e,t){Gf.X(e,t);var n=Xf;if(n&&e){var r=ln(n).hoistableScripts,i=ip(e),o=r.get(i);o||((o=n.querySelector(op(i)))||(e=xe({src:e,async:!0},t),(t=Qf.get(i))&&cp(e,t),cn(o=n.createElement("script")),xf(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(i,o))}},S:function(e,t,n){Gf.S(e,t,n);var r=Xf;if(r&&e){var i=ln(r).hoistableStyles,o=tp(e);t=t||"default";var a=i.get(o);if(!a){var s={loading:0,preload:null};if(a=r.querySelector(np(o)))s.loading=5;else{e=xe({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Qf.get(o))&&lp(e,n);var l=a=r.createElement("link");cn(l),xf(l,"link",e),l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),l.addEventListener("load",function(){s.loading|=1}),l.addEventListener("error",function(){s.loading|=2}),s.loading|=4,sp(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:s},i.set(o,a)}}},M:function(e,t){Gf.M(e,t);var n=Xf;if(n&&e){var r=ln(n).hoistableScripts,i=ip(e),o=r.get(i);o||((o=n.querySelector(op(i)))||(e=xe({src:e,async:!0,type:"module"},t),(t=Qf.get(i))&&cp(e,t),cn(o=n.createElement("script")),xf(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},r.set(i,o))}}};var Xf="undefined"==typeof document?null:document;function Zf(e,t,n){var r=Xf;if(r&&"string"==typeof t&&t){var i=En(t);i='link[rel="'+e+'"][href="'+i+'"]',"string"==typeof n&&(i+='[crossorigin="'+n+'"]'),Jf.has(i)||(Jf.add(i),e={rel:e,crossOrigin:n,href:t},null===r.querySelector(i)&&(xf(t=r.createElement("link"),"link",e),cn(t),r.head.appendChild(t)))}}function ep(e,t,n,r){var i,o,a,s,l=(l=et.current)?Yf(l):null;if(!l)throw Error(he(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof n.precedence&&"string"==typeof n.href?(t=tp(n.href),(r=(n=ln(l).hoistableStyles).get(t))||(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("stylesheet"===n.rel&&"string"==typeof n.href&&"string"==typeof n.precedence){e=tp(n.href);var c=ln(l).hoistableStyles,u=c.get(e);if(u||(l=l.ownerDocument||l,u={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,u),(c=l.querySelector(np(e)))&&!c._p&&(u.instance=c,u.state.loading=5),Qf.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},Qf.set(e,n),c||(i=l,o=e,a=n,s=u.state,i.querySelector('link[rel="preload"][as="style"]['+o+"]")?s.loading=1:(o=i.createElement("link"),s.preload=o,o.addEventListener("load",function(){return s.loading|=1}),o.addEventListener("error",function(){return s.loading|=2}),xf(o,"link",a),cn(o),i.head.appendChild(o))))),t&&null===r)throw Error(he(528,""));return u}if(t&&null!==r)throw Error(he(529,""));return null;case"script":return t=n.async,"string"==typeof(n=n.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=ip(n),(r=(n=ln(l).hoistableScripts).get(t))||(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(he(444,e))}}function tp(e){return'href="'+En(e)+'"'}function np(e){return'link[rel="stylesheet"]['+e+"]"}function rp(e){return xe({},e,{"data-precedence":e.precedence,precedence:null})}function ip(e){return'[src="'+En(e)+'"]'}function op(e){return"script[async]"+e}function ap(e,t,n){if(t.count++,null===t.instance)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+En(n.href)+'"]');if(r)return t.instance=r,cn(r),r;var i=xe({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return cn(r=(e.ownerDocument||e).createElement("style")),xf(r,"style",i),sp(r,n.precedence,e),t.instance=r;case"stylesheet":i=tp(n.href);var o=e.querySelector(np(i));if(o)return t.state.loading|=4,t.instance=o,cn(o),o;r=rp(n),(i=Qf.get(i))&&lp(r,i),cn(o=(e.ownerDocument||e).createElement("link"));var a=o;return a._p=new Promise(function(e,t){a.onload=e,a.onerror=t}),xf(o,"link",r),t.state.loading|=4,sp(o,n.precedence,e),t.instance=o;case"script":return o=ip(n.src),(i=e.querySelector(op(o)))?(t.instance=i,cn(i),i):(r=n,(i=Qf.get(o))&&cp(r=xe({},n),i),cn(i=(e=e.ownerDocument||e).createElement("script")),xf(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(he(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(r=t.instance,t.state.loading|=4,sp(r,n.precedence,e));return t.instance}function sp(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,o=i,a=0;a<r.length;a++){var s=r[a];if(s.dataset.precedence===t)o=s;else if(o!==i)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=9===n.nodeType?n.head:n).insertBefore(e,t.firstChild)}function lp(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function cp(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var up=null;function dp(e,t,n){if(null===up){var r=new Map,i=up=new Map;i.set(n,r)}else(r=(i=up).get(n))||(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 o=n[i];if(!(o[nn]||o[Jt]||"link"===e&&"stylesheet"===o.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==o.namespaceURI){var a=o.getAttribute(t)||"";a=e+a;var s=r.get(a);s?s.push(o):r.set(a,[o])}}return r}function fp(e,t,n){(e=e.ownerDocument||e).head.insertBefore(n,"title"===t?e.querySelector("head > title"):null)}function pp(e){return!!("stylesheet"!==e.type||3&e.state.loading)}var hp=0;function mp(){if(this.count--,0===this.count&&(0===this.imgCount||!this.waitingForImages))if(this.stylesheets)gp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var vp=null;function gp(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,vp=new Map,t.forEach(yp,e),vp=null,mp.call(e))}function yp(e,t){if(!(4&t.state.loading)){var n=vp.get(e);if(n)var r=n.get(null);else{n=new Map,vp.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<i.length;o++){var a=i[o];"LINK"!==a.nodeName&&"not all"===a.getAttribute("media")||(n.set(a.dataset.precedence,a),r=a)}r&&n.set(null,r)}a=(i=t.instance).getAttribute("data-precedence"),(o=n.get(a)||r)===r&&n.set(null,i),n.set(a,i),this.count++,r=mp.bind(this),i.addEventListener("load",r),i.addEventListener("error",r),o?o.parentNode.insertBefore(i,o.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(i,e.firstChild),t.state.loading|=4}}var bp={$$typeof:Te,Provider:null,Consumer:null,_currentValue:We,_currentValue2:We,_threadCount:0};function wp(e,t,n,r,i,o,a,s,l){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=zt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zt(0),this.hiddenUpdates=zt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=o,this.onRecoverableError=a,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function xp(e,t,n,r,i,o,a,s,l,c,u,d){return e=new wp(e,t,n,a,l,c,u,d,s),t=1,!0===o&&(t|=24),o=$i(3,null,null,t),e.current=o,o.stateNode=e,(t=Qo()).refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:r,isDehydrated:n,cache:t},_a(o),e}function kp(e){return e?e=Wi:Wi}function Sp(e,t,n,r,i,o){i=kp(i),null===r.context?r.context=i:r.pendingContext=i,(r=Na(t)).payload={element:n},null!==(o=void 0===o?null:o)&&(r.callback=o),null!==(n=Ia(e,r,t))&&(nd(n,0,t),Ta(n,e,t))}function Cp(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function _p(e,t){Cp(e,t),(e=e.alternate)&&Cp(e,t)}function Ep(e){if(13===e.tag||31===e.tag){var t=Fi(e,67108864);null!==t&&nd(t,0,67108864),_p(e,67108864)}}function Np(e){if(13===e.tag||31===e.tag){var t=ed(),n=Fi(e,t=Wt(t));null!==n&&nd(n,0,t),_p(e,t)}}var Ip=!0;function Tp(e,t,n,r){var i=qe.T;qe.T=null;var o=He.p;try{He.p=2,Op(e,t,n,r)}finally{He.p=o,qe.T=i}}function jp(e,t,n,r){var i=qe.T;qe.T=null;var o=He.p;try{He.p=8,Op(e,t,n,r)}finally{He.p=o,qe.T=i}}function Op(e,t,n,r){if(Ip){var i=Pp(r);if(null===i)uf(e,t,r,Ap,n),Wp(e,r);else if(function(e,t,n,r,i){switch(t){case"focusin":return Dp=Vp(Dp,e,t,n,r,i),!0;case"dragenter":return Bp=Vp(Bp,e,t,n,r,i),!0;case"mouseover":return zp=Vp(zp,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return Up.set(o,Vp(Up.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,Fp.set(o,Vp(Fp.get(o)||null,e,t,n,r,i)),!0}return!1}(i,e,t,n,r))r.stopPropagation();else if(Wp(e,r),4&t&&-1<Hp.indexOf(e)){for(;null!==i;){var o=an(i);if(null!==o)switch(o.tag){case 3:if((o=o.stateNode).current.memoizedState.isDehydrated){var a=Rt(o.pendingLanes);if(0!==a){var s=o;for(s.pendingLanes|=2,s.entangledLanes|=2;a;){var l=1<<31-It(a);s.entanglements[1]|=l,a&=~l}Hd(o),!(6&xu)&&(qu=vt()+500,Wd(0))}}break;case 31:case 13:null!==(s=Fi(o,2))&&nd(s,0,2),sd(),_p(o,2)}if(null===(o=Pp(r))&&uf(e,t,r,Ap,n),o===i)break;i=o}null!==i&&r.stopPropagation()}else uf(e,t,r,null,n)}}function Pp(e){return Rp(e=Hn(e))}var Ap=null;function Rp(e){if(Ap=null,null!==(e=on(e))){var t=ve(e);if(null===t)e=null;else{var n=t.tag;if(13===n){if(null!==(e=ge(t)))return e;e=null}else if(31===n){if(null!==(e=ye(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ap=e,null}function Mp(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(gt()){case yt:return 2;case bt:return 8;case wt:case xt:return 32;case kt:return 268435456;default:return 32}default:return 32}}var Lp=!1,Dp=null,Bp=null,zp=null,Up=new Map,Fp=new Map,qp=[],Hp="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 Wp(e,t){switch(e){case"focusin":case"focusout":Dp=null;break;case"dragenter":case"dragleave":Bp=null;break;case"mouseover":case"mouseout":zp=null;break;case"pointerover":case"pointerout":Up.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fp.delete(t.pointerId)}}function Vp(e,t,n,r,i,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},null!==t&&(null!==(t=an(t))&&Ep(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function $p(e){var t=on(e.target);if(null!==t){var n=ve(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=ge(n)))return e.blockedOn=t,void Kt(e.priority,function(){Np(n)})}else if(31===t){if(null!==(t=ye(n)))return e.blockedOn=t,void Kt(e.priority,function(){Np(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Kp(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Pp(e.nativeEvent);if(null!==n)return null!==(t=an(n))&&Ep(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);qn=r,n.target.dispatchEvent(r),qn=null,t.shift()}return!0}function Qp(e,t,n){Kp(e)&&n.delete(t)}function Jp(){Lp=!1,null!==Dp&&Kp(Dp)&&(Dp=null),null!==Bp&&Kp(Bp)&&(Bp=null),null!==zp&&Kp(zp)&&(zp=null),Up.forEach(Qp),Fp.forEach(Qp)}function Yp(e,t){e.blockedOn===t&&(e.blockedOn=null,Lp||(Lp=!0,de.unstable_scheduleCallback(de.unstable_NormalPriority,Jp)))}var Gp=null;function Xp(e){Gp!==e&&(Gp=e,de.unstable_scheduleCallback(de.unstable_NormalPriority,function(){Gp===e&&(Gp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if("function"!=typeof r){if(null===Rp(r||n))continue;break}var o=an(n);null!==o&&(e.splice(t,3),t-=3,cl(o,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Zp(e){function t(t){return Yp(t,e)}null!==Dp&&Yp(Dp,e),null!==Bp&&Yp(Bp,e),null!==zp&&Yp(zp,e),Up.forEach(t),Fp.forEach(t);for(var n=0;n<qp.length;n++){var r=qp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<qp.length&&null===(n=qp[0]).blockedOn;)$p(n),null===n.blockedOn&&qp.shift();if(null!=(n=(e.ownerDocument||e).$$reactFormReplay))for(r=0;r<n.length;r+=3){var i=n[r],o=n[r+1],a=i[Yt]||null;if("function"==typeof o)a||Xp(n);else if(a){var s=null;if(o&&o.hasAttribute("formAction")){if(i=o,a=o[Yt]||null)s=a.formAction;else if(null!==Rp(i))continue}else s=a.action;"function"==typeof s?n[r+1]=s:(n.splice(r,3),r-=3),Xp(n)}}}function eh(){function e(e){e.canIntercept&&"react-transition"===e.info&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:"manual",scroll:"manual"})}function t(){null!==i&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&null!=e.url&&navigation.navigate(e.url,{state:e.getState(),info:"react-transition",history:"replace"})}}if("object"==typeof navigation){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),null!==i&&(i(),i=null)}}}function th(e){this._internalRoot=e}function nh(e){this._internalRoot=e}nh.prototype.render=th.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(he(409));Sp(t.current,ed(),e,t,null,null)},nh.prototype.unmount=th.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Sp(e.current,2,null,e,null,null),sd(),t[Gt]=null}},nh.prototype.unstable_scheduleHydration=function(e){if(e){var t=$t();e={blockedOn:null,target:e,priority:t};for(var n=0;n<qp.length&&0!==t&&t<qp[n].priority;n++);qp.splice(n,0,e),0===n&&$p(e)}};var rh=fe.version;if("19.2.5"!==rh)throw Error(he(527,rh,"19.2.5"));He.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(he(188));throw e=Object.keys(e).join(","),Error(he(268,e))}return e=function(e){var t=e.alternate;if(!t){if(null===(t=ve(e)))throw Error(he(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return be(i),e;if(o===r)return be(i),t;o=o.sibling}throw Error(he(188))}if(n.return!==r.return)n=i,r=o;else{for(var a=!1,s=i.child;s;){if(s===n){a=!0,n=i,r=o;break}if(s===r){a=!0,r=i,n=o;break}s=s.sibling}if(!a){for(s=o.child;s;){if(s===n){a=!0,n=o,r=i;break}if(s===r){a=!0,r=o,n=i;break}s=s.sibling}if(!a)throw Error(he(189))}}if(n.alternate!==r)throw Error(he(190))}if(3!==n.tag)throw Error(he(188));return n.stateNode.current===n?e:t}(t),e=null===(e=null!==e?we(e):null)?null:e.stateNode};var ih={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:qe,reconcilerVersion:"19.2.5"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var oh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oh.isDisabled&&oh.supportsFiber)try{_t=oh.inject(ih),Et=oh}catch(Gh){}}h.createRoot=function(e,t){if(!me(e))throw Error(he(299));var n=!1,r="",i=Pl,o=Al,a=Rl;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onUncaughtError&&(i=t.onUncaughtError),void 0!==t.onCaughtError&&(o=t.onCaughtError),void 0!==t.onRecoverableError&&(a=t.onRecoverableError)),t=xp(e,1,!1,null,0,n,r,null,i,o,a,eh),e[Gt]=t.current,lf(e),new th(t)},h.hydrateRoot=function(e,t,n){if(!me(e))throw Error(he(299));var r=!1,i="",o=Pl,a=Al,s=Rl,l=null;return null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(i=n.identifierPrefix),void 0!==n.onUncaughtError&&(o=n.onUncaughtError),void 0!==n.onCaughtError&&(a=n.onCaughtError),void 0!==n.onRecoverableError&&(s=n.onRecoverableError),void 0!==n.formState&&(l=n.formState)),(t=xp(e,1,!0,t,0,r,i,l,o,a,s,eh)).context=kp(null),n=t.current,(i=Na(r=Wt(r=ed()))).callback=null,Ia(n,i,r),n=r,t.current.lanes=n,Ut(t,n),Hd(t),e[Gt]=t.current,lf(e),new nh(t)},h.version="19.2.5",function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),p.exports=h;var ah=p.exports,sh={exports:{}},lh={},ch=Z;var uh="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},dh=ch.useSyncExternalStore,fh=ch.useRef,ph=ch.useEffect,hh=ch.useMemo,mh=ch.useDebugValue;lh.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=fh(null);if(null===o.current){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=hh(function(){function e(e){if(!l){if(l=!0,o=e,e=r(e),void 0!==i&&a.hasValue){var t=a.value;if(i(t,e))return s=t}return s=e}if(t=s,uh(o,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(o=e,t):(o=e,s=n)}var o,s,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]);var s=dh(e,o[0],o[1]);return ph(function(){a.hasValue=!0,a.value=s},[s]),mh(s),s},sh.exports=lh;var vh=sh.exports;var gh={notify(){},get:()=>[]};var yh=(()=>!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement))(),bh=(()=>"undefined"!=typeof navigator&&"ReactNative"===navigator.product)(),wh=(()=>yh||bh?Z.useLayoutEffect:Z.useEffect)(),xh=Symbol.for("react-redux-context"),kh="undefined"!=typeof globalThis?globalThis:{};function Sh(){if(!Z.createContext)return{};const e=kh[xh]??=new Map;let t=e.get(Z.createContext);return t||(t=Z.createContext(null),e.set(Z.createContext,t)),t}var Ch=Sh();var _h=function(e){const{children:t,context:n,serverState:r,store:i}=e,o=Z.useMemo(()=>{const e=function(e){let t,n=gh,r=0,i=!1;function o(){l.onStateChange&&l.onStateChange()}function a(){r++,t||(t=e.subscribe(o),n=function(){let e=null,t=null;return{clear(){e=null,t=null},notify(){(()=>{let t=e;for(;t;)t.callback(),t=t.next})()},get(){const t=[];let n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){r&&null!==e&&(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}())}function s(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=gh)}const l={addNestedSub:function(e){a();const t=n.subscribe(e);let r=!1;return()=>{r||(r=!0,t(),s())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:o,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,a())},tryUnsubscribe:function(){i&&(i=!1,s())},getListeners:()=>n};return l}(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),a=Z.useMemo(()=>i.getState(),[i]);wh(()=>{const{subscription:e}=o;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),a!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[o,a]);const s=n||Ch;return Z.createElement(s.Provider,{value:o},t)};function Eh(e=Ch){return function(){return Z.useContext(e)}}var Nh=Eh();function Ih(e=Ch){const t=e===Ch?Nh:Eh(e),n=()=>{const{store:e}=t();return e};return Object.assign(n,{withTypes:()=>n}),n}var Th=Ih();function jh(e=Ch){const t=e===Ch?Th:Ih(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var Oh=jh(),Ph=(e,t)=>e===t;function Ah(e=Ch){const t=e===Ch?Nh:Eh(e),n=(e,n={})=>{const{equalityFn:r=Ph}="function"==typeof n?{equalityFn:n}:n,i=t(),{store:o,subscription:a,getServerState:s}=i;Z.useRef(!0);const l=Z.useCallback({[e.name]:t=>e(t)}[e.name],[e]),c=vh.useSyncExternalStoreWithSelector(a.addNestedSub,o.getState,s||o.getState,l,r);return Z.useDebugValue(c),c};return Object.assign(n,{withTypes:()=>n}),n}var Rh=Ah();
|
|
2
|
+
/*! Copyright (c) 2021, XAPPmedia */function Mh(e){return!!e&&e.startsWith("agent:")}var Lh=function(){this.retries=5,this.timeout=1e3,this.log=!1},Dh=function(){function e(e){e&&(this.options=Object.assign(new Lh,e))}return e.prototype.fetch=function(e,t){return n(this,void 0,void 0,function(){var n,i,o,a;return r(this,function(r){switch(r.label){case 0:t||(t=this.options),r.label=1;case 1:return r.trys.push([1,3,,5]),n=new AbortController,i=setTimeout(function(){n.abort()},t.timeout),[4,e(n.signal)];case 2:return o=r.sent(),clearTimeout(i),[2,o];case 3:if(a=r.sent(),1===t.retries||t.retries<1)throw a;return[4,this.fetch(e,{timeout:t.timeout,retries:t.retries-1})];case 4:return[2,r.sent()];case 5:return[2]}})})},e}();var Bh="xapp-form-js",zh="https://form.xapp.ai/xapp-form-widget.js";function Uh(e){return"".concat(zh,"?key=").concat(encodeURIComponent(e))}function Fh(e){if(document.getElementById(Bh))return!0;if(e)for(var t=Uh(e),n=document.querySelectorAll("script[src]"),r=0;r<n.length;r++){var i=n[r].getAttribute("src");if(i&&(i===t||i.startsWith(zh)))return!0}return!1}function qh(e){return new Promise(function(t,n){var r=document.createElement("script");r.id=Bh,r.src=Uh(e),r.async=!0,r.onload=function(){t()},r.onerror=function(){n(new Error("Failed to load form-widget script: ".concat(r.src)))},document.head.appendChild(r)})}function Hh(e){return n(this,arguments,void 0,function(e,t,n){var i,o,a;return void 0===t&&(t=3),void 0===n&&(n=1e3),r(this,function(r){switch(r.label){case 0:if(Fh(e))return[2];o=0,r.label=1;case 1:if(!(o<=t))return[3,8];r.label=2;case 2:return r.trys.push([2,6,,7]),o>0?((l=document.getElementById(Bh))&&l.remove(),console.log("[chat-widget] Retrying form-widget script load (attempt ".concat(o+1,"/").concat(t+1,")")),[4,(s=n,new Promise(function(e){return setTimeout(e,s)}))]):[3,4];case 3:r.sent(),r.label=4;case 4:return[4,qh(e)];case 5:return r.sent(),[2];case 6:return a=r.sent(),i=a,o===t&&console.error("[chat-widget] Failed to load form-widget script after all retries:",a),[3,7];case 7:return o++,[3,1];case 8:throw i||new Error("Failed to load form-widget script")}var s,l})})}function Wh(){var e;return"function"==typeof(null===(e=window.xafwControl)||void 0===e?void 0:e.openForm)}function Vh(e){return!!Wh()&&(window.xafwControl.openForm(e),!0)}function $h(e,t,n){return void 0===t&&(t=20),void 0===n&&(n=100),new Promise(function(r){if(Vh(e))r(!0);else var i=0,o=setInterval(function(){if(i++,Vh(e))return clearInterval(o),void r(!0);i>=t&&(clearInterval(o),console.warn("[chat-widget] Form widget not ready after waiting"),r(!1))},n)})}var Kh="xaLogLevel",Qh=localStorage.getItem(Kh);function Jh(){return(new Date).toISOString()+" ::"}function Yh(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];"debug"===window.xaLogLevel&&console.log.apply(console,i([Jh()],e,!1))}function Gh(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,i([Jh()],e,!1))}Object.getOwnPropertyDescriptor(window,"xaLogLevel")||Object.defineProperty(window,"xaLogLevel",{get:function(){return this._xaLogLevel},set:function(e){this._xaLogLevel=e,e?localStorage.setItem(Kh,e):localStorage.removeItem(Kh)},configurable:!0,enumerable:!0}),Qh&&(window.xaLogLevel=Qh),"undefined"!=typeof window&&(window.xapp=window.xapp||{},window.xapp.setLogLevel=function(e){"off"===e?(window.xaLogLevel=null,console.log("Log level set to: off (logs disabled)")):(window.xaLogLevel=e,console.log("Log level set to: ".concat(e)))},window.xapp.getLogLevel=function(){return window.xaLogLevel||"off"});function Xh(){var e=null===document||void 0===document?void 0:document.getElementById("xapp-js"),t=function(e){if(!e)return{path:e};var t=e.lastIndexOf("/"),n="";t>=0&&(n=e.substr(0,t));var r=new URL(e),i=r.hostname;i.endsWith("nitrocdn.com")&&(n="https://widget.xapp.ai");var o=new URLSearchParams(r.search),a=o.get("key");return{path:n,key:a}}(null==e?void 0:e.src);return t}var Zh=process.env.SERVER_URL;process.env.ACCOUNT_KEY;var em="48",tm="ScheduleButton";var nm=Z.createContext(null);function rm(){var e=Z.useContext(nm);return null==e?void 0:e.env}function im(e){return(null==e?void 0:e.connection)?e.connection:{serverUrl:null==e?void 0:e.serverUrl,accountKey:null==e?void 0:e.accountKey,type:(null==e?void 0:e.direct)?"direct":"websocket"}}function om(e,t){var n=im(e),r=n.accountKey,i=n.serverUrl,o=n.type,a=n.timeout,s=n.backgroundSleepDelay,l=n.mcp,c=null==e?void 0:e.channelId;return Z.useMemo(function(){return{accountKey:r,serverUrl:i,timeout:a,type:o,nonce:t,backgroundSleepDelay:s,mcp:am(l,c)}},[r,i,a,o,t,s,l,c])}function am(e,n){var r;return e?t(t({},e),{channelId:null!==(r=e.channelId)&&void 0!==r?r:n}):e}function sm(e){return e?im(e):{}}var lm=function(e){var t=e.label,n=e.disable,r=e.type,i=e.addClass,o=e.onClick;return f.jsx("button",{disabled:n,type:r,className:"action-button ".concat(i),onClick:function(e){e.stopPropagation(),o&&o(t)},children:t})},cm=Z.memo(function(e){var t=e.button,n=e.onClick,r=Z.useCallback(function(){n(t)},[t,n]);return f.jsx(lm,{onClick:r,addClass:"button-card",label:t.label})}),um=Z.memo(function(e){return f.jsx("div",{className:"buttons-container "+(e.className||""),children:e.buttons.map(function(t,n){return f.jsx(cm,{button:t,onClick:e.onClick},n)})})}),dm=function(e){var t=e.imageUrl.replace(/'/g,"%27"),n=f.jsx("div",{className:"chat-card-img__content",style:{backgroundImage:"url(".concat(t,")")}});return e.imageActionUrl?f.jsx("a",{href:e.imageActionUrl,"aria-label":"read more",target:"_blank",rel:"noopener noreferrer",className:"chat-card-img",children:n}):f.jsx("div",{className:"chat-card-img",children:n})},fm=function(e){var t,n,r,i,o=e.card;return o.imageUrl&&(r=f.jsx("div",{className:"chat-card-container__img",children:f.jsx(dm,{imageUrl:o.imageUrl,imageActionUrl:o.imageActionUrl})})),o.title&&(n=f.jsx("div",{className:"chat-card-title",children:f.jsx("span",{children:o.title})})),o.content&&(i=f.jsx("div",{className:"chat-card-sub-title",children:f.jsx("span",{children:o.content})})),f.jsxs("div",{className:"chat-card-container",children:[r,n,i,!!(null===(t=o.buttons)||void 0===t?void 0:t.length)&&f.jsx(um,{buttons:o.buttons,onClick:e.onButtonClick})]})},pm=function(e){var t,n,r,i,o,a,s={},l=e.entity,c=Z.useContext(nm),u=null==l?void 0:l.avatarPath;if(!u){var d=function(e){var t=(null==e?void 0:e.initials)||"?",n=(null==e?void 0:e.size)||40,r=(null==e?void 0:e.backgroundColor)||"#007bff",i=(null==e?void 0:e.textColor)||"#ffffff";return Z.useMemo(function(){return function(e,t,n,r){var i=document.createElement("canvas");i.width=t,i.height=t;var o=i.getContext("2d");o.fillStyle=n,o.fillRect(0,0,t,t),o.fillStyle=r,o.font="".concat(t/2,"px Arial"),o.textAlign="center",o.textBaseline="middle",o.fillText(e,t/2,t/2);var a=new Image;return a.src=i.toDataURL(),a}(t,n,r,i)},[t,n,r,i])}({initials:(null==l?void 0:l.displayName)?l.displayName.slice(0,2):"?",backgroundColor:null===(n=null===(t=null==c?void 0:c.env)||void 0===t?void 0:t.theme)||void 0===n?void 0:n.primaryColor,size:36});u=d.src}var p=l&&Mh(l.nick);p?(s.backgroundImage="url('".concat(u,"')"),s.backgroundColor="none"):a=f.jsx("svg",{width:"16",height:"19",viewBox:"0 0 16 19",style:{margin:"0 auto",display:"block"},children:f.jsx("path",{d:"M11.5 5c0-1.933-1.567-3.5-3.5-3.5S4.5 3.067 4.5 5 6.067 8.5 8 8.5s3.5-1.567 3.5-3.5zM3 5c0-2.76 2.24-5 5-5s5 2.24 5 5-2.24 5-5 5-5-2.24-5-5zM1.955 17.294c.21-.642.504-1.285.898-1.88C3.963 13.74 5.615 12.75 8 12.75c2.385 0 4.038.99 5.147 2.664.394.595.69 1.238.898 1.88.124.382.19.672.214.822.063.41.447.69.856.625.41-.063.69-.447.625-.856-.034-.225-.118-.59-.27-1.053-.247-.763-.598-1.527-1.073-2.244C13.024 12.51 10.917 11.25 8 11.25c-2.916 0-5.024 1.26-6.397 3.336-.475.717-.826 1.48-1.074 2.245-.152.463-.236.83-.27 1.054-.065.41.215.793.624.857.41.065.793-.215.857-.624.025-.15.09-.44.215-.822z",fill:"#FFF",fillRule:"evenodd"})});var h=!!s.backgroundImage||!!a,m=(null===(o=null===(i=null===(r=null==c?void 0:c.env)||void 0===r?void 0:r.connection)||void 0===i?void 0:i.mcp)||void 0===o?void 0:o.showAiBadge)&&(null==l?void 0:l.isAI);return f.jsxs("div",{className:"avatar ".concat(p?"avatar--agent":"avatar--visitor"," ").concat(h?"":"avatar--empty"),style:s,title:l?l.display_name:"Agent",children:[a,m&&f.jsx("span",{className:"avatar__ai-badge",children:"AI"})]})};function hm(e){return f.jsx("div",{className:"xappw-chat-msg-part__avatar",children:f.jsx(pm,{entity:e})})}var mm=function(e){var t,n=null!==(t=e.avatarPosition)&&void 0!==t?t:"left",r="xappw-chat-msg-part"+("below"===n?" xappw-chat-msg-part--avatar-below":"")+("bottom"===n?" xappw-chat-msg-part--avatar-bottom":"")+(e.fullWidth?" xappw-chat-msg-part--full-width":"")+(e.isStreaming?" xappw-chat-msg-part--streaming":""),i=e.user,o=e.hideUserInfo&&"bottom"===n;return f.jsx("div",{className:r,children:"left"===n?f.jsxs(f.Fragment,{children:[e.showAvatar&&hm(i),e.children]}):f.jsxs(f.Fragment,{children:[e.children,e.showAvatar&&!o&&f.jsxs("div",{className:"xappw-chat-msg-part__avatar-wrapper",children:[hm(i),(null==i?void 0:i.displayName)&&f.jsx("div",{className:"xappw-chat-msg-part__avatar-name",children:i.displayName})]})]})})};function vm(e,t,n){return{type:"synthetic",detail:{type:"write_msg",user:t,msg:e,timestamp:void 0!==n?n:+new Date}}}function gm(e,n){return function(r){return function(i,o){var a=o().attributes;a=t(t({},a),{currentUrl:window.location.href});var s=n||{},l=s.token,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(s,["token"]);a=t(t({},a),c);var u=o().visitor,d=+new Date;i(vm({text:l?"".concat(e," (from the list)"):e},u,d)),r.sendChatMsg({text:e,token:l,attributes:a},function(e){e&&Yh("Error sending message",e)})}}}function ym(e){return function(t){return function(){t.sendTyping(e)}}}function bm(e,t){return function(n){return function(){n.setVisitorInfo(e,t,function(e){e&&Yh(e)})}}}function wm(e){return{type:"account_status",detail:{status:e,timestamp:+new Date}}}function xm(e){return{type:"connection_update",detail:{status:e,timestamp:+new Date}}}function km(e){return{type:"ws_button_display",detail:{id:e.id,text:e.text,pressBehavior:e.pressBehavior,isPressed:e.isPressed,isDismissing:e.isDismissing,timestamp:+new Date}}}function Sm(e){throw new Error("Unknown kind "+e)}var Cm=function(){return Oh()},_m=function(){function e(e){this.inner=e}return e.prototype.bargeOut=function(e){Yh("CLIENT: bargeOut"),this.inner.bargeOut(e)},e.prototype.bargeIn=function(e,t){Yh("CLIENT: bargeIn: ".concat(e)),this.inner.bargeIn(e,t)},e.prototype.init=function(e){this.inner.init(e)},e.prototype.sendOfflineMsg=function(e,t){Yh("CLIENT: sendOfflineMsg: ".concat(JSON.stringify(e))),this.inner.sendOfflineMsg(e,t)},e.prototype.sendChatMsg=function(e,t){Yh("CLIENT: sendChatMsg: ".concat(JSON.stringify(e))),this.inner.sendChatMsg(e,t)},e.prototype.sendChatMsgRequest=function(e,t){Yh("CLIENT: sendChatMsgRequest: ".concat(JSON.stringify(e))),this.inner.sendChatMsgRequest(e,t)},e.prototype.sendTyping=function(e){Yh("CLIENT: sendTyping: ".concat(JSON.stringify(e))),this.inner.sendTyping(e)},e.prototype.setVisitorInfo=function(e,t,n){Yh("CLIENT: setVisitorInfo: ".concat(JSON.stringify(e)," session id: ").concat(t)),this.inner.setVisitorInfo(e,t,n)},e.prototype.sendChatRating=function(e){Yh("CLIENT: sendChatRating: ".concat(JSON.stringify(e))),this.inner.sendChatRating(e)},e.prototype.sendFile=function(e,t){Yh("CLIENT: sendFile: ".concat(JSON.stringify(e))),this.inner.sendFile(e,t)},e.prototype.markAsRead=function(){Yh("CLIENT: markAsRead:"),this.inner.markAsRead()},e.prototype.flush=function(){Yh("CLIENT: flush:"),this.inner.flush()},e.prototype.dispose=function(){Yh("CLIENT: dispose:"),this.inner.dispose()},e.prototype.sleep=function(){Yh("CLIENT: sleep:"),this.inner.sleep()},e.prototype.wakeup=function(){Yh("CLIENT: wakeup:"),this.inner.wakeup()},e.prototype.sendButtonPressed=function(e){return n(this,void 0,void 0,function(){return r(this,function(t){return Yh("CLIENT: sendButtonPressed: ".concat(e)),this.inner.sendButtonPressed?[2,this.inner.sendButtonPressed(e)]:[2]})})},e.prototype.notifyDisconnecting=function(){Yh("CLIENT: notifyDisconnecting:"),this.inner.notifyDisconnecting&&this.inner.notifyDisconnecting()},e}(),Em=f,Nm=Z;var Im=function(e){var t=e.format,n=e.text;return Em.jsx("span",{"data-rich-text-type":"bold",className:"xapp-search-rich-text-bold-span",children:n.substring(t.start,t.end)})},Tm=function(e){var t=e.format,n=e.text,r=e.readOnly,i=e.onClick,o=t.text||n.substring(t.start,t.end),a=Nm.useState(o),s=a[0],l=a[1],c=Nm.useCallback(function(e){l(e.target.value)},[]),u=Nm.useCallback(function(e){i&&(!1===i(t)&&(e.preventDefault(),e.stopPropagation()))},[i,t]);return r?Em.jsx("span",{className:"xapp-search-rich-text-input-span xapp-search-rich-text-input-span--readonly",onClick:u,children:o}):Em.jsx("input",{type:"text",value:s,className:"xapp-search-rich-text-input-span","data-rich-text-type":"inputText",onChange:c,onClick:u,readOnly:r})},jm=function(e){var t=e.format,n=e.text;return Em.jsx("span",{"data-rich-text-type":"normal",className:"xapp-search-rich-text-normal-span",children:n.substring(t.start,t.end)})},Om=function(e){var t=e.format,n=e.text,r=e.readOnly,i=e.onClick,o=t.type;switch(o){case"normal":return Em.jsx(jm,{text:n,format:t,readOnly:r});case"bold":return Em.jsx(Im,{text:n,format:t,readOnly:r});case"inputText":return Em.jsx(Tm,{text:n,format:t,readOnly:r,onClick:i});default:!function(e){throw new Error("Unknown kind "+e)}(o)}};function Pm(e){var t=e.childNodes,n=[],r="";return t.forEach(function(e){if(e.nodeType===Node.ELEMENT_NODE){var t=e,i="INPUT"===t.tagName?t.value:t.innerText,o=t.dataset.richTextType;n.push({type:o,start:r.length,end:r.length+i.length}),r+=i}e.nodeType===Node.TEXT_NODE&&((i=e.nodeValue)&&(n.push({type:"normal",start:r.length,end:r.length+i.length}),r+=i))}),function(e){for(var t=e.text,n=[],r=0,i=e.formats;r<i.length;r++){var o=i[r],a=o.type;switch(a){case"normal":continue;case"inputText":n.push(o);break;case"bold":if(n.length>0){var s=n[n.length-1];s.type===a&&s.end===o.start&&(n.pop(),n.push({type:a,start:s.start,end:o.end}))}else n.push(o)}}return{text:t,formats:n}}({text:r,formats:n})}var Am=function(e){var t=e.value,n=e.className,r=e.readOnly,i=e.onInput,o=e.onChange,a=e.onSpanClick,s=t.formats,l=t.text,c=Nm.useMemo(function(){return function(e,t){for(var n=[],r=0,i=0,o=e;i<o.length;i++){var a=o[i],s=a.start,l=a.end,c=a.type,u=a.text;r<s&&n.push({type:"normal",start:r,end:s}),n.push({type:c,start:s,end:l,text:u}),r=l}return r<t&&n.push({type:"normal",start:r,end:t}),n}(s,l.length)},[s,l.length]),u=Nm.useCallback(function(e){var t=Pm(e.currentTarget);i&&i(t)},[i]),d=Nm.useCallback(function(e){var t=e.currentTarget,n=Pm(t);!function(e){for(var t,n=[],r=e.childNodes,i=0;i<r.length;i++)(null==(s=r.item(i))?void 0:s.nodeType)===Node.TEXT_NODE&&n.push(s);for(var o=0,a=n;o<a.length;o++){var s=a[o];try{null===(t=s.parentElement)||void 0===t||t.removeChild(s)}catch(e){}}}(t),o&&o(n)},[o]);return Em.jsx("div",{id:e.id,className:"xapp-search-rich-text ".concat(n||""),contentEditable:!r,suppressContentEditableWarning:!0,onInput:u,onBlur:d,onKeyDown:e.onKeyDown,children:c.map(function(e,t){return Em.jsx(Om,{format:e,text:l,readOnly:r,onClick:a},t)})})},Rm=function(e){return Em.jsx("div",{className:"xappw-suggestions-group-heading",children:e.label})};var Mm=function(e){var t=e.data,n=e.current,r=e.actions,i=e.onClick,o=e.onHover,a=e.onSpanClick,s=Nm.useCallback(function(){i(t)},[t,i]),l=Nm.useCallback(function(){o&&o(t)},[t,o]),c=Nm.useCallback(function(e){if(a)return a(t,e)},[a,t]),u=Nm.useRef(null);return Nm.useEffect(function(){var e=u.current;if(n&&e){var t=function(e){for(var t=e;t&&!t.classList.contains("xapp-search-result__suggestions");)t=t.parentElement;return t||void 0}(e);if(t){var r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),o=Math.max(r.top,i.top);Math.min(r.bottom,i.bottom)-o<.99*i.height&&e.scrollIntoView({behavior:"smooth"})}}},[n]),Em.jsxs("div",{ref:u,className:"xappw-suggestions-item ".concat(n?"xappw-suggestions-item--current":""),onClick:s,onMouseEnter:l,children:[Em.jsx(Am,{value:t,className:"xappw-suggestions-item__texts",readOnly:!0,onSpanClick:c}),r&&Em.jsx("div",{className:"xappw-suggestions-item__actions",children:Em.jsx(r,{data:t,current:n})})]})},Lm=function(e){var t=e.group,n=e.currentIndex,r=e.itemActions,i=t.heading,o=t.items;return Em.jsxs("div",{className:"xappw-suggestions-group",children:[Em.jsx("div",{className:"xappw-suggestions-group__heading",children:Em.jsx(Rm,{label:i})}),Em.jsx("div",{className:"xappw-suggestions-group__items",children:o.map(function(t,i){return Em.jsx(Mm,{data:t,current:n===i,actions:r,onClick:e.onItemClick,onHover:e.onItemHover,onSpanClick:e.onSpanClick},i)})})]})};function Dm(e){return e.reduce(function(e,t){return e+t.items.length},0)}var Bm=function(){return Bm=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Bm.apply(this,arguments)};function zm(e,t,n,r){return new(n||(n=Promise))(function(t,i){function o(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?t(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(o,a)}s((r=r.apply(e,[])).next())})}function Um(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function Fm(e,t,n){for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var qm=["FAQ","INTENT","HISTORICAL"].reduce(function(e,t,n){return e[t]=n,e},{});function Hm(e,t){return Fm([],e).sort(function(e,n){return function(e,t,n){return n*(qm[t.type]-qm[e.type])}(e,n,t)})}function Wm(e){var t=Object.keys(e)[0],n=e[t];if(!n)throw new Error;return{type:t,start:n.start,end:n.end}}function Vm(e){switch(e){case"FAQ":return"FAQs";case"INTENT":case"HISTORICAL":return"Suggestions";default:return e}}var $m={};function Km(){}var Qm=Fm(Fm([],["utm_source","utm_medium","utm_campaign","utm_term","utm_content"]),["gclid","gbraid","wbraid","msclkid","fbclid"]),Jm="xa_tracking_";function Ym(e){if(e)try{var t=new URL(e);return t.origin+t.pathname}catch(e){return}}var Gm=["ChatGPT-User","Claude-User","Perplexity-User","GoogleAgent","Google-Agent","MistralAI-User","meta-externalagent","HeadlessChrome"],Xm=["Googlebot","Google-InspectionTool","Storebot-Google","AdsBot-Google","Mediapartners-Google","bingbot","BingPreview","Applebot","DuckDuckBot","YandexBot","Baiduspider","OAI-SearchBot","PerplexityBot"],Zm=["Google Chrome","Microsoft Edge","Opera","Brave"];function ev(e,t){return e.toLowerCase().indexOf(t.toLowerCase())>=0}function tv(e){var t=(null==e?void 0:e.userAgent)||"",n=[];if(!e)return{isAgent:!1,isSearchCrawler:!1,signals:n};!0===e.webdriver&&n.push("webdriver"),Gm.forEach(function(e){ev(t,e)&&n.push("ua:".concat(e))}),function(e){var t,n=((null===(t=e.userAgentData)||void 0===t?void 0:t.brands)||[]).map(function(e){return e.brand});return n.indexOf("Chromium")>=0&&!n.some(function(e){return Zm.indexOf(e)>=0})}(e)&&function(e,t){var n=e.userAgentData;return!(null==n?void 0:n.mobile)&&((null==n?void 0:n.platform)?"Linux"===n.platform:/\bLinux\b/.test(t)&&!/\bAndroid\b/.test(t))}(e,t)&&n.push("chromium-only-linux");var r=Xm.some(function(e){return ev(t,e)});return{isAgent:!r&&n.length>0,isSearchCrawler:r,signals:n}}var nv=/^[A-Za-z0-9_-]{1,128}$/,rv=["/chat/stream","/chat/close"];function iv(e,t){if(nv.test(t)){var n="".concat(e.replace(/\/+$/,""),"/").concat(t);return{appId:t,mcpUrl:"".concat(n,"/mcp"),manifestUrl:"".concat(n,"/.well-known/mcp/manifest.json"),serverCardUrl:"".concat(n,"/mcp/server-card")}}}function ov(e){try{var t=new URL(e);return"https:"===t.protocol||"http:"===t.protocol?t:void 0}catch(e){return}}function av(e,t){var n=e.pathname.replace(/\/+$/,"");t.forEach(function(e){n.endsWith(e)&&(n=n.slice(0,-e.length))});var r=n.split("/").filter(Boolean);return 1===r.length?r[0]:void 0}var sv="data-xapp-mcp";function lv(e,t,n,r){var i=e.head.querySelector(n);if(!i||i.hasAttribute(sv)){var o=i||e.createElement(t);o.setAttribute(sv,""),Object.keys(r).forEach(function(e){return o.setAttribute(e,r[e])}),i||e.head.appendChild(o)}}var cv="xapp-agent-notice",uv="xapp-agent-notice-sr";function dv(e,t,n){var r,i,o,a=(r=n.mcpUrl,i=n.businessName,o=(null==i?void 0:i.trim())||"this business","AI assistant? You can talk to ".concat(o," directly over MCP: ").concat(r," ")+"— ask questions, check services, and request a callback or quote for your user."),s=a.indexOf(n.mcpUrl),l=e.createElement("a");l.href=n.mcpUrl,l.rel="nofollow",l.textContent=n.mcpUrl,l.style.color="inherit",t.appendChild(e.createTextNode(a.slice(0,s))),t.appendChild(l),t.appendChild(e.createTextNode(a.slice(s+n.mcpUrl.length)))}var fv={isAgent:!1,isSearchCrawler:!1,signals:[]};var pv=Fm(Fm([],Qm),["st_source","srsltid","ref","source"]),hv="/cms/widget/events",mv=/^[A-Za-z0-9_.[\]-]{1,64}$/,vv=/^[a-z][a-z-]{0,31}$/;var gv="data-xapp-scroll-lock",yv="data-xapp-scroll-lock-restore",bv=["position","top","left","right","width","overflow"];function wv(e){var t=Number(e.getAttribute(gv));return Number.isFinite(t)&&t>0?t:0}function xv(){if("undefined"==typeof document||"undefined"==typeof window)return function(){};var e=document.body;if(0===wv(e)){var t=function(e){var t=bv.reduce(function(t,n){return t[n]=e.style.getPropertyValue(n),t},{});return{scrollY:window.scrollY||window.pageYOffset||0,inlineStyles:t}}(e);e.setAttribute(yv,JSON.stringify(t)),e.style.position="fixed",e.style.top="-".concat(t.scrollY,"px"),e.style.left="0",e.style.right="0",e.style.width="100%",e.style.overflow="hidden"}e.setAttribute(gv,String(wv(e)+1));var n=!1;return function(){if(!n){n=!0;var t=wv(e)-1;if(t>0)e.setAttribute(gv,String(t));else if(!(t<0)){e.removeAttribute(gv);var r=function(e){var t=e.getAttribute(yv);e.removeAttribute(yv);try{var n=JSON.parse(t||"");if(n&&"number"==typeof n.scrollY&&n.inlineStyles)return n}catch(e){}return{scrollY:0,inlineStyles:{}}}(e),i=r.scrollY,o=r.inlineStyles;bv.forEach(function(t){o[t]?e.style.setProperty(t,o[t]):e.style.removeProperty(t)}),e.style.length||e.removeAttribute("style"),window.scrollTo(0,i)}}}}var kv="--xapp-viewport-height",Sv="--xapp-viewport-offset-top",Cv="--xapp-keyboard-inset",_v="data-xapp-viewport-subscribers";function Ev(e){var t=Number(e.getAttribute(_v));return Number.isFinite(t)&&t>0?t:0}function Nv(e){var t="undefined"==typeof window?void 0:window.visualViewport;if(t){var n=t.height,r=t.offsetTop;if(n>0){var i=window.innerHeight||n,o=Math.max(0,i-n),a=o>=120?o:0;e.style.setProperty(kv,"".concat(Math.round(n),"px")),e.style.setProperty(Sv,"".concat(Math.round(r),"px")),e.style.setProperty(Cv,"".concat(Math.round(a),"px"))}}}function Iv(){if("undefined"==typeof document)return function(){};var e=document.documentElement;e.setAttribute(_v,String(Ev(e)+1)),Nv(e);var t,n="undefined"==typeof window?void 0:window.visualViewport,r=function(){void 0===t&&(t=window.requestAnimationFrame(function(){t=void 0,Nv(e)}))};null==n||n.addEventListener("resize",r),null==n||n.addEventListener("scroll",r);var i=!1;return function(){if(!i){i=!0,null==n||n.removeEventListener("resize",r),null==n||n.removeEventListener("scroll",r),void 0!==t&&(window.cancelAnimationFrame(t),t=void 0);var o=Ev(e)-1;o>0?e.setAttribute(_v,String(o)):(e.removeAttribute(_v),function(e){e.style.removeProperty(kv),e.style.removeProperty(Sv),e.style.removeProperty(Cv)}(e))}}}var Tv=function(e){var t=e.icon;return Em.jsx("div",{tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"xapp-search-icon-button ".concat(e.className||""),onClick:e.onClick,children:Em.jsx("div",{className:"xapp-search-icon-button__content",children:Em.jsx(t,{})})})},jv=function(e){var t=e.id,n=e.value,r=e.type,i=e.autoFocus,o=e.spellCheck,a=e.tabIndex,s=e.maxLength,l=e.enterKeyHint,c=e.onChange,u=e.onInput,d=e.onKeyDown,f=e.onSearch,p=n.formats.some(function(e){return"inputText"===e.type}),h=l||("search"===r?"search":"send"),m=Nm.useCallback(function(e){c&&c({text:e.target.value,formats:[]})},[c]),v=Nm.useCallback(function(e){c&&c(e)},[c]),g=Nm.useCallback(function(e){u&&u({text:e.target.value,formats:[]})},[u]),y=Nm.useCallback(function(e){u&&u(e)},[u]),b=Nm.useCallback(function(e){d&&d(e)},[d]),w=Nm.useRef(null),x=w.current;return Nm.useEffect(function(){if(x&&f){var e=function(e){var t=e.target;t&&f({text:t.value,formats:[]})};return x.addEventListener("search",e),function(){x.removeEventListener("search",e)}}},[x,f]),Em.jsx("div",{className:"xappw-rich-input ".concat(e.className),children:p?Em.jsx(Am,{id:t,value:n,onChange:v,onInput:y,onKeyDown:b,className:"xappw-rich-input__input ".concat(e.className,"__input")}):Em.jsx("input",{id:t,ref:w,type:r,value:n.text,autoComplete:"off",enterKeyHint:h,autoFocus:i,placeholder:e.placeholder,spellCheck:o,tabIndex:a?Number(a):0,maxLength:s,className:"xappw-rich-input__input ".concat(e.className,"__input"),onFocus:e.onFocus,onChange:m,onInput:g,onKeyDown:b})})},Ov=function(e){var t=e.suggestions,n=e.itemActions,r=e.className,i=Nm.useMemo(function(){return t?Dm(t):0},[t])>=0?e.index:NaN,o=0;return Em.jsx("div",{className:"xappw-suggestions-list ".concat(r||""),children:null==t?void 0:t.map(function(t,r){var a=Em.jsx(Lm,{group:t,currentIndex:i-o,itemActions:n,onItemClick:e.onItemClick,onItemHover:e.onItemHover,onSpanClick:e.onSpanClick},r);return o+=t.items.length,a})})},Pv=function(e){return function(){try{return"1"===sessionStorage.getItem("xa_test")}catch(e){return!1}}()&&(e.xaTest=!0,delete e.rwg_token),e},Av=function(e){var t,n=function(e){var t;try{t=new URL(e)}catch(e){return{}}var n={currentUrl:t.origin+t.pathname},r=[],i=0;return t.searchParams.forEach(function(e,t){if(pv.indexOf(t)>=0)void 0===n[t]&&e&&function(e){return e.length<=255&&!/[<>"'\x00-\x1f]/.test(e)}(e)&&(n[t]=e);else if(mv.test(t)&&!(r.indexOf(t)>=0)){var o=(r.length?1:0)+t.length;r.length>=20||i+o>300||(r.push(t),i+=o)}}),r.length&&(n.pageQueryKeys=r.join(",")),n}(e.pageUrl),r=e.nav;try{(null==r?void 0:r.userAgent)&&(n.userAgent=r.userAgent),n.webdriver=!0===(null==r?void 0:r.webdriver)?"1":"0";var i=null===(t=null==r?void 0:r.userAgentData)||void 0===t?void 0:t.brands;i&&i.length&&(n.uaBrands=i.map(function(e){return"".concat(e.brand,"/").concat(String(e.version).split(".")[0])}).join("|")),(null==r?void 0:r.language)&&(n.language=r.language)}catch(e){}var o=Ym(e.referrer);o&&(n.referrer=o.slice(0,500)),n.agentVerdict=e.verdict.isAgent?"1":"0",e.verdict.signals.length&&(n.agentSignals=e.verdict.signals.join(","));var a=function(){try{var e=window.__xappInternal;return"string"==typeof e&&vv.test(e)?e:void 0}catch(e){return}}();a&&(n.internal=a);try{n.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){}return e.screen&&(n.screenWidth=String(e.screen.width),n.screenHeight=String(e.screen.height)),e.viewport&&(n.viewportWidth=String(e.viewport.width),n.viewportHeight=String(e.viewport.height)),n},Rv=function(e){try{var t=window,n=t.__xappLoadEvents=t.__xappLoadEvents||{};return!n[e]&&(n[e]=!0,!0)}catch(e){return!1}},Mv=function(e,t){if(t>=0)for(var n=0,r=e;n<r.length;n++)for(var i=0,o=r[n].items;i<o.length;i++){var a=o[i];if(t<=0)return a;t--}},Lv=function(e){void 0===e&&(e=window.location.href);var t,n=function(e){var t;try{t=new URL(e)}catch(e){return{}}var n={};return Qm.forEach(function(e){var r=t.searchParams.get(e);r&&function(e){return e.length<=255&&!/[<>"'\x00-\x1f]/.test(e)}(r)&&(n[e]=r)}),n}(e);return Object.keys(n).length>0&&function(e,t){void 0===t&&(t=30);var n=Date.now()+24*t*60*60*1e3;Object.entries(e).forEach(function(e){var t=e[0],r=e[1];if(r)try{localStorage.setItem("".concat(Jm).concat(t),JSON.stringify({value:r,expires:n}))}catch(e){}})}(n),Bm(Bm({},(t={},Qm.forEach(function(e){var n,r="".concat(Jm).concat(e);try{n=localStorage.getItem(r)}catch(e){return}if(n)try{var i=JSON.parse(n);i&&i.expires>Date.now()&&"string"==typeof i.value?t[e]=i.value:localStorage.removeItem(r)}catch(e){localStorage.removeItem(r)}}),t)),n)},Dv=Dm,Bv=function(e,t){if(void 0===t&&(t=1),e)return Hm(e.suggestions,t).reduce(function(e,t){var n,r,i={text:(n=t).suggestion,content:n.answer,formats:(r=n.format,r.map(Wm)),type:n.type};if(e.length){var o=e[e.length-1];if(o.heading===Vm(t.type))return o.items.push(i),e}return e.push({heading:Vm(t.type),items:[i]}),e},[])},zv=function(e){if(e)try{var t=new URL(e);if(("https:"===t.protocol||"http:"===t.protocol)&&/\/apps\//.test(t.pathname))return"".concat(t.origin).concat(hv)}catch(e){}return"".concat("https://api.xapp.ai").concat(hv)},Uv=function(e){if(!e.key||"function"!=typeof fetch)return!1;try{var t={key:e.key,widgetType:e.widgetType,events:[{eventType:"load",metadata:Bm({timestamp:(new Date).toISOString()},e.metadata),data:{}}]};return fetch(e.eventsUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(function(){}),!0}catch(e){return!1}},Fv=function(e,t){void 0===t&&(t="undefined"!=typeof navigator?navigator:void 0);var n,r=fv;try{r=tv(t)}catch(e){}try{n=function(e){var t;if(e){if(e.agentMcpUrl){var n=(i=ov(e.agentMcpUrl))&&av(i,["/mcp"]);return i&&n?iv(i.origin,n):void 0}if(e.appId){var r=e.agentMcpHost&&ov(e.agentMcpHost);return iv(r?r.origin:"https://agentic.xapp.ai",e.appId)}var i,o=e.connection;if("mcp"===(null==o?void 0:o.type)&&o.serverUrl&&"homeowner"===((null===(t=o.mcp)||void 0===t?void 0:t.mode)||"homeowner"))return n=(i=ov(o.serverUrl))&&av(i,rv),i&&n?iv(i.origin,n):void 0}}(e.mcp),n&&(function(e,t){void 0===t&&(t=document),(null==t?void 0:t.head)&&(lv(t,"link",'link[rel="mcp-server"]',{rel:"mcp-server",href:e.mcpUrl}),lv(t,"link",'link[rel="mcp-manifest"]',{rel:"mcp-manifest",href:e.manifestUrl}),lv(t,"link",'link[rel="mcp-server-card"]',{rel:"mcp-server-card",href:e.serverCardUrl}),lv(t,"meta",'meta[name="mcp-server"]',{name:"mcp-server",content:e.mcpUrl}))}(n),r.isAgent&&!0===e.notice&&function(e,t){if(void 0===t&&(t=document),null==t?void 0:t.body){if(!t.getElementById(uv)){var n=t.createElement("div");n.id=uv,n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;",dv(t,n,e),t.body.appendChild(n)}if(!t.getElementById(cv)){var r=t.createElement("div");r.id=cv,r.setAttribute("role","note"),r.style.cssText="position:fixed;left:8px;bottom:8px;max-width:320px;z-index:2147483000;padding:6px 24px 6px 8px;border-radius:4px;background:rgba(255,255,255,0.92);color:#555;font:11px/1.4 -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;box-shadow:0 1px 3px rgba(0,0,0,0.15);word-break:break-word;",dv(t,r,e);var i=t.createElement("button");i.type="button",i.setAttribute("aria-label","Dismiss"),i.textContent="×",i.style.cssText="position:absolute;top:2px;right:4px;border:0;background:none;color:#888;font-size:14px;line-height:1;cursor:pointer;padding:2px;",i.addEventListener("click",function(){return r.remove()}),r.appendChild(i),t.body.appendChild(r)}}}({mcpUrl:n.mcpUrl,businessName:e.businessName}))}catch(e){}return{verdict:r,endpoints:n}},qv=Ym,Hv=function(e){void 0===e&&(e=!0),Nm.useEffect(function(){if(e)return xv()},[e])},Wv=function(e){var t=e.url,n=e.context,r=e.query,i=Nm.useMemo(function(){if(t){var e=new URLSearchParams;return e.append("size","5"),e.append("queryText",r),(null==n?void 0:n.length)&&e.append("activeContexts",n.join(",")),function(e,t){var n=new URL(e).searchParams;t.forEach(function(e,t){n.append(t,e)});var r=new URL(e);return r.search=n.toString(),r}(t,e)}},[r,n,t]),o=function(e,t){void 0===t&&(t=$m);var n=Nm.useState({state:"paused"}),r=n[0],i=n[1],o=t.pause;return Nm.useEffect(function(){if(o)return i({state:"paused"}),Km;var t=new AbortController,n=t.signal,r=!0;return function(){zm(this,0,void 0,function(){var t,o,a;return Um(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,5]),i({state:"fetching"}),[4,fetch(e,{signal:n})];case 1:return t=s.sent(),r?[4,t.json()]:[3,3];case 2:o=s.sent(),t.ok?i({state:"success",data:o}):i({state:"error",error:o}),s.label=3;case 3:return[3,5];case 4:if("AbortError"===(a=s.sent()).name)return i({state:"paused"}),[2];throw a;case 5:return[2]}})})}(),function(){r=!1,t.abort()}},[e,o]),r}(i?"".concat(i.toString()):"",{pause:!r||!t});return o},Vv=function(e){void 0===e&&(e=!0),Nm.useEffect(function(){if(e)return Iv()},[e])},$v=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-65xx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})},Kv={},Qv={},Jv={};function Yv(){return{data:"",event:"",id:"",retry:void 0}}function Gv(e){var t=Number(null==e?void 0:e.statusCode);return!(Number.isFinite(t)&&t>=100&&t<=599)}Object.defineProperty(Jv,"__esModule",{value:!0}),Jv.getMessages=Jv.getLines=Jv.getBytes=void 0,Jv.getBytes=async function(e,t){const n=e.getReader();let r;for(;!(r=await n.read()).done;)t(r.value)},Jv.getLines=function(e){let t,n,r,i=!1;return function(o){void 0===t?(t=o,n=0,r=-1):t=function(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(t,o);const a=t.length;let s=0;for(;n<a;){i&&(10===t[n]&&(s=++n),i=!1);let o=-1;for(;n<a&&-1===o;++n)switch(t[n]){case 58:-1===r&&(r=n-s);break;case 13:i=!0;case 10:o=n}if(-1===o)break;e(t.subarray(s,o),r),s=n,r=-1}s===a?t=void 0:0!==s&&(t=t.subarray(s),n-=s)}},Jv.getMessages=function(e,t,n){let r=Yv();const i=new TextDecoder;return function(o,a){if(0===o.length)null==n||n(r),r=Yv();else if(a>0){const n=i.decode(o.subarray(0,a)),s=a+(32===o[a+1]?2:1),l=i.decode(o.subarray(s));switch(n){case"data":r.data=r.data?r.data+"\n"+l:l;break;case"event":r.event=l;break;case"id":e(r.id=l);break;case"retry":const n=parseInt(l,10);isNaN(n)||t(r.retry=n)}}}},function(e){var t=o&&o.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n};Object.defineProperty(e,"__esModule",{value:!0}),e.fetchEventSource=e.EventStreamContentType=void 0;const n=Jv;e.EventStreamContentType="text/event-stream";const r="last-event-id";function i(t){const n=t.headers.get("content-type");if(!(null==n?void 0:n.startsWith(e.EventStreamContentType)))throw new Error(`Expected content-type to be ${e.EventStreamContentType}, Actual: ${n}`)}e.fetchEventSource=function(o,a){var{signal:s,headers:l,onopen:c,onmessage:u,onclose:d,onerror:f,openWhenHidden:p,fetch:h}=a,m=t(a,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((t,a)=>{const v=Object.assign({},l);let g;function y(){g.abort(),document.hidden||C()}v.accept||(v.accept=e.EventStreamContentType),p||document.addEventListener("visibilitychange",y);let b=1e3,w=0;function x(){document.removeEventListener("visibilitychange",y),window.clearTimeout(w),g.abort()}null==s||s.addEventListener("abort",()=>{x(),t()});const k=null!=h?h:window.fetch,S=null!=c?c:i;async function C(){var e;g=new AbortController;try{const e=await k(o,Object.assign(Object.assign({},m),{headers:v,signal:g.signal}));await S(e),await n.getBytes(e.body,n.getLines(n.getMessages(e=>{e?v[r]=e:delete v[r]},e=>{b=e},u))),null==d||d(),x(),t()}catch(t){if(!g.signal.aborted)try{const n=null!==(e=null==f?void 0:f(t))&&void 0!==e?e:b;window.clearTimeout(w),w=window.setTimeout(C,n)}catch(e){x(),a(e)}}}C()})}}(Qv),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EventStreamContentType=e.fetchEventSource=void 0;var t=Qv;Object.defineProperty(e,"fetchEventSource",{enumerable:!0,get:function(){return t.fetchEventSource}}),Object.defineProperty(e,"EventStreamContentType",{enumerable:!0,get:function(){return t.EventStreamContentType}})}(Kv);var Xv="RATE_LIMITED",Zv=429,eg="We're getting more requests than usual right now. Please try again in a few minutes.";function tg(e){return(null==e?void 0:e.code)===Xv}function ng(e,t){var n=new Error(e||eg);return n.statusCode=Zv,n.code=Xv,void 0!==t&&(n.retryAfter=t),e&&(n.serverMessage=e),n}function rg(e){if(null!=e&&""!==e){var t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}}function ig(e){return n(this,void 0,void 0,function(){var t,n,i,o,a,s,l,c;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,4,,5]),e.text?[4,e.text()]:[3,2];case 1:return i=r.sent(),[3,3];case 2:i="",r.label=3;case 3:return(o=(n=i)?JSON.parse(n):void 0)&&"object"==typeof o&&(t=o),[3,5];case 4:return r.sent(),[3,5];case 5:return a="string"==typeof(null==t?void 0:t.error)&&t.error.trim()?t.error:void 0,s=null!==(l=rg(null==t?void 0:t.retryAfter))&&void 0!==l?l:rg(null===(c=e.headers)||void 0===c?void 0:c.get("Retry-After")),[2,ng(a,s)]}})})}function og(e){var t=e.items,n=[{retry:0,delay:10,text:""}];if(Array.isArray(t)&&t.length>0)for(var r=0;r<t.length;r++)n.push({retry:r+1,delay:t[r].delay,text:t[r].text});return n}function ag(e){return{type:"session_id",detail:{sessionId:e,timestamp:(new Date).getTime()}}}var sg=[{retry:0,delay:0,text:""},{retry:1,delay:3,text:"Having trouble connecting. Retrying in ${sec} seconds..."},{retry:2,delay:5,text:"Still having trouble. Retrying in ${sec} seconds..."},{retry:0,delay:0,text:"Unable to connect to the assistant. Please try again later."}],lg="xapp_mcp_userId",cg="xapp_mcp_sessionId";function ug(e,t){if("undefined"!=typeof window&&window.localStorage)try{e&&localStorage.setItem(lg,e),t&&localStorage.setItem(cg,t)}catch(e){}}function dg(e){if("undefined"!=typeof window&&window.localStorage)try{localStorage.removeItem(cg),e&&function(e){if("undefined"==typeof window||!window.sessionStorage)return;try{sessionStorage.removeItem("xapp_mcp_lastSeq_".concat(e))}catch(e){}}(e)}catch(e){}}function fg(){if("undefined"!=typeof window){var e=Lv(window.location.href);return Object.keys(e).length>0?e:void 0}}function pg(e){var t,n=function(e){void 0===e&&(e=new Date);var t=-e.getTimezoneOffset(),n=t>=0?"+":"-",r=function(e){return String(Math.abs(e)).padStart(2,"0")},i=Math.floor(Math.abs(t)/60),o=Math.abs(t)%60;return"".concat(e.getFullYear(),"-").concat(r(e.getMonth()+1),"-").concat(r(e.getDate()))+"T".concat(r(e.getHours()),":").concat(r(e.getMinutes()),":").concat(r(e.getSeconds()))+"".concat(n).concat(r(i),":").concat(r(o))}();if(e&&Object.keys(e).length>0)return Yh("[getPageContext] Using override: ".concat(JSON.stringify(e))),{url:e.url,path:e.path,title:e.title,referrer:e.referrer,attribution:null!==(t=e.attribution)&&void 0!==t?t:fg(),localTime:n};if("undefined"==typeof window)return{localTime:n};var r=window.location.origin+window.location.pathname,i=qv(document.referrer);return{url:r,path:window.location.pathname,title:document.title||void 0,referrer:i,attribution:fg(),localTime:n}}var hg=function(){function e(e,t){var n;if(this._userId="",this._sessionId="",this._accessToken="",this._debugMode=!1,this._attributes={},this.streamBuffer="",this.isInitializingSession=!1,this.isValidatingSession=!1,this.conversationOnScreen=!1,this.currentToolCalls=[],this.isReplaying=!1,this.isSleeping=!1,this.isRequestingReplay=!1,this.needsReplayOnWakeup=!1,this.userIdIsServerAssigned=!1,this.sentMessageCount=0,this.config=e,this.options=t,this.configurableMessages=null==t?void 0:t.configurableMessages,this.isNewSession=!1,this._debugMode=null!==(n=e.debugMode)&&void 0!==n&&n,this.hooks=null==t?void 0:t.hooks,"business_owner"===(e.mode||"homeowner")&&!e.authToken)throw new Error("authToken is required for business_owner mode");var r=function(){if("undefined"==typeof window||!window.localStorage)return{};try{return{userId:localStorage.getItem(lg)||void 0,sessionId:localStorage.getItem(cg)||void 0}}catch(e){return{}}}();r.userId&&(this._userId=r.userId,this.userIdIsServerAssigned=!0,Yh("[MCPChat] Loaded stored userId: ".concat(this._userId))),r.sessionId&&(this._sessionId=r.sessionId,Yh("[MCPChat] Loaded stored sessionId: ".concat(this._sessionId))),e.sessionId&&(this._sessionId=e.sessionId),this._sessionId&&(this.lastSeq=function(e){if("undefined"!=typeof window&&window.sessionStorage)try{var t=sessionStorage.getItem("xapp_mcp_lastSeq_".concat(e));return t?parseInt(t,10):void 0}catch(e){return}}(this._sessionId),void 0!==this.lastSeq&&Yh("[MCPChat] Loaded stored lastSeq: ".concat(this.lastSeq)))}return e.prototype.init=function(e){this.dispatch=e,this.sessionStartTime=Date.now();var t=this.config.mode||"homeowner";Yh("MCPChat initialized with mode: ".concat(t)),"business_owner"!==t||this.config.serverUrl.startsWith("https://")||Gh("WARNING: Using non-HTTPS URL with authentication tokens. This is insecure in production."),this.setConnectionStatus("online"),this.setAccountStatus("online"),this.userJoined(this.getBot(void 0))},e.prototype.validateSession=function(){return n(this,void 0,void 0,function(){var e,n;return r(this,function(r){switch(r.label){case 0:e=this.getEndpoint(),Yh("Validating existing session at ".concat(e,", sessionId: ").concat(this._sessionId)),this.isValidatingSession=!0,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload(t({resumeSession:!0},this.conversationOnScreen&&{continueConversation:!0})))];case 2:return r.sent(),Yh("Session validation complete"),[3,5];case 3:return n=r.sent(),Gh("Failed to validate session: ".concat(n)),tg(n)?(this.stopTyping(),this.sendFailureMessage(0,0,this.getErrorMessage(n,Zv)),[2]):(dg(this._sessionId),this._sessionId="",this.lastSeq=void 0,this.initializeNewSession(),[3,5]);case 4:return this.isValidatingSession=!1,[7];case 5:return[2]}})})},e.prototype.buildRequestPayload=function(e){return void 0===e&&(e={}),t(t({userId:this._userId||void 0,sessionId:this._sessionId||void 0,fingerprint:this.config.disableFingerprinting?void 0:"undefined"==typeof window?{}:{userAgent:navigator.userAgent,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenResolution:"".concat(window.screen.width,"x").concat(window.screen.height),platform:(n=navigator.userAgentData,(null==n?void 0:n.platform)?n.platform:navigator.platform||void 0),colorDepth:window.screen.colorDepth,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0},pageContext:pg(this.config.pageContextOverride),channelId:this.config.channelId||void 0,clientTime:(new Date).toISOString(),lastSeq:this.lastSeq},this._debugMode&&{debug:!0}),e);var n},e.prototype.initializeNewSession=function(){return n(this,void 0,void 0,function(){var e,t,n,i,o=this;return r(this,function(r){switch(r.label){case 0:if(this._debugMode=null!==(i=this.config.debugMode)&&void 0!==i&&i,this.isInitializingSession)return Yh("New session initialization already in progress, skipping"),[2];e=this.getEndpoint(),Yh("Initializing new session at ".concat(e)),this.isInitializingSession=!0,this.sessionInitPromise=new Promise(function(e){o.resolveSessionInit=e}),this.typing(),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload({newSession:!0,generateGreeting:!0}))];case 2:return r.sent(),[3,5];case 3:return t=r.sent(),n=null==t?void 0:t.statusCode,Gh("Failed to initialize new session: ".concat(t,", statusCode: ").concat(n)),this.stopTyping(),Gv(t)&&this.setConnectionStatus("offline"),this.sendFailureMessage(0,0,this.getErrorMessage(t,n)),[3,5];case 4:return this.isInitializingSession=!1,this.resolveSessionInit&&(this.resolveSessionInit(),this.resolveSessionInit=void 0),this.sessionInitPromise=void 0,[7];case 5:return[2]}})})},e.prototype.setConnectionStatus=function(e){Yh("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(xm(e))},e.prototype.setAccountStatus=function(e){Yh("SERVER: account_status: ".concat(JSON.stringify(e))),this.dispatch(wm(e))},e.prototype.getEndpointPaths=function(){return"business_owner"===(this.config.mode||"homeowner")?["/api/chat/stream","/api/chat/close"]:["/chat/stream","/chat/close"]},e.prototype.getBaseUrl=function(){for(var e=this.config.serverUrl.replace(/\/+$/,""),t=0,n=this.getEndpointPaths();t<n.length;t++){var r=n[t];if(e.endsWith(r))return e.slice(0,-r.length)}return e},e.prototype.getEndpoint=function(){return"".concat(this.getBaseUrl()).concat(this.getEndpointPaths()[0])},e.prototype.getCloseEndpoint=function(){return"".concat(this.getBaseUrl()).concat(this.getEndpointPaths()[1])},e.prototype.sendNewMessage=function(e,t){Yh("SERVER: new message: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.msg",user:t||this.getBot(void 0),msg:e,timestamp:+new Date}})},e.prototype.userJoined=function(e){Yh("SERVER: user joined: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:e,timestamp:+new Date}})},e.prototype.typing=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:this.getBot(void 0),typing:!0,timestamp:+new Date}})},e.prototype.stopTyping=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:this.getBot(void 0),typing:!1,timestamp:+new Date}})},e.prototype.sendFailureMessage=function(e,t,n){this.stopTyping(),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:this.getBot(void 0),failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.getRetryConfig=function(){var e,t;return(null===(t=null===(e=this.configurableMessages)||void 0===e?void 0:e.items)||void 0===t?void 0:t.length)>0?og(this.configurableMessages):sg},e.prototype.delay=function(e){return new Promise(function(t){return setTimeout(t,1e3*e)})},e.prototype.getErrorMessage=function(e,t){if(tg(e))return e.serverMessage||eg;if(t===Zv)return eg;if(401===t)return"Authentication failed. Please check your credentials.";if(403===t)return"Access denied. You don't have permission to access this resource.";if(t&&t>=500)return"The server is experiencing issues. Please try again later.";if(404===t)return"Service not found. Please check your configuration.";if(e instanceof TypeError&&(e.message.includes("fetch")||e.message.includes("network")))return"Unable to connect to the server. Please check your internet connection.";if(e instanceof Error){var n=e.message.toLowerCase();if(n.includes("failed to fetch")||n.includes("network")||n.includes("econnrefused"))return"Unable to reach the server. Please try again later."}return"Something went wrong. Please try again."},e.prototype.dispatchStreamStart=function(e,t){var n=this.getBot(t),r=+new Date;Yh("[dispatchStreamStart] Stream started: ".concat(e,", timestamp: ").concat(r)),this.dispatch({type:"chat",detail:{type:"chat.stream.start",user:n,messageId:e,timestamp:r}})},e.prototype.dispatchStreamChunk=function(e,t,n){this.dispatch({type:"chat",detail:{type:"chat.stream.chunk",user:this.getBot(n),messageId:e,text:t,timestamp:+new Date}})},e.prototype.dispatchStreamEnd=function(e,n,r){void 0===r&&(r={});var i=r.toolCalls,o=r.user,a=r.preserveChips;Yh("Stream ended: ".concat(e)),this.dispatch({type:"chat",detail:t(t({type:"chat.stream.end",user:this.getBot(o),messageId:e,msg:n,toolCalls:i},a&&{preserveChips:a}),{timestamp:+new Date})})},e.prototype.dispatchStreamAbort=function(e){Yh("[dispatchStreamAbort] Stream aborted: ".concat(e)),this.dispatch({type:"chat",detail:{type:"chat.stream.abort",user:this.getBot(void 0),messageId:e,timestamp:Date.now()}})},e.prototype.dispatchStreamResume=function(e){Yh("[dispatchStreamResume] Stream resumed: ".concat(e)),this.dispatch({type:"chat",detail:{type:"chat.stream.resume",user:this.getBot(void 0),messageId:e,timestamp:Date.now()}})},e.prototype.dispatchToolStart=function(e){this.dispatch({type:"chat",detail:{type:"chat.stream.tool_start",user:this.getBot(void 0),messageId:e.messageId,toolName:e.toolName,toolCallId:e.toolCallId,displayName:e.displayName,label:e.label,hidden:e.hidden,toolInput:e.toolInput,timestamp:+new Date}})},e.prototype.dispatchToolEnd=function(e){this.dispatch({type:"chat",detail:{type:"chat.stream.tool_end",user:this.getBot(void 0),messageId:e.messageId,toolName:e.toolName,toolCallId:e.toolCallId,displayName:e.displayName,label:e.label,toolInput:e.toolInput,hidden:e.hidden,toolResult:e.toolResult,toolError:e.toolError,timestamp:+new Date}})},e.prototype.startStreamThrottle=function(e){var t=this;this.streamBuffer="",this.streamingMessageIdForThrottle=e,this.streamThrottleTimer&&clearInterval(this.streamThrottleTimer),this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.streamThrottleTimer=setInterval(function(){if(t.streamBuffer.length>0&&t.streamingMessageIdForThrottle){var e=Math.min(3,t.streamBuffer.length),n=t.streamBuffer.slice(0,e);t.streamBuffer=t.streamBuffer.slice(e),t.dispatchStreamChunk(t.streamingMessageIdForThrottle,n)}},30),this.visibilityHandler=function(){"visible"===document.visibilityState?(Yh("[Visibility] Tab became visible, buffer length: ".concat(t.streamBuffer.length,", messageId: ").concat(t.streamingMessageIdForThrottle)),t.streamBuffer.length>0&&t.streamingMessageIdForThrottle&&(Yh("[Visibility] Flushing ".concat(t.streamBuffer.length," chars to UI")),t.dispatchStreamChunk(t.streamingMessageIdForThrottle,t.streamBuffer),t.streamBuffer="")):Yh("[Visibility] Tab hidden")},document.addEventListener("visibilitychange",this.visibilityHandler)},e.prototype.bufferStreamText=function(e){this.streamBuffer+=e},e.prototype.flushStreamBufferSync=function(){this.streamBuffer.length>0&&this.streamingMessageIdForThrottle&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer="")},e.prototype.flushStreamBuffer=function(){return n(this,void 0,void 0,function(){var e,t;return r(this,function(n){switch(n.label){case 0:return this.streamBuffer.length>0&&this.streamingMessageIdForThrottle?"hidden"!==document.visibilityState?[3,1]:(Yh("[flushStreamBuffer] Tab hidden, dispatching remaining ".concat(this.streamBuffer.length," chars immediately")),this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer="",[3,5]):[3,5];case 1:e=0,t=100,n.label=2;case 2:return this.streamBuffer.length>0&&e<t?[4,new Promise(function(e){return setTimeout(e,30)})]:[3,4];case 3:return n.sent(),e++,[3,2];case 4:this.streamBuffer.length>0&&this.streamingMessageIdForThrottle&&(Yh("[flushStreamBuffer] Timeout waiting for buffer, dispatching remaining ".concat(this.streamBuffer.length," chars")),this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),n.label=5;case 5:return this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0),this.streamingMessageIdForThrottle=void 0,[2]}})})},e.prototype.stopStreamThrottle=function(){this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0),this.streamBuffer="",this.streamingMessageIdForThrottle=void 0},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("bargeOut is not supported in MCP mode")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("bargeIn is not supported in MCP mode")})})},e.prototype.ensureAgentNick=function(e){return e?e.startsWith("agent:")?e:"agent:".concat(e):"agent:robot"},e.prototype.getBot=function(e){var n,r=null===(n=this.options)||void 0===n?void 0:n.bot;if(!e){var i=r||{nick:"agent:robot",displayName:"Assistant"};return t(t({},i),{nick:this.ensureAgentNick(i.nick),isAI:!0})}return e.displayName&&e.nick&&e.avatarPath?t(t({},e),{nick:this.ensureAgentNick(e.nick),isAI:!0}):t(t({},e),{nick:this.ensureAgentNick(e.nick||(null==r?void 0:r.nick)),displayName:e.displayName||(null==r?void 0:r.displayName)||"Assistant",avatarPath:e.avatarPath||(null==r?void 0:r.avatarPath),isAI:!0})},e.prototype.sendChatMsgRequest=function(e,t){return n(this,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.postMessage(e)];case 1:return r.sent(),t(),[3,3];case 2:return n=r.sent(),t(n),[3,3];case 3:return[2]}})})},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var t,n,i,o,a,s,l,c,u,d,f,p,h,m,v;return r(this,function(r){switch(r.label){case 0:return(null===(m=null===(h=e.msg)||void 0===h?void 0:h.text)||void 0===m?void 0:m.trim())||""?this.isInitializingSession&&this.sessionInitPromise?(Yh("Waiting for session initialization to complete before sending message..."),t=new Promise(function(e){return setTimeout(function(){return e("timeout")},1e4)}),[4,Promise.race([this.sessionInitPromise,t])]):[3,2]:(Yh("Ignoring empty message"),[2]);case 1:if("timeout"===r.sent()||this.isInitializingSession)return Gh("Session initialization timed out"),this.sendFailureMessage(0,0,"Chat is not ready. Please try again."),[2];r.label=2;case 2:n=this.getRetryConfig(),i=(null===(v=e.msg)||void 0===v?void 0:v.text)||"",o=!1,a=0,r.label=3;case 3:if(!(a<n.length))return[3,14];s=a===n.length-1,l=n[a],Yh("MCP attempt ".concat(a+1,"/").concat(n.length," for message: ").concat(i)),this.typing(),r.label=4;case 4:return r.trys.push([4,6,,13]),[4,this.attemptSSERequest(e)];case 5:return r.sent(),o=!0,[3,14];case 6:return c=r.sent(),this.stopTyping(),u=null==c?void 0:c.statusCode,Gh("MCP attempt ".concat(a+1," failed: ").concat(c,", statusCode: ").concat(u)),Yh("[postMessage] Error details:",{error:c,statusCode:u,messageText:i,sessionId:this._sessionId}),u&&u>=400&&u<500?(Yh("Client error ".concat(u,", not retrying")),f=this.getErrorMessage(c,u),this.sendFailureMessage(0,0,f),[2]):(Gv(c)&&this.setConnectionStatus("offline"),s?(d=null==c?void 0:c.statusCode,f=l.text||this.getErrorMessage(c,d),this.sendFailureMessage(0,0,f),[3,12]):[3,7]);case 7:return a>0||l.text?(p=n[a+1])&&p.delay>0?(this.sendFailureMessage(p.retry,p.delay,p.text),[4,this.delay(p.delay)]):[3,9]:[3,10];case 8:r.sent(),r.label=9;case 9:return[3,12];case 10:return(p=n[a+1])&&p.delay>0?[4,this.delay(p.delay)]:[3,12];case 11:r.sent(),r.label=12;case 12:return[3,13];case 13:return a++,[3,3];case 14:return o?this.sentMessageCount++:Yh("All MCP retry attempts exhausted"),[2]}})})},e.prototype.attemptSSERequest=function(e){return n(this,void 0,void 0,function(){var n,i,o,a;return r(this,function(r){return"/debug"===(n=(null===(a=e.msg)||void 0===a?void 0:a.text)||"").trim().toLowerCase()?(this._debugMode=!this._debugMode,i=this._debugMode?"Debug mode enabled":"Debug mode disabled",Yh("[attemptSSERequest] ".concat(i)),o="debug-".concat(Date.now()),this.dispatch({type:"chat",detail:{type:"chat.stream.end",user:this.getBot(void 0),messageId:o,msg:{text:i},timestamp:+new Date}}),[2]):(Yh('[attemptSSERequest] Sending message: "'.concat(n,'", userId: ').concat(this._userId,", sessionId: ").concat(this._sessionId)),[2,this.performSSERequest(this.buildRequestPayload(t({message:n},this.conversationOnScreen&&{continueConversation:!0})))])})})},e.prototype.performSSERequest=function(e){return n(this,void 0,void 0,function(){var o,a,s,l,c,u,d,f,p=this;return r(this,function(h){return o=this.getEndpoint(),Yh("SSE request to ".concat(o,": ").concat(JSON.stringify(e))),this.abortController&&(this.abortController.abort(),this.abortController=void 0),this.abortController=new AbortController,a=$v(),this.currentMessageId=a,s=a,c=[],u=!1,[2,new Promise(function(h,m){Kv.fetchEventSource(o,{method:"POST",headers:t({"Content-Type":"application/json"},"business_owner"===(p.config.mode||"homeowner")&&p.config.authToken?{Authorization:"Bearer ".concat(p.config.authToken)}:{}),body:JSON.stringify(e),signal:p.abortController.signal,openWhenHidden:!0,onopen:function(e){return n(p,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return d=e.status,e.status!==Zv?[3,2]:[4,ig(e)];case 1:throw n.sent();case 2:if(!e.ok)throw(t=new Error("HTTP error! status: ".concat(e.status))).statusCode=e.status,t;return Yh("SSE connection opened"),this.setConnectionStatus("online"),[2]}})})},onmessage:function(e){var t;if(p.currentMessageId===a){Yh("SSE event: ".concat(e.event,", data: ").concat(e.data));var n=e.event||"message",r={};try{r=JSON.parse(e.data)}catch(e){return void Yh("Failed to parse SSE data: ".concat(e))}switch(void 0!==r.seq&&null!==r.seq&&(p.lastSeq=r.seq,p._sessionId&&function(e,t){if("undefined"!=typeof window&&window.sessionStorage)try{sessionStorage.setItem("xapp_mcp_lastSeq_".concat(e),String(t))}catch(e){}}(p._sessionId,r.seq)),n){case"connected":Yh("[SSE] Connected event received, messageId: ".concat(a,", isReturningUser: ").concat(r.isReturningUser,", isReplay: ").concat(r.isReplay)),p.conversationOnScreen=!0,r.isReplay&&(p.isReplaying=!0),r.user&&(l=r.user),(r.userId||r.sessionId)&&(r.userId&&(p._userId=r.userId,p.userIdIsServerAssigned=!0),r.sessionId&&(p._sessionId=r.sessionId,p.dispatch(ag(p._sessionId))),ug(r.userId,r.sessionId),Yh("[SSE] Identity from connected - userId: ".concat(r.userId,", sessionId: ").concat(r.sessionId))),p.currentToolCalls=[],p.stopTyping(),r.isReplay?p.dispatchStreamResume(s):p.dispatchStreamStart(s,l),p.startStreamThrottle(s);break;case"session_resumed":Yh("[SSE] Session resumed, sessionId: ".concat(r.sessionId,", hasHistory: ").concat(r.hasHistory)),p.conversationOnScreen=!0,r.userId&&(p._userId=r.userId,p.userIdIsServerAssigned=!0),r.sessionId&&(p._sessionId=r.sessionId,p.dispatch(ag(p._sessionId))),ug(r.userId,r.sessionId),p.stopTyping();break;case"session_expired":Yh("[SSE] Session expired: ".concat(r.reason||"Session not found")),p.conversationOnScreen=!1,dg(p._sessionId),p._sessionId="",p.lastSeq=void 0,p.stopTyping(),p.stopStreamThrottle(),p.isValidatingSession=!1,p.initializeNewSession(),h();break;case"message_start":Yh("[SSE] message_start — splitting bubble, user: ".concat(null===(t=r.user)||void 0===t?void 0:t.displayName)),p.flushStreamBufferSync(),p.dispatchStreamEnd(s,{text:c.join("")},{toolCalls:p.config.debugMode||p._debugMode?i([],p.currentToolCalls,!0):void 0,user:l,preserveChips:!0}),p.currentToolCalls=[],s=$v(),c=[],l=r.user,p.dispatchStreamStart(s,l),p.startStreamThrottle(s);break;case"text":r.text&&(Yh("[SSE] Text chunk received (".concat(r.text.length," chars), chunks in this bubble: ").concat(c.length+1,", isReplay: ").concat(r.isReplay)),c.push(r.text),r.isReplay||p.isSleeping?p.dispatchStreamChunk(s,r.text,l):p.bufferStreamText(r.text));break;case"tool_start":if(Yh("Tool execution started: ".concat(r.toolName,", toolCallId: ").concat(r.toolCallId,", displayName: ").concat(r.displayName,", label: ").concat(r.label,", hidden: ").concat(r.hidden)),r.toolName){var o={name:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,input:r.toolInput,startTime:Date.now(),isExecuting:!0};p.currentToolCalls.push(o),p.dispatchToolStart({messageId:s,toolName:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,toolInput:r.toolInput})}break;case"tool_end":if(Yh("Tool execution ended: ".concat(r.toolName,", toolCallId: ").concat(r.toolCallId,", displayName: ").concat(r.displayName,", label: ").concat(r.label,", hidden: ").concat(r.hidden)),r.toolName)(o=p.currentToolCalls.find(function(e){return r.toolCallId?e.toolCallId===r.toolCallId:e.name===r.toolName&&e.isExecuting}))&&(o.result=r.toolResult,o.error=r.toolError,o.label=r.label,o.hidden=r.hidden,o.endTime=r.toolBatchDurationMs&&null!=o.startTime?o.startTime+r.toolBatchDurationMs:Date.now(),o.isExecuting=!1,r.toolInput&&(o.input=r.toolInput)),"toggle_debug"===r.toolName&&(p._debugMode=!p._debugMode),p.dispatchToolEnd({messageId:s,toolName:r.toolName,toolCallId:r.toolCallId,displayName:r.displayName,label:r.label,hidden:r.hidden,toolInput:r.toolInput,toolResult:r.toolResult,toolError:r.toolError});break;case"done":if(p.stopTyping(),r.response){r.response.sessionId&&(p._sessionId=r.response.sessionId,p.dispatch(ag(p._sessionId)),ug(void 0,r.response.sessionId));var d=c.join("");Yh("[SSE] Done event received. Chunks in this bubble: ".concat(c.length,", accumulated text length: ").concat(d.length)),Yh("[SSE] First 100 chars of accumulated: ".concat(d.substring(0,100)));var f=r.response.suggestions,v=null==f?void 0:f.map(function(e){return{label:e.title,actionUrl:e.url||""}});(null==v?void 0:v.length)&&Yh("[SSE] Suggestions: ".concat(v.length," items"));var g=r.response.sources;(null==g?void 0:g.length)&&Yh("[SSE] Sources: ".concat(g.length," items"));var y={text:d||(s!==a?"":r.response.response)||"",options:v,sources:g,displays:r.response.displays},b=p.config.debugMode||p._debugMode?i([],p.currentToolCalls,!0):void 0;p.flushStreamBuffer().then(function(){p.dispatchStreamEnd(s,y,{toolCalls:b,user:l}),p.currentToolCalls=[],h()})}else p.stopStreamThrottle(),h();break;case"replay_complete":p.isReplaying=!1,Yh("[SSE] Replay complete: replayed ".concat(r.replayedCount," events, currentSeq: ").concat(r.currentSeq));break;case"replay_partial":p.isReplaying=!1,Yh("[SSE] Replay partial: some events unavailable, oldestAvailableSeq: ".concat(r.oldestAvailableSeq));break;case"error":if(u=!0,p.stopTyping(),p.stopStreamThrottle(),Gh("SSE error: ".concat(r.error)),r.code===Xv){m(ng(r.error,rg(r.retryAfter)));break}m(new Error(r.error||"Server error during processing"))}}else Yh("[SSE] Ignoring stale event for messageId: ".concat(a,", current: ").concat(p.currentMessageId))},onerror:function(e){if(p.currentMessageId===a&&!u){u=!0,p.isReplaying=!1,p.isSleeping?(Yh("[MCPChat] SSE error during sleep - will request replay on wakeup"),p.needsReplayOnWakeup=!0,p.streamingMessageIdForThrottle&&p.dispatchStreamAbort(s),p.stopStreamThrottle()):p.stopStreamThrottle(),f=e instanceof Error?e:new Error(String(e));var t=(null==e?void 0:e.statusCode)||d;t&&(f.statusCode=t),Gh("SSE connection error: ".concat(e))}throw e}}).catch(function(e){if(p.stopStreamThrottle(),u||p.currentMessageId!==a)m(f||e);else{var t=(null==e?void 0:e.statusCode)||d,n=e instanceof Error?e:new Error(String(e));t&&(n.statusCode=t),m(n)}})})]})})},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(e,n,r){this.visitorInfo=e,this._attributes=t({},this.visitorInfo.attributes),this.conversationOnScreen=!0===e.hasConversation;var i=new URL(window.location.href);(null==i?void 0:i.host.toLowerCase().startsWith("localhost"))?this._attributes.isLocal=!0:this._attributes.currentUrl=window.location.href,this._accessToken=this.visitorInfo.accessToken,this.startSession(n),this._sessionId?this.validateSession():this.initializeNewSession(),this.isInitializingSession&&this.typing(),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t(new Error("File upload not supported in MCP mode"))},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){this.stopStreamThrottle(),this.abortController&&(this.abortController.abort(),this.abortController=void 0)},e.prototype.sleep=function(){this.isSleeping=!0,this.streamingMessageIdForThrottle?(this.needsReplayOnWakeup=!1,Yh("[MCPChat] sleep() - stream in progress, keeping SSE connection alive"),this.streamBuffer.length>0&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),this.streamThrottleTimer&&(clearInterval(this.streamThrottleTimer),this.streamThrottleTimer=void 0),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=void 0)):(this.stopStreamThrottle(),this.isReplaying=!1,this.abortController&&(this.abortController.abort(),this.abortController=void 0))},e.prototype.wakeup=function(){if(this.isSleeping=!1,this.streamingMessageIdForThrottle&&this.abortController)Yh("[MCPChat] wakeup() - stream still in progress, restarting throttle"),this.streamBuffer.length>0&&(this.dispatchStreamChunk(this.streamingMessageIdForThrottle,this.streamBuffer),this.streamBuffer=""),this.startStreamThrottle(this.streamingMessageIdForThrottle);else if(this.needsReplayOnWakeup){if(this.needsReplayOnWakeup=!1,void 0!==this.lastSeq&&this._sessionId)return Yh("[MCPChat] wakeup() - connection lost during sleep, requesting replay"),void this.requestReplay();Gh("[MCPChat] wakeup() - cannot replay, missing lastSeq (".concat(this.lastSeq,") or sessionId (").concat(this._sessionId,")"))}this._sessionId&&(Yh("[MCPChat] Wakeup - session exists, lastSeq: ".concat(this.lastSeq)),this.setConnectionStatus("online"))},e.prototype.requestReplay=function(){return n(this,void 0,void 0,function(){var e,t;return r(this,function(n){switch(n.label){case 0:if(this.isRequestingReplay)return Yh("[MCPChat] Replay already in progress, skipping"),[2];this.isRequestingReplay=!0,this.typing(),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,this.performSSERequest(this.buildRequestPayload())];case 2:return n.sent(),Yh("[MCPChat] Replay request completed"),[3,5];case 3:return e=n.sent(),t=null==e?void 0:e.statusCode,Gh("[MCPChat] Replay request failed: ".concat(e,", statusCode: ").concat(t)),Gv(e)&&this.setConnectionStatus("offline"),[3,5];case 4:return this.stopTyping(),this.isRequestingReplay=!1,[7];case 5:return[2]}})})},e.prototype.notifyDisconnecting=function(e){if(void 0===e&&(e="close_tab"),this._sessionId){var t=this.getCloseEndpoint(),n=JSON.stringify({sessionId:this._sessionId,userId:this._userId||void 0,reason:e,messageCount:this.sentMessageCount,durationMs:void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:0});if(Yh("[MCPChat] notifyDisconnecting: reason=".concat(e,", endpoint=").concat(t)),"widget_close"===e&&"undefined"!=typeof fetch){var r={"Content-Type":"application/json"};return this.config.authToken&&(r.Authorization="Bearer ".concat(this.config.authToken)),void fetch(t,{method:"POST",headers:r,body:n,keepalive:!0})}if("undefined"!=typeof navigator&&navigator.sendBeacon){var i=new Blob([n],{type:"application/json"});navigator.sendBeacon(t,i)}}},e.prototype.startSession=function(e){this.userIdIsServerAssigned?Yh("[startSession] Preserving server-assigned userId: ".concat(this._userId)):this.visitorInfo.visitorId?this._userId="".concat(this.visitorInfo.visitorId):this.visitorInfo.email?this._userId="mcp-widget-user-".concat(this.visitorInfo.email):this._userId||(this._userId="mcp-widget-user-".concat($v())),e?(this._sessionId=e,Yh("Using provided session id: ".concat(this._sessionId))):""===e?(this._sessionId="mcp-widget-session-".concat($v()),this.dispatch(ag(this._sessionId)),Yh("Using generated session id: ".concat(this._sessionId))):!this._sessionId&&this.config.sessionId?(this._sessionId=this.config.sessionId,Yh("Using config session id: ".concat(this._sessionId))):this._sessionId?Yh("Keeping existing session id: ".concat(this._sessionId)):(this._sessionId="mcp-widget-session-".concat($v()),this.dispatch(ag(this._sessionId)),Yh("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0},Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},enumerable:!1,configurable:!0}),e}();function mg(e){if(e)return"string"==typeof e?{displayText:e}:e}function vg(e,n){var r,i,o,a,s,l,c,u,d;if(void 0===n&&(n=(new Date).getTime()),!e)return l;var f=mg(e.outputSpeech),p=mg(e.reprompt);return f&&(c=f.displayText,u=f.html),"TRANSFER_CALL"===e.system?l={type:"handOff",timestamp:n,handoffMessage:c,handoffTarget:null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.transferPhoneNumber,endSession:!1,user:void 0}:(null===(i=e.system)||void 0===i?void 0:i.startsWith("PERMISSION_"))?l=function(e,t){var n,r=function(e){switch(e){case"PERMISSION_EMAIL":return"EMAIL";case"PERMISSION_LOCATION_PRECISE":return"LOCATION_PRECISE";default:throw new Error("Unsupported permission: ".concat(e))}}(e.system),i=mg(e.outputSpeech),o=e.data.permissionPrimerAccepted,a=e.data.permissionDenied;return{type:"permissionRequest",timestamp:t,msg:{text:null!==(n=null==i?void 0:i.displayText)&&void 0!==n?n:"".concat(e.data.permissionRequestTTSContext),permissionRequest:{time:t,type:r,approve:"object"==typeof o?vg({outputSpeech:o}).msg:void 0,deny:"object"==typeof a?vg({outputSpeech:a}).msg:void 0}},endSession:!1,user:void 0}}(e,n):(d=!p||!(p.displayText||p.ssml),l={type:"msg",timestamp:n,msg:{displays:e.displays,context:null===(a=null===(o=e.context)||void 0===o?void 0:o.active)||void 0===a?void 0:a.map(function(e){return e.name})},endSession:d,user:void 0},c&&!u&&(l.msg=t(t({},l.msg),{text:c})),u&&(l.msg=t(t({},l.msg),{html:u})),(null===(s=null==f?void 0:f.suggestions)||void 0===s?void 0:s.length)&&(l.msg.options=f.suggestions.map(function(e){return"string"==typeof e?e:{label:e.title,actionUrl:e.url}}))),l}var gg=function(){function e(e,t){this._userId="",this._sessionId="",this._accessToken="",this._attributes={},this.config=e,this.options=t,this.configurableMessages=t.configurableMessages,this.isNewSession=!1,this.hooks=t.hooks}return e.prototype.init=function(e){this.dispatch=e,Yh("got init auth: ".concat(this.config.key)),this.setConnectionStatus("online"),this.setAccountStatus("online")},e.prototype.setConnectionStatus=function(e){Yh("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(xm(e))},e.prototype.setAccountStatus=function(e){Yh("SERVER: account_status: ".concat(JSON.stringify(e))),this.dispatch(wm(e))},e.prototype.sendNewMessage=function(e){Yh("SERVER: new message: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.msg",user:t(t({},e.user),{nick:"agent:robot"}),msg:e.msg,timestamp:+new Date}})},e.prototype.userJoined=function(e){Yh("SERVER: user joined: ".concat(JSON.stringify(e))),this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:t(t({},e.user),{nick:"agent:robot"}),timestamp:+new Date}})},e.prototype.typing=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!0,timestamp:+new Date}})},e.prototype.stopTyping=function(){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!1,timestamp:+new Date}})},e.prototype.sendFailureMessage=function(e,t,n){this.stopTyping(),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:{nick:"agent:robot"},failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeOut")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeIn")})})},e.prototype.getBot=function(e){var n,r=null===(n=this.options)||void 0===n?void 0:n.bot;return e?e.displayName&&e.nick&&e.avatarPath?e:t(t({},e),{nick:e.nick||r.nick||"Bot",displayName:e.displayName||r.displayName||"Bot",avatarPath:e.avatarPath||r.avatarPath}):r},e.prototype.sendChatMsgRequest=function(e,i){return n(this,void 0,void 0,function(){var n,o;return r(this,function(r){switch(r.label){case 0:return[4,this.postMessage(e)];case 1:return n=r.sent(),(null===(o=n.user)||void 0===o?void 0:o.displayName)||(n=t(t({},n),{user:this.getBot(n.user)})),this.sendNewMessage(n),i(),[2]}})})},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(e,n,r){this.visitorInfo=e,this._attributes=t({},this.visitorInfo.attributes);var i=new URL(window.location.href);(null==i?void 0:i.host.toLowerCase().startsWith("localhost"))?this._attributes.isLocal=!0:this._attributes.currentUrl=window.location.href;var o=qv(document.referrer);o&&(this._attributes.referrer=o),this._accessToken=this.visitorInfo.accessToken,this.userJoined({user:this.getBot(void 0),token:""}),this.startSession(n),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var i,o,a,s,l,c,u,d,f,p,h,m,v,g,y,b,w,x,k,S,C,_,E,N,I,T,j,O,P,A,R,M=this;return r(this,function(L){switch(L.label){case 0:o=this._userId,a=this._sessionId,s=this._accessToken,l=function(e,n){for(var r=e||{},i=t({},n),o=0,a=Object.entries(r);o<a.length;o++){var s=a[o],l=s[0],c=s[1];void 0!==c&&(i[l]=c)}return i}(this._attributes,Lv()),(c=localStorage.getItem("xa_rwg_token"))&&(l.rwg_token=c),(u=localStorage.getItem("xa_merchant_id"))&&(l.merchant_id=u),(d=localStorage.getItem("xa_environment"))&&(l.environment=d),(f=localStorage.getItem("xa_enablePreferredTime"))&&(l.enablePreferredTime=f),(p=localStorage.getItem("xa_service"))&&(l.service=p),(h=localStorage.getItem("xa_origin"))&&(l.origin=h),Pv(l),l.currentTime=(new Date).toISOString(),m=(new Date).getTime(),this.isNewSession&&!(null===(j=null==e?void 0:e.msg)||void 0===j?void 0:j.text)?i={type:"LAUNCH_REQUEST",rawQuery:null===(O=null==e?void 0:e.msg)||void 0===O?void 0:O.text,sessionId:a,userId:o,isNewSession:!0,intentId:"LaunchRequest",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l}:(v=null===(P=e.msg)||void 0===P?void 0:P.permissionRequest)?(e=t(t({},e),{msg:t(t({},e.msg),{permissionRequest:void 0})}),g=m-v.time>3e5,y=null===(A=e.msg.text)||void 0===A?void 0:A.toLowerCase(),b=!g,w={id:this._userId},g||("EMAIL"===v.type&&(x=function(e){var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())}(y),b=x,w.email=this.visitorInfo.email,w.name=this.visitorInfo.displayName,this.visitorInfo.email=y),"LOCATION_PRECISE"===v.type&&(b=!!e.msg.location,w.preciseLocation=e.msg.location?{coordinates:{latitude:e.msg.location.latitude,longitude:e.msg.location.longitude}}:void 0)),i={type:"PERMISSION_GRANT",rawQuery:e.msg.text,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,granted:b,userProfile:w,intentId:"PermissionGrant",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l}):i="custom"===e.type?t(t({},JSON.parse(e.payload)),{sessionId:this._sessionId,userId:this._userId,isNewSession:!1,platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l}):e.msg.token?{type:"OPTION_SELECT_REQUEST",token:e.msg.token,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,intentId:"OptionSelect",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l}:{type:"INTENT_REQUEST",rawQuery:e.msg.text,sessionId:this._sessionId,userId:this._userId,isNewSession:!1,intentId:"NLU_RESULT_PLACEHOLDER",platform:"stentor-platform",channel:"widget",accessToken:s,attributes:l},Yh("Visitor says: ".concat(JSON.stringify(i,void 0,2))),k=og(this.configurableMessages),C=!1,_=function(e){S=e,C=!0},E=function(e,t){return n(M,void 0,void 0,function(){var n,i,o;return r(this,function(r){return n=k[e].retry,i=k[e].delay,o=k[e].text,Gh("POST failed: ".concat(t)),this.sendFailureMessage(n,i,o),S={errorText:""},[2,new Promise(function(e){setTimeout(e,1e3*i)})]})})},N=1,L.label=1;case 1:return N<k.length?(I=this.config.timeout||22e3,Yh("POST attempt ".concat(N," with timeout ").concat(I)),this.typing(),[4,new Dh({retries:1,timeout:I}).fetch(function(e){return function(e,t,i,o){return n(this,void 0,void 0,function(){var n,a;return r(this,function(r){switch(r.label){case 0:return n=JSON.stringify(e),Yh("URL: ".concat(t)),Yh("BODY: ".concat(n)),[4,fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(i)},body:n,mode:"cors",signal:o})];case 1:if(!(a=r.sent()).ok)throw new Error("Status ".concat(a.status,", Text: ").concat(a.statusText));return[2,a.json()]}})})}(i,M.config.url,M.config.key,e)}).then(_).catch(E.bind(this,N))]):[3,4];case 2:if(L.sent(),C)return[3,4];L.label=3;case 3:return N++,[3,1];case 4:return Yh("Bot says: ".concat(JSON.stringify(S,void 0,2))),this.isNewSession=!1,T=vg(S),!(null==S?void 0:S.hasOwnProperty("errorText"))&&S||((T={type:"userLeft",timestamp:m,msg:{},user:void 0,endSession:!0}).msg={text:(null==S?void 0:S.hasOwnProperty("errorText"))?S.errorText:"The assistant is not responding right now. Please close the widget and open it again."}),"function"==typeof(null===(R=this.hooks)||void 0===R?void 0:R.onResponse)&&this.hooks.onResponse(S),this.stopTyping(),[2,T]}})})},e.prototype.startSession=function(e){this.visitorInfo.visitorId?this._userId="".concat(this.visitorInfo.visitorId):this.visitorInfo.email?this._userId="stentor-widget-user-".concat(this.visitorInfo.email):this._userId="stentor-widget-user-".concat($v()),e?(this._sessionId=e,Yh("Using persisted session id: ".concat(this._sessionId))):(this._sessionId="stentor-widget-session-".concat($v()),this.dispatch(ag(this._sessionId)),Yh("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0},Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},enumerable:!1,configurable:!0}),e}();var yg=function(){function e(){}return e.prototype.init=function(){},e.prototype.sendOfflineMsg=function(){},e.prototype.sendChatMsg=function(){},e.prototype.sendChatMsgRequest=function(){},e.prototype.sendTyping=function(){},e.prototype.setVisitorInfo=function(){},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(){},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){},e.prototype.bargeOut=function(){},e.prototype.bargeIn=function(){},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e}();function bg(e,n,r,i,o,a,s){var l,c,u,d,f,p,h=(new Date).getTime();if(r&&!(null===(l=null==e?void 0:e.msg)||void 0===l?void 0:l.text))p={type:"LAUNCH_REQUEST",rawQuery:null===(c=null==e?void 0:e.msg)||void 0===c?void 0:c.text,sessionId:i,userId:n,isNewSession:!0,intentId:"LaunchRequest",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a};else{var m=null===(u=e.msg)||void 0===u?void 0:u.permissionRequest;if(m){e=t(t({},e),{msg:t(t({},e.msg),{permissionRequest:void 0})});var v=h-m.time>3e5,g=null===(d=e.msg.text)||void 0===d?void 0:d.toLowerCase(),y=!v,b={id:n};if(!v){if("EMAIL"===m.type){var w=function(e){var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())}(g);y=w,b.email=s.email,b.name=s.displayName,this.visitorInfo.email=g}"LOCATION_PRECISE"===m.type&&(y=!!e.msg.location,b.preciseLocation=e.msg.location?{coordinates:{latitude:e.msg.location.latitude,longitude:e.msg.location.longitude}}:void 0)}p={type:"PERMISSION_GRANT",rawQuery:e.msg.text,sessionId:i,userId:n,isNewSession:!1,granted:y,userProfile:b,intentId:"PermissionGrant",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a}}else p="custom"===e.type?t(t({},JSON.parse(e.payload)),{sessionId:i,userId:n,isNewSession:!1,platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a}):e.msg.token?{type:"OPTION_SELECT_REQUEST",token:e.msg.token,sessionId:i,userId:n,isNewSession:!1,intentId:"OptionSelect",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a}:{type:"INTENT_REQUEST",rawQuery:e.msg.text,sessionId:i,userId:n,isNewSession:!1,intentId:"NLU_RESULT_PLACEHOLDER",platform:"stentor-platform",channel:"widget",accessToken:o,attributes:a}}return(null===(f=e.msg)||void 0===f?void 0:f.attributes)&&(p.attributes=t(t({},p.attributes),e.msg.attributes)),p}var wg="router",xg={deviceId:"Router",userId:wg,displayName:"XAPP Server"},kg=function(){function e(e,t){var n,r,i,o,a;this.isDisposed=!1,this._userId="",this._sessionId="",this.accessToken="",this.attributes={},this.routerAttributes={},this.isAdmin=!1,this.urlAttributes={},this.handlers={},this.sleepTimeoutId=null,this.receivedMessageIds=new Set,this.MESSAGE_DEDUP_CACHE_SIZE=1e3,this.config=e,this.options=t;var s=new URL(this.config.url);this.appId=s.searchParams.get("appId");var l=new URL(window.location.href);if(this.isAdmin="true"===l.searchParams.get("isAdmin"),this.appId)this.serverUrl=this.config.url,this.urlAttributes.path=null===(n=s.pathname)||void 0===n?void 0:n.split("/");else{this.serverUrl="".concat(s.origin);var c=null===(r=s.pathname)||void 0===r?void 0:r.split("/");c&&c.length>1&&(this.serverUrl="".concat(this.serverUrl,"/").concat(c[1]),this.urlAttributes.path=c.slice(1))}Yh("WS url: ".concat(this.serverUrl," isAdmin: ").concat(this.isAdmin," attributes: ").concat(JSON.stringify(this.attributes)," appId: ").concat(this.appId)),this.configurableMessages=og(t.configurableMessages),this.noOfServerErrors=0,this.SLEEP_DELAY_MS=null!==(a=null===(o=null===(i=null==t?void 0:t.env)||void 0===i?void 0:i.connection)||void 0===o?void 0:o.backgroundSleepDelay)&&void 0!==a?a:6e4,Yh("Background sleep delay set to ".concat(this.SLEEP_DELAY_MS,"ms"))}return e.prototype.init=function(e){var n,r,i=this;this.dispatch=e,Yh("INIT called - setting initial accountStatus to OFFLINE"),this.setAccountStatus("offline"),this.handlers["connection update"]=function(e,t,n,r){Yh("Connection update received. Session created: ".concat(e.sessionCreated," Error: ").concat(e.errorMessage||"")),e.sessionCreated?(i.sessionCreated=!0,i.setConnectionStatus("online")):(Gh("SERVER: something is wrong. Going offline."),i.dispatch(wm("offline")),i.dispatch(xm("offline")))},this.handlers["account status"]=function(t,n,r,i){e({type:"account_status",detail:{status:"online",timestamp:r||(new Date).getTime()}})},this.handlers.failure=function(e,t,n,r){Gh("SERVER: something's failed: type: ".concat(e.type," tries: ").concat(e.tries," error: ").concat(e.error));var o=i.configurableMessages[e.tries],a=o.retry,s=o.delay,l=o.text;i.sendFailureMessage(a,e.delay||s,l,t)},this.handlers["new message"]=function(e,n,r,o,a){var s,l;if(a){if(a.length>256)return void Yh("Rejecting message with oversized messageId (".concat(a.length," chars)"));if(i.receivedMessageIds.has(a))return void Yh("Deduplicating message with id: ".concat(a));if(i.receivedMessageIds.add(a),i.receivedMessageIds.size>i.MESSAGE_DEDUP_CACHE_SIZE)for(var c=Math.floor(.1*i.MESSAGE_DEDUP_CACHE_SIZE),u=i.receivedMessageIds.values(),d=0;d<c;d++){var f=u.next().value;f&&i.receivedMessageIds.delete(f)}}if("Bot"===n.deviceId){var p=e;o&&"object"==typeof o&&Object.keys(o).length>0&&(i.routerAttributes=t({},o),Yh("Extracted router attributes: ".concat(JSON.stringify(i.routerAttributes)))),"function"==typeof(null===(s=i.options.hooks)||void 0===s?void 0:s.onResponse)&&i.options.hooks.onResponse(p),i.isNewSession&&(i.isNewSession=!1,Yh("Session initialized after receiving first bot response")),l=vg(p)}else"Widget"===n.deviceId?l=function(e,t){if(void 0===t&&(t=(new Date).getTime()),e)return{type:"msg",timestamp:t,msg:{text:e.rawQuery},endSession:!1,user:void 0}}(e):Gh("Unknown sender device Id: ".concat(n.deviceId));i.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:n.displayName||n.email||n.userId,nick:Sg(n),avatarPath:n.avatarPath},msg:l.msg,timestamp:r||(new Date).getTime()}})},this.handlers["user joined"]=function(e,t,n,r){var o,a,s=Sg(t);Yh('Received "user joined" event - deviceId: '.concat(t.deviceId,", userId: ").concat(t.userId,", displayName: ").concat(t.displayName,", nick: ").concat(s)),Yh("Dispatching chat.memberjoin for ".concat(t.displayName||"Unknown"));var l=e;i.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{avatarPath:t.avatarPath||(null===(a=null===(o=i.options)||void 0===o?void 0:o.bot)||void 0===a?void 0:a.avatarPath),displayName:t.displayName,nick:s},timestamp:n||(new Date).getTime(),showDivider:null==l?void 0:l.showDivider,message:null==l?void 0:l.message,hideUserInfo:null==l?void 0:l.hideUserInfo}}),Yh("chat.memberjoin dispatched for nick: ".concat(s))},this.handlers["user left"]=function(e,t,n,r){var o=e;i.dispatch({type:"chat",detail:{type:"chat.memberleave",user:{avatarPath:t.avatarPath,displayName:t.displayName,nick:Sg(t)},timestamp:n||(new Date).getTime(),showDivider:null==o?void 0:o.showDivider,message:null==o?void 0:o.message}})},this.handlers.typing=function(e,t,n,r){i.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:Sg(t)},typing:!0,timestamp:n||(new Date).getTime()}})},this.handlers["stop typing"]=function(e,t,n,r){i.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:Sg(t)},typing:!1,timestamp:n||(new Date).getTime()}})},this.handlers.disconnect=function(){Yh("DISCONNECT event received from server"),Gh("SERVER: requested disconnect"),i.dispatch(wm("offline")),i.dispatch(xm("offline"))},this.handlers.reconnect=function(){i.dispatch(wm("online")),i.dispatch(xm("online"))},this.handlers["reconnect failed"]=function(e){Gh("SERVER: says re-connect failed"),i.dispatch(wm("offline")),i.dispatch(xm("offline"))},this.handlers["reconnect error"]=function(e){Gh("SERVER: says there was an error while re-connecting"),i.dispatch(wm("offline"))},this.handlers["display button"]=function(e,t,n,r){Yh('Received "display button" event - id: '.concat(e.id,", text: ").concat(e.text,", pressBehavior: ").concat(e.pressBehavior)),i.dispatch(km({id:e.id,text:e.text,pressBehavior:e.pressBehavior||"none"}))},this.handlers["dismiss button"]=function(e,t,n,r){Yh('Received "dismiss button" event - id: '.concat(e.id)),i.dispatch(km({id:e.id,text:"",pressBehavior:"none",isDismissing:!0})),setTimeout(function(){i.dispatch({type:"ws_button_dismiss",detail:{id:e.id,timestamp:+new Date}})},300)},this.handlers["system-message"]=function(e,t,n,r){Yh('Received "system-message" event - id: '.concat(e.id,", message: ").concat(e.message,", dismissId: ").concat(e.dismissId)),e.dismissId&&i.dispatch({type:"chat",detail:{type:"chat.systemmessagedismiss",user:{displayName:t.displayName||"System",nick:Sg(t)},id:e.dismissId,timestamp:n||(new Date).getTime()}}),i.dispatch({type:"chat",detail:{type:"chat.systemmessage",user:{displayName:t.displayName||"System",nick:Sg(t)},id:e.id,message:e.message,dismissId:e.dismissId,timestamp:n||(new Date).getTime()}})},this.handlers["system-message-dismiss"]=function(e,t,n,r){Yh('Received "system-message-dismiss" event - id: '.concat(e.id)),i.dispatch({type:"chat",detail:{type:"chat.systemmessagedismiss",user:{displayName:t.displayName||"System",nick:Sg(t)},id:e.id,timestamp:n||(new Date).getTime()}})},this.handlers["missed messages"]=function(e,t,n,r){var o,a=e;Yh('Received "missed messages" event with '.concat((null===(o=null==a?void 0:a.messages)||void 0===o?void 0:o.length)||0," messages")),(null==a?void 0:a.messages)&&Array.isArray(a.messages)&&a.messages.forEach(function(e){Yh("Processing missed message: event=".concat(e.event,", messageId=").concat(e.messageId));var t=i.handlers[e.event];t&&"missed messages"!==e.event?t(e.data,e.sender,e.timeMs,e.attributes,e.messageId):Yh("No handler for missed message event: ".concat(e.event))})},this.handlers["request missed messages"]=function(){Yh("Request missed messages handler (no-op on client side)")},this.handlers["user backgrounded"]=function(){Yh("User backgrounded handler (no-op on client side)")},this.handlers["user foregrounded"]=function(){Yh("User foregrounded handler (no-op on client side)")},this.handlers["user disconnecting"]=function(){Yh("User disconnecting handler (no-op on client side)")},this.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{avatarPath:null===(r=null===(n=this.options)||void 0===n?void 0:n.bot)||void 0===r?void 0:r.avatarPath,displayName:xg.displayName,nick:Sg(xg)},timestamp:(new Date).getTime()}}),this.setAccountStatus("online"),this.setConnectionStatus("online")},e.prototype.autoReconnect=function(e){var t=this;0===this.noOfServerErrors&&this.setConnectionStatus("pending");var n=this.setAccountStatus.bind(this),r=this.setConnectionStatus.bind(this);function i(){var t=setInterval(function(){var o=e();o?(Yh("Re-created WS connection"),o.onopen=function(){Yh("Re-opened WS connection"),n("online"),r("online"),o.onclose=function(){Yh("WebSocket ONCLOSE event - connection closed unexpectedly"),Yh("Closed WS connection (onclosed was called)"),i()},clearInterval(t)}):clearInterval(t)},5e3)}Yh("Creating WS connection");var o=e();o&&(o.onclose=function(){Yh("WebSocket ONCLOSE event (initial) - connection closed"),Yh("Closed WS connection (onclosed was called)"),i()},this.ws.onopen=function(){Yh("WebSocket ONOPEN event - connection established"),Yh("Opened WS connection (onopen was called)"),t.setAccountStatus("online"),t.setConnectionStatus("online")})},e.prototype.wsClose=function(){this.ws&&(Yh("wsClose() - Closing WebSocket (readyState: ".concat(this.ws.readyState,")")),this.ws.onclose=null,this.ws.onerror=null,this.ws.onopen=null,this.ws.onmessage=null,this.ws.close())},e.prototype.wsCreate=function(e){var t=this;if(!this.isDisposed){Yh('Trying to re-connect. Reason: "'.concat(e,'"'));var n=new URL(this.serverUrl);if(n.searchParams.set("userId",this._userId),n.searchParams.set("isAdmin","".concat(this.isAdmin)),n.searchParams.set("createWsReason",e),this.ws&&this.ws.readyState!==WebSocket.CLOSED&&this.ws.readyState!==WebSocket.CLOSING){var r=this.ws.readyState;Yh("Forced WS close. State: ".concat(r));try{this.wsClose()}catch(e){e("Failed to close WS (ready state: ".concat(r,"): ").concat(e))}}return this.ws=new WebSocket(n.toString()),this.ws.onerror=function(e){var r;Gh("Error in WS connection. Url: ".concat(n.toString()," Type: ").concat(e?e.type:"?"," Ready State: ").concat(null===(r=t.ws)||void 0===r?void 0:r.readyState))},this.ws.onmessage=function(e){Yh("ROUTER says: ".concat(e.data));var n=JSON.parse(e.data);t.handlers[n.event]?t.handlers[n.event](n.data,n.sender,n.timeMs,n.attributes,n.messageId):Gh("Unknown router message event: ".concat(n.event))},this.ws}Yh("Stopping reconnect for disposed router connector")},e.prototype.checkConnection=function(){var e;return(null===(e=this.ws)||void 0===e?void 0:e.readyState)===WebSocket.OPEN},e.prototype.emit=function(e,t){return n(this,void 0,void 0,function(){var n,i,o=this;return r(this,function(r){switch(r.label){case 0:return n={event:e,data:t,sender:this.visitorInfo,sessionId:this._sessionId,timeMs:(new Date).getTime()},this.routerAttributes&&Object.keys(this.routerAttributes).length>0&&(n.attributes=this.routerAttributes,Yh("Adding router attributes to outgoing payload: ".concat(JSON.stringify(this.routerAttributes)))),i=JSON.stringify(n),Yh("Widget says: ".concat(i)),this.ws||this.autoReconnect(this.wsCreate.bind(this,"emitNoWs")),[4,Cg(this.checkConnection.bind(this),1e3,1e4,"connection").then(function(e){e>0&&Yh("Connection is ready in ".concat(e," ms")),o.ws.send(i),o.noOfServerErrors=0}).catch(function(e){Gh("Connection wait timed out in ".concat(e," ms (show error)")),o.setConnectionStatus("online")})];case 1:return r.sent(),[2]}})})},e.prototype.setAccountStatus=function(e){Yh("setAccountStatus: ".concat(e)),Yh("SERVER account_status: ".concat(JSON.stringify(e))),this.dispatch(wm(e))},e.prototype.setConnectionStatus=function(e){Yh("setConnectionStatus: ".concat(e)),Yh("SERVER: connection_update: ".concat(JSON.stringify(e))),this.dispatch(xm(e))},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(n){return[2,this.sendChatMsgRequest({msg:e,timestamp:(new Date).getTime(),agent:!1,user:void 0,type:"msg"},t)]})})},e.prototype.sendFailureMessage=function(e,t,n,r){this.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:Sg(r)},typing:!1,timestamp:+new Date}}),this.dispatch({type:"chat",detail:{type:"chat.failureMsg",user:{nick:Sg(r)},failureMsg:{retry:e,delay:t,text:n},timestamp:+new Date}})},e.prototype.sendDisconnectMessage=function(){this.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:"Server",nick:Sg(xg),avatarPath:xg.avatarPath},msg:{text:0===this.noOfServerErrors?"I cannot connect to the server. Please try later.":"Nope. Still no luck. I still cannot connect to the server. Please don't give up."},timestamp:(new Date).getTime()}}),this.noOfServerErrors++},e.prototype.checkSession=function(){return this.sessionCreated},e.prototype.sendChatMsgRequest=function(e,t){return n(this,void 0,void 0,function(){var n=this;return r(this,function(r){switch(r.label){case 0:return this.checkSession()||this.setConnectionStatus("pending"),[4,Cg(this.checkSession.bind(this),1e3,1e4,"session creation").then(function(t){t>0&&Yh("Session creation is ready in ".concat(t," ms")),n.postMessage(e)}).catch(function(e){Gh("Session creation wait timed out in ".concat(e," ms")),n.setConnectionStatus("online"),n.sendDisconnectMessage()})];case 1:return r.sent(),this.setConnectionStatus("online"),t(),[2]}})})},e.prototype.sendTyping=function(e){},e.prototype.setVisitorInfo=function(e,n,r){Yh("Visitor Info Message = ".concat(JSON.stringify(e))),this.visitorInfo={deviceId:"Widget",userId:e.userId,displayName:e.displayName||e.name,email:e.email,isAdmin:this.isAdmin,urlAttributes:this.urlAttributes},this.attributes=t(t(t({},e.attributes),this.attributes),{currentUrl:window.location.href}),this.accessToken=e.accessToken,this.startSession(n),this.postVisitorInfo(),r()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){Yh("DISPOSE called - cleaning up connection"),this.isDisposed=!0,this.sleepTimeoutId&&(clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null),this.ws&&this.wsClose(),Yh("Closed web socket (dispose)")},e.prototype.sleep=function(){var e=this;Yh("SLEEP called - scheduling delayed close"),this.checkConnection()&&(Yh("SLEEP - Notifying router of user backgrounded"),this.emit("user backgrounded")),this.sleepTimeoutId&&(clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null),this.sleepTimeoutId=window.setTimeout(function(){e.ws&&e.wsClose(),Yh("SLEEP - closed web socket after ".concat(e.SLEEP_DELAY_MS,"ms delay")),e.sleepTimeoutId=null},this.SLEEP_DELAY_MS),Yh("SLEEP - WebSocket will close in ".concat(this.SLEEP_DELAY_MS,"ms if not woken up"))},e.prototype.wakeup=function(){var e=this;if(Yh("WAKEUP called - userId:",this._userId),this.sleepTimeoutId)return clearTimeout(this.sleepTimeoutId),this.sleepTimeoutId=null,Yh("WAKEUP - Cancelled pending sleep, keeping WebSocket open"),void(this.checkConnection()&&(Yh("WAKEUP - Notifying router of user foregrounded"),this.emit("user foregrounded")));this.isDisposed=!1,this._userId?(Yh("WAKEUP - Setting accountStatus and connectionStatus to ONLINE"),this.setAccountStatus("online"),this.setConnectionStatus("online"),Yh("Waking up - setting status to online"),Yh("WAKEUP - Calling autoReconnect"),this.autoReconnect(this.wsCreate.bind(this,"wakeup")),Cg(this.checkConnection.bind(this),100,5e3,"wakeup-connection").then(function(){Yh("WAKEUP - Notifying router of user foregrounded (after reconnect)"),e.emit("user foregrounded"),e.requestMissedMessages()}).catch(function(){Yh("WAKEUP - Connection not ready after 5s, skipping missed messages request")})):Yh("WAKEUP - No userId, returning early")},e.prototype.requestMissedMessages=function(){Yh("Requesting missed messages from server"),this.emit("request missed messages")},e.prototype.notifyDisconnecting=function(){if(this.checkConnection()){Yh("Notifying router of user disconnecting");var e=JSON.stringify({event:"user disconnecting",data:{reason:"tab_close"},sender:this.visitorInfo,sessionId:this._sessionId,timeMs:Date.now()});try{this.ws.send(e)}catch(e){Yh("Failed to send disconnect notification:",e)}}},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){return this.emit("barge out"),[2]})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(t){return this.visitorInfo.displayName=e,this.emit("barge in"),[2]})})},e.prototype.sendButtonPressed=function(e){return n(this,void 0,void 0,function(){var t;return r(this,function(n){return Yh('Sending "button pressed" event - id: '.concat(e)),t={id:e},this.emit("button pressed",t),[2]})})},e.prototype.postVisitorInfo=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return this.sessionCreated=!1,this.emit("user joined"),[2]})})},e.prototype.postMessage=function(e){return n(this,void 0,void 0,function(){var t,n,i,o,a,s,l,c,u,d,f;return r(this,function(r){return t=this._userId,n=this._sessionId,i=this.accessToken,o=this.attributes||{},(a=localStorage.getItem("xa_rwg_token"))&&(o.rwg_token=a),(s=localStorage.getItem("xa_merchant_id"))&&(o.merchant_id=s),(l=localStorage.getItem("xa_environment"))&&(o.environment=l),(c=localStorage.getItem("xa_enablePreferredTime"))&&(o.enablePreferredTime=c),(u=localStorage.getItem("xa_service"))&&(o.service=u),(d=localStorage.getItem("xa_origin"))&&(o.origin=d),Pv(o),o.currentTime=(new Date).toISOString(),f=bg(e,t,this.isNewSession,n,i,o,this.visitorInfo),this.emit("new message",f),[2]})})},e.prototype.startSession=function(e){this.visitorInfo.userId?this._userId="".concat(this.visitorInfo.userId):this.visitorInfo.email?this._userId="stentor-widget-user-".concat(this.visitorInfo.email):this._userId="stentor-widget-user-".concat($v());var t=new URL(window.location.href).searchParams.get("sessionId");t?(this._sessionId=t,this.dispatch(ag(this._sessionId)),Yh("Using enforced session id: ".concat(this._sessionId))):e?(this._sessionId=e,Yh("Using persisted session id: ".concat(this._sessionId))):(this._sessionId="stentor-widget-session-".concat($v()),this.dispatch(ag(this._sessionId)),Yh("Using generated session id: ".concat(this._sessionId))),this.isNewSession=!0,Yh("Started session: ".concat(this._sessionId))},e}();function Sg(e){return"Bot"===e.deviceId?"agent:bot:".concat(e.userId):"agent:widget:".concat(e.userId)}function Cg(e,t,n,r){var i=0,o=function(a,s){i>=n?s(i):e()?a(i):(i+=t,r&&Yh("Still waiting for ".concat(r," (").concat(i," ms)")),setTimeout(function(e){return o(a,s)},t))};return new Promise(o)}const _g=Object.create(null);_g.open="0",_g.close="1",_g.ping="2",_g.pong="3",_g.message="4",_g.upgrade="5",_g.noop="6";const Eg=Object.create(null);Object.keys(_g).forEach(e=>{Eg[_g[e]]=e});const Ng={type:"error",data:"parser error"},Ig="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Tg="function"==typeof ArrayBuffer,jg=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Og=({type:e,data:t},n,r)=>Ig&&t instanceof Blob?n?r(t):Pg(t,r):Tg&&(t instanceof ArrayBuffer||jg(t))?n?r(t):Pg(new Blob([t]),r):r(_g[e]+(t||"")),Pg=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Ag(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Rg;const Mg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lg="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)Lg[Mg.charCodeAt(e)]=e;const Dg="function"==typeof ArrayBuffer,Bg=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Ug(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:zg(e.substring(1),t)};return Eg[n]?e.length>1?{type:Eg[n],data:e.substring(1)}:{type:Eg[n]}:Ng},zg=(e,t)=>{if(Dg){const n=(e=>{let t,n,r,i,o,a=.75*e.length,s=e.length,l=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const c=new ArrayBuffer(a),u=new Uint8Array(c);for(t=0;t<s;t+=4)n=Lg[e.charCodeAt(t)],r=Lg[e.charCodeAt(t+1)],i=Lg[e.charCodeAt(t+2)],o=Lg[e.charCodeAt(t+3)],u[l++]=n<<2|r>>4,u[l++]=(15&r)<<4|i>>2,u[l++]=(3&i)<<6|63&o;return c})(e);return Ug(n,t)}return{base64:!0,data:e}},Ug=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,Fg=String.fromCharCode(30);function qg(){return new TransformStream({transform(e,t){!function(e,t){Ig&&e.data instanceof Blob?e.data.arrayBuffer().then(Ag).then(t):Tg&&(e.data instanceof ArrayBuffer||jg(e.data))?t(Ag(e.data)):Og(e,!1,e=>{Rg||(Rg=new TextEncoder),t(Rg.encode(e))})}(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let Hg;function Wg(e){return e.reduce((e,t)=>e+t.length,0)}function Vg(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let 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}var $g=Kg;function Kg(e){if(e)return function(e){for(var t in Kg.prototype)e[t]=Kg.prototype[t];return e}(e)}Kg.prototype.on=Kg.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Kg.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Kg.prototype.off=Kg.prototype.removeListener=Kg.prototype.removeAllListeners=Kg.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},Kg.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},Kg.prototype.emitReserved=Kg.prototype.emit,Kg.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Kg.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Qg="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Jg="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function Yg(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const Gg=Jg.setTimeout,Xg=Jg.clearTimeout;function Zg(e,t){t.useNativeTimers?(e.setTimeoutFn=Gg.bind(Jg),e.clearTimeoutFn=Xg.bind(Jg)):(e.setTimeoutFn=Jg.setTimeout.bind(Jg),e.clearTimeoutFn=Jg.clearTimeout.bind(Jg))}function ey(e){return"string"==typeof e?function(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}(e):Math.ceil(1.33*(e.byteLength||e.size))}function ty(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class ny extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class ry extends $g{constructor(e){super(),this.writable=!1,Zg(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 ny(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Bg(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(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class iy extends ry{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const 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,t)=>{const n=e.split(Fg),r=[];for(let e=0;e<n.length;e++){const i=Bg(n[e],t);if(r.push(i),"error"===i.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((e,o)=>{Og(e,!1,e=>{r[o]=e,++i===n&&t(r.join(Fg))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=ty()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let oy=!1;try{oy="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Gh){}const ay=oy;function sy(){}class ly extends iy{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const 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}}class cy extends $g{constructor(e,t,n){super(),this.createRequest=e,Zg(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=Yg(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof n.status?n.status:0)},0))},n.send(this._data)}catch(e){return void this.setTimeoutFn(()=>{this._onError(e)},0)}"undefined"!=typeof document&&(this._index=cy.requestsCount++,cy.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=sy,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete cy.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(cy.requestsCount=0,cy.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",uy);else if("function"==typeof addEventListener){addEventListener("onpagehide"in Jg?"pagehide":"unload",uy,!1)}function uy(){for(let e in cy.requests)cy.requests.hasOwnProperty(e)&&cy.requests[e].abort()}const dy=function(){const e=fy({xdomain:!1});return e&&null!==e.responseType}();function fy(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||ay))return new XMLHttpRequest}catch(e){}if(!t)try{return new(Jg[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const py="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class hy extends ry{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=py?{}:Yg(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++){const n=e[t],r=t===e.length-1;Og(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(e){}r&&Qg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ty()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const my=Jg.WebSocket||Jg.MozWebSocket;const vy={websocket:class extends hy{createSocket(e,t,n){return py?new my(e,t,n):t?new my(e,t):new my(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends ry{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=>{const t=function(e,t){Hg||(Hg=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,s){for(n.push(a);;){if(0===r){if(Wg(n)<1)break;const e=Vg(n,1);o=!(128&~e[0]),i=127&e[0],r=i<126?3:126===i?1:2}else if(1===r){if(Wg(n)<2)break;const e=Vg(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(Wg(n)<8)break;const e=Vg(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){s.enqueue(Ng);break}i=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(Wg(n)<i)break;const e=Vg(n,i);s.enqueue(Bg(o?e:Hg.decode(e),t)),r=0}if(0===i||i>e){s.enqueue(Ng);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=qg();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&Qg(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends ly{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=dy&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new cy(fy,this.uri(),e)}}},gy=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,yy=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function by(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=gy.exec(e||""),o={},a=14;for(;a--;)o[yy[a]]=i[a]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const wy="function"==typeof addEventListener&&"function"==typeof removeEventListener,xy=[];wy&&addEventListener("offline",()=>{xy.forEach(e=>e())},!1);class ky extends $g{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=by(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=by(t.host).host);Zg(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const 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?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(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}(this.opts.query)),wy&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},xy.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const 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(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&ky.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}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",ky.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)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":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}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(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const 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,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=ey(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Qg(()=>{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("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const 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"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(ky.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),wy&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=xy.indexOf(this._offlineEventListener);-1!==e&&xy.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ky.protocol=4;class Sy extends ky{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&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;ky.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ky.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function i(){n||(n=!0,c(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,i(),this.emitReserved("upgradeError",n)};function a(){o("transport closed")}function s(){o("socket closed")}function l(e){t&&e.name!==t.name&&i()}const c=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",s),this.off("upgrading",l)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",s),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Cy=class extends Sy{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>vy[e]).filter(e=>!!e)),super(e,n)}};const _y="function"==typeof ArrayBuffer,Ey=Object.prototype.toString,Ny="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Ey.call(Blob),Iy="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Ey.call(File);function Ty(e){return _y&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Ny&&e instanceof Blob||Iy&&e instanceof File}function jy(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(jy(e[t]))return!0;return!1}if(Ty(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return jy(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&jy(e[t]))return!0;return!1}function Oy(e){const t=[],n=e.data,r=e;return r.data=Py(n,t),r.attachments=t.length,{packet:r,buffers:t}}function Py(e,t){if(!e)return e;if(Ty(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=Py(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=Py(e[r],t));return n}return e}function Ay(e,t){return e.data=Ry(e.data,t),delete e.attachments,e}function Ry(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Ry(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Ry(e[n],t));return e}const My=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ly;!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"}(Ly||(Ly={}));function Dy(e){return"[object Object]"===Object.prototype.toString.call(e)}class By extends $g{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Ly.BINARY_EVENT;n||t.type===Ly.BINARY_ACK?(t.type=n?Ly.EVENT:Ly.ACK,this.reconstructor=new zy(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Ty(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Ly[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Ly.BINARY_EVENT||n.type===Ly.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!By.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Ly.CONNECT:return Dy(t);case Ly.DISCONNECT:return void 0===t;case Ly.CONNECT_ERROR:return"string"==typeof t||Dy(t);case Ly.EVENT:case Ly.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===My.indexOf(t[0]));case Ly.ACK:case Ly.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class zy{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Ay(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Uy=Object.freeze({__proto__:null,Decoder:By,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Ly.EVENT&&e.type!==Ly.ACK||!jy(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Ly.EVENT?Ly.BINARY_EVENT:Ly.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Ly.BINARY_EVENT&&e.type!==Ly.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Oy(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Ly}});function Fy(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const qy=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Hy extends $g{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;const e=this.io;this.subs=[Fy(e,"open",this.onopen.bind(this)),Fy(e,"packet",this.onpacket.bind(this)),Fy(e,"error",this.onerror.bind(this)),Fy(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,i;if(qy.hasOwnProperty(e))throw new 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;const o={type:Ly.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const a=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,s=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!a||(s?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=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,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{this._queue[0];return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const 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(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ly.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)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ly.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new 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 Ly.EVENT:case Ly.BINARY_EVENT:this.onevent(e);break;case Ly.ACK:case Ly.BINARY_ACK:this.onack(e);break;case Ly.DISCONNECT:this.ondisconnect();break;case Ly.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&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){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:Ly.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(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()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ly.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){const 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){const 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){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function Wy(e){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}Wy.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},Wy.prototype.reset=function(){this.attempts=0},Wy.prototype.setMin=function(e){this.ms=e},Wy.prototype.setMax=function(e){this.max=e},Wy.prototype.setJitter=function(e){this.jitter=e};class Vy extends $g{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,Zg(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Wy({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Uy;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Cy(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Fy(t,"open",function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=Fy(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Fy(e,"ping",this.onping.bind(this)),Fy(e,"data",this.ondata.bind(this)),Fy(e,"error",this.onerror.bind(this)),Fy(e,"close",this.onclose.bind(this)),Fy(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){Qg(()=>{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 Hy(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const 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(),null===(n=this.engine)||void 0===n||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;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const 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(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const $y={};function Ky(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=by(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+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}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=$y[i]&&o in $y[i].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new Vy(r,t):($y[i]||($y[i]=new Vy(r,t)),s=$y[i]),n.query&&!t.query&&(t.query=n.queryKey),s.socket(n.path,t)}Object.assign(Ky,{Manager:Vy,Socket:Hy,io:Ky,connect:Ky});var Qy=function(){function e(e,t){this.config=e,this.token=t.token}return e.prototype.init=function(e){var t=this;Yh("[StentorServerChat] Creating new socket connection to ".concat(this.config.url)),this.socket=Ky(this.config.url,{transports:["websocket"],reconnection:!0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,reconnectionAttempts:5}),this.dispatch=e,this.socket.on("connect",function(){Yh("[StentorServerChat] Socket CONNECTED - ID: ".concat(t.socket.id))}),this.socket.on("account_status",function(n){Yh("SERVER: account_status: ".concat(JSON.stringify(n))),t.token||(t.token=$v(),e({type:"receiveToken",detail:{token:t.token,timestamp:+new Date,type:"receiveToken",user:void 0}}),Yh("CLIENT: created token: ".concat(t.token))),t.socket.emit("connection update",t.token),e({type:"account_status",detail:{status:"online",timestamp:+new Date}})}),this.socket.on("new message",function(e){Yh("SERVER: new message: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.msg",user:{displayName:e.username,nick:"agent:robot"},msg:e.message,timestamp:+new Date}})}),this.socket.on("user joined",function(e){Yh("SERVER: user joined: ".concat(JSON.stringify(e))),t.visitorInfo.token=e.token,t.dispatch({type:"chat",detail:{type:"chat.memberjoin",user:{displayName:e.username,nick:e.nick||"agent:robot",avatarPath:e.avatarPath},timestamp:+new Date}})}),this.socket.on("user left",function(e){Yh("SERVER: user left: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.memberleave",user:{displayName:e.username,nick:"agent:robot"},timestamp:+new Date}})}),this.socket.on("typing",function(e){Yh("SERVER: typing: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!0,timestamp:+new Date}})}),this.socket.on("stop typing",function(e){Yh("SERVER: stop typing: ".concat(JSON.stringify(e))),t.dispatch({type:"chat",detail:{type:"chat.typing",user:{nick:"agent:robot"},typing:!1,timestamp:+new Date}})}),this.socket.on("disconnect",function(e){var n="string"==typeof e?e:String(e||"unknown");Yh("[StentorServerChat] Socket DISCONNECTED - Reason: ".concat(n)),Yh("SERVER: disconnect"),t.dispatch(wm("offline")),t.dispatch(xm("offline"))}),this.socket.on("reconnect",function(){Yh("SERVER: reconnect"),t.dispatch(wm("online")),t.dispatch(xm("online"))}),this.socket.on("reconnect_failed",function(e){Yh("SERVER: reconnect_failed",e),t.dispatch(wm("offline")),t.dispatch(xm("offline"))}),this.socket.on("reconnect_error",function(e){Yh("SERVER: reconnect_error",e),t.dispatch(wm("offline"))}),this.dispatch(xm("pending"))},e.prototype.sendOfflineMsg=function(e,t){t()},e.prototype.sendChatMsg=function(e,t){this.socket.emit("new message",e),t()},e.prototype.sendChatMsgRequest=function(e,t){this.socket.emit("new message",e),t()},e.prototype.sendTyping=function(e){this.socket.emit(e?"typing":"stop typing")},e.prototype.setVisitorInfo=function(e,t,n){this.visitorInfo=e,this.socket.emit("add user",e),n()},e.prototype.sendChatRating=function(){},e.prototype.sendFile=function(e,t){t()},e.prototype.markAsRead=function(){},e.prototype.flush=function(){},e.prototype.dispose=function(){var e;Yh("[StentorServerChat] dispose() called - manually disconnecting socket"),null===(e=this.socket)||void 0===e||e.disconnect()},e.prototype.sleep=function(){},e.prototype.wakeup=function(){},e.prototype.bargeOut=function(e){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeOut")})})},e.prototype.bargeIn=function(e,t){return n(this,void 0,void 0,function(){return r(this,function(e){throw new Error("Method not implemented: bargeIn")})})},e}();function Jy(e,t){return new _m(function(e,t){var n,r,i,o,a,s;switch(e.type){case"direct":return new gg({url:e.serverUrl,key:e.accountKey,timeout:e.timeout},t);case"websocket":return new Qy({url:e.serverUrl},t);case"websocketraw":return new kg({url:e.serverUrl},t);case"mcp":return new hg({serverUrl:e.serverUrl,mode:null===(n=e.mcp)||void 0===n?void 0:n.mode,authToken:null===(r=e.mcp)||void 0===r?void 0:r.authToken,debugMode:null===(i=e.mcp)||void 0===i?void 0:i.debugMode,pageContextOverride:null===(o=e.mcp)||void 0===o?void 0:o.pageContextOverride,showAiBadge:null===(a=e.mcp)||void 0===a?void 0:a.showAiBadge,channelId:null===(s=e.mcp)||void 0===s?void 0:s.channelId},t);case"local":return new yg;default:throw Sm(e.type)}}(e,t))}var Yy=Z.createContext(null);function Gy(){var e=Cm(),t=Z.useContext(Yy);return Z.useCallback(function(n){n?t&&e(n(t)):console.warn("react bug? Someone invokes with null")},[e,t])}function Xy(){var e=Gy();return Z.useCallback(function(t,n){e(gm(t,n))},[e])}var Zy={type:"newWindow"};function eb(e){return{type:"visual_status",detail:{status:e,timestamp:(new Date).getTime()}}}var tb="xa_chat",nb="resume",rb="Continue your conversation";function ib(e){return!!(null==e?void 0:e.some(function(e){return"chat.msg"===e.type}))}function ob(e,n){var r=n.arrivedViaChatLink;if(!n.hasConversation||!(null==e?void 0:e.message)&&!r)return e;var i=r?{delay:0}:{},o=null==e?void 0:e.mobile;return t(t(t(t({},e),{message:rb}),i),o&&{mobile:t(t(t({},o),("string"==typeof o.message||r)&&{message:rb}),i)})}var ab="(max-width: 640px), (max-height: 480px) and (pointer: coarse)";function sb(e,t,n,r,i){var o,a,s;if(void 0===i&&(void 0===s&&(s=window),i="function"==typeof s.matchMedia&&s.matchMedia(ab).matches),!t||!n)throw new Error("OpenUrl: No dispatch and/or visual.");if(e!==tm){try{var l=new URL(e),c=new URLSearchParams(l.search);c.has("utm_source")||c.append("utm_source","xapp"),l.search=c.toString(),e=l.toString()}catch(e){}var u=r.type;switch(u){case"newWindow":n.opened&&t(eb({opened:!1})),window.open(e,"callout-option","toolbar=0,status=0,width=".concat(r.width||1e3,",height=").concat(r.height||700));break;case"newTab":n.opened&&t(eb({opened:!1})),window.open(e,"_blank");break;case"sameWindow":i?t(eb({opened:!1})):n.opened||t(eb({opened:!0})),window.open(function(e,t){try{var n=new URL(e);return n.origin!==t||n.searchParams.get(tb)===nb?e:(n.searchParams.set(tb,nb),n.toString())}catch(t){return e}}(e,window.location.origin),"_self");break;default:Sm(u)}}else{var d=null===(o=window.xafwControl)||void 0===o?void 0:o.openForm;if(!d)return void Gh("Cannot find toggleForm! Update form widget!");var f=!1,p=null===(a=window.xafwControl)||void 0===a?void 0:a.formStatus;p?f=p().active:Gh("Cannot find formStatus! Update form widget!"),f||(d(),n.opened&&t(eb({opened:!1})))}}function lb(){var e=rm();return Z.useCallback(function(t,n,r,i){i||(i=(null==e?void 0:e.urls)?function(e,t){if(t.policies)for(var n=0,r=t.policies;n<r.length;n++){var i=r[n];try{if(new RegExp(i.pattern,"gi").test(e))return i.behavior}catch(e){}}return t.defaultBehavior||Zy}(t,e.urls):Zy),sb(t,n,r,i)},[e])}function cb(){var e=lb(),t=Cm(),n=Rh(function(e){return e.visuals}),r=Xy();return Z.useCallback(function(i){i.actionUrl?e(i.actionUrl,t,n):r(i.label)},[t,r,e,n])}var ub=function(e){var t=e.msg,n=e.ctx,r=Z.useMemo(function(){return function(e){var t=e;return{content:e.content,imageUrl:e.smallImageUrl||t.imageUrl,title:e.title,imageActionUrl:null==e?void 0:e.imageActionUrl,buttons:e.buttons?e.buttons.map(function(e){return{actionUrl:e.openUrlAction||e.url,label:e.title}}):void 0}}(t)},[t]),i=n.user,o=cb();return f.jsx(mm,{showAvatar:!0,user:i,children:f.jsx("div",{className:"chat-msg",children:f.jsx(fm,{card:r,onButtonClick:o})})})};function db(e){return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function fb(e){var t,n=Z.useState(e.getArray()),r=n[0],i=n[1],o=(t=Z.useRef(!1),Z.useEffect(function(){return t.current=!0,function(){t.current=!1}},[]),Z.useCallback(function(){return t.current},[]));return Z.useEffect(function(){var t=e.subscribe(function(e){o()&&i(e)});return function(){t.unsubscribe()}},[o,e]),r}var pb=[];function hb(e){var t=e.get()||pb,n=Array.isArray(t)?function(e){var t=e||[],n=[];function r(){for(var e=0,r=n;e<r.length;e++)(0,r[e])(t)}return{getArray:function(){return t},push:function(e){t=i(i([],t,!0),[e],!1),r()},unshift:function(e){t=i([e],t,!0),r()},subscribe:function(e){return n.push(e),{unsubscribe:function(){var t=n.indexOf(e);t>=0&&n.splice(t,1)}}}}}(t):t;return n!==t&&e.set(n),fb(n)}var mb=function(e,t){return{get:function(){return e[t]},set:function(n){return e[t]=n}}}(globalThis,"xappMsgMiddlewares");function vb(){return function(e){var t=hb(e);return Z.useMemo(function(){return db(t)},[t])}(mb)}function gb(e){return e.hasOwnProperty("label")}function yb(e){return e.url||e.imageActionUrl}var bb=function(e){var t=Cm(),n=Rh(function(e){return e.visuals}),r=e.url,i=e.className,o=e.onOpen,a=Z.useCallback(function(){o&&o(r,t,n)},[r,o]);return r?f.jsx("div",{onClick:a,className:i,children:e.children}):f.jsx("div",{onClick:e.onClick,className:i,children:e.children})},wb=function(e){var t,n=e.item,r=e.onButtonClick,i=e.onExecute,o=1===(null===(t=n.buttons)||void 0===t?void 0:t.length),a=Z.useCallback(function(){var e;1===(null===(e=n.buttons)||void 0===e?void 0:e.length)?r(n.buttons[0]):i(n.title,n.token)},[n,i,r]),s="xappw-chat-action-item ".concat(o?"xappw-chat-action-item--action":""," ").concat(e.className);return f.jsx(bb,{className:s,url:yb(n),onClick:a,onOpen:e.onOpenUrl,children:e.children})},xb=function(e){var t,n=e.item,r=1===(null===(t=n.buttons)||void 0===t?void 0:t.length),i=yb(n);if(n.imageUrl){var o=r?null:n.imageActionUrl;return f.jsx("div",{className:e.className,children:f.jsx(dm,{imageUrl:n.imageUrl,imageActionUrl:!i&&o})})}return e.emptyImageVisible?f.jsx("div",{className:e.className}):f.jsx(f.Fragment,{})},kb=function(e){var t,n=e.item;return f.jsx(wb,{className:"chat-list-item-container",item:n,onButtonClick:e.onButtonClick,onExecute:e.onExecute,onOpenUrl:e.onOpenUrl,children:f.jsxs("div",{className:"chat-list-item",children:[f.jsx(xb,{item:n,className:"chat-list-item__img",emptyImageVisible:e.emptyImageVisible}),n.title&&f.jsx("div",{className:"chat-list-item__title",children:f.jsx("span",{children:n.title})}),n.subTitle&&f.jsx("div",{className:"chat-list-item__subtitle",children:f.jsx("span",{children:n.subTitle})}),!!(null===(t=n.buttons)||void 0===t?void 0:t.length)&&f.jsx(um,{className:"chat-list-item__actions",buttons:n.buttons,onClick:e.onButtonClick})]})})};var Sb=function(e){return f.jsx("button",{onClick:e.onClick,className:"xa-chevron",children:f.jsx("svg",{viewBox:"-5 -18 10 36",children:f.jsx("path",{d:"M 2.5 -15 L -2.5 0 L 2.5 15",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"4px",fill:"none"})})})};var Cb=function(e){return f.jsx("button",{onClick:e.onClick,className:"xa-chevron",children:f.jsx("svg",{viewBox:"-5 -18 10 36",children:f.jsx("path",{d:"M -2.5 -15 L 2.5 0 L -2.5 15",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"4px",fill:"none"})})})},_b=function(e){var t=Z.useRef(null),n=Z.useState(0),r=n[0],i=n[1];function o(e){var n,o,a=t.current;if(a){var s=a.getElementsByClassName("xappw-carousel-items__item"),l=s.length,c=r;1===e?r<l-1&&c++:r>0&&c--;for(var u=0,d=0;d<s.length&&d!==c;d++)u+=null!==(o=null===(n=s.item(d))||void 0===n?void 0:n.clientWidth)&&void 0!==o?o:0;a.scrollLeft=u,i(c)}}var a=1===e.list.items.length,s=e.list.items.some(function(e){return e.imageUrl}),l=e.list.items.map(function(t,n){return f.jsx("div",{className:"xappw-carousel-items__item",children:f.jsx(kb,{item:t,emptyImageVisible:s,onExecute:e.onExecute,onButtonClick:e.onButtonClick,onOpenUrl:e.onOpenUrl})},"item-key-".concat(n))});return f.jsxs("div",{className:"xappw-carousel",children:[!a&&f.jsx("div",{className:"xappw-carousel__prev",children:f.jsx(Sb,{onClick:function(){return o(-1)}})}),f.jsx("div",{ref:t,className:"xappw-carousel-items ".concat(a?"xappw-carousel-items--one-item":""),children:l}),!a&&f.jsx("div",{className:"xappw-carousel__next",children:f.jsx(Cb,{onClick:function(){return o(1)}})})]})};var Eb=function(e){var t=e.url,n=Z.useCallback(function(e){e.preventDefault()},[]);return f.jsx("a",{href:t,"aria-label":"read more",target:"_blank",rel:"noreferrer",className:e.className,onClick:n,children:f.jsxs("svg",{viewBox:"0 0 20 20",children:[f.jsx("path",{d:"M17 17H3V3h5V1H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5h-2z"}),f.jsx("path",{d:"M19 1h-8l3.29 3.29-5.73 5.73 1.42 1.42 5.73-5.73L19 9V1z"})]})})};function Nb(e,t){for(var n=-1,r=0,i=t;r<i.length;r++){var o=i[r],a=e.indexOf(o);a>=0&&(n<0||n>=0&&a<n)&&(n=a)}return n}var Ib=[":","/"],Tb=["/"],jb=["?","#"],Ob=["#"],Pb=[function(e){var t=e.indexOf("://");return t<0?t:t+3},function(e){return Nb(e,Ib)},function(e){return":"!==e.charAt(0)?-1:Nb(e,Tb)},function(e){var t=Nb(e,jb);return t>=0?t:e.length},function(e){return Nb(e,Ob)}];var Ab="/...";function Rb(e,t){if(e.length<t)return e;var n=function(e){for(var t=[],n=e,r=0,i=Pb;r<i.length;r++){var o=i[r],a=Math.max(0,o(n,e)),s=n.substring(0,a);t.push(s),n=n.substring(a)}return n&&t.push(n),t}(e);function r(){return n.join("")}function i(){return r().length>t}function o(e){i()&&(n[e]="")}if(":80"===n[2]&&"http://"===n[0]&&o(2),":443"===n[2]&&"https://"===n[0]&&o(2),o(5),o(4),o(2),o(0),i()){var a=n[3],s=r().length-a.length,l=t-s;if(l<0)n[3]="";else if(l<a.length){var c=a.length-l+4;n[3]=Ab+a.substring(c)}}return r()}var Mb=function(e){var t=e.url,n=e.className,r=Z.useCallback(function(e){e.preventDefault()},[]);return f.jsx("a",{href:t,"aria-label":"read more",target:"_blank",rel:"noreferrer",className:n,onClick:r,children:Rb(t,40)})},Lb=function(e){var t,n=e.item,r=e.layout||"normal",i=n.url||n.imageActionUrl;return f.jsx(wb,{className:"xappw-vlist-item-container",item:n,onButtonClick:e.onButtonClick,onExecute:e.onExecute,onOpenUrl:e.onOpenUrl,children:f.jsxs("div",{className:"xappw-vlist-item xappw-vlist-item--".concat(r),children:[f.jsxs("div",{className:"xappw-vlist-item__description",children:[n.title&&f.jsx("div",{className:"xappw-vlist-item__title",children:f.jsx("span",{children:n.title})}),i&&!n.hideUrl&&f.jsxs("div",{className:"xappw-vlist-item__link-row",children:[f.jsx(Mb,{url:i,className:"xappw-vlist-item__link"}),f.jsx(Eb,{url:i,className:"xappw-vlist-item__external-link"})]}),n.subTitle&&f.jsx("div",{className:"xappw-vlist-item__subtitle",children:f.jsx("span",{children:n.subTitle})}),!!(null===(t=n.buttons)||void 0===t?void 0:t.length)&&f.jsx(um,{buttons:n.buttons,onClick:e.onButtonClick})]}),f.jsx("div",{className:"xappw-vlist-item__side",children:f.jsx(xb,{item:n,className:"xappw-vlist-item__img",emptyImageVisible:e.emptyImageVisible})})]})})},Db=function(e){var t=e.list,n=Z.useRef(null),r=t.items.some(function(e){return e.imageUrl}),i=!t.items.some(function(e){var t;return e.subTitle||(null===(t=e.buttons)||void 0===t?void 0:t.length)}),o=t.items.map(function(t,n){return f.jsx("div",{className:"xappw-vlist-container__item",children:f.jsx(Lb,{item:t,layout:i?"titles":"normal",emptyImageVisible:r,onExecute:e.onExecute,onButtonClick:e.onButtonClick,onOpenUrl:e.onOpenUrl})},"item-key-".concat(n))});return f.jsx("div",{className:"xappw-vlist",children:f.jsxs("div",{ref:n,className:"xappw-vlist-container",children:[e.list.title&&f.jsx("div",{className:"xappw-vlist__header",children:e.list.title}),o]})})},Bb=function(e){var t=e.msg,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(Bb.name));var r=Z.useMemo(function(){return function(e){return{type:e.type,title:e.title,items:e.items.map(function(e){var t,n,r={title:e.title,subTitle:e.description,token:e.token,url:e.url,hideUrl:e.hideUrl,imageUrl:(null===(t=e.image)||void 0===t?void 0:t.url)||e.imageUrl,imageActionUrl:null===(n=e.image)||void 0===n?void 0:n.imageActionUrl},i=e.buttons;return i&&i.length>0&&(r.buttons=i.map(function(e){return{actionUrl:e.openUrlAction,label:e.title}})),r})}}(t)},[t]),i=Xy(),o=Z.useCallback(function(e,t,n){i(t,{token:n,action:"click",ui:e})},[i]),a=cb(),s=n.user;return f.jsxs(mm,{showAvatar:!1,user:s,fullWidth:!0,children:["CAROUSEL"===r.type&&f.jsx("div",{className:"chat-msg chat-msg--fullwidth chat-msg--no-ava",children:f.jsx(_b,{list:r,onExecute:o.bind(null,"carousel"),onButtonClick:a,onOpenUrl:n.openUrl})}),"LIST"===r.type&&f.jsx("div",{className:"chat-msg chat-msg--expand",children:f.jsx(Db,{list:r,onExecute:o.bind(null,"list"),onButtonClick:a,onOpenUrl:n.openUrl})})]})},zb=function(){},Ub=function(){function e(e){this.cache={},this.template=e}return e.prototype.resolve=function(e){var t,n,r;if(e){var i=this.cache,o=e.nick,a=i[o];return a||(a={user:e,send:null!==(t=this.template.send)&&void 0!==t?t:zb,write:null!==(n=this.template.write)&&void 0!==n?n:zb,openUrl:null!==(r=this.template.openUrl)&&void 0!==r?r:zb},i[o]=a),a}},e}(),Fb=function(){return f.jsx(f.Fragment,{})},qb=function(e){var n=e.items,r=e.checked,i=e.onChange,o=Z.useCallback(function(e){var n,o=e.target.value;i(t(t({},r),((n={})[o]=!r[o],n)))},[r,i]);return f.jsx("ul",{className:"xappw-multiselect",children:null==n?void 0:n.map(function(e){return f.jsx("li",{children:f.jsxs("label",{children:[f.jsx("input",{type:"checkbox",checked:r[e.id]||!1,onChange:o,value:e.id}),f.jsx("span",{children:e.title})]})},e.id)})})};var Hb=function(e){var t=e.msg,n=e.ctx,r=Z.useMemo(function(){return t.items},[t]),i=n.user,o=Z.useState({}),a=o[0],s=o[1],l=Z.useCallback(function(){n.send({type:"custom",payload:JSON.stringify({type:"OPTION_SELECT_REQUEST",intentId:"OptionSelect",selected:Object.keys(a).map(function(e){return{id:e}})})})},[n,a]);return f.jsx(mm,{showAvatar:!0,user:i,children:f.jsx("div",{className:"chat-msg",children:f.jsxs("div",{children:[f.jsx(qb,{items:r,checked:a,onChange:s}),f.jsx(lm,{label:"Submit",onClick:l})]})})})},Wb=function(e){var t=e.table;return f.jsxs("div",{className:"xappw-table",children:[t.title&&f.jsx("div",{className:"xappw-table__header",children:t.title}),f.jsx("div",{className:"xappw-table__container",children:f.jsxs("table",{children:[f.jsx("thead",{children:f.jsx("tr",{children:t.headers.map(function(e,t){return f.jsx("th",{scope:"col",children:e},"".concat(e,"-").concat(t))})})}),f.jsx("tbody",{children:t.rows.map(function(e,t){return f.jsx("tr",{children:e.map(function(e,t){return f.jsx("td",{children:e},t)})},t)})})]})})]})},Vb=function(e){var t=e.msg,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(Vb.name));return f.jsx(mm,{showAvatar:!1,user:n.user,fullWidth:!0,children:f.jsx("div",{className:"chat-msg chat-msg--expand",children:f.jsx(Wb,{table:t})})})},$b=db([function(e){return function(t){var n,r=t.msg,i=t.ctx;return!(n=r)||"LIST"!==n.type&&"CAROUSEL"!==n.type?e(t):f.jsx(Bb,{msg:r,ctx:i})}},function(e){return function(t){var n,r=t.msg,i=t.ctx;return(n=r)&&"CARD"===n.type?f.jsx(ub,{msg:r,ctx:i}):e(t)}},function(e){return function(t){var n=t.msg,r=t.ctx;return"MultiSelect"===n.type?f.jsx(Hb,{msg:n,ctx:r}):e(t)}},function(e){return function(t){var n,r=t.msg,i=t.ctx;return(n=r)&&"TABLE"===n.type&&Array.isArray(n.headers)&&Array.isArray(n.rows)?f.jsx(Vb,{msg:r,ctx:i}):e(t)}}]);function Kb(){var e,t=(e=vb(),Z.useMemo(function(){return db([e,$b])},[e]));return Z.useMemo(function(){return t(Fb)},[t])}var Qb=$b(Fb);function Jb(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Yb=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")(),Gb=()=>Math.random().toString(36).substring(7).split("").join("."),Xb={INIT:`@@redux/INIT${Gb()}`,REPLACE:`@@redux/REPLACE${Gb()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${Gb()}`};function Zb(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function ew(e,t,n){if("function"!=typeof e)throw new Error(Jb(2));if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Jb(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Jb(1));return n(ew)(e,t)}let r=e,i=t,o=new Map,a=o,s=0,l=!1;function c(){a===o&&(a=new Map,o.forEach((e,t)=>{a.set(t,e)}))}function u(){if(l)throw new Error(Jb(3));return i}function d(e){if("function"!=typeof e)throw new Error(Jb(4));if(l)throw new Error(Jb(5));let t=!0;c();const n=s++;return a.set(n,e),function(){if(t){if(l)throw new Error(Jb(6));t=!1,c(),a.delete(n),o=null}}}function f(e){if(!Zb(e))throw new Error(Jb(7));if(void 0===e.type)throw new Error(Jb(8));if("string"!=typeof e.type)throw new Error(Jb(17));if(l)throw new Error(Jb(9));try{l=!0,i=r(i,e)}finally{l=!1}return(o=a).forEach(e=>{e()}),e}f({type:Xb.INIT});return{dispatch:f,subscribe:d,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Jb(10));r=e,f({type:Xb.REPLACE})},[Yb]:function(){const e=d;return{subscribe(t){if("object"!=typeof t||null===t)throw new Error(Jb(11));function n(){const e=t;e.next&&e.next(u())}n();return{unsubscribe:e(n)}},[Yb](){return this}}}}}function tw(e){const t=Object.keys(e),n={};for(let r=0;r<t.length;r++){const i=t[r];"function"==typeof e[i]&&(n[i]=e[i])}const r=Object.keys(n);let i;try{!function(e){Object.keys(e).forEach(t=>{const n=e[t];if(void 0===n(void 0,{type:Xb.INIT}))throw new Error(Jb(12));if(void 0===n(void 0,{type:Xb.PROBE_UNKNOWN_ACTION()}))throw new Error(Jb(13))})}(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let o=!1;const a={};for(let i=0;i<r.length;i++){const s=r[i],l=n[s],c=e[s],u=l(c,t);if(void 0===u)throw t&&t.type,new Error(Jb(14));a[s]=u,o=o||u!==c}return o=o||r.length!==Object.keys(e).length,o?a:e}}function nw(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function rw(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var iw=rw(),ow=rw;const aw="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?nw:nw.apply(null,arguments)};var sw=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};const lw=e=>t=>{setTimeout(t,e)},cw=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,o=!1,a=!1;const s=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"undefined"!=typeof window&&window.requestAnimationFrame?(c=window.requestAnimationFrame,u=100,e=>{let t,n,r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(t),clearTimeout(n),e())};t=c(i),n=setTimeout(i,u)}):lw(10):"callback"===e.type?e.queueNotification:lw(e.timeout);var c,u;const d=()=>{a=!1,o&&(o=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){const t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.RTK_autoBatch,o=!i,o&&(a||(a=!0,l(d))),r.dispatch(e)}finally{i=!0}}})};function uw(e){const t=function(e){const{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{};let o=new sw;return t&&("boolean"==typeof t?o.push(iw):o.push(ow(t.extraArgument))),o},{reducer:n,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:o=!0,preloadedState:a,enhancers:s}=e||{};let l;if("function"==typeof n)l=n;else{if(!Zb(n))throw new Error(`Minified Redux Toolkit error #${c=1}; visit https://redux-toolkit.js.org/Errors?code=${c} for the full message or use the non-minified dev environment for full errors. `);l=tw(n)}var c;let u;u="function"==typeof r?r(t):t();let d=nw;i&&(d=aw({trace:!1,..."object"==typeof i&&i}));const f=function(...e){return t=>(n,r)=>{const i=t(n,r);let o=()=>{throw new Error(Jb(15))};const a={getState:i.getState,dispatch:(e,...t)=>o(e,...t)},s=e.map(e=>e(a));return o=nw(...s)(i.dispatch),{...i,dispatch:o}}}(...u),p=(e=>function(t){const{autoBatch:n=!0}=t??{};let r=new sw(e);return n&&r.push(cw("object"==typeof n?n:void 0)),r})(f);return ew(l,a,d(..."function"==typeof s?s(p):p()))}var dw=function(){function e(e,t){this.innerStorage=e,this.key=t}return e.prototype.get=function(){return function(e){try{if(e)return JSON.parse(e)}catch(e){}}(this.innerStorage.getItem(this.key))},e.prototype.set=function(e){try{this.innerStorage.setItem(this.key,JSON.stringify(e))}catch(e){!function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r={};r[e]||(r[e]=!0,Yh.apply(void 0,t))}("storage","Unable to store redux state")}},e}(),fw="xapp_chat_visitorId";function pw(){try{var e=localStorage.getItem(fw);if(e)return e;var t=$v();return localStorage.setItem(fw,t),t}catch(e){return $v()}}var hw={displayName:"Visitor",nick:"visitor:",typing:!1};function mw(e,n){var r;e||(e={}),e.userId=e.userId?e.userId:pw(),e.visitorId=e.userId;var i=!1;if("undefined"!=typeof window){var o=null===(r=window.localStorage)||void 0===r?void 0:r.getItem("xaErrorOverlay");"enabled"===o?i=!0:"disabled"===o?i=!1:((null==n?void 0:n.enableErrorOverlay)||void 0!==globalThis.__DEV__&&globalThis.__DEV__)&&(i=!0)}return t({connection:{connectionStatus:"offline",token:null,greetingRequested:!1},accountStatus:"offline",departments:{},visitor:hw,agents:{},chats:[],lastTimestamp:0,lastRatingRequestTimestamp:0,hasRating:!1,isChatting:!1,queuePosition:0,failureMsg:null,visitorId:pw(),chips:[],sessionExpiration:"24h",visuals:{},debugMode:i},e)}var vw=mw(),gw=function(){function e(){this.valuesMap=new Map}return e.prototype.getItem=function(e){var t=String(e);return this.valuesMap.has(e)?String(this.valuesMap.get(t)):null},e.prototype.setItem=function(e,t){this.valuesMap.set(String(e),String(t))},e.prototype.removeItem=function(e){this.valuesMap.delete(e)},e.prototype.clear=function(){this.valuesMap.clear()},e.prototype.key=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'key' on 'Storage': 1 argument required, but only 0 present.");return Array.from(this.valuesMap.keys())[e]},Object.defineProperty(e.prototype,"length",{get:function(){return this.valuesMap.size},enumerable:!1,configurable:!0}),e}();function yw(e){return"chat.msg"===e.type}function bw(e,t){return function(e,t,n){if(!e.length)return e.push(t),e;if(1===e.length)return 0===(c=n(t,e[0]))?(t===e[0]||e.push(t),e):(c<0?e.unshift(t):e.push(t),e);for(var r=0,i=e.length-1;i-r>0;){var o=e[r],a=e[i],s=n(t,o);if(0===s)return t===o||e.splice(r+1,0,t),e;if(s<0)return e.splice(r,0,t),e;var l=n(t,a);if(0===l)return t===a||e.splice(i+1,0,t),e;if(l>0)return e.splice(i+1,0,t),e;if(i-r<=1)break;var c,u=Math.floor((r+i)/2),d=e[u];if(0===(c=n(d,t))&&t===d)return e;c<=0?r=u:c>0&&(i=u)}return e.splice(r+1,0,t),e}(i([],e,!0),t,function(e,t){return e.timestamp-t.timestamp})}function ww(e){for(var t=e.length-1;t>=0;t--){var n=e[t];if(yw(n)&&n.isStreaming)return t}return-1}function xw(e,t){e.chats=bw(e.chats,t),"chat.msg"===t.type&&(e.activeContexts=t.msg.context)}function kw(e,n){var r,o,a,s,l,c,u,d,f,p,h,m,v,g,y,b,w,x,k,S,C;if(void 0===e&&(e=vw),Yh("action",n),"reset"===n.type)return function(e){var n;void 0===e&&(e=vw);var r=mw({accessToken:e.accessToken,userId:e.userId,attributes:e.attributes,sessionExpiration:e.sessionExpiration}),i="online"===e.connection.connectionStatus,o=null===(n=e.visuals)||void 0===n?void 0:n.opened;return t(t({},r),{connection:t(t({},r.connection),{greetingRequested:!1,nonce:$v(),connectionStatus:i?"online":r.connection.connectionStatus}),accountStatus:i?"online":r.accountStatus,visitor:e.visitor,visitorId:e.visitorId,visuals:{opened:o,hasInteracted:!1}})}(e);switch(n.type){case"connection_update":case"receiveToken":case"sendGreeting":var _=function(e,n){switch(n.type){case"connection_update":return t(t({},e),{connectionStatus:n.detail.status});case"receiveToken":return t(t({},e),{token:n.detail.token});case"sendGreeting":return t(t({},e),{greetingRequested:!0})}return e}(e.connection,n);return e.connection!==_&&(e=t(t({},e),{lastTimestamp:null===(l=n.detail)||void 0===l?void 0:l.timestamp,connection:_})),e;case"account_status":return t(t({},e),{lastTimestamp:null===(c=n.detail)||void 0===c?void 0:c.timestamp,accountStatus:n.detail.status});case"session_id":return t(t({},e),{lastTimestamp:null===(u=n.detail)||void 0===u?void 0:u.timestamp,sessionId:n.detail.sessionId});case"visual_status":return t(t({},e),{lastTimestamp:null===(d=n.detail)||void 0===d?void 0:d.timestamp,visuals:t(t(t(t(t({},e.visuals||{}),void 0!==n.detail.status.drawer&&{drawer:n.detail.status.drawer}),void 0!==n.detail.status.opened&&{opened:n.detail.status.opened}),void 0!==n.detail.status.visible&&{visible:n.detail.status.visible}),void 0!==n.detail.status.hasInteracted&&{hasInteracted:n.detail.status.hasInteracted})});case"toggle_debug_mode":var E=!e.debugMode;return"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem("xaErrorOverlay",E?"enabled":"disabled"),t(t({},e),{debugMode:E});case"ws_button_display":return t(t({},e),{lastTimestamp:null===(f=n.detail)||void 0===f?void 0:f.timestamp,wsButton:{id:n.detail.id,text:n.detail.text||(null===(p=e.wsButton)||void 0===p?void 0:p.text)||"",pressBehavior:n.detail.pressBehavior,isPressed:null!==(h=n.detail.isPressed)&&void 0!==h&&h,isDismissing:null!==(m=n.detail.isDismissing)&&void 0!==m&&m}});case"ws_button_dismiss":return(null===(v=e.wsButton)||void 0===v?void 0:v.id)===n.detail.id?t(t({},e),{lastTimestamp:null===(g=n.detail)||void 0===g?void 0:g.timestamp,wsButton:void 0}):e;case"department_update":return t(t({},e),{lastTimestamp:null===(y=n.detail)||void 0===y?void 0:y.timestamp,departments:t(t({},e.departments),(r={},r[n.detail.id]=t({},n.detail),r))});case"visitor_update":return t(t({},e),{lastTimestamp:null===(b=n.detail)||void 0===b?void 0:b.timestamp,visitor:t(t({},e.visitor),n.detail)});case"agent_update":var N=e.agents[n.detail.nick];return t(t({},e),{lastTimestamp:null===(w=n.detail)||void 0===w?void 0:w.timestamp,agents:t(t({},e.agents),(o={},o[n.detail.nick]=t(t({},N),{user:t(t({},N.user),n.detail),typing:(N||{typing:!1}).typing}),o))});case"chat":var I=t(t({},e),{lastTimestamp:null===(x=n.detail)||void 0===x?void 0:x.timestamp});switch(n.detail.type){case"chat.memberjoin":return function(e,n){var r=t({},e.agents),i=e.agents[n.user.nick];if(r[n.user.nick]=t(t({},i),{user:t(t({},n.user),{displayName:n.user.displayName||"Agent"}),joined:!0,typing:!1,hideUserInfo:n.hideUserInfo}),Mh(n.user.nick)){var o=n.showDivider||n.message;return(null==i?void 0:i.joined)&&!o?Yh('DEDUPLICATION: Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") already joined. NOT adding duplicate join message to chat.")):Yh(o?'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining with special visuals (divider or custom message). Adding join message to chat."):'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining. Adding join message to chat.")),t(t({},e),{isChatting:!0,chats:(null==i?void 0:i.joined)&&!o?e.chats:bw(e.chats,n),agents:r})}return Yh('Non-agent member "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is joining. Adding join message to chat.")),t(t({},e),{isChatting:!0,chats:bw(e.chats,n),agents:r})}(e,n.detail);case"chat.memberleave":return function(e,n){var r=t({},e.agents),i=e.agents[n.user.nick];r[n.user.nick]=t(t({},i),{joined:!1,typing:!1});var o=Object.values(r).filter(function(e){return e.joined}).length>0;if(Mh(n.user.nick)){var a=n.showDivider||n.message;return(null==i?void 0:i.joined)?Yh(a?'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving with special visuals (divider or custom message). Adding leave message to chat."):'Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving. Adding leave message to chat.")):Yh('DEDUPLICATION: Agent "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") already left. NOT adding duplicate leave message to chat.")),t(t({},e),{isChatting:o,chats:(null==i?void 0:i.joined)?bw(e.chats,n):e.chats,agents:r})}return Yh('Non-agent member "'.concat(n.user.displayName||"Unknown",'" (nick: ').concat(n.user.nick,") is leaving. Adding leave message to chat.")),t(t({},e),{isChatting:o,chats:bw(e.chats,n),agents:r})}(e,n.detail);case"chat.systemmessage":return xw(I,n.detail),I;case"chat.systemmessagedismiss":var T=n.detail.id;return t(t({},I),{chats:I.chats.filter(function(e){return!function(e){return"chat.systemmessage"===e.type}(e)||e.id!==T})});case"chat.queue.position":return I.queuePosition=n.detail.queuePosition,I;case"chat.request.rating":return xw(I,n.detail),t(t({},I),{lastRatingRequestTimestamp:n.detail.timestamp});case"chat.rating":return xw(I,n.detail),t(t({},I),{hasRating:!!n.detail.newRating});case"chat.file":case"chat.msg":xw(I,n.detail);var j=n.detail,O="chat.msg"===j.type?j.msg:null;return I.chips=(null===(k=null==O?void 0:O.options)||void 0===k?void 0:k.length)?O.options:[],I;case"chat.failureMsg":var P,A=I.agents[n.detail.user.nick],R=n.detail.failureMsg.retry,M=I;if(1!==R){P=I.chats.filter(function(e){return"chat.failureMsg"===e.type&&e.failureMsg.retry<R})[0];var L=I.chats.filter(function(e){return e!==P});M=t(t({},I),{chats:L})}return xw(M,n.detail),t(t({},M),{agents:t(t({},M.agents),(a={},a[n.detail.user.nick]=t(t({},A),{typing:!1,requestFailed:!0}),a)),failureMsg:n.detail.failureMsg});case"chat.typing":var D=e.agents[n.detail.user.nick];return t(t({},e),{lastTimestamp:null===(S=n.detail)||void 0===S?void 0:S.timestamp,agents:t(t({},e.agents),(s={},s[n.detail.user.nick]=t(t({},D),{typing:n.detail.typing}),s))});case"chat.stream.start":var B=I.chats.map(function(e){return yw(e)&&e.isStreaming?t(t({},e),{isStreaming:!1,wasStreamed:!0}):e}),z=bw(B,{type:"chat.msg",user:n.detail.user,timestamp:n.detail.timestamp,msg:{text:""},isStreaming:!0});return t(t({},I),{chats:z,streamingMessageId:n.detail.messageId});case"chat.stream.chunk":var U=n.detail;if(e.streamingMessageId===U.messageId){var F=ww(e.chats);if(F>=0){var q=U.text;return t(t({},e),{lastTimestamp:null==U?void 0:U.timestamp,chats:e.chats.map(function(e,n){var r;return n===F&&yw(e)?t(t({},e),{msg:t(t({},e.msg),{text:((null===(r=e.msg)||void 0===r?void 0:r.text)||"")+q})}):e})})}}return e;case"chat.stream.tool_start":Yh("Tool execution started: ".concat(n.detail.toolName));var H=n.detail;if(e.streamingMessageId===H.messageId){var W=ww(e.chats);if(W>=0)return t(t({},e),{lastTimestamp:H.timestamp,chats:e.chats.map(function(e,n){if(n===W&&yw(e)){var r=e.toolCalls||[];return t(t({},e),{toolCalls:i(i([],r,!0),[{name:H.toolName,toolCallId:H.toolCallId,displayName:H.displayName,label:H.label,hidden:H.hidden,input:H.toolInput,startTime:H.timestamp,isExecuting:!0}],!1)})}return e})})}return e;case"chat.stream.tool_end":Yh("Tool execution ended: ".concat(n.detail.toolName));var V=n.detail;if(e.streamingMessageId===V.messageId){var $=ww(e.chats);if($>=0)return t(t({},e),{lastTimestamp:V.timestamp,chats:e.chats.map(function(e,n){var r;if(n===$&&yw(e)){var i=null===(r=e.toolCalls)||void 0===r?void 0:r.map(function(e){var n,r;return(V.toolCallId?e.toolCallId===V.toolCallId:e.name===V.toolName&&e.isExecuting)?t(t({},e),{displayName:V.displayName||e.displayName,label:V.label,hidden:null!==(n=V.hidden)&&void 0!==n?n:e.hidden,input:null!==(r=V.toolInput)&&void 0!==r?r:e.input,result:V.toolResult,error:V.toolError,endTime:V.timestamp,isExecuting:!1}):e});return t(t({},e),{toolCalls:i})}return e})})}return e;case"chat.stream.end":var K=n.detail;if(e.streamingMessageId===K.messageId){var Q=ww(e.chats),J=Q>=0?e.chats[Q]:void 0;if(Q>=0&&J&&yw(J)){var Y=K.msg,G=K.toolCalls||J.toolCalls,X=K.preserveChips?e.chips:(null===(C=null==Y?void 0:Y.options)||void 0===C?void 0:C.length)?Y.options:[];return t(t({},e),{lastTimestamp:null==K?void 0:K.timestamp,streamingMessageId:void 0,chips:X,chats:e.chats.map(function(e,n){return n===Q&&yw(e)?t(t({},e),{msg:Y,isStreaming:!1,wasStreamed:!0,toolCalls:G}):e})})}}return e;case"chat.stream.abort":var Z=n.detail;if(e.streamingMessageId===Z.messageId){var ee=ww(e.chats);if(ee>=0)return t(t({},e),{lastTimestamp:Z.timestamp,streamingMessageId:void 0,chats:e.chats.map(function(e,n){return n===ee&&yw(e)?t(t({},e),{isStreaming:!1,wasStreamed:!0}):e})})}return e;case"chat.stream.resume":var te=n.detail;if(e.streamingMessageId)return e;for(var ne=-1,re=e.chats.length-1;re>=0;re--){var ie=e.chats[re];if(yw(ie)&&ie.wasStreamed&&!ie.isStreaming){ne=re;break}}return ne>=0?t(t({},e),{lastTimestamp:te.timestamp,streamingMessageId:te.messageId,chats:e.chats.map(function(e,n){return n===ne&&yw(e)?t(t({},e),{isStreaming:!0,wasStreamed:!1}):e})}):e;default:return e}default:return Yh("Unhandled redux action: ",n.type),e}}function Sw(e,t){if(void 0===e&&(e=vw),"synthetic"===t.type){Yh("synthetic action",t);var n=function(e,t){var n;void 0===e&&(e=vw);var r=((null===(n=t.detail)||void 0===n?void 0:n.timestamp)||+new Date)+1;switch(t.detail.type){case"write_msg":return{type:"chat",detail:{type:"chat.msg",user:t.detail.user,timestamp:r,msg:t.detail.msg}};case"visitor.send.file":return{type:"chat",detail:{type:"chat.file",user:{displayName:e.visitor.displayName,nick:"visitor:"},timestamp:r,attachment:t.detail.attachment}};default:throw new Error("Unknown synthetic action. Detail type: ".concat(t.detail.type))}}(e,t);return kw(e,n)}return kw(e,t)}var Cw="AdminAccessTimes";function _w(e,n){var r;n||(n="undefined"!=typeof window?localStorage:new gw);var i,o=e.connection,a=null===(r=new URL(window.location.href).searchParams)||void 0===r?void 0:r.get("sessionId"),s=(new Date).getTime();if(a){var l=n.getItem(Cw),c=l?JSON.parse(l):{};if(c[a])Yh("ChatStore: reusing session: ".concat(a)),c[a].lastAccessMs=s,i=c[a].dataStorageKey;else{if(Object.keys(c).length>=20){var u=function(e){for(var t,n=Number.MAX_VALUE,r=0,i=Object.keys(e);r<i.length;r++){var o=i[r];e[o].lastAccessMs<n&&(t=o,n=e[o].lastAccessMs)}return t}(c);Yh("ChatStore: evicting session: ".concat(u)),n.removeItem(c[u].dataStorageKey),c[u]=void 0}i=Ew(o,a),c[a]={lastAccessMs:s,dataStorageKey:i}}n.setItem(Cw,JSON.stringify(c))}else i=Ew(o);var d=function(e,n,r){var i,o=null!==(i=e.get())&&void 0!==i?i:n;return o&&o.visuals&&(o=t(t({},o),{visuals:t(t({},o.visuals),{hasInteracted:void 0,visible:void 0})})),function(t,n){void 0===t&&(t=o);var i=r(t,n);return e.set(i),i}}(new dw(n,i),mw({accessToken:e.accessToken,userId:e.userId,attributes:e.attributes,sessionExpiration:e.sessionExpiration},{enableErrorOverlay:e.enableErrorOverlay}),Sw);return uw({reducer:d,middleware:function(e){return e({thunk:!0})},devTools:!1})}function Ew(e,t){var n="xappchat.".concat(e.serverUrl);return t?e.accountKey?"".concat(n,".").concat(e.accountKey,".").concat(t):"".concat(n,".").concat(t):e.accountKey?"".concat(n,".").concat(e.accountKey):n}function Nw(e,t,n,r){return void 0===r&&(r=Date.now()),!!t&&(r-t>=1e3*function(e){var t=e.match(/(\d+)([dhms]?)/);if(!t)return Gh("Invalid time string: ".concat(e)),0;var n=parseInt(t[1]);switch(t[2]){case"d":return 24*n*60*60;case"h":return 60*n*60;case"m":return 60*n;default:return n}}(e||"4h")&&(i=r,o=new Date(t),a=new Date(i),!(o.getFullYear()===a.getFullYear()&&o.getMonth()===a.getMonth()&&o.getDate()===a.getDate())));var i,o,a}function Iw(e){void 0===e&&(e=!1);var t=Z.useState(function(){return!e&&function(e){void 0===e&&(e=window);try{return new URL(e.location.href).searchParams.get(tb)===nb}catch(e){return!1}}()})[0];return Z.useEffect(function(){t&&function(e){void 0===e&&(e=window);try{var t=new URL(e.location.href);if(!t.searchParams.has(tb))return;t.searchParams.delete(tb),e.history.replaceState(e.history.state,"",t.toString())}catch(e){}}()},[t]),t}function Tw(e){Z.useEffect(function(){if(e){var t=function(e){for(var t="es-",n=0;n<e.length;n++)t+=jw(e.charAt(n));return t}(e);if(!document.getElementById(t)){var n=document.createElement("script");n.id=t,n.src=e,n.crossOrigin="anonymous",document.head.appendChild(n)}}},[e])}function jw(e){return e>="0"&&e<="9"||e>="a"&&e<="z"||e>="A"&&e<="Z"?e:"_".concat(e.charCodeAt(0),"_")}var Ow="data-xapp-form-page";function Pw(){return!("undefined"==typeof document||!document.body)&&"true"===document.body.getAttribute(Ow)}function Aw(){var e=Z.useState(Pw),t=e[0],n=e[1];return Z.useEffect(function(){if("undefined"!=typeof document&&document.body&&(n(Pw()),"undefined"!=typeof MutationObserver)){var e=new MutationObserver(function(){n(Pw())});return e.observe(document.body,{attributes:!0,attributeFilter:[Ow]}),function(){return e.disconnect()}}},[]),t}function Rw(e){var n,r,i,o,a,s,l=(i=Gy(),o=Rh(function(e){return e.visitorId||e.userId}),a=Rh(function(e){return e.accessToken}),s=Rh(function(e){return e.attributes}),Z.useMemo(function(){return{dispatch:i,visitorId:o,accessToken:a,userId:o,attributes:s}},[i,o,a,s])),c=Z.useRef(null),u=Z.useContext(nm),d=null!==(r=null===(n=null==u?void 0:u.env)||void 0===n?void 0:n.isAdmin)&&void 0!==r&&r,f=Rh(function(e){return e.sessionId}),p=Rh(function(e){return ib(e.chats)});Z.useEffect(function(){if(e&&c.current!==l&&(c.current=l,l.visitorId)){if(l.dispatch(bm({name:"Visitor",visitorId:l.visitorId,userId:l.userId,accessToken:l.accessToken,attributes:t(t({},l.attributes),{currentUrl:window.location.href}),hasConversation:p},f)),!d){var n=setTimeout(function(){var e,t=(void 0===e&&(e=!1),function(t){return function(n,r){e||r().connection.greetingRequested||(Yh("sending greeting"),t.sendChatMsg({text:void 0,attributes:{isGreeting:!0}},function(e){e&&Yh("Error sending message"),n({type:"sendGreeting",detail:void 0})}))}});l.dispatch(t)},1e3);return function(){clearTimeout(n)}}Yh("Admin widget. Not sending greeting.")}},[l,e,d])}var Mw={},Lw={};Object.defineProperty(Lw,"__esModule",{value:!0}),Lw.isActionBarChatButton=function(e){return"chat"===e.type},Lw.isActionBarFormButton=function(e){return"form"===e.type},Lw.isActionBarScheduleButton=function(e){return"schedule"===e.type},Lw.isActionBarPhoneButton=function(e){return"phone"===e.type},Lw.isActionBarUrlButton=function(e){return"url"===e.type},Lw.isActionBarEmailButton=function(e){return"email"===e.type},Lw.isActionBarHelpButton=function(e){return"help"===e.type},Lw.isActionBarPaymentButton=function(e){return"payment"===e.type};var Dw={},Bw={};function zw(e,t=2){return(new Array(t).join("0")+e).slice(-t)}function Uw(e){const t=null==e?void 0:e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([\d.]+)\)$/);if(t)return{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10),a:parseFloat(t[4])};const n=null==e?void 0:e.match(/^rgb?\((\d+),\s*(\d+),\s*(\d+)\)$/);return n?{r:parseInt(n[1],10),g:parseInt(n[2],10),b:parseInt(n[3],10)}:null}function Fw(e,t,n){return.299*e+.587*t+.114*n>186}function qw(e,t){if(!e)return;let n=0===e.indexOf("#")?e.slice(1):e;if(3===n.length&&(n=n[0]+n[0]+n[1]+n[1]+n[2]+n[2]),6!==n.length)throw new Error("Invalid HEX color.");const r=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),o=parseInt(n.slice(4,6),16);return t?Fw(r,i,o)?"#000000":"#FFFFFF":`#${zw((255-r).toString(16))}${zw((255-i).toString(16))}${zw((255-o).toString(16))}`}function Hw(e,t){const n=Uw(e);if(!n)return e;const{r:r,g:i,b:o}=n;return t?Fw(r,i,o)?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)":`rgba(${255-r}, ${255-i}, ${255-o}, 1)`}function Ww(e){if(!e)return!1;if(e.startsWith("#")){const t=e.slice(1);return(3===t.length||6===t.length)&&/^[0-9a-f]+$/i.test(t)}return null!==Uw(e)}
|
|
3
3
|
/*! Copyright (c) 2026, XAPP AI */
|
|
4
|
-
Object.defineProperty(
|
|
5
|
-
/*! Copyright (c) 2021, XAPPmedia */Object.defineProperty(
|
|
4
|
+
Object.defineProperty(Bw,"__esModule",{value:!0}),Bw.parseRgb=Uw,Bw.invertColorHEX=qw,Bw.invertColorRgb=Hw,Bw.invertColor=function(e,t){if(!e)return;return e.startsWith("#")?qw(e,t):Hw(e,t)},Bw.isSupportedColor=Ww,Bw.usableColorOr=function(e,t){return Ww(e)?e:t},Bw.readableTextOn=function(e){if(!Ww(e))return"#000000";const t=e.startsWith("#")?function(e){let t=e.slice(1);3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]);if(6!==t.length)return null;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}(e):Uw(e);if(!t)return"#000000";return Fw(t.r,t.g,t.b)?"#000000":"#FFFFFF"},Bw.darkenColor=function(e,t){if(!e)return e;let n,r,i,o,a;try{if(e.startsWith("#")){const t=e.match(/\w\w/g);t&&([n,r,i]=t.map(e=>parseInt(e,16)))}else if(e.startsWith("rgb")){const t=Uw(e);t&&({r:n,g:r,b:i,a:o}=t)}if(void 0===n||void 0===r||void 0===i)return console.error(`Unsupported color format: ${e}`),e;if(void 0!==o){const e=.3*n+.59*r+.11*i;let s=e*(1-t/100);s=Math.max(0,Math.min(255,s));const l=s/(e||1);n=Math.round(n*l),r=Math.round(r*l),i=Math.round(i*l),o+=t/100,o=Math.max(0,Math.min(1,o)),a=`rgba(${n}, ${r}, ${i}, ${o})`}else t>0?(n=Math.max(0,n-t),r=Math.max(0,r-t),i=Math.max(0,i-t)):(t=Math.abs(t),n=Math.min(255,n+t),r=Math.min(255,r+t),i=Math.min(255,i+t)),a=`#${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}catch(t){console.error(`Unsupported color format: ${e} - Error: ${t}`)}return a},Object.defineProperty(Dw,"__esModule",{value:!0}),Dw.buildChatWidgetChannel=function(e){var t;const{appId:n,apiUrl:r,mcpUrl:i,formWidgetKey:o,phoneNumber:a}=e,s=null===(t=e.businessName)||void 0===t?void 0:t.trim(),l=(0,Vw.usableColorOr)(e.primaryColor,$w);return Object.assign(Object.assign({type:"chat-widget",connection:{type:"mcp",serverUrl:`${i}/${n}`,mcp:{mode:"homeowner"}},theme:Qw(l,e.secondaryColor),actionBar:Kw({apiUrl:r,formWidgetKey:o,phoneNumber:a})},o?{formWidgetKey:o}:{}),s?{botName:s}:{})},Dw.buildChatTheme=Qw;const Vw=Bw,$w="#1AA7DC";function Kw(e){const{apiUrl:t,formWidgetKey:n,phoneNumber:r}=e,i=[];return n&&i.push({id:"book",type:"schedule",label:"Book",formConfig:{api:{url:t,key:n}}}),r&&i.push({id:"call",type:"phone",label:"Call",phoneNumber:r}),i.push({id:"chat",type:"chat",label:"Chat"}),{enabled:!0,position:"right",buttons:i}}function Qw(e,t){const n="RobotoRegular";return t||(t=(0,Vw.readableTextOn)(e)),{zIndex:"10000",border:{color:e,radius:"10px"},carousel:{button:{color:e},subtitle:{color:"#979797",fontFamily:n,fontSize:"12px",fontStyle:"normal",fontWeight:"normal"},title:{color:"#000",fontFamily:n,fontSize:"14px",fontStyle:"normal",fontWeight:"bold"}},chatButton:{background:e,margin:{bottom:"10px",left:"10px",right:"10px",top:"10px"}},content:{background:"#ffffff"},cta:{background:"#e1e2e1",text:{color:"#333333",fontFamily:n,fontSize:"14px"}},footer:{background:e,border:{color:e,radius:"0px",width:"0px"},branding:{text:{color:"#ffffff",fontFamily:n,fontSize:"14px",fontWeight:"normal",fontStyle:"normal"}}},header:{background:e,avatarBackground:"transparent",border:{color:e,radius:"0px",width:"0px"},text:{color:t,fontFamily:n,fontSize:"16px",fontWeight:"normal",fontStyle:"normal"},subtitle:{color:t,fontFamily:n,fontSize:"10px",fontWeight:"normal",fontStyle:"normal"}},input:{background:"#ffffff",border:{radius:"20px"},text:{color:"#000000",fontFamily:n,fontSize:"14px"},placeholder:{color:"#e1e2e1",fontFamily:n,fontSize:"14px",fontWeight:"normal",fontStyle:"normal"}},textTypingStatus:{text:{color:"#bfbfbf",fontFamily:n,fontSize:"14px",fontWeight:"normal",fontStyle:"normal"}},menu:{item:{height:"24px",text:{fontSize:"14px"}}},menuButton:{color:"#ffffff"},messages:{maxWidth:"400px",mine:{bubbleColor:"#f2f2f2",text:{color:"#454545",fontFamily:n,fontSize:"18px",fontStyle:"normal",fontWeight:"normal"}},others:{bubbleColor:"#e1e2e1",text:{color:"#262726",fontFamily:n,fontSize:"18px",fontStyle:"normal",fontWeight:"normal"}},padding:{bottom:"0px",left:"20px",right:"16px",top:"16px"}},refreshButton:{color:t},minimizeButton:{color:t},cancelButton:{color:t},primaryColor:e,sendButton:{color:"#505050",width:"20px"},size:{width:"500px",height:"700px"}}}var Jw={};Object.defineProperty(Jw,"__esModule",{value:!0});var Yw={};Object.defineProperty(Yw,"__esModule",{value:!0}),Yw.CHAT_WIDGET_CHANNEL=void 0,Yw.CHAT_WIDGET_CHANNEL="chat-widget";var Gw={};
|
|
5
|
+
/*! Copyright (c) 2021, XAPPmedia */Object.defineProperty(Gw,"__esModule",{value:!0});var Xw={};Object.defineProperty(Xw,"__esModule",{value:!0});var Zw={};Object.defineProperty(Zw,"__esModule",{value:!0});var ex={};Object.defineProperty(ex,"__esModule",{value:!0});var tx={};Object.defineProperty(tx,"__esModule",{value:!0}),tx.isStaticImageMenuItem=function(e){return!!e&&!!e.imageUrl},tx.isStaticTextMenuItem=function(e){return!!e&&!!e.body},tx.isStandardMenuItem=function(e){return!!e&&!!e.label},tx.isOpenURLMenuItem=function(e){return!!e&&!!e.url},function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=o&&o.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),
|
|
6
6
|
/*! Copyright (c) 2021, XAPPmedia */
|
|
7
|
-
n(cw,e),n(uw,e),n(kw,e),n(dw,e),n(Sw,e),n(Cw,e),n(_w,e),n(Ew,e),n(Nw,e),n(Iw,e)}(lw);var Tw=function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2zM9 14H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8 4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2z"})})},jw=function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})})},Ow=function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})})},Pw={chat:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"})})},form:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6zm2-6h8v2H8v-2zm0-3h8v2H8v-2zm0 6h5v2H8v-2z"})})},calendar:Tw,schedule:Tw,phone:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z"})})},link:jw,url:jw,email:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"})})},help:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"})})},payment:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"})})}},Rw=function(e){var t=e.type,n=e.icon,r=e.iconUrl,i=e.className;if(r)return f.jsx("div",{className:i,children:f.jsx("img",{src:r,alt:"".concat(n||t," icon")})});var o=Pw[n||t]||Ow;return f.jsx("div",{className:i,children:f.jsx(o,{})})},Mw=["http:","https:","tel:","mailto:"];function Aw(e,t,n){if(!function(e){try{var t=new URL(e,window.location.href);return Mw.includes(t.protocol)}catch(e){return!1}}(e))return console.warn("[ActionBar] Blocked navigation to unsafe URL:",e),!1;if("sameWindow"===t)window.location.href=e;else if("newWindow"===t&&n){var r="width=".concat(n.width||600,",height=").concat(n.height||400);window.open(e,"_blank",r)}else window.open(e,"_blank","noopener,noreferrer");return!0}var Lw={chat:"Chat",form:"Contact",schedule:"Book",phone:"Call",url:"Link",email:"Email",help:"Help",payment:"Pay"},Dw=function(e){var t,n=e.button,r=e.chatActive,i=e.onChatClick,o=e.onChatMinimize,a=e.onFormClick,s=e.isMobile,l=Z.useCallback(function(){if(lw.isActionBarChatButton(n))r?o():i();else if(lw.isActionBarFormButton(n)||lw.isActionBarScheduleButton(n))a(n);else if(lw.isActionBarPhoneButton(n)){var e=n.phoneNumber.replace(/\s/g,"");window.location.href="tel:".concat(e)}else if(lw.isActionBarUrlButton(n)){var t=n.url,s=n.target;Aw(t,void 0===s?"newTab":s,n.windowOptions)}else if(lw.isActionBarEmailButton(n)){var l=n.emailAddress,c=n.subject,u=n.body,d="mailto:".concat(l),f=[];c&&f.push("subject=".concat(encodeURIComponent(c))),u&&f.push("body=".concat(encodeURIComponent(u))),f.length>0&&(d+="?".concat(f.join("&"))),window.location.href=d}else if(lw.isActionBarHelpButton(n)){t=n.url;var h=n.target;Aw(t,void 0===h?"newTab":h)}else if(lw.isActionBarPaymentButton(n)){t=n.url;var p=n.target;Aw(t,void 0===p?"newTab":p)}},[n,r,i,o,a]),c=n.visibility||"all";if("mobile-only"===c&&!s)return null;if("desktop-only"===c&&s)return null;var u=n.label||Lw[n.type]||n.type,d=null!==(t=n.tabIndex)&&void 0!==t?t:0,h=lw.isActionBarChatButton(n)&&r,p=["xapp-action-bar__button",h?"xapp-action-bar__button--active":""].filter(Boolean).join(" ");return f.jsxs("button",{className:p,onClick:l,"aria-label":u,"aria-pressed":h,tabIndex:d,children:[f.jsx(Rw,{type:n.type,icon:n.icon,iconUrl:n.iconUrl,className:"xapp-action-bar__icon"}),n.label&&f.jsx("span",{className:"xapp-action-bar__label",children:n.label})]})},Bw=function(e){var t,n,r,i,o,a,s,l,c,u,d=e.config,h=e.isMobile,p=e.onClick,m=e.onDismiss,v=e.hasUserInteracted,g=Z.useState(!1),y=g[0],b=g[1],w=Z.useState(!1),x=w[0],k=w[1],S=Z.useState(!1),C=S[0],_=S[1],E=h?null===(t=d.mobile)||void 0===t?void 0:t.message:void 0,N=void 0!==E?E:d.message,I=h&&void 0!==(null===(n=d.mobile)||void 0===n?void 0:n.delay)?d.mobile.delay:null!==(r=d.delay)&&void 0!==r?r:0,T=h?null===(i=d.mobile)||void 0===i?void 0:i.timeout:void 0,j=void 0!==T?T:d.timeout,O=h?null===(o=d.mobile)||void 0===o?void 0:o.animation:void 0,P=void 0!==O?O:d.animation,R=h&&void 0!==(null===(a=d.mobile)||void 0===a?void 0:a.animationDelay)?d.mobile.animationDelay:null!==(s=d.animationDelay)&&void 0!==s?s:I,M=h&&void 0!==(null===(l=d.mobile)||void 0===l?void 0:l.animationTimeout)?d.mobile.animationTimeout:d.animationTimeout,A=h&&void 0!==(null===(c=d.mobile)||void 0===c?void 0:c.dismissible)?d.mobile.dismissible:null===(u=d.dismissible)||void 0===u||u;Z.useEffect(function(){if(N&&!v&&!C){var e=setTimeout(function(){b(!0)},I);return function(){return clearTimeout(e)}}b(!1)},[N,I,v,C]),Z.useEffect(function(){if(y&&j){var e=setTimeout(function(){b(!1)},j);return function(){return clearTimeout(e)}}},[y,j]),Z.useEffect(function(){if(P&&!v&&!C){var e=setTimeout(function(){k(!0)},R);return function(){return clearTimeout(e)}}k(!1)},[P,R,v,C]),Z.useEffect(function(){if(x&&M){var e=setTimeout(function(){k(!1)},M);return function(){return clearTimeout(e)}}},[x,M]);var L=function(){p(),b(!1)};if(!y||!N)return null;var D=x&&P?"xapp-action-bar-cta--".concat(P):"";return f.jsxs("div",{className:"xapp-action-bar-cta ".concat(D),onClick:L,role:"button",tabIndex:0,"aria-label":N,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),L())},children:[f.jsx("span",{className:"xapp-action-bar-cta__message",children:N}),A&&f.jsx("button",{className:"xapp-action-bar-cta__dismiss",onClick:function(e){e.stopPropagation(),_(!0),b(!1),m()},"aria-label":"Dismiss",type:"button",children:f.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("path",{d:"M13 1L1 13M1 1L13 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})},zw="--xapp-action-bar-height";function Uw(e){return lw.isActionBarFormButton(e)||lw.isActionBarScheduleButton(e)}function Fw(e,t){void 0===e&&(e=[]),void 0===t&&(t={});var n=t.chatDisabled,r=t.formDisabled;return e.filter(function(e){return(!n||!lw.isActionBarChatButton(e))&&(!r||!Uw(e))})}var qw=function(e){var t,n,r=e.config,i=e.visible,o=e.chatDisabled,a=e.formDisabled,s=e.hasUserInteracted,l=void 0!==s&&s,c=e.onChatClick,u=e.onChatMinimize,d=e.onFormClick,h=e.onCtaDismiss,p=Z.useState(!1),m=p[0],v=p[1],g=null!=r.mobileBreakpoint?"(max-width: ".concat(r.mobileBreakpoint,"px)"):My,y=null!==(t=r.position)&&void 0!==t?t:"right",b=Z.useRef(null);Z.useEffect(function(){if("function"==typeof window.matchMedia){var e=window.matchMedia(g);v(e.matches);var t=function(e){v(e.matches)};return"function"==typeof e.addEventListener?(e.addEventListener("change",t),function(){return e.removeEventListener("change",t)}):(e.addListener(t),function(){return e.removeListener(t)})}},[g]),Z.useLayoutEffect(function(){var e=b.current;if(e){var t=function(){var t=e.getBoundingClientRect().height;t<=0||document.documentElement.style.setProperty(zw,"".concat(t,"px"))};if(t(),"undefined"==typeof ResizeObserver)return function(){document.documentElement.style.removeProperty(zw)};var n=new ResizeObserver(t);return n.observe(e),function(){n.disconnect(),document.documentElement.style.removeProperty(zw)}}},[m]);var w=Fw(r.buttons,{chatDisabled:o,formDisabled:a}),x=["xapp-action-bar","xapp-action-bar--".concat(y),m?"xapp-action-bar--mobile":"xapp-action-bar--desktop"].filter(Boolean).join(" "),k=w.some(lw.isActionBarChatButton),S=(null===(n=r.cta)||void 0===n?void 0:n.message)&&!i&&!o&&k;return 0===w.length?null:f.jsxs("div",{ref:b,className:x,role:"toolbar","aria-label":"Chat actions",children:[S&&f.jsx("div",{className:"xapp-action-bar-cta-wrapper",children:f.jsx(Bw,{config:r.cta,isMobile:m,onClick:function(){c()},onDismiss:function(){null==h||h()},hasUserInteracted:l})}),f.jsx("div",{className:"xapp-action-bar__buttons",children:w.map(function(e){return f.jsx(Dw,{button:e,chatActive:i,onChatClick:c,onChatMinimize:u,onFormClick:d,isMobile:m},e.id)})})]})};function Hw(){var e=Z.useRef(null),t=Z.useState(),n=t[0],r=t[1];return Z.useLayoutEffect(function(){var t,n;r(null===(n=null===(t=e.current)||void 0===t?void 0:t.getBoundingClientRect())||void 0===n?void 0:n.toJSON())},[]),[e,n]}function Ww(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Vw(e,t){return{x:e.x-t.x,y:e.y-t.y}}function $w(e,t){return{x:e.x*t,y:e.y*t}}function Kw(e){return Math.sqrt(e.x*e.x+e.y*e.y)}function Qw(e,t){var n=t*Math.PI/180,r=Math.cos(n),i=Math.sin(n);return{x:e.x*r+e.y*i,y:e.y*r-e.x*i}}function Jw(e,t){var n=Vw(t.start,e.center),r=n.x,i=n.y,o=t.direction.x,a=t.direction.y,s=e.radius.x,l=e.radius.y,c=s*s,u=l*l,d=o*o/c+a*a/u,f=2*o*r/c+2*a*i/u,h=f*f-4*d*(r*r/c+i*i/u-1);if(h>=0){var p=Math.sqrt(h),m=(-f-p)/(2*d),v=(-f+p)/(2*d);if(m>0&&v>0)return Ww(t.start,$w(t.direction,Math.min(m,v)));if(m>0)return Ww(t.start,$w(t.direction,m));if(v>0)return Ww(t.start,$w(t.direction,v))}return t.start}function Yw(e,t){var n,r,i,o=e.direction*Math.PI/180,a={x:e.width/2,y:e.height/2},s={x:t.x/2,y:t.y/2},l={x:a.x*Math.cos(o),y:a.y*Math.sin(o)},c=(n=l,r=Kw(l)+e.length,(i=Kw(n))?$w(n,r/i):n),u=Ww(c,s),d=Vw(l,c),f=e.angle,h=Qw(d,f/2),p=Qw(d,-f/2),m={center:s,radius:a},v=Jw(m,{start:u,direction:h}),g=Jw(m,{start:u,direction:p});return"m ".concat(u.x," ").concat(u.y," L ").concat(v.x," ").concat(v.y," L ").concat(g.x," ").concat(g.y," z")}var Gw=function(e){var t,n,r=Hw(),i=r[0],o=r[1],a={x:null!==(t=null==o?void 0:o.width)&&void 0!==t?t:0,y:null!==(n=null==o?void 0:o.height)&&void 0!==n?n:0};return f.jsx("div",{ref:i,className:"cta-bubble__tail",children:f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(a.x," ").concat(a.y),children:f.jsx("path",{d:Yw(e,a),fill:"currentColor"})})})},Xw=function(e){var t,n,r,i,o=Hw(),a=o[0],s=o[1],l=(e.animate||!1)&&"bounce"===e.buttonAnimation?"bounce":"none";return console.log("Returning CTABubble with message: ",e.children),f.jsxs("div",{ref:a,style:{border:e.borderStyle?"solid":"none",borderWidth:(null===(t=e.borderStyle)||void 0===t?void 0:t.width)||"0px",borderColor:(null===(n=e.borderStyle)||void 0===n?void 0:n.color)||"transparent",animation:"".concat(l," 1s infinite")},className:"cta-bubble",onClick:e.onClick,children:[f.jsx(Gw,{width:null!==(r=null==s?void 0:s.width)&&void 0!==r?r:0,height:null!==(i=null==s?void 0:s.height)&&void 0!==i?i:0,direction:60,angle:45,length:16}),f.jsx("div",{className:"cta-bubble__content",children:e.children}),e.dismissible&&f.jsx("button",{className:"cta-bubble__dismiss",onClick:function(t){t.stopPropagation(),e.onDismiss&&e.onDismiss()},"aria-label":"Dismiss",children:f.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("path",{d:"M11 1L1 11M1 1L11 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})},Zw=function(e){var t=e.visible,n=e.timeout,r=e.delay,i=e.animate,o=e.buttonAnimation,a=e.dismissible,s=e.onClick,l=e.onDismiss,c=e.children;Yp("[CtaBubbleContainer] Props received:",{visible:t,timeout:n,delay:r,animate:i,buttonAnimation:o,dismissible:a,hasOnClick:!!s,hasOnDismiss:!!l,hasChildren:!!c,childrenContent:c});var u=Z.useMemo(function(){var e=t?(new Date).valueOf():void 0;return Yp("[CtaBubbleContainer] StartTime calculated: visible=".concat(t,", startTime=").concat(e)),e},[t]),d=Z.useState(!1),h=d[0],p=d[1];Yp("[CtaBubbleContainer] Current state: showBubble=".concat(h)),Z.useEffect(function(){Yp("[CtaBubbleContainer] useEffect triggered with:",{startTime:u,startTimeExists:!!u,timeout:n,timeoutType:typeof n,delay:r,delayType:typeof r,visible:t});var e=null,i=null,o=!0;if(u){var a=r||0;Yp("[CtaBubbleContainer] Timer setup: actualDelay=".concat(a,"ms (from delay=").concat(r,")")),i=setTimeout(function(){Yp("[CtaBubbleContainer] Delay timer fired after ".concat(a,"ms, isMounted=").concat(o)),o?(Yp("[CtaBubbleContainer] Component still mounted, setting showBubble=true"),p(!0),"number"==typeof n?(Yp("[CtaBubbleContainer] Hide timer setup: will hide after ".concat(n,"ms")),e=setTimeout(function(){Yp("[CtaBubbleContainer] Hide timer fired after ".concat(n,"ms, isMounted=").concat(o)),o?(Yp("[CtaBubbleContainer] Component still mounted, setting showBubble=false"),p(!1)):Yp("[CtaBubbleContainer] Component unmounted, skipping hide")},n)):Yp("[CtaBubbleContainer] No hide timer set (timeout=".concat(n,", type=").concat(typeof n,")"))):Yp("[CtaBubbleContainer] Component unmounted before delay timer, not showing bubble")},a)}else Yp("[CtaBubbleContainer] No startTime, skipping timer setup");return function(){Yp("[CtaBubbleContainer] Cleanup triggered, unmounting component"),o=!1,e&&(Yp("[CtaBubbleContainer] Clearing hide timer"),clearTimeout(e)),i&&(Yp("[CtaBubbleContainer] Clearing delay timer"),clearTimeout(i))}},[u,n,r,t]);var m=t&&h;return Yp("[CtaBubbleContainer] Render decision: visible=".concat(t,", showBubble=").concat(h,", shouldRender=").concat(m)),f.jsx(f.Fragment,{children:t&&h&&f.jsx(Xw,{onClick:s,animate:i,buttonAnimation:o,dismissible:a,onDismiss:function(){Yp("[CtaBubbleContainer] handleDismiss called, setting showBubble=false"),p(!1),l&&(Yp("[CtaBubbleContainer] Calling onDismiss callback"),l())},children:c})})},ex=function(e){var t,n=e.onClick,r=e.addClass,i=e.config,o=e.visible,a=e.borderStyle,s=e.imageUrl,l=e.hasInteracted,c=e.onCtaDismiss,u=Z.useState(em),d=u[0],h=u[1],p=Z.useState(!1),m=p[0],v=p[1],g=(null===(t=null==i?void 0:i.mobile)||void 0===t?void 0:t.applyAtLessThanWidth)||"400",y=window.innerWidth<=parseInt(g,10)&&(null==i?void 0:i.mobile)?i.mobile:i;Z.useEffect(function(){var e,t,n;if(l)return v(!1),function(){};var r=null!==(e=null==y?void 0:y.animationDelay)&&void 0!==e?e:null==y?void 0:y.delay;return r?t=setTimeout(function(){v(!0),y.animationTimeout&&(n=setTimeout(function(){v(!1)},y.animationTimeout))},r):(null==y?void 0:y.animationTimeout)?(v(!0),n=setTimeout(function(){v(!1)},y.animationTimeout)):(null==y?void 0:y.animation)&&v(!0),function(){t&&clearTimeout(t),n&&clearTimeout(n)}},[y,v,l]);var b=m&&!l?(null==y?void 0:y.animation)||"wiggle":"none";Z.useEffect(function(){var e=function(){var e=window.innerWidth<parseInt(g,10)?"30":em;h(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[g]);var w=Math.min(22,+d/48*22);return f.jsxs("button",{"aria-label":"open chat",className:"xapp-chat-button ".concat(r||"").trim(),onClick:n,children:[f.jsx("div",{id:"xapp-widget-button",className:"xapp-chat-button__btn",style:{width:"".concat(d,"px"),height:"".concat(d,"px"),borderRadius:"".concat(+d/2,"px"),border:a&&a.width?"solid":"none",borderWidth:(null==a?void 0:a.width)||"0px",borderColor:(null==a?void 0:a.color)||"transparent",animation:"".concat(b," 1s infinite")},children:s?f.jsx("img",{src:s,alt:"Chat Icon"}):f.jsx("svg",{width:w,height:w,viewBox:"0 0 22 22",children:f.jsx("path",{d:"M13 22l-4-6H2c-1.11-.043-2-.935-2-2V2C0 .89.89 0 2 0h18c1.11 0 2 .892 2 2v12c0 1.067-.89 1.957-2 2h-3l-4 6zm3-8h4c-.005.3-.01-12 0-12-.01.004-18 .006-18 0 .005.006 0 12 0 12h8l3 5 3-5z",fill:"#FFF",fillRule:"evenodd"})})}),y&&y.message&&!l&&f.jsx("div",{className:"xapp-chat-button__cta",children:f.jsx(Zw,{timeout:null==y?void 0:y.timeout,delay:null==y?void 0:y.delay,animate:m,buttonAnimation:b,dismissible:null==y?void 0:y.dismissible,visible:!o,onDismiss:c,children:null==y?void 0:y.message})})]})};function tx(e,t){var n=Z.useState(),r=n[0],i=n[1],o=Z.useState(-1),a=o[0],s=o[1],l=Z.useState(e),c=l[0],u=l[1],d=Z.useState(t),f=d[0],h=d[1];Z.useEffect(function(){u(e)},[e]),Z.useEffect(function(){h(t)},[t]);var p=Z.useMemo(function(){return r?fv(r,a):void 0},[r,a]),m=Z.useCallback(function(e){if(r){var t=pv(r);s(function(n){return function(e,t){return(e+t)%t}(n+e+(n<0&&e<=0?1:0),t)})}else s(-1)},[r]),v=Z.useCallback(function(e){switch(e){case"prev":m(-1);break;case"next":m(1);break;case"cancel":s(-1),u(void 0),h(void 0)}},[m]),g=function(e,t){var n=rm(),r=null==n?void 0:n.autocompleteSuggestionsUrl;return yv({url:r,query:e,context:t})}(c||"",f),y="success"===g.state?g.data:void 0,b=Z.useMemo(function(){return y?mv(y,-1).map(function(e){return{heading:e.heading,items:e.items.slice().reverse()}}):void 0},[y]);return Z.useEffect(function(){var e=p;i(b),e&&b||s(-1)},[b,p]),Z.useMemo(function(){return{suggestions:r,index:a,execute:v,item:p}},[r,a,v,p])}var nx=function(e){var t=e.onAdminJoin,n=Z.useRef(null),r=Z.useState(!1),i=r[0],o=r[1],a=Z.useState(""),s=a[0],l=a[1];function c(e){l(e.target.value)}var u=""===s||void 0===s,d=_y();function h(e){var r,a;e.preventDefault(),i?(d(function(e){return function(){e.bargeOut(function(e){e&&Yp(e)})}}),o(!1),t(!1),l("")):(d((a=null===(r=n.current)||void 0===r?void 0:r.value,function(e){return function(){e.bargeIn(a,function(e){e&&Yp(e)})}})),o(!0),t(!0))}return f.jsx("div",{className:"xappw-admin-input-container visible",children:i?f.jsx("form",{className:"xappw-admin-input-form",onSubmit:h,children:f.jsx("div",{className:"xappw-admin-input-form__buttons",children:f.jsx(lm,{addClass:"xappw-admin-input-form__btn",type:"submit",label:"Leave"})})}):f.jsxs("form",{className:"xappw-admin-input-form",onSubmit:h,children:[f.jsx("div",{className:"xappw-admin-input-form__buttons",children:f.jsx(lm,{addClass:"xappw-admin-input-form__btn",type:"submit",label:"Join",disable:u})}),f.jsx("div",{className:"xappw-admin-input",children:f.jsx("input",{ref:n,id:"adminBarInput",placeholder:"Type your name here...",className:"xappw-admin-input__input",onChange:c})})]})})};var rx=function(e){var t,n=e.text,r=e.applyBrandingClass,i=e.linkColor,o=(t={"chat-footer__branding":r},Object.keys(t).filter(function(e){return t[e]}).join(" ")),a=n.replace(/\[(.*?)\]\((.*?)\)/g,function(e,t,n){return'<a style="color: '.concat(i||"",'; text-decoration: underline;" href="').concat(n,'" target="_blank" rel="noopener noreferrer">').concat(t,"</a>")}).replace(/\*\*(.*?)\*\*/g,function(e,t){return"<b>".concat(t,"</b>")}).replace(/^(#{1,6}) (.*?)(?=\n|$)/gm,function(e,t,n){var r=t.length;return"<h".concat(r,">").concat(n,"</h").concat(r,">")});return f.jsx("div",{className:o,dangerouslySetInnerHTML:{__html:a}})},ix=function(e){var t=e.text;return(null==t?void 0:t.match(/\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/))?f.jsx(rx,{text:t,applyBrandingClass:!0,linkColor:"white"}):f.jsx("div",{className:"chat-footer__branding",style:{color:"white"},children:t})},ox=function(e){var t=e.subtitle?f.jsxs("span",{children:[f.jsx("div",{children:e.label}),f.jsx("div",{className:"chat-menu-item--subtitle",children:e.subtitle})]}):f.jsx("span",{children:e.label});return f.jsx("button",{type:"button",className:"chat-menu-item",tabIndex:e.tabIndex?Number(e.tabIndex):0,onClick:function(){e.onClick&&e.onClick(e.label)},children:t})},ax=function(e){var t=e.items,n=e.opened,r=e.openFrom||"bottom",i=Ly(),o=Cm(),a=Mp(function(e){return e.visuals});return f.jsx("div",{className:"chat-menu-".concat(r," ").concat("chat-menu-".concat(r,n?"--opened":"--closed")),children:t.map(function(t,n){return lw.isStandardMenuItem(t)?f.jsx(ox,{onClick:e.onItemClick,label:t.label,subtitle:t.subtitle},n):lw.isStaticImageMenuItem(t)?f.jsx("div",{className:"chat-menu-item-static",children:f.jsx("img",{style:{maxHeight:"100%",maxWidth:"auto"},src:t.imageUrl,alt:"Menu Item"})},n):lw.isStaticTextMenuItem(t)?f.jsx("div",{className:"chat-menu-item-static-text",children:f.jsxs("div",{children:[f.jsx("div",{children:t.title}),f.jsx("div",{className:"chat-menu-item-static-text--body",children:t.body})]})},n):lw.isOpenURLMenuItem(t)?f.jsx("button",{className:"chat-menu-item",onClick:i.bind(undefined,t.url,o,a,t.behavior),children:t.text},n):f.jsx("p",{children:"Unknown"})})})},sx=function(e){var t=e.bars;return t||(t=2),f.jsx("button",{className:"drawer-bars",tabIndex:e.tabIndex?Number(e.tabIndex):0,"aria-label":"open menu","aria-hidden":!1,onClick:e.onToggle,children:function(){for(var e=[],n=0;n<t;n++)e.push(f.jsx("div",{className:"drawer-bar bar".concat(n)},"drawer-bar-".concat(n)));return e}()})},lx=function(){return f.jsx("svg",{style:{color:"grey",paddingRight:"5px"},xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16",children:f.jsx("path",{d:"M1.293 1.293a1 1 0 0 1 1.414 0L8 6.586l5.293-5.293a1 1 0 1 1 1.414 1.414L9.414 8l5.293 5.293a1 1 0 0 1-1.414 1.414L8 9.414l-5.293 5.293a1 1 0 0 1-1.414-1.414L6.586 8 1.293 2.707a1 1 0 0 1 0-1.414z"})})},cx=function(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16",children:f.jsx("path",{fillRule:"evenodd",d:"M2 13.5a.5.5 0 0 0 .5.5h6a.5.5 0 0 0 0-1H3.707L13.854 2.854a.5.5 0 0 0-.708-.708L3 12.293V7.5a.5.5 0 0 0-1 0v6z"})})},ux=function(){return f.jsx("svg",{viewBox:"80.208 98.129 313.069 282.823",xmlns:"http://www.w3.org/2000/svg",children:f.jsxs("g",{transform:"matrix(0.024498, 0, 0, -0.038359, 79.83091, 381.182404)",fill:"currentColor",stroke:"none",children:[f.jsx("path",{d:"M12670 7345 c-63 -18 -272 -77 -465 -130 -192 -53 -478 -132 -635 -175 -508 -141 -1091 -302 -2345 -649 -676 -187 -2038 -563 -3025 -836 -987 -273 -2072 -573 -2410 -666 -338 -94 -802 -222 -1030 -285 -1857 -514 -2579 -714 -2684 -742 -38 -10 -65 -21 -60 -24 5 -3 67 -22 139 -41 72 -20 326 -90 565 -157 239 -67 611 -170 825 -230 215 -60 586 -163 825 -230 239 -67 491 -137 560 -156 l126 -34 974 439 c1397 629 4128 1858 6050 2724 910 410 1826 822 2035 917 209 94 387 173 395 176 35 10 -66 -39 -8200 -3928 -586 -280 -1068 -512 -1071 -516 -3 -4 33 -117 82 -252 76 -213 355 -996 765 -2147 65 -183 120 -330 122 -329 1 2 114 558 250 1236 l248 1233 3455 2064 c1900 1135 3670 2193 3933 2351 264 158 491 293 505 301 62 33 -5 -12 -271 -182 -1671 -1070 -7188 -4613 -7188 -4617 0 -7 3661 -2455 3669 -2454 4 1 3713 6853 3977 7347 8 15 11 27 7 26 -5 0 -60 -15 -123 -34z"}),f.jsx("path",{d:"M5030 2232 c-15 -61 -479 -1861 -531 -2058 -21 -83 -39 -154 -39 -158 0 -3 369 330 820 740 452 411 817 750 813 754 -11 10 -1025 754 -1039 763 -8 4 -16 -10 -24 -41z"})]})})},dx=function(e){var t=e.disabled,n=void 0!==t&&t,r=ee.useState(!1),i=r[0],o=r[1];return f.jsx(f.Fragment,{children:e.sendButtonIcon?f.jsx("button",{className:"xappw-custom-send-button ".concat(n?"disabled":""),tabIndex:e.tabIndex?Number(e.tabIndex):0,onClick:e.onClick,disabled:n,onMouseEnter:function(){return o(!0)},onMouseLeave:function(){return o(!1)},children:f.jsx("img",{src:n&&e.sendButtonIconDisabled?e.sendButtonIconDisabled:i&&!n&&e.sendButtonIconHover?e.sendButtonIconHover:e.sendButtonIcon,alt:"Send button",draggable:!1,className:"send-button-icon"})}):f.jsx(lv,{className:"xappw-send-button ".concat(e.className||""," ").concat(n?"disabled":""),tabIndex:e.tabIndex,onClick:n?void 0:e.onClick,icon:ux})})},fx=function(e){var t,n,r=e.value,i=e.placeholder,o=e.sendButtonIcon,a=e.sendButtonIconHover,s=e.sendButtonIconDisabled,l=e.suggestion,c=e.footerConfig,u=e.inputConfig,d=e.onChange,h=e.onSubmit,p=e.onSuggestionCommand,m=Z.useState(!1),v=m[0],g=m[1],y=null==u?void 0:u.maxLength,b=r.text.length,w=void 0!==y&&b>=y,x=void 0!==y&&b>=.8*y;var k=Z.useCallback(function(e){e&&e.preventDefault(),h(r)},[r,h]),S=Z.useCallback(function(){d({text:"",formats:[]})},[d]),C=Z.useCallback(function(e){!l||"End"!==e.key&&"ArrowRight"!==e.key&&"Enter"!==e.key?p&&("ArrowUp"===e.key?(p("prev"),e.preventDefault()):"ArrowDown"===e.key?(p("next"),e.preventDefault()):"Escape"===e.key&&(p("cancel"),e.preventDefault())):d(l)},[l,d,p]);return f.jsx("div",{className:"xappw-input-container ".concat(e.addClass," ").concat(v?"drag-drop-zone":""),"aria-label":(r.text,"To clear input field click on clear icon on the left of send button"),"aria-hidden":!1,onDrop:function(t){g(!1),e.onFileUpload(t)},onDragOver:function(e){g(!0),e.preventDefault(),e.dataTransfer.dropEffect="copy"},onDragLeave:function(){g(!1)},children:f.jsxs("form",{className:"xappw-input-form",onSubmit:k,children:[f.jsx(cv,{id:"chatWidgetInput",className:"xappw-input",placeholder:null!=i?i:"type your question here",tabIndex:null==u?void 0:u.tabIndex,maxLength:y,onInput:d,onChange:d,onKeyDown:C,value:r,spellCheck:!0},"input"),f.jsxs("div",{className:"xappw-input-form__buttons",children:[x&&f.jsxs("span",{className:"xappw-input-form__counter".concat(w?" xappw-input-form__counter--limit":""),children:[b,"/",y]}),r.text&&f.jsx(lv,{icon:lx,tabIndex:null===(t=null==c?void 0:c.clearButton)||void 0===t?void 0:t.tabIndex,className:"xappw-input-form__btn",onClick:S}),f.jsx(dx,{className:"xappw-input-form__btn",sendButtonIcon:o,sendButtonIconHover:a,sendButtonIconDisabled:s,tabIndex:null===(n=null==c?void 0:c.sendButton)||void 0===n?void 0:n.tabIndex,disabled:!r.text,onClick:k})]})]})})};var hx=function(e){var t=e.data,n=e.onItemUse,r=e.searchTerms,i=Z.useState(),o=i[0],a=i[1],s=Z.useState(),l=s[0],c=s[1];Z.useEffect(function(){t&&a(t),r||(a(void 0),c(void 0))},[t,r]);var u=(null==t?void 0:t.length)>0?e.index:NaN,d=Z.useMemo(function(){return fv(t,u)},[t,u]),h=Z.useCallback(function(e,t){if("inputText"===t.type)return n(e),c(void 0),!1},[n]);Z.useEffect(function(){c(d)},[d]);var p,m=Z.useMemo(function(){return function(e){return function(t){var n=t.data,r="FAQ"!==n.type,i=Z.useCallback(function(t){e(n),t.stopPropagation()},[n]);return r?f.jsx(lv,{className:"xappw-suggestions__use",onClick:i,icon:cx}):f.jsx(f.Fragment,{})}}(n)},[n]),v="xappw-suggestions ".concat(e.className||""," ").concat(e.hasWsButton?"xappw-suggestions--with-ws-button":"").trim();return f.jsxs("div",{className:v,children:[(null==l?void 0:l.content)&&f.jsx("div",{className:"xappw-suggestions__answer",children:(p=l.content,p.split("\n").map(function(e,t){return e?f.jsx(rx,{text:e},"line-".concat(t)):f.jsx(ee.Fragment,{},"line-".concat(t))}))}),o&&o.length>0&&f.jsx(uv,{suggestions:o,index:u,className:"xappw-suggestions__groups",itemActions:m,onItemClick:e.onItemClick,onItemHover:c,onSpanClick:h})]})},px=function(e){var t,n,r,i=e.isAdmin,o=e.isChatting,a=e.visible,s=e.placeholder,l=e.sendButtonIcon,c=e.sendButtonIconHover,u=e.sendButtonIconDisabled,d=e.footerConfig,h=e.menuConfig,p=e.inputConfig,m=e.hasWsButton,v=e.disabled,g=e.onSubmit,y=Cm(),b=Z.useState(!1),w=b[0],x=b[1],k=Z.useState(),S=k[0],C=k[1],_=tx(S,Mp(function(e){return e.activeContexts})),E="FOOTER"===((null==h?void 0:h.menuButtonLocation)||"FOOTER"),N=null==h?void 0:h.items,I=null==h?void 0:h.itemsTabIndex,T=null===(t=null==h?void 0:h.button)||void 0===t?void 0:t.tabIndex,j=Z.useMemo(function(){return N||[]},[N]),O=null===(n=null==d?void 0:d.branding)||void 0===n?void 0:n.enabled,P=null===(r=null==d?void 0:d.branding)||void 0===r?void 0:r.text,R=Z.useState(!i),M=R[0],A=R[1],L=Z.useState({text:"",formats:[]}),D=L[0],B=L[1];var z=Z.useCallback(function(e){C(""),B({text:"",formats:[]}),g(e.text)},[g]),U=Z.useCallback(function(e){z(e)},[z]),F=Z.useCallback(function(e){B(e),C(e.text)},[]);return f.jsxs("div",{className:"chat-footer background-footer","aria-label":j.length?"to open menu click a button above the rounded rectangle at the bottom of widget":"","aria-hidden":!1,children:[E&&j.length?f.jsxs(f.Fragment,{children:[w?f.jsx(ax,{opened:w,tabIndex:I,onItemClick:function(t){x(!1),e.onSubmit(t)},items:j}):f.jsx(f.Fragment,{}),f.jsx("div",{className:"chat-footer__menu-icon",children:f.jsx(sx,{tabIndex:T,onToggle:function(){var e=!w;x(e),y(Iy({drawer:e}))}})})]}):f.jsx(f.Fragment,{}),f.jsx(hx,{className:"xappw-chat-footer__suggestions",data:_.suggestions,index:_.index,searchTerms:S,hasWsButton:m,onItemClick:U,onItemUse:F}),i&&o&&a&&f.jsx(nx,{onAdminJoin:function(e){A(e)}}),f.jsx("div",{style:{pointerEvents:M&&!v?"auto":"none",opacity:M?1:.5},children:f.jsx(fx,{addClass:"chat-footer__input "+(o&&a?"visible":""),suggestion:_.item,value:D,placeholder:s,sendButtonIcon:l,sendButtonIconHover:c,sendButtonIconDisabled:u,footerConfig:d,inputConfig:p,onSubmit:z,onChange:function(t){B(t),e.onChange(t.text),C(t.text)},onSuggestionCommand:_.execute,onFileUpload:e.onFileUpload})}),O&&P&&f.jsx(ix,{text:P})]})};var mx=function(e){var t,i,o=e.config,a=e.widgetEnv,s=e.onClose,l=Z.useRef(null),c=Z.useRef(null),u=function(e,t){var n;return e.formConfig?{api:e.formConfig.api,intentId:e.formConfig.intentId,autoGreeting:e.formConfig.autoGreeting}:(null===(n=null==t?void 0:t.connection)||void 0===n?void 0:n.serverUrl)?{api:{url:t.connection.serverUrl,key:t.connection.accountKey},intentId:e.intentId,autoGreeting:e.autoGreeting}:null}(o,a),d=Z.useState("idle"),h=d[0],p=d[1],m=Z.useState(""),v=m[0],g=m[1],y=(null===(i=null===(t=o.formConfig)||void 0===t?void 0:t.api)||void 0===i?void 0:i.key)||(null==a?void 0:a.formWidgetKey),b=Z.useCallback(function(){return n(void 0,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return Wp()?[4,$p(o.preselectChipLabel?{preselectChipLabel:o.preselectChipLabel}:void 0,5,100)]:[3,2];case 1:if(e.sent())return p("success"),s(),[2];e.label=2;case 2:if(!y)return[3,8];p("loading"),e.label=3;case 3:return e.trys.push([3,6,,7]),[4,Hp(y)];case 4:return e.sent(),[4,$p(o.preselectChipLabel?{preselectChipLabel:o.preselectChipLabel}:void 0,30,100)];case 5:return e.sent()?(p("success"),s()):(p("error"),g("Form widget loaded but failed to open. Please try again.")),[3,7];case 6:return e.sent(),p("error"),g("Failed to load form. Please check your connection and try again."),[3,7];case 7:return[3,9];case 8:p("error"),g("Form widget key not configured. Please contact support."),e.label=9;case 9:return[2]}})})},[o.preselectChipLabel,y,s]);Z.useEffect(function(){b()},[b]),Z.useEffect(function(){var e=function(e){"Escape"===e.key&&s()};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[s]),gv(),Z.useEffect(function(){c.current&&c.current.focus()},[]);var w=Z.useCallback(function(e){e.target===l.current&&s()},[s]),x=Z.useCallback(function(){p("idle"),g(""),b()},[b]);return u||y?f.jsx("div",{className:"xapp-form-modal",ref:l,onClick:w,role:"dialog","aria-modal":"true","aria-label":"Form",children:f.jsxs("div",{className:"xapp-form-modal__content",ref:c,tabIndex:-1,children:[f.jsx("button",{className:"xapp-form-modal__close",onClick:s,"aria-label":"Close form",children:"×"}),f.jsxs("div",{className:"xapp-form-modal__form-container",children:["loading"===h&&f.jsxs("div",{className:"xapp-form-modal__loading",children:[f.jsx("div",{className:"xapp-form-modal__spinner","aria-hidden":"true"}),f.jsx("p",{children:"Loading form..."})]}),"error"===h&&f.jsxs("div",{className:"xapp-form-modal__error",children:[f.jsx("p",{children:v}),f.jsx("button",{className:"xapp-form-modal__retry",onClick:x,children:"Try Again"})]}),"idle"===h&&f.jsxs("div",{className:"xapp-form-modal__loading",children:[f.jsx("div",{className:"xapp-form-modal__spinner","aria-hidden":"true"}),f.jsx("p",{children:"Initializing..."})]})]})]})}):f.jsx("div",{className:"xapp-form-modal",ref:l,onClick:w,role:"dialog","aria-modal":"true","aria-label":"Form",children:f.jsxs("div",{className:"xapp-form-modal__content",ref:c,tabIndex:-1,children:[f.jsx("button",{className:"xapp-form-modal__close",onClick:s,"aria-label":"Close form",children:"×"}),f.jsxs("div",{className:"xapp-form-modal__error",children:[f.jsx("p",{children:"Form configuration not available."}),f.jsx("p",{children:"Please configure the form button with valid settings."})]})]})})},vx=function(e){var t=e.option,n=t.actionUrl?"chat-chip chat-chip-link":"chat-chip";return f.jsx("div",{onClick:function(){return null==e?void 0:e.onClick(t)},className:n,children:f.jsx("span",{children:"object"==typeof t?t.label:t})})},gx=function(e){return f.jsx("div",{className:"chat-chips",children:e.options.map(function(t,n){return f.jsx(vx,{onClick:e.onOptionClick,option:t},n)})})},yx=function(e){var t=_y(),n=Mp(function(e){return e.chips}),r=Cm(),i=Mp(function(e){return e.visuals}),o=Ly();return f.jsx("div",{className:"message-list-container__chips ".concat((null==n?void 0:n.length)?"":"message-list-container__chips--empty"),children:f.jsx(gx,{options:n,onOptionClick:function(e){var n,a=Vy(e)&&e.actionUrl;a?o(a,r,i):t(gm(Vy(n=e)?n.label:n,{action:"click",ui:"chip"}))}})})};function bx(e){return"others"===e?"m 80 0 v 240 h -60 c 40 -40 60 -160 60 -240":"m 0 0 v 240 h 60 c -40 -40 -60 -160 -60 -240"}function wx(e){return f.jsx("svg",{className:"chat-text-bubble__tail",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 240",children:f.jsx("path",{d:bx(e),fill:"currentColor"})})}var xx=function(e){var t=e.owner,n=e.onClick,r=Z.useCallback(function(){n&&n()},[n]);return f.jsxs("div",{onClick:r,className:"chat-text-bubble ".concat("mine"===t?"chat-text-bubble--mine":"chat-text-bubble--others"),children:[e.hasTail&&wx(t),e.children]})},kx=function(e){var t=e.onOpenUrl,n=Ap(e.message.user.nick),r=Z.useRef(null),i=Cm(),o=Mp(function(e){return e.visuals}),a=e.message.msg.html,s=Z.useCallback(function(e){if(t){var n=e.target;e.preventDefault(),t(n.href,i,o)}},[t]);return Z.useEffect(function(){if(r.current&&(r.current.innerHTML=a,t)){var e=r.current.querySelectorAll("a");return e.forEach(function(e){e.addEventListener("click",s)}),function(){e.forEach(function(e){e.removeEventListener("click",s)})}}},[r,a,t,s,e.message.timestamp]),f.jsx("div",{className:"chat-msg",children:f.jsx("div",{className:"chat-text-container",children:f.jsxs(xx,{owner:n?"others":"mine",hasTail:n&&!e.sibling,children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+(n?" the bot said":" the user said")}),f.jsx("div",{ref:r})]})})})},Sx=function(e){var t=e.message,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(Sx.name));var r=n.user,i=t.msg.permissionRequest,o=Ap(e.message.user.nick),a=t.user,s="Deny",l=Z.useCallback(function(e){n.write({type:"msg",user:a,msg:e})},[n,a]),c=Z.useCallback(function(e){n.write({type:"msg",user:r,msg:e})},[n,r]),u=Z.useCallback(function(){n.send({type:"msg",user:void 0,msg:{text:s}})},[n]),d=Z.useCallback(function(e){n.send({type:"permissionGrant",user:a,msg:e})},[a,n]),h=Z.useCallback(function(e,t){d({text:t,location:e?{latitude:e.coords.latitude,longitude:e.coords.longitude}:void 0,permissionRequest:i}),c({text:t});var n=e?null==i?void 0:i.approve:null==i?void 0:i.deny;n&&l(n)},[i,c,l,d]),p=Z.useCallback(function(e){h(void 0,e)},[h]),m=Z.useCallback(function(e){navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){h(t,e)},function(){u()})},[u,h]);return i?f.jsxs("div",{className:"chat-msg",children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+(o?" the bot said":" the user said")}),f.jsxs("div",{className:"buttons-container",children:[f.jsx(lm,{label:"Allow",addClass:"button",onClick:m}),f.jsx(lm,{label:s,addClass:"button",onClick:p})]})]}):f.jsx(f.Fragment,{})},Cx=function(e){var t=e.text,i=Z.useState(!1),o=i[0],a=i[1];return f.jsx("button",{className:"tool-call-item__copy-btn",onClick:function(e){return n(void 0,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:e.stopPropagation(),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(t)];case 2:return r.sent(),a(!0),setTimeout(function(){return a(!1)},1500),[3,4];case 3:return r.sent(),(n=document.createElement("textarea")).value=t,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),a(!0),setTimeout(function(){return a(!1)},1500),[3,4];case 4:return[2]}})})},title:"Copy to clipboard",children:o?"✓":"⧉"})},_x=function(e){var t,n,r;return null!==(r=null!==(n=null!==(t=e.label)&&void 0!==t?t:e.displayName)&&void 0!==n?n:e.name)&&void 0!==r?r:"Working..."},Ex=function(e){var t=e.toolCall,n=_x(t);return f.jsxs("div",{className:"tool-progress-item ".concat(t.isExecuting?"tool-progress-item--executing":""," ").concat(t.error?"tool-progress-item--error":""),children:[f.jsx("span",{className:"tool-progress-item__icon",children:t.isExecuting?f.jsx("span",{className:"tool-progress-item__spinner","aria-label":"executing"}):t.error?f.jsx("span",{className:"tool-progress-item__status tool-progress-item__status--error",children:"!"}):f.jsx("span",{className:"tool-progress-item__status tool-progress-item__status--success",children:"✓"})}),f.jsx("span",{className:"tool-progress-item__label",children:n})]})},Nx=function(e){var t=e.toolCall,n=Z.useState(!1),r=n[0],i=n[1],o=function(e){if(null==e)return"";try{if("string"==typeof e)try{var t=JSON.parse(e);return JSON.stringify(t,null,2)}catch(t){return e}return JSON.stringify(e,null,2)}catch(t){return String(e)}},a=_x(t),s=t.endTime?"".concat(((t.endTime-t.startTime)/1e3).toFixed(2),"s"):null,l=void 0!==t.input&&null!==t.input,c=void 0!==t.result&&null!==t.result,u=!!t.error;return f.jsxs("div",{className:"tool-call-item ".concat(t.isExecuting?"tool-call-item--executing":""),children:[f.jsxs("button",{className:"tool-call-item__header",onClick:function(){return i(!r)},"aria-expanded":r,children:[f.jsx("span",{className:"tool-call-item__icon",children:t.isExecuting?f.jsx("span",{className:"tool-call-item__spinner","aria-label":"executing"}):t.error?f.jsx("span",{className:"tool-call-item__status tool-call-item__status--error",children:"!"}):f.jsx("span",{className:"tool-call-item__status tool-call-item__status--success",children:"✓"})}),f.jsxs("span",{className:"tool-call-item__info",children:[f.jsx("span",{className:"tool-call-item__label",children:a}),f.jsx("span",{className:"tool-call-item__name",children:t.name})]}),s&&f.jsx("span",{className:"tool-call-item__duration",children:s}),f.jsx("span",{className:"tool-call-item__chevron ".concat(r?"tool-call-item__chevron--expanded":""),children:"▾"})]}),r&&f.jsxs("div",{className:"tool-call-item__content",children:[l&&f.jsxs("div",{className:"tool-call-item__section",children:[f.jsxs("div",{className:"tool-call-item__section-header",children:[f.jsx("span",{className:"tool-call-item__section-label",children:"Input"}),f.jsx(Cx,{text:o(t.input)})]}),f.jsx("pre",{className:"tool-call-item__code",children:o(t.input)})]}),c&&f.jsxs("div",{className:"tool-call-item__section",children:[f.jsxs("div",{className:"tool-call-item__section-header",children:[f.jsx("span",{className:"tool-call-item__section-label",children:"Output"}),f.jsx(Cx,{text:o(t.result)})]}),f.jsx("pre",{className:"tool-call-item__code",children:o(t.result)})]}),u&&f.jsxs("div",{className:"tool-call-item__section",children:[f.jsxs("div",{className:"tool-call-item__section-header",children:[f.jsx("span",{className:"tool-call-item__section-label tool-call-item__section-label--error",children:"Error"}),f.jsx(Cx,{text:t.error||""})]}),f.jsx("pre",{className:"tool-call-item__code tool-call-item__code--error",children:t.error})]}),!l&&!c&&!u&&f.jsx("div",{className:"tool-call-item__empty",children:"No data available"})]})]})},Ix=function(e){var t=e.toolCalls,n=e.debugMode,r=void 0!==n&&n;if(!t||0===t.length)return null;if(r)return f.jsxs("div",{className:"tool-call-display",children:[f.jsxs("div",{className:"tool-call-display__header",children:[f.jsx("span",{className:"tool-call-display__icon",children:"⚙"}),f.jsxs("span",{className:"tool-call-display__title",children:["Tool Calls (",t.length,")"]})]}),f.jsx("div",{className:"tool-call-display__list",children:t.map(function(e,t){return f.jsx(Nx,{toolCall:e},"".concat(e.name,"-").concat(e.startTime,"-").concat(t))})})]});var i=t.filter(function(e){return!e.hidden});return 0===i.length?null:f.jsx("div",{className:"tool-progress-display",children:i.map(function(e,t){return f.jsx(Ex,{toolCall:e},"".concat(e.name,"-").concat(e.startTime,"-").concat(t))})})};function Tx(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function jx(e){return Tx(e).replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/\*([^*]+?)\*/g,"<em>$1</em>").replace(/_([^_]+?)_/g,"<em>$1</em>")}function Ox(e){if(!e)return"";var t=[],n=e.replace(/```([^\s`]*)\r?\n([\s\S]*?)```/g,function(e,n,r){var i=Tx(r.replace(/\n$/,"")),o=n?' data-language="'.concat(Tx(n),'"'):"";return t.push("<pre><code".concat(o,">").concat(i,"</code></pre>")),"%%CODEBLOCK".concat(t.length-1,"%%")}),r=[];n=n.replace(/(?:^|\n)(\|.+\|)\n(\|[\s:|-]+\|)\n((?:\|.+\|\n?)+)/g,function(e,t,n,i){return r.push(function(e,t,n){var r=function(e){return e.split("|").slice(1,-1).map(function(e){return jx(e.trim())})},i=t.split("|").slice(1,-1).map(function(e){return e.trim()}).map(function(e){return e.startsWith(":")&&e.endsWith(":")?"center":e.endsWith(":")?"right":"left"}),o=r(e).map(function(e,t){return'<th scope="col" style="text-align:'.concat(i[t]||"left",'">').concat(e,"</th>")}).join(""),a=n.trim().split("\n").filter(function(e){return""!==e.trim()}).map(function(e){return"<tr>"+r(e).map(function(e,t){return'<td style="text-align:'.concat(i[t]||"left",'">').concat(e,"</td>")}).join("")+"</tr>"}).join("");return'<div style="overflow-x:auto"><table><thead><tr>'.concat(o,"</tr></thead><tbody>").concat(a,"</tbody></table></div>")}(t,n,i)),"\n%%TABLE".concat(r.length-1,"%%\n")});var i=[];n=n.replace(/`([^`\n]+)`/g,function(e,t){return i.push("<code>".concat(Tx(t),"</code>")),"%%INLINECODE".concat(i.length-1,"%%")});var o=[];return n=n.replace(/\[([^\]]+)\]\(([^)]+)\)/g,function(e,t,n){return o.push('<a href="'.concat(Tx(n),'" target="_blank" rel="noopener noreferrer">').concat(jx(t),"</a>")),"%%LINK".concat(o.length-1,"%%")}),n=(n=(n=(n=n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/^### (.+)$/gm,"<h4>$1</h4>").replace(/^## (.+)$/gm,"<h3>$1</h3>").replace(/^# (.+)$/gm,"<h2>$1</h2>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/\*([^*]+?)\*/g,"<em>$1</em>").replace(/_([^_]+?)_/g,"<em>$1</em>").replace(/^[-*] (.+)$/gm,"<li>$1</li>").replace(/\n/g,"<br>")).replace(/(<li>.*?<\/li>)(<br>)?/g,"$1")).replace(/(<li>.*?<\/li>)+/g,"<ul>$&</ul>")).replace(/<ul>(.*?)<\/ul>/g,function(e){return e.replace(/<br>/g,"")}),r.forEach(function(e,t){n=n.replace(new RegExp("(?:<br>)?%%TABLE".concat(t,"%%(?:<br>)?")),function(){return e})}),t.forEach(function(e,t){n=n.replace(new RegExp("(?:<br>)?%%CODEBLOCK".concat(t,"%%(?:<br>)?")),function(){return e})}),i.forEach(function(e,t){n=n.replace("%%INLINECODE".concat(t,"%%"),function(){return e})}),o.forEach(function(e,t){n=n.replace("%%LINK".concat(t,"%%"),function(){return e})}),n}var Px=function(e){var t,n=e.message,r=new Date(n.timestamp),i=r.getHours()+":"+r.getMinutes(),o=Ap(null===(t=e.message.user)||void 0===t?void 0:t.nick),a=n.isStreaming,s=Z.useMemo(function(){return o&&n.msg.text?Ox(n.msg.text):null},[o,n.msg.text]),l=n.wasStreamed,c=o&&!e.sibling&&!a&&!l,u=e.toolCalls&&e.toolCalls.length>0,d=e.onLinkClick;return f.jsxs("div",{className:"chat-msg".concat(a?" chat-msg--streaming":""),children:[u&&f.jsx(Ix,{toolCalls:e.toolCalls,debugMode:e.debugMode}),f.jsx("div",{className:"chat-text-container",children:f.jsxs(xx,{owner:o?"others":"mine",hasTail:c,children:[f.jsx("span",{className:"message-sr-only",children:"at "+i+(o?a?" the bot is typing":" the bot said":" the user said")}),s?f.jsx("span",{className:"chat-msg__content",onClick:function(e){var t,n;if(!(!d||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)){var r=null===(n=(t=e.target).closest)||void 0===n?void 0:n.call(t,"a");r&&e.currentTarget.contains(r)&&(e.preventDefault(),d(r.href))}},dangerouslySetInnerHTML:{__html:s}}):f.jsx("span",{className:"chat-msg__content",children:n.msg.text}),a&&f.jsx("span",{className:"streaming-cursor","aria-hidden":"true"})]})})]})},Rx=function(e){var t=e.display,n=Cm(),r=Mp(function(e){return e.visuals}),i=Ly();return f.jsx("div",{className:"chat-schedule-button-container",children:f.jsxs("button",{className:"chat-schedule-button",onClick:function(){i(tm,n,r)},children:[f.jsx("i",{className:"fa fa-lg fa-calendar"}),f.jsx("span",{children:t.label||"Schedule Now!"})]})})},Mx=function(e){var t=e.sources,n=e.prefix,r=void 0===n?"Sources:":n,i=e.onSourceClick;if(!t||0===t.length)return null;return f.jsxs("div",{className:"source-links",children:[r&&f.jsx("span",{className:"source-links__prefix",children:r}),f.jsx("span",{className:"source-links__list",children:t.map(function(e,n){return f.jsxs("span",{className:"source-links__item",children:[f.jsx("a",{href:e.url,target:!1!==e.newTab?"_blank":"_self",rel:!1!==e.newTab?"noopener noreferrer":void 0,className:"source-links__link",onClick:function(t){return function(e,t){i&&(t.preventDefault(),i(e))}(e,t)},title:e.url,children:e.title}),n<t.length-1&&f.jsx("span",{className:"source-links__separator",children:"·"})]},n)})})]})};var Ax,Lx=["text","html","card","list"],Dx=function(e){var t,n,r,i,o=e.messageMiddleware||kb,a=Z.useContext(nm),s=e.middlewareContext,l=e.agent,c=Cm(),u=Mp(function(e){return e.visuals}),d=(null===(t=null==a?void 0:a.env)||void 0===t?void 0:t.urls)&&(null==s?void 0:s.openUrl)?function(e){return s.openUrl(e,c,u)}:void 0,h=null===(n=e.agents)||void 0===n?void 0:n[e.message.user.nick],p=(null==h?void 0:h.hideUserInfo)||!1;var m,v=e.message.isStreaming,g=!(!(null===(r=e.message.msg)||void 0===r?void 0:r.text)&&!(null===(i=e.message.msg)||void 0===i?void 0:i.html)),y=!v&&g;return f.jsx("div",{className:"chat-msg-container-wrapper ".concat(Ap(e.message.user.nick)?"agent":"visitor"," ").concat(e.sibling?"sibling":""),children:f.jsxs("div",{className:"chat-msg-container ".concat((m=e.message,Ap(m.user.nick)?"agent":"visitor")),children:[function(){var t,n,r,i,c,u,h,m,v,g,y,b,w,x,k,S,C,_=e.message.msg;if("chat.msg"===e.message.type){var E=Lx.find(function(e){return!!_[e]}),N=e.message.isStreaming,I=e.message.wasStreamed,T=e.message.toolCalls,j=T&&T.length>0,O=null!==(i=null===(r=null===(n=null===(t=null==a?void 0:a.env)||void 0===t?void 0:t.connection)||void 0===n?void 0:n.mcp)||void 0===r?void 0:r.debugMode)&&void 0!==i&&i,P=j&&!_.text;return f.jsxs(f.Fragment,{children:[P&&f.jsx(mm,{showAvatar:!0,user:l,avatarPosition:null===(h=null===(u=null===(c=null==a?void 0:a.env)||void 0===c?void 0:c.theme)||void 0===u?void 0:u.messages)||void 0===h?void 0:h.avatarPosition,hideUserInfo:p,isStreaming:!0,children:f.jsx("div",{className:"chat-msg",children:f.jsx(Ix,{toolCalls:T,debugMode:O})})}),_.text&&f.jsx(mm,{showAvatar:"text"===E,user:l,avatarPosition:null===(g=null===(v=null===(m=null==a?void 0:a.env)||void 0===m?void 0:m.theme)||void 0===v?void 0:v.messages)||void 0===g?void 0:g.avatarPosition,hideUserInfo:p,isStreaming:N||I,children:f.jsx(Px,{message:e.message,sibling:e.sibling,user:l,toolCalls:j?T:void 0,debugMode:O,onLinkClick:d})}),_.html&&f.jsx(mm,{showAvatar:"html"===E,user:l,avatarPosition:null===(w=null===(b=null===(y=null==a?void 0:a.env)||void 0===y?void 0:y.theme)||void 0===b?void 0:b.messages)||void 0===w?void 0:w.avatarPosition,hideUserInfo:p,children:f.jsx(kx,{message:e.message,sibling:e.sibling,onOpenUrl:null===(x=e.middlewareContext)||void 0===x?void 0:x.openUrl})}),_.displays&&o&&_.displays.map(function(t,n){if("ScheduleButton"===t.type)return f.jsx(Rx,{minimizeOnClick:e.minimizeOnClick,display:t},n);var r=o;return f.jsx(r,{msg:t,ctx:e.middlewareContext},n)}),_.permissionRequest&&s&&f.jsx(mm,{showAvatar:"permissionRequest"===E,user:l,avatarPosition:null===(C=null===(S=null===(k=null==a?void 0:a.env)||void 0===k?void 0:k.theme)||void 0===S?void 0:S.messages)||void 0===C?void 0:C.avatarPosition,hideUserInfo:p,children:f.jsx(Sx,{message:e.message,sibling:e.sibling,ctx:s})})]})}return f.jsx(f.Fragment,{})}(),y&&function(){var t,n=e.message.timestamp,r=function(e){var t=new Date,n=Math.floor((t.valueOf()-e.valueOf())/1e3);if(n<1)return"now";if(n<60)return"".concat(n," seconds ago");var r=Math.floor(n/60);if(r<60)return"".concat(r," minutes ago");var i=Math.floor(r/60);return i<24?"".concat(i," hours ago"):e.toLocaleString()}(new Date(n)),i=null===(t=e.message.msg)||void 0===t?void 0:t.sources,o=i&&i.length>0,a=Ap(e.message.user.nick);return f.jsxs("div",{className:"chat-msg-footer ".concat(a?"agent":"visitor"),children:[f.jsx("span",{className:"chat-msg-timestamp",children:r}),o&&f.jsx(Mx,{sources:i.map(function(e){return{title:e.title,url:e.url,newTab:e.newTab}})})]})}()]})})},Bx=function(e){return f.jsxs("div",{className:"card-container ".concat(e.addClass),children:[(t="string"==typeof e.icon,f.jsx("div",{className:"card-container__icon",children:!t&&e.icon})),f.jsxs("div",{className:"card-container__content ".concat(e.contentAddClass),children:[f.jsx("div",{className:"card-container__title",children:e.title}),e.children]})]});var t},zx=function(e){var t=e.agent,n=void 0===t?{}:t,r=e.hasRating,i=void 0!==r&&r,o=e.shouldDisplay,a=void 0===o||o,s=e.onRate,l=void 0===s?function(){}:s,c=Z.useCallback(function(){l("bad")},[l]),u=Z.useCallback(function(){l("good")},[l]),d=Z.useCallback(function(){l(void 0)},[l]);return a?i?f.jsxs(Bx,{title:"Chat Rating",addClass:"chat-rating-card",children:["You have rated the chat service.",f.jsx("div",{className:"buttons-container",children:f.jsx(lm,{addClass:"button button-rate-again",label:"Rate again",onClick:d})})]}):f.jsxs(Bx,{title:"Chat Rating",addClass:"chat-rating-card",children:[n.displayName," has requested you to rate the chat service.",f.jsxs("div",{className:"buttons-container",children:[f.jsx(lm,{addClass:"button button-rate-bad",label:"Rate Bad",onClick:c}),f.jsx(lm,{addClass:"button button-rate-good",label:"Rate Good",onClick:u})]})]}):null},Ux=function(e){var t=_y(),n=Z.useCallback(function(e){t(function(e){return function(t){return function(){t.sendChatRating(e)}}}(e))},[t]);return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+" system message"}),f.jsx(zx,{agent:e.agent,hasRating:e.hasRating,shouldDisplay:e.shouldDisplay,onRate:n})]})};function Fx(e,t){var n,r;switch(void 0===t&&(t="ssml"),typeof e){case"string":n=e;break;case"number":n="".concat(e)}return qx(e)&&(n=Qx(e,t)),(r=e)&&(r.start||r.end)&&(n=function(e,t){void 0===t&&(t="ssml");if(!e)return"";var n=e.start,r=e.end,i="".concat(Qx(n,t)," to ").concat(Qx(r,t));o=Hx(n.date),a=Hx(r.date),o.getFullYear()===a.getFullYear()&&o.getMonth()===a.getMonth()&&o.getDate()===a.getDate()&&(i="on ".concat(Qx({date:n.date},t)," from ").concat(Qx({time:n.time},t)," to ").concat(Qx({time:r.time},t)));var o,a;return i}(e,t)),function(e){return!!e&&"object"==typeof e&&"number"==typeof e.amount&&"string"==typeof e.format}(e)&&(n=function(e,t){void 0===t&&(t="ssml");if(!e)return"";var n=e.amount>1,r="ssml"===t?'<say-as interpret-as="cardinal">'.concat(e.amount,"</say-as>"):e.amount,i=Jx[e.format],o=e.format;Object.keys(Jx).forEach(function(e){Jx[e]===i&&e.length>o.length&&!e.endsWith("s")&&(o=e)});var a=n?"".concat(o,"s"):o;return"".concat(r," ").concat(a)}(e,t)),Array.isArray(e)&&(n=function(e,t){void 0===t&&(t=Ax.or);var n=Ax[t];if(!e||0===e.length)return"";if(1===e.length)return e[0];if(e.length>=2){var r=e.length-2;return e.reduce(function(e,t,i){return e+=t,i<r?e+=", ":i===r&&(e+=" ".concat(n," ")),e},"")}}(e,Ax.and)),n}function qx(e){return!(!e||!e.date&&!e.time)}function Hx(e){var t=String(e).split("-").map(Number),n=t[0],r=t[1],i=t[2];return new Date(n,r-1,i)}function Wx(e){return e<10?"0".concat(e):String(e)}function Vx(e){if(isNaN(e.getTime()))throw new RangeError("Invalid time value")}function $x(e){return Vx(e),"".concat(e.getFullYear(),"-").concat(Wx(e.getMonth()+1),"-").concat(Wx(e.getDate()))}function Kx(e){Vx(e);var t=e.getHours();return"".concat(t%12==0?12:t%12,":").concat(Wx(e.getMinutes())," ").concat(t<12?"AM":"PM")}function Qx(e,n){if(void 0===n&&(n="ssml"),!e)return"";var r=t({},e);r.date||(r.date=$x(new Date));var i=new Date(Date.parse(function(e){if("object"!=typeof e)return"";var t="";try{if(qx(e)){var n=e.date?$x(Hx(e.date)):void 0,r=e.time;t="".concat(n||"").concat(n&&r?"T":"").concat(r||"")}else{var i=e.start,o=e.end;if(i){n=i.date?$x(Hx(i.date)):void 0,r=i.time;t="".concat(n||"").concat(n&&r?"T":"").concat(r||"")}if(i&&o&&(t+=" --\x3e "),o){n=o.date?$x(Hx(o.date)):void 0,r=o.time;t+="".concat(n||"").concat(n&&r?"T":"").concat(r||"")}}}catch(e){console.error(e)}return t}(r))),o="";return e.date&&(o+="ssml"===n?'<say-as interpret-as="date" format="ymd">'.concat($x(i),"</say-as>"):"".concat(function(e){return Vx(e),"".concat(e.getMonth()+1,"-").concat(e.getDate(),"-").concat(e.getFullYear())}(i))),e.time&&("ssml"===n?o+='<say-as interpret-as="time">'.concat(Kx(i),"</say-as>"):(o.length>0&&(o+=" "),o+="".concat(Kx(i)))),o}!function(e){e[e.or=0]="or",e[e.and=1]="and"}(Ax||(Ax={}));var Jx={ms:1,millisecond:1,milliseconds:1,s:1e3,second:1e3,seconds:1e3,m:6e4,minute:6e4,minutes:6e4,h:36e5,hour:36e5,hours:36e5,d:864e5,day:864e5,days:864e5,w:6048e5,week:6048e5,weeks:6048e5,M:2628e6,month:2628e6,months:2628e6,Q:7776e6,quarter:7776e6,quarters:7776e6,y:3154e7,years:3154e7,year:3154e7};var Yx=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;function Gx(e,t,n,r){for(var i,o=e,a=new RegExp(Yx);null!==(i=a.exec(e));){var s=void 0,l=t[i[1].trim()];l&&(s=Fx(l.value,n)),(s||r)&&(o=o.replace(i[0],s))}return o}var Xx=function(e){var t=e.agents,n=e.text,r=e.delay,i=e.time,o=Z.useState(r),a=o[0],s=o[1],l=Object.values(t).filter(function(e){return e.requestFailed});Z.useEffect(function(){if(0!==r)var e=r,t=setInterval(function(){e--,s(e),0===e&&clearInterval(t)},1e3);else s(5)},[r]);var c=Z.useMemo(function(){return{sec:{name:"sec",value:a}}},[a]),u=Z.useMemo(function(){return function(e,t,n){if(!e||!t)return e;var r=e;if("string"==typeof r)r=Gx(r,t,"displayText",n);else{var i=r;["ssml","displayText"].forEach(function(e){i[e]&&(i[e]=Gx(i[e],t,e,n))})}return r}(n,c)},[n,c]);return 0===a?f.jsx(f.Fragment,{}):f.jsx(f.Fragment,{children:l.map(function(e){var t,n;return f.jsx("div",{className:"chat-msg-container-wrapper",children:f.jsx("div",{className:"chat-msg-container agent",children:f.jsx(mm,{user:null==e?void 0:e.user,showAvatar:!0,children:f.jsx("div",{className:"chat-msg",children:f.jsxs(xx,{owner:"others",hasTail:!0,children:[f.jsx("span",{className:"message-sr-only",children:"at "+i+" the bot said"}),f.jsx("span",{children:"object"==typeof u?u.displayText:u})]})})})},null===(t=null==e?void 0:e.user)||void 0===t?void 0:t.nick)},"failure-msg-".concat(null===(n=null==e?void 0:e.user)||void 0===n?void 0:n.nick))})})},Zx=function(e){return f.jsx("svg",{className:"message-svg",width:"16",height:"12",viewBox:"0 0 16 12",children:f.jsx("path",{d:"M14.4 0H1.6C.72 0 .008.675.008 1.5L0 10.5c0 .825.72 1.5 1.6 1.5h12.8c.88 0 1.6-.675 1.6-1.5v-9c0-.825-.72-1.5-1.6-1.5zm0 3L8 6.75 1.6 3V1.5L8 5.25l6.4-3.75V3z",fill:"#424242",fillRule:"evenodd"})})},ek=function(e){var t=Z.useRef(null),n=Z.useRef(null),r=Z.useRef(null),i=Z.useRef(null),o=Z.useState(!1),a=o[0],s=o[1];function l(){var e,t,r;(null===(e=n.current)||void 0===e?void 0:e.validity.patternMismatch)?null===(t=n.current)||void 0===t||t.setCustomValidity("This doesn't look like an email!"):null===(r=n.current)||void 0===r||r.setCustomValidity("")}function c(o){var a,l,c,u,d;o.preventDefault(),(null===(a=i.current)||void 0===a?void 0:a.checkValidity())?(e.onSubmit({name:null===(c=t.current)||void 0===c?void 0:c.value,email:null===(u=n.current)||void 0===u?void 0:u.value,message:null===(d=r.current)||void 0===d?void 0:d.value}),s(!0)):null===(l=i.current)||void 0===l||l.reportValidity()}function u(){s(!1)}return f.jsx(Bx,{title:e.title,addClass:"offline-card",contentAddClass:a?"sent":"",icon:f.jsx(Zx,{}),children:a?f.jsxs("div",{className:"message-form--sent",children:["Your message has been sent. We will get back to you as soon as possible.",f.jsx(lm,{addClass:"button-resend",label:"Send another",onClick:u})]},"sent"):f.jsxs("form",{ref:i,className:"message-form",onSubmit:c,children:[f.jsxs("div",{className:"content",children:[f.jsxs("div",{className:"section",children:[f.jsx("label",{className:"label",children:"Name"}),f.jsx("input",{ref:t,maxLength:255})]}),f.jsxs("div",{className:"section",children:[f.jsx("label",{className:"label",children:"Email"}),f.jsx("input",{ref:n,onChange:l,type:"email",required:!0,pattern:"^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$"})]}),f.jsxs("div",{className:"section",children:[f.jsx("label",{className:"label",children:"Message"}),f.jsx("textarea",{required:!0,ref:r})]})]}),f.jsx("div",{className:"button-container",children:f.jsx(lm,{type:"submit",addClass:"message-form__submit",label:"Send"})})]},"not-sent")})},tk=function(e){return f.jsx(ek,{title:"Offline message card title",onSubmit:e.onSubmit})},nk=function(e){var t=_y(),n=Z.useCallback(function(e){t(function(e){return function(t){return function(){t.sendOfflineMsg(e,function(e){e&&Yp(e)})}}}(e))},[t]);return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+" system message"}),f.jsx(tk,{onSubmit:n})]})},rk=function(e){var t=Z.useState(!1),n=t[0],r=t[1],i=e.onSubmit,o=Z.useCallback(function(e){i(e),r(!0)},[i]);return f.jsx(f.Fragment,{children:!n&&f.jsx(ek,{title:"Introduce yourself!",onSubmit:o})})},ik=function(e){var t=_y(),n=Mp(function(e){return e.sessionId}),r=Z.useCallback(function(e){e.message&&(t(bm({displayName:e.name,email:e.email},n)),t(gm(e.message)))},[t,n]);return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+" system message"}),f.jsx(rk,{onSubmit:r})]})},ok=function(e){var t=e.position,n=void 0===t?0:t;return n<=0?null:f.jsx("div",{className:"system-msg-container",children:f.jsxs("span",{className:"system-msg",children:["Queue position: ",n]})})};function ak(e){switch(e.type){case"chat.memberjoin":return e.message||"".concat(e.user.displayName||"Bot"," has joined the chat");case"chat.memberleave":return e.message||"".concat(e.user.displayName||"Bot"," has left the chat");case"chat.systemmessage":return e.message;case"chat.rating":if(e.newRating){var t=(n=e.newRating)[0].toUpperCase()+n.slice(1);return"You have rated the chat service ".concat(t)}return"You have removed the chat rating";default:return JSON.stringify(e)}var n}var sk=function(e){var t;if(function(e){var t;return null===(t=e.nick)||void 0===t?void 0:t.endsWith(Qv)}(e.message.user))return null;var n=e.message,r=function(e){return"chat.memberjoin"===e.type&&e.showDivider||"chat.memberleave"===e.type&&e.showDivider}(n),i=null===(t=n.user)||void 0===t?void 0:t.avatarPath;return f.jsxs("div",{className:"system-msg-container",children:[r&&i&&f.jsxs("div",{className:"system-msg-divider",children:[f.jsx("div",{className:"divider-line"}),f.jsx("div",{className:"divider-avatar",children:f.jsx("img",{src:i,alt:"".concat(n.user.displayName||"User","'s avatar")})}),f.jsx("div",{className:"divider-line"})]}),f.jsx("span",{className:"message-sr-only",children:"at "+e.time+" system message"}),f.jsx("span",{className:"system-msg",children:ak(e.message)})]})};var lk=function(e){return f.jsxs("div",{className:"typing-indicator",children:[f.jsx("div",{className:"typing-indicator-part"}),f.jsx("div",{className:"typing-indicator-part"}),f.jsx("div",{className:"typing-indicator-part"})]})},ck=function(e){var t=Object.values(e.agents).filter(function(e){return e.typing});return f.jsx(f.Fragment,{children:t.map(function(t,n){var r,i,o=(null===(r=t.user)||void 0===r?void 0:r.nick)||"".concat(n),a=(null===(i=t.user)||void 0===i?void 0:i.displayName)||"Somebody";return f.jsx("span",{children:e.textTypingStatusEnabled?f.jsxs("div",{className:"chat-msg-agent-typing",children:[a," is typing"]},"typing-status-".concat(o)):f.jsx("div",{className:"chat-msg-container-wrapper",children:f.jsx("div",{className:"chat-msg-container agent chat-typing-progress",children:f.jsx(mm,{user:t.user,showAvatar:!0,children:f.jsx("div",{className:"chat-msg",children:f.jsx(xx,{owner:"others",hasTail:!0,children:f.jsx(lk,{})})})})},o)},"typing-status-".concat(o))},"typing-status-".concat(n))})})},uk=function(e){e.visible;var n=e.messages,r=void 0===n?[]:n,i=e.agents,o=void 0===i?{}:i;e.isOffline,e.isChatting;var a=e.queuePosition,s=void 0===a?0:a,l=e.lastRatingRequestTimestamp,c=void 0===l?0:l,u=e.hasRating,d=void 0!==u&&u;e.visitorId;var h=e.messageMiddleware,p=e.textTypingStatusEnabled,m=e.agent,v=e.hasWsButton,g=e.disableAutoScroll,y=void 0!==g&&g,b=e.onSend,w=void 0===b?function(){return Promise.resolve()}:b,x=e.onWrite,k=void 0===x?function(){return Promise.resolve()}:x,S=e.onOpenUrl,C=void 0===S?function(){}:S,_=e.minimizeOnClick,E=void 0===_?function(){}:_;e.children;var N=Z.useRef(null),I=Z.useRef(null),T=Z.useRef(v),j=Z.useCallback(function(){if(!I.current)return!0;var e=I.current,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return Math.abs(n-r-t)<10},[]),O=Z.useCallback(function(e){void 0===e&&(e="smooth");var t=I.current;t&&("function"!=typeof t.scrollTo?t.scrollTop=t.scrollHeight:t.scrollTo({top:t.scrollHeight,behavior:e}))},[]);Z.useEffect(function(){y||O("smooth")},[r,o,O,y]),Z.useEffect(function(){if(!y){var e=T.current,t=v;if(T.current=t,e&&!t)if(j()){var n=setTimeout(function(){O("smooth")},350);return function(){return clearTimeout(n)}}}},[v,j,O,y]);var P=Z.useCallback(function(e){w(e),y||O("smooth")},[w,y,O]),R=Z.useCallback(function(e){k(e),y||O("smooth")},[k,y,O]),M=Z.useMemo(function(){return new pb({send:P,write:R,openUrl:C})},[P,R,C]),A=new Date,L=A.getHours()+":"+A.getMinutes();function D(e,n){var r,i,a,s;switch((null===(i=null===(r=e.user)||void 0===r?void 0:r.nick)||void 0===i?void 0:i.startsWith("visitor:"))?s=e.user:(s=(null===(a=o[e.user.nick])||void 0===a?void 0:a.user)||m)||(Yp('Could not get a user from agents list with nick: "'.concat(e.user.nick,'"')),s=e.user),e.type){case"chat.file":case"chat.msg":return f.jsx(Dx,{message:e,sibling:n,agent:s,messageMiddleware:h,middlewareContext:M.resolve(s),minimizeOnClick:E},"cm-".concat(e.type,"-").concat(e.timestamp));case"chat.failureMsg":return f.jsx(Xx,t({agents:o,time:L},e.failureMsg),"fm-".concat(e.type,"-").concat(e.timestamp));case"chat.memberjoin":case"chat.memberleave":case"chat.systemmessage":case"chat.rating":case"chat.typing":return f.jsx(sk,{time:L,message:e},"sm-".concat(e.type,"-").concat(e.timestamp));case"chat.request.rating":return f.jsx(Ux,{agent:s,hasRating:d,time:L,shouldDisplay:e.timestamp===c},"cr-".concat(e.type,"-").concat(e.timestamp));case"chat.offline":return f.jsx(nk,{time:L},"offline-".concat(e.timestamp));case"chat.prechat":return f.jsx(ik,{time:L},"prechat");default:return f.jsxs("span",{children:[f.jsx("span",{className:"message-sr-only",children:"at "+L+" system message"}),f.jsxs("div",{"data-testid":"unhandled-message",children:["Unhandled message: ",JSON.stringify(e)]},"uhm-".concat(e.timestamp))]},"default-".concat(e.timestamp))}}return f.jsxs("div",{className:"message-list-container",ref:I,children:[f.jsxs("div",{className:"message-list-container__msgs",children:[function(){for(var e=-1,t=r.length-1;t>0;t--)if("chat.msg"===r[t].type){e=t;break}return r.map(function(t,n){var i,o,a=!1;if(["chat.file","chat.msg","chat.memberjoin","chat.memberleave","chat.rating","chat.request.rating","chat.offline","chat.prechat"].includes(t.type)&&!(null===(o=null===(i=t.user)||void 0===i?void 0:i.nick)||void 0===o?void 0:o.endsWith(Qv)))if(0===n||n===r.length-1||n===e)a=!0;else{var s=r[n-1];t.timestamp&&s.timestamp&&(a=t.timestamp-s.timestamp>3e5)}0===n&&"chat.memberjoin"===t.type&&(a=!1);var l=a?new Date(t.timestamp).toLocaleString():void 0;return f.jsxs("span",{children:[a&&f.jsx("div",{className:"ts-msg-container",children:f.jsx("span",{className:"ts-msg",children:l})}),D(t,!1)]},"message-list-render-all-".concat(n))})}(),f.jsx("div",{ref:N,style:{float:"left",clear:"both"}}),f.jsx(ok,{position:s}),f.jsx(ck,{agents:o,textTypingStatusEnabled:p})]}),f.jsx(yx,{})]})},dk=function(){return f.jsxs("div",{className:"server-offline",children:[f.jsx("h2",{children:"We can't reach the chat right now"}),f.jsx("h3",{children:"Check your connection and try again in a moment."})]})},fk=function(e){var t=e.children,n=e.className,r=void 0===n?"":n;return f.jsx("div",{className:"button-group ".concat(r),children:t})},hk=function(e){return f.jsx("div",{id:"xapp-widget-close","aria-label":"close widget","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"cancel-button",onClick:e.onClick})};function pk(e){return Vy(e)?e.actionUrl?"[".concat(e.label,"](").concat(e.actionUrl,")"):e.label:e}var mk=function(e){var t=Mp(function(e){return e.chats});return f.jsx("div",{id:"xapp-widget-export","aria-label":"export conversation","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"export-button",onClick:function(){return n(void 0,void 0,void 0,function(){var e,n;return r(this,function(r){switch(r.label){case 0:e=function(e){return e.filter(Vb).map(function(e){var t,n,r,i=(null===(t=e.user.nick)||void 0===t?void 0:t.startsWith("visitor:"))?"User":"Assistant",o=(null===(n=e.msg)||void 0===n?void 0:n.text)||"",a="".concat(i,": ").concat(o),s=null===(r=e.msg)||void 0===r?void 0:r.options;if(s&&s.length>0){var l=s.map(pk).join(", ");a+="\nSuggestions: ".concat(l)}return a}).join("\n")}(t),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(e)];case 2:return r.sent(),[3,4];case 3:return r.sent(),console.warn("[ExportButton] Using deprecated execCommand fallback for clipboard copy"),(n=document.createElement("textarea")).value=e,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),[3,4];case 4:return[2]}})})}})},vk=function(e){return f.jsx("div",{id:"xapp-widget-menu","aria-label":"open menu","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"menu-button",onClick:e.onClick})},gk=function(e){return f.jsx("div",{id:"xapp-widget-minimize","aria-label":"minimize widget","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"minimize-button ".concat(e.showInRight?"positionRight":""),onClick:e.onClick})},yk=function(e){return f.jsx("div",{id:"xapp-widget-refresh","aria-label":"refresh chat","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"refresh-button ".concat(e.showInRight?"positionRight":e.showInLeft?"positionLeft":""),onClick:e.onClick})},bk="Virtual Assistant",wk="Leave us a message",xk="We're away!",kk="Connecting...";function Sk(e,t){var n,r,i,o;switch(Yp('getStatusText called with status: "'.concat(e,'"')),e){case"online":return null!==(n=null==t?void 0:t.online)&&void 0!==n?n:bk;case"offline":return null!==(r=null==t?void 0:t.offline)&&void 0!==r?r:wk;case"away":return null!==(i=null==t?void 0:t.away)&&void 0!==i?i:xk;default:return null!==(o=null==t?void 0:t.connecting)&&void 0!==o?o:kk}}function Ck(e){if(function(e){return"string"==typeof e&&/<\/?[a-z][\s\S]*>/i.test(e)}(e)){var t=function(e){try{if("undefined"==typeof DOMParser)return Yp("DOMParser not available, returning text content only"),e.replace(/<[^>]*>/g,"");var t=(new DOMParser).parseFromString(e,"text/html");if(!t||!t.body)return Yp("DOMParser failed to parse HTML, returning text content only"),e.replace(/<[^>]*>/g,"");var n=["span","div","p","strong","em","b","i","u","br"],r=["color","background-color","font-size","font-weight","font-style","text-align","display","flex","align-items","justify-content","gap","margin","padding","width","height","border-radius"],i=function(e){if(e.nodeType===Node.ELEMENT_NODE){var o=e,a=o.tagName.toLowerCase();if(!n.includes(a)){var s=t.createTextNode(o.textContent||"");return void o.replaceWith(s)}if(Array.from(o.attributes).forEach(function(e){"style"!==e.name&&o.removeAttribute(e.name)}),o.hasAttribute("style")){var l=o.getAttribute("style")||"",c=[];l.split(";").forEach(function(e){var t=e.split(":"),n=t[0],i=t.slice(1).join(":").trim(),o=n.trim();o&&i&&r.includes(o.toLowerCase())&&(/javascript:|expression\(|@import|behavior:/i.test(i)||c.push("".concat(o,": ").concat(i)))}),c.length>0?o.setAttribute("style",c.join("; ")):o.removeAttribute("style")}Array.from(o.childNodes).forEach(function(e){return i(e)})}};return Array.from(t.body.childNodes).forEach(function(e){return i(e)}),t.body.innerHTML}catch(t){return Yp("Error sanitizing HTML: ".concat(t)),e.replace(/<[^>]*>/g,"")}}(e);return f.jsx("span",{dangerouslySetInnerHTML:{__html:t}})}return e}var _k=function(e){var t,n,r,i,o,a,s,l,c,u,d,h,p,m,v,g=Cm(),y=e.menuConfig,b=e.onSubmit,w=e.debugMode,x=Z.useState(!1),k=x[0],S=x[1],C=(null==y?void 0:y.menuButtonLocation)||"FOOTER",_="HEADER_LEFT"===C,E="HEADER_RIGHT"===C,N=null==y?void 0:y.items,I=null==y?void 0:y.itemsTabIndex,T=null===(t=null==y?void 0:y.button)||void 0===t?void 0:t.tabIndex,j=Z.useMemo(function(){return N||[]},[N]),O=E&&j.length>0;function P(){var e=!k;S(e),g(Iy({drawer:e}))}var R="",M=e.canRefresh,A=e.canMinimize,L=e.canCancel;return M&&(R="To refresh chat click on clockwise gapped circle arrow icon in top right side of widget. "),A&&(R="".concat(R).concat("To minimize widget click on minus icon in top right side of widget. ")),L&&(R="".concat(R).concat("To close widget click on close icon in top right side of widget.")),f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"status-container background-header","aria-label":R,"aria-hidden":!1,children:[_&&j.length?f.jsx(f.Fragment,{children:f.jsx("div",{className:"chat-footer__menu-icon",children:f.jsx(sx,{bars:3,tabIndex:T,onToggle:P})})}):f.jsx(f.Fragment,{}),void 0===(null===(n=null==e?void 0:e.agent)||void 0===n?void 0:n.avatarPath)?f.jsx("div",{}):f.jsx("div",{className:"status-container__avatar",children:f.jsx(hm,{entity:e.agent})}),f.jsxs("div",{className:"\n ".concat("status-text","\n ").concat(_&&j.length?"status-text-positionWithMenu":void 0===(null===(r=null==e?void 0:e.agent)||void 0===r?void 0:r.avatarPath)?"status-text-positionLeftNoAvatar":"status-text-positionLeft","\n ").concat((null===(i=e.config)||void 0===i?void 0:i.alignTextCenter)?"status-text-positionCenter":""," \n "),children:[f.jsx("span",{className:"status-text-title",children:Sk(e.accountStatus,null===(o=e.config)||void 0===o?void 0:o.status)}),(null===(s=null===(a=e.config)||void 0===a?void 0:a.subtitle)||void 0===s?void 0:s.enabled)&&f.jsx("span",{className:"status-text-subtitle",children:Ck(null===(c=null===(l=e.config)||void 0===l?void 0:l.subtitle)||void 0===c?void 0:c.text)})]}),f.jsxs(fk,{children:[O&&f.jsx(vk,{onClick:P,tabIndex:T}),w&&f.jsx(mk,{}),e.canRefresh&&f.jsx(yk,{onClick:e.refreshOnClick,tabIndex:null===(d=null===(u=e.config)||void 0===u?void 0:u.actions)||void 0===d?void 0:d.refreshTabIndex,showInLeft:!1,showInRight:!1}),e.canMinimize&&f.jsx(gk,{onClick:e.minimizeOnClick,tabIndex:null===(p=null===(h=e.config)||void 0===h?void 0:h.actions)||void 0===p?void 0:p.minimizeTabIndex,showInRight:!1}),e.canCancel&&f.jsx(hk,{onClick:e.cancelOnClick,tabIndex:null===(v=null===(m=e.config)||void 0===m?void 0:m.actions)||void 0===v?void 0:v.cancelTabIndex})]})]}),k?f.jsx("div",{className:"xa-chat-menu-container",children:f.jsx(ax,{openFrom:E?"right":"left",opened:k,tabIndex:I,onItemClick:function(e){S(!1),b(e)},items:j})}):f.jsx(f.Fragment,{})]})};function Ek(e){var t,n,i,o,a;return Tk("--xapp-",jk(Ok("primary-color",null==e?void 0:e.primaryColor),Tk("widget-",jk(Mk(null==e?void 0:e.size),Ak(null==e?void 0:e.margin),Uk(null==e?void 0:e.border),function(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["z-index",e]]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})}(null==e?void 0:e.zIndex))),function(e){if(!e)return Pk();return Tk("chat-button-",jk(Ak(e.margin),Bk(e.background),Tk("image-",Mk(e.imageSize)),function(e){var t,n,i,o,a;return r(this,function(r){switch(r.label){case 0:return e?(t=e.primaryColor||"0, 117, 170",n=e.secondaryColor||"110, 178, 209",i=e.opacity||.75,[4,["animation-primary-color","".concat(t)]]):[2];case 1:return r.sent(),[4,["animation-secondary-color","".concat(n)]];case 2:return r.sent(),[4,["animation-opacity","".concat(i)]];case 3:return r.sent(),[4,["animation-primary-rgba","rgba(".concat(t,", ").concat(i,")")]];case 4:return r.sent(),[4,["animation-secondary-rgba","rgba(".concat(n,", ").concat(i,")")]];case 5:return r.sent(),o="radial-gradient(40.83% 40.83% at 47.92% 52.5%, rgba(".concat(t,", ").concat(i,") 78.85%, rgba(").concat(n,", ").concat(i,") 92.07%)"),a="radial-gradient(40.83% 40.83% at 47.92% 52.5%, rgba(".concat(t,", ").concat(i,") 20.46%, rgba(").concat(n,", ").concat(i,") 92.07%)"),[4,["animation-pulse-intense",o]];case 6:return r.sent(),[4,["animation-pulse-less-intense",a]];case 7:return r.sent(),[2]}})}(e.animation)))}(null==e?void 0:e.chatButton),Tk("header-",function(e){if(!e)return Pk();return jk(Bk(e.background),Dk(e.text),Tk("subtitle-",Dk(e.subtitle)),Uk(e.border),Lk(e.padding),Ok("avatar-background",e.avatarBackground))}(null==e?void 0:e.header)),Tk("footer-",function(e){var t;if(!e)return Pk();return jk(Bk(e.background),Uk(e.border),Tk("branding-",Dk(null===(t=e.branding)||void 0===t?void 0:t.text)))}(null==e?void 0:e.footer)),Tk("content-",jk(Bk(null===(t=null==e?void 0:e.content)||void 0===t?void 0:t.background))),Tk("messages-",function(e){if(!e)return Pk();return jk(Tk("mine-",Rk(e.mine)),Tk("others-",Rk(e.others)),Lk(null==e?void 0:e.padding),Ok("max-width",null==e?void 0:e.maxWidth))}(null==e?void 0:e.messages)),Tk("text-typing-status-",Dk(null===(n=null==e?void 0:e.textTypingStatus)||void 0===n?void 0:n.text)),Tk("send-",zk(null==e?void 0:e.sendButton)),Tk("menu-",zk(null==e?void 0:e.menuButton)),Tk("menu-",function(e){return jk(Tk("item-",function(e){return jk(Dk(null==e?void 0:e.text),Tk("subtitle-",Dk(null==e?void 0:e.subtitle)),Uk(null==e?void 0:e.border),Bk(null==e?void 0:e.background),Ok("height",null==e?void 0:e.height))}(null==e?void 0:e.item)))}(null==e?void 0:e.menu)),Tk("refresh-",zk(null==e?void 0:e.refreshButton)),Tk("minimize-",zk(null==e?void 0:e.minimizeButton)),Tk("cancel-",zk(null==e?void 0:e.cancelButton)),Tk("carousel-",jk(Tk("title-",Dk(null===(i=null==e?void 0:e.carousel)||void 0===i?void 0:i.title)),Tk("subtitle-",Dk(null===(o=null==e?void 0:e.carousel)||void 0===o?void 0:o.subtitle)),Tk("action-",zk(null===(a=null==e?void 0:e.carousel)||void 0===a?void 0:a.button)))),Tk("input-",function(e){if(!e)return Pk();return jk(Bk(e.background),Uk(e.border),Dk(e.text),Tk("placeholder-",Dk(e.placeholder)))}(null==e?void 0:e.input)),Tk("cta-",function(e){if(!e)return Pk();return jk(Bk(e.background),Dk(e.text))}(null==e?void 0:e.cta)),Tk("action-bar-",function(e){if(!e)return Pk();return jk(Bk(e.background),Uk(e.border),Lk(e.padding),Ak(e.margin),Ok("box-shadow",e.boxShadow),Ok("border-radius",e.borderRadius),Tk("button-",function(e){if(!e)return Pk();return jk(Bk(e.background),Ok("hover-background",e.hoverBackground),Tk("icon-",Mk(e.iconSize)),Ok("icon-color",e.iconColor),Tk("label-",Dk(e.label)),Ok("gap",e.gap),Ok("border-radius",e.borderRadius),Lk(e.padding))}(e.button)))}(null==e?void 0:e.actionBar))))}var Nk=new Map;function Ik(e){var t=e.theme,n=JSON.stringify(function(e){for(var t=[],n=Ek(e),r=n.next();!1===r.done;){var i=r.value,o=i[0],a=i[1];null!=a&&""!==a&&t.push([o,a]),r=n.next()}return t}(t));return ee.useLayoutEffect(function(){var e=JSON.parse(n);return function(e){for(var t,n=document.documentElement,r=0,i=e;r<i.length;r++){var o=i[r],a=o[0],s=o[1];n.style.setProperty(a,s),Nk.set(a,(null!==(t=Nk.get(a))&&void 0!==t?t:0)+1)}}(e),function(){return function(e){for(var t,n=document.documentElement,r=0,i=e;r<i.length;r++){var o=i[r][0],a=(null!==(t=Nk.get(o))&&void 0!==t?t:1)-1;a<=0?(Nk.delete(o),n.style.removeProperty(o)):Nk.set(o,a)}}(e)}},[n]),null}function Tk(e,t){var n;return r(this,function(r){switch(r.label){case 0:n=t.next(),r.label=1;case 1:return n.done?[3,3]:[4,["".concat(e).concat(n.value[0]),n.value[1]]];case 2:return r.sent(),n=t.next(),[3,1];case 3:return[2]}})}function jk(){var e,t,n,i,o,a=[];for(e=0;e<arguments.length;e++)a[e]=arguments[e];return r(this,function(e){switch(e.label){case 0:t=0,n=a,e.label=1;case 1:if(!(t<n.length))return[3,5];i=n[t],o=i.next(),e.label=2;case 2:return!1!==o.done?[3,4]:[4,o.value];case 3:return e.sent(),o=i.next(),[3,2];case 4:return t++,[3,1];case 5:return[2]}})}function Ok(e,t){return r(this,function(n){switch(n.label){case 0:return[4,[e,t]];case 1:return n.sent(),[2]}})}function Pk(){return r(this,function(e){return[2]})}function Rk(e){return jk(Ok("bubble-color",null==e?void 0:e.bubbleColor),Dk(null==e?void 0:e.text))}function Mk(e){return r(this,function(t){switch(t.label){case 0:return[4,["width",null==e?void 0:e.width]];case 1:return t.sent(),[4,["height",null==e?void 0:e.height]];case 2:return t.sent(),[2]}})}function Ak(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["margin-top",e.top]]:[3,5];case 1:return t.sent(),[4,["margin-right",e.right]];case 2:return t.sent(),[4,["margin-bottom",e.bottom]];case 3:return t.sent(),[4,["margin-left",e.left]];case 4:t.sent(),t.label=5;case 5:return[2]}})}function Lk(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["padding-top",e.top]]:[3,5];case 1:return t.sent(),[4,["padding-right",e.right]];case 2:return t.sent(),[4,["padding-bottom",e.bottom]];case 3:return t.sent(),[4,["padding-left",e.left]];case 4:t.sent(),t.label=5;case 5:return[2]}})}function Dk(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["text-color",e.color]]:[3,6];case 1:return t.sent(),[4,["font-size",e.fontSize]];case 2:return t.sent(),[4,["font-family",e.fontFamily]];case 3:return t.sent(),[4,["font-weight",e.fontWeight]];case 4:return t.sent(),[4,["font-style",e.fontStyle]];case 5:t.sent(),t.label=6;case 6:return[2]}})}function Bk(e){return r(this,function(t){switch(t.label){case 0:return[4,["background",e]];case 1:return t.sent(),[2]}})}function zk(e){return r(this,function(t){switch(t.label){case 0:return[4,["button-color",null==e?void 0:e.color]];case 1:return t.sent(),[4,["button-width",null==e?void 0:e.width]];case 2:return t.sent(),[4,["button-bg",null==e?void 0:e.background]];case 3:return t.sent(),[4,["button-hover-bg",null==e?void 0:e.hoverBackground]];case 4:return t.sent(),[4,["button-disabled-bg",null==e?void 0:e.disabledBackground]];case 5:return t.sent(),[2]}})}function Uk(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["border-color",e.color]]:[3,4];case 1:return t.sent(),[4,["border-width",e.width]];case 2:return t.sent(),[4,["border-radius",e.radius]];case 3:t.sent(),t.label=4;case 4:return[2]}})}var Fk=function(e){if(null===e)return"null";if(void 0===e)return"undefined";if("object"!=typeof e)return String(e);try{var t=new WeakSet;return JSON.stringify(e,function(e,n){if("object"==typeof n&&null!==n){if(t.has(n))return"[Circular]";t.add(n)}return n},2)}catch(t){return"[Object: ".concat(Object.prototype.toString.call(e),"]")}},qk=function(e){var o=e.enableErrorOverlay,a=Z.useState([]),s=a[0],l=a[1],c=Z.useState(!1),u=c[0],d=c[1],h=Z.useState(!0),p=h[0],m=h[1],v=Z.useState(!1),g=v[0],y=v[1],b=Z.useState("bottom"),w=b[0],x=b[1];Z.useEffect(function(){var e,t=function(){var e;if("undefined"==typeof window)return!1;var t=null===(e=window.localStorage)||void 0===e?void 0:e.getItem("xaErrorOverlay");return"enabled"===t?(console.log("[ErrorOverlay] Enabled via localStorage"),!0):"disabled"===t?(console.log("[ErrorOverlay] Disabled via localStorage"),!1):void 0!==o?(console.log("[ErrorOverlay] Using config setting:",o),o):!(void 0===globalThis.__DEV__||!globalThis.__DEV__)&&(console.log("[ErrorOverlay] Enabled via __DEV__"),!0)}();y(t);var n=null===(e=window.localStorage)||void 0===e?void 0:e.getItem("xaErrorOverlayPosition");"top"!==n&&"bottom"!==n||x(n),console.log("[ErrorOverlay] Component mounted, enabled:",t,"position:",n||"bottom")},[o]);var k=Z.useCallback(function(e){console.log("[ErrorOverlay] Adding error:",e),l(function(n){var r=(new Date).toISOString(),o=n[n.length-1];if(o&&o.message===e.message)return i(i([],n.slice(0,-1),!0),[t(t({},o),{count:o.count+1,timestamp:r})],!1);var a=t({id:"".concat(r,"-").concat(Math.random()),timestamp:r,count:1},e);return i(i([],n,!0),[a],!1).slice(-50)})},[]);Z.useEffect(function(){if(g){console.log("[ErrorOverlay] Setting up error interception");var e=console.error,t=console.warn;console.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(e){return Fk(e)}).join(" "),i=new Error;k({message:r,type:"error",stack:i.stack}),e.apply(console,t)},console.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e.map(function(e){return Fk(e)}).join(" ");k({message:r,type:"warning"}),t.apply(console,e)};var n=function(e){var t;k({message:e.message,type:"error",stack:null===(t=e.error)||void 0===t?void 0:t.stack})},r=function(e){var t;k({message:"Unhandled Promise Rejection: ".concat(e.reason),type:"error",stack:null===(t=e.reason)||void 0===t?void 0:t.stack})};return window.addEventListener("error",n),window.addEventListener("unhandledrejection",r),function(){console.log("[ErrorOverlay] Cleaning up error interception"),console.error=e,console.warn=t,window.removeEventListener("error",n),window.removeEventListener("unhandledrejection",r)}}console.log("[ErrorOverlay] Not enabled, skipping error interception")},[g,k]);return g&&p?0===s.length?null:f.jsxs("div",{className:"error-overlay error-overlay--".concat(w," ").concat(u?"minimized":""),children:[f.jsxs("div",{className:"error-overlay-header",children:[f.jsxs("span",{className:"error-overlay-title",children:["Debug Console (",s.length,")"]}),f.jsxs("div",{className:"error-overlay-actions",children:[f.jsx("button",{onClick:function(){return n(void 0,void 0,void 0,function(){var e,t,n;return r(this,function(r){switch(r.label){case 0:e=s.map(function(e){return"[".concat(e.timestamp,"] ").concat(e.type.toUpperCase(),": ").concat(e.message).concat(e.stack?"\n"+e.stack:"")}).join("\n\n"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(e)];case 2:return r.sent(),console.log("[ErrorOverlay] Errors copied to clipboard"),[3,4];case 3:t=r.sent(),console.error("[ErrorOverlay] Failed to copy to clipboard:",t),(n=document.createElement("textarea")).value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();try{document.execCommand("copy"),console.log("[ErrorOverlay] Errors copied to clipboard using fallback method")}catch(e){console.error("[ErrorOverlay] Fallback copy method also failed:",e)}return document.body.removeChild(n),[3,4];case 4:return[2]}})})},title:"Copy all to clipboard",children:"📋"}),f.jsx("button",{onClick:function(){l([])},title:"Clear all",children:"🗑️"}),f.jsx("button",{onClick:function(){var e="bottom"===w?"top":"bottom";x(e),"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem("xaErrorOverlayPosition",e)},title:"Move to ".concat("bottom"===w?"top":"bottom"),children:"bottom"===w?"⬆️":"⬇️"}),f.jsx("button",{onClick:function(){var e=!g;y(e),"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem("xaErrorOverlay",e?"enabled":"disabled"),console.log("[ErrorOverlay] Toggled enabled state to:",e),e||l([])},title:"Disable Error Overlay",children:"🔧"}),f.jsx("button",{onClick:function(){return d(!u)},title:"Minimize/Maximize",children:u?"▲":"▼"}),f.jsx("button",{onClick:function(){return m(!1)},title:"Close",children:"✕"})]})]}),!u&&f.jsx("div",{className:"error-overlay-content",children:s.map(function(e){return f.jsxs("div",{className:"error-entry error-".concat(e.type),children:[f.jsxs("div",{className:"error-header",children:[f.jsx("span",{className:"error-time",children:new Date(e.timestamp).toLocaleTimeString()}),e.count>1&&f.jsxs("span",{className:"error-count",children:["(",e.count,"x)"]}),f.jsx("span",{className:"error-badge error-badge-".concat(e.type),children:e.type})]}),f.jsx("div",{className:"error-message",children:e.message}),e.stack&&f.jsxs("details",{className:"error-stack",children:[f.jsx("summary",{children:"Stack trace"}),f.jsx("pre",{children:e.stack})]})]},e.id)})})]}):null},Hk=function(e){var t=e.button,n=e.onPress,r=Z.useCallback(function(){"disabled"===t.pressBehavior||t.isPressed||n(t.id)},[t.pressBehavior,t.isPressed,t.id,n]),i=Z.useMemo(function(){var e=["ws-button"];return("disabled"===t.pressBehavior||t.isPressed)&&e.push("ws-button--disabled"),t.isPressed&&"spinning"===t.pressBehavior&&e.push("ws-button--spinning"),e.join(" ")},[t.pressBehavior,t.isPressed]),o=Z.useMemo(function(){var e=["ws-button-container"];return t.isDismissing&&e.push("ws-button-container--dismissing"),e.join(" ")},[t.isDismissing]);return f.jsx("div",{className:o,children:f.jsxs("button",{className:i,onClick:r,disabled:"disabled"===t.pressBehavior||t.isPressed,"aria-label":t.text,"aria-busy":t.isPressed&&"spinning"===t.pressBehavior,children:[t.isPressed&&"spinning"===t.pressBehavior&&f.jsx("span",{className:"ws-button__spinner"}),f.jsx("span",{className:"ws-button__text",children:t.text})]})})},Wk=function(e){var t=e.onClose,n=e.onReset;return f.jsxs("div",{className:"modalContent",children:[f.jsxs("div",{className:"modalBody",children:[f.jsx("h2",{children:"Restart Conversation"}),f.jsx("p",{children:"Would you like to refresh and return to the starting point of the conversation?"})]}),f.jsxs("div",{className:"modalActions",children:[f.jsx("button",{onClick:t,className:"cancelBtn",children:"Cancel"}),f.jsx("button",{onClick:n,className:"restartBtn",children:"Restart"})]})]})};function Vk(e){var t=function(e){return function(t,n){return void 0===t&&(t=e),Yp("static reducer",t,n),t}}(e);return Bb({reducer:t,middleware:function(e){return e({thunk:!0})},devTools:!1})}var $k=function(e){var n=e.state,r=Z.useMemo(function(){return Vk(n)},[n]),i=Z.useMemo(function(){return t(t({},e.config),{connection:{serverUrl:"",type:"local"}})},[e.config]);return f.jsx(_p,{store:r,children:f.jsx(Zk,t({},e,{config:i,disableAutoScroll:e.disableAutoScroll,preview:e.preview}))})},Kk=function(e){var n=e.messages,r=Z.useMemo(function(){return function(e){var n,r=qb(),o=e.length>0?e[e.length-1]:void 0,a="chat.msg"===(null==o?void 0:o.type)?o.msg:null,s=(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.length)?a.options:[];return t(t({},r),{connection:t(t({},r.connection),{connectionStatus:"online"}),accountStatus:"online",chats:i([],e,!0),chips:s,isChatting:!0,visuals:{visible:!0,opened:!0}})}(n)},[n]);return f.jsx($k,{state:r,mode:e.mode,config:e.config,disableAutoScroll:e.disableAutoScroll,preview:e.preview})},Qk="undefined"==typeof window?Z.useEffect:Z.useLayoutEffect;"undefined"!=typeof process&&process.env;var Jk=function(e){var t,n=null!==(t=e.mode)&&void 0!==t?t:"preview",r=Z.useMemo(function(){return t=e.previewMessages||[],n=e.config,r=Date.now(),t.map(function(e,t){var i,o;return{type:"chat.msg",user:{nick:"agent:robot",display_name:(null==n?void 0:n.botName)||"Assistant",avatarPath:null==n?void 0:n.avatarUrl},timestamp:r+t,msg:{text:e.displayText,html:e.html,options:null===(i=e.suggestions)||void 0===i?void 0:i.map(function(e){return{label:e.title,actionUrl:e.url||"#"}}),list:e.list?{type:e.list.type,title:e.list.title,items:e.list.items.map(function(e){return{title:e.title,subTitle:e.description,url:e.url,imageUrl:e.imageUrl,hideUrl:e.hideUrl}})}:void 0,displays:e.list?[(o={type:e.list.type,title:e.list.title,items:e.list.items.map(function(e){return{title:e.title,subTitle:e.description,url:e.url,imageUrl:e.imageUrl,hideUrl:e.hideUrl}})},{type:o.type,title:o.title,items:(o.items||[]).map(function(e){var t={title:e.title,description:e.subTitle,token:e.token,url:e.url,hideUrl:e.hideUrl,image:{url:e.imageUrl,imageActionUrl:e.imageActionUrl,accessibilityText:""}},n=e.buttons;return n&&n.length>0&&(t.buttons=n.map(function(e){return{openUrlAction:e.actionUrl,title:e.label}})),t})})]:void 0}}});var t,n,r},[e.previewMessages,e.config]);return f.jsx(Kk,{messages:r,mode:n,config:e.config,disableAutoScroll:e.disableAutoScroll,preview:!0})},Yk=function(e){var n,r=null!==(n=e.mode)&&void 0!==n?n:"normal",i=Z.useState(e.config),o=i[0],a=i[1],s=Z.useState(!!e.getConfig),l=s[0],c=s[1],u=Z.useState(),d=u[0],h=u[1];Z.useEffect(function(){var t=!1;return e.getConfig?(c(!0),h(void 0),e.getConfig().then(function(e){t||(a(e),c(!1),Yp("[ChatWidget] Config loaded from getConfig callback"))}).catch(function(e){t||(h(e),c(!1),Gp("[ChatWidget] Failed to load config: ".concat(e.message)))})):e.config&&(a(e.config),c(!1)),function(){t=!0}},[e.getConfig,e.config]);var p,m,v=(p=o,m=Mp(function(e){return e.connection.nonce}),Yp("nonce from Redux: ".concat(m)),om(p,m)),g=Z.useMemo(function(){var e;return t(t({},o),{connection:v,assetUrl:null!==(e=null==v?void 0:v.serverUrl)&&void 0!==e?e:Zp,env:o})},[v,o]),y=Mp(function(e){return e.connection.token}),b=Z.useMemo(function(){var e={items:[{delay:5,text:"We are having trouble communicating with the assistant right now. Re-trying in ${sec} seconds..."},{delay:5,text:"We are still having trouble communicating with the assistant right now. Re-trying in ${sec} seconds..."},{delay:0,text:"Sorry, we cannot communicate with the assistant right now. Please check your connection or try again later."}]};return(null==o?void 0:o.configurableMessages)&&Array.isArray(o.configurableMessages.items)&&o.configurableMessages.items.length>0&&(e=o.configurableMessages),{token:y,bot:{nick:"Bot",displayName:null==o?void 0:o.botName,avatarPath:null==o?void 0:o.avatarUrl},configurableMessages:e,hooks:null==o?void 0:o.hooks,env:o}},[y,null==o?void 0:o.botName,null==o?void 0:o.avatarUrl,null==o?void 0:o.configurableMessages,null==o?void 0:o.hooks]),w=function(e,t){var n=Z.useState(),r=n[0],i=n[1],o=Cm(),a=[t,e,o],s=Z.useRef(void 0);return Z.useEffect(function(){if(s.current){var n=s.current,r=n[0],a=n[1],l=n[2],c=[];r!==t&&c.push("options"),a!==e&&c.push("config"),l!==o&&c.push("dispatch"),c.length>0&&Yp("[useChatServer] Effect re-running due to: ".concat(c.join(", ")))}else Yp("[useChatServer] Effect running for first time");if(s.current=[t,e,o],!e||!t)return Yp("[useChatServer] Config or options null, not creating server"),void i(void 0);Yp("Creating new chat server - type: ".concat(e.type));var u=Sy(e,t);return u.init(o),i(u),function(){Yp("Cleanup - disposing old server"),u.dispose()}},a),r}(l||d?null:v,l||d?null:b),x="widget-container--".concat(r);return l?f.jsx("div",{className:"widget-container widget-container--loading ".concat(x),children:f.jsx("div",{className:"xa-spinner-container visible",children:f.jsx("div",{className:"xa-spinner"})})}):d?f.jsx("div",{className:"widget-container widget-container--error ".concat(x),children:f.jsxs("div",{className:"widget-error-message",children:["Failed to load chat configuration: ",d.message]})}):f.jsx(nm.Provider,{value:g,children:f.jsx(Cy.Provider,{value:w,children:f.jsx(Zk,t({},e,{config:o}))})})};function Gk(e){var t,n;return Uw(e)&&(null===(n=null===(t=e.formConfig)||void 0===t?void 0:t.api)||void 0===n?void 0:n.key)||void 0}function Xk(){return Fp()||Wp()}var Zk=function(e){var n,r,i,o,a,s,l,c,u,d,h,p,m,v,g,y,b,w,x,k,S,C,_,E,N,I,T,j,O,P,R,M,A,L,D,B,z,U,F,q,H,W,V,$,K,Q,J,Y,G=Cm(),X=_y();bv();var ee=Mp(function(e){return e}),te=Z.useRef({}),ne=null!==(n=e.mode)&&void 0!==n?n:"normal",re="docked"===ne,ie="static"===ne,oe=!0===e.preview||"preview"===ne,ae="widget-container--".concat(ne),se=tw(oe),le=Py(ee.chats),ce=Z.useMemo(function(){var t;return Ry(null===(t=e.config)||void 0===t?void 0:t.cta,{hasConversation:le,arrivedViaChatLink:se})},[null===(r=e.config)||void 0===r?void 0:r.cta,le,se]),de=re&&!0===(null===(i=e.config.popOut)||void 0===i?void 0:i.enabled),fe=null!==(a=null===(o=e.config.popOut)||void 0===o?void 0:o.minWidth)&&void 0!==a?a:640,he=Z.useRef(null),pe=Z.useState(!1),me=pe[0],ve=pe[1],ge=Z.useState(!1),ye=ge[0],be=ge[1],we=Z.useState(!1),xe=we[0],ke=we[1],Se=Z.useState(!1),Ce=Se[0],_e=Se[1],Ee=Z.useState("undefined"==typeof window?0:window.innerWidth),Ne=Ee[0],Ie=Ee[1];Z.useEffect(function(){if(de&&"undefined"!=typeof window){var e=function(){return Ie(window.innerWidth)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}},[de]),Z.useEffect(function(){if(de&&"undefined"!=typeof IntersectionObserver&&he.current){var e=new IntersectionObserver(function(e){var t=e[e.length-1];t&&(ve(!t.isIntersecting),t.isIntersecting&&(be(!0),ke(!1),_e(!1)))});return e.observe(he.current),function(){return e.disconnect()}}},[de]);var Te,je="message"!==(null===(s=e.config.popOut)||void 0===s?void 0:s.after)||!!(null==(Te=ee.chats)?void 0:Te.some(function(e){var t,n;return"chat.msg"===e.type&&!!(null===(n=null===(t=e.user)||void 0===t?void 0:t.nick)||void 0===n?void 0:n.startsWith("visitor:"))})),Oe=de&&ye&&me&&!xe&&je,Pe=Ne>=fe,Re=null!==(c=null===(l=e.config.popOut)||void 0===l?void 0:l.mobile)&&void 0!==c?c:"auto",Me=Oe&&!Pe&&"none"!==Re&&!Ce,Ae=Oe&&(Pe||Ce);function Le(){_e(!0)}var De=Z.useMemo(function(){return de&&"undefined"!=typeof document?document.createElement("div"):null},[de]),Be=Z.useRef({fromBottom:0,latest:!0});Z.useEffect(function(){if(De){var e=function(e){var t=e.target;if(t instanceof HTMLElement&&t.classList.contains("message-list-container")){var n=t.scrollHeight-t.clientHeight-t.scrollTop;Be.current={fromBottom:n,latest:n<=t.clientHeight}}};return De.addEventListener("scroll",e,!0),function(){return De.removeEventListener("scroll",e,!0)}}},[De]),Qk(function(){if(De){De.className="widget-portal";var e=Ae?document.body:he.current;if(e&&De.parentElement!==e){var t=document.activeElement,n=t instanceof HTMLElement&&De.contains(t)?t:void 0,r=De.querySelector(".message-list-container");e.appendChild(De);var i=function(){if(r){var e=Be.current,t=e.fromBottom,n=e.latest,i=r.scrollHeight-r.clientHeight;r.scrollTop=n?i:Math.max(0,i-t)}};i(),null==n||n.focus({preventScroll:!0});var o=requestAnimationFrame(i),a=window.setTimeout(i,250);return function(){cancelAnimationFrame(o),window.clearTimeout(a)}}}},[De,Ae]),Z.useEffect(function(){return function(){return null==De?void 0:De.remove()}},[De]);var ze,Ue=!0===(null===(u=e.config.header)||void 0===u?void 0:u.hidden)&&(re||ie)&&!Ae,Fe=Z.useMemo(function(){return Ue&&e.config.menu&&"FOOTER"!==e.config.menu.menuButtonLocation?t(t({},e.config.menu),{menuButtonLocation:"FOOTER"}):e.config.menu},[Ue,e.config.menu]),qe=null===(h=null===(d=e.config.header)||void 0===d?void 0:d.actions)||void 0===h?void 0:h.refresh,He=!re&&!ie&&!oe&&(null===(m=null===(p=e.config.header)||void 0===p?void 0:p.actions)||void 0===m?void 0:m.minimize);Yp("docked: ".concat(re," static: ").concat(ie," preview: ").concat(oe," minimized: ").concat(null===(g=null===(v=e.config.header)||void 0===v?void 0:v.actions)||void 0===g?void 0:g.minimize)),ze="boolean"==typeof(null===(b=null===(y=e.config.header)||void 0===y?void 0:y.actions)||void 0===b?void 0:b.cancel)?!re&&!ie&&!oe&&(null===(x=null===(w=e.config.header)||void 0===w?void 0:w.actions)||void 0===x?void 0:x.cancel):!re&&!ie&&!oe,ee.visuals||(ee.visuals={});var We=(null===(k=e.config)||void 0===k?void 0:k.autoOpenOnWidth)?parseInt(e.config.autoOpenOnWidth,10):NaN,Ve=!isNaN(We)&&window.innerWidth>=We,$e=Z.useState(!He&&!ze||(isNaN(We)?ee.visuals.visible:Ve)),Ke=$e[0],Qe=$e[1],Je=Z.useState(!1);Je[0];var Ye=Je[1],Ge=Z.useRef(!1),Xe=Z.useRef(null),Ze=Z.useRef(Ve),et=Z.useContext(Cy),tt=null===(C=null===(S=e.config)||void 0===S?void 0:S.autoOpenOnPattern)||void 0===C?void 0:C.patterns,nt=window.location.href,rt=tt&&tt.length>0,it=null==tt?void 0:tt.some(function(e){return nt.includes(e)}),ot=null===(E=null===(_=e.config)||void 0===_?void 0:_.autoOpenOnPattern)||void 0===E?void 0:E.minimumWidth,at=window.innerWidth,st=Z.useCallback(function(e){ie||oe||(Yp("setVisible: ".concat(e)),Qe(e),G(Iy({visible:e})))},[G,ie,oe]);Z.useEffect(function(){var t,n,r=function(e){var t=document.getElementsByTagName("body")[0];t.tabIndex=-1,"Escape"===e.key&&t.focus()};return document.addEventListener("keydown",r),ew((null==ee?void 0:ee.sessionExpiration)||(null===(t=e.config)||void 0===t?void 0:t.sessionExpiration),null===(n=null==ee?void 0:ee.chats[ee.chats.length-1])||void 0===n?void 0:n.timestamp,null==ee||ee.lastTimestamp)&&(G(Mv(void 0)),G({type:"reset"})),function(){document.removeEventListener("keydown",r),Xe.current&&clearTimeout(Xe.current)}},[]);var lt=Z.useState(!document.hidden),ct=lt[0],ut=lt[1];Z.useEffect(function(){var e=function(){ut(!document.hidden)};return document.addEventListener("visibilitychange",e),function(){document.removeEventListener("visibilitychange",e)}},[]),Z.useEffect(function(){et?ct?(Yp("Tab is VISIBLE - calling wakeup()"),et.wakeup()):(Yp("Tab is HIDDEN - calling sleep()"),et.sleep()):Yp("Tab visibility changed but no chatServer yet")},[et,G,ct]),Z.useEffect(function(){if(et){var e=function(){Yp("beforeunload - notifying router of user disconnecting"),et.notifyDisconnecting&&et.notifyDisconnecting("close_tab")};return window.addEventListener("beforeunload",e),function(){window.removeEventListener("beforeunload",e)}}},[et]),Z.useEffect(function(){ee.visuals.opened?st(!0):"normal"!==ne||Ve||st(!1),rt&&it&&st(!0),at<+ot&&st(!1),Ve&&!Ze.current&&(Ze.current=!0,st(!0))},[at,rt,it,ot,st,ee.visuals.opened,ne,Ve]);var dt=Z.useCallback(function(){Ge.current&&(Xe.current&&(clearTimeout(Xe.current),Xe.current=null),X(ym(!1)),Ye(!1),Ge.current=!1)},[X]),ft=Z.useCallback(function(){Ge.current||(X(ym(!0)),Ye(!0),Ge.current=!0),Xe.current&&clearTimeout(Xe.current),Xe.current=window.setTimeout(function(){dt()},2e3)},[X,dt]);var ht=Ly();function pt(e){oe||("offline"!==ee.accountStatus||ee.isChatting)&&e&&(dt(),et.flush(),X(gm(e)))}function mt(){G({type:"reset"})}function vt(){te.current.style.display="none"}function gt(){G(Iy({opened:!1,hasInteracted:!0})),st(!1)}function yt(){G(Iy({opened:!0,hasInteracted:!0})),st(!0),setTimeout(function(){var e;null===(e=document.getElementById("chatWidgetInput"))||void 0===e||e.focus({preventScroll:!0})},100)}function bt(){G(Iy({hasInteracted:!0}))}var wt=Z.useState(!1),xt=wt[0],kt=wt[1],St=Z.useState(null),Ct=St[0],_t=St[1],Et=Z.useCallback(function(e){$p(e.preselectChipLabel?{preselectChipLabel:e.preselectChipLabel}:void 0).then(function(t){t||(Yp("Form widget not available, showing modal fallback"),_t(e),kt(!0))})},[]),Nt=Z.useCallback(function(){kt(!1),_t(null)},[]);var It="offline"===ee.accountStatus&&!ee.isChatting,Tt=ee&&ee.chats;Yp('Rendering - accountStatus: "'.concat(ee.accountStatus,'", connectionStatus: "').concat(ee.connection.connectionStatus,'"'));var jt=e.config,Ot=e.onConnectionStatusChange,Pt=!0===(null===(N=null==jt?void 0:jt.actionBar)||void 0===N?void 0:N.enabled),Rt=aw(),Mt=null!==(T=null===(I=null==jt?void 0:jt.actionBar)||void 0===I?void 0:I.buttons)&&void 0!==T?T:[],At=!(null==jt?void 0:jt.formWidgetKey)&&Mt.some(Uw)&&!Mt.some(Gk),Lt=Z.useState(function(){return At&&Xk()}),Dt=Lt[0],Bt=Lt[1];Z.useEffect(function(){if(At&&!Dt){var e=0,t=setInterval(function(){e++,Xk()?(Bt(!0),clearInterval(t)):e>=30&&clearInterval(t)},500);return function(){return clearInterval(t)}}},[At,Dt]);var zt=Z.useMemo(function(){var e=null==jt?void 0:jt.actionBar;return e&&At&&!Dt?t(t({},e),{buttons:e.buttons.filter(function(e){return!Uw(e)})}):e},[null==jt?void 0:jt.actionBar,At,Dt]),Ut=Z.useMemo(function(){return Pt&&zt?Fw(zt.buttons,{chatDisabled:jt.disabled,formDisabled:Rt}):[]},[Pt,zt,null==jt?void 0:jt.disabled,Rt]),Ft=Pt&&Ut.length>0;sw(!It&&!e.preChatFormEnabled&&Ke&&!oe);var qt=ee.connection.connectionStatus;Z.useEffect(function(){Ot&&Ot(qt)},[qt,Ot]),nw(null===(j=e.config)||void 0===j?void 0:j.middlewareUrl);var Ht=!Rt&&(!Pt||Ut.some(Uw)),Wt=null!==(O=null==jt?void 0:jt.formWidgetKey)&&void 0!==O?O:Ut.map(Gk).find(Boolean);Z.useEffect(function(){var e;Wt&&Ht&&(e=Wt)&&Hp(e).catch(function(e){console.warn("[chat-widget] Failed to preload form-widget script:",e)})},[Wt,Ht]),Z.useEffect(function(){if(Ft){var e=parseInt(document.body.getAttribute("data-xapp-action-bar-count")||"0",10);document.body.setAttribute("data-xapp-action-bar-count",String(e+1)),document.body.setAttribute("data-xapp-action-bar-enabled","true")}return function(){if(Ft){var e=parseInt(document.body.getAttribute("data-xapp-action-bar-count")||"0",10),t=Math.max(0,e-1);0===t?(document.body.removeAttribute("data-xapp-action-bar-enabled"),document.body.removeAttribute("data-xapp-action-bar-count")):document.body.setAttribute("data-xapp-action-bar-count",String(t))}}},[Ft]);var Vt=(null===(P=ee.agents["agent:robot"])||void 0===P?void 0:P.user)||(null==jt?void 0:jt.agent)||{nick:"agent:robot",avatarPath:jt.avatarUrl,display_name:"Agent"},$t=f.jsxs("div",{className:"widget-container ".concat(ae," ").concat(function(){var e;return Ke?"visible":(null===(e=ee.visuals)||void 0===e?void 0:e.hasInteracted)?"":"widget-container--initial-hidden"}()).concat(Ft?" widget-container--with-action-bar":"").concat(Ae?" widget-container--popped":"").concat(Me?" widget-container--collapsed":""),children:[f.jsx(Ik,{theme:null==jt?void 0:jt.theme}),!Ue&&f.jsx(_k,{accountStatus:ee.accountStatus,refreshOnClick:function(){jt.header.actions.refreshShowConfirmation?te.current.style.display="block":mt()},minimizeOnClick:Ae?function(){Pe?ke(!0):_e(!1)}:gt,cancelOnClick:function(){(null==et?void 0:et.notifyDisconnecting)&&et.notifyDisconnecting("widget_close"),G({type:"reset"}),G(Iy({opened:!1,hasInteracted:!0})),st(!1)},agent:Vt,canRefresh:qe,canMinimize:Ae||He,canCancel:ze,config:null==jt?void 0:jt.header,menuConfig:jt.menu,debugMode:null===(A=null===(M=null===(R=e.config)||void 0===R?void 0:R.connection)||void 0===M?void 0:M.mcp)||void 0===A?void 0:A.debugMode,onSubmit:pt}),f.jsx(uk,{visible:Ke,queuePosition:ee.queuePosition,isChatting:ee.isChatting,isOffline:It,messages:Tt,agents:ee.agents,agent:null==jt?void 0:jt.agent,lastRatingRequestTimestamp:ee.lastRatingRequestTimestamp,hasRating:ee.hasRating,visitorId:ee.visitorId,hasWsButton:!!ee.wsButton,messageMiddleware:e.messageMiddleware,textTypingStatusEnabled:null===(D=null===(L=e.config)||void 0===L?void 0:L.typingStatus)||void 0===D?void 0:D.textTypingStatusEnabled,disableAutoScroll:e.disableAutoScroll,onSend:function(e){oe||X(function(e){return function(t){return function(n,r){var i=r();("offline"!==i.accountStatus||i.isChatting)&&(e.msg&&n(vm(e.msg,i.visitor,+new Date)),t.sendChatMsgRequest(e,function(){}))}}}(e))},onWrite:function(e){oe||G(vm(e.msg,e.user))},onOpenUrl:ht,minimizeOnClick:gt}),f.jsx("div",{className:"xa-spinner-container ".concat(Ke&&"pending"===qt?"visible":""),children:f.jsx("div",{className:"xa-spinner"})}),"offline"===qt&&f.jsx(dk,{}),ee.wsButton&&Ke&&f.jsx(Hk,{button:ee.wsButton,onPress:function(e){var n,r;Yp("WS Button pressed: ".concat(e)),"spinning"===(null===(n=ee.wsButton)||void 0===n?void 0:n.pressBehavior)&&G({type:"ws_button_display",detail:t(t({},ee.wsButton),{isPressed:!0,timestamp:+new Date})}),et&&et.sendButtonPressed&&et.sendButtonPressed(e).catch(function(e){Gp("Failed to send button press: ".concat(e)),ee.wsButton&&G({type:"ws_button_display",detail:t(t({},ee.wsButton),{isPressed:!1,timestamp:+new Date})})}),"disabled"===(null===(r=ee.wsButton)||void 0===r?void 0:r.pressBehavior)&&(G({type:"ws_button_display",detail:t(t({},ee.wsButton),{isDismissing:!0,timestamp:+new Date})}),setTimeout(function(){G({type:"ws_button_dismiss",detail:{id:e,timestamp:+new Date}})},300))}}),f.jsx(px,{isAdmin:null==jt?void 0:jt.isAdmin,isChatting:ee.isChatting,placeholder:null===(B=null==jt?void 0:jt.input)||void 0===B?void 0:B.placeholder,sendButtonIcon:null===(U=null===(z=null==jt?void 0:jt.footer)||void 0===z?void 0:z.sendButton)||void 0===U?void 0:U.icon,sendButtonIconHover:null===(q=null===(F=null==jt?void 0:jt.footer)||void 0===F?void 0:F.sendButton)||void 0===q?void 0:q.iconHover,sendButtonIconDisabled:null===(W=null===(H=null==jt?void 0:jt.footer)||void 0===H?void 0:H.sendButton)||void 0===W?void 0:W.iconDisabled,visible:Ke,hasWsButton:!!ee.wsButton,menuConfig:Fe,footerConfig:null===(V=e.config)||void 0===V?void 0:V.footer,inputConfig:null===($=e.config)||void 0===$?void 0:$.input,disabled:oe,onChange:ft,onSubmit:pt,onFileUpload:function(e){var t;if(e.preventDefault(),!oe){var n=null===(t=null==e?void 0:e.dataTransfer)||void 0===t?void 0:t.files[0];n&&X(function(e){return function(t){return function(n,r){var i=r();if("offline"!==i.accountStatus||i.isChatting){var o={mimeType:e.type,name:e.name,size:e.size,url:window.URL.createObjectURL(e)};t.sendFile(e,function(e){e&&Yp("Error sending file",e)}),n({type:"synthetic",detail:{type:"visitor.send.file",attachment:o,user:{nick:""},attributes:{currentUrl:window.location.href},timestamp:+new Date}})}}}}(n))}}}),f.jsx("div",{className:"restartModal",ref:te,onClick:vt,children:f.jsx(Wk,{onClose:vt,onReset:mt})})]});return f.jsxs(f.Fragment,{children:[de?f.jsx("div",{className:"widget-anchor",ref:he,children:De&&ue.createPortal($t,De)}):$t,!Ft||!zt||Me&&"button"===Re?f.jsx(ex,{addClass:Ke&&!Me?"visible":"",onClick:Me?Le:yt,config:ce,imageUrl:null===(J=null==jt?void 0:jt.chatButton)||void 0===J?void 0:J.imageUrl,visible:!Me&&Ke,hasInteracted:null===(Y=ee.visuals)||void 0===Y?void 0:Y.hasInteracted,onCtaDismiss:bt}):f.jsxs(f.Fragment,{children:[f.jsx(qw,{config:t(t({},zt),{cta:Ry(null!==(K=zt.cta)&&void 0!==K?K:jt.cta,{hasConversation:le,arrivedViaChatLink:se})}),visible:!Me&&Ke,chatDisabled:jt.disabled,formDisabled:Rt,hasUserInteracted:null===(Q=ee.visuals)||void 0===Q?void 0:Q.hasInteracted,onChatClick:Me?Le:yt,onChatMinimize:gt,onFormClick:Et,onCtaDismiss:bt}),xt&&Ct&&f.jsx(mx,{config:Ct,widgetEnv:jt,onClose:Nt})]}),f.jsx(qk,{enableErrorOverlay:null==jt?void 0:jt.enableErrorOverlay})]})},eS=function(e){var n,r=null!==(n=e.mode)&&void 0!==n?n:"normal",i="preview"===r?"static":r;return!0===e.preview||"preview"===r?f.jsx(Jk,t({},e,{mode:i})):f.jsx(Yk,t({},e))},tS=function(e){var n=xb(),r=t(t({},e),{messageMiddleware:n});return f.jsx(eS,t({},r))},nS=function(e){var n,r,i,o,a,s,l=xb(),c=om(e.config),u=Z.useMemo(function(){var t,n,r,i,o;return Xb({connection:c,userId:null===(t=e.config)||void 0===t?void 0:t.userId,accessToken:null===(n=e.config)||void 0===n?void 0:n.accessToken,attributes:null===(r=e.config)||void 0===r?void 0:r.attributes,sessionExpiration:null===(i=e.config)||void 0===i?void 0:i.sessionExpiration,enableErrorOverlay:null===(o=e.config)||void 0===o?void 0:o.enableErrorOverlay})},[c,null===(n=e.config)||void 0===n?void 0:n.userId,null===(r=e.config)||void 0===r?void 0:r.accessToken,null===(i=e.config)||void 0===i?void 0:i.attributes,null===(o=e.config)||void 0===o?void 0:o.sessionExpiration,null===(a=e.config)||void 0===a?void 0:a.enableErrorOverlay]);if(null===(s=e.config)||void 0===s?void 0:s.disabled)return f.jsx(f.Fragment,{});var d=t(t({},e),{messageMiddleware:l,getConfig:e.getConfig});return f.jsx(_p,{store:u,children:f.jsx(eS,t({},d))})},rS=function(e){var n,r=null!==(n=e.mode)&&void 0!==n?n:"normal";return!0===e.preview||"preview"===r?f.jsx(tS,t({},e)):f.jsx(nS,t({},e))};function iS(e){return e.split("-").map(function(e,t){return e.length?t?e[0].toUpperCase()+e.substring(1).toLowerCase():e.toLowerCase():""}).join("")}function oS(e){return Object.keys(e).reduce(function(t,n){var r=n,i="string";n.endsWith("-FLAG")?(r=n.substring(0,n.length-5),i="boolean"):n.endsWith("-MSEC")&&(r=n.substring(0,n.length-5),i="number");for(var o=r.split("_").map(iS),a=t;o.length>1;){var s=o.shift();"object"==typeof a&&(a[s]||(a[s]={}),a=a[s])}return"object"==typeof a&&(a[o.shift()]=function(e,t){return"string"===t?e:"boolean"===t?"TRUE"===e:"number"===t?parseFloat(e):e}(e[n],i)),t},{})}function aS(e,n){if(!n)return e;var r=t({},e);for(var o in n)if(n.hasOwnProperty(o)){var a=n[o],s=r[o];if(void 0===a)continue;null===a?r[o]=a:Array.isArray(a)?r[o]=i([],a,!0):"object"!=typeof a||Array.isArray(a)?r[o]=a:s&&"object"==typeof s&&!Array.isArray(s)?r[o]=aS(s,a):r[o]=t({},a)}return r}var sS="{{INJECT}}";function lS(e){var t=e||sS;try{var n=JSON.parse(t),r=window.xaConfig||{};window.xaConfig=aS(n,r)}catch(e){t!==sS&&Gp("Chat Widget: injected config could not be parsed",{injected:t,error:e})}}function cS(){return n(this,arguments,void 0,function(e){var t;return void 0===e&&(e=1e4),r(this,function(n){switch(n.label){case 0:t=Date.now(),n.label=1;case 1:return dS(window)?[3,3]:Date.now()-t>e?(console.warn("[xapp-chat-widget] Timeout waiting for window.xaConfig"),[2,{}]):[4,new Promise(function(e){return setTimeout(e,50)})];case 2:return n.sent(),[3,1];case 3:return[2,window.xaConfig]}})})}function uS(){var e=oS(process.env),n="true"===new URL(window.location.href).searchParams.get("isAdmin"),r=dS(window)?window.xaConfig:{};return t(t(t(t({},e),{isAdmin:n}),r),{attributes:t(t({},null==e?void 0:e.attributes),null==r?void 0:r.attributes)})}function dS(e){return!!e&&null!=e.xaConfig&&"object"==typeof e.xaConfig}var fS="chat-config-error";var hS=function(e){var t,n=e.env,r=function(){var e=Z.useState(!1),t=e[0],n=e[1];return Z.useEffect(function(){if(!document.getElementById("xapp-style")){var e=Xp(),t=document.createElement("link");t.id="xapp-style",t.href="".concat(e.path,"/xapp-chat-widget.css"),t.rel="stylesheet",document.head.appendChild(t),t.addEventListener("load",function(){n(!0)})}},[]),[t]}()[0];if(n.disabled)return f.jsx(f.Fragment,{});var i=n.mode,o=null===(t=window.xaConfig)||void 0===t?void 0:t.getConfig;return r?f.jsx(rS,{config:n,mode:i,getConfig:o}):f.jsx(f.Fragment,{})},pS=!1,mS=null;function vS(){return n(this,void 0,void 0,function(){var e,t,n;return r(this,function(r){switch(r.label){case 0:if(pS)return[2];pS=!0,r.label=1;case 1:return r.trys.push([1,,4,5]),lS(),dS(window)||window.xaSkipConfigWait?[3,3]:[4,cS()];case 2:r.sent(),r.label=3;case 3:return function(e,t){return void 0===t&&(t={}),!!(null==e?void 0:e.disabled)||!!t.hasAsyncConfigLoader||!!sm(e).serverUrl}(e=uS(),{hasAsyncConfigLoader:!!(null===(n=window.xaConfig)||void 0===n?void 0:n.getConfig)})?((t=document.getElementById("xapp-widget"))||((t=document.createElement("div")).id="xapp-widget",document.body.appendChild(t)),mS||(mS=ap.createRoot(t)),mS.render(f.jsx(hS,{env:e})),[3,5]):(Gp("Chat Widget: not rendering, the configuration has no server URL",function(e){var t=sm(e);return{serverUrl:t.serverUrl,accountKey:t.accountKey,connectionType:t.type}}(e)),function(){if("debug"===window.xaLogLevel&&!document.getElementById(fS)){var e=document.createElement("div");e.id=fS,e.textContent="Chat Load Error",e.style.cssText="\n position: fixed;\n bottom: 20px;\n right: 20px;\n background-color: #f44336;\n color: white;\n padding: 12px 16px;\n border-radius: 4px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 14px;\n font-weight: 500;\n z-index: 10000;\n box-shadow: 0 2px 8px rgba(0,0,0,0.2);\n transition: opacity ".concat(300,"ms ease-in-out;\n "),document.body.appendChild(e),setTimeout(function(){e.style.opacity="0",setTimeout(function(){return e.remove()},300)},2e3)}}(),[2]);case 4:return pS=!1,[7];case 5:return[2]}})})}return window.addEventListener("load",function(){vS()}),"complete"===document.readyState&&vS(),e.ChatMessagePart=mm,e.INJECT_PLACEHOLDER=sS,e.React=ee,e.injectConfig=lS,e.renderWidget=vS,e}({});
|
|
7
|
+
n(Lw,e),n(Dw,e),n(Jw,e),n(Bw,e),n(Yw,e),n(Gw,e),n(Xw,e),n(Zw,e),n(ex,e),n(tx,e)}(Mw);var nx=function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2zM9 14H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8 4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2z"})})},rx=function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})})},ix=function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})})},ox={chat:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"})})},form:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6zm2-6h8v2H8v-2zm0-3h8v2H8v-2zm0 6h5v2H8v-2z"})})},calendar:nx,schedule:nx,phone:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z"})})},link:rx,url:rx,email:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"})})},help:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"})})},payment:function(){return f.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:f.jsx("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"})})}},ax=function(e){var t=e.type,n=e.icon,r=e.iconUrl,i=e.className;if(r)return f.jsx("div",{className:i,children:f.jsx("img",{src:r,alt:"".concat(n||t," icon")})});var o=ox[n||t]||ix;return f.jsx("div",{className:i,children:f.jsx(o,{})})},sx=["http:","https:","tel:","mailto:"];function lx(e,t,n){if(!function(e){try{var t=new URL(e,window.location.href);return sx.includes(t.protocol)}catch(e){return!1}}(e))return console.warn("[ActionBar] Blocked navigation to unsafe URL:",e),!1;if("sameWindow"===t)window.location.href=e;else if("newWindow"===t&&n){var r="width=".concat(n.width||600,",height=").concat(n.height||400);window.open(e,"_blank",r)}else window.open(e,"_blank","noopener,noreferrer");return!0}var cx={chat:"Chat",form:"Contact",schedule:"Book",phone:"Call",url:"Link",email:"Email",help:"Help",payment:"Pay"},ux=function(e){var t,n=e.button,r=e.chatActive,i=e.onChatClick,o=e.onChatMinimize,a=e.onFormClick,s=e.isMobile,l=Z.useCallback(function(){if(Mw.isActionBarChatButton(n))r?o():i();else if(Mw.isActionBarFormButton(n)||Mw.isActionBarScheduleButton(n))a(n);else if(Mw.isActionBarPhoneButton(n)){var e=n.phoneNumber.replace(/\s/g,"");window.location.href="tel:".concat(e)}else if(Mw.isActionBarUrlButton(n)){var t=n.url,s=n.target;lx(t,void 0===s?"newTab":s,n.windowOptions)}else if(Mw.isActionBarEmailButton(n)){var l=n.emailAddress,c=n.subject,u=n.body,d="mailto:".concat(l),f=[];c&&f.push("subject=".concat(encodeURIComponent(c))),u&&f.push("body=".concat(encodeURIComponent(u))),f.length>0&&(d+="?".concat(f.join("&"))),window.location.href=d}else if(Mw.isActionBarHelpButton(n)){t=n.url;var p=n.target;lx(t,void 0===p?"newTab":p)}else if(Mw.isActionBarPaymentButton(n)){t=n.url;var h=n.target;lx(t,void 0===h?"newTab":h)}},[n,r,i,o,a]),c=n.visibility||"all";if("mobile-only"===c&&!s)return null;if("desktop-only"===c&&s)return null;var u=n.label||cx[n.type]||n.type,d=null!==(t=n.tabIndex)&&void 0!==t?t:0,p=Mw.isActionBarChatButton(n)&&r,h=["xapp-action-bar__button",p?"xapp-action-bar__button--active":""].filter(Boolean).join(" ");return f.jsxs("button",{className:h,onClick:l,"aria-label":u,"aria-pressed":p,tabIndex:d,children:[f.jsx(ax,{type:n.type,icon:n.icon,iconUrl:n.iconUrl,className:"xapp-action-bar__icon"}),n.label&&f.jsx("span",{className:"xapp-action-bar__label",children:n.label})]})},dx=function(e){var t,n,r,i,o,a,s,l,c,u,d=e.config,p=e.isMobile,h=e.onClick,m=e.onDismiss,v=e.hasUserInteracted,g=Z.useState(!1),y=g[0],b=g[1],w=Z.useState(!1),x=w[0],k=w[1],S=Z.useState(!1),C=S[0],_=S[1],E=p?null===(t=d.mobile)||void 0===t?void 0:t.message:void 0,N=void 0!==E?E:d.message,I=p&&void 0!==(null===(n=d.mobile)||void 0===n?void 0:n.delay)?d.mobile.delay:null!==(r=d.delay)&&void 0!==r?r:0,T=p?null===(i=d.mobile)||void 0===i?void 0:i.timeout:void 0,j=void 0!==T?T:d.timeout,O=p?null===(o=d.mobile)||void 0===o?void 0:o.animation:void 0,P=void 0!==O?O:d.animation,A=p&&void 0!==(null===(a=d.mobile)||void 0===a?void 0:a.animationDelay)?d.mobile.animationDelay:null!==(s=d.animationDelay)&&void 0!==s?s:I,R=p&&void 0!==(null===(l=d.mobile)||void 0===l?void 0:l.animationTimeout)?d.mobile.animationTimeout:d.animationTimeout,M=p&&void 0!==(null===(c=d.mobile)||void 0===c?void 0:c.dismissible)?d.mobile.dismissible:null===(u=d.dismissible)||void 0===u||u;Z.useEffect(function(){if(N&&!v&&!C){var e=setTimeout(function(){b(!0)},I);return function(){return clearTimeout(e)}}b(!1)},[N,I,v,C]),Z.useEffect(function(){if(y&&j){var e=setTimeout(function(){b(!1)},j);return function(){return clearTimeout(e)}}},[y,j]),Z.useEffect(function(){if(P&&!v&&!C){var e=setTimeout(function(){k(!0)},A);return function(){return clearTimeout(e)}}k(!1)},[P,A,v,C]),Z.useEffect(function(){if(x&&R){var e=setTimeout(function(){k(!1)},R);return function(){return clearTimeout(e)}}},[x,R]);var L=function(){h(),b(!1)};if(!y||!N)return null;var D=x&&P?"xapp-action-bar-cta--".concat(P):"";return f.jsxs("div",{className:"xapp-action-bar-cta ".concat(D),onClick:L,role:"button",tabIndex:0,"aria-label":N,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),L())},children:[f.jsx("span",{className:"xapp-action-bar-cta__message",children:N}),M&&f.jsx("button",{className:"xapp-action-bar-cta__dismiss",onClick:function(e){e.stopPropagation(),_(!0),b(!1),m()},"aria-label":"Dismiss",type:"button",children:f.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("path",{d:"M13 1L1 13M1 1L13 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})},fx="--xapp-action-bar-height";function px(e){return Mw.isActionBarFormButton(e)||Mw.isActionBarScheduleButton(e)}function hx(e,t){void 0===e&&(e=[]),void 0===t&&(t={});var n=t.chatDisabled,r=t.formDisabled;return e.filter(function(e){return(!n||!Mw.isActionBarChatButton(e))&&(!r||!px(e))})}var mx=function(e){var t,n,r=e.config,i=e.visible,o=e.chatDisabled,a=e.formDisabled,s=e.hasUserInteracted,l=void 0!==s&&s,c=e.onChatClick,u=e.onChatMinimize,d=e.onFormClick,p=e.onCtaDismiss,h=Z.useState(!1),m=h[0],v=h[1],g=null!=r.mobileBreakpoint?"(max-width: ".concat(r.mobileBreakpoint,"px)"):ab,y=null!==(t=r.position)&&void 0!==t?t:"right",b=Z.useRef(null);Z.useEffect(function(){if("function"==typeof window.matchMedia){var e=window.matchMedia(g);v(e.matches);var t=function(e){v(e.matches)};return"function"==typeof e.addEventListener?(e.addEventListener("change",t),function(){return e.removeEventListener("change",t)}):(e.addListener(t),function(){return e.removeListener(t)})}},[g]),Z.useLayoutEffect(function(){var e=b.current;if(e){var t=function(){var t=e.getBoundingClientRect().height;t<=0||document.documentElement.style.setProperty(fx,"".concat(t,"px"))};if(t(),"undefined"==typeof ResizeObserver)return function(){document.documentElement.style.removeProperty(fx)};var n=new ResizeObserver(t);return n.observe(e),function(){n.disconnect(),document.documentElement.style.removeProperty(fx)}}},[m]);var w=hx(r.buttons,{chatDisabled:o,formDisabled:a}),x=["xapp-action-bar","xapp-action-bar--".concat(y),m?"xapp-action-bar--mobile":"xapp-action-bar--desktop"].filter(Boolean).join(" "),k=w.some(Mw.isActionBarChatButton),S=(null===(n=r.cta)||void 0===n?void 0:n.message)&&!i&&!o&&k;return 0===w.length?null:f.jsxs("div",{ref:b,className:x,role:"toolbar","aria-label":"Chat actions",children:[S&&f.jsx("div",{className:"xapp-action-bar-cta-wrapper",children:f.jsx(dx,{config:r.cta,isMobile:m,onClick:function(){c()},onDismiss:function(){null==p||p()},hasUserInteracted:l})}),f.jsx("div",{className:"xapp-action-bar__buttons",children:w.map(function(e){return f.jsx(ux,{button:e,chatActive:i,onChatClick:c,onChatMinimize:u,onFormClick:d,isMobile:m},e.id)})})]})};function vx(){var e=Z.useRef(null),t=Z.useState(),n=t[0],r=t[1];return Z.useLayoutEffect(function(){var t,n;r(null===(n=null===(t=e.current)||void 0===t?void 0:t.getBoundingClientRect())||void 0===n?void 0:n.toJSON())},[]),[e,n]}function gx(e,t){return{x:e.x+t.x,y:e.y+t.y}}function yx(e,t){return{x:e.x-t.x,y:e.y-t.y}}function bx(e,t){return{x:e.x*t,y:e.y*t}}function wx(e){return Math.sqrt(e.x*e.x+e.y*e.y)}function xx(e,t){var n=t*Math.PI/180,r=Math.cos(n),i=Math.sin(n);return{x:e.x*r+e.y*i,y:e.y*r-e.x*i}}function kx(e,t){var n=yx(t.start,e.center),r=n.x,i=n.y,o=t.direction.x,a=t.direction.y,s=e.radius.x,l=e.radius.y,c=s*s,u=l*l,d=o*o/c+a*a/u,f=2*o*r/c+2*a*i/u,p=f*f-4*d*(r*r/c+i*i/u-1);if(p>=0){var h=Math.sqrt(p),m=(-f-h)/(2*d),v=(-f+h)/(2*d);if(m>0&&v>0)return gx(t.start,bx(t.direction,Math.min(m,v)));if(m>0)return gx(t.start,bx(t.direction,m));if(v>0)return gx(t.start,bx(t.direction,v))}return t.start}function Sx(e,t){var n,r,i,o=e.direction*Math.PI/180,a={x:e.width/2,y:e.height/2},s={x:t.x/2,y:t.y/2},l={x:a.x*Math.cos(o),y:a.y*Math.sin(o)},c=(n=l,r=wx(l)+e.length,(i=wx(n))?bx(n,r/i):n),u=gx(c,s),d=yx(l,c),f=e.angle,p=xx(d,f/2),h=xx(d,-f/2),m={center:s,radius:a},v=kx(m,{start:u,direction:p}),g=kx(m,{start:u,direction:h});return"m ".concat(u.x," ").concat(u.y," L ").concat(v.x," ").concat(v.y," L ").concat(g.x," ").concat(g.y," z")}var Cx=function(e){var t,n,r=vx(),i=r[0],o=r[1],a={x:null!==(t=null==o?void 0:o.width)&&void 0!==t?t:0,y:null!==(n=null==o?void 0:o.height)&&void 0!==n?n:0};return f.jsx("div",{ref:i,className:"cta-bubble__tail",children:f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(a.x," ").concat(a.y),children:f.jsx("path",{d:Sx(e,a),fill:"currentColor"})})})},_x=function(e){var t,n,r,i,o=vx(),a=o[0],s=o[1],l=(e.animate||!1)&&"bounce"===e.buttonAnimation?"bounce":"none";return console.log("Returning CTABubble with message: ",e.children),f.jsxs("div",{ref:a,style:{border:e.borderStyle?"solid":"none",borderWidth:(null===(t=e.borderStyle)||void 0===t?void 0:t.width)||"0px",borderColor:(null===(n=e.borderStyle)||void 0===n?void 0:n.color)||"transparent",animation:"".concat(l," 1s infinite")},className:"cta-bubble",onClick:e.onClick,children:[f.jsx(Cx,{width:null!==(r=null==s?void 0:s.width)&&void 0!==r?r:0,height:null!==(i=null==s?void 0:s.height)&&void 0!==i?i:0,direction:60,angle:45,length:16}),f.jsx("div",{className:"cta-bubble__content",children:e.children}),e.dismissible&&f.jsx("button",{className:"cta-bubble__dismiss",onClick:function(t){t.stopPropagation(),e.onDismiss&&e.onDismiss()},"aria-label":"Dismiss",children:f.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:f.jsx("path",{d:"M11 1L1 11M1 1L11 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})},Ex=function(e){var t=e.visible,n=e.timeout,r=e.delay,i=e.animate,o=e.buttonAnimation,a=e.dismissible,s=e.onClick,l=e.onDismiss,c=e.children;Yh("[CtaBubbleContainer] Props received:",{visible:t,timeout:n,delay:r,animate:i,buttonAnimation:o,dismissible:a,hasOnClick:!!s,hasOnDismiss:!!l,hasChildren:!!c,childrenContent:c});var u=Z.useMemo(function(){var e=t?(new Date).valueOf():void 0;return Yh("[CtaBubbleContainer] StartTime calculated: visible=".concat(t,", startTime=").concat(e)),e},[t]),d=Z.useState(!1),p=d[0],h=d[1];Yh("[CtaBubbleContainer] Current state: showBubble=".concat(p)),Z.useEffect(function(){Yh("[CtaBubbleContainer] useEffect triggered with:",{startTime:u,startTimeExists:!!u,timeout:n,timeoutType:typeof n,delay:r,delayType:typeof r,visible:t});var e=null,i=null,o=!0;if(u){var a=r||0;Yh("[CtaBubbleContainer] Timer setup: actualDelay=".concat(a,"ms (from delay=").concat(r,")")),i=setTimeout(function(){Yh("[CtaBubbleContainer] Delay timer fired after ".concat(a,"ms, isMounted=").concat(o)),o?(Yh("[CtaBubbleContainer] Component still mounted, setting showBubble=true"),h(!0),"number"==typeof n?(Yh("[CtaBubbleContainer] Hide timer setup: will hide after ".concat(n,"ms")),e=setTimeout(function(){Yh("[CtaBubbleContainer] Hide timer fired after ".concat(n,"ms, isMounted=").concat(o)),o?(Yh("[CtaBubbleContainer] Component still mounted, setting showBubble=false"),h(!1)):Yh("[CtaBubbleContainer] Component unmounted, skipping hide")},n)):Yh("[CtaBubbleContainer] No hide timer set (timeout=".concat(n,", type=").concat(typeof n,")"))):Yh("[CtaBubbleContainer] Component unmounted before delay timer, not showing bubble")},a)}else Yh("[CtaBubbleContainer] No startTime, skipping timer setup");return function(){Yh("[CtaBubbleContainer] Cleanup triggered, unmounting component"),o=!1,e&&(Yh("[CtaBubbleContainer] Clearing hide timer"),clearTimeout(e)),i&&(Yh("[CtaBubbleContainer] Clearing delay timer"),clearTimeout(i))}},[u,n,r,t]);var m=t&&p;return Yh("[CtaBubbleContainer] Render decision: visible=".concat(t,", showBubble=").concat(p,", shouldRender=").concat(m)),f.jsx(f.Fragment,{children:t&&p&&f.jsx(_x,{onClick:s,animate:i,buttonAnimation:o,dismissible:a,onDismiss:function(){Yh("[CtaBubbleContainer] handleDismiss called, setting showBubble=false"),h(!1),l&&(Yh("[CtaBubbleContainer] Calling onDismiss callback"),l())},children:c})})},Nx=function(e){var t,n=e.onClick,r=e.addClass,i=e.config,o=e.visible,a=e.borderStyle,s=e.imageUrl,l=e.hasInteracted,c=e.onCtaDismiss,u=Z.useState(em),d=u[0],p=u[1],h=Z.useState(!1),m=h[0],v=h[1],g=(null===(t=null==i?void 0:i.mobile)||void 0===t?void 0:t.applyAtLessThanWidth)||"400",y=window.innerWidth<=parseInt(g,10)&&(null==i?void 0:i.mobile)?i.mobile:i;Z.useEffect(function(){var e,t,n;if(l)return v(!1),function(){};var r=null!==(e=null==y?void 0:y.animationDelay)&&void 0!==e?e:null==y?void 0:y.delay;return r?t=setTimeout(function(){v(!0),y.animationTimeout&&(n=setTimeout(function(){v(!1)},y.animationTimeout))},r):(null==y?void 0:y.animationTimeout)?(v(!0),n=setTimeout(function(){v(!1)},y.animationTimeout)):(null==y?void 0:y.animation)&&v(!0),function(){t&&clearTimeout(t),n&&clearTimeout(n)}},[y,v,l]);var b=m&&!l?(null==y?void 0:y.animation)||"wiggle":"none";Z.useEffect(function(){var e=function(){var e=window.innerWidth<parseInt(g,10)?"30":em;p(e)};return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[g]);var w=Math.min(22,+d/48*22);return f.jsxs("button",{"aria-label":"open chat",className:"xapp-chat-button ".concat(r||"").trim(),onClick:n,children:[f.jsx("div",{id:"xapp-widget-button",className:"xapp-chat-button__btn",style:{width:"".concat(d,"px"),height:"".concat(d,"px"),borderRadius:"".concat(+d/2,"px"),border:a&&a.width?"solid":"none",borderWidth:(null==a?void 0:a.width)||"0px",borderColor:(null==a?void 0:a.color)||"transparent",animation:"".concat(b," 1s infinite")},children:s?f.jsx("img",{src:s,alt:"Chat Icon"}):f.jsx("svg",{width:w,height:w,viewBox:"0 0 22 22",children:f.jsx("path",{d:"M13 22l-4-6H2c-1.11-.043-2-.935-2-2V2C0 .89.89 0 2 0h18c1.11 0 2 .892 2 2v12c0 1.067-.89 1.957-2 2h-3l-4 6zm3-8h4c-.005.3-.01-12 0-12-.01.004-18 .006-18 0 .005.006 0 12 0 12h8l3 5 3-5z",fill:"#FFF",fillRule:"evenodd"})})}),y&&y.message&&!l&&f.jsx("div",{className:"xapp-chat-button__cta",children:f.jsx(Ex,{timeout:null==y?void 0:y.timeout,delay:null==y?void 0:y.delay,animate:m,buttonAnimation:b,dismissible:null==y?void 0:y.dismissible,visible:!o,onDismiss:c,children:null==y?void 0:y.message})})]})};function Ix(e,t){var n=Z.useState(),r=n[0],i=n[1],o=Z.useState(-1),a=o[0],s=o[1],l=Z.useState(e),c=l[0],u=l[1],d=Z.useState(t),f=d[0],p=d[1];Z.useEffect(function(){u(e)},[e]),Z.useEffect(function(){p(t)},[t]);var h=Z.useMemo(function(){return r?Mv(r,a):void 0},[r,a]),m=Z.useCallback(function(e){if(r){var t=Dv(r);s(function(n){return function(e,t){return(e+t)%t}(n+e+(n<0&&e<=0?1:0),t)})}else s(-1)},[r]),v=Z.useCallback(function(e){switch(e){case"prev":m(-1);break;case"next":m(1);break;case"cancel":s(-1),u(void 0),p(void 0)}},[m]),g=function(e,t){var n=rm(),r=null==n?void 0:n.autocompleteSuggestionsUrl;return Wv({url:r,query:e,context:t})}(c||"",f),y="success"===g.state?g.data:void 0,b=Z.useMemo(function(){return y?Bv(y,-1).map(function(e){return{heading:e.heading,items:e.items.slice().reverse()}}):void 0},[y]);return Z.useEffect(function(){var e=h;i(b),e&&b||s(-1)},[b,h]),Z.useMemo(function(){return{suggestions:r,index:a,execute:v,item:h}},[r,a,v,h])}var Tx=function(e){var t=e.onAdminJoin,n=Z.useRef(null),r=Z.useState(!1),i=r[0],o=r[1],a=Z.useState(""),s=a[0],l=a[1];function c(e){l(e.target.value)}var u=""===s||void 0===s,d=Gy();function p(e){var r,a;e.preventDefault(),i?(d(function(e){return function(){e.bargeOut(function(e){e&&Yh(e)})}}),o(!1),t(!1),l("")):(d((a=null===(r=n.current)||void 0===r?void 0:r.value,function(e){return function(){e.bargeIn(a,function(e){e&&Yh(e)})}})),o(!0),t(!0))}return f.jsx("div",{className:"xappw-admin-input-container visible",children:i?f.jsx("form",{className:"xappw-admin-input-form",onSubmit:p,children:f.jsx("div",{className:"xappw-admin-input-form__buttons",children:f.jsx(lm,{addClass:"xappw-admin-input-form__btn",type:"submit",label:"Leave"})})}):f.jsxs("form",{className:"xappw-admin-input-form",onSubmit:p,children:[f.jsx("div",{className:"xappw-admin-input-form__buttons",children:f.jsx(lm,{addClass:"xappw-admin-input-form__btn",type:"submit",label:"Join",disable:u})}),f.jsx("div",{className:"xappw-admin-input",children:f.jsx("input",{ref:n,id:"adminBarInput",placeholder:"Type your name here...",className:"xappw-admin-input__input",onChange:c})})]})})};var jx=function(e){var t,n=e.text,r=e.applyBrandingClass,i=e.linkColor,o=(t={"chat-footer__branding":r},Object.keys(t).filter(function(e){return t[e]}).join(" ")),a=n.replace(/\[(.*?)\]\((.*?)\)/g,function(e,t,n){return'<a style="color: '.concat(i||"",'; text-decoration: underline;" href="').concat(n,'" target="_blank" rel="noopener noreferrer">').concat(t,"</a>")}).replace(/\*\*(.*?)\*\*/g,function(e,t){return"<b>".concat(t,"</b>")}).replace(/^(#{1,6}) (.*?)(?=\n|$)/gm,function(e,t,n){var r=t.length;return"<h".concat(r,">").concat(n,"</h").concat(r,">")});return f.jsx("div",{className:o,dangerouslySetInnerHTML:{__html:a}})},Ox=function(e){var t=e.text;return(null==t?void 0:t.match(/\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/))?f.jsx(jx,{text:t,applyBrandingClass:!0,linkColor:"white"}):f.jsx("div",{className:"chat-footer__branding",style:{color:"white"},children:t})},Px=function(e){var t=e.subtitle?f.jsxs("span",{children:[f.jsx("div",{children:e.label}),f.jsx("div",{className:"chat-menu-item--subtitle",children:e.subtitle})]}):f.jsx("span",{children:e.label});return f.jsx("button",{type:"button",className:"chat-menu-item",tabIndex:e.tabIndex?Number(e.tabIndex):0,onClick:function(){e.onClick&&e.onClick(e.label)},children:t})},Ax=function(e){var t=e.items,n=e.opened,r=e.openFrom||"bottom",i=lb(),o=Cm(),a=Rh(function(e){return e.visuals});return f.jsx("div",{className:"chat-menu-".concat(r," ").concat("chat-menu-".concat(r,n?"--opened":"--closed")),children:t.map(function(t,n){return Mw.isStandardMenuItem(t)?f.jsx(Px,{onClick:e.onItemClick,label:t.label,subtitle:t.subtitle},n):Mw.isStaticImageMenuItem(t)?f.jsx("div",{className:"chat-menu-item-static",children:f.jsx("img",{style:{maxHeight:"100%",maxWidth:"auto"},src:t.imageUrl,alt:"Menu Item"})},n):Mw.isStaticTextMenuItem(t)?f.jsx("div",{className:"chat-menu-item-static-text",children:f.jsxs("div",{children:[f.jsx("div",{children:t.title}),f.jsx("div",{className:"chat-menu-item-static-text--body",children:t.body})]})},n):Mw.isOpenURLMenuItem(t)?f.jsx("button",{className:"chat-menu-item",onClick:i.bind(undefined,t.url,o,a,t.behavior),children:t.text},n):f.jsx("p",{children:"Unknown"})})})},Rx=function(e){var t=e.bars;return t||(t=2),f.jsx("button",{className:"drawer-bars",tabIndex:e.tabIndex?Number(e.tabIndex):0,"aria-label":"open menu","aria-hidden":!1,onClick:e.onToggle,children:function(){for(var e=[],n=0;n<t;n++)e.push(f.jsx("div",{className:"drawer-bar bar".concat(n)},"drawer-bar-".concat(n)));return e}()})},Mx=function(){return f.jsx("svg",{style:{color:"grey",paddingRight:"5px"},xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16",children:f.jsx("path",{d:"M1.293 1.293a1 1 0 0 1 1.414 0L8 6.586l5.293-5.293a1 1 0 1 1 1.414 1.414L9.414 8l5.293 5.293a1 1 0 0 1-1.414 1.414L8 9.414l-5.293 5.293a1 1 0 0 1-1.414-1.414L6.586 8 1.293 2.707a1 1 0 0 1 0-1.414z"})})},Lx=function(){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16",children:f.jsx("path",{fillRule:"evenodd",d:"M2 13.5a.5.5 0 0 0 .5.5h6a.5.5 0 0 0 0-1H3.707L13.854 2.854a.5.5 0 0 0-.708-.708L3 12.293V7.5a.5.5 0 0 0-1 0v6z"})})},Dx=function(){return f.jsx("svg",{viewBox:"80.208 98.129 313.069 282.823",xmlns:"http://www.w3.org/2000/svg",children:f.jsxs("g",{transform:"matrix(0.024498, 0, 0, -0.038359, 79.83091, 381.182404)",fill:"currentColor",stroke:"none",children:[f.jsx("path",{d:"M12670 7345 c-63 -18 -272 -77 -465 -130 -192 -53 -478 -132 -635 -175 -508 -141 -1091 -302 -2345 -649 -676 -187 -2038 -563 -3025 -836 -987 -273 -2072 -573 -2410 -666 -338 -94 -802 -222 -1030 -285 -1857 -514 -2579 -714 -2684 -742 -38 -10 -65 -21 -60 -24 5 -3 67 -22 139 -41 72 -20 326 -90 565 -157 239 -67 611 -170 825 -230 215 -60 586 -163 825 -230 239 -67 491 -137 560 -156 l126 -34 974 439 c1397 629 4128 1858 6050 2724 910 410 1826 822 2035 917 209 94 387 173 395 176 35 10 -66 -39 -8200 -3928 -586 -280 -1068 -512 -1071 -516 -3 -4 33 -117 82 -252 76 -213 355 -996 765 -2147 65 -183 120 -330 122 -329 1 2 114 558 250 1236 l248 1233 3455 2064 c1900 1135 3670 2193 3933 2351 264 158 491 293 505 301 62 33 -5 -12 -271 -182 -1671 -1070 -7188 -4613 -7188 -4617 0 -7 3661 -2455 3669 -2454 4 1 3713 6853 3977 7347 8 15 11 27 7 26 -5 0 -60 -15 -123 -34z"}),f.jsx("path",{d:"M5030 2232 c-15 -61 -479 -1861 -531 -2058 -21 -83 -39 -154 -39 -158 0 -3 369 330 820 740 452 411 817 750 813 754 -11 10 -1025 754 -1039 763 -8 4 -16 -10 -24 -41z"})]})})},Bx=function(e){var t=e.disabled,n=void 0!==t&&t,r=ee.useState(!1),i=r[0],o=r[1];return f.jsx(f.Fragment,{children:e.sendButtonIcon?f.jsx("button",{className:"xappw-custom-send-button ".concat(n?"disabled":""),tabIndex:e.tabIndex?Number(e.tabIndex):0,onClick:e.onClick,disabled:n,onMouseEnter:function(){return o(!0)},onMouseLeave:function(){return o(!1)},children:f.jsx("img",{src:n&&e.sendButtonIconDisabled?e.sendButtonIconDisabled:i&&!n&&e.sendButtonIconHover?e.sendButtonIconHover:e.sendButtonIcon,alt:"Send button",draggable:!1,className:"send-button-icon"})}):f.jsx(Tv,{className:"xappw-send-button ".concat(e.className||""," ").concat(n?"disabled":""),tabIndex:e.tabIndex,onClick:n?void 0:e.onClick,icon:Dx})})},zx=function(e){var t,n,r=e.value,i=e.placeholder,o=e.sendButtonIcon,a=e.sendButtonIconHover,s=e.sendButtonIconDisabled,l=e.suggestion,c=e.footerConfig,u=e.inputConfig,d=e.onChange,p=e.onSubmit,h=e.onSuggestionCommand,m=Z.useState(!1),v=m[0],g=m[1],y=null==u?void 0:u.maxLength,b=r.text.length,w=void 0!==y&&b>=y,x=void 0!==y&&b>=.8*y;var k=Z.useCallback(function(e){e&&e.preventDefault(),p(r)},[r,p]),S=Z.useCallback(function(){d({text:"",formats:[]})},[d]),C=Z.useCallback(function(e){!l||"End"!==e.key&&"ArrowRight"!==e.key&&"Enter"!==e.key?h&&("ArrowUp"===e.key?(h("prev"),e.preventDefault()):"ArrowDown"===e.key?(h("next"),e.preventDefault()):"Escape"===e.key&&(h("cancel"),e.preventDefault())):d(l)},[l,d,h]);return f.jsx("div",{className:"xappw-input-container ".concat(e.addClass," ").concat(v?"drag-drop-zone":""),"aria-label":(r.text,"To clear input field click on clear icon on the left of send button"),"aria-hidden":!1,onDrop:function(t){g(!1),e.onFileUpload(t)},onDragOver:function(e){g(!0),e.preventDefault(),e.dataTransfer.dropEffect="copy"},onDragLeave:function(){g(!1)},children:f.jsxs("form",{className:"xappw-input-form",onSubmit:k,children:[f.jsx(jv,{id:"chatWidgetInput",className:"xappw-input",placeholder:null!=i?i:"type your question here",tabIndex:null==u?void 0:u.tabIndex,maxLength:y,onInput:d,onChange:d,onKeyDown:C,value:r,spellCheck:!0},"input"),f.jsxs("div",{className:"xappw-input-form__buttons",children:[x&&f.jsxs("span",{className:"xappw-input-form__counter".concat(w?" xappw-input-form__counter--limit":""),children:[b,"/",y]}),r.text&&f.jsx(Tv,{icon:Mx,tabIndex:null===(t=null==c?void 0:c.clearButton)||void 0===t?void 0:t.tabIndex,className:"xappw-input-form__btn",onClick:S}),f.jsx(Bx,{className:"xappw-input-form__btn",sendButtonIcon:o,sendButtonIconHover:a,sendButtonIconDisabled:s,tabIndex:null===(n=null==c?void 0:c.sendButton)||void 0===n?void 0:n.tabIndex,disabled:!r.text,onClick:k})]})]})})};var Ux=function(e){var t=e.data,n=e.onItemUse,r=e.searchTerms,i=Z.useState(),o=i[0],a=i[1],s=Z.useState(),l=s[0],c=s[1];Z.useEffect(function(){t&&a(t),r||(a(void 0),c(void 0))},[t,r]);var u=(null==t?void 0:t.length)>0?e.index:NaN,d=Z.useMemo(function(){return Mv(t,u)},[t,u]),p=Z.useCallback(function(e,t){if("inputText"===t.type)return n(e),c(void 0),!1},[n]);Z.useEffect(function(){c(d)},[d]);var h,m=Z.useMemo(function(){return function(e){return function(t){var n=t.data,r="FAQ"!==n.type,i=Z.useCallback(function(t){e(n),t.stopPropagation()},[n]);return r?f.jsx(Tv,{className:"xappw-suggestions__use",onClick:i,icon:Lx}):f.jsx(f.Fragment,{})}}(n)},[n]),v="xappw-suggestions ".concat(e.className||""," ").concat(e.hasWsButton?"xappw-suggestions--with-ws-button":"").trim();return f.jsxs("div",{className:v,children:[(null==l?void 0:l.content)&&f.jsx("div",{className:"xappw-suggestions__answer",children:(h=l.content,h.split("\n").map(function(e,t){return e?f.jsx(jx,{text:e},"line-".concat(t)):f.jsx(ee.Fragment,{},"line-".concat(t))}))}),o&&o.length>0&&f.jsx(Ov,{suggestions:o,index:u,className:"xappw-suggestions__groups",itemActions:m,onItemClick:e.onItemClick,onItemHover:c,onSpanClick:p})]})},Fx=function(e){var t,n,r,i=e.isAdmin,o=e.isChatting,a=e.visible,s=e.placeholder,l=e.sendButtonIcon,c=e.sendButtonIconHover,u=e.sendButtonIconDisabled,d=e.footerConfig,p=e.menuConfig,h=e.inputConfig,m=e.hasWsButton,v=e.disabled,g=e.onSubmit,y=Cm(),b=Z.useState(!1),w=b[0],x=b[1],k=Z.useState(),S=k[0],C=k[1],_=Ix(S,Rh(function(e){return e.activeContexts})),E="FOOTER"===((null==p?void 0:p.menuButtonLocation)||"FOOTER"),N=null==p?void 0:p.items,I=null==p?void 0:p.itemsTabIndex,T=null===(t=null==p?void 0:p.button)||void 0===t?void 0:t.tabIndex,j=Z.useMemo(function(){return N||[]},[N]),O=null===(n=null==d?void 0:d.branding)||void 0===n?void 0:n.enabled,P=null===(r=null==d?void 0:d.branding)||void 0===r?void 0:r.text,A=Z.useState(!i),R=A[0],M=A[1],L=Z.useState({text:"",formats:[]}),D=L[0],B=L[1];var z=Z.useCallback(function(e){C(""),B({text:"",formats:[]}),g(e.text)},[g]),U=Z.useCallback(function(e){z(e)},[z]),F=Z.useCallback(function(e){B(e),C(e.text)},[]);return f.jsxs("div",{className:"chat-footer background-footer","aria-label":j.length?"to open menu click a button above the rounded rectangle at the bottom of widget":"","aria-hidden":!1,children:[E&&j.length?f.jsxs(f.Fragment,{children:[w?f.jsx(Ax,{opened:w,tabIndex:I,onItemClick:function(t){x(!1),e.onSubmit(t)},items:j}):f.jsx(f.Fragment,{}),f.jsx("div",{className:"chat-footer__menu-icon",children:f.jsx(Rx,{tabIndex:T,onToggle:function(){var e=!w;x(e),y(eb({drawer:e}))}})})]}):f.jsx(f.Fragment,{}),f.jsx(Ux,{className:"xappw-chat-footer__suggestions",data:_.suggestions,index:_.index,searchTerms:S,hasWsButton:m,onItemClick:U,onItemUse:F}),i&&o&&a&&f.jsx(Tx,{onAdminJoin:function(e){M(e)}}),f.jsx("div",{style:{pointerEvents:R&&!v?"auto":"none",opacity:R?1:.5},children:f.jsx(zx,{addClass:"chat-footer__input "+(o&&a?"visible":""),suggestion:_.item,value:D,placeholder:s,sendButtonIcon:l,sendButtonIconHover:c,sendButtonIconDisabled:u,footerConfig:d,inputConfig:h,onSubmit:z,onChange:function(t){B(t),e.onChange(t.text),C(t.text)},onSuggestionCommand:_.execute,onFileUpload:e.onFileUpload})}),O&&P&&f.jsx(Ox,{text:P})]})};var qx=function(e){var t,i,o=e.config,a=e.widgetEnv,s=e.onClose,l=Z.useRef(null),c=Z.useRef(null),u=function(e,t){var n;return e.formConfig?{api:e.formConfig.api,intentId:e.formConfig.intentId,autoGreeting:e.formConfig.autoGreeting}:(null===(n=null==t?void 0:t.connection)||void 0===n?void 0:n.serverUrl)?{api:{url:t.connection.serverUrl,key:t.connection.accountKey},intentId:e.intentId,autoGreeting:e.autoGreeting}:null}(o,a),d=Z.useState("idle"),p=d[0],h=d[1],m=Z.useState(""),v=m[0],g=m[1],y=(null===(i=null===(t=o.formConfig)||void 0===t?void 0:t.api)||void 0===i?void 0:i.key)||(null==a?void 0:a.formWidgetKey),b=Z.useCallback(function(){return n(void 0,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return Wh()?[4,$h(o.preselectChipLabel?{preselectChipLabel:o.preselectChipLabel}:void 0,5,100)]:[3,2];case 1:if(e.sent())return h("success"),s(),[2];e.label=2;case 2:if(!y)return[3,8];h("loading"),e.label=3;case 3:return e.trys.push([3,6,,7]),[4,Hh(y)];case 4:return e.sent(),[4,$h(o.preselectChipLabel?{preselectChipLabel:o.preselectChipLabel}:void 0,30,100)];case 5:return e.sent()?(h("success"),s()):(h("error"),g("Form widget loaded but failed to open. Please try again.")),[3,7];case 6:return e.sent(),h("error"),g("Failed to load form. Please check your connection and try again."),[3,7];case 7:return[3,9];case 8:h("error"),g("Form widget key not configured. Please contact support."),e.label=9;case 9:return[2]}})})},[o.preselectChipLabel,y,s]);Z.useEffect(function(){b()},[b]),Z.useEffect(function(){var e=function(e){"Escape"===e.key&&s()};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[s]),Hv(),Z.useEffect(function(){c.current&&c.current.focus()},[]);var w=Z.useCallback(function(e){e.target===l.current&&s()},[s]),x=Z.useCallback(function(){h("idle"),g(""),b()},[b]);return u||y?f.jsx("div",{className:"xapp-form-modal",ref:l,onClick:w,role:"dialog","aria-modal":"true","aria-label":"Form",children:f.jsxs("div",{className:"xapp-form-modal__content",ref:c,tabIndex:-1,children:[f.jsx("button",{className:"xapp-form-modal__close",onClick:s,"aria-label":"Close form",children:"×"}),f.jsxs("div",{className:"xapp-form-modal__form-container",children:["loading"===p&&f.jsxs("div",{className:"xapp-form-modal__loading",children:[f.jsx("div",{className:"xapp-form-modal__spinner","aria-hidden":"true"}),f.jsx("p",{children:"Loading form..."})]}),"error"===p&&f.jsxs("div",{className:"xapp-form-modal__error",children:[f.jsx("p",{children:v}),f.jsx("button",{className:"xapp-form-modal__retry",onClick:x,children:"Try Again"})]}),"idle"===p&&f.jsxs("div",{className:"xapp-form-modal__loading",children:[f.jsx("div",{className:"xapp-form-modal__spinner","aria-hidden":"true"}),f.jsx("p",{children:"Initializing..."})]})]})]})}):f.jsx("div",{className:"xapp-form-modal",ref:l,onClick:w,role:"dialog","aria-modal":"true","aria-label":"Form",children:f.jsxs("div",{className:"xapp-form-modal__content",ref:c,tabIndex:-1,children:[f.jsx("button",{className:"xapp-form-modal__close",onClick:s,"aria-label":"Close form",children:"×"}),f.jsxs("div",{className:"xapp-form-modal__error",children:[f.jsx("p",{children:"Form configuration not available."}),f.jsx("p",{children:"Please configure the form button with valid settings."})]})]})})},Hx=function(e){var t=e.option,n=t.actionUrl?"chat-chip chat-chip-link":"chat-chip";return f.jsx("div",{onClick:function(){return null==e?void 0:e.onClick(t)},className:n,children:f.jsx("span",{children:"object"==typeof t?t.label:t})})},Wx=function(e){return f.jsx("div",{className:"chat-chips",children:e.options.map(function(t,n){return f.jsx(Hx,{onClick:e.onOptionClick,option:t},n)})})},Vx=function(e){var t=Gy(),n=Rh(function(e){return e.chips}),r=Cm(),i=Rh(function(e){return e.visuals}),o=lb();return f.jsx("div",{className:"message-list-container__chips ".concat((null==n?void 0:n.length)?"":"message-list-container__chips--empty"),children:f.jsx(Wx,{options:n,onOptionClick:function(e){var n,a=gb(e)&&e.actionUrl;a?o(a,r,i):t(gm(gb(n=e)?n.label:n,{action:"click",ui:"chip"}))}})})};function $x(e){return"others"===e?"m 80 0 v 240 h -60 c 40 -40 60 -160 60 -240":"m 0 0 v 240 h 60 c -40 -40 -60 -160 -60 -240"}function Kx(e){return f.jsx("svg",{className:"chat-text-bubble__tail",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 240",children:f.jsx("path",{d:$x(e),fill:"currentColor"})})}var Qx=function(e){var t=e.owner,n=e.onClick,r=Z.useCallback(function(){n&&n()},[n]);return f.jsxs("div",{onClick:r,className:"chat-text-bubble ".concat("mine"===t?"chat-text-bubble--mine":"chat-text-bubble--others"),children:[e.hasTail&&Kx(t),e.children]})},Jx=function(e){var t=e.onOpenUrl,n=Mh(e.message.user.nick),r=Z.useRef(null),i=Cm(),o=Rh(function(e){return e.visuals}),a=e.message.msg.html,s=Z.useCallback(function(e){if(t){var n=e.target;e.preventDefault(),t(n.href,i,o)}},[t]);return Z.useEffect(function(){if(r.current&&(r.current.innerHTML=a,t)){var e=r.current.querySelectorAll("a");return e.forEach(function(e){e.addEventListener("click",s)}),function(){e.forEach(function(e){e.removeEventListener("click",s)})}}},[r,a,t,s,e.message.timestamp]),f.jsx("div",{className:"chat-msg",children:f.jsx("div",{className:"chat-text-container",children:f.jsxs(Qx,{owner:n?"others":"mine",hasTail:n&&!e.sibling,children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+(n?" the bot said":" the user said")}),f.jsx("div",{ref:r})]})})})},Yx=function(e){var t=e.message,n=e.ctx;if(!n)throw new TypeError("ctx not provided to ".concat(Yx.name));var r=n.user,i=t.msg.permissionRequest,o=Mh(e.message.user.nick),a=t.user,s="Deny",l=Z.useCallback(function(e){n.write({type:"msg",user:a,msg:e})},[n,a]),c=Z.useCallback(function(e){n.write({type:"msg",user:r,msg:e})},[n,r]),u=Z.useCallback(function(){n.send({type:"msg",user:void 0,msg:{text:s}})},[n]),d=Z.useCallback(function(e){n.send({type:"permissionGrant",user:a,msg:e})},[a,n]),p=Z.useCallback(function(e,t){d({text:t,location:e?{latitude:e.coords.latitude,longitude:e.coords.longitude}:void 0,permissionRequest:i}),c({text:t});var n=e?null==i?void 0:i.approve:null==i?void 0:i.deny;n&&l(n)},[i,c,l,d]),h=Z.useCallback(function(e){p(void 0,e)},[p]),m=Z.useCallback(function(e){navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){p(t,e)},function(){u()})},[u,p]);return i?f.jsxs("div",{className:"chat-msg",children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+(o?" the bot said":" the user said")}),f.jsxs("div",{className:"buttons-container",children:[f.jsx(lm,{label:"Allow",addClass:"button",onClick:m}),f.jsx(lm,{label:s,addClass:"button",onClick:h})]})]}):f.jsx(f.Fragment,{})},Gx=function(e){var t=e.text,i=Z.useState(!1),o=i[0],a=i[1];return f.jsx("button",{className:"tool-call-item__copy-btn",onClick:function(e){return n(void 0,void 0,void 0,function(){var n;return r(this,function(r){switch(r.label){case 0:e.stopPropagation(),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(t)];case 2:return r.sent(),a(!0),setTimeout(function(){return a(!1)},1500),[3,4];case 3:return r.sent(),(n=document.createElement("textarea")).value=t,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),a(!0),setTimeout(function(){return a(!1)},1500),[3,4];case 4:return[2]}})})},title:"Copy to clipboard",children:o?"✓":"⧉"})},Xx=function(e){var t,n,r;return null!==(r=null!==(n=null!==(t=e.label)&&void 0!==t?t:e.displayName)&&void 0!==n?n:e.name)&&void 0!==r?r:"Working..."},Zx=function(e){var t=e.toolCall,n=Xx(t);return f.jsxs("div",{className:"tool-progress-item ".concat(t.isExecuting?"tool-progress-item--executing":""," ").concat(t.error?"tool-progress-item--error":""),children:[f.jsx("span",{className:"tool-progress-item__icon",children:t.isExecuting?f.jsx("span",{className:"tool-progress-item__spinner","aria-label":"executing"}):t.error?f.jsx("span",{className:"tool-progress-item__status tool-progress-item__status--error",children:"!"}):f.jsx("span",{className:"tool-progress-item__status tool-progress-item__status--success",children:"✓"})}),f.jsx("span",{className:"tool-progress-item__label",children:n})]})},ek=function(e){var t=e.toolCall,n=Z.useState(!1),r=n[0],i=n[1],o=function(e){if(null==e)return"";try{if("string"==typeof e)try{var t=JSON.parse(e);return JSON.stringify(t,null,2)}catch(t){return e}return JSON.stringify(e,null,2)}catch(t){return String(e)}},a=Xx(t),s=t.endTime?"".concat(((t.endTime-t.startTime)/1e3).toFixed(2),"s"):null,l=void 0!==t.input&&null!==t.input,c=void 0!==t.result&&null!==t.result,u=!!t.error;return f.jsxs("div",{className:"tool-call-item ".concat(t.isExecuting?"tool-call-item--executing":""),children:[f.jsxs("button",{className:"tool-call-item__header",onClick:function(){return i(!r)},"aria-expanded":r,children:[f.jsx("span",{className:"tool-call-item__icon",children:t.isExecuting?f.jsx("span",{className:"tool-call-item__spinner","aria-label":"executing"}):t.error?f.jsx("span",{className:"tool-call-item__status tool-call-item__status--error",children:"!"}):f.jsx("span",{className:"tool-call-item__status tool-call-item__status--success",children:"✓"})}),f.jsxs("span",{className:"tool-call-item__info",children:[f.jsx("span",{className:"tool-call-item__label",children:a}),f.jsx("span",{className:"tool-call-item__name",children:t.name})]}),s&&f.jsx("span",{className:"tool-call-item__duration",children:s}),f.jsx("span",{className:"tool-call-item__chevron ".concat(r?"tool-call-item__chevron--expanded":""),children:"▾"})]}),r&&f.jsxs("div",{className:"tool-call-item__content",children:[l&&f.jsxs("div",{className:"tool-call-item__section",children:[f.jsxs("div",{className:"tool-call-item__section-header",children:[f.jsx("span",{className:"tool-call-item__section-label",children:"Input"}),f.jsx(Gx,{text:o(t.input)})]}),f.jsx("pre",{className:"tool-call-item__code",children:o(t.input)})]}),c&&f.jsxs("div",{className:"tool-call-item__section",children:[f.jsxs("div",{className:"tool-call-item__section-header",children:[f.jsx("span",{className:"tool-call-item__section-label",children:"Output"}),f.jsx(Gx,{text:o(t.result)})]}),f.jsx("pre",{className:"tool-call-item__code",children:o(t.result)})]}),u&&f.jsxs("div",{className:"tool-call-item__section",children:[f.jsxs("div",{className:"tool-call-item__section-header",children:[f.jsx("span",{className:"tool-call-item__section-label tool-call-item__section-label--error",children:"Error"}),f.jsx(Gx,{text:t.error||""})]}),f.jsx("pre",{className:"tool-call-item__code tool-call-item__code--error",children:t.error})]}),!l&&!c&&!u&&f.jsx("div",{className:"tool-call-item__empty",children:"No data available"})]})]})},tk=function(e){var t=e.toolCalls,n=e.debugMode,r=void 0!==n&&n;if(!t||0===t.length)return null;if(r)return f.jsxs("div",{className:"tool-call-display",children:[f.jsxs("div",{className:"tool-call-display__header",children:[f.jsx("span",{className:"tool-call-display__icon",children:"⚙"}),f.jsxs("span",{className:"tool-call-display__title",children:["Tool Calls (",t.length,")"]})]}),f.jsx("div",{className:"tool-call-display__list",children:t.map(function(e,t){return f.jsx(ek,{toolCall:e},"".concat(e.name,"-").concat(e.startTime,"-").concat(t))})})]});var i=t.filter(function(e){return!e.hidden});return 0===i.length?null:f.jsx("div",{className:"tool-progress-display",children:i.map(function(e,t){return f.jsx(Zx,{toolCall:e},"".concat(e.name,"-").concat(e.startTime,"-").concat(t))})})};function nk(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function rk(e){return nk(e).replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/\*([^*]+?)\*/g,"<em>$1</em>").replace(/_([^_]+?)_/g,"<em>$1</em>")}function ik(e){if(!e)return"";var t=[],n=e.replace(/```([^\s`]*)\r?\n([\s\S]*?)```/g,function(e,n,r){var i=nk(r.replace(/\n$/,"")),o=n?' data-language="'.concat(nk(n),'"'):"";return t.push("<pre><code".concat(o,">").concat(i,"</code></pre>")),"%%CODEBLOCK".concat(t.length-1,"%%")}),r=[];n=n.replace(/(?:^|\n)(\|.+\|)\n(\|[\s:|-]+\|)\n((?:\|.+\|\n?)+)/g,function(e,t,n,i){return r.push(function(e,t,n){var r=function(e){return e.split("|").slice(1,-1).map(function(e){return rk(e.trim())})},i=t.split("|").slice(1,-1).map(function(e){return e.trim()}).map(function(e){return e.startsWith(":")&&e.endsWith(":")?"center":e.endsWith(":")?"right":"left"}),o=r(e).map(function(e,t){return'<th scope="col" style="text-align:'.concat(i[t]||"left",'">').concat(e,"</th>")}).join(""),a=n.trim().split("\n").filter(function(e){return""!==e.trim()}).map(function(e){return"<tr>"+r(e).map(function(e,t){return'<td style="text-align:'.concat(i[t]||"left",'">').concat(e,"</td>")}).join("")+"</tr>"}).join("");return'<div style="overflow-x:auto"><table><thead><tr>'.concat(o,"</tr></thead><tbody>").concat(a,"</tbody></table></div>")}(t,n,i)),"\n%%TABLE".concat(r.length-1,"%%\n")});var i=[];n=n.replace(/`([^`\n]+)`/g,function(e,t){return i.push("<code>".concat(nk(t),"</code>")),"%%INLINECODE".concat(i.length-1,"%%")});var o=[];return n=n.replace(/\[([^\]]+)\]\(([^)]+)\)/g,function(e,t,n){return o.push('<a href="'.concat(nk(n),'" target="_blank" rel="noopener noreferrer">').concat(rk(t),"</a>")),"%%LINK".concat(o.length-1,"%%")}),n=(n=(n=(n=n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/^### (.+)$/gm,"<h4>$1</h4>").replace(/^## (.+)$/gm,"<h3>$1</h3>").replace(/^# (.+)$/gm,"<h2>$1</h2>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/__(.+?)__/g,"<strong>$1</strong>").replace(/\*([^*]+?)\*/g,"<em>$1</em>").replace(/_([^_]+?)_/g,"<em>$1</em>").replace(/^[-*] (.+)$/gm,"<li>$1</li>").replace(/\n/g,"<br>")).replace(/(<li>.*?<\/li>)(<br>)?/g,"$1")).replace(/(<li>.*?<\/li>)+/g,"<ul>$&</ul>")).replace(/<ul>(.*?)<\/ul>/g,function(e){return e.replace(/<br>/g,"")}),r.forEach(function(e,t){n=n.replace(new RegExp("(?:<br>)?%%TABLE".concat(t,"%%(?:<br>)?")),function(){return e})}),t.forEach(function(e,t){n=n.replace(new RegExp("(?:<br>)?%%CODEBLOCK".concat(t,"%%(?:<br>)?")),function(){return e})}),i.forEach(function(e,t){n=n.replace("%%INLINECODE".concat(t,"%%"),function(){return e})}),o.forEach(function(e,t){n=n.replace("%%LINK".concat(t,"%%"),function(){return e})}),n}var ok=function(e){var t,n=e.message,r=new Date(n.timestamp),i=r.getHours()+":"+r.getMinutes(),o=Mh(null===(t=e.message.user)||void 0===t?void 0:t.nick),a=n.isStreaming,s=Z.useMemo(function(){return o&&n.msg.text?ik(n.msg.text):null},[o,n.msg.text]),l=n.wasStreamed,c=o&&!e.sibling&&!a&&!l,u=e.toolCalls&&e.toolCalls.length>0,d=e.onLinkClick;return f.jsxs("div",{className:"chat-msg".concat(a?" chat-msg--streaming":""),children:[u&&f.jsx(tk,{toolCalls:e.toolCalls,debugMode:e.debugMode}),f.jsx("div",{className:"chat-text-container",children:f.jsxs(Qx,{owner:o?"others":"mine",hasTail:c,children:[f.jsx("span",{className:"message-sr-only",children:"at "+i+(o?a?" the bot is typing":" the bot said":" the user said")}),s?f.jsx("span",{className:"chat-msg__content",onClick:function(e){var t,n;if(!(!d||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)){var r=null===(n=(t=e.target).closest)||void 0===n?void 0:n.call(t,"a");r&&e.currentTarget.contains(r)&&(e.preventDefault(),d(r.href))}},dangerouslySetInnerHTML:{__html:s}}):f.jsx("span",{className:"chat-msg__content",children:n.msg.text}),a&&f.jsx("span",{className:"streaming-cursor","aria-hidden":"true"})]})})]})},ak=function(e){var t=e.display,n=Cm(),r=Rh(function(e){return e.visuals}),i=lb();return f.jsx("div",{className:"chat-schedule-button-container",children:f.jsxs("button",{className:"chat-schedule-button",onClick:function(){i(tm,n,r)},children:[f.jsx("i",{className:"fa fa-lg fa-calendar"}),f.jsx("span",{children:t.label||"Schedule Now!"})]})})},sk=function(e){var t=e.sources,n=e.prefix,r=void 0===n?"Sources:":n,i=e.onSourceClick;if(!t||0===t.length)return null;return f.jsxs("div",{className:"source-links",children:[r&&f.jsx("span",{className:"source-links__prefix",children:r}),f.jsx("span",{className:"source-links__list",children:t.map(function(e,n){return f.jsxs("span",{className:"source-links__item",children:[f.jsx("a",{href:e.url,target:!1!==e.newTab?"_blank":"_self",rel:!1!==e.newTab?"noopener noreferrer":void 0,className:"source-links__link",onClick:function(t){return function(e,t){i&&(t.preventDefault(),i(e))}(e,t)},title:e.url,children:e.title}),n<t.length-1&&f.jsx("span",{className:"source-links__separator",children:"·"})]},n)})})]})};var lk,ck=["text","html","card","list"],uk=function(e){var t,n,r,i,o=e.messageMiddleware||Qb,a=Z.useContext(nm),s=e.middlewareContext,l=e.agent,c=Cm(),u=Rh(function(e){return e.visuals}),d=(null===(t=null==a?void 0:a.env)||void 0===t?void 0:t.urls)&&(null==s?void 0:s.openUrl)?function(e){return s.openUrl(e,c,u)}:void 0,p=null===(n=e.agents)||void 0===n?void 0:n[e.message.user.nick],h=(null==p?void 0:p.hideUserInfo)||!1;var m,v=e.message.isStreaming,g=!(!(null===(r=e.message.msg)||void 0===r?void 0:r.text)&&!(null===(i=e.message.msg)||void 0===i?void 0:i.html)),y=!v&&g;return f.jsx("div",{className:"chat-msg-container-wrapper ".concat(Mh(e.message.user.nick)?"agent":"visitor"," ").concat(e.sibling?"sibling":""),children:f.jsxs("div",{className:"chat-msg-container ".concat((m=e.message,Mh(m.user.nick)?"agent":"visitor")),children:[function(){var t,n,r,i,c,u,p,m,v,g,y,b,w,x,k,S,C,_=e.message.msg;if("chat.msg"===e.message.type){var E=ck.find(function(e){return!!_[e]}),N=e.message.isStreaming,I=e.message.wasStreamed,T=e.message.toolCalls,j=T&&T.length>0,O=null!==(i=null===(r=null===(n=null===(t=null==a?void 0:a.env)||void 0===t?void 0:t.connection)||void 0===n?void 0:n.mcp)||void 0===r?void 0:r.debugMode)&&void 0!==i&&i,P=j&&!_.text;return f.jsxs(f.Fragment,{children:[P&&f.jsx(mm,{showAvatar:!0,user:l,avatarPosition:null===(p=null===(u=null===(c=null==a?void 0:a.env)||void 0===c?void 0:c.theme)||void 0===u?void 0:u.messages)||void 0===p?void 0:p.avatarPosition,hideUserInfo:h,isStreaming:!0,children:f.jsx("div",{className:"chat-msg",children:f.jsx(tk,{toolCalls:T,debugMode:O})})}),_.text&&f.jsx(mm,{showAvatar:"text"===E,user:l,avatarPosition:null===(g=null===(v=null===(m=null==a?void 0:a.env)||void 0===m?void 0:m.theme)||void 0===v?void 0:v.messages)||void 0===g?void 0:g.avatarPosition,hideUserInfo:h,isStreaming:N||I,children:f.jsx(ok,{message:e.message,sibling:e.sibling,user:l,toolCalls:j?T:void 0,debugMode:O,onLinkClick:d})}),_.html&&f.jsx(mm,{showAvatar:"html"===E,user:l,avatarPosition:null===(w=null===(b=null===(y=null==a?void 0:a.env)||void 0===y?void 0:y.theme)||void 0===b?void 0:b.messages)||void 0===w?void 0:w.avatarPosition,hideUserInfo:h,children:f.jsx(Jx,{message:e.message,sibling:e.sibling,onOpenUrl:null===(x=e.middlewareContext)||void 0===x?void 0:x.openUrl})}),_.displays&&o&&_.displays.map(function(t,n){if("ScheduleButton"===t.type)return f.jsx(ak,{minimizeOnClick:e.minimizeOnClick,display:t},n);var r=o;return f.jsx(r,{msg:t,ctx:e.middlewareContext},n)}),_.permissionRequest&&s&&f.jsx(mm,{showAvatar:"permissionRequest"===E,user:l,avatarPosition:null===(C=null===(S=null===(k=null==a?void 0:a.env)||void 0===k?void 0:k.theme)||void 0===S?void 0:S.messages)||void 0===C?void 0:C.avatarPosition,hideUserInfo:h,children:f.jsx(Yx,{message:e.message,sibling:e.sibling,ctx:s})})]})}return f.jsx(f.Fragment,{})}(),y&&function(){var t,n=e.message.timestamp,r=function(e){var t=new Date,n=Math.floor((t.valueOf()-e.valueOf())/1e3);if(n<1)return"now";if(n<60)return"".concat(n," seconds ago");var r=Math.floor(n/60);if(r<60)return"".concat(r," minutes ago");var i=Math.floor(r/60);return i<24?"".concat(i," hours ago"):e.toLocaleString()}(new Date(n)),i=null===(t=e.message.msg)||void 0===t?void 0:t.sources,o=i&&i.length>0,a=Mh(e.message.user.nick);return f.jsxs("div",{className:"chat-msg-footer ".concat(a?"agent":"visitor"),children:[f.jsx("span",{className:"chat-msg-timestamp",children:r}),o&&f.jsx(sk,{sources:i.map(function(e){return{title:e.title,url:e.url,newTab:e.newTab}})})]})}()]})})},dk=function(e){return f.jsxs("div",{className:"card-container ".concat(e.addClass),children:[(t="string"==typeof e.icon,f.jsx("div",{className:"card-container__icon",children:!t&&e.icon})),f.jsxs("div",{className:"card-container__content ".concat(e.contentAddClass),children:[f.jsx("div",{className:"card-container__title",children:e.title}),e.children]})]});var t},fk=function(e){var t=e.agent,n=void 0===t?{}:t,r=e.hasRating,i=void 0!==r&&r,o=e.shouldDisplay,a=void 0===o||o,s=e.onRate,l=void 0===s?function(){}:s,c=Z.useCallback(function(){l("bad")},[l]),u=Z.useCallback(function(){l("good")},[l]),d=Z.useCallback(function(){l(void 0)},[l]);return a?i?f.jsxs(dk,{title:"Chat Rating",addClass:"chat-rating-card",children:["You have rated the chat service.",f.jsx("div",{className:"buttons-container",children:f.jsx(lm,{addClass:"button button-rate-again",label:"Rate again",onClick:d})})]}):f.jsxs(dk,{title:"Chat Rating",addClass:"chat-rating-card",children:[n.displayName," has requested you to rate the chat service.",f.jsxs("div",{className:"buttons-container",children:[f.jsx(lm,{addClass:"button button-rate-bad",label:"Rate Bad",onClick:c}),f.jsx(lm,{addClass:"button button-rate-good",label:"Rate Good",onClick:u})]})]}):null},pk=function(e){var t=Gy(),n=Z.useCallback(function(e){t(function(e){return function(t){return function(){t.sendChatRating(e)}}}(e))},[t]);return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+" system message"}),f.jsx(fk,{agent:e.agent,hasRating:e.hasRating,shouldDisplay:e.shouldDisplay,onRate:n})]})};function hk(e,t){var n,r;switch(void 0===t&&(t="ssml"),typeof e){case"string":n=e;break;case"number":n="".concat(e)}return mk(e)&&(n=xk(e,t)),(r=e)&&(r.start||r.end)&&(n=function(e,t){void 0===t&&(t="ssml");if(!e)return"";var n=e.start,r=e.end,i="".concat(xk(n,t)," to ").concat(xk(r,t));o=vk(n.date),a=vk(r.date),o.getFullYear()===a.getFullYear()&&o.getMonth()===a.getMonth()&&o.getDate()===a.getDate()&&(i="on ".concat(xk({date:n.date},t)," from ").concat(xk({time:n.time},t)," to ").concat(xk({time:r.time},t)));var o,a;return i}(e,t)),function(e){return!!e&&"object"==typeof e&&"number"==typeof e.amount&&"string"==typeof e.format}(e)&&(n=function(e,t){void 0===t&&(t="ssml");if(!e)return"";var n=e.amount>1,r="ssml"===t?'<say-as interpret-as="cardinal">'.concat(e.amount,"</say-as>"):e.amount,i=kk[e.format],o=e.format;Object.keys(kk).forEach(function(e){kk[e]===i&&e.length>o.length&&!e.endsWith("s")&&(o=e)});var a=n?"".concat(o,"s"):o;return"".concat(r," ").concat(a)}(e,t)),Array.isArray(e)&&(n=function(e,t){void 0===t&&(t=lk.or);var n=lk[t];if(!e||0===e.length)return"";if(1===e.length)return e[0];if(e.length>=2){var r=e.length-2;return e.reduce(function(e,t,i){return e+=t,i<r?e+=", ":i===r&&(e+=" ".concat(n," ")),e},"")}}(e,lk.and)),n}function mk(e){return!(!e||!e.date&&!e.time)}function vk(e){var t=String(e).split("-").map(Number),n=t[0],r=t[1],i=t[2];return new Date(n,r-1,i)}function gk(e){return e<10?"0".concat(e):String(e)}function yk(e){if(isNaN(e.getTime()))throw new RangeError("Invalid time value")}function bk(e){return yk(e),"".concat(e.getFullYear(),"-").concat(gk(e.getMonth()+1),"-").concat(gk(e.getDate()))}function wk(e){yk(e);var t=e.getHours();return"".concat(t%12==0?12:t%12,":").concat(gk(e.getMinutes())," ").concat(t<12?"AM":"PM")}function xk(e,n){if(void 0===n&&(n="ssml"),!e)return"";var r=t({},e);r.date||(r.date=bk(new Date));var i=new Date(Date.parse(function(e){if("object"!=typeof e)return"";var t="";try{if(mk(e)){var n=e.date?bk(vk(e.date)):void 0,r=e.time;t="".concat(n||"").concat(n&&r?"T":"").concat(r||"")}else{var i=e.start,o=e.end;if(i){n=i.date?bk(vk(i.date)):void 0,r=i.time;t="".concat(n||"").concat(n&&r?"T":"").concat(r||"")}if(i&&o&&(t+=" --\x3e "),o){n=o.date?bk(vk(o.date)):void 0,r=o.time;t+="".concat(n||"").concat(n&&r?"T":"").concat(r||"")}}}catch(e){console.error(e)}return t}(r))),o="";return e.date&&(o+="ssml"===n?'<say-as interpret-as="date" format="ymd">'.concat(bk(i),"</say-as>"):"".concat(function(e){return yk(e),"".concat(e.getMonth()+1,"-").concat(e.getDate(),"-").concat(e.getFullYear())}(i))),e.time&&("ssml"===n?o+='<say-as interpret-as="time">'.concat(wk(i),"</say-as>"):(o.length>0&&(o+=" "),o+="".concat(wk(i)))),o}!function(e){e[e.or=0]="or",e[e.and=1]="and"}(lk||(lk={}));var kk={ms:1,millisecond:1,milliseconds:1,s:1e3,second:1e3,seconds:1e3,m:6e4,minute:6e4,minutes:6e4,h:36e5,hour:36e5,hours:36e5,d:864e5,day:864e5,days:864e5,w:6048e5,week:6048e5,weeks:6048e5,M:2628e6,month:2628e6,months:2628e6,Q:7776e6,quarter:7776e6,quarters:7776e6,y:3154e7,years:3154e7,year:3154e7};var Sk=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;function Ck(e,t,n,r){for(var i,o=e,a=new RegExp(Sk);null!==(i=a.exec(e));){var s=void 0,l=t[i[1].trim()];l&&(s=hk(l.value,n)),(s||r)&&(o=o.replace(i[0],s))}return o}var _k=function(e){var t=e.agents,n=e.text,r=e.delay,i=e.time,o=Z.useState(r),a=o[0],s=o[1],l=Object.values(t).filter(function(e){return e.requestFailed});Z.useEffect(function(){if(0!==r)var e=r,t=setInterval(function(){e--,s(e),0===e&&clearInterval(t)},1e3);else s(5)},[r]);var c=Z.useMemo(function(){return{sec:{name:"sec",value:a}}},[a]),u=Z.useMemo(function(){return function(e,t,n){if(!e||!t)return e;var r=e;if("string"==typeof r)r=Ck(r,t,"displayText",n);else{var i=r;["ssml","displayText"].forEach(function(e){i[e]&&(i[e]=Ck(i[e],t,e,n))})}return r}(n,c)},[n,c]);return 0===a?f.jsx(f.Fragment,{}):f.jsx(f.Fragment,{children:l.map(function(e){var t,n;return f.jsx("div",{className:"chat-msg-container-wrapper",children:f.jsx("div",{className:"chat-msg-container agent",children:f.jsx(mm,{user:null==e?void 0:e.user,showAvatar:!0,children:f.jsx("div",{className:"chat-msg",children:f.jsxs(Qx,{owner:"others",hasTail:!0,children:[f.jsx("span",{className:"message-sr-only",children:"at "+i+" the bot said"}),f.jsx("span",{children:"object"==typeof u?u.displayText:u})]})})})},null===(t=null==e?void 0:e.user)||void 0===t?void 0:t.nick)},"failure-msg-".concat(null===(n=null==e?void 0:e.user)||void 0===n?void 0:n.nick))})})},Ek=function(e){return f.jsx("svg",{className:"message-svg",width:"16",height:"12",viewBox:"0 0 16 12",children:f.jsx("path",{d:"M14.4 0H1.6C.72 0 .008.675.008 1.5L0 10.5c0 .825.72 1.5 1.6 1.5h12.8c.88 0 1.6-.675 1.6-1.5v-9c0-.825-.72-1.5-1.6-1.5zm0 3L8 6.75 1.6 3V1.5L8 5.25l6.4-3.75V3z",fill:"#424242",fillRule:"evenodd"})})},Nk=function(e){var t=Z.useRef(null),n=Z.useRef(null),r=Z.useRef(null),i=Z.useRef(null),o=Z.useState(!1),a=o[0],s=o[1];function l(){var e,t,r;(null===(e=n.current)||void 0===e?void 0:e.validity.patternMismatch)?null===(t=n.current)||void 0===t||t.setCustomValidity("This doesn't look like an email!"):null===(r=n.current)||void 0===r||r.setCustomValidity("")}function c(o){var a,l,c,u,d;o.preventDefault(),(null===(a=i.current)||void 0===a?void 0:a.checkValidity())?(e.onSubmit({name:null===(c=t.current)||void 0===c?void 0:c.value,email:null===(u=n.current)||void 0===u?void 0:u.value,message:null===(d=r.current)||void 0===d?void 0:d.value}),s(!0)):null===(l=i.current)||void 0===l||l.reportValidity()}function u(){s(!1)}return f.jsx(dk,{title:e.title,addClass:"offline-card",contentAddClass:a?"sent":"",icon:f.jsx(Ek,{}),children:a?f.jsxs("div",{className:"message-form--sent",children:["Your message has been sent. We will get back to you as soon as possible.",f.jsx(lm,{addClass:"button-resend",label:"Send another",onClick:u})]},"sent"):f.jsxs("form",{ref:i,className:"message-form",onSubmit:c,children:[f.jsxs("div",{className:"content",children:[f.jsxs("div",{className:"section",children:[f.jsx("label",{className:"label",children:"Name"}),f.jsx("input",{ref:t,maxLength:255})]}),f.jsxs("div",{className:"section",children:[f.jsx("label",{className:"label",children:"Email"}),f.jsx("input",{ref:n,onChange:l,type:"email",required:!0,pattern:"^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$"})]}),f.jsxs("div",{className:"section",children:[f.jsx("label",{className:"label",children:"Message"}),f.jsx("textarea",{required:!0,ref:r})]})]}),f.jsx("div",{className:"button-container",children:f.jsx(lm,{type:"submit",addClass:"message-form__submit",label:"Send"})})]},"not-sent")})},Ik=function(e){return f.jsx(Nk,{title:"Offline message card title",onSubmit:e.onSubmit})},Tk=function(e){var t=Gy(),n=Z.useCallback(function(e){t(function(e){return function(t){return function(){t.sendOfflineMsg(e,function(e){e&&Yh(e)})}}}(e))},[t]);return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+" system message"}),f.jsx(Ik,{onSubmit:n})]})},jk=function(e){var t=Z.useState(!1),n=t[0],r=t[1],i=e.onSubmit,o=Z.useCallback(function(e){i(e),r(!0)},[i]);return f.jsx(f.Fragment,{children:!n&&f.jsx(Nk,{title:"Introduce yourself!",onSubmit:o})})},Ok=function(e){var t=Gy(),n=Rh(function(e){return e.sessionId}),r=Z.useCallback(function(e){e.message&&(t(bm({displayName:e.name,email:e.email},n)),t(gm(e.message)))},[t,n]);return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"message-sr-only",children:"at "+e.time+" system message"}),f.jsx(jk,{onSubmit:r})]})},Pk=function(e){var t=e.position,n=void 0===t?0:t;return n<=0?null:f.jsx("div",{className:"system-msg-container",children:f.jsxs("span",{className:"system-msg",children:["Queue position: ",n]})})};function Ak(e){switch(e.type){case"chat.memberjoin":return e.message||"".concat(e.user.displayName||"Bot"," has joined the chat");case"chat.memberleave":return e.message||"".concat(e.user.displayName||"Bot"," has left the chat");case"chat.systemmessage":return e.message;case"chat.rating":if(e.newRating){var t=(n=e.newRating)[0].toUpperCase()+n.slice(1);return"You have rated the chat service ".concat(t)}return"You have removed the chat rating";default:return JSON.stringify(e)}var n}var Rk=function(e){var t;if(function(e){var t;return null===(t=e.nick)||void 0===t?void 0:t.endsWith(wg)}(e.message.user))return null;var n=e.message,r=function(e){return"chat.memberjoin"===e.type&&e.showDivider||"chat.memberleave"===e.type&&e.showDivider}(n),i=null===(t=n.user)||void 0===t?void 0:t.avatarPath;return f.jsxs("div",{className:"system-msg-container",children:[r&&i&&f.jsxs("div",{className:"system-msg-divider",children:[f.jsx("div",{className:"divider-line"}),f.jsx("div",{className:"divider-avatar",children:f.jsx("img",{src:i,alt:"".concat(n.user.displayName||"User","'s avatar")})}),f.jsx("div",{className:"divider-line"})]}),f.jsx("span",{className:"message-sr-only",children:"at "+e.time+" system message"}),f.jsx("span",{className:"system-msg",children:Ak(e.message)})]})};var Mk=function(e){return f.jsxs("div",{className:"typing-indicator",children:[f.jsx("div",{className:"typing-indicator-part"}),f.jsx("div",{className:"typing-indicator-part"}),f.jsx("div",{className:"typing-indicator-part"})]})},Lk=function(e){var t=Object.values(e.agents).filter(function(e){return e.typing});return f.jsx(f.Fragment,{children:t.map(function(t,n){var r,i,o=(null===(r=t.user)||void 0===r?void 0:r.nick)||"".concat(n),a=(null===(i=t.user)||void 0===i?void 0:i.displayName)||"Somebody";return f.jsx("span",{children:e.textTypingStatusEnabled?f.jsxs("div",{className:"chat-msg-agent-typing",children:[a," is typing"]},"typing-status-".concat(o)):f.jsx("div",{className:"chat-msg-container-wrapper",children:f.jsx("div",{className:"chat-msg-container agent chat-typing-progress",children:f.jsx(mm,{user:t.user,showAvatar:!0,children:f.jsx("div",{className:"chat-msg",children:f.jsx(Qx,{owner:"others",hasTail:!0,children:f.jsx(Mk,{})})})})},o)},"typing-status-".concat(o))},"typing-status-".concat(n))})})},Dk=function(e){e.visible;var n=e.messages,r=void 0===n?[]:n,i=e.agents,o=void 0===i?{}:i;e.isOffline,e.isChatting;var a=e.queuePosition,s=void 0===a?0:a,l=e.lastRatingRequestTimestamp,c=void 0===l?0:l,u=e.hasRating,d=void 0!==u&&u;e.visitorId;var p=e.messageMiddleware,h=e.textTypingStatusEnabled,m=e.agent,v=e.hasWsButton,g=e.disableAutoScroll,y=void 0!==g&&g,b=e.onSend,w=void 0===b?function(){return Promise.resolve()}:b,x=e.onWrite,k=void 0===x?function(){return Promise.resolve()}:x,S=e.onOpenUrl,C=void 0===S?function(){}:S,_=e.minimizeOnClick,E=void 0===_?function(){}:_;e.children;var N=Z.useRef(null),I=Z.useRef(null),T=Z.useRef(v),j=Z.useCallback(function(){if(!I.current)return!0;var e=I.current,t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return Math.abs(n-r-t)<10},[]),O=Z.useCallback(function(e){void 0===e&&(e="smooth");var t=I.current;t&&("function"!=typeof t.scrollTo?t.scrollTop=t.scrollHeight:t.scrollTo({top:t.scrollHeight,behavior:e}))},[]);Z.useEffect(function(){y||O("smooth")},[r,o,O,y]),Z.useEffect(function(){if(!y){var e=T.current,t=v;if(T.current=t,e&&!t)if(j()){var n=setTimeout(function(){O("smooth")},350);return function(){return clearTimeout(n)}}}},[v,j,O,y]);var P=Z.useCallback(function(e){w(e),y||O("smooth")},[w,y,O]),A=Z.useCallback(function(e){k(e),y||O("smooth")},[k,y,O]),R=Z.useMemo(function(){return new Ub({send:P,write:A,openUrl:C})},[P,A,C]),M=new Date,L=M.getHours()+":"+M.getMinutes();function D(e,n){var r,i,a,s;switch((null===(i=null===(r=e.user)||void 0===r?void 0:r.nick)||void 0===i?void 0:i.startsWith("visitor:"))?s=e.user:(s=(null===(a=o[e.user.nick])||void 0===a?void 0:a.user)||m)||(Yh('Could not get a user from agents list with nick: "'.concat(e.user.nick,'"')),s=e.user),e.type){case"chat.file":case"chat.msg":return f.jsx(uk,{message:e,sibling:n,agent:s,messageMiddleware:p,middlewareContext:R.resolve(s),minimizeOnClick:E},"cm-".concat(e.type,"-").concat(e.timestamp));case"chat.failureMsg":return f.jsx(_k,t({agents:o,time:L},e.failureMsg),"fm-".concat(e.type,"-").concat(e.timestamp));case"chat.memberjoin":case"chat.memberleave":case"chat.systemmessage":case"chat.rating":case"chat.typing":return f.jsx(Rk,{time:L,message:e},"sm-".concat(e.type,"-").concat(e.timestamp));case"chat.request.rating":return f.jsx(pk,{agent:s,hasRating:d,time:L,shouldDisplay:e.timestamp===c},"cr-".concat(e.type,"-").concat(e.timestamp));case"chat.offline":return f.jsx(Tk,{time:L},"offline-".concat(e.timestamp));case"chat.prechat":return f.jsx(Ok,{time:L},"prechat");default:return f.jsxs("span",{children:[f.jsx("span",{className:"message-sr-only",children:"at "+L+" system message"}),f.jsxs("div",{"data-testid":"unhandled-message",children:["Unhandled message: ",JSON.stringify(e)]},"uhm-".concat(e.timestamp))]},"default-".concat(e.timestamp))}}return f.jsxs("div",{className:"message-list-container",ref:I,children:[f.jsxs("div",{className:"message-list-container__msgs",children:[function(){for(var e=-1,t=r.length-1;t>0;t--)if("chat.msg"===r[t].type){e=t;break}return r.map(function(t,n){var i,o,a=!1;if(["chat.file","chat.msg","chat.memberjoin","chat.memberleave","chat.rating","chat.request.rating","chat.offline","chat.prechat"].includes(t.type)&&!(null===(o=null===(i=t.user)||void 0===i?void 0:i.nick)||void 0===o?void 0:o.endsWith(wg)))if(0===n||n===r.length-1||n===e)a=!0;else{var s=r[n-1];t.timestamp&&s.timestamp&&(a=t.timestamp-s.timestamp>3e5)}0===n&&"chat.memberjoin"===t.type&&(a=!1);var l=a?new Date(t.timestamp).toLocaleString():void 0;return f.jsxs("span",{children:[a&&f.jsx("div",{className:"ts-msg-container",children:f.jsx("span",{className:"ts-msg",children:l})}),D(t,!1)]},"message-list-render-all-".concat(n))})}(),f.jsx("div",{ref:N,style:{float:"left",clear:"both"}}),f.jsx(Pk,{position:s}),f.jsx(Lk,{agents:o,textTypingStatusEnabled:h})]}),f.jsx(Vx,{})]})},Bk=function(){return f.jsxs("div",{className:"server-offline",children:[f.jsx("h2",{children:"We can't reach the chat right now"}),f.jsx("h3",{children:"Check your connection and try again in a moment."})]})},zk=function(e){var t=e.children,n=e.className,r=void 0===n?"":n;return f.jsx("div",{className:"button-group ".concat(r),children:t})},Uk=function(e){return f.jsx("div",{id:"xapp-widget-close","aria-label":"close widget","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"cancel-button",onClick:e.onClick})};function Fk(e){return gb(e)?e.actionUrl?"[".concat(e.label,"](").concat(e.actionUrl,")"):e.label:e}var qk=function(e){var t=Rh(function(e){return e.chats});return f.jsx("div",{id:"xapp-widget-export","aria-label":"export conversation","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"export-button",onClick:function(){return n(void 0,void 0,void 0,function(){var e,n;return r(this,function(r){switch(r.label){case 0:e=function(e){return e.filter(yw).map(function(e){var t,n,r,i=(null===(t=e.user.nick)||void 0===t?void 0:t.startsWith("visitor:"))?"User":"Assistant",o=(null===(n=e.msg)||void 0===n?void 0:n.text)||"",a="".concat(i,": ").concat(o),s=null===(r=e.msg)||void 0===r?void 0:r.options;if(s&&s.length>0){var l=s.map(Fk).join(", ");a+="\nSuggestions: ".concat(l)}return a}).join("\n")}(t),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(e)];case 2:return r.sent(),[3,4];case 3:return r.sent(),console.warn("[ExportButton] Using deprecated execCommand fallback for clipboard copy"),(n=document.createElement("textarea")).value=e,document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),[3,4];case 4:return[2]}})})}})},Hk=function(e){return f.jsx("div",{id:"xapp-widget-menu","aria-label":"open menu","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"menu-button",onClick:e.onClick})},Wk=function(e){return f.jsx("div",{id:"xapp-widget-minimize","aria-label":"minimize widget","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"minimize-button ".concat(e.showInRight?"positionRight":""),onClick:e.onClick})},Vk=function(e){return f.jsx("div",{id:"xapp-widget-refresh","aria-label":"refresh chat","aria-hidden":!1,tabIndex:e.tabIndex?Number(e.tabIndex):0,className:"refresh-button ".concat(e.showInRight?"positionRight":e.showInLeft?"positionLeft":""),onClick:e.onClick})},$k="Virtual Assistant",Kk="Leave us a message",Qk="We're away!",Jk="Connecting...";function Yk(e,t){var n,r,i,o;switch(Yh('getStatusText called with status: "'.concat(e,'"')),e){case"online":return null!==(n=null==t?void 0:t.online)&&void 0!==n?n:$k;case"offline":return null!==(r=null==t?void 0:t.offline)&&void 0!==r?r:Kk;case"away":return null!==(i=null==t?void 0:t.away)&&void 0!==i?i:Qk;default:return null!==(o=null==t?void 0:t.connecting)&&void 0!==o?o:Jk}}function Gk(e){if(function(e){return"string"==typeof e&&/<\/?[a-z][\s\S]*>/i.test(e)}(e)){var t=function(e){try{if("undefined"==typeof DOMParser)return Yh("DOMParser not available, returning text content only"),e.replace(/<[^>]*>/g,"");var t=(new DOMParser).parseFromString(e,"text/html");if(!t||!t.body)return Yh("DOMParser failed to parse HTML, returning text content only"),e.replace(/<[^>]*>/g,"");var n=["span","div","p","strong","em","b","i","u","br"],r=["color","background-color","font-size","font-weight","font-style","text-align","display","flex","align-items","justify-content","gap","margin","padding","width","height","border-radius"],i=function(e){if(e.nodeType===Node.ELEMENT_NODE){var o=e,a=o.tagName.toLowerCase();if(!n.includes(a)){var s=t.createTextNode(o.textContent||"");return void o.replaceWith(s)}if(Array.from(o.attributes).forEach(function(e){"style"!==e.name&&o.removeAttribute(e.name)}),o.hasAttribute("style")){var l=o.getAttribute("style")||"",c=[];l.split(";").forEach(function(e){var t=e.split(":"),n=t[0],i=t.slice(1).join(":").trim(),o=n.trim();o&&i&&r.includes(o.toLowerCase())&&(/javascript:|expression\(|@import|behavior:/i.test(i)||c.push("".concat(o,": ").concat(i)))}),c.length>0?o.setAttribute("style",c.join("; ")):o.removeAttribute("style")}Array.from(o.childNodes).forEach(function(e){return i(e)})}};return Array.from(t.body.childNodes).forEach(function(e){return i(e)}),t.body.innerHTML}catch(t){return Yh("Error sanitizing HTML: ".concat(t)),e.replace(/<[^>]*>/g,"")}}(e);return f.jsx("span",{dangerouslySetInnerHTML:{__html:t}})}return e}var Xk=function(e){var t,n,r,i,o,a,s,l,c,u,d,p,h,m,v,g=Cm(),y=e.menuConfig,b=e.onSubmit,w=e.debugMode,x=Z.useState(!1),k=x[0],S=x[1],C=(null==y?void 0:y.menuButtonLocation)||"FOOTER",_="HEADER_LEFT"===C,E="HEADER_RIGHT"===C,N=null==y?void 0:y.items,I=null==y?void 0:y.itemsTabIndex,T=null===(t=null==y?void 0:y.button)||void 0===t?void 0:t.tabIndex,j=Z.useMemo(function(){return N||[]},[N]),O=E&&j.length>0;function P(){var e=!k;S(e),g(eb({drawer:e}))}var A="",R=e.canRefresh,M=e.canMinimize,L=e.canCancel;return R&&(A="To refresh chat click on clockwise gapped circle arrow icon in top right side of widget. "),M&&(A="".concat(A).concat("To minimize widget click on minus icon in top right side of widget. ")),L&&(A="".concat(A).concat("To close widget click on close icon in top right side of widget.")),f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"status-container background-header","aria-label":A,"aria-hidden":!1,children:[_&&j.length?f.jsx(f.Fragment,{children:f.jsx("div",{className:"chat-footer__menu-icon",children:f.jsx(Rx,{bars:3,tabIndex:T,onToggle:P})})}):f.jsx(f.Fragment,{}),void 0===(null===(n=null==e?void 0:e.agent)||void 0===n?void 0:n.avatarPath)?f.jsx("div",{}):f.jsx("div",{className:"status-container__avatar",children:f.jsx(pm,{entity:e.agent})}),f.jsxs("div",{className:"\n ".concat("status-text","\n ").concat(_&&j.length?"status-text-positionWithMenu":void 0===(null===(r=null==e?void 0:e.agent)||void 0===r?void 0:r.avatarPath)?"status-text-positionLeftNoAvatar":"status-text-positionLeft","\n ").concat((null===(i=e.config)||void 0===i?void 0:i.alignTextCenter)?"status-text-positionCenter":""," \n "),children:[f.jsx("span",{className:"status-text-title",children:Yk(e.accountStatus,null===(o=e.config)||void 0===o?void 0:o.status)}),(null===(s=null===(a=e.config)||void 0===a?void 0:a.subtitle)||void 0===s?void 0:s.enabled)&&f.jsx("span",{className:"status-text-subtitle",children:Gk(null===(c=null===(l=e.config)||void 0===l?void 0:l.subtitle)||void 0===c?void 0:c.text)})]}),f.jsxs(zk,{children:[O&&f.jsx(Hk,{onClick:P,tabIndex:T}),w&&f.jsx(qk,{}),e.canRefresh&&f.jsx(Vk,{onClick:e.refreshOnClick,tabIndex:null===(d=null===(u=e.config)||void 0===u?void 0:u.actions)||void 0===d?void 0:d.refreshTabIndex,showInLeft:!1,showInRight:!1}),e.canMinimize&&f.jsx(Wk,{onClick:e.minimizeOnClick,tabIndex:null===(h=null===(p=e.config)||void 0===p?void 0:p.actions)||void 0===h?void 0:h.minimizeTabIndex,showInRight:!1}),e.canCancel&&f.jsx(Uk,{onClick:e.cancelOnClick,tabIndex:null===(v=null===(m=e.config)||void 0===m?void 0:m.actions)||void 0===v?void 0:v.cancelTabIndex})]})]}),k?f.jsx("div",{className:"xa-chat-menu-container",children:f.jsx(Ax,{openFrom:E?"right":"left",opened:k,tabIndex:I,onItemClick:function(e){S(!1),b(e)},items:j})}):f.jsx(f.Fragment,{})]})};function Zk(e){var t,n,i,o,a;return nS("--xapp-",rS(iS("primary-color",null==e?void 0:e.primaryColor),nS("widget-",rS(sS(null==e?void 0:e.size),lS(null==e?void 0:e.margin),pS(null==e?void 0:e.border),function(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["z-index",e]]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})}(null==e?void 0:e.zIndex))),function(e){if(!e)return oS();return nS("chat-button-",rS(lS(e.margin),dS(e.background),nS("image-",sS(e.imageSize)),function(e){var t,n,i,o,a;return r(this,function(r){switch(r.label){case 0:return e?(t=e.primaryColor||"0, 117, 170",n=e.secondaryColor||"110, 178, 209",i=e.opacity||.75,[4,["animation-primary-color","".concat(t)]]):[2];case 1:return r.sent(),[4,["animation-secondary-color","".concat(n)]];case 2:return r.sent(),[4,["animation-opacity","".concat(i)]];case 3:return r.sent(),[4,["animation-primary-rgba","rgba(".concat(t,", ").concat(i,")")]];case 4:return r.sent(),[4,["animation-secondary-rgba","rgba(".concat(n,", ").concat(i,")")]];case 5:return r.sent(),o="radial-gradient(40.83% 40.83% at 47.92% 52.5%, rgba(".concat(t,", ").concat(i,") 78.85%, rgba(").concat(n,", ").concat(i,") 92.07%)"),a="radial-gradient(40.83% 40.83% at 47.92% 52.5%, rgba(".concat(t,", ").concat(i,") 20.46%, rgba(").concat(n,", ").concat(i,") 92.07%)"),[4,["animation-pulse-intense",o]];case 6:return r.sent(),[4,["animation-pulse-less-intense",a]];case 7:return r.sent(),[2]}})}(e.animation)))}(null==e?void 0:e.chatButton),nS("header-",function(e){if(!e)return oS();return rS(dS(e.background),uS(e.text),nS("subtitle-",uS(e.subtitle)),pS(e.border),cS(e.padding),iS("avatar-background",e.avatarBackground))}(null==e?void 0:e.header)),nS("footer-",function(e){var t;if(!e)return oS();return rS(dS(e.background),pS(e.border),nS("branding-",uS(null===(t=e.branding)||void 0===t?void 0:t.text)))}(null==e?void 0:e.footer)),nS("content-",rS(dS(null===(t=null==e?void 0:e.content)||void 0===t?void 0:t.background))),nS("messages-",function(e){if(!e)return oS();return rS(nS("mine-",aS(e.mine)),nS("others-",aS(e.others)),cS(null==e?void 0:e.padding),iS("max-width",null==e?void 0:e.maxWidth))}(null==e?void 0:e.messages)),nS("text-typing-status-",uS(null===(n=null==e?void 0:e.textTypingStatus)||void 0===n?void 0:n.text)),nS("send-",fS(null==e?void 0:e.sendButton)),nS("menu-",fS(null==e?void 0:e.menuButton)),nS("menu-",function(e){return rS(nS("item-",function(e){return rS(uS(null==e?void 0:e.text),nS("subtitle-",uS(null==e?void 0:e.subtitle)),pS(null==e?void 0:e.border),dS(null==e?void 0:e.background),iS("height",null==e?void 0:e.height))}(null==e?void 0:e.item)))}(null==e?void 0:e.menu)),nS("refresh-",fS(null==e?void 0:e.refreshButton)),nS("minimize-",fS(null==e?void 0:e.minimizeButton)),nS("cancel-",fS(null==e?void 0:e.cancelButton)),nS("carousel-",rS(nS("title-",uS(null===(i=null==e?void 0:e.carousel)||void 0===i?void 0:i.title)),nS("subtitle-",uS(null===(o=null==e?void 0:e.carousel)||void 0===o?void 0:o.subtitle)),nS("action-",fS(null===(a=null==e?void 0:e.carousel)||void 0===a?void 0:a.button)))),nS("input-",function(e){if(!e)return oS();return rS(dS(e.background),pS(e.border),uS(e.text),nS("placeholder-",uS(e.placeholder)))}(null==e?void 0:e.input)),nS("cta-",function(e){if(!e)return oS();return rS(dS(e.background),uS(e.text))}(null==e?void 0:e.cta)),nS("action-bar-",function(e){if(!e)return oS();return rS(dS(e.background),pS(e.border),cS(e.padding),lS(e.margin),iS("box-shadow",e.boxShadow),iS("border-radius",e.borderRadius),nS("button-",function(e){if(!e)return oS();return rS(dS(e.background),iS("hover-background",e.hoverBackground),nS("icon-",sS(e.iconSize)),iS("icon-color",e.iconColor),nS("label-",uS(e.label)),iS("gap",e.gap),iS("border-radius",e.borderRadius),cS(e.padding))}(e.button)))}(null==e?void 0:e.actionBar))))}var eS=new Map;function tS(e){var t=e.theme,n=JSON.stringify(function(e){for(var t=[],n=Zk(e),r=n.next();!1===r.done;){var i=r.value,o=i[0],a=i[1];null!=a&&""!==a&&t.push([o,a]),r=n.next()}return t}(t));return ee.useLayoutEffect(function(){var e=JSON.parse(n);return function(e){for(var t,n=document.documentElement,r=0,i=e;r<i.length;r++){var o=i[r],a=o[0],s=o[1];n.style.setProperty(a,s),eS.set(a,(null!==(t=eS.get(a))&&void 0!==t?t:0)+1)}}(e),function(){return function(e){for(var t,n=document.documentElement,r=0,i=e;r<i.length;r++){var o=i[r][0],a=(null!==(t=eS.get(o))&&void 0!==t?t:1)-1;a<=0?(eS.delete(o),n.style.removeProperty(o)):eS.set(o,a)}}(e)}},[n]),null}function nS(e,t){var n;return r(this,function(r){switch(r.label){case 0:n=t.next(),r.label=1;case 1:return n.done?[3,3]:[4,["".concat(e).concat(n.value[0]),n.value[1]]];case 2:return r.sent(),n=t.next(),[3,1];case 3:return[2]}})}function rS(){var e,t,n,i,o,a=[];for(e=0;e<arguments.length;e++)a[e]=arguments[e];return r(this,function(e){switch(e.label){case 0:t=0,n=a,e.label=1;case 1:if(!(t<n.length))return[3,5];i=n[t],o=i.next(),e.label=2;case 2:return!1!==o.done?[3,4]:[4,o.value];case 3:return e.sent(),o=i.next(),[3,2];case 4:return t++,[3,1];case 5:return[2]}})}function iS(e,t){return r(this,function(n){switch(n.label){case 0:return[4,[e,t]];case 1:return n.sent(),[2]}})}function oS(){return r(this,function(e){return[2]})}function aS(e){return rS(iS("bubble-color",null==e?void 0:e.bubbleColor),uS(null==e?void 0:e.text))}function sS(e){return r(this,function(t){switch(t.label){case 0:return[4,["width",null==e?void 0:e.width]];case 1:return t.sent(),[4,["height",null==e?void 0:e.height]];case 2:return t.sent(),[2]}})}function lS(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["margin-top",e.top]]:[3,5];case 1:return t.sent(),[4,["margin-right",e.right]];case 2:return t.sent(),[4,["margin-bottom",e.bottom]];case 3:return t.sent(),[4,["margin-left",e.left]];case 4:t.sent(),t.label=5;case 5:return[2]}})}function cS(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["padding-top",e.top]]:[3,5];case 1:return t.sent(),[4,["padding-right",e.right]];case 2:return t.sent(),[4,["padding-bottom",e.bottom]];case 3:return t.sent(),[4,["padding-left",e.left]];case 4:t.sent(),t.label=5;case 5:return[2]}})}function uS(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["text-color",e.color]]:[3,6];case 1:return t.sent(),[4,["font-size",e.fontSize]];case 2:return t.sent(),[4,["font-family",e.fontFamily]];case 3:return t.sent(),[4,["font-weight",e.fontWeight]];case 4:return t.sent(),[4,["font-style",e.fontStyle]];case 5:t.sent(),t.label=6;case 6:return[2]}})}function dS(e){return r(this,function(t){switch(t.label){case 0:return[4,["background",e]];case 1:return t.sent(),[2]}})}function fS(e){return r(this,function(t){switch(t.label){case 0:return[4,["button-color",null==e?void 0:e.color]];case 1:return t.sent(),[4,["button-width",null==e?void 0:e.width]];case 2:return t.sent(),[4,["button-bg",null==e?void 0:e.background]];case 3:return t.sent(),[4,["button-hover-bg",null==e?void 0:e.hoverBackground]];case 4:return t.sent(),[4,["button-disabled-bg",null==e?void 0:e.disabledBackground]];case 5:return t.sent(),[2]}})}function pS(e){return r(this,function(t){switch(t.label){case 0:return e?[4,["border-color",e.color]]:[3,4];case 1:return t.sent(),[4,["border-width",e.width]];case 2:return t.sent(),[4,["border-radius",e.radius]];case 3:t.sent(),t.label=4;case 4:return[2]}})}var hS=function(e){if(null===e)return"null";if(void 0===e)return"undefined";if("object"!=typeof e)return String(e);try{var t=new WeakSet;return JSON.stringify(e,function(e,n){if("object"==typeof n&&null!==n){if(t.has(n))return"[Circular]";t.add(n)}return n},2)}catch(t){return"[Object: ".concat(Object.prototype.toString.call(e),"]")}},mS=function(e){var o=e.enableErrorOverlay,a=Z.useState([]),s=a[0],l=a[1],c=Z.useState(!1),u=c[0],d=c[1],p=Z.useState(!0),h=p[0],m=p[1],v=Z.useState(!1),g=v[0],y=v[1],b=Z.useState("bottom"),w=b[0],x=b[1];Z.useEffect(function(){var e,t=function(){var e;if("undefined"==typeof window)return!1;var t=null===(e=window.localStorage)||void 0===e?void 0:e.getItem("xaErrorOverlay");return"enabled"===t?(console.log("[ErrorOverlay] Enabled via localStorage"),!0):"disabled"===t?(console.log("[ErrorOverlay] Disabled via localStorage"),!1):void 0!==o?(console.log("[ErrorOverlay] Using config setting:",o),o):!(void 0===globalThis.__DEV__||!globalThis.__DEV__)&&(console.log("[ErrorOverlay] Enabled via __DEV__"),!0)}();y(t);var n=null===(e=window.localStorage)||void 0===e?void 0:e.getItem("xaErrorOverlayPosition");"top"!==n&&"bottom"!==n||x(n),console.log("[ErrorOverlay] Component mounted, enabled:",t,"position:",n||"bottom")},[o]);var k=Z.useCallback(function(e){console.log("[ErrorOverlay] Adding error:",e),l(function(n){var r=(new Date).toISOString(),o=n[n.length-1];if(o&&o.message===e.message)return i(i([],n.slice(0,-1),!0),[t(t({},o),{count:o.count+1,timestamp:r})],!1);var a=t({id:"".concat(r,"-").concat(Math.random()),timestamp:r,count:1},e);return i(i([],n,!0),[a],!1).slice(-50)})},[]);Z.useEffect(function(){if(g){console.log("[ErrorOverlay] Setting up error interception");var e=console.error,t=console.warn;console.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t.map(function(e){return hS(e)}).join(" "),i=new Error;k({message:r,type:"error",stack:i.stack}),e.apply(console,t)},console.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e.map(function(e){return hS(e)}).join(" ");k({message:r,type:"warning"}),t.apply(console,e)};var n=function(e){var t;k({message:e.message,type:"error",stack:null===(t=e.error)||void 0===t?void 0:t.stack})},r=function(e){var t;k({message:"Unhandled Promise Rejection: ".concat(e.reason),type:"error",stack:null===(t=e.reason)||void 0===t?void 0:t.stack})};return window.addEventListener("error",n),window.addEventListener("unhandledrejection",r),function(){console.log("[ErrorOverlay] Cleaning up error interception"),console.error=e,console.warn=t,window.removeEventListener("error",n),window.removeEventListener("unhandledrejection",r)}}console.log("[ErrorOverlay] Not enabled, skipping error interception")},[g,k]);return g&&h?0===s.length?null:f.jsxs("div",{className:"error-overlay error-overlay--".concat(w," ").concat(u?"minimized":""),children:[f.jsxs("div",{className:"error-overlay-header",children:[f.jsxs("span",{className:"error-overlay-title",children:["Debug Console (",s.length,")"]}),f.jsxs("div",{className:"error-overlay-actions",children:[f.jsx("button",{onClick:function(){return n(void 0,void 0,void 0,function(){var e,t,n;return r(this,function(r){switch(r.label){case 0:e=s.map(function(e){return"[".concat(e.timestamp,"] ").concat(e.type.toUpperCase(),": ").concat(e.message).concat(e.stack?"\n"+e.stack:"")}).join("\n\n"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.clipboard.writeText(e)];case 2:return r.sent(),console.log("[ErrorOverlay] Errors copied to clipboard"),[3,4];case 3:t=r.sent(),console.error("[ErrorOverlay] Failed to copy to clipboard:",t),(n=document.createElement("textarea")).value=e,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select();try{document.execCommand("copy"),console.log("[ErrorOverlay] Errors copied to clipboard using fallback method")}catch(e){console.error("[ErrorOverlay] Fallback copy method also failed:",e)}return document.body.removeChild(n),[3,4];case 4:return[2]}})})},title:"Copy all to clipboard",children:"📋"}),f.jsx("button",{onClick:function(){l([])},title:"Clear all",children:"🗑️"}),f.jsx("button",{onClick:function(){var e="bottom"===w?"top":"bottom";x(e),"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem("xaErrorOverlayPosition",e)},title:"Move to ".concat("bottom"===w?"top":"bottom"),children:"bottom"===w?"⬆️":"⬇️"}),f.jsx("button",{onClick:function(){var e=!g;y(e),"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem("xaErrorOverlay",e?"enabled":"disabled"),console.log("[ErrorOverlay] Toggled enabled state to:",e),e||l([])},title:"Disable Error Overlay",children:"🔧"}),f.jsx("button",{onClick:function(){return d(!u)},title:"Minimize/Maximize",children:u?"▲":"▼"}),f.jsx("button",{onClick:function(){return m(!1)},title:"Close",children:"✕"})]})]}),!u&&f.jsx("div",{className:"error-overlay-content",children:s.map(function(e){return f.jsxs("div",{className:"error-entry error-".concat(e.type),children:[f.jsxs("div",{className:"error-header",children:[f.jsx("span",{className:"error-time",children:new Date(e.timestamp).toLocaleTimeString()}),e.count>1&&f.jsxs("span",{className:"error-count",children:["(",e.count,"x)"]}),f.jsx("span",{className:"error-badge error-badge-".concat(e.type),children:e.type})]}),f.jsx("div",{className:"error-message",children:e.message}),e.stack&&f.jsxs("details",{className:"error-stack",children:[f.jsx("summary",{children:"Stack trace"}),f.jsx("pre",{children:e.stack})]})]},e.id)})})]}):null},vS=function(e){var t=e.button,n=e.onPress,r=Z.useCallback(function(){"disabled"===t.pressBehavior||t.isPressed||n(t.id)},[t.pressBehavior,t.isPressed,t.id,n]),i=Z.useMemo(function(){var e=["ws-button"];return("disabled"===t.pressBehavior||t.isPressed)&&e.push("ws-button--disabled"),t.isPressed&&"spinning"===t.pressBehavior&&e.push("ws-button--spinning"),e.join(" ")},[t.pressBehavior,t.isPressed]),o=Z.useMemo(function(){var e=["ws-button-container"];return t.isDismissing&&e.push("ws-button-container--dismissing"),e.join(" ")},[t.isDismissing]);return f.jsx("div",{className:o,children:f.jsxs("button",{className:i,onClick:r,disabled:"disabled"===t.pressBehavior||t.isPressed,"aria-label":t.text,"aria-busy":t.isPressed&&"spinning"===t.pressBehavior,children:[t.isPressed&&"spinning"===t.pressBehavior&&f.jsx("span",{className:"ws-button__spinner"}),f.jsx("span",{className:"ws-button__text",children:t.text})]})})},gS=function(e){var t=e.onClose,n=e.onReset;return f.jsxs("div",{className:"modalContent",children:[f.jsxs("div",{className:"modalBody",children:[f.jsx("h2",{children:"Restart Conversation"}),f.jsx("p",{children:"Would you like to refresh and return to the starting point of the conversation?"})]}),f.jsxs("div",{className:"modalActions",children:[f.jsx("button",{onClick:t,className:"cancelBtn",children:"Cancel"}),f.jsx("button",{onClick:n,className:"restartBtn",children:"Restart"})]})]})};function yS(e){var t=function(e){return function(t,n){return void 0===t&&(t=e),Yh("static reducer",t,n),t}}(e);return uw({reducer:t,middleware:function(e){return e({thunk:!0})},devTools:!1})}var bS=function(e){var n=e.state,r=Z.useMemo(function(){return yS(n)},[n]),i=Z.useMemo(function(){return t(t({},e.config),{connection:{serverUrl:"",type:"local"}})},[e.config]);return f.jsx(_h,{store:r,children:f.jsx(ES,t({},e,{config:i,disableAutoScroll:e.disableAutoScroll,preview:e.preview}))})},wS=function(e){var n=e.messages,r=Z.useMemo(function(){return function(e){var n,r=mw(),o=e.length>0?e[e.length-1]:void 0,a="chat.msg"===(null==o?void 0:o.type)?o.msg:null,s=(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.length)?a.options:[];return t(t({},r),{connection:t(t({},r.connection),{connectionStatus:"online"}),accountStatus:"online",chats:i([],e,!0),chips:s,isChatting:!0,visuals:{visible:!0,opened:!0}})}(n)},[n]);return f.jsx(bS,{state:r,mode:e.mode,config:e.config,disableAutoScroll:e.disableAutoScroll,preview:e.preview})},xS="undefined"==typeof window?Z.useEffect:Z.useLayoutEffect;"undefined"!=typeof process&&process.env;var kS=function(e){var t,n=null!==(t=e.mode)&&void 0!==t?t:"preview",r=Z.useMemo(function(){return t=e.previewMessages||[],n=e.config,r=Date.now(),t.map(function(e,t){var i,o;return{type:"chat.msg",user:{nick:"agent:robot",display_name:(null==n?void 0:n.botName)||"Assistant",avatarPath:null==n?void 0:n.avatarUrl},timestamp:r+t,msg:{text:e.displayText,html:e.html,options:null===(i=e.suggestions)||void 0===i?void 0:i.map(function(e){return{label:e.title,actionUrl:e.url||"#"}}),list:e.list?{type:e.list.type,title:e.list.title,items:e.list.items.map(function(e){return{title:e.title,subTitle:e.description,url:e.url,imageUrl:e.imageUrl,hideUrl:e.hideUrl}})}:void 0,displays:e.list?[(o={type:e.list.type,title:e.list.title,items:e.list.items.map(function(e){return{title:e.title,subTitle:e.description,url:e.url,imageUrl:e.imageUrl,hideUrl:e.hideUrl}})},{type:o.type,title:o.title,items:(o.items||[]).map(function(e){var t={title:e.title,description:e.subTitle,token:e.token,url:e.url,hideUrl:e.hideUrl,image:{url:e.imageUrl,imageActionUrl:e.imageActionUrl,accessibilityText:""}},n=e.buttons;return n&&n.length>0&&(t.buttons=n.map(function(e){return{openUrlAction:e.actionUrl,title:e.label}})),t})})]:void 0}}});var t,n,r},[e.previewMessages,e.config]);return f.jsx(wS,{messages:r,mode:n,config:e.config,disableAutoScroll:e.disableAutoScroll,preview:!0})},SS=function(e){var n,r=null!==(n=e.mode)&&void 0!==n?n:"normal",i=Z.useState(e.config),o=i[0],a=i[1],s=Z.useState(!!e.getConfig),l=s[0],c=s[1],u=Z.useState(),d=u[0],p=u[1];Z.useEffect(function(){var t=!1;return e.getConfig?(c(!0),p(void 0),e.getConfig().then(function(e){t||(a(e),c(!1),Yh("[ChatWidget] Config loaded from getConfig callback"))}).catch(function(e){t||(p(e),c(!1),Gh("[ChatWidget] Failed to load config: ".concat(e.message)))})):e.config&&(a(e.config),c(!1)),function(){t=!0}},[e.getConfig,e.config]);var h,m,v=(h=o,m=Rh(function(e){return e.connection.nonce}),Yh("nonce from Redux: ".concat(m)),om(h,m)),g=Z.useMemo(function(){var e;return t(t({},o),{connection:v,assetUrl:null!==(e=null==v?void 0:v.serverUrl)&&void 0!==e?e:Zh,env:o})},[v,o]),y=Rh(function(e){return e.connection.token}),b=Z.useMemo(function(){var e={items:[{delay:5,text:"We are having trouble communicating with the assistant right now. Re-trying in ${sec} seconds..."},{delay:5,text:"We are still having trouble communicating with the assistant right now. Re-trying in ${sec} seconds..."},{delay:0,text:"Sorry, we cannot communicate with the assistant right now. Please check your connection or try again later."}]};return(null==o?void 0:o.configurableMessages)&&Array.isArray(o.configurableMessages.items)&&o.configurableMessages.items.length>0&&(e=o.configurableMessages),{token:y,bot:{nick:"Bot",displayName:null==o?void 0:o.botName,avatarPath:null==o?void 0:o.avatarUrl},configurableMessages:e,hooks:null==o?void 0:o.hooks,env:o}},[y,null==o?void 0:o.botName,null==o?void 0:o.avatarUrl,null==o?void 0:o.configurableMessages,null==o?void 0:o.hooks]),w=function(e,t){var n=Z.useState(),r=n[0],i=n[1],o=Cm(),a=[t,e,o],s=Z.useRef(void 0);return Z.useEffect(function(){if(s.current){var n=s.current,r=n[0],a=n[1],l=n[2],c=[];r!==t&&c.push("options"),a!==e&&c.push("config"),l!==o&&c.push("dispatch"),c.length>0&&Yh("[useChatServer] Effect re-running due to: ".concat(c.join(", ")))}else Yh("[useChatServer] Effect running for first time");if(s.current=[t,e,o],!e||!t)return Yh("[useChatServer] Config or options null, not creating server"),void i(void 0);Yh("Creating new chat server - type: ".concat(e.type));var u=Jy(e,t);return u.init(o),i(u),function(){Yh("Cleanup - disposing old server"),u.dispose()}},a),r}(l||d?null:v,l||d?null:b),x="widget-container--".concat(r);return l?f.jsx("div",{className:"widget-container widget-container--loading ".concat(x),children:f.jsx("div",{className:"xa-spinner-container visible",children:f.jsx("div",{className:"xa-spinner"})})}):d?f.jsx("div",{className:"widget-container widget-container--error ".concat(x),children:f.jsxs("div",{className:"widget-error-message",children:["Failed to load chat configuration: ",d.message]})}):f.jsx(nm.Provider,{value:g,children:f.jsx(Yy.Provider,{value:w,children:f.jsx(ES,t({},e,{config:o}))})})};function CS(e){var t,n;return px(e)&&(null===(n=null===(t=e.formConfig)||void 0===t?void 0:t.api)||void 0===n?void 0:n.key)||void 0}function _S(){return Fh()||Wh()}var ES=function(e){var n,r,i,o,a,s,l,c,u,d,p,h,m,v,g,y,b,w,x,k,S,C,_,E,N,I,T,j,O,P,A,R,M,L,D,B,z,U,F,q,H,W,V,$,K,Q,J,Y,G=Cm(),X=Gy();Vv();var ee=Rh(function(e){return e}),te=Z.useRef({}),ne=null!==(n=e.mode)&&void 0!==n?n:"normal",re="docked"===ne,ie="static"===ne,oe=!0===e.preview||"preview"===ne,ae="widget-container--".concat(ne),se=Iw(oe),le=ib(ee.chats),ce=Z.useMemo(function(){var t;return ob(null===(t=e.config)||void 0===t?void 0:t.cta,{hasConversation:le,arrivedViaChatLink:se})},[null===(r=e.config)||void 0===r?void 0:r.cta,le,se]),de=re&&!0===(null===(i=e.config.popOut)||void 0===i?void 0:i.enabled),fe=null!==(a=null===(o=e.config.popOut)||void 0===o?void 0:o.minWidth)&&void 0!==a?a:640,pe=Z.useRef(null),he=Z.useState(!1),me=he[0],ve=he[1],ge=Z.useState(!1),ye=ge[0],be=ge[1],we=Z.useState(!1),xe=we[0],ke=we[1],Se=Z.useState(!1),Ce=Se[0],_e=Se[1],Ee=Z.useState("undefined"==typeof window?0:window.innerWidth),Ne=Ee[0],Ie=Ee[1];Z.useEffect(function(){if(de&&"undefined"!=typeof window){var e=function(){return Ie(window.innerWidth)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}},[de]),Z.useEffect(function(){if(de&&"undefined"!=typeof IntersectionObserver&&pe.current){var e=new IntersectionObserver(function(e){var t=e[e.length-1];t&&(ve(!t.isIntersecting),t.isIntersecting&&(be(!0),ke(!1),_e(!1)))});return e.observe(pe.current),function(){return e.disconnect()}}},[de]);var Te,je="message"!==(null===(s=e.config.popOut)||void 0===s?void 0:s.after)||!!(null==(Te=ee.chats)?void 0:Te.some(function(e){var t,n;return"chat.msg"===e.type&&!!(null===(n=null===(t=e.user)||void 0===t?void 0:t.nick)||void 0===n?void 0:n.startsWith("visitor:"))})),Oe=de&&ye&&me&&!xe&&je,Pe=Ne>=fe,Ae=null!==(c=null===(l=e.config.popOut)||void 0===l?void 0:l.mobile)&&void 0!==c?c:"auto",Re=Oe&&!Pe&&"none"!==Ae&&!Ce,Me=Oe&&(Pe||Ce);function Le(){_e(!0)}var De=Z.useMemo(function(){return de&&"undefined"!=typeof document?document.createElement("div"):null},[de]),Be=Z.useRef({fromBottom:0,latest:!0});Z.useEffect(function(){if(De){var e=function(e){var t=e.target;if(t instanceof HTMLElement&&t.classList.contains("message-list-container")){var n=t.scrollHeight-t.clientHeight-t.scrollTop;Be.current={fromBottom:n,latest:n<=t.clientHeight}}};return De.addEventListener("scroll",e,!0),function(){return De.removeEventListener("scroll",e,!0)}}},[De]),xS(function(){if(De){De.className="widget-portal";var e=Me?document.body:pe.current;if(e&&De.parentElement!==e){var t=document.activeElement,n=t instanceof HTMLElement&&De.contains(t)?t:void 0,r=De.querySelector(".message-list-container");e.appendChild(De);var i=function(){if(r){var e=Be.current,t=e.fromBottom,n=e.latest,i=r.scrollHeight-r.clientHeight;r.scrollTop=n?i:Math.max(0,i-t)}};i(),null==n||n.focus({preventScroll:!0});var o=requestAnimationFrame(i),a=window.setTimeout(i,250);return function(){cancelAnimationFrame(o),window.clearTimeout(a)}}}},[De,Me]),Z.useEffect(function(){return function(){return null==De?void 0:De.remove()}},[De]);var ze,Ue=!0===(null===(u=e.config.header)||void 0===u?void 0:u.hidden)&&(re||ie)&&!Me,Fe=Z.useMemo(function(){return Ue&&e.config.menu&&"FOOTER"!==e.config.menu.menuButtonLocation?t(t({},e.config.menu),{menuButtonLocation:"FOOTER"}):e.config.menu},[Ue,e.config.menu]),qe=null===(p=null===(d=e.config.header)||void 0===d?void 0:d.actions)||void 0===p?void 0:p.refresh,He=!re&&!ie&&!oe&&(null===(m=null===(h=e.config.header)||void 0===h?void 0:h.actions)||void 0===m?void 0:m.minimize);Yh("docked: ".concat(re," static: ").concat(ie," preview: ").concat(oe," minimized: ").concat(null===(g=null===(v=e.config.header)||void 0===v?void 0:v.actions)||void 0===g?void 0:g.minimize)),ze="boolean"==typeof(null===(b=null===(y=e.config.header)||void 0===y?void 0:y.actions)||void 0===b?void 0:b.cancel)?!re&&!ie&&!oe&&(null===(x=null===(w=e.config.header)||void 0===w?void 0:w.actions)||void 0===x?void 0:x.cancel):!re&&!ie&&!oe,ee.visuals||(ee.visuals={});var We=(null===(k=e.config)||void 0===k?void 0:k.autoOpenOnWidth)?parseInt(e.config.autoOpenOnWidth,10):NaN,Ve=!isNaN(We)&&window.innerWidth>=We,$e=Z.useState(!He&&!ze||(isNaN(We)?ee.visuals.visible:Ve)),Ke=$e[0],Qe=$e[1],Je=Z.useState(!1);Je[0];var Ye=Je[1],Ge=Z.useRef(!1),Xe=Z.useRef(null),Ze=Z.useRef(Ve),et=Z.useContext(Yy),tt=null===(C=null===(S=e.config)||void 0===S?void 0:S.autoOpenOnPattern)||void 0===C?void 0:C.patterns,nt=window.location.href,rt=tt&&tt.length>0,it=null==tt?void 0:tt.some(function(e){return nt.includes(e)}),ot=null===(E=null===(_=e.config)||void 0===_?void 0:_.autoOpenOnPattern)||void 0===E?void 0:E.minimumWidth,at=window.innerWidth,st=Z.useCallback(function(e){ie||oe||(Yh("setVisible: ".concat(e)),Qe(e),G(eb({visible:e})))},[G,ie,oe]);Z.useEffect(function(){var t,n,r=function(e){var t=document.getElementsByTagName("body")[0];t.tabIndex=-1,"Escape"===e.key&&t.focus()};return document.addEventListener("keydown",r),Nw((null==ee?void 0:ee.sessionExpiration)||(null===(t=e.config)||void 0===t?void 0:t.sessionExpiration),null===(n=null==ee?void 0:ee.chats[ee.chats.length-1])||void 0===n?void 0:n.timestamp,null==ee||ee.lastTimestamp)&&(G(ag(void 0)),G({type:"reset"})),function(){document.removeEventListener("keydown",r),Xe.current&&clearTimeout(Xe.current)}},[]);var lt=Z.useState(!document.hidden),ct=lt[0],ut=lt[1];Z.useEffect(function(){var e=function(){ut(!document.hidden)};return document.addEventListener("visibilitychange",e),function(){document.removeEventListener("visibilitychange",e)}},[]),Z.useEffect(function(){et?ct?(Yh("Tab is VISIBLE - calling wakeup()"),et.wakeup()):(Yh("Tab is HIDDEN - calling sleep()"),et.sleep()):Yh("Tab visibility changed but no chatServer yet")},[et,G,ct]),Z.useEffect(function(){if(et){var e=function(){Yh("beforeunload - notifying router of user disconnecting"),et.notifyDisconnecting&&et.notifyDisconnecting("close_tab")};return window.addEventListener("beforeunload",e),function(){window.removeEventListener("beforeunload",e)}}},[et]),Z.useEffect(function(){ee.visuals.opened?st(!0):"normal"!==ne||Ve||st(!1),rt&&it&&st(!0),at<+ot&&st(!1),Ve&&!Ze.current&&(Ze.current=!0,st(!0))},[at,rt,it,ot,st,ee.visuals.opened,ne,Ve]);var dt=Z.useCallback(function(){Ge.current&&(Xe.current&&(clearTimeout(Xe.current),Xe.current=null),X(ym(!1)),Ye(!1),Ge.current=!1)},[X]),ft=Z.useCallback(function(){Ge.current||(X(ym(!0)),Ye(!0),Ge.current=!0),Xe.current&&clearTimeout(Xe.current),Xe.current=window.setTimeout(function(){dt()},2e3)},[X,dt]);var pt=lb();function ht(e){oe||("offline"!==ee.accountStatus||ee.isChatting)&&e&&(dt(),et.flush(),X(gm(e)))}function mt(){G({type:"reset"})}function vt(){te.current.style.display="none"}function gt(){G(eb({opened:!1,hasInteracted:!0})),st(!1)}function yt(){G(eb({opened:!0,hasInteracted:!0})),st(!0),setTimeout(function(){var e;null===(e=document.getElementById("chatWidgetInput"))||void 0===e||e.focus({preventScroll:!0})},100)}function bt(){G(eb({hasInteracted:!0}))}var wt=Z.useState(!1),xt=wt[0],kt=wt[1],St=Z.useState(null),Ct=St[0],_t=St[1],Et=Z.useCallback(function(e){$h(e.preselectChipLabel?{preselectChipLabel:e.preselectChipLabel}:void 0).then(function(t){t||(Yh("Form widget not available, showing modal fallback"),_t(e),kt(!0))})},[]),Nt=Z.useCallback(function(){kt(!1),_t(null)},[]);var It="offline"===ee.accountStatus&&!ee.isChatting,Tt=ee&&ee.chats;Yh('Rendering - accountStatus: "'.concat(ee.accountStatus,'", connectionStatus: "').concat(ee.connection.connectionStatus,'"'));var jt=e.config,Ot=e.onConnectionStatusChange,Pt=!0===(null===(N=null==jt?void 0:jt.actionBar)||void 0===N?void 0:N.enabled),At=Aw(),Rt=null!==(T=null===(I=null==jt?void 0:jt.actionBar)||void 0===I?void 0:I.buttons)&&void 0!==T?T:[],Mt=!(null==jt?void 0:jt.formWidgetKey)&&Rt.some(px)&&!Rt.some(CS),Lt=Z.useState(function(){return Mt&&_S()}),Dt=Lt[0],Bt=Lt[1];Z.useEffect(function(){if(Mt&&!Dt){var e=0,t=setInterval(function(){e++,_S()?(Bt(!0),clearInterval(t)):e>=30&&clearInterval(t)},500);return function(){return clearInterval(t)}}},[Mt,Dt]);var zt=Z.useMemo(function(){var e=null==jt?void 0:jt.actionBar;return e&&Mt&&!Dt?t(t({},e),{buttons:e.buttons.filter(function(e){return!px(e)})}):e},[null==jt?void 0:jt.actionBar,Mt,Dt]),Ut=Z.useMemo(function(){return Pt&&zt?hx(zt.buttons,{chatDisabled:jt.disabled,formDisabled:At}):[]},[Pt,zt,null==jt?void 0:jt.disabled,At]),Ft=Pt&&Ut.length>0;Rw(!It&&!e.preChatFormEnabled&&Ke&&!oe);var qt=ee.connection.connectionStatus;Z.useEffect(function(){Ot&&Ot(qt)},[qt,Ot]),Tw(null===(j=e.config)||void 0===j?void 0:j.middlewareUrl);var Ht=!At&&(!Pt||Ut.some(px)),Wt=null!==(O=null==jt?void 0:jt.formWidgetKey)&&void 0!==O?O:Ut.map(CS).find(Boolean);Z.useEffect(function(){var e;Wt&&Ht&&(e=Wt)&&Hh(e).catch(function(e){console.warn("[chat-widget] Failed to preload form-widget script:",e)})},[Wt,Ht]),Z.useEffect(function(){if(Ft){var e=parseInt(document.body.getAttribute("data-xapp-action-bar-count")||"0",10);document.body.setAttribute("data-xapp-action-bar-count",String(e+1)),document.body.setAttribute("data-xapp-action-bar-enabled","true")}return function(){if(Ft){var e=parseInt(document.body.getAttribute("data-xapp-action-bar-count")||"0",10),t=Math.max(0,e-1);0===t?(document.body.removeAttribute("data-xapp-action-bar-enabled"),document.body.removeAttribute("data-xapp-action-bar-count")):document.body.setAttribute("data-xapp-action-bar-count",String(t))}}},[Ft]);var Vt=(null===(P=ee.agents["agent:robot"])||void 0===P?void 0:P.user)||(null==jt?void 0:jt.agent)||{nick:"agent:robot",avatarPath:jt.avatarUrl,display_name:"Agent"},$t=f.jsxs("div",{className:"widget-container ".concat(ae," ").concat(function(){var e;return Ke?"visible":(null===(e=ee.visuals)||void 0===e?void 0:e.hasInteracted)?"":"widget-container--initial-hidden"}()).concat(Ft?" widget-container--with-action-bar":"").concat(Me?" widget-container--popped":"").concat(Re?" widget-container--collapsed":""),children:[f.jsx(tS,{theme:null==jt?void 0:jt.theme}),!Ue&&f.jsx(Xk,{accountStatus:ee.accountStatus,refreshOnClick:function(){jt.header.actions.refreshShowConfirmation?te.current.style.display="block":mt()},minimizeOnClick:Me?function(){Pe?ke(!0):_e(!1)}:gt,cancelOnClick:function(){(null==et?void 0:et.notifyDisconnecting)&&et.notifyDisconnecting("widget_close"),G({type:"reset"}),G(eb({opened:!1,hasInteracted:!0})),st(!1)},agent:Vt,canRefresh:qe,canMinimize:Me||He,canCancel:ze,config:null==jt?void 0:jt.header,menuConfig:jt.menu,debugMode:null===(M=null===(R=null===(A=e.config)||void 0===A?void 0:A.connection)||void 0===R?void 0:R.mcp)||void 0===M?void 0:M.debugMode,onSubmit:ht}),f.jsx(Dk,{visible:Ke,queuePosition:ee.queuePosition,isChatting:ee.isChatting,isOffline:It,messages:Tt,agents:ee.agents,agent:null==jt?void 0:jt.agent,lastRatingRequestTimestamp:ee.lastRatingRequestTimestamp,hasRating:ee.hasRating,visitorId:ee.visitorId,hasWsButton:!!ee.wsButton,messageMiddleware:e.messageMiddleware,textTypingStatusEnabled:null===(D=null===(L=e.config)||void 0===L?void 0:L.typingStatus)||void 0===D?void 0:D.textTypingStatusEnabled,disableAutoScroll:e.disableAutoScroll,onSend:function(e){oe||X(function(e){return function(t){return function(n,r){var i=r();("offline"!==i.accountStatus||i.isChatting)&&(e.msg&&n(vm(e.msg,i.visitor,+new Date)),t.sendChatMsgRequest(e,function(){}))}}}(e))},onWrite:function(e){oe||G(vm(e.msg,e.user))},onOpenUrl:pt,minimizeOnClick:gt}),f.jsx("div",{className:"xa-spinner-container ".concat(Ke&&"pending"===qt?"visible":""),children:f.jsx("div",{className:"xa-spinner"})}),"offline"===qt&&f.jsx(Bk,{}),ee.wsButton&&Ke&&f.jsx(vS,{button:ee.wsButton,onPress:function(e){var n,r;Yh("WS Button pressed: ".concat(e)),"spinning"===(null===(n=ee.wsButton)||void 0===n?void 0:n.pressBehavior)&&G({type:"ws_button_display",detail:t(t({},ee.wsButton),{isPressed:!0,timestamp:+new Date})}),et&&et.sendButtonPressed&&et.sendButtonPressed(e).catch(function(e){Gh("Failed to send button press: ".concat(e)),ee.wsButton&&G({type:"ws_button_display",detail:t(t({},ee.wsButton),{isPressed:!1,timestamp:+new Date})})}),"disabled"===(null===(r=ee.wsButton)||void 0===r?void 0:r.pressBehavior)&&(G({type:"ws_button_display",detail:t(t({},ee.wsButton),{isDismissing:!0,timestamp:+new Date})}),setTimeout(function(){G({type:"ws_button_dismiss",detail:{id:e,timestamp:+new Date}})},300))}}),f.jsx(Fx,{isAdmin:null==jt?void 0:jt.isAdmin,isChatting:ee.isChatting,placeholder:null===(B=null==jt?void 0:jt.input)||void 0===B?void 0:B.placeholder,sendButtonIcon:null===(U=null===(z=null==jt?void 0:jt.footer)||void 0===z?void 0:z.sendButton)||void 0===U?void 0:U.icon,sendButtonIconHover:null===(q=null===(F=null==jt?void 0:jt.footer)||void 0===F?void 0:F.sendButton)||void 0===q?void 0:q.iconHover,sendButtonIconDisabled:null===(W=null===(H=null==jt?void 0:jt.footer)||void 0===H?void 0:H.sendButton)||void 0===W?void 0:W.iconDisabled,visible:Ke,hasWsButton:!!ee.wsButton,menuConfig:Fe,footerConfig:null===(V=e.config)||void 0===V?void 0:V.footer,inputConfig:null===($=e.config)||void 0===$?void 0:$.input,disabled:oe,onChange:ft,onSubmit:ht,onFileUpload:function(e){var t;if(e.preventDefault(),!oe){var n=null===(t=null==e?void 0:e.dataTransfer)||void 0===t?void 0:t.files[0];n&&X(function(e){return function(t){return function(n,r){var i=r();if("offline"!==i.accountStatus||i.isChatting){var o={mimeType:e.type,name:e.name,size:e.size,url:window.URL.createObjectURL(e)};t.sendFile(e,function(e){e&&Yh("Error sending file",e)}),n({type:"synthetic",detail:{type:"visitor.send.file",attachment:o,user:{nick:""},attributes:{currentUrl:window.location.href},timestamp:+new Date}})}}}}(n))}}}),f.jsx("div",{className:"restartModal",ref:te,onClick:vt,children:f.jsx(gS,{onClose:vt,onReset:mt})})]});return f.jsxs(f.Fragment,{children:[de?f.jsx("div",{className:"widget-anchor",ref:pe,children:De&&ue.createPortal($t,De)}):$t,!Ft||!zt||Re&&"button"===Ae?f.jsx(Nx,{addClass:Ke&&!Re?"visible":"",onClick:Re?Le:yt,config:ce,imageUrl:null===(J=null==jt?void 0:jt.chatButton)||void 0===J?void 0:J.imageUrl,visible:!Re&&Ke,hasInteracted:null===(Y=ee.visuals)||void 0===Y?void 0:Y.hasInteracted,onCtaDismiss:bt}):f.jsxs(f.Fragment,{children:[f.jsx(mx,{config:t(t({},zt),{cta:ob(null!==(K=zt.cta)&&void 0!==K?K:jt.cta,{hasConversation:le,arrivedViaChatLink:se})}),visible:!Re&&Ke,chatDisabled:jt.disabled,formDisabled:At,hasUserInteracted:null===(Q=ee.visuals)||void 0===Q?void 0:Q.hasInteracted,onChatClick:Re?Le:yt,onChatMinimize:gt,onFormClick:Et,onCtaDismiss:bt}),xt&&Ct&&f.jsx(qx,{config:Ct,widgetEnv:jt,onClose:Nt})]}),f.jsx(mS,{enableErrorOverlay:null==jt?void 0:jt.enableErrorOverlay})]})},NS=function(e){var n,r=null!==(n=e.mode)&&void 0!==n?n:"normal",i="preview"===r?"static":r;return!0===e.preview||"preview"===r?f.jsx(kS,t({},e,{mode:i})):f.jsx(SS,t({},e))},IS=function(e){var n=Kb(),r=t(t({},e),{messageMiddleware:n});return f.jsx(NS,t({},r))},TS=function(e){var n,r,i,o,a,s,l=Kb(),c=om(e.config),u=Z.useMemo(function(){var t,n,r,i,o;return _w({connection:c,userId:null===(t=e.config)||void 0===t?void 0:t.userId,accessToken:null===(n=e.config)||void 0===n?void 0:n.accessToken,attributes:null===(r=e.config)||void 0===r?void 0:r.attributes,sessionExpiration:null===(i=e.config)||void 0===i?void 0:i.sessionExpiration,enableErrorOverlay:null===(o=e.config)||void 0===o?void 0:o.enableErrorOverlay})},[c,null===(n=e.config)||void 0===n?void 0:n.userId,null===(r=e.config)||void 0===r?void 0:r.accessToken,null===(i=e.config)||void 0===i?void 0:i.attributes,null===(o=e.config)||void 0===o?void 0:o.sessionExpiration,null===(a=e.config)||void 0===a?void 0:a.enableErrorOverlay]);if(null===(s=e.config)||void 0===s?void 0:s.disabled)return f.jsx(f.Fragment,{});var d=t(t({},e),{messageMiddleware:l,getConfig:e.getConfig});return f.jsx(_h,{store:u,children:f.jsx(NS,t({},d))})},jS=function(e){var n,r=null!==(n=e.mode)&&void 0!==n?n:"normal";return!0===e.preview||"preview"===r?f.jsx(IS,t({},e)):f.jsx(TS,t({},e))};function OS(e){return e.split("-").map(function(e,t){return e.length?t?e[0].toUpperCase()+e.substring(1).toLowerCase():e.toLowerCase():""}).join("")}function PS(e){return Object.keys(e).reduce(function(t,n){var r=n,i="string";n.endsWith("-FLAG")?(r=n.substring(0,n.length-5),i="boolean"):n.endsWith("-MSEC")&&(r=n.substring(0,n.length-5),i="number");for(var o=r.split("_").map(OS),a=t;o.length>1;){var s=o.shift();"object"==typeof a&&(a[s]||(a[s]={}),a=a[s])}return"object"==typeof a&&(a[o.shift()]=function(e,t){return"string"===t?e:"boolean"===t?"TRUE"===e:"number"===t?parseFloat(e):e}(e[n],i)),t},{})}function AS(e,n){if(!n)return e;var r=t({},e);for(var o in n)if(n.hasOwnProperty(o)){var a=n[o],s=r[o];if(void 0===a)continue;null===a?r[o]=a:Array.isArray(a)?r[o]=i([],a,!0):"object"!=typeof a||Array.isArray(a)?r[o]=a:s&&"object"==typeof s&&!Array.isArray(s)?r[o]=AS(s,a):r[o]=t({},a)}return r}function RS(e){try{return localStorage.getItem(e)||void 0}catch(e){return}}function MS(){var e=RS(cg),t=RS(lg);if(!t){t=function(){var e=new Uint8Array(8);try{crypto.getRandomValues(e)}catch(t){e.forEach(function(t,n){return e[n]=Math.floor(256*Math.random())})}var t=Array.from(e,function(e){return e.toString(16).padStart(2,"0")}).join("");return"usr_".concat(Date.now().toString(36)).concat(t)}();try{localStorage.setItem(lg,t)}catch(e){}}return{sessionId:e,userId:t}}function LS(e){try{var n=Fv({mcp:e.disabled?void 0:e,notice:!0===e.agentNotice}).verdict;if(!Rv("chat"))return;var r="mcp"===im(e).type?MS():function(e){var t;try{var n=im(e),r="xappchat.".concat(n.serverUrl),i=RS(n.accountKey?"".concat(r,".").concat(n.accountKey):r);t=i?JSON.parse(i):void 0}catch(e){t=void 0}return{sessionId:"string"==typeof(null==t?void 0:t.sessionId)?t.sessionId:void 0,userId:"string"==typeof(null==t?void 0:t.userId)?t.userId:pw()}}(e),i=r.sessionId,o=r.userId,a=Av({pageUrl:window.location.href,referrer:document.referrer,nav:navigator,verdict:n,screen:window.screen,viewport:{width:window.innerWidth,height:window.innerHeight}});Uv({eventsUrl:zv(im(e).serverUrl),key:Xh().key||void 0,widgetType:"chat",metadata:t({sessionId:i||"unknown",userId:o},a)})}catch(e){}}var DS="{{INJECT}}";function BS(e){var t=e||DS;try{var n=JSON.parse(t),r=window.xaConfig||{};window.xaConfig=AS(n,r)}catch(e){t!==DS&&Gh("Chat Widget: injected config could not be parsed",{injected:t,error:e})}}function zS(){return n(this,arguments,void 0,function(e){var t;return void 0===e&&(e=1e4),r(this,function(n){switch(n.label){case 0:t=Date.now(),n.label=1;case 1:return FS(window)?[3,3]:Date.now()-t>e?(console.warn("[xapp-chat-widget] Timeout waiting for window.xaConfig"),[2,{}]):[4,new Promise(function(e){return setTimeout(e,50)})];case 2:return n.sent(),[3,1];case 3:return[2,window.xaConfig]}})})}function US(){var e=PS(process.env),n="true"===new URL(window.location.href).searchParams.get("isAdmin"),r=FS(window)?window.xaConfig:{};return t(t(t(t({},e),{isAdmin:n}),r),{attributes:t(t({},null==e?void 0:e.attributes),null==r?void 0:r.attributes)})}function FS(e){return!!e&&null!=e.xaConfig&&"object"==typeof e.xaConfig}var qS="chat-config-error";var HS=function(e){var t,n=e.env,r=function(){var e=Z.useState(!1),t=e[0],n=e[1];return Z.useEffect(function(){if(!document.getElementById("xapp-style")){var e=Xh(),t=document.createElement("link");t.id="xapp-style",t.href="".concat(e.path,"/xapp-chat-widget.css"),t.rel="stylesheet",document.head.appendChild(t),t.addEventListener("load",function(){n(!0)})}},[]),[t]}()[0];if(n.disabled)return f.jsx(f.Fragment,{});var i=n.mode,o=null===(t=window.xaConfig)||void 0===t?void 0:t.getConfig;return r?f.jsx(jS,{config:n,mode:i,getConfig:o}):f.jsx(f.Fragment,{})},WS=!1,VS=null;function $S(){return n(this,void 0,void 0,function(){var e,t,n;return r(this,function(r){switch(r.label){case 0:if(WS)return[2];WS=!0,r.label=1;case 1:return r.trys.push([1,,4,5]),BS(),FS(window)||window.xaSkipConfigWait?[3,3]:[4,zS()];case 2:r.sent(),r.label=3;case 3:return function(e,t){return void 0===t&&(t={}),!!(null==e?void 0:e.disabled)||!!t.hasAsyncConfigLoader||!!sm(e).serverUrl}(e=US(),{hasAsyncConfigLoader:!!(null===(n=window.xaConfig)||void 0===n?void 0:n.getConfig)})?((t=document.getElementById("xapp-widget"))||((t=document.createElement("div")).id="xapp-widget",document.body.appendChild(t)),VS||(VS=ah.createRoot(t)),VS.render(f.jsx(HS,{env:e})),LS(e),[3,5]):(Gh("Chat Widget: not rendering, the configuration has no server URL",function(e){var t=sm(e);return{serverUrl:t.serverUrl,accountKey:t.accountKey,connectionType:t.type}}(e)),function(){if("debug"===window.xaLogLevel&&!document.getElementById(qS)){var e=document.createElement("div");e.id=qS,e.textContent="Chat Load Error",e.style.cssText="\n position: fixed;\n bottom: 20px;\n right: 20px;\n background-color: #f44336;\n color: white;\n padding: 12px 16px;\n border-radius: 4px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 14px;\n font-weight: 500;\n z-index: 10000;\n box-shadow: 0 2px 8px rgba(0,0,0,0.2);\n transition: opacity ".concat(300,"ms ease-in-out;\n "),document.body.appendChild(e),setTimeout(function(){e.style.opacity="0",setTimeout(function(){return e.remove()},300)},2e3)}}(),[2]);case 4:return WS=!1,[7];case 5:return[2]}})})}return window.addEventListener("load",function(){$S()}),"complete"===document.readyState&&$S(),e.ChatMessagePart=mm,e.INJECT_PLACEHOLDER=DS,e.React=ee,e.injectConfig=BS,e.renderWidget=$S,e}({});
|
|
8
8
|
//# sourceMappingURL=xapp-chat-widget.js.map
|