@astermind/chatbot-template 2.2.30 → 2.2.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var AsterMindChatbot=function(e,t){"use strict";var n="undefined"!=typeof document?document.currentScript:null;function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a={exports:{}},o={},i=Symbol.for("react.element"),s=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.iterator;var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,w={};function k(e,t,n){this.props=e,this.context=t,this.refs=w,this.updater=n||v}function S(){}function x(e,t,n){this.props=e,this.context=t,this.refs=w,this.updater=n||v}k.prototype.isReactComponent={},k.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): 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")},k.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=k.prototype;var C=x.prototype=new S;C.constructor=x,b(C,k.prototype),C.isPureReactComponent=!0;var E=Array.isArray,_=Object.prototype.hasOwnProperty,M={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function A(e,t,n){var r,a={},o=null,s=null;if(null!=t)for(r in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(o=""+t.key),t)_.call(t,r)&&!R.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(1===l)a.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps)void 0===a[r]&&(a[r]=l[r]);return{$$typeof:i,type:e,key:o,ref:s,props:a,_owner:M.current}}function P(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var L=/\/+/g;function T(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function N(e,t,n,r,a){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var l=!1;if(null===e)l=!0;else switch(o){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case i:case s:l=!0}}if(l)return a=a(l=e),e=""===r?"."+T(l,0):r,E(a)?(n="",null!=e&&(n=e.replace(L,"$&/")+"/"),N(a,t,n,"",function(e){return e})):null!=a&&(P(a)&&(a=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(a,n+(!a.key||l&&l.key===a.key?"":(""+a.key).replace(L,"$&/")+"/")+e)),t.push(a)),1;if(l=0,r=""===r?".":r+":",E(e))for(var c=0;c<e.length;c++){var u=r+T(o=e[c],c);l+=N(o,t,n,u,a)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=y&&e[y]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(o=e.next()).done;)l+=N(o=o.value,t,n,u=r+T(o,c++),a);else if("object"===o)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 D(e,t,n){if(null==e)return e;var r=[],a=0;return N(e,r,"","",function(e){return t.call(n,e,a++)}),r}function I(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 z={current:null},F={transition:null},O={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:F,ReactCurrentOwner:M};function $(){throw Error("act(...) is not supported in production builds of React.")}o.Children={map:D,forEach:function(e,t,n){D(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return D(e,function(){t++}),t},toArray:function(e){return D(e,function(e){return e})||[]},only:function(e){if(!P(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},o.Component=k,o.Fragment=l,o.Profiler=u,o.PureComponent=x,o.StrictMode=c,o.Suspense=p,o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O,o.act=$,o.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=b({},e.props),a=e.key,o=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(o=t.ref,s=M.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)_.call(t,c)&&!R.hasOwnProperty(c)&&(r[c]=void 0===t[c]&&void 0!==l?l[c]:t[c])}var c=arguments.length-2;if(1===c)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:i,type:e.type,key:a,ref:o,props:r,_owner:s}},o.createContext=function(e){return(e={$$typeof:f,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:d,_context:e},e.Consumer=e},o.createElement=A,o.createFactory=function(e){var t=A.bind(null,e);return t.type=e,t},o.createRef=function(){return{current:null}},o.forwardRef=function(e){return{$$typeof:h,render:e}},o.isValidElement=P,o.lazy=function(e){return{$$typeof:g,_payload:{_status:-1,_result:e},_init:I}},o.memo=function(e,t){return{$$typeof:m,type:e,compare:void 0===t?null:t}},o.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},o.unstable_act=$,o.useCallback=function(e,t){return z.current.useCallback(e,t)},o.useContext=function(e){return z.current.useContext(e)},o.useDebugValue=function(){},o.useDeferredValue=function(e){return z.current.useDeferredValue(e)},o.useEffect=function(e,t){return z.current.useEffect(e,t)},o.useId=function(){return z.current.useId()},o.useImperativeHandle=function(e,t,n){return z.current.useImperativeHandle(e,t,n)},o.useInsertionEffect=function(e,t){return z.current.useInsertionEffect(e,t)},o.useLayoutEffect=function(e,t){return z.current.useLayoutEffect(e,t)},o.useMemo=function(e,t){return z.current.useMemo(e,t)},o.useReducer=function(e,t,n){return z.current.useReducer(e,t,n)},o.useRef=function(e){return z.current.useRef(e)},o.useState=function(e){return z.current.useState(e)},o.useSyncExternalStore=function(e,t,n){return z.current.useSyncExternalStore(e,t,n)},o.useTransition=function(){return z.current.useTransition()},o.version="18.3.1",a.exports=o;var j=a.exports,U=r(j),B={exports:{}},V={},W={exports:{}},H={};
1
+ var AsterMindChatbot=function(e){"use strict";var t="undefined"!=typeof document?document.currentScript:null;function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r={exports:{}},a={},o=Symbol.for("react.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.iterator;var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,b={};function w(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||y}function k(){}function S(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||y}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): 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")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},k.prototype=w.prototype;var x=S.prototype=new k;x.constructor=S,v(x,w.prototype),x.isPureReactComponent=!0;var C=Array.isArray,E=Object.prototype.hasOwnProperty,_={current:null},M={key:!0,ref:!0,__self:!0,__source:!0};function L(e,t,n){var r,a={},i=null,s=null;if(null!=t)for(r in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(i=""+t.key),t)E.call(t,r)&&!M.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(1===l)a.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps)void 0===a[r]&&(a[r]=l[r]);return{$$typeof:o,type:e,key:i,ref:s,props:a,_owner:_.current}}function R(e){return"object"==typeof e&&null!==e&&e.$$typeof===o}var A=/\/+/g;function P(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function N(e,t,n,r,a){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var l=!1;if(null===e)l=!0;else switch(s){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case o:case i:l=!0}}if(l)return a=a(l=e),e=""===r?"."+P(l,0):r,C(a)?(n="",null!=e&&(n=e.replace(A,"$&/")+"/"),N(a,t,n,"",function(e){return e})):null!=a&&(R(a)&&(a=function(e,t){return{$$typeof:o,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(a,n+(!a.key||l&&l.key===a.key?"":(""+a.key).replace(A,"$&/")+"/")+e)),t.push(a)),1;if(l=0,r=""===r?".":r+":",C(e))for(var c=0;c<e.length;c++){var u=r+P(s=e[c],c);l+=N(s,t,n,u,a)}else if(u=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=g&&e[g]||e["@@iterator"])?e:null}(e),"function"==typeof u)for(e=u.call(e),c=0;!(s=e.next()).done;)l+=N(s=s.value,t,n,u=r+P(s,c++),a);else if("object"===s)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 D(e,t,n){if(null==e)return e;var r=[],a=0;return N(e,r,"","",function(e){return t.call(n,e,a++)}),r}function T(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 I={current:null},z={transition:null},F={ReactCurrentDispatcher:I,ReactCurrentBatchConfig:z,ReactCurrentOwner:_};function O(){throw Error("act(...) is not supported in production builds of React.")}a.Children={map:D,forEach:function(e,t,n){D(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return D(e,function(){t++}),t},toArray:function(e){return D(e,function(e){return e})||[]},only:function(e){if(!R(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},a.Component=w,a.Fragment=s,a.Profiler=c,a.PureComponent=S,a.StrictMode=l,a.Suspense=h,a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,a.act=O,a.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=v({},e.props),a=e.key,i=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,s=_.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)E.call(t,c)&&!M.hasOwnProperty(c)&&(r[c]=void 0===t[c]&&void 0!==l?l[c]:t[c])}var c=arguments.length-2;if(1===c)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:o,type:e.type,key:a,ref:i,props:r,_owner:s}},a.createContext=function(e){return(e={$$typeof:d,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:u,_context:e},e.Consumer=e},a.createElement=L,a.createFactory=function(e){var t=L.bind(null,e);return t.type=e,t},a.createRef=function(){return{current:null}},a.forwardRef=function(e){return{$$typeof:f,render:e}},a.isValidElement=R,a.lazy=function(e){return{$$typeof:m,_payload:{_status:-1,_result:e},_init:T}},a.memo=function(e,t){return{$$typeof:p,type:e,compare:void 0===t?null:t}},a.startTransition=function(e){var t=z.transition;z.transition={};try{e()}finally{z.transition=t}},a.unstable_act=O,a.useCallback=function(e,t){return I.current.useCallback(e,t)},a.useContext=function(e){return I.current.useContext(e)},a.useDebugValue=function(){},a.useDeferredValue=function(e){return I.current.useDeferredValue(e)},a.useEffect=function(e,t){return I.current.useEffect(e,t)},a.useId=function(){return I.current.useId()},a.useImperativeHandle=function(e,t,n){return I.current.useImperativeHandle(e,t,n)},a.useInsertionEffect=function(e,t){return I.current.useInsertionEffect(e,t)},a.useLayoutEffect=function(e,t){return I.current.useLayoutEffect(e,t)},a.useMemo=function(e,t){return I.current.useMemo(e,t)},a.useReducer=function(e,t,n){return I.current.useReducer(e,t,n)},a.useRef=function(e){return I.current.useRef(e)},a.useState=function(e){return I.current.useState(e)},a.useSyncExternalStore=function(e,t,n){return I.current.useSyncExternalStore(e,t,n)},a.useTransition=function(){return I.current.useTransition()},a.version="18.3.1",r.exports=a;var $=r.exports,j=n($),U={exports:{}},B={},V={exports:{}},W={};
2
2
  /**
3
3
  * @license React
4
4
  * scheduler.production.min.js
@@ -8,7 +8,7 @@ var AsterMindChatbot=function(e,t){"use strict";var n="undefined"!=typeof docume
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  */
11
- !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<a(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,i=o>>>1;r<i;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>a(l,n))c<o&&0>a(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<o&&0>a(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,s=i.now();e.unstable_now=function(){return i.now()-s}}var l=[],c=[],u=1,d=null,f=3,h=!1,p=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var a=n(c);null!==a;){if(null===a.callback)r(c);else{if(!(a.startTime<=e))break;r(c),a.sortIndex=a.expirationTime,t(l,a)}a=n(c)}}function w(e){if(m=!1,b(e),!p)if(null!==n(l))p=!0,T(k);else{var t=n(c);null!==t&&N(w,t.startTime-e)}}function k(t,a){p=!1,m&&(m=!1,y(E),E=-1),h=!0;var o=f;try{for(b(a),d=n(l);null!==d&&(!(d.expirationTime>a)||t&&!R());){var i=d.callback;if("function"==typeof i){d.callback=null,f=d.priorityLevel;var s=i(d.expirationTime<=a);a=e.unstable_now(),"function"==typeof s?d.callback=s:d===n(l)&&r(l),b(a)}else r(l);d=n(l)}if(null!==d)var u=!0;else{var g=n(c);null!==g&&N(w,g.startTime-a),u=!1}return u}finally{d=null,f=o,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,x=!1,C=null,E=-1,_=5,M=-1;function R(){return!(e.unstable_now()-M<_)}function A(){if(null!==C){var t=e.unstable_now();M=t;var n=!0;try{n=C(!0,t)}finally{n?S():(x=!1,C=null)}}else x=!1}if("function"==typeof v)S=function(){v(A)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,L=P.port2;P.port1.onmessage=A,S=function(){L.postMessage(null)}}else S=function(){g(A,0)};function T(e){C=e,x||(x=!0,S())}function N(t,n){E=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_continueExecution=function(){p||h||(p=!0,T(k))},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_getFirstCallbackNode=function(){return n(l)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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,a,o){var i=e.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?i+o:i:o=i,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:a,priorityLevel:r,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>i?(r.sortIndex=o,t(c,r),null===n(l)&&r===n(c)&&(m?(y(E),E=-1):m=!0,N(w,o-i))):(r.sortIndex=s,t(l,r),p||h||(p=!0,T(k))),r},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(H),W.exports=H;var K=W.exports,q=j,G=K;
11
+ !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<a(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,i=o>>>1;r<i;){var s=2*(r+1)-1,l=e[s],c=s+1,u=e[c];if(0>a(l,n))c<o&&0>a(u,l)?(e[r]=u,e[c]=n,r=c):(e[r]=l,e[s]=n,r=s);else{if(!(c<o&&0>a(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,s=i.now();e.unstable_now=function(){return i.now()-s}}var l=[],c=[],u=1,d=null,f=3,h=!1,p=!1,m=!1,g="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function b(e){for(var a=n(c);null!==a;){if(null===a.callback)r(c);else{if(!(a.startTime<=e))break;r(c),a.sortIndex=a.expirationTime,t(l,a)}a=n(c)}}function w(e){if(m=!1,b(e),!p)if(null!==n(l))p=!0,N(k);else{var t=n(c);null!==t&&D(w,t.startTime-e)}}function k(t,a){p=!1,m&&(m=!1,y(E),E=-1),h=!0;var o=f;try{for(b(a),d=n(l);null!==d&&(!(d.expirationTime>a)||t&&!L());){var i=d.callback;if("function"==typeof i){d.callback=null,f=d.priorityLevel;var s=i(d.expirationTime<=a);a=e.unstable_now(),"function"==typeof s?d.callback=s:d===n(l)&&r(l),b(a)}else r(l);d=n(l)}if(null!==d)var u=!0;else{var g=n(c);null!==g&&D(w,g.startTime-a),u=!1}return u}finally{d=null,f=o,h=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,x=!1,C=null,E=-1,_=5,M=-1;function L(){return!(e.unstable_now()-M<_)}function R(){if(null!==C){var t=e.unstable_now();M=t;var n=!0;try{n=C(!0,t)}finally{n?S():(x=!1,C=null)}}else x=!1}if("function"==typeof v)S=function(){v(R)};else if("undefined"!=typeof MessageChannel){var A=new MessageChannel,P=A.port2;A.port1.onmessage=R,S=function(){P.postMessage(null)}}else S=function(){g(R,0)};function N(e){C=e,x||(x=!0,S())}function D(t,n){E=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_continueExecution=function(){p||h||(p=!0,N(k))},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_getFirstCallbackNode=function(){return n(l)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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,a,o){var i=e.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?i+o:i:o=i,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:a,priorityLevel:r,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>i?(r.sortIndex=o,t(c,r),null===n(l)&&r===n(c)&&(m?(y(E),E=-1):m=!0,D(w,o-i))):(r.sortIndex=s,t(l,r),p||h||(p=!0,N(k))),r},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}(W),V.exports=W;var H=V.exports,K=$,q=H;
12
12
  /**
13
13
  * @license React
14
14
  * react-dom.production.min.js
@@ -17,5 +17,5 @@ var AsterMindChatbot=function(e,t){"use strict";var n="undefined"!=typeof docume
17
17
  *
18
18
  * This source code is licensed under the MIT license found in the
19
19
  * LICENSE file in the root directory of this source tree.
20
- */function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;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."}var Y=new Set,X={};function J(e,t){Z(e,t),Z(e+"Capture",t)}function Z(e,t){for(X[e]=t,e=0;e<t.length;e++)Y.add(t[e])}var ee=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),te=Object.prototype.hasOwnProperty,ne=/^[: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]*$/,re={},ae={};function oe(e,t,n,r,a,o,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ie[e]=new oe(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ie[t]=new oe(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){ie[e]=new oe(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ie[e]=new oe(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ie[e]=new oe(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){ie[e]=new oe(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){ie[e]=new oe(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){ie[e]=new oe(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){ie[e]=new oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var se=/[\-:]([a-z])/g;function le(e){return e[1].toUpperCase()}function ce(e,t,n,r){var a=ie.hasOwnProperty(t)?ie[t]:null;(null!==a?0!==a.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,a,r)&&(n=null),r||null===a?function(e){return!!te.call(ae,e)||!te.call(re,e)&&(ne.test(e)?ae[e]=!0:(re[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=null===n?3!==a.type&&"":n:(t=a.attributeName,r=a.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(a=a.type)||4===a&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(se,le);ie[t]=new oe(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(se,le);ie[t]=new oe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(se,le);ie[t]=new oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){ie[e]=new oe(e,1,!1,e.toLowerCase(),null,!1,!1)}),ie.xlinkHref=new oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){ie[e]=new oe(e,1,!1,e.toLowerCase(),null,!0,!0)});var ue=q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,de=Symbol.for("react.element"),fe=Symbol.for("react.portal"),he=Symbol.for("react.fragment"),pe=Symbol.for("react.strict_mode"),me=Symbol.for("react.profiler"),ge=Symbol.for("react.provider"),ye=Symbol.for("react.context"),ve=Symbol.for("react.forward_ref"),be=Symbol.for("react.suspense"),we=Symbol.for("react.suspense_list"),ke=Symbol.for("react.memo"),Se=Symbol.for("react.lazy"),xe=Symbol.for("react.offscreen"),Ce=Symbol.iterator;function Ee(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=Ce&&e[Ce]||e["@@iterator"])?e:null}var _e,Me=Object.assign;function Re(e){if(void 0===_e)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||""}return"\n"+_e+e}var Ae=!1;function Pe(e,t){if(!e||Ae)return"";Ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var a=t.stack.split("\n"),o=r.stack.split("\n"),i=a.length-1,s=o.length-1;1<=i&&0<=s&&a[i]!==o[s];)s--;for(;1<=i&&0<=s;i--,s--)if(a[i]!==o[s]){if(1!==i||1!==s)do{if(i--,0>--s||a[i]!==o[s]){var l="\n"+a[i].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=i&&0<=s);break}}}finally{Ae=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Re(e):""}function Le(e){switch(e.tag){case 5:return Re(e.type);case 16:return Re("Lazy");case 13:return Re("Suspense");case 19:return Re("SuspenseList");case 0:case 2:case 15:return e=Pe(e.type,!1);case 11:return e=Pe(e.type.render,!1);case 1:return e=Pe(e.type,!0);default:return""}}function Te(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case he:return"Fragment";case fe:return"Portal";case me:return"Profiler";case pe:return"StrictMode";case be:return"Suspense";case we:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ye:return(e.displayName||"Context")+".Consumer";case ge:return(e._context.displayName||"Context")+".Provider";case ve:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ke:return null!==(t=e.displayName||null)?t:Te(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return Te(e(t))}catch(e){}}return null}function Ne(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Te(t);case 8:return t===pe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function De(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function Ie(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ze(e){e._valueTracker||(e._valueTracker=function(e){var t=Ie(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Fe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ie(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Oe(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}}function $e(e,t){var n=t.checked;return Me({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function je(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=De(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Ue(e,t){null!=(t=t.checked)&&ce(e,"checked",t,!1)}function Be(e,t){Ue(e,t);var n=De(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?We(e,t.type,n):t.hasOwnProperty("defaultValue")&&We(e,t.type,De(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Ve(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function We(e,t,n){"number"===t&&Oe(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var He=Array.isArray;function Ke(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+De(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function qe(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(Q(91));return Me({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ge(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(Q(92));if(He(n)){if(1<n.length)throw Error(Q(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:De(n)}}function Qe(e,t){var n=De(t.value),r=De(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function Ye(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function Xe(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Je(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Xe(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var Ze,et,tt=(et=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((Ze=Ze||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ze.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return et(e,t)})}:et);function nt(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 rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},at=["Webkit","ms","Moz","O"];function ot(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||rt.hasOwnProperty(e)&&rt[e]?(""+t).trim():t+"px"}function it(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),a=ot(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}Object.keys(rt).forEach(function(e){at.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),rt[t]=rt[e]})});var st=Me({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function lt(e,t){if(t){if(st[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(Q(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(Q(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(Q(62))}}function ct(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;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 ut=null;function dt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var ft=null,ht=null,pt=null;function mt(e){if(e=co(e)){if("function"!=typeof ft)throw Error(Q(280));var t=e.stateNode;t&&(t=fo(t),ft(e.stateNode,e.type,t))}}function gt(e){ht?pt?pt.push(e):pt=[e]:ht=e}function yt(){if(ht){var e=ht,t=pt;if(pt=ht=null,mt(e),t)for(e=0;e<t.length;e++)mt(t[e])}}function vt(e,t){return e(t)}function bt(){}var wt=!1;function kt(e,t,n){if(wt)return e(t,n);wt=!0;try{return vt(e,t,n)}finally{wt=!1,(null!==ht||null!==pt)&&(bt(),yt())}}function St(e,t){var n=e.stateNode;if(null===n)return null;var r=fo(n);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(Q(231,t,typeof n));return n}var xt=!1;if(ee)try{var Ct={};Object.defineProperty(Ct,"passive",{get:function(){xt=!0}}),window.addEventListener("test",Ct,Ct),window.removeEventListener("test",Ct,Ct)}catch(et){xt=!1}function Et(e,t,n,r,a,o,i,s,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(e){this.onError(e)}}var _t=!1,Mt=null,Rt=!1,At=null,Pt={onError:function(e){_t=!0,Mt=e}};function Lt(e,t,n,r,a,o,i,s,l){_t=!1,Mt=null,Et.apply(Pt,arguments)}function Tt(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 Nt(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 Dt(e){if(Tt(e)!==e)throw Error(Q(188))}function It(e){return e=function(e){var t=e.alternate;if(!t){if(null===(t=Tt(e)))throw Error(Q(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return Dt(a),e;if(o===r)return Dt(a),t;o=o.sibling}throw Error(Q(188))}if(n.return!==r.return)n=a,r=o;else{for(var i=!1,s=a.child;s;){if(s===n){i=!0,n=a,r=o;break}if(s===r){i=!0,r=a,n=o;break}s=s.sibling}if(!i){for(s=o.child;s;){if(s===n){i=!0,n=o,r=a;break}if(s===r){i=!0,r=o,n=a;break}s=s.sibling}if(!i)throw Error(Q(189))}}if(n.alternate!==r)throw Error(Q(190))}if(3!==n.tag)throw Error(Q(188));return n.stateNode.current===n?e:t}(e),null!==e?zt(e):null}function zt(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=zt(e);if(null!==t)return t;e=e.sibling}return null}var Ft=G.unstable_scheduleCallback,Ot=G.unstable_cancelCallback,$t=G.unstable_shouldYield,jt=G.unstable_requestPaint,Ut=G.unstable_now,Bt=G.unstable_getCurrentPriorityLevel,Vt=G.unstable_ImmediatePriority,Wt=G.unstable_UserBlockingPriority,Ht=G.unstable_NormalPriority,Kt=G.unstable_LowPriority,qt=G.unstable_IdlePriority,Gt=null,Qt=null;var Yt=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(Xt(e)/Jt|0)|0},Xt=Math.log,Jt=Math.LN2;var Zt=64,en=4194304;function tn(e){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: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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nn(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,a=e.suspendedLanes,o=e.pingedLanes,i=268435455&n;if(0!==i){var s=i&~a;0!==s?r=tn(s):0!==(o&=i)&&(r=tn(o))}else 0!==(i=n&~a)?r=tn(i):0!==o&&(r=tn(o));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&a)&&((a=r&-r)>=(o=t&-t)||16===a&&4194240&o))return t;if(4&r&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)a=1<<(n=31-Yt(t)),r|=e[n],t&=~a;return r}function rn(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 an(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function on(){var e=Zt;return!(4194240&(Zt<<=1))&&(Zt=64),e}function sn(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ln(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-Yt(t)]=n}function cn(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Yt(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var un=0;function dn(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var fn,hn,pn,mn,gn,yn=!1,vn=[],bn=null,wn=null,kn=null,Sn=new Map,xn=new Map,Cn=[],En="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 submit".split(" ");function _n(e,t){switch(e){case"focusin":case"focusout":bn=null;break;case"dragenter":case"dragleave":wn=null;break;case"mouseover":case"mouseout":kn=null;break;case"pointerover":case"pointerout":Sn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":xn.delete(t.pointerId)}}function Mn(e,t,n,r,a,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},null!==t&&(null!==(t=co(t))&&hn(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function Rn(e){var t=lo(e.target);if(null!==t){var n=Tt(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Nt(n)))return e.blockedOn=t,void gn(e.priority,function(){pn(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 An(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=jn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=co(n))&&hn(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);ut=r,n.target.dispatchEvent(r),ut=null,t.shift()}return!0}function Pn(e,t,n){An(e)&&n.delete(t)}function Ln(){yn=!1,null!==bn&&An(bn)&&(bn=null),null!==wn&&An(wn)&&(wn=null),null!==kn&&An(kn)&&(kn=null),Sn.forEach(Pn),xn.forEach(Pn)}function Tn(e,t){e.blockedOn===t&&(e.blockedOn=null,yn||(yn=!0,G.unstable_scheduleCallback(G.unstable_NormalPriority,Ln)))}function Nn(e){function t(t){return Tn(t,e)}if(0<vn.length){Tn(vn[0],e);for(var n=1;n<vn.length;n++){var r=vn[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==bn&&Tn(bn,e),null!==wn&&Tn(wn,e),null!==kn&&Tn(kn,e),Sn.forEach(t),xn.forEach(t),n=0;n<Cn.length;n++)(r=Cn[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Cn.length&&null===(n=Cn[0]).blockedOn;)Rn(n),null===n.blockedOn&&Cn.shift()}var Dn=ue.ReactCurrentBatchConfig,In=!0;function zn(e,t,n,r){var a=un,o=Dn.transition;Dn.transition=null;try{un=1,On(e,t,n,r)}finally{un=a,Dn.transition=o}}function Fn(e,t,n,r){var a=un,o=Dn.transition;Dn.transition=null;try{un=4,On(e,t,n,r)}finally{un=a,Dn.transition=o}}function On(e,t,n,r){if(In){var a=jn(e,t,n,r);if(null===a)Da(e,t,r,$n,n),_n(e,r);else if(function(e,t,n,r,a){switch(t){case"focusin":return bn=Mn(bn,e,t,n,r,a),!0;case"dragenter":return wn=Mn(wn,e,t,n,r,a),!0;case"mouseover":return kn=Mn(kn,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return Sn.set(o,Mn(Sn.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,xn.set(o,Mn(xn.get(o)||null,e,t,n,r,a)),!0}return!1}(a,e,t,n,r))r.stopPropagation();else if(_n(e,r),4&t&&-1<En.indexOf(e)){for(;null!==a;){var o=co(a);if(null!==o&&fn(o),null===(o=jn(e,t,n,r))&&Da(e,t,r,$n,n),o===a)break;a=o}null!==a&&r.stopPropagation()}else Da(e,t,r,null,n)}}var $n=null;function jn(e,t,n,r){if($n=null,null!==(e=lo(e=dt(r))))if(null===(t=Tt(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=Nt(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 $n=e,null}function Un(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Bt()){case Vt:return 1;case Wt:return 4;case Ht:case Kt:return 16;case qt:return 536870912;default:return 16}default:return 16}}var Bn=null,Vn=null,Wn=null;function Hn(){if(Wn)return Wn;var e,t,n=Vn,r=n.length,a="value"in Bn?Bn.value:Bn.textContent,o=a.length;for(e=0;e<r&&n[e]===a[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===a[o-t];t++);return Wn=a.slice(e,1<t?1-t:void 0)}function Kn(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 qn(){return!0}function Gn(){return!1}function Qn(e){function t(t,n,r,a,o){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(a):a[i]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?qn:Gn,this.isPropagationStopped=Gn,this}return Me(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=qn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=qn)},persist:function(){},isPersistent:qn}),t}var Yn,Xn,Jn,Zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},er=Qn(Zn),tr=Me({},Zn,{view:0,detail:0}),nr=Qn(tr),rr=Me({},tr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mr,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!==Jn&&(Jn&&"mousemove"===e.type?(Yn=e.screenX-Jn.screenX,Xn=e.screenY-Jn.screenY):Xn=Yn=0,Jn=e),Yn)},movementY:function(e){return"movementY"in e?e.movementY:Xn}}),ar=Qn(rr),or=Qn(Me({},rr,{dataTransfer:0})),ir=Qn(Me({},tr,{relatedTarget:0})),sr=Qn(Me({},Zn,{animationName:0,elapsedTime:0,pseudoElement:0})),lr=Me({},Zn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),cr=Qn(lr),ur=Qn(Me({},Zn,{data:0})),dr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fr={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"},hr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=hr[e])&&!!t[e]}function mr(){return pr}var gr=Me({},tr,{key:function(e){if(e.key){var t=dr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Kn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?fr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mr,charCode:function(e){return"keypress"===e.type?Kn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Kn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),yr=Qn(gr),vr=Qn(Me({},rr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),br=Qn(Me({},tr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mr})),wr=Qn(Me({},Zn,{propertyName:0,elapsedTime:0,pseudoElement:0})),kr=Me({},rr,{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}),Sr=Qn(kr),xr=[9,13,27,32],Cr=ee&&"CompositionEvent"in window,Er=null;ee&&"documentMode"in document&&(Er=document.documentMode);var _r=ee&&"TextEvent"in window&&!Er,Mr=ee&&(!Cr||Er&&8<Er&&11>=Er),Rr=String.fromCharCode(32),Ar=!1;function Pr(e,t){switch(e){case"keyup":return-1!==xr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lr(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Tr=!1;var Nr={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 Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Nr[e.type]:"textarea"===t}function Ir(e,t,n,r){gt(r),0<(t=za(t,"onChange")).length&&(n=new er("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var zr=null,Fr=null;function Or(e){Ra(e,0)}function $r(e){if(Fe(uo(e)))return e}function jr(e,t){if("change"===e)return t}var Ur=!1;if(ee){var Br;if(ee){var Vr="oninput"in document;if(!Vr){var Wr=document.createElement("div");Wr.setAttribute("oninput","return;"),Vr="function"==typeof Wr.oninput}Br=Vr}else Br=!1;Ur=Br&&(!document.documentMode||9<document.documentMode)}function Hr(){zr&&(zr.detachEvent("onpropertychange",Kr),Fr=zr=null)}function Kr(e){if("value"===e.propertyName&&$r(Fr)){var t=[];Ir(t,Fr,e,dt(e)),kt(Or,t)}}function qr(e,t,n){"focusin"===e?(Hr(),Fr=n,(zr=t).attachEvent("onpropertychange",Kr)):"focusout"===e&&Hr()}function Gr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return $r(Fr)}function Qr(e,t){if("click"===e)return $r(t)}function Yr(e,t){if("input"===e||"change"===e)return $r(t)}var Xr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function Jr(e,t){if(Xr(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 a=n[r];if(!te.call(t,a)||!Xr(e[a],t[a]))return!1}return!0}function Zr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ea(e,t){var n,r=Zr(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=Zr(r)}}function ta(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ta(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function na(){for(var e=window,t=Oe();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Oe((e=t.contentWindow).document)}return t}function ra(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)}function aa(e){var t=na(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ta(n.ownerDocument.documentElement,n)){if(null!==r&&ra(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var a=n.textContent.length,o=Math.min(r.start,a);r=void 0===r.end?o:Math.min(r.end,a),!e.extend&&o>r&&(a=r,r=o,o=a),a=ea(n,o);var i=ea(n,r);a&&i&&(1!==e.rangeCount||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&((t=t.createRange()).setStart(a.node,a.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var oa=ee&&"documentMode"in document&&11>=document.documentMode,ia=null,sa=null,la=null,ca=!1;function ua(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;ca||null==ia||ia!==Oe(r)||("selectionStart"in(r=ia)&&ra(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},la&&Jr(la,r)||(la=r,0<(r=za(sa,"onSelect")).length&&(t=new er("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=ia)))}function da(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var fa={animationend:da("Animation","AnimationEnd"),animationiteration:da("Animation","AnimationIteration"),animationstart:da("Animation","AnimationStart"),transitionend:da("Transition","TransitionEnd")},ha={},pa={};function ma(e){if(ha[e])return ha[e];if(!fa[e])return e;var t,n=fa[e];for(t in n)if(n.hasOwnProperty(t)&&t in pa)return ha[e]=n[t];return e}ee&&(pa=document.createElement("div").style,"AnimationEvent"in window||(delete fa.animationend.animation,delete fa.animationiteration.animation,delete fa.animationstart.animation),"TransitionEvent"in window||delete fa.transitionend.transition);var ga=ma("animationend"),ya=ma("animationiteration"),va=ma("animationstart"),ba=ma("transitionend"),wa=new Map,ka="abort auxClick 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 Sa(e,t){wa.set(e,t),J(t,[e])}for(var xa=0;xa<ka.length;xa++){var Ca=ka[xa];Sa(Ca.toLowerCase(),"on"+(Ca[0].toUpperCase()+Ca.slice(1)))}Sa(ga,"onAnimationEnd"),Sa(ya,"onAnimationIteration"),Sa(va,"onAnimationStart"),Sa("dblclick","onDoubleClick"),Sa("focusin","onFocus"),Sa("focusout","onBlur"),Sa(ba,"onTransitionEnd"),Z("onMouseEnter",["mouseout","mouseover"]),Z("onMouseLeave",["mouseout","mouseover"]),Z("onPointerEnter",["pointerout","pointerover"]),Z("onPointerLeave",["pointerout","pointerover"]),J("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),J("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),J("onBeforeInput",["compositionend","keypress","textInput","paste"]),J("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),J("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),J("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ea="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(" "),_a=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ea));function Ma(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,a,o,i,s,l){if(Lt.apply(this,arguments),_t){if(!_t)throw Error(Q(198));var c=Mt;_t=!1,Mt=null,Rt||(Rt=!0,At=c)}}(r,t,void 0,e),e.currentTarget=null}function Ra(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var s=r[i],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==o&&a.isPropagationStopped())break e;Ma(a,s,c),o=l}else for(i=0;i<r.length;i++){if(l=(s=r[i]).instance,c=s.currentTarget,s=s.listener,l!==o&&a.isPropagationStopped())break e;Ma(a,s,c),o=l}}}if(Rt)throw e=At,Rt=!1,At=null,e}function Aa(e,t){var n=t[oo];void 0===n&&(n=t[oo]=new Set);var r=e+"__bubble";n.has(r)||(Na(t,e,2,!1),n.add(r))}function Pa(e,t,n){var r=0;t&&(r|=4),Na(n,e,r,t)}var La="_reactListening"+Math.random().toString(36).slice(2);function Ta(e){if(!e[La]){e[La]=!0,Y.forEach(function(t){"selectionchange"!==t&&(_a.has(t)||Pa(t,!1,e),Pa(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[La]||(t[La]=!0,Pa("selectionchange",!1,t))}}function Na(e,t,n,r){switch(Un(t)){case 1:var a=zn;break;case 4:a=Fn;break;default:a=On}n=a.bind(null,t,n,e),a=void 0,!xt||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Da(e,t,n,r,a){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var s=r.stateNode.containerInfo;if(s===a||8===s.nodeType&&s.parentNode===a)break;if(4===i)for(i=r.return;null!==i;){var l=i.tag;if((3===l||4===l)&&((l=i.stateNode.containerInfo)===a||8===l.nodeType&&l.parentNode===a))return;i=i.return}for(;null!==s;){if(null===(i=lo(s)))return;if(5===(l=i.tag)||6===l){r=o=i;continue e}s=s.parentNode}}r=r.return}kt(function(){var r=o,a=dt(n),i=[];e:{var s=wa.get(e);if(void 0!==s){var l=er,c=e;switch(e){case"keypress":if(0===Kn(n))break e;case"keydown":case"keyup":l=yr;break;case"focusin":c="focus",l=ir;break;case"focusout":c="blur",l=ir;break;case"beforeblur":case"afterblur":l=ir;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=ar;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=or;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=br;break;case ga:case ya:case va:l=sr;break;case ba:l=wr;break;case"scroll":l=nr;break;case"wheel":l=Sr;break;case"copy":case"cut":case"paste":l=cr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=vr}var u=!!(4&t),d=!u&&"scroll"===e,f=u?null!==s?s+"Capture":null:s;u=[];for(var h,p=r;null!==p;){var m=(h=p).stateNode;if(5===h.tag&&null!==m&&(h=m,null!==f&&(null!=(m=St(p,f))&&u.push(Ia(p,m,h)))),d)break;p=p.return}0<u.length&&(s=new l(s,c,null,n,a),i.push({event:s,listeners:u}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===ut||!(c=n.relatedTarget||n.fromElement)||!lo(c)&&!c[ao])&&(l||s)&&(s=a.window===a?a:(s=a.ownerDocument)?s.defaultView||s.parentWindow:window,l?(l=r,null!==(c=(c=n.relatedTarget||n.toElement)?lo(c):null)&&(c!==(d=Tt(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=r),l!==c)){if(u=ar,m="onMouseLeave",f="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=vr,m="onPointerLeave",f="onPointerEnter",p="pointer"),d=null==l?s:uo(l),h=null==c?s:uo(c),(s=new u(m,p+"leave",l,n,a)).target=d,s.relatedTarget=h,m=null,lo(a)===r&&((u=new u(f,p+"enter",c,n,a)).target=h,u.relatedTarget=d,m=u),d=m,l&&c)e:{for(f=c,p=0,h=u=l;h;h=Fa(h))p++;for(h=0,m=f;m;m=Fa(m))h++;for(;0<p-h;)u=Fa(u),p--;for(;0<h-p;)f=Fa(f),h--;for(;p--;){if(u===f||null!==f&&u===f.alternate)break e;u=Fa(u),f=Fa(f)}u=null}else u=null;null!==l&&Oa(i,s,l,u,!1),null!==c&&null!==d&&Oa(i,d,c,u,!0)}if("select"===(l=(s=r?uo(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===l&&"file"===s.type)var g=jr;else if(Dr(s))if(Ur)g=Yr;else{g=Gr;var y=qr}else(l=s.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===s.type||"radio"===s.type)&&(g=Qr);switch(g&&(g=g(e,r))?Ir(i,g,n,a):(y&&y(e,s,r),"focusout"===e&&(y=s._wrapperState)&&y.controlled&&"number"===s.type&&We(s,"number",s.value)),y=r?uo(r):window,e){case"focusin":(Dr(y)||"true"===y.contentEditable)&&(ia=y,sa=r,la=null);break;case"focusout":la=sa=ia=null;break;case"mousedown":ca=!0;break;case"contextmenu":case"mouseup":case"dragend":ca=!1,ua(i,n,a);break;case"selectionchange":if(oa)break;case"keydown":case"keyup":ua(i,n,a)}var v;if(Cr)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Tr?Pr(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(Mr&&"ko"!==n.locale&&(Tr||"onCompositionStart"!==b?"onCompositionEnd"===b&&Tr&&(v=Hn()):(Vn="value"in(Bn=a)?Bn.value:Bn.textContent,Tr=!0)),0<(y=za(r,b)).length&&(b=new ur(b,e,null,n,a),i.push({event:b,listeners:y}),v?b.data=v:null!==(v=Lr(n))&&(b.data=v))),(v=_r?function(e,t){switch(e){case"compositionend":return Lr(t);case"keypress":return 32!==t.which?null:(Ar=!0,Rr);case"textInput":return(e=t.data)===Rr&&Ar?null:e;default:return null}}(e,n):function(e,t){if(Tr)return"compositionend"===e||!Cr&&Pr(e,t)?(e=Hn(),Wn=Vn=Bn=null,Tr=!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 Mr&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=za(r,"onBeforeInput")).length&&(a=new ur("onBeforeInput","beforeinput",null,n,a),i.push({event:a,listeners:r}),a.data=v))}Ra(i,t)})}function Ia(e,t,n){return{instance:e,listener:t,currentTarget:n}}function za(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,o=a.stateNode;5===a.tag&&null!==o&&(a=o,null!=(o=St(e,n))&&r.unshift(Ia(e,o,a)),null!=(o=St(e,t))&&r.push(Ia(e,o,a))),e=e.return}return r}function Fa(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Oa(e,t,n,r,a){for(var o=t._reactName,i=[];null!==n&&n!==r;){var s=n,l=s.alternate,c=s.stateNode;if(null!==l&&l===r)break;5===s.tag&&null!==c&&(s=c,a?null!=(l=St(n,o))&&i.unshift(Ia(n,l,s)):a||null!=(l=St(n,o))&&i.push(Ia(n,l,s))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}var $a=/\r\n?/g,ja=/\u0000|\uFFFD/g;function Ua(e){return("string"==typeof e?e:""+e).replace($a,"\n").replace(ja,"")}function Ba(e,t,n){if(t=Ua(t),Ua(e)!==t&&n)throw Error(Q(425))}function Va(){}var Wa=null,Ha=null;function Ka(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var qa="function"==typeof setTimeout?setTimeout:void 0,Ga="function"==typeof clearTimeout?clearTimeout:void 0,Qa="function"==typeof Promise?Promise:void 0,Ya="function"==typeof queueMicrotask?queueMicrotask:void 0!==Qa?function(e){return Qa.resolve(null).then(e).catch(Xa)}:qa;function Xa(e){setTimeout(function(){throw e})}function Ja(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&8===a.nodeType)if("/$"===(n=a.data)){if(0===r)return e.removeChild(a),void Nn(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=a}while(n);Nn(t)}function Za(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)break;if("/$"===t)return null}}return e}function eo(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var to=Math.random().toString(36).slice(2),no="__reactFiber$"+to,ro="__reactProps$"+to,ao="__reactContainer$"+to,oo="__reactEvents$"+to,io="__reactListeners$"+to,so="__reactHandles$"+to;function lo(e){var t=e[no];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ao]||n[no]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=eo(e);null!==e;){if(n=e[no])return n;e=eo(e)}return t}n=(e=n).parentNode}return null}function co(e){return!(e=e[no]||e[ao])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function uo(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(Q(33))}function fo(e){return e[ro]||null}var ho=[],po=-1;function mo(e){return{current:e}}function go(e){0>po||(e.current=ho[po],ho[po]=null,po--)}function yo(e,t){po++,ho[po]=e.current,e.current=t}var vo={},bo=mo(vo),wo=mo(!1),ko=vo;function So(e,t){var n=e.type.contextTypes;if(!n)return vo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a,o={};for(a in n)o[a]=t[a];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function xo(e){return null!=(e=e.childContextTypes)}function Co(){go(wo),go(bo)}function Eo(e,t,n){if(bo.current!==vo)throw Error(Q(168));yo(bo,t),yo(wo,n)}function _o(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in t))throw Error(Q(108,Ne(e)||"Unknown",a));return Me({},n,r)}function Mo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vo,ko=bo.current,yo(bo,e),yo(wo,wo.current),!0}function Ro(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=_o(e,t,ko),r.__reactInternalMemoizedMergedChildContext=e,go(wo),go(bo),yo(bo,e)):go(wo),yo(wo,n)}var Ao=null,Po=!1,Lo=!1;function To(e){null===Ao?Ao=[e]:Ao.push(e)}function No(){if(!Lo&&null!==Ao){Lo=!0;var e=0,t=un;try{var n=Ao;for(un=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Ao=null,Po=!1}catch(t){throw null!==Ao&&(Ao=Ao.slice(e+1)),Ft(Vt,No),t}finally{un=t,Lo=!1}}return null}var Do=[],Io=0,zo=null,Fo=0,Oo=[],$o=0,jo=null,Uo=1,Bo="";function Vo(e,t){Do[Io++]=Fo,Do[Io++]=zo,zo=e,Fo=t}function Wo(e,t,n){Oo[$o++]=Uo,Oo[$o++]=Bo,Oo[$o++]=jo,jo=e;var r=Uo;e=Bo;var a=32-Yt(r)-1;r&=~(1<<a),n+=1;var o=32-Yt(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,Uo=1<<32-Yt(t)+a|n<<a|r,Bo=o+e}else Uo=1<<o|n<<a|r,Bo=e}function Ho(e){null!==e.return&&(Vo(e,1),Wo(e,1,0))}function Ko(e){for(;e===zo;)zo=Do[--Io],Do[Io]=null,Fo=Do[--Io],Do[Io]=null;for(;e===jo;)jo=Oo[--$o],Oo[$o]=null,Bo=Oo[--$o],Oo[$o]=null,Uo=Oo[--$o],Oo[$o]=null}var qo=null,Go=null,Qo=!1,Yo=null;function Xo(e,t){var n=ku(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function Jo(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,qo=e,Go=Za(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,qo=e,Go=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==jo?{id:Uo,overflow:Bo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=ku(18,null,null,0)).stateNode=t,n.return=e,e.child=n,qo=e,Go=null,!0);default:return!1}}function Zo(e){return!(!(1&e.mode)||128&e.flags)}function ei(e){if(Qo){var t=Go;if(t){var n=t;if(!Jo(e,t)){if(Zo(e))throw Error(Q(418));t=Za(n.nextSibling);var r=qo;t&&Jo(e,t)?Xo(r,n):(e.flags=-4097&e.flags|2,Qo=!1,qo=e)}}else{if(Zo(e))throw Error(Q(418));e.flags=-4097&e.flags|2,Qo=!1,qo=e}}}function ti(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;qo=e}function ni(e){if(e!==qo)return!1;if(!Qo)return ti(e),Qo=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!Ka(e.type,e.memoizedProps)),t&&(t=Go)){if(Zo(e))throw ri(),Error(Q(418));for(;t;)Xo(e,t),t=Za(t.nextSibling)}if(ti(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){Go=Za(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}Go=null}}else Go=qo?Za(e.stateNode.nextSibling):null;return!0}function ri(){for(var e=Go;e;)e=Za(e.nextSibling)}function ai(){Go=qo=null,Qo=!1}function oi(e){null===Yo?Yo=[e]:Yo.push(e)}var ii=ue.ReactCurrentBatchConfig;function si(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(Q(309));var r=n.stateNode}if(!r)throw Error(Q(147,e));var a=r,o=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;null===e?delete t[o]:t[o]=e},t._stringRef=o,t)}if("string"!=typeof e)throw Error(Q(284));if(!n._owner)throw Error(Q(290,e))}return e}function li(e,t){throw e=Object.prototype.toString.call(t),Error(Q(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ci(e){return(0,e._init)(e._payload)}function ui(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,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function a(e,t){return(e=xu(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|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function i(t){return e&&null===t.alternate&&(t.flags|=2),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Mu(n,e.mode,r)).return=e,t):((t=a(t,n)).return=e,t)}function l(e,t,n,r){var o=n.type;return o===he?u(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===Se&&ci(o)===t.type)?((r=a(t,n.props)).ref=si(e,t,n),r.return=e,r):((r=Cu(n.type,n.key,n.props,null,e.mode,r)).ref=si(e,t,n),r.return=e,r)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Ru(n,e.mode,r)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function u(e,t,n,r,o){return null===t||7!==t.tag?((t=Eu(n,e.mode,r,o)).return=e,t):((t=a(t,n)).return=e,t)}function d(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Mu(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case de:return(n=Cu(t.type,t.key,t.props,null,e.mode,n)).ref=si(e,null,t),n.return=e,n;case fe:return(t=Ru(t,e.mode,n)).return=e,t;case Se:return d(e,(0,t._init)(t._payload),n)}if(He(t)||Ee(t))return(t=Eu(t,e.mode,n,null)).return=e,t;li(e,t)}return null}function f(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==a?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case de:return n.key===a?l(e,t,n,r):null;case fe:return n.key===a?c(e,t,n,r):null;case Se:return f(e,t,(a=n._init)(n._payload),r)}if(He(n)||Ee(n))return null!==a?null:u(e,t,n,r,null);li(e,n)}return null}function h(e,t,n,r,a){if("string"==typeof r&&""!==r||"number"==typeof r)return s(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case de:return l(t,e=e.get(null===r.key?n:r.key)||null,r,a);case fe:return c(t,e=e.get(null===r.key?n:r.key)||null,r,a);case Se:return h(e,t,n,(0,r._init)(r._payload),a)}if(He(r)||Ee(r))return u(t,e=e.get(n)||null,r,a,null);li(t,r)}return null}function p(a,i,s,l){for(var c=null,u=null,p=i,m=i=0,g=null;null!==p&&m<s.length;m++){p.index>m?(g=p,p=null):g=p.sibling;var y=f(a,p,s[m],l);if(null===y){null===p&&(p=g);break}e&&p&&null===y.alternate&&t(a,p),i=o(y,i,m),null===u?c=y:u.sibling=y,u=y,p=g}if(m===s.length)return n(a,p),Qo&&Vo(a,m),c;if(null===p){for(;m<s.length;m++)null!==(p=d(a,s[m],l))&&(i=o(p,i,m),null===u?c=p:u.sibling=p,u=p);return Qo&&Vo(a,m),c}for(p=r(a,p);m<s.length;m++)null!==(g=h(p,a,m,s[m],l))&&(e&&null!==g.alternate&&p.delete(null===g.key?m:g.key),i=o(g,i,m),null===u?c=g:u.sibling=g,u=g);return e&&p.forEach(function(e){return t(a,e)}),Qo&&Vo(a,m),c}function m(a,i,s,l){var c=Ee(s);if("function"!=typeof c)throw Error(Q(150));if(null==(s=c.call(s)))throw Error(Q(151));for(var u=c=null,p=i,m=i=0,g=null,y=s.next();null!==p&&!y.done;m++,y=s.next()){p.index>m?(g=p,p=null):g=p.sibling;var v=f(a,p,y.value,l);if(null===v){null===p&&(p=g);break}e&&p&&null===v.alternate&&t(a,p),i=o(v,i,m),null===u?c=v:u.sibling=v,u=v,p=g}if(y.done)return n(a,p),Qo&&Vo(a,m),c;if(null===p){for(;!y.done;m++,y=s.next())null!==(y=d(a,y.value,l))&&(i=o(y,i,m),null===u?c=y:u.sibling=y,u=y);return Qo&&Vo(a,m),c}for(p=r(a,p);!y.done;m++,y=s.next())null!==(y=h(p,a,m,y.value,l))&&(e&&null!==y.alternate&&p.delete(null===y.key?m:y.key),i=o(y,i,m),null===u?c=y:u.sibling=y,u=y);return e&&p.forEach(function(e){return t(a,e)}),Qo&&Vo(a,m),c}return function e(r,o,s,l){if("object"==typeof s&&null!==s&&s.type===he&&null===s.key&&(s=s.props.children),"object"==typeof s&&null!==s){switch(s.$$typeof){case de:e:{for(var c=s.key,u=o;null!==u;){if(u.key===c){if((c=s.type)===he){if(7===u.tag){n(r,u.sibling),(o=a(u,s.props.children)).return=r,r=o;break e}}else if(u.elementType===c||"object"==typeof c&&null!==c&&c.$$typeof===Se&&ci(c)===u.type){n(r,u.sibling),(o=a(u,s.props)).ref=si(r,u,s),o.return=r,r=o;break e}n(r,u);break}t(r,u),u=u.sibling}s.type===he?((o=Eu(s.props.children,r.mode,l,s.key)).return=r,r=o):((l=Cu(s.type,s.key,s.props,null,r.mode,l)).ref=si(r,o,s),l.return=r,r=l)}return i(r);case fe:e:{for(u=s.key;null!==o;){if(o.key===u){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){n(r,o.sibling),(o=a(o,s.children||[])).return=r,r=o;break e}n(r,o);break}t(r,o),o=o.sibling}(o=Ru(s,r.mode,l)).return=r,r=o}return i(r);case Se:return e(r,o,(u=s._init)(s._payload),l)}if(He(s))return p(r,o,s,l);if(Ee(s))return m(r,o,s,l);li(r,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==o&&6===o.tag?(n(r,o.sibling),(o=a(o,s)).return=r,r=o):(n(r,o),(o=Mu(s,r.mode,l)).return=r,r=o),i(r)):n(r,o)}}var di=ui(!0),fi=ui(!1),hi=mo(null),pi=null,mi=null,gi=null;function yi(){gi=mi=pi=null}function vi(e){var t=hi.current;go(hi),e._currentValue=t}function bi(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 wi(e,t){pi=e,gi=mi=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(cl=!0),e.firstContext=null)}function ki(e){var t=e._currentValue;if(gi!==e)if(e={context:e,memoizedValue:t,next:null},null===mi){if(null===pi)throw Error(Q(308));mi=e,pi.dependencies={lanes:0,firstContext:e}}else mi=mi.next=e;return t}var Si=null;function xi(e){null===Si?Si=[e]:Si.push(e)}function Ci(e,t,n,r){var a=t.interleaved;return null===a?(n.next=n,xi(t)):(n.next=a.next,a.next=n),t.interleaved=n,Ei(e,r)}function Ei(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var _i=!1;function Mi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ri(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ai(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Pi(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&vc){var a=r.pending;return null===a?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Ei(e,n)}return null===(a=r.interleaved)?(t.next=t,xi(r)):(t.next=a.next,a.next=t),r.interleaved=t,Ei(e,n)}function Li(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,cn(e,n)}}function Ti(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?a=o=i:o=o.next=i,n=n.next}while(null!==n);null===o?a=o=t:o=o.next=t}else a=o=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ni(e,t,n,r){var a=e.updateQueue;_i=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,s=a.shared.pending;if(null!==s){a.shared.pending=null;var l=s,c=l.next;l.next=null,null===i?o=c:i.next=c,i=l;var u=e.alternate;null!==u&&((s=(u=u.updateQueue).lastBaseUpdate)!==i&&(null===s?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(null!==o){var d=a.baseState;for(i=0,u=c=l=null,s=o;;){var f=s.lane,h=s.eventTime;if((r&f)===f){null!==u&&(u=u.next={eventTime:h,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var p=e,m=s;switch(f=t,h=n,m.tag){case 1:if("function"==typeof(p=m.payload)){d=p.call(h,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(h,d,f):p))break e;d=Me({},d,f);break e;case 2:_i=!0}}null!==s.callback&&0!==s.lane&&(e.flags|=64,null===(f=a.effects)?a.effects=[s]:f.push(s))}else h={eventTime: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,i|=f;if(null===(s=s.next)){if(null===(s=a.shared.pending))break;s=(f=s).next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}if(null===u&&(l=d),a.baseState=l,a.firstBaseUpdate=c,a.lastBaseUpdate=u,null!==(t=a.shared.interleaved)){a=t;do{i|=a.lane,a=a.next}while(a!==t)}else null===o&&(a.shared.lanes=0);_c|=i,e.lanes=i,e.memoizedState=d}}function Di(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(null!==a){if(r.callback=null,r=n,"function"!=typeof a)throw Error(Q(191,a));a.call(r)}}}var Ii={},zi=mo(Ii),Fi=mo(Ii),Oi=mo(Ii);function $i(e){if(e===Ii)throw Error(Q(174));return e}function ji(e,t){switch(yo(Oi,t),yo(Fi,e),yo(zi,Ii),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Je(null,"");break;default:t=Je(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}go(zi),yo(zi,t)}function Ui(){go(zi),go(Fi),go(Oi)}function Bi(e){$i(Oi.current);var t=$i(zi.current),n=Je(t,e.type);t!==n&&(yo(Fi,e),yo(zi,n))}function Vi(e){Fi.current===e&&(go(zi),go(Fi))}var Wi=mo(0);function Hi(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}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 Ki=[];function qi(){for(var e=0;e<Ki.length;e++)Ki[e]._workInProgressVersionPrimary=null;Ki.length=0}var Gi=ue.ReactCurrentDispatcher,Qi=ue.ReactCurrentBatchConfig,Yi=0,Xi=null,Ji=null,Zi=null,es=!1,ts=!1,ns=0,rs=0;function as(){throw Error(Q(321))}function os(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Xr(e[n],t[n]))return!1;return!0}function is(e,t,n,r,a,o){if(Yi=o,Xi=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Gi.current=null===e||null===e.memoizedState?Vs:Ws,e=n(r,a),ts){o=0;do{if(ts=!1,ns=0,25<=o)throw Error(Q(301));o+=1,Zi=Ji=null,t.updateQueue=null,Gi.current=Hs,e=n(r,a)}while(ts)}if(Gi.current=Bs,t=null!==Ji&&null!==Ji.next,Yi=0,Zi=Ji=Xi=null,es=!1,t)throw Error(Q(300));return e}function ss(){var e=0!==ns;return ns=0,e}function ls(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Zi?Xi.memoizedState=Zi=e:Zi=Zi.next=e,Zi}function cs(){if(null===Ji){var e=Xi.alternate;e=null!==e?e.memoizedState:null}else e=Ji.next;var t=null===Zi?Xi.memoizedState:Zi.next;if(null!==t)Zi=t,Ji=e;else{if(null===e)throw Error(Q(310));e={memoizedState:(Ji=e).memoizedState,baseState:Ji.baseState,baseQueue:Ji.baseQueue,queue:Ji.queue,next:null},null===Zi?Xi.memoizedState=Zi=e:Zi=Zi.next=e}return Zi}function us(e,t){return"function"==typeof t?t(e):t}function ds(e){var t=cs(),n=t.queue;if(null===n)throw Error(Q(311));n.lastRenderedReducer=e;var r=Ji,a=r.baseQueue,o=n.pending;if(null!==o){if(null!==a){var i=a.next;a.next=o.next,o.next=i}r.baseQueue=a=o,n.pending=null}if(null!==a){o=a.next,r=r.baseState;var s=i=null,l=null,c=o;do{var u=c.lane;if((Yi&u)===u)null!==l&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===l?(s=l=d,i=r):l=l.next=d,Xi.lanes|=u,_c|=u}c=c.next}while(null!==c&&c!==o);null===l?i=r:l.next=s,Xr(r,t.memoizedState)||(cl=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=l,n.lastRenderedState=r}if(null!==(e=n.interleaved)){a=e;do{o=a.lane,Xi.lanes|=o,_c|=o,a=a.next}while(a!==e)}else null===a&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function fs(e){var t=cs(),n=t.queue;if(null===n)throw Error(Q(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(null!==a){n.pending=null;var i=a=a.next;do{o=e(o,i.action),i=i.next}while(i!==a);Xr(o,t.memoizedState)||(cl=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function hs(){}function ps(e,t){var n=Xi,r=cs(),a=t(),o=!Xr(r.memoizedState,a);if(o&&(r.memoizedState=a,cl=!0),r=r.queue,_s(ys.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||null!==Zi&&1&Zi.memoizedState.tag){if(n.flags|=2048,ks(9,gs.bind(null,n,r,a,t),void 0,null),null===bc)throw Error(Q(349));30&Yi||ms(n,t,a)}return a}function ms(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Xi.updateQueue)?(t={lastEffect:null,stores:null},Xi.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function gs(e,t,n,r){t.value=n,t.getSnapshot=r,vs(t)&&bs(e)}function ys(e,t,n){return n(function(){vs(t)&&bs(e)})}function vs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Xr(e,n)}catch(e){return!0}}function bs(e){var t=Ei(e,1);null!==t&&Kc(t,e,1,-1)}function ws(e){var t=ls();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:us,lastRenderedState:e},t.queue=e,e=e.dispatch=Os.bind(null,Xi,e),[t.memoizedState,e]}function ks(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Xi.updateQueue)?(t={lastEffect:null,stores:null},Xi.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Ss(){return cs().memoizedState}function xs(e,t,n,r){var a=ls();Xi.flags|=e,a.memoizedState=ks(1|t,n,void 0,void 0===r?null:r)}function Cs(e,t,n,r){var a=cs();r=void 0===r?null:r;var o=void 0;if(null!==Ji){var i=Ji.memoizedState;if(o=i.destroy,null!==r&&os(r,i.deps))return void(a.memoizedState=ks(t,n,o,r))}Xi.flags|=e,a.memoizedState=ks(1|t,n,o,r)}function Es(e,t){return xs(8390656,8,e,t)}function _s(e,t){return Cs(2048,8,e,t)}function Ms(e,t){return Cs(4,2,e,t)}function Rs(e,t){return Cs(4,4,e,t)}function As(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Ps(e,t,n){return n=null!=n?n.concat([e]):null,Cs(4,4,As.bind(null,t,e),n)}function Ls(){}function Ts(e,t){var n=cs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&os(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ns(e,t){var n=cs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&os(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ds(e,t,n){return 21&Yi?(Xr(n,t)||(n=on(),Xi.lanes|=n,_c|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,cl=!0),e.memoizedState=n)}function Is(e,t){var n=un;un=0!==n&&4>n?n:4,e(!0);var r=Qi.transition;Qi.transition={};try{e(!1),t()}finally{un=n,Qi.transition=r}}function zs(){return cs().memoizedState}function Fs(e,t,n){var r=Hc(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},$s(e))js(t,n);else if(null!==(n=Ci(e,t,n,r))){Kc(n,e,r,Wc()),Us(n,t,r)}}function Os(e,t,n){var r=Hc(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if($s(e))js(t,a);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var i=t.lastRenderedState,s=o(i,n);if(a.hasEagerState=!0,a.eagerState=s,Xr(s,i)){var l=t.interleaved;return null===l?(a.next=a,xi(t)):(a.next=l.next,l.next=a),void(t.interleaved=a)}}catch(e){}null!==(n=Ci(e,t,a,r))&&(Kc(n,e,r,a=Wc()),Us(n,t,r))}}function $s(e){var t=e.alternate;return e===Xi||null!==t&&t===Xi}function js(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 Us(e,t,n){if(4194240&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,cn(e,n)}}var Bs={readContext:ki,useCallback:as,useContext:as,useEffect:as,useImperativeHandle:as,useInsertionEffect:as,useLayoutEffect:as,useMemo:as,useReducer:as,useRef:as,useState:as,useDebugValue:as,useDeferredValue:as,useTransition:as,useMutableSource:as,useSyncExternalStore:as,useId:as,unstable_isNewReconciler:!1},Vs={readContext:ki,useCallback:function(e,t){return ls().memoizedState=[e,void 0===t?null:t],e},useContext:ki,useEffect:Es,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,xs(4194308,4,As.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xs(4194308,4,e,t)},useInsertionEffect:function(e,t){return xs(4,2,e,t)},useMemo:function(e,t){var n=ls();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ls();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Fs.bind(null,Xi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},ls().memoizedState=e},useState:ws,useDebugValue:Ls,useDeferredValue:function(e){return ls().memoizedState=e},useTransition:function(){var e=ws(!1),t=e[0];return e=Is.bind(null,e[1]),ls().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Xi,a=ls();if(Qo){if(void 0===n)throw Error(Q(407));n=n()}else{if(n=t(),null===bc)throw Error(Q(349));30&Yi||ms(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Es(ys.bind(null,r,o,e),[e]),r.flags|=2048,ks(9,gs.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ls(),t=bc.identifierPrefix;if(Qo){var n=Bo;t=":"+t+"R"+(n=(Uo&~(1<<32-Yt(Uo)-1)).toString(32)+n),0<(n=ns++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=rs++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Ws={readContext:ki,useCallback:Ts,useContext:ki,useEffect:_s,useImperativeHandle:Ps,useInsertionEffect:Ms,useLayoutEffect:Rs,useMemo:Ns,useReducer:ds,useRef:Ss,useState:function(){return ds(us)},useDebugValue:Ls,useDeferredValue:function(e){return Ds(cs(),Ji.memoizedState,e)},useTransition:function(){return[ds(us)[0],cs().memoizedState]},useMutableSource:hs,useSyncExternalStore:ps,useId:zs,unstable_isNewReconciler:!1},Hs={readContext:ki,useCallback:Ts,useContext:ki,useEffect:_s,useImperativeHandle:Ps,useInsertionEffect:Ms,useLayoutEffect:Rs,useMemo:Ns,useReducer:fs,useRef:Ss,useState:function(){return fs(us)},useDebugValue:Ls,useDeferredValue:function(e){var t=cs();return null===Ji?t.memoizedState=e:Ds(t,Ji.memoizedState,e)},useTransition:function(){return[fs(us)[0],cs().memoizedState]},useMutableSource:hs,useSyncExternalStore:ps,useId:zs,unstable_isNewReconciler:!1};function Ks(e,t){if(e&&e.defaultProps){for(var n in t=Me({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function qs(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:Me({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var Gs={isMounted:function(e){return!!(e=e._reactInternals)&&Tt(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Wc(),a=Hc(e),o=Ai(r,a);o.payload=t,null!=n&&(o.callback=n),null!==(t=Pi(e,o,a))&&(Kc(t,e,a,r),Li(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Wc(),a=Hc(e),o=Ai(r,a);o.tag=1,o.payload=t,null!=n&&(o.callback=n),null!==(t=Pi(e,o,a))&&(Kc(t,e,a,r),Li(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Wc(),r=Hc(e),a=Ai(n,r);a.tag=2,null!=t&&(a.callback=t),null!==(t=Pi(e,a,r))&&(Kc(t,e,r,n),Li(t,e,r))}};function Qs(e,t,n,r,a,o,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,i):!t.prototype||!t.prototype.isPureReactComponent||(!Jr(n,r)||!Jr(a,o))}function Ys(e,t,n){var r=!1,a=vo,o=t.contextType;return"object"==typeof o&&null!==o?o=ki(o):(a=xo(t)?ko:bo.current,o=(r=null!=(r=t.contextTypes))?So(e,a):vo),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Gs,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function Xs(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&&Gs.enqueueReplaceState(t,t.state,null)}function Js(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},Mi(e);var o=t.contextType;"object"==typeof o&&null!==o?a.context=ki(o):(o=xo(t)?ko:bo.current,a.context=So(e,o)),a.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(qs(e,t,o,n),a.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(t=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),t!==a.state&&Gs.enqueueReplaceState(a,a.state,null),Ni(e,n,a,r),a.state=e.memoizedState),"function"==typeof a.componentDidMount&&(e.flags|=4194308)}function Zs(e,t){try{var n="",r=t;do{n+=Le(r),r=r.return}while(r);var a=n}catch(e){a="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:a,digest:null}}function el(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function tl(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var nl="function"==typeof WeakMap?WeakMap:Map;function rl(e,t,n){(n=Ai(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Dc||(Dc=!0,Ic=r),tl(0,t)},n}function al(e,t,n){(n=Ai(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){tl(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){tl(0,t),"function"!=typeof r&&(null===zc?zc=new Set([this]):zc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function ol(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new nl;var a=new Set;r.set(t,a)}else void 0===(a=r.get(t))&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=mu.bind(null,e,t,n),t.then(e,e))}function il(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function sl(e,t,n,r,a){return 1&e.mode?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Ai(-1,1)).tag=2,Pi(n,t,1))),n.lanes|=1),e)}var ll=ue.ReactCurrentOwner,cl=!1;function ul(e,t,n,r){t.child=null===e?fi(t,null,n,r):di(t,e.child,n,r)}function dl(e,t,n,r,a){n=n.render;var o=t.ref;return wi(t,a),r=is(e,t,n,r,o,a),n=ss(),null===e||cl?(Qo&&n&&Ho(t),t.flags|=1,ul(e,t,r,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Dl(e,t,a))}function fl(e,t,n,r,a){if(null===e){var o=n.type;return"function"!=typeof o||Su(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Cu(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,hl(e,t,o,r,a))}if(o=e.child,0===(e.lanes&a)){var i=o.memoizedProps;if((n=null!==(n=n.compare)?n:Jr)(i,r)&&e.ref===t.ref)return Dl(e,t,a)}return t.flags|=1,(e=xu(o,r)).ref=t.ref,e.return=t,t.child=e}function hl(e,t,n,r,a){if(null!==e){var o=e.memoizedProps;if(Jr(o,r)&&e.ref===t.ref){if(cl=!1,t.pendingProps=r=o,0===(e.lanes&a))return t.lanes=e.lanes,Dl(e,t,a);131072&e.flags&&(cl=!0)}}return gl(e,t,n,r,a)}function pl(e,t,n){var r=t.pendingProps,a=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,yo(xc,Sc),Sc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,yo(xc,Sc),Sc|=r}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},yo(xc,Sc),Sc|=n;else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,yo(xc,Sc),Sc|=r;return ul(e,t,a,n),t.child}function ml(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function gl(e,t,n,r,a){var o=xo(n)?ko:bo.current;return o=So(t,o),wi(t,a),n=is(e,t,n,r,o,a),r=ss(),null===e||cl?(Qo&&r&&Ho(t),t.flags|=1,ul(e,t,n,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Dl(e,t,a))}function yl(e,t,n,r,a){if(xo(n)){var o=!0;Mo(t)}else o=!1;if(wi(t,a),null===t.stateNode)Nl(e,t),Ys(t,n,r),Js(t,n,r,a),r=!0;else if(null===e){var i=t.stateNode,s=t.memoizedProps;i.props=s;var l=i.context,c=n.contextType;"object"==typeof c&&null!==c?c=ki(c):c=So(t,c=xo(n)?ko:bo.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof i.getSnapshotBeforeUpdate;d||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==r||l!==c)&&Xs(t,i,r,c),_i=!1;var f=t.memoizedState;i.state=f,Ni(t,r,i,a),l=t.memoizedState,s!==r||f!==l||wo.current||_i?("function"==typeof u&&(qs(t,n,u,r),l=t.memoizedState),(s=_i||Qs(t,n,s,r,f,l,c))?(d||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),i.props=r,i.state=l,i.context=c,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Ri(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:Ks(t.type,s),i.props=c,d=t.pendingProps,f=i.context,"object"==typeof(l=n.contextType)&&null!==l?l=ki(l):l=So(t,l=xo(n)?ko:bo.current);var h=n.getDerivedStateFromProps;(u="function"==typeof h||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==d||f!==l)&&Xs(t,i,r,l),_i=!1,f=t.memoizedState,i.state=f,Ni(t,r,i,a);var p=t.memoizedState;s!==d||f!==p||wo.current||_i?("function"==typeof h&&(qs(t,n,h,r),p=t.memoizedState),(c=_i||Qs(t,n,c,r,f,p,l)||!1)?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,p,l),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=l,r=c):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return vl(e,t,n,r,o,a)}function vl(e,t,n,r,a,o){ml(e,t);var i=!!(128&t.flags);if(!r&&!i)return a&&Ro(t,n,!1),Dl(e,t,o);r=t.stateNode,ll.current=t;var s=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=di(t,e.child,null,o),t.child=di(t,null,s,o)):ul(e,t,s,o),t.memoizedState=r.state,a&&Ro(t,n,!0),t.child}function bl(e){var t=e.stateNode;t.pendingContext?Eo(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Eo(0,t.context,!1),ji(e,t.containerInfo)}function wl(e,t,n,r,a){return ai(),oi(a),t.flags|=256,ul(e,t,n,r),t.child}var kl,Sl,xl,Cl,El={dehydrated:null,treeContext:null,retryLane:0};function _l(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ml(e,t,n){var r,a=t.pendingProps,o=Wi.current,i=!1,s=!!(128&t.flags);if((r=s)||(r=(null===e||null!==e.memoizedState)&&!!(2&o)),r?(i=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(o|=1),yo(Wi,1&o),null===e)return ei(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=a.children,e=a.fallback,i?(a=t.mode,i=t.child,s={mode:"hidden",children:s},1&a||null===i?i=_u(s,a,0,null):(i.childLanes=0,i.pendingProps=s),e=Eu(e,a,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=_l(n),t.memoizedState=El,e):Rl(t,s));if(null!==(o=e.memoizedState)&&null!==(r=o.dehydrated))return function(e,t,n,r,a,o,i){if(n)return 256&t.flags?(t.flags&=-257,Al(e,t,i,r=el(Error(Q(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(o=r.fallback,a=t.mode,r=_u({mode:"visible",children:r.children},a,0,null),(o=Eu(o,a,i,null)).flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,1&t.mode&&di(t,e.child,null,i),t.child.memoizedState=_l(i),t.memoizedState=El,o);if(!(1&t.mode))return Al(e,t,i,null);if("$!"===a.data){if(r=a.nextSibling&&a.nextSibling.dataset)var s=r.dgst;return r=s,Al(e,t,i,r=el(o=Error(Q(419)),r,void 0))}if(s=0!==(i&e.childLanes),cl||s){if(null!==(r=bc)){switch(i&-i){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}0!==(a=0!==(a&(r.suspendedLanes|i))?0:a)&&a!==o.retryLane&&(o.retryLane=a,Ei(e,a),Kc(r,e,a,-1))}return ou(),Al(e,t,i,r=el(Error(Q(421))))}return"$?"===a.data?(t.flags|=128,t.child=e.child,t=yu.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Go=Za(a.nextSibling),qo=t,Qo=!0,Yo=null,null!==e&&(Oo[$o++]=Uo,Oo[$o++]=Bo,Oo[$o++]=jo,Uo=e.id,Bo=e.overflow,jo=t),t=Rl(t,r.children),t.flags|=4096,t)}(e,t,s,a,r,o,n);if(i){i=a.fallback,s=t.mode,r=(o=e.child).sibling;var l={mode:"hidden",children:a.children};return 1&s||t.child===o?(a=xu(o,l)).subtreeFlags=14680064&o.subtreeFlags:((a=t.child).childLanes=0,a.pendingProps=l,t.deletions=null),null!==r?i=xu(r,i):(i=Eu(i,s,n,null)).flags|=2,i.return=t,a.return=t,a.sibling=i,t.child=a,a=i,i=t.child,s=null===(s=e.child.memoizedState)?_l(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=El,a}return e=(i=e.child).sibling,a=xu(i,{mode:"visible",children:a.children}),!(1&t.mode)&&(a.lanes=n),a.return=t,a.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=a,t.memoizedState=null,a}function Rl(e,t){return(t=_u({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Al(e,t,n,r){return null!==r&&oi(r),di(t,e.child,null,n),(e=Rl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Pl(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),bi(e.return,t,n)}function Ll(e,t,n,r,a){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=a)}function Tl(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(ul(e,t,r.children,n),2&(r=Wi.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Pl(e,n,t);else if(19===e.tag)Pl(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}r&=1}if(yo(Wi,r),1&t.mode)switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===Hi(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Ll(t,!1,a,n,o);break;case"backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===Hi(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Ll(t,!0,n,null,o);break;case"together":Ll(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Nl(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Dl(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),_c|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(Q(153));if(null!==t.child){for(n=xu(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=xu(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Il(e,t){if(!Qo)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 zl(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=14680064&a.subtreeFlags,r|=14680064&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fl(e,t,n){var r=t.pendingProps;switch(Ko(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zl(t),null;case 1:case 17:return xo(t.type)&&Co(),zl(t),null;case 3:return r=t.stateNode,Ui(),go(wo),go(bo),qi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(ni(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==Yo&&(Yc(Yo),Yo=null))),Sl(e,t),zl(t),null;case 5:Vi(t);var a=$i(Oi.current);if(n=t.type,null!==e&&null!=t.stateNode)xl(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(Q(166));return zl(t),null}if(e=$i(zi.current),ni(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[no]=t,r[ro]=o,e=!!(1&t.mode),n){case"dialog":Aa("cancel",r),Aa("close",r);break;case"iframe":case"object":case"embed":Aa("load",r);break;case"video":case"audio":for(a=0;a<Ea.length;a++)Aa(Ea[a],r);break;case"source":Aa("error",r);break;case"img":case"image":case"link":Aa("error",r),Aa("load",r);break;case"details":Aa("toggle",r);break;case"input":je(r,o),Aa("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Aa("invalid",r);break;case"textarea":Ge(r,o),Aa("invalid",r)}for(var i in lt(n,o),a=null,o)if(o.hasOwnProperty(i)){var s=o[i];"children"===i?"string"==typeof s?r.textContent!==s&&(!0!==o.suppressHydrationWarning&&Ba(r.textContent,s,e),a=["children",s]):"number"==typeof s&&r.textContent!==""+s&&(!0!==o.suppressHydrationWarning&&Ba(r.textContent,s,e),a=["children",""+s]):X.hasOwnProperty(i)&&null!=s&&"onScroll"===i&&Aa("scroll",r)}switch(n){case"input":ze(r),Ve(r,o,!0);break;case"textarea":ze(r),Ye(r);break;case"select":case"option":break;default:"function"==typeof o.onClick&&(r.onclick=Va)}r=a,t.updateQueue=r,null!==r&&(t.flags|=4)}else{i=9===a.nodeType?a:a.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=Xe(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=i.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),"select"===n&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[no]=t,e[ro]=r,kl(e,t,!1,!1),t.stateNode=e;e:{switch(i=ct(n,r),n){case"dialog":Aa("cancel",e),Aa("close",e),a=r;break;case"iframe":case"object":case"embed":Aa("load",e),a=r;break;case"video":case"audio":for(a=0;a<Ea.length;a++)Aa(Ea[a],e);a=r;break;case"source":Aa("error",e),a=r;break;case"img":case"image":case"link":Aa("error",e),Aa("load",e),a=r;break;case"details":Aa("toggle",e),a=r;break;case"input":je(e,r),a=$e(e,r),Aa("invalid",e);break;case"option":default:a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=Me({},r,{value:void 0}),Aa("invalid",e);break;case"textarea":Ge(e,r),a=qe(e,r),Aa("invalid",e)}for(o in lt(n,a),s=a)if(s.hasOwnProperty(o)){var l=s[o];"style"===o?it(e,l):"dangerouslySetInnerHTML"===o?null!=(l=l?l.__html:void 0)&&tt(e,l):"children"===o?"string"==typeof l?("textarea"!==n||""!==l)&&nt(e,l):"number"==typeof l&&nt(e,""+l):"suppressContentEditableWarning"!==o&&"suppressHydrationWarning"!==o&&"autoFocus"!==o&&(X.hasOwnProperty(o)?null!=l&&"onScroll"===o&&Aa("scroll",e):null!=l&&ce(e,o,l,i))}switch(n){case"input":ze(e),Ve(e,r,!1);break;case"textarea":ze(e),Ye(e);break;case"option":null!=r.value&&e.setAttribute("value",""+De(r.value));break;case"select":e.multiple=!!r.multiple,null!=(o=r.value)?Ke(e,!!r.multiple,o,!1):null!=r.defaultValue&&Ke(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=Va)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return zl(t),null;case 6:if(e&&null!=t.stateNode)Cl(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(Q(166));if(n=$i(Oi.current),$i(zi.current),ni(t)){if(r=t.stateNode,n=t.memoizedProps,r[no]=t,(o=r.nodeValue!==n)&&null!==(e=qo))switch(e.tag){case 3:Ba(r.nodeValue,n,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ba(r.nodeValue,n,!!(1&e.mode))}o&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[no]=t,t.stateNode=r}return zl(t),null;case 13:if(go(Wi),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(Qo&&null!==Go&&1&t.mode&&!(128&t.flags))ri(),ai(),t.flags|=98560,o=!1;else if(o=ni(t),null!==r&&null!==r.dehydrated){if(null===e){if(!o)throw Error(Q(318));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(Q(317));o[no]=t}else ai(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;zl(t),o=!1}else null!==Yo&&(Yc(Yo),Yo=null),o=!0;if(!o)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=n,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,1&t.mode&&(null===e||1&Wi.current?0===Cc&&(Cc=3):ou())),null!==t.updateQueue&&(t.flags|=4),zl(t),null);case 4:return Ui(),Sl(e,t),null===e&&Ta(t.stateNode.containerInfo),zl(t),null;case 10:return vi(t.type._context),zl(t),null;case 19:if(go(Wi),null===(o=t.memoizedState))return zl(t),null;if(r=!!(128&t.flags),null===(i=o.rendering))if(r)Il(o,!1);else{if(0!==Cc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(i=Hi(e))){for(t.flags|=128,Il(o,!1),null!==(r=i.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(o=n).flags&=14680066,null===(i=o.alternate)?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return yo(Wi,1&Wi.current|2),t.child}e=e.sibling}null!==o.tail&&Ut()>Tc&&(t.flags|=128,r=!0,Il(o,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=Hi(i))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Il(o,!0),null===o.tail&&"hidden"===o.tailMode&&!i.alternate&&!Qo)return zl(t),null}else 2*Ut()-o.renderingStartTime>Tc&&1073741824!==n&&(t.flags|=128,r=!0,Il(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(null!==(n=o.last)?n.sibling=i:t.child=i,o.last=i)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ut(),t.sibling=null,n=Wi.current,yo(Wi,r?1&n|2:1&n),t):(zl(t),null);case 22:case 23:return tu(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&1&t.mode?!!(1073741824&Sc)&&(zl(t),6&t.subtreeFlags&&(t.flags|=8192)):zl(t),null;case 24:case 25:return null}throw Error(Q(156,t.tag))}function Ol(e,t){switch(Ko(t),t.tag){case 1:return xo(t.type)&&Co(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ui(),go(wo),go(bo),qi(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Vi(t),null;case 13:if(go(Wi),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(Q(340));ai()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return go(Wi),null;case 4:return Ui(),null;case 10:return vi(t.type._context),null;case 22:case 23:return tu(),null;default:return null}}kl=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Sl=function(){},xl=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,$i(zi.current);var o,i=null;switch(n){case"input":a=$e(e,a),r=$e(e,r),i=[];break;case"select":a=Me({},a,{value:void 0}),r=Me({},r,{value:void 0}),i=[];break;case"textarea":a=qe(e,a),r=qe(e,r),i=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(e.onclick=Va)}for(c in lt(n,r),n=null,a)if(!r.hasOwnProperty(c)&&a.hasOwnProperty(c)&&null!=a[c])if("style"===c){var s=a[c];for(o in s)s.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(X.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(s=null!=a?a[c]:void 0,r.hasOwnProperty(c)&&l!==s&&(null!=l||null!=s))if("style"===c)if(s){for(o in s)!s.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&s[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(i||(i=[]),i.push(c,n)),n=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,s=s?s.__html:void 0,null!=l&&s!==l&&(i=i||[]).push(c,l)):"children"===c?"string"!=typeof l&&"number"!=typeof l||(i=i||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(X.hasOwnProperty(c)?(null!=l&&"onScroll"===c&&Aa("scroll",e),i||s===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}},Cl=function(e,t,n,r){n!==r&&(t.flags|=4)};var $l=!1,jl=!1,Ul="function"==typeof WeakSet?WeakSet:Set,Bl=null;function Vl(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){pu(e,t,n)}else n.current=null}function Wl(e,t,n){try{n()}catch(n){pu(e,t,n)}}var Hl=!1;function Kl(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var a=r=r.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,void 0!==o&&Wl(t,n,o)}a=a.next}while(a!==r)}}function ql(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Gl(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function Ql(e){var t=e.alternate;null!==t&&(e.alternate=null,Ql(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[no],delete t[ro],delete t[oo],delete t[io],delete t[so])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Yl(e){return 5===e.tag||3===e.tag||4===e.tag}function Xl(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Yl(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(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 Jl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Va));else if(4!==r&&null!==(e=e.child))for(Jl(e,t,n),e=e.sibling;null!==e;)Jl(e,t,n),e=e.sibling}function Zl(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&&null!==(e=e.child))for(Zl(e,t,n),e=e.sibling;null!==e;)Zl(e,t,n),e=e.sibling}var ec=null,tc=!1;function nc(e,t,n){for(n=n.child;null!==n;)rc(e,t,n),n=n.sibling}function rc(e,t,n){if(Qt&&"function"==typeof Qt.onCommitFiberUnmount)try{Qt.onCommitFiberUnmount(Gt,n)}catch(e){}switch(n.tag){case 5:jl||Vl(n,t);case 6:var r=ec,a=tc;ec=null,nc(e,t,n),tc=a,null!==(ec=r)&&(tc?(e=ec,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):ec.removeChild(n.stateNode));break;case 18:null!==ec&&(tc?(e=ec,n=n.stateNode,8===e.nodeType?Ja(e.parentNode,n):1===e.nodeType&&Ja(e,n),Nn(e)):Ja(ec,n.stateNode));break;case 4:r=ec,a=tc,ec=n.stateNode.containerInfo,tc=!0,nc(e,t,n),ec=r,tc=a;break;case 0:case 11:case 14:case 15:if(!jl&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){a=r=r.next;do{var o=a,i=o.destroy;o=o.tag,void 0!==i&&(2&o||4&o)&&Wl(n,t,i),a=a.next}while(a!==r)}nc(e,t,n);break;case 1:if(!jl&&(Vl(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){pu(n,t,e)}nc(e,t,n);break;case 21:nc(e,t,n);break;case 22:1&n.mode?(jl=(r=jl)||null!==n.memoizedState,nc(e,t,n),jl=r):nc(e,t,n);break;default:nc(e,t,n)}}function ac(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Ul),t.forEach(function(t){var r=vu.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function oc(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var a=n[r];try{var o=e,i=t,s=i;e:for(;null!==s;){switch(s.tag){case 5:ec=s.stateNode,tc=!1;break e;case 3:case 4:ec=s.stateNode.containerInfo,tc=!0;break e}s=s.return}if(null===ec)throw Error(Q(160));rc(o,i,a),ec=null,tc=!1;var l=a.alternate;null!==l&&(l.return=null),a.return=null}catch(e){pu(a,t,e)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)ic(t,e),t=t.sibling}function ic(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(oc(t,e),sc(e),4&r){try{Kl(3,e,e.return),ql(3,e)}catch(t){pu(e,e.return,t)}try{Kl(5,e,e.return)}catch(t){pu(e,e.return,t)}}break;case 1:oc(t,e),sc(e),512&r&&null!==n&&Vl(n,n.return);break;case 5:if(oc(t,e),sc(e),512&r&&null!==n&&Vl(n,n.return),32&e.flags){var a=e.stateNode;try{nt(a,"")}catch(t){pu(e,e.return,t)}}if(4&r&&null!=(a=e.stateNode)){var o=e.memoizedProps,i=null!==n?n.memoizedProps:o,s=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===s&&"radio"===o.type&&null!=o.name&&Ue(a,o),ct(s,i);var c=ct(s,o);for(i=0;i<l.length;i+=2){var u=l[i],d=l[i+1];"style"===u?it(a,d):"dangerouslySetInnerHTML"===u?tt(a,d):"children"===u?nt(a,d):ce(a,u,d,c)}switch(s){case"input":Be(a,o);break;case"textarea":Qe(a,o);break;case"select":var f=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var h=o.value;null!=h?Ke(a,!!o.multiple,h,!1):f!==!!o.multiple&&(null!=o.defaultValue?Ke(a,!!o.multiple,o.defaultValue,!0):Ke(a,!!o.multiple,o.multiple?[]:"",!1))}a[ro]=o}catch(t){pu(e,e.return,t)}}break;case 6:if(oc(t,e),sc(e),4&r){if(null===e.stateNode)throw Error(Q(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){pu(e,e.return,t)}}break;case 3:if(oc(t,e),sc(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Nn(t.containerInfo)}catch(t){pu(e,e.return,t)}break;case 4:default:oc(t,e),sc(e);break;case 13:oc(t,e),sc(e),8192&(a=e.child).flags&&(o=null!==a.memoizedState,a.stateNode.isHidden=o,!o||null!==a.alternate&&null!==a.alternate.memoizedState||(Lc=Ut())),4&r&&ac(e);break;case 22:if(u=null!==n&&null!==n.memoizedState,1&e.mode?(jl=(c=jl)||u,oc(t,e),jl=c):oc(t,e),sc(e),8192&r){if(c=null!==e.memoizedState,(e.stateNode.isHidden=c)&&!u&&1&e.mode)for(Bl=e,u=e.child;null!==u;){for(d=Bl=u;null!==Bl;){switch(h=(f=Bl).child,f.tag){case 0:case 11:case 14:case 15:Kl(4,f,f.return);break;case 1:Vl(f,f.return);var p=f.stateNode;if("function"==typeof p.componentWillUnmount){r=f,n=f.return;try{t=r,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(e){pu(r,n,e)}}break;case 5:Vl(f,f.return);break;case 22:if(null!==f.memoizedState){dc(d);continue}}null!==h?(h.return=f,Bl=h):dc(d)}u=u.sibling}e:for(u=null,d=e;;){if(5===d.tag){if(null===u){u=d;try{a=d.stateNode,c?"function"==typeof(o=a.style).setProperty?o.setProperty("display","none","important"):o.display="none":(s=d.stateNode,i=null!=(l=d.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,s.style.display=ot("display",i))}catch(t){pu(e,e.return,t)}}}else if(6===d.tag){if(null===u)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(t){pu(e,e.return,t)}}else if((22!==d.tag&&23!==d.tag||null===d.memoizedState||d===e)&&null!==d.child){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;null===d.sibling;){if(null===d.return||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:oc(t,e),sc(e),4&r&&ac(e);case 21:}}function sc(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(Yl(n)){var r=n;break e}n=n.return}throw Error(Q(160))}switch(r.tag){case 5:var a=r.stateNode;32&r.flags&&(nt(a,""),r.flags&=-33),Zl(e,Xl(e),a);break;case 3:case 4:var o=r.stateNode.containerInfo;Jl(e,Xl(e),o);break;default:throw Error(Q(161))}}catch(t){pu(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function lc(e,t,n){Bl=e,cc(e)}function cc(e,t,n){for(var r=!!(1&e.mode);null!==Bl;){var a=Bl,o=a.child;if(22===a.tag&&r){var i=null!==a.memoizedState||$l;if(!i){var s=a.alternate,l=null!==s&&null!==s.memoizedState||jl;s=$l;var c=jl;if($l=i,(jl=l)&&!c)for(Bl=a;null!==Bl;)l=(i=Bl).child,22===i.tag&&null!==i.memoizedState?fc(a):null!==l?(l.return=i,Bl=l):fc(a);for(;null!==o;)Bl=o,cc(o),o=o.sibling;Bl=a,$l=s,jl=c}uc(e)}else 8772&a.subtreeFlags&&null!==o?(o.return=a,Bl=o):uc(e)}}function uc(e){for(;null!==Bl;){var t=Bl;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:jl||ql(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!jl)if(null===n)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Ks(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;null!==o&&Di(t,o,r);break;case 3:var i=t.updateQueue;if(null!==i){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Di(t,i,n)}break;case 5:var s=t.stateNode;if(null===n&&4&t.flags){n=s;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var c=t.alternate;if(null!==c){var u=c.memoizedState;if(null!==u){var d=u.dehydrated;null!==d&&Nn(d)}}}break;default:throw Error(Q(163))}jl||512&t.flags&&Gl(t)}catch(e){pu(t,t.return,e)}}if(t===e){Bl=null;break}if(null!==(n=t.sibling)){n.return=t.return,Bl=n;break}Bl=t.return}}function dc(e){for(;null!==Bl;){var t=Bl;if(t===e){Bl=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Bl=n;break}Bl=t.return}}function fc(e){for(;null!==Bl;){var t=Bl;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ql(4,t)}catch(e){pu(t,n,e)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var a=t.return;try{r.componentDidMount()}catch(e){pu(t,a,e)}}var o=t.return;try{Gl(t)}catch(e){pu(t,o,e)}break;case 5:var i=t.return;try{Gl(t)}catch(e){pu(t,i,e)}}}catch(e){pu(t,t.return,e)}if(t===e){Bl=null;break}var s=t.sibling;if(null!==s){s.return=t.return,Bl=s;break}Bl=t.return}}var hc,pc=Math.ceil,mc=ue.ReactCurrentDispatcher,gc=ue.ReactCurrentOwner,yc=ue.ReactCurrentBatchConfig,vc=0,bc=null,wc=null,kc=0,Sc=0,xc=mo(0),Cc=0,Ec=null,_c=0,Mc=0,Rc=0,Ac=null,Pc=null,Lc=0,Tc=1/0,Nc=null,Dc=!1,Ic=null,zc=null,Fc=!1,Oc=null,$c=0,jc=0,Uc=null,Bc=-1,Vc=0;function Wc(){return 6&vc?Ut():-1!==Bc?Bc:Bc=Ut()}function Hc(e){return 1&e.mode?2&vc&&0!==kc?kc&-kc:null!==ii.transition?(0===Vc&&(Vc=on()),Vc):0!==(e=un)?e:e=void 0===(e=window.event)?16:Un(e.type):1}function Kc(e,t,n,r){if(50<jc)throw jc=0,Uc=null,Error(Q(185));ln(e,n,r),2&vc&&e===bc||(e===bc&&(!(2&vc)&&(Mc|=n),4===Cc&&Xc(e,kc)),qc(e,r),1===n&&0===vc&&!(1&t.mode)&&(Tc=Ut()+500,Po&&No()))}function qc(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-Yt(o),s=1<<i,l=a[i];-1===l?0!==(s&n)&&0===(s&r)||(a[i]=rn(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}}(e,t);var r=nn(e,e===bc?kc:0);if(0===r)null!==n&&Ot(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ot(n),1===t)0===e.tag?function(e){Po=!0,To(e)}(Jc.bind(null,e)):To(Jc.bind(null,e)),Ya(function(){!(6&vc)&&No()}),n=null;else{switch(dn(r)){case 1:n=Vt;break;case 4:n=Wt;break;case 16:default:n=Ht;break;case 536870912:n=qt}n=bu(n,Gc.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Gc(e,t){if(Bc=-1,Vc=0,6&vc)throw Error(Q(327));var n=e.callbackNode;if(fu()&&e.callbackNode!==n)return null;var r=nn(e,e===bc?kc:0);if(0===r)return null;if(30&r||0!==(r&e.expiredLanes)||t)t=iu(e,r);else{t=r;var a=vc;vc|=2;var o=au();for(bc===e&&kc===t||(Nc=null,Tc=Ut()+500,nu(e,t));;)try{lu();break}catch(t){ru(e,t)}yi(),mc.current=o,vc=a,null!==wc?t=0:(bc=null,kc=0,t=Cc)}if(0!==t){if(2===t&&(0!==(a=an(e))&&(r=a,t=Qc(e,a))),1===t)throw n=Ec,nu(e,0),Xc(e,r),qc(e,Ut()),n;if(6===t)Xc(e,r);else{if(a=e.current.alternate,!(30&r||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var a=n[r],o=a.getSnapshot;a=a.value;try{if(!Xr(o(),a))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}(a)||(t=iu(e,r),2===t&&(o=an(e),0!==o&&(r=o,t=Qc(e,o))),1!==t)))throw n=Ec,nu(e,0),Xc(e,r),qc(e,Ut()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(Q(345));case 2:case 5:du(e,Pc,Nc);break;case 3:if(Xc(e,r),(130023424&r)===r&&10<(t=Lc+500-Ut())){if(0!==nn(e,0))break;if(((a=e.suspendedLanes)&r)!==r){Wc(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=qa(du.bind(null,e,Pc,Nc),t);break}du(e,Pc,Nc);break;case 4:if(Xc(e,r),(4194240&r)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-Yt(r);o=1<<i,(i=t[i])>a&&(a=i),r&=~o}if(r=a,10<(r=(120>(r=Ut()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*pc(r/1960))-r)){e.timeoutHandle=qa(du.bind(null,e,Pc,Nc),r);break}du(e,Pc,Nc);break;default:throw Error(Q(329))}}}return qc(e,Ut()),e.callbackNode===n?Gc.bind(null,e):null}function Qc(e,t){var n=Ac;return e.current.memoizedState.isDehydrated&&(nu(e,t).flags|=256),2!==(e=iu(e,t))&&(t=Pc,Pc=n,null!==t&&Yc(t)),e}function Yc(e){null===Pc?Pc=e:Pc.push.apply(Pc,e)}function Xc(e,t){for(t&=~Rc,t&=~Mc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Yt(t),r=1<<n;e[n]=-1,t&=~r}}function Jc(e){if(6&vc)throw Error(Q(327));fu();var t=nn(e,0);if(!(1&t))return qc(e,Ut()),null;var n=iu(e,t);if(0!==e.tag&&2===n){var r=an(e);0!==r&&(t=r,n=Qc(e,r))}if(1===n)throw n=Ec,nu(e,0),Xc(e,t),qc(e,Ut()),n;if(6===n)throw Error(Q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,du(e,Pc,Nc),qc(e,Ut()),null}function Zc(e,t){var n=vc;vc|=1;try{return e(t)}finally{0===(vc=n)&&(Tc=Ut()+500,Po&&No())}}function eu(e){null!==Oc&&0===Oc.tag&&!(6&vc)&&fu();var t=vc;vc|=1;var n=yc.transition,r=un;try{if(yc.transition=null,un=1,e)return e()}finally{un=r,yc.transition=n,!(6&(vc=t))&&No()}}function tu(){Sc=xc.current,go(xc)}function nu(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Ga(n)),null!==wc)for(n=wc.return;null!==n;){var r=n;switch(Ko(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&Co();break;case 3:Ui(),go(wo),go(bo),qi();break;case 5:Vi(r);break;case 4:Ui();break;case 13:case 19:go(Wi);break;case 10:vi(r.type._context);break;case 22:case 23:tu()}n=n.return}if(bc=e,wc=e=xu(e.current,null),kc=Sc=t,Cc=0,Ec=null,Rc=Mc=_c=0,Pc=Ac=null,null!==Si){for(t=0;t<Si.length;t++)if(null!==(r=(n=Si[t]).interleaved)){n.interleaved=null;var a=r.next,o=n.pending;if(null!==o){var i=o.next;o.next=a,r.next=i}n.pending=r}Si=null}return e}function ru(e,t){for(;;){var n=wc;try{if(yi(),Gi.current=Bs,es){for(var r=Xi.memoizedState;null!==r;){var a=r.queue;null!==a&&(a.pending=null),r=r.next}es=!1}if(Yi=0,Zi=Ji=Xi=null,ts=!1,ns=0,gc.current=null,null===n||null===n.return){Cc=1,Ec=t,wc=null;break}e:{var o=e,i=n.return,s=n,l=t;if(t=kc,s.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var c=l,u=s,d=u.tag;if(!(1&u.mode||0!==d&&11!==d&&15!==d)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=il(i);if(null!==h){h.flags&=-257,sl(h,i,s,0,t),1&h.mode&&ol(o,c,t),l=c;var p=(t=h).updateQueue;if(null===p){var m=new Set;m.add(l),t.updateQueue=m}else p.add(l);break e}if(!(1&t)){ol(o,c,t),ou();break e}l=Error(Q(426))}else if(Qo&&1&s.mode){var g=il(i);if(null!==g){!(65536&g.flags)&&(g.flags|=256),sl(g,i,s,0,t),oi(Zs(l,s));break e}}o=l=Zs(l,s),4!==Cc&&(Cc=2),null===Ac?Ac=[o]:Ac.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t,Ti(o,rl(0,l,t));break e;case 1:s=l;var y=o.type,v=o.stateNode;if(!(128&o.flags||"function"!=typeof y.getDerivedStateFromError&&(null===v||"function"!=typeof v.componentDidCatch||null!==zc&&zc.has(v)))){o.flags|=65536,t&=-t,o.lanes|=t,Ti(o,al(o,s,t));break e}}o=o.return}while(null!==o)}uu(n)}catch(e){t=e,wc===n&&null!==n&&(wc=n=n.return);continue}break}}function au(){var e=mc.current;return mc.current=Bs,null===e?Bs:e}function ou(){0!==Cc&&3!==Cc&&2!==Cc||(Cc=4),null===bc||!(268435455&_c)&&!(268435455&Mc)||Xc(bc,kc)}function iu(e,t){var n=vc;vc|=2;var r=au();for(bc===e&&kc===t||(Nc=null,nu(e,t));;)try{su();break}catch(t){ru(e,t)}if(yi(),vc=n,mc.current=r,null!==wc)throw Error(Q(261));return bc=null,kc=0,Cc}function su(){for(;null!==wc;)cu(wc)}function lu(){for(;null!==wc&&!$t();)cu(wc)}function cu(e){var t=hc(e.alternate,e,Sc);e.memoizedProps=e.pendingProps,null===t?uu(e):wc=t,gc.current=null}function uu(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=Ol(n,t)))return n.flags&=32767,void(wc=n);if(null===e)return Cc=6,void(wc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=Fl(n,t,Sc)))return void(wc=n);if(null!==(t=t.sibling))return void(wc=t);wc=t=e}while(null!==t);0===Cc&&(Cc=5)}function du(e,t,n){var r=un,a=yc.transition;try{yc.transition=null,un=1,function(e,t,n,r){do{fu()}while(null!==Oc);if(6&vc)throw Error(Q(327));n=e.finishedWork;var a=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Q(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-Yt(n),o=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~o}}(e,o),e===bc&&(wc=bc=null,kc=0),!(2064&n.subtreeFlags)&&!(2064&n.flags)||Fc||(Fc=!0,bu(Ht,function(){return fu(),null})),o=!!(15990&n.flags),!!(15990&n.subtreeFlags)||o){o=yc.transition,yc.transition=null;var i=un;un=1;var s=vc;vc|=4,gc.current=null,function(e,t){if(Wa=In,ra(e=na())){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 a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(e){n=null;break e}var i=0,s=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var h;d!==n||0!==a&&3!==d.nodeType||(s=i+a),d!==o||0!==r&&3!==d.nodeType||(l=i+r),3===d.nodeType&&(i+=d.nodeValue.length),null!==(h=d.firstChild);)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++c===a&&(s=i),f===o&&++u===r&&(l=i),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(Ha={focusedElem:e,selectionRange:n},In=!1,Bl=t;null!==Bl;)if(e=(t=Bl).child,1028&t.subtreeFlags&&null!==e)e.return=t,Bl=e;else for(;null!==Bl;){t=Bl;try{var p=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==p){var m=p.memoizedProps,g=p.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?m:Ks(t.type,m),g);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;1===b.nodeType?b.textContent="":9===b.nodeType&&b.documentElement&&b.removeChild(b.documentElement);break;default:throw Error(Q(163))}}catch(e){pu(t,t.return,e)}if(null!==(e=t.sibling)){e.return=t.return,Bl=e;break}Bl=t.return}p=Hl,Hl=!1}(e,n),ic(n,e),aa(Ha),In=!!Wa,Ha=Wa=null,e.current=n,lc(n),jt(),vc=s,un=i,yc.transition=o}else e.current=n;if(Fc&&(Fc=!1,Oc=e,$c=a),o=e.pendingLanes,0===o&&(zc=null),function(e){if(Qt&&"function"==typeof Qt.onCommitFiberRoot)try{Qt.onCommitFiberRoot(Gt,e,void 0,!(128&~e.current.flags))}catch(e){}}(n.stateNode),qc(e,Ut()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(Dc)throw Dc=!1,e=Ic,Ic=null,e;!!(1&$c)&&0!==e.tag&&fu(),o=e.pendingLanes,1&o?e===Uc?jc++:(jc=0,Uc=e):jc=0,No()}(e,t,n,r)}finally{yc.transition=a,un=r}return null}function fu(){if(null!==Oc){var e=dn($c),t=yc.transition,n=un;try{if(yc.transition=null,un=16>e?16:e,null===Oc)var r=!1;else{if(e=Oc,Oc=null,$c=0,6&vc)throw Error(Q(331));var a=vc;for(vc|=4,Bl=e.current;null!==Bl;){var o=Bl,i=o.child;if(16&Bl.flags){var s=o.deletions;if(null!==s){for(var l=0;l<s.length;l++){var c=s[l];for(Bl=c;null!==Bl;){var u=Bl;switch(u.tag){case 0:case 11:case 15:Kl(8,u,o)}var d=u.child;if(null!==d)d.return=u,Bl=d;else for(;null!==Bl;){var f=(u=Bl).sibling,h=u.return;if(Ql(u),u===c){Bl=null;break}if(null!==f){f.return=h,Bl=f;break}Bl=h}}}var p=o.alternate;if(null!==p){var m=p.child;if(null!==m){p.child=null;do{var g=m.sibling;m.sibling=null,m=g}while(null!==m)}}Bl=o}}if(2064&o.subtreeFlags&&null!==i)i.return=o,Bl=i;else e:for(;null!==Bl;){if(2048&(o=Bl).flags)switch(o.tag){case 0:case 11:case 15:Kl(9,o,o.return)}var y=o.sibling;if(null!==y){y.return=o.return,Bl=y;break e}Bl=o.return}}var v=e.current;for(Bl=v;null!==Bl;){var b=(i=Bl).child;if(2064&i.subtreeFlags&&null!==b)b.return=i,Bl=b;else e:for(i=v;null!==Bl;){if(2048&(s=Bl).flags)try{switch(s.tag){case 0:case 11:case 15:ql(9,s)}}catch(e){pu(s,s.return,e)}if(s===i){Bl=null;break e}var w=s.sibling;if(null!==w){w.return=s.return,Bl=w;break e}Bl=s.return}}if(vc=a,No(),Qt&&"function"==typeof Qt.onPostCommitFiberRoot)try{Qt.onPostCommitFiberRoot(Gt,e)}catch(e){}r=!0}return r}finally{un=n,yc.transition=t}}return!1}function hu(e,t,n){e=Pi(e,t=rl(0,t=Zs(n,t),1),1),t=Wc(),null!==e&&(ln(e,1,t),qc(e,t))}function pu(e,t,n){if(3===e.tag)hu(e,e,n);else for(;null!==t;){if(3===t.tag){hu(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===zc||!zc.has(r))){t=Pi(t,e=al(t,e=Zs(n,e),1),1),e=Wc(),null!==t&&(ln(t,1,e),qc(t,e));break}}t=t.return}}function mu(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=Wc(),e.pingedLanes|=e.suspendedLanes&n,bc===e&&(kc&n)===n&&(4===Cc||3===Cc&&(130023424&kc)===kc&&500>Ut()-Lc?nu(e,0):Rc|=n),qc(e,t)}function gu(e,t){0===t&&(1&e.mode?(t=en,!(130023424&(en<<=1))&&(en=4194304)):t=1);var n=Wc();null!==(e=Ei(e,t))&&(ln(e,t,n),qc(e,n))}function yu(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),gu(e,n)}function vu(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Q(314))}null!==r&&r.delete(t),gu(e,n)}function bu(e,t){return Ft(e,t)}function wu(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.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 ku(e,t,n,r){return new wu(e,t,n,r)}function Su(e){return!(!(e=e.prototype)||!e.isReactComponent)}function xu(e,t){var n=e.alternate;return null===n?((n=ku(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=14680064&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}function Cu(e,t,n,r,a,o){var i=2;if(r=e,"function"==typeof e)Su(e)&&(i=1);else if("string"==typeof e)i=5;else e:switch(e){case he:return Eu(n.children,a,o,t);case pe:i=8,a|=8;break;case me:return(e=ku(12,n,t,2|a)).elementType=me,e.lanes=o,e;case be:return(e=ku(13,n,t,a)).elementType=be,e.lanes=o,e;case we:return(e=ku(19,n,t,a)).elementType=we,e.lanes=o,e;case xe:return _u(n,a,o,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case ge:i=10;break e;case ye:i=9;break e;case ve:i=11;break e;case ke:i=14;break e;case Se:i=16,r=null;break e}throw Error(Q(130,null==e?e:typeof e,""))}return(t=ku(i,n,t,a)).elementType=e,t.type=r,t.lanes=o,t}function Eu(e,t,n,r){return(e=ku(7,e,r,t)).lanes=n,e}function _u(e,t,n,r){return(e=ku(22,e,r,t)).elementType=xe,e.lanes=n,e.stateNode={isHidden:!1},e}function Mu(e,t,n){return(e=ku(6,e,null,t)).lanes=n,e}function Ru(e,t,n){return(t=ku(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Au(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sn(0),this.expirationTimes=sn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sn(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Pu(e,t,n,r,a,o,i,s,l){return e=new Au(e,t,n,s,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=ku(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Mi(o),e}function Lu(e){if(!e)return vo;e:{if(Tt(e=e._reactInternals)!==e||1!==e.tag)throw Error(Q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(xo(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(Q(171))}if(1===e.tag){var n=e.type;if(xo(n))return _o(e,n,t)}return t}function Tu(e,t,n,r,a,o,i,s,l){return(e=Pu(n,r,!0,e,0,o,0,s,l)).context=Lu(null),n=e.current,(o=Ai(r=Wc(),a=Hc(n))).callback=null!=t?t:null,Pi(n,o,a),e.current.lanes=a,ln(e,a,r),qc(e,r),e}function Nu(e,t,n,r){var a=t.current,o=Wc(),i=Hc(a);return n=Lu(n),null===t.context?t.context=n:t.pendingContext=n,(t=Ai(o,i)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Pi(a,t,i))&&(Kc(e,a,i,o),Li(e,a,i)),i}function Du(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Iu(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function zu(e,t){Iu(e,t),(e=e.alternate)&&Iu(e,t)}hc=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||wo.current)cl=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return cl=!1,function(e,t,n){switch(t.tag){case 3:bl(t),ai();break;case 5:Bi(t);break;case 1:xo(t.type)&&Mo(t);break;case 4:ji(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;yo(hi,r._currentValue),r._currentValue=a;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(yo(Wi,1&Wi.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Ml(e,t,n):(yo(Wi,1&Wi.current),null!==(e=Dl(e,t,n))?e.sibling:null);yo(Wi,1&Wi.current);break;case 19:if(r=0!==(n&t.childLanes),128&e.flags){if(r)return Tl(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),yo(Wi,Wi.current),r)break;return null;case 22:case 23:return t.lanes=0,pl(e,t,n)}return Dl(e,t,n)}(e,t,n);cl=!!(131072&e.flags)}else cl=!1,Qo&&1048576&t.flags&&Wo(t,Fo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Nl(e,t),e=t.pendingProps;var a=So(t,bo.current);wi(t,n),a=is(null,t,r,e,a,n);var o=ss();return t.flags|=1,"object"==typeof a&&null!==a&&"function"==typeof a.render&&void 0===a.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xo(r)?(o=!0,Mo(t)):o=!1,t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,Mi(t),a.updater=Gs,t.stateNode=a,a._reactInternals=t,Js(t,r,e,n),t=vl(null,t,r,!0,o,n)):(t.tag=0,Qo&&o&&Ho(t),ul(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Nl(e,t),e=t.pendingProps,r=(a=r._init)(r._payload),t.type=r,a=t.tag=function(e){if("function"==typeof e)return Su(e)?1:0;if(null!=e){if((e=e.$$typeof)===ve)return 11;if(e===ke)return 14}return 2}(r),e=Ks(r,e),a){case 0:t=gl(null,t,r,e,n);break e;case 1:t=yl(null,t,r,e,n);break e;case 11:t=dl(null,t,r,e,n);break e;case 14:t=fl(null,t,r,Ks(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,gl(e,t,r,a=t.elementType===r?a:Ks(r,a),n);case 1:return r=t.type,a=t.pendingProps,yl(e,t,r,a=t.elementType===r?a:Ks(r,a),n);case 3:e:{if(bl(t),null===e)throw Error(Q(387));r=t.pendingProps,a=(o=t.memoizedState).element,Ri(e,t),Ni(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=wl(e,t,r,n,a=Zs(Error(Q(423)),t));break e}if(r!==a){t=wl(e,t,r,n,a=Zs(Error(Q(424)),t));break e}for(Go=Za(t.stateNode.containerInfo.firstChild),qo=t,Qo=!0,Yo=null,n=fi(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(ai(),r===a){t=Dl(e,t,n);break e}ul(e,t,r,n)}t=t.child}return t;case 5:return Bi(t),null===e&&ei(t),r=t.type,a=t.pendingProps,o=null!==e?e.memoizedProps:null,i=a.children,Ka(r,a)?i=null:null!==o&&Ka(r,o)&&(t.flags|=32),ml(e,t),ul(e,t,i,n),t.child;case 6:return null===e&&ei(t),null;case 13:return Ml(e,t,n);case 4:return ji(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=di(t,null,r,n):ul(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,dl(e,t,r,a=t.elementType===r?a:Ks(r,a),n);case 7:return ul(e,t,t.pendingProps,n),t.child;case 8:case 12:return ul(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,i=a.value,yo(hi,r._currentValue),r._currentValue=i,null!==o)if(Xr(o.value,i)){if(o.children===a.children&&!wo.current){t=Dl(e,t,n);break e}}else for(null!==(o=t.child)&&(o.return=t);null!==o;){var s=o.dependencies;if(null!==s){i=o.child;for(var l=s.firstContext;null!==l;){if(l.context===r){if(1===o.tag){(l=Ai(-1,n&-n)).tag=2;var c=o.updateQueue;if(null!==c){var u=(c=c.shared).pending;null===u?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}o.lanes|=n,null!==(l=o.alternate)&&(l.lanes|=n),bi(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(10===o.tag)i=o.type===t.type?null:o.child;else if(18===o.tag){if(null===(i=o.return))throw Error(Q(341));i.lanes|=n,null!==(s=i.alternate)&&(s.lanes|=n),bi(i,n,t),i=o.sibling}else i=o.child;if(null!==i)i.return=o;else for(i=o;null!==i;){if(i===t){i=null;break}if(null!==(o=i.sibling)){o.return=i.return,i=o;break}i=i.return}o=i}ul(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,wi(t,n),r=r(a=ki(a)),t.flags|=1,ul(e,t,r,n),t.child;case 14:return a=Ks(r=t.type,t.pendingProps),fl(e,t,r,a=Ks(r.type,a),n);case 15:return hl(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Ks(r,a),Nl(e,t),t.tag=1,xo(r)?(e=!0,Mo(t)):e=!1,wi(t,n),Ys(t,r,a),Js(t,r,a,n),vl(null,t,r,!0,e,n);case 19:return Tl(e,t,n);case 22:return pl(e,t,n)}throw Error(Q(156,t.tag))};var Fu="function"==typeof reportError?reportError:function(e){console.error(e)};function Ou(e){this._internalRoot=e}function $u(e){this._internalRoot=e}function ju(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Uu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Bu(){}function Vu(e,t,n,r,a){var o=n._reactRootContainer;if(o){var i=o;if("function"==typeof a){var s=a;a=function(){var e=Du(i);s.call(e)}}Nu(t,i,e,a)}else i=function(e,t,n,r,a){if(a){if("function"==typeof r){var o=r;r=function(){var e=Du(i);o.call(e)}}var i=Tu(t,r,e,0,null,!1,0,"",Bu);return e._reactRootContainer=i,e[ao]=i.current,Ta(8===e.nodeType?e.parentNode:e),eu(),i}for(;a=e.lastChild;)e.removeChild(a);if("function"==typeof r){var s=r;r=function(){var e=Du(l);s.call(e)}}var l=Pu(e,0,!1,null,0,!1,0,"",Bu);return e._reactRootContainer=l,e[ao]=l.current,Ta(8===e.nodeType?e.parentNode:e),eu(function(){Nu(t,l,n,r)}),l}(n,t,e,a,r);return Du(i)}$u.prototype.render=Ou.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(Q(409));Nu(e,t,null,null)},$u.prototype.unmount=Ou.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;eu(function(){Nu(null,e,null,null)}),t[ao]=null}},$u.prototype.unstable_scheduleHydration=function(e){if(e){var t=mn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Cn.length&&0!==t&&t<Cn[n].priority;n++);Cn.splice(n,0,e),0===n&&Rn(e)}},fn=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=tn(t.pendingLanes);0!==n&&(cn(t,1|n),qc(t,Ut()),!(6&vc)&&(Tc=Ut()+500,No()))}break;case 13:eu(function(){var t=Ei(e,1);if(null!==t){var n=Wc();Kc(t,e,1,n)}}),zu(e,1)}},hn=function(e){if(13===e.tag){var t=Ei(e,134217728);if(null!==t)Kc(t,e,134217728,Wc());zu(e,134217728)}},pn=function(e){if(13===e.tag){var t=Hc(e),n=Ei(e,t);if(null!==n)Kc(n,e,t,Wc());zu(e,t)}},mn=function(){return un},gn=function(e,t){var n=un;try{return un=e,t()}finally{un=n}},ft=function(e,t,n){switch(t){case"input":if(Be(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=fo(r);if(!a)throw Error(Q(90));Fe(r),Be(r,a)}}}break;case"textarea":Qe(e,n);break;case"select":null!=(t=n.value)&&Ke(e,!!n.multiple,t,!1)}},vt=Zc,bt=eu;var Wu={usingClientEntryPoint:!1,Events:[co,uo,fo,gt,yt,Zc]},Hu={findFiberByHostInstance:lo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Ku={bundleType:Hu.bundleType,version:Hu.version,rendererPackageName:Hu.rendererPackageName,rendererConfig:Hu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ue.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=It(e))?null:e.stateNode},findFiberByHostInstance:Hu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var qu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qu.isDisabled&&qu.supportsFiber)try{Gt=qu.inject(Ku),Qt=qu}catch(et){}}V.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Wu,V.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!ju(t))throw Error(Q(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:fe,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},V.createRoot=function(e,t){if(!ju(e))throw Error(Q(299));var n=!1,r="",a=Fu;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(a=t.onRecoverableError)),t=Pu(e,1,!1,null,0,n,0,r,a),e[ao]=t.current,Ta(8===e.nodeType?e.parentNode:e),new Ou(t)},V.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(Q(188));throw e=Object.keys(e).join(","),Error(Q(268,e))}return e=null===(e=It(t))?null:e.stateNode},V.flushSync=function(e){return eu(e)},V.hydrate=function(e,t,n){if(!Uu(t))throw Error(Q(200));return Vu(null,e,t,!0,n)},V.hydrateRoot=function(e,t,n){if(!ju(e))throw Error(Q(405));var r=null!=n&&n.hydratedSources||null,a=!1,o="",i=Fu;if(null!=n&&(!0===n.unstable_strictMode&&(a=!0),void 0!==n.identifierPrefix&&(o=n.identifierPrefix),void 0!==n.onRecoverableError&&(i=n.onRecoverableError)),t=Tu(t,null,e,1,null!=n?n:null,a,0,o,i),e[ao]=t.current,Ta(e),r)for(e=0;e<r.length;e++)a=(a=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new $u(t)},V.render=function(e,t,n){if(!Uu(t))throw Error(Q(200));return Vu(null,e,t,!1,n)},V.unmountComponentAtNode=function(e){if(!Uu(e))throw Error(Q(40));return!!e._reactRootContainer&&(eu(function(){Vu(null,null,e,!1,function(){e._reactRootContainer=null,e[ao]=null})}),!0)},V.unstable_batchedUpdates=Zc,V.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Uu(n))throw Error(Q(200));if(null==e||void 0===e._reactInternals)throw Error(Q(38));return Vu(e,t,n,!1,r)},V.version="18.3.1-next-f1338f8080-20240426",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)}}(),B.exports=V;var Gu,Qu=B.exports;Gu=Qu.createRoot,Qu.hydrateRoot;var Yu={exports:{}},Xu={},Ju=j,Zu=Symbol.for("react.element"),ed=Symbol.for("react.fragment"),td=Object.prototype.hasOwnProperty,nd=Ju.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,rd={key:!0,ref:!0,__self:!0,__source:!0};function ad(e,t,n){var r,a={},o=null,i=null;for(r in void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),void 0!==t.ref&&(i=t.ref),t)td.call(t,r)&&!rd.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===a[r]&&(a[r]=t[r]);return{$$typeof:Zu,type:e,key:o,ref:i,props:a,_owner:nd.current}}Xu.Fragment=ed,Xu.jsx=ad,Xu.jsxs=ad,Yu.exports=Xu;var od=Yu.exports;function id(e){return{title:e.title,snippet:e.content,relevance:e.score,documentId:e.documentId,fullContent:e.fullContent,downloadUrl:e.downloadUrl,documentName:e.documentName,sourceType:e.sourceType,chunkId:e.chunkId}}class sd{constructor(e,t){this.baseUrl=e.replace(/\/$/,""),this.apiKey=t}async chat(e,t){const n=await fetch(`${this.baseUrl}/api/external/chat`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.apiKey},body:JSON.stringify({message:e,sessionId:t?.sessionId,context:t?.context})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`HTTP ${n.status}: ${n.statusText}`)}const r=await n.json();return{...r,sources:(r.sources||[]).map(id)}}async chatStream(e,t){const n=await fetch(`${this.baseUrl}/api/external/chat/stream`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.apiKey},body:JSON.stringify({message:e,sessionId:t?.sessionId,context:t?.context})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`HTTP ${n.status}`)}const r=n.body?.getReader();if(!r)throw new Error("Streaming not supported");const a=new TextDecoder;let o,i="",s="",l=[];try{for(;;){const{done:e,value:n}=await r.read();if(e)break;i+=a.decode(n,{stream:!0});const c=i.split("\n");i=c.pop()||"";for(const e of c)if(e.startsWith("event: "));else if(e.startsWith("data: "))try{const n=JSON.parse(e.slice(6));void 0!==n.text?(s+=n.text,t.onToken?.(n.text)):void 0!==n.sources?(l=(n.sources||[]).map(id),t.onSources?.(l)):void 0!==n.sessionId&&(o=n.sessionId)}catch{}}t.onComplete?.({fullText:s,sessionId:o,sources:l})}catch(e){t.onError?.(e)}}async getGeneralDocs(e){const t=new URLSearchParams;e&&t.set("since",e);const n=`${this.baseUrl}/api/external/docs${t.toString()?"?"+t:""}`,r=await fetch(n,{headers:{"X-API-Key":this.apiKey}});if(!r.ok)throw new Error(`HTTP ${r.status}`);return(await r.json()).documents}async getStatus(){const e=await fetch(`${this.baseUrl}/api/external/status`,{headers:{"X-API-Key":this.apiKey}});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async health(){const e=await fetch(`${this.baseUrl}/api/external/health`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}}let ld,cd;const ud=new WeakMap,dd=new WeakMap,fd=new WeakMap,hd=new WeakMap,pd=new WeakMap;let md={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return dd.get(e);if("objectStoreNames"===t)return e.objectStoreNames||fd.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return vd(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function gd(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(cd||(cd=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(bd(this),t),vd(ud.get(this))}:function(...t){return vd(e.apply(bd(this),t))}:function(t,...n){const r=e.call(bd(this),t,...n);return fd.set(r,t.sort?t.sort():[t]),vd(r)}}function yd(e){return"function"==typeof e?gd(e):(e instanceof IDBTransaction&&function(e){if(dd.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",o),e.removeEventListener("abort",o)},a=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",a),e.addEventListener("error",o),e.addEventListener("abort",o)});dd.set(e,t)}(e),t=e,(ld||(ld=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,md):e);var t}function vd(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",a),e.removeEventListener("error",o)},a=()=>{t(vd(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",a),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&ud.set(t,e)}).catch(()=>{}),pd.set(t,e),t}(e);if(hd.has(e))return hd.get(e);const t=yd(e);return t!==e&&(hd.set(e,t),pd.set(t,e)),t}const bd=e=>pd.get(e);function wd(e,t,{blocked:n,upgrade:r,blocking:a,terminated:o}={}){const i=indexedDB.open(e,t),s=vd(i);return r&&i.addEventListener("upgradeneeded",e=>{r(vd(i.result),e.oldVersion,e.newVersion,vd(i.transaction),e)}),n&&i.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),s.then(e=>{o&&e.addEventListener("close",()=>o()),a&&e.addEventListener("versionchange",e=>a(e.oldVersion,e.newVersion,e))}).catch(()=>{}),s}const kd=["get","getKey","getAll","getAllKeys","count"],Sd=["put","add","delete","clear"],xd=new Map;function Cd(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(xd.get(t))return xd.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,a=Sd.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!a&&!kd.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,a?"readwrite":"readonly");let i=o.store;return r&&(i=i.index(t.shift())),(await Promise.all([i[n](...t),a&&o.done]))[0]};return xd.set(t,o),o}md=(e=>({...e,get:(t,n,r)=>Cd(t,n)||e.get(t,n,r),has:(t,n)=>!!Cd(t,n)||e.has(t,n)}))(md);class Ed{constructor(e){this.db=null,this.dbPromise=null,this.documentCount=0,this.lastSyncAt=null,this.config=e,"indexeddb"===e.storage&&"undefined"!=typeof indexedDB?this.dbPromise=this.initDB():"localstorage"===e.storage&&this.loadLocalStorageMetadata()}loadLocalStorageMetadata(){try{const e=localStorage.getItem("cybernetic-cache-meta");if(e){const t=JSON.parse(e);this.documentCount=t.documentCount||0,this.lastSyncAt=t.lastSyncAt||null}}catch{}}async initDB(){return this.db=await wd("cybernetic-cache",1,{upgrade(e){if(!e.objectStoreNames.contains("documents")){e.createObjectStore("documents",{keyPath:"id"}).createIndex("by-updated","updatedAt")}e.objectStoreNames.contains("metadata")||e.createObjectStore("metadata",{keyPath:"key"})}}),await this.loadMetadata(),this.db}async getDB(){if(this.db)return this.db;if(this.dbPromise)return this.dbPromise;throw new Error("Database not available")}async loadMetadata(){if(!this.db)return;const e=await this.db.get("metadata","documentCount");this.documentCount=e?.value||0;const t=await this.db.get("metadata","lastSyncAt");this.lastSyncAt=t?.value||null}async store(e){if("localstorage"===this.config.storage)return this.storeLocalStorage(e);const t=(await this.getDB()).transaction(["documents","metadata"],"readwrite");for(const n of e)await t.objectStore("documents").put(n);this.documentCount=await t.objectStore("documents").count(),this.lastSyncAt=(new Date).toISOString(),await t.objectStore("metadata").put({key:"documentCount",value:this.documentCount}),await t.objectStore("metadata").put({key:"lastSyncAt",value:this.lastSyncAt}),await t.done}async retrieve(){if("localstorage"===this.config.storage)return this.retrieveLocalStorage();return(await this.getDB()).getAll("documents")}async getLastSync(){return this.lastSyncAt}getStatus(){const e=Date.now()-(this.lastSyncAt?new Date(this.lastSyncAt).getTime():0)>this.config.maxAge;return{documentCount:this.documentCount,lastSyncAt:this.lastSyncAt,cacheSize:5e3*this.documentCount,isStale:e}}async clear(){if("localstorage"===this.config.storage)return localStorage.removeItem("cybernetic-cache-docs"),localStorage.removeItem("cybernetic-cache-meta"),this.documentCount=0,void(this.lastSyncAt=null);const e=(await this.getDB()).transaction(["documents","metadata"],"readwrite");await e.objectStore("documents").clear(),await e.objectStore("metadata").clear(),await e.done,this.documentCount=0,this.lastSyncAt=null}storeLocalStorage(e){try{localStorage.setItem("cybernetic-cache-docs",JSON.stringify(e)),this.documentCount=e.length,this.lastSyncAt=(new Date).toISOString(),localStorage.setItem("cybernetic-cache-meta",JSON.stringify({documentCount:this.documentCount,lastSyncAt:this.lastSyncAt}))}catch{localStorage.removeItem("cybernetic-cache-docs");const t=e.slice(0,50);localStorage.setItem("cybernetic-cache-docs",JSON.stringify(t)),this.documentCount=t.length}}retrieveLocalStorage(){try{const e=localStorage.getItem("cybernetic-cache-docs");return e?JSON.parse(e):[]}catch{return[]}}}class _d{constructor(){this.documents=[],this.idf=new Map,this.indexed=!1,this.loadedFromExport=!1,this.vocabulary=new Map}isIndexed(){return this.indexed&&this.documents.length>0}async index(e){this.documents=[],this.idf=new Map;const t=new Map;for(const n of e){if(!n.content)continue;const e=this.tokenize(n.content),r=new Set(e);for(const e of r)t.set(e,(t.get(e)||0)+1);this.documents.push({id:n.id,title:n.title,content:n.content,tokens:e,tfidf:new Map})}const n=e.length;for(const[e,r]of t)this.idf.set(e,Math.log((n+1)/(r+1))+1);for(const e of this.documents){const t=this.computeTermFrequency(e.tokens);for(const[n,r]of t){const t=this.idf.get(n)||1;e.tfidf.set(n,r*t)}}this.indexed=!0}async ask(e){if(!this.indexed||0===this.documents.length)return{answer:"I don't have any information available offline.",sources:[],topScore:0};const t=this.tokenize(e),n=this.computeTermFrequency(t),r=new Map;for(const[e,t]of n){const n=this.idf.get(e)||1;r.set(e,t*n)}const a=this.documents.map(e=>({doc:e,score:this.cosineSimilarity(r,e.tfidf)}));a.sort((e,t)=>t.score-e.score);const o=a.slice(0,3).filter(e=>e.score>.1);if(0===o.length)return{answer:"I couldn't find relevant information for your question in my offline data.",sources:[],topScore:a[0]?.score||0};const i=o[0].doc;return{answer:this.extractRelevantSnippet(i.content,t),sources:o.map(e=>({title:e.doc.title,snippet:e.doc.content.substring(0,200)+"...",score:e.score})),topScore:o[0].score}}reset(){this.documents=[],this.idf=new Map,this.vocabulary=new Map,this.indexed=!1,this.loadedFromExport=!1,this.exportVersion=void 0,this.exportedAt=void 0}async loadFromExport(e){this.reset(),this.idf=new Map(Object.entries(e.tfidfIndex.idf));let t=0;for(const e of this.idf.keys())this.vocabulary.set(e,t++);for(const t of e.documents){const e=new Map;for(const[n,r]of t.tfidfVector)for(const[t,a]of this.vocabulary)if(a===n){e.set(t,r);break}this.documents.push({id:t.id,title:t.title,content:t.content,tokens:[],tfidf:e})}this.indexed=!0,this.loadedFromExport=!0,this.exportVersion=e.version,this.exportedAt=e.meta.exportedAt,console.log(`[CyberneticLocalRAG] Loaded ${this.documents.length} documents from export (v${e.version})`)}getExportStatus(){return{loaded:this.indexed,loadedFromExport:this.loadedFromExport,documentCount:this.documents.length,chunkCount:this.documents.length,exportVersion:this.exportVersion,exportedAt:this.exportedAt}}tokenize(e){return e&&"string"==typeof e?e.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(e=>e.length>2&&!this.isStopWord(e)):[]}computeTermFrequency(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)||0)+1);const n=Math.max(...t.values());if(n>0)for(const[e,r]of t)t.set(e,r/n);return t}cosineSimilarity(e,t){let n=0,r=0,a=0;for(const[a,o]of e){n+=o*(t.get(a)||0),r+=o*o}for(const e of t.values())a+=e*e;return 0===r||0===a?0:n/(Math.sqrt(r)*Math.sqrt(a))}extractRelevantSnippet(e,t){const n=e.split(/[.!?]+/).filter(e=>e.trim().length>0).map(e=>{const n=new Set(this.tokenize(e));let r=0;for(const e of t)n.has(e)&&r++;return{sentence:e.trim(),score:r}});n.sort((e,t)=>t.score-e.score);const r=n.slice(0,3).filter(e=>e.score>0);return 0===r.length?e.substring(0,300)+"...":r.map(e=>e.sentence).join(". ")+"."}isStopWord(e){return new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","from","up","about","into","through","during","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","this","that","these","those","it","its","they","them","their","what","which","who","whom","when","where","why","how","all","each","every","both","few","more","most","other","some","such","no","not","only","same","so","than","too","very"]).has(e)}}class Md{constructor(){this.db=null,this.dbPromise=null,this.dbName="cybernetic-offline-vectors",this.dbVersion=1}async initDB(){return this.db?this.db:this.dbPromise?this.dbPromise:(this.dbPromise=wd(this.dbName,this.dbVersion,{upgrade(e){e.objectStoreNames.contains("vectors")||e.createObjectStore("vectors",{keyPath:"id"})}}),this.db=await this.dbPromise,this.db)}async store(e,t){const n=await this.getDB();await n.put("vectors",{id:e,exportVersion:t.version,exportedAt:t.meta.exportedAt,type:t.type,data:t}),console.log(`[CyberneticOfflineStorage] Stored ${t.meta.chunkCount} chunks`)}async retrieve(e){const t=await this.getDB(),n=await t.get("vectors",e);return n?.data??null}async isValid(e,t){const n=await this.getDB(),r=await n.get("vectors",e);if(!r)return!1;const a=new Date(r.exportedAt).getTime();return Date.now()-a<t}async getMeta(e){const t=await this.getDB(),n=await t.get("vectors",e);return n?{version:n.exportVersion,exportedAt:n.exportedAt,documentCount:n.data.meta.documentCount,chunkCount:n.data.meta.chunkCount,type:n.type}:null}async hasData(){const e=await this.getDB();return await e.count("vectors")>0}async getStoredIds(){return(await this.getDB()).getAllKeys("vectors")}async delete(e){const t=await this.getDB();await t.delete("vectors",e)}async clear(){const e=await this.getDB();await e.clear("vectors"),console.log("[CyberneticOfflineStorage] Cache cleared")}async getDB(){return this.db?this.db:this.initDB()}close(){this.db&&(this.db.close(),this.db=null,this.dbPromise=null)}}function Rd(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=t.length%4;n&&(t+="=".repeat(4-n));const r=atob(t),a=new Uint8Array(r.length);for(let e=0;e<r.length;e++)a[e]=r.charCodeAt(e);return a}function Ad(e){const t=Rd(e);return(new TextDecoder).decode(t)}async function Pd(e,t,n){try{const r=await async function(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return crypto.subtle.importKey("spki",r.buffer,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])}(n),a=(new TextEncoder).encode(e),o=new Uint8Array(t).buffer;return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},r,o,a)}catch(e){return console.warn("[License] Signature verification failed:",e),!1}}async function Ld(e,t){if(!e||""===e.trim())return{status:"missing",payload:null,error:"No license key provided",inGracePeriod:!1,daysRemaining:null};const n=function(e){try{const t=e.split(".");if(3!==t.length)return null;const[n,r,a]=t;return{header:JSON.parse(Ad(n)),payload:JSON.parse(Ad(r)),signature:Rd(a),signedContent:`${n}.${r}`}}catch{return null}}(e);if(!n)return{status:"invalid",payload:null,error:"Invalid license key format",inGracePeriod:!1,daysRemaining:null};const r=function(e){return"string"!=typeof e.iss||"string"!=typeof e.sub||"string"!=typeof e.aud||"number"!=typeof e.iat||"number"!=typeof e.exp||"string"!=typeof e.plan||"number"!=typeof e.seats?null:Array.isArray(e.features)?"number"!=typeof e.licenseVersion?null:{iss:e.iss,sub:e.sub,aud:e.aud,iat:e.iat,exp:e.exp,plan:e.plan,org:"string"==typeof e.org?e.org:void 0,seats:e.seats,features:e.features,graceUntil:"number"==typeof e.graceUntil?e.graceUntil:void 0,licenseVersion:e.licenseVersion}:null}(n.payload);if(!r)return{status:"invalid",payload:null,error:"Invalid license payload structure",inGracePeriod:!1,daysRemaining:null};if("astermind"!==r.iss)return{status:"invalid",payload:null,error:"Invalid license issuer",inGracePeriod:!1,daysRemaining:null};if("cybernetic-chatbot"!==r.aud&&"*"!==r.aud)return{status:"invalid",payload:null,error:"License not valid for this product",inGracePeriod:!1,daysRemaining:null};if("undefined"!=typeof crypto&&crypto.subtle){const e=t||"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhLW7MXHQ0Fuk1OKt9D5CbRw7fUMN\nLJ5AZXvOhHaXdHzMuYKX5BpK4w7TqbPvJ6QPvKmLKvHh1VKcUJ6mJQgJJw==\n-----END PUBLIC KEY-----";if(!await Pd(n.signedContent,n.signature,e))return{status:"invalid",payload:null,error:"License signature verification failed",inGracePeriod:!1,daysRemaining:null}}const a=Math.floor(Date.now()/1e3),o=function(e){const t=e-Math.floor(Date.now()/1e3);return Math.floor(t/86400)}(r.exp);return r.exp<a?r.graceUntil&&r.graceUntil>a?{status:"valid",payload:r,inGracePeriod:!0,daysRemaining:o}:{status:"expired",payload:r,error:"License has expired",inGracePeriod:!1,daysRemaining:o}:"eval"===r.plan?{status:"eval",payload:r,inGracePeriod:!1,daysRemaining:o}:{status:"valid",payload:r,inGracePeriod:!1,daysRemaining:o}}const Td="cybernetic-chatbot-client",Nd="agentic";class Dd{constructor(e={}){this.state=null,this.verificationPromise=null,this.hasLoggedWarning=!1,this.loggedMissingFeatures=new Set,this.config=e,this.environment=e.environment||function(){if("undefined"==typeof window)return"production"===process?.env?.NODE_ENV?"production":"development";const e=window.location?.hostname||"",t=["localhost","127.0.0.1","0.0.0.0",".local",".dev",".test",":3000",":5173",":8080",":4200"];for(const n of t)if(e.includes(n)||window.location?.port===n.replace(":",""))return"development";if("file:"===window.location?.protocol)return"development";const n=["staging.","preview.","-preview.",".vercel.app",".netlify.app",".pages.dev"];for(const t of n)if(e.includes(t))return"production";return"production"}(),this.enforcementMode="development"===this.environment?"soft":"hard"}async verify(){if(this.state)return this.state;if(this.verificationPromise)return this.verificationPromise;this.verificationPromise=Ld(this.config.licenseKey,this.config.publicKey);try{return this.state=await this.verificationPromise,this.config.onStatusChange?.(this.state),this.logLicenseStatus(),this.state}finally{this.verificationPromise=null}}getState(){return this.state}isValid(){return!!this.state&&("valid"===this.state.status||"eval"===this.state.status)}requiresAction(){return!this.state||("expired"===this.state.status||"missing"===this.state.status||"invalid"===this.state.status)}getEnvironment(){return this.environment}getEnforcementMode(){return this.enforcementMode}processResponse(e){return this.state?this.isValid()&&!this.state.inGracePeriod?e:"soft"===this.enforcementMode?(this.hasLoggedWarning||(this.logDevelopmentWarning(),this.hasLoggedWarning=!0),e):e+"\n\n---\n⚠️ License Notice: Your AsterMind license key needs to be updated. Please contact support@astermind.ai or visit https://astermind.ai/license to renew your license.":e}getStatusMessage(){if(!this.state)return"License not verified";switch(this.state.status){case"valid":return this.state.inGracePeriod?`License expired but in grace period (${Math.abs(this.state.daysRemaining||0)} days overdue)`:`License valid (${this.state.daysRemaining} days remaining)`;case"eval":return`Evaluation license (${this.state.daysRemaining} days remaining)`;case"expired":return`License expired ${Math.abs(this.state.daysRemaining||0)} days ago`;case"missing":return"No license key provided";case"invalid":return`Invalid license: ${this.state.error}`;default:return"Unknown license status"}}async reVerify(){return this.state=null,this.hasLoggedWarning=!1,this.loggedMissingFeatures.clear(),this.verify()}hasFeature(e){return!!this.state?.payload&&this.state.payload.features.includes(e)}getFeatures(){return this.state?.payload?.features||[]}checkClientFeature(){return this.checkFeatureWithLog(Td,"CyberneticClient")}checkAgenticFeature(){return this.checkFeatureWithLog(Nd,"Agentic capabilities")}checkFeatureWithLog(e,t){if(!this.state?.payload)return!0;const n=this.state.payload.features.includes(e);return n||this.loggedMissingFeatures.has(e)||(this.loggedMissingFeatures.add(e),this.logMissingFeature(e,t)),n}logMissingFeature(e,t){const n=this.getFeatures(),r=this.state?.payload?.plan||"unknown";console.warn(`[Cybernetic License] ${t} requires the '${e}' feature, which is not included in your license.`),console.info(`[Cybernetic License] Current license plan: ${r}`),console.info(`[Cybernetic License] Licensed features: ${n.length>0?n.join(", "):"(none)"}`),console.info("[Cybernetic License] To add this feature, upgrade your license at https://astermind.ai/license")}logLicenseStatus(){if(!this.state)return;const e="[Cybernetic License]";switch(this.state.status){case"valid":this.state.inGracePeriod?console.warn(`${e} License expired but in grace period. Please renew at https://astermind.ai/license`):null!==this.state.daysRemaining&&this.state.daysRemaining<=30&&console.info(`${e} License expires in ${this.state.daysRemaining} days`);break;case"eval":console.info(`${e} Evaluation license - ${this.state.daysRemaining} days remaining`);break;case"expired":console.error(`${e} License expired. Enforcement mode: ${this.enforcementMode}. Renew at https://astermind.ai/license`);break;case"missing":console.warn(`${e} No license key provided. Enforcement mode: ${this.enforcementMode}. Get a license at https://astermind.ai/license`);break;case"invalid":console.error(`${e} Invalid license: ${this.state.error}. Enforcement mode: ${this.enforcementMode}`)}}logDevelopmentWarning(){console.warn(`[Cybernetic License] Running in development mode with ${this.state?.status||"unknown"} license. In production, a warning will be appended to chatbot responses. Get a license at https://astermind.ai/license`)}}class Id{constructor(e){this.status="connecting",this.lastError=null,this.systemSettings=null,this.settingsLastChecked=0,this.SETTINGS_CHECK_INTERVAL=3e5,this.agenticCapabilities=null,this.offlineStorage=null,this.omegaRAG=null,this.offlineWarningShown=!1,this.config={apiUrl:e.apiUrl,apiKey:e.apiKey,fallback:{enabled:e.fallback?.enabled??!0,cacheMaxAge:e.fallback?.cacheMaxAge??864e5,cacheOnConnect:e.fallback?.cacheOnConnect??!0,cacheStorage:e.fallback?.cacheStorage??"indexeddb"},retry:{maxRetries:e.retry?.maxRetries??2,initialDelay:e.retry?.initialDelay??1e3,exponentialBackoff:e.retry?.exponentialBackoff??!0},agentic:e.agentic??null,offline:e.offline??null,sitemap:e.sitemap??null,sources:{enabled:e.sources?.enabled??!0,showSummary:e.sources?.showSummary??!0,showDownload:e.sources?.showDownload??!0,includeFullContent:e.sources?.includeFullContent??!1,maxSources:e.sources?.maxSources??5},onStatusChange:e.onStatusChange||(()=>{}),onError:e.onError||(()=>{})},this.apiClient=new sd(this.config.apiUrl,this.config.apiKey),this.cache=new Ed({storage:this.config.fallback.cacheStorage,maxAge:this.config.fallback.cacheMaxAge}),this.localRAG=new _d,this.licenseManager=new Dd({licenseKey:e.licenseKey}),this.licenseManager.verify().then(()=>{this.licenseManager.checkClientFeature()}).catch(()=>{}),this.monitorConnection(),this.config.fallback.enabled&&this.config.fallback.cacheOnConnect&&this.syncCache().catch(()=>{}),this.config.offline?.enabled&&this.initializeOffline(this.config.offline).catch(e=>{console.warn("[Cybernetic] Failed to initialize offline vectors:",e)})}registerAgentic(e){this.agenticCapabilities=e,console.log("[Cybernetic] Agentic capabilities registered")}isAgenticEnabled(){return null!==this.agenticCapabilities&&!0===this.config.agentic?.enabled&&(this.licenseManager.checkAgenticFeature(),!0)}getAgenticCapabilities(){return this.agenticCapabilities}getAgenticConfig(){return this.config.agentic}getSourcesConfig(){return{...this.config.sources}}isSourceFeatureAvailable(e){return!!this.config.sources.enabled&&("summary"===e?this.config.sources.showSummary:"download"===e&&(this.config.sources.showDownload&&"online"===this.status))}classifyIntent(e){if(!this.isAgenticEnabled()||!this.agenticCapabilities)return null;const t=this.config.agentic;return new(0,this.agenticCapabilities.agent)(t).interpretIntent(e)}async executeAction(e){if(!this.isAgenticEnabled()||!this.agenticCapabilities)return{success:!1,message:"Agentic capabilities not enabled"};const t=this.config.agentic;return new(0,this.agenticCapabilities.agent)(t).executeAction(e)}async smartAsk(e,t){const n=this.classifyIntent(e);if(n&&n.action&&!n.shouldEscalate){if(!1!==this.config.agentic?.requireConfirmation)return{action:n.action};const e=await this.executeAction(n.action);return{action:n.action,actionResult:e}}return{response:await this.ask(e,t)}}async initializeOffline(e){const t=e.storageMode??"hybrid",n=e.cacheMaxAge??6048e5;if("memory"!==t&&(this.offlineStorage=new Md),this.offlineStorage&&"memory"!==t){const e="default";if(await this.offlineStorage.isValid(e,n)){console.log("[Cybernetic] Loading vectors from IndexedDB cache");const t=await this.offlineStorage.retrieve(e);if(t)return await this.localRAG.loadFromExport(t),void console.log("[Cybernetic] Loaded vectors from IndexedDB cache")}}if(e.vectorFileUrl)try{const n=await fetch(e.vectorFileUrl);if(!n.ok)throw new Error(`Failed to fetch vectors: ${n.status}`);const r=await n.json();return this.offlineStorage&&"memory"!==t&&await this.offlineStorage.store("default",r),await this.localRAG.loadFromExport(r),e.omega?.enabled&&await this.initializeOmega(e),void console.log("[Cybernetic] Loaded vectors from URL:",e.vectorFileUrl)}catch(e){console.error("[Cybernetic] Failed to load offline vectors from URL:",e)}if(e.vectorData)return await this.localRAG.loadFromExport(e.vectorData),e.omega?.enabled&&await this.initializeOmega(e),void console.log("[Cybernetic] Loaded inline vector data");this.offlineWarningShown||(console.warn("[Cybernetic] Offline functionality is enabled but no vectors are loaded. Offline responses will be limited. To enable full offline functionality, export vectors from the AsterMind admin panel and configure the vectorFileUrl or vectorData option."),this.offlineWarningShown=!0)}async initializeOmega(e){if(e.omega?.enabled)try{const{OmegaOfflineRAG:t}=await Promise.resolve().then(function(){return yf});this.omegaRAG=new t({reranking:e.omega.reranking,topK:5,verbose:!1}),e.omega.modelUrl?await this.omegaRAG.loadModelFromUrl(e.omega.modelUrl):e.omega.modelData&&await this.omegaRAG.loadModel(e.omega.modelData),console.log("[Cybernetic] Omega RAG initialized")}catch(e){console.warn("[Cybernetic] Failed to initialize Omega RAG:",e),this.omegaRAG=null}}async reloadOfflineVectors(){this.config.offline?.enabled?(this.localRAG.reset(),this.offlineStorage&&await this.offlineStorage.clear(),this.omegaRAG&&this.omegaRAG.clear(),await this.initializeOffline(this.config.offline)):console.warn("[Cybernetic] Offline mode is not enabled")}isOmegaOfflineEnabled(){return this.omegaRAG?.isReady()??!1}getOfflineModelInfo(){return this.omegaRAG?.getModelInfo()??null}getLocalRAGStatus(){return this.localRAG.getExportStatus()}getOfflineStorage(){return this.offlineStorage}async ask(e,t){if(!e||"string"!=typeof e)return this.createErrorResponse("Message is required","none");const n=await this.checkSystemStatus();if(n.maintenanceMode||n.forceOfflineClients)return console.log("[Cybernetic] Maintenance mode active, using cached data"),this.isCacheValid()?await this.fallbackAsk(e):{reply:n.maintenanceMessage||"The service is currently under maintenance. Please try again later.",confidence:"none",sources:[],offline:!0,degradedReason:"Maintenance mode active, no valid cache available"};try{const n=await this.apiWithRetry(e,t);this.setStatus("online");return{reply:this.licenseManager.processResponse(n.reply),confidence:"high",sources:n.sources||[],offline:!1,sessionId:n.sessionId}}catch(n){const r=this.normalizeError(n);return this.lastError=r,this.config.onError(r),"RATE_LIMIT"===r.code?{reply:"I'm receiving too many requests right now. Please try again in a moment.",confidence:"none",sources:[],offline:!1,retryAfter:r.retryAfter}:this.config.fallback.enabled&&!t?.skipFallback?await this.fallbackAsk(e):this.createErrorResponse("Unable to connect to the chatbot service. Please try again later.","none",r.retryAfter)}}async askStream(e,t,n){if(!e||"string"!=typeof e)return void t.onError?.({code:"LOCAL_RAG_ERROR",message:"Message is required"});const r=await this.checkSystemStatus();if(r.maintenanceMode||r.forceOfflineClients){console.log("[Cybernetic] Maintenance mode active, falling back to offline");const n=await this.fallbackAsk(e);return void t.onComplete?.(n)}try{await this.apiClient.chatStream(e,{sessionId:n?.sessionId,context:n?.context,onToken:t.onToken,onSources:t.onSources,onComplete:e=>{this.setStatus("online");const n=this.licenseManager.processResponse(e.fullText);t.onComplete?.({reply:n,confidence:"high",sources:e.sources||[],offline:!1,sessionId:e.sessionId})},onError:e=>{const n=this.normalizeError(e);this.config.onError(n),t.onError?.(n)}})}catch(r){const a=this.normalizeError(r);if(this.lastError=a,this.config.onError(a),this.config.fallback.enabled&&!n?.skipFallback){const n=await this.fallbackAsk(e);t.onComplete?.(n)}else t.onError?.(a)}}async syncCache(){try{const e=await this.cache.getLastSync(),t=await this.apiClient.getGeneralDocs(e);t.length>0&&(await this.cache.store(t),await this.localRAG.index(t),console.log(`[Cybernetic] Cache synced: ${t.length} documents`)),this.setStatus("online")}catch(e){console.warn("[Cybernetic] Cache sync failed:",e)}}getStatus(){return{connection:this.status,cache:this.cache.getStatus(),lastError:this.lastError,systemSettings:this.systemSettings,license:this.licenseManager.getState()}}getLicenseManager(){return this.licenseManager}async clearCache(){await this.cache.clear(),this.localRAG.reset()}async checkConnection(){try{return await this.apiClient.getStatus(),this.setStatus("online"),!0}catch{return this.setStatus("offline"),!1}}async checkSystemStatus(){if(this.systemSettings&&Date.now()-this.settingsLastChecked<this.SETTINGS_CHECK_INTERVAL)return this.systemSettings;try{const e=await this.apiClient.getStatus();return this.systemSettings={cacheRetentionHours:e.systemSettings?.cacheRetentionHours??168,maintenanceMode:e.systemSettings?.maintenanceMode??!1,maintenanceMessage:e.systemSettings?.maintenanceMessage,forceOfflineClients:e.systemSettings?.forceOfflineClients??!1},this.settingsLastChecked=Date.now(),this.systemSettings}catch{return this.systemSettings||{cacheRetentionHours:168,maintenanceMode:!1,forceOfflineClients:!1}}}isMaintenanceMode(){return this.systemSettings?.maintenanceMode??!1}getMaintenanceMessage(){return this.systemSettings?.maintenanceMessage}isCacheValid(){const e=this.cache.getStatus();if(!e.lastSyncAt)return!1;const t=60*(this.systemSettings?.cacheRetentionHours||168)*60*1e3,n=new Date(e.lastSyncAt).getTime();return Date.now()-n<t}async apiWithRetry(e,t){const{maxRetries:n,initialDelay:r,exponentialBackoff:a}=this.config.retry;let o=null;for(let i=0;i<=n;i++)try{return await this.apiClient.chat(e,{sessionId:t?.sessionId,context:t?.context})}catch(e){o=e;const t=this.normalizeError(e);if("AUTH_ERROR"===t.code||"RATE_LIMIT"===t.code)throw e;if(i<n){const e=a?r*Math.pow(2,i):r;await this.sleep(e)}}throw o}async fallbackAsk(e){if(this.setStatus("offline"),this.omegaRAG?.isReady())try{const t=await this.omegaRAG.ask(e);if(!t.degraded){return{reply:this.licenseManager.processResponse(t.answer),confidence:t.confidence,sources:t.sources.map(e=>({title:e.heading,snippet:e.content.substring(0,200)+"...",relevance:e.score})),offline:!0,degradedReason:"Omega hybrid retrieval (offline)"}}}catch(e){console.warn("[Cybernetic] Omega RAG failed, falling back to TF-IDF:",e)}const t=this.localRAG.getExportStatus();if(t.loaded&&t.documentCount>0)try{const n=await this.localRAG.ask(e);let r="medium";n.topScore<.3?r="low":n.topScore>.7&&(r="medium");return{reply:this.licenseManager.processResponse(n.answer),confidence:r,sources:n.sources.map(e=>({title:e.title,snippet:e.snippet,relevance:e.score})),offline:!0,degradedReason:t.loadedFromExport?"Using pre-exported vectors (offline)":"Processed locally with TF-IDF"}}catch(e){console.error("[Cybernetic] Local RAG error:",e)}const n=this.cache.getStatus();if(0===n.documentCount&&!t.loaded)return{reply:"I'm currently offline and don't have any cached information. Please check your connection and try again.",confidence:"none",sources:[],offline:!0,degradedReason:"No cached documents or offline vectors available"};try{const t=await this.cache.retrieve();this.localRAG.isIndexed()||await this.localRAG.index(t);const r=await this.localRAG.ask(e);let a="medium";r.topScore<.3?a="low":r.topScore>.7&&(a="medium");return{reply:this.licenseManager.processResponse(r.answer),confidence:a,sources:r.sources.map(e=>({title:e.title,snippet:e.snippet,relevance:e.score})),offline:!0,degradedReason:n.isStale?"Using stale cached data":"Processed locally without server"}}catch(e){return console.error("[Cybernetic] Local RAG error:",e),{reply:"I'm having trouble processing your request offline. Please try again when you're back online.",confidence:"none",sources:[],offline:!0,degradedReason:"Local RAG processing failed"}}}monitorConnection(){"undefined"!=typeof window&&(window.addEventListener("online",()=>{this.syncCache().catch(()=>{})}),window.addEventListener("offline",()=>{this.setStatus("offline")}),navigator.onLine||this.setStatus("offline"))}setStatus(e){this.status!==e&&(this.status=e,this.config.onStatusChange(e))}normalizeError(e){if(e instanceof Error){if(e.message.includes("401")||e.message.includes("Unauthorized"))return{code:"AUTH_ERROR",message:"Invalid or expired API key",originalError:e};if(e.message.includes("429")||e.message.includes("Rate limit")){const t=e.message.match(/retry after (\d+)/i);return{code:"RATE_LIMIT",message:"Rate limit exceeded",retryAfter:t?parseInt(t[1],10):60,originalError:e}}return e.message.includes("5")||e.message.includes("Server")?{code:"SERVER_ERROR",message:"Server error occurred",originalError:e}:{code:"NETWORK_ERROR",message:e.message||"Network error",originalError:e}}return{code:"NETWORK_ERROR",message:"Unknown error occurred"}}createErrorResponse(e,t,n){return{reply:e,confidence:t,sources:[],offline:!1,retryAfter:n}}sleep(e){return new Promise(t=>setTimeout(t,e))}}class zd{constructor(e,t,n){this.staticEntries=[],this.discoveredEntries=[],this.backendEntries=[],this.backendCache=null,this.isInitialized=!1,this.initPromise=null,this.config=e,this.apiUrl=t,this.apiKey=n,e.static&&(this.staticEntries=this.enhanceEntries(e.static,"props"))}async initialize(){if(!this.isInitialized){if(this.initPromise)return this.initPromise;this.initPromise=this.performInitialization(),await this.initPromise,this.isInitialized=!0}}async performInitialization(){const e=[];!1!==this.config.discovery?.enabled&&e.push(this.discoverFromFramework()),!1!==this.config.backend?.enabled&&this.config.backend?.endpoint&&e.push(this.fetchFromBackend());const t=await Promise.allSettled(e);for(const e of t)if("fulfilled"===e.status){const{entries:t,source:n}=e.value;"discovery"===n?this.discoveredEntries=t:"backend"===n&&(this.backendEntries=t)}else console.warn("[SiteMapDiscovery] Source failed:",e.reason);const n=this.staticEntries.length+this.discoveredEntries.length+this.backendEntries.length;console.log(`[SiteMapDiscovery] Initialized with ${n} total entries (${this.staticEntries.length} static, ${this.discoveredEntries.length} discovered, ${this.backendEntries.length} backend)`)}getMergedEntries(){return this.mergeEntries(this.staticEntries,this.discoveredEntries,this.backendEntries)}getLegacyEntries(){return this.getMergedEntries().map(e=>({path:e.path,name:e.name,description:e.description,params:e.params,dynamicParams:e.dynamicParams,aliases:e.aliases}))}async discoverFromFramework(){const e=this.config.discovery||{},t=[];try{const n=e.framework||this.detectFramework();let r=[];switch(n){case"react-router":r=this.discoverReactRouter();break;case"vue-router":r=this.discoverVueRouter();break;case"next":r=this.discoverNextRoutes();break;case"angular":r=this.discoverAngularRoutes();break;default:!1!==e.domFallback&&(r=this.discoverFromDOM(e.navSelectors))}for(const n of r){if(this.shouldExcludeRoute(n.path,e.excludePaths))continue;let r;r=e.transformRoute?e.transformRoute(n):this.defaultRouteTransform(n),r&&t.push(this.enhanceEntry(r,"discovery"))}console.log(`[SiteMapDiscovery] Discovered ${t.length} routes from ${n}`)}catch(e){return console.warn("[SiteMapDiscovery] Framework discovery failed:",e),{entries:[],source:"discovery",timestamp:Date.now(),error:String(e)}}return{entries:t,source:"discovery",timestamp:Date.now()}}detectFramework(){if("undefined"==typeof window)return"generic";const e=window;return e.__REACT_ROUTER_DATA_ROUTER__||e.__reactRouterContext?"react-router":e.__VUE_ROUTER__||e.__VUE_APP__?.$router?"vue-router":e.__NEXT_DATA__?"next":e.ng||document.querySelector("[ng-version]")?"angular":"generic"}discoverReactRouter(){const e=[];if("undefined"==typeof window)return e;const t=window.__REACT_ROUTER_DATA_ROUTER__;return t?.routes?(this.extractRoutesFromConfig(t.routes,e,""),e):e}extractRoutesFromConfig(e,t,n){for(const r of e){const e=this.normalizePath(n,r.path||""),a={path:e,name:r.handle?.name||r.handle?.title||r.id,meta:r.handle||{},children:[]};(r.path||r.index)&&t.push(a),r.children&&this.extractRoutesFromConfig(r.children,t,e)}}discoverVueRouter(){const e=[];if("undefined"==typeof window)return e;const t=window,n=t.__VUE_APP__,r=n?.$router||t.__VUE_ROUTER__;if(r?.getRoutes){const t=r.getRoutes();for(const n of t)e.push({path:n.path,name:n.name?.toString(),meta:n.meta||{},component:n.components?.default?.name})}return e}discoverNextRoutes(){const e=[];if("undefined"==typeof window)return e;const t=window.__NEXT_DATA__;if(!t)return e;const n=t.buildManifest?.pages||{};for(const t of Object.keys(n))t.startsWith("/_")||e.push({path:t,name:this.pathToName(t)});return e}discoverAngularRoutes(){return[]}discoverFromDOM(e){const t=[];if("undefined"==typeof document)return t;const n=e||["nav a[href]",'[role="navigation"] a[href]',".nav a[href]",".navigation a[href]",".sidebar a[href]",".menu a[href]","header a[href]"],r=new Set;for(const e of n)try{const n=document.querySelectorAll(e);for(const e of n){const n=e.getAttribute("href");if(!n)continue;if(n.startsWith("http")&&!n.startsWith(window.location.origin))continue;const a=n.startsWith("/")?n:`/${n}`;if(r.has(a)||a.startsWith("/#")||"/"===a||a.includes("javascript:"))continue;r.add(a);const o=a.split("?")[0].split("#")[0];t.push({path:o,name:e.textContent?.trim()||this.pathToName(o)})}}catch(e){}return t}async fetchFromBackend(){const e=this.config.backend||{},t=e.endpoint||"/api/external/sitemap";if(this.backendCache&&Date.now()<this.backendCache.expiresAt)return{entries:this.backendCache.entries,source:"backend",timestamp:this.backendCache.fetchedAt};try{const n=new URL(t,this.apiUrl);!1!==e.tenantScoped&&n.searchParams.set("tenantScoped","true"),!1!==e.includeGeneral&&n.searchParams.set("includeGeneral","true");const r=await fetch(n.toString(),{method:"GET",headers:{"X-API-Key":this.apiKey,"Content-Type":"application/json",...e.headers}});if(!r.ok)throw new Error(`Backend sitemap fetch failed: ${r.status}`);const a=await r.json(),o=this.transformBackendResponse(a),i=e.cacheTtl||3e5;return this.backendCache={entries:o,fetchedAt:Date.now(),expiresAt:Date.now()+i},console.log(`[SiteMapDiscovery] Loaded ${o.length} routes from backend`),{entries:o,source:"backend",timestamp:Date.now()}}catch(e){return console.warn("[SiteMapDiscovery] Backend fetch failed:",e),{entries:this.backendCache?.entries||[],source:"backend",timestamp:Date.now(),error:String(e)}}}transformBackendResponse(e){return(Array.isArray(e)?e:e.entries||e.sitemap||e.routes||[]).map(e=>this.enhanceEntry({path:e.url||e.path,name:e.title||e.name,description:e.description,aliases:e.keywords||e.aliases,params:e.params,dynamicParams:e.dynamicParams},"backend"))}mergeEntries(...e){const t=this.config.merge||{},n=t.sourcePriority||["props","backend","discovery"],r=t.deduplication||"path",a=new Map;n.forEach((e,t)=>{a.set(e,n.length-t)});const o=[];for(const t of e)for(const e of t){const t=a.get(e._source||"props")||0;o.push({...e,_priority:t})}o.sort((e,t)=>(t._priority||0)-(e._priority||0));const i=new Map;for(const e of o){let n;switch(r){case"name":n=e.name.toLowerCase();break;case"both":n=`${e.path}|${e.name.toLowerCase()}`;break;default:n=this.normalizePath("",e.path)}if(i.has(n)){if(!1!==t.keepNonConflicting){const t=i.get(n);!t.description&&e.description&&(t.description=e.description),!t.aliases?.length&&e.aliases?.length&&(t.aliases=e.aliases)}}else i.set(n,e)}return Array.from(i.values())}enhanceEntries(e,t){return e.map(e=>this.enhanceEntry(e,t))}enhanceEntry(e,t){return{...e,_source:t,_discoveredAt:Date.now()}}defaultRouteTransform(e){return e.path&&"*"!==e.path&&"**"!==e.path?{path:e.path,name:e.name||e.meta?.title||this.pathToName(e.path),description:e.meta?.description,aliases:e.meta?.keywords||e.meta?.aliases,dynamicParams:e.path.includes(":")||e.path.includes("[")}:null}normalizePath(e,t){return t&&"/"!==t?t.startsWith("/")?t:e&&"/"!==e?`${e}/${t}`.replace(/\/+/g,"/"):`/${t}`:e||"/"}pathToName(e){const t=e.split("/").filter(Boolean);return(t[t.length-1]||"Home").replace(/[-_]/g," ").replace(/\[.*?\]/g,"").replace(/:/g,"").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ").trim()||"Page"}shouldExcludeRoute(e,t){if(!t?.length)return!1;for(const n of t){if(new RegExp("^"+n.replace(/\*/g,".*").replace(/\?/g,".")+"$").test(e))return!0}return!1}async refresh(){this.backendCache=null,this.isInitialized=!1,this.initPromise=null,await this.initialize()}isReady(){return this.isInitialized}getStats(){return{static:this.staticEntries.length,discovered:this.discoveredEntries.length,backend:this.backendEntries.length,merged:this.getMergedEntries().length}}}const Fd={navigate:[{pattern:/^(go to|navigate to|take me to|open|show me|bring up)\s+(.+)/i,type:"navigate",weight:.9},{pattern:/^(i want to see|i need to go to|let me see)\s+(.+)/i,type:"navigate",weight:.85},{pattern:/^(where is|how do i get to)\s+(.+)/i,type:"navigate",weight:.6}],fillForm:[{pattern:/^(search for|find|look up|search)\s+(.+)/i,type:"fillForm",weight:.88},{pattern:/^(filter by|set .+ to|change .+ to)\s+(.+)/i,type:"fillForm",weight:.85},{pattern:/^(enter|type|put)\s+(.+)\s+(in|into)\s+(.+)/i,type:"fillForm",weight:.9}],clickElement:[{pattern:/^(click|press|hit|tap)\s+(the\s+)?(.+)\s+(button|link)/i,type:"clickElement",weight:.9},{pattern:/^(submit|send|confirm|save|cancel|delete)/i,type:"clickElement",weight:.85}],triggerModal:[{pattern:/^(open|show|display)\s+(the\s+)?(.+)\s+(modal|dialog|popup|window)/i,type:"triggerModal",weight:.9},{pattern:/^(open|show)\s+(help|settings|preferences|options)/i,type:"triggerModal",weight:.85}],scroll:[{pattern:/^(scroll to|jump to|go to)\s+(the\s+)?(.+)\s+(section|area|part)/i,type:"scroll",weight:.85},{pattern:/^(show me|take me to)\s+(the\s+)?(bottom|top|end|beginning)/i,type:"scroll",weight:.8}],highlight:[{pattern:/^(highlight|show me|point to|where is)\s+(the\s+)?(.+)/i,type:"highlight",weight:.7}],custom:[{pattern:/^(export|download|refresh|reload|sync)/i,type:"custom",weight:.85}]};class Od{constructor(e,t="",n=""){this.categories=[],this.topicKeywords=new Map,this.siteMapDiscovery=null,this.config=e,this.siteMapIndex=new Map,this.formIndex=new Map,this.modalIndex=new Map,this.buildIndexes(),e.siteMapConfig&&(this.siteMapDiscovery=new zd(e.siteMapConfig,t,n))}buildIndexes(){if(this.config.siteMap)for(const e of this.config.siteMap){const t=[e.name.toLowerCase(),e.path.toLowerCase(),...(e.aliases||[]).map(e=>e.toLowerCase())];for(const n of t)this.siteMapIndex.set(n,e)}if(this.config.forms)for(const[e,t]of Object.entries(this.config.forms)){const n=[e.toLowerCase(),t.name.toLowerCase(),...(t.aliases||[]).map(e=>e.toLowerCase())];for(const e of n)this.formIndex.set(e,t)}if(this.config.modals)for(const[e,t]of Object.entries(this.config.modals)){const n=[e.toLowerCase(),t.id.toLowerCase(),...(t.aliases||[]).map(e=>e.toLowerCase())];for(const e of n)this.modalIndex.set(e,t)}}classify(e){if(!this.config.enabled)return{action:null,shouldEscalate:!0,rawConfidence:0};const t=e.trim().toLowerCase();for(const[t,n]of Object.entries(Fd))for(const{pattern:r,weight:a}of n){const n=e.match(r);if(n){const e=this.buildAction(t,n,a);if(e)return e}}const n=this.fuzzyMatchSiteMap(t);if(n)return n;const r=this.matchCustomAction(t);return r||{action:null,shouldEscalate:!0,rawConfidence:0,matchedPatterns:[]}}buildAction(e,t,n){const r=this.config.confidenceThreshold??.8;switch(e){case"navigate":{const e=this.extractTarget(t),a=this.findSiteMapMatch(e);if(a){const e=n*a.similarity;return{action:{id:`action-${Date.now()}`,type:"navigate",target:a.entry.path,confidence:e,explanation:`Navigate to ${a.entry.name}`},shouldEscalate:e<r,rawConfidence:e,matchedPatterns:["navigate",a.entry.name]}}break}case"fillForm":{const e=this.extractTarget(t),{field:a,value:o}=this.parseFormIntent(t);if(a){const e=.95*n;return{action:{id:`action-${Date.now()}`,type:"fillForm",target:a.selector,params:{value:o},confidence:e,explanation:`Fill "${a.name}" with "${o}"`},shouldEscalate:e<r,rawConfidence:e,matchedPatterns:["fillForm",a.name]}}if(this.config.forms?.search){const t=.9*n;return{action:{id:`action-${Date.now()}`,type:"fillForm",target:this.config.forms.search.selector,params:{value:e},confidence:t,explanation:`Search for "${e}"`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["fillForm","search"]}}break}case"clickElement":{const e=this.extractTarget(t),a=this.findButtonSelector(e);if(a){const t=.95*n;return{action:{id:`action-${Date.now()}`,type:"clickElement",target:a,confidence:t,explanation:`Click "${e}" button`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["clickElement",e]}}break}case"triggerModal":{const e=this.extractTarget(t),a=this.findModalConfig(e);if(a){const e=.95*n;return{action:{id:`action-${Date.now()}`,type:"triggerModal",target:a.trigger,confidence:e,explanation:`Open ${a.id} modal`},shouldEscalate:e<r,rawConfidence:e,matchedPatterns:["triggerModal",a.id]}}break}case"scroll":{const e=this.extractTarget(t),a=this.findScrollTarget(e);if(a){const t=.9*n;return{action:{id:`action-${Date.now()}`,type:"scroll",target:a,confidence:t,explanation:`Scroll to ${e}`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["scroll",e]}}break}case"highlight":{const e=this.extractTarget(t),a=this.findElementByDescription(e);if(a){const t=.85*n;return{action:{id:`action-${Date.now()}`,type:"highlight",target:a,confidence:t,explanation:`Highlight ${e}`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["highlight",e]}}break}case"custom":{const e=t[1]?.toLowerCase();if(this.config.customActions?.[e]){const t=.95*n;return{action:{id:`action-${Date.now()}`,type:"custom",target:e,confidence:t,explanation:`Execute ${e} action`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["custom",e]}}break}}return null}extractTarget(e){for(let t=e.length-1;t>=1;t--)if(e[t])return e[t].trim();return""}stripArticles(e){return e.replace(/^(the|a|an|my|our|your|this|that)\s+/gi,"").replace(/\s+(page|section|screen|view)$/gi,"").trim()}findSiteMapMatch(e){const t=e.toLowerCase().replace(/[^a-z0-9\s]/g,""),n=this.stripArticles(t),r=this.siteMapIndex.get(t)||this.siteMapIndex.get(n);if(r)return{entry:r,similarity:1};let a=null,o=0;for(const[e,r]of this.siteMapIndex){const i=this.calculateSimilarity(t,e),s=this.calculateSimilarity(n,e),l=Math.max(i,s);l>o&&l>.5&&(o=l,a=r)}return a?{entry:a,similarity:o}:null}fuzzyMatchSiteMap(e){const t=this.config.confidenceThreshold??.8;for(const[n,r]of this.siteMapIndex)if(e.includes(n)){const e=.75;return{action:{id:`action-${Date.now()}`,type:"navigate",target:r.path,confidence:e,explanation:`Navigate to ${r.name}`},shouldEscalate:e<t,rawConfidence:e,matchedPatterns:["fuzzy-sitemap",n]}}return null}matchCustomAction(e){if(!this.config.customActions)return null;const t=this.config.confidenceThreshold??.8;for(const n of Object.keys(this.config.customActions))if(e.includes(n.toLowerCase())){const e=.85;return{action:{id:`action-${Date.now()}`,type:"custom",target:n,confidence:e,explanation:`Execute ${n}`},shouldEscalate:e<t,rawConfidence:e,matchedPatterns:["custom",n]}}return null}parseFormIntent(e){const t=e[0];for(const[,e]of this.formIndex)if(t.toLowerCase().includes(e.name.toLowerCase())){const n=t.match(new RegExp(`${e.name}[^a-z]*(.+)`,"i"));return{field:e,value:n?.[1]?.trim()||""}}return{field:null,value:this.extractTarget(e)}}findButtonSelector(e){const t=e.toLowerCase();if("undefined"==typeof document)return`button:contains("${e}")`;const n=[`[data-action="${t}"]`,`[aria-label*="${t}" i]`,`.btn-${t}`,`#${t}-button`,`button.${t}`];for(const e of n)try{if(document.querySelector(e))return e}catch{}const r=document.querySelectorAll('button, [role="button"], a.btn');for(const e of r)if(e.textContent?.toLowerCase().includes(t))return this.generateUniqueSelector(e);return null}findModalConfig(e){return this.modalIndex.get(e.toLowerCase())||null}findScrollTarget(e){const t=e.toLowerCase();if("top"===t||"beginning"===t)return"body";if("bottom"===t||"end"===t)return"body:last-child";if("undefined"==typeof document)return`#${t.replace(/\s+/g,"-")}`;const n=[`#${t.replace(/\s+/g,"-")}`,`[data-section="${t}"]`,`.${t.replace(/\s+/g,"-")}-section`,`section[aria-label*="${t}" i]`];for(const e of n)try{if(document.querySelector(e))return e}catch{continue}return null}findElementByDescription(e){const t=e.toLowerCase();if("undefined"==typeof document)return`[aria-label*="${t}" i]`;const n=[`[aria-label*="${t}" i]`,`[data-testid*="${t}" i]`,`[title*="${t}" i]`];for(const e of n)try{if(document.querySelector(e))return e}catch{continue}return null}generateUniqueSelector(e){if(e.id)return`#${e.id}`;if(e.getAttribute("data-testid"))return`[data-testid="${e.getAttribute("data-testid")}"]`;const t=[];let n=e;for(;n&&n!==document.body;){let e=n.tagName.toLowerCase();if(n.className&&"string"==typeof n.className){const t=n.className.split(" ").filter(e=>e&&!e.includes(" "));t.length>0&&(e+=`.${t.slice(0,2).join(".")}`)}t.unshift(e),n=n.parentElement}return t.join(" > ")}calculateSimilarity(e,t){const n=new Set(e.split(/\s+/)),r=new Set(t.split(/\s+/)),a=new Set([...n].filter(e=>r.has(e))),o=new Set([...n,...r]);return a.size/o.size}getConfig(){return this.config}async trainFromExport(e){if(e.categories){this.categories=e.categories;for(const t of e.categories)for(const e of t.keywords){const n=this.topicKeywords.get(t.name)||[];n.push(e.toLowerCase()),this.topicKeywords.set(t.name,n)}}const t=this.extractTopicsFromDocuments(e.documents);for(const[e,n]of t){const t=this.topicKeywords.get(e)||[];t.push(...n),this.topicKeywords.set(e,[...new Set(t)])}e.sitemap&&this.loadSitemapEntries(e.sitemap),console.log(`[CyberneticIntentClassifier] Trained with ${this.categories.length} categories, ${this.topicKeywords.size} topics`)}async loadSitemap(e){if(e.enabled)if(e.sitemapData)this.loadSitemapEntries(e.sitemapData);else if(e.sitemapUrl)try{const t=await fetch(e.sitemapUrl);if(!t.ok)throw new Error(`Failed to fetch sitemap: ${t.status}`);const n=await t.json();this.loadSitemapEntries(n)}catch(e){console.error("[CyberneticIntentClassifier] Failed to load sitemap:",e)}}loadSitemapEntries(e){for(const t of e){const e={path:t.url,name:t.title,description:t.description,aliases:t.keywords},n=[t.title.toLowerCase(),t.url.toLowerCase(),...(t.keywords||[]).map(e=>e.toLowerCase())];if(t.description){const e=t.description.toLowerCase().split(/\s+/).filter(e=>e.length>4);n.push(...e)}for(const t of n)this.siteMapIndex.set(t,e)}console.log(`[CyberneticIntentClassifier] Loaded ${e.length} sitemap entries`)}extractTopicsFromDocuments(e){const t=new Map;for(const n of e){const e=n.title.toLowerCase(),r=[];n.metadata?.keywords&&r.push(...n.metadata.keywords.map(e=>e.toLowerCase()));const a=n.title.toLowerCase().replace(/[^a-z0-9\s]/g,"").split(/\s+/).filter(e=>e.length>3&&!this.isStopWord(e));r.push(...a);const o=n.content.toLowerCase().replace(/[^a-z0-9\s]/g,"").split(/\s+/).filter(e=>e.length>4&&!this.isStopWord(e)),i=new Map;for(const e of o)i.set(e,(i.get(e)||0)+1);const s=[...i.entries()].sort((e,t)=>t[1]-e[1]).slice(0,5).map(([e])=>e);r.push(...s),t.set(e,[...new Set(r)])}return t}isStopWord(e){return new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","from","up","about","into","through","during","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","this","that","these","those","it","its","they","them","their","what","which","who","whom","when","where","why","how","all","each","every","both","few","more","most","other","some","such","no","not","only","same","so","than","too","very","can","just","dont","now","here","there","also","your","you"]).has(e)}getCategories(){return this.categories}getTopicKeywords(){return this.topicKeywords}isTrained(){return this.categories.length>0||this.topicKeywords.size>0}async initializeDiscovery(){if(this.siteMapDiscovery)try{await this.siteMapDiscovery.initialize(),this.rebuildIndexesFromDiscovery(),console.log(`[CyberneticIntentClassifier] Discovery complete, indexed ${this.siteMapIndex.size} entries`)}catch(e){console.error("[CyberneticIntentClassifier] Discovery initialization failed:",e)}else console.log("[CyberneticIntentClassifier] No siteMapConfig provided, skipping discovery")}rebuildIndexesFromDiscovery(){if(!this.siteMapDiscovery)return;const e=this.siteMapDiscovery.getLegacyEntries();this.siteMapIndex.clear();for(const t of e){const e={path:t.path,name:t.name,description:t.description,params:t.params,aliases:t.aliases},n=[t.name.toLowerCase(),t.path.toLowerCase(),...(t.aliases||[]).map(e=>e.toLowerCase())];if(t.description){const e=t.description.toLowerCase().split(/\s+/).filter(e=>e.length>4&&!this.isStopWord(e));n.push(...e)}for(const t of n)this.siteMapIndex.set(t,e)}}isSiteMapReady(){return this.siteMapDiscovery?this.siteMapDiscovery.isReady():this.siteMapIndex.size>0||(this.config.siteMap?.length??0)>0}async ensureSiteMapReady(){this.isSiteMapReady()||await this.initializeDiscovery()}async refreshSiteMap(){this.siteMapDiscovery?(await this.siteMapDiscovery.refresh(),this.rebuildIndexesFromDiscovery()):console.log("[CyberneticIntentClassifier] No siteMapConfig provided, cannot refresh")}getSiteMapDiscovery(){return this.siteMapDiscovery}getSiteMapEntries(){return this.siteMapDiscovery?this.siteMapDiscovery.getLegacyEntries():this.config.siteMap||[]}}class $d{constructor(e){this.highlightOverlay=null,this.actionCount=0,this.lastActionReset=Date.now(),this.config=e,this.classifier=new Od(e),"undefined"!=typeof document&&this.injectStyles()}interpretIntent(e){return this.classifier.classify(e)}async executeAction(e){const t=Date.now();t-this.lastActionReset>6e4&&(this.actionCount=0,this.lastActionReset=t);const n=this.config.maxActionsPerTurn??5;if(this.actionCount>=n)return{success:!1,message:`Rate limit exceeded. Maximum ${n} actions per minute.`};if(!this.isActionAllowed(e))return{success:!1,message:`Action type "${e.type}" is not allowed`};switch(this.actionCount++,e.type){case"navigate":return this.navigate(e.target,e.params);case"fillForm":return this.fillForm(e.target,e.params?.value);case"clickElement":return this.clickElement(e.target);case"triggerModal":return this.triggerModal(e.target);case"scroll":return this.scrollToElement(e.target);case"highlight":return this.highlightElement(e.target);case"custom":return this.executeCustomAction(e.target,e.params);default:return{success:!1,message:`Unknown action type: ${e.type}`}}}isActionAllowed(e){const t=this.config.allowedActions;if(!t)return!0;const n={navigate:"navigate",fillForm:"fill",clickElement:"click",scroll:"scroll",highlight:"click",triggerModal:"click",custom:"click"}[e.type];return t.includes(n)}isSelectorAllowed(e){if(this.config.blockedSelectors)for(const t of this.config.blockedSelectors)if(e.includes(t))return!1;return!(this.config.allowedSelectors&&this.config.allowedSelectors.length>0)||this.config.allowedSelectors.some(t=>e.includes(t))}async navigate(e,t){try{if(!this.validateNavigationUrl(e))return{success:!1,message:"Invalid or blocked URL"};let n=e;if(t){const e=new URLSearchParams;for(const[n,r]of Object.entries(t))null!=r&&e.set(n,String(r));const r=e.toString();r&&(n+=(n.includes("?")?"&":"?")+r)}return"undefined"==typeof window?{success:!0,message:`Navigation to ${e} would be executed (server-side)`}:this.isInternalUrl(n)?this.tryClientSideNavigation(n)?{success:!0,message:`Navigated to ${e}`}:(window.location.href=n,{success:!0,message:`Navigating to ${e}...`}):(window.open(n,"_blank","noopener,noreferrer"),{success:!0,message:`Opened ${n} in new tab`})}catch(e){return{success:!1,message:"Navigation failed",error:String(e)}}}async fillForm(e,t){if(!this.isSelectorAllowed(e))return{success:!1,message:`Selector "${e}" is not allowed`};const n=this.sanitizeSelector(e);if("undefined"==typeof document)return{success:!0,message:`Form fill would set "${n}" to "${t}" (server-side)`};try{const e=document.querySelector(n);if(!e)return{success:!1,message:`Element not found: ${n}`};if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement))return{success:!1,message:"Element is not a form field"};if(e.focus(),e instanceof HTMLSelectElement){const n=Array.from(e.options).find(e=>e.value.toLowerCase()===t.toLowerCase()||e.text.toLowerCase()===t.toLowerCase());if(!n)return{success:!1,message:`Option "${t}" not found`};e.value=n.value}else e.value=t;e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}));const r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;return r&&e instanceof HTMLInputElement&&(r.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))),{success:!0,message:`Filled field with "${t}"`}}catch(e){return{success:!1,message:"Failed to fill form field",error:String(e)}}}async clickElement(e){if(!this.isSelectorAllowed(e))return{success:!1,message:`Selector "${e}" is not allowed`};const t=this.sanitizeSelector(e);if("undefined"==typeof document)return{success:!0,message:`Click on "${t}" would be executed (server-side)`};try{const e=document.querySelector(t);return e?e instanceof HTMLElement?(e.scrollIntoView({behavior:"smooth",block:"center"}),await this.sleep(300),e.click(),{success:!0,message:"Element clicked"}):{success:!1,message:"Element is not clickable"}:{success:!1,message:`Element not found: ${t}`}}catch(e){return{success:!1,message:"Failed to click element",error:String(e)}}}async triggerModal(e){return this.clickElement(e)}async scrollToElement(e){if("undefined"==typeof window)return{success:!0,message:`Scroll to "${e}" would be executed (server-side)`};try{if("body"===e)return window.scrollTo({top:0,behavior:"smooth"}),{success:!0,message:"Scrolled to top"};if("body:last-child"===e)return window.scrollTo({top:document.body.scrollHeight,behavior:"smooth"}),{success:!0,message:"Scrolled to bottom"};const t=document.querySelector(e);return t?(t.scrollIntoView({behavior:"smooth",block:"start"}),{success:!0,message:"Scrolled to element"}):{success:!1,message:`Element not found: ${e}`}}catch(e){return{success:!1,message:"Failed to scroll",error:String(e)}}}async highlightElement(e){if(!this.isSelectorAllowed(e))return{success:!1,message:`Selector "${e}" is not allowed`};if("undefined"==typeof document)return{success:!0,message:`Highlight on "${e}" would be shown (server-side)`};try{const t=document.querySelector(e);if(!t)return{success:!1,message:`Element not found: ${e}`};this.removeHighlight(),t.scrollIntoView({behavior:"smooth",block:"center"}),await this.sleep(300);const n=t.getBoundingClientRect(),r=document.createElement("div");return r.className="astermind-highlight-overlay",r.style.cssText=`\n position: fixed;\n top: ${n.top-4}px;\n left: ${n.left-4}px;\n width: ${n.width+8}px;\n height: ${n.height+8}px;\n border: 3px solid #4F46E5;\n border-radius: 4px;\n pointer-events: none;\n z-index: 999999;\n animation: astermind-highlight-pulse 1s ease-in-out 3;\n `,document.body.appendChild(r),this.highlightOverlay=r,setTimeout(()=>this.removeHighlight(),3e3),{success:!0,message:"Element highlighted"}}catch(e){return{success:!1,message:"Failed to highlight element",error:String(e)}}}async executeCustomAction(e,t){if(!this.isAllowedCustomAction(e))return{success:!1,message:`Custom action "${e}" not found`};const n=this.config.customActions[e];try{return await n(t)}catch(t){return{success:!1,message:`Custom action "${e}" failed`,error:String(t)}}}isInternalUrl(e){if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return!0;if("undefined"==typeof window)return!0;try{return new URL(e,window.location.href).origin===window.location.origin}catch{return!0}}tryClientSideNavigation(e){if("undefined"==typeof window)return!1;try{return window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate")),e.includes("#")&&window.dispatchEvent(new HashChangeEvent("hashchange")),!0}catch{return!1}}validateNavigationUrl(e){if(/^(javascript|data):/i.test(e))return!1;if("undefined"==typeof window)return!0;try{return new URL(e,window.location.href).origin===window.location.origin||e.startsWith("/")}catch{return e.startsWith("/")}}sanitizeSelector(e){return e.replace(/[<>'"]/g,"").replace(/javascript:/gi,"").replace(/data:/gi,"").trim()}isAllowedCustomAction(e){return void 0!==this.config.customActions&&Object.prototype.hasOwnProperty.call(this.config.customActions,e)}removeHighlight(){this.highlightOverlay&&(this.highlightOverlay.remove(),this.highlightOverlay=null)}injectStyles(){if("undefined"==typeof document)return;if(document.getElementById("astermind-agent-styles"))return;const e=document.createElement("style");e.id="astermind-agent-styles",e.textContent="\n @keyframes astermind-highlight-pulse {\n 0%, 100% {\n box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);\n }\n 50% {\n box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);\n }\n }\n\n .astermind-highlight-overlay {\n transition: all 0.2s ease-out;\n }\n ",document.head.appendChild(e)}sleep(e){return new Promise(t=>setTimeout(t,e))}getConfig(){return this.config}getClassifier(){return this.classifier}resetActionCount(){this.actionCount=0,this.lastActionReset=Date.now()}}const jd={hiddenUnits:50,activation:"relu",ridgeLambda:.01,weightInit:"xavier",seed:1337,dropout:0,log:{verbose:!0,toFile:!1,modelName:"Unnamed ELM Model",level:"info"}};function Ud(e){let t=0,n=0;for(;0===t;)t=e();for(;0===n;)n=e();return Math.sqrt(-2*Math.log(t))*Math.cos(2*Math.PI*n)}Object.assign(Object.assign({},jd),{useTokenizer:!1}),Object.assign(Object.assign({},jd),{useTokenizer:!0,maxLen:30,charSet:"abcdefghijklmnopqrstuvwxyz",tokenizerDelimiter:/\s+/});class Bd{constructor(e,t,n=1e-4){this.p=e,this.m=t,this.lambda=n,this.Ainv=new Float64Array(e*e),this.Beta=new Float64Array(e*t);const r=1/Math.max(1e-12,n);for(let t=0;t<e;t++)this.Ainv[t*e+t]=r}update(e,t){const{p:n,m:r,Ainv:a,Beta:o}=this,i=new Float64Array(n);for(let t=0;t<n;t++){let r=0,o=t*n;for(let t=0;t<n;t++)r+=a[o+t]*e[t];i[t]=r}let s=1;for(let t=0;t<n;t++)s+=e[t]*i[t];s=Math.max(s,1e-12);const l=1/s;for(let e=0;e<n;e++){const t=i[e]*l;for(let r=0;r<n;r++)a[e*n+r]-=t*i[r]}for(let t=0;t<n;t++){let r=0,o=t*n;for(let t=0;t<n;t++)r+=a[o+t]*e[t];i[t]=r}for(let e=0;e<n;e++){const n=i[e];for(let a=0;a<r;a++)o[e*r+a]+=n*t[a]}}predict(e){const{p:t,m:n,Beta:r}=this,a=new Float64Array(n);for(let o=0;o<n;o++){let i=0;for(let a=0;a<t;a++)i+=e[a]*r[a*n+o];a[o]=i}return a}}function Vd(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(Math.max(0,t))}function Wd(e,t){var n,r;const a=Math.min(e.length,t.length);if(0===a)return 0;let o=0,i=0,s=0;for(let l=0;l<a;l++){const a=null!==(n=e[l])&&void 0!==n?n:0,c=null!==(r=t[l])&&void 0!==r?r:0;o+=a*c,i+=a*a,s+=c*c}const l=o/Math.sqrt(Math.max(i*s,1e-12));return Number.isFinite(l)?l:0}function Hd(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(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){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,s)}l((r=r.apply(e,t||[])).next())})}function Kd(e){return e.replace(/\s+/g," ").split(/(?<=[.?!])\s+/).map(e=>e.trim()).filter(e=>e.length>8&&/\w/.test(e))}function qd(e){return e.replace(/```[\s\S]*?```/g," ").replace(/`[^`]+`/g," ").replace(/\[[^\]]*\]\([^)]*\)/g,"").replace(/[-–>•→]/g," ").replace(/\s+/g," ").trim()}function Gd(e,t){return Hd(this,arguments,void 0,function*(e,t,n={}){if(!(null==t?void 0:t.length))return"No results found.";const{dim:r=64,features:a=32,sigma:o=1,rounds:i=3,topSentences:s=8,personality:l="neutral"}=n;let c=Kd(t.map(e=>qd(e.content)).join(" ")).filter(e=>!function(e){return/^(\*|#)/.test(e)||/chapter/i.test(e)||/part\s*\d+/i.test(e)||/section/i.test(e)||/^\s*[A-Z]\)\s*$/.test(e)||e.length<15}(e)).slice(0,120);if(0===c.length)return qd(t[0].content).slice(0,400);const u=function(e,t,n=1,r=Math.random){const a=new Float64Array(t*e),o=new Float64Array(t),i=1/Math.max(1e-12,n);for(let n=0;n<t*e;n++)a[n]=Ud(r)*i;for(let e=0;e<t;e++)o[e]=2*r()*Math.PI;return{W:a,b:o,D:t,d:e,sigma:n}}(r,a,o),d=new Bd(2*a,1,.001),f=e=>{const t=new Float64Array(r),n=Math.min(e.length,r);for(let r=0;r<n;r++)t[r]=e.charCodeAt(r)/255;return function(e,t){const{W:n,b:r,D:a,d:o}=e,i=new Float64Array(2*a);for(let e=0;e<a;e++){let s=r[e];const l=e*o;for(let e=0;e<o;e++)s+=n[l+e]*(t[e]||0);i[e]=Math.cos(s),i[a+e]=Math.sin(s)}let s=0;for(let e=0;e<i.length;e++)s+=i[e]*i[e];const l=1/Math.sqrt(Math.max(s,1e-12));for(let e=0;e<i.length;e++)i[e]*=l;return i}(u,function(e,t=1e-12){const n=Vd(e);if(!(n>t&&Number.isFinite(n)))return new Float64Array(e.length);const r=new Float64Array(e.length),a=1/n;for(let t=0;t<e.length;t++)r[t]=e[t]*a;return r}(t))},h=f(e),p=e.toLowerCase().split(/\W+/).filter(e=>e.length>2),m=c.map(e=>{const t=f(e);let n=Wd(t,h);const r=e.toLowerCase();for(const e of p)r.includes(e)&&(n+=.02);return{s:e,v:t,w:n}});m.sort((e,t)=>t.w-e.w);let g=m.slice(0,s).map(e=>e.s).join(" "),y=new Float64Array(2*a);for(let e=0;e<i;e++){const e=Kd(g).slice(0,s),t=e.map(e=>f(e)),n=t.map(e=>Wd(e,h));for(let e=0;e<t.length;e++)d.update(t[e],new Float64Array([n[e]]));y.fill(0);for(let e=0;e<t.length;e++){const r=t[e],a=n[e];for(let e=0;e<r.length;e++)y[e]+=r[e]*a}const r=Vd(y)||1;for(let e=0;e<y.length;e++)y[e]/=r;const a=e.map(e=>({s:e,w:Wd(f(e),y)}));a.sort((e,t)=>t.w-e.w),g=a.slice(0,Math.max(3,Math.floor(s/2))).map(e=>e.s).join(" ")}g=function(e){return e.replace(/\s+[-–>•→]\s+/g," ").replace(/\s+\.\s+/g,". ").replace(/([a-z]) - ([a-z])/gi,"$1-$2").replace(/\s{2,}/g," ").trim()}(g);return`${"teacher"===l?"Here’s a simple way to think about it:\n\n":"scientist"===l?"From the retrieved material, we can infer:\n\n":""}${g.charAt(0).toUpperCase()+g.slice(1)}\n\n(${t[0].heading||"Answer"}, Ω-synthesized)`})}function Qd(e,t){let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}function Yd(e,t,n,r){if("cosine"===n){const n=Qd(e,t),r=Math.hypot(...e),a=Math.hypot(...t);return r&&a?n/(r*a):0}if("poly2"===n){const n=Qd(e,t);return Math.pow(n+1,2)}{let n=0;for(let r=0;r<e.length;r++){const a=e[r]-t[r];n+=a*a}return Math.exp(-n/Math.max(1e-9,2*r*r))}}function Xd(e,t,n,r,a){const o=function(e,t){const n=new Float64Array(t);for(const[t,r]of e)n[t]=r;return n}(e,t),i=new Float64Array(n.length);for(let e=0;e<n.length;e++){const t=n[e];i[e]=Yd(o,t,r,a)}const s=Math.hypot(...i);if(s>0)for(let e=0;e<i.length;e++)i[e]/=s;return i}"function"==typeof SuppressedError&&SuppressedError;const Jd=new Map;function Zd(e){const t=e,n=Jd.get(t);if(n)return n;let r=e.toLowerCase();if(r=r.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g,""),r.length<=2)return Jd.set(t,r),r;r.endsWith("ies")&&r.length>4?r=r.slice(0,-3)+"y":/(xes|ches|shes|zes|sses)$/.test(r)&&r.length>4?r=r.replace(/(xes|ches|shes|zes|sses)$/,e=>"sses"===e?"ss":e.replace(/es$/,"")):r.endsWith("s")&&!/(ss|us)$/.test(r)&&r.length>3&&(r=r.slice(0,-1));const a=[[/ization$|isation$/,"ize"],[/ational$/,"ate"],[/fulness$/,"ful"],[/ousness$/,"ous"],[/iveness$/,"ive"],[/ability$/,"able"],[/ness$/,""],[/ment$/,""],[/ations?$/,"ate"],[/izer$|iser$/,"ize"],[/ally$/,"al"],[/ically$/,"ic"],[/ingly$|edly$/,""],[/ing$|ed$/,""]];for(const[e,t]of a)if(e.test(r)&&r.length-t.length>=4){r=r.replace(e,t);break}return Jd.set(t,r),r}function ef(e,t){const n=Array.from(e,(e,t)=>t);return n.sort((t,n)=>e[n]-e[t]),n.slice(0,t)}function tf(e){const{query:t,chunks:n,vocabMap:r,idf:a,tfidfDocs:o,denseDocs:i,landmarksIdx:s,landmarkMat:l,vocabSize:c,kernel:u,sigma:d,alpha:f,beta:h,ridge:p,headingW:m,useStem:g,expandQuery:y,topK:v,prefilter:b}=e,w=y?function(e){const t=[];return/\bmap\b/.test(e)&&t.push("dict key value make"),/\bchan|channel\b/.test(e)&&t.push("goroutine concurrency select buffer"),/\berror\b/.test(e)&&t.push("fmt wrap unwrap sentinel try catch"),/\bstruct\b/.test(e)&&t.push("field method receiver init zero value"),e+" "+t.join(" ")}(t):t,k=function(e,t){const n=e.toLowerCase().replace(/[`*_>~]/g," ").replace(/[^a-z0-9]+/g," ").split(/\s+/).filter(Boolean);if(!t)return n;const r=[];for(const e of n){const t=Zd(e);t&&t.length>1&&r.push(t)}return r}(w,g),S=function(e,t,n,r=1){const a=new Map;for(let t=0;t<e.length;t++){const o=e[t],i=n.get(o);if(void 0===i)continue;const s=t<8?r:1;a.set(i,(a.get(i)||0)+s)}const o=Math.max(1,...a.values()),i=new Map;for(const[e,n]of a){const r=.5+n/o*.5;i.set(e,r*(t[e]||0))}return i}(k,a,r,m),x=Xd(S,c,l,u,d),C=o.map(e=>function(e,t){let n=0,r=0,a=0;for(const[a,o]of e){r+=o*o;const e=t.get(a);e&&(n+=o*e)}for(const[,e]of t)a+=e*e;return r&&a?n/(Math.sqrt(r)*Math.sqrt(a)):0}(e,S)),E=i.map(e=>function(e,t,n,r){if("cosine"===n){const n=Qd(e,t),r=Math.hypot(...e),a=Math.hypot(...t);return r&&a?n/(r*a):0}if("poly2"===n){const n=Qd(e,t);return Math.pow(n+1,2)}{let n=0;for(let r=0;r<e.length;r++){const a=e[r]-t[r];n+=a*a}return Math.exp(-n/Math.max(1e-9,2*r*r))}}(e,x,u,d)),_=function(e,t){const n=Array.from(new Set(t.toLowerCase().split(/\W+/).filter(e=>e.length>2))),r=/\b(define|declare|syntax|example|function|struct|map|interface)\b/i.test(t);return e.map(e=>{const t=e.rich||e.content||"",a=t.toLowerCase();let o=0;for(const e of n)a.includes(e)&&o++;return r&&/```/.test(t)&&(o+=5),Math.min(1,.03*o)})}(n,t),M=function(e,t,n){return Math.max(t,Math.min(n,e))}(f,0,1),R=null!=p?p:.08,A=E.map((e,t)=>{const n=C[t],r=h*_[t],a=1/(1+R*(e*e+n*n+.5*r*r))*(M*e+(1-M)*n+r);return Math.tanh(a)}),P=Math.max(v,null!=b?b:0),L=ef(A,P),T=ef(L.map(e=>A[e]),v).map(e=>L[e]);return{items:T.map(e=>{const t=n[e],r=t.rich&&t.rich.trim()||t.content&&t.content.trim()||"(see subsections)";return{score:A[e],heading:t.heading,content:r,index:e}}),scores:T.map(e=>A[e]),indices:T,tfidfScores:T.map(e=>C[e]),denseScores:T.map(e=>E[e])}}const nf=new Set(["a","an","the","and","or","but","if","then","else","for","to","of","in","on","at","by","with","is","are","was","were","be","been","being","as","from","that","this","it","its","you","your","i","we","they","he","she","them","his","her","our","us","do","does","did","done","not","no","yes","can","could","should","would","may","might","into","about","over","under","between"]);function rf(e){return e.toLowerCase().replace(/[`*_#>~=\[\]{}()!?.:,;'"<>|/\\+-]+/g," ").split(/\s+/).filter(e=>e&&!nf.has(e))}function af(e){const t=new Map,n=[],r=[];let a=0;for(const o of e){const e=rf(o);r.push(e.length);const i=new Map;for(const n of e){let e=t.get(n);void 0===e&&(e=a++,t.set(n,e)),i.set(e,(i.get(e)||0)+1)}n.push(i)}const o=e.length,i=Array(a).fill(0);for(const e of n)for(const t of e.keys())i[t]+=1;const s=i.map(e=>Math.log((o+1)/(e+1))+1),l=r.reduce((e,t)=>e+t,0)/Math.max(1,o);return{stats:{vocab:t,idf:s,avgLen:l,df:i},tf:n,docLens:r}}function of(e,t){const n=new Map;let r=0;for(const[a,o]of e){const e=o*(t[a]||0);n.set(a,e),r+=e*e}const a=Math.sqrt(r)||1e-12;for(const[e,t]of n)n.set(e,t/a);return n}function sf(e,t){const[n,r]=e.size<t.size?[e,t]:[t,e];let a=0;for(const[e,t]of n){const n=r.get(e);void 0!==n&&(a+=t*n)}return a}function lf(e,t,n=1337){const r=new Float64Array(t);for(const[n,a]of e){let e=2654435761*n>>>0;for(let n=0;n<t;n++){e^=e<<13,e^=e>>>17,e^=e<<5;const t=(e>>>0)/4294967296*2-1;r[n]+=a*t}}let a=0;for(let e=0;e<t;e++)a+=r[e]*r[e];const o=Math.sqrt(a)||1e-12;for(let e=0;e<t;e++)r[e]/=o;return r}function cf(e){return/```+\s*go([\s\S]*?)```/i.test(e)||/\bfunc\s+\w+\s*\(.*\)\s*\w*\s*{/.test(e)}function uf(e){return/```+/.test(e)||/{[^}]*}/.test(e)}function df(e,t){const n=(r=rf(e),Array.from(new Set(r)));var r;const a=new Set(rf(t));if(0===n.length||0===a.size)return 0;let o=0;for(const e of n)a.has(e)&&o++;return o/n.length}function ff(e,t,n,r,a,o,i,s,l,c){var u;const d=[],f=[],h=sf(n,r);d.push(h),f.push("cosine_tfidf");const p=function(e,t,n,r,a=1.5,o=.75){let i=0;for(const[s]of e){const e=t.get(s)||0;e<=0||(i+=Math.log(((n.df[s]||0)+.5)/(n.idf.length-(n.df[s]||0)+.5)+1)*(e*(a+1)/(e+a*(1-o+o*(r/(n.avgLen||1)))||1e-12)))}return i}(a,o,i,s);d.push(p),f.push("bm25");const m=df(t.heading||"",e);d.push(m),f.push("heading_match_frac");const g=function(e,t){const n=new Set(rf(e)),r=new Set(rf(t));let a=0;for(const e of n)r.has(e)&&a++;const o=n.size+r.size-a;return 0===o?0:a/o}(e,t.content||"");d.push(g),f.push("jaccard_tokens");const y=cf(t.rich||t.content||""),v=uf(t.rich||t.content||"");var b;d.push(y?1:0),f.push("flag_go_code"),d.push(v?1:0),f.push("flag_any_code"),d.push((b=t.content||"",!/(golang\.org|go\.dev|pkg\.go\.dev)/i.test(b)?0:1)),f.push("flag_go_spec_link"),d.push(null!==(u=t.score_base)&&void 0!==u?u:0),f.push("prior_score_base");const w=(t.content||"").length;if(d.push(1/Math.sqrt(1+w)),f.push("len_inv_sqrt"),l&&c){let e=0,t=0;for(let n=0;n<l.length;n++)e+=l[n]*c[n],t+=Math.abs(l[n]-c[n]);d.push(e),f.push("proj_dot"),d.push(t/l.length),f.push("proj_l1mean")}return{names:f,values:d}}class hf{constructor(){this.w=null,this.mu=null,this.sigma=null}fit(e,t,n=.01){var r;const a=e.length,o=(null===(r=e[0])||void 0===r?void 0:r.length)||0;if(0===a||0===o)return void(this.w=new Float64Array(o));const i=new Float64Array(o),s=new Float64Array(o);for(let t=0;t<o;t++){let n=0;for(let r=0;r<a;r++)n+=e[r][t];n/=a,i[t]=n;let r=0;for(let o=0;o<a;o++){const a=e[o][t]-n;r+=a*a}s[t]=Math.sqrt(r/a)||1}const l=Array.from({length:a},(e,t)=>new Float64Array(o));for(let t=0;t<a;t++)for(let n=0;n<o;n++)l[t][n]=(e[t][n]-i[n])/s[n];const c=Array.from({length:o},()=>new Float64Array(o)),u=new Float64Array(o);for(let e=0;e<a;e++){const n=l[e],r=t[e];for(let e=0;e<o;e++){u[e]+=n[e]*r;const t=n[e];for(let r=0;r<=e;r++)c[e][r]+=t*n[r]}}for(let e=0;e<o;e++){for(let t=0;t<e;t++)c[t][e]=c[e][t];c[e][e]+=n}const d=Array.from({length:o},()=>new Float64Array(o));for(let e=0;e<o;e++)for(let t=0;t<=e;t++){let n=c[e][t];for(let r=0;r<t;r++)n-=d[e][r]*d[t][r];d[e][t]=e===t?Math.sqrt(Math.max(n,1e-12)):n/(d[t][t]||1e-12)}const f=new Float64Array(o);for(let e=0;e<o;e++){let t=u[e];for(let n=0;n<e;n++)t-=d[e][n]*f[n];f[e]=t/(d[e][e]||1e-12)}const h=new Float64Array(o);for(let e=o-1;e>=0;e--){let t=f[e];for(let n=e+1;n<o;n++)t-=d[n][e]*h[n];h[e]=t/(d[e][e]||1e-12)}this.w=h,this.mu=i,this.sigma=s}predict(e){if(!this.w||!this.mu||!this.sigma)return 0;let t=0;for(let n=0;n<this.w.length;n++){const r=(e[n]-this.mu[n])/this.sigma[n];t+=this.w[n]*r}return t}}function pf(e,t,n){var r;const a=t.rich||t.content||"";let o=0;/\bgo\b/.test(e.toLowerCase())&&/(define|declare|function|func)/i.test(e)&&cf(a)&&(o=Math.max(o,1));df(t.heading||"",e)>=.34&&uf(a)&&(o=Math.max(o,.8));const i=n.names.indexOf("cosine_tfidf"),s=n.names.indexOf("bm25"),l=i>=0?n.values[i]:0,c=s>=0?n.values[s]:0;l>.25&&(o=Math.max(o,.6)),c>1&&(o=Math.max(o,.6));const u=n.names.indexOf("prior_score_base"),d=u>=0?n.values[u]:0;return(null!==(r=t.score_base)&&void 0!==r?r:0)>0&&(o=Math.max(o,Math.min(.6,.2+.5*d))),o}function mf(e,t,n={}){var r,a;const{lambdaRidge:o=.01,randomProjDim:i=32,exposeFeatures:s=!0,attachFeatureNames:l=!1}=n,c=[e,...t.map(e=>e.content||"")],{stats:u,tf:d,docLens:f}=af(c),h=d.map(e=>of(e,u.idf)),p=d[0],m=h[0],g=i>0?lf(m,i):void 0,y=[],v=[],b=[];for(let n=0;n<t.length;n++){const r=t[n],a=d[n+1],o=h[n+1],s=i>0?lf(o,i,1337+n):void 0,l=ff(e,r,m,o,p,a,u,f[n+1]||1,g,s);b.push(l),y.push(l.values);const c=pf(e,r,l);v.push(c)}const w=v.every(e=>Math.abs(e-v[0])<1e-9);if(w){const e=b[0].names.indexOf("cosine_tfidf");if(e>=0)for(let t=0;t<v.length;t++)v[t]=Math.max(0,Math.min(1,.2+.6*y[t][e]))}const k=new hf;k.fit(y,v,o);let S=1/0,x=-1/0;const C=y.map(e=>k.predict(e));for(const e of C)e<S&&(S=e),e>x&&(x=e);const E=Math.max(1e-9,x-S),_=l?null!==(a=null===(r=b[0])||void 0===r?void 0:r.names)&&void 0!==a?a:[]:void 0,M=t.map((e,t)=>{const n=(C[t]-S)/E,r=function(e){if(e>=0)return 1/(1+Math.exp(-e));{const t=Math.exp(e);return t/(1+t)}}((C[t]-.5*(S+x))/(.2*E+1e-6)),a=Object.assign(Object.assign({},e),{score_rr:n,p_relevant:r});return s&&(a._features=y[t]),_&&(a._feature_names=_),a});return M.sort((e,t)=>t.score_rr-e.score_rr),M}function gf(e,t={}){const{probThresh:n=.45,epsilonTop:r=.05,useMMR:a=!0,mmrLambda:o=.7,budgetChars:i=1200}=t;if(0===e.length)return[];const s=e[0].score_rr,l=e.filter(e=>e.p_relevant>=n&&e.score_rr>=s-r),c=l.length>0?l:[e[0]];if(!a){const e=[];let t=0;for(const n of c){const r=(n.content||"").length;if(t+r>i&&e.length>0)break;e.push(n),t+=r}return e}return function(e,t=.7,n=1200){const r=[],a=e.map(e=>e.content||""),{stats:o,tf:i}=af(a),s=i.map(e=>of(e,o.idf)),l=new Set;let c=0;for(;l.size<e.length;){let a=-1,o=-1/0;for(let n=0;n<e.length;n++){if(l.has(n))continue;const r=e[n];let i=0;for(const e of l){const t=sf(s[n],s[e]);t>i&&(i=t)}const c=t*r.score_rr-(1-t)*i;c>o&&(o=c,a=n)}if(a<0)break;const i=e[a],u=(i.content||"").length;if(c+u>n&&r.length>0)break;r.push(i),c+=u,l.add(a)}return r}(e.map(e=>Object.assign(Object.assign({},e),{score_rr:c.includes(e)?e.score_rr+.01:e.score_rr})),o,i)}var yf=Object.freeze({__proto__:null,OmegaOfflineRAG:class{constructor(e){this.modelState=null,this.model=null,this.config={reranking:{enabled:e?.reranking?.enabled??!0,lambdaRidge:e?.reranking?.lambdaRidge??.1,useMMR:e?.reranking?.useMMR??!0,mmrLambda:e?.reranking?.mmrLambda??.5,probThresh:e?.reranking?.probThresh??.1},topK:e?.topK??5,verbose:e?.verbose??!1}}async loadModel(e){const t=performance.now();if(this.model=e,this.modelState=function(e){if("astermind-pro-v1"!==e.version&&"astermind-elm-v1"!==e.version)throw new Error(`Unsupported model version: ${e.version}. Expected 'astermind-pro-v1' or 'astermind-elm-v1'`);const t=JSON.parse(JSON.stringify(e.settings||{})),n=new Map(e.vocab),r=Float64Array.from(e.idf),a=e.chunks.map(e=>({heading:e.heading,content:e.content||"",rich:e.rich,level:e.level,secId:e.secId})),o=e.tfidfDocs.map(e=>{const t=new Map;for(const[n,r]of e)t.set(n,r);return t}),i=Array.from(e.landmarksIdx),s=e.landmarkMat.map(e=>Float64Array.from(e));let l;if(!e.denseDocs||e.denseDocs.length!==o.length)throw new Error("recomputeDense=true but buildDense function not provided");return l=e.denseDocs.map(e=>Float64Array.from(e)),{settings:t,vocabMap:n,idf:r,chunks:a,tfidfDocs:o,landmarksIdx:i,landmarkMat:s,denseDocs:l}}(e),this.config.verbose){const e=performance.now()-t;console.log(`[OmegaOfflineRAG] Model loaded in ${e.toFixed(0)}ms`),console.log(`[OmegaOfflineRAG] ${this.modelState.chunks.length} chunks, ${this.modelState.vocabMap.size} vocab`)}}async loadModelFromUrl(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch model from ${e}: ${t.status}`);const n=await t.json();await this.loadModel(n)}isReady(){return null!==this.modelState}getModelInfo(){return this.model&&this.modelState?{version:this.model.version,savedAt:this.model.savedAt,documentCount:this.modelState.chunks.length,vocabularySize:this.modelState.vocabMap.size,landmarkCount:this.modelState.landmarksIdx.length,hasDenseVectors:this.modelState.denseDocs.length>0,settings:this.model.settings}:null}async ask(e){const t=performance.now();if(!this.modelState||!this.model)return{answer:"Omega model not loaded. Please load a model first.",confidence:"none",sources:[],processingTime:0,degraded:!0,degradedReason:"Model not loaded"};try{const n=this.model.settings,r=n.kernel??"rbf",a=n.sigma??1,o=n.alpha??.5,i=n.beta??.3,s=n.ridge??.001,l=n.headingW??.2,c=n.useStem??!0,u=n.expandQuery??!1,d=n.prefilter??100,f=tf({query:e,chunks:this.modelState.chunks,vocabMap:this.modelState.vocabMap,idf:this.modelState.idf,tfidfDocs:this.modelState.tfidfDocs,denseDocs:this.modelState.denseDocs,landmarksIdx:this.modelState.landmarksIdx,landmarkMat:this.modelState.landmarkMat,vocabSize:this.modelState.vocabMap.size,kernel:r,sigma:a,alpha:o,beta:i,ridge:s,headingW:l,useStem:c,expandQuery:u,topK:2*this.config.topK,prefilter:d});let h;if(this.config.reranking.enabled&&f.items.length>0){const t=function(e,t,n={}){return gf(mf(e,t,n),n)}(e,f.items.map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score_base:f.scores[t]})),{lambdaRidge:this.config.reranking.lambdaRidge,useMMR:this.config.reranking.useMMR,mmrLambda:this.config.reranking.mmrLambda,probThresh:this.config.reranking.probThresh});h=t.slice(0,this.config.topK).map(e=>({heading:e.heading,content:e.content,rich:e.rich,score:e.score_base??0,rerankScore:e.score_rr,probability:e.p_relevant}))}else h=f.items.slice(0,this.config.topK).map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score:f.scores[t]}));const p=await Gd(e,h.map(e=>({heading:e.heading,content:e.content,score:e.score}))),m=performance.now()-t,g=h[0]?.score??0,y=this.determineConfidence(g,h.length);return{answer:p,confidence:y,sources:h,processingTime:m,degraded:!1,queryClassification:this.classifyQuery(e)}}catch(e){const n=performance.now()-t;return console.error("[OmegaOfflineRAG] Error during retrieval:",e),{answer:"An error occurred while processing your question offline.",confidence:"none",sources:[],processingTime:n,degraded:!0,degradedReason:e instanceof Error?e.message:"Unknown error"}}}async retrieve(e,t){if(!this.modelState||!this.model)return[];const n=t??this.config.topK,r=this.model.settings,a=r.kernel??"rbf",o=r.sigma??1,i=r.alpha??.5,s=r.beta??.3,l=r.ridge??.001,c=r.headingW??.2,u=r.useStem??!0,d=r.expandQuery??!1,f=r.prefilter??100,h=tf({query:e,chunks:this.modelState.chunks,vocabMap:this.modelState.vocabMap,idf:this.modelState.idf,tfidfDocs:this.modelState.tfidfDocs,denseDocs:this.modelState.denseDocs,landmarksIdx:this.modelState.landmarksIdx,landmarkMat:this.modelState.landmarkMat,vocabSize:this.modelState.vocabMap.size,kernel:a,sigma:o,alpha:i,beta:s,ridge:l,headingW:c,useStem:u,expandQuery:d,topK:n,prefilter:f});return h.items.map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score:h.scores[t]}))}classifyQuery(e){const t=e.toLowerCase(),n=t.split(/\s+/),r=["what","who","when","where","which","is","are","was","were"],a=["how","steps","guide","tutorial","process","procedure"],o=["why","explain","describe","meaning","definition","concept"],i=["go to","navigate","find","page","link","take me","show me"];let s="unknown",l=.5;const c=[];for(const e of i)if(t.includes(e)){s="navigational",l=.8,c.push(e);break}if("unknown"===s){const e=n[0];a.includes(e)||a.some(e=>t.includes(e))?(s="procedural",l=.7,c.push(...a.filter(e=>t.includes(e)))):o.includes(e)||o.some(e=>t.includes(e))?(s="conceptual",l=.7,c.push(...o.filter(e=>t.includes(e)))):r.includes(e)&&(s="factual",l=.7,c.push(e))}return{type:s,confidence:l,keywords:c}}determineConfidence(e,t){return 0===t?"none":e>=.7||e>=.4?"medium":"low"}clear(){this.modelState=null,this.model=null}}});function vf({onClick:e,position:t,unreadCount:n=0}){return od.jsxs("button",{className:`astermind-bubble astermind-bubble--${t}`,onClick:e,"aria-label":"Open chat",type:"button",children:[od.jsx("svg",{className:"astermind-bubble__icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:od.jsx("path",{d:"M21 11.5C21.0034 12.8199 20.6951 14.1219 20.1 15.3C19.3944 16.7118 18.3098 17.8992 16.9674 18.7293C15.6251 19.5594 14.0782 19.9994 12.5 20C11.1801 20.0035 9.87812 19.6951 8.7 19.1L3 21L4.9 15.3C4.30493 14.1219 3.99656 12.8199 4 11.5C4.00061 9.92179 4.44061 8.37488 5.27072 7.03258C6.10083 5.69028 7.28825 4.6056 8.7 3.90003C9.87812 3.30496 11.1801 2.99659 12.5 3.00003H13C15.0843 3.11502 17.053 3.99479 18.5291 5.47089C20.0052 6.94699 20.885 8.91568 21 11V11.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),n>0&&od.jsx("span",{className:"astermind-bubble__badge",children:n})]})}function bf({title:e,subtitle:t,onClose:n,children:r}){return od.jsxs("div",{className:"astermind-header",children:[od.jsxs("div",{className:"astermind-header__info",children:[od.jsx("h3",{className:"astermind-header__title",children:e}),t&&od.jsx("p",{className:"astermind-header__subtitle",children:t})]}),od.jsxs("div",{className:"astermind-header__actions",children:[r,od.jsx("button",{className:"astermind-header__close",onClick:n,"aria-label":"Close chat",type:"button",children:od.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:od.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})]})}function wf(e){if(!e)return"";return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,"<code>$1</code>").replace(/\[(.+?)\]\((.+?)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>').replace(/\n/g,"<br />")}function kf(){return od.jsxs("svg",{className:"astermind-source__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[od.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),od.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Sf(){return od.jsxs("svg",{className:"astermind-source__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[od.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),od.jsx("polyline",{points:"7 10 12 15 17 10"}),od.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function xf({source:e,showSummaryButton:t,showDownloadButton:n,onViewSummary:r,onDownload:a}){const[o,i]=j.useState(!1);return od.jsxs("div",{className:"astermind-source",children:[od.jsxs("div",{className:"astermind-source__header",children:[od.jsx("span",{className:"astermind-source__title",children:e.documentName||e.title}),od.jsxs("div",{className:"astermind-source__actions",children:[t&&od.jsx("button",{className:"astermind-source__action-btn",onClick:t=>{t.stopPropagation(),e.fullContent&&i(!o),r?.(e)},title:"View summary","aria-label":"View source summary",children:od.jsx(kf,{})}),n&&od.jsx("button",{className:"astermind-source__action-btn",onClick:t=>{t.stopPropagation(),a?.(e)},title:"Download source","aria-label":"Download source file",children:od.jsx(Sf,{})}),od.jsxs("span",{className:"astermind-source__relevance",children:[Math.round(100*e.relevance),"%"]})]})]}),od.jsx("p",{className:"astermind-source__snippet",children:e.snippet}),o&&e.fullContent&&od.jsx("div",{className:"astermind-source__full-content",dangerouslySetInnerHTML:{__html:wf(e.fullContent)}})]})}function Cf({sources:e,config:t={},isOnline:n=!0,onViewSummary:r,onDownload:a}){const{enabled:o=!0,showSummary:i=!0,showDownload:s=!0}=t;return o&&0!==e.length?od.jsx("div",{className:"astermind-sources",children:e.map((e,t)=>{const o=i&&!!e.fullContent,l=s&&n&&!!e.downloadUrl;return od.jsx(xf,{source:e,showSummaryButton:o,showDownloadButton:l,onViewSummary:r,onDownload:a},e.chunkId||e.documentId||t)})}):null}function Ef(e){const t=new Date,n=t.getTime()-e.getTime();if(n<6e4)return"Just now";if(n<36e5){return`${Math.floor(n/6e4)}m ago`}return e.toDateString()===t.toDateString()?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString([],{month:"short",day:"numeric"})}function _f({message:e,sourceConfig:t,isOnline:n=!0,onViewSourceSummary:r,onDownloadSource:a}){const[o,i]=j.useState(!1);return od.jsxs("div",{className:`astermind-message astermind-message--${e.role}`,children:[od.jsx("div",{className:"astermind-message__bubble",children:e.isStreaming&&!e.content?od.jsxs("span",{className:"astermind-message__typing",children:[od.jsx("span",{}),od.jsx("span",{}),od.jsx("span",{})]}):od.jsx("div",{className:"astermind-message__content",dangerouslySetInnerHTML:{__html:wf(e.content)}})}),od.jsxs("div",{className:"astermind-message__meta",children:[od.jsx("span",{className:"astermind-message__time",children:Ef(e.timestamp)}),e.offline&&od.jsx("span",{className:"astermind-message__offline",title:"Offline response",children:"offline"}),e.confidence&&"high"!==e.confidence&&od.jsx("span",{className:`astermind-message__confidence astermind-message__confidence--${e.confidence}`,title:`Confidence: ${e.confidence}`,children:e.confidence})]}),e.sources&&e.sources.length>0&&od.jsxs("div",{className:"astermind-message__sources",children:[od.jsxs("button",{className:"astermind-message__sources-toggle",onClick:()=>i(!o),type:"button",children:[o?"Hide":"Show"," sources (",e.sources.length,")"]}),o&&od.jsx(Cf,{sources:e.sources,config:t,isOnline:n,onViewSummary:r,onDownload:a})]})]})}function Mf(){return od.jsxs("div",{className:"astermind-typing",children:[od.jsx("span",{}),od.jsx("span",{}),od.jsx("span",{})]})}function Rf({messages:e,isProcessing:t,sourceConfig:n,isOnline:r=!0,onViewSourceSummary:a,onDownloadSource:o}){const i=j.useRef(null);return j.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,t]),od.jsxs("div",{className:"astermind-messages",ref:i,children:[e.map(e=>od.jsx(_f,{message:e,sourceConfig:n,isOnline:r,onViewSourceSummary:a,onDownloadSource:o},e.id)),t&&""===e[e.length-1]?.content&&od.jsx(Mf,{})]})}function Af({placeholder:e,disabled:t=!1,onSend:n}){const[r,a]=j.useState(""),o=j.useRef(null),i=()=>{r.trim()&&!t&&(n(r.trim()),a(""),o.current?.focus())};return od.jsxs("div",{className:"astermind-input",children:[od.jsx("textarea",{ref:o,className:"astermind-input__textarea",value:r,onChange:e=>{const t=e.target;a(t.value),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),i())},placeholder:e,disabled:t,rows:1,"aria-label":"Message input"}),od.jsx("button",{className:"astermind-input__send",onClick:i,disabled:t||!r.trim(),"aria-label":"Send message",type:"button",children:od.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:od.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})}function Pf({action:e,onConfirm:t,onCancel:n}){return od.jsxs("div",{className:"astermind-action-card",children:[od.jsxs("div",{className:"astermind-action-card__header",children:[od.jsx("div",{className:"astermind-action-card__icon",children:(e=>{switch(e){case"navigate":return od.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[od.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),od.jsx("polyline",{points:"15,3 21,3 21,9"}),od.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]});case"fillForm":return od.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[od.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),od.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"clickElement":return od.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[od.jsx("path",{d:"M15 15l-2 5L9 9l11 4-5 2z"}),od.jsx("path",{d:"M15 15l5 5"})]});default:return od.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[od.jsx("circle",{cx:"12",cy:"12",r:"10"}),od.jsx("polyline",{points:"12,6 12,12 16,14"})]})}})(e.type)}),od.jsxs("div",{className:"astermind-action-card__title",children:[od.jsx("span",{className:"astermind-action-card__label",children:(e=>{switch(e){case"navigate":return"Navigate to";case"fillForm":return"Fill form field";case"clickElement":return"Click";case"triggerModal":return"Open modal";case"scroll":return"Scroll to";case"highlight":return"Highlight";case"custom":return"Execute action";default:return"Perform action"}})(e.type)}),od.jsx("span",{className:"astermind-action-card__target",children:e.target})]})]}),e.explanation&&od.jsx("p",{className:"astermind-action-card__explanation",children:e.explanation}),od.jsxs("div",{className:"astermind-action-card__confidence",children:[od.jsx("div",{className:"astermind-action-card__confidence-bar",style:{width:100*e.confidence+"%"}}),od.jsxs("span",{children:[Math.round(100*e.confidence),"% confident"]})]}),od.jsxs("div",{className:"astermind-action-card__actions",children:[od.jsx("button",{className:"astermind-action-card__cancel",onClick:n,type:"button",children:"Cancel"}),od.jsx("button",{className:"astermind-action-card__confirm",onClick:t,type:"button",children:"Confirm"})]})]})}function Lf({status:e}){return od.jsxs("div",{className:`astermind-status astermind-status--${e}`,children:[od.jsx("span",{className:"astermind-status__dot"}),od.jsx("span",{className:"astermind-status__label",children:(()=>{switch(e){case"online":return"Online";case"offline":return"Offline";case"connecting":return"Connecting...";case"error":return"Error";default:return"Unknown"}})()})]})}function Tf({messages:e,isProcessing:t,connectionStatus:n,pendingAction:r,headerTitle:a,headerSubtitle:o,placeholder:i,showPoweredBy:s,sourceConfig:l,onClose:c,onSendMessage:u,onActionConfirm:d,onActionCancel:f,onViewSourceSummary:h,onDownloadSource:p}){const m="online"===n;return od.jsxs("div",{className:"astermind-window",children:[od.jsx(bf,{title:a,subtitle:o,onClose:c,children:od.jsx(Lf,{status:n})}),od.jsxs("div",{className:"astermind-window__body",children:[od.jsx(Rf,{messages:e,isProcessing:t,sourceConfig:l,isOnline:m,onViewSourceSummary:h,onDownloadSource:p}),r&&od.jsx(Pf,{action:r,onConfirm:()=>d(r),onCancel:f})]}),od.jsxs("div",{className:"astermind-window__footer",children:[od.jsx(Af,{placeholder:i,disabled:t||"error"===n,onSend:u}),s&&od.jsxs("div",{className:"astermind-powered-by",children:["Powered by ",od.jsx("a",{href:"https://astermind.ai",target:"_blank",rel:"noopener noreferrer",children:"AsterMind"})]})]})]})}const Nf={primaryColor:"#4F46E5",primaryHover:"#4338CA",backgroundColor:"#ffffff",surfaceColor:"#f3f4f6",textColor:"#1f2937",textMuted:"#6b7280",borderColor:"#e5e7eb",userBubbleBackground:"#4F46E5",userBubbleText:"#ffffff",botBubbleBackground:"#f3f4f6",botBubbleText:"#1f2937",widgetWidth:"380px",widgetHeight:"75vh",bubbleSize:"60px",borderRadius:"12px",fontFamily:"'Inter', system-ui, -apple-system, sans-serif",fontSize:"14px",shadow:"0 4px 20px rgba(0, 0, 0, 0.15)"};const Df=j.createContext(null);function If({theme:e,children:t}){const n=function(e){const t=j.useMemo(()=>({...Nf,...e}),[e]),n=j.useMemo(()=>({"--astermind-primary":t.primaryColor,"--astermind-primary-hover":t.primaryHover,"--astermind-background":t.backgroundColor,"--astermind-surface":t.surfaceColor,"--astermind-text":t.textColor,"--astermind-text-muted":t.textMuted,"--astermind-border":t.borderColor,"--astermind-user-bg":t.userBubbleBackground,"--astermind-user-text":t.userBubbleText,"--astermind-bot-bg":t.botBubbleBackground,"--astermind-bot-text":t.botBubbleText,"--astermind-widget-width":t.widgetWidth,"--astermind-widget-height":t.widgetHeight,"--astermind-bubble-size":t.bubbleSize,"--astermind-border-radius":t.borderRadius,"--astermind-font-family":t.fontFamily,"--astermind-font-size":t.fontSize,"--astermind-shadow":t.shadow}),[t]);return{theme:t,cssVariables:n}}(e);return od.jsx(Df.Provider,{value:n,children:od.jsx("div",{style:n.cssVariables,children:t})})}function zf(e){const r=j.useMemo(()=>function(){let e="",t="https://api.astermind.ai";try{n&&"SCRIPT"===n.tagName.toUpperCase()&&n.src||new URL("astermind-chatbot.min.js",document.baseURI).href}catch{}if(!e&&"undefined"!=typeof process&&process.env&&(e=process.env.REACT_APP_ASTERMIND_RAG_API_KEY||e,t=process.env.REACT_APP_ASTERMIND_RAG_API_SERVER_URL||t),"undefined"!=typeof window){const n=window.__ASTERMIND_CONFIG__;n&&"object"==typeof n&&(e=n.apiKey||e,t=n.apiUrl||t)}return{apiKey:e,apiUrl:t}}(),[]),{apiKey:a,apiUrl:o,throwOnMissingKey:i=!0,position:s="bottom-right",theme:l={},greeting:c="Hi! How can I help you today?",placeholder:u="Type your message...",agent:d,fallback:f={enabled:!0},sourceDisplay:h,showPoweredBy:p=!0,headerTitle:m="AsterMind",headerSubtitle:g="AI Assistant",defaultOpen:y=!1,zIndex:v=9999,onReady:b,onMessage:w,onAction:k,onError:S,onToggle:x}=e,C=a||r.apiKey,E=o||r.apiUrl,[_,M]=j.useState(y),[R,A]=j.useState(null),[P,L]=j.useState([]),[T,N]=j.useState(!1),[D,I]=j.useState(),[z,F]=j.useState(),[O,$]=j.useState("connecting"),U=d?.siteMapConfig?.discovery?.enabled??!1,{entries:B}=function(e={}){const{enabled:n=!0,transformRoute:r,excludePaths:a=[],navSelectors:o,disableDomFallback:i=!1}=e,[s,l]=t.useState({entries:[],isDiscovering:!1,error:null,framework:null}),c=t.useRef(!1),u=t.useRef(e);u.current=e;const d=t.useCallback(()=>{if("undefined"==typeof window)return"generic";const e=window;return e.__REACT_ROUTER_DATA_ROUTER__||e.__reactRouterContext?"react-router":e.__VUE_ROUTER__||e.__VUE_APP__?.$router?"vue-router":e.__NEXT_DATA__?"next":e.ng||document.querySelector("[ng-version]")?"angular":"generic"},[]),f=t.useCallback(e=>{const t=u.current.excludePaths||[];for(const n of t)if(new RegExp("^"+n.replace(/\*/g,".*")+"$").test(e))return!0;return!1},[]),h=t.useCallback(e=>{const t=e.split("/").filter(Boolean);return(t[t.length-1]||"Home").replace(/[-_:]/g," ").replace(/\[.*?\]/g,"").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ").trim()||"Page"},[]),p=t.useCallback(e=>e.path&&"*"!==e.path&&"**"!==e.path?{path:e.path,name:e.name||e.meta?.title||h(e.path),description:e.meta?.description,aliases:e.meta?.keywords||e.meta?.aliases,dynamicParams:e.path.includes(":")||e.path.includes("[")}:null,[h]),m=t.useCallback((e,t,n)=>{for(const r of e){let e=r.path||"";e&&!e.startsWith("/")?e=n?`${n}/${e}`.replace(/\/+/g,"/"):`/${e}`:!e&&n&&(e=n);const a={path:e,name:r.handle?.name||r.handle?.title||r.id,meta:r.handle||{}};r.path&&!f(e)&&t.push(a),r.children&&m(r.children,t,e)}},[f]),g=t.useCallback(()=>{if("undefined"==typeof document)return[];const e=u.current.navSelectors||["nav a[href]",'[role="navigation"] a[href]',".nav a[href]",".sidebar a[href]",".menu a[href]","header a[href]"],t=[],n=new Set;for(const r of e)try{const e=document.querySelectorAll(r);for(const r of e){const e=r.getAttribute("href");if(!e||e.startsWith("http")||e.startsWith("javascript:"))continue;const a=(e.startsWith("/")?e:`/${e}`).split("?")[0].split("#")[0];n.has(a)||"/"===a||f(a)||(n.add(a),t.push({path:a,name:r.textContent?.trim()||h(a)}))}}catch(e){}return t},[f,h]),y=t.useCallback(()=>{if(n&&"undefined"!=typeof window){l(e=>({...e,isDiscovering:!0,error:null}));try{const e=d(),t=[],n=window;if("react-router"===e&&n.__REACT_ROUTER_DATA_ROUTER__?.routes)m(n.__REACT_ROUTER_DATA_ROUTER__.routes,t,"");else if("vue-router"===e){const e=n.__VUE_APP__?.$router||n.__VUE_ROUTER__;if(e?.getRoutes)for(const n of e.getRoutes())f(n.path)||t.push({path:n.path,name:n.name?.toString(),meta:n.meta||{}})}else if("next"===e&&n.__NEXT_DATA__?.buildManifest?.pages)for(const e of Object.keys(n.__NEXT_DATA__.buildManifest.pages))e.startsWith("/_")||f(e)||t.push({path:e,name:h(e)});0!==t.length||i||t.push(...g());const r=u.current.transformRoute||p,a=[];for(const e of t){const t=r(e);t&&a.push(t)}l({entries:a,isDiscovering:!1,error:null,framework:e}),c.current=!0,console.log(`[useSiteMapDiscovery] Discovered ${a.length} routes from ${e}`)}catch(e){console.warn("[useSiteMapDiscovery] Discovery failed:",e),l(t=>({...t,isDiscovering:!1,error:String(e)}))}}},[n,d,m,g,p,f,h,i]);return t.useEffect(()=>{if(!n||c.current)return;const e=setTimeout(y,100);return()=>clearTimeout(e)},[n,y]),t.useEffect(()=>{if(!n||"undefined"==typeof window)return;const e=()=>{setTimeout(y,50)};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[n,y]),{...s,refresh:y}}({enabled:U,excludePaths:d?.siteMapConfig?.discovery?.excludePaths,transformRoute:d?.siteMapConfig?.discovery?.transformRoute,navSelectors:d?.siteMapConfig?.discovery?.navSelectors,disableDomFallback:!1===d?.siteMapConfig?.discovery?.domFallback}),V=j.useMemo(()=>{const e=d?.siteMap||d?.siteMapConfig?.static||[],t=[...e],n=new Set(e.map(e=>e.path.toLowerCase()));for(const e of B)n.has(e.path.toLowerCase())||t.push(e);return t},[d?.siteMap,d?.siteMapConfig?.static,B]),W=j.useMemo(()=>{const e=R?.getSourcesConfig?.()||{};return{enabled:h?.enabled??e.enabled??!0,showSummary:h?.showSummary??e.showSummary??!0,showDownload:h?.showDownload??e.showDownload??!0}},[R,h]),H=j.useCallback(e=>{console.log("[AsterMind] View source summary:",e.title)},[]),K=j.useCallback(async e=>{if(e.downloadUrl)try{const t=e.downloadUrl.startsWith("http")?e.downloadUrl:`${E}${e.downloadUrl}`,n=await fetch(t,{headers:{"X-API-Key":C}});if(!n.ok)return void console.error("[AsterMind] Download failed:",n.status,n.statusText);const r=n.headers.get("Content-Disposition");let a=e.documentName||e.title||"download";if(r){const e=r.match(/filename="?(.+?)"?$/);e&&(a=e[1])}const o=await n.blob(),i=window.URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=a,document.body.appendChild(s),s.click(),window.URL.revokeObjectURL(i),document.body.removeChild(s)}catch(e){console.error("[AsterMind] Download error:",e)}else console.warn("[AsterMind] No download URL for source:",e.title)},[E,C]);j.useEffect(()=>{if(!C){const e='AsterMind API key is required. Configure using one of these methods:\n 1. Pass apiKey prop: <ChatbotWidget apiKey="am_..." />\n 2. Set VITE_ASTERMIND_RAG_API_KEY environment variable (Vite)\n 3. Set REACT_APP_ASTERMIND_RAG_API_KEY environment variable (CRA)\n 4. Set window.__ASTERMIND_CONFIG__ = { apiKey: "am_...", apiUrl: "..." }';if(i)throw new Error(e);console.warn("[AsterMind] "+e)}},[C,i]);const q=j.useMemo(()=>{if(d?.enabled)return{enabled:!0,confidenceThreshold:d.confidenceThreshold??.8,siteMap:V,siteMapConfig:d.siteMapConfig,customActions:d.customActions,requireConfirmation:!0}},[d,V]);j.useEffect(()=>{if(!C)return;const e=new Id({apiUrl:E,apiKey:C,fallback:{enabled:f?.enabled??!0,cacheOnConnect:!0},agentic:q,onStatusChange:e=>{$(e)},onError:e=>{S?.(new Error(e.message))}});if(q?.enabled){!function(e){const t={agent:$d,intentClassifier:Od};e.registerAgentic(t)}(e);const t=q.siteMap?.length??0;console.log(`[AsterMind] Agentic capabilities enabled with ${t} sitemap entries`),U&&console.log("[AsterMind] Sitemap auto-discovery enabled")}if(A(e),c){const e={id:"greeting",role:"assistant",content:c,timestamp:new Date};L([e])}return b?.(),()=>{}},[C,E,f?.enabled,q,c,S,b,U]);const G=j.useCallback(()=>{const e=!_;M(e),x?.(e)},[_,x]),Q=j.useCallback(()=>{M(!1),x?.(!1)},[x]),Y=j.useCallback(async e=>{if(!R||!e.trim()||T)return;const t={id:`user-${Date.now()}`,role:"user",content:e.trim(),timestamp:new Date};if(L(e=>[...e,t]),w?.(t),N(!0),R.isAgenticEnabled())try{const t=await R.smartAsk(e,{sessionId:D});if(t.action&&!t.response){const e={id:t.action.id,type:t.action.type,target:t.action.target,params:t.action.params,confidence:t.action.confidence,explanation:t.action.explanation,status:"pending"};return F(e),k?.(e),void N(!1)}if(t.actionResult){const e={id:t.action.id,type:t.action.type,target:t.action.target,params:t.action?.params,confidence:t.action.confidence,explanation:t.action?.explanation,status:t.actionResult.success?"executed":"failed",result:t.actionResult},n={id:`assistant-${Date.now()}`,role:"assistant",content:t.actionResult.success?`✓ ${t.action?.explanation||"Action completed"}`:`✗ ${t.actionResult.message}`,timestamp:new Date,isStreaming:!1};return L(e=>[...e,n]),k?.(e),void N(!1)}if(t.response){const e={id:`assistant-${Date.now()}`,role:"assistant",content:t.response.reply,timestamp:new Date,sources:t.response.sources,confidence:t.response.confidence,offline:t.response.offline,isStreaming:!1};return L(t=>[...t,e]),I(t.response.sessionId),w?.(e),void N(!1)}}catch(e){console.error("[AsterMind] smartAsk error, falling back to standard ask:",e)}const n=`assistant-${Date.now()}`,r={id:n,role:"assistant",content:"",timestamp:new Date,isStreaming:!0};L(e=>[...e,r]);try{let t="";await R.askStream(e,{onToken:e=>{t+=e,L(e=>e.map(e=>e.id===n?{...e,content:t}:e))},onSources:e=>{L(t=>t.map(t=>t.id===n?{...t,sources:e}:t))},onComplete:e=>{const t={id:n,role:"assistant",content:e.reply,timestamp:new Date,sources:e.sources,confidence:e.confidence,offline:e.offline,isStreaming:!1};L(e=>e.map(e=>e.id===n?t:e)),I(e.sessionId),w?.(t)},onError:()=>{X(R,e,n)}},{sessionId:D})}catch{const e={id:n,role:"assistant",content:"I encountered an error processing your request. Please try again.",timestamp:new Date,isStreaming:!1};L(t=>t.map(t=>t.id===n?e:t)),S?.(new Error("Failed to process message"))}finally{N(!1)}},[R,T,D,w,S,k]),X=async(e,t,n)=>{try{const r=await e.ask(t,{sessionId:D}),a={id:n,role:"assistant",content:r.reply,timestamp:new Date,sources:r.sources,confidence:r.confidence,offline:r.offline,isStreaming:!1};L(e=>e.map(e=>e.id===n?a:e)),I(r.sessionId),w?.(a)}catch{const e={id:n,role:"assistant",content:"I'm having trouble connecting. Please try again later.",timestamp:new Date,isStreaming:!1};L(t=>t.map(t=>t.id===n?e:t))}},J=j.useCallback(async e=>{if(!R)return;const t={...e,status:"confirmed"};F(t);try{const t=await R.executeAction({id:e.id,type:e.type,target:e.target,confidence:e.confidence,params:e.params}),n={...e,status:t.success?"executed":"failed",result:t},r={id:`assistant-${Date.now()}`,role:"assistant",content:t.success?`✓ ${e.explanation||t.message}`:`✗ ${t.message}${t.error?`: ${t.error}`:""}`,timestamp:new Date,isStreaming:!1};L(e=>[...e,r]),F(void 0),k?.(n)}catch(t){const n={...e,status:"failed",result:{success:!1,message:"Failed to execute action",error:String(t)}},r={id:`assistant-${Date.now()}`,role:"assistant",content:`✗ Failed to execute action: ${String(t)}`,timestamp:new Date,isStreaming:!1};L(e=>[...e,r]),F(void 0),k?.(n)}},[z,R,k]),Z=j.useCallback(()=>{if(!z)return;const e={...z,status:"cancelled"};F(void 0),k?.(e)},[z,k]);return od.jsx(If,{theme:l,children:od.jsxs("div",{className:`astermind-chatbot astermind-chatbot--${s}`,style:{zIndex:v},children:[!_&&od.jsx(vf,{onClick:G,position:s}),_&&od.jsx(Tf,{messages:P,isProcessing:T,connectionStatus:O,pendingAction:z,headerTitle:m,headerSubtitle:g,placeholder:u,showPoweredBy:p,sourceConfig:W,onClose:Q,onSendMessage:Y,onActionConfirm:J,onActionCancel:Z,onViewSourceSummary:H,onDownloadSource:K})]})})}let Ff=null;function Of(e){const t=function(){if("undefined"==typeof document)return{};const e=document.querySelector("script[data-astermind-key]");if(!e)return{};const t={},n=e.getAttribute("data-astermind-key");n&&(t.apiKey=n);const r=e.getAttribute("data-astermind-url");r&&(t.apiUrl=r);const a=e.getAttribute("data-astermind-position");a&&["bottom-right","bottom-left","top-right","top-left"].includes(a)&&(t.position=a);const o=e.getAttribute("data-astermind-greeting");o&&(t.greeting=o);const i=e.getAttribute("data-astermind-title");i&&(t.headerTitle=i);const s=e.getAttribute("data-astermind-subtitle");return s&&(t.headerSubtitle=s),"true"===e.getAttribute("data-astermind-auto-open")&&(t.defaultOpen=!0),t}(),n={...t,...function(){if("undefined"==typeof window)return{};const e=window.astermindConfig;return e&&"object"==typeof e?e:{}}(),...e||{}},{container:r=document.body,...a}=n;a.apiKey||console.warn('[AsterMindChatbot] No API key found. Configure using one of these methods:\n 1. AsterMindChatbot.init({ apiKey: "am_..." })\n 2. window.astermindConfig = { apiKey: "am_..." }\n 3. <script data-astermind-key="am_..." ...>\n 4. Set VITE_ASTERMIND_RAG_API_KEY environment variable (if bundled)');const o="string"==typeof r?document.querySelector(r):r;if(!o)return void console.error("[AsterMindChatbot] Container not found:",r);const i=document.createElement("div");i.id="astermind-chatbot-root",o.appendChild(i),Ff=Gu(i),Ff.render(U.createElement(zf,a)),console.log("[AsterMindChatbot] Initialized")}function $f(){Ff&&(Ff.unmount(),Ff=null);const e=document.getElementById("astermind-chatbot-root");e&&e.remove(),console.log("[AsterMindChatbot] Destroyed")}function jf(){return null!==Ff}return"undefined"!=typeof window&&(window.AsterMindChatbot={init:Of,destroy:$f,isInitialized:jf}),e.destroy=$f,e.init=Of,e.isInitialized=jf,e}({},react$1);
20
+ */function G(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;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."}var Q=new Set,Y={};function X(e,t){J(e,t),J(e+"Capture",t)}function J(e,t){for(Y[e]=t,e=0;e<t.length;e++)Q.add(t[e])}var Z=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),ee=Object.prototype.hasOwnProperty,te=/^[: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]*$/,ne={},re={};function ae(e,t,n,r,a,o,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var oe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){oe[e]=new ae(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];oe[t]=new ae(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){oe[e]=new ae(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){oe[e]=new ae(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){oe[e]=new ae(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){oe[e]=new ae(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){oe[e]=new ae(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){oe[e]=new ae(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){oe[e]=new ae(e,5,!1,e.toLowerCase(),null,!1,!1)});var ie=/[\-:]([a-z])/g;function se(e){return e[1].toUpperCase()}function le(e,t,n,r){var a=oe.hasOwnProperty(t)?oe[t]:null;(null!==a?0!==a.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,a,r)&&(n=null),r||null===a?function(e){return!!ee.call(re,e)||!ee.call(ne,e)&&(te.test(e)?re[e]=!0:(ne[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=null===n?3!==a.type&&"":n:(t=a.attributeName,r=a.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(a=a.type)||4===a&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ie,se);oe[t]=new ae(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ie,se);oe[t]=new ae(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ie,se);oe[t]=new ae(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){oe[e]=new ae(e,1,!1,e.toLowerCase(),null,!1,!1)}),oe.xlinkHref=new ae("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){oe[e]=new ae(e,1,!1,e.toLowerCase(),null,!0,!0)});var ce=K.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ue=Symbol.for("react.element"),de=Symbol.for("react.portal"),fe=Symbol.for("react.fragment"),he=Symbol.for("react.strict_mode"),pe=Symbol.for("react.profiler"),me=Symbol.for("react.provider"),ge=Symbol.for("react.context"),ye=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),be=Symbol.for("react.suspense_list"),we=Symbol.for("react.memo"),ke=Symbol.for("react.lazy"),Se=Symbol.for("react.offscreen"),xe=Symbol.iterator;function Ce(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=xe&&e[xe]||e["@@iterator"])?e:null}var Ee,_e=Object.assign;function Me(e){if(void 0===Ee)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ee=t&&t[1]||""}return"\n"+Ee+e}var Le=!1;function Re(e,t){if(!e||Le)return"";Le=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var a=t.stack.split("\n"),o=r.stack.split("\n"),i=a.length-1,s=o.length-1;1<=i&&0<=s&&a[i]!==o[s];)s--;for(;1<=i&&0<=s;i--,s--)if(a[i]!==o[s]){if(1!==i||1!==s)do{if(i--,0>--s||a[i]!==o[s]){var l="\n"+a[i].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=i&&0<=s);break}}}finally{Le=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Me(e):""}function Ae(e){switch(e.tag){case 5:return Me(e.type);case 16:return Me("Lazy");case 13:return Me("Suspense");case 19:return Me("SuspenseList");case 0:case 2:case 15:return e=Re(e.type,!1);case 11:return e=Re(e.type.render,!1);case 1:return e=Re(e.type,!0);default:return""}}function Pe(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case fe:return"Fragment";case de:return"Portal";case pe:return"Profiler";case he:return"StrictMode";case ve:return"Suspense";case be:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ge:return(e.displayName||"Context")+".Consumer";case me:return(e._context.displayName||"Context")+".Provider";case ye:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case we:return null!==(t=e.displayName||null)?t:Pe(e.type)||"Memo";case ke:t=e._payload,e=e._init;try{return Pe(e(t))}catch(e){}}return null}function Ne(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Pe(t);case 8:return t===he?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function De(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function Te(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Ie(e){e._valueTracker||(e._valueTracker=function(e){var t=Te(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function ze(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Te(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function Fe(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}}function Oe(e,t){var n=t.checked;return _e({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function $e(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=De(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function je(e,t){null!=(t=t.checked)&&le(e,"checked",t,!1)}function Ue(e,t){je(e,t);var n=De(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?Ve(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ve(e,t.type,De(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Be(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function Ve(e,t,n){"number"===t&&Fe(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var We=Array.isArray;function He(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+De(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function Ke(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(G(91));return _e({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function qe(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(G(92));if(We(n)){if(1<n.length)throw Error(G(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:De(n)}}function Ge(e,t){var n=De(t.value),r=De(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function Qe(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function Ye(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Xe(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Ye(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var Je,Ze,et=(Ze=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((Je=Je||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Je.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return Ze(e,t)})}:Ze);function tt(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 nt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},rt=["Webkit","ms","Moz","O"];function at(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||nt.hasOwnProperty(e)&&nt[e]?(""+t).trim():t+"px"}function ot(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),a=at(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}Object.keys(nt).forEach(function(e){rt.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),nt[t]=nt[e]})});var it=_e({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function st(e,t){if(t){if(it[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(G(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(G(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(G(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(G(62))}}function lt(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;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 ct=null;function ut(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var dt=null,ft=null,ht=null;function pt(e){if(e=lo(e)){if("function"!=typeof dt)throw Error(G(280));var t=e.stateNode;t&&(t=uo(t),dt(e.stateNode,e.type,t))}}function mt(e){ft?ht?ht.push(e):ht=[e]:ft=e}function gt(){if(ft){var e=ft,t=ht;if(ht=ft=null,pt(e),t)for(e=0;e<t.length;e++)pt(t[e])}}function yt(e,t){return e(t)}function vt(){}var bt=!1;function wt(e,t,n){if(bt)return e(t,n);bt=!0;try{return yt(e,t,n)}finally{bt=!1,(null!==ft||null!==ht)&&(vt(),gt())}}function kt(e,t){var n=e.stateNode;if(null===n)return null;var r=uo(n);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(G(231,t,typeof n));return n}var St=!1;if(Z)try{var xt={};Object.defineProperty(xt,"passive",{get:function(){St=!0}}),window.addEventListener("test",xt,xt),window.removeEventListener("test",xt,xt)}catch(Ze){St=!1}function Ct(e,t,n,r,a,o,i,s,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(e){this.onError(e)}}var Et=!1,_t=null,Mt=!1,Lt=null,Rt={onError:function(e){Et=!0,_t=e}};function At(e,t,n,r,a,o,i,s,l){Et=!1,_t=null,Ct.apply(Rt,arguments)}function Pt(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 Nt(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 Dt(e){if(Pt(e)!==e)throw Error(G(188))}function Tt(e){return e=function(e){var t=e.alternate;if(!t){if(null===(t=Pt(e)))throw Error(G(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(r=a.return)){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return Dt(a),e;if(o===r)return Dt(a),t;o=o.sibling}throw Error(G(188))}if(n.return!==r.return)n=a,r=o;else{for(var i=!1,s=a.child;s;){if(s===n){i=!0,n=a,r=o;break}if(s===r){i=!0,r=a,n=o;break}s=s.sibling}if(!i){for(s=o.child;s;){if(s===n){i=!0,n=o,r=a;break}if(s===r){i=!0,r=o,n=a;break}s=s.sibling}if(!i)throw Error(G(189))}}if(n.alternate!==r)throw Error(G(190))}if(3!==n.tag)throw Error(G(188));return n.stateNode.current===n?e:t}(e),null!==e?It(e):null}function It(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=It(e);if(null!==t)return t;e=e.sibling}return null}var zt=q.unstable_scheduleCallback,Ft=q.unstable_cancelCallback,Ot=q.unstable_shouldYield,$t=q.unstable_requestPaint,jt=q.unstable_now,Ut=q.unstable_getCurrentPriorityLevel,Bt=q.unstable_ImmediatePriority,Vt=q.unstable_UserBlockingPriority,Wt=q.unstable_NormalPriority,Ht=q.unstable_LowPriority,Kt=q.unstable_IdlePriority,qt=null,Gt=null;var Qt=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(Yt(e)/Xt|0)|0},Yt=Math.log,Xt=Math.LN2;var Jt=64,Zt=4194304;function en(e){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: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 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function tn(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,a=e.suspendedLanes,o=e.pingedLanes,i=268435455&n;if(0!==i){var s=i&~a;0!==s?r=en(s):0!==(o&=i)&&(r=en(o))}else 0!==(i=n&~a)?r=en(i):0!==o&&(r=en(o));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&a)&&((a=r&-r)>=(o=t&-t)||16===a&&4194240&o))return t;if(4&r&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)a=1<<(n=31-Qt(t)),r|=e[n],t&=~a;return r}function nn(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 rn(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function an(){var e=Jt;return!(4194240&(Jt<<=1))&&(Jt=64),e}function on(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function sn(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-Qt(t)]=n}function ln(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Qt(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var cn=0;function un(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var dn,fn,hn,pn,mn,gn=!1,yn=[],vn=null,bn=null,wn=null,kn=new Map,Sn=new Map,xn=[],Cn="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 submit".split(" ");function En(e,t){switch(e){case"focusin":case"focusout":vn=null;break;case"dragenter":case"dragleave":bn=null;break;case"mouseover":case"mouseout":wn=null;break;case"pointerover":case"pointerout":kn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sn.delete(t.pointerId)}}function _n(e,t,n,r,a,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},null!==t&&(null!==(t=lo(t))&&fn(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function Mn(e){var t=so(e.target);if(null!==t){var n=Pt(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Nt(n)))return e.blockedOn=t,void mn(e.priority,function(){hn(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 Ln(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=$n(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=lo(n))&&fn(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);ct=r,n.target.dispatchEvent(r),ct=null,t.shift()}return!0}function Rn(e,t,n){Ln(e)&&n.delete(t)}function An(){gn=!1,null!==vn&&Ln(vn)&&(vn=null),null!==bn&&Ln(bn)&&(bn=null),null!==wn&&Ln(wn)&&(wn=null),kn.forEach(Rn),Sn.forEach(Rn)}function Pn(e,t){e.blockedOn===t&&(e.blockedOn=null,gn||(gn=!0,q.unstable_scheduleCallback(q.unstable_NormalPriority,An)))}function Nn(e){function t(t){return Pn(t,e)}if(0<yn.length){Pn(yn[0],e);for(var n=1;n<yn.length;n++){var r=yn[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==vn&&Pn(vn,e),null!==bn&&Pn(bn,e),null!==wn&&Pn(wn,e),kn.forEach(t),Sn.forEach(t),n=0;n<xn.length;n++)(r=xn[n]).blockedOn===e&&(r.blockedOn=null);for(;0<xn.length&&null===(n=xn[0]).blockedOn;)Mn(n),null===n.blockedOn&&xn.shift()}var Dn=ce.ReactCurrentBatchConfig,Tn=!0;function In(e,t,n,r){var a=cn,o=Dn.transition;Dn.transition=null;try{cn=1,Fn(e,t,n,r)}finally{cn=a,Dn.transition=o}}function zn(e,t,n,r){var a=cn,o=Dn.transition;Dn.transition=null;try{cn=4,Fn(e,t,n,r)}finally{cn=a,Dn.transition=o}}function Fn(e,t,n,r){if(Tn){var a=$n(e,t,n,r);if(null===a)Da(e,t,r,On,n),En(e,r);else if(function(e,t,n,r,a){switch(t){case"focusin":return vn=_n(vn,e,t,n,r,a),!0;case"dragenter":return bn=_n(bn,e,t,n,r,a),!0;case"mouseover":return wn=_n(wn,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return kn.set(o,_n(kn.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,Sn.set(o,_n(Sn.get(o)||null,e,t,n,r,a)),!0}return!1}(a,e,t,n,r))r.stopPropagation();else if(En(e,r),4&t&&-1<Cn.indexOf(e)){for(;null!==a;){var o=lo(a);if(null!==o&&dn(o),null===(o=$n(e,t,n,r))&&Da(e,t,r,On,n),o===a)break;a=o}null!==a&&r.stopPropagation()}else Da(e,t,r,null,n)}}var On=null;function $n(e,t,n,r){if(On=null,null!==(e=so(e=ut(r))))if(null===(t=Pt(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=Nt(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 On=e,null}function jn(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Ut()){case Bt:return 1;case Vt:return 4;case Wt:case Ht:return 16;case Kt:return 536870912;default:return 16}default:return 16}}var Un=null,Bn=null,Vn=null;function Wn(){if(Vn)return Vn;var e,t,n=Bn,r=n.length,a="value"in Un?Un.value:Un.textContent,o=a.length;for(e=0;e<r&&n[e]===a[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===a[o-t];t++);return Vn=a.slice(e,1<t?1-t:void 0)}function Hn(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 Kn(){return!0}function qn(){return!1}function Gn(e){function t(t,n,r,a,o){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(a):a[i]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?Kn:qn,this.isPropagationStopped=qn,this}return _e(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=Kn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Kn)},persist:function(){},isPersistent:Kn}),t}var Qn,Yn,Xn,Jn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zn=Gn(Jn),er=_e({},Jn,{view:0,detail:0}),tr=Gn(er),nr=_e({},er,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pr,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!==Xn&&(Xn&&"mousemove"===e.type?(Qn=e.screenX-Xn.screenX,Yn=e.screenY-Xn.screenY):Yn=Qn=0,Xn=e),Qn)},movementY:function(e){return"movementY"in e?e.movementY:Yn}}),rr=Gn(nr),ar=Gn(_e({},nr,{dataTransfer:0})),or=Gn(_e({},er,{relatedTarget:0})),ir=Gn(_e({},Jn,{animationName:0,elapsedTime:0,pseudoElement:0})),sr=_e({},Jn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),lr=Gn(sr),cr=Gn(_e({},Jn,{data:0})),ur={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dr={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"},fr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=fr[e])&&!!t[e]}function pr(){return hr}var mr=_e({},er,{key:function(e){if(e.key){var t=ur[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Hn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?dr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pr,charCode:function(e){return"keypress"===e.type?Hn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Hn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),gr=Gn(mr),yr=Gn(_e({},nr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),vr=Gn(_e({},er,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pr})),br=Gn(_e({},Jn,{propertyName:0,elapsedTime:0,pseudoElement:0})),wr=_e({},nr,{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}),kr=Gn(wr),Sr=[9,13,27,32],xr=Z&&"CompositionEvent"in window,Cr=null;Z&&"documentMode"in document&&(Cr=document.documentMode);var Er=Z&&"TextEvent"in window&&!Cr,_r=Z&&(!xr||Cr&&8<Cr&&11>=Cr),Mr=String.fromCharCode(32),Lr=!1;function Rr(e,t){switch(e){case"keyup":return-1!==Sr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ar(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Pr=!1;var Nr={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 Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Nr[e.type]:"textarea"===t}function Tr(e,t,n,r){mt(r),0<(t=Ia(t,"onChange")).length&&(n=new Zn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ir=null,zr=null;function Fr(e){Ma(e,0)}function Or(e){if(ze(co(e)))return e}function $r(e,t){if("change"===e)return t}var jr=!1;if(Z){var Ur;if(Z){var Br="oninput"in document;if(!Br){var Vr=document.createElement("div");Vr.setAttribute("oninput","return;"),Br="function"==typeof Vr.oninput}Ur=Br}else Ur=!1;jr=Ur&&(!document.documentMode||9<document.documentMode)}function Wr(){Ir&&(Ir.detachEvent("onpropertychange",Hr),zr=Ir=null)}function Hr(e){if("value"===e.propertyName&&Or(zr)){var t=[];Tr(t,zr,e,ut(e)),wt(Fr,t)}}function Kr(e,t,n){"focusin"===e?(Wr(),zr=n,(Ir=t).attachEvent("onpropertychange",Hr)):"focusout"===e&&Wr()}function qr(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Or(zr)}function Gr(e,t){if("click"===e)return Or(t)}function Qr(e,t){if("input"===e||"change"===e)return Or(t)}var Yr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function Xr(e,t){if(Yr(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 a=n[r];if(!ee.call(t,a)||!Yr(e[a],t[a]))return!1}return!0}function Jr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zr(e,t){var n,r=Jr(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=Jr(r)}}function ea(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ea(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function ta(){for(var e=window,t=Fe();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Fe((e=t.contentWindow).document)}return t}function na(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)}function ra(e){var t=ta(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ea(n.ownerDocument.documentElement,n)){if(null!==r&&na(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var a=n.textContent.length,o=Math.min(r.start,a);r=void 0===r.end?o:Math.min(r.end,a),!e.extend&&o>r&&(a=r,r=o,o=a),a=Zr(n,o);var i=Zr(n,r);a&&i&&(1!==e.rangeCount||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&((t=t.createRange()).setStart(a.node,a.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var aa=Z&&"documentMode"in document&&11>=document.documentMode,oa=null,ia=null,sa=null,la=!1;function ca(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;la||null==oa||oa!==Fe(r)||("selectionStart"in(r=oa)&&na(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},sa&&Xr(sa,r)||(sa=r,0<(r=Ia(ia,"onSelect")).length&&(t=new Zn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=oa)))}function ua(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var da={animationend:ua("Animation","AnimationEnd"),animationiteration:ua("Animation","AnimationIteration"),animationstart:ua("Animation","AnimationStart"),transitionend:ua("Transition","TransitionEnd")},fa={},ha={};function pa(e){if(fa[e])return fa[e];if(!da[e])return e;var t,n=da[e];for(t in n)if(n.hasOwnProperty(t)&&t in ha)return fa[e]=n[t];return e}Z&&(ha=document.createElement("div").style,"AnimationEvent"in window||(delete da.animationend.animation,delete da.animationiteration.animation,delete da.animationstart.animation),"TransitionEvent"in window||delete da.transitionend.transition);var ma=pa("animationend"),ga=pa("animationiteration"),ya=pa("animationstart"),va=pa("transitionend"),ba=new Map,wa="abort auxClick 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 ka(e,t){ba.set(e,t),X(t,[e])}for(var Sa=0;Sa<wa.length;Sa++){var xa=wa[Sa];ka(xa.toLowerCase(),"on"+(xa[0].toUpperCase()+xa.slice(1)))}ka(ma,"onAnimationEnd"),ka(ga,"onAnimationIteration"),ka(ya,"onAnimationStart"),ka("dblclick","onDoubleClick"),ka("focusin","onFocus"),ka("focusout","onBlur"),ka(va,"onTransitionEnd"),J("onMouseEnter",["mouseout","mouseover"]),J("onMouseLeave",["mouseout","mouseover"]),J("onPointerEnter",["pointerout","pointerover"]),J("onPointerLeave",["pointerout","pointerover"]),X("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),X("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),X("onBeforeInput",["compositionend","keypress","textInput","paste"]),X("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),X("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ca="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(" "),Ea=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ca));function _a(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,a,o,i,s,l){if(At.apply(this,arguments),Et){if(!Et)throw Error(G(198));var c=_t;Et=!1,_t=null,Mt||(Mt=!0,Lt=c)}}(r,t,void 0,e),e.currentTarget=null}function Ma(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var s=r[i],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==o&&a.isPropagationStopped())break e;_a(a,s,c),o=l}else for(i=0;i<r.length;i++){if(l=(s=r[i]).instance,c=s.currentTarget,s=s.listener,l!==o&&a.isPropagationStopped())break e;_a(a,s,c),o=l}}}if(Mt)throw e=Lt,Mt=!1,Lt=null,e}function La(e,t){var n=t[ao];void 0===n&&(n=t[ao]=new Set);var r=e+"__bubble";n.has(r)||(Na(t,e,2,!1),n.add(r))}function Ra(e,t,n){var r=0;t&&(r|=4),Na(n,e,r,t)}var Aa="_reactListening"+Math.random().toString(36).slice(2);function Pa(e){if(!e[Aa]){e[Aa]=!0,Q.forEach(function(t){"selectionchange"!==t&&(Ea.has(t)||Ra(t,!1,e),Ra(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Aa]||(t[Aa]=!0,Ra("selectionchange",!1,t))}}function Na(e,t,n,r){switch(jn(t)){case 1:var a=In;break;case 4:a=zn;break;default:a=Fn}n=a.bind(null,t,n,e),a=void 0,!St||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Da(e,t,n,r,a){var o=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var s=r.stateNode.containerInfo;if(s===a||8===s.nodeType&&s.parentNode===a)break;if(4===i)for(i=r.return;null!==i;){var l=i.tag;if((3===l||4===l)&&((l=i.stateNode.containerInfo)===a||8===l.nodeType&&l.parentNode===a))return;i=i.return}for(;null!==s;){if(null===(i=so(s)))return;if(5===(l=i.tag)||6===l){r=o=i;continue e}s=s.parentNode}}r=r.return}wt(function(){var r=o,a=ut(n),i=[];e:{var s=ba.get(e);if(void 0!==s){var l=Zn,c=e;switch(e){case"keypress":if(0===Hn(n))break e;case"keydown":case"keyup":l=gr;break;case"focusin":c="focus",l=or;break;case"focusout":c="blur",l=or;break;case"beforeblur":case"afterblur":l=or;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=rr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=ar;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=vr;break;case ma:case ga:case ya:l=ir;break;case va:l=br;break;case"scroll":l=tr;break;case"wheel":l=kr;break;case"copy":case"cut":case"paste":l=lr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=yr}var u=!!(4&t),d=!u&&"scroll"===e,f=u?null!==s?s+"Capture":null:s;u=[];for(var h,p=r;null!==p;){var m=(h=p).stateNode;if(5===h.tag&&null!==m&&(h=m,null!==f&&(null!=(m=kt(p,f))&&u.push(Ta(p,m,h)))),d)break;p=p.return}0<u.length&&(s=new l(s,c,null,n,a),i.push({event:s,listeners:u}))}}if(!(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===ct||!(c=n.relatedTarget||n.fromElement)||!so(c)&&!c[ro])&&(l||s)&&(s=a.window===a?a:(s=a.ownerDocument)?s.defaultView||s.parentWindow:window,l?(l=r,null!==(c=(c=n.relatedTarget||n.toElement)?so(c):null)&&(c!==(d=Pt(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=r),l!==c)){if(u=rr,m="onMouseLeave",f="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=yr,m="onPointerLeave",f="onPointerEnter",p="pointer"),d=null==l?s:co(l),h=null==c?s:co(c),(s=new u(m,p+"leave",l,n,a)).target=d,s.relatedTarget=h,m=null,so(a)===r&&((u=new u(f,p+"enter",c,n,a)).target=h,u.relatedTarget=d,m=u),d=m,l&&c)e:{for(f=c,p=0,h=u=l;h;h=za(h))p++;for(h=0,m=f;m;m=za(m))h++;for(;0<p-h;)u=za(u),p--;for(;0<h-p;)f=za(f),h--;for(;p--;){if(u===f||null!==f&&u===f.alternate)break e;u=za(u),f=za(f)}u=null}else u=null;null!==l&&Fa(i,s,l,u,!1),null!==c&&null!==d&&Fa(i,d,c,u,!0)}if("select"===(l=(s=r?co(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===l&&"file"===s.type)var g=$r;else if(Dr(s))if(jr)g=Qr;else{g=qr;var y=Kr}else(l=s.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===s.type||"radio"===s.type)&&(g=Gr);switch(g&&(g=g(e,r))?Tr(i,g,n,a):(y&&y(e,s,r),"focusout"===e&&(y=s._wrapperState)&&y.controlled&&"number"===s.type&&Ve(s,"number",s.value)),y=r?co(r):window,e){case"focusin":(Dr(y)||"true"===y.contentEditable)&&(oa=y,ia=r,sa=null);break;case"focusout":sa=ia=oa=null;break;case"mousedown":la=!0;break;case"contextmenu":case"mouseup":case"dragend":la=!1,ca(i,n,a);break;case"selectionchange":if(aa)break;case"keydown":case"keyup":ca(i,n,a)}var v;if(xr)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Pr?Rr(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(_r&&"ko"!==n.locale&&(Pr||"onCompositionStart"!==b?"onCompositionEnd"===b&&Pr&&(v=Wn()):(Bn="value"in(Un=a)?Un.value:Un.textContent,Pr=!0)),0<(y=Ia(r,b)).length&&(b=new cr(b,e,null,n,a),i.push({event:b,listeners:y}),v?b.data=v:null!==(v=Ar(n))&&(b.data=v))),(v=Er?function(e,t){switch(e){case"compositionend":return Ar(t);case"keypress":return 32!==t.which?null:(Lr=!0,Mr);case"textInput":return(e=t.data)===Mr&&Lr?null:e;default:return null}}(e,n):function(e,t){if(Pr)return"compositionend"===e||!xr&&Rr(e,t)?(e=Wn(),Vn=Bn=Un=null,Pr=!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 _r&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=Ia(r,"onBeforeInput")).length&&(a=new cr("onBeforeInput","beforeinput",null,n,a),i.push({event:a,listeners:r}),a.data=v))}Ma(i,t)})}function Ta(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ia(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,o=a.stateNode;5===a.tag&&null!==o&&(a=o,null!=(o=kt(e,n))&&r.unshift(Ta(e,o,a)),null!=(o=kt(e,t))&&r.push(Ta(e,o,a))),e=e.return}return r}function za(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Fa(e,t,n,r,a){for(var o=t._reactName,i=[];null!==n&&n!==r;){var s=n,l=s.alternate,c=s.stateNode;if(null!==l&&l===r)break;5===s.tag&&null!==c&&(s=c,a?null!=(l=kt(n,o))&&i.unshift(Ta(n,l,s)):a||null!=(l=kt(n,o))&&i.push(Ta(n,l,s))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}var Oa=/\r\n?/g,$a=/\u0000|\uFFFD/g;function ja(e){return("string"==typeof e?e:""+e).replace(Oa,"\n").replace($a,"")}function Ua(e,t,n){if(t=ja(t),ja(e)!==t&&n)throw Error(G(425))}function Ba(){}var Va=null,Wa=null;function Ha(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Ka="function"==typeof setTimeout?setTimeout:void 0,qa="function"==typeof clearTimeout?clearTimeout:void 0,Ga="function"==typeof Promise?Promise:void 0,Qa="function"==typeof queueMicrotask?queueMicrotask:void 0!==Ga?function(e){return Ga.resolve(null).then(e).catch(Ya)}:Ka;function Ya(e){setTimeout(function(){throw e})}function Xa(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&8===a.nodeType)if("/$"===(n=a.data)){if(0===r)return e.removeChild(a),void Nn(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=a}while(n);Nn(t)}function Ja(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)break;if("/$"===t)return null}}return e}function Za(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var eo=Math.random().toString(36).slice(2),to="__reactFiber$"+eo,no="__reactProps$"+eo,ro="__reactContainer$"+eo,ao="__reactEvents$"+eo,oo="__reactListeners$"+eo,io="__reactHandles$"+eo;function so(e){var t=e[to];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ro]||n[to]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Za(e);null!==e;){if(n=e[to])return n;e=Za(e)}return t}n=(e=n).parentNode}return null}function lo(e){return!(e=e[to]||e[ro])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function co(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(G(33))}function uo(e){return e[no]||null}var fo=[],ho=-1;function po(e){return{current:e}}function mo(e){0>ho||(e.current=fo[ho],fo[ho]=null,ho--)}function go(e,t){ho++,fo[ho]=e.current,e.current=t}var yo={},vo=po(yo),bo=po(!1),wo=yo;function ko(e,t){var n=e.type.contextTypes;if(!n)return yo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a,o={};for(a in n)o[a]=t[a];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function So(e){return null!=(e=e.childContextTypes)}function xo(){mo(bo),mo(vo)}function Co(e,t,n){if(vo.current!==yo)throw Error(G(168));go(vo,t),go(bo,n)}function Eo(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in t))throw Error(G(108,Ne(e)||"Unknown",a));return _e({},n,r)}function _o(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||yo,wo=vo.current,go(vo,e),go(bo,bo.current),!0}function Mo(e,t,n){var r=e.stateNode;if(!r)throw Error(G(169));n?(e=Eo(e,t,wo),r.__reactInternalMemoizedMergedChildContext=e,mo(bo),mo(vo),go(vo,e)):mo(bo),go(bo,n)}var Lo=null,Ro=!1,Ao=!1;function Po(e){null===Lo?Lo=[e]:Lo.push(e)}function No(){if(!Ao&&null!==Lo){Ao=!0;var e=0,t=cn;try{var n=Lo;for(cn=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Lo=null,Ro=!1}catch(t){throw null!==Lo&&(Lo=Lo.slice(e+1)),zt(Bt,No),t}finally{cn=t,Ao=!1}}return null}var Do=[],To=0,Io=null,zo=0,Fo=[],Oo=0,$o=null,jo=1,Uo="";function Bo(e,t){Do[To++]=zo,Do[To++]=Io,Io=e,zo=t}function Vo(e,t,n){Fo[Oo++]=jo,Fo[Oo++]=Uo,Fo[Oo++]=$o,$o=e;var r=jo;e=Uo;var a=32-Qt(r)-1;r&=~(1<<a),n+=1;var o=32-Qt(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,jo=1<<32-Qt(t)+a|n<<a|r,Uo=o+e}else jo=1<<o|n<<a|r,Uo=e}function Wo(e){null!==e.return&&(Bo(e,1),Vo(e,1,0))}function Ho(e){for(;e===Io;)Io=Do[--To],Do[To]=null,zo=Do[--To],Do[To]=null;for(;e===$o;)$o=Fo[--Oo],Fo[Oo]=null,Uo=Fo[--Oo],Fo[Oo]=null,jo=Fo[--Oo],Fo[Oo]=null}var Ko=null,qo=null,Go=!1,Qo=null;function Yo(e,t){var n=wu(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function Xo(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,Ko=e,qo=Ja(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,Ko=e,qo=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==$o?{id:jo,overflow:Uo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=wu(18,null,null,0)).stateNode=t,n.return=e,e.child=n,Ko=e,qo=null,!0);default:return!1}}function Jo(e){return!(!(1&e.mode)||128&e.flags)}function Zo(e){if(Go){var t=qo;if(t){var n=t;if(!Xo(e,t)){if(Jo(e))throw Error(G(418));t=Ja(n.nextSibling);var r=Ko;t&&Xo(e,t)?Yo(r,n):(e.flags=-4097&e.flags|2,Go=!1,Ko=e)}}else{if(Jo(e))throw Error(G(418));e.flags=-4097&e.flags|2,Go=!1,Ko=e}}}function ei(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Ko=e}function ti(e){if(e!==Ko)return!1;if(!Go)return ei(e),Go=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!Ha(e.type,e.memoizedProps)),t&&(t=qo)){if(Jo(e))throw ni(),Error(G(418));for(;t;)Yo(e,t),t=Ja(t.nextSibling)}if(ei(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(G(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){qo=Ja(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}qo=null}}else qo=Ko?Ja(e.stateNode.nextSibling):null;return!0}function ni(){for(var e=qo;e;)e=Ja(e.nextSibling)}function ri(){qo=Ko=null,Go=!1}function ai(e){null===Qo?Qo=[e]:Qo.push(e)}var oi=ce.ReactCurrentBatchConfig;function ii(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(G(309));var r=n.stateNode}if(!r)throw Error(G(147,e));var a=r,o=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;null===e?delete t[o]:t[o]=e},t._stringRef=o,t)}if("string"!=typeof e)throw Error(G(284));if(!n._owner)throw Error(G(290,e))}return e}function si(e,t){throw e=Object.prototype.toString.call(t),Error(G(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function li(e){return(0,e._init)(e._payload)}function ci(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,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function a(e,t){return(e=Su(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|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function i(t){return e&&null===t.alternate&&(t.flags|=2),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=_u(n,e.mode,r)).return=e,t):((t=a(t,n)).return=e,t)}function l(e,t,n,r){var o=n.type;return o===fe?u(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===ke&&li(o)===t.type)?((r=a(t,n.props)).ref=ii(e,t,n),r.return=e,r):((r=xu(n.type,n.key,n.props,null,e.mode,r)).ref=ii(e,t,n),r.return=e,r)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Mu(n,e.mode,r)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function u(e,t,n,r,o){return null===t||7!==t.tag?((t=Cu(n,e.mode,r,o)).return=e,t):((t=a(t,n)).return=e,t)}function d(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=_u(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case ue:return(n=xu(t.type,t.key,t.props,null,e.mode,n)).ref=ii(e,null,t),n.return=e,n;case de:return(t=Mu(t,e.mode,n)).return=e,t;case ke:return d(e,(0,t._init)(t._payload),n)}if(We(t)||Ce(t))return(t=Cu(t,e.mode,n,null)).return=e,t;si(e,t)}return null}function f(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==a?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case ue:return n.key===a?l(e,t,n,r):null;case de:return n.key===a?c(e,t,n,r):null;case ke:return f(e,t,(a=n._init)(n._payload),r)}if(We(n)||Ce(n))return null!==a?null:u(e,t,n,r,null);si(e,n)}return null}function h(e,t,n,r,a){if("string"==typeof r&&""!==r||"number"==typeof r)return s(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case ue:return l(t,e=e.get(null===r.key?n:r.key)||null,r,a);case de:return c(t,e=e.get(null===r.key?n:r.key)||null,r,a);case ke:return h(e,t,n,(0,r._init)(r._payload),a)}if(We(r)||Ce(r))return u(t,e=e.get(n)||null,r,a,null);si(t,r)}return null}function p(a,i,s,l){for(var c=null,u=null,p=i,m=i=0,g=null;null!==p&&m<s.length;m++){p.index>m?(g=p,p=null):g=p.sibling;var y=f(a,p,s[m],l);if(null===y){null===p&&(p=g);break}e&&p&&null===y.alternate&&t(a,p),i=o(y,i,m),null===u?c=y:u.sibling=y,u=y,p=g}if(m===s.length)return n(a,p),Go&&Bo(a,m),c;if(null===p){for(;m<s.length;m++)null!==(p=d(a,s[m],l))&&(i=o(p,i,m),null===u?c=p:u.sibling=p,u=p);return Go&&Bo(a,m),c}for(p=r(a,p);m<s.length;m++)null!==(g=h(p,a,m,s[m],l))&&(e&&null!==g.alternate&&p.delete(null===g.key?m:g.key),i=o(g,i,m),null===u?c=g:u.sibling=g,u=g);return e&&p.forEach(function(e){return t(a,e)}),Go&&Bo(a,m),c}function m(a,i,s,l){var c=Ce(s);if("function"!=typeof c)throw Error(G(150));if(null==(s=c.call(s)))throw Error(G(151));for(var u=c=null,p=i,m=i=0,g=null,y=s.next();null!==p&&!y.done;m++,y=s.next()){p.index>m?(g=p,p=null):g=p.sibling;var v=f(a,p,y.value,l);if(null===v){null===p&&(p=g);break}e&&p&&null===v.alternate&&t(a,p),i=o(v,i,m),null===u?c=v:u.sibling=v,u=v,p=g}if(y.done)return n(a,p),Go&&Bo(a,m),c;if(null===p){for(;!y.done;m++,y=s.next())null!==(y=d(a,y.value,l))&&(i=o(y,i,m),null===u?c=y:u.sibling=y,u=y);return Go&&Bo(a,m),c}for(p=r(a,p);!y.done;m++,y=s.next())null!==(y=h(p,a,m,y.value,l))&&(e&&null!==y.alternate&&p.delete(null===y.key?m:y.key),i=o(y,i,m),null===u?c=y:u.sibling=y,u=y);return e&&p.forEach(function(e){return t(a,e)}),Go&&Bo(a,m),c}return function e(r,o,s,l){if("object"==typeof s&&null!==s&&s.type===fe&&null===s.key&&(s=s.props.children),"object"==typeof s&&null!==s){switch(s.$$typeof){case ue:e:{for(var c=s.key,u=o;null!==u;){if(u.key===c){if((c=s.type)===fe){if(7===u.tag){n(r,u.sibling),(o=a(u,s.props.children)).return=r,r=o;break e}}else if(u.elementType===c||"object"==typeof c&&null!==c&&c.$$typeof===ke&&li(c)===u.type){n(r,u.sibling),(o=a(u,s.props)).ref=ii(r,u,s),o.return=r,r=o;break e}n(r,u);break}t(r,u),u=u.sibling}s.type===fe?((o=Cu(s.props.children,r.mode,l,s.key)).return=r,r=o):((l=xu(s.type,s.key,s.props,null,r.mode,l)).ref=ii(r,o,s),l.return=r,r=l)}return i(r);case de:e:{for(u=s.key;null!==o;){if(o.key===u){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){n(r,o.sibling),(o=a(o,s.children||[])).return=r,r=o;break e}n(r,o);break}t(r,o),o=o.sibling}(o=Mu(s,r.mode,l)).return=r,r=o}return i(r);case ke:return e(r,o,(u=s._init)(s._payload),l)}if(We(s))return p(r,o,s,l);if(Ce(s))return m(r,o,s,l);si(r,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==o&&6===o.tag?(n(r,o.sibling),(o=a(o,s)).return=r,r=o):(n(r,o),(o=_u(s,r.mode,l)).return=r,r=o),i(r)):n(r,o)}}var ui=ci(!0),di=ci(!1),fi=po(null),hi=null,pi=null,mi=null;function gi(){mi=pi=hi=null}function yi(e){var t=fi.current;mo(fi),e._currentValue=t}function vi(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 bi(e,t){hi=e,mi=pi=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(ll=!0),e.firstContext=null)}function wi(e){var t=e._currentValue;if(mi!==e)if(e={context:e,memoizedValue:t,next:null},null===pi){if(null===hi)throw Error(G(308));pi=e,hi.dependencies={lanes:0,firstContext:e}}else pi=pi.next=e;return t}var ki=null;function Si(e){null===ki?ki=[e]:ki.push(e)}function xi(e,t,n,r){var a=t.interleaved;return null===a?(n.next=n,Si(t)):(n.next=a.next,a.next=n),t.interleaved=n,Ci(e,r)}function Ci(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var Ei=!1;function _i(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mi(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Li(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ri(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&yc){var a=r.pending;return null===a?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Ci(e,n)}return null===(a=r.interleaved)?(t.next=t,Si(r)):(t.next=a.next,a.next=t),r.interleaved=t,Ci(e,n)}function Ai(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,ln(e,n)}}function Pi(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?a=o=i:o=o.next=i,n=n.next}while(null!==n);null===o?a=o=t:o=o.next=t}else a=o=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ni(e,t,n,r){var a=e.updateQueue;Ei=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,s=a.shared.pending;if(null!==s){a.shared.pending=null;var l=s,c=l.next;l.next=null,null===i?o=c:i.next=c,i=l;var u=e.alternate;null!==u&&((s=(u=u.updateQueue).lastBaseUpdate)!==i&&(null===s?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(null!==o){var d=a.baseState;for(i=0,u=c=l=null,s=o;;){var f=s.lane,h=s.eventTime;if((r&f)===f){null!==u&&(u=u.next={eventTime:h,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var p=e,m=s;switch(f=t,h=n,m.tag){case 1:if("function"==typeof(p=m.payload)){d=p.call(h,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(h,d,f):p))break e;d=_e({},d,f);break e;case 2:Ei=!0}}null!==s.callback&&0!==s.lane&&(e.flags|=64,null===(f=a.effects)?a.effects=[s]:f.push(s))}else h={eventTime: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,i|=f;if(null===(s=s.next)){if(null===(s=a.shared.pending))break;s=(f=s).next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}if(null===u&&(l=d),a.baseState=l,a.firstBaseUpdate=c,a.lastBaseUpdate=u,null!==(t=a.shared.interleaved)){a=t;do{i|=a.lane,a=a.next}while(a!==t)}else null===o&&(a.shared.lanes=0);Ec|=i,e.lanes=i,e.memoizedState=d}}function Di(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(null!==a){if(r.callback=null,r=n,"function"!=typeof a)throw Error(G(191,a));a.call(r)}}}var Ti={},Ii=po(Ti),zi=po(Ti),Fi=po(Ti);function Oi(e){if(e===Ti)throw Error(G(174));return e}function $i(e,t){switch(go(Fi,t),go(zi,e),go(Ii,Ti),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Xe(null,"");break;default:t=Xe(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}mo(Ii),go(Ii,t)}function ji(){mo(Ii),mo(zi),mo(Fi)}function Ui(e){Oi(Fi.current);var t=Oi(Ii.current),n=Xe(t,e.type);t!==n&&(go(zi,e),go(Ii,n))}function Bi(e){zi.current===e&&(mo(Ii),mo(zi))}var Vi=po(0);function Wi(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}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 Hi=[];function Ki(){for(var e=0;e<Hi.length;e++)Hi[e]._workInProgressVersionPrimary=null;Hi.length=0}var qi=ce.ReactCurrentDispatcher,Gi=ce.ReactCurrentBatchConfig,Qi=0,Yi=null,Xi=null,Ji=null,Zi=!1,es=!1,ts=0,ns=0;function rs(){throw Error(G(321))}function as(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Yr(e[n],t[n]))return!1;return!0}function os(e,t,n,r,a,o){if(Qi=o,Yi=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,qi.current=null===e||null===e.memoizedState?Bs:Vs,e=n(r,a),es){o=0;do{if(es=!1,ts=0,25<=o)throw Error(G(301));o+=1,Ji=Xi=null,t.updateQueue=null,qi.current=Ws,e=n(r,a)}while(es)}if(qi.current=Us,t=null!==Xi&&null!==Xi.next,Qi=0,Ji=Xi=Yi=null,Zi=!1,t)throw Error(G(300));return e}function is(){var e=0!==ts;return ts=0,e}function ss(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Ji?Yi.memoizedState=Ji=e:Ji=Ji.next=e,Ji}function ls(){if(null===Xi){var e=Yi.alternate;e=null!==e?e.memoizedState:null}else e=Xi.next;var t=null===Ji?Yi.memoizedState:Ji.next;if(null!==t)Ji=t,Xi=e;else{if(null===e)throw Error(G(310));e={memoizedState:(Xi=e).memoizedState,baseState:Xi.baseState,baseQueue:Xi.baseQueue,queue:Xi.queue,next:null},null===Ji?Yi.memoizedState=Ji=e:Ji=Ji.next=e}return Ji}function cs(e,t){return"function"==typeof t?t(e):t}function us(e){var t=ls(),n=t.queue;if(null===n)throw Error(G(311));n.lastRenderedReducer=e;var r=Xi,a=r.baseQueue,o=n.pending;if(null!==o){if(null!==a){var i=a.next;a.next=o.next,o.next=i}r.baseQueue=a=o,n.pending=null}if(null!==a){o=a.next,r=r.baseState;var s=i=null,l=null,c=o;do{var u=c.lane;if((Qi&u)===u)null!==l&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};null===l?(s=l=d,i=r):l=l.next=d,Yi.lanes|=u,Ec|=u}c=c.next}while(null!==c&&c!==o);null===l?i=r:l.next=s,Yr(r,t.memoizedState)||(ll=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=l,n.lastRenderedState=r}if(null!==(e=n.interleaved)){a=e;do{o=a.lane,Yi.lanes|=o,Ec|=o,a=a.next}while(a!==e)}else null===a&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function ds(e){var t=ls(),n=t.queue;if(null===n)throw Error(G(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(null!==a){n.pending=null;var i=a=a.next;do{o=e(o,i.action),i=i.next}while(i!==a);Yr(o,t.memoizedState)||(ll=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function fs(){}function hs(e,t){var n=Yi,r=ls(),a=t(),o=!Yr(r.memoizedState,a);if(o&&(r.memoizedState=a,ll=!0),r=r.queue,Es(gs.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||null!==Ji&&1&Ji.memoizedState.tag){if(n.flags|=2048,ws(9,ms.bind(null,n,r,a,t),void 0,null),null===vc)throw Error(G(349));30&Qi||ps(n,t,a)}return a}function ps(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Yi.updateQueue)?(t={lastEffect:null,stores:null},Yi.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function ms(e,t,n,r){t.value=n,t.getSnapshot=r,ys(t)&&vs(e)}function gs(e,t,n){return n(function(){ys(t)&&vs(e)})}function ys(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Yr(e,n)}catch(e){return!0}}function vs(e){var t=Ci(e,1);null!==t&&Hc(t,e,1,-1)}function bs(e){var t=ss();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:cs,lastRenderedState:e},t.queue=e,e=e.dispatch=Fs.bind(null,Yi,e),[t.memoizedState,e]}function ws(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Yi.updateQueue)?(t={lastEffect:null,stores:null},Yi.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ks(){return ls().memoizedState}function Ss(e,t,n,r){var a=ss();Yi.flags|=e,a.memoizedState=ws(1|t,n,void 0,void 0===r?null:r)}function xs(e,t,n,r){var a=ls();r=void 0===r?null:r;var o=void 0;if(null!==Xi){var i=Xi.memoizedState;if(o=i.destroy,null!==r&&as(r,i.deps))return void(a.memoizedState=ws(t,n,o,r))}Yi.flags|=e,a.memoizedState=ws(1|t,n,o,r)}function Cs(e,t){return Ss(8390656,8,e,t)}function Es(e,t){return xs(2048,8,e,t)}function _s(e,t){return xs(4,2,e,t)}function Ms(e,t){return xs(4,4,e,t)}function Ls(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Rs(e,t,n){return n=null!=n?n.concat([e]):null,xs(4,4,Ls.bind(null,t,e),n)}function As(){}function Ps(e,t){var n=ls();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&as(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ns(e,t){var n=ls();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&as(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ds(e,t,n){return 21&Qi?(Yr(n,t)||(n=an(),Yi.lanes|=n,Ec|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ll=!0),e.memoizedState=n)}function Ts(e,t){var n=cn;cn=0!==n&&4>n?n:4,e(!0);var r=Gi.transition;Gi.transition={};try{e(!1),t()}finally{cn=n,Gi.transition=r}}function Is(){return ls().memoizedState}function zs(e,t,n){var r=Wc(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Os(e))$s(t,n);else if(null!==(n=xi(e,t,n,r))){Hc(n,e,r,Vc()),js(n,t,r)}}function Fs(e,t,n){var r=Wc(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Os(e))$s(t,a);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var i=t.lastRenderedState,s=o(i,n);if(a.hasEagerState=!0,a.eagerState=s,Yr(s,i)){var l=t.interleaved;return null===l?(a.next=a,Si(t)):(a.next=l.next,l.next=a),void(t.interleaved=a)}}catch(e){}null!==(n=xi(e,t,a,r))&&(Hc(n,e,r,a=Vc()),js(n,t,r))}}function Os(e){var t=e.alternate;return e===Yi||null!==t&&t===Yi}function $s(e,t){es=Zi=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function js(e,t,n){if(4194240&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,ln(e,n)}}var Us={readContext:wi,useCallback:rs,useContext:rs,useEffect:rs,useImperativeHandle:rs,useInsertionEffect:rs,useLayoutEffect:rs,useMemo:rs,useReducer:rs,useRef:rs,useState:rs,useDebugValue:rs,useDeferredValue:rs,useTransition:rs,useMutableSource:rs,useSyncExternalStore:rs,useId:rs,unstable_isNewReconciler:!1},Bs={readContext:wi,useCallback:function(e,t){return ss().memoizedState=[e,void 0===t?null:t],e},useContext:wi,useEffect:Cs,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Ss(4194308,4,Ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ss(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ss(4,2,e,t)},useMemo:function(e,t){var n=ss();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ss();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=zs.bind(null,Yi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},ss().memoizedState=e},useState:bs,useDebugValue:As,useDeferredValue:function(e){return ss().memoizedState=e},useTransition:function(){var e=bs(!1),t=e[0];return e=Ts.bind(null,e[1]),ss().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Yi,a=ss();if(Go){if(void 0===n)throw Error(G(407));n=n()}else{if(n=t(),null===vc)throw Error(G(349));30&Qi||ps(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Cs(gs.bind(null,r,o,e),[e]),r.flags|=2048,ws(9,ms.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ss(),t=vc.identifierPrefix;if(Go){var n=Uo;t=":"+t+"R"+(n=(jo&~(1<<32-Qt(jo)-1)).toString(32)+n),0<(n=ts++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=ns++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Vs={readContext:wi,useCallback:Ps,useContext:wi,useEffect:Es,useImperativeHandle:Rs,useInsertionEffect:_s,useLayoutEffect:Ms,useMemo:Ns,useReducer:us,useRef:ks,useState:function(){return us(cs)},useDebugValue:As,useDeferredValue:function(e){return Ds(ls(),Xi.memoizedState,e)},useTransition:function(){return[us(cs)[0],ls().memoizedState]},useMutableSource:fs,useSyncExternalStore:hs,useId:Is,unstable_isNewReconciler:!1},Ws={readContext:wi,useCallback:Ps,useContext:wi,useEffect:Es,useImperativeHandle:Rs,useInsertionEffect:_s,useLayoutEffect:Ms,useMemo:Ns,useReducer:ds,useRef:ks,useState:function(){return ds(cs)},useDebugValue:As,useDeferredValue:function(e){var t=ls();return null===Xi?t.memoizedState=e:Ds(t,Xi.memoizedState,e)},useTransition:function(){return[ds(cs)[0],ls().memoizedState]},useMutableSource:fs,useSyncExternalStore:hs,useId:Is,unstable_isNewReconciler:!1};function Hs(e,t){if(e&&e.defaultProps){for(var n in t=_e({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function Ks(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:_e({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var qs={isMounted:function(e){return!!(e=e._reactInternals)&&Pt(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Vc(),a=Wc(e),o=Li(r,a);o.payload=t,null!=n&&(o.callback=n),null!==(t=Ri(e,o,a))&&(Hc(t,e,a,r),Ai(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Vc(),a=Wc(e),o=Li(r,a);o.tag=1,o.payload=t,null!=n&&(o.callback=n),null!==(t=Ri(e,o,a))&&(Hc(t,e,a,r),Ai(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Vc(),r=Wc(e),a=Li(n,r);a.tag=2,null!=t&&(a.callback=t),null!==(t=Ri(e,a,r))&&(Hc(t,e,r,n),Ai(t,e,r))}};function Gs(e,t,n,r,a,o,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,i):!t.prototype||!t.prototype.isPureReactComponent||(!Xr(n,r)||!Xr(a,o))}function Qs(e,t,n){var r=!1,a=yo,o=t.contextType;return"object"==typeof o&&null!==o?o=wi(o):(a=So(t)?wo:vo.current,o=(r=null!=(r=t.contextTypes))?ko(e,a):yo),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=qs,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function Ys(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&&qs.enqueueReplaceState(t,t.state,null)}function Xs(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},_i(e);var o=t.contextType;"object"==typeof o&&null!==o?a.context=wi(o):(o=So(t)?wo:vo.current,a.context=ko(e,o)),a.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(Ks(e,t,o,n),a.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(t=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),t!==a.state&&qs.enqueueReplaceState(a,a.state,null),Ni(e,n,a,r),a.state=e.memoizedState),"function"==typeof a.componentDidMount&&(e.flags|=4194308)}function Js(e,t){try{var n="",r=t;do{n+=Ae(r),r=r.return}while(r);var a=n}catch(e){a="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:a,digest:null}}function Zs(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function el(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var tl="function"==typeof WeakMap?WeakMap:Map;function nl(e,t,n){(n=Li(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Dc||(Dc=!0,Tc=r),el(0,t)},n}function rl(e,t,n){(n=Li(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){el(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){el(0,t),"function"!=typeof r&&(null===Ic?Ic=new Set([this]):Ic.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function al(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new tl;var a=new Set;r.set(t,a)}else void 0===(a=r.get(t))&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=pu.bind(null,e,t,n),t.then(e,e))}function ol(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function il(e,t,n,r,a){return 1&e.mode?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Li(-1,1)).tag=2,Ri(n,t,1))),n.lanes|=1),e)}var sl=ce.ReactCurrentOwner,ll=!1;function cl(e,t,n,r){t.child=null===e?di(t,null,n,r):ui(t,e.child,n,r)}function ul(e,t,n,r,a){n=n.render;var o=t.ref;return bi(t,a),r=os(e,t,n,r,o,a),n=is(),null===e||ll?(Go&&n&&Wo(t),t.flags|=1,cl(e,t,r,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Dl(e,t,a))}function dl(e,t,n,r,a){if(null===e){var o=n.type;return"function"!=typeof o||ku(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=xu(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,fl(e,t,o,r,a))}if(o=e.child,0===(e.lanes&a)){var i=o.memoizedProps;if((n=null!==(n=n.compare)?n:Xr)(i,r)&&e.ref===t.ref)return Dl(e,t,a)}return t.flags|=1,(e=Su(o,r)).ref=t.ref,e.return=t,t.child=e}function fl(e,t,n,r,a){if(null!==e){var o=e.memoizedProps;if(Xr(o,r)&&e.ref===t.ref){if(ll=!1,t.pendingProps=r=o,0===(e.lanes&a))return t.lanes=e.lanes,Dl(e,t,a);131072&e.flags&&(ll=!0)}}return ml(e,t,n,r,a)}function hl(e,t,n){var r=t.pendingProps,a=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,go(Sc,kc),kc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,go(Sc,kc),kc|=r}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},go(Sc,kc),kc|=n;else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,go(Sc,kc),kc|=r;return cl(e,t,a,n),t.child}function pl(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ml(e,t,n,r,a){var o=So(n)?wo:vo.current;return o=ko(t,o),bi(t,a),n=os(e,t,n,r,o,a),r=is(),null===e||ll?(Go&&r&&Wo(t),t.flags|=1,cl(e,t,n,a),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Dl(e,t,a))}function gl(e,t,n,r,a){if(So(n)){var o=!0;_o(t)}else o=!1;if(bi(t,a),null===t.stateNode)Nl(e,t),Qs(t,n,r),Xs(t,n,r,a),r=!0;else if(null===e){var i=t.stateNode,s=t.memoizedProps;i.props=s;var l=i.context,c=n.contextType;"object"==typeof c&&null!==c?c=wi(c):c=ko(t,c=So(n)?wo:vo.current);var u=n.getDerivedStateFromProps,d="function"==typeof u||"function"==typeof i.getSnapshotBeforeUpdate;d||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==r||l!==c)&&Ys(t,i,r,c),Ei=!1;var f=t.memoizedState;i.state=f,Ni(t,r,i,a),l=t.memoizedState,s!==r||f!==l||bo.current||Ei?("function"==typeof u&&(Ks(t,n,u,r),l=t.memoizedState),(s=Ei||Gs(t,n,s,r,f,l,c))?(d||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),i.props=r,i.state=l,i.context=c,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Mi(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:Hs(t.type,s),i.props=c,d=t.pendingProps,f=i.context,"object"==typeof(l=n.contextType)&&null!==l?l=wi(l):l=ko(t,l=So(n)?wo:vo.current);var h=n.getDerivedStateFromProps;(u="function"==typeof h||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==d||f!==l)&&Ys(t,i,r,l),Ei=!1,f=t.memoizedState,i.state=f,Ni(t,r,i,a);var p=t.memoizedState;s!==d||f!==p||bo.current||Ei?("function"==typeof h&&(Ks(t,n,h,r),p=t.memoizedState),(c=Ei||Gs(t,n,c,r,f,p,l)||!1)?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,p,l),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=l,r=c):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return yl(e,t,n,r,o,a)}function yl(e,t,n,r,a,o){pl(e,t);var i=!!(128&t.flags);if(!r&&!i)return a&&Mo(t,n,!1),Dl(e,t,o);r=t.stateNode,sl.current=t;var s=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=ui(t,e.child,null,o),t.child=ui(t,null,s,o)):cl(e,t,s,o),t.memoizedState=r.state,a&&Mo(t,n,!0),t.child}function vl(e){var t=e.stateNode;t.pendingContext?Co(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Co(0,t.context,!1),$i(e,t.containerInfo)}function bl(e,t,n,r,a){return ri(),ai(a),t.flags|=256,cl(e,t,n,r),t.child}var wl,kl,Sl,xl,Cl={dehydrated:null,treeContext:null,retryLane:0};function El(e){return{baseLanes:e,cachePool:null,transitions:null}}function _l(e,t,n){var r,a=t.pendingProps,o=Vi.current,i=!1,s=!!(128&t.flags);if((r=s)||(r=(null===e||null!==e.memoizedState)&&!!(2&o)),r?(i=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(o|=1),go(Vi,1&o),null===e)return Zo(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=a.children,e=a.fallback,i?(a=t.mode,i=t.child,s={mode:"hidden",children:s},1&a||null===i?i=Eu(s,a,0,null):(i.childLanes=0,i.pendingProps=s),e=Cu(e,a,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=El(n),t.memoizedState=Cl,e):Ml(t,s));if(null!==(o=e.memoizedState)&&null!==(r=o.dehydrated))return function(e,t,n,r,a,o,i){if(n)return 256&t.flags?(t.flags&=-257,Ll(e,t,i,r=Zs(Error(G(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(o=r.fallback,a=t.mode,r=Eu({mode:"visible",children:r.children},a,0,null),(o=Cu(o,a,i,null)).flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,1&t.mode&&ui(t,e.child,null,i),t.child.memoizedState=El(i),t.memoizedState=Cl,o);if(!(1&t.mode))return Ll(e,t,i,null);if("$!"===a.data){if(r=a.nextSibling&&a.nextSibling.dataset)var s=r.dgst;return r=s,Ll(e,t,i,r=Zs(o=Error(G(419)),r,void 0))}if(s=0!==(i&e.childLanes),ll||s){if(null!==(r=vc)){switch(i&-i){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}0!==(a=0!==(a&(r.suspendedLanes|i))?0:a)&&a!==o.retryLane&&(o.retryLane=a,Ci(e,a),Hc(r,e,a,-1))}return au(),Ll(e,t,i,r=Zs(Error(G(421))))}return"$?"===a.data?(t.flags|=128,t.child=e.child,t=gu.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,qo=Ja(a.nextSibling),Ko=t,Go=!0,Qo=null,null!==e&&(Fo[Oo++]=jo,Fo[Oo++]=Uo,Fo[Oo++]=$o,jo=e.id,Uo=e.overflow,$o=t),t=Ml(t,r.children),t.flags|=4096,t)}(e,t,s,a,r,o,n);if(i){i=a.fallback,s=t.mode,r=(o=e.child).sibling;var l={mode:"hidden",children:a.children};return 1&s||t.child===o?(a=Su(o,l)).subtreeFlags=14680064&o.subtreeFlags:((a=t.child).childLanes=0,a.pendingProps=l,t.deletions=null),null!==r?i=Su(r,i):(i=Cu(i,s,n,null)).flags|=2,i.return=t,a.return=t,a.sibling=i,t.child=a,a=i,i=t.child,s=null===(s=e.child.memoizedState)?El(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Cl,a}return e=(i=e.child).sibling,a=Su(i,{mode:"visible",children:a.children}),!(1&t.mode)&&(a.lanes=n),a.return=t,a.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=a,t.memoizedState=null,a}function Ml(e,t){return(t=Eu({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Ll(e,t,n,r){return null!==r&&ai(r),ui(t,e.child,null,n),(e=Ml(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Rl(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),vi(e.return,t,n)}function Al(e,t,n,r,a){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=a)}function Pl(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(cl(e,t,r.children,n),2&(r=Vi.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Rl(e,n,t);else if(19===e.tag)Rl(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}r&=1}if(go(Vi,r),1&t.mode)switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===Wi(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Al(t,!1,a,n,o);break;case"backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===Wi(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Al(t,!0,n,null,o);break;case"together":Al(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Nl(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Dl(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Ec|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(G(153));if(null!==t.child){for(n=Su(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Su(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Tl(e,t){if(!Go)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 Il(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=14680064&a.subtreeFlags,r|=14680064&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function zl(e,t,n){var r=t.pendingProps;switch(Ho(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Il(t),null;case 1:case 17:return So(t.type)&&xo(),Il(t),null;case 3:return r=t.stateNode,ji(),mo(bo),mo(vo),Ki(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(ti(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==Qo&&(Qc(Qo),Qo=null))),kl(e,t),Il(t),null;case 5:Bi(t);var a=Oi(Fi.current);if(n=t.type,null!==e&&null!=t.stateNode)Sl(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(G(166));return Il(t),null}if(e=Oi(Ii.current),ti(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[to]=t,r[no]=o,e=!!(1&t.mode),n){case"dialog":La("cancel",r),La("close",r);break;case"iframe":case"object":case"embed":La("load",r);break;case"video":case"audio":for(a=0;a<Ca.length;a++)La(Ca[a],r);break;case"source":La("error",r);break;case"img":case"image":case"link":La("error",r),La("load",r);break;case"details":La("toggle",r);break;case"input":$e(r,o),La("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},La("invalid",r);break;case"textarea":qe(r,o),La("invalid",r)}for(var i in st(n,o),a=null,o)if(o.hasOwnProperty(i)){var s=o[i];"children"===i?"string"==typeof s?r.textContent!==s&&(!0!==o.suppressHydrationWarning&&Ua(r.textContent,s,e),a=["children",s]):"number"==typeof s&&r.textContent!==""+s&&(!0!==o.suppressHydrationWarning&&Ua(r.textContent,s,e),a=["children",""+s]):Y.hasOwnProperty(i)&&null!=s&&"onScroll"===i&&La("scroll",r)}switch(n){case"input":Ie(r),Be(r,o,!0);break;case"textarea":Ie(r),Qe(r);break;case"select":case"option":break;default:"function"==typeof o.onClick&&(r.onclick=Ba)}r=a,t.updateQueue=r,null!==r&&(t.flags|=4)}else{i=9===a.nodeType?a:a.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=Ye(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=i.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),"select"===n&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[to]=t,e[no]=r,wl(e,t,!1,!1),t.stateNode=e;e:{switch(i=lt(n,r),n){case"dialog":La("cancel",e),La("close",e),a=r;break;case"iframe":case"object":case"embed":La("load",e),a=r;break;case"video":case"audio":for(a=0;a<Ca.length;a++)La(Ca[a],e);a=r;break;case"source":La("error",e),a=r;break;case"img":case"image":case"link":La("error",e),La("load",e),a=r;break;case"details":La("toggle",e),a=r;break;case"input":$e(e,r),a=Oe(e,r),La("invalid",e);break;case"option":default:a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=_e({},r,{value:void 0}),La("invalid",e);break;case"textarea":qe(e,r),a=Ke(e,r),La("invalid",e)}for(o in st(n,a),s=a)if(s.hasOwnProperty(o)){var l=s[o];"style"===o?ot(e,l):"dangerouslySetInnerHTML"===o?null!=(l=l?l.__html:void 0)&&et(e,l):"children"===o?"string"==typeof l?("textarea"!==n||""!==l)&&tt(e,l):"number"==typeof l&&tt(e,""+l):"suppressContentEditableWarning"!==o&&"suppressHydrationWarning"!==o&&"autoFocus"!==o&&(Y.hasOwnProperty(o)?null!=l&&"onScroll"===o&&La("scroll",e):null!=l&&le(e,o,l,i))}switch(n){case"input":Ie(e),Be(e,r,!1);break;case"textarea":Ie(e),Qe(e);break;case"option":null!=r.value&&e.setAttribute("value",""+De(r.value));break;case"select":e.multiple=!!r.multiple,null!=(o=r.value)?He(e,!!r.multiple,o,!1):null!=r.defaultValue&&He(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=Ba)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Il(t),null;case 6:if(e&&null!=t.stateNode)xl(e,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(G(166));if(n=Oi(Fi.current),Oi(Ii.current),ti(t)){if(r=t.stateNode,n=t.memoizedProps,r[to]=t,(o=r.nodeValue!==n)&&null!==(e=Ko))switch(e.tag){case 3:Ua(r.nodeValue,n,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ua(r.nodeValue,n,!!(1&e.mode))}o&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[to]=t,t.stateNode=r}return Il(t),null;case 13:if(mo(Vi),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(Go&&null!==qo&&1&t.mode&&!(128&t.flags))ni(),ri(),t.flags|=98560,o=!1;else if(o=ti(t),null!==r&&null!==r.dehydrated){if(null===e){if(!o)throw Error(G(318));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(G(317));o[to]=t}else ri(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Il(t),o=!1}else null!==Qo&&(Qc(Qo),Qo=null),o=!0;if(!o)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=n,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,1&t.mode&&(null===e||1&Vi.current?0===xc&&(xc=3):au())),null!==t.updateQueue&&(t.flags|=4),Il(t),null);case 4:return ji(),kl(e,t),null===e&&Pa(t.stateNode.containerInfo),Il(t),null;case 10:return yi(t.type._context),Il(t),null;case 19:if(mo(Vi),null===(o=t.memoizedState))return Il(t),null;if(r=!!(128&t.flags),null===(i=o.rendering))if(r)Tl(o,!1);else{if(0!==xc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(i=Wi(e))){for(t.flags|=128,Tl(o,!1),null!==(r=i.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(o=n).flags&=14680066,null===(i=o.alternate)?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return go(Vi,1&Vi.current|2),t.child}e=e.sibling}null!==o.tail&&jt()>Pc&&(t.flags|=128,r=!0,Tl(o,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=Wi(i))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Tl(o,!0),null===o.tail&&"hidden"===o.tailMode&&!i.alternate&&!Go)return Il(t),null}else 2*jt()-o.renderingStartTime>Pc&&1073741824!==n&&(t.flags|=128,r=!0,Tl(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(null!==(n=o.last)?n.sibling=i:t.child=i,o.last=i)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=jt(),t.sibling=null,n=Vi.current,go(Vi,r?1&n|2:1&n),t):(Il(t),null);case 22:case 23:return eu(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&1&t.mode?!!(1073741824&kc)&&(Il(t),6&t.subtreeFlags&&(t.flags|=8192)):Il(t),null;case 24:case 25:return null}throw Error(G(156,t.tag))}function Fl(e,t){switch(Ho(t),t.tag){case 1:return So(t.type)&&xo(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return ji(),mo(bo),mo(vo),Ki(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Bi(t),null;case 13:if(mo(Vi),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(G(340));ri()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return mo(Vi),null;case 4:return ji(),null;case 10:return yi(t.type._context),null;case 22:case 23:return eu(),null;default:return null}}wl=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},kl=function(){},Sl=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,Oi(Ii.current);var o,i=null;switch(n){case"input":a=Oe(e,a),r=Oe(e,r),i=[];break;case"select":a=_e({},a,{value:void 0}),r=_e({},r,{value:void 0}),i=[];break;case"textarea":a=Ke(e,a),r=Ke(e,r),i=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(e.onclick=Ba)}for(c in st(n,r),n=null,a)if(!r.hasOwnProperty(c)&&a.hasOwnProperty(c)&&null!=a[c])if("style"===c){var s=a[c];for(o in s)s.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==c&&"children"!==c&&"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(Y.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(s=null!=a?a[c]:void 0,r.hasOwnProperty(c)&&l!==s&&(null!=l||null!=s))if("style"===c)if(s){for(o in s)!s.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&s[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(i||(i=[]),i.push(c,n)),n=l;else"dangerouslySetInnerHTML"===c?(l=l?l.__html:void 0,s=s?s.__html:void 0,null!=l&&s!==l&&(i=i||[]).push(c,l)):"children"===c?"string"!=typeof l&&"number"!=typeof l||(i=i||[]).push(c,""+l):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&(Y.hasOwnProperty(c)?(null!=l&&"onScroll"===c&&La("scroll",e),i||s===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}},xl=function(e,t,n,r){n!==r&&(t.flags|=4)};var Ol=!1,$l=!1,jl="function"==typeof WeakSet?WeakSet:Set,Ul=null;function Bl(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){hu(e,t,n)}else n.current=null}function Vl(e,t,n){try{n()}catch(n){hu(e,t,n)}}var Wl=!1;function Hl(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var a=r=r.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,void 0!==o&&Vl(t,n,o)}a=a.next}while(a!==r)}}function Kl(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ql(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function Gl(e){var t=e.alternate;null!==t&&(e.alternate=null,Gl(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[to],delete t[no],delete t[ao],delete t[oo],delete t[io])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ql(e){return 5===e.tag||3===e.tag||4===e.tag}function Yl(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Ql(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(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 Xl(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Ba));else if(4!==r&&null!==(e=e.child))for(Xl(e,t,n),e=e.sibling;null!==e;)Xl(e,t,n),e=e.sibling}function Jl(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&&null!==(e=e.child))for(Jl(e,t,n),e=e.sibling;null!==e;)Jl(e,t,n),e=e.sibling}var Zl=null,ec=!1;function tc(e,t,n){for(n=n.child;null!==n;)nc(e,t,n),n=n.sibling}function nc(e,t,n){if(Gt&&"function"==typeof Gt.onCommitFiberUnmount)try{Gt.onCommitFiberUnmount(qt,n)}catch(e){}switch(n.tag){case 5:$l||Bl(n,t);case 6:var r=Zl,a=ec;Zl=null,tc(e,t,n),ec=a,null!==(Zl=r)&&(ec?(e=Zl,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):Zl.removeChild(n.stateNode));break;case 18:null!==Zl&&(ec?(e=Zl,n=n.stateNode,8===e.nodeType?Xa(e.parentNode,n):1===e.nodeType&&Xa(e,n),Nn(e)):Xa(Zl,n.stateNode));break;case 4:r=Zl,a=ec,Zl=n.stateNode.containerInfo,ec=!0,tc(e,t,n),Zl=r,ec=a;break;case 0:case 11:case 14:case 15:if(!$l&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){a=r=r.next;do{var o=a,i=o.destroy;o=o.tag,void 0!==i&&(2&o||4&o)&&Vl(n,t,i),a=a.next}while(a!==r)}tc(e,t,n);break;case 1:if(!$l&&(Bl(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){hu(n,t,e)}tc(e,t,n);break;case 21:tc(e,t,n);break;case 22:1&n.mode?($l=(r=$l)||null!==n.memoizedState,tc(e,t,n),$l=r):tc(e,t,n);break;default:tc(e,t,n)}}function rc(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new jl),t.forEach(function(t){var r=yu.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function ac(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var a=n[r];try{var o=e,i=t,s=i;e:for(;null!==s;){switch(s.tag){case 5:Zl=s.stateNode,ec=!1;break e;case 3:case 4:Zl=s.stateNode.containerInfo,ec=!0;break e}s=s.return}if(null===Zl)throw Error(G(160));nc(o,i,a),Zl=null,ec=!1;var l=a.alternate;null!==l&&(l.return=null),a.return=null}catch(e){hu(a,t,e)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)oc(t,e),t=t.sibling}function oc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ac(t,e),ic(e),4&r){try{Hl(3,e,e.return),Kl(3,e)}catch(t){hu(e,e.return,t)}try{Hl(5,e,e.return)}catch(t){hu(e,e.return,t)}}break;case 1:ac(t,e),ic(e),512&r&&null!==n&&Bl(n,n.return);break;case 5:if(ac(t,e),ic(e),512&r&&null!==n&&Bl(n,n.return),32&e.flags){var a=e.stateNode;try{tt(a,"")}catch(t){hu(e,e.return,t)}}if(4&r&&null!=(a=e.stateNode)){var o=e.memoizedProps,i=null!==n?n.memoizedProps:o,s=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===s&&"radio"===o.type&&null!=o.name&&je(a,o),lt(s,i);var c=lt(s,o);for(i=0;i<l.length;i+=2){var u=l[i],d=l[i+1];"style"===u?ot(a,d):"dangerouslySetInnerHTML"===u?et(a,d):"children"===u?tt(a,d):le(a,u,d,c)}switch(s){case"input":Ue(a,o);break;case"textarea":Ge(a,o);break;case"select":var f=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var h=o.value;null!=h?He(a,!!o.multiple,h,!1):f!==!!o.multiple&&(null!=o.defaultValue?He(a,!!o.multiple,o.defaultValue,!0):He(a,!!o.multiple,o.multiple?[]:"",!1))}a[no]=o}catch(t){hu(e,e.return,t)}}break;case 6:if(ac(t,e),ic(e),4&r){if(null===e.stateNode)throw Error(G(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){hu(e,e.return,t)}}break;case 3:if(ac(t,e),ic(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Nn(t.containerInfo)}catch(t){hu(e,e.return,t)}break;case 4:default:ac(t,e),ic(e);break;case 13:ac(t,e),ic(e),8192&(a=e.child).flags&&(o=null!==a.memoizedState,a.stateNode.isHidden=o,!o||null!==a.alternate&&null!==a.alternate.memoizedState||(Ac=jt())),4&r&&rc(e);break;case 22:if(u=null!==n&&null!==n.memoizedState,1&e.mode?($l=(c=$l)||u,ac(t,e),$l=c):ac(t,e),ic(e),8192&r){if(c=null!==e.memoizedState,(e.stateNode.isHidden=c)&&!u&&1&e.mode)for(Ul=e,u=e.child;null!==u;){for(d=Ul=u;null!==Ul;){switch(h=(f=Ul).child,f.tag){case 0:case 11:case 14:case 15:Hl(4,f,f.return);break;case 1:Bl(f,f.return);var p=f.stateNode;if("function"==typeof p.componentWillUnmount){r=f,n=f.return;try{t=r,p.props=t.memoizedProps,p.state=t.memoizedState,p.componentWillUnmount()}catch(e){hu(r,n,e)}}break;case 5:Bl(f,f.return);break;case 22:if(null!==f.memoizedState){uc(d);continue}}null!==h?(h.return=f,Ul=h):uc(d)}u=u.sibling}e:for(u=null,d=e;;){if(5===d.tag){if(null===u){u=d;try{a=d.stateNode,c?"function"==typeof(o=a.style).setProperty?o.setProperty("display","none","important"):o.display="none":(s=d.stateNode,i=null!=(l=d.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,s.style.display=at("display",i))}catch(t){hu(e,e.return,t)}}}else if(6===d.tag){if(null===u)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(t){hu(e,e.return,t)}}else if((22!==d.tag&&23!==d.tag||null===d.memoizedState||d===e)&&null!==d.child){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;null===d.sibling;){if(null===d.return||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:ac(t,e),ic(e),4&r&&rc(e);case 21:}}function ic(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(Ql(n)){var r=n;break e}n=n.return}throw Error(G(160))}switch(r.tag){case 5:var a=r.stateNode;32&r.flags&&(tt(a,""),r.flags&=-33),Jl(e,Yl(e),a);break;case 3:case 4:var o=r.stateNode.containerInfo;Xl(e,Yl(e),o);break;default:throw Error(G(161))}}catch(t){hu(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function sc(e,t,n){Ul=e,lc(e)}function lc(e,t,n){for(var r=!!(1&e.mode);null!==Ul;){var a=Ul,o=a.child;if(22===a.tag&&r){var i=null!==a.memoizedState||Ol;if(!i){var s=a.alternate,l=null!==s&&null!==s.memoizedState||$l;s=Ol;var c=$l;if(Ol=i,($l=l)&&!c)for(Ul=a;null!==Ul;)l=(i=Ul).child,22===i.tag&&null!==i.memoizedState?dc(a):null!==l?(l.return=i,Ul=l):dc(a);for(;null!==o;)Ul=o,lc(o),o=o.sibling;Ul=a,Ol=s,$l=c}cc(e)}else 8772&a.subtreeFlags&&null!==o?(o.return=a,Ul=o):cc(e)}}function cc(e){for(;null!==Ul;){var t=Ul;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:$l||Kl(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!$l)if(null===n)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:Hs(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;null!==o&&Di(t,o,r);break;case 3:var i=t.updateQueue;if(null!==i){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Di(t,i,n)}break;case 5:var s=t.stateNode;if(null===n&&4&t.flags){n=s;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var c=t.alternate;if(null!==c){var u=c.memoizedState;if(null!==u){var d=u.dehydrated;null!==d&&Nn(d)}}}break;default:throw Error(G(163))}$l||512&t.flags&&ql(t)}catch(e){hu(t,t.return,e)}}if(t===e){Ul=null;break}if(null!==(n=t.sibling)){n.return=t.return,Ul=n;break}Ul=t.return}}function uc(e){for(;null!==Ul;){var t=Ul;if(t===e){Ul=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Ul=n;break}Ul=t.return}}function dc(e){for(;null!==Ul;){var t=Ul;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Kl(4,t)}catch(e){hu(t,n,e)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var a=t.return;try{r.componentDidMount()}catch(e){hu(t,a,e)}}var o=t.return;try{ql(t)}catch(e){hu(t,o,e)}break;case 5:var i=t.return;try{ql(t)}catch(e){hu(t,i,e)}}}catch(e){hu(t,t.return,e)}if(t===e){Ul=null;break}var s=t.sibling;if(null!==s){s.return=t.return,Ul=s;break}Ul=t.return}}var fc,hc=Math.ceil,pc=ce.ReactCurrentDispatcher,mc=ce.ReactCurrentOwner,gc=ce.ReactCurrentBatchConfig,yc=0,vc=null,bc=null,wc=0,kc=0,Sc=po(0),xc=0,Cc=null,Ec=0,_c=0,Mc=0,Lc=null,Rc=null,Ac=0,Pc=1/0,Nc=null,Dc=!1,Tc=null,Ic=null,zc=!1,Fc=null,Oc=0,$c=0,jc=null,Uc=-1,Bc=0;function Vc(){return 6&yc?jt():-1!==Uc?Uc:Uc=jt()}function Wc(e){return 1&e.mode?2&yc&&0!==wc?wc&-wc:null!==oi.transition?(0===Bc&&(Bc=an()),Bc):0!==(e=cn)?e:e=void 0===(e=window.event)?16:jn(e.type):1}function Hc(e,t,n,r){if(50<$c)throw $c=0,jc=null,Error(G(185));sn(e,n,r),2&yc&&e===vc||(e===vc&&(!(2&yc)&&(_c|=n),4===xc&&Yc(e,wc)),Kc(e,r),1===n&&0===yc&&!(1&t.mode)&&(Pc=jt()+500,Ro&&No()))}function Kc(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-Qt(o),s=1<<i,l=a[i];-1===l?0!==(s&n)&&0===(s&r)||(a[i]=nn(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}}(e,t);var r=tn(e,e===vc?wc:0);if(0===r)null!==n&&Ft(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ft(n),1===t)0===e.tag?function(e){Ro=!0,Po(e)}(Xc.bind(null,e)):Po(Xc.bind(null,e)),Qa(function(){!(6&yc)&&No()}),n=null;else{switch(un(r)){case 1:n=Bt;break;case 4:n=Vt;break;case 16:default:n=Wt;break;case 536870912:n=Kt}n=vu(n,qc.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function qc(e,t){if(Uc=-1,Bc=0,6&yc)throw Error(G(327));var n=e.callbackNode;if(du()&&e.callbackNode!==n)return null;var r=tn(e,e===vc?wc:0);if(0===r)return null;if(30&r||0!==(r&e.expiredLanes)||t)t=ou(e,r);else{t=r;var a=yc;yc|=2;var o=ru();for(vc===e&&wc===t||(Nc=null,Pc=jt()+500,tu(e,t));;)try{su();break}catch(t){nu(e,t)}gi(),pc.current=o,yc=a,null!==bc?t=0:(vc=null,wc=0,t=xc)}if(0!==t){if(2===t&&(0!==(a=rn(e))&&(r=a,t=Gc(e,a))),1===t)throw n=Cc,tu(e,0),Yc(e,r),Kc(e,jt()),n;if(6===t)Yc(e,r);else{if(a=e.current.alternate,!(30&r||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var a=n[r],o=a.getSnapshot;a=a.value;try{if(!Yr(o(),a))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}(a)||(t=ou(e,r),2===t&&(o=rn(e),0!==o&&(r=o,t=Gc(e,o))),1!==t)))throw n=Cc,tu(e,0),Yc(e,r),Kc(e,jt()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(G(345));case 2:case 5:uu(e,Rc,Nc);break;case 3:if(Yc(e,r),(130023424&r)===r&&10<(t=Ac+500-jt())){if(0!==tn(e,0))break;if(((a=e.suspendedLanes)&r)!==r){Vc(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ka(uu.bind(null,e,Rc,Nc),t);break}uu(e,Rc,Nc);break;case 4:if(Yc(e,r),(4194240&r)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-Qt(r);o=1<<i,(i=t[i])>a&&(a=i),r&=~o}if(r=a,10<(r=(120>(r=jt()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*hc(r/1960))-r)){e.timeoutHandle=Ka(uu.bind(null,e,Rc,Nc),r);break}uu(e,Rc,Nc);break;default:throw Error(G(329))}}}return Kc(e,jt()),e.callbackNode===n?qc.bind(null,e):null}function Gc(e,t){var n=Lc;return e.current.memoizedState.isDehydrated&&(tu(e,t).flags|=256),2!==(e=ou(e,t))&&(t=Rc,Rc=n,null!==t&&Qc(t)),e}function Qc(e){null===Rc?Rc=e:Rc.push.apply(Rc,e)}function Yc(e,t){for(t&=~Mc,t&=~_c,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Qt(t),r=1<<n;e[n]=-1,t&=~r}}function Xc(e){if(6&yc)throw Error(G(327));du();var t=tn(e,0);if(!(1&t))return Kc(e,jt()),null;var n=ou(e,t);if(0!==e.tag&&2===n){var r=rn(e);0!==r&&(t=r,n=Gc(e,r))}if(1===n)throw n=Cc,tu(e,0),Yc(e,t),Kc(e,jt()),n;if(6===n)throw Error(G(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,uu(e,Rc,Nc),Kc(e,jt()),null}function Jc(e,t){var n=yc;yc|=1;try{return e(t)}finally{0===(yc=n)&&(Pc=jt()+500,Ro&&No())}}function Zc(e){null!==Fc&&0===Fc.tag&&!(6&yc)&&du();var t=yc;yc|=1;var n=gc.transition,r=cn;try{if(gc.transition=null,cn=1,e)return e()}finally{cn=r,gc.transition=n,!(6&(yc=t))&&No()}}function eu(){kc=Sc.current,mo(Sc)}function tu(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,qa(n)),null!==bc)for(n=bc.return;null!==n;){var r=n;switch(Ho(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&xo();break;case 3:ji(),mo(bo),mo(vo),Ki();break;case 5:Bi(r);break;case 4:ji();break;case 13:case 19:mo(Vi);break;case 10:yi(r.type._context);break;case 22:case 23:eu()}n=n.return}if(vc=e,bc=e=Su(e.current,null),wc=kc=t,xc=0,Cc=null,Mc=_c=Ec=0,Rc=Lc=null,null!==ki){for(t=0;t<ki.length;t++)if(null!==(r=(n=ki[t]).interleaved)){n.interleaved=null;var a=r.next,o=n.pending;if(null!==o){var i=o.next;o.next=a,r.next=i}n.pending=r}ki=null}return e}function nu(e,t){for(;;){var n=bc;try{if(gi(),qi.current=Us,Zi){for(var r=Yi.memoizedState;null!==r;){var a=r.queue;null!==a&&(a.pending=null),r=r.next}Zi=!1}if(Qi=0,Ji=Xi=Yi=null,es=!1,ts=0,mc.current=null,null===n||null===n.return){xc=1,Cc=t,bc=null;break}e:{var o=e,i=n.return,s=n,l=t;if(t=wc,s.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var c=l,u=s,d=u.tag;if(!(1&u.mode||0!==d&&11!==d&&15!==d)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=ol(i);if(null!==h){h.flags&=-257,il(h,i,s,0,t),1&h.mode&&al(o,c,t),l=c;var p=(t=h).updateQueue;if(null===p){var m=new Set;m.add(l),t.updateQueue=m}else p.add(l);break e}if(!(1&t)){al(o,c,t),au();break e}l=Error(G(426))}else if(Go&&1&s.mode){var g=ol(i);if(null!==g){!(65536&g.flags)&&(g.flags|=256),il(g,i,s,0,t),ai(Js(l,s));break e}}o=l=Js(l,s),4!==xc&&(xc=2),null===Lc?Lc=[o]:Lc.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t,Pi(o,nl(0,l,t));break e;case 1:s=l;var y=o.type,v=o.stateNode;if(!(128&o.flags||"function"!=typeof y.getDerivedStateFromError&&(null===v||"function"!=typeof v.componentDidCatch||null!==Ic&&Ic.has(v)))){o.flags|=65536,t&=-t,o.lanes|=t,Pi(o,rl(o,s,t));break e}}o=o.return}while(null!==o)}cu(n)}catch(e){t=e,bc===n&&null!==n&&(bc=n=n.return);continue}break}}function ru(){var e=pc.current;return pc.current=Us,null===e?Us:e}function au(){0!==xc&&3!==xc&&2!==xc||(xc=4),null===vc||!(268435455&Ec)&&!(268435455&_c)||Yc(vc,wc)}function ou(e,t){var n=yc;yc|=2;var r=ru();for(vc===e&&wc===t||(Nc=null,tu(e,t));;)try{iu();break}catch(t){nu(e,t)}if(gi(),yc=n,pc.current=r,null!==bc)throw Error(G(261));return vc=null,wc=0,xc}function iu(){for(;null!==bc;)lu(bc)}function su(){for(;null!==bc&&!Ot();)lu(bc)}function lu(e){var t=fc(e.alternate,e,kc);e.memoizedProps=e.pendingProps,null===t?cu(e):bc=t,mc.current=null}function cu(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=Fl(n,t)))return n.flags&=32767,void(bc=n);if(null===e)return xc=6,void(bc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=zl(n,t,kc)))return void(bc=n);if(null!==(t=t.sibling))return void(bc=t);bc=t=e}while(null!==t);0===xc&&(xc=5)}function uu(e,t,n){var r=cn,a=gc.transition;try{gc.transition=null,cn=1,function(e,t,n,r){do{du()}while(null!==Fc);if(6&yc)throw Error(G(327));n=e.finishedWork;var a=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(G(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-Qt(n),o=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~o}}(e,o),e===vc&&(bc=vc=null,wc=0),!(2064&n.subtreeFlags)&&!(2064&n.flags)||zc||(zc=!0,vu(Wt,function(){return du(),null})),o=!!(15990&n.flags),!!(15990&n.subtreeFlags)||o){o=gc.transition,gc.transition=null;var i=cn;cn=1;var s=yc;yc|=4,mc.current=null,function(e,t){if(Va=Tn,na(e=ta())){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 a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(e){n=null;break e}var i=0,s=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var h;d!==n||0!==a&&3!==d.nodeType||(s=i+a),d!==o||0!==r&&3!==d.nodeType||(l=i+r),3===d.nodeType&&(i+=d.nodeValue.length),null!==(h=d.firstChild);)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++c===a&&(s=i),f===o&&++u===r&&(l=i),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(Wa={focusedElem:e,selectionRange:n},Tn=!1,Ul=t;null!==Ul;)if(e=(t=Ul).child,1028&t.subtreeFlags&&null!==e)e.return=t,Ul=e;else for(;null!==Ul;){t=Ul;try{var p=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==p){var m=p.memoizedProps,g=p.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?m:Hs(t.type,m),g);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;1===b.nodeType?b.textContent="":9===b.nodeType&&b.documentElement&&b.removeChild(b.documentElement);break;default:throw Error(G(163))}}catch(e){hu(t,t.return,e)}if(null!==(e=t.sibling)){e.return=t.return,Ul=e;break}Ul=t.return}p=Wl,Wl=!1}(e,n),oc(n,e),ra(Wa),Tn=!!Va,Wa=Va=null,e.current=n,sc(n),$t(),yc=s,cn=i,gc.transition=o}else e.current=n;if(zc&&(zc=!1,Fc=e,Oc=a),o=e.pendingLanes,0===o&&(Ic=null),function(e){if(Gt&&"function"==typeof Gt.onCommitFiberRoot)try{Gt.onCommitFiberRoot(qt,e,void 0,!(128&~e.current.flags))}catch(e){}}(n.stateNode),Kc(e,jt()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(Dc)throw Dc=!1,e=Tc,Tc=null,e;!!(1&Oc)&&0!==e.tag&&du(),o=e.pendingLanes,1&o?e===jc?$c++:($c=0,jc=e):$c=0,No()}(e,t,n,r)}finally{gc.transition=a,cn=r}return null}function du(){if(null!==Fc){var e=un(Oc),t=gc.transition,n=cn;try{if(gc.transition=null,cn=16>e?16:e,null===Fc)var r=!1;else{if(e=Fc,Fc=null,Oc=0,6&yc)throw Error(G(331));var a=yc;for(yc|=4,Ul=e.current;null!==Ul;){var o=Ul,i=o.child;if(16&Ul.flags){var s=o.deletions;if(null!==s){for(var l=0;l<s.length;l++){var c=s[l];for(Ul=c;null!==Ul;){var u=Ul;switch(u.tag){case 0:case 11:case 15:Hl(8,u,o)}var d=u.child;if(null!==d)d.return=u,Ul=d;else for(;null!==Ul;){var f=(u=Ul).sibling,h=u.return;if(Gl(u),u===c){Ul=null;break}if(null!==f){f.return=h,Ul=f;break}Ul=h}}}var p=o.alternate;if(null!==p){var m=p.child;if(null!==m){p.child=null;do{var g=m.sibling;m.sibling=null,m=g}while(null!==m)}}Ul=o}}if(2064&o.subtreeFlags&&null!==i)i.return=o,Ul=i;else e:for(;null!==Ul;){if(2048&(o=Ul).flags)switch(o.tag){case 0:case 11:case 15:Hl(9,o,o.return)}var y=o.sibling;if(null!==y){y.return=o.return,Ul=y;break e}Ul=o.return}}var v=e.current;for(Ul=v;null!==Ul;){var b=(i=Ul).child;if(2064&i.subtreeFlags&&null!==b)b.return=i,Ul=b;else e:for(i=v;null!==Ul;){if(2048&(s=Ul).flags)try{switch(s.tag){case 0:case 11:case 15:Kl(9,s)}}catch(e){hu(s,s.return,e)}if(s===i){Ul=null;break e}var w=s.sibling;if(null!==w){w.return=s.return,Ul=w;break e}Ul=s.return}}if(yc=a,No(),Gt&&"function"==typeof Gt.onPostCommitFiberRoot)try{Gt.onPostCommitFiberRoot(qt,e)}catch(e){}r=!0}return r}finally{cn=n,gc.transition=t}}return!1}function fu(e,t,n){e=Ri(e,t=nl(0,t=Js(n,t),1),1),t=Vc(),null!==e&&(sn(e,1,t),Kc(e,t))}function hu(e,t,n){if(3===e.tag)fu(e,e,n);else for(;null!==t;){if(3===t.tag){fu(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Ic||!Ic.has(r))){t=Ri(t,e=rl(t,e=Js(n,e),1),1),e=Vc(),null!==t&&(sn(t,1,e),Kc(t,e));break}}t=t.return}}function pu(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=Vc(),e.pingedLanes|=e.suspendedLanes&n,vc===e&&(wc&n)===n&&(4===xc||3===xc&&(130023424&wc)===wc&&500>jt()-Ac?tu(e,0):Mc|=n),Kc(e,t)}function mu(e,t){0===t&&(1&e.mode?(t=Zt,!(130023424&(Zt<<=1))&&(Zt=4194304)):t=1);var n=Vc();null!==(e=Ci(e,t))&&(sn(e,t,n),Kc(e,n))}function gu(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),mu(e,n)}function yu(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(G(314))}null!==r&&r.delete(t),mu(e,n)}function vu(e,t){return zt(e,t)}function bu(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.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 wu(e,t,n,r){return new bu(e,t,n,r)}function ku(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Su(e,t){var n=e.alternate;return null===n?((n=wu(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=14680064&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}function xu(e,t,n,r,a,o){var i=2;if(r=e,"function"==typeof e)ku(e)&&(i=1);else if("string"==typeof e)i=5;else e:switch(e){case fe:return Cu(n.children,a,o,t);case he:i=8,a|=8;break;case pe:return(e=wu(12,n,t,2|a)).elementType=pe,e.lanes=o,e;case ve:return(e=wu(13,n,t,a)).elementType=ve,e.lanes=o,e;case be:return(e=wu(19,n,t,a)).elementType=be,e.lanes=o,e;case Se:return Eu(n,a,o,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case me:i=10;break e;case ge:i=9;break e;case ye:i=11;break e;case we:i=14;break e;case ke:i=16,r=null;break e}throw Error(G(130,null==e?e:typeof e,""))}return(t=wu(i,n,t,a)).elementType=e,t.type=r,t.lanes=o,t}function Cu(e,t,n,r){return(e=wu(7,e,r,t)).lanes=n,e}function Eu(e,t,n,r){return(e=wu(22,e,r,t)).elementType=Se,e.lanes=n,e.stateNode={isHidden:!1},e}function _u(e,t,n){return(e=wu(6,e,null,t)).lanes=n,e}function Mu(e,t,n){return(t=wu(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Lu(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=on(0),this.expirationTimes=on(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=on(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Ru(e,t,n,r,a,o,i,s,l){return e=new Lu(e,t,n,s,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=wu(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},_i(o),e}function Au(e){if(!e)return yo;e:{if(Pt(e=e._reactInternals)!==e||1!==e.tag)throw Error(G(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(So(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(G(171))}if(1===e.tag){var n=e.type;if(So(n))return Eo(e,n,t)}return t}function Pu(e,t,n,r,a,o,i,s,l){return(e=Ru(n,r,!0,e,0,o,0,s,l)).context=Au(null),n=e.current,(o=Li(r=Vc(),a=Wc(n))).callback=null!=t?t:null,Ri(n,o,a),e.current.lanes=a,sn(e,a,r),Kc(e,r),e}function Nu(e,t,n,r){var a=t.current,o=Vc(),i=Wc(a);return n=Au(n),null===t.context?t.context=n:t.pendingContext=n,(t=Li(o,i)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Ri(a,t,i))&&(Hc(e,a,i,o),Ai(e,a,i)),i}function Du(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Tu(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Iu(e,t){Tu(e,t),(e=e.alternate)&&Tu(e,t)}fc=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||bo.current)ll=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return ll=!1,function(e,t,n){switch(t.tag){case 3:vl(t),ri();break;case 5:Ui(t);break;case 1:So(t.type)&&_o(t);break;case 4:$i(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;go(fi,r._currentValue),r._currentValue=a;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(go(Vi,1&Vi.current),t.flags|=128,null):0!==(n&t.child.childLanes)?_l(e,t,n):(go(Vi,1&Vi.current),null!==(e=Dl(e,t,n))?e.sibling:null);go(Vi,1&Vi.current);break;case 19:if(r=0!==(n&t.childLanes),128&e.flags){if(r)return Pl(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),go(Vi,Vi.current),r)break;return null;case 22:case 23:return t.lanes=0,hl(e,t,n)}return Dl(e,t,n)}(e,t,n);ll=!!(131072&e.flags)}else ll=!1,Go&&1048576&t.flags&&Vo(t,zo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Nl(e,t),e=t.pendingProps;var a=ko(t,vo.current);bi(t,n),a=os(null,t,r,e,a,n);var o=is();return t.flags|=1,"object"==typeof a&&null!==a&&"function"==typeof a.render&&void 0===a.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,So(r)?(o=!0,_o(t)):o=!1,t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,_i(t),a.updater=qs,t.stateNode=a,a._reactInternals=t,Xs(t,r,e,n),t=yl(null,t,r,!0,o,n)):(t.tag=0,Go&&o&&Wo(t),cl(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Nl(e,t),e=t.pendingProps,r=(a=r._init)(r._payload),t.type=r,a=t.tag=function(e){if("function"==typeof e)return ku(e)?1:0;if(null!=e){if((e=e.$$typeof)===ye)return 11;if(e===we)return 14}return 2}(r),e=Hs(r,e),a){case 0:t=ml(null,t,r,e,n);break e;case 1:t=gl(null,t,r,e,n);break e;case 11:t=ul(null,t,r,e,n);break e;case 14:t=dl(null,t,r,Hs(r.type,e),n);break e}throw Error(G(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,ml(e,t,r,a=t.elementType===r?a:Hs(r,a),n);case 1:return r=t.type,a=t.pendingProps,gl(e,t,r,a=t.elementType===r?a:Hs(r,a),n);case 3:e:{if(vl(t),null===e)throw Error(G(387));r=t.pendingProps,a=(o=t.memoizedState).element,Mi(e,t),Ni(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=bl(e,t,r,n,a=Js(Error(G(423)),t));break e}if(r!==a){t=bl(e,t,r,n,a=Js(Error(G(424)),t));break e}for(qo=Ja(t.stateNode.containerInfo.firstChild),Ko=t,Go=!0,Qo=null,n=di(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(ri(),r===a){t=Dl(e,t,n);break e}cl(e,t,r,n)}t=t.child}return t;case 5:return Ui(t),null===e&&Zo(t),r=t.type,a=t.pendingProps,o=null!==e?e.memoizedProps:null,i=a.children,Ha(r,a)?i=null:null!==o&&Ha(r,o)&&(t.flags|=32),pl(e,t),cl(e,t,i,n),t.child;case 6:return null===e&&Zo(t),null;case 13:return _l(e,t,n);case 4:return $i(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=ui(t,null,r,n):cl(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,ul(e,t,r,a=t.elementType===r?a:Hs(r,a),n);case 7:return cl(e,t,t.pendingProps,n),t.child;case 8:case 12:return cl(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,i=a.value,go(fi,r._currentValue),r._currentValue=i,null!==o)if(Yr(o.value,i)){if(o.children===a.children&&!bo.current){t=Dl(e,t,n);break e}}else for(null!==(o=t.child)&&(o.return=t);null!==o;){var s=o.dependencies;if(null!==s){i=o.child;for(var l=s.firstContext;null!==l;){if(l.context===r){if(1===o.tag){(l=Li(-1,n&-n)).tag=2;var c=o.updateQueue;if(null!==c){var u=(c=c.shared).pending;null===u?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}o.lanes|=n,null!==(l=o.alternate)&&(l.lanes|=n),vi(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(10===o.tag)i=o.type===t.type?null:o.child;else if(18===o.tag){if(null===(i=o.return))throw Error(G(341));i.lanes|=n,null!==(s=i.alternate)&&(s.lanes|=n),vi(i,n,t),i=o.sibling}else i=o.child;if(null!==i)i.return=o;else for(i=o;null!==i;){if(i===t){i=null;break}if(null!==(o=i.sibling)){o.return=i.return,i=o;break}i=i.return}o=i}cl(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,bi(t,n),r=r(a=wi(a)),t.flags|=1,cl(e,t,r,n),t.child;case 14:return a=Hs(r=t.type,t.pendingProps),dl(e,t,r,a=Hs(r.type,a),n);case 15:return fl(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Hs(r,a),Nl(e,t),t.tag=1,So(r)?(e=!0,_o(t)):e=!1,bi(t,n),Qs(t,r,a),Xs(t,r,a,n),yl(null,t,r,!0,e,n);case 19:return Pl(e,t,n);case 22:return hl(e,t,n)}throw Error(G(156,t.tag))};var zu="function"==typeof reportError?reportError:function(e){console.error(e)};function Fu(e){this._internalRoot=e}function Ou(e){this._internalRoot=e}function $u(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function ju(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Uu(){}function Bu(e,t,n,r,a){var o=n._reactRootContainer;if(o){var i=o;if("function"==typeof a){var s=a;a=function(){var e=Du(i);s.call(e)}}Nu(t,i,e,a)}else i=function(e,t,n,r,a){if(a){if("function"==typeof r){var o=r;r=function(){var e=Du(i);o.call(e)}}var i=Pu(t,r,e,0,null,!1,0,"",Uu);return e._reactRootContainer=i,e[ro]=i.current,Pa(8===e.nodeType?e.parentNode:e),Zc(),i}for(;a=e.lastChild;)e.removeChild(a);if("function"==typeof r){var s=r;r=function(){var e=Du(l);s.call(e)}}var l=Ru(e,0,!1,null,0,!1,0,"",Uu);return e._reactRootContainer=l,e[ro]=l.current,Pa(8===e.nodeType?e.parentNode:e),Zc(function(){Nu(t,l,n,r)}),l}(n,t,e,a,r);return Du(i)}Ou.prototype.render=Fu.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(G(409));Nu(e,t,null,null)},Ou.prototype.unmount=Fu.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;Zc(function(){Nu(null,e,null,null)}),t[ro]=null}},Ou.prototype.unstable_scheduleHydration=function(e){if(e){var t=pn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xn.length&&0!==t&&t<xn[n].priority;n++);xn.splice(n,0,e),0===n&&Mn(e)}},dn=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=en(t.pendingLanes);0!==n&&(ln(t,1|n),Kc(t,jt()),!(6&yc)&&(Pc=jt()+500,No()))}break;case 13:Zc(function(){var t=Ci(e,1);if(null!==t){var n=Vc();Hc(t,e,1,n)}}),Iu(e,1)}},fn=function(e){if(13===e.tag){var t=Ci(e,134217728);if(null!==t)Hc(t,e,134217728,Vc());Iu(e,134217728)}},hn=function(e){if(13===e.tag){var t=Wc(e),n=Ci(e,t);if(null!==n)Hc(n,e,t,Vc());Iu(e,t)}},pn=function(){return cn},mn=function(e,t){var n=cn;try{return cn=e,t()}finally{cn=n}},dt=function(e,t,n){switch(t){case"input":if(Ue(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=uo(r);if(!a)throw Error(G(90));ze(r),Ue(r,a)}}}break;case"textarea":Ge(e,n);break;case"select":null!=(t=n.value)&&He(e,!!n.multiple,t,!1)}},yt=Jc,vt=Zc;var Vu={usingClientEntryPoint:!1,Events:[lo,co,uo,mt,gt,Jc]},Wu={findFiberByHostInstance:so,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Hu={bundleType:Wu.bundleType,version:Wu.version,rendererPackageName:Wu.rendererPackageName,rendererConfig:Wu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ce.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Tt(e))?null:e.stateNode},findFiberByHostInstance:Wu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var Ku=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ku.isDisabled&&Ku.supportsFiber)try{qt=Ku.inject(Hu),Gt=Ku}catch(Ze){}}B.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Vu,B.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!$u(t))throw Error(G(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:de,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},B.createRoot=function(e,t){if(!$u(e))throw Error(G(299));var n=!1,r="",a=zu;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(a=t.onRecoverableError)),t=Ru(e,1,!1,null,0,n,0,r,a),e[ro]=t.current,Pa(8===e.nodeType?e.parentNode:e),new Fu(t)},B.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(G(188));throw e=Object.keys(e).join(","),Error(G(268,e))}return e=null===(e=Tt(t))?null:e.stateNode},B.flushSync=function(e){return Zc(e)},B.hydrate=function(e,t,n){if(!ju(t))throw Error(G(200));return Bu(null,e,t,!0,n)},B.hydrateRoot=function(e,t,n){if(!$u(e))throw Error(G(405));var r=null!=n&&n.hydratedSources||null,a=!1,o="",i=zu;if(null!=n&&(!0===n.unstable_strictMode&&(a=!0),void 0!==n.identifierPrefix&&(o=n.identifierPrefix),void 0!==n.onRecoverableError&&(i=n.onRecoverableError)),t=Pu(t,null,e,1,null!=n?n:null,a,0,o,i),e[ro]=t.current,Pa(e),r)for(e=0;e<r.length;e++)a=(a=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new Ou(t)},B.render=function(e,t,n){if(!ju(t))throw Error(G(200));return Bu(null,e,t,!1,n)},B.unmountComponentAtNode=function(e){if(!ju(e))throw Error(G(40));return!!e._reactRootContainer&&(Zc(function(){Bu(null,null,e,!1,function(){e._reactRootContainer=null,e[ro]=null})}),!0)},B.unstable_batchedUpdates=Jc,B.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ju(n))throw Error(G(200));if(null==e||void 0===e._reactInternals)throw Error(G(38));return Bu(e,t,n,!1,r)},B.version="18.3.1-next-f1338f8080-20240426",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)}}(),U.exports=B;var qu,Gu=U.exports;qu=Gu.createRoot,Gu.hydrateRoot;var Qu={exports:{}},Yu={},Xu=$,Ju=Symbol.for("react.element"),Zu=Symbol.for("react.fragment"),ed=Object.prototype.hasOwnProperty,td=Xu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,nd={key:!0,ref:!0,__self:!0,__source:!0};function rd(e,t,n){var r,a={},o=null,i=null;for(r in void 0!==n&&(o=""+n),void 0!==t.key&&(o=""+t.key),void 0!==t.ref&&(i=t.ref),t)ed.call(t,r)&&!nd.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===a[r]&&(a[r]=t[r]);return{$$typeof:Ju,type:e,key:o,ref:i,props:a,_owner:td.current}}Yu.Fragment=Zu,Yu.jsx=rd,Yu.jsxs=rd,Qu.exports=Yu;var ad=Qu.exports;function od(e){return{title:e.title,snippet:e.content,relevance:e.score,documentId:e.documentId,fullContent:e.fullContent,downloadUrl:e.downloadUrl,documentName:e.documentName,sourceType:e.sourceType,chunkId:e.chunkId}}class id{constructor(e,t){this.baseUrl=e.replace(/\/$/,""),this.apiKey=t}async chat(e,t){const n=await fetch(`${this.baseUrl}/api/external/chat`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.apiKey},body:JSON.stringify({message:e,sessionId:t?.sessionId,context:t?.context})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`HTTP ${n.status}: ${n.statusText}`)}const r=await n.json();return{...r,sources:(r.sources||[]).map(od)}}async chatStream(e,t){const n=await fetch(`${this.baseUrl}/api/external/chat/stream`,{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":this.apiKey},body:JSON.stringify({message:e,sessionId:t?.sessionId,context:t?.context})});if(!n.ok){const e=await n.json().catch(()=>({}));throw new Error(e.message||`HTTP ${n.status}`)}const r=n.body?.getReader();if(!r)throw new Error("Streaming not supported");const a=new TextDecoder;let o,i="",s="",l=[];try{for(;;){const{done:e,value:n}=await r.read();if(e)break;i+=a.decode(n,{stream:!0});const c=i.split("\n");i=c.pop()||"";for(const e of c)if(e.startsWith("event: "));else if(e.startsWith("data: "))try{const n=JSON.parse(e.slice(6));void 0!==n.text?(s+=n.text,t.onToken?.(n.text)):void 0!==n.sources?(l=(n.sources||[]).map(od),t.onSources?.(l)):void 0!==n.sessionId&&(o=n.sessionId)}catch{}}t.onComplete?.({fullText:s,sessionId:o,sources:l})}catch(e){t.onError?.(e)}}async getGeneralDocs(e){const t=new URLSearchParams;e&&t.set("since",e);const n=`${this.baseUrl}/api/external/docs${t.toString()?"?"+t:""}`,r=await fetch(n,{headers:{"X-API-Key":this.apiKey}});if(!r.ok)throw new Error(`HTTP ${r.status}`);return(await r.json()).documents}async getStatus(){const e=await fetch(`${this.baseUrl}/api/external/status`,{headers:{"X-API-Key":this.apiKey}});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async health(){const e=await fetch(`${this.baseUrl}/api/external/health`);if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}}let sd,ld;const cd=new WeakMap,ud=new WeakMap,dd=new WeakMap,fd=new WeakMap,hd=new WeakMap;let pd={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return ud.get(e);if("objectStoreNames"===t)return e.objectStoreNames||dd.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return yd(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function md(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(ld||(ld=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(vd(this),t),yd(cd.get(this))}:function(...t){return yd(e.apply(vd(this),t))}:function(t,...n){const r=e.call(vd(this),t,...n);return dd.set(r,t.sort?t.sort():[t]),yd(r)}}function gd(e){return"function"==typeof e?md(e):(e instanceof IDBTransaction&&function(e){if(ud.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",o),e.removeEventListener("abort",o)},a=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",a),e.addEventListener("error",o),e.addEventListener("abort",o)});ud.set(e,t)}(e),t=e,(sd||(sd=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,pd):e);var t}function yd(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",a),e.removeEventListener("error",o)},a=()=>{t(yd(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",a),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&cd.set(t,e)}).catch(()=>{}),hd.set(t,e),t}(e);if(fd.has(e))return fd.get(e);const t=gd(e);return t!==e&&(fd.set(e,t),hd.set(t,e)),t}const vd=e=>hd.get(e);function bd(e,t,{blocked:n,upgrade:r,blocking:a,terminated:o}={}){const i=indexedDB.open(e,t),s=yd(i);return r&&i.addEventListener("upgradeneeded",e=>{r(yd(i.result),e.oldVersion,e.newVersion,yd(i.transaction),e)}),n&&i.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),s.then(e=>{o&&e.addEventListener("close",()=>o()),a&&e.addEventListener("versionchange",e=>a(e.oldVersion,e.newVersion,e))}).catch(()=>{}),s}const wd=["get","getKey","getAll","getAllKeys","count"],kd=["put","add","delete","clear"],Sd=new Map;function xd(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(Sd.get(t))return Sd.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,a=kd.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!a&&!wd.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,a?"readwrite":"readonly");let i=o.store;return r&&(i=i.index(t.shift())),(await Promise.all([i[n](...t),a&&o.done]))[0]};return Sd.set(t,o),o}pd=(e=>({...e,get:(t,n,r)=>xd(t,n)||e.get(t,n,r),has:(t,n)=>!!xd(t,n)||e.has(t,n)}))(pd);class Cd{constructor(e){this.db=null,this.dbPromise=null,this.documentCount=0,this.lastSyncAt=null,this.config=e,"indexeddb"===e.storage&&"undefined"!=typeof indexedDB?this.dbPromise=this.initDB():"localstorage"===e.storage&&this.loadLocalStorageMetadata()}loadLocalStorageMetadata(){try{const e=localStorage.getItem("cybernetic-cache-meta");if(e){const t=JSON.parse(e);this.documentCount=t.documentCount||0,this.lastSyncAt=t.lastSyncAt||null}}catch{}}async initDB(){return this.db=await bd("cybernetic-cache",1,{upgrade(e){if(!e.objectStoreNames.contains("documents")){e.createObjectStore("documents",{keyPath:"id"}).createIndex("by-updated","updatedAt")}e.objectStoreNames.contains("metadata")||e.createObjectStore("metadata",{keyPath:"key"})}}),await this.loadMetadata(),this.db}async getDB(){if(this.db)return this.db;if(this.dbPromise)return this.dbPromise;throw new Error("Database not available")}async loadMetadata(){if(!this.db)return;const e=await this.db.get("metadata","documentCount");this.documentCount=e?.value||0;const t=await this.db.get("metadata","lastSyncAt");this.lastSyncAt=t?.value||null}async store(e){if("localstorage"===this.config.storage)return this.storeLocalStorage(e);const t=(await this.getDB()).transaction(["documents","metadata"],"readwrite");for(const n of e)await t.objectStore("documents").put(n);this.documentCount=await t.objectStore("documents").count(),this.lastSyncAt=(new Date).toISOString(),await t.objectStore("metadata").put({key:"documentCount",value:this.documentCount}),await t.objectStore("metadata").put({key:"lastSyncAt",value:this.lastSyncAt}),await t.done}async retrieve(){if("localstorage"===this.config.storage)return this.retrieveLocalStorage();return(await this.getDB()).getAll("documents")}async getLastSync(){return this.lastSyncAt}getStatus(){const e=Date.now()-(this.lastSyncAt?new Date(this.lastSyncAt).getTime():0)>this.config.maxAge;return{documentCount:this.documentCount,lastSyncAt:this.lastSyncAt,cacheSize:5e3*this.documentCount,isStale:e}}async clear(){if("localstorage"===this.config.storage)return localStorage.removeItem("cybernetic-cache-docs"),localStorage.removeItem("cybernetic-cache-meta"),this.documentCount=0,void(this.lastSyncAt=null);const e=(await this.getDB()).transaction(["documents","metadata"],"readwrite");await e.objectStore("documents").clear(),await e.objectStore("metadata").clear(),await e.done,this.documentCount=0,this.lastSyncAt=null}storeLocalStorage(e){try{localStorage.setItem("cybernetic-cache-docs",JSON.stringify(e)),this.documentCount=e.length,this.lastSyncAt=(new Date).toISOString(),localStorage.setItem("cybernetic-cache-meta",JSON.stringify({documentCount:this.documentCount,lastSyncAt:this.lastSyncAt}))}catch{localStorage.removeItem("cybernetic-cache-docs");const t=e.slice(0,50);localStorage.setItem("cybernetic-cache-docs",JSON.stringify(t)),this.documentCount=t.length}}retrieveLocalStorage(){try{const e=localStorage.getItem("cybernetic-cache-docs");return e?JSON.parse(e):[]}catch{return[]}}}class Ed{constructor(){this.documents=[],this.idf=new Map,this.indexed=!1,this.loadedFromExport=!1,this.vocabulary=new Map}isIndexed(){return this.indexed&&this.documents.length>0}async index(e){this.documents=[],this.idf=new Map;const t=new Map;for(const n of e){if(!n.content)continue;const e=this.tokenize(n.content),r=new Set(e);for(const e of r)t.set(e,(t.get(e)||0)+1);this.documents.push({id:n.id,title:n.title,content:n.content,tokens:e,tfidf:new Map})}const n=e.length;for(const[e,r]of t)this.idf.set(e,Math.log((n+1)/(r+1))+1);for(const e of this.documents){const t=this.computeTermFrequency(e.tokens);for(const[n,r]of t){const t=this.idf.get(n)||1;e.tfidf.set(n,r*t)}}this.indexed=!0}async ask(e){if(!this.indexed||0===this.documents.length)return{answer:"I don't have any information available offline.",sources:[],topScore:0};const t=this.tokenize(e),n=this.computeTermFrequency(t),r=new Map;for(const[e,t]of n){const n=this.idf.get(e)||1;r.set(e,t*n)}const a=this.documents.map(e=>({doc:e,score:this.cosineSimilarity(r,e.tfidf)}));a.sort((e,t)=>t.score-e.score);const o=a.slice(0,3).filter(e=>e.score>.1);if(0===o.length)return{answer:"I couldn't find relevant information for your question in my offline data.",sources:[],topScore:a[0]?.score||0};const i=o[0].doc;return{answer:this.extractRelevantSnippet(i.content,t),sources:o.map(e=>({title:e.doc.title,snippet:e.doc.content.substring(0,200)+"...",score:e.score})),topScore:o[0].score}}reset(){this.documents=[],this.idf=new Map,this.vocabulary=new Map,this.indexed=!1,this.loadedFromExport=!1,this.exportVersion=void 0,this.exportedAt=void 0}async loadFromExport(e){this.reset(),this.idf=new Map(Object.entries(e.tfidfIndex.idf));let t=0;for(const e of this.idf.keys())this.vocabulary.set(e,t++);for(const t of e.documents){const e=new Map;for(const[n,r]of t.tfidfVector)for(const[t,a]of this.vocabulary)if(a===n){e.set(t,r);break}this.documents.push({id:t.id,title:t.title,content:t.content,tokens:[],tfidf:e})}this.indexed=!0,this.loadedFromExport=!0,this.exportVersion=e.version,this.exportedAt=e.meta.exportedAt,console.log(`[CyberneticLocalRAG] Loaded ${this.documents.length} documents from export (v${e.version})`)}getExportStatus(){return{loaded:this.indexed,loadedFromExport:this.loadedFromExport,documentCount:this.documents.length,chunkCount:this.documents.length,exportVersion:this.exportVersion,exportedAt:this.exportedAt}}tokenize(e){return e&&"string"==typeof e?e.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(e=>e.length>2&&!this.isStopWord(e)):[]}computeTermFrequency(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)||0)+1);const n=Math.max(...t.values());if(n>0)for(const[e,r]of t)t.set(e,r/n);return t}cosineSimilarity(e,t){let n=0,r=0,a=0;for(const[a,o]of e){n+=o*(t.get(a)||0),r+=o*o}for(const e of t.values())a+=e*e;return 0===r||0===a?0:n/(Math.sqrt(r)*Math.sqrt(a))}extractRelevantSnippet(e,t){const n=e.split(/[.!?]+/).filter(e=>e.trim().length>0).map(e=>{const n=new Set(this.tokenize(e));let r=0;for(const e of t)n.has(e)&&r++;return{sentence:e.trim(),score:r}});n.sort((e,t)=>t.score-e.score);const r=n.slice(0,3).filter(e=>e.score>0);return 0===r.length?e.substring(0,300)+"...":r.map(e=>e.sentence).join(". ")+"."}isStopWord(e){return new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","from","up","about","into","through","during","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","this","that","these","those","it","its","they","them","their","what","which","who","whom","when","where","why","how","all","each","every","both","few","more","most","other","some","such","no","not","only","same","so","than","too","very"]).has(e)}}class _d{constructor(){this.db=null,this.dbPromise=null,this.dbName="cybernetic-offline-vectors",this.dbVersion=1}async initDB(){return this.db?this.db:this.dbPromise?this.dbPromise:(this.dbPromise=bd(this.dbName,this.dbVersion,{upgrade(e){e.objectStoreNames.contains("vectors")||e.createObjectStore("vectors",{keyPath:"id"})}}),this.db=await this.dbPromise,this.db)}async store(e,t){const n=await this.getDB();await n.put("vectors",{id:e,exportVersion:t.version,exportedAt:t.meta.exportedAt,type:t.type,data:t}),console.log(`[CyberneticOfflineStorage] Stored ${t.meta.chunkCount} chunks`)}async retrieve(e){const t=await this.getDB(),n=await t.get("vectors",e);return n?.data??null}async isValid(e,t){const n=await this.getDB(),r=await n.get("vectors",e);if(!r)return!1;const a=new Date(r.exportedAt).getTime();return Date.now()-a<t}async getMeta(e){const t=await this.getDB(),n=await t.get("vectors",e);return n?{version:n.exportVersion,exportedAt:n.exportedAt,documentCount:n.data.meta.documentCount,chunkCount:n.data.meta.chunkCount,type:n.type}:null}async hasData(){const e=await this.getDB();return await e.count("vectors")>0}async getStoredIds(){return(await this.getDB()).getAllKeys("vectors")}async delete(e){const t=await this.getDB();await t.delete("vectors",e)}async clear(){const e=await this.getDB();await e.clear("vectors"),console.log("[CyberneticOfflineStorage] Cache cleared")}async getDB(){return this.db?this.db:this.initDB()}close(){this.db&&(this.db.close(),this.db=null,this.dbPromise=null)}}function Md(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=t.length%4;n&&(t+="=".repeat(4-n));const r=atob(t),a=new Uint8Array(r.length);for(let e=0;e<r.length;e++)a[e]=r.charCodeAt(e);return a}function Ld(e){const t=Md(e);return(new TextDecoder).decode(t)}async function Rd(e,t,n){try{const r=await async function(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return crypto.subtle.importKey("spki",r.buffer,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])}(n),a=(new TextEncoder).encode(e),o=new Uint8Array(t).buffer;return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},r,o,a)}catch(e){return console.warn("[License] Signature verification failed:",e),!1}}async function Ad(e,t){if(!e||""===e.trim())return{status:"missing",payload:null,error:"No license key provided",inGracePeriod:!1,daysRemaining:null};const n=function(e){try{const t=e.split(".");if(3!==t.length)return null;const[n,r,a]=t;return{header:JSON.parse(Ld(n)),payload:JSON.parse(Ld(r)),signature:Md(a),signedContent:`${n}.${r}`}}catch{return null}}(e);if(!n)return{status:"invalid",payload:null,error:"Invalid license key format",inGracePeriod:!1,daysRemaining:null};const r=function(e){return"string"!=typeof e.iss||"string"!=typeof e.sub||"string"!=typeof e.aud||"number"!=typeof e.iat||"number"!=typeof e.exp||"string"!=typeof e.plan||"number"!=typeof e.seats?null:Array.isArray(e.features)?"number"!=typeof e.licenseVersion?null:{iss:e.iss,sub:e.sub,aud:e.aud,iat:e.iat,exp:e.exp,plan:e.plan,org:"string"==typeof e.org?e.org:void 0,seats:e.seats,features:e.features,graceUntil:"number"==typeof e.graceUntil?e.graceUntil:void 0,licenseVersion:e.licenseVersion}:null}(n.payload);if(!r)return{status:"invalid",payload:null,error:"Invalid license payload structure",inGracePeriod:!1,daysRemaining:null};if("astermind"!==r.iss)return{status:"invalid",payload:null,error:"Invalid license issuer",inGracePeriod:!1,daysRemaining:null};if("cybernetic-chatbot"!==r.aud&&"*"!==r.aud)return{status:"invalid",payload:null,error:"License not valid for this product",inGracePeriod:!1,daysRemaining:null};if("undefined"!=typeof crypto&&crypto.subtle){const e=t||"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhLW7MXHQ0Fuk1OKt9D5CbRw7fUMN\nLJ5AZXvOhHaXdHzMuYKX5BpK4w7TqbPvJ6QPvKmLKvHh1VKcUJ6mJQgJJw==\n-----END PUBLIC KEY-----";if(!await Rd(n.signedContent,n.signature,e))return{status:"invalid",payload:null,error:"License signature verification failed",inGracePeriod:!1,daysRemaining:null}}const a=Math.floor(Date.now()/1e3),o=function(e){const t=e-Math.floor(Date.now()/1e3);return Math.floor(t/86400)}(r.exp);return r.exp<a?r.graceUntil&&r.graceUntil>a?{status:"valid",payload:r,inGracePeriod:!0,daysRemaining:o}:{status:"expired",payload:r,error:"License has expired",inGracePeriod:!1,daysRemaining:o}:"eval"===r.plan?{status:"eval",payload:r,inGracePeriod:!1,daysRemaining:o}:{status:"valid",payload:r,inGracePeriod:!1,daysRemaining:o}}const Pd="cybernetic-chatbot-client",Nd="agentic";class Dd{constructor(e={}){this.state=null,this.verificationPromise=null,this.hasLoggedWarning=!1,this.loggedMissingFeatures=new Set,this.config=e,this.environment=e.environment||function(){if("undefined"==typeof window)return"production"===process?.env?.NODE_ENV?"production":"development";const e=window.location?.hostname||"",t=["localhost","127.0.0.1","0.0.0.0",".local",".dev",".test",":3000",":5173",":8080",":4200"];for(const n of t)if(e.includes(n)||window.location?.port===n.replace(":",""))return"development";if("file:"===window.location?.protocol)return"development";const n=["staging.","preview.","-preview.",".vercel.app",".netlify.app",".pages.dev"];for(const t of n)if(e.includes(t))return"production";return"production"}(),this.enforcementMode="development"===this.environment?"soft":"hard"}async verify(){if(this.state)return this.state;if(this.verificationPromise)return this.verificationPromise;this.verificationPromise=Ad(this.config.licenseKey,this.config.publicKey);try{return this.state=await this.verificationPromise,this.config.onStatusChange?.(this.state),this.logLicenseStatus(),this.state}finally{this.verificationPromise=null}}getState(){return this.state}isValid(){return!!this.state&&("valid"===this.state.status||"eval"===this.state.status)}requiresAction(){return!this.state||("expired"===this.state.status||"missing"===this.state.status||"invalid"===this.state.status)}getEnvironment(){return this.environment}getEnforcementMode(){return this.enforcementMode}processResponse(e){return this.state?this.isValid()&&!this.state.inGracePeriod?e:"soft"===this.enforcementMode?(this.hasLoggedWarning||(this.logDevelopmentWarning(),this.hasLoggedWarning=!0),e):e+"\n\n---\n⚠️ License Notice: Your AsterMind license key needs to be updated. Please contact support@astermind.ai or visit https://astermind.ai/license to renew your license.":e}getStatusMessage(){if(!this.state)return"License not verified";switch(this.state.status){case"valid":return this.state.inGracePeriod?`License expired but in grace period (${Math.abs(this.state.daysRemaining||0)} days overdue)`:`License valid (${this.state.daysRemaining} days remaining)`;case"eval":return`Evaluation license (${this.state.daysRemaining} days remaining)`;case"expired":return`License expired ${Math.abs(this.state.daysRemaining||0)} days ago`;case"missing":return"No license key provided";case"invalid":return`Invalid license: ${this.state.error}`;default:return"Unknown license status"}}async reVerify(){return this.state=null,this.hasLoggedWarning=!1,this.loggedMissingFeatures.clear(),this.verify()}hasFeature(e){return!!this.state?.payload&&this.state.payload.features.includes(e)}getFeatures(){return this.state?.payload?.features||[]}checkClientFeature(){return this.checkFeatureWithLog(Pd,"CyberneticClient")}checkAgenticFeature(){return this.checkFeatureWithLog(Nd,"Agentic capabilities")}checkFeatureWithLog(e,t){if(!this.state?.payload)return!0;const n=this.state.payload.features.includes(e);return n||this.loggedMissingFeatures.has(e)||(this.loggedMissingFeatures.add(e),this.logMissingFeature(e,t)),n}logMissingFeature(e,t){const n=this.getFeatures(),r=this.state?.payload?.plan||"unknown";console.warn(`[Cybernetic License] ${t} requires the '${e}' feature, which is not included in your license.`),console.info(`[Cybernetic License] Current license plan: ${r}`),console.info(`[Cybernetic License] Licensed features: ${n.length>0?n.join(", "):"(none)"}`),console.info("[Cybernetic License] To add this feature, upgrade your license at https://astermind.ai/license")}logLicenseStatus(){if(!this.state)return;const e="[Cybernetic License]";switch(this.state.status){case"valid":this.state.inGracePeriod?console.warn(`${e} License expired but in grace period. Please renew at https://astermind.ai/license`):null!==this.state.daysRemaining&&this.state.daysRemaining<=30&&console.info(`${e} License expires in ${this.state.daysRemaining} days`);break;case"eval":console.info(`${e} Evaluation license - ${this.state.daysRemaining} days remaining`);break;case"expired":console.error(`${e} License expired. Enforcement mode: ${this.enforcementMode}. Renew at https://astermind.ai/license`);break;case"missing":console.warn(`${e} No license key provided. Enforcement mode: ${this.enforcementMode}. Get a license at https://astermind.ai/license`);break;case"invalid":console.error(`${e} Invalid license: ${this.state.error}. Enforcement mode: ${this.enforcementMode}`)}}logDevelopmentWarning(){console.warn(`[Cybernetic License] Running in development mode with ${this.state?.status||"unknown"} license. In production, a warning will be appended to chatbot responses. Get a license at https://astermind.ai/license`)}}class Td{constructor(e){this.status="connecting",this.lastError=null,this.systemSettings=null,this.settingsLastChecked=0,this.SETTINGS_CHECK_INTERVAL=3e5,this.agenticCapabilities=null,this.offlineStorage=null,this.omegaRAG=null,this.offlineWarningShown=!1,this.config={apiUrl:e.apiUrl,apiKey:e.apiKey,fallback:{enabled:e.fallback?.enabled??!0,cacheMaxAge:e.fallback?.cacheMaxAge??864e5,cacheOnConnect:e.fallback?.cacheOnConnect??!0,cacheStorage:e.fallback?.cacheStorage??"indexeddb"},retry:{maxRetries:e.retry?.maxRetries??2,initialDelay:e.retry?.initialDelay??1e3,exponentialBackoff:e.retry?.exponentialBackoff??!0},agentic:e.agentic??null,offline:e.offline??null,sitemap:e.sitemap??null,sources:{enabled:e.sources?.enabled??!0,showSummary:e.sources?.showSummary??!0,showDownload:e.sources?.showDownload??!0,includeFullContent:e.sources?.includeFullContent??!1,maxSources:e.sources?.maxSources??5},onStatusChange:e.onStatusChange||(()=>{}),onError:e.onError||(()=>{})},this.apiClient=new id(this.config.apiUrl,this.config.apiKey),this.cache=new Cd({storage:this.config.fallback.cacheStorage,maxAge:this.config.fallback.cacheMaxAge}),this.localRAG=new Ed,this.licenseManager=new Dd({licenseKey:e.licenseKey}),this.licenseManager.verify().then(()=>{this.licenseManager.checkClientFeature()}).catch(()=>{}),this.monitorConnection(),this.config.fallback.enabled&&this.config.fallback.cacheOnConnect&&this.syncCache().catch(()=>{}),this.config.offline?.enabled&&this.initializeOffline(this.config.offline).catch(e=>{console.warn("[Cybernetic] Failed to initialize offline vectors:",e)})}registerAgentic(e){this.agenticCapabilities=e,console.log("[Cybernetic] Agentic capabilities registered")}isAgenticEnabled(){return null!==this.agenticCapabilities&&!0===this.config.agentic?.enabled&&(this.licenseManager.checkAgenticFeature(),!0)}getAgenticCapabilities(){return this.agenticCapabilities}getAgenticConfig(){return this.config.agentic}getSourcesConfig(){return{...this.config.sources}}isSourceFeatureAvailable(e){return!!this.config.sources.enabled&&("summary"===e?this.config.sources.showSummary:"download"===e&&(this.config.sources.showDownload&&"online"===this.status))}classifyIntent(e){if(!this.isAgenticEnabled()||!this.agenticCapabilities)return null;const t=this.config.agentic;return new(0,this.agenticCapabilities.agent)(t).interpretIntent(e)}async executeAction(e){if(!this.isAgenticEnabled()||!this.agenticCapabilities)return{success:!1,message:"Agentic capabilities not enabled"};const t=this.config.agentic;return new(0,this.agenticCapabilities.agent)(t).executeAction(e)}async smartAsk(e,t){const n=this.classifyIntent(e);if(n&&n.action&&!n.shouldEscalate){if(!1!==this.config.agentic?.requireConfirmation)return{action:n.action};const e=await this.executeAction(n.action);return{action:n.action,actionResult:e}}return{response:await this.ask(e,t)}}async initializeOffline(e){const t=e.storageMode??"hybrid",n=e.cacheMaxAge??6048e5;if("memory"!==t&&(this.offlineStorage=new _d),this.offlineStorage&&"memory"!==t){const e="default";if(await this.offlineStorage.isValid(e,n)){console.log("[Cybernetic] Loading vectors from IndexedDB cache");const t=await this.offlineStorage.retrieve(e);if(t)return await this.localRAG.loadFromExport(t),void console.log("[Cybernetic] Loaded vectors from IndexedDB cache")}}if(e.vectorFileUrl)try{const n=await fetch(e.vectorFileUrl);if(!n.ok)throw new Error(`Failed to fetch vectors: ${n.status}`);const r=await n.json();return this.offlineStorage&&"memory"!==t&&await this.offlineStorage.store("default",r),await this.localRAG.loadFromExport(r),e.omega?.enabled&&await this.initializeOmega(e),void console.log("[Cybernetic] Loaded vectors from URL:",e.vectorFileUrl)}catch(e){console.error("[Cybernetic] Failed to load offline vectors from URL:",e)}if(e.vectorData)return await this.localRAG.loadFromExport(e.vectorData),e.omega?.enabled&&await this.initializeOmega(e),void console.log("[Cybernetic] Loaded inline vector data");this.offlineWarningShown||(console.warn("[Cybernetic] Offline functionality is enabled but no vectors are loaded. Offline responses will be limited. To enable full offline functionality, export vectors from the AsterMind admin panel and configure the vectorFileUrl or vectorData option."),this.offlineWarningShown=!0)}async initializeOmega(e){if(e.omega?.enabled)try{const{OmegaOfflineRAG:t}=await Promise.resolve().then(function(){return vf});this.omegaRAG=new t({reranking:e.omega.reranking,topK:5,verbose:!1}),e.omega.modelUrl?await this.omegaRAG.loadModelFromUrl(e.omega.modelUrl):e.omega.modelData&&await this.omegaRAG.loadModel(e.omega.modelData),console.log("[Cybernetic] Omega RAG initialized")}catch(e){console.warn("[Cybernetic] Failed to initialize Omega RAG:",e),this.omegaRAG=null}}async reloadOfflineVectors(){this.config.offline?.enabled?(this.localRAG.reset(),this.offlineStorage&&await this.offlineStorage.clear(),this.omegaRAG&&this.omegaRAG.clear(),await this.initializeOffline(this.config.offline)):console.warn("[Cybernetic] Offline mode is not enabled")}isOmegaOfflineEnabled(){return this.omegaRAG?.isReady()??!1}getOfflineModelInfo(){return this.omegaRAG?.getModelInfo()??null}getLocalRAGStatus(){return this.localRAG.getExportStatus()}getOfflineStorage(){return this.offlineStorage}async ask(e,t){if(!e||"string"!=typeof e)return this.createErrorResponse("Message is required","none");const n=await this.checkSystemStatus();if(n.maintenanceMode||n.forceOfflineClients)return console.log("[Cybernetic] Maintenance mode active, using cached data"),this.isCacheValid()?await this.fallbackAsk(e):{reply:n.maintenanceMessage||"The service is currently under maintenance. Please try again later.",confidence:"none",sources:[],offline:!0,degradedReason:"Maintenance mode active, no valid cache available"};try{const n=await this.apiWithRetry(e,t);this.setStatus("online");return{reply:this.licenseManager.processResponse(n.reply),confidence:"high",sources:n.sources||[],offline:!1,sessionId:n.sessionId}}catch(n){const r=this.normalizeError(n);return this.lastError=r,this.config.onError(r),"RATE_LIMIT"===r.code?{reply:"I'm receiving too many requests right now. Please try again in a moment.",confidence:"none",sources:[],offline:!1,retryAfter:r.retryAfter}:this.config.fallback.enabled&&!t?.skipFallback?await this.fallbackAsk(e):this.createErrorResponse("Unable to connect to the chatbot service. Please try again later.","none",r.retryAfter)}}async askStream(e,t,n){if(!e||"string"!=typeof e)return void t.onError?.({code:"LOCAL_RAG_ERROR",message:"Message is required"});const r=await this.checkSystemStatus();if(r.maintenanceMode||r.forceOfflineClients){console.log("[Cybernetic] Maintenance mode active, falling back to offline");const n=await this.fallbackAsk(e);return void t.onComplete?.(n)}try{await this.apiClient.chatStream(e,{sessionId:n?.sessionId,context:n?.context,onToken:t.onToken,onSources:t.onSources,onComplete:e=>{this.setStatus("online");const n=this.licenseManager.processResponse(e.fullText);t.onComplete?.({reply:n,confidence:"high",sources:e.sources||[],offline:!1,sessionId:e.sessionId})},onError:e=>{const n=this.normalizeError(e);this.config.onError(n),t.onError?.(n)}})}catch(r){const a=this.normalizeError(r);if(this.lastError=a,this.config.onError(a),this.config.fallback.enabled&&!n?.skipFallback){const n=await this.fallbackAsk(e);t.onComplete?.(n)}else t.onError?.(a)}}async syncCache(){try{const e=await this.cache.getLastSync(),t=await this.apiClient.getGeneralDocs(e);t.length>0&&(await this.cache.store(t),await this.localRAG.index(t),console.log(`[Cybernetic] Cache synced: ${t.length} documents`)),this.setStatus("online")}catch(e){console.warn("[Cybernetic] Cache sync failed:",e)}}getStatus(){return{connection:this.status,cache:this.cache.getStatus(),lastError:this.lastError,systemSettings:this.systemSettings,license:this.licenseManager.getState()}}getLicenseManager(){return this.licenseManager}async clearCache(){await this.cache.clear(),this.localRAG.reset()}async checkConnection(){try{return await this.apiClient.getStatus(),this.setStatus("online"),!0}catch{return this.setStatus("offline"),!1}}async checkSystemStatus(){if(this.systemSettings&&Date.now()-this.settingsLastChecked<this.SETTINGS_CHECK_INTERVAL)return this.systemSettings;try{const e=await this.apiClient.getStatus();return this.systemSettings={cacheRetentionHours:e.systemSettings?.cacheRetentionHours??168,maintenanceMode:e.systemSettings?.maintenanceMode??!1,maintenanceMessage:e.systemSettings?.maintenanceMessage,forceOfflineClients:e.systemSettings?.forceOfflineClients??!1},this.settingsLastChecked=Date.now(),this.systemSettings}catch{return this.systemSettings||{cacheRetentionHours:168,maintenanceMode:!1,forceOfflineClients:!1}}}isMaintenanceMode(){return this.systemSettings?.maintenanceMode??!1}getMaintenanceMessage(){return this.systemSettings?.maintenanceMessage}isCacheValid(){const e=this.cache.getStatus();if(!e.lastSyncAt)return!1;const t=60*(this.systemSettings?.cacheRetentionHours||168)*60*1e3,n=new Date(e.lastSyncAt).getTime();return Date.now()-n<t}async apiWithRetry(e,t){const{maxRetries:n,initialDelay:r,exponentialBackoff:a}=this.config.retry;let o=null;for(let i=0;i<=n;i++)try{return await this.apiClient.chat(e,{sessionId:t?.sessionId,context:t?.context})}catch(e){o=e;const t=this.normalizeError(e);if("AUTH_ERROR"===t.code||"RATE_LIMIT"===t.code)throw e;if(i<n){const e=a?r*Math.pow(2,i):r;await this.sleep(e)}}throw o}async fallbackAsk(e){if(this.setStatus("offline"),this.omegaRAG?.isReady())try{const t=await this.omegaRAG.ask(e);if(!t.degraded){return{reply:this.licenseManager.processResponse(t.answer),confidence:t.confidence,sources:t.sources.map(e=>({title:e.heading,snippet:e.content.substring(0,200)+"...",relevance:e.score})),offline:!0,degradedReason:"Omega hybrid retrieval (offline)"}}}catch(e){console.warn("[Cybernetic] Omega RAG failed, falling back to TF-IDF:",e)}const t=this.localRAG.getExportStatus();if(t.loaded&&t.documentCount>0)try{const n=await this.localRAG.ask(e);let r="medium";n.topScore<.3?r="low":n.topScore>.7&&(r="medium");return{reply:this.licenseManager.processResponse(n.answer),confidence:r,sources:n.sources.map(e=>({title:e.title,snippet:e.snippet,relevance:e.score})),offline:!0,degradedReason:t.loadedFromExport?"Using pre-exported vectors (offline)":"Processed locally with TF-IDF"}}catch(e){console.error("[Cybernetic] Local RAG error:",e)}const n=this.cache.getStatus();if(0===n.documentCount&&!t.loaded)return{reply:"I'm currently offline and don't have any cached information. Please check your connection and try again.",confidence:"none",sources:[],offline:!0,degradedReason:"No cached documents or offline vectors available"};try{const t=await this.cache.retrieve();this.localRAG.isIndexed()||await this.localRAG.index(t);const r=await this.localRAG.ask(e);let a="medium";r.topScore<.3?a="low":r.topScore>.7&&(a="medium");return{reply:this.licenseManager.processResponse(r.answer),confidence:a,sources:r.sources.map(e=>({title:e.title,snippet:e.snippet,relevance:e.score})),offline:!0,degradedReason:n.isStale?"Using stale cached data":"Processed locally without server"}}catch(e){return console.error("[Cybernetic] Local RAG error:",e),{reply:"I'm having trouble processing your request offline. Please try again when you're back online.",confidence:"none",sources:[],offline:!0,degradedReason:"Local RAG processing failed"}}}monitorConnection(){"undefined"!=typeof window&&(window.addEventListener("online",()=>{this.syncCache().catch(()=>{})}),window.addEventListener("offline",()=>{this.setStatus("offline")}),navigator.onLine||this.setStatus("offline"))}setStatus(e){this.status!==e&&(this.status=e,this.config.onStatusChange(e))}normalizeError(e){if(e instanceof Error){if(e.message.includes("401")||e.message.includes("Unauthorized"))return{code:"AUTH_ERROR",message:"Invalid or expired API key",originalError:e};if(e.message.includes("429")||e.message.includes("Rate limit")){const t=e.message.match(/retry after (\d+)/i);return{code:"RATE_LIMIT",message:"Rate limit exceeded",retryAfter:t?parseInt(t[1],10):60,originalError:e}}return e.message.includes("5")||e.message.includes("Server")?{code:"SERVER_ERROR",message:"Server error occurred",originalError:e}:{code:"NETWORK_ERROR",message:e.message||"Network error",originalError:e}}return{code:"NETWORK_ERROR",message:"Unknown error occurred"}}createErrorResponse(e,t,n){return{reply:e,confidence:t,sources:[],offline:!1,retryAfter:n}}sleep(e){return new Promise(t=>setTimeout(t,e))}}const Id=["nav a[href]",'[role="navigation"] a[href]',"header a[href]",".nav a[href]",".navbar a[href]",".navigation a[href]",".sidebar a[href]",".side-nav a[href]",".sidenav a[href]",".menu a[href]",".main-menu a[href]",".top-menu a[href]","[data-nav] a[href]","[data-menu] a[href]","[data-navigation] a[href]",'[aria-label*="navigation" i] a[href]','[aria-label*="menu" i] a[href]','[aria-label*="breadcrumb" i] a[href]',".breadcrumb a[href]",".breadcrumbs a[href]",'a[href^="/"]'],zd=["/login","/logout","/signin","/signout","/sign-in","/sign-out","/register","/signup","/sign-up","/forgot-password","/reset-password","/auth/*","/oauth/*","/callback/*","/sso/*","/api/*","/_next/*","/_nuxt/*","/__*","javascript:*","mailto:*","tel:*","#*"];class Fd{constructor(e,t,n){this.staticEntries=[],this.discoveredEntries=[],this.backendEntries=[],this.backendCache=null,this.isInitialized=!1,this.initPromise=null,this.detectedFramework="generic",this.popstateHandler=null,this.config=e,this.apiUrl=t,this.apiKey=n,e.static&&(this.staticEntries=this.enhanceEntries(e.static,"props"))}async initialize(){if(!this.isInitialized){if(this.initPromise)return this.initPromise;this.initPromise=this.performInitialization(),await this.initPromise,this.isInitialized=!0}}async performInitialization(){await this.waitForDOMReady();const e=this.loadFromLocalStorage();if(e)return this.discoveredEntries=e,console.log(`[SiteMapDiscovery] Loaded ${e.length} entries from cache`),void this.refreshInBackground();const t=[];!1!==this.config.discovery?.enabled&&t.push(this.discoverFromFramework()),!1!==this.config.backend?.enabled&&this.config.backend?.endpoint&&t.push(this.fetchFromBackend());const n=await Promise.allSettled(t);for(const e of n)if("fulfilled"===e.status){const{entries:t,source:n}=e.value;"discovery"===n?(this.discoveredEntries=t,this.saveToLocalStorage(t)):"backend"===n&&(this.backendEntries=t)}else console.warn("[SiteMapDiscovery] Source failed:",e.reason);this.setupPopstateListener();const r=this.staticEntries.length+this.discoveredEntries.length+this.backendEntries.length;console.log(`[SiteMapDiscovery] Initialized with ${r} total entries (${this.staticEntries.length} static, ${this.discoveredEntries.length} discovered, ${this.backendEntries.length} backend)`)}async waitForDOMReady(){if("undefined"!=typeof document){if("complete"!==document.readyState&&"interactive"!==document.readyState)return new Promise(e=>{document.addEventListener("DOMContentLoaded",()=>e(),{once:!0})});await new Promise(e=>setTimeout(e,0))}}setupPopstateListener(){"undefined"!=typeof window&&(this.popstateHandler=()=>{setTimeout(()=>{this.refreshInBackground()},100)},window.addEventListener("popstate",this.popstateHandler))}async refreshInBackground(){try{const e=await this.discoverFromFramework();e.entries.length>0&&(this.discoveredEntries=e.entries,this.saveToLocalStorage(e.entries))}catch(e){console.debug("[SiteMapDiscovery] Background refresh failed:",e)}}getCacheKey(){return"undefined"==typeof window?"astermind-sitemap":`astermind-sitemap-${window.location.origin}`}loadFromLocalStorage(){if("undefined"==typeof localStorage)return null;try{const e=this.getCacheKey(),t=localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);if("1"!==n.version)return localStorage.removeItem(e),null;const r=this.config.discovery?.cacheTtl??3e5;return Date.now()-n.timestamp>r?(localStorage.removeItem(e),null):(this.detectedFramework=n.framework,n.entries)}catch(e){return console.debug("[SiteMapDiscovery] Failed to load from cache:",e),null}}saveToLocalStorage(e){if("undefined"!=typeof localStorage&&!1!==this.config.discovery?.cacheRoutes)try{const t=this.getCacheKey(),n={entries:e,url:"undefined"!=typeof window?window.location.href:"",timestamp:Date.now(),framework:this.detectedFramework,version:"1"};localStorage.setItem(t,JSON.stringify(n))}catch(e){console.debug("[SiteMapDiscovery] Failed to save to cache:",e)}}clearCache(){"undefined"!=typeof localStorage&&localStorage.removeItem(this.getCacheKey())}dispose(){this.popstateHandler&&"undefined"!=typeof window&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null)}getDetectedFramework(){return this.detectedFramework}getMergedEntries(){return this.mergeEntries(this.staticEntries,this.discoveredEntries,this.backendEntries)}getLegacyEntries(){return this.getMergedEntries().map(e=>({path:e.path,name:e.name,description:e.description,params:e.params,dynamicParams:e.dynamicParams,aliases:e.aliases}))}async discoverFromFramework(){const e=this.config.discovery||{},t=[];try{const n=e.framework||this.detectFramework();this.detectedFramework=n;let r=[];switch(n){case"react-router":r=this.discoverReactRouter();break;case"vue-router":r=this.discoverVueRouter();break;case"next":r=this.discoverNextRoutes();break;case"angular":r=this.discoverAngularRoutes();break;default:!1!==e.domFallback&&(r=this.discoverFromDOM(e.navSelectors))}for(const n of r){if(this.shouldExcludeRoute(n.path,e.excludePaths))continue;let r;r=e.transformRoute?e.transformRoute(n):this.defaultRouteTransform(n),r&&t.push(this.enhanceEntry(r,"discovery"))}console.log(`[SiteMapDiscovery] Discovered ${t.length} routes from ${n}`)}catch(e){return console.warn("[SiteMapDiscovery] Framework discovery failed:",e),{entries:[],source:"discovery",timestamp:Date.now(),error:String(e)}}return{entries:t,source:"discovery",timestamp:Date.now()}}detectFramework(){if("undefined"==typeof window)return"generic";const e=window;return e.__REACT_ROUTER_DATA_ROUTER__||e.__reactRouterContext?"react-router":e.__VUE_ROUTER__||e.__VUE_APP__?.$router?"vue-router":e.__NEXT_DATA__?"next":e.ng||document.querySelector("[ng-version]")?"angular":"generic"}discoverReactRouter(){const e=[];if("undefined"==typeof window)return e;const t=window.__REACT_ROUTER_DATA_ROUTER__;return t?.routes?(this.extractRoutesFromConfig(t.routes,e,""),e):e}extractRoutesFromConfig(e,t,n){for(const r of e){const e=this.normalizePath(n,r.path||""),a={path:e,name:r.handle?.name||r.handle?.title||r.id,meta:r.handle||{},children:[]};(r.path||r.index)&&t.push(a),r.children&&this.extractRoutesFromConfig(r.children,t,e)}}discoverVueRouter(){const e=[];if("undefined"==typeof window)return e;const t=window,n=t.__VUE_APP__,r=n?.$router||t.__VUE_ROUTER__;if(r?.getRoutes){const t=r.getRoutes();for(const n of t)e.push({path:n.path,name:n.name?.toString(),meta:n.meta||{},component:n.components?.default?.name})}return e}discoverNextRoutes(){const e=[];if("undefined"==typeof window)return e;const t=window.__NEXT_DATA__;if(!t)return e;const n=t.buildManifest?.pages||{};for(const t of Object.keys(n))t.startsWith("/_")||e.push({path:t,name:this.pathToName(t)});return e}discoverAngularRoutes(){return[]}discoverFromDOM(e){const t=[];if("undefined"==typeof document)return t;const n=e||Id,r=this.config.discovery?.maxDomLinks??200,a=this.config.discovery?.excludePaths||[],o=[...zd,...a],i=new Set;let s=0;for(const e of n){if(s>=r)break;try{const n=document.querySelectorAll(e);for(const e of n){if(s>=r)break;const n=e.getAttribute("href");if(!n)continue;if(n.startsWith("http")&&!n.startsWith(window.location.origin))continue;let a=n;if(n.startsWith("http"))try{a=new URL(n).pathname}catch{continue}else n.startsWith("/")||(a=`/${n}`);const l=a.split("?")[0].split("#")[0];i.has(l)||"/"!==l&&(this.shouldExcludeRoute(l,o)||(i.add(l),s++,t.push({path:l,name:e.textContent?.trim()||this.pathToName(l)})))}}catch(e){}}return console.log(`[SiteMapDiscovery] DOM scan found ${t.length} routes (limit: ${r})`),t}async fetchFromBackend(){const e=this.config.backend||{},t=e.endpoint||"/api/external/sitemap";if(this.backendCache&&Date.now()<this.backendCache.expiresAt)return{entries:this.backendCache.entries,source:"backend",timestamp:this.backendCache.fetchedAt};try{const n=new URL(t,this.apiUrl);!1!==e.tenantScoped&&n.searchParams.set("tenantScoped","true"),!1!==e.includeGeneral&&n.searchParams.set("includeGeneral","true");const r=await fetch(n.toString(),{method:"GET",headers:{"X-API-Key":this.apiKey,"Content-Type":"application/json",...e.headers}});if(!r.ok)throw new Error(`Backend sitemap fetch failed: ${r.status}`);const a=await r.json(),o=this.transformBackendResponse(a),i=e.cacheTtl||3e5;return this.backendCache={entries:o,fetchedAt:Date.now(),expiresAt:Date.now()+i},console.log(`[SiteMapDiscovery] Loaded ${o.length} routes from backend`),{entries:o,source:"backend",timestamp:Date.now()}}catch(e){return console.warn("[SiteMapDiscovery] Backend fetch failed:",e),{entries:this.backendCache?.entries||[],source:"backend",timestamp:Date.now(),error:String(e)}}}transformBackendResponse(e){return(Array.isArray(e)?e:e.entries||e.sitemap||e.routes||[]).map(e=>this.enhanceEntry({path:e.url||e.path,name:e.title||e.name,description:e.description,aliases:e.keywords||e.aliases,params:e.params,dynamicParams:e.dynamicParams},"backend"))}mergeEntries(...e){const t=this.config.merge||{},n=t.sourcePriority||["props","backend","discovery"],r=t.deduplication||"path",a=new Map;n.forEach((e,t)=>{a.set(e,n.length-t)});const o=[];for(const t of e)for(const e of t){const t=a.get(e._source||"props")||0;o.push({...e,_priority:t})}o.sort((e,t)=>(t._priority||0)-(e._priority||0));const i=new Map;for(const e of o){let n;switch(r){case"name":n=e.name.toLowerCase();break;case"both":n=`${e.path}|${e.name.toLowerCase()}`;break;default:n=this.normalizePath("",e.path)}if(i.has(n)){if(!1!==t.keepNonConflicting){const t=i.get(n);!t.description&&e.description&&(t.description=e.description),!t.aliases?.length&&e.aliases?.length&&(t.aliases=e.aliases)}}else i.set(n,e)}return Array.from(i.values())}enhanceEntries(e,t){return e.map(e=>this.enhanceEntry(e,t))}enhanceEntry(e,t){return{...e,_source:t,_discoveredAt:Date.now()}}defaultRouteTransform(e){return e.path&&"*"!==e.path&&"**"!==e.path?{path:e.path,name:e.name||e.meta?.title||this.pathToName(e.path),description:e.meta?.description,aliases:e.meta?.keywords||e.meta?.aliases,dynamicParams:e.path.includes(":")||e.path.includes("[")}:null}normalizePath(e,t){return t&&"/"!==t?t.startsWith("/")?t:e&&"/"!==e?`${e}/${t}`.replace(/\/+/g,"/"):`/${t}`:e||"/"}pathToName(e){const t=e.split("/").filter(Boolean);return(t[t.length-1]||"Home").replace(/[-_]/g," ").replace(/\[.*?\]/g,"").replace(/:/g,"").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ").trim()||"Page"}shouldExcludeRoute(e,t){if(!t?.length)return!1;for(const n of t){if(new RegExp("^"+n.replace(/\*/g,".*").replace(/\?/g,".")+"$").test(e))return!0}return!1}async refresh(){this.backendCache=null,this.isInitialized=!1,this.initPromise=null,await this.initialize()}isReady(){return this.isInitialized}getStats(){return{static:this.staticEntries.length,discovered:this.discoveredEntries.length,backend:this.backendEntries.length,merged:this.getMergedEntries().length}}}const Od={navigate:[{pattern:/^(go to|navigate to|take me to|open|show me|bring up)\s+(.+)/i,type:"navigate",weight:.9},{pattern:/^(i want to see|i need to go to|let me see)\s+(.+)/i,type:"navigate",weight:.85},{pattern:/^(where is|how do i get to)\s+(.+)/i,type:"navigate",weight:.6}],fillForm:[{pattern:/^(search for|find|look up|search)\s+(.+)/i,type:"fillForm",weight:.88},{pattern:/^(filter by|set .+ to|change .+ to)\s+(.+)/i,type:"fillForm",weight:.85},{pattern:/^(enter|type|put)\s+(.+)\s+(in|into)\s+(.+)/i,type:"fillForm",weight:.9}],clickElement:[{pattern:/^(click|press|hit|tap)\s+(the\s+)?(.+)\s+(button|link)/i,type:"clickElement",weight:.9},{pattern:/^(submit|send|confirm|save|cancel|delete)/i,type:"clickElement",weight:.85}],triggerModal:[{pattern:/^(open|show|display)\s+(the\s+)?(.+)\s+(modal|dialog|popup|window)/i,type:"triggerModal",weight:.9},{pattern:/^(open|show)\s+(help|settings|preferences|options)/i,type:"triggerModal",weight:.85}],scroll:[{pattern:/^(scroll to|jump to|go to)\s+(the\s+)?(.+)\s+(section|area|part)/i,type:"scroll",weight:.85},{pattern:/^(show me|take me to)\s+(the\s+)?(bottom|top|end|beginning)/i,type:"scroll",weight:.8}],highlight:[{pattern:/^(highlight|show me|point to|where is)\s+(the\s+)?(.+)/i,type:"highlight",weight:.7}],custom:[{pattern:/^(export|download|refresh|reload|sync)/i,type:"custom",weight:.85}]};class $d{constructor(e,t="",n=""){this.categories=[],this.topicKeywords=new Map,this.siteMapDiscovery=null,this.config=e,this.siteMapIndex=new Map,this.formIndex=new Map,this.modalIndex=new Map,this.buildIndexes();const r=e.siteMapConfig??(e.enabled&&!e.siteMap?.length?{discovery:{enabled:!0}}:void 0);r&&(this.siteMapDiscovery=new Fd(r,t,n),!e.siteMapConfig&&e.enabled&&console.log("[CyberneticIntentClassifier] Zero-config mode: auto-discovery enabled"))}buildIndexes(){if(this.config.siteMap)for(const e of this.config.siteMap){const t=[e.name.toLowerCase(),e.path.toLowerCase(),...(e.aliases||[]).map(e=>e.toLowerCase())];for(const n of t)this.siteMapIndex.set(n,e)}if(this.config.forms)for(const[e,t]of Object.entries(this.config.forms)){const n=[e.toLowerCase(),t.name.toLowerCase(),...(t.aliases||[]).map(e=>e.toLowerCase())];for(const e of n)this.formIndex.set(e,t)}if(this.config.modals)for(const[e,t]of Object.entries(this.config.modals)){const n=[e.toLowerCase(),t.id.toLowerCase(),...(t.aliases||[]).map(e=>e.toLowerCase())];for(const e of n)this.modalIndex.set(e,t)}}classify(e){if(!this.config.enabled)return{action:null,shouldEscalate:!0,rawConfidence:0};const t=e.trim().toLowerCase();for(const[t,n]of Object.entries(Od))for(const{pattern:r,weight:a}of n){const n=e.match(r);if(n){const e=this.buildAction(t,n,a);if(e)return e}}const n=this.fuzzyMatchSiteMap(t);if(n)return n;const r=this.matchCustomAction(t);return r||{action:null,shouldEscalate:!0,rawConfidence:0,matchedPatterns:[]}}buildAction(e,t,n){const r=this.config.confidenceThreshold??.8;switch(e){case"navigate":{const e=this.extractTarget(t),a=this.findSiteMapMatch(e);if(a){const e=n*a.similarity;return{action:{id:`action-${Date.now()}`,type:"navigate",target:a.entry.path,confidence:e,explanation:`Navigate to ${a.entry.name}`},shouldEscalate:e<r,rawConfidence:e,matchedPatterns:["navigate",a.entry.name]}}break}case"fillForm":{const e=this.extractTarget(t),{field:a,value:o}=this.parseFormIntent(t);if(a){const e=.95*n;return{action:{id:`action-${Date.now()}`,type:"fillForm",target:a.selector,params:{value:o},confidence:e,explanation:`Fill "${a.name}" with "${o}"`},shouldEscalate:e<r,rawConfidence:e,matchedPatterns:["fillForm",a.name]}}if(this.config.forms?.search){const t=.9*n;return{action:{id:`action-${Date.now()}`,type:"fillForm",target:this.config.forms.search.selector,params:{value:e},confidence:t,explanation:`Search for "${e}"`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["fillForm","search"]}}break}case"clickElement":{const e=this.extractTarget(t),a=this.findButtonSelector(e);if(a){const t=.95*n;return{action:{id:`action-${Date.now()}`,type:"clickElement",target:a,confidence:t,explanation:`Click "${e}" button`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["clickElement",e]}}break}case"triggerModal":{const e=this.extractTarget(t),a=this.findModalConfig(e);if(a){const e=.95*n;return{action:{id:`action-${Date.now()}`,type:"triggerModal",target:a.trigger,confidence:e,explanation:`Open ${a.id} modal`},shouldEscalate:e<r,rawConfidence:e,matchedPatterns:["triggerModal",a.id]}}break}case"scroll":{const e=this.extractTarget(t),a=this.findScrollTarget(e);if(a){const t=.9*n;return{action:{id:`action-${Date.now()}`,type:"scroll",target:a,confidence:t,explanation:`Scroll to ${e}`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["scroll",e]}}break}case"highlight":{const e=this.extractTarget(t),a=this.findElementByDescription(e);if(a){const t=.85*n;return{action:{id:`action-${Date.now()}`,type:"highlight",target:a,confidence:t,explanation:`Highlight ${e}`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["highlight",e]}}break}case"custom":{const e=t[1]?.toLowerCase();if(this.config.customActions?.[e]){const t=.95*n;return{action:{id:`action-${Date.now()}`,type:"custom",target:e,confidence:t,explanation:`Execute ${e} action`},shouldEscalate:t<r,rawConfidence:t,matchedPatterns:["custom",e]}}break}}return null}extractTarget(e){for(let t=e.length-1;t>=1;t--)if(e[t])return e[t].trim();return""}stripArticles(e){return e.replace(/^(the|a|an|my|our|your|this|that)\s+/gi,"").replace(/\s+(page|section|screen|view)$/gi,"").trim()}findSiteMapMatch(e){const t=e.toLowerCase().replace(/[^a-z0-9\s]/g,""),n=this.stripArticles(t),r=this.siteMapIndex.get(t)||this.siteMapIndex.get(n);if(r)return{entry:r,similarity:1};let a=null,o=0;for(const[e,r]of this.siteMapIndex){const i=this.calculateSimilarity(t,e),s=this.calculateSimilarity(n,e),l=Math.max(i,s);l>o&&l>.5&&(o=l,a=r)}return a?{entry:a,similarity:o}:null}fuzzyMatchSiteMap(e){const t=this.config.confidenceThreshold??.8;for(const[n,r]of this.siteMapIndex)if(e.includes(n)){const e=.75;return{action:{id:`action-${Date.now()}`,type:"navigate",target:r.path,confidence:e,explanation:`Navigate to ${r.name}`},shouldEscalate:e<t,rawConfidence:e,matchedPatterns:["fuzzy-sitemap",n]}}return null}matchCustomAction(e){if(!this.config.customActions)return null;const t=this.config.confidenceThreshold??.8;for(const n of Object.keys(this.config.customActions))if(e.includes(n.toLowerCase())){const e=.85;return{action:{id:`action-${Date.now()}`,type:"custom",target:n,confidence:e,explanation:`Execute ${n}`},shouldEscalate:e<t,rawConfidence:e,matchedPatterns:["custom",n]}}return null}parseFormIntent(e){const t=e[0];for(const[,e]of this.formIndex)if(t.toLowerCase().includes(e.name.toLowerCase())){const n=t.match(new RegExp(`${e.name}[^a-z]*(.+)`,"i"));return{field:e,value:n?.[1]?.trim()||""}}return{field:null,value:this.extractTarget(e)}}findButtonSelector(e){const t=e.toLowerCase();if("undefined"==typeof document)return`button:contains("${e}")`;const n=[`[data-action="${t}"]`,`[aria-label*="${t}" i]`,`.btn-${t}`,`#${t}-button`,`button.${t}`];for(const e of n)try{if(document.querySelector(e))return e}catch{}const r=document.querySelectorAll('button, [role="button"], a.btn');for(const e of r)if(e.textContent?.toLowerCase().includes(t))return this.generateUniqueSelector(e);return null}findModalConfig(e){return this.modalIndex.get(e.toLowerCase())||null}findScrollTarget(e){const t=e.toLowerCase();if("top"===t||"beginning"===t)return"body";if("bottom"===t||"end"===t)return"body:last-child";if("undefined"==typeof document)return`#${t.replace(/\s+/g,"-")}`;const n=[`#${t.replace(/\s+/g,"-")}`,`[data-section="${t}"]`,`.${t.replace(/\s+/g,"-")}-section`,`section[aria-label*="${t}" i]`];for(const e of n)try{if(document.querySelector(e))return e}catch{continue}return null}findElementByDescription(e){const t=e.toLowerCase();if("undefined"==typeof document)return`[aria-label*="${t}" i]`;const n=[`[aria-label*="${t}" i]`,`[data-testid*="${t}" i]`,`[title*="${t}" i]`];for(const e of n)try{if(document.querySelector(e))return e}catch{continue}return null}generateUniqueSelector(e){if(e.id)return`#${e.id}`;if(e.getAttribute("data-testid"))return`[data-testid="${e.getAttribute("data-testid")}"]`;const t=[];let n=e;for(;n&&n!==document.body;){let e=n.tagName.toLowerCase();if(n.className&&"string"==typeof n.className){const t=n.className.split(" ").filter(e=>e&&!e.includes(" "));t.length>0&&(e+=`.${t.slice(0,2).join(".")}`)}t.unshift(e),n=n.parentElement}return t.join(" > ")}calculateSimilarity(e,t){const n=new Set(e.split(/\s+/)),r=new Set(t.split(/\s+/)),a=new Set([...n].filter(e=>r.has(e))),o=new Set([...n,...r]);return a.size/o.size}getConfig(){return this.config}async trainFromExport(e){if(e.categories){this.categories=e.categories;for(const t of e.categories)for(const e of t.keywords){const n=this.topicKeywords.get(t.name)||[];n.push(e.toLowerCase()),this.topicKeywords.set(t.name,n)}}const t=this.extractTopicsFromDocuments(e.documents);for(const[e,n]of t){const t=this.topicKeywords.get(e)||[];t.push(...n),this.topicKeywords.set(e,[...new Set(t)])}e.sitemap&&this.loadSitemapEntries(e.sitemap),console.log(`[CyberneticIntentClassifier] Trained with ${this.categories.length} categories, ${this.topicKeywords.size} topics`)}async loadSitemap(e){if(e.enabled)if(e.sitemapData)this.loadSitemapEntries(e.sitemapData);else if(e.sitemapUrl)try{const t=await fetch(e.sitemapUrl);if(!t.ok)throw new Error(`Failed to fetch sitemap: ${t.status}`);const n=await t.json();this.loadSitemapEntries(n)}catch(e){console.error("[CyberneticIntentClassifier] Failed to load sitemap:",e)}}loadSitemapEntries(e){for(const t of e){const e={path:t.url,name:t.title,description:t.description,aliases:t.keywords},n=[t.title.toLowerCase(),t.url.toLowerCase(),...(t.keywords||[]).map(e=>e.toLowerCase())];if(t.description){const e=t.description.toLowerCase().split(/\s+/).filter(e=>e.length>4);n.push(...e)}for(const t of n)this.siteMapIndex.set(t,e)}console.log(`[CyberneticIntentClassifier] Loaded ${e.length} sitemap entries`)}extractTopicsFromDocuments(e){const t=new Map;for(const n of e){const e=n.title.toLowerCase(),r=[];n.metadata?.keywords&&r.push(...n.metadata.keywords.map(e=>e.toLowerCase()));const a=n.title.toLowerCase().replace(/[^a-z0-9\s]/g,"").split(/\s+/).filter(e=>e.length>3&&!this.isStopWord(e));r.push(...a);const o=n.content.toLowerCase().replace(/[^a-z0-9\s]/g,"").split(/\s+/).filter(e=>e.length>4&&!this.isStopWord(e)),i=new Map;for(const e of o)i.set(e,(i.get(e)||0)+1);const s=[...i.entries()].sort((e,t)=>t[1]-e[1]).slice(0,5).map(([e])=>e);r.push(...s),t.set(e,[...new Set(r)])}return t}isStopWord(e){return new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","from","up","about","into","through","during","is","are","was","were","be","been","being","have","has","had","do","does","did","will","would","could","should","may","might","this","that","these","those","it","its","they","them","their","what","which","who","whom","when","where","why","how","all","each","every","both","few","more","most","other","some","such","no","not","only","same","so","than","too","very","can","just","dont","now","here","there","also","your","you"]).has(e)}getCategories(){return this.categories}getTopicKeywords(){return this.topicKeywords}isTrained(){return this.categories.length>0||this.topicKeywords.size>0}async initializeDiscovery(){if(this.siteMapDiscovery)try{await this.siteMapDiscovery.initialize(),this.rebuildIndexesFromDiscovery(),console.log(`[CyberneticIntentClassifier] Discovery complete, indexed ${this.siteMapIndex.size} entries`)}catch(e){console.error("[CyberneticIntentClassifier] Discovery initialization failed:",e)}else console.log("[CyberneticIntentClassifier] No siteMapConfig provided, skipping discovery")}rebuildIndexesFromDiscovery(){if(!this.siteMapDiscovery)return;const e=this.siteMapDiscovery.getLegacyEntries();this.siteMapIndex.clear();for(const t of e){const e={path:t.path,name:t.name,description:t.description,params:t.params,aliases:t.aliases},n=[t.name.toLowerCase(),t.path.toLowerCase(),...(t.aliases||[]).map(e=>e.toLowerCase())];if(t.description){const e=t.description.toLowerCase().split(/\s+/).filter(e=>e.length>4&&!this.isStopWord(e));n.push(...e)}for(const t of n)this.siteMapIndex.set(t,e)}}isSiteMapReady(){return this.siteMapDiscovery?this.siteMapDiscovery.isReady():this.siteMapIndex.size>0||(this.config.siteMap?.length??0)>0}async ensureSiteMapReady(){this.isSiteMapReady()||await this.initializeDiscovery()}async refreshSiteMap(){this.siteMapDiscovery?(await this.siteMapDiscovery.refresh(),this.rebuildIndexesFromDiscovery()):console.log("[CyberneticIntentClassifier] No siteMapConfig provided, cannot refresh")}getSiteMapDiscovery(){return this.siteMapDiscovery}getSiteMapEntries(){return this.siteMapDiscovery?this.siteMapDiscovery.getLegacyEntries():this.config.siteMap||[]}}class jd{constructor(e){this.highlightOverlay=null,this.actionCount=0,this.lastActionReset=Date.now(),this.config=e,this.classifier=new $d(e),"undefined"!=typeof document&&this.injectStyles()}interpretIntent(e){return this.classifier.classify(e)}async executeAction(e){const t=Date.now();t-this.lastActionReset>6e4&&(this.actionCount=0,this.lastActionReset=t);const n=this.config.maxActionsPerTurn??5;if(this.actionCount>=n)return{success:!1,message:`Rate limit exceeded. Maximum ${n} actions per minute.`};if(!this.isActionAllowed(e))return{success:!1,message:`Action type "${e.type}" is not allowed`};switch(this.actionCount++,e.type){case"navigate":return this.navigate(e.target,e.params);case"fillForm":return this.fillForm(e.target,e.params?.value);case"clickElement":return this.clickElement(e.target);case"triggerModal":return this.triggerModal(e.target);case"scroll":return this.scrollToElement(e.target);case"highlight":return this.highlightElement(e.target);case"custom":return this.executeCustomAction(e.target,e.params);default:return{success:!1,message:`Unknown action type: ${e.type}`}}}isActionAllowed(e){const t=this.config.allowedActions;if(!t)return!0;const n={navigate:"navigate",fillForm:"fill",clickElement:"click",scroll:"scroll",highlight:"click",triggerModal:"click",custom:"click"}[e.type];return t.includes(n)}isSelectorAllowed(e){if(this.config.blockedSelectors)for(const t of this.config.blockedSelectors)if(e.includes(t))return!1;return!(this.config.allowedSelectors&&this.config.allowedSelectors.length>0)||this.config.allowedSelectors.some(t=>e.includes(t))}async navigate(e,t){try{if(!this.validateNavigationUrl(e))return{success:!1,message:"Invalid or blocked URL"};let n=e;if(t){const e=new URLSearchParams;for(const[n,r]of Object.entries(t))null!=r&&e.set(n,String(r));const r=e.toString();r&&(n+=(n.includes("?")?"&":"?")+r)}return"undefined"==typeof window?{success:!0,message:`Navigation to ${e} would be executed (server-side)`}:this.isInternalUrl(n)?this.tryClientSideNavigation(n)?{success:!0,message:`Navigated to ${e}`}:(window.location.href=n,{success:!0,message:`Navigating to ${e}...`}):(window.open(n,"_blank","noopener,noreferrer"),{success:!0,message:`Opened ${n} in new tab`})}catch(e){return{success:!1,message:"Navigation failed",error:String(e)}}}async fillForm(e,t){if(!this.isSelectorAllowed(e))return{success:!1,message:`Selector "${e}" is not allowed`};const n=this.sanitizeSelector(e);if("undefined"==typeof document)return{success:!0,message:`Form fill would set "${n}" to "${t}" (server-side)`};try{const e=document.querySelector(n);if(!e)return{success:!1,message:`Element not found: ${n}`};if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement))return{success:!1,message:"Element is not a form field"};if(e.focus(),e instanceof HTMLSelectElement){const n=Array.from(e.options).find(e=>e.value.toLowerCase()===t.toLowerCase()||e.text.toLowerCase()===t.toLowerCase());if(!n)return{success:!1,message:`Option "${t}" not found`};e.value=n.value}else e.value=t;e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}));const r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;return r&&e instanceof HTMLInputElement&&(r.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))),{success:!0,message:`Filled field with "${t}"`}}catch(e){return{success:!1,message:"Failed to fill form field",error:String(e)}}}async clickElement(e){if(!this.isSelectorAllowed(e))return{success:!1,message:`Selector "${e}" is not allowed`};const t=this.sanitizeSelector(e);if("undefined"==typeof document)return{success:!0,message:`Click on "${t}" would be executed (server-side)`};try{const e=document.querySelector(t);return e?e instanceof HTMLElement?(e.scrollIntoView({behavior:"smooth",block:"center"}),await this.sleep(300),e.click(),{success:!0,message:"Element clicked"}):{success:!1,message:"Element is not clickable"}:{success:!1,message:`Element not found: ${t}`}}catch(e){return{success:!1,message:"Failed to click element",error:String(e)}}}async triggerModal(e){return this.clickElement(e)}async scrollToElement(e){if("undefined"==typeof window)return{success:!0,message:`Scroll to "${e}" would be executed (server-side)`};try{if("body"===e)return window.scrollTo({top:0,behavior:"smooth"}),{success:!0,message:"Scrolled to top"};if("body:last-child"===e)return window.scrollTo({top:document.body.scrollHeight,behavior:"smooth"}),{success:!0,message:"Scrolled to bottom"};const t=document.querySelector(e);return t?(t.scrollIntoView({behavior:"smooth",block:"start"}),{success:!0,message:"Scrolled to element"}):{success:!1,message:`Element not found: ${e}`}}catch(e){return{success:!1,message:"Failed to scroll",error:String(e)}}}async highlightElement(e){if(!this.isSelectorAllowed(e))return{success:!1,message:`Selector "${e}" is not allowed`};if("undefined"==typeof document)return{success:!0,message:`Highlight on "${e}" would be shown (server-side)`};try{const t=document.querySelector(e);if(!t)return{success:!1,message:`Element not found: ${e}`};this.removeHighlight(),t.scrollIntoView({behavior:"smooth",block:"center"}),await this.sleep(300);const n=t.getBoundingClientRect(),r=document.createElement("div");return r.className="astermind-highlight-overlay",r.style.cssText=`\n position: fixed;\n top: ${n.top-4}px;\n left: ${n.left-4}px;\n width: ${n.width+8}px;\n height: ${n.height+8}px;\n border: 3px solid #4F46E5;\n border-radius: 4px;\n pointer-events: none;\n z-index: 999999;\n animation: astermind-highlight-pulse 1s ease-in-out 3;\n `,document.body.appendChild(r),this.highlightOverlay=r,setTimeout(()=>this.removeHighlight(),3e3),{success:!0,message:"Element highlighted"}}catch(e){return{success:!1,message:"Failed to highlight element",error:String(e)}}}async executeCustomAction(e,t){if(!this.isAllowedCustomAction(e))return{success:!1,message:`Custom action "${e}" not found`};const n=this.config.customActions[e];try{return await n(t)}catch(t){return{success:!1,message:`Custom action "${e}" failed`,error:String(t)}}}isInternalUrl(e){if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return!0;if("undefined"==typeof window)return!0;try{return new URL(e,window.location.href).origin===window.location.origin}catch{return!0}}tryClientSideNavigation(e){if("undefined"==typeof window)return!1;try{return window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate")),e.includes("#")&&window.dispatchEvent(new HashChangeEvent("hashchange")),!0}catch{return!1}}validateNavigationUrl(e){if(/^(javascript|data):/i.test(e))return!1;if("undefined"==typeof window)return!0;try{return new URL(e,window.location.href).origin===window.location.origin||e.startsWith("/")}catch{return e.startsWith("/")}}sanitizeSelector(e){return e.replace(/[<>'"]/g,"").replace(/javascript:/gi,"").replace(/data:/gi,"").trim()}isAllowedCustomAction(e){return void 0!==this.config.customActions&&Object.prototype.hasOwnProperty.call(this.config.customActions,e)}removeHighlight(){this.highlightOverlay&&(this.highlightOverlay.remove(),this.highlightOverlay=null)}injectStyles(){if("undefined"==typeof document)return;if(document.getElementById("astermind-agent-styles"))return;const e=document.createElement("style");e.id="astermind-agent-styles",e.textContent="\n @keyframes astermind-highlight-pulse {\n 0%, 100% {\n box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);\n }\n 50% {\n box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);\n }\n }\n\n .astermind-highlight-overlay {\n transition: all 0.2s ease-out;\n }\n ",document.head.appendChild(e)}sleep(e){return new Promise(t=>setTimeout(t,e))}getConfig(){return this.config}getClassifier(){return this.classifier}resetActionCount(){this.actionCount=0,this.lastActionReset=Date.now()}}const Ud={hiddenUnits:50,activation:"relu",ridgeLambda:.01,weightInit:"xavier",seed:1337,dropout:0,log:{verbose:!0,toFile:!1,modelName:"Unnamed ELM Model",level:"info"}};function Bd(e){let t=0,n=0;for(;0===t;)t=e();for(;0===n;)n=e();return Math.sqrt(-2*Math.log(t))*Math.cos(2*Math.PI*n)}Object.assign(Object.assign({},Ud),{useTokenizer:!1}),Object.assign(Object.assign({},Ud),{useTokenizer:!0,maxLen:30,charSet:"abcdefghijklmnopqrstuvwxyz",tokenizerDelimiter:/\s+/});class Vd{constructor(e,t,n=1e-4){this.p=e,this.m=t,this.lambda=n,this.Ainv=new Float64Array(e*e),this.Beta=new Float64Array(e*t);const r=1/Math.max(1e-12,n);for(let t=0;t<e;t++)this.Ainv[t*e+t]=r}update(e,t){const{p:n,m:r,Ainv:a,Beta:o}=this,i=new Float64Array(n);for(let t=0;t<n;t++){let r=0,o=t*n;for(let t=0;t<n;t++)r+=a[o+t]*e[t];i[t]=r}let s=1;for(let t=0;t<n;t++)s+=e[t]*i[t];s=Math.max(s,1e-12);const l=1/s;for(let e=0;e<n;e++){const t=i[e]*l;for(let r=0;r<n;r++)a[e*n+r]-=t*i[r]}for(let t=0;t<n;t++){let r=0,o=t*n;for(let t=0;t<n;t++)r+=a[o+t]*e[t];i[t]=r}for(let e=0;e<n;e++){const n=i[e];for(let a=0;a<r;a++)o[e*r+a]+=n*t[a]}}predict(e){const{p:t,m:n,Beta:r}=this,a=new Float64Array(n);for(let o=0;o<n;o++){let i=0;for(let a=0;a<t;a++)i+=e[a]*r[a*n+o];a[o]=i}return a}}function Wd(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(Math.max(0,t))}function Hd(e,t){var n,r;const a=Math.min(e.length,t.length);if(0===a)return 0;let o=0,i=0,s=0;for(let l=0;l<a;l++){const a=null!==(n=e[l])&&void 0!==n?n:0,c=null!==(r=t[l])&&void 0!==r?r:0;o+=a*c,i+=a*a,s+=c*c}const l=o/Math.sqrt(Math.max(i*s,1e-12));return Number.isFinite(l)?l:0}function Kd(e,t,n,r){return new(n||(n=Promise))(function(a,o){function i(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){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,s)}l((r=r.apply(e,t||[])).next())})}function qd(e){return e.replace(/\s+/g," ").split(/(?<=[.?!])\s+/).map(e=>e.trim()).filter(e=>e.length>8&&/\w/.test(e))}function Gd(e){return e.replace(/```[\s\S]*?```/g," ").replace(/`[^`]+`/g," ").replace(/\[[^\]]*\]\([^)]*\)/g,"").replace(/[-–>•→]/g," ").replace(/\s+/g," ").trim()}function Qd(e,t){return Kd(this,arguments,void 0,function*(e,t,n={}){if(!(null==t?void 0:t.length))return"No results found.";const{dim:r=64,features:a=32,sigma:o=1,rounds:i=3,topSentences:s=8,personality:l="neutral"}=n;let c=qd(t.map(e=>Gd(e.content)).join(" ")).filter(e=>!function(e){return/^(\*|#)/.test(e)||/chapter/i.test(e)||/part\s*\d+/i.test(e)||/section/i.test(e)||/^\s*[A-Z]\)\s*$/.test(e)||e.length<15}(e)).slice(0,120);if(0===c.length)return Gd(t[0].content).slice(0,400);const u=function(e,t,n=1,r=Math.random){const a=new Float64Array(t*e),o=new Float64Array(t),i=1/Math.max(1e-12,n);for(let n=0;n<t*e;n++)a[n]=Bd(r)*i;for(let e=0;e<t;e++)o[e]=2*r()*Math.PI;return{W:a,b:o,D:t,d:e,sigma:n}}(r,a,o),d=new Vd(2*a,1,.001),f=e=>{const t=new Float64Array(r),n=Math.min(e.length,r);for(let r=0;r<n;r++)t[r]=e.charCodeAt(r)/255;return function(e,t){const{W:n,b:r,D:a,d:o}=e,i=new Float64Array(2*a);for(let e=0;e<a;e++){let s=r[e];const l=e*o;for(let e=0;e<o;e++)s+=n[l+e]*(t[e]||0);i[e]=Math.cos(s),i[a+e]=Math.sin(s)}let s=0;for(let e=0;e<i.length;e++)s+=i[e]*i[e];const l=1/Math.sqrt(Math.max(s,1e-12));for(let e=0;e<i.length;e++)i[e]*=l;return i}(u,function(e,t=1e-12){const n=Wd(e);if(!(n>t&&Number.isFinite(n)))return new Float64Array(e.length);const r=new Float64Array(e.length),a=1/n;for(let t=0;t<e.length;t++)r[t]=e[t]*a;return r}(t))},h=f(e),p=e.toLowerCase().split(/\W+/).filter(e=>e.length>2),m=c.map(e=>{const t=f(e);let n=Hd(t,h);const r=e.toLowerCase();for(const e of p)r.includes(e)&&(n+=.02);return{s:e,v:t,w:n}});m.sort((e,t)=>t.w-e.w);let g=m.slice(0,s).map(e=>e.s).join(" "),y=new Float64Array(2*a);for(let e=0;e<i;e++){const e=qd(g).slice(0,s),t=e.map(e=>f(e)),n=t.map(e=>Hd(e,h));for(let e=0;e<t.length;e++)d.update(t[e],new Float64Array([n[e]]));y.fill(0);for(let e=0;e<t.length;e++){const r=t[e],a=n[e];for(let e=0;e<r.length;e++)y[e]+=r[e]*a}const r=Wd(y)||1;for(let e=0;e<y.length;e++)y[e]/=r;const a=e.map(e=>({s:e,w:Hd(f(e),y)}));a.sort((e,t)=>t.w-e.w),g=a.slice(0,Math.max(3,Math.floor(s/2))).map(e=>e.s).join(" ")}g=function(e){return e.replace(/\s+[-–>•→]\s+/g," ").replace(/\s+\.\s+/g,". ").replace(/([a-z]) - ([a-z])/gi,"$1-$2").replace(/\s{2,}/g," ").trim()}(g);return`${"teacher"===l?"Here’s a simple way to think about it:\n\n":"scientist"===l?"From the retrieved material, we can infer:\n\n":""}${g.charAt(0).toUpperCase()+g.slice(1)}\n\n(${t[0].heading||"Answer"}, Ω-synthesized)`})}function Yd(e,t){let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}function Xd(e,t,n,r){if("cosine"===n){const n=Yd(e,t),r=Math.hypot(...e),a=Math.hypot(...t);return r&&a?n/(r*a):0}if("poly2"===n){const n=Yd(e,t);return Math.pow(n+1,2)}{let n=0;for(let r=0;r<e.length;r++){const a=e[r]-t[r];n+=a*a}return Math.exp(-n/Math.max(1e-9,2*r*r))}}function Jd(e,t,n,r,a){const o=function(e,t){const n=new Float64Array(t);for(const[t,r]of e)n[t]=r;return n}(e,t),i=new Float64Array(n.length);for(let e=0;e<n.length;e++){const t=n[e];i[e]=Xd(o,t,r,a)}const s=Math.hypot(...i);if(s>0)for(let e=0;e<i.length;e++)i[e]/=s;return i}"function"==typeof SuppressedError&&SuppressedError;const Zd=new Map;function ef(e){const t=e,n=Zd.get(t);if(n)return n;let r=e.toLowerCase();if(r=r.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g,""),r.length<=2)return Zd.set(t,r),r;r.endsWith("ies")&&r.length>4?r=r.slice(0,-3)+"y":/(xes|ches|shes|zes|sses)$/.test(r)&&r.length>4?r=r.replace(/(xes|ches|shes|zes|sses)$/,e=>"sses"===e?"ss":e.replace(/es$/,"")):r.endsWith("s")&&!/(ss|us)$/.test(r)&&r.length>3&&(r=r.slice(0,-1));const a=[[/ization$|isation$/,"ize"],[/ational$/,"ate"],[/fulness$/,"ful"],[/ousness$/,"ous"],[/iveness$/,"ive"],[/ability$/,"able"],[/ness$/,""],[/ment$/,""],[/ations?$/,"ate"],[/izer$|iser$/,"ize"],[/ally$/,"al"],[/ically$/,"ic"],[/ingly$|edly$/,""],[/ing$|ed$/,""]];for(const[e,t]of a)if(e.test(r)&&r.length-t.length>=4){r=r.replace(e,t);break}return Zd.set(t,r),r}function tf(e,t){const n=Array.from(e,(e,t)=>t);return n.sort((t,n)=>e[n]-e[t]),n.slice(0,t)}function nf(e){const{query:t,chunks:n,vocabMap:r,idf:a,tfidfDocs:o,denseDocs:i,landmarksIdx:s,landmarkMat:l,vocabSize:c,kernel:u,sigma:d,alpha:f,beta:h,ridge:p,headingW:m,useStem:g,expandQuery:y,topK:v,prefilter:b}=e,w=y?function(e){const t=[];return/\bmap\b/.test(e)&&t.push("dict key value make"),/\bchan|channel\b/.test(e)&&t.push("goroutine concurrency select buffer"),/\berror\b/.test(e)&&t.push("fmt wrap unwrap sentinel try catch"),/\bstruct\b/.test(e)&&t.push("field method receiver init zero value"),e+" "+t.join(" ")}(t):t,k=function(e,t){const n=e.toLowerCase().replace(/[`*_>~]/g," ").replace(/[^a-z0-9]+/g," ").split(/\s+/).filter(Boolean);if(!t)return n;const r=[];for(const e of n){const t=ef(e);t&&t.length>1&&r.push(t)}return r}(w,g),S=function(e,t,n,r=1){const a=new Map;for(let t=0;t<e.length;t++){const o=e[t],i=n.get(o);if(void 0===i)continue;const s=t<8?r:1;a.set(i,(a.get(i)||0)+s)}const o=Math.max(1,...a.values()),i=new Map;for(const[e,n]of a){const r=.5+n/o*.5;i.set(e,r*(t[e]||0))}return i}(k,a,r,m),x=Jd(S,c,l,u,d),C=o.map(e=>function(e,t){let n=0,r=0,a=0;for(const[a,o]of e){r+=o*o;const e=t.get(a);e&&(n+=o*e)}for(const[,e]of t)a+=e*e;return r&&a?n/(Math.sqrt(r)*Math.sqrt(a)):0}(e,S)),E=i.map(e=>function(e,t,n,r){if("cosine"===n){const n=Yd(e,t),r=Math.hypot(...e),a=Math.hypot(...t);return r&&a?n/(r*a):0}if("poly2"===n){const n=Yd(e,t);return Math.pow(n+1,2)}{let n=0;for(let r=0;r<e.length;r++){const a=e[r]-t[r];n+=a*a}return Math.exp(-n/Math.max(1e-9,2*r*r))}}(e,x,u,d)),_=function(e,t){const n=Array.from(new Set(t.toLowerCase().split(/\W+/).filter(e=>e.length>2))),r=/\b(define|declare|syntax|example|function|struct|map|interface)\b/i.test(t);return e.map(e=>{const t=e.rich||e.content||"",a=t.toLowerCase();let o=0;for(const e of n)a.includes(e)&&o++;return r&&/```/.test(t)&&(o+=5),Math.min(1,.03*o)})}(n,t),M=function(e,t,n){return Math.max(t,Math.min(n,e))}(f,0,1),L=null!=p?p:.08,R=E.map((e,t)=>{const n=C[t],r=h*_[t],a=1/(1+L*(e*e+n*n+.5*r*r))*(M*e+(1-M)*n+r);return Math.tanh(a)}),A=Math.max(v,null!=b?b:0),P=tf(R,A),N=tf(P.map(e=>R[e]),v).map(e=>P[e]);return{items:N.map(e=>{const t=n[e],r=t.rich&&t.rich.trim()||t.content&&t.content.trim()||"(see subsections)";return{score:R[e],heading:t.heading,content:r,index:e}}),scores:N.map(e=>R[e]),indices:N,tfidfScores:N.map(e=>C[e]),denseScores:N.map(e=>E[e])}}const rf=new Set(["a","an","the","and","or","but","if","then","else","for","to","of","in","on","at","by","with","is","are","was","were","be","been","being","as","from","that","this","it","its","you","your","i","we","they","he","she","them","his","her","our","us","do","does","did","done","not","no","yes","can","could","should","would","may","might","into","about","over","under","between"]);function af(e){return e.toLowerCase().replace(/[`*_#>~=\[\]{}()!?.:,;'"<>|/\\+-]+/g," ").split(/\s+/).filter(e=>e&&!rf.has(e))}function of(e){const t=new Map,n=[],r=[];let a=0;for(const o of e){const e=af(o);r.push(e.length);const i=new Map;for(const n of e){let e=t.get(n);void 0===e&&(e=a++,t.set(n,e)),i.set(e,(i.get(e)||0)+1)}n.push(i)}const o=e.length,i=Array(a).fill(0);for(const e of n)for(const t of e.keys())i[t]+=1;const s=i.map(e=>Math.log((o+1)/(e+1))+1),l=r.reduce((e,t)=>e+t,0)/Math.max(1,o);return{stats:{vocab:t,idf:s,avgLen:l,df:i},tf:n,docLens:r}}function sf(e,t){const n=new Map;let r=0;for(const[a,o]of e){const e=o*(t[a]||0);n.set(a,e),r+=e*e}const a=Math.sqrt(r)||1e-12;for(const[e,t]of n)n.set(e,t/a);return n}function lf(e,t){const[n,r]=e.size<t.size?[e,t]:[t,e];let a=0;for(const[e,t]of n){const n=r.get(e);void 0!==n&&(a+=t*n)}return a}function cf(e,t,n=1337){const r=new Float64Array(t);for(const[n,a]of e){let e=2654435761*n>>>0;for(let n=0;n<t;n++){e^=e<<13,e^=e>>>17,e^=e<<5;const t=(e>>>0)/4294967296*2-1;r[n]+=a*t}}let a=0;for(let e=0;e<t;e++)a+=r[e]*r[e];const o=Math.sqrt(a)||1e-12;for(let e=0;e<t;e++)r[e]/=o;return r}function uf(e){return/```+\s*go([\s\S]*?)```/i.test(e)||/\bfunc\s+\w+\s*\(.*\)\s*\w*\s*{/.test(e)}function df(e){return/```+/.test(e)||/{[^}]*}/.test(e)}function ff(e,t){const n=(r=af(e),Array.from(new Set(r)));var r;const a=new Set(af(t));if(0===n.length||0===a.size)return 0;let o=0;for(const e of n)a.has(e)&&o++;return o/n.length}function hf(e,t,n,r,a,o,i,s,l,c){var u;const d=[],f=[],h=lf(n,r);d.push(h),f.push("cosine_tfidf");const p=function(e,t,n,r,a=1.5,o=.75){let i=0;for(const[s]of e){const e=t.get(s)||0;e<=0||(i+=Math.log(((n.df[s]||0)+.5)/(n.idf.length-(n.df[s]||0)+.5)+1)*(e*(a+1)/(e+a*(1-o+o*(r/(n.avgLen||1)))||1e-12)))}return i}(a,o,i,s);d.push(p),f.push("bm25");const m=ff(t.heading||"",e);d.push(m),f.push("heading_match_frac");const g=function(e,t){const n=new Set(af(e)),r=new Set(af(t));let a=0;for(const e of n)r.has(e)&&a++;const o=n.size+r.size-a;return 0===o?0:a/o}(e,t.content||"");d.push(g),f.push("jaccard_tokens");const y=uf(t.rich||t.content||""),v=df(t.rich||t.content||"");var b;d.push(y?1:0),f.push("flag_go_code"),d.push(v?1:0),f.push("flag_any_code"),d.push((b=t.content||"",!/(golang\.org|go\.dev|pkg\.go\.dev)/i.test(b)?0:1)),f.push("flag_go_spec_link"),d.push(null!==(u=t.score_base)&&void 0!==u?u:0),f.push("prior_score_base");const w=(t.content||"").length;if(d.push(1/Math.sqrt(1+w)),f.push("len_inv_sqrt"),l&&c){let e=0,t=0;for(let n=0;n<l.length;n++)e+=l[n]*c[n],t+=Math.abs(l[n]-c[n]);d.push(e),f.push("proj_dot"),d.push(t/l.length),f.push("proj_l1mean")}return{names:f,values:d}}class pf{constructor(){this.w=null,this.mu=null,this.sigma=null}fit(e,t,n=.01){var r;const a=e.length,o=(null===(r=e[0])||void 0===r?void 0:r.length)||0;if(0===a||0===o)return void(this.w=new Float64Array(o));const i=new Float64Array(o),s=new Float64Array(o);for(let t=0;t<o;t++){let n=0;for(let r=0;r<a;r++)n+=e[r][t];n/=a,i[t]=n;let r=0;for(let o=0;o<a;o++){const a=e[o][t]-n;r+=a*a}s[t]=Math.sqrt(r/a)||1}const l=Array.from({length:a},(e,t)=>new Float64Array(o));for(let t=0;t<a;t++)for(let n=0;n<o;n++)l[t][n]=(e[t][n]-i[n])/s[n];const c=Array.from({length:o},()=>new Float64Array(o)),u=new Float64Array(o);for(let e=0;e<a;e++){const n=l[e],r=t[e];for(let e=0;e<o;e++){u[e]+=n[e]*r;const t=n[e];for(let r=0;r<=e;r++)c[e][r]+=t*n[r]}}for(let e=0;e<o;e++){for(let t=0;t<e;t++)c[t][e]=c[e][t];c[e][e]+=n}const d=Array.from({length:o},()=>new Float64Array(o));for(let e=0;e<o;e++)for(let t=0;t<=e;t++){let n=c[e][t];for(let r=0;r<t;r++)n-=d[e][r]*d[t][r];d[e][t]=e===t?Math.sqrt(Math.max(n,1e-12)):n/(d[t][t]||1e-12)}const f=new Float64Array(o);for(let e=0;e<o;e++){let t=u[e];for(let n=0;n<e;n++)t-=d[e][n]*f[n];f[e]=t/(d[e][e]||1e-12)}const h=new Float64Array(o);for(let e=o-1;e>=0;e--){let t=f[e];for(let n=e+1;n<o;n++)t-=d[n][e]*h[n];h[e]=t/(d[e][e]||1e-12)}this.w=h,this.mu=i,this.sigma=s}predict(e){if(!this.w||!this.mu||!this.sigma)return 0;let t=0;for(let n=0;n<this.w.length;n++){const r=(e[n]-this.mu[n])/this.sigma[n];t+=this.w[n]*r}return t}}function mf(e,t,n){var r;const a=t.rich||t.content||"";let o=0;/\bgo\b/.test(e.toLowerCase())&&/(define|declare|function|func)/i.test(e)&&uf(a)&&(o=Math.max(o,1));ff(t.heading||"",e)>=.34&&df(a)&&(o=Math.max(o,.8));const i=n.names.indexOf("cosine_tfidf"),s=n.names.indexOf("bm25"),l=i>=0?n.values[i]:0,c=s>=0?n.values[s]:0;l>.25&&(o=Math.max(o,.6)),c>1&&(o=Math.max(o,.6));const u=n.names.indexOf("prior_score_base"),d=u>=0?n.values[u]:0;return(null!==(r=t.score_base)&&void 0!==r?r:0)>0&&(o=Math.max(o,Math.min(.6,.2+.5*d))),o}function gf(e,t,n={}){var r,a;const{lambdaRidge:o=.01,randomProjDim:i=32,exposeFeatures:s=!0,attachFeatureNames:l=!1}=n,c=[e,...t.map(e=>e.content||"")],{stats:u,tf:d,docLens:f}=of(c),h=d.map(e=>sf(e,u.idf)),p=d[0],m=h[0],g=i>0?cf(m,i):void 0,y=[],v=[],b=[];for(let n=0;n<t.length;n++){const r=t[n],a=d[n+1],o=h[n+1],s=i>0?cf(o,i,1337+n):void 0,l=hf(e,r,m,o,p,a,u,f[n+1]||1,g,s);b.push(l),y.push(l.values);const c=mf(e,r,l);v.push(c)}const w=v.every(e=>Math.abs(e-v[0])<1e-9);if(w){const e=b[0].names.indexOf("cosine_tfidf");if(e>=0)for(let t=0;t<v.length;t++)v[t]=Math.max(0,Math.min(1,.2+.6*y[t][e]))}const k=new pf;k.fit(y,v,o);let S=1/0,x=-1/0;const C=y.map(e=>k.predict(e));for(const e of C)e<S&&(S=e),e>x&&(x=e);const E=Math.max(1e-9,x-S),_=l?null!==(a=null===(r=b[0])||void 0===r?void 0:r.names)&&void 0!==a?a:[]:void 0,M=t.map((e,t)=>{const n=(C[t]-S)/E,r=function(e){if(e>=0)return 1/(1+Math.exp(-e));{const t=Math.exp(e);return t/(1+t)}}((C[t]-.5*(S+x))/(.2*E+1e-6)),a=Object.assign(Object.assign({},e),{score_rr:n,p_relevant:r});return s&&(a._features=y[t]),_&&(a._feature_names=_),a});return M.sort((e,t)=>t.score_rr-e.score_rr),M}function yf(e,t={}){const{probThresh:n=.45,epsilonTop:r=.05,useMMR:a=!0,mmrLambda:o=.7,budgetChars:i=1200}=t;if(0===e.length)return[];const s=e[0].score_rr,l=e.filter(e=>e.p_relevant>=n&&e.score_rr>=s-r),c=l.length>0?l:[e[0]];if(!a){const e=[];let t=0;for(const n of c){const r=(n.content||"").length;if(t+r>i&&e.length>0)break;e.push(n),t+=r}return e}return function(e,t=.7,n=1200){const r=[],a=e.map(e=>e.content||""),{stats:o,tf:i}=of(a),s=i.map(e=>sf(e,o.idf)),l=new Set;let c=0;for(;l.size<e.length;){let a=-1,o=-1/0;for(let n=0;n<e.length;n++){if(l.has(n))continue;const r=e[n];let i=0;for(const e of l){const t=lf(s[n],s[e]);t>i&&(i=t)}const c=t*r.score_rr-(1-t)*i;c>o&&(o=c,a=n)}if(a<0)break;const i=e[a],u=(i.content||"").length;if(c+u>n&&r.length>0)break;r.push(i),c+=u,l.add(a)}return r}(e.map(e=>Object.assign(Object.assign({},e),{score_rr:c.includes(e)?e.score_rr+.01:e.score_rr})),o,i)}var vf=Object.freeze({__proto__:null,OmegaOfflineRAG:class{constructor(e){this.modelState=null,this.model=null,this.config={reranking:{enabled:e?.reranking?.enabled??!0,lambdaRidge:e?.reranking?.lambdaRidge??.1,useMMR:e?.reranking?.useMMR??!0,mmrLambda:e?.reranking?.mmrLambda??.5,probThresh:e?.reranking?.probThresh??.1},topK:e?.topK??5,verbose:e?.verbose??!1}}async loadModel(e){const t=performance.now();if(this.model=e,this.modelState=function(e){if("astermind-pro-v1"!==e.version&&"astermind-elm-v1"!==e.version)throw new Error(`Unsupported model version: ${e.version}. Expected 'astermind-pro-v1' or 'astermind-elm-v1'`);const t=JSON.parse(JSON.stringify(e.settings||{})),n=new Map(e.vocab),r=Float64Array.from(e.idf),a=e.chunks.map(e=>({heading:e.heading,content:e.content||"",rich:e.rich,level:e.level,secId:e.secId})),o=e.tfidfDocs.map(e=>{const t=new Map;for(const[n,r]of e)t.set(n,r);return t}),i=Array.from(e.landmarksIdx),s=e.landmarkMat.map(e=>Float64Array.from(e));let l;if(!e.denseDocs||e.denseDocs.length!==o.length)throw new Error("recomputeDense=true but buildDense function not provided");return l=e.denseDocs.map(e=>Float64Array.from(e)),{settings:t,vocabMap:n,idf:r,chunks:a,tfidfDocs:o,landmarksIdx:i,landmarkMat:s,denseDocs:l}}(e),this.config.verbose){const e=performance.now()-t;console.log(`[OmegaOfflineRAG] Model loaded in ${e.toFixed(0)}ms`),console.log(`[OmegaOfflineRAG] ${this.modelState.chunks.length} chunks, ${this.modelState.vocabMap.size} vocab`)}}async loadModelFromUrl(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch model from ${e}: ${t.status}`);const n=await t.json();await this.loadModel(n)}isReady(){return null!==this.modelState}getModelInfo(){return this.model&&this.modelState?{version:this.model.version,savedAt:this.model.savedAt,documentCount:this.modelState.chunks.length,vocabularySize:this.modelState.vocabMap.size,landmarkCount:this.modelState.landmarksIdx.length,hasDenseVectors:this.modelState.denseDocs.length>0,settings:this.model.settings}:null}async ask(e){const t=performance.now();if(!this.modelState||!this.model)return{answer:"Omega model not loaded. Please load a model first.",confidence:"none",sources:[],processingTime:0,degraded:!0,degradedReason:"Model not loaded"};try{const n=this.model.settings,r=n.kernel??"rbf",a=n.sigma??1,o=n.alpha??.5,i=n.beta??.3,s=n.ridge??.001,l=n.headingW??.2,c=n.useStem??!0,u=n.expandQuery??!1,d=n.prefilter??100,f=nf({query:e,chunks:this.modelState.chunks,vocabMap:this.modelState.vocabMap,idf:this.modelState.idf,tfidfDocs:this.modelState.tfidfDocs,denseDocs:this.modelState.denseDocs,landmarksIdx:this.modelState.landmarksIdx,landmarkMat:this.modelState.landmarkMat,vocabSize:this.modelState.vocabMap.size,kernel:r,sigma:a,alpha:o,beta:i,ridge:s,headingW:l,useStem:c,expandQuery:u,topK:2*this.config.topK,prefilter:d});let h;if(this.config.reranking.enabled&&f.items.length>0){const t=function(e,t,n={}){return yf(gf(e,t,n),n)}(e,f.items.map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score_base:f.scores[t]})),{lambdaRidge:this.config.reranking.lambdaRidge,useMMR:this.config.reranking.useMMR,mmrLambda:this.config.reranking.mmrLambda,probThresh:this.config.reranking.probThresh});h=t.slice(0,this.config.topK).map(e=>({heading:e.heading,content:e.content,rich:e.rich,score:e.score_base??0,rerankScore:e.score_rr,probability:e.p_relevant}))}else h=f.items.slice(0,this.config.topK).map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score:f.scores[t]}));const p=await Qd(e,h.map(e=>({heading:e.heading,content:e.content,score:e.score}))),m=performance.now()-t,g=h[0]?.score??0,y=this.determineConfidence(g,h.length);return{answer:p,confidence:y,sources:h,processingTime:m,degraded:!1,queryClassification:this.classifyQuery(e)}}catch(e){const n=performance.now()-t;return console.error("[OmegaOfflineRAG] Error during retrieval:",e),{answer:"An error occurred while processing your question offline.",confidence:"none",sources:[],processingTime:n,degraded:!0,degradedReason:e instanceof Error?e.message:"Unknown error"}}}async retrieve(e,t){if(!this.modelState||!this.model)return[];const n=t??this.config.topK,r=this.model.settings,a=r.kernel??"rbf",o=r.sigma??1,i=r.alpha??.5,s=r.beta??.3,l=r.ridge??.001,c=r.headingW??.2,u=r.useStem??!0,d=r.expandQuery??!1,f=r.prefilter??100,h=nf({query:e,chunks:this.modelState.chunks,vocabMap:this.modelState.vocabMap,idf:this.modelState.idf,tfidfDocs:this.modelState.tfidfDocs,denseDocs:this.modelState.denseDocs,landmarksIdx:this.modelState.landmarksIdx,landmarkMat:this.modelState.landmarkMat,vocabSize:this.modelState.vocabMap.size,kernel:a,sigma:o,alpha:i,beta:s,ridge:l,headingW:c,useStem:u,expandQuery:d,topK:n,prefilter:f});return h.items.map((e,t)=>({heading:e.heading,content:e.content,rich:e.rich,score:h.scores[t]}))}classifyQuery(e){const t=e.toLowerCase(),n=t.split(/\s+/),r=["what","who","when","where","which","is","are","was","were"],a=["how","steps","guide","tutorial","process","procedure"],o=["why","explain","describe","meaning","definition","concept"],i=["go to","navigate","find","page","link","take me","show me"];let s="unknown",l=.5;const c=[];for(const e of i)if(t.includes(e)){s="navigational",l=.8,c.push(e);break}if("unknown"===s){const e=n[0];a.includes(e)||a.some(e=>t.includes(e))?(s="procedural",l=.7,c.push(...a.filter(e=>t.includes(e)))):o.includes(e)||o.some(e=>t.includes(e))?(s="conceptual",l=.7,c.push(...o.filter(e=>t.includes(e)))):r.includes(e)&&(s="factual",l=.7,c.push(e))}return{type:s,confidence:l,keywords:c}}determineConfidence(e,t){return 0===t?"none":e>=.7||e>=.4?"medium":"low"}clear(){this.modelState=null,this.model=null}}});function bf({onClick:e,position:t,unreadCount:n=0}){return ad.jsxs("button",{className:`astermind-bubble astermind-bubble--${t}`,onClick:e,"aria-label":"Open chat",type:"button",children:[ad.jsx("svg",{className:"astermind-bubble__icon",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:ad.jsx("path",{d:"M21 11.5C21.0034 12.8199 20.6951 14.1219 20.1 15.3C19.3944 16.7118 18.3098 17.8992 16.9674 18.7293C15.6251 19.5594 14.0782 19.9994 12.5 20C11.1801 20.0035 9.87812 19.6951 8.7 19.1L3 21L4.9 15.3C4.30493 14.1219 3.99656 12.8199 4 11.5C4.00061 9.92179 4.44061 8.37488 5.27072 7.03258C6.10083 5.69028 7.28825 4.6056 8.7 3.90003C9.87812 3.30496 11.1801 2.99659 12.5 3.00003H13C15.0843 3.11502 17.053 3.99479 18.5291 5.47089C20.0052 6.94699 20.885 8.91568 21 11V11.5Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),n>0&&ad.jsx("span",{className:"astermind-bubble__badge",children:n})]})}function wf({title:e,subtitle:t,onClose:n,children:r}){return ad.jsxs("div",{className:"astermind-header",children:[ad.jsxs("div",{className:"astermind-header__info",children:[ad.jsx("h3",{className:"astermind-header__title",children:e}),t&&ad.jsx("p",{className:"astermind-header__subtitle",children:t})]}),ad.jsxs("div",{className:"astermind-header__actions",children:[r,ad.jsx("button",{className:"astermind-header__close",onClick:n,"aria-label":"Close chat",type:"button",children:ad.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:ad.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]})]})}function kf(e){if(!e)return"";return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,"<code>$1</code>").replace(/\[(.+?)\]\((.+?)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>').replace(/\n/g,"<br />")}function Sf(){return ad.jsxs("svg",{className:"astermind-source__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[ad.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),ad.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function xf(){return ad.jsxs("svg",{className:"astermind-source__icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[ad.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),ad.jsx("polyline",{points:"7 10 12 15 17 10"}),ad.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function Cf({source:e,showSummaryButton:t,showDownloadButton:n,onViewSummary:r,onDownload:a}){const[o,i]=$.useState(!1);return ad.jsxs("div",{className:"astermind-source",children:[ad.jsxs("div",{className:"astermind-source__header",children:[ad.jsx("span",{className:"astermind-source__title",children:e.documentName||e.title}),ad.jsxs("div",{className:"astermind-source__actions",children:[t&&ad.jsx("button",{className:"astermind-source__action-btn",onClick:t=>{t.stopPropagation(),e.fullContent&&i(!o),r?.(e)},title:"View summary","aria-label":"View source summary",children:ad.jsx(Sf,{})}),n&&ad.jsx("button",{className:"astermind-source__action-btn",onClick:t=>{t.stopPropagation(),a?.(e)},title:"Download source","aria-label":"Download source file",children:ad.jsx(xf,{})}),ad.jsxs("span",{className:"astermind-source__relevance",children:[Math.round(100*e.relevance),"%"]})]})]}),ad.jsx("p",{className:"astermind-source__snippet",children:e.snippet}),o&&e.fullContent&&ad.jsx("div",{className:"astermind-source__full-content",dangerouslySetInnerHTML:{__html:kf(e.fullContent)}})]})}function Ef({sources:e,config:t={},isOnline:n=!0,onViewSummary:r,onDownload:a}){const{enabled:o=!0,showSummary:i=!0,showDownload:s=!0}=t;return o&&0!==e.length?ad.jsx("div",{className:"astermind-sources",children:e.map((e,t)=>{const o=i&&!!e.fullContent,l=s&&n&&!!e.downloadUrl;return ad.jsx(Cf,{source:e,showSummaryButton:o,showDownloadButton:l,onViewSummary:r,onDownload:a},e.chunkId||e.documentId||t)})}):null}function _f(e){const t=new Date,n=t.getTime()-e.getTime();if(n<6e4)return"Just now";if(n<36e5){return`${Math.floor(n/6e4)}m ago`}return e.toDateString()===t.toDateString()?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString([],{month:"short",day:"numeric"})}function Mf({message:e,sourceConfig:t,isOnline:n=!0,onViewSourceSummary:r,onDownloadSource:a}){const[o,i]=$.useState(!1);return ad.jsxs("div",{className:`astermind-message astermind-message--${e.role}`,children:[ad.jsx("div",{className:"astermind-message__bubble",children:e.isStreaming&&!e.content?ad.jsxs("span",{className:"astermind-message__typing",children:[ad.jsx("span",{}),ad.jsx("span",{}),ad.jsx("span",{})]}):ad.jsx("div",{className:"astermind-message__content",dangerouslySetInnerHTML:{__html:kf(e.content)}})}),ad.jsxs("div",{className:"astermind-message__meta",children:[ad.jsx("span",{className:"astermind-message__time",children:_f(e.timestamp)}),e.offline&&ad.jsx("span",{className:"astermind-message__offline",title:"Offline response",children:"offline"}),e.confidence&&"high"!==e.confidence&&ad.jsx("span",{className:`astermind-message__confidence astermind-message__confidence--${e.confidence}`,title:`Confidence: ${e.confidence}`,children:e.confidence})]}),e.sources&&e.sources.length>0&&ad.jsxs("div",{className:"astermind-message__sources",children:[ad.jsxs("button",{className:"astermind-message__sources-toggle",onClick:()=>i(!o),type:"button",children:[o?"Hide":"Show"," sources (",e.sources.length,")"]}),o&&ad.jsx(Ef,{sources:e.sources,config:t,isOnline:n,onViewSummary:r,onDownload:a})]})]})}function Lf(){return ad.jsxs("div",{className:"astermind-typing",children:[ad.jsx("span",{}),ad.jsx("span",{}),ad.jsx("span",{})]})}function Rf({messages:e,isProcessing:t,sourceConfig:n,isOnline:r=!0,onViewSourceSummary:a,onDownloadSource:o}){const i=$.useRef(null);return $.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,t]),ad.jsxs("div",{className:"astermind-messages",ref:i,children:[e.map(e=>ad.jsx(Mf,{message:e,sourceConfig:n,isOnline:r,onViewSourceSummary:a,onDownloadSource:o},e.id)),t&&""===e[e.length-1]?.content&&ad.jsx(Lf,{})]})}function Af({placeholder:e,disabled:t=!1,onSend:n}){const[r,a]=$.useState(""),o=$.useRef(null),i=()=>{r.trim()&&!t&&(n(r.trim()),a(""),o.current?.focus())};return ad.jsxs("div",{className:"astermind-input",children:[ad.jsx("textarea",{ref:o,className:"astermind-input__textarea",value:r,onChange:e=>{const t=e.target;a(t.value),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px"},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),i())},placeholder:e,disabled:t,rows:1,"aria-label":"Message input"}),ad.jsx("button",{className:"astermind-input__send",onClick:i,disabled:t||!r.trim(),"aria-label":"Send message",type:"button",children:ad.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:ad.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})}function Pf({action:e,onConfirm:t,onCancel:n}){return ad.jsxs("div",{className:"astermind-action-card",children:[ad.jsxs("div",{className:"astermind-action-card__header",children:[ad.jsx("div",{className:"astermind-action-card__icon",children:(e=>{switch(e){case"navigate":return ad.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[ad.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),ad.jsx("polyline",{points:"15,3 21,3 21,9"}),ad.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]});case"fillForm":return ad.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[ad.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),ad.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"clickElement":return ad.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[ad.jsx("path",{d:"M15 15l-2 5L9 9l11 4-5 2z"}),ad.jsx("path",{d:"M15 15l5 5"})]});default:return ad.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[ad.jsx("circle",{cx:"12",cy:"12",r:"10"}),ad.jsx("polyline",{points:"12,6 12,12 16,14"})]})}})(e.type)}),ad.jsxs("div",{className:"astermind-action-card__title",children:[ad.jsx("span",{className:"astermind-action-card__label",children:(e=>{switch(e){case"navigate":return"Navigate to";case"fillForm":return"Fill form field";case"clickElement":return"Click";case"triggerModal":return"Open modal";case"scroll":return"Scroll to";case"highlight":return"Highlight";case"custom":return"Execute action";default:return"Perform action"}})(e.type)}),ad.jsx("span",{className:"astermind-action-card__target",children:e.target})]})]}),e.explanation&&ad.jsx("p",{className:"astermind-action-card__explanation",children:e.explanation}),ad.jsxs("div",{className:"astermind-action-card__confidence",children:[ad.jsx("div",{className:"astermind-action-card__confidence-bar",style:{width:100*e.confidence+"%"}}),ad.jsxs("span",{children:[Math.round(100*e.confidence),"% confident"]})]}),ad.jsxs("div",{className:"astermind-action-card__actions",children:[ad.jsx("button",{className:"astermind-action-card__cancel",onClick:n,type:"button",children:"Cancel"}),ad.jsx("button",{className:"astermind-action-card__confirm",onClick:t,type:"button",children:"Confirm"})]})]})}function Nf({status:e}){return ad.jsxs("div",{className:`astermind-status astermind-status--${e}`,children:[ad.jsx("span",{className:"astermind-status__dot"}),ad.jsx("span",{className:"astermind-status__label",children:(()=>{switch(e){case"online":return"Online";case"offline":return"Offline";case"connecting":return"Connecting...";case"error":return"Error";default:return"Unknown"}})()})]})}function Df({messages:e,isProcessing:t,connectionStatus:n,pendingAction:r,headerTitle:a,headerSubtitle:o,placeholder:i,showPoweredBy:s,sourceConfig:l,onClose:c,onSendMessage:u,onActionConfirm:d,onActionCancel:f,onViewSourceSummary:h,onDownloadSource:p}){const m="online"===n;return ad.jsxs("div",{className:"astermind-window",children:[ad.jsx(wf,{title:a,subtitle:o,onClose:c,children:ad.jsx(Nf,{status:n})}),ad.jsxs("div",{className:"astermind-window__body",children:[ad.jsx(Rf,{messages:e,isProcessing:t,sourceConfig:l,isOnline:m,onViewSourceSummary:h,onDownloadSource:p}),r&&ad.jsx(Pf,{action:r,onConfirm:()=>d(r),onCancel:f})]}),ad.jsxs("div",{className:"astermind-window__footer",children:[ad.jsx(Af,{placeholder:i,disabled:t||"error"===n,onSend:u}),s&&ad.jsxs("div",{className:"astermind-powered-by",children:["Powered by ",ad.jsx("a",{href:"https://astermind.ai",target:"_blank",rel:"noopener noreferrer",children:"AsterMind"})]})]})]})}const Tf={primaryColor:"#4F46E5",primaryHover:"#4338CA",backgroundColor:"#ffffff",surfaceColor:"#f3f4f6",textColor:"#1f2937",textMuted:"#6b7280",borderColor:"#e5e7eb",userBubbleBackground:"#4F46E5",userBubbleText:"#ffffff",botBubbleBackground:"#f3f4f6",botBubbleText:"#1f2937",widgetWidth:"380px",widgetHeight:"75vh",bubbleSize:"60px",borderRadius:"12px",fontFamily:"'Inter', system-ui, -apple-system, sans-serif",fontSize:"14px",shadow:"0 4px 20px rgba(0, 0, 0, 0.15)"};const If=$.createContext(null);function zf({theme:e,children:t}){const n=function(e){const t=$.useMemo(()=>({...Tf,...e}),[e]),n=$.useMemo(()=>({"--astermind-primary":t.primaryColor,"--astermind-primary-hover":t.primaryHover,"--astermind-background":t.backgroundColor,"--astermind-surface":t.surfaceColor,"--astermind-text":t.textColor,"--astermind-text-muted":t.textMuted,"--astermind-border":t.borderColor,"--astermind-user-bg":t.userBubbleBackground,"--astermind-user-text":t.userBubbleText,"--astermind-bot-bg":t.botBubbleBackground,"--astermind-bot-text":t.botBubbleText,"--astermind-widget-width":t.widgetWidth,"--astermind-widget-height":t.widgetHeight,"--astermind-bubble-size":t.bubbleSize,"--astermind-border-radius":t.borderRadius,"--astermind-font-family":t.fontFamily,"--astermind-font-size":t.fontSize,"--astermind-shadow":t.shadow}),[t]);return{theme:t,cssVariables:n}}(e);return ad.jsx(If.Provider,{value:n,children:ad.jsx("div",{style:n.cssVariables,children:t})})}function Ff(e){const n=$.useMemo(()=>function(){let e="",n="https://api.astermind.ai";try{t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("astermind-chatbot.min.js",document.baseURI).href}catch{}if(!e&&"undefined"!=typeof process&&process.env&&(e=process.env.REACT_APP_ASTERMIND_RAG_API_KEY||e,n=process.env.REACT_APP_ASTERMIND_RAG_API_SERVER_URL||n),"undefined"!=typeof window){const t=window.__ASTERMIND_CONFIG__;t&&"object"==typeof t&&(e=t.apiKey||e,n=t.apiUrl||n)}return{apiKey:e,apiUrl:n}}(),[]),{apiKey:r,apiUrl:a,throwOnMissingKey:o=!0,position:i="bottom-right",theme:s={},greeting:l="Hi! How can I help you today?",placeholder:c="Type your message...",agent:u,fallback:d={enabled:!0},sourceDisplay:f,showPoweredBy:h=!0,headerTitle:p="AsterMind",headerSubtitle:m="AI Assistant",defaultOpen:g=!1,zIndex:y=9999,onReady:v,onMessage:b,onAction:w,onError:k,onToggle:S}=e,x=r||n.apiKey,C=a||n.apiUrl,[E,_]=$.useState(g),[M,L]=$.useState(null),[R,A]=$.useState([]),[P,N]=$.useState(!1),[D,T]=$.useState(),[I,z]=$.useState(),[F,O]=$.useState("connecting"),j=$.useMemo(()=>{const e=M?.getSourcesConfig?.()||{};return{enabled:f?.enabled??e.enabled??!0,showSummary:f?.showSummary??e.showSummary??!0,showDownload:f?.showDownload??e.showDownload??!0}},[M,f]),U=$.useCallback(e=>{console.log("[AsterMind] View source summary:",e.title)},[]),B=$.useCallback(async e=>{if(e.downloadUrl)try{const t=e.downloadUrl.startsWith("http")?e.downloadUrl:`${C}${e.downloadUrl}`,n=await fetch(t,{headers:{"X-API-Key":x}});if(!n.ok)return void console.error("[AsterMind] Download failed:",n.status,n.statusText);const r=n.headers.get("Content-Disposition");let a=e.documentName||e.title||"download";if(r){const e=r.match(/filename="?(.+?)"?$/);e&&(a=e[1])}const o=await n.blob(),i=window.URL.createObjectURL(o),s=document.createElement("a");s.href=i,s.download=a,document.body.appendChild(s),s.click(),window.URL.revokeObjectURL(i),document.body.removeChild(s)}catch(e){console.error("[AsterMind] Download error:",e)}else console.warn("[AsterMind] No download URL for source:",e.title)},[C,x]);$.useEffect(()=>{if(!x){const e='AsterMind API key is required. Configure using one of these methods:\n 1. Pass apiKey prop: <ChatbotWidget apiKey="am_..." />\n 2. Set VITE_ASTERMIND_RAG_API_KEY environment variable (Vite)\n 3. Set REACT_APP_ASTERMIND_RAG_API_KEY environment variable (CRA)\n 4. Set window.__ASTERMIND_CONFIG__ = { apiKey: "am_...", apiUrl: "..." }';if(o)throw new Error(e);console.warn("[AsterMind] "+e)}},[x,o]);const V=$.useMemo(()=>{if(u?.enabled)return{enabled:!0,confidenceThreshold:u.confidenceThreshold??.8,siteMap:u.siteMap,siteMapConfig:u.siteMapConfig,customActions:u.customActions,requireConfirmation:!0}},[u]);$.useEffect(()=>{if(!x)return;const e=new Td({apiUrl:C,apiKey:x,fallback:{enabled:d?.enabled??!0,cacheOnConnect:!0},agentic:V,onStatusChange:e=>{O(e)},onError:e=>{k?.(new Error(e.message))}});if(V?.enabled&&(!function(e){const t={agent:jd,intentClassifier:$d};e.registerAgentic(t)}(e),console.log("[AsterMind] Agentic capabilities enabled (auto-discovery handled by client)")),L(e),l){const e={id:"greeting",role:"assistant",content:l,timestamp:new Date};A([e])}return v?.(),()=>{}},[x,C,d?.enabled,V,l,k,v]);const W=$.useCallback(()=>{const e=!E;_(e),S?.(e)},[E,S]),H=$.useCallback(()=>{_(!1),S?.(!1)},[S]),K=$.useCallback(async e=>{if(!M||!e.trim()||P)return;const t={id:`user-${Date.now()}`,role:"user",content:e.trim(),timestamp:new Date};if(A(e=>[...e,t]),b?.(t),N(!0),M.isAgenticEnabled())try{const t=await M.smartAsk(e,{sessionId:D});if(t.action&&!t.response){const e={id:t.action.id,type:t.action.type,target:t.action.target,params:t.action.params,confidence:t.action.confidence,explanation:t.action.explanation,status:"pending"};return z(e),w?.(e),void N(!1)}if(t.actionResult){const e={id:t.action.id,type:t.action.type,target:t.action.target,params:t.action?.params,confidence:t.action.confidence,explanation:t.action?.explanation,status:t.actionResult.success?"executed":"failed",result:t.actionResult},n={id:`assistant-${Date.now()}`,role:"assistant",content:t.actionResult.success?`✓ ${t.action?.explanation||"Action completed"}`:`✗ ${t.actionResult.message}`,timestamp:new Date,isStreaming:!1};return A(e=>[...e,n]),w?.(e),void N(!1)}if(t.response){const e={id:`assistant-${Date.now()}`,role:"assistant",content:t.response.reply,timestamp:new Date,sources:t.response.sources,confidence:t.response.confidence,offline:t.response.offline,isStreaming:!1};return A(t=>[...t,e]),T(t.response.sessionId),b?.(e),void N(!1)}}catch(e){console.error("[AsterMind] smartAsk error, falling back to standard ask:",e)}const n=`assistant-${Date.now()}`,r={id:n,role:"assistant",content:"",timestamp:new Date,isStreaming:!0};A(e=>[...e,r]);try{let t="";await M.askStream(e,{onToken:e=>{t+=e,A(e=>e.map(e=>e.id===n?{...e,content:t}:e))},onSources:e=>{A(t=>t.map(t=>t.id===n?{...t,sources:e}:t))},onComplete:e=>{const t={id:n,role:"assistant",content:e.reply,timestamp:new Date,sources:e.sources,confidence:e.confidence,offline:e.offline,isStreaming:!1};A(e=>e.map(e=>e.id===n?t:e)),T(e.sessionId),b?.(t)},onError:()=>{q(M,e,n)}},{sessionId:D})}catch{const e={id:n,role:"assistant",content:"I encountered an error processing your request. Please try again.",timestamp:new Date,isStreaming:!1};A(t=>t.map(t=>t.id===n?e:t)),k?.(new Error("Failed to process message"))}finally{N(!1)}},[M,P,D,b,k,w]),q=async(e,t,n)=>{try{const r=await e.ask(t,{sessionId:D}),a={id:n,role:"assistant",content:r.reply,timestamp:new Date,sources:r.sources,confidence:r.confidence,offline:r.offline,isStreaming:!1};A(e=>e.map(e=>e.id===n?a:e)),T(r.sessionId),b?.(a)}catch{const e={id:n,role:"assistant",content:"I'm having trouble connecting. Please try again later.",timestamp:new Date,isStreaming:!1};A(t=>t.map(t=>t.id===n?e:t))}},G=$.useCallback(async e=>{if(!M)return;const t={...e,status:"confirmed"};z(t);try{const t=await M.executeAction({id:e.id,type:e.type,target:e.target,confidence:e.confidence,params:e.params}),n={...e,status:t.success?"executed":"failed",result:t},r={id:`assistant-${Date.now()}`,role:"assistant",content:t.success?`✓ ${e.explanation||t.message}`:`✗ ${t.message}${t.error?`: ${t.error}`:""}`,timestamp:new Date,isStreaming:!1};A(e=>[...e,r]),z(void 0),w?.(n)}catch(t){const n={...e,status:"failed",result:{success:!1,message:"Failed to execute action",error:String(t)}},r={id:`assistant-${Date.now()}`,role:"assistant",content:`✗ Failed to execute action: ${String(t)}`,timestamp:new Date,isStreaming:!1};A(e=>[...e,r]),z(void 0),w?.(n)}},[I,M,w]),Q=$.useCallback(()=>{if(!I)return;const e={...I,status:"cancelled"};z(void 0),w?.(e)},[I,w]);return ad.jsx(zf,{theme:s,children:ad.jsxs("div",{className:`astermind-chatbot astermind-chatbot--${i}`,style:{zIndex:y},children:[!E&&ad.jsx(bf,{onClick:W,position:i}),E&&ad.jsx(Df,{messages:R,isProcessing:P,connectionStatus:F,pendingAction:I,headerTitle:p,headerSubtitle:m,placeholder:c,showPoweredBy:h,sourceConfig:j,onClose:H,onSendMessage:K,onActionConfirm:G,onActionCancel:Q,onViewSourceSummary:U,onDownloadSource:B})]})})}let Of=null;function $f(e){const t=function(){if("undefined"==typeof document)return{};const e=document.querySelector("script[data-astermind-key]");if(!e)return{};const t={},n=e.getAttribute("data-astermind-key");n&&(t.apiKey=n);const r=e.getAttribute("data-astermind-url");r&&(t.apiUrl=r);const a=e.getAttribute("data-astermind-position");a&&["bottom-right","bottom-left","top-right","top-left"].includes(a)&&(t.position=a);const o=e.getAttribute("data-astermind-greeting");o&&(t.greeting=o);const i=e.getAttribute("data-astermind-title");i&&(t.headerTitle=i);const s=e.getAttribute("data-astermind-subtitle");return s&&(t.headerSubtitle=s),"true"===e.getAttribute("data-astermind-auto-open")&&(t.defaultOpen=!0),t}(),n={...t,...function(){if("undefined"==typeof window)return{};const e=window.astermindConfig;return e&&"object"==typeof e?e:{}}(),...e||{}},{container:r=document.body,...a}=n;a.apiKey||console.warn('[AsterMindChatbot] No API key found. Configure using one of these methods:\n 1. AsterMindChatbot.init({ apiKey: "am_..." })\n 2. window.astermindConfig = { apiKey: "am_..." }\n 3. <script data-astermind-key="am_..." ...>\n 4. Set VITE_ASTERMIND_RAG_API_KEY environment variable (if bundled)');const o="string"==typeof r?document.querySelector(r):r;if(!o)return void console.error("[AsterMindChatbot] Container not found:",r);const i=document.createElement("div");i.id="astermind-chatbot-root",o.appendChild(i),Of=qu(i),Of.render(j.createElement(Ff,a)),console.log("[AsterMindChatbot] Initialized")}function jf(){Of&&(Of.unmount(),Of=null);const e=document.getElementById("astermind-chatbot-root");e&&e.remove(),console.log("[AsterMindChatbot] Destroyed")}function Uf(){return null!==Of}return"undefined"!=typeof window&&(window.AsterMindChatbot={init:$f,destroy:jf,isInitialized:Uf}),e.destroy=jf,e.init=$f,e.isInitialized=Uf,e}({});
21
21
  //# sourceMappingURL=astermind-chatbot.min.js.map