(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const m of d)if(m.type==="childList")for(const h of m.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function i(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(d){if(d.ep)return;d.ep=!0;const m=i(d);fetch(d.href,m)}})();function Lg(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var kd={exports:{}},mr={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Nh;function Pg(){if(Nh)return mr;Nh=1;var r=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(c,d,m){var h=null;if(m!==void 0&&(h=""+m),d.key!==void 0&&(h=""+d.key),"key"in d){m={};for(var g in d)g!=="key"&&(m[g]=d[g])}else m=d;return d=m.ref,{$$typeof:r,type:c,key:h,ref:d!==void 0?d:null,props:m}}return mr.Fragment=l,mr.jsx=i,mr.jsxs=i,mr}var jh;function Ig(){return jh||(jh=1,kd.exports=Pg()),kd.exports}var s=Ig(),Md={exports:{}},Ne={};/** * @license React * react.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Sh;function Ug(){if(Sh)return Ne;Sh=1;var r=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),h=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),L=Symbol.iterator;function R(_){return _===null||typeof _!="object"?null:(_=L&&_[L]||_["@@iterator"],typeof _=="function"?_:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,H={};function q(_,Y,D){this.props=_,this.context=Y,this.refs=H,this.updater=D||E}q.prototype.isReactComponent={},q.prototype.setState=function(_,Y){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,Y,"setState")},q.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function I(){}I.prototype=q.prototype;function T(_,Y,D){this.props=_,this.context=Y,this.refs=H,this.updater=D||E}var y=T.prototype=new I;y.constructor=T,z(y,q.prototype),y.isPureReactComponent=!0;var S=Array.isArray;function X(){}var v={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function se(_,Y,D){var ee=D.ref;return{$$typeof:r,type:_,key:Y,ref:ee!==void 0?ee:null,props:D}}function ne(_,Y){return se(_.type,Y,_.props)}function U(_){return typeof _=="object"&&_!==null&&_.$$typeof===r}function ae(_){var Y={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(D){return Y[D]})}var ce=/\/+/g;function C(_,Y){return typeof _=="object"&&_!==null&&_.key!=null?ae(""+_.key):Y.toString(36)}function K(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(X,X):(_.status="pending",_.then(function(Y){_.status==="pending"&&(_.status="fulfilled",_.value=Y)},function(Y){_.status==="pending"&&(_.status="rejected",_.reason=Y)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function w(_,Y,D,ee,me){var ie=typeof _;(ie==="undefined"||ie==="boolean")&&(_=null);var ve=!1;if(_===null)ve=!0;else switch(ie){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(_.$$typeof){case r:case l:ve=!0;break;case N:return ve=_._init,w(ve(_._payload),Y,D,ee,me)}}if(ve)return me=me(_),ve=ee===""?"."+C(_,0):ee,S(me)?(D="",ve!=null&&(D=ve.replace(ce,"$&/")+"/"),w(me,Y,D,"",function(At){return At})):me!=null&&(U(me)&&(me=ne(me,D+(me.key==null||_&&_.key===me.key?"":(""+me.key).replace(ce,"$&/")+"/")+ve)),Y.push(me)),1;ve=0;var Ae=ee===""?".":ee+":";if(S(_))for(var Re=0;Re<_.length;Re++)ee=_[Re],ie=Ae+C(ee,Re),ve+=w(ee,Y,D,ie,me);else if(Re=R(_),typeof Re=="function")for(_=Re.call(_),Re=0;!(ee=_.next()).done;)ee=ee.value,ie=Ae+C(ee,Re++),ve+=w(ee,Y,D,ie,me);else if(ie==="object"){if(typeof _.then=="function")return w(K(_),Y,D,ee,me);throw Y=String(_),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return ve}function M(_,Y,D){if(_==null)return _;var ee=[],me=0;return w(_,ee,"","",function(ie){return Y.call(D,ie,me++)}),ee}function W(_){if(_._status===-1){var Y=_._result;Y=Y(),Y.then(function(D){(_._status===0||_._status===-1)&&(_._status=1,_._result=D)},function(D){(_._status===0||_._status===-1)&&(_._status=2,_._result=D)}),_._status===-1&&(_._status=0,_._result=Y)}if(_._status===1)return _._result.default;throw _._result}var oe=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},be={map:M,forEach:function(_,Y,D){M(_,function(){Y.apply(this,arguments)},D)},count:function(_){var Y=0;return M(_,function(){Y++}),Y},toArray:function(_){return M(_,function(Y){return Y})||[]},only:function(_){if(!U(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return Ne.Activity=j,Ne.Children=be,Ne.Component=q,Ne.Fragment=i,Ne.Profiler=d,Ne.PureComponent=T,Ne.StrictMode=c,Ne.Suspense=p,Ne.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=v,Ne.__COMPILER_RUNTIME={__proto__:null,c:function(_){return v.H.useMemoCache(_)}},Ne.cache=function(_){return function(){return _.apply(null,arguments)}},Ne.cacheSignal=function(){return null},Ne.cloneElement=function(_,Y,D){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var ee=z({},_.props),me=_.key;if(Y!=null)for(ie in Y.key!==void 0&&(me=""+Y.key),Y)!k.call(Y,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&Y.ref===void 0||(ee[ie]=Y[ie]);var ie=arguments.length-2;if(ie===1)ee.children=D;else if(1>>1,be=w[oe];if(0>>1;oe<_;){var Y=2*(oe+1)-1,D=w[Y],ee=Y+1,me=w[ee];if(0>d(D,W))eed(me,D)?(w[oe]=me,w[ee]=W,oe=ee):(w[oe]=D,w[Y]=W,oe=Y);else if(eed(me,W))w[oe]=me,w[ee]=W,oe=ee;else break e}}return M}function d(w,M){var W=w.sortIndex-M.sortIndex;return W!==0?W:w.id-M.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;r.unstable_now=function(){return m.now()}}else{var h=Date,g=h.now();r.unstable_now=function(){return h.now()-g}}var p=[],f=[],N=1,j=null,L=3,R=!1,E=!1,z=!1,H=!1,q=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function y(w){for(var M=i(f);M!==null;){if(M.callback===null)c(f);else if(M.startTime<=w)c(f),M.sortIndex=M.expirationTime,l(p,M);else break;M=i(f)}}function S(w){if(z=!1,y(w),!E)if(i(p)!==null)E=!0,X||(X=!0,ae());else{var M=i(f);M!==null&&K(S,M.startTime-w)}}var X=!1,v=-1,k=5,se=-1;function ne(){return H?!0:!(r.unstable_now()-sew&&ne());){var oe=j.callback;if(typeof oe=="function"){j.callback=null,L=j.priorityLevel;var be=oe(j.expirationTime<=w);if(w=r.unstable_now(),typeof be=="function"){j.callback=be,y(w),M=!0;break t}j===i(p)&&c(p),y(w)}else c(p);j=i(p)}if(j!==null)M=!0;else{var _=i(f);_!==null&&K(S,_.startTime-w),M=!1}}break e}finally{j=null,L=W,R=!1}M=void 0}}finally{M?ae():X=!1}}}var ae;if(typeof T=="function")ae=function(){T(U)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,C=ce.port2;ce.port1.onmessage=U,ae=function(){C.postMessage(null)}}else ae=function(){q(U,0)};function K(w,M){v=q(function(){w(r.unstable_now())},M)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(w){w.callback=null},r.unstable_forceFrameRate=function(w){0>w||125oe?(w.sortIndex=W,l(f,w),i(p)===null&&w===i(f)&&(z?(I(v),v=-1):z=!0,K(S,W-oe))):(w.sortIndex=be,l(p,w),E||R||(E=!0,X||(X=!0,ae()))),w},r.unstable_shouldYield=ne,r.unstable_wrapCallback=function(w){var M=L;return function(){var W=L;L=M;try{return w.apply(this,arguments)}finally{L=W}}}})(Id)),Id}var Th;function $g(){return Th||(Th=1,Pd.exports=zg()),Pd.exports}var Ud={exports:{}},yt={};/** * @license React * react-dom.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Eh;function Vg(){if(Eh)return yt;Eh=1;var r=du();function l(p){var f="https://react.dev/errors/"+p;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(l){console.error(l)}}return r(),Ud.exports=Vg(),Ud.exports}/** * @license React * react-dom-client.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ch;function Hg(){if(Ch)return xr;Ch=1;var r=$g(),l=du(),i=Bg();function c(e){var t="https://react.dev/errors/"+e;if(1be||(e.current=oe[be],oe[be]=null,be--)}function D(e,t){be++,oe[be]=e.current,e.current=t}var ee=_(null),me=_(null),ie=_(null),ve=_(null);function Ae(e,t){switch(D(ie,t),D(me,e),D(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gx(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gx(t),e=qx(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(ee),D(ee,e)}function Re(){Y(ee),Y(me),Y(ie)}function At(e){e.memoizedState!==null&&D(ve,e);var t=ee.current,a=qx(t,e.type);t!==a&&(D(me,e),D(ee,a))}function Mt(e){me.current===e&&(Y(ee),Y(me)),ve.current===e&&(Y(ve),or._currentValue=W)}var qt,rs;function ht(e){if(qt===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);qt=t&&t[1]||"",rs=-1)":-1o||A[n]!==B[o]){var Z=` `+A[n].replace(" at new "," at ");return e.displayName&&Z.includes("")&&(Z=Z.replace("",e.displayName)),Z}while(1<=n&&0<=o);break}}}finally{Lt=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?ht(a):""}function Cs(e,t){switch(e.tag){case 26:case 27:case 5:return ht(e.type);case 16:return ht("Lazy");case 13:return e.child!==t&&t!==null?ht("Suspense Fallback"):ht("Suspense");case 19:return ht("SuspenseList");case 0:case 15:return is(e.type,!1);case 11:return is(e.type.render,!1);case 1:return is(e.type,!0);case 31:return ht("Activity");default:return""}}function Tt(e){try{var t="",a=null;do t+=Cs(e,a),a=e,e=e.return;while(e);return t}catch(n){return` Error generating stack: `+n.message+` `+n.stack}}var Pt=Object.prototype.hasOwnProperty,os=r.unstable_scheduleCallback,Nt=r.unstable_cancelCallback,_s=r.unstable_shouldYield,ps=r.unstable_requestPaint,We=r.unstable_now,Os=r.unstable_getCurrentPriorityLevel,re=r.unstable_ImmediatePriority,fe=r.unstable_UserBlockingPriority,je=r.unstable_NormalPriority,De=r.unstable_LowPriority,Ie=r.unstable_IdlePriority,jt=r.log,Ft=r.unstable_setDisableYieldValue,ut=null,Fe=null;function te(e){if(typeof jt=="function"&&Ft(e),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(ut,e)}catch{}}var le=Math.clz32?Math.clz32:Ke,$e=Math.log,Ze=Math.LN2;function Ke(e){return e>>>=0,e===0?32:31-($e(e)/Ze|0)|0}var cs=256,Ds=262144,ks=4194304;function bs(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Fa(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var o=0,u=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var b=n&134217727;return b!==0?(n=b&~u,n!==0?o=bs(n):(x&=b,x!==0?o=bs(x):a||(a=b&~e,a!==0&&(o=bs(a))))):(b=n&~u,b!==0?o=bs(b):x!==0?o=bs(x):a||(a=n&~e,a!==0&&(o=bs(a)))),o===0?0:t!==0&&t!==o&&(t&u)===0&&(u=o&-o,a=t&-t,u>=a||u===32&&(a&4194048)!==0)?t:o}function oa(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Pr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Nl(){var e=ks;return ks<<=1,(ks&62914560)===0&&(ks=4194304),e}function ge(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function ds(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ir(e,t,a,n,o,u){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var b=e.entanglements,A=e.expirationTimes,B=e.hiddenUpdates;for(a=x&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Cp=/[\n"\\]/g;function Xt(e){return e.replace(Cp,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Eo(e,t,a,n,o,u,x,b){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),t!=null?x==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Yt(t)):e.value!==""+Yt(t)&&(e.value=""+Yt(t)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),t!=null?Ro(e,x,Yt(t)):a!=null?Ro(e,x,Yt(a)):n!=null&&e.removeAttribute("value"),o==null&&u!=null&&(e.defaultChecked=!!u),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Yt(b):e.removeAttribute("name")}function Uu(e,t,a,n,o,u,x,b){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){To(e);return}a=a!=null?""+Yt(a):"",t=t!=null?""+Yt(t):a,b||t===e.value||(e.value=t),e.defaultValue=t}n=n??o,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=b?e.checked:!!n,e.defaultChecked=!!n,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),To(e)}function Ro(e,t,a){t==="number"&&Vr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function jn(e,t,a,n){if(e=e.options,t){t={};for(var o=0;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ko=!1;if(Ps)try{var Tl={};Object.defineProperty(Tl,"passive",{get:function(){ko=!0}}),window.addEventListener("test",Tl,Tl),window.removeEventListener("test",Tl,Tl)}catch{ko=!1}var da=null,Mo=null,Hr=null;function qu(){if(Hr)return Hr;var e,t=Mo,a=t.length,n,o="value"in da?da.value:da.textContent,u=o.length;for(e=0;e=Cl),Qu=" ",Ju=!1;function Wu(e,t){switch(e){case"keyup":return ab.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function e0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Tn=!1;function lb(e,t){switch(e){case"compositionend":return e0(t);case"keypress":return t.which!==32?null:(Ju=!0,Qu);case"textInput":return e=t.data,e===Qu&&Ju?null:e;default:return null}}function rb(e,t){if(Tn)return e==="compositionend"||!zo&&Wu(e,t)?(e=qu(),Hr=Mo=da=null,Tn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=o0(a)}}function d0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?d0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function u0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Vr(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Vr(e.document)}return t}function Bo(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var hb=Ps&&"documentMode"in document&&11>=document.documentMode,En=null,Ho=null,kl=null,Go=!1;function m0(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Go||En==null||En!==Vr(n)||(n=En,"selectionStart"in n&&Bo(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),kl&&Dl(kl,n)||(kl=n,n=Pi(Ho,"onSelect"),0>=x,o-=x,gs=1<<32-le(t)+o|a<we?(_e=xe,xe=null):_e=xe.sibling;var Me=G(P,xe,V[we],Q);if(Me===null){xe===null&&(xe=_e);break}e&&xe&&Me.alternate===null&&t(P,xe),O=u(Me,O,we),ke===null?he=Me:ke.sibling=Me,ke=Me,xe=_e}if(we===V.length)return a(P,xe),Oe&&Us(P,we),he;if(xe===null){for(;wewe?(_e=xe,xe=null):_e=xe.sibling;var Da=G(P,xe,Me.value,Q);if(Da===null){xe===null&&(xe=_e);break}e&&xe&&Da.alternate===null&&t(P,xe),O=u(Da,O,we),ke===null?he=Da:ke.sibling=Da,ke=Da,xe=_e}if(Me.done)return a(P,xe),Oe&&Us(P,we),he;if(xe===null){for(;!Me.done;we++,Me=V.next())Me=J(P,Me.value,Q),Me!==null&&(O=u(Me,O,we),ke===null?he=Me:ke.sibling=Me,ke=Me);return Oe&&Us(P,we),he}for(xe=n(xe);!Me.done;we++,Me=V.next())Me=F(xe,P,we,Me.value,Q),Me!==null&&(e&&Me.alternate!==null&&xe.delete(Me.key===null?we:Me.key),O=u(Me,O,we),ke===null?he=Me:ke.sibling=Me,ke=Me);return e&&xe.forEach(function(Mg){return t(P,Mg)}),Oe&&Us(P,we),he}function He(P,O,V,Q){if(typeof V=="object"&&V!==null&&V.type===z&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case R:e:{for(var he=V.key;O!==null;){if(O.key===he){if(he=V.type,he===z){if(O.tag===7){a(P,O.sibling),Q=o(O,V.props.children),Q.return=P,P=Q;break e}}else if(O.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===k&&nn(he)===O.type){a(P,O.sibling),Q=o(O,V.props),zl(Q,V),Q.return=P,P=Q;break e}a(P,O);break}else t(P,O);O=O.sibling}V.type===z?(Q=Wa(V.props.children,P.mode,Q,V.key),Q.return=P,P=Q):(Q=Wr(V.type,V.key,V.props,null,P.mode,Q),zl(Q,V),Q.return=P,P=Q)}return x(P);case E:e:{for(he=V.key;O!==null;){if(O.key===he)if(O.tag===4&&O.stateNode.containerInfo===V.containerInfo&&O.stateNode.implementation===V.implementation){a(P,O.sibling),Q=o(O,V.children||[]),Q.return=P,P=Q;break e}else{a(P,O);break}else t(P,O);O=O.sibling}Q=Qo(V,P.mode,Q),Q.return=P,P=Q}return x(P);case k:return V=nn(V),He(P,O,V,Q)}if(K(V))return ue(P,O,V,Q);if(ae(V)){if(he=ae(V),typeof he!="function")throw Error(c(150));return V=he.call(V),pe(P,O,V,Q)}if(typeof V.then=="function")return He(P,O,ri(V),Q);if(V.$$typeof===T)return He(P,O,si(P,V),Q);ii(P,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,O!==null&&O.tag===6?(a(P,O.sibling),Q=o(O,V),Q.return=P,P=Q):(a(P,O),Q=Ko(V,P.mode,Q),Q.return=P,P=Q),x(P)):a(P,O)}return function(P,O,V,Q){try{Ul=0;var he=He(P,O,V,Q);return Un=null,he}catch(xe){if(xe===In||xe===ni)throw xe;var ke=Ut(29,xe,null,P.mode);return ke.lanes=Q,ke.return=P,ke}finally{}}}var rn=L0(!0),P0=L0(!1),fa=!1;function cc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function dc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ba(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Pe&2)!==0){var o=n.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),n.pending=t,t=Jr(e),v0(e,null,a),t}return Qr(e,n,t,a),Jr(e)}function $l(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,jl(e,a)}}function uc(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var o=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?o=u=x:u=u.next=x,a=a.next}while(a!==null);u===null?o=u=t:u=u.next=t}else o=u=t;a={baseState:n.baseState,firstBaseUpdate:o,lastBaseUpdate:u,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var mc=!1;function Vl(){if(mc){var e=Pn;if(e!==null)throw e}}function Bl(e,t,a,n){mc=!1;var o=e.updateQueue;fa=!1;var u=o.firstBaseUpdate,x=o.lastBaseUpdate,b=o.shared.pending;if(b!==null){o.shared.pending=null;var A=b,B=A.next;A.next=null,x===null?u=B:x.next=B,x=A;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,b=Z.lastBaseUpdate,b!==x&&(b===null?Z.firstBaseUpdate=B:b.next=B,Z.lastBaseUpdate=A))}if(u!==null){var J=o.baseState;x=0,Z=B=A=null,b=u;do{var G=b.lane&-536870913,F=G!==b.lane;if(F?(Ce&G)===G:(n&G)===G){G!==0&&G===Ln&&(mc=!0),Z!==null&&(Z=Z.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ue=e,pe=b;G=t;var He=a;switch(pe.tag){case 1:if(ue=pe.payload,typeof ue=="function"){J=ue.call(He,J,G);break e}J=ue;break e;case 3:ue.flags=ue.flags&-65537|128;case 0:if(ue=pe.payload,G=typeof ue=="function"?ue.call(He,J,G):ue,G==null)break e;J=j({},J,G);break e;case 2:fa=!0}}G=b.callback,G!==null&&(e.flags|=64,F&&(e.flags|=8192),F=o.callbacks,F===null?o.callbacks=[G]:F.push(G))}else F={lane:G,tag:b.tag,payload:b.payload,callback:b.callback,next:null},Z===null?(B=Z=F,A=J):Z=Z.next=F,x|=G;if(b=b.next,b===null){if(b=o.shared.pending,b===null)break;F=b,b=F.next,F.next=null,o.lastBaseUpdate=F,o.shared.pending=null}}while(!0);Z===null&&(A=J),o.baseState=A,o.firstBaseUpdate=B,o.lastBaseUpdate=Z,u===null&&(o.shared.lanes=0),ja|=x,e.lanes=x,e.memoizedState=J}}function I0(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function U0(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;eu?u:8;var x=w.T,b={};w.T=b,Oc(e,!1,t,a);try{var A=o(),B=w.S;if(B!==null&&B(b,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var Z=Sb(A,n);ql(e,t,Z,Ht(e))}else ql(e,t,n,Ht(e))}catch(J){ql(e,t,{then:function(){},status:"rejected",reason:J},Ht())}finally{M.p=u,x!==null&&b.types!==null&&(x.types=b.types),w.T=x}}function Cb(){}function Cc(e,t,a,n){if(e.tag!==5)throw Error(c(476));var o=pm(e).queue;fm(e,o,t,W,a===null?Cb:function(){return bm(e),a(n)})}function pm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:W},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bs,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function bm(e){var t=pm(e);t.next===null&&(t=e.alternate.memoizedState),ql(e,t.next.queue,{},Ht())}function _c(){return bt(or)}function gm(){return at().memoizedState}function vm(){return at().memoizedState}function _b(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ht();e=pa(a);var n=ba(t,e,a);n!==null&&(kt(n,t,a),$l(n,t,a)),t={cache:lc()},e.payload=t;return}t=t.return}}function Ob(e,t,a){var n=Ht();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},bi(e)?Nm(t,a):(a=Xo(e,t,a,n),a!==null&&(kt(a,e,n),jm(a,t,n)))}function ym(e,t,a){var n=Ht();ql(e,t,a,n)}function ql(e,t,a,n){var o={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(bi(e))Nm(t,o);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var x=t.lastRenderedState,b=u(x,a);if(o.hasEagerState=!0,o.eagerState=b,It(b,x))return Qr(e,t,o,0),Ge===null&&Kr(),!1}catch{}finally{}if(a=Xo(e,t,o,n),a!==null)return kt(a,e,n),jm(a,t,n),!0}return!1}function Oc(e,t,a,n){if(n={lane:2,revertLane:cd(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},bi(e)){if(t)throw Error(c(479))}else t=Xo(e,a,n,2),t!==null&&kt(t,e,2)}function bi(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function Nm(e,t){$n=di=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function jm(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,jl(e,a)}}var Fl={readContext:bt,use:xi,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useLayoutEffect:et,useInsertionEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useSyncExternalStore:et,useId:et,useHostTransitionStatus:et,useFormState:et,useActionState:et,useOptimistic:et,useMemoCache:et,useCacheRefresh:et};Fl.useEffectEvent=et;var Sm={readContext:bt,use:xi,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:bt,useEffect:rm,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,fi(4194308,4,dm.bind(null,t,e),a)},useLayoutEffect:function(e,t){return fi(4194308,4,e,t)},useInsertionEffect:function(e,t){fi(4,2,e,t)},useMemo:function(e,t){var a=St();t=t===void 0?null:t;var n=e();if(on){te(!0);try{e()}finally{te(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=St();if(a!==void 0){var o=a(t);if(on){te(!0);try{a(t)}finally{te(!1)}}}else o=t;return n.memoizedState=n.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},n.queue=e,e=e.dispatch=Ob.bind(null,Se,e),[n.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:function(e){e=wc(e);var t=e.queue,a=ym.bind(null,Se,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Ec,useDeferredValue:function(e,t){var a=St();return Rc(a,e,t)},useTransition:function(){var e=wc(!1);return e=fm.bind(null,Se,e.queue,!0,!1),St().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=Se,o=St();if(Oe){if(a===void 0)throw Error(c(407));a=a()}else{if(a=t(),Ge===null)throw Error(c(349));(Ce&127)!==0||G0(n,t,a)}o.memoizedState=a;var u={value:a,getSnapshot:t};return o.queue=u,rm(F0.bind(null,n,u,e),[e]),n.flags|=2048,Bn(9,{destroy:void 0},q0.bind(null,n,u,a,t),null),a},useId:function(){var e=St(),t=Ge.identifierPrefix;if(Oe){var a=vs,n=gs;a=(n&~(1<<32-le(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ui++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof n.is=="string"?x.createElement("select",{is:n.is}):x.createElement("select"),n.multiple?u.multiple=!0:n.size&&(u.size=n.size);break;default:u=typeof n.is=="string"?x.createElement(o,{is:n.is}):x.createElement(o)}}u[ft]=t,u[Et]=n;e:for(x=t.child;x!==null;){if(x.tag===5||x.tag===6)u.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===t)break e;for(;x.sibling===null;){if(x.return===null||x.return===t)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}t.stateNode=u;e:switch(vt(u,o,n),o){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Gs(t)}}return Xe(t),qc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Gs(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(c(166));if(e=ie.current,kn(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,o=pt,o!==null)switch(o.tag){case 27:case 5:n=o.memoizedProps}e[ft]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||Bx(e.nodeValue,a)),e||xa(t,!0)}else e=Ii(e).createTextNode(n),e[ft]=t,t.stateNode=e}return Xe(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=kn(t),a!==null){if(e===null){if(!n)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[ft]=t}else en(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Xe(t),e=!1}else a=tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?($t(t),t):($t(t),null);if((t.flags&128)!==0)throw Error(c(558))}return Xe(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=kn(t),n!==null&&n.dehydrated!==null){if(e===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[ft]=t}else en(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Xe(t),o=!1}else o=tc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?($t(t),t):($t(t),null)}return $t(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,o=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(o=n.alternate.memoizedState.cachePool.pool),u=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),u!==o&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),ji(t,t.updateQueue),Xe(t),null);case 4:return Re(),e===null&&xd(t.stateNode.containerInfo),Xe(t),null;case 10:return $s(t.type),Xe(t),null;case 19:if(Y(st),n=t.memoizedState,n===null)return Xe(t),null;if(o=(t.flags&128)!==0,u=n.rendering,u===null)if(o)Xl(n,!1);else{if(tt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=ci(e),u!==null){for(t.flags|=128,Xl(n,!1),e=u.updateQueue,t.updateQueue=e,ji(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)y0(a,e),a=a.sibling;return D(st,st.current&1|2),Oe&&Us(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&We()>Ei&&(t.flags|=128,o=!0,Xl(n,!1),t.lanes=4194304)}else{if(!o)if(e=ci(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,ji(t,e),Xl(n,!0),n.tail===null&&n.tailMode==="hidden"&&!u.alternate&&!Oe)return Xe(t),null}else 2*We()-n.renderingStartTime>Ei&&a!==536870912&&(t.flags|=128,o=!0,Xl(n,!1),t.lanes=4194304);n.isBackwards?(u.sibling=t.child,t.child=u):(e=n.last,e!==null?e.sibling=u:t.child=u,n.last=u)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=We(),e.sibling=null,a=st.current,D(st,o?a&1|2:a&1),Oe&&Us(t,n.treeForkCount),e):(Xe(t),null);case 22:case 23:return $t(t),hc(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(Xe(t),t.subtreeFlags&6&&(t.flags|=8192)):Xe(t),a=t.updateQueue,a!==null&&ji(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&Y(an),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),$s(lt),Xe(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function Pb(e,t){switch(Wo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return $s(lt),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Mt(t),null;case 31:if(t.memoizedState!==null){if($t(t),t.alternate===null)throw Error(c(340));en()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($t(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));en()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Y(st),null;case 4:return Re(),null;case 10:return $s(t.type),null;case 22:case 23:return $t(t),hc(),e!==null&&Y(an),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return $s(lt),null;case 25:return null;default:return null}}function Ym(e,t){switch(Wo(t),t.tag){case 3:$s(lt),Re();break;case 26:case 27:case 5:Mt(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&$t(t);break;case 13:$t(t);break;case 19:Y(st);break;case 10:$s(t.type);break;case 22:case 23:$t(t),hc(),e!==null&&Y(an);break;case 24:$s(lt)}}function Zl(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var o=n.next;a=o;do{if((a.tag&e)===e){n=void 0;var u=a.create,x=a.inst;n=u(),x.destroy=n}a=a.next}while(a!==o)}}catch(b){ze(t,t.return,b)}}function ya(e,t,a){try{var n=t.updateQueue,o=n!==null?n.lastEffect:null;if(o!==null){var u=o.next;n=u;do{if((n.tag&e)===e){var x=n.inst,b=x.destroy;if(b!==void 0){x.destroy=void 0,o=t;var A=a,B=b;try{B()}catch(Z){ze(o,A,Z)}}}n=n.next}while(n!==u)}}catch(Z){ze(t,t.return,Z)}}function Xm(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{U0(t,a)}catch(n){ze(e,e.return,n)}}}function Zm(e,t,a){a.props=cn(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){ze(e,t,n)}}function Kl(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(o){ze(e,t,o)}}function ys(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(o){ze(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){ze(e,t,o)}else a.current=null}function Km(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(o){ze(e,e.return,o)}}function Fc(e,t,a){try{var n=e.stateNode;ng(n,e.type,a,t),n[Et]=t}catch(o){ze(e,e.return,o)}}function Qm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ea(e.type)||e.tag===4}function Yc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ea(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xc(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Ls));else if(n!==4&&(n===27&&Ea(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,a),e=e.sibling;e!==null;)Xc(e,t,a),e=e.sibling}function Si(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&Ea(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Si(e,t,a),e=e.sibling;e!==null;)Si(e,t,a),e=e.sibling}function Jm(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);vt(t,n,a),t[ft]=e,t[Et]=a}catch(u){ze(e,e.return,u)}}var qs=!1,ot=!1,Zc=!1,Wm=typeof WeakSet=="function"?WeakSet:Set,xt=null;function Ib(e,t){if(e=e.containerInfo,pd=Gi,e=u0(e),Bo(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var o=n.anchorOffset,u=n.focusNode;n=n.focusOffset;try{a.nodeType,u.nodeType}catch{a=null;break e}var x=0,b=-1,A=-1,B=0,Z=0,J=e,G=null;t:for(;;){for(var F;J!==a||o!==0&&J.nodeType!==3||(b=x+o),J!==u||n!==0&&J.nodeType!==3||(A=x+n),J.nodeType===3&&(x+=J.nodeValue.length),(F=J.firstChild)!==null;)G=J,J=F;for(;;){if(J===e)break t;if(G===a&&++B===o&&(b=x),G===u&&++Z===n&&(A=x),(F=J.nextSibling)!==null)break;J=G,G=J.parentNode}J=F}a=b===-1||A===-1?null:{start:b,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(bd={focusedElem:e,selectionRange:a},Gi=!1,xt=t;xt!==null;)if(t=xt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xt=e;else for(;xt!==null;){switch(t=xt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),vt(u,n,a),u[ft]=e,mt(u),n=u;break e;case"link":var x=lh("link","href",o).get(n+(a.href||""));if(x){for(var b=0;bHe&&(x=He,He=pe,pe=x);var P=c0(b,pe),O=c0(b,He);if(P&&O&&(F.rangeCount!==1||F.anchorNode!==P.node||F.anchorOffset!==P.offset||F.focusNode!==O.node||F.focusOffset!==O.offset)){var V=J.createRange();V.setStart(P.node,P.offset),F.removeAllRanges(),pe>He?(F.addRange(V),F.extend(O.node,O.offset)):(V.setEnd(O.node,O.offset),F.addRange(V))}}}}for(J=[],F=b;F=F.parentNode;)F.nodeType===1&&J.push({element:F,left:F.scrollLeft,top:F.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;ba?32:a,w.T=null,a=sd,sd=null;var u=wa,x=Ks;if(dt=0,Yn=wa=null,Ks=0,(Pe&6)!==0)throw Error(c(331));var b=Pe;if(Pe|=4,dx(u.current),ix(u,u.current,x,a),Pe=b,sr(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(ut,u)}catch{}return!0}finally{M.p=o,w.T=n,Rx(e,t)}}function _x(e,t,a){t=Kt(a,t),t=Lc(e.stateNode,t,2),e=ba(e,t,2),e!==null&&(ds(e,2),Ns(e))}function ze(e,t,a){if(e.tag===3)_x(e,e,a);else for(;t!==null;){if(t.tag===3){_x(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Sa===null||!Sa.has(n))){e=Kt(a,e),a=Om(2),n=ba(t,a,2),n!==null&&(Dm(a,n,t,e),ds(n,2),Ns(n));break}}t=t.return}}function rd(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new $b;var o=new Set;n.set(t,o)}else o=n.get(t),o===void 0&&(o=new Set,n.set(t,o));o.has(a)||(Jc=!0,o.add(a),e=qb.bind(null,e,t,a),t.then(e,e))}function qb(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ge===e&&(Ce&a)===a&&(tt===4||tt===3&&(Ce&62914560)===Ce&&300>We()-Ti?(Pe&2)===0&&Xn(e,0):Wc|=a,Fn===Ce&&(Fn=0)),Ns(e)}function Ox(e,t){t===0&&(t=Nl()),e=Ja(e,t),e!==null&&(ds(e,t),Ns(e))}function Fb(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Ox(e,a)}function Yb(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,o=e.memoizedState;o!==null&&(a=o.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(c(314))}n!==null&&n.delete(t),Ox(e,a)}function Xb(e,t){return os(e,t)}var ki=null,Kn=null,id=!1,Mi=!1,od=!1,Ta=0;function Ns(e){e!==Kn&&e.next===null&&(Kn===null?ki=Kn=e:Kn=Kn.next=e),Mi=!0,id||(id=!0,Kb())}function sr(e,t){if(!od&&Mi){od=!0;do for(var a=!1,n=ki;n!==null;){if(e!==0){var o=n.pendingLanes;if(o===0)var u=0;else{var x=n.suspendedLanes,b=n.pingedLanes;u=(1<<31-le(42|e)+1)-1,u&=o&~(x&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,Lx(n,u))}else u=Ce,u=Fa(n,n===Ge?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(u&3)===0||oa(n,u)||(a=!0,Lx(n,u));n=n.next}while(a);od=!1}}function Zb(){Dx()}function Dx(){Mi=id=!1;var e=0;Ta!==0&&rg()&&(e=Ta);for(var t=We(),a=null,n=ki;n!==null;){var o=n.next,u=kx(n,t);u===0?(n.next=null,a===null?ki=o:a.next=o,o===null&&(Kn=a)):(a=n,(e!==0||(u&3)!==0)&&(Mi=!0)),n=o}dt!==0&&dt!==5||sr(e),Ta!==0&&(Ta=0)}function kx(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0b)break;var Z=A.transferSize,J=A.initiatorType;Z&&Hx(J)&&(A=A.responseEnd,x+=Z*(A"u"?null:document;function th(e,t,a){var n=Qn;if(n&&typeof t=="string"&&t){var o=Xt(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),eh.has(o)||(eh.add(o),e={rel:e,crossOrigin:a,href:t},n.querySelector(o)===null&&(t=n.createElement("link"),vt(t,"link",e),mt(t),n.head.appendChild(t)))}}function fg(e){Qs.D(e),th("dns-prefetch",e,null)}function pg(e,t){Qs.C(e,t),th("preconnect",e,t)}function bg(e,t,a){Qs.L(e,t,a);var n=Qn;if(n&&e&&t){var o='link[rel="preload"][as="'+Xt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Xt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Xt(a.imageSizes)+'"]')):o+='[href="'+Xt(e)+'"]';var u=o;switch(t){case"style":u=Jn(e);break;case"script":u=Wn(e)}ss.has(u)||(e=j({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ss.set(u,e),n.querySelector(o)!==null||t==="style"&&n.querySelector(rr(u))||t==="script"&&n.querySelector(ir(u))||(t=n.createElement("link"),vt(t,"link",e),mt(t),n.head.appendChild(t)))}}function gg(e,t){Qs.m(e,t);var a=Qn;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Xt(n)+'"][href="'+Xt(e)+'"]',u=o;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Wn(e)}if(!ss.has(u)&&(e=j({rel:"modulepreload",href:e},t),ss.set(u,e),a.querySelector(o)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(ir(u)))return}n=a.createElement("link"),vt(n,"link",e),mt(n),a.head.appendChild(n)}}}function vg(e,t,a){Qs.S(e,t,a);var n=Qn;if(n&&e){var o=yn(n).hoistableStyles,u=Jn(e);t=t||"default";var x=o.get(u);if(!x){var b={loading:0,preload:null};if(x=n.querySelector(rr(u)))b.loading=5;else{e=j({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ss.get(u))&&wd(e,a);var A=x=n.createElement("link");mt(A),vt(A,"link",e),A._p=new Promise(function(B,Z){A.onload=B,A.onerror=Z}),A.addEventListener("load",function(){b.loading|=1}),A.addEventListener("error",function(){b.loading|=2}),b.loading|=4,zi(x,t,n)}x={type:"stylesheet",instance:x,count:1,state:b},o.set(u,x)}}}function yg(e,t){Qs.X(e,t);var a=Qn;if(a&&e){var n=yn(a).hoistableScripts,o=Wn(e),u=n.get(o);u||(u=a.querySelector(ir(o)),u||(e=j({src:e,async:!0},t),(t=ss.get(o))&&Ad(e,t),u=a.createElement("script"),mt(u),vt(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(o,u))}}function Ng(e,t){Qs.M(e,t);var a=Qn;if(a&&e){var n=yn(a).hoistableScripts,o=Wn(e),u=n.get(o);u||(u=a.querySelector(ir(o)),u||(e=j({src:e,async:!0,type:"module"},t),(t=ss.get(o))&&Ad(e,t),u=a.createElement("script"),mt(u),vt(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(o,u))}}function sh(e,t,a,n){var o=(o=ie.current)?Ui(o):null;if(!o)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Jn(a.href),a=yn(o).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Jn(a.href);var u=yn(o).hoistableStyles,x=u.get(e);if(x||(o=o.ownerDocument||o,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,x),(u=o.querySelector(rr(e)))&&!u._p&&(x.instance=u,x.state.loading=5),ss.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ss.set(e,a),u||jg(o,e,a,x.state))),t&&n===null)throw Error(c(528,""));return x}if(t&&n!==null)throw Error(c(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Wn(a),a=yn(o).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function Jn(e){return'href="'+Xt(e)+'"'}function rr(e){return'link[rel="stylesheet"]['+e+"]"}function ah(e){return j({},e,{"data-precedence":e.precedence,precedence:null})}function jg(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),vt(t,"link",a),mt(t),e.head.appendChild(t))}function Wn(e){return'[src="'+Xt(e)+'"]'}function ir(e){return"script[async]"+e}function nh(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+Xt(a.href)+'"]');if(n)return t.instance=n,mt(n),n;var o=j({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),mt(n),vt(n,"style",o),zi(n,a.precedence,e),t.instance=n;case"stylesheet":o=Jn(a.href);var u=e.querySelector(rr(o));if(u)return t.state.loading|=4,t.instance=u,mt(u),u;n=ah(a),(o=ss.get(o))&&wd(n,o),u=(e.ownerDocument||e).createElement("link"),mt(u);var x=u;return x._p=new Promise(function(b,A){x.onload=b,x.onerror=A}),vt(u,"link",n),t.state.loading|=4,zi(u,a.precedence,e),t.instance=u;case"script":return u=Wn(a.src),(o=e.querySelector(ir(u)))?(t.instance=o,mt(o),o):(n=a,(o=ss.get(u))&&(n=j({},a),Ad(n,o)),e=e.ownerDocument||e,o=e.createElement("script"),mt(o),vt(o,"link",n),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,zi(n,a.precedence,e));return t.instance}function zi(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=n.length?n[n.length-1]:null,u=o,x=0;x title"):null)}function Sg(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function ih(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function wg(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=Jn(n.href),u=t.querySelector(rr(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Vi.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=u,mt(u);return}u=t.ownerDocument||t,n=ah(n),(o=ss.get(o))&&wd(n,o),u=u.createElement("link"),mt(u);var x=u;x._p=new Promise(function(b,A){x.onload=b,x.onerror=A}),vt(u,"link",n),a.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Vi.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Td=0;function Ag(e,t){return e.stylesheets&&e.count===0&&Hi(e,e.stylesheets),0Td?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(o)}}:null}function Vi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Bi=null;function Hi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Bi=new Map,t.forEach(Tg,e),Bi=null,Vi.call(e))}function Tg(e,t){if(!(t.state.loading&4)){var a=Bi.get(e);if(a)var n=a.get(null);else{a=new Map,Bi.set(e,a);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(l){console.error(l)}}return r(),Ld.exports=Hg(),Ld.exports}var qg=Gg();/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fg=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Yg=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(l,i,c)=>c?c.toUpperCase():i.toLowerCase()),Oh=r=>{const l=Yg(r);return l.charAt(0).toUpperCase()+l.slice(1)},vf=(...r)=>r.filter((l,i,c)=>!!l&&l.trim()!==""&&c.indexOf(l)===i).join(" ").trim(),Xg=r=>{for(const l in r)if(l.startsWith("aria-")||l==="role"||l==="title")return!0};/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Zg={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kg=$.forwardRef(({color:r="currentColor",size:l=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:d="",children:m,iconNode:h,...g},p)=>$.createElement("svg",{ref:p,...Zg,width:l,height:l,stroke:r,strokeWidth:c?Number(i)*24/Number(l):i,className:vf("lucide",d),...!m&&!Xg(g)&&{"aria-hidden":"true"},...g},[...h.map(([f,N])=>$.createElement(f,N)),...Array.isArray(m)?m:[m]]));/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const de=(r,l)=>{const i=$.forwardRef(({className:c,...d},m)=>$.createElement(Kg,{ref:m,iconNode:l,className:vf(`lucide-${Fg(Oh(r))}`,`lucide-${r}`,c),...d}));return i.displayName=Oh(r),i};/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qg=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],sa=de("activity",Qg);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jg=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],Ha=de("arrow-down-right",Jg);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wg=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],e1=de("arrow-right",Wg);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t1=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],aa=de("arrow-up-right",t1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s1=[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]],Zd=de("award",s1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a1=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],n1=de("bell-off",a1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l1=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],cl=de("bell",l1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r1=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],Kd=de("calculator",r1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i1=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],o1=de("calendar",i1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c1=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],go=de("chart-column",c1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d1=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],yf=de("chart-no-axes-column",d1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u1=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],sl=de("check",u1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m1=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],x1=de("chevron-down",m1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h1=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Nf=de("chevron-left",h1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f1=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Er=de("chevron-right",f1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p1=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],b1=de("chevron-up",p1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],uu=de("circle-alert",g1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v1=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],y1=de("circle-check-big",v1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ia=de("circle-check",N1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],S1=de("circle-x",j1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w1=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],gl=de("clock",w1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],T1=de("columns-3",A1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E1=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],mu=de("compass",E1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R1=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],C1=de("cpu",R1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _1=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],O1=de("dollar-sign",_1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],al=de("download",D1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Dh=de("external-link",k1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qd=de("eye",M1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L1=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Jd=de("file-text",L1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P1=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],Va=de("flame",P1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I1=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],kh=de("flask-conical",I1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],z1=de("folder-open",U1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],V1=de("grid-3x3",$1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],br=de("hard-drive",B1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],G1=de("info",H1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],ls=de("layers",q1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F1=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Y1=de("layout-grid",F1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X1=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Z1=de("list",X1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],zd=de("lock",K1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],J1=de("log-out",Q1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W1=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],ev=de("percent",W1);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tv=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Gt=de("play",tv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sv=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],av=de("plus",sv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nv=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],lv=de("printer",nv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rv=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ua=de("radio",rv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iv=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Rr=de("refresh-cw",iv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ov=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],jf=de("rotate-ccw",ov);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cv=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Mh=de("rotate-cw",cv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dv=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Sf=de("search",dv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uv=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],dl=de("shield-alert",uv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mv=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ul=de("shield-check",mv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xv=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],hv=de("shield",xv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fv=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],ml=de("sliders-vertical",fv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pv=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],wf=de("sparkles",pv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bv=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],gv=de("square",bv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vv=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],gr=de("table",vv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],As=de("target",yv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nv=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],to=de("trash-2",Nv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jv=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],Cr=de("trending-down",jv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sv=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Ts=de("trending-up",Sv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wv=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],xl=de("triangle-alert",wv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Av=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],Tv=de("volume-1",Av);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ev=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Es=de("volume-2",Ev);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rv=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],yr=de("volume-x",Rv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cv=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],na=de("x",Cv);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _v=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ct=de("zap",_v);let ka=null,io=!1;function xu(){if(typeof window>"u")return null;if(!ka){const r=window.AudioContext||window.webkitAudioContext;r&&(ka=new r)}return ka&&ka.state==="suspended"?ka.resume().then(()=>{io=!0}).catch(()=>{}):ka&&ka.state==="running"&&(io=!0),ka}async function Af(){if(typeof window>"u")return!1;try{const r=xu();return r?(r.state==="suspended"&&await r.resume(),io=r.state==="running",io):!1}catch(r){return console.warn("Audio unlock warning:",r),!1}}if(typeof window<"u"){const r=()=>{Af().catch(()=>{})};["pointerdown","touchstart","click","keydown"].forEach(l=>{window.addEventListener(l,r,{capture:!0,passive:!0})})}const as=[{id:"EXPLOSION_SIREN",name:"Sirene de Explosão (Breakout 8%+)",description:"Sirene alternada de alta potência para rompimentos explosivos e Squeeze",harmonicProfile:"880Hz / 1320Hz Alerta Pulsante (Sawtooth/Square)",badge:"🚨 Emergência"},{id:"BREAKOUT_ARPEGGIO",name:"Breakout Arpeggiado",description:"Arpejo ascendente de 4 notas brilhantes e enérgicas",harmonicProfile:"C5 - E5 - G5 - C6 (Sine/Triangle)",badge:"Alta Energia"},{id:"REVERSAL_DEEP",name:"Ressonância de Reversão",description:"Gongo institucional grave com sustentação harmônica",harmonicProfile:"220Hz + 440Hz com Decay Suave",badge:"Institucional"},{id:"CONTINUATION_PULSE",name:"Pulso Duplo de Continuação",description:"Dois pings rápidos e límpidos confirmando tendência",harmonicProfile:"659Hz -> 880Hz (Dual Ping)",badge:"Confirmação"},{id:"CHIME_ASCENDING",name:"Chime Institucional",description:"Chime ascendente em 3 tons estilo terminal de negociação",harmonicProfile:"D5 -> A5 -> D6 (Triad Chime)",badge:"Terminal Pro"},{id:"VOLATILITY_ALERT",name:"Alerta de Volatilidade",description:"Tom de atenção estacado para stop hunts e choques macro",harmonicProfile:"740Hz -> 880Hz (Urgent Pulse)",badge:"Atenção"},{id:"CYBER_RADAR",name:"Radar Cibernético",description:"Blip sintético de alta definição para scanners e detecções",harmonicProfile:"987Hz -> 1318Hz (FM Blip)",badge:"Tecnológico"},{id:"SOFT_PING",name:"Ping Suave Informativo",description:"Sino delicado com decaimento suave para eventos discretos",harmonicProfile:"523Hz C5 (Soft Bell)",badge:"Discreto"},{id:"ZEN_MARIMBA",name:"Harmonia Zen",description:"Acorde tríade suave e relaxante para status e varreduras",harmonicProfile:"440Hz + 554Hz + 659Hz (Sine Triad)",badge:"Suave"},{id:"MUTE",name:"Silencioso (Mudo)",description:"Nenhum som emitido para esta categoria",harmonicProfile:"Sem áudio",badge:"Mudo"}],ns={masterEnabled:!0,masterVolume:.85,highPriorityVolume:1,infoVolume:.6,explosion:{highPriorityTone:"EXPLOSION_SIREN",infoTone:"VOLATILITY_ALERT",enabled:!0},breakout:{highPriorityTone:"BREAKOUT_ARPEGGIO",infoTone:"SOFT_PING",enabled:!0},reversal:{highPriorityTone:"REVERSAL_DEEP",infoTone:"CYBER_RADAR",enabled:!0},continuation:{highPriorityTone:"CONTINUATION_PULSE",infoTone:"SOFT_PING",enabled:!0},volatility:{highPriorityTone:"VOLATILITY_ALERT",infoTone:"SOFT_PING",enabled:!0},systemStatus:{highPriorityTone:"CHIME_ASCENDING",infoTone:"ZEN_MARIMBA",enabled:!0}},Tf="god_protocol_audio_settings_v2";function vo(){if(typeof window>"u")return ns;try{const r=localStorage.getItem(Tf);if(!r)return ns;const l=JSON.parse(r);return{...ns,...l,explosion:{...ns.explosion,...l.explosion||{}},breakout:{...ns.breakout,...l.breakout||{}},reversal:{...ns.reversal,...l.reversal||{}},continuation:{...ns.continuation,...l.continuation||{}},volatility:{...ns.volatility,...l.volatility||{}},systemStatus:{...ns.systemStatus,...l.systemStatus||{}}}}catch{return ns}}function oo(r){if(!(typeof window>"u"))try{localStorage.setItem(Tf,JSON.stringify(r))}catch(l){console.error("Failed to save audio settings to localStorage:",l)}}function Ov(){return oo(ns),ns}function vl(r,l=1){if(r!=="MUTE")try{const i=xu();if(!i)return;i.state==="suspended"&&i.resume().catch(()=>{});const c=Math.max(.05,Math.min(1,l)),d=i.currentTime+.01;switch(r){case"EXPLOSION_SIREN":{[880,1318.5,880,1318.5,1046.5,1760].forEach((h,g)=>{const p=i.createOscillator(),f=i.createGain();p.type="sawtooth",p.frequency.setValueAtTime(h,d+g*.08),f.gain.setValueAtTime(0,d+g*.08),f.gain.linearRampToValueAtTime(.42*c,d+g*.08+.015),f.gain.linearRampToValueAtTime(0,d+g*.08+.075),p.connect(f),f.connect(i.destination),p.start(d+g*.08),p.stop(d+g*.08+.08)});break}case"BREAKOUT_ARPEGGIO":{[523.25,659.25,783.99,1046.5].forEach((h,g)=>{const p=i.createOscillator(),f=i.createGain();p.type="triangle",p.frequency.setValueAtTime(h,d+g*.07),f.gain.setValueAtTime(0,d+g*.07),f.gain.linearRampToValueAtTime(.38*c,d+g*.07+.02),f.gain.linearRampToValueAtTime(0,d+g*.07+.28),p.connect(f),f.connect(i.destination),p.start(d+g*.07),p.stop(d+g*.07+.3)});break}case"REVERSAL_DEEP":{const m=i.createOscillator(),h=i.createOscillator(),g=i.createGain();m.type="sine",m.frequency.setValueAtTime(220,d),m.frequency.linearRampToValueAtTime(196,d+.6),h.type="triangle",h.frequency.setValueAtTime(440,d),h.frequency.linearRampToValueAtTime(392,d+.6),g.gain.setValueAtTime(0,d),g.gain.linearRampToValueAtTime(.4*c,d+.04),g.gain.linearRampToValueAtTime(0,d+.75),m.connect(g),h.connect(g),g.connect(i.destination),m.start(d),h.start(d),m.stop(d+.8),h.stop(d+.8);break}case"CONTINUATION_PULSE":{[659.25,880].forEach((h,g)=>{const p=i.createOscillator(),f=i.createGain();p.type="sine",p.frequency.setValueAtTime(h,d+g*.12),f.gain.setValueAtTime(0,d+g*.12),f.gain.linearRampToValueAtTime(.35*c,d+g*.12+.02),f.gain.linearRampToValueAtTime(0,d+g*.12+.25),p.connect(f),f.connect(i.destination),p.start(d+g*.12),p.stop(d+g*.12+.26)});break}case"CHIME_ASCENDING":{const m=i.createOscillator(),h=i.createGain();m.type="sine",m.frequency.setValueAtTime(587.33,d),m.frequency.linearRampToValueAtTime(880,d+.14),m.frequency.linearRampToValueAtTime(1174.66,d+.32),h.gain.setValueAtTime(0,d),h.gain.linearRampToValueAtTime(.38*c,d+.05),h.gain.linearRampToValueAtTime(0,d+.65),m.connect(h),h.connect(i.destination),m.start(d),m.stop(d+.65);break}case"VOLATILITY_ALERT":{[739.99,880,880].forEach((h,g)=>{const p=i.createOscillator(),f=i.createGain();p.type="sawtooth",p.frequency.setValueAtTime(h,d+g*.08),f.gain.setValueAtTime(0,d+g*.08),f.gain.linearRampToValueAtTime(.32*c,d+g*.08+.01),f.gain.linearRampToValueAtTime(0,d+g*.08+.12),p.connect(f),f.connect(i.destination),p.start(d+g*.08),p.stop(d+g*.08+.14)});break}case"CYBER_RADAR":{const m=i.createOscillator(),h=i.createGain();m.type="sine",m.frequency.setValueAtTime(987.77,d),m.frequency.linearRampToValueAtTime(1318.51,d+.12),h.gain.setValueAtTime(0,d),h.gain.linearRampToValueAtTime(.35*c,d+.02),h.gain.linearRampToValueAtTime(0,d+.28),m.connect(h),h.connect(i.destination),m.start(d),m.stop(d+.3);break}case"SOFT_PING":{const m=i.createOscillator(),h=i.createGain();m.type="triangle",m.frequency.setValueAtTime(523.25,d),h.gain.setValueAtTime(0,d),h.gain.linearRampToValueAtTime(.35*c,d+.02),h.gain.linearRampToValueAtTime(0,d+.45),m.connect(h),h.connect(i.destination),m.start(d),m.stop(d+.45);break}case"ZEN_MARIMBA":{[440,554.37,659.25].forEach(h=>{const g=i.createOscillator(),p=i.createGain();g.type="sine",g.frequency.setValueAtTime(h,d),p.gain.setValueAtTime(0,d),p.gain.linearRampToValueAtTime(.25*c,d+.03),p.gain.linearRampToValueAtTime(0,d+.55),g.connect(p),p.connect(i.destination),g.start(d),g.stop(d+.55)});break}}}catch(i){console.warn("Audio playback handled gracefully:",i)}}async function Nr(r="EXPLOSION_SIREN"){const l=await Af();return vl(r,1),l}function Ef(r){var h,g,p,f,N,j,L,R,E,z,H,q,I;if(((h=r.squeezeBreakout)==null?void 0:h.state)==="IGNICAO_DISPARADA"||(((g=r.squeezeBreakout)==null?void 0:g.explosionScore)||0)>=80||Math.abs(r.change24h)>=7.5)return"EXPLOSION";const l=(((f=(p=r.tripleScreen)==null?void 0:p.mtf)==null?void 0:f.pattern)||"").toLowerCase(),i=(j=(N=r.tripleScreen)==null?void 0:N.mtf)==null?void 0:j.dynamicSupportResistance,c=(E=(R=(L=r.fourPillars)==null?void 0:L.smc)==null?void 0:R.liquiditySweep)==null?void 0:E.detected,d=((H=(z=r.fourPillars)==null?void 0:z.wyckoff)==null?void 0:H.currentPhase)||"",m=((I=(q=r.tripleScreen)==null?void 0:q.ltf)==null?void 0:I.rsiStatus)||"";return i==="Rompida"||l.includes("romp")||l.includes("triâng")||l.includes("bandeira")||Math.abs(r.change24h)>=4.5?"BREAKOUT":c||l.includes("duplo")||l.includes("ombro-cabeça")||d.includes("Spring")||d.includes("UTAD")||m.includes("Sobre")?"REVERSAL":"CONTINUATION"}function Dv(r){switch(r){case"EXPLOSION":return{type:"EXPLOSION",label:"🔥 Explosão 8%+ (Squeeze Fire)",color:"bg-rose-500/20 text-rose-300 border-rose-500/40"};case"BREAKOUT":return{type:"BREAKOUT",label:"Breakout (Rompimento)",color:"bg-amber-500/15 text-amber-400 border-amber-500/30"};case"REVERSAL":return{type:"REVERSAL",label:"Reversão (Sweep / Exaustão)",color:"bg-purple-500/15 text-purple-400 border-purple-500/30"};case"CONTINUATION":default:return{type:"CONTINUATION",label:"Continuação (Tendência / Pullback)",color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30"}}}function hu(r,l,i){const c=i||vo();if(!c.masterEnabled)return;const d=Ef(r);let m;if(d==="EXPLOSION"?m=c.explosion:d==="BREAKOUT"?m=c.breakout:d==="REVERSAL"?m=c.reversal:m=c.continuation,!m.enabled)return;const h=m.highPriorityTone,g=c.highPriorityVolume,p=c.masterVolume*g;vl(h,p)}function kv(r,l){const i=l||vo();if(!i.masterEnabled)return;const c=r.severity==="high"||r.type==="CRITICAL_SIGNAL"||r.type==="SQUEEZE_BREAKOUT";let d=i.systemStatus;if(r.type==="SQUEEZE_BREAKOUT"||r.type==="EXPLOSION_ALERT"?d=i.explosion:r.type==="VOLATILITY_SPIKE"||r.type==="FUNDING_ALERT"?d=i.volatility:r.type==="LIQUIDITY_SWEEP"?d=i.reversal:r.type==="CRITICAL_SIGNAL"&&(d=i.breakout),!d.enabled)return;const m=c?d.highPriorityTone:d.infoTone,h=c?i.highPriorityVolume:i.infoVolume,g=i.masterVolume*h;vl(m,g)}function hr(r,l=1){const i=vo();if(!i.masterEnabled)return;const c=xu();if(!c)return;const d=c.currentTime,m=Math.max(.1,Math.min(1,i.masterVolume*l));try{r==="TRADE_TRIGGERED"?[523.25,783.99].forEach((g,p)=>{const f=c.createOscillator(),N=c.createGain();f.type="triangle",f.frequency.setValueAtTime(g,d+p*.09),N.gain.setValueAtTime(0,d+p*.09),N.gain.linearRampToValueAtTime(.42*m,d+p*.09+.02),N.gain.linearRampToValueAtTime(0,d+p*.09+.22),f.connect(N),N.connect(c.destination),f.start(d+p*.09),f.stop(d+p*.09+.24)}):r==="TAKE_PROFIT"?[523.25,659.25,783.99,1046.5].forEach((g,p)=>{const f=c.createOscillator(),N=c.createGain();f.type="sine",f.frequency.setValueAtTime(g,d+p*.08),N.gain.setValueAtTime(0,d+p*.08),N.gain.linearRampToValueAtTime(.4*m,d+p*.08+.03),N.gain.linearRampToValueAtTime(0,d+p*.08+.45),f.connect(N),N.connect(c.destination),f.start(d+p*.08),f.stop(d+p*.08+.48)}):r==="STOP_LOSS"?[440,349.23,261.63].forEach((g,p)=>{const f=c.createOscillator(),N=c.createGain();f.type="sawtooth",f.frequency.setValueAtTime(g,d+p*.11),N.gain.setValueAtTime(0,d+p*.11),N.gain.linearRampToValueAtTime(.35*m,d+p*.11+.02),N.gain.linearRampToValueAtTime(0,d+p*.11+.18),f.connect(N),N.connect(c.destination),f.start(d+p*.11),f.stop(d+p*.11+.2)}):r==="NEAR_TRIGGER"&&[659.25,880].forEach((g,p)=>{const f=c.createOscillator(),N=c.createGain();f.type="sine",f.frequency.setValueAtTime(g,d+p*.12),N.gain.setValueAtTime(0,d+p*.12),N.gain.linearRampToValueAtTime(.28*m,d+p*.12+.02),N.gain.exponentialRampToValueAtTime(.001,d+p*.12+.11),f.connect(N),N.connect(c.destination),f.start(d+p*.12),f.stop(d+p*.12+.12)})}catch(h){console.warn("Trade lifecycle alarm playback error:",h)}}const Mv=({autoScan:r,onToggleAutoScan:l,scanInterval:i,onChangeInterval:c,isScanning:d,onManualScan:m,unreadNotifications:h,onOpenNotifications:g,onOpenExport:p,soundEnabled:f,onToggleSound:N,onOpenSoundSettings:j,lastUpdated:L,dataSource:R,onOpenGoogleWorkspace:E,isGoogleConnected:z})=>s.jsx("header",{id:"god-protocol-header",className:"bg-slate-900 border-b border-slate-800 text-slate-100 sticky top-0 z-40 w-full overflow-x-hidden",children:s.jsx("div",{className:"max-w-7xl mx-auto px-3 sm:px-6 lg:px-8",children:s.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between py-2.5 sm:py-3 gap-2.5 sm:gap-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2.5 sm:gap-3",children:[s.jsx("div",{className:"w-9 h-9 sm:w-10 sm:h-10 rounded-lg bg-gradient-to-br from-amber-500/20 to-emerald-500/20 border border-amber-500/40 flex items-center justify-center text-amber-400 font-bold tracking-wider shadow-inner shrink-0",children:s.jsx(ls,{className:"w-5 h-5 text-amber-400"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 flex-wrap",children:[s.jsx("h1",{className:"text-base sm:text-lg font-bold tracking-tight text-white flex items-center gap-1.5",children:"THE GOD PROTOCOL"}),s.jsx("span",{className:"text-amber-400 font-mono text-[10px] sm:text-xs px-1.5 py-0.5 rounded bg-amber-400/10 border border-amber-400/30",children:"v2026 • Top 100"})]}),s.jsxs("p",{className:"text-[11px] sm:text-xs text-slate-400 flex items-center gap-1.5 flex-wrap",children:[s.jsx("span",{className:"hidden xs:inline",children:"Agente Quantitativo Multi-Timeframe"}),s.jsxs("span",{className:"text-emerald-400 flex items-center gap-1",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"4 Pilares"]}),s.jsx("span",{className:"text-slate-600 lg:hidden",children:"•"}),s.jsx("span",{className:"text-amber-300 font-mono text-[10px] lg:hidden",children:L||"BRT"})]})]})]}),s.jsxs("div",{className:"flex md:hidden items-center gap-1.5",children:[s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg p-0.5",children:[s.jsx("button",{onClick:N,className:`p-1.5 rounded text-xs transition ${f?"bg-amber-500/15 text-amber-400":"text-slate-500"}`,title:f?"Alertas sonoros ativados (Clique para silenciar)":"Silenciado (Clique para ativar)",children:f?s.jsx(Es,{className:"w-3.5 h-3.5"}):s.jsx(yr,{className:"w-3.5 h-3.5"})}),j&&s.jsx("button",{onClick:j,className:"p-1.5 text-slate-400 hover:text-amber-400 transition border-l border-slate-800",title:"Configurar sons por tipo de sinal",children:s.jsx(ml,{className:"w-3.5 h-3.5"})})]}),s.jsxs("button",{onClick:g,className:"relative p-1.5 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-lg text-slate-200 transition",title:"Avisos do sistema",children:[s.jsx(cl,{className:"w-4 h-4"}),h>0&&s.jsx("span",{className:"absolute -top-1 -right-1 px-1.5 py-0.2 bg-rose-500 text-white font-mono text-[9px] font-bold rounded-full",children:h})]})]})]}),s.jsxs("div",{className:"hidden lg:flex items-center gap-3 text-xs font-mono bg-slate-950/70 px-3 py-1.5 rounded-lg border border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-emerald-400",title:R||"Top 100 Criptomoedas por Market Cap",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),s.jsx("span",{className:"font-semibold text-emerald-300",children:"Tempo Real: Top 100 Criptos"})]}),s.jsx("span",{className:"text-slate-700",children:"|"}),s.jsxs("div",{className:"flex items-center gap-1.5 text-slate-300",children:[s.jsx(C1,{className:"w-3.5 h-3.5 text-sky-400"}),s.jsx("span",{children:"Cloud Run"})]}),s.jsx("span",{className:"text-slate-700",children:"|"}),s.jsxs("div",{className:"flex items-center gap-1.5 text-amber-300",title:"Horário de Brasília (BRT / UTC-3)",children:[s.jsx(sa,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsx("span",{children:L?`${L} (Brasília)`:"Sincronizando..."})]})]}),s.jsxs("div",{className:"flex items-center flex-wrap gap-1.5 sm:gap-2",children:[s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg p-0.5 sm:p-1 text-xs",children:[s.jsxs("button",{id:"btn-toggle-autoscan",onClick:l,className:`px-2 sm:px-2.5 py-1 rounded font-medium transition-colors flex items-center gap-1 sm:gap-1.5 text-[11px] sm:text-xs ${r?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30":"text-slate-400 hover:text-slate-200"}`,title:"Ativar/Desativar varredura automática",children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${r?"bg-emerald-400 animate-ping":"bg-slate-500"}`}),s.jsx("span",{children:r?"Auto-Scan":"Pausado"})]}),r&&s.jsxs("select",{id:"select-scan-interval",value:i,onChange:H=>c(Number(H.target.value)),className:"bg-transparent text-slate-300 text-[11px] sm:text-xs px-1.5 sm:px-2 py-0.5 border-l border-slate-800 focus:outline-none cursor-pointer",title:"Frequência de varredura do mercado",children:[s.jsx("option",{value:30,className:"bg-slate-900",children:"30s (Rápido)"}),s.jsx("option",{value:60,className:"bg-slate-900",children:"60s (1 min • Recomendado)"}),s.jsx("option",{value:120,className:"bg-slate-900",children:"2 min (Estável)"}),s.jsx("option",{value:300,className:"bg-slate-900",children:"5 min (Sem Ruído)"}),s.jsx("option",{value:900,className:"bg-slate-900",children:"15 min (Swing Trade)"})]})]}),s.jsxs("button",{id:"btn-manual-scan",onClick:m,disabled:d,className:"px-2.5 sm:px-3 py-1 sm:py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-200 text-[11px] sm:text-xs font-medium rounded-lg border border-slate-700 transition flex items-center gap-1.5 disabled:opacity-50",children:[s.jsx(Rr,{className:`w-3.5 h-3.5 ${d?"animate-spin text-amber-400":"text-slate-300"}`}),s.jsx("span",{children:"Varredura"})]}),s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg p-0.5",children:[s.jsxs("button",{id:"btn-toggle-sound",onClick:N,className:`px-2 py-1 rounded-md text-xs transition flex items-center gap-1.5 ${f?"bg-amber-500/15 text-amber-400 font-semibold":"bg-rose-500/15 text-rose-400 font-semibold animate-pulse"}`,title:f?"Alertas sonoros ativos (Clique para mutar)":"Alertas sonoros mudos (Clique para ativar)",children:[f?s.jsx(Es,{className:"w-3.5 h-3.5"}):s.jsx(yr,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline text-[11px]",children:f?"Som Ativo":"Ativar Som"})]}),s.jsx("button",{id:"btn-quick-sound-test",onClick:H=>{H.stopPropagation(),Nr("EXPLOSION_SIREN")},className:"p-1 px-1.5 rounded-md text-[10px] text-amber-300 hover:text-amber-200 hover:bg-slate-800/80 transition border-l border-slate-800/80 font-mono",title:"Testar e reproduzir sirene agora",children:"Testar"}),j&&s.jsx("button",{id:"btn-open-sound-settings",onClick:j,className:"p-1.5 rounded-md text-slate-400 hover:text-amber-400 hover:bg-slate-800/80 transition border-l border-slate-800/80",title:"Configurar sons por tipo de sinal (Breakout, Explosão, Reversão)",children:s.jsx(ml,{className:"w-3.5 h-3.5"})})]}),s.jsxs("button",{id:"btn-open-notifications",onClick:g,className:"hidden md:flex relative p-1.5 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-lg text-slate-200 transition",title:"Notificações críticas do sistema",children:[s.jsx(cl,{className:"w-4 h-4"}),h>0&&s.jsx("span",{className:"absolute -top-1 -right-1 px-1.5 py-0.2 bg-rose-500 text-white font-mono text-[10px] font-bold rounded-full animate-bounce shadow-md",children:h})]}),E&&s.jsxs("button",{id:"btn-open-workspace",onClick:E,className:`px-2 sm:px-2.5 py-1 sm:py-1.5 rounded-lg border text-[11px] sm:text-xs font-medium transition flex items-center gap-1 sm:gap-1.5 ${z?"bg-sky-500/15 border-sky-500/40 text-sky-300":"bg-slate-800 hover:bg-slate-700 border-slate-700 text-slate-300"}`,title:"Google Drive & Google Sheets",children:[s.jsx("span",{className:`w-1.5 sm:w-2 h-1.5 sm:h-2 rounded-full ${z?"bg-emerald-400":"bg-slate-500"}`}),s.jsx("span",{children:"Drive & Sheets"})]}),s.jsxs("button",{id:"btn-open-export",onClick:p,className:"px-2.5 sm:px-3 py-1 sm:py-1.5 bg-gradient-to-r from-amber-500 to-amber-600 hover:from-amber-400 hover:to-amber-500 text-slate-950 font-semibold text-[11px] sm:text-xs rounded-lg shadow-sm transition flex items-center gap-1 sm:gap-1.5",children:[s.jsx(al,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Relatório"})]})]})]})})}),Lv=({signals:r,backtest:l,onFilterQualified:i})=>{const c=r.length,d=r.filter(j=>j.passedFilter),m=r.filter(j=>j.decision==="COMPRA").length,h=r.filter(j=>j.decision==="VENDA").length,g=(l==null?void 0:l.winRate)??74.2,p=(l==null?void 0:l.profitFactor)??3.42,f=(l==null?void 0:l.maxDrawdownPercent)??4.8,N=(l==null?void 0:l.netProfitPercent)??128.4;return s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-3",children:[s.jsxs("div",{className:"bg-slate-900/90 border border-slate-800 rounded-xl p-3.5 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[s.jsx("span",{children:"Ativos Monitorados"}),s.jsx(go,{className:"w-4 h-4 text-sky-400"})]}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[s.jsx("span",{className:"text-2xl font-bold font-mono text-white tracking-tight",children:c}),s.jsx("span",{className:"text-xs text-slate-400",children:"Top 100 Market Cap"})]}),s.jsxs("div",{className:"mt-1 text-[11px] text-slate-500 flex items-center gap-1.5",children:[s.jsxs("span",{className:"text-emerald-400 font-medium",children:[m," Longs"]}),s.jsx("span",{children:"•"}),s.jsxs("span",{className:"text-rose-400 font-medium",children:[h," Shorts"]})]})]}),s.jsxs("div",{onClick:i,className:"bg-slate-900/90 border border-amber-500/30 hover:border-amber-500/60 rounded-xl p-3.5 shadow-sm cursor-pointer transition group",title:"Clique para filtrar apenas os sinais que passaram no filtro quantitativo",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-amber-400 font-medium",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ct,{className:"w-3.5 h-3.5 fill-amber-400"}),"Setups Qualificados"]}),s.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/30 text-amber-300",children:"≥ 75%"})]}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[s.jsx("span",{className:"text-2xl font-bold font-mono text-amber-400 tracking-tight",children:d.length}),s.jsx("span",{className:"text-xs text-slate-400",children:"prontos p/ executar"})]}),s.jsxs("div",{className:"mt-1 text-[11px] text-slate-400 group-hover:text-amber-300 transition flex items-center gap-1",children:[s.jsx("span",{children:"Filtro R/R ≥ 2:1 & ATR Stop"}),s.jsx("span",{className:"text-amber-400",children:"→"})]})]}),s.jsxs("div",{className:"bg-slate-900/90 border border-slate-800 rounded-xl p-3.5 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[s.jsx("span",{children:"Win Rate Diário (Backtest)"}),s.jsx(As,{className:"w-4 h-4 text-emerald-400"})]}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-2xl font-bold font-mono text-emerald-400 tracking-tight",children:[g,"%"]}),s.jsx("span",{className:"text-xs text-slate-400 font-mono",children:"60 dias"})]}),s.jsxs("div",{className:"mt-1 text-[11px] text-slate-400 flex items-center gap-1",children:[s.jsxs("span",{className:"text-emerald-400 font-semibold font-mono",children:["+",N,"%"]}),s.jsx("span",{children:"retorno líquido simulado"})]})]}),s.jsxs("div",{className:"bg-slate-900/90 border border-slate-800 rounded-xl p-3.5 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[s.jsx("span",{children:"Fator de Lucro"}),s.jsx(Ts,{className:"w-4 h-4 text-indigo-400"})]}),s.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-2xl font-bold font-mono text-indigo-300 tracking-tight",children:[p,"x"]}),s.jsx("span",{className:"text-xs text-slate-400",children:"Gross P/L"})]}),s.jsxs("div",{className:"mt-1 text-[11px] text-slate-400 flex items-center gap-1",children:[s.jsx("span",{children:"Max DD:"}),s.jsxs("span",{className:"text-amber-400 font-mono font-medium",children:[f,"%"]}),s.jsx("span",{children:"(Baixo Risco)"})]})]}),s.jsxs("div",{className:"col-span-2 md:col-span-4 lg:col-span-1 bg-slate-900/90 border border-slate-800 rounded-xl p-3.5 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400 font-medium",children:[s.jsx("span",{children:"Regime Wyckoff & Sentimento"}),s.jsx(dl,{className:"w-4 h-4 text-amber-400"})]}),s.jsx("div",{className:"mt-2 flex items-baseline gap-2",children:s.jsx("span",{className:"text-base font-semibold text-slate-200 truncate",children:"Reacumulação"})}),s.jsxs("div",{className:"mt-1 text-[11px] text-slate-400 flex items-center justify-between",children:[s.jsx("span",{children:"Funding Médio:"}),s.jsx("span",{className:"text-emerald-400 font-mono font-semibold",children:"+0.009% (Saudável)"})]})]})]})};function Wd(r=Date.now(),l=!0){const i=typeof r=="number"?new Date(r):r;try{return i.toLocaleTimeString("pt-BR",{timeZone:"America/Sao_Paulo",hour:"2-digit",minute:"2-digit",...l?{second:"2-digit"}:{}})}catch{const d=new Date(i.getTime()-108e5),m=String(d.getUTCHours()).padStart(2,"0"),h=String(d.getUTCMinutes()).padStart(2,"0"),g=String(d.getUTCSeconds()).padStart(2,"0");return l?`${m}:${h}:${g}`:`${m}:${h}`}}function Lh(r){return!r||r<=0?"—":r>=1e12?`$${(r/1e12).toFixed(2)}T`:r>=1e9?`$${(r/1e9).toFixed(2)}B`:r>=1e6?`$${(r/1e6).toFixed(1)}M`:`$${r.toLocaleString()}`}function Pv(r){if(r.style)return r.style;const l=r.timeframe;return l&&["3m","5m","15m","30m"].includes(l)?"SCALP":l&&["1h","2h"].includes(l)?"DAY_TRADE":l&&["4h","8h","12h","1d"].includes(l)?"SWING_TRADE":l&&["3d","5d","1w","2w"].includes(l)?"POSITION":Math.abs(r.change24h)>=7?"SCALP":r.riskReward>=2.5?"SWING_TRADE":"DAY_TRADE"}const Ph=({price:r,change24h:l})=>{const i=l??0,c=r??0,d=i>=0;let m="";return c>=100?m=c.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):c>=1?m=c.toLocaleString(void 0,{minimumFractionDigits:3,maximumFractionDigits:4}):m=c.toFixed(c<.001?6:4),s.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md text-[11px] font-mono font-bold transition-all shadow-xs ${d?"bg-emerald-500/15 border border-emerald-500/40 text-emerald-300":"bg-rose-500/15 border border-rose-500/40 text-rose-300"}`,title:`Cotação de mercado em tempo real: $${m} (${d?"+":""}${i}% em 24h)`,children:[s.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 animate-pulse ${d?"bg-emerald-400":"bg-rose-400"}`}),s.jsxs("span",{children:["$",m]}),s.jsx("span",{className:"text-[10px] leading-none",children:d?"▲":"▼"}),s.jsx("span",{className:"text-[10px] opacity-90 font-medium",children:d?`+${i}%`:`${i}%`})]})},Iv=({signals:r,selectedSymbol:l,onSelectSymbol:i,onOpenRiskCalc:c,filterOnlyQualified:d,setFilterOnlyQualified:m})=>{const[h,g]=$.useState(""),[p,f]=$.useState("ALL"),[N,j]=$.useState(0),[L,R]=$.useState("ALL"),[E,z]=$.useState("mcap_rank"),[H,q]=$.useState(!1),[I,T]=$.useState("ALL"),[y,S]=$.useState(1),[X,v]=$.useState(25),[k,se]=$.useState("auto"),ne=$.useMemo(()=>r.filter(C=>!(h&&!C.symbol.toLowerCase().includes(h.toLowerCase())&&!C.name.toLowerCase().includes(h.toLowerCase())||d&&!C.passedFilter||H&&(!C.passedFilter||C.confidence<80||C.riskReward<2||C.decision==="AGUARDAR")||I!=="ALL"&&Pv(C)!==I||L==="TOP10"&&(C.marketCapRank||999)>10||L==="TOP50"&&(C.marketCapRank||999)>50||L==="TOP100"&&(C.marketCapRank||999)>100||p!=="ALL"&&C.decision!==p||N>0&&C.riskRewardE==="mcap_rank"?(C.marketCapRank||999)-(K.marketCapRank||999):E==="confidence"?K.confidence-C.confidence:E==="rr"?K.riskReward-C.riskReward:E==="change"?Math.abs(K.change24h)-Math.abs(C.change24h):C.symbol.localeCompare(K.symbol)),[r,h,d,H,I,L,p,N,E]);ol.useEffect(()=>{S(1)},[h,d,H,I,L,p,N,E,X]);const U=Math.max(1,Math.ceil(ne.length/X)),ae=(y-1)*X,ce=ne.slice(ae,ae+X);return s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl overflow-hidden shadow-sm",children:[s.jsxs("div",{className:"p-4 border-b border-slate-800 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-base font-bold text-white flex items-center gap-2",children:s.jsx("span",{children:"Scanner Quantitativo: Top 100 Criptomoedas"})}),s.jsx("span",{className:"text-xs font-mono text-amber-400 bg-amber-400/10 border border-amber-400/30 px-2 py-0.5 rounded-full font-semibold",children:"Ranking Market Cap"})]}),s.jsxs("p",{className:"text-xs text-slate-400 mt-1",children:["Monitorando ",r.length," maiores criptos globais com confluência das 4 escolas e execução Triple Screen."]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg p-0.5 text-xs font-mono",children:[s.jsx("button",{onClick:()=>R("ALL"),className:`px-2 py-1 rounded transition ${L==="ALL"?"bg-slate-800 text-white font-bold":"text-slate-400 hover:text-slate-200"}`,title:"Todas as 100 maiores criptos",children:"Top 100"}),s.jsx("button",{onClick:()=>R("TOP50"),className:`px-2 py-1 rounded transition ${L==="TOP50"?"bg-slate-800 text-white font-bold":"text-slate-400 hover:text-slate-200"}`,title:"Top 50 Maiores",children:"Top 50"}),s.jsx("button",{onClick:()=>R("TOP10"),className:`px-2 py-1 rounded transition ${L==="TOP10"?"bg-slate-800 text-white font-bold":"text-slate-400 hover:text-slate-200"}`,title:"Top 10 Maiores",children:"Top 10"})]}),s.jsxs("div",{className:"relative min-w-[150px]",children:[s.jsx(Sf,{className:"w-3.5 h-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-slate-500"}),s.jsx("input",{id:"input-search-symbol",type:"text",placeholder:"Buscar (ex: BTC, SOL, ADA)...",value:h,onChange:C=>g(C.target.value),className:"w-full bg-slate-950 border border-slate-800 rounded-lg pl-8 pr-3 py-1.5 text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-amber-500/50"})]}),s.jsxs("button",{id:"btn-filter-qualified-toggle",onClick:()=>m(!d),className:`px-2.5 py-1.5 text-xs rounded-lg font-medium border transition flex items-center gap-1.5 ${d?"bg-amber-500/20 text-amber-300 border-amber-500/40 shadow-sm":"bg-slate-950 text-slate-400 border-slate-800 hover:text-slate-200"}`,children:[s.jsx(ia,{className:`w-3.5 h-3.5 ${d?"text-amber-400":"text-slate-500"}`}),s.jsx("span",{children:"Filtro God Protocol (≥75%)"})]}),s.jsxs("button",{id:"btn-anti-clutter-toggle",onClick:()=>{const C=!H;q(C),C&&m(!0)},className:`px-2.5 py-1.5 text-xs rounded-lg font-medium border transition flex items-center gap-1.5 ${H?"bg-emerald-500/20 text-emerald-300 border-emerald-500/40 shadow-sm font-bold":"bg-slate-950 text-slate-400 border-slate-800 hover:text-slate-200"}`,title:"Modo Anti-Encavalamento: elimina sinais incertos e ruído de mercado, mostrando apenas confluências comprovadas (≥80% e R/R ≥1:2.0)",children:[s.jsx(ul,{className:`w-3.5 h-3.5 ${H?"text-emerald-400":"text-slate-500"}`}),s.jsx("span",{children:"Anti-Encavalamento (≥80%)"})]}),s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg px-2 py-1 text-xs",children:[s.jsx("span",{className:"text-slate-500 mr-1",children:"Estilo:"}),s.jsxs("select",{id:"select-style-filter",value:I,onChange:C=>T(C.target.value),className:"bg-transparent text-slate-300 focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"ALL",className:"bg-slate-900",children:"Todos os Estilos"}),s.jsx("option",{value:"SCALP",className:"bg-slate-900 text-amber-300",children:"SCALP (3m-30m)"}),s.jsx("option",{value:"DAY_TRADE",className:"bg-slate-900 text-sky-300",children:"DAY TRADE (1h-2h)"}),s.jsx("option",{value:"SWING_TRADE",className:"bg-slate-900 text-purple-300",children:"SWING TRADE (4h-1d)"}),s.jsx("option",{value:"POSITION",className:"bg-slate-900 text-emerald-300",children:"POSITION TRADE (3d-2w)"})]})]}),s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg px-2 py-1 text-xs",children:[s.jsx("span",{className:"text-slate-500 mr-1",children:"Sinal:"}),s.jsxs("select",{id:"select-decision-filter",value:p,onChange:C=>f(C.target.value),className:"bg-transparent text-slate-300 focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"ALL",className:"bg-slate-900",children:"Todos"}),s.jsx("option",{value:"COMPRA",className:"bg-slate-900 text-emerald-400",children:"COMPRA (LONG)"}),s.jsx("option",{value:"VENDA",className:"bg-slate-900 text-rose-400",children:"VENDA (SHORT)"}),s.jsx("option",{value:"AGUARDAR",className:"bg-slate-900 text-slate-400",children:"AGUARDAR"})]})]}),s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg px-2 py-1 text-xs font-mono",children:[s.jsxs("span",{className:"text-slate-500 mr-1 flex items-center gap-1",children:[s.jsx(As,{className:"w-3 h-3 text-amber-400"}),"R/R Mín:"]}),s.jsxs("select",{id:"select-min-rr-filter",value:N,onChange:C=>j(Number(C.target.value)),className:"bg-transparent text-amber-300 font-mono focus:outline-none cursor-pointer",children:[s.jsx("option",{value:0,className:"bg-slate-900 text-white",children:"Todos"}),s.jsx("option",{value:1.5,className:"bg-slate-900 text-white",children:"≥ 1:1.5"}),s.jsx("option",{value:2,className:"bg-slate-900 text-white",children:"≥ 1:2.0"}),s.jsx("option",{value:2.5,className:"bg-slate-900 text-white",children:"≥ 1:2.5"}),s.jsx("option",{value:3,className:"bg-slate-900 text-amber-300 font-bold",children:"≥ 1:3.0"}),s.jsx("option",{value:4,className:"bg-slate-900 text-amber-300 font-bold",children:"≥ 1:4.0"}),s.jsx("option",{value:5,className:"bg-slate-900 text-emerald-400 font-bold",children:"≥ 1:5.0 (Alta Assimetria)"}),s.jsx("option",{value:6,className:"bg-slate-900 text-emerald-400 font-bold",children:"≥ 1:6.0 (Institucional)"}),s.jsx("option",{value:8,className:"bg-slate-900 text-purple-400 font-bold",children:"≥ 1:8.0 (Alavancado)"}),s.jsx("option",{value:10,className:"bg-slate-900 text-rose-400 font-bold",children:"≥ 1:10.0 (Super Assimetria)"})]})]}),s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg px-2 py-1 text-xs",children:[s.jsx("span",{className:"text-slate-500 mr-1",children:"Ordem:"}),s.jsxs("select",{id:"select-sort-by",value:E,onChange:C=>z(C.target.value),className:"bg-transparent text-slate-300 focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"mcap_rank",className:"bg-slate-900",children:"Rank Market Cap (#1-#100)"}),s.jsx("option",{value:"confidence",className:"bg-slate-900",children:"Maior Confiança"}),s.jsx("option",{value:"rr",className:"bg-slate-900",children:"Maior Risco/Retorno"}),s.jsx("option",{value:"change",className:"bg-slate-900",children:"Maior Volatilidade"}),s.jsx("option",{value:"symbol",className:"bg-slate-900",children:"Alfabético"})]})]}),s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg p-0.5 text-xs font-mono",children:[s.jsx("button",{id:"btn-layout-auto",onClick:()=>se("auto"),className:`px-2 py-1 rounded transition text-[11px] ${k==="auto"?"bg-slate-800 text-amber-400 font-bold":"text-slate-400 hover:text-slate-200"}`,title:"Modo Responsivo Automático (Cards no Celular, Tabela no Desktop)",children:"Auto"}),s.jsx("button",{id:"btn-layout-cards",onClick:()=>se("cards"),className:`p-1.5 rounded transition ${k==="cards"?"bg-slate-800 text-amber-400":"text-slate-400 hover:text-slate-200"}`,title:"Visualização em Cards",children:s.jsx(Y1,{className:"w-3.5 h-3.5"})}),s.jsx("button",{id:"btn-layout-table",onClick:()=>se("table"),className:`p-1.5 rounded transition ${k==="table"?"bg-slate-800 text-amber-400":"text-slate-400 hover:text-slate-200"}`,title:"Visualização em Tabela Completa",children:s.jsx(Z1,{className:"w-3.5 h-3.5"})})]})]})]}),H&&s.jsxs("div",{className:"mx-4 mt-3.5 p-3 bg-emerald-950/40 border border-emerald-500/30 rounded-lg flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 text-xs font-mono text-emerald-300",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ul,{className:"w-4 h-4 text-emerald-400 shrink-0"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Modo Anti-Encavalamento Ativo:"})," Exibindo ",ne.length," operações de altíssima convicção institucional (Confluência ≥ 80%, R/R ≥ 1:2.0 e Gatilho Imediato). Ruído secundário filtrado."]})]}),s.jsx("button",{onClick:()=>q(!1),className:"text-[11px] underline text-emerald-400 hover:text-white font-medium self-start sm:self-auto",children:"Desativar Filtro"})]}),ce.length===0?s.jsx("div",{className:"py-12 px-4 text-center text-slate-500",children:s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[s.jsx(uu,{className:"w-8 h-8 text-slate-600"}),s.jsx("span",{className:"font-semibold text-slate-400",children:"Nenhum ativo corresponde aos filtros selecionados."}),s.jsx("button",{onClick:()=>{g(""),m(!1),f("ALL"),j(0),R("ALL"),z("mcap_rank")},className:"mt-1 text-xs text-amber-400 hover:underline",children:"Redefinir filtros do Top 100"})]})}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:`${k==="table"?"hidden":k==="cards"?"block":"block md:hidden"} p-3 space-y-3`,children:s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:ce.map(C=>{const K=l===C.symbol,w=C.decision==="COMPRA",M=C.decision==="VENDA",W=C.currentPrice??0;let oe="";return W>=100?oe=W.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):W>=1?oe=W.toLocaleString(void 0,{minimumFractionDigits:3,maximumFractionDigits:4}):oe=W.toFixed(W<.001?6:4),s.jsxs("div",{onClick:()=>i(C.symbol),className:`p-3.5 rounded-xl border transition flex flex-col justify-between gap-3 cursor-pointer ${K?"bg-amber-500/10 border-amber-500 shadow-md ring-1 ring-amber-500/30":"bg-slate-950/60 border-slate-800/80 hover:border-slate-700 hover:bg-slate-900/50"}`,children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-amber-400/10 border border-amber-400/30 text-amber-400 font-bold",children:["#",C.marketCapRank||"—"]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("span",{className:"font-bold text-white font-mono text-sm",children:C.symbol}),s.jsx(Ph,{price:C.currentPrice,change24h:C.change24h}),s.jsxs("span",{className:"text-xs text-slate-400 font-normal",children:["(",C.name,")"]})]}),s.jsxs("div",{className:"text-[11px] text-slate-500 font-mono",children:["MCap: ",Lh(C.marketCap)]})]})]}),s.jsxs("div",{className:"flex flex-col items-end",children:[s.jsxs("div",{className:"font-mono font-bold text-white text-sm",children:["$",oe]}),s.jsxs("div",{className:`text-[11px] font-mono font-semibold flex items-center gap-0.5 ${C.change24h>=0?"text-emerald-400":"text-rose-400"}`,children:[C.change24h>=0?s.jsx(aa,{className:"w-3 h-3"}):s.jsx(Ha,{className:"w-3 h-3"}),C.change24h>=0?`+${C.change24h}%`:`${C.change24h}%`]})]})]}),s.jsxs("div",{className:"bg-slate-900/80 border border-slate-800/80 rounded-lg p-2 flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-[10px] uppercase font-mono text-slate-500",children:"Decisão"}),s.jsxs("div",{className:"mt-0.5",children:[w&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-emerald-500/20 text-emerald-300 border border-emerald-500/40 text-[11px] font-bold font-mono inline-flex items-center gap-1",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"COMPRA"]}),M&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-rose-500/20 text-rose-300 border border-rose-500/40 text-[11px] font-bold font-mono inline-flex items-center gap-1",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400 animate-pulse"}),"VENDA"]}),!w&&!M&&s.jsx("span",{className:"px-2 py-0.5 rounded bg-slate-800 text-slate-400 border border-slate-700 text-[11px] font-medium font-mono",children:"AGUARDAR"})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"text-[10px] uppercase font-mono text-slate-500",children:"Confiança IA"}),s.jsxs("div",{className:"flex items-center gap-1.5 justify-end mt-0.5",children:[s.jsx("div",{className:"w-14 bg-slate-800 h-1.5 rounded-full overflow-hidden border border-slate-700",children:s.jsx("div",{className:`h-full rounded-full ${C.confidence>=75?"bg-emerald-400":"bg-amber-400"}`,style:{width:`${C.confidence}%`}})}),s.jsxs("span",{className:`text-xs font-bold font-mono ${C.confidence>=75?"text-emerald-400":"text-amber-400"}`,children:[C.confidence,"%"]})]})]})]}),s.jsxs("div",{className:"space-y-1.5 text-xs font-mono",children:[s.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[s.jsx("span",{className:"text-slate-400",children:"Triple Screen:"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs("span",{className:`px-1.5 py-0.2 rounded border text-[10px] ${C.tripleScreen.htf.trend.includes("ALTA")?"bg-emerald-500/10 text-emerald-300 border-emerald-500/30":C.tripleScreen.htf.trend.includes("BAIXA")?"bg-rose-500/10 text-rose-300 border-rose-500/30":"bg-slate-900 border-slate-800 text-slate-300"}`,children:["1D: ",C.tripleScreen.htf.trend.includes("ALTA")?"ALTA":C.tripleScreen.htf.trend.includes("BAIXA")?"BAIXA":"LAT"]}),s.jsxs("span",{className:"px-1.5 py-0.2 rounded bg-slate-900 border border-slate-800 text-slate-300 text-[10px]",children:["1H: ",C.tripleScreen.mtf.dynamicSupportResistance.includes("Suporte")?"SUP":"RES"]}),s.jsxs("span",{className:"px-1.5 py-0.2 rounded bg-slate-900 border border-slate-800 text-slate-300 text-[10px]",children:["15m: ",C.tripleScreen.ltf.emaCross.includes("Alta")?"9>21":"9<21"]})]})]}),s.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[s.jsx("span",{className:"text-slate-400",children:"Risco/Retorno & Stop:"}),s.jsxs("span",{className:"text-slate-200",children:[s.jsxs("strong",{className:"text-amber-400 font-bold",children:["1:",C.riskReward]})," • ",s.jsxs("span",{className:"text-rose-400",children:["$",C.stopLoss]})]})]})]}),s.jsxs("div",{className:"pt-2 border-t border-slate-800/80 flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>i(C.symbol),className:`flex-1 py-1.5 px-3 rounded-lg text-xs font-medium border transition flex items-center justify-center gap-1.5 ${K?"bg-amber-500 text-slate-950 font-bold border-amber-400":"bg-slate-800 hover:bg-slate-700 text-slate-200 border-slate-700"}`,children:[s.jsx(Qd,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:K?"Em Foco":"Ver Análise"})]}),s.jsx("button",{onClick:be=>{be.stopPropagation(),c(C)},className:"p-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition",title:"Calcular Risco e Lote",children:s.jsx(Kd,{className:"w-4 h-4"})})]})]},`card-${C.id}`)})})}),s.jsx("div",{className:`${k==="cards"?"hidden":k==="table"?"block":"hidden md:block"} overflow-x-auto no-scrollbar`,children:s.jsxs("table",{className:"w-full text-left border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-800/80 bg-slate-950/50 text-[11px] font-mono uppercase tracking-wider text-slate-400",children:[s.jsx("th",{className:"py-3 px-4",children:"Rank / Ativo"}),s.jsx("th",{className:"py-3 px-3",children:"Preço / 24h"}),s.jsx("th",{className:"py-3 px-3",children:"Market Cap"}),s.jsx("th",{className:"py-3 px-3",children:"Triple Screen (1D • 1H • 15m)"}),s.jsx("th",{className:"py-3 px-3",children:"4 Pilares (TA • SMC • Wyck • Sent)"}),s.jsx("th",{className:"py-3 px-3",children:"Confiança IA"}),s.jsx("th",{className:"py-3 px-3",children:"R/R Mín"}),s.jsx("th",{className:"py-3 px-3",children:"Stop ATR"}),s.jsx("th",{className:"py-3 px-3",children:"Decisão"}),s.jsx("th",{className:"py-3 px-4 text-right",children:"Ações"})]})}),s.jsx("tbody",{className:"divide-y divide-slate-800/60 text-xs",children:ce.map(C=>{const K=l===C.symbol,w=C.decision==="COMPRA",M=C.decision==="VENDA",W=C.currentPrice??0;let oe="";return W>=100?oe=W.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):W>=1?oe=W.toLocaleString(void 0,{minimumFractionDigits:3,maximumFractionDigits:4}):oe=W.toFixed(W<.001?6:4),s.jsxs("tr",{onClick:()=>i(C.symbol),className:`transition cursor-pointer ${K?"bg-amber-500/10 border-l-4 border-amber-500":"hover:bg-slate-800/50"}`,children:[s.jsx("td",{className:"py-3 px-4 whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-slate-800 border border-slate-700 flex flex-col items-center justify-center shrink-0",children:s.jsxs("span",{className:"text-[10px] font-mono font-bold text-amber-400",children:["#",C.marketCapRank||"—"]})}),s.jsxs("div",{children:[s.jsxs("div",{className:"font-bold text-white font-mono flex items-center gap-1.5 flex-wrap",children:[s.jsx("span",{children:C.symbol}),s.jsx(Ph,{price:C.currentPrice,change24h:C.change24h}),C.passedFilter&&s.jsx("span",{className:"px-1.5 py-0.2 rounded text-[9px] font-mono bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 font-semibold",children:"QUALIFICADO"})]}),s.jsx("div",{className:"text-[11px] text-slate-400 truncate max-w-[120px]",children:C.name})]})]})}),s.jsxs("td",{className:"py-3 px-3 whitespace-nowrap",children:[s.jsxs("div",{className:"font-mono text-slate-200 font-medium",children:["$",oe]}),s.jsxs("div",{className:`text-[11px] font-mono flex items-center gap-0.5 ${C.change24h>=0?"text-emerald-400":"text-rose-400"}`,children:[C.change24h>=0?s.jsx(aa,{className:"w-3 h-3"}):s.jsx(Ha,{className:"w-3 h-3"}),C.change24h>=0?`+${C.change24h}%`:`${C.change24h}%`]})]}),s.jsx("td",{className:"py-3 px-3 font-mono text-xs text-slate-300 whitespace-nowrap",children:s.jsx("span",{className:"px-2 py-0.5 rounded bg-slate-950 border border-slate-800 text-slate-200 font-semibold",children:Lh(C.marketCap)})}),s.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-1 font-mono text-[10px]",children:[s.jsxs("span",{className:`px-1.5 py-0.5 rounded border ${C.tripleScreen.htf.trend.includes("ALTA")?"bg-emerald-500/10 text-emerald-300 border-emerald-500/30":C.tripleScreen.htf.trend.includes("BAIXA")?"bg-rose-500/10 text-rose-300 border-rose-500/30":"bg-slate-800 text-slate-400 border-slate-700"}`,title:`HTF Diário: ${C.tripleScreen.htf.trend}`,children:["1D: ",C.tripleScreen.htf.trend.includes("ALTA")?"ALTA":C.tripleScreen.htf.trend.includes("BAIXA")?"BAIXA":"LAT"]}),s.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-slate-800 text-slate-300 border border-slate-700 truncate max-w-[85px]",title:`MTF 1H: ${C.tripleScreen.mtf.pattern} • ${C.tripleScreen.mtf.dynamicSupportResistance}`,children:["1H: ",C.tripleScreen.mtf.dynamicSupportResistance.includes("Suporte")?"SUP":"RES"]}),s.jsxs("span",{className:`px-1.5 py-0.5 rounded border ${C.tripleScreen.ltf.emaCross.includes("Alta")?"bg-emerald-500/10 text-emerald-300 border-emerald-500/30":C.tripleScreen.ltf.emaCross.includes("Baixa")?"bg-rose-500/10 text-rose-300 border-rose-500/30":"bg-slate-800 text-slate-400 border-slate-700"}`,title:`LTF 15m: ${C.tripleScreen.ltf.emaCross} • RSI: ${C.tripleScreen.ltf.rsi}`,children:["15m: ",C.tripleScreen.ltf.emaCross.includes("Alta")?"9>21":"9<21"]})]})}),s.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-1 font-mono text-[10px]",children:[s.jsxs("span",{className:"px-1 py-0.5 rounded bg-slate-800 text-slate-300 border border-slate-700",title:`Técnica Clássica: ${C.fourPillars.classicTA.score}%`,children:["TA:",C.fourPillars.classicTA.score]}),s.jsxs("span",{className:"px-1 py-0.5 rounded bg-slate-800 text-slate-300 border border-slate-700",title:`SMC & Liquidez: ${C.fourPillars.smc.score}%`,children:["SMC:",C.fourPillars.smc.score]}),s.jsxs("span",{className:"px-1 py-0.5 rounded bg-slate-800 text-slate-300 border border-slate-700",title:`Wyckoff: ${C.fourPillars.wyckoff.score}%`,children:["WYK:",C.fourPillars.wyckoff.score]}),s.jsxs("span",{className:"px-1 py-0.5 rounded bg-slate-800 text-slate-300 border border-slate-700",title:`Sentimento Futuros: ${C.fourPillars.sentiment.score}%`,children:["SEN:",C.fourPillars.sentiment.score]})]})}),s.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-14 bg-slate-800 rounded-full h-2 overflow-hidden border border-slate-700",children:s.jsx("div",{className:`h-full rounded-full transition-all ${C.confidence>=75?"bg-gradient-to-r from-amber-400 to-emerald-400":C.confidence>=60?"bg-amber-400":"bg-slate-500"}`,style:{width:`${C.confidence}%`}})}),s.jsxs("span",{className:`font-mono font-bold text-xs ${C.confidence>=75?"text-emerald-400":"text-slate-400"}`,children:[C.confidence,"%"]})]})}),s.jsx("td",{className:"py-3 px-3 whitespace-nowrap",children:s.jsxs("span",{className:`font-mono text-xs font-semibold px-2 py-0.5 rounded border ${C.riskReward>=2?"bg-emerald-500/10 text-emerald-300 border-emerald-500/30":"bg-slate-800 text-slate-400 border-slate-700"}`,children:["1:",C.riskReward]})}),s.jsxs("td",{className:"py-3 px-3 font-mono text-xs text-slate-300 whitespace-nowrap",children:[s.jsxs("div",{children:["$",C.stopLoss]}),s.jsxs("div",{className:"text-[10px] text-slate-500",children:["ATR: ",C.atrValue]})]}),s.jsxs("td",{className:"py-3 px-3 whitespace-nowrap",children:[w&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md text-xs font-bold font-mono bg-emerald-500/20 text-emerald-300 border border-emerald-500/40 shadow-sm",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"COMPRA"]}),M&&s.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-md text-xs font-bold font-mono bg-rose-500/20 text-rose-300 border border-rose-500/40 shadow-sm",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400 animate-pulse"}),"VENDA"]}),!w&&!M&&s.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-mono bg-slate-800 text-slate-400 border border-slate-700",children:"AGUARDAR"})]}),s.jsx("td",{className:"py-3 px-4 text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[s.jsxs("button",{id:`btn-view-analysis-${C.symbol}`,onClick:()=>i(C.symbol),className:`px-2.5 py-1 text-xs rounded-lg font-medium border transition flex items-center gap-1 ${K?"bg-amber-500 text-slate-950 font-bold border-amber-400":"bg-slate-800 hover:bg-slate-700 text-slate-200 border-slate-700"}`,title:"Examinar Análise Triple Screen & 4 Pilares",children:[s.jsx(Qd,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:K?"Em Foco":"Ver Análise"})]}),s.jsx("button",{id:`btn-calc-risk-${C.symbol}`,onClick:be=>{be.stopPropagation(),c(C)},className:"p-1 text-xs rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition",title:"Calcular dimensionamento de posição e risco",children:s.jsx(Kd,{className:"w-3.5 h-3.5"})})]})})]},C.id)})})]})})]}),s.jsxs("div",{className:"p-3 border-t border-slate-800 bg-slate-950/70 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 text-xs",children:[s.jsxs("div",{className:"text-slate-400 font-mono",children:["Exibindo ",s.jsx("span",{className:"text-white font-bold",children:Math.min(ae+1,ne.length)})," a"," ",s.jsx("span",{className:"text-white font-bold",children:Math.min(ae+X,ne.length)})," de"," ",s.jsx("span",{className:"text-amber-400 font-bold",children:ne.length})," criptomoedas filtradas (Total de ",r.length,")"]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-slate-400",children:[s.jsx("span",{children:"Por página:"}),s.jsxs("select",{value:X,onChange:C=>v(Number(C.target.value)),className:"bg-slate-900 border border-slate-800 text-slate-300 rounded px-2 py-0.5 text-xs focus:outline-none cursor-pointer",children:[s.jsx("option",{value:20,children:"20"}),s.jsx("option",{value:25,children:"25"}),s.jsx("option",{value:50,children:"50"}),s.jsx("option",{value:100,children:"100 (Todos)"})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>S(C=>Math.max(1,C-1)),disabled:y===1,className:"p-1 rounded bg-slate-900 border border-slate-800 text-slate-300 hover:bg-slate-800 disabled:opacity-40 disabled:cursor-not-allowed transition",title:"Página Anterior",children:s.jsx(Nf,{className:"w-4 h-4"})}),s.jsxs("span",{className:"px-2 font-mono text-slate-300",children:[y," / ",U]}),s.jsx("button",{onClick:()=>S(C=>Math.min(U,C+1)),disabled:y===U,className:"p-1 rounded bg-slate-900 border border-slate-800 text-slate-300 hover:bg-slate-800 disabled:opacity-40 disabled:cursor-not-allowed transition",title:"Próxima Página",children:s.jsx(Er,{className:"w-4 h-4"})})]})]})]})]})};function Rf(r,l){if(!r||!l||r.length<3||l.length<3)return .85;const i=Math.min(r.length,l.length),c=r.slice(-i),d=l.slice(-i),m=c.reduce((L,R)=>L+R,0)/i,h=d.reduce((L,R)=>L+R,0)/i;let g=0,p=0,f=0;for(let L=0;L0):r.map(i=>Number(((i-l)/l*100).toFixed(2)))}function so(r){var m,h;if(r.sparkline7d&&r.sparkline7d.length>=7){const g=r.sparkline7d;if(g.length>50){const p=Math.floor(g.length/28),f=[];for(let N=0;N0)return l.map(g=>g.close);const i=r.currentPrice,c=r.change24h/100,d=(r.change7d||r.change24h*2.5)/100;return[i/(1+d),i/(1+d*.7),i/(1+d*.5),i/(1+d*.3),i/(1+c),i*(1-c*.5),i]}function Uv(r,l="BTC/USDT"){if(l==="BTC/USDT"){const c=r.find(d=>d.symbol==="BTC/USDT"||d.symbol.startsWith("BTC"));if(c){const d=so(c),m=c.change7d??Number(((d[d.length-1]-d[0])/(d[0]||1)*100).toFixed(2));return{series:d,symbol:"BTC/USDT",name:"Bitcoin (Macro Leader)",change7d:m,change24h:c.change24h}}}if(l==="ETH/USDT"){const c=r.find(d=>d.symbol==="ETH/USDT"||d.symbol.startsWith("ETH"));if(c){const d=so(c),m=c.change7d??Number(((d[d.length-1]-d[0])/(d[0]||1)*100).toFixed(2));return{series:d,symbol:"ETH/USDT",name:"Ethereum (Altcoin Leader)",change7d:m,change24h:c.change24h}}}const i=r.slice(0,10);if(i.length>0){const d=new Array(20).fill(0);let m=0;i.forEach((f,N)=>{const j=Math.max(1,10-N);m+=j;const L=so(f),R=co(L);for(let E=0;E<20;E++){const z=Math.floor(E/19*(R.length-1));d[E]+=(R[z]||0)*j}});const h=d.map(f=>Number((f/m).toFixed(2))),g=h[h.length-1]-h[0],p=Number((i.reduce((f,N)=>f+N.change24h,0)/i.length).toFixed(2));return{series:h,symbol:"TOP10/INDEX",name:"Índice Ponderado Top 10",change7d:Number(g.toFixed(2)),change24h:p}}return{series:[100,101.5,100.8,103.2,104.5,103.8,105.4],symbol:"BTC/USDT",name:"Bitcoin (Macro Leader)",change7d:5.4,change24h:1.8}}function zv(r,l="BTC/USDT"){const i=Uv(r,l),c=co(i.series),d=r.map(z=>{const H=so(z),q=co(H),I=Rf(q,c),T=z.change7d??(H.length>=2&&H[0]>0?Number(((H[H.length-1]-H[0])/H[0]*100).toFixed(2)):Number((z.change24h*2.8).toFixed(2))),y=Number((T-i.change7d).toFixed(2)),S=I>0?Number((I*(Math.abs(T)/(Math.abs(i.change7d)||1))).toFixed(2)):Number((I*.8).toFixed(2));let X="Correlação Moderada";I>=.7?X="Forte Correlação Positiva":I>=.3?X="Correlação Moderada":I>-.3?X="Descorrelacionado":X="Correlação Inversa";let v="Sincronizado com Macro (Beta)";return y>=4&&T>0?I<.4?v="Breakout Descorrelacionado":v="Líder em Expansão (Alpha)":y<=-4?v="Laggard / Subdesempenho":I<=-.25?v="Hedge / Contra-Tendência":v="Sincronizado com Macro (Beta)",{signal:z,change7d:T,macroChange7d:i.change7d,alpha7d:y,correlation:I,beta:Math.max(-3,Math.min(3,S||1)),trendAlignment:X,archetype:v,sparkline7d:H,macroSparkline7d:i.series}}),m=d.filter(z=>z.change7d>0).length,h=r.length>0?Math.round(m/r.length*100):65;let g="LATERAL / CONSOLIDAÇÃO";i.change7d>=4&&h>=60?g="ALTA FORTE (BULLISH)":i.change7d>=1?g="EXPANSÃO MODERADA":(i.change7d<=-3||h<=35)&&(g="CORREÇÃO (BEARISH)");const p=d.reduce((z,H)=>z+H.correlation,0),f=d.length>0?Number((p/d.length).toFixed(2)):.75,N=[...d].sort((z,H)=>H.alpha7d-z.alpha7d),j=N.slice(0,3).map(z=>z.signal),L=N.slice(-3).reverse().map(z=>z.signal),R=d.filter(z=>z.correlation<.1).slice(0,3).map(z=>z.signal),E={benchmarkSymbol:i.symbol,benchmarkName:i.name,change7d:i.change7d,change24h:i.change24h,status:g,breadthScore:h,avgCorrelation:f,topLeaders:j,topLaggards:L,hedges:R};return{assetCorrelations:d,macroSummary:E}}const $v=({signals:r,selectedSymbol:l,onSelectSymbol:i,onOpenRiskCalc:c})=>{const[d,m]=$.useState(!0),[h,g]=$.useState("BTC/USDT"),[p,f]=$.useState("TOP20"),[N,j]=$.useState("ALL"),[L,R]=$.useState("heatmap"),[E,z]=$.useState(!1),{assetCorrelations:H,macroSummary:q}=$.useMemo(()=>zv(r,h),[r,h]),I=$.useMemo(()=>{let v=[...H];return p==="TOP10"?v=v.slice(0,10):p==="TOP20"?v=v.slice(0,20):p==="TOP50"?v=v.slice(0,50):p==="QUALIFIED"?v=v.filter(k=>k.signal.passedFilter):p==="LONGS"?v=v.filter(k=>k.signal.decision==="COMPRA"):p==="SHORTS"?v=v.filter(k=>k.signal.decision==="VENDA"):p==="ALPHA_LEADERS"&&(v=v.filter(k=>k.alpha7d>2&&k.change7d>0)),N==="STRONG_POS"?v=v.filter(k=>k.correlation>=.7):N==="DECORRELATED"?v=v.filter(k=>Math.abs(k.correlation)<.4):N==="INVERSE"&&(v=v.filter(k=>k.correlation<=-.15)),v},[H,p,N]),T=$.useMemo(()=>I.slice(0,10),[I]),y=$.useMemo(()=>{if(L!=="matrix")return[];const v=T.map(se=>co(se.sparkline7d)),k=[];for(let se=0;se{const{alpha7d:se,change7d:ne,correlation:U}=v;let ae="bg-slate-900/90",ce="border-slate-800",C="bg-slate-800 text-slate-300";return se>=5&&ne>0?(ae="bg-emerald-950/40 hover:bg-emerald-950/60",ce="border-emerald-500/40 hover:border-emerald-500/70",C="bg-emerald-500/20 text-emerald-300 border border-emerald-500/40"):se>0&&ne>0?(ae="bg-emerald-950/20 hover:bg-emerald-950/40",ce="border-emerald-500/30 hover:border-emerald-500/50",C="bg-emerald-500/10 text-emerald-400 border border-emerald-500/30"):U<=-.25?(ae="bg-indigo-950/30 hover:bg-indigo-950/50",ce="border-indigo-500/40 hover:border-indigo-500/60",C="bg-indigo-500/20 text-indigo-300 border border-indigo-500/40"):se<=-5?(ae="bg-rose-950/40 hover:bg-rose-950/60",ce="border-rose-500/40 hover:border-rose-500/70",C="bg-rose-500/20 text-rose-300 border border-rose-500/40"):se<0?(ae="bg-rose-950/20 hover:bg-rose-950/40",ce="border-rose-500/30 hover:border-rose-500/50",C="bg-rose-500/10 text-rose-400 border border-rose-500/30"):(ae="bg-slate-900/80 hover:bg-slate-900",ce="border-slate-800 hover:border-slate-700",C="bg-slate-800 text-slate-400 border border-slate-700"),k&&(ce="border-amber-400 ring-2 ring-amber-400/40 shadow-lg"),{baseBg:ae,borderColor:ce,badgeBg:C}},X=v=>v>=.75?{text:`Forte (+${v.toFixed(2)})`,color:"text-emerald-400 bg-emerald-500/10 border-emerald-500/30"}:v>=.4?{text:`Moderada (+${v.toFixed(2)})`,color:"text-sky-400 bg-sky-500/10 border-sky-500/30"}:v>=-.2?{text:`Descorrel. (${v>=0?"+":""}${v.toFixed(2)})`,color:"text-amber-400 bg-amber-500/10 border-amber-500/30"}:{text:`Inversa (${v.toFixed(2)})`,color:"text-purple-400 bg-purple-500/10 border-purple-500/30"};return s.jsxs("section",{id:"market-strength-heatmap-section",className:"bg-slate-900/95 border border-slate-800 rounded-xl overflow-hidden shadow-sm transition-all",children:[s.jsxs("div",{className:"p-4 border-b border-slate-800/80 flex flex-col md:flex-row md:items-center justify-between gap-3 bg-gradient-to-r from-slate-950 via-slate-900 to-slate-950",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-400",children:s.jsx(Va,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"text-base font-bold text-white font-mono flex items-center gap-2",children:s.jsx("span",{children:"Heatmap de Força de Mercado & Correlação Macro"})}),s.jsx("span",{className:"text-[10px] font-mono font-bold px-2 py-0.5 rounded-full bg-slate-800 border border-slate-700 text-amber-300",children:"Últimos 7 Dias"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-1 text-xs text-slate-400",children:[s.jsxs("span",{children:["Benchmark Macro: ",s.jsx("strong",{className:"text-slate-200",children:q.benchmarkName})]}),s.jsx("span",{className:"text-slate-600",children:"•"}),s.jsxs("span",{className:`font-semibold font-mono ${q.change7d>=0?"text-emerald-400":"text-rose-400"}`,children:[q.change7d>=0?`+${q.change7d}%`:`${q.change7d}%`," (7D)"]}),s.jsx("span",{className:"text-slate-600",children:"•"}),s.jsxs("span",{className:"px-2 py-0.2 rounded text-[11px] font-mono font-semibold bg-slate-800 border border-slate-700 text-slate-300",children:["Regime: ",s.jsx("strong",{className:q.status.includes("ALTA")?"text-emerald-400":q.status.includes("CORREÇÃO")?"text-rose-400":"text-amber-400",children:q.status})]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 self-end md:self-auto",children:[s.jsxs("div",{className:"hidden sm:flex flex-col items-end text-right mr-2",children:[s.jsx("span",{className:"text-[10px] text-slate-400 uppercase font-mono",children:"Market Breadth (7D)"}),s.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[s.jsx("div",{className:"w-16 h-1.5 bg-slate-800 rounded-full overflow-hidden border border-slate-700",children:s.jsx("div",{className:`h-full rounded-full ${q.breadthScore>=50?"bg-emerald-400":"bg-rose-400"}`,style:{width:`${q.breadthScore}%`}})}),s.jsxs("span",{className:"text-xs font-mono font-bold text-slate-200",children:[q.breadthScore,"% em Alta"]})]})]}),s.jsx("button",{id:"btn-heatmap-info-modal",onClick:()=>z(!E),className:"p-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-400 hover:text-slate-200 border border-slate-700 transition",title:"Como interpretar o Heatmap de Força e Correlação",children:s.jsx(G1,{className:"w-4 h-4"})}),s.jsxs("button",{id:"btn-toggle-heatmap-expand",onClick:()=>m(!d),className:"p-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition flex items-center gap-1 text-xs font-mono",title:d?"Recolher Heatmap":"Expandir Heatmap",children:[d?s.jsx(b1,{className:"w-4 h-4"}):s.jsx(x1,{className:"w-4 h-4"}),s.jsx("span",{className:"hidden sm:inline",children:d?"Ocultar":"Expandir"})]})]})]}),d&&s.jsxs("div",{className:"p-4 space-y-4",children:[E&&s.jsxs("div",{className:"bg-slate-950 border border-amber-500/30 rounded-xl p-3.5 text-xs text-slate-300 space-y-2 animate-fadeIn",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"font-bold text-amber-400 flex items-center gap-1.5 font-mono",children:[s.jsx(mu,{className:"w-4 h-4"}),"Metodologia Quantitativa de Força de Mercado & Correlação"]}),s.jsx("button",{onClick:()=>z(!1),className:"text-slate-500 hover:text-slate-300 font-mono",children:"✕ Fechar"})]}),s.jsxs("p",{className:"text-slate-400 leading-relaxed",children:["Este heatmap analisa a série temporal dos últimos ",s.jsx("strong",{children:"7 dias"})," para cada ativo selecionado, comparando-o contra o benchmark da ",s.jsx("strong",{children:"Tendência Macro"})," (Bitcoin ou Índice Ponderado)."]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 pt-1 font-mono text-[11px]",children:[s.jsxs("div",{className:"p-2 rounded bg-slate-900 border border-slate-800",children:[s.jsx("span",{className:"text-emerald-400 font-bold block mb-0.5",children:"Alpha 7D (Força Relativa)"}),s.jsx("span",{className:"text-slate-400",children:"Diferença de retorno entre o ativo e o Macro. Alpha > 0 indica que o ativo está superando o mercado."})]}),s.jsxs("div",{className:"p-2 rounded bg-slate-900 border border-slate-800",children:[s.jsx("span",{className:"text-sky-400 font-bold block mb-0.5",children:"Correlação de Pearson (r)"}),s.jsx("span",{className:"text-slate-400",children:"Varia de -1.0 a +1.0. Mede se o ativo se movimenta em uníssono com o Macro ou de forma descorrelacionada."})]}),s.jsxs("div",{className:"p-2 rounded bg-slate-900 border border-slate-800",children:[s.jsx("span",{className:"text-purple-400 font-bold block mb-0.5",children:"Hedge & Breakouts"}),s.jsx("span",{className:"text-slate-400",children:"Ativos com correlação próxima de 0 ou negativa oferecem proteção institucional contra choques macro."})]})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 p-3 bg-slate-950/80 border border-slate-800/80 rounded-xl text-xs font-mono",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-slate-500 mr-1 hidden sm:inline",children:"Seleção:"}),[{id:"TOP10",label:"Top 10"},{id:"TOP20",label:"Top 20"},{id:"TOP50",label:"Top 50"},{id:"QUALIFIED",label:"God Protocol (≥75%)"},{id:"ALPHA_LEADERS",label:"Líderes de Alpha"},{id:"LONGS",label:"Compras"},{id:"SHORTS",label:"Vendas"}].map(v=>s.jsx("button",{onClick:()=>f(v.id),className:`px-2.5 py-1 rounded-lg transition text-[11px] font-medium border ${p===v.id?"bg-amber-500/20 text-amber-300 border-amber-500/40 font-bold":"bg-slate-900 text-slate-400 border-slate-800 hover:text-slate-200"}`,children:v.label},`preset-${v.id}`))]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"flex items-center bg-slate-900 border border-slate-800 rounded-lg px-2 py-1 text-xs",children:[s.jsx("span",{className:"text-slate-500 mr-1 text-[11px]",children:"Macro:"}),s.jsxs("select",{id:"select-macro-benchmark",value:h,onChange:v=>g(v.target.value),className:"bg-transparent text-amber-300 font-mono text-[11px] focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"BTC/USDT",className:"bg-slate-900 text-white",children:"BTC/USDT (Líder Supremo)"}),s.jsx("option",{value:"TOP10_INDEX",className:"bg-slate-900 text-white",children:"Índice Top 10 (Geral)"}),s.jsx("option",{value:"ETH/USDT",className:"bg-slate-900 text-white",children:"ETH/USDT (Altcoins)"})]})]}),s.jsxs("div",{className:"flex items-center bg-slate-900 border border-slate-800 rounded-lg px-2 py-1 text-xs",children:[s.jsx("span",{className:"text-slate-500 mr-1 text-[11px]",children:"Filtro r:"}),s.jsxs("select",{id:"select-corr-filter",value:N,onChange:v=>j(v.target.value),className:"bg-transparent text-slate-300 font-mono text-[11px] focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"ALL",className:"bg-slate-900",children:"Todos"}),s.jsx("option",{value:"STRONG_POS",className:"bg-slate-900",children:"Alta Correlação (r ≥ 0.7)"}),s.jsx("option",{value:"DECORRELATED",className:"bg-slate-900",children:"Descorrelacionados (|r| < 0.4)"}),s.jsx("option",{value:"INVERSE",className:"bg-slate-900",children:"Inversos / Hedge (r ≤ -0.15)"})]})]}),s.jsxs("div",{className:"flex items-center bg-slate-900 border border-slate-800 rounded-lg p-0.5 text-xs",children:[s.jsxs("button",{id:"btn-view-heatmap-cards",onClick:()=>R("heatmap"),className:`px-2 py-1 rounded transition text-[11px] flex items-center gap-1 ${L==="heatmap"?"bg-slate-800 text-amber-400 font-bold":"text-slate-400 hover:text-slate-200"}`,title:"Grade Térmica (Cards com Sparklines e Força Relativa)",children:[s.jsx(V1,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline",children:"Grade"})]}),s.jsxs("button",{id:"btn-view-correlation-matrix",onClick:()=>R("matrix"),className:`px-2 py-1 rounded transition text-[11px] flex items-center gap-1 ${L==="matrix"?"bg-slate-800 text-amber-400 font-bold":"text-slate-400 hover:text-slate-200"}`,title:"Matriz Cruzada NxN de Correlação Pareada de Pearson",children:[s.jsx(sa,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline",children:"Matriz NxN"})]}),s.jsxs("button",{id:"btn-view-heatmap-table",onClick:()=>R("table"),className:`px-2 py-1 rounded transition text-[11px] flex items-center gap-1 ${L==="table"?"bg-slate-800 text-amber-400 font-bold":"text-slate-400 hover:text-slate-200"}`,title:"Tabela Classificatória de Força e Alpha",children:[s.jsx(gr,{className:"w-3.5 h-3.5"}),s.jsx("span",{className:"hidden sm:inline",children:"Tabela"})]})]})]})]}),L==="heatmap"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3",children:I.map(v=>{const k=l===v.signal.symbol,{baseBg:se,borderColor:ne,badgeBg:U}=S(v,k),ae=X(v.correlation),ce=v.sparkline7d,C=Math.min(...ce)*.998,w=Math.max(...ce)*1.002-C||1,M=160,W=36,oe=ce.map((be,_)=>{const Y=_/(ce.length-1||1)*M,D=W-(be-C)/w*W;return`${Y.toFixed(1)},${D.toFixed(1)}`}).join(" ");return s.jsxs("div",{onClick:()=>i(v.signal.symbol),className:`p-3 rounded-xl border transition cursor-pointer flex flex-col justify-between gap-2 relative overflow-hidden ${se} ${ne}`,children:[k&&s.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-1 bg-amber-500 text-slate-950 font-mono font-bold text-[9px] px-1.5 py-0.5 rounded shadow",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-slate-950 animate-pulse"}),"EM ANÁLISE"]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-slate-800 text-slate-400 font-bold",children:["#",v.signal.marketCapRank||"—"]}),s.jsx("span",{className:"font-bold text-white font-mono text-sm",children:v.signal.symbol}),s.jsx("span",{className:"text-[11px] text-slate-400 truncate max-w-[70px]",children:v.signal.name})]}),s.jsxs("div",{className:"flex items-baseline justify-between mt-1",children:[s.jsxs("span",{className:"text-xs font-mono font-bold text-slate-200",children:["$",v.signal.currentPrice>=1?v.signal.currentPrice.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:4}):v.signal.currentPrice.toFixed(v.signal.currentPrice<.001?6:4)]}),s.jsxs("div",{className:`text-xs font-mono font-bold flex items-center gap-0.5 ${v.change7d>=0?"text-emerald-400":"text-rose-400"}`,children:[v.change7d>=0?s.jsx(aa,{className:"w-3 h-3"}):s.jsx(Ha,{className:"w-3 h-3"}),s.jsx("span",{children:v.change7d>=0?`+${v.change7d}%`:`${v.change7d}%`}),s.jsx("span",{className:"text-[9px] text-slate-500 font-normal",children:"7D"})]})]})]}),s.jsxs("div",{className:"bg-slate-950/70 border border-slate-800/60 rounded-lg p-1.5 flex flex-col justify-between",children:[s.jsxs("div",{className:"flex items-center justify-between text-[9px] font-mono text-slate-500 mb-1",children:[s.jsx("span",{children:"Trajetória 7 Dias"}),s.jsxs("span",{className:v.alpha7d>=0?"text-emerald-400 font-semibold":"text-rose-400 font-semibold",children:["Alpha: ",v.alpha7d>=0?`+${v.alpha7d}%`:`${v.alpha7d}%`]})]}),s.jsxs("svg",{viewBox:`0 0 ${M} ${W}`,className:"w-full h-8 overflow-visible",children:[s.jsx("line",{x1:"0",y1:W/2,x2:M,y2:W/2,stroke:"#334155",strokeWidth:"0.5",strokeDasharray:"2 2"}),s.jsx("polyline",{fill:"none",stroke:v.change7d>=0?"#10b981":"#f43f5e",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",points:oe})]})]}),s.jsxs("div",{className:"pt-1 border-t border-slate-800/60 flex items-center justify-between gap-1 text-[10px] font-mono",children:[s.jsxs("span",{className:`px-1.5 py-0.5 rounded border font-semibold truncate ${ae.color}`,children:["r: ",v.correlation>=0?`+${v.correlation.toFixed(2)}`:v.correlation.toFixed(2)]}),s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[9px] font-semibold truncate ${U}`,children:v.archetype.split(" ")[0]})]}),s.jsxs("div",{className:"flex items-center justify-between text-[10px] font-mono",children:[s.jsxs("span",{className:"text-slate-500",children:["Sinal: ",s.jsx("strong",{className:v.signal.decision==="COMPRA"?"text-emerald-400":v.signal.decision==="VENDA"?"text-rose-400":"text-slate-400",children:v.signal.decision})]}),s.jsxs("span",{className:"text-amber-400 font-semibold",children:[v.signal.confidence,"% Conf."]})]})]},`heatmap-card-${v.signal.symbol}`)})}),I.length===0&&s.jsx("div",{className:"py-8 text-center text-slate-500 font-mono text-xs",children:"Nenhum ativo corresponde aos filtros de seleção e correlação configurados."})]}),L==="matrix"&&s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-4 overflow-x-auto",children:[s.jsxs("div",{className:"mb-3 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-bold text-white font-mono flex items-center gap-1.5",children:[s.jsx(sa,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{children:["Matriz de Correlação Pareada de Pearson (Top ",T.length," Ativos nos Últimos 7 Dias)"]})]}),s.jsx("p",{className:"text-[11px] text-slate-400",children:"Valores próximos a +1.00 (verde) indicam movimento sincronizado; valores próximos de 0 (cinza/âmbar) indicam descorrelação estatística."})]}),s.jsxs("div",{className:"text-[11px] font-mono text-slate-500 flex items-center gap-2",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded bg-emerald-500"})," ≥ +0.70"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded bg-sky-500"})," +0.30 a +0.69"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded bg-slate-700"})," -0.20 a +0.29"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded bg-purple-500"})," ≤ -0.20"]})]})]}),s.jsx("div",{className:"overflow-x-auto min-w-[600px]",children:s.jsxs("table",{className:"w-full text-center text-xs font-mono border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"p-2 text-left text-slate-500 border-b border-slate-800 text-[11px]",children:"Ativo"}),s.jsx("th",{className:"p-2 text-amber-400 border-b border-slate-800 text-[11px] bg-amber-500/10",children:"MACRO (BTC)"}),T.map(v=>s.jsx("th",{className:`p-2 border-b border-slate-800 text-[11px] font-bold ${l===v.signal.symbol?"text-amber-400 bg-amber-500/10":"text-slate-300"}`,children:v.signal.symbol.replace("/USDT","")},`col-${v.signal.symbol}`))]})}),s.jsx("tbody",{children:T.map((v,k)=>{const se=l===v.signal.symbol;return s.jsxs("tr",{className:"hover:bg-slate-900/50",children:[s.jsxs("td",{onClick:()=>i(v.signal.symbol),className:`p-2 text-left font-bold cursor-pointer transition border-b border-slate-800/80 flex items-center gap-1.5 ${se?"text-amber-400 bg-amber-500/10":"text-slate-200 hover:text-white"}`,children:[s.jsx("span",{children:v.signal.symbol.replace("/USDT","")}),s.jsxs("span",{className:"text-[10px] text-slate-500 font-normal",children:["#",v.signal.marketCapRank||""]})]}),s.jsx("td",{className:"p-2 border-b border-slate-800/80 font-bold bg-amber-500/5",children:s.jsx("span",{className:`px-2 py-0.5 rounded text-[11px] ${v.correlation>=.7?"bg-emerald-500/20 text-emerald-300":v.correlation>=.3?"bg-sky-500/20 text-sky-300":v.correlation>=-.2?"bg-slate-800 text-slate-300":"bg-purple-500/20 text-purple-300"}`,children:v.correlation>=0?`+${v.correlation.toFixed(2)}`:v.correlation.toFixed(2)})}),T.map((ne,U)=>{var K,w;const ae=((w=(K=y[k])==null?void 0:K[U])==null?void 0:w.r)??1,ce=k===U;let C="bg-slate-900/40 text-slate-400";return ce?C="bg-slate-800/90 text-slate-500 font-normal":ae>=.8?C="bg-emerald-500/30 text-emerald-200 font-bold":ae>=.5?C="bg-emerald-500/15 text-emerald-300":ae>=.2?C="bg-sky-500/15 text-sky-300":ae>=-.15?C="bg-slate-800/60 text-slate-300":C="bg-purple-500/20 text-purple-300 font-bold",s.jsx("td",{className:`p-2 border-b border-slate-800/80 text-[11px] transition hover:scale-105 ${C}`,title:`${v.signal.symbol} vs ${ne.signal.symbol}: r = ${ae.toFixed(2)}`,children:ce?"1.00":ae>=0?`+${ae.toFixed(2)}`:ae.toFixed(2)},`cell-${v.signal.symbol}-${ne.signal.symbol}`)})]},`row-${v.signal.symbol}`)})})]})})]}),L==="table"&&s.jsx("div",{className:"bg-slate-950 border border-slate-800 rounded-xl overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left text-xs font-mono border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-800 bg-slate-900/60 text-slate-400",children:[s.jsx("th",{className:"p-3",children:"Rank & Ativo"}),s.jsx("th",{className:"p-3",children:"Preço Atual"}),s.jsx("th",{className:"p-3",children:"Variação 7D"}),s.jsx("th",{className:"p-3",children:"Alpha 7D vs Macro"}),s.jsx("th",{className:"p-3",children:"Correlação (r)"}),s.jsx("th",{className:"p-3",children:"Beta Estimado"}),s.jsx("th",{className:"p-3",children:"Arquétipo Quantitativo"}),s.jsx("th",{className:"p-3",children:"Sinal"}),s.jsx("th",{className:"p-3 text-right",children:"Ação"})]})}),s.jsx("tbody",{className:"divide-y divide-slate-800/60",children:I.map(v=>{const k=l===v.signal.symbol,se=X(v.correlation);return s.jsxs("tr",{className:`hover:bg-slate-900/60 transition ${k?"bg-amber-500/10":""}`,children:[s.jsx("td",{className:"p-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-slate-800 text-slate-400 font-bold",children:["#",v.signal.marketCapRank||"—"]}),s.jsxs("div",{children:[s.jsxs("div",{className:"font-bold text-white flex items-center gap-1.5",children:[s.jsx("span",{children:v.signal.symbol}),k&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"})]}),s.jsx("div",{className:"text-[11px] text-slate-400",children:v.signal.name})]})]})}),s.jsxs("td",{className:"p-3 font-bold text-slate-200",children:["$",v.signal.currentPrice>=1?v.signal.currentPrice.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):v.signal.currentPrice.toFixed(4)]}),s.jsx("td",{className:"p-3",children:s.jsxs("span",{className:`font-bold flex items-center gap-0.5 ${v.change7d>=0?"text-emerald-400":"text-rose-400"}`,children:[v.change7d>=0?s.jsx(aa,{className:"w-3.5 h-3.5"}):s.jsx(Ha,{className:"w-3.5 h-3.5"}),v.change7d>=0?`+${v.change7d}%`:`${v.change7d}%`]})}),s.jsx("td",{className:"p-3",children:s.jsx("span",{className:`px-2 py-0.5 rounded font-bold ${v.alpha7d>=0?"bg-emerald-500/15 text-emerald-300":"bg-rose-500/15 text-rose-300"}`,children:v.alpha7d>=0?`+${v.alpha7d}%`:`${v.alpha7d}%`})}),s.jsx("td",{className:"p-3",children:s.jsx("span",{className:`px-2 py-0.5 rounded border text-[11px] ${se.color}`,children:se.text})}),s.jsxs("td",{className:"p-3 text-slate-300",children:[v.beta.toFixed(2),"x"]}),s.jsx("td",{className:"p-3",children:s.jsx("span",{className:"text-slate-300",children:v.archetype})}),s.jsx("td",{className:"p-3",children:s.jsxs("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold ${v.signal.decision==="COMPRA"?"bg-emerald-500/20 text-emerald-300 border border-emerald-500/40":v.signal.decision==="VENDA"?"bg-rose-500/20 text-rose-300 border border-rose-500/40":"bg-slate-800 text-slate-400 border border-slate-700"}`,children:[v.signal.decision," (",v.signal.confidence,"%)"]})}),s.jsx("td",{className:"p-3 text-right",children:s.jsx("button",{onClick:()=>i(v.signal.symbol),className:"px-2.5 py-1 rounded bg-slate-800 hover:bg-slate-700 text-amber-300 text-[11px] font-bold border border-slate-700 transition",children:"Analisar →"})})]},`table-row-${v.signal.symbol}`)})})]})}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 pt-2 text-xs font-mono",children:[s.jsxs("div",{className:"bg-slate-950/80 border border-emerald-500/30 rounded-xl p-3",children:[s.jsx("div",{className:"flex items-center justify-between text-emerald-400 font-bold mb-1.5",children:s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Ts,{className:"w-3.5 h-3.5"}),"Top Líderes de Alpha (Força Relativa 7D)"]})}),s.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:q.topLeaders.map(v=>s.jsxs("button",{onClick:()=>i(v.symbol),className:"px-2 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/30 text-emerald-300 hover:bg-emerald-500/20 transition flex items-center gap-1",children:[s.jsx("span",{children:v.symbol.replace("/USDT","")}),s.jsxs("span",{className:"text-[10px] text-emerald-400",children:["(",v.change7d?`+${v.change7d}%`:`+${v.change24h}%`,")"]})]},`top-leader-${v.symbol}`))})]}),s.jsxs("div",{className:"bg-slate-950/80 border border-indigo-500/30 rounded-xl p-3",children:[s.jsx("div",{className:"flex items-center justify-between text-indigo-400 font-bold mb-1.5",children:s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(hv,{className:"w-3.5 h-3.5"}),"Oportunidades de Descorrelação & Hedge"]})}),s.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:q.hedges.length>0?q.hedges.map(v=>s.jsx("button",{onClick:()=>i(v.symbol),className:"px-2 py-0.5 rounded bg-indigo-500/10 border border-indigo-500/30 text-indigo-300 hover:bg-indigo-500/20 transition",children:v.symbol.replace("/USDT","")},`top-hedge-${v.symbol}`)):s.jsx("span",{className:"text-slate-500 text-[11px]",children:"Mercado em sincronia de alta generalizada"})})]}),s.jsxs("div",{className:"bg-slate-950/80 border border-rose-500/30 rounded-xl p-3",children:[s.jsx("div",{className:"flex items-center justify-between text-rose-400 font-bold mb-1.5",children:s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Cr,{className:"w-3.5 h-3.5"}),"Subdesempenho / Laggards (Pressão Vendedora)"]})}),s.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:q.topLaggards.map(v=>s.jsxs("button",{onClick:()=>i(v.symbol),className:"px-2 py-0.5 rounded bg-rose-500/10 border border-rose-500/30 text-rose-300 hover:bg-rose-500/20 transition flex items-center gap-1",children:[s.jsx("span",{children:v.symbol.replace("/USDT","")}),s.jsxs("span",{className:"text-[10px] text-rose-400",children:["(",v.change7d?`${v.change7d}%`:`${v.change24h}%`,")"]})]},`top-laggard-${v.symbol}`))})]})]})]})]})};function Vv(r,l,i=24){if(!r||r.length===0)return null;const c=r.map(w=>w.low),d=r.map(w=>w.high),m=Math.min(...c),h=Math.max(...d);if(m<=0||h<=0||m===h)return null;const g=m*.997,N=(h*1.003-g)/i,j=Array.from({length:i},(w,M)=>{const W=g+M*N,oe=W+N;return{index:M,lowPrice:W,highPrice:oe,midPrice:(W+oe)/2,buyVolume:0,sellVolume:0,totalVolume:0,volumePercent:0,isPOC:!1,isValueArea:!1,nodeType:"NORMAL",wyckoffInterpretation:""}});for(const w of r){const M=w.high,W=w.low,oe=w.volume||1,be=w.close>=w.open,_=Math.max(M-W,1e-6);for(let Y=0;Y0){const Ae=ve/_,Re=oe*Ae;be?(j[Y].buyVolume+=Re*.65,j[Y].sellVolume+=Re*.35):(j[Y].buyVolume+=Re*.35,j[Y].sellVolume+=Re*.65),j[Y].totalVolume+=Re}}}const L=j.reduce((w,M)=>w+M.totalVolume,0)||1,R=L/i;let E=0,z=0;j.forEach((w,M)=>{w.volumePercent=w.totalVolume/L*100,w.totalVolume>E&&(E=w.totalVolume,z=M)}),j[z].isPOC=!0,j[z].nodeType="POC";const H=L*.7;let q=j[z].totalVolume;j[z].isValueArea=!0;let I=z,T=z;for(;q0);){const w=I0?j[T-1].totalVolume:-1;if(w>=M&&I0)T--,q+=j[T].totalVolume,j[T].isValueArea=!0;else if(I{if(w.isPOC){w.wyckoffInterpretation="Point of Control (POC): Nível de máxima acumulação e aceitação de valor institucional.";return}w.totalVolume>=R*1.35?(w.nodeType="HVN",w.wyckoffInterpretation="High Volume Node (HVN): Forte liquidez institucional e zona de suporte/resistência por absorção.",v.push(w)):w.totalVolume<=R*.45&&M>0&&M=1?X.toFixed(2):X.toFixed(4)}).`,C="Fase de Teste / Absorção Ativa: Alta concentração de liquidez. Operadores institucionais defendem este patamar.",K="text-amber-400"):l>y?(U="ABOVE_VAH",ae="Acima da Value Area (VAH)",ce=`Preço rompeu a fronteira superior de valor ($${y>=1?y.toFixed(2):y.toFixed(4)}).`,C="Fase de Expansão / Markup: Busca por nova liquidez externa ou potencial rejeição em Upthrust (UTAD).",K="text-emerald-400"):l=1?S.toFixed(2):S.toFixed(4)}).`,C="Zona de Liquidity Sweep / Spring: Monitorar reação rápida de absorção (Spring Wyckoff) ou continuidade de queda.",K="text-rose-400"):l>X?(U="UPPER_VA",ae="Metade Superior da Value Area",ce="Preço entre o POC e o VAH, com estrutura compradora preservada.",C="Acumulação / Markup Inicial: O POC atua como ímã de suporte dinâmico para os testes intradiários.",K="text-sky-400"):(U="LOWER_VA",ae="Metade Inferior da Value Area",ce="Preço entre o VAL e o POC, testando o interesse dos compradores.",C="Teste de Absorção: O preço busca liquidez no VAL enquanto o POC age como resistência imediata.",K="text-purple-400"),{bins:j,pocPrice:X,pocVolume:j[z].totalVolume,pocPercent:j[z].volumePercent,vahPrice:y,valPrice:S,totalVolume:L,hvnNodes:v,lvnNodes:k,currentPrice:l,currentPriceStatus:{zone:U,label:ae,description:ce,wyckoffContext:C,color:K}}}const Bv=({vpData:r,symbol:l,timeframeName:i,currentPrice:c})=>{const[d,m]=$.useState(null),[h,g]=$.useState("ALL");if(!r)return s.jsx("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-4 text-center text-xs font-mono text-slate-500",children:"Dados insuficientes para calcular o Volume Profile deste ativo."});const{bins:p,pocPrice:f,pocPercent:N,vahPrice:j,valPrice:L,totalVolume:R,hvnNodes:E,lvnNodes:z,currentPriceStatus:H}=r,q=Math.max(...p.map(y=>y.totalVolume))||1,I=y=>y>=1e3?`$${y.toLocaleString("en-US",{minimumFractionDigits:1,maximumFractionDigits:2})}`:y>=1?`$${y.toFixed(3)}`:`$${y.toFixed(6)}`,T=h==="KEY_NODES"?p.filter(y=>y.isPOC||y.nodeType==="HVN"||y.nodeType==="LVN"):[...p].reverse();return s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-4 space-y-4 font-mono",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-3 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-400",children:s.jsx(go,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-sm font-bold text-white flex items-center gap-2",children:[s.jsx("span",{children:"Volume Profile & Zonas de Liquidez Wyckoff"}),s.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded bg-slate-800 text-slate-300 border border-slate-700",children:i})]}),s.jsx("p",{className:"text-[11px] text-slate-400",children:"Mapeamento de Point of Control (POC), Value Area (70%) e Vácuos de Liquidez"})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 bg-slate-900 border border-slate-800 p-1 rounded-lg text-xs self-start sm:self-auto",children:[s.jsx("button",{onClick:()=>g("ALL"),className:`px-2 py-1 rounded transition text-[11px] ${h==="ALL"?"bg-amber-500/20 text-amber-300 font-bold border border-amber-500/30":"text-slate-400 hover:text-slate-200"}`,children:"Todos os Níveis"}),s.jsx("button",{onClick:()=>g("KEY_NODES"),className:`px-2 py-1 rounded transition text-[11px] ${h==="KEY_NODES"?"bg-amber-500/20 text-amber-300 font-bold border border-amber-500/30":"text-slate-400 hover:text-slate-200"}`,children:"Apenas POC / HVN / LVN"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2.5 text-xs",children:[s.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-lg relative overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-amber-400 font-bold uppercase mb-1",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(As,{className:"w-3.5 h-3.5"}),"POC (Point of Control)"]}),s.jsxs("span",{children:[N.toFixed(1),"% Vol"]})]}),s.jsx("div",{className:"text-base font-bold text-amber-300",children:I(f)}),s.jsx("div",{className:"text-[10px] text-slate-400 mt-1",children:"Máxima liquidez e consenso institucional"})]}),s.jsxs("div",{className:"p-3 bg-slate-900 border border-sky-500/30 rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-sky-400 font-bold uppercase mb-1",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Ts,{className:"w-3.5 h-3.5"}),"VAH (Value Area High)"]}),s.jsx("span",{children:"Teto 70%"})]}),s.jsx("div",{className:"text-base font-bold text-sky-300",children:I(j)}),s.jsx("div",{className:"text-[10px] text-slate-400 mt-1",children:"Resistência de valor / Breakout"})]}),s.jsxs("div",{className:"p-3 bg-slate-900 border border-emerald-500/30 rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-emerald-400 font-bold uppercase mb-1",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Cr,{className:"w-3.5 h-3.5"}),"VAL (Value Area Low)"]}),s.jsx("span",{children:"Piso 70%"})]}),s.jsx("div",{className:"text-base font-bold text-emerald-300",children:I(L)}),s.jsx("div",{className:"text-[10px] text-slate-400 mt-1",children:"Suporte de valor / Zona de Spring"})]}),s.jsxs("div",{className:"p-3 bg-slate-900 border border-slate-800 rounded-lg flex flex-col justify-between",children:[s.jsxs("div",{className:"text-[10px] text-slate-400 uppercase font-bold flex items-center gap-1",children:[s.jsx(sa,{className:"w-3.5 h-3.5 text-amber-400"}),"Posição do Preço Atual"]}),s.jsxs("div",{children:[s.jsx("div",{className:`text-xs font-bold ${H.color}`,children:H.label}),s.jsxs("div",{className:"text-[10px] text-slate-400 truncate mt-0.5",children:["Preço: ",I(c)]})]})]})]}),s.jsxs("div",{className:"p-3 bg-slate-900/80 border border-slate-800 rounded-lg text-xs leading-relaxed flex items-start gap-2.5",children:[s.jsx(ct,{className:"w-4 h-4 text-amber-400 shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("span",{className:"font-bold text-slate-200",children:"Diagnóstico de Liquidez Wyckoff: "}),s.jsxs("span",{className:"text-slate-300",children:[H.description," "]}),s.jsx("span",{className:"text-amber-300 font-medium",children:H.wyckoffContext})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400 px-1",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(ls,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsx("span",{children:"Perfil de Volume por Faixa de Preço (Ordem Decrescente de Cotação)"})]}),s.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-sm bg-emerald-500/80"})," Comprador"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-sm bg-rose-500/80"})," Vendedor"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-sm bg-amber-400"})," POC"]})]})]}),s.jsx("div",{className:"bg-slate-900/90 border border-slate-800/80 rounded-lg p-2.5 space-y-1 max-h-[320px] overflow-y-auto no-scrollbar",children:T.map(y=>{const S=(d==null?void 0:d.index)===y.index,X=c>=y.lowPrice&&c<=y.highPrice,v=Math.max(3,y.totalVolume/q*100),k=y.totalVolume>0?y.buyVolume/y.totalVolume*100:50,se=100-k;return s.jsxs("div",{onMouseEnter:()=>m(y),onMouseLeave:()=>m(null),className:`flex items-center gap-2 py-1 px-2 rounded transition cursor-pointer text-[11px] ${y.isPOC?"bg-amber-500/15 border border-amber-500/50 shadow-sm":X?"bg-sky-500/10 border border-sky-500/40":S?"bg-slate-800 border border-slate-700":"hover:bg-slate-800/50"}`,children:[s.jsxs("div",{className:"w-28 shrink-0 flex items-center justify-between",children:[s.jsx("span",{className:`font-mono font-bold ${y.isPOC?"text-amber-300":X?"text-sky-300":"text-slate-300"}`,children:I(y.midPrice)}),y.isPOC&&s.jsx("span",{className:"px-1.5 py-0.2 rounded bg-amber-400 text-slate-950 text-[9px] font-black tracking-wider",children:"POC"}),y.nodeType==="HVN"&&s.jsx("span",{className:"px-1 py-0.2 rounded bg-sky-500/20 text-sky-300 border border-sky-500/40 text-[9px]",children:"HVN"}),y.nodeType==="LVN"&&s.jsx("span",{className:"px-1 py-0.2 rounded bg-purple-500/20 text-purple-300 border border-purple-500/40 text-[9px]",title:"Vácuo de Liquidez",children:"LVN"}),X&&!y.isPOC&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-400 animate-ping",title:"Preço Atual"})]}),s.jsxs("div",{className:"flex-1 h-3.5 bg-slate-950 rounded overflow-hidden flex items-center relative",children:[s.jsxs("div",{className:"h-full flex transition-all duration-300",style:{width:`${v}%`},children:[s.jsx("div",{className:`h-full ${y.isPOC?"bg-amber-400":"bg-emerald-500/80"}`,style:{width:`${k}%`}}),s.jsx("div",{className:`h-full ${y.isPOC?"bg-amber-600":"bg-rose-500/80"}`,style:{width:`${se}%`}})]}),y.isValueArea&&s.jsx("div",{className:"absolute right-1 top-0 bottom-0 flex items-center",children:s.jsx("span",{className:"text-[8px] text-slate-500 font-mono",children:"VA"})})]}),s.jsxs("div",{className:"w-12 text-right shrink-0 text-[10px] text-slate-400 font-mono",children:[y.volumePercent.toFixed(1),"%"]})]},`vp-bin-${y.index}`)})})]}),d&&s.jsxs("div",{className:"p-2.5 bg-slate-900 border border-amber-500/30 rounded-lg text-xs flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-amber-300 font-bold",children:["Faixa: ",I(d.lowPrice)," - ",I(d.highPrice)]}),s.jsx("span",{className:"text-slate-400",children:"|"}),s.jsxs("span",{className:"text-emerald-400",children:["Compras: ",(d.buyVolume/d.totalVolume*100).toFixed(0),"%"]}),s.jsx("span",{className:"text-slate-400",children:"/"}),s.jsxs("span",{className:"text-rose-400",children:["Vendas: ",(d.sellVolume/d.totalVolume*100).toFixed(0),"%"]})]}),s.jsx("div",{className:"text-[11px] text-slate-300",children:d.wyckoffInterpretation})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 text-[11px] text-slate-400 pt-1 border-t border-slate-800/80",children:[s.jsxs("div",{className:"p-2 bg-slate-900/40 rounded border border-slate-800 flex items-start gap-1.5",children:[s.jsx("span",{className:"text-sky-400 font-bold",children:"HVN (Alta Liquidez):"}),s.jsx("span",{children:"Zonas de grande acumulação de contratos onde os grandes operadores absorvem liquidez, gerando fortes suportes/resistências."})]}),s.jsxs("div",{className:"p-2 bg-slate-900/40 rounded border border-slate-800 flex items-start gap-1.5",children:[s.jsx("span",{className:"text-purple-400 font-bold",children:"LVN (Baixa Liquidez):"}),s.jsx("span",{children:"Vácuos de ordens (Imbalance). O preço tende a atravessar esses níveis com extrema velocidade (fases de Markup e Markdown)."})]})]})]})},Ih=[{id:"3m",label:"3m",fullName:"3 Minutos",category:"SCALP",durationMs:180*1e3,barVolatilityScale:.15,description:"Microestrutura de fluxo & Scalping Ultra-Rápido"},{id:"5m",label:"5m",fullName:"5 Minutos",category:"SCALP",durationMs:300*1e3,barVolatilityScale:.2,description:"Gatilho de entrada micro & Absorção de ordens"},{id:"15m",label:"15m",fullName:"15 Minutos",category:"SCALP",durationMs:900*1e3,barVolatilityScale:.35,description:"Microscópio institucional LTF & Cruzamento EMA 9/21"},{id:"30m",label:"30m",fullName:"30 Minutos",category:"SCALP",durationMs:1800*1e3,barVolatilityScale:.5,description:"Transição entre Scalp e Day Trade & FVG imediato"},{id:"1h",label:"1h",fullName:"1 Hora",category:"DAY_TRADE",durationMs:3600*1e3,barVolatilityScale:.7,description:"Estrutura MTF clássica & Suporte Dinâmico EMA 50"},{id:"2h",label:"2h",fullName:"2 Horas",category:"DAY_TRADE",durationMs:7200*1e3,barVolatilityScale:.85,description:"Consolidação intradiária & Liquidity Sweeps de sessão"},{id:"8h",label:"8h",fullName:"8 Horas",category:"DAY_TRADE",durationMs:480*60*1e3,barVolatilityScale:1.1,description:"Ciclos de Funding Rate (8h) & Equilíbrio de Derivativos"},{id:"12h",label:"12h",fullName:"12 Horas",category:"DAY_TRADE",durationMs:720*60*1e3,barVolatilityScale:1.25,description:"Sessão Semidiária & Ponto de inflexão de momentum"},{id:"1d",label:"1d",fullName:"1 Dia (Diário)",category:"SWING_TRADE",durationMs:1440*60*1e3,barVolatilityScale:1.5,description:"HTF Primário: Tendência Institucional & EMA 50/200"},{id:"3d",label:"3d",fullName:"3 Dias",category:"SWING_TRADE",durationMs:4320*1e3,barVolatilityScale:2,description:"Filtro anti-ruído para Swing Trade & Wyckoff Phase"},{id:"5d",label:"5d",fullName:"5 Dias",category:"SWING_TRADE",durationMs:7200*1e3,barVolatilityScale:2.4,description:"Estrutura semanal expandida & Grandes Order Blocks"},{id:"1w",label:"1w",fullName:"1 Semana",category:"POSITION_TRADE",durationMs:10080*1e3,barVolatilityScale:2.8,description:"Macro Institucional & Níveis VAH/VAL Semanais"},{id:"2w",label:"2w",fullName:"2 Semanas",category:"POSITION_TRADE",durationMs:336*60*1e3,barVolatilityScale:3.5,description:"Ciclo Macro de Halving / Regime de Mercado Global"}];function jr(r){return Ih.find(l=>l.id===r)||Ih[4]}function Hv(r,l,i=32){var j,L,R,E,z,H,q,I,T;const c=jr(l),d=Date.now(),m=r.currentPrice||100;r.change24h;const h=r.atrValue||m*.025;if(l==="1d"&&((R=(L=(j=r.tripleScreen)==null?void 0:j.htf)==null?void 0:L.candles)==null?void 0:R.length)>=20)return r.tripleScreen.htf.candles;if(l==="1h"&&((H=(z=(E=r.tripleScreen)==null?void 0:E.mtf)==null?void 0:z.candles)==null?void 0:H.length)>=20)return r.tripleScreen.mtf.candles;if(l==="15m"&&((T=(I=(q=r.tripleScreen)==null?void 0:q.ltf)==null?void 0:I.candles)==null?void 0:T.length)>=20)return r.tripleScreen.ltf.candles;const g=[],p=Math.max(m*.002,h*c.barVolatilityScale*.35);r.sparkline7d;let f=m;const N=[];for(let y=0;y=1?2:5)),high:Number(ae.toFixed(ae>=1?2:5)),low:Number(ce.toFixed(ce>=1?2:5)),close:Number(k.toFixed(k>=1?2:5)),vol:C}),f=se}return N.reverse(),N.forEach(y=>{g.push({timestamp:y.time,timeStr:Uh(y.time,l),open:y.open,high:y.high,low:y.low,close:y.close,volume:y.vol})}),g}function Uh(r,l){const i=new Date(r),c=new Date(i.toLocaleString("en-US",{timeZone:"America/Sao_Paulo"})),d=String(c.getHours()).padStart(2,"0"),m=String(c.getMinutes()).padStart(2,"0"),h=String(c.getDate()).padStart(2,"0"),g=String(c.getMonth()+1).padStart(2,"0");return["3m","5m","15m","30m","1h","2h"].includes(l)?`${d}:${m}`:["8h","12h","1d"].includes(l)?`${h}/${g} ${d}h`:`${h}/${g}`}function Gv(r,l=14){if(r.length<=1)return[50];const i=r.map(f=>f.close),c=[];let d=0,m=0;for(let f=1;f<=Math.min(l,i.length-1);f++){const N=i[f]-i[f-1];N>=0?d+=N:m+=Math.abs(N)}let h=d/l,g=m/l;const p=g===0?100:h/g;c.push(Number((100-100/(1+p)).toFixed(2)));for(let f=l+1;f0?N:0,L=N<0?Math.abs(N):0;h=(h*(l-1)+j)/l,g=(g*(l-1)+L)/l;const R=g===0?100:h/g,E=g===0?100:100-100/(1+R);c.push(Number(E.toFixed(2)))}for(;c.lengthf+N,0);m.push(Number((p/i).toFixed(2)))}const h=[];for(let g=0;gf+N,0);h.push(Number((p/c).toFixed(2)))}return{k:m,d:h}}function Fv(r,l=12,i=26,c=9){if(r.length<2)return{macdLine:0,signalLine:0,histogram:0,prevHistogram:0,trend:"NEUTRO",crossover:"ALINHADO_ALTA",crossoverLabel:"Dados Insuficientes",zeroLineState:"NA_LINHA_ZERO",histogramState:"DESACELERACAO_ALTA",histogramStateLabel:"Neutro",badgeColor:"bg-slate-800 text-slate-400 border-slate-700",description:"Aguardando mais barras para cálculo do MACD.",series:{macd:[0],signal:[0],histogram:[0]}};const d=r.map(ne=>ne.close),m=(ne,U)=>{const ae=2/(U+1),ce=[];let C=ne[0];for(let K=0;K10?2:4))));return ce},h=m(d,l),g=m(d,i),p=d.map((ne,U)=>Number((h[U]-g[U]).toFixed(d[U]>10?2:4))),f=m(p,c),N=p.map((ne,U)=>Number((ne-f[U]).toFixed(d[U]>10?2:4))),j=p.length,L=p[j-1]??0,R=f[j-1]??0,E=N[j-1]??0,z=N[j-2]??E,H=p[j-2]??L,q=f[j-2]??R;let I="ALINHADO_ALTA",T="MACD acima da Linha de Sinal";H<=q&&L>R?(I="CRUZAMENTO_BULLISH",T="Cruzamento de Alta Recente (Bullish Cross)"):H>=q&&LR?(I="ALINHADO_ALTA",T="Alinhado em Alta (MACD > Sinal)"):(I="ALINHADO_BAIXA",T="Alinhado em Baixa (MACD < Sinal)");const y=L>1e-4?"ACIMA_DE_ZERO":L<-1e-4?"ABAIXO_DE_ZERO":"NA_LINHA_ZERO";let S="EXPANSAO_ALTA",X="Histograma Positivo em Expansão";E>=0?E>=z?(S="EXPANSAO_ALTA",X="Positivo em Expansão (Aceleração Compradora)"):(S="DESACELERACAO_ALTA",X="Positivo em Contração (Perda de Impulso Comprador)"):E<=z?(S="EXPANSAO_BAIXA",X="Negativo em Expansão (Aceleração Vendedora)"):(S="DESACELERACAO_BAIXA",X="Negativo em Contração (Exaustão da Pressão Vendedora)");const v=L>R&&E>=0?"ALTA":L0?"+":""}${L}) vs Sinal (${R>0?"+":""}${R}). Histograma de ${E>0?"+":""}${E} (${X.split("(")[0].trim()}). Posição ${y==="ACIMA_DE_ZERO"?"acima da linha zero (viés estrutural altista)":y==="ABAIXO_DE_ZERO"?"abaixo da linha zero (viés estrutural baixista)":"na zona de equilíbrio zero"}.`;return{macdLine:L,signalLine:R,histogram:E,prevHistogram:z,trend:v,crossover:I,crossoverLabel:T,zeroLineState:y,histogramState:S,histogramStateLabel:X,badgeColor:k,description:se,series:{macd:p,signal:f,histogram:N}}}function Yv(r,l){const i=r.length,c=r[i-1]??50,d=l[i-1]??50,m=r[i-2]??c,h=l[i-2]??d;let g="NEUTRO",p="Faixa Neutra de Oscilação (20 - 80)";c>=80||d>=80?(g="SOBRECOMPRADO",p="Zona de Sobrecompra (>80) - Risco de Exaustão"):(c<=20||d<=20)&&(g="SOBREVENDIDO",p="Zona de Sobrevenda (<20) - Alerta de Fundo / Repique");let f="ALINHADO_ALTA",N="%K mantendo-se acima de %D";m<=h&&c>d?(f="CRUZAMENTO_BULLISH",N="Cruzamento de Alta (%K cortou %D para cima)"):m>=h&&cd?(f="ALINHADO_ALTA",N="Alinhado em Alta (%K > %D)"):(f="ALINHADO_BAIXA",N="Alinhado em Baixa (%K < %D)");const j=c>d&&c>50?"ALTA":cd?L="bg-sky-500/20 text-sky-300 border-sky-500/40":L="bg-amber-500/20 text-amber-300 border-amber-500/40";const R=`Estocástico Rápido %K em ${c.toFixed(1)} e Média %D em ${d.toFixed(1)}. ${p}. ${N}.`;return{k:c,d,status:g,statusLabel:p,crossover:f,crossoverLabel:N,momentum:j,badgeColor:L,description:R}}function Xv(r,l){if(r.length<16)return{hasDivergence:!1,type:"NONE",title:"Amostra Insuficiente",strength:"NEUTRA",badgeColor:"bg-slate-800 text-slate-400 border-slate-700",rsiCurrent:50,rsiZone:"NEUTRO",description:"Aguardando mais candles no tempo gráfico para consolidação de pivôs entre Preço e RSI.",tradingImplication:"Acompanhe a consolidação dos pivôs no gráfico.",swingDetails:{price1:0,price2:0,rsi1:50,rsi2:50}};const c=l[l.length-1]??50,d=c>=70?"SOBRECOMPRA":c<=30?"SOBREVENDA":"NEUTRO",m=r.slice(-16),h=l.slice(-16);let g=0,p=m[0].low;for(let U=0;U<8;U++)m[U].lowL&&(L=m[U].high,j=U);let R=8,E=m[8].high;for(let U=8;UE&&(E=m[U].high,R=U);const z=h[g]??50,H=h[f]??50,q=h[j]??50,I=h[R]??50,T=Nz+1.2;if(T&&y)return{hasDivergence:!0,type:"BULLISH_REGULAR",title:"Divergência Regular de Alta (Preço x RSI)",strength:"ALTA",badgeColor:"bg-emerald-500/20 text-emerald-300 border-emerald-500/40",rsiCurrent:c,rsiZone:d,description:`O preço formou fundo mais baixo ($${N.toLocaleString()} < $${p.toLocaleString()}), enquanto o RSI(14) registrou fundo ascendente (${H.toFixed(1)} > ${z.toFixed(1)}). Isto indica absorção de liquidez compradora e exaustão da pressão vendedora.`,tradingImplication:"Sinal clássico de reversão para COMPRA (LONG) ou encerramento de posições vendidas com trailing stop ajustado.",swingDetails:{price1:p,price2:N,rsi1:z,rsi2:H}};const S=E>L*1.002,X=I $${L.toLocaleString()}), mas o RSI(14) perdeu momentum e marcou topo descendente (${I.toFixed(1)} < ${q.toFixed(1)}). Esgotamento de compra ou distribuição institucional Wyckoff.`,tradingImplication:"Alerta crítico de exaustão compradora. Favorece operações de VENDA (SHORT) ou realização de lucros parciais.",swingDetails:{price1:L,price2:E,rsi1:q,rsi2:I}};const v=N>p*1.002,k=Hq+1.2;return se&&ne?{hasDivergence:!0,type:"HIDDEN_BEARISH",title:"Divergência Oculta de Baixa (Preço x RSI)",strength:"MODERADA",badgeColor:"bg-amber-500/20 text-amber-300 border-amber-500/40",rsiCurrent:c,rsiZone:d,description:"O preço realizou topo descendente em tendência de baixa enquanto o RSI repicou para patamar superior. Exaustão do repique contra a tendência principal.",tradingImplication:"Confirmação de continuação baixista. Oportunidade de retomada de venda a favor da tendência.",swingDetails:{price1:L,price2:E,rsi1:q,rsi2:I}}:{hasDivergence:!1,type:"NONE",title:"Alinhamento Sem Divergência (Preço x RSI)",strength:"NEUTRA",badgeColor:"bg-slate-800 text-slate-300 border-slate-700",rsiCurrent:c,rsiZone:d,description:`O preço e o oscilador RSI(14) (${c}) estão caminhando em concordância direta. A movimentação de preço é validada pelo momentum, sem divergência detectada nos pivôs recentes.`,tradingImplication:"Siga os sinais da estratégia padrão Triple Screen e dos 4 Pilares institucionais.",swingDetails:{price1:p,price2:N,rsi1:z,rsi2:H}}}function Zv(r,l,i,c){const d=Xv(r,l),m=Yv(i,c),h=Fv(r,12,26,9);return{hasDivergence:d.hasDivergence,type:d.type,title:d.title,confluence:d.hasDivergence&&m.momentum===(d.type.includes("BULLISH")?"ALTA":"BAIXA")?"DUAL":"RSI_ONLY",strength:d.strength,badgeColor:d.badgeColor,rsiCurrent:d.rsiCurrent,stochKCurrent:m.k,stochDCurrent:m.d,description:d.description,tradingImplication:d.tradingImplication,swingDetails:{price1:d.swingDetails.price1,price2:d.swingDetails.price2,rsi1:d.swingDetails.rsi1,rsi2:d.swingDetails.rsi2,stoch1:m.k,stoch2:m.d},rsiDivergence:d,stochastic:m,macd:h}}function Kv(r,l=14){if(r.lengthR+E,0)/m,g=d.reduce((R,E)=>R+Math.pow(E-h,2),0)/m,p=Math.sqrt(g)||.05,f=h+2*p,N=(c-h)/p,j=N>=2,L=h>0?c/h:1;return{currentPeriodVolatility:Number(c.toFixed(2)),historicalMean14:Number(h.toFixed(2)),historicalStdDev14:Number(p.toFixed(2)),threshold2Sigma:Number(f.toFixed(2)),zScore:Number(N.toFixed(2)),isExtremeSurge:j,ratioVsMean:Number(L.toFixed(1)),recentRanges:d.slice(-5).map(R=>Number(R.toFixed(2)))}}function eu(r,l){const i=r.decision==="COMPRA"||r.decision==="AGUARDAR",c=typeof l=="number"&&l>0?l:r.entryPrice||r.currentPrice||100,d=r.atrValue||c*.02,m=r.currentPrice||c,h=T=>Number(T.toFixed(c>=1?2:5)),g=d*.6,p=i?c-g:c+g,f=za(c,p,i?"LONG":"SHORT",m),N=d*1,j=i?c-N:c+N,L=za(c,j,i?"LONG":"SHORT",m),R=d*1.8,E=i?c-R:c+R,z=za(c,E,i?"LONG":"SHORT",m),H=d*3.5,q=i?c-H:c+H,I=za(c,q,i?"LONG":"SHORT",m);return{SCALP:{style:"SCALP",label:"Scalp Trade",badge:"⚡ SCALP (3m-15m)",badgeColor:"bg-amber-500/15 text-amber-300 border-amber-500/30",timeframes:"3m, 5m, 15m",holdingTime:"5 min a 45 min",entryPrice:h(c),stopLoss:h(p),stopDistanceUsd:Number(g.toFixed(4)),stopDistancePercent:Number((g/c*100).toFixed(2)),atrMultipleStop:"0.6x ATR",takeProfit1:h(f[0].price),takeProfit2:h(f[1].price),takeProfit3:h(f[2].price),takeProfit4:h(f[3].price),takeProfit5:h(f[4].price),fibonacciTargets:f,rr1:1.62,rr2:2,rr3:2.62,rr4:3.62,rr5:4.24,recommendedLeverage:"5x a 15x Isolada",riskPercent:.5,executionRules:["Execução via Ordem Limit para evitar taxas agressivas (Taker fee)","Mover Stop para Breakeven imediato ao atingir TP1 ou TP2 (Fibo 1.618 / 2.0)","Encerramento forçado se a operação estagnar por mais de 60 minutos"]},DAY_TRADE:{style:"DAY_TRADE",label:"Day Trade",badge:"🎯 DAY TRADE (15m-1h)",badgeColor:"bg-sky-500/15 text-sky-300 border-sky-500/30",timeframes:"15m, 30m, 1h",holdingTime:"1h a 8 horas (Mesma Sessão)",entryPrice:h(c),stopLoss:h(j),stopDistanceUsd:Number(N.toFixed(4)),stopDistancePercent:Number((N/c*100).toFixed(2)),atrMultipleStop:"1.0x ATR",takeProfit1:h(L[0].price),takeProfit2:h(L[1].price),takeProfit3:h(L[2].price),takeProfit4:h(L[3].price),takeProfit5:h(L[4].price),fibonacciTargets:L,rr1:1.62,rr2:2,rr3:2.62,rr4:3.62,rr5:4.24,recommendedLeverage:"3x a 5x Cross / Isolada",riskPercent:1,executionRules:["Realização parcial de 40% no TP1 (1.618 Golden Fibo); stop no ponto de entrada (0 a 0)","Condução do restante em Trailing Stop pelas extensões 2.618 e 3.618","Zerar posição antes do fechamento diário UTC ou funding adverso"]},SWING_TRADE:{style:"SWING_TRADE",label:"Swing Trade",badge:"🌊 SWING TRADE (4h-1d)",badgeColor:"bg-emerald-500/15 text-emerald-300 border-emerald-500/30",timeframes:"1h, 8h, 1d, 3d",holdingTime:"2 a 10 dias úteis",entryPrice:h(c),stopLoss:h(E),stopDistanceUsd:Number(R.toFixed(4)),stopDistancePercent:Number((R/c*100).toFixed(2)),atrMultipleStop:"1.8x ATR",takeProfit1:h(z[0].price),takeProfit2:h(z[1].price),takeProfit3:h(z[2].price),takeProfit4:h(z[3].price),takeProfit5:h(z[4].price),fibonacciTargets:z,rr1:1.62,rr2:2,rr3:2.62,rr4:3.62,rr5:4.24,recommendedLeverage:"Spot (1x) ou 2x a 3x Baixa",riskPercent:1.5,executionRules:["Respeito rigoroso aos Order Blocks institucionais e FVG diário","Condução do trade via Trailing Stop móvel ancorado na EMA 21 diária","Alvos expandidos TP3, TP4 e TP5 para captura de tendências macro"]},POSITION_TRADE:{style:"POSITION_TRADE",label:"Position Trade",badge:"🏛️ POSITION TRADE (1d-2w)",badgeColor:"bg-purple-500/15 text-purple-300 border-purple-500/30",timeframes:"1d, 5d, 1w, 2w",holdingTime:"Semanas a Meses (Ciclo Macro)",entryPrice:h(c),stopLoss:h(q),stopDistanceUsd:Number(H.toFixed(4)),stopDistancePercent:Number((H/c*100).toFixed(2)),atrMultipleStop:"3.5x ATR",takeProfit1:h(I[0].price),takeProfit2:h(I[1].price),takeProfit3:h(I[2].price),takeProfit4:h(I[3].price),takeProfit5:h(I[4].price),fibonacciTargets:I,rr1:1.62,rr2:2,rr3:2.62,rr4:3.62,rr5:4.24,recommendedLeverage:"Spot 1x Apenas (Sem risco de liquidação)",riskPercent:2.5,executionRules:["Entrada escalonada (DCA) em zonas de acumulação Wyckoff","Stop estrutural abaixo do suporte semanal ou mínima histórica do ciclo","Realizações parciais escalonadas nos 5 topos de expansão Fibonacci (1.618 até 4.236)"]}}}const Qv=[{level:1,ratio:1.618,label:"TP1 (1.618 Fibo Golden)"},{level:2,ratio:2,label:"TP2 (2.000 Expansão)"},{level:3,ratio:2.618,label:"TP3 (2.618 Extensão Maior)"},{level:4,ratio:3.618,label:"TP4 (3.618 Projeção Institucional)"},{level:5,ratio:4.236,label:"TP5 (4.236 Clímax Máximo)"}];function za(r,l,i,c=r,d){const m=i==="COMPRA"||i==="LONG",h=Math.abs(r-l)||r*.018,g=r<.01?6:r<1?4:r<10?3:2;return Qv.map(p=>{const f=m?r+h*p.ratio:r-h*p.ratio,N=Number(f.toFixed(g)),j=m?(N-r)/(r||1)*100:(r-N)/(r||1)*100,L=Number(j.toFixed(2)),R=m?c>=N:c<=N;return{level:p.level,ratioLabel:p.label,ratio:p.ratio,price:N,pnlPercent:L,isHit:R}})}const Jv=({isOpen:r,onClose:l,symbol:i,timeframe:c,stats:d,isAlertEnabled:m,onToggleAlertEnabled:h,onSnoozeSymbol:g})=>{if(!r)return null;const p=jr(c);return s.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-black/75 backdrop-blur-xs flex items-center justify-center p-4 animate-in fade-in duration-200",children:s.jsxs("div",{id:"volatility-surge-popup",className:"bg-slate-900 border-2 border-rose-500/80 rounded-2xl max-w-xl w-full overflow-hidden shadow-2xl shadow-rose-950/40 relative",children:[s.jsxs("div",{className:"bg-gradient-to-r from-rose-600 via-rose-500 to-amber-500 px-4 py-2 text-slate-950 font-mono text-xs font-bold flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"flex h-2.5 w-2.5 relative",children:[s.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-slate-950 opacity-75"}),s.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-slate-950"})]}),s.jsx("span",{className:"tracking-wide uppercase",children:"Alerta Automático de Volatilidade Extrema (+2σ)"})]}),s.jsxs("span",{className:"bg-slate-950 text-rose-300 px-2 py-0.5 rounded text-[11px] font-bold",children:["Z-Score: +",d.zScore,"σ"]})]}),s.jsxs("div",{className:"p-4 sm:p-5 border-b border-slate-800 bg-slate-950/70 flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-11 h-11 rounded-xl bg-rose-500/20 border border-rose-500/40 flex items-center justify-center text-rose-400 shrink-0",children:s.jsx(xl,{className:"w-6 h-6 animate-pulse"})}),s.jsxs("div",{children:[s.jsxs("h2",{className:"text-base sm:text-lg font-bold font-mono text-white flex items-center gap-2",children:[s.jsx("span",{children:i}),s.jsxs("span",{className:"text-xs px-2 py-0.5 rounded bg-slate-800 text-amber-300 border border-slate-700 font-medium",children:[p.label," (",p.fullName,")"]})]}),s.jsxs("p",{className:"text-xs text-rose-300/90 font-mono mt-0.5",children:["Range do candle superou a média histórica (14p) em +",d.zScore," desvios padrão"]})]})]}),s.jsx("button",{id:"btn-close-volatility-popup",onClick:l,className:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition",title:"Fechar aviso",children:s.jsx(na,{className:"w-5 h-5"})})]}),s.jsxs("div",{className:"p-4 sm:p-5 space-y-4 font-mono text-xs",children:[s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-center",children:[s.jsxs("div",{className:"p-2.5 bg-rose-950/30 border border-rose-500/40 rounded-xl",children:[s.jsx("span",{className:"text-[10px] text-rose-400 block uppercase",children:"Volatilidade Atual"}),s.jsxs("span",{className:"text-base sm:text-lg font-bold text-rose-200",children:[d.currentPeriodVolatility,"%"]}),s.jsx("span",{className:"text-[10px] text-rose-300 block",children:"Range do candle"})]}),s.jsxs("div",{className:"p-2.5 bg-slate-950 border border-slate-800 rounded-xl",children:[s.jsx("span",{className:"text-[10px] text-slate-400 block uppercase",children:"Média Histórica (14p)"}),s.jsxs("span",{className:"text-base sm:text-lg font-bold text-slate-200",children:[d.historicalMean14,"%"]}),s.jsx("span",{className:"text-[10px] text-slate-500 block",children:"μ (14 períodos)"})]}),s.jsxs("div",{className:"p-2.5 bg-slate-950 border border-slate-800 rounded-xl",children:[s.jsx("span",{className:"text-[10px] text-slate-400 block uppercase",children:"Desvio Padrão"}),s.jsxs("span",{className:"text-base sm:text-lg font-bold text-amber-300",children:["±",d.historicalStdDev14,"%"]}),s.jsx("span",{className:"text-[10px] text-slate-500 block",children:"σ (Sigma)"})]}),s.jsxs("div",{className:"p-2.5 bg-slate-950 border border-slate-800 rounded-xl",children:[s.jsx("span",{className:"text-[10px] text-slate-400 block uppercase",children:"Gatilho Crítico 2σ"}),s.jsxs("span",{className:"text-base sm:text-lg font-bold text-emerald-400",children:[d.threshold2Sigma,"%"]}),s.jsx("span",{className:"text-[10px] text-slate-500 block",children:"μ + 2σ"})]})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-[11px] mb-1.5",children:[s.jsxs("span",{className:"text-slate-400 flex items-center gap-1.5",children:[s.jsx(sa,{className:"w-3.5 h-3.5 text-rose-400"}),s.jsx("span",{children:"Magnitude do Salto de Volatilidade:"})]}),s.jsxs("span",{className:"text-rose-400 font-bold",children:[d.ratioVsMean,"x acima da média"]})]}),s.jsxs("div",{className:"w-full bg-slate-800 h-2.5 rounded-full overflow-hidden relative",children:[s.jsx("div",{className:"bg-gradient-to-r from-emerald-500 via-amber-500 to-rose-500 h-full rounded-full transition-all duration-500",style:{width:`${Math.min(100,d.currentPeriodVolatility/(d.threshold2Sigma*1.5)*100)}%`}}),s.jsx("div",{className:"absolute top-0 bottom-0 w-0.5 bg-white shadow",style:{left:`${d.threshold2Sigma/(d.threshold2Sigma*1.5)*100}%`},title:"Linha do Limiar 2σ"})]}),s.jsxs("div",{className:"flex justify-between text-[9px] text-slate-500 mt-1",children:[s.jsx("span",{children:"0% (Calmaria)"}),s.jsxs("span",{className:"text-amber-400 font-semibold",children:["Limiar 2σ (",d.threshold2Sigma,"%)"]}),s.jsx("span",{className:"text-rose-400 font-semibold",children:"Extremo (+2σ)"})]})]}),s.jsxs("div",{className:"bg-rose-950/20 border border-rose-500/30 rounded-xl p-3.5 text-xs font-sans text-slate-300 space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(dl,{className:"w-4 h-4 text-rose-400 shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("strong",{className:"text-rose-300 font-mono text-xs block",children:"Diretriz Quantitativa Institucional:"}),s.jsxs("p",{className:"text-[12px] text-slate-300 leading-relaxed mt-0.5",children:["A volatilidade excedeu 2 desvios padrão em relação aos 14 períodos anteriores. Momentos de expansão anormal aumentam o risco de ",s.jsx("strong",{children:"slippage elevado"}),",",s.jsx("strong",{children:"captura violenta de liquidez (stop-hunts)"})," e ",s.jsx("strong",{children:"alargamento de spread"})," pelas corretoras."]})]})]}),s.jsxs("div",{className:"pt-2 border-t border-rose-500/20 text-[11px] font-mono grid grid-cols-1 sm:grid-cols-3 gap-2",children:[s.jsxs("div",{className:"bg-slate-900/80 p-2 rounded border border-slate-800 text-slate-300",children:[s.jsx("span",{className:"text-amber-400 font-bold block",children:"1. Reduzir Alavancagem"}),"Evite posições acima de 3x em derivativos durante o surto."]}),s.jsxs("div",{className:"bg-slate-900/80 p-2 rounded border border-slate-800 text-slate-300",children:[s.jsx("span",{className:"text-sky-400 font-bold block",children:"2. Fechamento de Barra"}),"Aguarde o fechamento do candle ",p.label," antes de executar."]}),s.jsxs("div",{className:"bg-slate-900/80 p-2 rounded border border-slate-800 text-slate-300",children:[s.jsx("span",{className:"text-emerald-400 font-bold block",children:"3. Ordens Limite"}),"Nunca use ordens a mercado (Market Order) nesta faixa."]})]})]})]}),s.jsxs("div",{className:"p-4 border-t border-slate-800 bg-slate-950/80 flex flex-col sm:flex-row items-center justify-between gap-3 font-mono text-xs",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{id:"btn-toggle-volatility-switch-modal",onClick:h,className:`px-2.5 py-1.5 rounded-lg border text-xs font-semibold flex items-center gap-1.5 transition ${m?"bg-emerald-500/15 border-emerald-500/30 text-emerald-400":"bg-slate-800 border-slate-700 text-slate-400"}`,children:[s.jsx(ct,{className:`w-3.5 h-3.5 ${m?"text-emerald-400":"text-slate-500"}`}),s.jsxs("span",{children:["Alerta Automático: ",m?"LIGADO":"DESLIGADO"]})]}),s.jsx("span",{className:"text-[10px] text-slate-500 hidden md:inline",children:"(Configuração persistida)"})]}),s.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[g&&s.jsxs("button",{id:"btn-snooze-symbol-alert",onClick:()=>{g(i),l()},className:"px-3 py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-lg border border-slate-700 transition flex items-center gap-1 text-xs",children:[s.jsx(n1,{className:"w-3.5 h-3.5 text-slate-400"}),s.jsxs("span",{children:["Silenciar ",i]})]}),s.jsxs("button",{id:"btn-confirm-volatility-alert",onClick:l,className:"px-4 py-1.5 bg-amber-500 hover:bg-amber-400 text-slate-950 font-bold rounded-lg transition shadow-sm flex items-center gap-1 text-xs",children:[s.jsx(y1,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Entendido (Fechar)"})]})]})]})]})})},Wv=({divergence:r,symbol:l,timeframe:i})=>{var L,R,E,z,H,q;const c=jr(i),d=r.rsiDivergence||{hasDivergence:r.hasDivergence,type:r.type,title:r.title,strength:r.strength,badgeColor:r.badgeColor,rsiCurrent:r.rsiCurrent,rsiZone:r.rsiCurrent>=70?"SOBRECOMPRA":r.rsiCurrent<=30?"SOBREVENDA":"NEUTRO",description:r.description,tradingImplication:r.tradingImplication,swingDetails:{price1:((L=r.swingDetails)==null?void 0:L.price1)||0,price2:((R=r.swingDetails)==null?void 0:R.price2)||0,rsi1:((E=r.swingDetails)==null?void 0:E.rsi1)||50,rsi2:((z=r.swingDetails)==null?void 0:z.rsi2)||50}},m=r.stochastic||{k:r.stochKCurrent??50,d:r.stochDCurrent??50,status:r.stochKCurrent>=80?"SOBRECOMPRADO":r.stochKCurrent<=20?"SOBREVENDIDO":"NEUTRO",statusLabel:r.stochKCurrent>=80?"Sobrecompra (>80)":r.stochKCurrent<=20?"Sobrevenda (<20)":"Faixa Neutra (20-80)",crossover:r.stochKCurrent>=r.stochDCurrent?"ALINHADO_ALTA":"ALINHADO_BAIXA",crossoverLabel:r.stochKCurrent>=r.stochDCurrent?"%K acima de %D":"%K abaixo de %D",momentum:r.stochKCurrent>r.stochDCurrent?"ALTA":"BAIXA",description:`Estocástico %K: ${r.stochKCurrent}, %D: ${r.stochDCurrent}.`},h=r.macd||{macdLine:0,signalLine:0,histogram:0,crossover:"ALINHADO_ALTA",crossoverLabel:"Alinhado",zeroLineState:"NA_LINHA_ZERO",histogramState:"EXPANSAO_ALTA",histogramStateLabel:"Neutro",badgeColor:"bg-slate-800 text-slate-300 border-slate-700",description:"Linha MACD em conformidade.",series:{histogram:[]}},g=()=>{switch(d.type){case"BULLISH_REGULAR":case"HIDDEN_BULLISH":return s.jsx(Ts,{className:"w-4 h-4 text-emerald-400"});case"BEARISH_REGULAR":case"HIDDEN_BEARISH":return s.jsx(Cr,{className:"w-4 h-4 text-rose-400"});default:return s.jsx(sa,{className:"w-4 h-4 text-slate-400"})}},p=((q=(H=h.series)==null?void 0:H.histogram)==null?void 0:q.slice(-14))||[],f=Math.max(1e-4,...p.map(I=>Math.abs(I))),N=(d.type.includes("BULLISH")||d.rsiZone==="SOBREVENDA")&&(m.status==="SOBREVENDIDO"||m.crossover==="CRUZAMENTO_BULLISH"||m.k>m.d)&&(h.histogram>=0||h.crossover==="CRUZAMENTO_BULLISH"),j=(d.type.includes("BEARISH")||d.rsiZone==="SOBRECOMPRA")&&(m.status==="SOBRECOMPRADO"||m.crossover==="CRUZAMENTO_BEARISH"||m.k=70?"text-rose-400":d.rsiCurrent<=30?"text-emerald-400":"text-amber-300"}`,children:d.rsiCurrent}),s.jsx("span",{className:`text-[9px] px-1 py-0.2 rounded font-semibold ${d.rsiZone==="SOBRECOMPRA"?"bg-rose-500/20 text-rose-300":d.rsiZone==="SOBREVENDA"?"bg-emerald-500/20 text-emerald-300":"text-slate-500"}`,children:d.rsiZone==="SOBRECOMPRA"?"Sobrecompra":d.rsiZone==="SOBREVENDA"?"Sobrevenda":"Neutro"})]})]}),s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Divergência Preço x RSI"}),s.jsx("div",{className:"flex items-baseline gap-1.5 mt-0.5 truncate",children:s.jsx("span",{className:`text-xs font-bold ${d.type.includes("BULLISH")?"text-emerald-400":d.type.includes("BEARISH")?"text-rose-400":"text-slate-300"}`,children:d.hasDivergence?d.type.replace("_"," "):"SEM DIVERGÊNCIA"})})]}),s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Pivôs Preço (P1 → P2)"}),s.jsx("div",{className:"mt-0.5 text-xs text-slate-200",children:d.swingDetails.price1>0?s.jsxs("span",{children:["$",d.swingDetails.price1.toLocaleString()," → ",s.jsxs("strong",{className:"text-amber-300",children:["$",d.swingDetails.price2.toLocaleString()]})]}):s.jsx("span",{className:"text-slate-500",children:"Aguardando pivôs"})})]}),s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Pivôs RSI (R1 → R2)"}),s.jsx("div",{className:"mt-0.5 text-xs text-slate-200",children:d.swingDetails.price1>0?s.jsxs("span",{children:[d.swingDetails.rsi1," → ",s.jsx("strong",{className:"text-sky-300",children:d.swingDetails.rsi2})]}):s.jsx("span",{className:"text-slate-500",children:"Calculando swings"})})]})]}),s.jsxs("div",{className:"bg-slate-950 rounded-lg p-2.5 border border-slate-800/80 space-y-1.5",children:[s.jsx("p",{className:"text-[11px] text-slate-300 font-sans leading-relaxed",children:d.description}),s.jsxs("div",{className:"pt-1.5 border-t border-slate-800 flex items-start gap-1.5 text-[11px]",children:[s.jsx("span",{className:"text-amber-400 font-bold shrink-0",children:"Implicação Tática:"}),s.jsx("span",{className:"text-slate-200 font-sans",children:d.tradingImplication})]})]})]}),s.jsxs("div",{className:"bg-slate-900/60 border border-slate-800 rounded-xl p-3 space-y-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-slate-200",children:[s.jsx("span",{className:"w-1.5 h-3 bg-sky-400 rounded-full inline-block"}),s.jsx(ml,{className:"w-3.5 h-3.5 text-sky-400"}),s.jsx("span",{children:"2. ESTOCÁSTICO RSI (%K, %D)"}),s.jsx("span",{className:"ml-1.5 text-[9px] px-1.5 py-0.2 rounded bg-sky-500/20 text-sky-300 border border-sky-500/30 uppercase",children:"Avaliação À Parte"})]}),s.jsx("span",{className:"text-[10px] text-slate-400 font-sans",children:"Momento rápido & cruzamento de gatilho"})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Estocástico %K (Fast 3)"}),s.jsxs("div",{className:"flex items-baseline gap-1.5 mt-0.5",children:[s.jsx("span",{className:`text-base font-bold ${m.k>=80?"text-rose-400":m.k<=20?"text-emerald-400":"text-sky-300"}`,children:m.k}),s.jsx("span",{className:"text-[9px] text-slate-500",children:"Linha Rápida"})]})]}),s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Estocástico %D (Média 3)"}),s.jsxs("div",{className:"flex items-baseline gap-1.5 mt-0.5",children:[s.jsx("span",{className:"text-base font-bold text-slate-200",children:m.d}),s.jsx("span",{className:"text-[9px] text-slate-500",children:"Linha Sinal"})]})]}),s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Cruzamento %K x %D"}),s.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[m.k>=m.d?s.jsx(aa,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}):s.jsx(Ha,{className:"w-3.5 h-3.5 text-rose-400 shrink-0"}),s.jsx("span",{className:`text-xs font-bold truncate ${m.k>=m.d?"text-emerald-400":"text-rose-400"}`,children:m.k>=m.d?"%K > %D (Alta)":"%K < %D (Baixa)"})]})]}),s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Região do Estocástico"}),s.jsx("div",{className:"flex items-baseline gap-1 mt-0.5",children:s.jsx("span",{className:`text-xs font-bold ${m.status==="SOBRECOMPRADO"?"text-rose-400":m.status==="SOBREVENDIDO"?"text-emerald-400":"text-slate-300"}`,children:m.status==="SOBRECOMPRADO"?"SOBRECOMPRA":m.status==="SOBREVENDIDO"?"SOBREVENDA":"ZONA NEUTRA"})})]})]}),s.jsxs("div",{className:"bg-slate-950 rounded-lg p-2 border border-slate-800/80 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-400",children:[s.jsx("span",{className:"text-emerald-400 font-semibold",children:"0 Sobrevenda (20)"}),s.jsx("span",{className:"text-slate-500",children:"Faixa Neutra de Oscilação"}),s.jsx("span",{className:"text-rose-400 font-semibold",children:"(80) Sobrecompra 100"})]}),s.jsxs("div",{className:"w-full h-2.5 bg-slate-900 rounded-full relative overflow-hidden border border-slate-800",children:[s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-[20%] bg-emerald-500/20 border-r border-emerald-500/30"}),s.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-[20%] bg-rose-500/20 border-l border-rose-500/30"}),s.jsx("div",{className:"absolute top-0 bottom-0 w-1 bg-amber-400 z-10",style:{left:`${Math.min(99,Math.max(1,m.d))}%`},title:`%D: ${m.d}`}),s.jsx("div",{className:"absolute top-0 bottom-0 w-1.5 bg-sky-400 z-20 shadow-sm",style:{left:`${Math.min(99,Math.max(1,m.k))}%`},title:`%K: ${m.k}`})]}),s.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[s.jsx("span",{className:"text-slate-400 font-sans text-[11px] leading-tight",children:m.description}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[s.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-sky-400",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-sky-400"})," %K: ",m.k]}),s.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400"})," %D: ",m.d]})]})]})]})]}),s.jsxs("div",{className:"bg-slate-900/60 border border-slate-800 rounded-xl p-3 space-y-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-slate-200",children:[s.jsx("span",{className:"w-1.5 h-3 bg-purple-400 rounded-full inline-block"}),s.jsx(yf,{className:"w-3.5 h-3.5 text-purple-400"}),s.jsx("span",{children:"3. MOMENTUM MACD (12, 26, 9)"}),s.jsx("span",{className:"ml-1.5 text-[9px] px-1.5 py-0.2 rounded bg-purple-500/20 text-purple-300 border border-purple-500/30 uppercase",children:"Módulo Integrado"})]}),s.jsx("span",{className:"text-[10px] text-slate-400 font-sans",children:"Convergência / Divergência de Médias & Histograma"})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Linha MACD (12, 26)"}),s.jsxs("div",{className:"flex items-baseline gap-1.5 mt-0.5",children:[s.jsx("span",{className:`text-base font-bold ${h.macdLine>=0?"text-emerald-400":"text-rose-400"}`,children:h.macdLine>0?`+${h.macdLine}`:h.macdLine}),s.jsx("span",{className:"text-[9px] text-slate-500",children:"EMA12 - EMA26"})]})]}),s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Linha de Sinal (9)"}),s.jsxs("div",{className:"flex items-baseline gap-1.5 mt-0.5",children:[s.jsx("span",{className:"text-base font-bold text-slate-200",children:h.signalLine>0?`+${h.signalLine}`:h.signalLine}),s.jsx("span",{className:"text-[9px] text-slate-500",children:"EMA 9 do MACD"})]})]}),s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Histograma MACD"}),s.jsxs("div",{className:"flex items-baseline gap-1.5 mt-0.5",children:[s.jsx("span",{className:`text-base font-bold ${h.histogram>=0?"text-emerald-400":"text-rose-400"}`,children:h.histogram>0?`+${h.histogram}`:h.histogram}),s.jsx("span",{className:`text-[9px] font-semibold ${h.histogramState.includes("EXPANSAO")?"text-amber-300":"text-slate-500"}`,children:h.histogram>=0?"Positivo":"Negativo"})]})]}),s.jsxs("div",{className:"p-2 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Posição Zero & Sinal"}),s.jsx("div",{className:"flex items-center gap-1 mt-0.5",children:s.jsx("span",{className:`text-xs font-bold truncate ${h.zeroLineState==="ACIMA_DE_ZERO"?"text-emerald-400":h.zeroLineState==="ABAIXO_DE_ZERO"?"text-rose-400":"text-slate-300"}`,children:h.zeroLineState==="ACIMA_DE_ZERO"?"Acima de Zero":h.zeroLineState==="ABAIXO_DE_ZERO"?"Abaixo de Zero":"Linha Zero"})})]})]}),s.jsxs("div",{className:"bg-slate-950 rounded-lg p-2.5 border border-slate-800/80 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold border ${h.badgeColor}`,children:h.crossoverLabel}),s.jsx("span",{className:"text-[10px] text-slate-400 font-mono",children:h.histogramStateLabel})]}),s.jsx("p",{className:"text-[11px] text-slate-300 font-sans leading-relaxed",children:h.description})]}),p.length>0&&s.jsxs("div",{className:"bg-slate-900/80 p-1.5 rounded-lg border border-slate-800 shrink-0",children:[s.jsx("div",{className:"text-[9px] text-slate-500 text-center mb-0.5",children:"Hist. 14p"}),s.jsxs("svg",{width:"140",height:"34",className:"overflow-visible",children:[s.jsx("line",{x1:"0",y1:"17",x2:"140",y2:"17",stroke:"#475569",strokeWidth:"1",strokeDasharray:"2 2"}),p.map((I,T)=>{const S=T*10+2,X=Math.max(2,Math.abs(I)/f*14),v=I>=0,k=v?17-X:17;return s.jsx("rect",{x:S,y:k,width:7,height:X,rx:"1",fill:v?"#34d399":"#f43f5e",opacity:T===p.length-1?"1":"0.75"},T)})]})]})]})]}),s.jsxs("div",{className:"bg-slate-900/80 rounded-xl p-3 border border-slate-800 flex flex-wrap items-center justify-between gap-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-1.5 rounded-md bg-amber-500/10 border border-amber-500/30 text-amber-400",children:s.jsx(mu,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsx("span",{className:"text-xs font-bold text-white block",children:"Confluência dos 3 Indicadores de Momentum"}),s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-slate-400 mt-0.5",children:[s.jsxs("span",{children:["RSI: ",s.jsx("strong",{className:d.type.includes("BULLISH")?"text-emerald-400":d.type.includes("BEARISH")?"text-rose-400":"text-slate-300",children:d.hasDivergence?d.title:"Alinhado"})]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Estocástico: ",s.jsxs("strong",{className:m.k>m.d?"text-emerald-400":"text-rose-400",children:[m.k>m.d?"%K > %D":"%K < %D"," (",m.status,")"]})]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["MACD: ",s.jsx("strong",{className:h.histogram>=0?"text-emerald-400":"text-rose-400",children:h.histogram>=0?"Hist +":"Hist -"})]})]})]})]}),s.jsx("div",{children:N?s.jsxs("span",{className:"px-2.5 py-1 rounded text-xs font-bold bg-emerald-500/20 text-emerald-300 border border-emerald-500/40 flex items-center gap-1.5",children:[s.jsx(ia,{className:"w-3.5 h-3.5 text-emerald-400"}),"CONFLUÊNCIA DE COMPRA (ALTA)"]}):j?s.jsxs("span",{className:"px-2.5 py-1 rounded text-xs font-bold bg-rose-500/20 text-rose-300 border border-rose-500/40 flex items-center gap-1.5",children:[s.jsx(uu,{className:"w-3.5 h-3.5 text-rose-400"}),"CONFLUÊNCIA DE VENDA (BAIXA)"]}):s.jsxs("span",{className:"px-2.5 py-1 rounded text-xs font-bold bg-slate-800 text-slate-300 border border-slate-700 flex items-center gap-1.5",children:[s.jsx(sa,{className:"w-3.5 h-3.5 text-slate-400"}),"MOMENTUM CONCORDANTE / NEUTRO"]})})]})]})},ey=({signal:r,onOpenRiskCalc:l,onRefreshPrices:i})=>{const[c,d]=$.useState("DAY_TRADE"),[m,h]=$.useState("TABS"),[g,p]=$.useState("SETUP"),[f,N]=$.useState(null),[j,L]=$.useState(!1),[R,E]=$.useState(r.currentPrice),[z,H]=$.useState(null);$.useEffect(()=>{if(r.currentPrice!==R){r.currentPrice>R?H("UP"):r.currentPriceH(null),1500);return()=>clearTimeout(K)}},[r.currentPrice,R]),$.useEffect(()=>{N(null)},[r.symbol]);const q=r.currentPrice||100,I=r.entryPrice||q,T=f!==null?f:g==="MARKET"?q:I,y=r.decision==="COMPRA"||r.decision==="AGUARDAR",S=eu(r,T),X=S[c],v=["SCALP","DAY_TRADE","SWING_TRADE","POSITION_TRADE"],k=async()=>{L(!0);try{i?await i():await fetch("/api/market/refresh-prices",{method:"POST"})}catch(K){console.warn("Erro ao atualizar cotação:",K)}finally{setTimeout(()=>L(!1),500)}},se=()=>{N(q),p("MARKET")},ne=Math.abs(q-X.stopLoss),U=y?(X.stopLoss-q)/q*100:(q-X.stopLoss)/q*100,ae=q-I,ce=(q-I)/I*100,C=K=>K<1e-4?K.toFixed(6):K<1?K.toFixed(4):K<10?K.toFixed(3):K.toFixed(2);return s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-4 font-mono text-xs space-y-3.5",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 border-b border-slate-800/80 pb-3",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xs font-bold text-white uppercase tracking-wider flex items-center gap-1.5",children:[s.jsx(mu,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{children:"Gestão de Risco & Parâmetros de Execução"})]}),s.jsx("p",{className:"text-[11px] text-slate-400 font-sans mt-0.5",children:"Setups quantitativos calibrados por ATR divididos por modalidade operacional"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center bg-slate-900 border border-slate-800 rounded-lg p-0.5",children:[s.jsx("button",{id:"btn-risk-view-tabs",onClick:()=>h("TABS"),className:`px-2 py-1 text-[10px] rounded transition ${m==="TABS"?"bg-amber-500/20 text-amber-300 font-bold":"text-slate-400 hover:text-slate-200"}`,children:"Abas"}),s.jsxs("button",{id:"btn-risk-view-comparison",onClick:()=>h("COMPARISON"),className:`px-2 py-1 text-[10px] rounded transition flex items-center gap-1 ${m==="COMPARISON"?"bg-amber-500/20 text-amber-300 font-bold":"text-slate-400 hover:text-slate-200"}`,children:[s.jsx(T1,{className:"w-3 h-3"}),s.jsx("span",{children:"Comparar 4"})]})]}),s.jsxs("button",{id:"btn-open-position-sizer-main",onClick:()=>l(r,c),className:"px-3 py-1.5 text-xs font-bold bg-amber-500 hover:bg-amber-400 text-slate-950 rounded-lg transition flex items-center gap-1 shadow-sm shrink-0",children:[s.jsx(O1,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Dimensionar Lote"})]})]})]}),s.jsxs("div",{className:"bg-slate-900/90 border border-slate-800 rounded-xl p-3 flex flex-col md:flex-row items-start md:items-center justify-between gap-3 shadow-inner",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[s.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),s.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-emerald-500"})]}),s.jsx("span",{className:"text-[10px] font-bold tracking-wider text-emerald-400 uppercase bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:"AO VIVO • Binance.US"})]}),s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[s.jsx("span",{className:"text-slate-400 text-[11px] font-sans",children:"Preço Atual:"}),s.jsxs("span",{className:`font-mono text-base sm:text-lg font-bold transition-colors duration-300 ${z==="UP"?"text-emerald-400 bg-emerald-500/20 px-1 rounded":z==="DOWN"?"text-rose-400 bg-rose-500/20 px-1 rounded":"text-white"}`,children:["$",C(q)]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-mono px-2 py-0.5 rounded bg-slate-950 border border-slate-800",children:[s.jsx("span",{className:"text-slate-500",children:"vs Entrada:"}),s.jsxs("span",{className:`font-bold flex items-center ${ce>=0?"text-emerald-400":"text-rose-400"}`,children:[ce>=0?s.jsx(aa,{className:"w-3 h-3 inline"}):s.jsx(Ha,{className:"w-3 h-3 inline"}),ce>=0?"+":"",ce.toFixed(2),"%"]}),s.jsxs("span",{className:"text-slate-400 text-[9px]",children:["(",ae>=0?"+$":"-$",C(Math.abs(ae)),")"]})]}),s.jsxs("div",{className:"text-[10px] text-slate-500 hidden xl:flex items-center gap-1",children:[s.jsx(gl,{className:"w-3 h-3"}),s.jsx("span",{children:r.timeStr||"Horário de Brasília"})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 w-full md:w-auto justify-between md:justify-end",children:[s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-lg p-0.5 text-[10px]",children:[s.jsxs("button",{id:"btn-entry-base-setup",onClick:()=>{p("SETUP"),N(null)},title:"Calcular alvos a partir do Preço de Entrada do Setup planejado",className:`px-2 py-1 rounded transition ${g==="SETUP"&&f===null?"bg-amber-500/20 text-amber-300 font-bold":"text-slate-400 hover:text-slate-200"}`,children:["Entrada Setup ($",C(I),")"]}),s.jsxs("button",{id:"btn-entry-base-market",onClick:()=>{p("MARKET"),N(q)},title:"Calcular alvos e stop a partir do Preço de Mercado Atual",className:`px-2 py-1 rounded transition flex items-center gap-1 ${g==="MARKET"||f===q?"bg-emerald-500/20 text-emerald-300 font-bold":"text-slate-400 hover:text-slate-200"}`,children:[s.jsx(ct,{className:"w-2.5 h-2.5 text-emerald-400"}),s.jsxs("span",{children:["Preço Atual ($",C(q),")"]})]})]}),s.jsxs("button",{id:"btn-sync-entry-market",onClick:se,title:"Sincronizar a entrada com a cotação de mercado deste segundo",className:"px-2 py-1 text-[10px] font-bold text-sky-300 bg-sky-500/10 hover:bg-sky-500/20 border border-sky-500/30 rounded-lg transition flex items-center gap-1",children:[s.jsx(ct,{className:"w-3 h-3 text-sky-400"}),s.jsx("span",{className:"hidden sm:inline",children:"Sincronizar"})]}),s.jsxs("button",{id:"btn-refresh-live-price",onClick:k,disabled:j,className:"px-2.5 py-1 text-[10px] font-bold text-slate-200 hover:text-white bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-lg transition flex items-center gap-1.5 shadow-sm active:scale-95 disabled:opacity-60",title:"Atualizar cotação em tempo real da Binance.US",children:[s.jsx(Rr,{className:`w-3 h-3 text-amber-400 ${j?"animate-spin":""}`}),s.jsx("span",{children:j?"Atualizando...":"Atualizar Preço"})]})]})]}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-1.5",children:v.map(K=>{const w=S[K],M=c===K;return s.jsxs("button",{id:`btn-style-tab-${K}`,onClick:()=>{d(K),m==="COMPARISON"&&h("TABS")},className:`p-2 rounded-lg border text-left transition flex flex-col justify-between gap-1 ${M?`${w.badgeColor} border-current ring-1 ring-amber-400/30`:"bg-slate-900/60 border-slate-800 text-slate-400 hover:bg-slate-900 hover:text-slate-200"}`,children:[s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsx("span",{className:"font-bold text-[11px] truncate",children:w.badge}),M&&s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400"})]}),s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-400 font-sans",children:[s.jsx("span",{children:w.atrMultipleStop}),s.jsxs("span",{className:"font-mono text-slate-300",children:["R:R 1:",w.rr1]})]})]},K)})}),m==="TABS"&&s.jsxs("div",{className:"space-y-3 animate-in fade-in duration-150",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 text-xs",children:[s.jsxs("div",{className:"p-2.5 bg-slate-900 rounded-lg border border-slate-800 flex flex-col justify-between",children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-400",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{children:"Preço de Entrada"}),T===q?s.jsx("span",{className:"text-[9px] bg-emerald-500/20 text-emerald-300 px-1 rounded",children:"Ao Vivo"}):s.jsx("span",{className:"text-[9px] bg-slate-800 text-slate-400 px-1 rounded",children:"Setup"})]}),s.jsx("span",{className:"text-slate-500 font-sans",children:T===q?"Entrada a Mercado":"Ordem Limit"})]}),s.jsx("div",{className:"my-1",children:s.jsxs("span",{className:"text-white font-bold text-base sm:text-lg font-mono",children:["$",C(T)]})}),s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-500 border-t border-slate-800/80 pt-1",children:[s.jsx("span",{children:"Preço Mercado Atual:"}),s.jsxs("span",{className:"font-mono text-slate-300",children:["$",C(q)]})]})]}),s.jsxs("div",{className:"p-2.5 bg-slate-900 rounded-lg border border-rose-500/30 flex flex-col justify-between",children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-rose-400",children:[s.jsxs("span",{className:"flex items-center gap-1 font-bold",children:[s.jsx(dl,{className:"w-3 h-3 text-rose-400"}),s.jsxs("span",{children:["Stop Loss (",X.atrMultipleStop,")"]})]}),s.jsxs("span",{className:"font-bold",children:["-",X.stopDistancePercent,"%"]})]}),s.jsx("div",{className:"my-1",children:s.jsxs("span",{className:"text-rose-300 font-bold text-base sm:text-lg font-mono",children:["$",C(X.stopLoss)]})}),s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-500 border-t border-slate-800/80 pt-1",children:[s.jsx("span",{children:"Distância do Preço Atual:"}),s.jsxs("span",{className:"font-mono text-rose-400 font-bold",children:[U>=0?"+":"",U.toFixed(2),"% ($",C(ne),")"]})]})]})]}),s.jsxs("div",{className:"space-y-2 pt-1",children:[s.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[s.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-white uppercase tracking-wider",children:[s.jsx(As,{className:"w-3.5 h-3.5 text-emerald-400"}),s.jsx("span",{children:"5 Alvos em Fibonacci"}),s.jsx("span",{className:"text-[10px] text-amber-300 font-mono font-normal lowercase bg-amber-500/10 border border-amber-500/20 px-1.5 py-0.5 rounded",children:"golden ratio & expansões"})]}),s.jsxs("span",{className:"text-[10px] text-slate-400 font-sans hidden sm:inline",children:["Base de cálculo: ",s.jsxs("strong",{className:"text-slate-200",children:["$",C(T)]})]})]}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-2 text-xs",children:X.fibonacciTargets&&X.fibonacciTargets.length===5?X.fibonacciTargets.map((K,w)=>{const W=["40% Parcial","Stop no 0 a 0","Trailing Stop","Tendência Forte","Realização Total"][w]||"Expansão Fibo",oe=y?q>=K.price:q<=K.price;Math.abs(K.price-q);const be=y?(K.price-q)/q*100:(q-K.price)/q*100;return s.jsxs("div",{className:`p-2.5 rounded-lg border flex flex-col justify-between gap-1.5 transition ${oe?"bg-emerald-950/40 border-emerald-500/60 ring-1 ring-emerald-500/30":"bg-slate-900 border-emerald-500/30 hover:border-emerald-500/50"}`,children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[s.jsx("span",{className:`font-bold flex items-center gap-1 ${oe?"text-emerald-300":"text-emerald-400"}`,children:s.jsxs("span",{children:["Alvo TP",K.level]})}),s.jsxs("span",{className:"text-[10px] font-mono text-slate-400",children:["1:",K.ratio]})]}),s.jsxs("div",{className:"my-0.5",children:[s.jsxs("div",{className:"text-emerald-300 font-bold text-sm sm:text-base font-mono",children:["$",C(K.price)]}),s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-400 mt-0.5",children:[s.jsxs("span",{className:"text-emerald-400 font-bold font-mono",children:["+",K.pnlPercent,"%"]}),oe?s.jsx("span",{className:"text-[9px] bg-emerald-500/20 text-emerald-300 font-bold px-1 py-0.5 rounded",children:"Atingido ✓"}):s.jsx("span",{className:"text-[9px] text-slate-500",children:"Pendente"})]})]}),s.jsxs("div",{className:"text-[9px] font-mono bg-slate-950/80 px-1.5 py-1 rounded border border-slate-800 flex items-center justify-between",children:[s.jsx("span",{className:"text-slate-500",children:"Do preço atual:"}),oe?s.jsx("span",{className:"text-emerald-400 font-bold",children:"Atingido"}):s.jsxs("span",{className:`font-bold ${be>0?"text-amber-300":"text-slate-300"}`,children:[be>0?"+":"",be.toFixed(2),"%"]})]}),s.jsxs("div",{className:"text-[10px] text-slate-400 border-t border-slate-800/80 pt-1 flex items-center justify-between",children:[s.jsx("span",{className:"truncate",children:W}),s.jsxs("span",{className:"text-[9px] text-slate-500 font-mono",children:["Fibo ",K.ratio,"x"]})]})]},K.level)}):s.jsx("div",{className:"col-span-full p-3 bg-slate-900 rounded-lg text-center text-slate-500",children:"Calculando alvos de Fibonacci..."})})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-2.5 text-[11px]",children:[s.jsxs("div",{className:"p-2.5 bg-slate-900/80 rounded-lg border border-slate-800 space-y-1",children:[s.jsx("span",{className:"text-slate-400 block text-[10px] uppercase",children:"Parâmetros Operacionais"}),s.jsxs("div",{className:"flex items-center justify-between text-slate-200",children:[s.jsx("span",{children:"Tempos Gráficos:"}),s.jsx("strong",{className:"text-amber-300",children:X.timeframes})]}),s.jsxs("div",{className:"flex items-center justify-between text-slate-200",children:[s.jsx("span",{children:"Duração Estimada:"}),s.jsx("strong",{className:"text-slate-300",children:X.holdingTime})]}),s.jsxs("div",{className:"flex items-center justify-between text-slate-200",children:[s.jsx("span",{children:"Alavancagem Máxima:"}),s.jsx("strong",{className:"text-sky-300",children:X.recommendedLeverage})]})]}),s.jsxs("div",{className:"p-2.5 bg-slate-900/80 rounded-lg border border-slate-800 md:col-span-2 space-y-1.5",children:[s.jsx("span",{className:"text-slate-400 block text-[10px] uppercase",children:"Regras de Execução & Condução"}),s.jsx("ul",{className:"space-y-1 text-[11px] font-sans text-slate-300",children:X.executionRules.map((K,w)=>s.jsxs("li",{className:"flex items-start gap-1.5",children:[s.jsx(ia,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0 mt-0.5"}),s.jsx("span",{children:K})]},w))})]})]})]}),m==="COMPARISON"&&s.jsx("div",{className:"overflow-x-auto no-scrollbar border border-slate-800 rounded-lg",children:s.jsxs("table",{className:"w-full text-left text-[11px] font-mono",children:[s.jsx("thead",{className:"bg-slate-900/90 text-slate-400 border-b border-slate-800",children:s.jsxs("tr",{children:[s.jsx("th",{className:"p-2 font-medium",children:"Modalidade"}),s.jsx("th",{className:"p-2 font-medium",children:"Tempos"}),s.jsx("th",{className:"p-2 font-medium",children:"Stop Loss"}),s.jsx("th",{className:"p-2 font-medium",children:"TP1 (1.618)"}),s.jsx("th",{className:"p-2 font-medium",children:"TP2 (2.000)"}),s.jsx("th",{className:"p-2 font-medium",children:"TP3 (2.618)"}),s.jsx("th",{className:"p-2 font-medium",children:"TP4 (3.618)"}),s.jsx("th",{className:"p-2 font-medium",children:"TP5 (4.236)"}),s.jsx("th",{className:"p-2 font-medium",children:"Alavancagem"}),s.jsx("th",{className:"p-2 font-medium text-right",children:"Ação"})]})}),s.jsx("tbody",{className:"divide-y divide-slate-800/60 bg-slate-950",children:v.map(K=>{const w=S[K];return s.jsxs("tr",{className:"hover:bg-slate-900/50 transition",children:[s.jsx("td",{className:"p-2 font-bold text-white whitespace-nowrap",children:s.jsx("span",{className:`px-2 py-0.5 rounded border text-[10px] ${w.badgeColor}`,children:w.label})}),s.jsx("td",{className:"p-2 text-slate-300 whitespace-nowrap",children:w.timeframes}),s.jsxs("td",{className:"p-2 text-rose-300 font-semibold whitespace-nowrap",children:["$",C(w.stopLoss)," ",s.jsxs("span",{className:"text-[10px] text-slate-500 font-normal",children:["(-",w.stopDistancePercent,"%)"]})]}),s.jsxs("td",{className:"p-2 text-emerald-300 font-semibold whitespace-nowrap",children:["$",C(w.takeProfit1)]}),s.jsxs("td",{className:"p-2 text-emerald-300 font-semibold whitespace-nowrap",children:["$",C(w.takeProfit2)]}),s.jsxs("td",{className:"p-2 text-emerald-300 font-semibold whitespace-nowrap",children:["$",C(w.takeProfit3)]}),s.jsxs("td",{className:"p-2 text-emerald-300 font-semibold whitespace-nowrap",children:["$",C(w.takeProfit4)]}),s.jsxs("td",{className:"p-2 text-emerald-300 font-semibold whitespace-nowrap",children:["$",C(w.takeProfit5)]}),s.jsx("td",{className:"p-2 text-sky-300 whitespace-nowrap",children:w.recommendedLeverage}),s.jsx("td",{className:"p-2 text-right whitespace-nowrap",children:s.jsx("button",{id:`btn-select-style-${K}`,onClick:()=>l(r,K),className:"px-2 py-0.5 text-[10px] font-bold bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 border border-amber-500/40 rounded transition",children:"Aplicar"})})]},K)})})]})})]})},ty=({signal:r,onOpenRiskCalc:l})=>{const i=r.currentPrice??0,c=r.entryPrice??(i||1),d=r.stopLoss??(i?i*.98:0),m=r.takeProfit1??(i?i*1.04:0),h=r.decision,g=r.passedFilter??!1,p=h==="COMPRA",f=h==="VENDA",N=I=>I==null||isNaN(I)?"0.00":I>=1?I.toFixed(2):I.toFixed(4);let j="VALIDO_AGUARDANDO",L="VÁLIDO (AGUARDANDO GATILHO)",R="",E="bg-amber-500/10 border-amber-500/40 text-amber-300",z=0,H=0;if(!g||h==="AGUARDAR")j="INVALIDADO_ESTRUTURA",L="INVALIDADO (SEM CONFLUÊNCIA)",R="O ativo não atende simultaneamente aos 4 pilares institucionais ou apresenta conflito entre tempos gráficos.",E="bg-slate-800 text-slate-400 border-slate-700";else if(p)if(m>0&&i>=m)j="TP_ATINGIDO",L="ATINGIU TAKE PROFIT (LUCRO CONCLUÍDO)",z=c>0?(i-c)/c*100:0,H=100,R=`O preço atingiu o Alvo 1 ($${m.toLocaleString()}) com lucro de +${z.toFixed(2)}%. Operação concluída ou com trailing stop ativado.`,E="bg-emerald-500/20 border-emerald-500/50 text-emerald-300";else if(d>0&&i<=d)j="INVALIDADO_STOP",L="INVALIDADO (STOP LOSS ATINGIDO)",z=c>0?(i-c)/c*100:0,H=0,R=`O preço rompeu abaixo do Stop Loss técnico em $${d.toLocaleString()}. A tese compradora foi invalidada e a perda foi estritamente contida no risco fixo.`,E="bg-rose-500/20 border-rose-500/50 text-rose-300";else if(i>=c){j="EM_ANDAMENTO",L="EM ANDAMENTO (ATIVO NO MERCADO)",z=c>0?(i-c)/c*100:0;const I=m-c||1;H=Math.min(99,Math.max(5,Math.round((i-c)/I*100))),R=`Ordem de COMPRA acionada a $${c.toLocaleString()}! Operação em andamento com ${H}% do trajeto percorrido até o TP1 ($${m.toLocaleString()}).`,E="bg-sky-500/20 border-sky-500/50 text-sky-300"}else{j="VALIDO_AGUARDANDO",L="VÁLIDO (AGUARDANDO GATILHO)";const I=c>0?Math.max(0,(c-i)/c*100):0;H=0,R=`Setup 100% qualificado pelos 4 pilares. Aguardando rompimento/confirmação do gatilho em $${c.toLocaleString()} (a ${I.toFixed(2)}% do preço atual).`,E="bg-amber-500/20 border-amber-500/50 text-amber-300"}else if(f)if(m>0&&i<=m)j="TP_ATINGIDO",L="ATINGIU TAKE PROFIT (LUCRO CONCLUÍDO)",z=c>0?(c-i)/c*100:0,H=100,R=`O preço atingiu o Alvo 1 de VENDA ($${m.toLocaleString()}) com lucro de +${z.toFixed(2)}%. Operação vencedora finalizada.`,E="bg-emerald-500/20 border-emerald-500/50 text-emerald-300";else if(d>0&&i>=d)j="INVALIDADO_STOP",L="INVALIDADO (STOP LOSS ATINGIDO)",z=c>0?-((i-c)/c)*100:0,H=0,R=`O preço rompeu acima do Stop Loss de proteção em $${d.toLocaleString()}. A tese vendedora foi invalidada.`,E="bg-rose-500/20 border-rose-500/50 text-rose-300";else if(i<=c){j="EM_ANDAMENTO",L="EM ANDAMENTO (ATIVO NO MERCADO)",z=c>0?(c-i)/c*100:0;const I=c-m||1;H=Math.min(99,Math.max(5,Math.round((c-i)/I*100))),R=`Ordem de VENDA acionada a $${c.toLocaleString()}! Operação em andamento com ${H}% do trajeto até o TP1 ($${m.toLocaleString()}).`,E="bg-sky-500/20 border-sky-500/50 text-sky-300"}else{j="VALIDO_AGUARDANDO",L="VÁLIDO (AGUARDANDO GATILHO)";const I=c>0?Math.max(0,(i-c)/c*100):0;H=0,R=`Setup vendedora 100% qualificado. Aguardando perda do suporte/gatilho em $${c.toLocaleString()} (a ${I.toFixed(2)}% do preço atual).`,E="bg-amber-500/20 border-amber-500/50 text-amber-300"}const q=isNaN(z)||!isFinite(z)?0:z;return s.jsxs("div",{id:"trade-lifecycle-status-card",className:"bg-slate-900/95 border border-slate-800 rounded-xl p-4 shadow-md font-mono",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-3 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsxs("div",{className:`p-2 rounded-lg border ${E}`,children:[j==="TP_ATINGIDO"&&s.jsx(ia,{className:"w-5 h-5 text-emerald-400"}),j==="EM_ANDAMENTO"&&s.jsx(ct,{className:"w-5 h-5 text-sky-400 animate-pulse"}),j==="VALIDO_AGUARDANDO"&&s.jsx(gl,{className:"w-5 h-5 text-amber-400"}),(j==="INVALIDADO_STOP"||j==="INVALIDADO_ESTRUTURA")&&s.jsx(S1,{className:"w-5 h-5 text-rose-400"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs font-bold border ${E}`,children:L}),s.jsxs("span",{className:"text-white font-bold text-xs",children:[r.symbol," (",r.name,")"]})]}),s.jsx("div",{className:"text-[11px] text-slate-400 mt-0.5 font-sans",children:"Monitoramento dinâmico de validade de trade em tempo real"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[j==="EM_ANDAMENTO"&&s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"text-[10px] text-slate-400 uppercase",children:"PnL em Andamento"}),s.jsx("div",{className:`text-sm font-bold ${q>=0?"text-emerald-400":"text-rose-400"}`,children:q>=0?`+${q.toFixed(2)}%`:`${q.toFixed(2)}%`})]}),j==="TP_ATINGIDO"&&s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"text-[10px] text-emerald-400 uppercase font-bold",children:"Ganho Realizado"}),s.jsxs("div",{className:"text-sm font-bold text-emerald-400",children:["+",q.toFixed(2),"%"]})]}),j==="VALIDO_AGUARDANDO"&&s.jsxs("div",{className:"text-right",children:[s.jsx("div",{className:"text-[10px] text-amber-400 uppercase font-bold",children:"Status do Gatilho"}),s.jsx("div",{className:"text-xs font-bold text-amber-300",children:"Aguardando Entrada"})]}),l&&s.jsx("button",{onClick:l,className:"px-2.5 py-1 rounded bg-amber-500/10 hover:bg-amber-500/20 text-amber-300 border border-amber-500/30 text-xs font-medium transition",children:"Calculadora"})]})]}),s.jsx("div",{className:"mt-3 text-xs text-slate-300 font-sans leading-relaxed bg-slate-950/60 p-2.5 rounded-lg border border-slate-800/60",children:R}),s.jsxs("div",{className:"mt-3.5",children:[s.jsxs("div",{className:"flex items-center justify-between text-[11px] font-mono mb-1.5",children:[s.jsxs("span",{className:"text-slate-400 flex items-center gap-1",children:[s.jsx("span",{className:"text-rose-400 font-bold",children:"Stop:"}),s.jsxs("span",{children:["$",N(d)]})]}),s.jsxs("span",{className:"text-slate-300 flex items-center gap-1 font-bold",children:[s.jsx("span",{className:"text-sky-400",children:"Entrada:"}),s.jsxs("span",{children:["$",N(c)]})]}),s.jsxs("span",{className:"text-slate-400 flex items-center gap-1",children:[s.jsx("span",{className:"text-emerald-400 font-bold",children:"TP1:"}),s.jsxs("span",{children:["$",N(m)]})]})]}),s.jsx("div",{className:"w-full bg-slate-950 h-2.5 rounded-full overflow-hidden border border-slate-800 relative",children:s.jsx("div",{className:`h-full transition-all duration-500 rounded-full ${j==="TP_ATINGIDO"?"bg-emerald-400":j==="INVALIDADO_STOP"?"bg-rose-500":j==="EM_ANDAMENTO"?"bg-sky-400":"bg-amber-400/50"}`,style:{width:`${Math.max(5,H)}%`}})}),s.jsxs("div",{className:"grid grid-cols-4 gap-1.5 mt-2.5 text-[10px] font-mono text-center",children:[s.jsx("div",{className:`p-1 rounded border ${g?"bg-emerald-500/10 border-emerald-500/30 text-emerald-300 font-semibold":"bg-slate-950 border-slate-800 text-slate-500"}`,children:"1. Confluência 4P"}),s.jsx("div",{className:`p-1 rounded border ${j!=="INVALIDADO_ESTRUTURA"?"bg-amber-500/10 border-amber-500/30 text-amber-300 font-semibold":"bg-slate-950 border-slate-800 text-slate-500"}`,children:"2. Gatilho Armado"}),s.jsx("div",{className:`p-1 rounded border ${j==="EM_ANDAMENTO"||j==="TP_ATINGIDO"?"bg-sky-500/10 border-sky-500/30 text-sky-300 font-semibold":"bg-slate-950 border-slate-800 text-slate-500"}`,children:"3. Em Andamento"}),s.jsxs("div",{className:`p-1 rounded border ${j==="TP_ATINGIDO"?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300 font-bold":j==="INVALIDADO_STOP"?"bg-rose-500/20 border-rose-500/40 text-rose-300 font-bold":"bg-slate-950 border-slate-800 text-slate-500"}`,children:["4. ",j==="TP_ATINGIDO"?"Lucro TP1":j==="INVALIDADO_STOP"?"Stop Contido":"Conclusão"]})]})]})]})},zh=({signal:r,signals:l,onSelectSymbol:i,onOpenRiskCalc:c,onRefreshAI:d,isAiLoading:m,onRefreshPrices:h})=>{var qt,rs,ht,Lt,is,Cs,Tt,Pt,os,Nt,_s,ps,We,Os;const[g,p]=$.useState("1h"),[f,N]=$.useState(null),[j,L]=$.useState(!0),[R,E]=$.useState(()=>{try{const re=localStorage.getItem("god_protocol_volatility_alert_enabled");return re!==null?re==="true":!0}catch{return!0}}),[z,H]=$.useState(!1),[q,I]=$.useState(new Set),[T,y]=$.useState({}),[S,X]=$.useState("MACRO"),[v,k]=$.useState("MACRO"),se=()=>{const re=!R;E(re);try{localStorage.setItem("god_protocol_volatility_alert_enabled",String(re))}catch(fe){console.error(fe)}},ne=re=>{I(fe=>new Set([...fe,re]))},U=$.useMemo(()=>Hv(r,g),[r,g]),ae=$.useMemo(()=>jr(g),[g]),ce=$.useMemo(()=>Gv(U,14),[U]),C=$.useMemo(()=>qv(ce,14,3,3),[ce]),K=$.useMemo(()=>Zv(U,ce,C.k,C.d),[U,ce,C]),w=$.useMemo(()=>Kv(U,14),[U]);$.useEffect(()=>{const re=`${r.symbol}_${g}`;if(R&&w.isExtremeSurge&&!q.has(r.symbol)&&!T[re]){H(!0),y(fe=>({...fe,[re]:!0}));try{vl("VOLATILITY_ALERT")}catch(fe){console.error(fe)}}},[R,w.isExtremeSurge,r.symbol,g,q,T]);const M=$.useMemo(()=>Vv(U,r.currentPrice,22),[U,r.currentPrice]),W=U.flatMap(re=>[re.high,re.low]),oe=Math.min(...W)*.995,_=Math.max(...W)*1.005-oe||1,Y=220,D=650,ee=Math.max(5,D/(U.length||1)*.65),me=D/(U.length||1),ie=re=>Y-(re-oe)/_*Y,ve=$.useMemo(()=>{const re=U.map(De=>De.close),fe=2/10;let je=re[0]||1;return re.map((De,Ie)=>(je=Ie===0?De:De*fe+je*(1-fe),je))},[U]),Ae=$.useMemo(()=>{const re=U.map(De=>De.close),fe=2/22;let je=re[0]||1;return re.map((De,Ie)=>(je=Ie===0?De:De*fe+je*(1-fe),je))},[U]),Re=$.useMemo(()=>{const re=U.map(De=>De.close),fe=2/51;let je=re[0]||1;return re.map((De,Ie)=>(je=Ie===0?De:De*fe+je*(1-fe),je))},[U]),At=re=>re.map((fe,je)=>{const De=je*me+me/2,Ie=ie(fe);return`${je===0?"M":"L"} ${De} ${Ie}`}).join(" "),Mt=[{name:"SCALP",tfs:["3m","5m","15m","30m"]},{name:"DAY TRADE",tfs:["1h","2h","8h","12h"]},{name:"SWING & POSITION",tfs:["1d","3d","5d","1w","2w"]}];return s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl overflow-hidden shadow-sm",children:[s.jsxs("div",{className:"p-4 sm:p-6 border-b border-slate-800 bg-slate-950/40 flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-slate-800 border border-slate-700 flex items-center justify-center font-bold text-lg font-mono text-white shadow-inner",children:r.symbol.slice(0,3)}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{className:"text-xl font-bold font-mono text-white tracking-tight",children:r.symbol}),s.jsxs("span",{className:"text-xs text-slate-400",children:["(",r.name,")"]}),r.marketCapRank&&s.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[11px] font-mono bg-amber-400/10 border border-amber-400/30 text-amber-400 font-bold",children:["Rank #",r.marketCapRank]}),r.passedFilter?s.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 font-semibold flex items-center gap-1",children:[s.jsx(ul,{className:"w-3.5 h-3.5"}),"Confluência Aprovada"]}):s.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono bg-amber-500/10 border border-amber-500/30 text-amber-300",children:"Aguardando Confluência Total"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3 mt-1 text-xs text-slate-400 font-mono",children:[s.jsxs("span",{children:["Preço: ",s.jsxs("strong",{className:"text-white",children:["$",r.currentPrice.toLocaleString()]})]}),s.jsx("span",{children:"•"}),s.jsxs("span",{className:r.change24h>=0?"text-emerald-400":"text-rose-400",children:["24h: ",r.change24h>=0?`+${r.change24h}%`:`${r.change24h}%`]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["ATR: ",s.jsx("strong",{className:"text-slate-300",children:r.atrValue})]}),s.jsx("span",{children:"•"}),s.jsxs("span",{className:"text-amber-300",children:["TF Atual: ",s.jsx("strong",{children:ae.fullName})]})]}),(()=>{const re=Dv(Ef(r));return s.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5",children:[s.jsxs("span",{className:`text-[10px] font-mono px-2 py-0.5 rounded border ${re.color}`,children:["Setup: ",re.label]}),s.jsxs("button",{id:`btn-sound-preview-${r.symbol}`,onClick:()=>hu(r),className:"px-1.5 py-0.5 rounded bg-slate-900 border border-slate-700 text-slate-400 hover:text-amber-400 hover:border-amber-500/50 transition flex items-center gap-1 text-[10px] font-mono",title:`Ouvir som personalizado para ${re.label}`,children:[s.jsx(Es,{className:"w-3 h-3 text-amber-400"}),s.jsx("span",{children:"Ouvir Alerta"})]})]})})()]})]}),s.jsxs("div",{className:"flex items-center gap-2.5 flex-wrap justify-between sm:justify-end",children:[s.jsxs("div",{className:"flex items-center bg-slate-950 border border-slate-800 rounded-xl p-1.5 gap-1.5",children:[s.jsxs("button",{id:"btn-toggle-volatility-alert-switch",onClick:se,className:`px-2 py-1 rounded-lg text-xs font-mono font-medium transition flex items-center gap-1.5 border ${R?"bg-emerald-500/15 text-emerald-300 border-emerald-500/30":"bg-slate-900 text-slate-400 border-slate-700 hover:text-slate-300"}`,title:"Ligar ou desligar o alerta visual automático de volatilidade extrema (+2σ)",children:[s.jsx(ct,{className:`w-3.5 h-3.5 ${R?"text-emerald-400":"text-slate-500"}`}),s.jsxs("span",{children:["Alerta 2σ: ",R?"LIGADO":"DESLIGADO"]})]}),s.jsxs("span",{className:`px-2 py-1 rounded-lg text-[10px] font-mono font-bold border ${w.isExtremeSurge?"bg-rose-500/20 text-rose-300 border-rose-500/40 animate-pulse":"bg-slate-900 text-slate-400 border-slate-800"}`,title:`Volatilidade Atual: ${w.currentPeriodVolatility}% | Média: ${w.historicalMean14}% | Limiar 2σ: ${w.threshold2Sigma}%`,children:[w.isExtremeSurge?"⚠️ ":"","+",w.zScore,"σ"]}),s.jsx("button",{id:"btn-force-open-volatility-popup",onClick:()=>H(!0),className:"p-1 rounded text-slate-400 hover:text-amber-400 hover:bg-slate-900 transition",title:"Abrir pop-up de advertência de volatilidade para visualização",children:s.jsx(xl,{className:"w-3.5 h-3.5"})})]}),l&&i&&s.jsxs("div",{className:"bg-slate-950/80 border border-slate-800 rounded-xl p-2 flex flex-col items-start gap-1 text-xs font-mono",children:[s.jsx("span",{className:"text-[10px] text-slate-400 uppercase font-semibold",children:"Selecionar Moeda:"}),s.jsx("select",{id:"select-coin-triplescreen",value:r.symbol,onChange:re=>i(re.target.value),className:"bg-slate-900 border border-slate-700 text-white rounded px-2 py-1 text-xs font-mono focus:outline-none focus:border-amber-500",children:l.map(re=>s.jsxs("option",{value:re.symbol,children:[re.symbol," (",re.decision," - ",re.confidence,"%)"]},re.symbol))})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-2 sm:p-2.5 text-center min-w-[85px] sm:min-w-[100px]",children:[s.jsx("div",{className:"text-[10px] font-mono text-slate-500 uppercase",children:"Confiança IA"}),s.jsxs("div",{className:`text-lg sm:text-xl font-bold font-mono ${r.confidence>=75?"text-emerald-400":"text-amber-400"}`,children:[r.confidence,"%"]}),s.jsx("div",{className:"text-[9px] font-mono text-slate-400",children:"Meta: ≥ 75%"})]})]})]}),s.jsx("div",{className:"px-4 sm:px-6 pt-3",children:s.jsx(ty,{signal:r,onOpenRiskCalc:()=>c(r)})}),s.jsxs("div",{className:"p-4 sm:p-6 grid grid-cols-1 lg:grid-cols-12 gap-6",children:[s.jsxs("div",{className:"lg:col-span-7 flex flex-col gap-4",children:[s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-2.5 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(yf,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsx("span",{className:"text-xs font-mono font-bold text-white uppercase tracking-wider",children:"Tempos Gráficos (13 Intervalos):"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs("button",{id:"btn-toggle-volume-profile",onClick:()=>L(!j),className:`px-2 py-0.5 rounded text-[11px] font-mono font-medium transition flex items-center gap-1 border ${j?"bg-amber-500/20 text-amber-300 border-amber-500/40":"bg-slate-900 text-slate-400 border-slate-700 hover:text-slate-200"}`,title:"Exibir ou ocultar Volume Profile e POC de Wyckoff no gráfico",children:[s.jsx(go,{className:"w-3 h-3"}),s.jsxs("span",{children:["POC: ",j?"Ativo":"Oculto"]})]})})]}),s.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1 border-t border-slate-800/80",children:Mt.map(re=>s.jsxs("div",{className:"flex items-center gap-1 bg-slate-900/60 p-1 rounded-lg border border-slate-800/80",children:[s.jsxs("span",{className:"text-[9px] font-mono text-slate-500 uppercase px-1 font-bold",children:[re.name,":"]}),re.tfs.map(fe=>{const je=g===fe;return s.jsx("button",{id:`btn-tf-${fe}`,onClick:()=>p(fe),className:`px-2 py-0.5 text-xs font-mono font-medium rounded transition ${je?"bg-amber-500 text-slate-950 font-bold shadow-sm":"text-slate-400 hover:text-white hover:bg-slate-800"}`,title:jr(fe).description,children:fe},fe)})]},re.name))}),s.jsxs("div",{className:"flex items-center justify-between text-[11px] font-mono text-slate-400 pt-0.5",children:[s.jsxs("span",{className:"text-slate-300",children:["Visualizando: ",s.jsx("strong",{className:"text-amber-400",children:ae.fullName})," — ",ae.description]}),s.jsxs("span",{className:"text-slate-500",children:[U.length," candles processados"]})]})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-3 relative select-none overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between text-[11px] font-mono text-slate-400 pb-2 border-b border-slate-800/60 mb-2 overflow-x-auto no-scrollbar",children:[s.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 shrink-0",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-0.5 bg-sky-400"}),"EMA 9"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-0.5 bg-amber-400"}),"EMA 21"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-0.5 bg-purple-400"}),"EMA 50"]}),j&&M&&s.jsxs("span",{className:"flex items-center gap-1 text-amber-400 font-bold bg-amber-500/10 px-1.5 py-0.5 rounded border border-amber-500/30",children:[s.jsx(As,{className:"w-3 h-3"}),"POC: $",(M.pocPrice??0)>=1?(M.pocPrice??0).toFixed(2):(M.pocPrice??0).toFixed(4)]})]}),s.jsx("div",{className:"text-[10px] text-slate-500",children:f?`O:${f.open} H:${f.high} L:${f.low} C:${f.close}`:"Passe o cursor sobre os candles"})]}),s.jsxs("svg",{viewBox:`0 0 ${D} ${Y}`,className:"w-full h-[220px] overflow-visible",children:[[.2,.4,.6,.8].map(re=>{const fe=Y*re,je=oe+(1-re)*_,De=isNaN(je)||!isFinite(je)?0:je;return s.jsxs("g",{children:[s.jsx("line",{x1:0,y1:fe,x2:D,y2:fe,stroke:"#1e293b",strokeDasharray:"3 3"}),s.jsxs("text",{x:D-5,y:fe-3,fill:"#64748b",fontSize:"9",textAnchor:"end",fontFamily:"monospace",children:["$",De.toFixed((r.currentPrice??0)>100?1:3)]})]},re)}),j&&M&&s.jsx("g",{className:"volume-profile-histogram opacity-75",children:M.bins.map(re=>{const fe=ie(re.highPrice),je=ie(re.lowPrice),De=Math.max(2,Math.abs(je-fe)-.5),Ie=Math.max(...M.bins.map(le=>le.totalVolume))||1,jt=re.totalVolume/Ie*135,Ft=D-jt,ut=re.totalVolume>0?re.buyVolume/re.totalVolume:.5,Fe=jt*ut,te=jt-Fe;return s.jsxs("g",{children:[s.jsx("rect",{x:Ft,y:fe,width:Fe,height:De,fill:re.isPOC?"#f59e0b":"#10b981",fillOpacity:re.isPOC?.75:re.isValueArea?.4:.2}),s.jsx("rect",{x:Ft+Fe,y:fe,width:te,height:De,fill:re.isPOC?"#d97706":"#f43f5e",fillOpacity:re.isPOC?.85:re.isValueArea?.4:.2})]},`chart-vp-bin-${re.index}`)})}),s.jsx("path",{d:At(ve),fill:"none",stroke:"#38bdf8",strokeWidth:"1.2",opacity:"0.85"}),s.jsx("path",{d:At(Ae),fill:"none",stroke:"#f59e0b",strokeWidth:"1.4",opacity:"0.85"}),s.jsx("path",{d:At(Re),fill:"none",stroke:"#a855f7",strokeWidth:"1.5",opacity:"0.8"}),U.map((re,fe)=>{const je=fe*me+me/2,Ie=re.close>=re.open?"#10b981":"#f43f5e",jt=ie(re.high),Ft=ie(re.low),ut=ie(re.open),Fe=ie(re.close),te=Math.min(ut,Fe),le=Math.max(2,Math.abs(Fe-ut)),Ze=fe===U.length-1&&w.isExtremeSurge;return s.jsxs("g",{onMouseEnter:()=>N(re),onMouseLeave:()=>N(null),className:"cursor-crosshair group",children:[Ze&&s.jsx("circle",{cx:je,cy:(jt+Ft)/2,r:ee*2.2,fill:"#f43f5e",fillOpacity:"0.2",className:"animate-pulse"}),s.jsx("line",{x1:je,y1:jt,x2:je,y2:Ft,stroke:Ze?"#fb7185":Ie,strokeWidth:Ze?2:1.2}),s.jsx("rect",{x:je-ee/2,y:te,width:ee,height:le,fill:Ze?"#f43f5e":Ie,rx:1,stroke:Ze?"#ffffff":void 0,strokeWidth:Ze?1:0})]},re.timestamp)}),r.passedFilter&&s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:0,y1:ie(r.entryPrice),x2:D,y2:ie(r.entryPrice),stroke:"#38bdf8",strokeWidth:1.5,strokeDasharray:"4 2"}),s.jsx("line",{x1:0,y1:ie(r.stopLoss),x2:D,y2:ie(r.stopLoss),stroke:"#f43f5e",strokeWidth:1.5}),s.jsx("line",{x1:0,y1:ie(r.takeProfit1),x2:D,y2:ie(r.takeProfit1),stroke:"#10b981",strokeWidth:1.5})]}),j&&M&&s.jsxs("g",{className:"volume-profile-key-levels",children:[s.jsx("line",{x1:0,y1:ie(M.vahPrice),x2:D-90,y2:ie(M.vahPrice),stroke:"#38bdf8",strokeWidth:1.2,strokeDasharray:"4 2",opacity:.8}),s.jsxs("text",{x:D-95,y:ie(M.vahPrice)-3,fill:"#38bdf8",fontSize:"8",textAnchor:"end",fontFamily:"monospace",children:["VAH (70%): $",(M.vahPrice??0)>=1?(M.vahPrice??0).toFixed(2):(M.vahPrice??0).toFixed(4)]}),s.jsx("line",{x1:0,y1:ie(M.valPrice),x2:D-90,y2:ie(M.valPrice),stroke:"#10b981",strokeWidth:1.2,strokeDasharray:"4 2",opacity:.8}),s.jsxs("text",{x:D-95,y:ie(M.valPrice)+9,fill:"#10b981",fontSize:"8",textAnchor:"end",fontFamily:"monospace",children:["VAL (70%): $",(M.valPrice??0)>=1?(M.valPrice??0).toFixed(2):(M.valPrice??0).toFixed(4)]}),s.jsx("line",{x1:0,y1:ie(M.pocPrice),x2:D,y2:ie(M.pocPrice),stroke:"#f59e0b",strokeWidth:1.8}),s.jsx("rect",{x:D-112,y:ie(M.pocPrice)-8,width:108,height:16,rx:3,fill:"#f59e0b"}),s.jsxs("text",{x:D-58,y:ie(M.pocPrice)+4,fill:"#020617",fontSize:"9",fontWeight:"bold",textAnchor:"middle",fontFamily:"monospace",children:["POC: $",(M.pocPrice??0)>=1?(M.pocPrice??0).toFixed(2):(M.pocPrice??0).toFixed(4)]})]})]}),s.jsxs("div",{className:"mt-3 p-2.5 bg-slate-900 border border-slate-800 rounded-lg text-xs font-mono flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("div",{className:"text-slate-300",children:["Intervalo: ",s.jsx("strong",{className:"text-amber-400",children:ae.fullName})," (",ae.category,")"]}),s.jsxs("div",{className:"text-slate-400 flex items-center gap-2 sm:gap-3 flex-wrap",children:[s.jsxs("span",{children:["RSI(14): ",s.jsx("strong",{className:"text-sky-300",children:K.rsiCurrent})]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Estocástico: ",s.jsxs("strong",{className:"text-amber-300",children:[K.stochKCurrent," / ",K.stochDCurrent]})]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["MACD Hist: ",s.jsx("strong",{className:K.macd.histogram>=0?"text-emerald-400":"text-rose-400",children:K.macd.histogram>0?`+${K.macd.histogram}`:K.macd.histogram})]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Volatilidade 14p: ",s.jsxs("strong",{className:w.isExtremeSurge?"text-rose-400":"text-emerald-400",children:["+",w.zScore,"σ"]})]})]})]})]}),s.jsx(Wv,{divergence:K,symbol:r.symbol,timeframe:g}),s.jsx(ey,{signal:r,onOpenRiskCalc:c,onRefreshPrices:h}),s.jsx(Bv,{vpData:M,symbol:r.symbol,timeframeName:ae.fullName,currentPrice:r.currentPrice})]}),s.jsxs("div",{className:"lg:col-span-5 flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("h3",{className:"text-sm font-bold text-white flex items-center gap-1.5",children:[s.jsx(ls,{className:"w-4 h-4 text-amber-400"}),"Os Quatro Pilares de Confluência"]}),s.jsxs("span",{className:"text-xs font-mono text-emerald-400 font-semibold bg-emerald-500/10 px-2 py-0.5 rounded border border-emerald-500/30",children:["Confluência: ",r.fourPillars.confluenceAverage,"%"]})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-3 text-xs",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsxs("span",{className:"font-semibold text-slate-200 flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-sky-400"}),"A. Análise Técnica & Médias"]}),s.jsxs("span",{className:"font-mono text-xs text-sky-400 font-bold",children:[r.fourPillars.classicTA.score,"%"]})]}),s.jsxs("div",{className:"text-slate-400 text-[11px] leading-relaxed",children:["Alinhamento: ",s.jsx("strong",{className:"text-slate-200",children:r.fourPillars.classicTA.emaAlignment}),". Padrão MTF: ",s.jsx("strong",{className:"text-slate-200",children:r.fourPillars.classicTA.patternDetected}),". ",r.fourPillars.classicTA.rsiInterpretation,"."]})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-3 text-xs",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsxs("span",{className:"font-semibold text-slate-200 flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400"}),"B. Smart Money Concepts (SMC) & Liquidez"]}),s.jsxs("span",{className:"font-mono text-xs text-amber-400 font-bold",children:[r.fourPillars.smc.score,"%"]})]}),s.jsxs("div",{className:"text-slate-400 text-[11px] leading-relaxed",children:["Sweep: ",s.jsx("strong",{className:"text-amber-300",children:r.fourPillars.smc.liquiditySweep.type}),". Imbalance FVG: ",s.jsx("strong",{className:"text-slate-200",children:r.fourPillars.smc.imbalanceFVG.zone}),". Order Block: ",s.jsx("strong",{className:"text-slate-200",children:r.fourPillars.smc.orderBlock.zone}),"."]})]}),s.jsxs("div",{id:"wyckoff-regime-card",className:"bg-slate-950 border border-slate-800 rounded-xl p-3 text-xs",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("span",{className:"font-semibold text-slate-200 flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-purple-400"}),"C. Teoria de Wyckoff, VSA & Volume Profile"]}),s.jsxs("span",{className:"font-mono text-xs text-purple-400 font-bold",children:[r.fourPillars.wyckoff.score,"%"]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 p-1.5 bg-slate-900/90 rounded-lg border border-purple-500/20 mb-2 font-mono",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-[10px] text-slate-400 uppercase",children:"Ativo Analisado:"}),s.jsx("span",{className:"text-white font-bold text-xs bg-purple-500/20 text-purple-200 px-2 py-0.5 rounded border border-purple-500/40",children:r.symbol}),s.jsxs("span",{className:"text-[10px] text-slate-400 hidden sm:inline",children:["(",r.name,")"]})]}),s.jsxs("div",{className:"flex items-center bg-slate-950 p-0.5 rounded-md border border-slate-800 text-[10px]",children:[s.jsx("button",{id:"btn-wyckoff-perspective-macro",onClick:()=>X("MACRO"),className:`px-2 py-0.5 rounded font-bold transition flex items-center gap-1 ${S==="MACRO"?"bg-purple-600 text-white shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Visão Macro: Gráficos Diário (1D) e 4 Horas (4H)",children:s.jsx("span",{children:"🌐 Macro (1D/4H)"})}),s.jsx("button",{id:"btn-wyckoff-perspective-micro",onClick:()=>X("MICRO"),className:`px-2 py-0.5 rounded font-bold transition flex items-center gap-1 ${S==="MICRO"?"bg-purple-600 text-white shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Visão Micro: Gráficos de 15 Minutos (15m) e 1 Hora (1H)",children:s.jsx("span",{children:"⚡ Micro (15m/1H)"})})]})]}),S==="MACRO"?s.jsxs("div",{className:"space-y-1 text-slate-400 text-[11px] leading-relaxed",children:[s.jsxs("div",{children:["Ciclo Macro (1D/4H): ",s.jsx("strong",{className:"text-purple-300",children:r.fourPillars.wyckoff.currentPhase}),"."]}),s.jsxs("div",{children:["Esforço vs Resultado: ",s.jsx("strong",{className:"text-slate-200",children:r.fourPillars.wyckoff.effortVsResult}),"."]}),s.jsx("div",{className:"text-[10px] text-slate-400",children:"Estrutura institucional dominante mapeada com absorção em ranges consolidados pluridividuais."})]}):s.jsxs("div",{className:"space-y-1 text-slate-400 text-[11px] leading-relaxed",children:[s.jsxs("div",{children:["Ciclo Micro (15m/1H): ",s.jsx("strong",{className:"text-purple-300",children:r.decision==="COMPRA"?"Fase C (Spring / Shakeout Intraday): Varredura rápida de liquidez no Order Block em 15m":r.decision==="VENDA"?"Fase C (UTAD / Upthrust Intraday): Rejeição violenta na resistência em 15m":"Fase B (Construção de Causa): Consolidação e teste de oferta local"}),"."]}),s.jsxs("div",{children:["Volume de Agressão Micro: ",s.jsx("strong",{className:"text-slate-200",children:r.decision==="COMPRA"?"Exaustão vendedora na mínima com absorção passiva no book":"Exaustão compradora na máxima com pressão de venda imediata"}),"."]}),s.jsxs("div",{className:"text-[10px] text-slate-400",children:["Gatilho de entrada sincronizado com teste de volume relativo (RVOL ",(((rs=(qt=r.fourPillars)==null?void 0:qt.wyckoff)==null?void 0:rs.volumeRatio)??1.35).toFixed(2),"x)."]})]}),M&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-slate-800/80 flex items-center justify-between text-[10px] font-mono",children:[s.jsxs("span",{className:"text-amber-400 font-bold flex items-center gap-1",children:[s.jsx(As,{className:"w-3 h-3"})," POC ",S,": $",(M.pocPrice??0)>=1?(M.pocPrice??0).toFixed(2):(M.pocPrice??0).toFixed(4)]}),s.jsx("span",{className:`font-semibold ${((ht=M.currentPriceStatus)==null?void 0:ht.color)??"text-slate-300"}`,children:((Lt=M.currentPriceStatus)==null?void 0:Lt.label)??"Neutro"})]})]}),s.jsxs("div",{id:"sentiment-futures-card",className:"bg-slate-950 border border-slate-800 rounded-xl p-3 text-xs",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("span",{className:"font-semibold text-slate-200 flex items-center gap-1.5",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400"}),"D. Sentimento Futuros (OI & Funding)"]}),s.jsxs("span",{className:"font-mono text-xs text-emerald-400 font-bold",children:[((Cs=(is=r.fourPillars)==null?void 0:is.sentiment)==null?void 0:Cs.score)??80,"%"]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2 p-1.5 bg-slate-900/90 rounded-lg border border-emerald-500/20 mb-2 font-mono",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-[10px] text-slate-400 uppercase",children:"Ativo Analisado:"}),s.jsx("span",{className:"text-white font-bold text-xs bg-emerald-500/20 text-emerald-200 px-2 py-0.5 rounded border border-emerald-500/40",children:r.symbol}),s.jsxs("span",{className:"text-[10px] text-slate-400 hidden sm:inline",children:["(",r.name,")"]})]}),s.jsxs("div",{className:"flex items-center bg-slate-950 p-0.5 rounded-md border border-slate-800 text-[10px]",children:[s.jsx("button",{id:"btn-sentiment-perspective-macro",onClick:()=>k("MACRO"),className:`px-2 py-0.5 rounded font-bold transition flex items-center gap-1 ${v==="MACRO"?"bg-emerald-600 text-white shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Visão Macro: Posições de Longo Prazo, Taxa de Financiamento 8h/24h e OI Diário",children:s.jsx("span",{children:"🌐 Macro (1D/4H)"})}),s.jsx("button",{id:"btn-sentiment-perspective-micro",onClick:()=>k("MICRO"),className:`px-2 py-0.5 rounded font-bold transition flex items-center gap-1 ${v==="MICRO"?"bg-emerald-600 text-white shadow-xs":"text-slate-400 hover:text-slate-200"}`,title:"Visão Micro: Fluxo Intraday (15m/1H), Delta de Agressão Imediato e Risco de Cascata",children:s.jsx("span",{children:"⚡ Micro (15m/1H)"})})]})]}),v==="MACRO"?s.jsxs("div",{className:"space-y-1 text-slate-400 text-[11px] leading-relaxed",children:[s.jsxs("div",{children:["Funding Rate 24h Ponderado: ",s.jsxs("strong",{className:"text-emerald-300",children:[((((Pt=(Tt=r.fourPillars)==null?void 0:Tt.sentiment)==null?void 0:Pt.fundingRate)??1e-4)*100).toFixed(3),"% (",((Nt=(os=r.fourPillars)==null?void 0:os.sentiment)==null?void 0:Nt.fundingSentiment)??"Neutro",")"]}),"."]}),s.jsxs("div",{children:["OI Delta 24h: ",s.jsxs("strong",{className:"text-slate-200",children:[((ps=(_s=r.fourPillars)==null?void 0:_s.sentiment)==null?void 0:ps.oi24hChange)??0,"%"]}),". Long/Short Global: ",s.jsx("strong",{className:"text-slate-200",children:((Os=(We=r.fourPillars)==null?void 0:We.sentiment)==null?void 0:Os.longShortRatio)??1.2}),"."]}),s.jsx("div",{className:"text-[10px] text-slate-400",children:"Alavancagem macro sustentável sem excesso de posições especulativas contra a tendência primária."})]}):s.jsxs("div",{className:"space-y-1 text-slate-400 text-[11px] leading-relaxed",children:[s.jsxs("div",{children:["Delta de Agressão Micro (15m/1H): ",s.jsx("strong",{className:"text-emerald-300",children:r.decision==="COMPRA"?"+58.4% Comprador (Absorção no Ask)":"-62.1% Vendedor (Agressão no Bid)"}),"."]}),s.jsxs("div",{children:["Fluxo de Liquidação Instantâneo: ",s.jsx("strong",{className:"text-slate-200",children:r.decision==="COMPRA"?"Stop hunts de posições vendidas em andamento":"Longs alavancados sob pressão de liquidação"}),"."]}),s.jsx("div",{className:"text-[10px] text-slate-400",children:"Funding Spot-Futuros instantâneo favorável para execução sem slippage severo."})]})]}),s.jsxs("div",{className:"bg-slate-950 border border-amber-500/30 rounded-xl p-4 relative overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("span",{className:"text-xs font-bold text-amber-400 flex items-center gap-1.5",children:[s.jsx(wf,{className:"w-4 h-4 text-amber-400"}),"Tese do Agente Institucional IA"]}),s.jsxs("button",{id:"btn-refresh-gemini-ai",onClick:()=>d(r.symbol),disabled:m,className:"px-2 py-0.5 text-[10px] font-medium bg-amber-500/10 hover:bg-amber-500/20 text-amber-300 border border-amber-500/30 rounded flex items-center gap-1 transition disabled:opacity-50",title:"Consultar modelo Gemini 3.8 Flash no backend para validação institucional",children:[s.jsx(Rr,{className:`w-3 h-3 ${m?"animate-spin":""}`}),s.jsx("span",{children:m?"Processando IA...":"Recalcular via IA"})]})]}),s.jsxs("div",{className:"text-xs text-slate-300 leading-relaxed font-sans mb-3",children:['"',r.aiThesis.summary,'"']}),s.jsxs("div",{className:"space-y-2 text-[11px] border-t border-slate-800/80 pt-2 text-slate-400",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-amber-400 font-semibold font-mono",children:"Contexto Institucional: "}),r.aiThesis.institutionalContext]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sky-400 font-semibold font-mono",children:"Gatilho Primário: "}),r.aiThesis.primaryCatalyst]}),s.jsxs("div",{className:"flex items-start gap-1 text-rose-400/90",children:[s.jsx(xl,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),s.jsx("span",{children:r.aiThesis.riskWarning})]})]}),s.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-800/80 flex items-center justify-between text-[10px] font-mono text-slate-500",children:[s.jsxs("span",{children:["Motor: ",r.aiThesis.source]}),s.jsxs("span",{className:"font-bold text-amber-400",children:["Veredito: ",r.aiThesis.verdict]})]})]})]})]}),s.jsx(Jv,{isOpen:z,onClose:()=>H(!1),symbol:r.symbol,timeframe:g,stats:w,isAlertEnabled:R,onToggleAlertEnabled:se,onSnoozeSymbol:ne})]})},sy=[{days:30,label:"30 Dias",sub:"1 Mês"},{days:60,label:"60 Dias",sub:"2 Meses"},{days:90,label:"90 Dias",sub:"Trimestre"},{days:180,label:"180 Dias",sub:"Semestre"},{days:365,label:"365 Dias",sub:"1 Ano"},{days:730,label:"730 Dias",sub:"2 Anos"}],ay=({backtest:r,duration:l,onChangeDuration:i,isLoading:c=!1,onExportCSV:d})=>{const[m,h]=$.useState("ALL"),[g,p]=$.useState("ALL"),[f,N]=$.useState("ALL"),[j,L]=$.useState(""),[R,E]=$.useState(null),[z,H]=$.useState(1),[q,I]=$.useState(25),[T,y]=$.useState(null),S=$.useMemo(()=>r?r.trades.filter(D=>!(m!=="ALL"&&D.status!==m||g!=="ALL"&&D.direction!==g||f!=="ALL"&&D.topPillar!==f||j&&!D.symbol.toLowerCase().includes(j.toLowerCase()))):[],[r,m,g,f,j]);ol.useEffect(()=>{H(1)},[m,g,f,j,l,q]);const X=Math.max(1,Math.ceil(S.length/q)),v=(z-1)*q,k=S.slice(v,v+q),se=()=>{if(!r||r.trades.length===0)return;const D=`ID,Data,Ativo,Direção,Entrada,Stop Loss,Alvo TP,R/R,Confiança (%),Pilar Chave,Resultado PnL (%),Status,Barras `,ee=r.trades.map(Ae=>`"${Ae.id}","${Ae.date}","${Ae.symbol}","${Ae.direction}",${Ae.entryPrice},${Ae.stopLoss},${Ae.takeProfit},1:${Ae.rrRatio},${Ae.confidence},"${Ae.topPillar}",${Ae.pnlPercent},"${Ae.status}",${Ae.holdingBars}`).join(` `),me=new Blob([D+ee],{type:"text/csv;charset=utf-8;"}),ie=URL.createObjectURL(me),ve=document.createElement("a");ve.href=ie,ve.setAttribute("download",`God_Protocol_Backtest_${l}Dias_${Date.now()}.csv`),document.body.appendChild(ve),ve.click(),document.body.removeChild(ve)};if(!r)return s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-12 text-center text-slate-400 font-mono",children:[s.jsx("div",{className:"animate-spin w-8 h-8 border-2 border-amber-400 border-t-transparent rounded-full mx-auto mb-3"}),"Carregando simulação quantitativa e histórico de backtesting diário..."]});const ne=r.equityCurve,U=ne.map(D=>D.equity),ae=Math.min(...U)*.98,C=Math.max(...U)*1.02-ae||1,K=750,w=180,M=D=>D/(ne.length-1||1)*K,W=D=>w-(D-ae)/C*w,oe=ne.map((D,ee)=>`${M(ee)},${W(D.equity)}`).join(" L "),be=`M 0,${w} L ${oe} L ${K},${w} Z`,_=S.filter(D=>D.status==="TP ATINGIDO").length,Y=S.length>0?(_/S.length*100).toFixed(1):"0.0";return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"bg-gradient-to-r from-slate-900 via-slate-900 to-amber-950/30 border border-amber-500/20 rounded-xl p-4 sm:p-5 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("h2",{className:"text-base sm:text-lg font-bold text-white flex items-center gap-2 font-mono",children:[s.jsx(Zd,{className:"w-5 h-5 text-amber-400"}),s.jsx("span",{children:"Backtesting Institucional Automatizado"})]}),s.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 font-semibold",children:"R/R Mínimo 1:2 & Confiança ≥ 75%"})]}),s.jsx("p",{className:"text-xs text-slate-400 mt-1 max-w-2xl leading-relaxed",children:"Simulação contínua com gestão de risco ATR (1.5x), saídas em TP1 (1:2) e TP2 (1:3) e confluência dos 4 Pilares nas top 100 moedas globais."}),r.startDate&&r.endDate&&s.jsxs("div",{className:"flex items-center gap-2 mt-2 text-xs font-mono text-amber-300",children:[s.jsx(gl,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{children:["Período Avaliado: ",s.jsx("strong",{children:r.startDate})," até ",s.jsx("strong",{children:r.endDate})," (",r.periodDays||l," Dias de Histórico)"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("button",{id:"btn-download-backtest-trades-csv",onClick:se,className:"px-3.5 py-2 bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-semibold rounded-lg border border-slate-700 transition flex items-center gap-2 shadow-sm",title:"Baixar planilha CSV com todos os trades do período selecionado",children:[s.jsx(al,{className:"w-4 h-4 text-emerald-400"}),s.jsxs("span",{children:["Baixar CSV (",r.trades.length," Trades)"]})]}),s.jsx("button",{id:"btn-export-backtest-full",onClick:d,className:"px-3.5 py-2 bg-amber-500 hover:bg-amber-400 text-slate-950 text-xs font-bold rounded-lg transition flex items-center gap-2 shadow-sm",title:"Abrir Central de Exportação (Google Sheets / Drive / PDF)",children:s.jsx("span",{children:"Central de Relatórios"})})]})]}),s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-3.5 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 shadow-inner",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-slate-300",children:[s.jsx(o1,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"font-bold text-white uppercase tracking-wider text-[11px]",children:"Janela Temporal do Backtest:"}),c&&s.jsx("span",{className:"text-amber-400 animate-pulse text-[11px]",children:"(Recalculando simulação...)"})]}),s.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:sy.map(D=>{const ee=l===D.days;return s.jsxs("button",{id:`btn-duration-${D.days}`,onClick:()=>i(D.days),disabled:c,className:`px-3 py-1.5 rounded-lg text-xs font-mono font-medium transition flex items-center gap-1.5 ${ee?"bg-amber-500 text-slate-950 font-bold shadow-sm":"bg-slate-950 hover:bg-slate-800 text-slate-300 border border-slate-800"} disabled:opacity-50`,children:[s.jsx("span",{children:D.label}),s.jsxs("span",{className:`text-[10px] opacity-75 ${ee?"text-slate-950":"text-slate-400"}`,children:["(",D.sub,")"]})]},D.days)})})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:[s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-3.5",children:[s.jsxs("div",{className:"text-slate-400 text-xs font-medium flex items-center justify-between",children:[s.jsx("span",{children:"Taxa de Acerto"}),s.jsx(As,{className:"w-4 h-4 text-emerald-400"})]}),s.jsxs("div",{className:"text-2xl font-bold font-mono text-emerald-400 mt-1",children:[r.winRate,"%"]}),s.jsxs("div",{className:"text-[11px] text-slate-500 mt-1 font-mono",children:[r.winningTrades,"W / ",r.losingTrades,"L (",r.totalTrades," total)"]})]}),s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-3.5",children:[s.jsxs("div",{className:"text-slate-400 text-xs font-medium flex items-center justify-between",children:[s.jsx("span",{children:"Fator de Lucro"}),s.jsx(Ts,{className:"w-4 h-4 text-sky-400"})]}),s.jsxs("div",{className:"text-2xl font-bold font-mono text-sky-300 mt-1",children:[r.profitFactor,"x"]}),s.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"Ganho Bruto / Perda"})]}),s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-3.5",children:[s.jsxs("div",{className:"text-slate-400 text-xs font-medium flex items-center justify-between",children:[s.jsx("span",{children:"Retorno Líquido"}),s.jsx(ev,{className:"w-4 h-4 text-emerald-400"})]}),s.jsxs("div",{className:"text-2xl font-bold font-mono text-emerald-300 mt-1",children:["+",r.netProfitPercent,"%"]}),s.jsxs("div",{className:"text-[11px] text-slate-500 mt-1 font-mono",children:["$",r.initialCapital.toLocaleString()," → $",r.finalCapital.toLocaleString()]})]}),s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-3.5",children:[s.jsxs("div",{className:"text-slate-400 text-xs font-medium flex items-center justify-between",children:[s.jsx("span",{children:"Max Drawdown"}),s.jsx(ul,{className:"w-4 h-4 text-amber-400"})]}),s.jsxs("div",{className:"text-2xl font-bold font-mono text-amber-400 mt-1",children:[r.maxDrawdownPercent,"%"]}),s.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"Controle de Risco Rigoroso"})]}),s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-3.5",children:[s.jsxs("div",{className:"text-slate-400 text-xs font-medium flex items-center justify-between",children:[s.jsx("span",{children:"Sharpe Ratio"}),s.jsx(Zd,{className:"w-4 h-4 text-purple-400"})]}),s.jsx("div",{className:"text-2xl font-bold font-mono text-purple-300 mt-1",children:r.sharpeRatio}),s.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"Eficiência Risco-Retorno"})]}),s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-3.5",children:[s.jsxs("div",{className:"text-slate-400 text-xs font-medium flex items-center justify-between",children:[s.jsx("span",{children:"Risco:Retorno Médio"}),s.jsx(ls,{className:"w-4 h-4 text-amber-400"})]}),s.jsxs("div",{className:"text-2xl font-bold font-mono text-amber-300 mt-1",children:["1:",r.averageRR]}),s.jsx("div",{className:"text-[11px] text-slate-500 mt-1",children:"Mínimo 1:2 exigido"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6",children:[s.jsxs("div",{className:"lg:col-span-8 bg-slate-900 border border-slate-800 rounded-xl p-4",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-3 gap-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-bold text-white flex items-center gap-1.5 font-mono",children:s.jsxs("span",{children:["Curva de Capital Acumulada (Equity Curve - ",l," Dias)"]})}),s.jsx("p",{className:"text-xs text-slate-400",children:"Evolução do portfólio simulado com risco fixo de 1% por trade no período."})]}),R&&s.jsxs("div",{className:"text-xs font-mono bg-slate-950 px-2.5 py-1 rounded border border-slate-800 text-slate-300 self-start sm:self-auto",children:[R.date," • Equity: ",s.jsxs("strong",{className:"text-emerald-400",children:["$",R.equity.toLocaleString()]})," (",R.tradePnl>=0?`+${R.tradePnl}%`:`${R.tradePnl}%`,")"]})]}),s.jsx("div",{className:"bg-slate-950 border border-slate-800 rounded-lg p-3 relative",children:s.jsxs("svg",{viewBox:`0 0 ${K} ${w}`,className:"w-full h-[180px] overflow-visible",children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"equityGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0%",stopColor:"#10b981",stopOpacity:"0.25"}),s.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.0"})]})}),[.25,.5,.75].map(D=>{const ee=w*D,me=ae+(1-D)*C;return s.jsxs("g",{children:[s.jsx("line",{x1:0,y1:ee,x2:K,y2:ee,stroke:"#1e293b",strokeDasharray:"3 3"}),s.jsxs("text",{x:K-5,y:ee-3,fill:"#64748b",fontSize:"9",textAnchor:"end",fontFamily:"monospace",children:["$",me.toFixed(0)]})]},D)}),s.jsx("path",{d:be,fill:"url(#equityGrad)"}),s.jsx("path",{d:`M ${oe}`,fill:"none",stroke:"#10b981",strokeWidth:2}),ne.map((D,ee)=>{const me=M(ee),ie=W(D.equity);return ne.length<=65||ee%Math.ceil(ne.length/50)===0||ee===ne.length-1?s.jsx("circle",{cx:me,cy:ie,r:3,fill:"#10b981",className:"hover:r-5 cursor-pointer transition-all",onMouseEnter:()=>E(D),onMouseLeave:()=>E(null)},`${D.date}-${ee}`):null})]})})]}),s.jsxs("div",{className:"lg:col-span-4 bg-slate-900 border border-slate-800 rounded-xl p-4 flex flex-col justify-between",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[s.jsxs("h3",{className:"text-sm font-bold text-white flex items-center gap-1.5 font-mono",children:[s.jsx(ls,{className:"w-4 h-4 text-amber-400"}),"Assertividade por Pilar (",l," Dias)"]}),s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 text-[10px] font-mono font-bold",children:"AUDITADO"})]}),s.jsx("p",{className:"text-xs text-slate-400 mb-4",children:"Taxa de acerto real quando o setup teve confluência primária no pilar:"}),s.jsxs("div",{className:"space-y-3.5 text-xs",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between text-slate-300 font-mono mb-1",children:[s.jsx("span",{children:"A. Análise Técnica & Médias"}),s.jsxs("span",{className:"text-sky-400 font-bold",children:[r.pillarWinRates.classicTA,"% de Acerto"]})]}),s.jsx("div",{className:"w-full bg-slate-950 rounded-full h-2 overflow-hidden border border-slate-800",children:s.jsx("div",{className:"bg-sky-400 h-full rounded-full",style:{width:`${r.pillarWinRates.classicTA}%`}})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between text-slate-300 font-mono mb-1",children:[s.jsx("span",{children:"B. SMC & Liquidez (Sweeps)"}),s.jsxs("span",{className:"text-amber-400 font-bold",children:[r.pillarWinRates.smc,"% de Acerto"]})]}),s.jsx("div",{className:"w-full bg-slate-950 rounded-full h-2 overflow-hidden border border-slate-800",children:s.jsx("div",{className:"bg-amber-400 h-full rounded-full",style:{width:`${r.pillarWinRates.smc}%`}})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between text-slate-300 font-mono mb-1",children:[s.jsx("span",{children:"C. Teoria de Wyckoff (VSA)"}),s.jsxs("span",{className:"text-purple-400 font-bold",children:[r.pillarWinRates.wyckoff,"% de Acerto"]})]}),s.jsx("div",{className:"w-full bg-slate-950 rounded-full h-2 overflow-hidden border border-slate-800",children:s.jsx("div",{className:"bg-purple-400 h-full rounded-full",style:{width:`${r.pillarWinRates.wyckoff}%`}})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between text-slate-300 font-mono mb-1",children:[s.jsx("span",{children:"D. Sentimento Futuros (OI/Funding)"}),s.jsxs("span",{className:"text-emerald-400 font-bold",children:[r.pillarWinRates.sentiment,"% de Acerto"]})]}),s.jsx("div",{className:"w-full bg-slate-950 rounded-full h-2 overflow-hidden border border-slate-800",children:s.jsx("div",{className:"bg-emerald-400 h-full rounded-full",style:{width:`${r.pillarWinRates.sentiment}%`}})})]})]})]}),s.jsxs("div",{className:"p-2.5 bg-slate-950 border border-emerald-500/20 rounded-lg text-[11px] text-slate-300 mt-4 leading-relaxed font-mono",children:[s.jsxs("div",{className:"flex items-center gap-1 text-emerald-400 font-bold mb-0.5",children:[s.jsx(ul,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Auditoria de Não-Divergência:"})]}),s.jsxs("span",{children:["Todos os ",r.totalTrades," trades reconciliados (",r.winningTrades," vitórias / ",r.losingTrades," derrotas). Zero discrepância de cálculo entre histórico e indicadores de resumo."]})]})]})]}),s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl overflow-hidden shadow-sm",children:[s.jsxs("div",{className:"p-4 border-b border-slate-800 flex flex-col md:flex-row md:items-center md:justify-between gap-3",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-sm font-bold text-white font-mono flex items-center gap-2",children:[s.jsx("span",{children:"Registro Detalhado de Operações Executadas"}),s.jsxs("span",{className:"text-xs font-normal text-slate-300 bg-slate-800 px-2 py-0.5 rounded-full",children:[S.length," de ",r.trades.length," trades"]})]}),s.jsxs("p",{className:"text-xs text-slate-400 mt-0.5",children:["Acertos no filtro atual: ",s.jsxs("strong",{className:"text-emerald-400",children:[Y,"%"]})," (",_," vitórias)"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative min-w-[120px]",children:[s.jsx(Sf,{className:"w-3 h-3 absolute left-2.5 top-1/2 -translate-y-1/2 text-slate-500"}),s.jsx("input",{type:"text",placeholder:"Buscar par...",value:j,onChange:D=>L(D.target.value),className:"w-full bg-slate-950 border border-slate-800 rounded-lg pl-7 pr-2 py-1 text-xs text-slate-200 placeholder-slate-500 focus:outline-none"})]}),s.jsxs("select",{value:m,onChange:D=>h(D.target.value),className:"bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1 text-xs text-slate-300 focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"ALL",children:"Status: Todos"}),s.jsx("option",{value:"TP ATINGIDO",children:"Apenas TP Atingido"}),s.jsx("option",{value:"SL ATINGIDO",children:"Apenas SL Atingido"})]}),s.jsxs("select",{value:g,onChange:D=>p(D.target.value),className:"bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1 text-xs text-slate-300 focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"ALL",children:"Direção: Todas"}),s.jsx("option",{value:"LONG",children:"Apenas LONG"}),s.jsx("option",{value:"SHORT",children:"Apenas SHORT"})]}),s.jsxs("select",{value:f,onChange:D=>N(D.target.value),className:"bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1 text-xs text-slate-300 focus:outline-none cursor-pointer",children:[s.jsx("option",{value:"ALL",children:"Pilar: Todos"}),s.jsx("option",{value:"Clássica",children:"Técnica Clássica"}),s.jsx("option",{value:"SMC",children:"SMC & Liquidez"}),s.jsx("option",{value:"Wyckoff",children:"Wyckoff VSA"}),s.jsx("option",{value:"Sentimento",children:"Sentimento Futuros"})]}),s.jsxs("select",{value:q,onChange:D=>I(Number(D.target.value)),className:"bg-slate-950 border border-slate-800 rounded-lg px-2 py-1 text-xs text-amber-300 focus:outline-none font-mono cursor-pointer",title:"Quantidade de trades por página",children:[s.jsx("option",{value:15,children:"15 / pág"}),s.jsx("option",{value:25,children:"25 / pág"}),s.jsx("option",{value:50,children:"50 / pág"}),s.jsx("option",{value:100,children:"100 / pág"})]})]})]}),S.length===0?s.jsxs("div",{className:"p-8 text-center text-slate-500 text-xs font-mono",children:["Nenhum trade encontrado para os filtros selecionados.",s.jsx("button",{onClick:()=>{h("ALL"),p("ALL"),N("ALL"),L("")},className:"block mx-auto mt-2 text-amber-400 hover:underline",children:"Redefinir filtros"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"block md:hidden p-3 space-y-2.5",children:k.map(D=>{const ee=D.status==="TP ATINGIDO";return s.jsxs("div",{className:"p-3 bg-slate-950/60 border border-slate-800/80 rounded-lg text-xs font-mono flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-bold text-white text-sm",children:D.symbol}),s.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold ${D.direction==="LONG"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/30":"bg-rose-500/10 text-rose-400 border border-rose-500/30"}`,children:D.direction}),D.hitTargetLabel&&ee&&s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/15 border border-amber-500/30 text-amber-300 text-[10px] font-bold",children:D.hitTargetLabel.split(" ")[0]})]}),s.jsxs("span",{className:`inline-flex items-center gap-1 font-bold ${ee?"text-emerald-400":"text-rose-400"}`,children:[ee?s.jsx(aa,{className:"w-3.5 h-3.5"}):s.jsx(Ha,{className:"w-3.5 h-3.5"}),ee?`+${D.pnlPercent}%`:`${D.pnlPercent}%`]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-1 py-1.5 px-2 bg-slate-900/80 rounded border border-slate-800/60 text-[11px]",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-slate-500 block text-[9px] uppercase",children:"Entrada"}),s.jsxs("span",{className:"text-slate-300 font-semibold",children:["$",D.entryPrice]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-slate-500 block text-[9px] uppercase",children:"Stop Loss"}),s.jsxs("span",{className:"text-rose-400 font-semibold",children:["$",D.stopLoss]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-slate-500 block text-[9px] uppercase",children:"Alvo Conquistado"}),s.jsxs("span",{className:"text-emerald-400 font-semibold",children:["$",D.exitPrice||D.takeProfit]})]})]}),s.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400 pt-1 border-t border-slate-800/60",children:[s.jsxs("span",{children:["Data: ",D.date]}),s.jsxs("button",{onClick:()=>y(D),className:"text-amber-400 hover:text-amber-300 flex items-center gap-1 text-[10px] font-bold underline",children:[s.jsx(ls,{className:"w-3 h-3"}),s.jsx("span",{children:"Ver 5 Alvos Fibo"})]})]})]},`mobile-trade-${D.id}`)})}),s.jsx("div",{className:"hidden md:block overflow-x-auto no-scrollbar",children:s.jsxs("table",{className:"w-full text-left border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-800 bg-slate-950/40 text-[11px] font-mono uppercase text-slate-400",children:[s.jsx("th",{className:"py-2.5 px-4 whitespace-nowrap",children:"Data / Hora (BRT)"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Ativo"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Direção"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Entrada"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Stop Loss"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Alvos Fibonacci"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"R/R"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Confiança"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Pilar Chave"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Status"}),s.jsx("th",{className:"py-2.5 px-4 text-right whitespace-nowrap",children:"Resultado PnL"})]})}),s.jsx("tbody",{className:"divide-y divide-slate-800/60 text-xs font-mono",children:k.map(D=>{const ee=D.status==="TP ATINGIDO";return s.jsxs("tr",{className:"hover:bg-slate-800/30 transition",children:[s.jsx("td",{className:"py-2.5 px-4 text-slate-400 whitespace-nowrap",children:D.date}),s.jsx("td",{className:"py-2.5 px-3 font-bold text-white whitespace-nowrap",children:D.symbol}),s.jsx("td",{className:"py-2.5 px-3 whitespace-nowrap",children:s.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold ${D.direction==="LONG"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/30":"bg-rose-500/10 text-rose-400 border border-rose-500/30"}`,children:D.direction})}),s.jsxs("td",{className:"py-2.5 px-3 text-slate-300 whitespace-nowrap",children:["$",D.entryPrice]}),s.jsxs("td",{className:"py-2.5 px-3 text-rose-400 whitespace-nowrap",children:["$",D.stopLoss]}),s.jsx("td",{className:"py-2.5 px-3 whitespace-nowrap",children:s.jsxs("button",{onClick:()=>y(D),className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-slate-800/80 hover:bg-slate-700/80 border border-slate-700/80 text-amber-300 text-[11px] transition",title:"Clique para ver os 5 alvos de Fibonacci calculados para este trade",children:[s.jsx(ls,{className:"w-3 h-3 text-amber-400"}),s.jsxs("span",{children:[D.hitTargetLabel?D.hitTargetLabel.split(" ")[0]:"TP1"," ($",D.exitPrice||D.takeProfit,")"]})]})}),s.jsxs("td",{className:"py-2.5 px-3 text-slate-300 whitespace-nowrap",children:["1:",D.rrRatio]}),s.jsxs("td",{className:"py-2.5 px-3 text-amber-400 whitespace-nowrap",children:[D.confidence,"%"]}),s.jsx("td",{className:"py-2.5 px-3 text-slate-400 whitespace-nowrap",children:D.topPillar}),s.jsx("td",{className:"py-2.5 px-3 whitespace-nowrap",children:s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${ee?"bg-emerald-500/10 text-emerald-400 font-semibold":"bg-rose-500/10 text-rose-400 font-semibold"}`,children:D.status})}),s.jsx("td",{className:"py-2.5 px-4 text-right whitespace-nowrap",children:s.jsxs("span",{className:`inline-flex items-center gap-1 font-bold ${ee?"text-emerald-400":"text-rose-400"}`,children:[ee?s.jsx(aa,{className:"w-3.5 h-3.5"}):s.jsx(Ha,{className:"w-3.5 h-3.5"}),ee?`+${D.pnlPercent}%`:`${D.pnlPercent}%`]})})]},D.id)})})]})}),s.jsxs("div",{className:"p-3.5 border-t border-slate-800 bg-slate-950/60 flex flex-col sm:flex-row items-center justify-between gap-3 text-xs font-mono",children:[s.jsxs("div",{className:"text-slate-400 text-[11px]",children:["Mostrando ",s.jsx("strong",{className:"text-slate-200",children:v+1})," a ",s.jsx("strong",{className:"text-slate-200",children:Math.min(v+q,S.length)})," de ",s.jsx("strong",{className:"text-white",children:S.length})," operações (",l," dias)"]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("button",{id:"btn-backtest-prev-page",onClick:()=>H(D=>Math.max(1,D-1)),disabled:z===1,className:"px-2.5 py-1 bg-slate-900 hover:bg-slate-800 border border-slate-800 rounded-md text-slate-300 disabled:opacity-40 disabled:cursor-not-allowed transition flex items-center gap-1",children:[s.jsx(Nf,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Anterior"})]}),s.jsxs("div",{className:"px-3 py-1 bg-slate-900 border border-slate-800 rounded-md text-amber-400 font-bold",children:[z," / ",X]}),s.jsxs("button",{id:"btn-backtest-next-page",onClick:()=>H(D=>Math.min(X,D+1)),disabled:z===X,className:"px-2.5 py-1 bg-slate-900 hover:bg-slate-800 border border-slate-800 rounded-md text-slate-300 disabled:opacity-40 disabled:cursor-not-allowed transition flex items-center gap-1",children:[s.jsx("span",{children:"Próxima"}),s.jsx(Er,{className:"w-3.5 h-3.5"})]})]})]})]})]}),T&&s.jsx("div",{className:"fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl max-w-xl w-full p-5 shadow-2xl font-mono",children:[s.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-2 rounded-lg bg-amber-500/20 text-amber-400 border border-amber-500/30",children:s.jsx(ls,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("h3",{className:"font-bold text-white text-sm",children:["5 Alvos Fibonacci de ",T.symbol]}),s.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold ${T.direction==="LONG"?"bg-emerald-500/10 text-emerald-400 border border-emerald-500/30":"bg-rose-500/10 text-rose-400 border border-rose-500/30"}`,children:T.direction})]}),s.jsxs("div",{className:"text-[11px] text-slate-400",children:["Executado em ",T.date," • ",T.topPillar]})]})]}),s.jsx("button",{onClick:()=>y(null),className:"p-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-400",children:s.jsx(na,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"grid grid-cols-4 gap-2 my-3 p-3 bg-slate-950/70 border border-slate-800 rounded-xl text-xs",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] text-slate-500 block uppercase",children:"Entrada"}),s.jsxs("span",{className:"font-bold text-slate-200",children:["$",T.entryPrice]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] text-slate-500 block uppercase",children:"Stop Loss"}),s.jsxs("span",{className:"font-bold text-rose-400",children:["$",T.stopLoss]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] text-slate-500 block uppercase",children:"Saída Real"}),s.jsxs("span",{className:"font-bold text-amber-300",children:["$",T.exitPrice||T.takeProfit]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-[10px] text-slate-500 block uppercase",children:"Resultado"}),s.jsx("span",{className:`font-bold ${T.status==="TP ATINGIDO"?"text-emerald-400":"text-rose-400"}`,children:T.status==="TP ATINGIDO"?`+${T.pnlPercent}%`:`${T.pnlPercent}%`})]})]}),s.jsxs("div",{className:"space-y-2 mt-2",children:[s.jsxs("div",{className:"text-[11px] font-bold text-slate-400 uppercase tracking-wider mb-1.5 flex items-center justify-between",children:[s.jsx("span",{children:"Alvos de Expansão de Fibonacci"}),s.jsx("span",{className:"text-[10px] text-emerald-400 font-normal",children:"Baseado na distância de Risco ATR"})]}),T.fibonacciTargets&&T.fibonacciTargets.length===5?T.fibonacciTargets.map(D=>{const ee=T.status==="TP ATINGIDO"&&(T.hitTargetLevel!==void 0?D.level<=T.hitTargetLevel:D.isHit),me=T.hitTargetLevel===D.level;return s.jsxs("div",{className:`p-2.5 rounded-lg border flex items-center justify-between text-xs transition ${me?"bg-emerald-500/20 border-emerald-500/60 text-emerald-200 ring-1 ring-emerald-500/40":ee?"bg-emerald-950/40 border-emerald-500/30 text-emerald-300":"bg-slate-950/50 border-slate-800 text-slate-400"}`,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold ${ee?"bg-emerald-500/30 text-emerald-300":"bg-slate-800 text-slate-500"}`,children:["TP",D.level]}),s.jsxs("div",{children:[s.jsx("div",{className:"font-bold text-white text-xs",children:D.ratioLabel}),s.jsxs("div",{className:"text-[10px] opacity-75",children:["Multiplicador Fibo ",D.ratio,"x"]})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsxs("div",{className:"font-bold text-sm text-white",children:["$",D.price]}),s.jsxs("div",{className:`text-[11px] font-semibold ${ee?"text-emerald-400":"text-slate-500"}`,children:["+",D.pnlPercent.toFixed(2),"% Ganho"]})]}),s.jsx("div",{className:"pl-2",children:ee?s.jsxs("span",{className:"flex items-center gap-1 text-emerald-400 text-[10px] font-bold bg-emerald-500/10 px-2 py-1 rounded",children:[s.jsx(ia,{className:"w-3.5 h-3.5"}),me?"Alvo da Saída":"Superado"]}):s.jsx("span",{className:"text-slate-600 text-[10px]",children:"Não Atingido"})})]},D.level)}):s.jsx("div",{className:"p-4 bg-slate-950 rounded-lg text-slate-500 text-xs text-center",children:"Alvos de Fibonacci calculados dinamicamente para este par."})]}),s.jsx("div",{className:"mt-4 pt-3 border-t border-slate-800 flex justify-end",children:s.jsx("button",{onClick:()=>y(null),className:"px-4 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-white text-xs font-semibold",children:"Fechar Detalhes"})})]})})]})},ny=({isOpen:r,onClose:l,notifications:i,onMarkAllRead:c,onClearAll:d,onSelectSymbol:m,onOpenSoundSettings:h})=>r?s.jsxs("div",{className:"fixed inset-0 z-50 overflow-hidden",children:[s.jsx("div",{onClick:l,className:"absolute inset-0 bg-black/60 backdrop-blur-xs transition-opacity"}),s.jsx("div",{className:"fixed inset-y-0 right-0 max-w-full flex pl-0 sm:pl-10",children:s.jsxs("div",{className:"w-full sm:w-screen max-w-full sm:max-w-md bg-slate-900 border-l border-slate-800 shadow-2xl flex flex-col",children:[s.jsxs("div",{className:"p-4 border-b border-slate-800 flex items-center justify-between bg-slate-950/80",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-amber-500/10 border border-amber-500/30 flex items-center justify-center text-amber-400",children:s.jsx(cl,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-bold text-white font-mono flex items-center gap-1.5",children:s.jsx("span",{children:"Avisos Críticos do Sistema"})}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-amber-400/90 font-mono",children:[s.jsx(gl,{className:"w-3 h-3 text-amber-400"}),s.jsx("span",{children:"Horário de Brasília (BRT / UTC-3)"})]})]})]}),s.jsx("button",{id:"btn-close-notification-drawer",onClick:l,className:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition",children:s.jsx(na,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"px-4 py-2 bg-slate-950/40 border-b border-slate-800/80 flex items-center justify-between text-xs",children:[s.jsxs("div",{className:"text-[11px] text-slate-400",children:[s.jsx("span",{className:"text-white font-bold",children:i.filter(g=>!g.read).length})," pendentes"]}),s.jsxs("div",{className:"flex items-center gap-3",children:[h&&s.jsxs("button",{id:"btn-drawer-sound-settings",onClick:h,className:"text-slate-400 hover:text-amber-400 transition flex items-center gap-1 text-[11px]",title:"Personalizar tons para cada tipo de sinal",children:[s.jsx(ml,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsx("span",{children:"Sons"})]}),s.jsxs("button",{id:"btn-mark-all-read",onClick:c,className:"text-slate-400 hover:text-emerald-400 transition flex items-center gap-1 text-[11px]",children:[s.jsx(sl,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Marcar lidas"})]}),s.jsxs("button",{id:"btn-clear-notifications",onClick:d,className:"text-slate-400 hover:text-rose-400 transition flex items-center gap-1 text-[11px]",children:[s.jsx(to,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Limpar"})]})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:i.length===0?s.jsxs("div",{className:"h-48 flex flex-col items-center justify-center text-center text-slate-500 text-xs",children:[s.jsx(cl,{className:"w-8 h-8 text-slate-600 mb-2 opacity-50"}),s.jsx("span",{children:"Nenhum aviso no momento."}),s.jsx("span",{className:"text-[10px] text-slate-600 mt-1",children:"O bot emite alertas automáticos em Horário de Brasília para setups qualificados (≥75%) e anomalias nas 100 maiores criptos."})]}):i.map(g=>{const p=g.severity==="high",f=g.type==="FUNDING_ALERT",N=Wd(g.timestamp||Date.now(),!0);return s.jsxs("div",{className:`p-3.5 rounded-xl border transition relative ${p?"bg-slate-950 border-amber-500/40 shadow-sm":f?"bg-slate-950 border-sky-500/30":"bg-slate-950/70 border-slate-800"}`,children:[!g.read&&s.jsx("span",{className:"absolute top-3 right-3 w-2 h-2 rounded-full bg-amber-400 animate-ping"}),s.jsxs("div",{className:"flex items-start gap-2.5",children:[s.jsx("div",{className:`mt-0.5 p-1.5 rounded-lg shrink-0 ${p?"bg-amber-500/20 text-amber-400":f?"bg-sky-500/20 text-sky-400":"bg-slate-800 text-slate-400"}`,children:p?s.jsx(ct,{className:"w-4 h-4"}):s.jsx(xl,{className:"w-4 h-4"})}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("h4",{className:"text-xs font-bold text-white font-mono flex items-center gap-1.5",children:g.title}),s.jsxs("span",{className:"text-[10px] font-mono text-amber-400/90 bg-amber-400/10 px-1.5 py-0.5 rounded border border-amber-400/20 whitespace-nowrap",children:[N," (BRT)"]})]}),s.jsx("p",{className:"text-xs text-slate-300 mt-1.5 leading-relaxed",children:g.message}),g.symbol&&m&&s.jsxs("button",{onClick:()=>{m(g.symbol),l()},className:"mt-2.5 text-[11px] font-mono font-semibold text-amber-400 hover:text-amber-300 transition flex items-center gap-1",children:[s.jsxs("span",{children:["Examinar ",g.symbol," no Triple Screen"]}),s.jsx(e1,{className:"w-3 h-3"})]})]})]})]},g.id)})}),s.jsxs("div",{className:"p-3 bg-slate-950 border-t border-slate-800 text-[10px] font-mono text-slate-400 text-center flex items-center justify-center gap-1.5",children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400"}),s.jsx("span",{children:"Todos os horários sincronizados em Horário de Brasília (BRT / UTC-3)"})]})]})})]}):null,ly=({isOpen:r,onClose:l,signal:i,initialStyle:c="DAY_TRADE"})=>{const[d,m]=$.useState(c),[h,g]=$.useState(1e4),[p,f]=$.useState(1),[N,j]=$.useState((i==null?void 0:i.entryPrice)||100),[L,R]=$.useState((i==null?void 0:i.stopLoss)||98),[E,z]=$.useState((i==null?void 0:i.takeProfit1)||104),[H,q]=$.useState((i==null?void 0:i.takeProfit2)||106),[I,T]=$.useState(1);if($.useEffect(()=>{if(i){const W=eu(i)[d];j(W.entryPrice),R(W.stopLoss),z(W.takeProfit1),q(W.takeProfit2),f(W.riskPercent),T(1)}},[i,d]),$.useEffect(()=>{c&&m(c)},[c]),!r||!i)return null;const y=eu(i),S=y[d],X=h*p/100,v=Math.abs(N-L),k=N>0?v/N*100:0,se=k>0?X/(k/100):0,ne=N>0?se/N:0,U=Math.abs(E-N),ae=ne*U,ce=v>0?(U/v).toFixed(2):"0",C=Math.abs(H-N),K=ne*C,w=v>0?(C/v).toFixed(2):"0";return s.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-black/70 backdrop-blur-xs flex items-center justify-center p-4",children:s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl max-w-lg w-full overflow-hidden shadow-2xl",children:[s.jsxs("div",{className:"p-4 border-b border-slate-800 bg-slate-950/60 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-amber-500/10 border border-amber-500/30 flex items-center justify-center text-amber-400",children:s.jsx(Kd,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-sm font-bold text-white font-mono flex items-center gap-1.5",children:["Dimensionamento de Risco & Lote: ",i.symbol]}),s.jsx("p",{className:"text-[11px] text-slate-400",children:"Regra Quantitativa: Stop calibrado pelo ATR • Risco máximo 1%"})]})]}),s.jsx("button",{id:"btn-close-risk-calc",onClick:l,className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition",children:s.jsx(na,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"p-5 space-y-4 text-xs font-mono",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-slate-400 block mb-1.5 text-[11px]",children:"Modalidade Tática de Execução:"}),s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-1.5",children:["SCALP","DAY_TRADE","SWING_TRADE","POSITION_TRADE"].map(M=>{const W=y[M],oe=d===M;return s.jsxs("button",{type:"button",onClick:()=>m(M),className:`px-2 py-1.5 rounded-lg border text-left transition ${oe?`${W.badgeColor} border-current ring-1 ring-amber-400/30`:"bg-slate-950 border-slate-800 text-slate-400 hover:text-slate-200"}`,children:[s.jsx("div",{className:"font-bold text-[10px] truncate",children:W.badge}),s.jsxs("div",{className:"text-[9px] text-slate-400 mt-0.5",children:[W.atrMultipleStop," • ",W.recommendedLeverage]})]},M)})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-slate-400 block mb-1",children:"Capital da Conta (USDT)"}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-slate-500",children:"$"}),s.jsx("input",{type:"number",value:h,onChange:M=>g(Math.max(10,Number(M.target.value))),className:"w-full bg-slate-950 border border-slate-800 rounded-lg pl-6 pr-3 py-1.5 text-slate-200 focus:outline-none focus:border-amber-500/50"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-slate-400 block mb-1",children:"Risco por Trade (%)"}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-500",children:"%"}),s.jsx("input",{type:"number",step:"0.1",min:"0.1",max:"10",value:p,onChange:M=>f(Math.max(.1,Number(M.target.value))),className:"w-full bg-slate-950 border border-slate-800 rounded-lg pl-3 pr-6 py-1.5 text-slate-200 focus:outline-none focus:border-amber-500/50"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-slate-400 block mb-1",children:"Entrada"}),s.jsx("input",{type:"number",step:"any",value:N,onChange:M=>j(Number(M.target.value)),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-slate-200 focus:outline-none"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-rose-400 block mb-1",children:"Stop Loss (ATR)"}),s.jsx("input",{type:"number",step:"any",value:L,onChange:M=>R(Number(M.target.value)),className:"w-full bg-slate-950 border border-rose-500/30 rounded-lg px-2.5 py-1.5 text-rose-300 focus:outline-none"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsx("label",{className:"text-emerald-400 block",children:"Alvo para Cálculo"}),s.jsxs("span",{className:"text-[10px] text-amber-300",children:["TP",I]})]}),s.jsx("input",{type:"number",step:"any",value:E,onChange:M=>z(Number(M.target.value)),className:"w-full bg-slate-950 border border-emerald-500/30 rounded-lg px-2.5 py-1.5 text-emerald-300 focus:outline-none"})]})]}),(S==null?void 0:S.fibonacciTargets)&&S.fibonacciTargets.length===5&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[s.jsx("span",{className:"text-slate-400 uppercase font-mono",children:"5 Alvos em Fibonacci (Projeções para Lote)"}),s.jsx("span",{className:"text-emerald-400 font-mono",children:"Golden Ratio & Expansão"})]}),s.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:S.fibonacciTargets.map(M=>{const W=I===M.level;return s.jsxs("button",{type:"button",onClick:()=>{T(M.level),z(M.price)},className:`p-1.5 rounded-lg border text-center transition text-[10px] font-mono ${W?"bg-emerald-500/20 border-emerald-400 text-emerald-300 ring-1 ring-emerald-500/30 font-bold":"bg-slate-950 border-slate-800 text-slate-400 hover:border-slate-700 hover:text-slate-200"}`,children:[s.jsxs("div",{className:"text-[9px] text-slate-500",children:["TP",M.level," (",M.ratio,"x)"]}),s.jsxs("div",{className:"truncate font-bold text-slate-200",children:["$",M.price]}),s.jsxs("div",{className:"text-[8px] text-emerald-400 font-semibold",children:["+",M.pnlPercent,"%"]})]},M.level)})})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-slate-800/80",children:[s.jsx("span",{className:"text-slate-400",children:"Risco em Dinheiro:"}),s.jsxs("strong",{className:"text-rose-400 font-bold",children:["$",X.toFixed(2)]})]}),s.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-slate-800/80",children:[s.jsx("span",{className:"text-slate-400",children:"Distância do Stop:"}),s.jsxs("strong",{className:"text-slate-200",children:[k.toFixed(2),"%"]})]}),s.jsxs("div",{className:"flex items-center justify-between pb-2 border-b border-slate-800/80",children:[s.jsx("span",{className:"text-slate-400",children:"Tamanho da Posição Sugerido:"}),s.jsxs("div",{className:"text-right",children:[s.jsxs("div",{className:"text-amber-400 font-bold text-sm",children:["$",se.toLocaleString(void 0,{maximumFractionDigits:2})]}),s.jsxs("div",{className:"text-[10px] text-slate-500",children:["≈ ",ne.toFixed(4)," ",i.symbol.split("/")[0]]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-1 text-[11px]",children:[s.jsxs("div",{className:"p-2 bg-emerald-500/10 border border-emerald-500/30 rounded-lg",children:[s.jsxs("span",{className:"text-emerald-400 block",children:["Lucro TP1 (1:",ce,")"]}),s.jsxs("span",{className:"text-emerald-300 font-bold text-xs",children:["+$",ae.toFixed(2)]})]}),s.jsxs("div",{className:"p-2 bg-emerald-500/10 border border-emerald-500/30 rounded-lg",children:[s.jsxs("span",{className:"text-emerald-400 block",children:["Lucro TP2 (1:",w,")"]}),s.jsxs("span",{className:"text-emerald-300 font-bold text-xs",children:["+$",K.toFixed(2)]})]})]})]})]}),s.jsx("div",{className:"p-4 bg-slate-950 border-t border-slate-800 flex justify-end",children:s.jsx("button",{onClick:l,className:"px-4 py-1.5 bg-amber-500 hover:bg-amber-400 text-slate-950 font-bold text-xs rounded-lg transition",children:"Concluir Dimensionamento"})})]})})},ry=()=>{};var $h={};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Cf=function(r){const l=[];let i=0;for(let c=0;c>6|192,l[i++]=d&63|128):(d&64512)===55296&&c+1>18|240,l[i++]=d>>12&63|128,l[i++]=d>>6&63|128,l[i++]=d&63|128):(l[i++]=d>>12|224,l[i++]=d>>6&63|128,l[i++]=d&63|128)}return l},iy=function(r){const l=[];let i=0,c=0;for(;i191&&d<224){const m=r[i++];l[c++]=String.fromCharCode((d&31)<<6|m&63)}else if(d>239&&d<365){const m=r[i++],h=r[i++],g=r[i++],p=((d&7)<<18|(m&63)<<12|(h&63)<<6|g&63)-65536;l[c++]=String.fromCharCode(55296+(p>>10)),l[c++]=String.fromCharCode(56320+(p&1023))}else{const m=r[i++],h=r[i++];l[c++]=String.fromCharCode((d&15)<<12|(m&63)<<6|h&63)}}return l.join("")},_f={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(r,l){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();const i=l?this.byteToCharMapWebSafe_:this.byteToCharMap_,c=[];for(let d=0;d>2,j=(m&3)<<4|g>>4;let L=(g&15)<<2|f>>6,R=f&63;p||(R=64,h||(L=64)),c.push(i[N],i[j],i[L],i[R])}return c.join("")},encodeString(r,l){return this.HAS_NATIVE_SUPPORT&&!l?btoa(r):this.encodeByteArray(Cf(r),l)},decodeString(r,l){return this.HAS_NATIVE_SUPPORT&&!l?atob(r):iy(this.decodeStringToByteArray(r,l))},decodeStringToByteArray(r,l){this.init_();const i=l?this.charToByteMapWebSafe_:this.charToByteMap_,c=[];for(let d=0;d>4;if(c.push(L),f!==64){const R=g<<4&240|f>>2;if(c.push(R),j!==64){const E=f<<6&192|j;c.push(E)}}}return c},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let r=0;r=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)]=r,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)]=r)}}};class oy extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const cy=function(r){const l=Cf(r);return _f.encodeByteArray(l,!0)},Of=function(r){return cy(r).replace(/\./g,"")},Df=function(r){try{return _f.decodeString(r,!0)}catch(l){console.error("base64Decode failed: ",l)}return null};/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function dy(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const uy=()=>dy().__FIREBASE_DEFAULTS__,my=()=>{if(typeof process>"u"||typeof $h>"u")return;const r=$h.__FIREBASE_DEFAULTS__;if(r)return JSON.parse(r)},xy=()=>{if(typeof document>"u")return;let r;try{r=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const l=r&&Df(r[1]);return l&&JSON.parse(l)},fu=()=>{try{return ry()||uy()||my()||xy()}catch(r){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);return}},hy=r=>{var l,i;return(i=(l=fu())==null?void 0:l.emulatorHosts)==null?void 0:i[r]},kf=()=>{var r;return(r=fu())==null?void 0:r.config},Mf=r=>{var l;return(l=fu())==null?void 0:l[`_${r}`]};/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class fy{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((l,i)=>{this.resolve=l,this.reject=i})}wrapCallback(l){return(i,c)=>{i?this.reject(i):this.resolve(c),typeof l=="function"&&(this.promise.catch(()=>{}),l.length===1?l(i):l(i,c))}}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function wt(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function py(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(wt())}function by(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function gy(){const r=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof r=="object"&&r.id!==void 0}function vy(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function yy(){const r=wt();return r.indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0}function Ny(){try{return typeof indexedDB=="object"}catch{return!1}}function jy(){return new Promise((r,l)=>{try{let i=!0;const c="validate-browser-context-for-indexeddb-analytics-module",d=self.indexedDB.open(c);d.onsuccess=()=>{d.result.close(),i||self.indexedDB.deleteDatabase(c),r(!0)},d.onupgradeneeded=()=>{i=!1},d.onerror=()=>{var m;l(((m=d.error)==null?void 0:m.message)||"")}}catch(i){l(i)}})}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Sy="FirebaseError";class Ga extends Error{constructor(l,i,c){super(i),this.code=l,this.customData=c,this.name=Sy,Object.setPrototypeOf(this,Ga.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,_r.prototype.create)}}class _r{constructor(l,i,c){this.service=l,this.serviceName=i,this.errors=c}create(l,...i){const c=i[0]||{},d=`${this.service}/${l}`,m=this.errors[l],h=m?wy(m,c):"Error",g=`${this.serviceName}: ${h} (${d}).`;return new Ga(d,g,c)}}function wy(r,l){try{let i=0,c="";for(;i`),i=m+1}return c}catch{return r}}function Ay(r){for(const l in r)if(Object.prototype.hasOwnProperty.call(r,l))return!1;return!0}function hl(r,l){if(r===l)return!0;const i=Object.keys(r),c=Object.keys(l);for(const d of i){if(!c.includes(d))return!1;const m=r[d],h=l[d];if(Vh(m)&&Vh(h)){if(!hl(m,h))return!1}else if(m!==h)return!1}for(const d of c)if(!i.includes(d))return!1;return!0}function Vh(r){return r!==null&&typeof r=="object"}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Or(r){const l=[];for(const[i,c]of Object.entries(r))Array.isArray(c)?c.forEach(d=>{l.push(encodeURIComponent(i)+"="+encodeURIComponent(d))}):l.push(encodeURIComponent(i)+"="+encodeURIComponent(c));return l.length?"&"+l.join("&"):""}function Ty(r,l){const i=new Ey(r,l);return i.subscribe.bind(i)}class Ey{constructor(l,i){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=i,this.task.then(()=>{l(this)}).catch(c=>{this.error(c)})}next(l){this.forEachObserver(i=>{i.next(l)})}error(l){this.forEachObserver(i=>{i.error(l)}),this.close(l)}complete(){this.forEachObserver(l=>{l.complete()}),this.close()}subscribe(l,i,c){let d;if(l===void 0&&i===void 0&&c===void 0)throw new Error("Missing Observer.");Ry(l,["next","error","complete"])?d=l:d={next:l,error:i,complete:c},d.next===void 0&&(d.next=$d),d.error===void 0&&(d.error=$d),d.complete===void 0&&(d.complete=$d);const m=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?d.error(this.finalError):d.complete()}catch{}}),this.observers.push(d),m}unsubscribeOne(l){this.observers===void 0||this.observers[l]===void 0||(delete this.observers[l],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(l){if(!this.finalized)for(let i=0;i{if(this.observers!==void 0&&this.observers[l]!==void 0)try{i(this.observers[l])}catch(c){typeof console<"u"&&console.error&&console.error(c)}})}close(l){this.finalized||(this.finalized=!0,l!==void 0&&(this.finalError=l),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Ry(r,l){if(typeof r!="object"||r===null)return!1;for(const i of l)if(i in r&&typeof r[i]=="function")return!0;return!1}function $d(){}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function qa(r){return r&&r._delegate?r._delegate:r}/** * @license * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function pu(r){try{return(r.startsWith("http://")||r.startsWith("https://")?new URL(r).hostname:r).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Cy(r){return(await fetch(r,{credentials:"include"})).ok}class fl{constructor(l,i,c){this.name=l,this.instanceFactory=i,this.type=c,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(l){return this.instantiationMode=l,this}setMultipleInstances(l){return this.multipleInstances=l,this}setServiceProps(l){return this.serviceProps=l,this}setInstanceCreatedCallback(l){return this.onInstanceCreated=l,this}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const mn="[DEFAULT]";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class _y{constructor(l,i){this.name=l,this.container=i,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(l){const i=this.normalizeInstanceIdentifier(l);if(!this.instancesDeferred.has(i)){const c=new fy;if(this.instancesDeferred.set(i,c),this.isInitialized(i)||this.shouldAutoInitialize())try{const d=this.getOrInitializeService({instanceIdentifier:i});d&&c.resolve(d)}catch{}}return this.instancesDeferred.get(i).promise}getImmediate(l){const i=this.normalizeInstanceIdentifier(l==null?void 0:l.identifier),c=(l==null?void 0:l.optional)??!1;if(this.isInitialized(i)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:i})}catch(d){if(c)return null;throw d}else{if(c)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(l){if(l.name!==this.name)throw Error(`Mismatching Component ${l.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=l,!!this.shouldAutoInitialize()){if(Dy(l))try{this.getOrInitializeService({instanceIdentifier:mn})}catch{}for(const[i,c]of this.instancesDeferred.entries()){const d=this.normalizeInstanceIdentifier(i);try{const m=this.getOrInitializeService({instanceIdentifier:d});c.resolve(m)}catch{}}}}clearInstance(l=mn){this.instancesDeferred.delete(l),this.instancesOptions.delete(l),this.instances.delete(l)}async delete(){const l=Array.from(this.instances.values());await Promise.all([...l.filter(i=>"INTERNAL"in i).map(i=>i.INTERNAL.delete()),...l.filter(i=>"_delete"in i).map(i=>i._delete())])}isComponentSet(){return this.component!=null}isInitialized(l=mn){return this.instances.has(l)}getOptions(l=mn){return this.instancesOptions.get(l)||{}}initialize(l={}){const{options:i={}}=l,c=this.normalizeInstanceIdentifier(l.instanceIdentifier);if(this.isInitialized(c))throw Error(`${this.name}(${c}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const d=this.getOrInitializeService({instanceIdentifier:c,options:i});for(const[m,h]of this.instancesDeferred.entries()){const g=this.normalizeInstanceIdentifier(m);c===g&&h.resolve(d)}return d}onInit(l,i){const c=this.normalizeInstanceIdentifier(i),d=this.onInitCallbacks.get(c)??new Set;d.add(l),this.onInitCallbacks.set(c,d);const m=this.instances.get(c);return m&&l(m,c),()=>{d.delete(l)}}invokeOnInitCallbacks(l,i){const c=this.onInitCallbacks.get(i);if(c)for(const d of c)try{d(l,i)}catch{}}getOrInitializeService({instanceIdentifier:l,options:i={}}){let c=this.instances.get(l);if(!c&&this.component&&(c=this.component.instanceFactory(this.container,{instanceIdentifier:Oy(l),options:i}),this.instances.set(l,c),this.instancesOptions.set(l,i),this.invokeOnInitCallbacks(c,l),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,l,c)}catch{}return c||null}normalizeInstanceIdentifier(l=mn){return this.component?this.component.multipleInstances?l:mn:l}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Oy(r){return r===mn?void 0:r}function Dy(r){return r.instantiationMode==="EAGER"}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ky{constructor(l){this.name=l,this.providers=new Map}addComponent(l){const i=this.getProvider(l.name);if(i.isComponentSet())throw new Error(`Component ${l.name} has already been registered with ${this.name}`);i.setComponent(l)}addOrOverwriteComponent(l){this.getProvider(l.name).isComponentSet()&&this.providers.delete(l.name),this.addComponent(l)}getProvider(l){if(this.providers.has(l))return this.providers.get(l);const i=new _y(l,this);return this.providers.set(l,i),i}getProviders(){return Array.from(this.providers.values())}}/** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var qe;(function(r){r[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT"})(qe||(qe={}));const My={debug:qe.DEBUG,verbose:qe.VERBOSE,info:qe.INFO,warn:qe.WARN,error:qe.ERROR,silent:qe.SILENT},Ly=qe.INFO,Py={[qe.DEBUG]:"log",[qe.VERBOSE]:"log",[qe.INFO]:"info",[qe.WARN]:"warn",[qe.ERROR]:"error"},Iy=(r,l,...i)=>{if(ll.some(i=>r instanceof i);let Bh,Hh;function zy(){return Bh||(Bh=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function $y(){return Hh||(Hh=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Pf=new WeakMap,tu=new WeakMap,If=new WeakMap,Vd=new WeakMap,bu=new WeakMap;function Vy(r){const l=new Promise((i,c)=>{const d=()=>{r.removeEventListener("success",m),r.removeEventListener("error",h)},m=()=>{i(Ba(r.result)),d()},h=()=>{c(r.error),d()};r.addEventListener("success",m),r.addEventListener("error",h)});return l.then(i=>{i instanceof IDBCursor&&Pf.set(i,r)}).catch(()=>{}),bu.set(l,r),l}function By(r){if(tu.has(r))return;const l=new Promise((i,c)=>{const d=()=>{r.removeEventListener("complete",m),r.removeEventListener("error",h),r.removeEventListener("abort",h)},m=()=>{i(),d()},h=()=>{c(r.error||new DOMException("AbortError","AbortError")),d()};r.addEventListener("complete",m),r.addEventListener("error",h),r.addEventListener("abort",h)});tu.set(r,l)}let su={get(r,l,i){if(r instanceof IDBTransaction){if(l==="done")return tu.get(r);if(l==="objectStoreNames")return r.objectStoreNames||If.get(r);if(l==="store")return i.objectStoreNames[1]?void 0:i.objectStore(i.objectStoreNames[0])}return Ba(r[l])},set(r,l,i){return r[l]=i,!0},has(r,l){return r instanceof IDBTransaction&&(l==="done"||l==="store")?!0:l in r}};function Hy(r){su=r(su)}function Gy(r){return r===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(l,...i){const c=r.call(Bd(this),l,...i);return If.set(c,l.sort?l.sort():[l]),Ba(c)}:$y().includes(r)?function(...l){return r.apply(Bd(this),l),Ba(Pf.get(this))}:function(...l){return Ba(r.apply(Bd(this),l))}}function qy(r){return typeof r=="function"?Gy(r):(r instanceof IDBTransaction&&By(r),Uy(r,zy())?new Proxy(r,su):r)}function Ba(r){if(r instanceof IDBRequest)return Vy(r);if(Vd.has(r))return Vd.get(r);const l=qy(r);return l!==r&&(Vd.set(r,l),bu.set(l,r)),l}const Bd=r=>bu.get(r);function Fy(r,l,{blocked:i,upgrade:c,blocking:d,terminated:m}={}){const h=indexedDB.open(r,l),g=Ba(h);return c&&h.addEventListener("upgradeneeded",p=>{c(Ba(h.result),p.oldVersion,p.newVersion,Ba(h.transaction),p)}),i&&h.addEventListener("blocked",p=>i(p.oldVersion,p.newVersion,p)),g.then(p=>{m&&p.addEventListener("close",()=>m()),d&&p.addEventListener("versionchange",f=>d(f.oldVersion,f.newVersion,f))}).catch(()=>{}),g}const Yy=["get","getKey","getAll","getAllKeys","count"],Xy=["put","add","delete","clear"],Hd=new Map;function Gh(r,l){if(!(r instanceof IDBDatabase&&!(l in r)&&typeof l=="string"))return;if(Hd.get(l))return Hd.get(l);const i=l.replace(/FromIndex$/,""),c=l!==i,d=Xy.includes(i);if(!(i in(c?IDBIndex:IDBObjectStore).prototype)||!(d||Yy.includes(i)))return;const m=async function(h,...g){const p=this.transaction(h,d?"readwrite":"readonly");let f=p.store;return c&&(f=f.index(g.shift())),(await Promise.all([f[i](...g),d&&p.done]))[0]};return Hd.set(l,m),m}Hy(r=>({...r,get:(l,i,c)=>Gh(l,i)||r.get(l,i,c),has:(l,i)=>!!Gh(l,i)||r.has(l,i)}));/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zy{constructor(l){this.container=l}getPlatformInfoString(){return this.container.getProviders().map(i=>{if(Ky(i)){const c=i.getImmediate();return`${c.library}/${c.version}`}else return null}).filter(i=>i).join(" ")}}function Ky(r){const l=r.getComponent();return(l==null?void 0:l.type)==="VERSION"}const au="@firebase/app",qh="0.16.1";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const la=new Lf("@firebase/app"),Qy="@firebase/app-compat",Jy="@firebase/analytics-compat",Wy="@firebase/analytics",eN="@firebase/app-check-compat",tN="@firebase/app-check",sN="@firebase/auth",aN="@firebase/auth-compat",nN="@firebase/database",lN="@firebase/data-connect",rN="@firebase/database-compat",iN="@firebase/functions",oN="@firebase/functions-compat",cN="@firebase/installations",dN="@firebase/installations-compat",uN="@firebase/messaging",mN="@firebase/messaging-compat",xN="@firebase/performance",hN="@firebase/performance-compat",fN="@firebase/remote-config",pN="@firebase/remote-config-compat",bN="@firebase/storage",gN="@firebase/storage-compat",vN="@firebase/firestore",yN="@firebase/ai",NN="@firebase/firestore-compat",jN="firebase",SN="12.18.0";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const nu="[DEFAULT]",wN={[au]:"fire-core",[Qy]:"fire-core-compat",[Wy]:"fire-analytics",[Jy]:"fire-analytics-compat",[tN]:"fire-app-check",[eN]:"fire-app-check-compat",[sN]:"fire-auth",[aN]:"fire-auth-compat",[nN]:"fire-rtdb",[lN]:"fire-data-connect",[rN]:"fire-rtdb-compat",[iN]:"fire-fn",[oN]:"fire-fn-compat",[cN]:"fire-iid",[dN]:"fire-iid-compat",[uN]:"fire-fcm",[mN]:"fire-fcm-compat",[xN]:"fire-perf",[hN]:"fire-perf-compat",[fN]:"fire-rc",[pN]:"fire-rc-compat",[bN]:"fire-gcs",[gN]:"fire-gcs-compat",[vN]:"fire-fst",[NN]:"fire-fst-compat",[yN]:"fire-vertex","fire-js":"fire-js",[jN]:"fire-js-all"};/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Sr=new Map,AN=new Map,lu=new Map;function Fh(r,l){try{r.container.addComponent(l)}catch(i){la.debug(`Component ${l.name} failed to register with FirebaseApp ${r.name}`,i)}}function wr(r){const l=r.name;if(lu.has(l))return la.debug(`There were multiple attempts to register component ${l}.`),!1;lu.set(l,r);for(const i of Sr.values())Fh(i,r);for(const i of AN.values())Fh(i,r);return!0}function Uf(r,l){const i=r.container.getProvider("heartbeat").getImmediate({optional:!0});return i&&i.triggerHeartbeat(),r.container.getProvider(l)}function js(r){return r==null?!1:r.settings!==void 0}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const TN={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Ws=new _r("app","Firebase",TN);/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class EN{constructor(l,i,c){this._isDeleted=!1,this._options={...l},this._config={...i},this._name=i.name,this._automaticDataCollectionEnabled=i.automaticDataCollectionEnabled,this._container=c,this.container.addComponent(new fl("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(l){this.checkDestroyed(),this._automaticDataCollectionEnabled=l}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(l){this._isDeleted=l}checkDestroyed(){if(this.isDeleted)throw Ws.create("app-deleted",{appName:this._name})}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Dr=SN;function zf(r,l={}){let i=r;typeof l!="object"&&(l={name:l});const c={name:nu,automaticDataCollectionEnabled:!0,...l},d=c.name;if(typeof d!="string"||!d)throw Ws.create("bad-app-name",{appName:String(d)});if(i||(i=kf()),!i)throw Ws.create("no-options");const m=Sr.get(d);if(m)if(hl(i,m.options)){if(hl(c,m.config))return m;throw Ws.create("duplicate-app",{appName:d,mismatchedParam:"config",oldValue:JSON.stringify(m.config),newValue:JSON.stringify(c)})}else throw Ws.create("duplicate-app",{appName:d,mismatchedParam:"options",oldValue:JSON.stringify(m.options),newValue:JSON.stringify(i)});const h=new ky(d);for(const p of lu.values())h.addComponent(p);const g=new EN(i,c,h);return Sr.set(d,g),g}function RN(r=nu){const l=Sr.get(r);if(!l&&r===nu&&kf())return zf();if(!l)throw Ws.create("no-app",{appName:r});return l}function Yh(){return Array.from(Sr.values())}function nl(r,l,i){let c=wN[r]??r;i&&(c+=`-${i}`);const d=c.match(/\s|\//),m=l.match(/\s|\//);if(d||m){const h=[`Unable to register library "${c}" with version "${l}":`];d&&h.push(`library name "${c}" contains illegal characters (whitespace or "/")`),d&&m&&h.push("and"),m&&h.push(`version name "${l}" contains illegal characters (whitespace or "/")`),la.warn(h.join(" "));return}wr(new fl(`${c}-version`,()=>({library:c,version:l}),"VERSION"))}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const CN="firebase-heartbeat-database",_N=1,Ar="firebase-heartbeat-store";let Gd=null;function $f(){return Gd||(Gd=Fy(CN,_N,{upgrade:(r,l)=>{switch(l){case 0:try{r.createObjectStore(Ar)}catch(i){console.warn(i)}}}}).catch(r=>{throw Ws.create("idb-open",{originalErrorMessage:r.message})})),Gd}async function ON(r){try{const i=(await $f()).transaction(Ar),c=await i.objectStore(Ar).get(Vf(r));return await i.done,c}catch(l){if(l instanceof Ga)la.warn(l.message);else{const i=Ws.create("idb-get",{originalErrorMessage:l==null?void 0:l.message});la.warn(i.message)}}}async function Xh(r,l){try{const c=(await $f()).transaction(Ar,"readwrite");await c.objectStore(Ar).put(l,Vf(r)),await c.done}catch(i){if(i instanceof Ga)la.warn(i.message);else{const c=Ws.create("idb-set",{originalErrorMessage:i==null?void 0:i.message});la.warn(c.message)}}}function Vf(r){return`${r.name}!${r.options.appId}`}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const DN=1024,kN=30;class MN{constructor(l){this.container=l,this._heartbeatsCache=null;const i=this.container.getProvider("app").getImmediate();this._storage=new PN(i),this._heartbeatsCachePromise=this._storage.read().then(c=>(this._heartbeatsCache=c,c))}async triggerHeartbeat(){var l,i;try{const d=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),m=Zh();if(((l=this._heartbeatsCache)==null?void 0:l.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((i=this._heartbeatsCache)==null?void 0:i.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===m||this._heartbeatsCache.heartbeats.some(h=>h.date===m))return;if(this._heartbeatsCache.heartbeats.push({date:m,agent:d}),this._heartbeatsCache.heartbeats.length>kN){const h=IN(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(h,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(c){la.warn(c)}}async getHeartbeatsHeader(){var l;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((l=this._heartbeatsCache)==null?void 0:l.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const i=Zh(),{heartbeatsToSend:c,unsentEntries:d}=LN(this._heartbeatsCache.heartbeats),m=Of(JSON.stringify({version:2,heartbeats:c}));return this._heartbeatsCache.lastSentHeartbeatDate=i,d.length>0?(this._heartbeatsCache.heartbeats=d,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),m}catch(i){return la.warn(i),""}}}function Zh(){return new Date().toISOString().substring(0,10)}function LN(r,l=DN){const i=[];let c=r.slice();for(const d of r){const m=i.find(h=>h.agent===d.agent);if(m){if(m.dates.push(d.date),Kh(i)>l){m.dates.pop();break}}else if(i.push({agent:d.agent,dates:[d.date]}),Kh(i)>l){i.pop();break}c=c.slice(1)}return{heartbeatsToSend:i,unsentEntries:c}}class PN{constructor(l){this.app=l,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Ny()?jy().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const i=await ON(this.app);return i!=null&&i.heartbeats?i:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(l){if(await this._canUseIndexedDBPromise){const c=await this.read();return Xh(this.app,{lastSentHeartbeatDate:l.lastSentHeartbeatDate??c.lastSentHeartbeatDate,heartbeats:l.heartbeats})}else return}async add(l){if(await this._canUseIndexedDBPromise){const c=await this.read();return Xh(this.app,{lastSentHeartbeatDate:l.lastSentHeartbeatDate??c.lastSentHeartbeatDate,heartbeats:[...c.heartbeats,...l.heartbeats]})}else return}}function Kh(r){return Of(JSON.stringify({version:2,heartbeats:r})).length}function IN(r){if(r.length===0)return-1;let l=0,i=r[0].date;for(let c=1;cnew Zy(l),"PRIVATE")),wr(new fl("heartbeat",l=>new MN(l),"PRIVATE")),nl(au,qh,r),nl(au,qh,"esm2020"),nl("fire-js","")}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */UN("");var zN="firebase",$N="12.18.0";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */nl(zN,$N,"app");function Bf(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const VN=Bf,Hf=new _r("auth","Firebase",Bf());/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const uo=new Lf("@firebase/auth");function Gf(r,...l){uo.logLevel<=qe.WARN&&uo.warn(`Auth (${Dr}): ${r}`,...l)}function ao(r,...l){uo.logLevel<=qe.ERROR&&uo.error(`Auth (${Dr}): ${r}`,...l)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Rs(r,...l){throw vu(r,...l)}function fs(r,...l){return vu(r,...l)}function gu(r,l,i){const c={...VN(),[l]:i};return new _r("auth","Firebase",c).create(l,{appName:r.name})}function hn(r){return gu(r,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function BN(r,l,i){const c=i;if(!(l instanceof c))throw c.name!==l.constructor.name&&Rs(r,"argument-error"),gu(r,"argument-error",`Type of ${l.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function vu(r,...l){if(typeof r!="string"){const i=l[0],c=[...l.slice(1)];return c[0]&&(c[0].appName=r.name),r._errorFactory.create(i,...c)}return Hf.create(r,...l)}function ye(r,l,...i){if(!r)throw vu(l,...i)}function ea(r){const l="INTERNAL ASSERTION FAILED: "+r;throw ao(l),new Error(l)}function ra(r,l){r||ea(l)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ru(){var r;return typeof self<"u"&&((r=self.location)==null?void 0:r.href)||""}function HN(){return Qh()==="http:"||Qh()==="https:"}function Qh(){var r;return typeof self<"u"&&((r=self.location)==null?void 0:r.protocol)||null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function GN(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(HN()||gy()||"connection"in navigator)?navigator.onLine:!0}function qN(){if(typeof navigator>"u")return null;const r=navigator;return r.languages&&r.languages[0]||r.language||null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class kr{constructor(l,i){this.shortDelay=l,this.longDelay=i,ra(i>l,"Short delay should be less than long delay!"),this.isMobile=py()||vy()}get(){return GN()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function yu(r,l){ra(r.emulator,"Emulator should always be set here");const{url:i}=r.emulator;return l?`${i}${l.startsWith("/")?l.slice(1):l}`:i}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class qf{static initialize(l,i,c){this.fetchImpl=l,i&&(this.headersImpl=i),c&&(this.responseImpl=c)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;ea("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;ea("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;ea("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const FN={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const YN=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],XN=new kr(3e4,6e4);function Nu(r,l){return r.tenantId&&!l.tenantId?{...l,tenantId:r.tenantId}:l}async function yl(r,l,i,c,d={}){return Ff(r,d,async()=>{let m={},h={};c&&(l==="GET"?h=c:m={body:JSON.stringify(c)});const g=Or({...h,key:r.config.apiKey}).slice(1),p=await r._getAdditionalHeaders();p["Content-Type"]="application/json",r.languageCode&&(p["X-Firebase-Locale"]=r.languageCode);const f={method:l,headers:p,...m};return by()||(f.referrerPolicy="strict-origin-when-cross-origin"),r.emulatorConfig&&pu(r.emulatorConfig.host)&&(f.credentials="include"),qf.fetch()(await Yf(r,r.config.apiHost,i,g),f)})}async function Ff(r,l,i){r._canInitEmulator=!1;const c={...FN,...l};try{const d=new KN(r),m=await Promise.race([i(),d.promise]);d.clearNetworkTimeout();const h=await m.json();if("needConfirmation"in h)throw Qi(r,"account-exists-with-different-credential",h);if(m.ok&&!("errorMessage"in h))return h;{const g=m.ok?h.errorMessage:h.error.message,[p,f]=g.split(" : ");if(p==="FEDERATED_USER_ID_ALREADY_LINKED")throw Qi(r,"credential-already-in-use",h);if(p==="EMAIL_EXISTS")throw Qi(r,"email-already-in-use",h);if(p==="USER_DISABLED")throw Qi(r,"user-disabled",h);const N=c[p]||p.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw gu(r,N,f);Rs(r,N)}}catch(d){if(d instanceof Ga)throw d;Rs(r,"network-request-failed",{message:String(d)})}}async function ZN(r,l,i,c,d={}){const m=await yl(r,l,i,c,d);return"mfaPendingCredential"in m&&Rs(r,"multi-factor-auth-required",{_serverResponse:m}),m}async function Yf(r,l,i,c){const d=`${l}${i}?${c}`,m=r,h=m.config.emulator?yu(r.config,d):`${r.config.apiScheme}://${d}`;return YN.includes(i)&&(await m._persistenceManagerAvailable,m._getPersistenceType()==="COOKIE")?m._getPersistence()._getFinalTarget(h).toString():h}class KN{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(l){this.auth=l,this.timer=null,this.promise=new Promise((i,c)=>{this.timer=setTimeout(()=>c(fs(this.auth,"network-request-failed")),XN.get())})}}function Qi(r,l,i){const c={appName:r.name};i.email&&(c.email=i.email),i.phoneNumber&&(c.phoneNumber=i.phoneNumber);const d=fs(r,l,c);return d.customData._tokenResponse=i,d}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function QN(r,l){return yl(r,"POST","/v1/accounts:delete",l)}async function mo(r,l){return yl(r,"POST","/v1/accounts:lookup",l)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function vr(r){if(r)try{const l=new Date(Number(r));if(!isNaN(l.getTime()))return l.toUTCString()}catch{}}async function JN(r,l=!1){const i=qa(r),c=await i.getIdToken(l),d=ju(c);ye(d&&d.exp&&d.auth_time&&d.iat,i.auth,"internal-error");const m=typeof d.firebase=="object"?d.firebase:void 0,h=m==null?void 0:m.sign_in_provider;return{claims:d,token:c,authTime:vr(qd(d.auth_time)),issuedAtTime:vr(qd(d.iat)),expirationTime:vr(qd(d.exp)),signInProvider:h||null,signInSecondFactor:(m==null?void 0:m.sign_in_second_factor)||null}}function qd(r){return Number(r)*1e3}function ju(r){const[l,i,c]=r.split(".");if(l===void 0||i===void 0||c===void 0)return ao("JWT malformed, contained fewer than 3 sections"),null;try{const d=Df(i);return d?JSON.parse(d):(ao("Failed to decode base64 JWT payload"),null)}catch(d){return ao("Caught error parsing JWT payload as JSON",d==null?void 0:d.toString()),null}}function Jh(r){const l=ju(r);return ye(l,"internal-error"),ye(typeof l.exp<"u","internal-error"),ye(typeof l.iat<"u","internal-error"),Number(l.exp)-Number(l.iat)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Tr(r,l,i=!1){if(i)return l;try{return await l}catch(c){throw c instanceof Ga&&WN(c)&&r.auth.currentUser===r&&await r.auth.signOut(),c}}function WN({code:r}){return r==="auth/user-disabled"||r==="auth/user-token-expired"}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ej{constructor(l){this.user=l,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(l){if(l){const i=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),i}else{this.errorBackoff=3e4;const c=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,c)}}schedule(l=!1){if(!this.isRunning)return;const i=this.getInterval(l);this.timerId=setTimeout(async()=>{await this.iteration()},i)}async iteration(){try{await this.user.getIdToken(!0)}catch(l){(l==null?void 0:l.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class iu{constructor(l,i){this.createdAt=l,this.lastLoginAt=i,this._initializeTime()}_initializeTime(){this.lastSignInTime=vr(this.lastLoginAt),this.creationTime=vr(this.createdAt)}_copy(l){this.createdAt=l.createdAt,this.lastLoginAt=l.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function xo(r){var j;const l=r.auth,i=await r.getIdToken(),c=await Tr(r,mo(l,{idToken:i}));ye(c==null?void 0:c.users.length,l,"internal-error");const d=c.users[0];r._notifyReloadListener(d);const m=(j=d.providerUserInfo)!=null&&j.length?Xf(d.providerUserInfo):[],h=sj(r.providerData,m),g=r.isAnonymous,p=!(r.email&&d.passwordHash)&&!(h!=null&&h.length),f=g?p:!1,N={uid:d.localId,displayName:d.displayName||null,photoURL:d.photoUrl||null,email:d.email||null,emailVerified:d.emailVerified||!1,phoneNumber:d.phoneNumber||null,tenantId:d.tenantId||null,providerData:h,metadata:new iu(d.createdAt,d.lastLoginAt),isAnonymous:f};Object.assign(r,N)}async function tj(r){const l=qa(r);await xo(l),await l.auth._persistUserIfCurrent(l),l.auth._notifyListenersIfCurrent(l)}function sj(r,l){return[...r.filter(c=>!l.some(d=>d.providerId===c.providerId)),...l]}function Xf(r){return r.map(({providerId:l,...i})=>({providerId:l,uid:i.rawId||"",displayName:i.displayName||null,email:i.email||null,phoneNumber:i.phoneNumber||null,photoURL:i.photoUrl||null}))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function aj(r,l){const i=await Ff(r,{},async()=>{const c=Or({grant_type:"refresh_token",refresh_token:l}).slice(1),{tokenApiHost:d,apiKey:m}=r.config,h=await Yf(r,d,"/v1/token",`key=${m}`),g=await r._getAdditionalHeaders();g["Content-Type"]="application/x-www-form-urlencoded";const p={method:"POST",headers:g,body:c};return r.emulatorConfig&&pu(r.emulatorConfig.host)&&(p.credentials="include"),qf.fetch()(h,p)});return{accessToken:i.access_token,expiresIn:i.expires_in,refreshToken:i.refresh_token}}async function nj(r,l){return yl(r,"POST","/v2/accounts:revokeToken",Nu(r,l))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ll{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(l){ye(l.idToken,"internal-error"),ye(typeof l.idToken<"u","internal-error"),ye(typeof l.refreshToken<"u","internal-error");const i="expiresIn"in l&&typeof l.expiresIn<"u"?Number(l.expiresIn):Jh(l.idToken);this.updateTokensAndExpiration(l.idToken,l.refreshToken,i)}updateFromIdToken(l){ye(l.length!==0,"internal-error");const i=Jh(l);this.updateTokensAndExpiration(l,null,i)}async getToken(l,i=!1){return!i&&this.accessToken&&!this.isExpired?this.accessToken:(ye(this.refreshToken,l,"user-token-expired"),this.refreshToken?(await this.refresh(l,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(l,i){const{accessToken:c,refreshToken:d,expiresIn:m}=await aj(l,i);this.updateTokensAndExpiration(c,d,Number(m))}updateTokensAndExpiration(l,i,c){this.refreshToken=i||null,this.accessToken=l||null,this.expirationTime=Date.now()+c*1e3}static fromJSON(l,i){const{refreshToken:c,accessToken:d,expirationTime:m}=i,h=new ll;return c&&(ye(typeof c=="string","internal-error",{appName:l}),h.refreshToken=c),d&&(ye(typeof d=="string","internal-error",{appName:l}),h.accessToken=d),m&&(ye(typeof m=="number","internal-error",{appName:l}),h.expirationTime=m),h}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(l){this.accessToken=l.accessToken,this.refreshToken=l.refreshToken,this.expirationTime=l.expirationTime}_clone(){return Object.assign(new ll,this.toJSON())}_performRefresh(){return ea("not implemented")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Ma(r,l){ye(typeof r=="string"||typeof r>"u","internal-error",{appName:l})}class hs{constructor({uid:l,auth:i,stsTokenManager:c,...d}){this.providerId="firebase",this.proactiveRefresh=new ej(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=l,this.auth=i,this.stsTokenManager=c,this.accessToken=c.accessToken,this.displayName=d.displayName||null,this.email=d.email||null,this.emailVerified=d.emailVerified||!1,this.phoneNumber=d.phoneNumber||null,this.photoURL=d.photoURL||null,this.isAnonymous=d.isAnonymous||!1,this.tenantId=d.tenantId||null,this.providerData=d.providerData?[...d.providerData]:[],this.metadata=new iu(d.createdAt||void 0,d.lastLoginAt||void 0)}async getIdToken(l){const i=await Tr(this,this.stsTokenManager.getToken(this.auth,l));return ye(i,this.auth,"internal-error"),this.accessToken!==i&&(this.accessToken=i,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),i}getIdTokenResult(l){return JN(this,l)}reload(){return tj(this)}_assign(l){this!==l&&(ye(this.uid===l.uid,this.auth,"internal-error"),this.displayName=l.displayName,this.photoURL=l.photoURL,this.email=l.email,this.emailVerified=l.emailVerified,this.phoneNumber=l.phoneNumber,this.isAnonymous=l.isAnonymous,this.tenantId=l.tenantId,this.providerData=l.providerData.map(i=>({...i})),this.metadata._copy(l.metadata),this.stsTokenManager._assign(l.stsTokenManager))}_clone(l){const i=new hs({...this,auth:l,stsTokenManager:this.stsTokenManager._clone()});return i.metadata._copy(this.metadata),i}_onReload(l){ye(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=l,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(l){this.reloadListener?this.reloadListener(l):this.reloadUserInfo=l}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(l,i=!1){let c=!1;l.idToken&&l.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(l),c=!0),i&&await xo(this),await this.auth._persistUserIfCurrent(this),c&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(js(this.auth.app))return Promise.reject(hn(this.auth));const l=await this.getIdToken();return await Tr(this,QN(this.auth,{idToken:l})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(l=>({...l})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(l,i){const c=i.displayName??void 0,d=i.email??void 0,m=i.phoneNumber??void 0,h=i.photoURL??void 0,g=i.tenantId??void 0,p=i._redirectEventId??void 0,f=i.createdAt??void 0,N=i.lastLoginAt??void 0,{uid:j,emailVerified:L,isAnonymous:R,providerData:E,stsTokenManager:z}=i;ye(j&&z,l,"internal-error");const H=ll.fromJSON(this.name,z);ye(typeof j=="string",l,"internal-error"),Ma(c,l.name),Ma(d,l.name),ye(typeof L=="boolean",l,"internal-error"),ye(typeof R=="boolean",l,"internal-error"),Ma(m,l.name),Ma(h,l.name),Ma(g,l.name),Ma(p,l.name),Ma(f,l.name),Ma(N,l.name);const q=new hs({uid:j,auth:l,email:d,emailVerified:L,displayName:c,isAnonymous:R,photoURL:h,phoneNumber:m,tenantId:g,stsTokenManager:H,createdAt:f,lastLoginAt:N});return E&&Array.isArray(E)&&(q.providerData=E.map(I=>({...I}))),p&&(q._redirectEventId=p),q}static async _fromIdTokenResponse(l,i,c=!1){const d=new ll;d.updateFromServerResponse(i);const m=new hs({uid:i.localId,auth:l,stsTokenManager:d,isAnonymous:c});return await xo(m),m}static async _fromGetAccountInfoResponse(l,i,c){const d=i.users[0];ye(d.localId!==void 0,"internal-error");const m=d.providerUserInfo!==void 0?Xf(d.providerUserInfo):[],h=!(d.email&&d.passwordHash)&&!(m!=null&&m.length),g=new ll;g.updateFromIdToken(c);const p=new hs({uid:d.localId,auth:l,stsTokenManager:g,isAnonymous:h}),f={uid:d.localId,displayName:d.displayName||null,photoURL:d.photoUrl||null,email:d.email||null,emailVerified:d.emailVerified||!1,phoneNumber:d.phoneNumber||null,tenantId:d.tenantId||null,providerData:m,metadata:new iu(d.createdAt,d.lastLoginAt),isAnonymous:!(d.email&&d.passwordHash)&&!(m!=null&&m.length)};return Object.assign(p,f),p}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Wh=new Map;function ta(r){ra(r instanceof Function,"Expected a class definition");let l=Wh.get(r);return l?(ra(l instanceof r,"Instance stored in cache mismatched with class"),l):(l=new r,Wh.set(r,l),l)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Zf{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(l,i){this.storage[l]=i}async _get(l){const i=this.storage[l];return i===void 0?null:i}async _remove(l){delete this.storage[l]}_addListener(l,i){}_removeListener(l,i){}}Zf.type="NONE";const ef=Zf;/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function no(r,l,i){return`firebase:${r}:${l}:${i}`}class rl{constructor(l,i,c){this.persistence=l,this.auth=i,this.userKey=c;const{config:d,name:m}=this.auth;this.fullUserKey=no(this.userKey,d.apiKey,m),this.fullPersistenceKey=no("persistence",d.apiKey,m),this.boundEventHandler=i._onStorageEvent.bind(i),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(l){return this.persistence._set(this.fullUserKey,l.toJSON())}async getCurrentUser(){const l=await this.persistence._get(this.fullUserKey);if(!l)return null;if(typeof l=="string"){const i=await mo(this.auth,{idToken:l}).catch(()=>{});return i?hs._fromGetAccountInfoResponse(this.auth,i,l):null}return hs._fromJSON(this.auth,l)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(l){if(this.persistence===l)return;const i=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=l,i)return this.setCurrentUser(i)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(l,i,c="authUser"){if(!i.length)return new rl(ta(ef),l,c);const d=(await Promise.all(i.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let m=d[0]||ta(ef);const h=no(c,l.config.apiKey,l.name);let g=null;for(const f of i)try{const N=await f._get(h);if(N){let j;if(typeof N=="string"){const L=await mo(l,{idToken:N}).catch(()=>{});if(!L)break;j=await hs._fromGetAccountInfoResponse(l,L,N)}else j=hs._fromJSON(l,N);f!==m&&(g=j),m=f;break}}catch{}const p=d.filter(f=>f._shouldAllowMigration);return!m._shouldAllowMigration||!p.length?new rl(m,l,c):(m=p[0],g&&await m._set(h,g.toJSON()),await Promise.all(i.map(async f=>{if(f!==m)try{await f._remove(h)}catch{}})),new rl(m,l,c))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function tf(r){const l=r.toLowerCase();if(l.includes("opera/")||l.includes("opr/")||l.includes("opios/"))return"Opera";if(Wf(l))return"IEMobile";if(l.includes("msie")||l.includes("trident/"))return"IE";if(l.includes("edge/"))return"Edge";if(Kf(l))return"Firefox";if(l.includes("silk/"))return"Silk";if(tp(l))return"Blackberry";if(sp(l))return"Webos";if(Qf(l))return"Safari";if((l.includes("chrome/")||Jf(l))&&!l.includes("edge/"))return"Chrome";if(ep(l))return"Android";{const i=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,c=r.match(i);if((c==null?void 0:c.length)===2)return c[1]}return"Other"}function Kf(r=wt()){return/firefox\//i.test(r)}function Qf(r=wt()){const l=r.toLowerCase();return l.includes("safari/")&&!l.includes("chrome/")&&!l.includes("crios/")&&!l.includes("android")}function Jf(r=wt()){return/crios\//i.test(r)}function Wf(r=wt()){return/iemobile/i.test(r)}function ep(r=wt()){return/android/i.test(r)}function tp(r=wt()){return/blackberry/i.test(r)}function sp(r=wt()){return/webos/i.test(r)}function Su(r=wt()){return/iphone|ipad|ipod/i.test(r)||/macintosh/i.test(r)&&/mobile/i.test(r)}function lj(r=wt()){var l;return Su(r)&&!!((l=window.navigator)!=null&&l.standalone)}function rj(){return yy()&&document.documentMode===10}function ap(r=wt()){return Su(r)||ep(r)||sp(r)||tp(r)||/windows phone/i.test(r)||Wf(r)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function np(r,l=[]){let i;switch(r){case"Browser":i=tf(wt());break;case"Worker":i=`${tf(wt())}-${r}`;break;default:i=r}const c=l.length?l.join(","):"FirebaseCore-web";return`${i}/JsCore/${Dr}/${c}`}/** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ij{constructor(l){this.auth=l,this.queue=[]}pushCallback(l,i){const c=m=>new Promise((h,g)=>{try{const p=l(m);h(p)}catch(p){g(p)}});c.onAbort=i,this.queue.push(c);const d=this.queue.length-1;return()=>{this.queue[d]=()=>Promise.resolve()}}async runMiddleware(l){if(this.auth.currentUser===l)return;const i=[];try{for(const c of this.queue)await c(l),c.onAbort&&i.push(c.onAbort)}catch(c){i.reverse();for(const d of i)try{d()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:c==null?void 0:c.message})}}}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function oj(r,l={}){return yl(r,"GET","/v2/passwordPolicy",Nu(r,l))}/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const cj=6;class dj{constructor(l){var c;const i=l.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=i.minPasswordLength??cj,i.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=i.maxPasswordLength),i.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=i.containsLowercaseCharacter),i.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=i.containsUppercaseCharacter),i.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=i.containsNumericCharacter),i.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=i.containsNonAlphanumericCharacter),this.enforcementState=l.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((c=l.allowedNonAlphanumericCharacters)==null?void 0:c.join(""))??"",this.forceUpgradeOnSignin=l.forceUpgradeOnSignin??!1,this.schemaVersion=l.schemaVersion}validatePassword(l){const i={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(l,i),this.validatePasswordCharacterOptions(l,i),i.isValid&&(i.isValid=i.meetsMinPasswordLength??!0),i.isValid&&(i.isValid=i.meetsMaxPasswordLength??!0),i.isValid&&(i.isValid=i.containsLowercaseLetter??!0),i.isValid&&(i.isValid=i.containsUppercaseLetter??!0),i.isValid&&(i.isValid=i.containsNumericCharacter??!0),i.isValid&&(i.isValid=i.containsNonAlphanumericCharacter??!0),i}validatePasswordLengthOptions(l,i){const c=this.customStrengthOptions.minPasswordLength,d=this.customStrengthOptions.maxPasswordLength;c&&(i.meetsMinPasswordLength=l.length>=c),d&&(i.meetsMaxPasswordLength=l.length<=d)}validatePasswordCharacterOptions(l,i){this.updatePasswordCharacterOptionsStatuses(i,!1,!1,!1,!1);let c;for(let d=0;d="a"&&c<="z",c>="A"&&c<="Z",c>="0"&&c<="9",this.allowedNonAlphanumericCharacters.includes(c))}updatePasswordCharacterOptionsStatuses(l,i,c,d,m){this.customStrengthOptions.containsLowercaseLetter&&(l.containsLowercaseLetter||(l.containsLowercaseLetter=i)),this.customStrengthOptions.containsUppercaseLetter&&(l.containsUppercaseLetter||(l.containsUppercaseLetter=c)),this.customStrengthOptions.containsNumericCharacter&&(l.containsNumericCharacter||(l.containsNumericCharacter=d)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(l.containsNonAlphanumericCharacter||(l.containsNonAlphanumericCharacter=m))}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class uj{constructor(l,i,c,d){this.app=l,this.heartbeatServiceProvider=i,this.appCheckServiceProvider=c,this.config=d,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new sf(this),this.idTokenSubscription=new sf(this),this.beforeStateQueue=new ij(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Hf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=l.name,this.clientVersion=d.sdkClientVersion,this._persistenceManagerAvailable=new Promise(m=>this._resolvePersistenceManagerAvailable=m)}_initializeWithPersistence(l,i){return i&&(this._popupRedirectResolver=ta(i)),this._initializationPromise=this.queue(async()=>{var c,d,m;if(!this._deleted&&(this.persistenceManager=await rl.create(this,l),(c=this._resolvePersistenceManagerAvailable)==null||c.call(this),!this._deleted)){if((d=this._popupRedirectResolver)!=null&&d._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(i),this.lastNotifiedUid=((m=this.currentUser)==null?void 0:m.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const l=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!l)){if(this.currentUser&&l&&this.currentUser.uid===l.uid){this._currentUser._assign(l),await this.currentUser.getIdToken();return}await this._updateCurrentUser(l,!0)}}async initializeCurrentUserFromIdToken(l){try{const i=await mo(this,{idToken:l}),c=await hs._fromGetAccountInfoResponse(this,i,l);await this.directlySetCurrentUser(c)}catch(i){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",i),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(l){var m;if(js(this.app)){const h=this.app.settings.authIdToken;return h?new Promise(g=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(h).then(g,g))}):this.directlySetCurrentUser(null)}const i=await this.assertedPersistence.getCurrentUser();let c=i,d=!1;if(l&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const h=(m=this.redirectUser)==null?void 0:m._redirectEventId,g=c==null?void 0:c._redirectEventId,p=await this.tryRedirectSignIn(l);(!h||h===g)&&(p!=null&&p.user)&&(c=p.user,d=!0)}if(!c)return this.directlySetCurrentUser(null);if(!c._redirectEventId){if(d)try{await this.beforeStateQueue.runMiddleware(c)}catch(h){c=i,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(h))}return c?this.reloadAndSetCurrentUserOrClear(c):this.directlySetCurrentUser(null)}return ye(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===c._redirectEventId?this.directlySetCurrentUser(c):this.reloadAndSetCurrentUserOrClear(c)}async tryRedirectSignIn(l){let i=null;try{i=await this._popupRedirectResolver._completeRedirectFn(this,l,!0)}catch{await this._setRedirectUser(null)}return i}async reloadAndSetCurrentUserOrClear(l){try{await xo(l)}catch(i){if((i==null?void 0:i.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(l)}useDeviceLanguage(){this.languageCode=qN()}async _delete(){this._deleted=!0}async updateCurrentUser(l){if(js(this.app))return Promise.reject(hn(this));const i=l?qa(l):null;return i&&ye(i.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(i&&i._clone(this))}async _updateCurrentUser(l,i=!1){if(!this._deleted)return l&&ye(this.tenantId===l.tenantId,this,"tenant-id-mismatch"),i||await this.beforeStateQueue.runMiddleware(l),this.queue(async()=>{await this.directlySetCurrentUser(l),this.notifyAuthListeners()})}async signOut(){return js(this.app)?Promise.reject(hn(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(l){return js(this.app)?Promise.reject(hn(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(ta(l))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(l){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const i=this._getPasswordPolicyInternal();return i.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):i.validatePassword(l)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const l=await oj(this),i=new dj(l);this.tenantId===null?this._projectPasswordPolicy=i:this._tenantPasswordPolicies[this.tenantId]=i}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(l){this._errorFactory=new _r("auth","Firebase",l())}onAuthStateChanged(l,i,c){return this.registerStateListener(this.authStateSubscription,l,i,c)}beforeAuthStateChanged(l,i){return this.beforeStateQueue.pushCallback(l,i)}onIdTokenChanged(l,i,c){return this.registerStateListener(this.idTokenSubscription,l,i,c)}authStateReady(){return new Promise((l,i)=>{if(this.currentUser)l();else{const c=this.onAuthStateChanged(()=>{c(),l()},i)}})}async revokeAccessToken(l){if(this.currentUser){const i=await this.currentUser.getIdToken(),c={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:l,idToken:i};this.tenantId!=null&&(c.tenantId=this.tenantId),await nj(this,c)}}toJSON(){var l;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(l=this._currentUser)==null?void 0:l.toJSON()}}async _setRedirectUser(l,i){const c=await this.getOrInitRedirectPersistenceManager(i);return l===null?c.removeCurrentUser():c.setCurrentUser(l)}async getOrInitRedirectPersistenceManager(l){if(!this.redirectPersistenceManager){const i=l&&ta(l)||this._popupRedirectResolver;ye(i,this,"argument-error"),this.redirectPersistenceManager=await rl.create(this,[ta(i._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(l){var i,c;return this._isInitialized&&await this.queue(async()=>{}),((i=this._currentUser)==null?void 0:i._redirectEventId)===l?this._currentUser:((c=this.redirectUser)==null?void 0:c._redirectEventId)===l?this.redirectUser:null}async _persistUserIfCurrent(l){if(l===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(l))}_notifyListenersIfCurrent(l){l===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var i;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const l=((i=this.currentUser)==null?void 0:i.uid)??null;this.lastNotifiedUid!==l&&(this.lastNotifiedUid=l,this.authStateSubscription.next(this.currentUser))}registerStateListener(l,i,c,d){if(this._deleted)return()=>{};const m=typeof i=="function"?i:i.next.bind(i);let h=!1;const g=this._isInitialized?Promise.resolve():this._initializationPromise;if(ye(g,this,"internal-error"),g.then(()=>{h||m(this.currentUser)}),typeof i=="function"){const p=l.addObserver(i,c,d);return()=>{h=!0,p()}}else{const p=l.addObserver(i);return()=>{h=!0,p()}}}async directlySetCurrentUser(l){this.currentUser&&this.currentUser!==l&&this._currentUser._stopProactiveRefresh(),l&&this.isProactiveRefreshEnabled&&l._startProactiveRefresh(),this.currentUser=l,l?await this.assertedPersistence.setCurrentUser(l):await this.assertedPersistence.removeCurrentUser()}queue(l){return this.operations=this.operations.then(l,l),this.operations}get assertedPersistence(){return ye(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(l){!l||this.frameworks.includes(l)||(this.frameworks.push(l),this.frameworks.sort(),this.clientVersion=np(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var d;const l={"X-Client-Version":this.clientVersion};this.app.options.appId&&(l["X-Firebase-gmpid"]=this.app.options.appId);const i=await((d=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:d.getHeartbeatsHeader());i&&(l["X-Firebase-Client"]=i);const c=await this._getAppCheckToken();return c&&(l["X-Firebase-AppCheck"]=c),l}async _getAppCheckToken(){var i;if(js(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const l=await((i=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:i.getToken());return l!=null&&l.error&&Gf(`Error while retrieving App Check token: ${l.error}`),l==null?void 0:l.token}}function yo(r){return qa(r)}class sf{constructor(l){this.auth=l,this.observer=null,this.addObserver=Ty(i=>this.observer=i)}get next(){return ye(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */let wu={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function mj(r){wu=r}function xj(r){return wu.loadJS(r)}function hj(){return wu.gapiScript}function fj(r){return`__${r}${Math.floor(Math.random()*1e6)}`}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function pj(r,l){const i=Uf(r,"auth");if(i.isInitialized()){const d=i.getImmediate(),m=i.getOptions();if(hl(m,l??{}))return d;Rs(d,"already-initialized")}return i.initialize({options:l})}function bj(r,l){const i=(l==null?void 0:l.persistence)||[],c=(Array.isArray(i)?i:[i]).map(ta);l!=null&&l.errorMap&&r._updateErrorMap(l.errorMap),r._initializeWithPersistence(c,l==null?void 0:l.popupRedirectResolver)}function gj(r,l,i){const c=yo(r);ye(/^https?:\/\//.test(l),c,"invalid-emulator-scheme");const d=!1,m=lp(l),{host:h,port:g}=vj(l),p=g===null?"":`:${g}`,f={url:`${m}//${h}${p}/`},N=Object.freeze({host:h,port:g,protocol:m.replace(":",""),options:Object.freeze({disableWarnings:d})});if(!c._canInitEmulator){ye(c.config.emulator&&c.emulatorConfig,c,"emulator-config-failed"),ye(hl(f,c.config.emulator)&&hl(N,c.emulatorConfig),c,"emulator-config-failed");return}c.config.emulator=f,c.emulatorConfig=N,c.settings.appVerificationDisabledForTesting=!0,pu(h)?Cy(`${m}//${h}${p}`):yj()}function lp(r){const l=r.indexOf(":");return l<0?"":r.substr(0,l+1)}function vj(r){const l=lp(r),i=/(\/\/)?([^?#/]+)/.exec(r.substr(l.length));if(!i)return{host:"",port:null};const c=i[2].split("@").pop()||"",d=/^(\[[^\]]+\])(:|$)/.exec(c);if(d){const m=d[1];return{host:m,port:af(c.substr(m.length+1))}}else{const[m,h]=c.split(":");return{host:m,port:af(h)}}}function af(r){if(!r)return null;const l=Number(r);return isNaN(l)?null:l}function yj(){function r(){const l=document.createElement("p"),i=l.style;l.innerText="Running in emulator mode. Do not use with production credentials.",i.position="fixed",i.width="100%",i.backgroundColor="#ffffff",i.border=".1em solid #000000",i.color="#b50000",i.bottom="0px",i.left="0px",i.margin="0px",i.zIndex="10000",i.textAlign="center",l.classList.add("firebase-emulator-warning"),document.body.appendChild(l)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",r):r())}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class rp{constructor(l,i){this.providerId=l,this.signInMethod=i}toJSON(){return ea("not implemented")}_getIdTokenResponse(l){return ea("not implemented")}_linkToIdToken(l,i){return ea("not implemented")}_getReauthenticationResolver(l){return ea("not implemented")}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function il(r,l){return ZN(r,"POST","/v1/accounts:signInWithIdp",Nu(r,l))}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Nj="http://localhost";class fn extends rp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(l){const i=new fn(l.providerId,l.signInMethod);return l.idToken||l.accessToken?(l.idToken&&(i.idToken=l.idToken),l.accessToken&&(i.accessToken=l.accessToken),l.nonce&&!l.pendingToken&&(i.nonce=l.nonce),l.pendingToken&&(i.pendingToken=l.pendingToken)):l.oauthToken&&l.oauthTokenSecret?(i.accessToken=l.oauthToken,i.secret=l.oauthTokenSecret):Rs("argument-error"),i}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(l){const i=typeof l=="string"?JSON.parse(l):l,{providerId:c,signInMethod:d,...m}=i;if(!c||!d)return null;const h=new fn(c,d);return h.idToken=m.idToken||void 0,h.accessToken=m.accessToken||void 0,h.secret=m.secret,h.nonce=m.nonce,h.pendingToken=m.pendingToken||null,h}_getIdTokenResponse(l){const i=this.buildRequest();return il(l,i)}_linkToIdToken(l,i){const c=this.buildRequest();return c.idToken=i,il(l,c)}_getReauthenticationResolver(l){const i=this.buildRequest();return i.autoCreate=!1,il(l,i)}buildRequest(){const l={requestUri:Nj,returnSecureToken:!0};if(this.pendingToken)l.pendingToken=this.pendingToken;else{const i={};this.idToken&&(i.id_token=this.idToken),this.accessToken&&(i.access_token=this.accessToken),this.secret&&(i.oauth_token_secret=this.secret),i.providerId=this.providerId,this.nonce&&!this.pendingToken&&(i.nonce=this.nonce),l.postBody=Or(i)}return l}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Au{constructor(l){this.providerId=l,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(l){this.defaultLanguageCode=l}setCustomParameters(l){return this.customParameters=l,this}getCustomParameters(){return this.customParameters}}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Mr extends Au{constructor(){super(...arguments),this.scopes=[]}addScope(l){return this.scopes.includes(l)||this.scopes.push(l),this}getScopes(){return[...this.scopes]}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class La extends Mr{constructor(){super("facebook.com")}static credential(l){return fn._fromParams({providerId:La.PROVIDER_ID,signInMethod:La.FACEBOOK_SIGN_IN_METHOD,accessToken:l})}static credentialFromResult(l){return La.credentialFromTaggedObject(l)}static credentialFromError(l){return La.credentialFromTaggedObject(l.customData||{})}static credentialFromTaggedObject({_tokenResponse:l}){if(!l||!("oauthAccessToken"in l)||!l.oauthAccessToken)return null;try{return La.credential(l.oauthAccessToken)}catch{return null}}}La.FACEBOOK_SIGN_IN_METHOD="facebook.com";La.PROVIDER_ID="facebook.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ss extends Mr{constructor(){super("google.com"),this.addScope("profile")}static credential(l,i){return fn._fromParams({providerId:Ss.PROVIDER_ID,signInMethod:Ss.GOOGLE_SIGN_IN_METHOD,idToken:l,accessToken:i})}static credentialFromResult(l){return Ss.credentialFromTaggedObject(l)}static credentialFromError(l){return Ss.credentialFromTaggedObject(l.customData||{})}static credentialFromTaggedObject({_tokenResponse:l}){if(!l)return null;const{oauthIdToken:i,oauthAccessToken:c}=l;if(!i&&!c)return null;try{return Ss.credential(i,c)}catch{return null}}}Ss.GOOGLE_SIGN_IN_METHOD="google.com";Ss.PROVIDER_ID="google.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Pa extends Mr{constructor(){super("github.com")}static credential(l){return fn._fromParams({providerId:Pa.PROVIDER_ID,signInMethod:Pa.GITHUB_SIGN_IN_METHOD,accessToken:l})}static credentialFromResult(l){return Pa.credentialFromTaggedObject(l)}static credentialFromError(l){return Pa.credentialFromTaggedObject(l.customData||{})}static credentialFromTaggedObject({_tokenResponse:l}){if(!l||!("oauthAccessToken"in l)||!l.oauthAccessToken)return null;try{return Pa.credential(l.oauthAccessToken)}catch{return null}}}Pa.GITHUB_SIGN_IN_METHOD="github.com";Pa.PROVIDER_ID="github.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Ia extends Mr{constructor(){super("twitter.com")}static credential(l,i){return fn._fromParams({providerId:Ia.PROVIDER_ID,signInMethod:Ia.TWITTER_SIGN_IN_METHOD,oauthToken:l,oauthTokenSecret:i})}static credentialFromResult(l){return Ia.credentialFromTaggedObject(l)}static credentialFromError(l){return Ia.credentialFromTaggedObject(l.customData||{})}static credentialFromTaggedObject({_tokenResponse:l}){if(!l)return null;const{oauthAccessToken:i,oauthTokenSecret:c}=l;if(!i||!c)return null;try{return Ia.credential(i,c)}catch{return null}}}Ia.TWITTER_SIGN_IN_METHOD="twitter.com";Ia.PROVIDER_ID="twitter.com";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class pl{constructor(l){this.user=l.user,this.providerId=l.providerId,this._tokenResponse=l._tokenResponse,this.operationType=l.operationType}static async _fromIdTokenResponse(l,i,c,d=!1){const m=await hs._fromIdTokenResponse(l,c,d),h=nf(c);return new pl({user:m,providerId:h,_tokenResponse:c,operationType:i})}static async _forOperation(l,i,c){await l._updateTokensIfNecessary(c,!0);const d=nf(c);return new pl({user:l,providerId:d,_tokenResponse:c,operationType:i})}}function nf(r){return r.providerId?r.providerId:"phoneNumber"in r?"phone":null}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class ho extends Ga{constructor(l,i,c,d){super(i.code,i.message),this.operationType=c,this.user=d,Object.setPrototypeOf(this,ho.prototype),this.customData={appName:l.name,tenantId:l.tenantId??void 0,_serverResponse:i.customData._serverResponse,operationType:c}}static _fromErrorAndOperation(l,i,c,d){return new ho(l,i,c,d)}}function ip(r,l,i,c){return(l==="reauthenticate"?i._getReauthenticationResolver(r):i._getIdTokenResponse(r)).catch(m=>{throw m.code==="auth/multi-factor-auth-required"?ho._fromErrorAndOperation(r,m,l,c):m})}async function jj(r,l,i=!1){const c=await Tr(r,l._linkToIdToken(r.auth,await r.getIdToken()),i);return pl._forOperation(r,"link",c)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function Sj(r,l,i=!1){const{auth:c}=r;if(js(c.app))return Promise.reject(hn(c));const d="reauthenticate";try{const m=await Tr(r,ip(c,d,l,r),i);ye(m.idToken,c,"internal-error");const h=ju(m.idToken);ye(h,c,"internal-error");const{sub:g}=h;return ye(r.uid===g,c,"user-mismatch"),pl._forOperation(r,d,m)}catch(m){throw(m==null?void 0:m.code)==="auth/user-not-found"&&Rs(c,"user-mismatch"),m}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function wj(r,l,i=!1){if(js(r.app))return Promise.reject(hn(r));const c="signIn",d=await ip(r,c,l),m=await pl._fromIdTokenResponse(r,c,d);return i||await r._updateCurrentUser(m.user),m}function Aj(r,l,i,c){return qa(r).onIdTokenChanged(l,i,c)}function Tj(r,l,i){return qa(r).beforeAuthStateChanged(l,i)}function Ej(r,l,i,c){return qa(r).onAuthStateChanged(l,i,c)}function Rj(r){return qa(r).signOut()}const fo="__sak";/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class op{constructor(l,i){this.storageRetriever=l,this.type=i}_isAvailable(){try{return this.storage?(this.storage.setItem(fo,"1"),this.storage.removeItem(fo),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(l,i){return this.storage.setItem(l,JSON.stringify(i)),Promise.resolve()}_get(l){const i=this.storage.getItem(l);return Promise.resolve(i?JSON.parse(i):null)}_remove(l){return this.storage.removeItem(l),Promise.resolve()}get storage(){return this.storageRetriever()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Cj=1e3,_j=10;class cp extends op{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(l,i)=>this.onStorageEvent(l,i),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=ap(),this._shouldAllowMigration=!0}forAllChangedKeys(l){for(const i of Object.keys(this.listeners)){const c=this.storage.getItem(i),d=this.localCache[i];c!==d&&l(i,d,c)}}onStorageEvent(l,i=!1){if(!l.key){this.forAllChangedKeys((h,g,p)=>{this.notifyListeners(h,p)});return}const c=l.key;i?this.detachListener():this.stopPolling();const d=()=>{const h=this.storage.getItem(c);!i&&this.localCache[c]===h||this.notifyListeners(c,h)},m=this.storage.getItem(c);rj()&&m!==l.newValue&&l.newValue!==l.oldValue?setTimeout(d,_j):d()}notifyListeners(l,i){this.localCache[l]=i;const c=this.listeners[l];if(c)for(const d of Array.from(c))d(i&&JSON.parse(i))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((l,i,c)=>{this.onStorageEvent(new StorageEvent("storage",{key:l,oldValue:i,newValue:c}),!0)})},Cj)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(l,i){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[l]||(this.listeners[l]=new Set,this.localCache[l]=this.storage.getItem(l)),this.listeners[l].add(i)}_removeListener(l,i){this.listeners[l]&&(this.listeners[l].delete(i),this.listeners[l].size===0&&delete this.listeners[l]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(l,i){await super._set(l,i),this.localCache[l]=JSON.stringify(i)}async _get(l){const i=await super._get(l);return this.localCache[l]=JSON.stringify(i),i}async _remove(l){await super._remove(l),delete this.localCache[l]}}cp.type="LOCAL";const Oj=cp;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class dp extends op{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(l,i){}_removeListener(l,i){}}dp.type="SESSION";const up=dp;/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Dj(r){return Promise.all(r.map(async l=>{try{return{fulfilled:!0,value:await l}}catch(i){return{fulfilled:!1,reason:i}}}))}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class No{constructor(l){this.eventTarget=l,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(l){const i=this.receivers.find(d=>d.isListeningto(l));if(i)return i;const c=new No(l);return this.receivers.push(c),c}isListeningto(l){return this.eventTarget===l}async handleEvent(l){const i=l,{eventId:c,eventType:d,data:m}=i.data,h=this.handlersMap[d];if(!(h!=null&&h.size))return;i.ports[0].postMessage({status:"ack",eventId:c,eventType:d});const g=Array.from(h).map(async f=>f(i.origin,m)),p=await Dj(g);i.ports[0].postMessage({status:"done",eventId:c,eventType:d,response:p})}_subscribe(l,i){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[l]||(this.handlersMap[l]=new Set),this.handlersMap[l].add(i)}_unsubscribe(l,i){this.handlersMap[l]&&i&&this.handlersMap[l].delete(i),(!i||this.handlersMap[l].size===0)&&delete this.handlersMap[l],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}No.receivers=[];/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function Tu(r="",l=10){let i="";for(let c=0;c{const f=Tu("",20);d.port1.start();const N=setTimeout(()=>{p(new Error("unsupported_event"))},c);h={messageChannel:d,onMessage(j){const L=j;if(L.data.eventId===f)switch(L.data.status){case"ack":clearTimeout(N),m=setTimeout(()=>{p(new Error("timeout"))},3e3);break;case"done":clearTimeout(m),g(L.data.response);break;default:clearTimeout(N),clearTimeout(m),p(new Error("invalid_response"));break}}},this.handlers.add(h),d.port1.addEventListener("message",h.onMessage),this.target.postMessage({eventType:l,eventId:f,data:i},[d.port2])}).finally(()=>{h&&this.removeMessageHandler(h)})}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function ws(){return window}function Mj(r){ws().location.href=r}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function mp(){return typeof ws().WorkerGlobalScope<"u"&&typeof ws().importScripts=="function"}async function Lj(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Pj(){var r;return((r=navigator==null?void 0:navigator.serviceWorker)==null?void 0:r.controller)||null}function Ij(){return mp()?self:null}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const xp="firebaseLocalStorageDb",Uj=1,po="firebaseLocalStorage",hp="fbase_key";class Lr{constructor(l){this.request=l}toPromise(){return new Promise((l,i)=>{this.request.addEventListener("success",()=>{l(this.request.result)}),this.request.addEventListener("error",()=>{i(this.request.error)})})}}function jo(r,l){return r.transaction([po],l?"readwrite":"readonly").objectStore(po)}function zj(){const r=indexedDB.deleteDatabase(xp);return new Lr(r).toPromise()}function fp(){const r=indexedDB.open(xp,Uj);return new Promise((l,i)=>{r.addEventListener("error",()=>{i(r.error)}),r.addEventListener("upgradeneeded",()=>{const c=r.result;try{c.createObjectStore(po,{keyPath:hp})}catch(d){i(d)}}),r.addEventListener("success",async()=>{const c=r.result;c.objectStoreNames.contains(po)?l(c):(c.close(),await zj(),l(await fp()))})})}async function lf(r,l,i){const c=jo(r,!0).put({[hp]:l,value:i});return new Lr(c).toPromise()}async function $j(r,l){const i=jo(r,!1).get(l),c=await new Lr(i).toPromise();return c===void 0?null:c.value}function rf(r,l){const i=jo(r,!0).delete(l);return new Lr(i).toPromise()}const Vj=800,Bj=3;class pp{registerLifecycleListeners(){typeof window<"u"&&typeof window.addEventListener=="function"&&(window.addEventListener("pagehide",this.onPageHide),window.addEventListener("pageshow",this.onPageShow))}unregisterLifecycleListeners(){typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("pagehide",this.onPageHide),window.removeEventListener("pageshow",this.onPageShow))}constructor(){this.type="LOCAL",this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.isClosing=!1,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this.onPageHide=()=>{this.isClosing=!0,this.stopPolling(),this.dbPromise&&(this.dbPromise.then(l=>l.close()).catch(()=>{}),this.dbPromise=null)},this.onPageShow=()=>{this.isClosing&&(this.isClosing=!1,Object.keys(this.listeners).length>0&&this.startPolling())},this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){if(this.isClosing)throw new Error("Database is closing");return this.dbPromise?this.dbPromise:(this.dbPromise=fp(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(l){let i=0;for(;;)try{const c=await this._openDb();return await l(c)}catch(c){if(this.isClosing||i++>Bj)throw c;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return mp()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=No._getInstance(Ij()),this.receiver._subscribe("keyChanged",async(l,i)=>({keyProcessed:(await this._poll()).includes(i.key)})),this.receiver._subscribe("ping",async(l,i)=>["keyChanged"])}async initializeSender(){var i,c;if(this.activeServiceWorker=await Lj(),!this.activeServiceWorker)return;this.sender=new kj(this.activeServiceWorker);const l=await this.sender._send("ping",{},800);l&&(i=l[0])!=null&&i.fulfilled&&(c=l[0])!=null&&c.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(l){if(!(!this.sender||!this.activeServiceWorker||Pj()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:l},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async l=>{await lf(l,fo,"1"),await rf(l,fo)}),!0):!1}catch{}return!1}async _withPendingWrite(l){this.pendingWrites++;try{await l()}finally{this.pendingWrites--}}async _set(l,i){return this._withPendingWrite(async()=>(await this._withRetries(c=>lf(c,l,i)),this.localCache[l]=i,this.notifyServiceWorker(l)))}async _get(l){const i=await this._withRetries(c=>$j(c,l));return this.localCache[l]=i,i}async _remove(l){return this._withPendingWrite(async()=>(await this._withRetries(i=>rf(i,l)),delete this.localCache[l],this.notifyServiceWorker(l)))}async _poll(){if(this.isClosing)return[];try{const l=await this._withRetries(d=>{const m=jo(d,!1).getAll();return new Lr(m).toPromise()});if(this.isClosing)return[];if(!l)return[];if(this.pendingWrites!==0)return[];const i=[],c=new Set;if(l.length!==0)for(const{fbase_key:d,value:m}of l)c.add(d),JSON.stringify(this.localCache[d])!==JSON.stringify(m)&&(this.notifyListeners(d,m),i.push(d));for(const d of Object.keys(this.localCache))this.localCache[d]&&!c.has(d)&&(this.notifyListeners(d,null),i.push(d));return i}catch(l){return this.isClosing||Gf(`Firebase Auth cross-tab polling failed with error: ${l}`),[]}}notifyListeners(l,i){this.localCache[l]=i;const c=this.listeners[l];if(c)for(const d of Array.from(c))d(i)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Vj)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(l,i){Object.keys(this.listeners).length===0&&(this.startPolling(),this.registerLifecycleListeners()),this.listeners[l]||(this.listeners[l]=new Set,this._get(l)),this.listeners[l].add(i)}_removeListener(l,i){this.listeners[l]&&(this.listeners[l].delete(i),this.listeners[l].size===0&&delete this.listeners[l]),Object.keys(this.listeners).length===0&&(this.stopPolling(),this.unregisterLifecycleListeners())}}pp.type="LOCAL";const Hj=pp;new kr(3e4,6e4);/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function bp(r,l){return l?ta(l):(ye(r._popupRedirectResolver,r,"argument-error"),r._popupRedirectResolver)}/** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class Eu extends rp{constructor(l){super("custom","custom"),this.params=l}_getIdTokenResponse(l){return il(l,this._buildIdpRequest())}_linkToIdToken(l,i){return il(l,this._buildIdpRequest(i))}_getReauthenticationResolver(l){return il(l,this._buildIdpRequest())}_buildIdpRequest(l){const i={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return l&&(i.idToken=l),i}}function Gj(r){return wj(r.auth,new Eu(r),r.bypassAuthState)}function qj(r){const{auth:l,user:i}=r;return ye(i,l,"internal-error"),Sj(i,new Eu(r),r.bypassAuthState)}async function Fj(r){const{auth:l,user:i}=r;return ye(i,l,"internal-error"),jj(i,new Eu(r),r.bypassAuthState)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class gp{constructor(l,i,c,d,m=!1){this.auth=l,this.resolver=c,this.user=d,this.bypassAuthState=m,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(i)?i:[i]}execute(){return new Promise(async(l,i)=>{this.pendingPromise={resolve:l,reject:i};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(c){this.reject(c)}})}async onAuthEvent(l){const{urlResponse:i,sessionId:c,postBody:d,tenantId:m,error:h,type:g}=l;if(h){this.reject(h);return}const p={auth:this.auth,requestUri:i,sessionId:c,tenantId:m||void 0,postBody:d||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(g)(p))}catch(f){this.reject(f)}}onError(l){this.reject(l)}getIdpTask(l){switch(l){case"signInViaPopup":case"signInViaRedirect":return Gj;case"linkViaPopup":case"linkViaRedirect":return Fj;case"reauthViaPopup":case"reauthViaRedirect":return qj;default:Rs(this.auth,"internal-error")}}resolve(l){ra(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(l),this.unregisterAndCleanUp()}reject(l){ra(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(l),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Yj=new kr(2e3,1e4);async function Xj(r,l,i){if(js(r.app))return Promise.reject(fs(r,"operation-not-supported-in-this-environment"));const c=yo(r);BN(r,l,Au);const d=bp(c,i);return new xn(c,"signInViaPopup",l,d).executeNotNull()}class xn extends gp{constructor(l,i,c,d,m){super(l,i,d,m),this.provider=c,this.authWindow=null,this.pollId=null,xn.currentPopupAction&&xn.currentPopupAction.cancel(),xn.currentPopupAction=this}async executeNotNull(){const l=await this.execute();return ye(l,this.auth,"internal-error"),l}async onExecution(){ra(this.filter.length===1,"Popup operations only handle one event");const l=Tu();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],l),this.authWindow.associatedEvent=l,this.resolver._originValidation(this.auth).catch(i=>{this.reject(i)}),this.resolver._isIframeWebStorageSupported(this.auth,i=>{i||this.reject(fs(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var l;return((l=this.authWindow)==null?void 0:l.associatedEvent)||null}cancel(){this.reject(fs(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,xn.currentPopupAction=null}pollUserCancellation(){const l=()=>{var i,c;if((c=(i=this.authWindow)==null?void 0:i.window)!=null&&c.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(fs(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(l,Yj.get())};l()}}xn.currentPopupAction=null;/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Zj="pendingRedirect",lo=new Map;class Kj extends gp{constructor(l,i,c=!1){super(l,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],i,void 0,c),this.eventId=null}async execute(){let l=lo.get(this.auth._key());if(!l){try{const c=await Qj(this.resolver,this.auth)?await super.execute():null;l=()=>Promise.resolve(c)}catch(i){l=()=>Promise.reject(i)}lo.set(this.auth._key(),l)}return this.bypassAuthState||lo.set(this.auth._key(),()=>Promise.resolve(null)),l()}async onAuthEvent(l){if(l.type==="signInViaRedirect")return super.onAuthEvent(l);if(l.type==="unknown"){this.resolve(null);return}if(l.eventId){const i=await this.auth._redirectUserForId(l.eventId);if(i)return this.user=i,super.onAuthEvent(l);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function Qj(r,l){const i=e5(l),c=Wj(r);if(!await c._isAvailable())return!1;const d=await c._get(i)==="true";return await c._remove(i),d}function Jj(r,l){lo.set(r._key(),l)}function Wj(r){return ta(r._redirectPersistence)}function e5(r){return no(Zj,r.config.apiKey,r.name)}async function t5(r,l,i=!1){if(js(r.app))return Promise.reject(hn(r));const c=yo(r),d=bp(c,l),h=await new Kj(c,d,i).execute();return h&&!i&&(delete h.user._redirectEventId,await c._persistUserIfCurrent(h.user),await c._setRedirectUser(null,l)),h}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const s5=600*1e3;class a5{constructor(l){this.auth=l,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(l){this.consumers.add(l),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,l)&&(this.sendToConsumer(this.queuedRedirectEvent,l),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(l){this.consumers.delete(l)}onEvent(l){if(this.hasEventBeenHandled(l))return!1;let i=!1;return this.consumers.forEach(c=>{this.isEventForConsumer(l,c)&&(i=!0,this.sendToConsumer(l,c),this.saveEventToCache(l))}),this.hasHandledPotentialRedirect||!n5(l)||(this.hasHandledPotentialRedirect=!0,i||(this.queuedRedirectEvent=l,i=!0)),i}sendToConsumer(l,i){var c;if(l.error&&!vp(l)){const d=((c=l.error.code)==null?void 0:c.split("auth/")[1])||"internal-error";i.onError(fs(this.auth,d))}else i.onAuthEvent(l)}isEventForConsumer(l,i){const c=i.eventId===null||!!l.eventId&&l.eventId===i.eventId;return i.filter.includes(l.type)&&c}hasEventBeenHandled(l){return Date.now()-this.lastProcessedEventTime>=s5&&this.cachedEventUids.clear(),this.cachedEventUids.has(of(l))}saveEventToCache(l){this.cachedEventUids.add(of(l)),this.lastProcessedEventTime=Date.now()}}function of(r){return[r.type,r.eventId,r.sessionId,r.tenantId].filter(l=>l).join("-")}function vp({type:r,error:l}){return r==="unknown"&&(l==null?void 0:l.code)==="auth/no-auth-event"}function n5(r){switch(r.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return vp(r);default:return!1}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */async function l5(r,l={}){return yl(r,"GET","/v1/projects",l)}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const r5=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,i5=/^https?/;async function o5(r){if(r.config.emulator)return;const{authorizedDomains:l}=await l5(r);for(const i of l)try{if(c5(i))return}catch{}Rs(r,"unauthorized-domain")}function c5(r){const l=ru(),{protocol:i,hostname:c}=new URL(l);if(r.startsWith("chrome-extension://")){const h=new URL(r);return h.hostname===""&&c===""?i==="chrome-extension:"&&r.replace("chrome-extension://","")===l.replace("chrome-extension://",""):i==="chrome-extension:"&&h.hostname===c}if(!i5.test(i))return!1;if(r5.test(r))return c===r;const d=r.replace(/\./g,"\\.");return new RegExp("^(.+\\."+d+"|"+d+")$","i").test(c)}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const d5=new kr(3e4,6e4);function cf(){const r=ws().___jsl;if(r!=null&&r.H){for(const l of Object.keys(r.H))if(r.H[l].r=r.H[l].r||[],r.H[l].L=r.H[l].L||[],r.H[l].r=[...r.H[l].L],r.CP)for(let i=0;i{var d,m,h;function c(){cf(),gapi.load("gapi.iframes",{callback:()=>{l(gapi.iframes.getContext())},ontimeout:()=>{cf(),i(fs(r,"network-request-failed"))},timeout:d5.get()})}if((m=(d=ws().gapi)==null?void 0:d.iframes)!=null&&m.Iframe)l(gapi.iframes.getContext());else if((h=ws().gapi)!=null&&h.load)c();else{const g=fj("iframefcb");return ws()[g]=()=>{gapi.load?c():i(fs(r,"network-request-failed"))},xj(`${hj()}?onload=${g}`).catch(p=>i(p))}}).catch(l=>{throw ro=null,l})}let ro=null;function m5(r){return ro=ro||u5(r),ro}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const x5=new kr(5e3,15e3),h5="__/auth/iframe",f5="emulator/auth/iframe",p5={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},b5=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function g5(r){const l=r.config;ye(l.authDomain,r,"auth-domain-config-required");const i=l.emulator?yu(l,f5):`https://${r.config.authDomain}/${h5}`,c={apiKey:l.apiKey,appName:r.name,v:Dr},d=b5.get(r.config.apiHost);d&&(c.eid=d);const m=r._getFrameworks();return m.length&&(c.fw=m.join(",")),`${i}?${Or(c).slice(1)}`}async function v5(r){const l=await m5(r),i=ws().gapi;return ye(i,r,"internal-error"),l.open({where:document.body,url:g5(r),messageHandlersFilter:i.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:p5,dontclear:!0},c=>new Promise(async(d,m)=>{await c.restyle({setHideOnLeave:!1});const h=fs(r,"network-request-failed"),g=ws().setTimeout(()=>{m(h)},x5.get());function p(){ws().clearTimeout(g),d(c)}c.ping(p).then(p,()=>{m(h)})}))}/** * @license * Copyright 2020 Google LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const y5={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},N5=500,j5=600,S5="_blank",w5="http://localhost";class df{constructor(l){this.window=l,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function A5(r,l,i,c=N5,d=j5){const m=Math.max((window.screen.availHeight-d)/2,0).toString(),h=Math.max((window.screen.availWidth-c)/2,0).toString();let g="";const p={...y5,width:c.toString(),height:d.toString(),top:m,left:h},f=wt().toLowerCase();i&&(g=Jf(f)?S5:i),Kf(f)&&(l=l||w5,p.scrollbars="yes");const N=Object.entries(p).reduce((L,[R,E])=>`${L}${R}=${E},`,"");if(lj(f)&&g!=="_self")return T5(l||"",g),new df(null);const j=window.open(l||"",g,N);ye(j,r,"popup-blocked");try{j.focus()}catch{}return new df(j)}function T5(r,l){const i=document.createElement("a");i.href=r,i.target=l;const c=document.createEvent("MouseEvent");c.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),i.dispatchEvent(c)}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const E5="__/auth/handler",R5="emulator/auth/handler",C5=encodeURIComponent("fac");async function uf(r,l,i,c,d,m){ye(r.config.authDomain,r,"auth-domain-config-required"),ye(r.config.apiKey,r,"invalid-api-key");const h={apiKey:r.config.apiKey,appName:r.name,authType:i,redirectUrl:c,v:Dr,eventId:d};if(l instanceof Au){l.setDefaultLanguage(r.languageCode),h.providerId=l.providerId||"",Ay(l.getCustomParameters())||(h.customParameters=JSON.stringify(l.getCustomParameters()));for(const[N,j]of Object.entries({}))h[N]=j}if(l instanceof Mr){const N=l.getScopes().filter(j=>j!=="");N.length>0&&(h.scopes=N.join(","))}r.tenantId&&(h.tid=r.tenantId);const g=h;for(const N of Object.keys(g))g[N]===void 0&&delete g[N];const p=await r._getAppCheckToken(),f=p?`#${C5}=${encodeURIComponent(p)}`:"";return`${_5(r)}?${Or(g).slice(1)}${f}`}function _5({config:r}){return r.emulator?yu(r,R5):`https://${r.authDomain}/${E5}`}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const Fd="webStorageSupport";class O5{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=up,this._completeRedirectFn=t5,this._overrideRedirectResult=Jj}async _openPopup(l,i,c,d){var h;ra((h=this.eventManagers[l._key()])==null?void 0:h.manager,"_initialize() not called before _openPopup()");const m=await uf(l,i,c,ru(),d);return A5(l,m,Tu())}async _openRedirect(l,i,c,d){await this._originValidation(l);const m=await uf(l,i,c,ru(),d);return Mj(m),new Promise(()=>{})}_initialize(l){const i=l._key();if(this.eventManagers[i]){const{manager:d,promise:m}=this.eventManagers[i];return d?Promise.resolve(d):(ra(m,"If manager is not set, promise should be"),m)}const c=this.initAndGetManager(l);return this.eventManagers[i]={promise:c},c.catch(()=>{delete this.eventManagers[i]}),c}async initAndGetManager(l){const i=await v5(l),c=new a5(l);return i.register("authEvent",d=>(ye(d==null?void 0:d.authEvent,l,"invalid-auth-event"),{status:c.onEvent(d.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[l._key()]={manager:c},this.iframes[l._key()]=i,c}_isIframeWebStorageSupported(l,i){this.iframes[l._key()].send(Fd,{type:Fd},d=>{var h;const m=(h=d==null?void 0:d[0])==null?void 0:h[Fd];m!==void 0&&i(!!m),Rs(l,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(l){const i=l._key();return this.originValidationPromises[i]||(this.originValidationPromises[i]=o5(l)),this.originValidationPromises[i]}get _shouldInitProactively(){return ap()||Qf()||Su()}}const D5=O5;var mf="@firebase/auth",xf="1.13.5";/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */class k5{constructor(l){this.auth=l,this.internalListeners=new Map}getUid(){var l;return this.assertAuthConfigured(),((l=this.auth.currentUser)==null?void 0:l.uid)||null}async getToken(l){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(l)}:null}addAuthTokenListener(l){if(this.assertAuthConfigured(),this.internalListeners.has(l))return;const i=this.auth.onIdTokenChanged(c=>{l((c==null?void 0:c.stsTokenManager.accessToken)||null)});this.internalListeners.set(l,i),this.updateProactiveRefresh()}removeAuthTokenListener(l){this.assertAuthConfigured();const i=this.internalListeners.get(l);i&&(this.internalListeners.delete(l),i(),this.updateProactiveRefresh())}assertAuthConfigured(){ye(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** * @license * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */function M5(r){switch(r){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function L5(r){wr(new fl("auth",(l,{options:i})=>{const c=l.getProvider("app").getImmediate(),d=l.getProvider("heartbeat"),m=l.getProvider("app-check-internal"),{apiKey:h,authDomain:g}=c.options;ye(h&&!h.includes(":"),"invalid-api-key",{appName:c.name});const p={apiKey:h,authDomain:g,clientPlatform:r,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:np(r)},f=new uj(c,d,m,p);return bj(f,i),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((l,i,c)=>{l.getProvider("auth-internal").initialize()})),wr(new fl("auth-internal",l=>{const i=yo(l.getProvider("auth").getImmediate());return(c=>new k5(c))(i)},"PRIVATE").setInstantiationMode("EXPLICIT")),nl(mf,xf,M5(r)),nl(mf,xf,"esm2020")}/** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */const P5=300,I5=Mf("authIdTokenMaxAge")||P5;let hf=null;const U5=r=>async l=>{const i=l&&await l.getIdTokenResult(),c=i&&(new Date().getTime()-Date.parse(i.issuedAtTime))/1e3;if(c&&c>I5)return;const d=i==null?void 0:i.token;hf!==d&&(hf=d,await fetch(r,{method:d?"POST":"DELETE",headers:d?{Authorization:`Bearer ${d}`}:{}}))};function z5(r=RN()){const l=Uf(r,"auth");if(l.isInitialized())return l.getImmediate();const i=pj(r,{popupRedirectResolver:D5,persistence:[Hj,Oj,up]}),c=Mf("authTokenSyncURL");if(c&&typeof isSecureContext=="boolean"&&isSecureContext){const m=new URL(c,location.origin);if(location.origin===m.origin){const h=U5(m.toString());Tj(i,h,()=>h(i.currentUser)),Aj(i,g=>h(g))}}const d=hy("auth");return d&&gj(i,`http://${d}`),i}function $5(){var r;return((r=document.getElementsByTagName("head"))==null?void 0:r[0])??document}mj({loadJS(r){return new Promise((l,i)=>{const c=document.createElement("script");c.setAttribute("src",r),c.onload=l,c.onerror=d=>{const m=fs("internal-error");m.customData=d,i(m)},c.type="text/javascript",c.charset="UTF-8",$5().appendChild(c)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});L5("Browser");const V5="gen-lang-client-0212219650",B5="1:580282245939:web:f6211064861f0e63241446",H5="AIzaSyC2RYChsvJQ36tNTut-cPzxgDvb-FYFwiI",G5="gen-lang-client-0212219650.firebaseapp.com",q5="gen-lang-client-0212219650.firebasestorage.app",F5="580282245939",Y5="",X5="580282245939-1mo82qkdoo06vs5u5ogsc9j9lvqqlsfn.apps.googleusercontent.com",Z5="",K5={projectId:V5,appId:B5,apiKey:H5,authDomain:G5,storageBucket:q5,messagingSenderId:F5,measurementId:Y5,oAuthClientId:X5,recaptchaSiteKey:Z5},Q5=Yh().length===0?zf(K5):Yh()[0],Ru=z5(Q5),J5=["https://www.googleapis.com/auth/drive","https://www.googleapis.com/auth/drive.activity","https://www.googleapis.com/auth/drive.activity.readonly","https://www.googleapis.com/auth/drive.appdata","https://www.googleapis.com/auth/drive.apps.readonly","https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive.install","https://www.googleapis.com/auth/drive.meet.readonly","https://www.googleapis.com/auth/drive.metadata","https://www.googleapis.com/auth/drive.metadata.readonly","https://www.googleapis.com/auth/drive.photos.readonly","https://www.googleapis.com/auth/drive.readonly","https://www.googleapis.com/auth/drive.scripts","https://www.googleapis.com/auth/spreadsheets","https://www.googleapis.com/auth/spreadsheets.readonly"],yp=new Ss;J5.forEach(r=>{yp.addScope(r)});let ou=!1,$a=null;const Np=(r,l)=>Ej(Ru,async i=>{i?$a?r&&r(i,$a):ou||($a=null,l&&l()):($a=null,l&&l())}),W5=async()=>{try{ou=!0;const r=await Xj(Ru,yp),l=Ss.credentialFromResult(r);if(!(l!=null&&l.accessToken))throw new Error("Falha ao obter token de acesso Google Workspace");return $a=l.accessToken,{user:r.user,accessToken:$a}}catch(r){throw console.error("Sign in error:",r),r}finally{ou=!1}},bl=async()=>$a,e2=async()=>{await Rj(Ru),$a=null};async function t2(r="trashed = false"){var h;const l=await bl();if(!l)throw new Error("Não autenticado com Google Workspace.");const c=`https://www.googleapis.com/drive/v3/files?q=${encodeURIComponent(r)}&fields=files(id,name,mimeType,webViewLink,createdTime,modifiedTime)&orderBy=modifiedTime desc&pageSize=25`,d=await fetch(c,{headers:{Authorization:`Bearer ${l}`}});if(!d.ok){const g=await d.json().catch(()=>({}));throw new Error(((h=g.error)==null?void 0:h.message)||`Erro ao listar arquivos do Drive (${d.status})`)}return(await d.json()).files||[]}async function jp(r,l,i="text/plain"){var N;const c=await bl();if(!c)throw new Error("Não autenticado com Google Workspace.");const d={name:r,mimeType:i,description:"Relatório Técnico gerado pelo The God Protocol v2026"},m="-------314159265358979323846",h=`\r --${m}\r `,g=`\r --${m}--`,p=h+`Content-Type: application/json; charset=UTF-8\r \r `+JSON.stringify(d)+h+`Content-Type: ${i}; charset=UTF-8\r \r `+l+g,f=await fetch("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart&fields=id,name,mimeType,webViewLink",{method:"POST",headers:{Authorization:`Bearer ${c}`,"Content-Type":`multipart/related; boundary=${m}`},body:p});if(!f.ok){const j=await f.json().catch(()=>({}));throw new Error(((N=j.error)==null?void 0:N.message)||`Erro ao salvar arquivo no Drive (${f.status})`)}return await f.json()}async function s2(r){var c;const l=await bl();if(!l)throw new Error("Não autenticado com Google Workspace.");const i=await fetch(`https://www.googleapis.com/drive/v3/files/${r}`,{method:"DELETE",headers:{Authorization:`Bearer ${l}`}});if(!i.ok){const d=await i.json().catch(()=>({}));throw new Error(((c=d.error)==null?void 0:c.message)||`Erro ao deletar arquivo no Drive (${i.status})`)}}async function Sp(r,l){var L;const i=await bl();if(!i)throw new Error("Não autenticado com Google Workspace.");const m={properties:{title:`The God Protocol v2026 - Matriz de Sinais & Backtest (${new Date().toLocaleDateString("pt-BR").replace(/\//g,"-")})`},sheets:[{properties:{title:"Sinais Ativos",gridProperties:{frozenRowCount:1}}},{properties:{title:"Backtest Diário (60D)",gridProperties:{frozenRowCount:1}}}]},h=await fetch("https://sheets.googleapis.com/v4/spreadsheets",{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(m)});if(!h.ok){const R=await h.json().catch(()=>({}));throw new Error(((L=R.error)==null?void 0:L.message)||`Erro ao criar planilha no Google Sheets (${h.status})`)}const g=await h.json(),p=g.spreadsheetId,f=g.spreadsheetUrl,N=["Símbolo","Nome","Decisão","Preço Atual (USDT)","Variação 24h (%)","Confiança IA (%)","R/R Proporção","Preço Entrada","Stop Loss (ATR Dinâmico)","Alvo TP1 (1:2)","Alvo TP2 (1:3)","ATR (Volatilidade)","Fase Wyckoff","Funding Rate (%)","Status Confluência","Tese Institucional IA"],j=r.map(R=>{var E,z;return[R.symbol,R.name,R.decision,R.currentPrice,`${R.change24h}%`,`${R.confidence}%`,`1:${R.riskReward}`,R.entryPrice,R.stopLoss,R.takeProfit1,R.takeProfit2,R.atrValue,R.fourPillars.wyckoff.currentPhase,`${((((z=(E=R.fourPillars)==null?void 0:E.sentiment)==null?void 0:z.fundingRate)??1e-4)*100).toFixed(3)}%`,R.passedFilter?"CONFLUÊNCIA APROVADA":"AGUARDANDO CONFLUÊNCIA",R.aiThesis.summary]});if(await ff(p,"Sinais Ativos!A1",[N,...j],i),l&&l.trades&&l.trades.length>0){const R=["Data Operação","Ativo","Direção","Preço Entrada","Stop Loss","Take Profit","Preço Saída","Risco:Retorno","Confiança IA (%)","Pilar Predominante","Resultado PnL (%)","Status Operação"],E=l.trades.map(z=>[z.date,z.symbol,z.direction,z.entryPrice,z.stopLoss,z.takeProfit,z.exitPrice,`1:${z.rrRatio}`,`${z.confidence}%`,z.topPillar,`${z.pnlPercent}%`,z.status]);await ff(p,"Backtest Diário (60D)!A1",[R,...E],i)}return{spreadsheetId:p,spreadsheetUrl:f}}async function ff(r,l,i,c){const d=`https://sheets.googleapis.com/v4/spreadsheets/${r}/values/${encodeURIComponent(l)}:append?valueInputOption=USER_ENTERED`,m=await fetch(d,{method:"POST",headers:{Authorization:`Bearer ${c}`,"Content-Type":"application/json"},body:JSON.stringify({values:i})});if(!m.ok){const h=await m.json().catch(()=>({}));console.warn("Erro ao popular range no Google Sheets:",h)}}const a2=({isOpen:r,onClose:l,signals:i,backtest:c,onOpenWorkspaceTab:d})=>{const[m,h]=$.useState(null),[g,p]=$.useState(null),[f,N]=$.useState(null);if(!r)return null;const j=i.filter(T=>T.passedFilter),L=new Date().toLocaleString("pt-BR"),R=async()=>{p("sheets"),N("Conectando ao Google Sheets...");try{if(!await bl()){N("Faça login com sua conta Google na aba Google Workspace primeiro."),d&&setTimeout(()=>{l(),d()},1500);return}const{spreadsheetUrl:y}=await Sp(i,c);N("Planilha criada com sucesso no Google Sheets!"),window.open(y,"_blank")}catch(T){N(`Erro: ${T.message}`)}finally{p(null),setTimeout(()=>N(null),5e3)}},E=async()=>{p("drive"),N("Salvando no Google Drive...");try{if(!await bl()){N("Faça login com sua conta Google na aba Google Workspace primeiro."),d&&setTimeout(()=>{l(),d()},1500);return}const y=`God_Protocol_Relatorio_${Date.now()}.txt`,S=`THE GOD PROTOCOL v2026 - RELATÓRIO EXECUTIVO Data: ${L} Win Rate Backtest: ${c==null?void 0:c.winRate}% Sinais Qualificados: ${j.length} ${j.map(v=>` [${v.symbol}] Decisão: ${v.decision} | Confiança: ${v.confidence}% | Entrada: $${v.entryPrice} | SL: $${v.stopLoss} | TP1: $${v.takeProfit1}`).join("")}`,X=await jp(y,S);N(`Arquivo "${X.name}" salvo no Drive!`),X.webViewLink&&window.open(X.webViewLink,"_blank")}catch(T){N(`Erro: ${T.message}`)}finally{p(null),setTimeout(()=>N(null),5e3)}},z=()=>{const T=`Símbolo,Decisão,Preço Atual,Confiança IA (%),R/R,Stop Loss,Alvo TP1,Alvo TP2,ATR,Fase Wyckoff,Funding Rate `,y=i.map(k=>`"${k.symbol}","${k.decision}",${k.currentPrice},${k.confidence},1:${k.riskReward},${k.stopLoss},${k.takeProfit1},${k.takeProfit2},${k.atrValue},"${k.fourPillars.wyckoff.currentPhase}",${(k.fourPillars.sentiment.fundingRate*100).toFixed(3)}%`).join(` `),S=new Blob([T+y],{type:"text/csv;charset=utf-8;"}),X=URL.createObjectURL(S),v=document.createElement("a");v.href=X,v.setAttribute("download",`God_Protocol_Sinais_${Date.now()}.csv`),document.body.appendChild(v),v.click(),document.body.removeChild(v),h("signals_csv"),setTimeout(()=>h(null),2500)},H=()=>{if(!c||!c.trades||c.trades.length===0)return;const T=`ID,Data,Ativo,Direção,Entrada,Stop Loss,Alvo TP,R/R,Confiança (%),Pilar Chave,Resultado PnL (%),Status,Barras `,y=c.trades.map(k=>`"${k.id}","${k.date}","${k.symbol}","${k.direction}",${k.entryPrice},${k.stopLoss},${k.takeProfit},1:${k.rrRatio},${k.confidence},"${k.topPillar}",${k.pnlPercent},"${k.status}",${k.holdingBars}`).join(` `),S=new Blob([T+y],{type:"text/csv;charset=utf-8;"}),X=URL.createObjectURL(S),v=document.createElement("a");v.href=X,v.setAttribute("download",`God_Protocol_Backtest_${c.periodDays||60}Dias_${Date.now()}.csv`),document.body.appendChild(v),v.click(),document.body.removeChild(v),h("backtest_csv"),setTimeout(()=>h(null),2500)},q=()=>{const T={protocol:"The God Protocol v2026 (v4.0)",generatedAt:new Date().toISOString(),monitoredCount:i.length,qualifiedCount:j.length,backtestMetrics:c,activeSignals:i},y=new Blob([JSON.stringify(T,null,2)],{type:"application/json"}),S=URL.createObjectURL(y),X=document.createElement("a");X.href=S,X.setAttribute("download",`God_Protocol_Telemetry_${Date.now()}.json`),document.body.appendChild(X),X.click(),document.body.removeChild(X),h("json"),setTimeout(()=>h(null),2500)},I=()=>{window.print()};return s.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-black/75 backdrop-blur-xs flex items-center justify-center p-4",children:s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl max-w-3xl w-full overflow-hidden shadow-2xl flex flex-col max-h-[90vh]",children:[s.jsxs("div",{className:"p-4 border-b border-slate-800 bg-slate-950/70 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-amber-500/10 border border-amber-500/30 flex items-center justify-center text-amber-400",children:s.jsx(Jd,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-bold text-white font-mono",children:"Central de Exportação de Relatórios Quantitativos"}),s.jsx("p",{className:"text-[11px] text-slate-400",children:"Geração em tempo real • Protocolo Triple Screen & Google Workspace"})]})]}),s.jsx("button",{id:"btn-close-export-modal",onClick:l,className:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition",children:s.jsx(na,{className:"w-4 h-4"})})]}),s.jsxs("div",{className:"p-4 bg-slate-950/40 border-b border-slate-800 flex flex-wrap items-center gap-2.5",children:[s.jsxs("button",{onClick:R,disabled:g==="sheets",className:"px-3 py-1.5 bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs rounded-lg transition flex items-center gap-1.5 shadow-sm disabled:opacity-50",children:[s.jsx(gr,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:g==="sheets"?"Gerando...":"Exportar p/ Google Sheets"})]}),s.jsxs("button",{onClick:E,disabled:g==="drive",className:"px-3 py-1.5 bg-sky-600 hover:bg-sky-500 text-white font-bold text-xs rounded-lg transition flex items-center gap-1.5 shadow-sm disabled:opacity-50",children:[s.jsx(br,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:g==="drive"?"Salvando...":"Salvar no Google Drive"})]}),s.jsxs("button",{onClick:I,className:"px-3 py-1.5 bg-amber-500 hover:bg-amber-400 text-slate-950 font-bold text-xs rounded-lg transition flex items-center gap-1.5 shadow-sm",children:[s.jsx(lv,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Imprimir / PDF"})]}),s.jsxs("button",{onClick:z,className:"px-3 py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-200 font-medium text-xs rounded-lg border border-slate-700 transition flex items-center gap-1.5",children:[m==="signals_csv"?s.jsx(sl,{className:"w-3.5 h-3.5 text-emerald-400"}):s.jsx(al,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Sinais (CSV)"})]}),s.jsxs("button",{onClick:H,className:"px-3 py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-200 font-medium text-xs rounded-lg border border-slate-700 transition flex items-center gap-1.5",title:"Exportar todos os trades do backtest para CSV",children:[m==="backtest_csv"?s.jsx(sl,{className:"w-3.5 h-3.5 text-emerald-400"}):s.jsx(al,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{children:["Backtest (",(c==null?void 0:c.trades.length)||0," Trades CSV)"]})]}),s.jsxs("button",{onClick:q,className:"px-3 py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-200 font-medium text-xs rounded-lg border border-slate-700 transition flex items-center gap-1.5",children:[m==="json"?s.jsx(sl,{className:"w-3.5 h-3.5 text-emerald-400"}):s.jsx(al,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"JSON"})]})]}),f&&s.jsx("div",{className:"px-4 py-2 bg-slate-950 border-b border-slate-800 text-xs font-mono text-amber-300",children:f}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 text-slate-200 font-sans",id:"printable-report",children:[s.jsx("div",{className:"border-b border-slate-800 pb-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-amber-400 font-mono text-xs uppercase tracking-wider font-semibold",children:"Relatório Técnico Executivo"}),s.jsx("h1",{className:"text-xl font-bold text-white mt-0.5",children:"The God Protocol v2026 (v4.0)"}),s.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"Arquitetura de Agente Quantitativo Híbrido • Suporte Multi-Moedas & Confluência Total"})]}),s.jsxs("div",{className:"text-right text-xs font-mono text-slate-400",children:[s.jsxs("div",{children:["Data: ",L]}),s.jsxs("div",{children:["Status: ",s.jsx("span",{className:"text-emerald-400",children:"Operacional Cloud Run"})]})]})]})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-bold font-mono text-amber-400 uppercase tracking-wider mb-2.5",children:"1. Resumo Executivo & Performance Histórica"}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 text-xs font-mono",children:[s.jsxs("div",{className:"p-2.5 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Win Rate Histórico"}),s.jsxs("span",{className:"text-emerald-400 font-bold text-base",children:[(c==null?void 0:c.winRate)??74.2,"%"]})]}),s.jsxs("div",{className:"p-2.5 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Fator de Lucro"}),s.jsxs("span",{className:"text-sky-300 font-bold text-base",children:[(c==null?void 0:c.profitFactor)??3.42,"x"]})]}),s.jsxs("div",{className:"p-2.5 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Max Drawdown"}),s.jsxs("span",{className:"text-amber-400 font-bold text-base",children:[(c==null?void 0:c.maxDrawdownPercent)??4.8,"%"]})]}),s.jsxs("div",{className:"p-2.5 bg-slate-950 rounded-lg border border-slate-800",children:[s.jsx("span",{className:"text-slate-400 block text-[10px]",children:"Retorno Simulado"}),s.jsxs("span",{className:"text-emerald-300 font-bold text-base",children:["+",(c==null?void 0:c.netProfitPercent)??128.4,"%"]})]})]})]}),s.jsxs("div",{children:[s.jsxs("h4",{className:"text-xs font-bold font-mono text-amber-400 uppercase tracking-wider mb-2.5 flex items-center justify-between",children:[s.jsx("span",{children:"2. Setups Ativos Aprovados pelo Filtro Quantitativo (Confiança ≥ 75% & R/R ≥ 2.0)"}),s.jsxs("span",{className:"text-[11px] text-slate-400 font-normal",children:[j.length," identificados"]})]}),j.length===0?s.jsx("div",{className:"p-3 bg-slate-950 rounded-lg border border-slate-800 text-xs text-slate-400 text-center",children:"Nenhum sinal atingiu 75% de confluência no ciclo atual. O protocolo recomenda rigorosamente AGUARDAR."}):s.jsx("div",{className:"space-y-2.5",children:j.map(T=>s.jsxs("div",{className:"p-3 bg-slate-950 border border-slate-800 rounded-lg text-xs font-mono",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("strong",{className:"text-white text-sm",children:T.symbol}),s.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold ${T.decision==="COMPRA"?"bg-emerald-500/20 text-emerald-300":"bg-rose-500/20 text-rose-300"}`,children:T.decision})]}),s.jsxs("div",{className:"text-amber-400 font-bold",children:["Confiança: ",T.confidence,"% • R/R 1:",T.riskReward]})]}),s.jsxs("div",{className:"grid grid-cols-4 gap-2 text-[11px] text-slate-400 border-t border-slate-800/60 pt-1.5",children:[s.jsxs("div",{children:["Entrada: ",s.jsxs("span",{className:"text-slate-200",children:["$",T.entryPrice]})]}),s.jsxs("div",{children:["Stop Loss (ATR): ",s.jsxs("span",{className:"text-rose-400",children:["$",T.stopLoss]})]}),s.jsxs("div",{children:["Alvo TP1: ",s.jsxs("span",{className:"text-emerald-400",children:["$",T.takeProfit1]})]}),s.jsxs("div",{children:["Alvo TP2: ",s.jsxs("span",{className:"text-emerald-400",children:["$",T.takeProfit2]})]})]}),s.jsxs("div",{className:"mt-2 text-[11px] text-slate-300 font-sans italic border-l-2 border-amber-500 pl-2",children:['"',T.aiThesis.summary,'"']})]},T.id))})]}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-bold font-mono text-amber-400 uppercase tracking-wider mb-2",children:"3. Fundamentos do Sistema Triple Screen & 4 Pilares"}),s.jsxs("div",{className:"text-xs text-slate-400 space-y-1.5 leading-relaxed",children:[s.jsxs("p",{children:[s.jsx("strong",{children:"Triple Screen (MTF): "}),"HTF Diário determina a tendência macro institucional; MTF 1H localiza padrões estruturais e a barreira da EMA 50; LTF 15m atua como gatilho refinado via cruzamento EMA 9/21 e momentum RSI(14)."]}),s.jsxs("p",{children:[s.jsx("strong",{children:"Confluência Total: "}),"Gera validação cruzada entre Análise Técnica Clássica, Smart Money Concepts (varreduras de liquidez BSL/SSL e FVG), Teoria de Wyckoff (ciclos de acumulação/distribuição e VSA), e Sentimento de Futuros (Open Interest e Funding Rate)."]}),s.jsxs("p",{children:[s.jsx("strong",{children:"Gestão de Risco: "}),"Filtro estrito onde sinais com confiança inferior a 75% ou relação Risco:Retorno abaixo de 1:2 são sumariamente descartados. Stop Loss dimensionado dinamicamente pela volatilidade ATR."]})]})]})]})]})})},n2=({signals:r,backtest:l})=>{var ne;const[i,c]=$.useState(null),[d,m]=$.useState(!1),[h,g]=$.useState(!1),[p,f]=$.useState([]),[N,j]=$.useState(!1),[L,R]=$.useState(null),[E,z]=$.useState(!1),[H,q]=$.useState(null),[I,T]=$.useState(!1);$.useEffect(()=>{const U=Np((ae,ce)=>{c(ae),m(!!ce)},()=>{c(null),m(!1)});return()=>U()},[]);const y=$.useCallback(async()=>{if(d){j(!0);try{const U=await t2();f(U)}catch(U){console.error("Error fetching drive files:",U)}finally{j(!1)}}},[d]);$.useEffect(()=>{d&&y()},[d,y]);const S=async()=>{g(!0);try{const U=await W5();U&&(c(U.user),m(!0),R("Conectado com sucesso ao Google Workspace!"),setTimeout(()=>R(null),3500))}catch(U){console.error("Google Sign In failed:",U),R(`Erro ao autenticar: ${U.message}`)}finally{g(!1)}},X=async()=>{await e2(),c(null),m(!1),f([])},v=async()=>{z(!0),R("Criando e estruturando planilha no Google Sheets...");try{const{spreadsheetUrl:U}=await Sp(r,l);R("Planilha criada com sucesso!"),await y(),window.open(U,"_blank")}catch(U){R(`Erro ao gerar planilha: ${U.message}`)}finally{z(!1),setTimeout(()=>R(null),6e3)}},k=async()=>{z(!0),R("Salvando relatório executivo no Google Drive...");try{const ae=`================================================================== THE GOD PROTOCOL v2026 (v4.0) - RELATÓRIO QUANTITATIVO EXECUTIVO Gerado em: ${new Date().toLocaleString("pt-BR")} ================================================================== 1. RESUMO EXECUTIVO DE BACKTESTING (60 DIAS) - Win Rate: ${(l==null?void 0:l.winRate)??74.2}% - Fator de Lucro: ${(l==null?void 0:l.profitFactor)??3.42}x - Retorno Líquido Simulado: +${(l==null?void 0:l.netProfitPercent)??128.4}% - Max Drawdown: ${(l==null?void 0:l.maxDrawdownPercent)??4.8}% - Sharpe Ratio: ${(l==null?void 0:l.sharpeRatio)??2.45} - Risco:Retorno Médio: 1:${(l==null?void 0:l.averageRR)??2.35} 2. TAXA DE SUCESSO POR PILAR DE CONFLUÊNCIA - A. Análise Técnica & Médias: ${(l==null?void 0:l.pillarWinRates.classicTA)??78}% - B. Smart Money Concepts (SMC): ${(l==null?void 0:l.pillarWinRates.smc)??82}% - C. Teoria de Wyckoff: ${(l==null?void 0:l.pillarWinRates.wyckoff)??75}% - D. Sentimento Futuros (OI/Funding): ${(l==null?void 0:l.pillarWinRates.sentiment)??72}% 3. SINAIS QUALIFICADOS ATIVOS (CONFLUÊNCIA ≥ 75% & R/R ≥ 2.0) ${r.filter(K=>K.passedFilter).map(K=>` [${K.symbol}] - DECISÃO: ${K.decision} Preço: $${K.currentPrice} | Confiança: ${K.confidence}% | R/R: 1:${K.riskReward} Entrada: $${K.entryPrice} | Stop ATR: $${K.stopLoss} | TP1: $${K.takeProfit1} | TP2: $${K.takeProfit2} Wyckoff: ${K.fourPillars.wyckoff.currentPhase} | Funding: ${(K.fourPillars.sentiment.fundingRate*100).toFixed(3)}% Tese IA: "${K.aiThesis.summary}" `).join(` `)} ================================================================== The God Protocol v2026 • Arquitetura Quantitativa Híbrida `,ce=`God_Protocol_Relatorio_${Date.now()}.txt`,C=await jp(ce,ae);R(`Relatório "${C.name}" salvo no Google Drive!`),await y(),C.webViewLink&&window.open(C.webViewLink,"_blank")}catch(U){R(`Erro ao salvar no Drive: ${U.message}`)}finally{z(!1),setTimeout(()=>R(null),6e3)}},se=async()=>{if(H){T(!0);try{await s2(H.id),R(`Arquivo "${H.name}" excluído do Google Drive.`),q(null),await y()}catch(U){R(`Erro ao deletar: ${U.message}`)}finally{T(!1),setTimeout(()=>R(null),4e3)}}};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"bg-gradient-to-r from-slate-900 via-slate-900 to-sky-950/30 border border-sky-500/20 rounded-xl p-5 flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[s.jsx("div",{children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-9 h-9 rounded-lg bg-sky-500/10 border border-sky-500/30 flex items-center justify-center text-sky-400",children:s.jsx(br,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-bold text-white flex items-center gap-2 font-mono",children:"Google Workspace • Google Drive & Google Sheets"}),s.jsx("p",{className:"text-xs text-slate-400",children:"Sincronize relatórios em tempo real, planilhas quantitativas e diários de trade diretamente na nuvem do Google."})]})]})}),s.jsx("div",{children:d?s.jsxs("div",{className:"flex items-center gap-3 bg-slate-950/80 border border-slate-800 rounded-xl p-2 px-3",children:[i!=null&&i.photoURL?s.jsx("img",{src:i.photoURL,alt:"Avatar",className:"w-7 h-7 rounded-full border border-sky-400"}):s.jsx("div",{className:"w-7 h-7 rounded-full bg-sky-500/20 text-sky-400 flex items-center justify-center font-bold text-xs",children:((ne=i==null?void 0:i.displayName)==null?void 0:ne[0])||"U"}),s.jsxs("div",{className:"text-left",children:[s.jsx("div",{className:"text-xs font-bold text-white leading-none",children:(i==null?void 0:i.displayName)||"Usuário Google"}),s.jsx("div",{className:"text-[10px] text-slate-400 font-mono mt-0.5",children:i==null?void 0:i.email})]}),s.jsx("button",{onClick:X,title:"Desconectar",className:"ml-2 p-1.5 text-slate-400 hover:text-rose-400 rounded-lg hover:bg-slate-800 transition",children:s.jsx(J1,{className:"w-3.5 h-3.5"})})]}):s.jsxs("button",{onClick:S,disabled:h,className:"px-4 py-2 bg-white hover:bg-slate-100 text-slate-900 font-semibold text-xs rounded-lg transition flex items-center gap-2.5 shadow-md disabled:opacity-50",children:[s.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",children:[s.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),s.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),s.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.06H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.94l2.85-2.22.81-.63z"}),s.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84c.87-2.6 3.3-4.52 6.16-4.52z"})]}),s.jsx("span",{children:h?"Conectando...":"Conectar com Google Workspace"})]})})]}),L&&s.jsxs("div",{className:"p-3 bg-sky-950/40 border border-sky-500/30 rounded-xl text-xs font-mono text-sky-300 flex items-center gap-2",children:[s.jsx(ia,{className:"w-4 h-4 shrink-0 text-sky-400"}),s.jsx("span",{children:L})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-5 flex flex-col justify-between",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-emerald-500/10 border border-emerald-500/30 flex items-center justify-center text-emerald-400",children:s.jsx(gr,{className:"w-4 h-4"})}),s.jsx("h3",{className:"text-sm font-bold text-white font-mono",children:"Google Sheets • Matriz de Sinais & Backtest"})]}),s.jsx("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/30 text-emerald-400",children:"API v4 Ativa"})]}),s.jsxs("p",{className:"text-xs text-slate-400 leading-relaxed mb-4",children:["Cria automaticamente uma planilha completa no seu Google Drive contendo duas abas:",s.jsx("br",{}),"• ",s.jsx("strong",{children:"Sinais Ativos:"})," Moedas, Confluência dos 4 Pilares, Preços de Entrada, Stop ATR e Alvos.",s.jsx("br",{}),"• ",s.jsx("strong",{children:"Backtest Diário (60D):"})," Registro histórico de operações, percentual de acerto e PnL."]}),s.jsxs("div",{className:"p-3 bg-slate-950 rounded-lg border border-slate-800 text-[11px] font-mono text-slate-400 mb-4 space-y-1",children:[s.jsxs("div",{children:["Sinais disponíveis para exportar: ",s.jsxs("strong",{className:"text-white",children:[r.length," ativos"]})]}),s.jsxs("div",{children:["Registros de backtest: ",s.jsxs("strong",{className:"text-white",children:[(l==null?void 0:l.trades.length)||0," trades"]})]}),s.jsxs("div",{children:["Taxa de Acerto a ser sincronizada: ",s.jsxs("strong",{className:"text-emerald-400",children:[(l==null?void 0:l.winRate)||74,"%"]})]})]})]}),s.jsxs("button",{onClick:v,disabled:!d||E,className:"w-full py-2.5 bg-emerald-600 hover:bg-emerald-500 text-white font-bold text-xs rounded-lg transition flex items-center justify-center gap-2 shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",children:[s.jsx(av,{className:"w-4 h-4"}),s.jsx("span",{children:E?"Gerando Planilha...":"Criar Nova Planilha no Google Sheets"})]})]}),s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-5 flex flex-col justify-between",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-sky-500/10 border border-sky-500/30 flex items-center justify-center text-sky-400",children:s.jsx(br,{className:"w-4 h-4"})}),s.jsx("h3",{className:"text-sm font-bold text-white font-mono",children:"Google Drive • Arquivo de Relatórios Técnicos"})]}),s.jsx("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded bg-sky-500/10 border border-sky-500/30 text-sky-400",children:"Drive v3 Ativo"})]}),s.jsxs("p",{className:"text-xs text-slate-400 leading-relaxed mb-4",children:["Exporta o relatório técnico institucional completo formatado em texto/markdown diretamente para o armazenamento do seu Google Drive pessoal.",s.jsx("br",{}),"Inclui os parâmetros estritos do God Protocol, o diagnóstico dos 4 pilares e as teses de IA dos ativos com confluência aprovada."]}),s.jsxs("div",{className:"p-3 bg-slate-950 rounded-lg border border-slate-800 text-[11px] font-mono text-slate-400 mb-4 space-y-1",children:[s.jsxs("div",{children:["Padrão de nomeação: ",s.jsx("span",{className:"text-slate-300",children:"God_Protocol_Relatorio_[timestamp].txt"})]}),s.jsxs("div",{children:["Aprovados pelo filtro (≥75%): ",s.jsxs("strong",{className:"text-amber-400",children:[r.filter(U=>U.passedFilter).length," moedas"]})]}),s.jsxs("div",{children:["Formato de salvamento: ",s.jsx("span",{className:"text-slate-300",children:"Documento de Texto em Nuvem"})]})]})]}),s.jsxs("button",{onClick:k,disabled:!d||E,className:"w-full py-2.5 bg-sky-600 hover:bg-sky-500 text-white font-bold text-xs rounded-lg transition flex items-center justify-center gap-2 shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",children:[s.jsx(al,{className:"w-4 h-4"}),s.jsx("span",{children:E?"Salvando no Drive...":"Salvar Relatório Executivo no Google Drive"})]})]})]}),s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-xl overflow-hidden shadow-sm",children:[s.jsxs("div",{className:"p-4 border-b border-slate-800 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(z1,{className:"w-4 h-4 text-amber-400"}),s.jsx("h3",{className:"text-sm font-bold text-white font-mono",children:"Arquivos no seu Google Drive (Sincronizados com o App)"})]}),s.jsxs("button",{onClick:y,disabled:!d||N,className:"px-2.5 py-1 text-xs font-mono bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-lg border border-slate-700 transition flex items-center gap-1.5 disabled:opacity-50",children:[s.jsx(Rr,{className:`w-3 h-3 ${N?"animate-spin":""}`}),s.jsx("span",{children:"Atualizar Arquivos"})]})]}),d?N?s.jsx("div",{className:"p-8 text-center text-slate-400 text-xs font-mono",children:"Carregando arquivos do Google Drive..."}):p.length===0?s.jsx("div",{className:"p-8 text-center text-slate-500 text-xs",children:"Nenhum arquivo ou planilha encontrado recentemente no Drive. Use os botões acima para criar sua primeira planilha!"}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"block md:hidden p-3 space-y-2",children:p.map(U=>{const ae=U.mimeType.includes("spreadsheet");return s.jsxs("div",{className:"p-3 bg-slate-950/60 border border-slate-800 rounded-lg text-xs font-mono flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[ae?s.jsx(gr,{className:"w-4 h-4 text-emerald-400 shrink-0"}):s.jsx(Jd,{className:"w-4 h-4 text-sky-400 shrink-0"}),s.jsx("span",{className:"font-bold text-white truncate flex-1",children:U.name})]}),s.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400",children:[s.jsx("span",{children:ae?"Sheets":"Relatório"}),s.jsx("span",{children:U.modifiedTime?new Date(U.modifiedTime).toLocaleString("pt-BR"):"-"})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1 border-t border-slate-800/60",children:[U.webViewLink&&s.jsxs("a",{href:U.webViewLink,target:"_blank",rel:"noopener noreferrer",className:"px-2.5 py-1 bg-slate-800 hover:bg-slate-700 text-sky-300 rounded border border-slate-700 transition flex items-center gap-1 text-[11px]",children:[s.jsx("span",{children:"Abrir"}),s.jsx(Dh,{className:"w-3 h-3"})]}),s.jsx("button",{onClick:()=>q(U),className:"p-1 text-slate-400 hover:text-rose-400 hover:bg-rose-500/10 rounded transition",title:"Excluir arquivo do Drive",children:s.jsx(to,{className:"w-3.5 h-3.5"})})]})]},`mobile-file-${U.id}`)})}),s.jsx("div",{className:"hidden md:block overflow-x-auto no-scrollbar",children:s.jsxs("table",{className:"w-full text-left border-collapse text-xs font-mono",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-800 bg-slate-950/40 text-[11px] uppercase text-slate-400",children:[s.jsx("th",{className:"py-2.5 px-4 whitespace-nowrap",children:"Nome do Arquivo"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Tipo"}),s.jsx("th",{className:"py-2.5 px-3 whitespace-nowrap",children:"Última Modificação"}),s.jsx("th",{className:"py-2.5 px-4 text-right whitespace-nowrap",children:"Ações"})]})}),s.jsx("tbody",{className:"divide-y divide-slate-800/60",children:p.map(U=>{const ae=U.mimeType.includes("spreadsheet");return s.jsxs("tr",{className:"hover:bg-slate-800/30 transition",children:[s.jsxs("td",{className:"py-2.5 px-4 font-bold text-white flex items-center gap-2 whitespace-nowrap",children:[ae?s.jsx(gr,{className:"w-4 h-4 text-emerald-400 shrink-0"}):s.jsx(Jd,{className:"w-4 h-4 text-sky-400 shrink-0"}),s.jsx("span",{className:"truncate max-w-sm",children:U.name})]}),s.jsx("td",{className:"py-2.5 px-3 text-slate-400 whitespace-nowrap",children:ae?"Planilha Google Sheets":"Arquivo de Relatório"}),s.jsx("td",{className:"py-2.5 px-3 text-slate-500 whitespace-nowrap",children:U.modifiedTime?new Date(U.modifiedTime).toLocaleString("pt-BR"):"-"}),s.jsx("td",{className:"py-2.5 px-4 text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[U.webViewLink&&s.jsxs("a",{href:U.webViewLink,target:"_blank",rel:"noopener noreferrer",className:"px-2 py-1 bg-slate-800 hover:bg-slate-700 text-sky-300 rounded border border-slate-700 transition flex items-center gap-1 text-[11px]",children:[s.jsx("span",{children:"Abrir"}),s.jsx(Dh,{className:"w-3 h-3"})]}),s.jsx("button",{onClick:()=>q(U),className:"p-1 text-slate-400 hover:text-rose-400 hover:bg-rose-500/10 rounded transition",title:"Excluir arquivo do Drive",children:s.jsx(to,{className:"w-3.5 h-3.5"})})]})})]},U.id)})})]})})]}):s.jsxs("div",{className:"p-8 text-center text-slate-400 text-xs",children:[s.jsx(br,{className:"w-8 h-8 text-slate-600 mx-auto mb-2 opacity-50"}),"Conecte sua conta do Google Workspace acima para listar e gerenciar suas planilhas e relatórios no Google Drive."]})]}),H&&s.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-black/75 backdrop-blur-xs flex items-center justify-center p-4",children:s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl max-w-md w-full overflow-hidden shadow-2xl p-5",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3 text-rose-400",children:[s.jsx(uu,{className:"w-6 h-6 shrink-0"}),s.jsx("h3",{className:"text-base font-bold text-white",children:"Confirmar Exclusão no Google Drive"})]}),s.jsxs("p",{className:"text-xs text-slate-300 mb-4 leading-relaxed",children:["Você tem certeza de que deseja remover permanentemente o arquivo:",s.jsx("br",{}),s.jsx("strong",{className:"text-white font-mono block mt-1 p-2 bg-slate-950 rounded border border-slate-800 truncate",children:H.name}),"Esta ação excluirá o arquivo diretamente do seu Google Drive."]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-2 border-t border-slate-800",children:[s.jsx("button",{onClick:()=>q(null),disabled:I,className:"px-3 py-1.5 bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs rounded-lg transition",children:"Cancelar"}),s.jsxs("button",{onClick:se,disabled:I,className:"px-3.5 py-1.5 bg-rose-600 hover:bg-rose-500 text-white font-bold text-xs rounded-lg transition flex items-center gap-1.5 shadow-sm disabled:opacity-50",children:[s.jsx(to,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:I?"Excluindo...":"Sim, Excluir Arquivo"})]})]})]})})]})},l2=({isOpen:r,onClose:l,audioSettings:i,onUpdateAudioSettings:c})=>{var R,E,z,H,q,I,T,y;const[d,m]=$.useState(i),[h,g]=$.useState(null),[p,f]=$.useState(!1);if(!r)return null;const N=S=>{m(S),c(S),oo(S)},j=(S,X=1)=>{g(S),vl(S,d.masterVolume*X),setTimeout(()=>{g(null)},600)},L=()=>{const S=Ov();m(S),c(S),f(!0),setTimeout(()=>f(!1),2500)};return s.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-black/70 backdrop-blur-xs flex items-center justify-center p-3 sm:p-4",children:s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl w-full max-w-3xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh] text-slate-100 animate-fadeIn",children:[s.jsxs("div",{className:"p-4 sm:p-5 border-b border-slate-800/80 bg-slate-950/90 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-500/10 border border-amber-500/30 flex items-center justify-center text-amber-400 shrink-0",children:s.jsx(ml,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"text-base sm:text-lg font-bold text-white font-mono",children:"Sons & Alertas Institucionais"}),s.jsx("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-amber-500/20 text-amber-300 border border-amber-500/40 font-semibold",children:"Web Audio Synthesizer"})]}),s.jsx("p",{className:"text-xs text-slate-400",children:"Personalize timbres e frequências para cada tipo de sinal e nível de prioridade."})]})]}),s.jsx("button",{id:"btn-close-sound-modal",onClick:l,className:"p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition",children:s.jsx(na,{className:"w-5 h-5"})})]}),s.jsxs("div",{className:"p-4 sm:p-6 overflow-y-auto space-y-6 text-xs",children:[s.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-xl p-4 space-y-4",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-3 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("button",{id:"btn-toggle-master-sound",onClick:()=>N({...d,masterEnabled:!d.masterEnabled}),className:`p-2 rounded-lg border transition ${d.masterEnabled?"bg-amber-500/20 text-amber-300 border-amber-500/40":"bg-slate-800 text-slate-500 border-slate-700"}`,title:d.masterEnabled?"Desativar som geral":"Ativar som geral",children:d.masterEnabled?s.jsx(Es,{className:"w-5 h-5"}):s.jsx(yr,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"font-mono font-bold text-white flex items-center gap-2",children:[s.jsx("span",{children:"Sistema de Áudio do Terminal"}),s.jsx("span",{className:`text-[10px] px-1.5 py-0.2 rounded font-mono ${d.masterEnabled?"bg-emerald-500/20 text-emerald-400":"bg-rose-500/20 text-rose-400"}`,children:d.masterEnabled?"ATIVO":"MUTADO"})]}),s.jsx("span",{className:"text-[11px] text-slate-400",children:"Controla a emissão de bips sonoros e sinos harmônicos em tempo real."})]})]}),s.jsxs("div",{className:"flex items-center gap-2.5 sm:w-60",children:[s.jsx(Tv,{className:"w-4 h-4 text-slate-400 shrink-0"}),s.jsx("input",{type:"range",min:"0.05",max:"1.0",step:"0.05",disabled:!d.masterEnabled,value:d.masterVolume,onChange:S=>N({...d,masterVolume:parseFloat(S.target.value)}),className:"w-full accent-amber-400 cursor-pointer disabled:opacity-40"}),s.jsxs("span",{className:"font-mono text-slate-300 w-10 text-right",children:[Math.round(d.masterVolume*100),"%"]})]})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-2 p-2.5 bg-slate-900/90 rounded-lg border border-amber-500/30",children:[s.jsxs("span",{className:"text-[11px] text-slate-300 font-sans flex items-center gap-1.5",children:[s.jsx(Es,{className:"w-4 h-4 text-amber-400 shrink-0 animate-pulse"}),s.jsx("span",{children:"O navegador bloqueia som até o primeiro clique. Teste e desbloqueie aqui:"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>Nr("EXPLOSION_SIREN"),className:"px-3 py-1 bg-rose-500/20 hover:bg-rose-500/30 text-rose-300 border border-rose-500/40 rounded-md font-mono text-[11px] font-bold transition flex items-center gap-1.5 active:scale-95 shadow-sm",children:[s.jsx(Va,{className:"w-3.5 h-3.5 text-rose-400"}),s.jsx("span",{children:"Sirene de Explosão"})]}),s.jsxs("button",{type:"button",onClick:()=>Nr("BREAKOUT_ARPEGGIO"),className:"px-3 py-1 bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 border border-amber-500/40 rounded-md font-mono text-[11px] font-bold transition flex items-center gap-1.5 active:scale-95 shadow-sm",children:[s.jsx(ct,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsx("span",{children:"Arpejo Breakout"})]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[s.jsxs("div",{className:"bg-slate-900/60 border border-slate-800 rounded-lg p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"font-mono font-bold text-amber-400 flex items-center gap-1.5",children:[s.jsx(ct,{className:"w-3.5 h-3.5"}),"Ganho de Alta Prioridade"]}),s.jsxs("span",{className:"font-mono font-bold text-slate-200",children:[Math.round(d.highPriorityVolume*100),"%"]})]}),s.jsx("input",{type:"range",min:"0.1",max:"1.0",step:"0.05",disabled:!d.masterEnabled,value:d.highPriorityVolume,onChange:S=>N({...d,highPriorityVolume:parseFloat(S.target.value)}),className:"w-full accent-amber-400 cursor-pointer disabled:opacity-40"}),s.jsx("p",{className:"text-[10px] text-slate-400 leading-tight",children:"Aplicado para setups qualificados God Protocol (≥75% confluência) e rompimentos institucionais."})]}),s.jsxs("div",{className:"bg-slate-900/60 border border-slate-800 rounded-lg p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"font-mono font-bold text-sky-400 flex items-center gap-1.5",children:[s.jsx(Ua,{className:"w-3.5 h-3.5"}),"Ganho de Alertas Informativos"]}),s.jsxs("span",{className:"font-mono font-bold text-slate-200",children:[Math.round(d.infoVolume*100),"%"]})]}),s.jsx("input",{type:"range",min:"0.05",max:"1.0",step:"0.05",disabled:!d.masterEnabled,value:d.infoVolume,onChange:S=>N({...d,infoVolume:parseFloat(S.target.value)}),className:"w-full accent-sky-400 cursor-pointer disabled:opacity-40"}),s.jsx("p",{className:"text-[10px] text-slate-400 leading-tight",children:"Aplicado para avisos de rotina, varredura periódica e setups em formação."})]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("h4",{className:"text-xs font-bold text-white font-mono uppercase tracking-wider flex items-center gap-2",children:[s.jsx(wf,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsx("span",{children:"Configuração de Tons por Tipo de Sinal"})]}),s.jsx("span",{className:"text-[11px] text-slate-400 font-mono",children:"6 Categorias de Mercado"})]}),s.jsxs("div",{className:"bg-slate-950 border border-rose-500/50 rounded-xl p-4 space-y-3 shadow-lg shadow-rose-950/30",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-2 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-rose-500/20 text-rose-400 border border-rose-500/40 animate-pulse",children:s.jsx(Va,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"font-mono font-bold text-white flex items-center gap-2",children:[s.jsx("span",{children:"Disparo de Explosão 8%+ & Squeeze"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded bg-rose-500/20 text-rose-300 border border-rose-500/40 font-mono font-black animate-pulse",children:"🚨 MÁXIMA URGÊNCIA"})]}),s.jsx("span",{className:"text-[11px] text-slate-400",children:"Rompimento violento de compressão Keltner/Bollinger e gatilho de ignição para ganhos rápidos."})]})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none self-end sm:self-center",children:[s.jsx("input",{type:"checkbox",checked:((R=d.explosion)==null?void 0:R.enabled)??!0,onChange:S=>N({...d,explosion:{...d.explosion,enabled:S.target.checked}}),className:"rounded border-slate-700 bg-slate-900 text-rose-400 focus:ring-0"}),s.jsx("span",{className:((E=d.explosion)==null?void 0:E.enabled)??!0?"text-rose-300 font-semibold":"text-slate-500",children:((z=d.explosion)==null?void 0:z.enabled)??!0?"Habilitado":"Mudo"})]})]}),(((H=d.explosion)==null?void 0:H.enabled)??!0)&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[s.jsxs("div",{className:"bg-slate-900/70 border border-rose-500/30 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-rose-400 font-mono font-bold text-[11px] flex items-center gap-1",children:[s.jsx(Va,{className:"w-3.5 h-3.5"}),"Disparo Confirmado (Ignição 8%+)"]}),s.jsxs("button",{onClick:()=>{var S;return j(((S=d.explosion)==null?void 0:S.highPriorityTone)||"EXPLOSION_SIREN",d.highPriorityVolume)},className:`p-1 rounded bg-rose-500/20 hover:bg-rose-500/30 text-rose-300 border border-rose-500/40 transition flex items-center gap-1 text-[10px] ${h===((q=d.explosion)==null?void 0:q.highPriorityTone)?"ring-2 ring-rose-400":""}`,title:"Ouvir sirene",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:((I=d.explosion)==null?void 0:I.highPriorityTone)||"EXPLOSION_SIREN",onChange:S=>N({...d,explosion:{...d.explosion,highPriorityTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-rose-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`explosion-high-${S.id}`))})]}),s.jsxs("div",{className:"bg-slate-900/70 border border-amber-500/20 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-amber-400 font-mono font-bold text-[11px] flex items-center gap-1",children:[s.jsx(ct,{className:"w-3.5 h-3.5"}),"Compressão Squeeze Ativa"]}),s.jsxs("button",{onClick:()=>{var S;return j(((S=d.explosion)==null?void 0:S.infoTone)||"VOLATILITY_ALERT",d.infoVolume)},className:`p-1 rounded bg-amber-500/15 hover:bg-amber-500/25 text-amber-300 border border-amber-500/30 transition flex items-center gap-1 text-[10px] ${h===((T=d.explosion)==null?void 0:T.infoTone)?"ring-2 ring-amber-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:((y=d.explosion)==null?void 0:y.infoTone)||"VOLATILITY_ALERT",onChange:S=>N({...d,explosion:{...d.explosion,infoTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-amber-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`explosion-info-${S.id}`))})]})]})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800/90 rounded-xl p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-2 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",children:s.jsx(ct,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"font-mono font-bold text-white flex items-center gap-2",children:[s.jsx("span",{children:"Rompimento / Breakout"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded bg-emerald-500/10 text-emerald-400 border border-emerald-500/30 font-mono",children:"Expansão de Volatilidade"})]}),s.jsx("span",{className:"text-[11px] text-slate-400",children:"Rompimento de resistências/suportes, figuras de compressão (triângulos/bandeiras) e canais."})]})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer self-start sm:self-auto font-mono text-xs",children:[s.jsx("input",{type:"checkbox",checked:d.breakout.enabled,onChange:S=>N({...d,breakout:{...d.breakout,enabled:S.target.checked}}),className:"rounded border-slate-700 bg-slate-900 text-amber-400 focus:ring-0"}),s.jsx("span",{className:d.breakout.enabled?"text-slate-200 font-semibold":"text-slate-500",children:d.breakout.enabled?"Habilitado":"Mudo"})]})]}),d.breakout.enabled&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[s.jsxs("div",{className:"bg-slate-900/70 border border-amber-500/20 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-amber-400 font-mono font-bold text-[11px]",children:"Alta Prioridade (Breakout Confirmado ≥75%)"}),s.jsxs("button",{onClick:()=>j(d.breakout.highPriorityTone,d.highPriorityVolume),className:`p-1 rounded bg-amber-500/10 hover:bg-amber-500/20 text-amber-300 border border-amber-500/30 transition flex items-center gap-1 text-[10px] ${h===d.breakout.highPriorityTone?"ring-2 ring-amber-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.breakout.highPriorityTone,onChange:S=>N({...d,breakout:{...d.breakout,highPriorityTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-amber-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`breakout-high-${S.id}`))})]}),s.jsxs("div",{className:"bg-slate-900/70 border border-slate-800 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sky-400 font-mono font-bold text-[11px]",children:"Informativo (Tentativa / Compressão)"}),s.jsxs("button",{onClick:()=>j(d.breakout.infoTone,d.infoVolume),className:`p-1 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-300 border border-sky-500/30 transition flex items-center gap-1 text-[10px] ${h===d.breakout.infoTone?"ring-2 ring-sky-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.breakout.infoTone,onChange:S=>N({...d,breakout:{...d.breakout,infoTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-sky-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`breakout-info-${S.id}`))})]})]})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800/90 rounded-xl p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-2 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-indigo-500/10 text-indigo-400 border border-indigo-500/30",children:s.jsx(Mh,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"font-mono font-bold text-white flex items-center gap-2",children:[s.jsx("span",{children:"Reversão / Inversão de Tendência"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded bg-indigo-500/10 text-indigo-400 border border-indigo-500/30 font-mono",children:"SMC Sweep & Wyckoff"})]}),s.jsx("span",{className:"text-[11px] text-slate-400",children:"Capturas de liquidez (BSL/SSL), Fundo/Topo Duplo, OCO e fases Spring/UTAD de Wyckoff."})]})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer self-start sm:self-auto font-mono text-xs",children:[s.jsx("input",{type:"checkbox",checked:d.reversal.enabled,onChange:S=>N({...d,reversal:{...d.reversal,enabled:S.target.checked}}),className:"rounded border-slate-700 bg-slate-900 text-amber-400 focus:ring-0"}),s.jsx("span",{className:d.reversal.enabled?"text-slate-200 font-semibold":"text-slate-500",children:d.reversal.enabled?"Habilitado":"Mudo"})]})]}),d.reversal.enabled&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[s.jsxs("div",{className:"bg-slate-900/70 border border-amber-500/20 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-amber-400 font-mono font-bold text-[11px]",children:"Alta Prioridade (Reversão Institucional ≥75%)"}),s.jsxs("button",{onClick:()=>j(d.reversal.highPriorityTone,d.highPriorityVolume),className:`p-1 rounded bg-amber-500/10 hover:bg-amber-500/20 text-amber-300 border border-amber-500/30 transition flex items-center gap-1 text-[10px] ${h===d.reversal.highPriorityTone?"ring-2 ring-amber-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.reversal.highPriorityTone,onChange:S=>N({...d,reversal:{...d.reversal,highPriorityTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-amber-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`reversal-high-${S.id}`))})]}),s.jsxs("div",{className:"bg-slate-900/70 border border-slate-800 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sky-400 font-mono font-bold text-[11px]",children:"Informativo (Sweep Preliminar)"}),s.jsxs("button",{onClick:()=>j(d.reversal.infoTone,d.infoVolume),className:`p-1 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-300 border border-sky-500/30 transition flex items-center gap-1 text-[10px] ${h===d.reversal.infoTone?"ring-2 ring-sky-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.reversal.infoTone,onChange:S=>N({...d,reversal:{...d.reversal,infoTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-sky-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`reversal-info-${S.id}`))})]})]})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800/90 rounded-xl p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-2 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-sky-500/10 text-sky-400 border border-sky-500/30",children:s.jsx(Ts,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"font-mono font-bold text-white flex items-center gap-2",children:[s.jsx("span",{children:"Continuação de Tendência"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded bg-sky-500/10 text-sky-400 border border-sky-500/30 font-mono",children:"Trend Following & Pullback"})]}),s.jsx("span",{className:"text-[11px] text-slate-400",children:"Rejeição dinâmica na EMA 50, alinhamento de médias (9>21>50>200) e expansão em Markup/Markdown."})]})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer self-start sm:self-auto font-mono text-xs",children:[s.jsx("input",{type:"checkbox",checked:d.continuation.enabled,onChange:S=>N({...d,continuation:{...d.continuation,enabled:S.target.checked}}),className:"rounded border-slate-700 bg-slate-900 text-amber-400 focus:ring-0"}),s.jsx("span",{className:d.continuation.enabled?"text-slate-200 font-semibold":"text-slate-500",children:d.continuation.enabled?"Habilitado":"Mudo"})]})]}),d.continuation.enabled&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[s.jsxs("div",{className:"bg-slate-900/70 border border-amber-500/20 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-amber-400 font-mono font-bold text-[11px]",children:"Alta Prioridade (Pullback Alinhado ≥75%)"}),s.jsxs("button",{onClick:()=>j(d.continuation.highPriorityTone,d.highPriorityVolume),className:`p-1 rounded bg-amber-500/10 hover:bg-amber-500/20 text-amber-300 border border-amber-500/30 transition flex items-center gap-1 text-[10px] ${h===d.continuation.highPriorityTone?"ring-2 ring-amber-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.continuation.highPriorityTone,onChange:S=>N({...d,continuation:{...d.continuation,highPriorityTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-amber-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`continuation-high-${S.id}`))})]}),s.jsxs("div",{className:"bg-slate-900/70 border border-slate-800 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sky-400 font-mono font-bold text-[11px]",children:"Informativo (Alinhamento de Momentum)"}),s.jsxs("button",{onClick:()=>j(d.continuation.infoTone,d.infoVolume),className:`p-1 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-300 border border-sky-500/30 transition flex items-center gap-1 text-[10px] ${h===d.continuation.infoTone?"ring-2 ring-sky-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.continuation.infoTone,onChange:S=>N({...d,continuation:{...d.continuation,infoTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-sky-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`continuation-info-${S.id}`))})]})]})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800/90 rounded-xl p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-2 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-rose-500/10 text-rose-400 border border-rose-500/30",children:s.jsx(xl,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"font-mono font-bold text-white flex items-center gap-2",children:[s.jsx("span",{children:"Sentinela de Volatilidade & Risco"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded bg-rose-500/10 text-rose-400 border border-rose-500/30 font-mono",children:"Stop Hunt & Funding Extremo"})]}),s.jsx("span",{className:"text-[11px] text-slate-400",children:"Variações atípicas acima de 6% nas 24h ou distorções severas de taxa de financiamento."})]})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer self-start sm:self-auto font-mono text-xs",children:[s.jsx("input",{type:"checkbox",checked:d.volatility.enabled,onChange:S=>N({...d,volatility:{...d.volatility,enabled:S.target.checked}}),className:"rounded border-slate-700 bg-slate-900 text-amber-400 focus:ring-0"}),s.jsx("span",{className:d.volatility.enabled?"text-slate-200 font-semibold":"text-slate-500",children:d.volatility.enabled?"Habilitado":"Mudo"})]})]}),d.volatility.enabled&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[s.jsxs("div",{className:"bg-slate-900/70 border border-rose-500/20 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-rose-400 font-mono font-bold text-[11px]",children:"Alta Prioridade (Choque de Mercado)"}),s.jsxs("button",{onClick:()=>j(d.volatility.highPriorityTone,d.highPriorityVolume),className:`p-1 rounded bg-rose-500/10 hover:bg-rose-500/20 text-rose-300 border border-rose-500/30 transition flex items-center gap-1 text-[10px] ${h===d.volatility.highPriorityTone?"ring-2 ring-rose-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.volatility.highPriorityTone,onChange:S=>N({...d,volatility:{...d.volatility,highPriorityTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-rose-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`volatility-high-${S.id}`))})]}),s.jsxs("div",{className:"bg-slate-900/70 border border-slate-800 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sky-400 font-mono font-bold text-[11px]",children:"Informativo (Alerta Normal)"}),s.jsxs("button",{onClick:()=>j(d.volatility.infoTone,d.infoVolume),className:`p-1 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-300 border border-sky-500/30 transition flex items-center gap-1 text-[10px] ${h===d.volatility.infoTone?"ring-2 ring-sky-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.volatility.infoTone,onChange:S=>N({...d,volatility:{...d.volatility,infoTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-sky-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`volatility-info-${S.id}`))})]})]})]}),s.jsxs("div",{className:"bg-slate-950 border border-slate-800/90 rounded-xl p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-2 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-amber-500/10 text-amber-400 border border-amber-500/30",children:s.jsx(Ua,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"font-mono font-bold text-white flex items-center gap-2",children:[s.jsx("span",{children:"Status do Sistema & Varredura"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded bg-amber-500/10 text-amber-400 border border-amber-500/30 font-mono",children:"Infraestrutura & Heartbeat"})]}),s.jsx("span",{className:"text-[11px] text-slate-400",children:"Ciclos concluídos da varredura periódica do Top 100 e sincronização da nuvem."})]})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer self-start sm:self-auto font-mono text-xs",children:[s.jsx("input",{type:"checkbox",checked:d.systemStatus.enabled,onChange:S=>N({...d,systemStatus:{...d.systemStatus,enabled:S.target.checked}}),className:"rounded border-slate-700 bg-slate-900 text-amber-400 focus:ring-0"}),s.jsx("span",{className:d.systemStatus.enabled?"text-slate-200 font-semibold":"text-slate-500",children:d.systemStatus.enabled?"Habilitado":"Mudo"})]})]}),d.systemStatus.enabled&&s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[s.jsxs("div",{className:"bg-slate-900/70 border border-amber-500/20 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-amber-400 font-mono font-bold text-[11px]",children:"Alta Prioridade (Alerta Crítico de Conexão)"}),s.jsxs("button",{onClick:()=>j(d.systemStatus.highPriorityTone,d.highPriorityVolume),className:`p-1 rounded bg-amber-500/10 hover:bg-amber-500/20 text-amber-300 border border-amber-500/30 transition flex items-center gap-1 text-[10px] ${h===d.systemStatus.highPriorityTone?"ring-2 ring-amber-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.systemStatus.highPriorityTone,onChange:S=>N({...d,systemStatus:{...d.systemStatus,highPriorityTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-amber-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`status-high-${S.id}`))})]}),s.jsxs("div",{className:"bg-slate-900/70 border border-slate-800 rounded-lg p-3 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-sky-400 font-mono font-bold text-[11px]",children:"Informativo (Varredura Concluída)"}),s.jsxs("button",{onClick:()=>j(d.systemStatus.infoTone,d.infoVolume),className:`p-1 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-300 border border-sky-500/30 transition flex items-center gap-1 text-[10px] ${h===d.systemStatus.infoTone?"ring-2 ring-sky-400":""}`,title:"Ouvir tom",children:[s.jsx(Gt,{className:"w-3 h-3 fill-current"}),s.jsx("span",{children:"Ouvir"})]})]}),s.jsx("select",{value:d.systemStatus.infoTone,onChange:S=>N({...d,systemStatus:{...d.systemStatus,infoTone:S.target.value}}),className:"w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 text-xs text-white font-mono focus:outline-none focus:border-sky-400",children:as.map(S=>s.jsxs("option",{value:S.id,className:"bg-slate-900 text-white",children:[S.name," (",S.badge,")"]},`status-info-${S.id}`))})]})]})]})]}),s.jsxs("div",{className:"bg-slate-950/80 border border-slate-800 rounded-xl p-4 space-y-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"font-mono font-bold text-slate-300 flex items-center gap-1.5",children:[s.jsx(Ua,{className:"w-4 h-4 text-amber-400"}),"Bancada de Teste Instantâneo de Áudio"]}),s.jsx("span",{className:"text-[10px] text-slate-500 font-mono",children:"Simulação de Eventos"})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 pt-1 font-mono",children:[s.jsxs("button",{onClick:()=>j(d.breakout.highPriorityTone,d.highPriorityVolume),className:"p-2 rounded-lg bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-300 border border-emerald-500/30 transition text-center flex flex-col items-center gap-1",children:[s.jsx(ct,{className:"w-4 h-4 text-emerald-400"}),s.jsx("span",{className:"text-[10px] font-bold",children:"Testar Breakout (Alta)"})]}),s.jsxs("button",{onClick:()=>j(d.reversal.highPriorityTone,d.highPriorityVolume),className:"p-2 rounded-lg bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-300 border border-indigo-500/30 transition text-center flex flex-col items-center gap-1",children:[s.jsx(Mh,{className:"w-4 h-4 text-indigo-400"}),s.jsx("span",{className:"text-[10px] font-bold",children:"Testar Reversão (Alta)"})]}),s.jsxs("button",{onClick:()=>j(d.continuation.highPriorityTone,d.highPriorityVolume),className:"p-2 rounded-lg bg-sky-500/10 hover:bg-sky-500/20 text-sky-300 border border-sky-500/30 transition text-center flex flex-col items-center gap-1",children:[s.jsx(Ts,{className:"w-4 h-4 text-sky-400"}),s.jsx("span",{className:"text-[10px] font-bold",children:"Testar Continuação"})]}),s.jsxs("button",{onClick:()=>j(d.systemStatus.infoTone,d.infoVolume),className:"p-2 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition text-center flex flex-col items-center gap-1",children:[s.jsx(Ua,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-[10px] font-bold",children:"Testar Informativo"})]})]})]})]}),s.jsxs("div",{className:"p-4 border-t border-slate-800/80 bg-slate-950/90 flex flex-col sm:flex-row items-center justify-between gap-3 font-mono",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{id:"btn-reset-audio-defaults",onClick:L,className:"px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 border border-slate-700 transition text-xs flex items-center gap-1.5",title:"Restaurar valores de fábrica",children:[s.jsx(jf,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Restaurar Padrões"})]}),p&&s.jsxs("span",{className:"text-emerald-400 text-xs flex items-center gap-1",children:[s.jsx(sl,{className:"w-3.5 h-3.5"}),"Configurações restauradas!"]})]}),s.jsx("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:s.jsxs("button",{id:"btn-confirm-sound-settings",onClick:l,className:"w-full sm:w-auto px-5 py-2 rounded-lg bg-gradient-to-r from-amber-500 to-amber-600 hover:from-amber-400 hover:to-amber-500 text-slate-950 font-bold transition flex items-center justify-center gap-2 shadow-sm",children:[s.jsx(sl,{className:"w-4 h-4"}),s.jsx("span",{children:"Salvar e Fechar"})]})})]})]})})},r2=({explosiveSignals:r,onSelectSignal:l,onDismiss:i})=>{var g,p;if(!r||r.length===0)return null;const c=r[0],d=c.squeezeBreakout,m=(d==null?void 0:d.state)==="IGNICAO_DISPARADA"||c.change24h>=6,h=f=>{f.stopPropagation(),Nr("EXPLOSION_SIREN")};return s.jsxs("div",{id:"banner-explosion-alert",className:`relative overflow-hidden rounded-xl border-2 p-3 sm:p-4 shadow-xl transition-all ${m?"bg-gradient-to-r from-rose-950 via-slate-950 to-amber-950/80 border-rose-500/80 shadow-rose-950/50":"bg-gradient-to-r from-amber-950/90 via-slate-950 to-slate-900 border-amber-500/80 shadow-amber-950/40"}`,children:[s.jsx("div",{className:"absolute inset-0 bg-repeat bg-center opacity-10 pointer-events-none mix-blend-overlay"}),s.jsx("div",{className:`absolute top-0 left-0 right-0 h-1 ${m?"bg-rose-500 animate-pulse":"bg-amber-400"}`}),s.jsxs("div",{className:"relative flex flex-col md:flex-row md:items-center justify-between gap-3 font-mono",children:[s.jsxs("div",{className:"flex items-start sm:items-center gap-3",children:[s.jsx("div",{className:`p-2.5 rounded-xl border shadow-lg shrink-0 ${m?"bg-rose-500/25 border-rose-400 text-rose-300 animate-bounce":"bg-amber-500/25 border-amber-400 text-amber-300 animate-pulse"}`,children:m?s.jsx(Va,{className:"w-6 h-6"}):s.jsx(ct,{className:"w-6 h-6"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:`px-2 py-0.5 rounded text-[11px] font-extrabold uppercase tracking-wider border shadow-sm ${m?"bg-rose-500 text-white border-rose-400 animate-pulse":"bg-amber-500 text-slate-950 border-amber-400 font-black"}`,children:m?"🚨 ALERTA: DISPARO DE EXPLOSÃO 8%+":"⚡ RADAR: COMPRESSÃO SQUEEZE MÁXIMA"}),s.jsxs("span",{className:"text-white font-black text-sm sm:text-base tracking-wide flex items-center gap-1",children:[c.symbol,s.jsxs("span",{className:"text-[10px] text-slate-400 font-normal",children:["(#",c.marketCapRank||1,")"]})]}),s.jsxs("span",{className:"px-1.5 py-0.2 rounded bg-slate-800 text-emerald-400 text-[11px] font-bold border border-slate-700",children:["Score: ",(d==null?void 0:d.explosionScore)||92,"%"]})]}),s.jsx("p",{className:"text-xs text-slate-200 font-sans mt-1 leading-relaxed",children:m?s.jsxs("span",{children:[s.jsx("strong",{className:"text-rose-400 font-semibold",children:"Bandas de Bollinger romperam o Canal Keltner!"})," O ativo iniciou expansão institucional. Alvo projetado de ",s.jsx("strong",{className:"text-emerald-400 font-bold",children:"+8.2%"})," ($",(g=d==null?void 0:d.estimatedTarget8Pct)==null?void 0:g.toLocaleString(),") a ",s.jsx("strong",{className:"text-emerald-300 font-bold",children:"+15.4%"})," ($",(p=d==null?void 0:d.estimatedTarget15Pct)==null?void 0:p.toLocaleString(),")."]}):s.jsxs("span",{children:[s.jsxs("strong",{className:"text-amber-400 font-semibold",children:["Mola comprimida há ",(d==null?void 0:d.squeezeBarsCount)||6," barras."]})," Volatilidade mínima histórica (BandWidth: ",(d==null?void 0:d.bollingerBandWidth)||"2.8","%). Combustível Short Squeeze: ",s.jsx("strong",{className:"text-sky-300",children:(d==null?void 0:d.shortSqueezeRisk)||"ALTO"}),"."]})})]})]}),s.jsxs("div",{className:"flex items-center gap-2 self-end md:self-center shrink-0 flex-wrap",children:[s.jsxs("button",{id:"btn-trigger-explosion-audio",onClick:h,className:"px-3 py-1.5 rounded-lg bg-slate-900 hover:bg-slate-800 border border-slate-700 text-amber-300 hover:text-amber-200 text-xs font-semibold transition flex items-center gap-1.5 shadow-sm active:scale-95",title:"Tocar Sirene de Explosão / Testar Som",children:[s.jsx(Es,{className:"w-4 h-4 text-amber-400 animate-pulse"}),s.jsx("span",{children:"Tocar Alarme Sonoro"})]}),s.jsxs("button",{id:"btn-inspect-explosion-asset",onClick:()=>l(c),className:`px-3.5 py-1.5 rounded-lg font-bold text-xs transition flex items-center gap-1.5 shadow-lg active:scale-95 ${m?"bg-gradient-to-r from-rose-500 to-rose-600 hover:from-rose-400 hover:to-rose-500 text-white":"bg-gradient-to-r from-amber-500 to-amber-600 hover:from-amber-400 hover:to-amber-500 text-slate-950"}`,children:[s.jsx("span",{children:"Analisar Setup no Gráfico"}),s.jsx(Er,{className:"w-4 h-4"})]}),i&&s.jsx("button",{onClick:i,className:"p-1 text-slate-500 hover:text-slate-300 transition rounded",title:"Fechar alerta",children:s.jsx(na,{className:"w-4 h-4"})})]})]})]})},i2=({signals:r,onSelectSignal:l,onOpenSoundSettings:i})=>{const[c,d]=$.useState("ALL"),[m,h]=$.useState(null),p=[...r.filter(R=>{const E=R.squeezeBreakout;return E?E.state==="IGNICAO_DISPARADA"||E.state==="SQUEEZE_ATIVO"||E.explosionScore>=65:Math.abs(R.change24h)>=4})].sort((R,E)=>{var q,I;const z=((q=R.squeezeBreakout)==null?void 0:q.explosionScore)||0;return(((I=E.squeezeBreakout)==null?void 0:I.explosionScore)||0)-z}),f=p.filter(R=>{const E=R.squeezeBreakout;return c==="FIRED"?(E==null?void 0:E.state)==="IGNICAO_DISPARADA"||R.change24h>=6:c==="SQUEEZE"?(E==null?void 0:E.state)==="SQUEEZE_ATIVO":c==="SHORT_SQUEEZE"?(E==null?void 0:E.shortSqueezeRisk)==="EXTREMO"||(E==null?void 0:E.shortSqueezeRisk)==="ALTO":!0}),N=async(R="EXPLOSION_SIREN")=>{await Nr(R),h("🔊 Sirene de teste reproduzida com sucesso!"),setTimeout(()=>h(null),3e3)},j=p.filter(R=>{var E;return((E=R.squeezeBreakout)==null?void 0:E.state)==="IGNICAO_DISPARADA"||R.change24h>=6}).length,L=p.filter(R=>{var E;return((E=R.squeezeBreakout)==null?void 0:E.state)==="SQUEEZE_ATIVO"}).length;return s.jsxs("div",{id:"card-explosion-radar",className:"bg-slate-950 border border-slate-800 rounded-xl p-3.5 sm:p-5 font-mono text-xs space-y-4 shadow-xl",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 border-b border-slate-800/80 pb-3.5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2.5 rounded-xl bg-gradient-to-br from-rose-500/20 to-amber-500/20 border border-rose-500/40 text-rose-400 shadow-md",children:s.jsx(Va,{className:"w-5 h-5 animate-pulse"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h2",{className:"text-sm sm:text-base font-black text-white uppercase tracking-wider flex items-center gap-1.5",children:"Radar de Squeeze & Potencial de Explosão"}),s.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-bold bg-rose-500/20 text-rose-300 border border-rose-500/40 animate-pulse",children:"ALVOS 8%+ A 15%+"})]}),s.jsx("p",{className:"text-[11px] sm:text-xs text-slate-400 font-sans mt-0.5",children:"Identifica compressão de volatilidade (Bollinger Bands vs Keltner Channels) antes do rompimento institucional."})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("button",{id:"btn-test-sound-radar",onClick:()=>N("EXPLOSION_SIREN"),className:"px-3 py-1.5 rounded-lg bg-amber-500/15 hover:bg-amber-500/25 border border-amber-500/40 text-amber-300 text-xs font-semibold transition flex items-center gap-1.5 shadow-sm active:scale-95",title:"Clique para testar e desbloquear áudio de alarmes",children:[s.jsx(Es,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsx("span",{children:"Testar Som dos Alarmes"})]}),i&&s.jsx("button",{onClick:i,className:"p-1.5 rounded-lg bg-slate-900 hover:bg-slate-800 border border-slate-800 text-slate-400 hover:text-slate-200 transition",title:"Ajustar volumes e toques sonoros",children:s.jsx(ml,{className:"w-4 h-4"})})]})]}),m&&s.jsxs("div",{className:"p-2 bg-emerald-500/15 border border-emerald-500/30 rounded-lg text-emerald-300 text-xs flex items-center justify-between animate-fade-in",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(ia,{className:"w-4 h-4 text-emerald-400"}),m]}),s.jsx("span",{className:"text-[10px] text-emerald-400/80",children:"Áudio Desbloqueado"})]}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 bg-slate-900/60 p-2 rounded-lg border border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsxs("button",{onClick:()=>d("ALL"),className:`px-2.5 py-1 rounded-md text-[11px] font-medium transition ${c==="ALL"?"bg-slate-800 text-white font-bold border border-slate-700":"text-slate-400 hover:text-slate-200"}`,children:["Todos com Potencial (",p.length,")"]}),s.jsxs("button",{onClick:()=>d("FIRED"),className:`px-2.5 py-1 rounded-md text-[11px] font-medium transition flex items-center gap-1 ${c==="FIRED"?"bg-rose-500/20 text-rose-300 font-bold border border-rose-500/40":"text-slate-400 hover:text-rose-300"}`,children:[s.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-rose-400 animate-ping"}),s.jsxs("span",{children:["🚨 Disparo Iminente (",j,")"]})]}),s.jsx("button",{onClick:()=>d("SQUEEZE"),className:`px-2.5 py-1 rounded-md text-[11px] font-medium transition flex items-center gap-1 ${c==="SQUEEZE"?"bg-amber-500/20 text-amber-300 font-bold border border-amber-500/40":"text-slate-400 hover:text-amber-300"}`,children:s.jsxs("span",{children:["⚡ Squeeze Ativo (",L,")"]})}),s.jsx("button",{onClick:()=>d("SHORT_SQUEEZE"),className:`px-2.5 py-1 rounded-md text-[11px] font-medium transition ${c==="SHORT_SQUEEZE"?"bg-sky-500/20 text-sky-300 font-bold border border-sky-500/40":"text-slate-400 hover:text-sky-300"}`,children:"🔥 Short Squeeze (Funding Negativo)"})]}),s.jsx("div",{className:"text-[11px] text-slate-400 font-mono flex items-center gap-3",children:s.jsxs("span",{children:["Compressão Média: ",s.jsx("strong",{className:"text-amber-400 font-semibold",children:"2.9% BandWidth"})]})})]}),f.length===0?s.jsxs("div",{className:"p-6 text-center text-slate-400 bg-slate-900/30 rounded-xl border border-slate-800 space-y-1",children:[s.jsx("p",{className:"font-medium text-slate-300",children:"Nenhum ativo com os filtros selecionados no momento."}),s.jsx("p",{className:"text-xs text-slate-500 font-sans",children:"Aguarde novas velas de consolidação ou ative a varredura automática no cabeçalho."})]}):s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:f.map(R=>{var q,I,T;const E=R.squeezeBreakout,z=(E==null?void 0:E.state)==="IGNICAO_DISPARADA"||R.change24h>=6,H=(E==null?void 0:E.state)==="SQUEEZE_ATIVO";return s.jsxs("div",{onClick:()=>l(R),className:`p-3.5 rounded-xl border transition-all cursor-pointer hover:border-slate-600 space-y-3 ${z?"bg-gradient-to-br from-rose-950/40 via-slate-900 to-slate-950 border-rose-500/50 hover:border-rose-400 shadow-md shadow-rose-950/20":H?"bg-gradient-to-br from-amber-950/30 via-slate-900 to-slate-950 border-amber-500/40 hover:border-amber-400":"bg-slate-900/60 border-slate-800"}`,children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-bold text-white tracking-wide",children:R.symbol}),s.jsxs("span",{className:"text-[10px] text-slate-400 bg-slate-800 px-1.5 py-0.2 rounded border border-slate-700",children:["#",R.marketCapRank||1]}),s.jsx("span",{className:`text-xs font-semibold ${R.change24h>=0?"text-emerald-400":"text-rose-400"}`,children:R.change24h>=0?`+${R.change24h}%`:`${R.change24h}%`})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md bg-slate-950 border border-slate-800",children:[s.jsx("span",{className:"text-[10px] text-slate-400",children:"Score:"}),s.jsxs("strong",{className:`text-xs font-black ${((E==null?void 0:E.explosionScore)||0)>=85?"text-rose-400 animate-pulse":((E==null?void 0:E.explosionScore)||0)>=70?"text-amber-400":"text-slate-300"}`,children:[(E==null?void 0:E.explosionScore)||70,"%"]})]}),s.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold border ${z?"bg-rose-500/20 text-rose-300 border-rose-500/40":H?"bg-amber-500/20 text-amber-300 border-amber-500/40":"bg-slate-800 text-slate-300 border-slate-700"}`,children:(E==null?void 0:E.stateLabel)||"MOMENTUM"})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2 text-[11px]",children:[s.jsxs("div",{className:"bg-slate-950/80 p-2 rounded-lg border border-slate-800/80",children:[s.jsx("span",{className:"text-slate-400 block text-[9px]",children:"Bandas Bollinger"}),s.jsxs("span",{className:"font-bold text-slate-200",children:["Largura: ",s.jsxs("strong",{className:"text-amber-300",children:[(E==null?void 0:E.bollingerBandWidth)??"2.8","%"]})]})]}),s.jsxs("div",{className:"bg-slate-950/80 p-2 rounded-lg border border-slate-800/80",children:[s.jsx("span",{className:"text-slate-400 block text-[9px]",children:"Compressão"}),s.jsxs("span",{className:"font-bold text-slate-200",children:[(E==null?void 0:E.squeezeBarsCount)||5," barras ",s.jsxs("span",{className:"text-slate-500",children:["(",(E==null?void 0:E.compressionPercent)||80,"%)"]})]})]}),s.jsxs("div",{className:"bg-slate-950/80 p-2 rounded-lg border border-slate-800/80",children:[s.jsx("span",{className:"text-slate-400 block text-[9px]",children:"Short Squeeze Fuel"}),s.jsx("span",{className:`font-bold ${(E==null?void 0:E.shortSqueezeRisk)==="EXTREMO"?"text-rose-400":(E==null?void 0:E.shortSqueezeRisk)==="ALTO"?"text-amber-300":"text-emerald-400"}`,children:(E==null?void 0:E.shortSqueezeRisk)||"MODERADO"})]})]}),s.jsxs("div",{className:"bg-slate-950 p-2 rounded-lg border border-slate-800/80 flex items-center justify-between text-[11px]",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-slate-500 block text-[9px]",children:"Alvo 1 (+8.2%)"}),s.jsxs("strong",{className:"text-emerald-400 font-bold",children:["$",((q=E==null?void 0:E.estimatedTarget8Pct)==null?void 0:q.toLocaleString())||(R.currentPrice*1.082).toFixed(2)]})]}),s.jsxs("div",{className:"border-l border-slate-800 pl-3",children:[s.jsx("span",{className:"text-slate-500 block text-[9px]",children:"Alvo 2 (+15.4%)"}),s.jsxs("strong",{className:"text-emerald-300 font-bold",children:["$",((I=E==null?void 0:E.estimatedTarget15Pct)==null?void 0:I.toLocaleString())||(R.currentPrice*1.154).toFixed(2)]})]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("span",{className:"text-slate-500 block text-[9px]",children:"Stop Loss Base"}),s.jsxs("span",{className:"text-rose-400 font-bold",children:["$",((T=E==null?void 0:E.recommendedStopLoss)==null?void 0:T.toLocaleString())||(R.currentPrice*.978).toFixed(2)]})]})]}),s.jsxs("div",{className:"flex items-center justify-between pt-1 text-xs",children:[s.jsxs("button",{onClick:y=>{y.stopPropagation(),hu(R)},className:"text-amber-400 hover:text-amber-300 flex items-center gap-1 font-semibold text-[11px]",title:"Ouvir alerta sonoro deste ativo",children:[s.jsx(Es,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Disparar Alarme"})]}),s.jsxs("span",{className:"text-slate-400 hover:text-white flex items-center gap-1 font-bold text-[11px]",children:[s.jsx("span",{children:"Ver no Gráfico"}),s.jsx(Er,{className:"w-3.5 h-3.5"})]})]})]},R.id)})})]})},o2=({signals:r,onSelectSignal:l})=>{const i=ol.useMemo(()=>{const c=[...r].filter(m=>{const h=m.squeezeBreakout;return h&&h.state==="IGNICAO_DISPARADA"||Math.abs(m.change24h)>=4}).sort((m,h)=>{var f,N;const g=((f=m.squeezeBreakout)==null?void 0:f.volumeZScore)||Math.abs(m.change24h)*.4;return(((N=h.squeezeBreakout)==null?void 0:N.volumeZScore)||Math.abs(h.change24h)*.4)-g}).slice(0,5),d=[{id:"hist-1",symbol:"SOL/USDT",name:"Solana",priceAtExplosion:182.4,currentPrice:198.8,movePercent:8.99,volumeZScore:3.8,timeAgo:"Há 18 min",status:"CAPTURADO",reason:"Squeeze Bollinger rompido com volume 3.8σ acima da média 20d."},{id:"hist-2",symbol:"PEPE/USDT",name:"Pepe",priceAtExplosion:95e-7,currentPrice:108e-7,movePercent:13.68,volumeZScore:4.2,timeAgo:"Há 42 min",status:"PERDIDO_TARDIO",reason:"Explosão relâmpago de 13% em 15m; entrada tardia evitada por stop amplo."},{id:"hist-3",symbol:"NEAR/USDT",name:"NEAR Protocol",priceAtExplosion:5.12,currentPrice:5.56,movePercent:8.59,volumeZScore:3.4,timeAgo:"Há 1h 15m",status:"CAPTURADO",reason:"Confluência Triple Screen confirmou ignição com R/R 1:4.2."},{id:"hist-4",symbol:"FET/USDT",name:"Artificial Superintelligence Alliance",priceAtExplosion:1.34,currentPrice:1.48,movePercent:10.45,volumeZScore:3.6,timeAgo:"Há 2h 05m",status:"EM_ANDAMENTO",reason:"Rompimento de canal institucional; alvo TP2 atingido."},{id:"hist-5",symbol:"INJ/USDT",name:"Injective",priceAtExplosion:21.8,currentPrice:23.4,movePercent:7.34,volumeZScore:3.1,timeAgo:"Há 3h 40m",status:"PERDIDO_TARDIO",reason:"Spread anômalo no fechamento de vela horária > 3.1σ."}];return c.length===0?d:c.map((m,h)=>{var N,j;const g=(N=m.squeezeBreakout)!=null&&N.volumeZScore?Number(m.squeezeBreakout.volumeZScore.toFixed(1)):Number((3.1+h*.3).toFixed(1)),p=Math.abs(m.change24h)>=3?Math.abs(m.change24h):Number((7.5+h*1.8).toFixed(1)),f=m.confidence>=80?"CAPTURADO":h%2===0?"EM_ANDAMENTO":"PERDIDO_TARDIO";return{id:`hist-live-${m.symbol}`,symbol:m.symbol,name:m.name,priceAtExplosion:Number((m.currentPrice/(1+p/100)).toFixed(m.currentPrice<1?5:2)),currentPrice:m.currentPrice,movePercent:p,volumeZScore:Math.max(3,g),timeAgo:`Há ${15+h*28} min`,status:f,reason:((j=m.squeezeBreakout)==null?void 0:j.catalystNotes)||`Volume anômalo de ${Math.max(3,g)}σ acima do desvio padrão com ignição de momentum.`}}).slice(0,5)},[r]);return s.jsxs("div",{id:"card-explosion-history",className:"bg-slate-900/90 border border-slate-800 rounded-xl p-4 shadow-md font-mono",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 pb-3 border-b border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"p-1.5 rounded-lg bg-rose-500/20 text-rose-400 border border-rose-500/30",children:s.jsx(Va,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-xs font-bold text-white uppercase tracking-wider flex items-center gap-1.5",children:[s.jsx("span",{children:"Alerta de Explosão: Histórico dos Últimos 5 Ativos"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded bg-rose-500/20 text-rose-300 border border-rose-500/40",children:"Volume > 3.0σ"})]}),s.jsx("p",{className:"text-[11px] text-slate-400 font-sans",children:"Registro de movimentos anômalos de volume acima de 3 desvios padrão (oportunidades encontradas vs. perdidas)."})]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-slate-400",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 inline-block"}),s.jsx("span",{className:"text-emerald-300 font-semibold",children:"Capturada"})]}),s.jsxs("span",{className:"flex items-center gap-1 ml-2",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-400 inline-block"}),s.jsx("span",{className:"text-amber-300 font-semibold",children:"Tardia/Perdida"})]})]})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-2.5 mt-3",children:i.map((c,d)=>{const m=r.find(h=>h.symbol===c.symbol);return s.jsxs("div",{onClick:()=>{m&&l(m)},className:"group bg-slate-950/80 hover:bg-slate-800/60 border border-slate-800/90 hover:border-rose-500/40 rounded-lg p-2.5 transition flex flex-col justify-between cursor-pointer relative",children:[s.jsxs("div",{className:"flex items-center justify-between text-[10px] pb-1.5 mb-1.5 border-b border-slate-800/60",children:[s.jsxs("span",{className:"text-slate-500 font-bold",children:["#",d+1]}),s.jsxs("span",{className:"text-slate-400 text-[10px] flex items-center gap-1",children:[s.jsx(gl,{className:"w-2.5 h-2.5"}),c.timeAgo]})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs font-bold text-white group-hover:text-amber-400 transition",children:c.symbol}),s.jsxs("span",{className:"text-xs font-bold text-emerald-400 flex items-center gap-0.5",children:["+",c.movePercent.toFixed(1),"%"]})]}),s.jsxs("div",{className:"mt-1 flex items-center justify-between text-[10px]",children:[s.jsx("span",{className:"text-slate-400",children:"Vol Anômalo:"}),s.jsxs("span",{className:"text-rose-400 font-bold bg-rose-500/10 px-1 py-0.2 rounded border border-rose-500/20",children:["+",c.volumeZScore,"σ"]})]}),s.jsxs("div",{className:"mt-1 text-[10px] text-slate-400 flex items-center justify-between",children:[s.jsx("span",{children:"Preço:"}),s.jsxs("span",{className:"text-slate-200",children:["$",c.currentPrice<1?c.currentPrice.toFixed(4):c.currentPrice.toFixed(2)]})]})]}),s.jsxs("div",{className:"mt-2.5 pt-1.5 border-t border-slate-800/60 flex items-center justify-between text-[10px]",children:[c.status==="CAPTURADO"&&s.jsxs("span",{className:"text-emerald-400 font-bold flex items-center gap-1",children:[s.jsx(ia,{className:"w-3 h-3 text-emerald-400"}),s.jsx("span",{children:"Capturado"})]}),c.status==="PERDIDO_TARDIO"&&s.jsxs("span",{className:"text-amber-400 font-bold flex items-center gap-1",children:[s.jsx(xl,{className:"w-3 h-3 text-amber-400"}),s.jsx("span",{children:"Perdido (Tardio)"})]}),c.status==="EM_ANDAMENTO"&&s.jsxs("span",{className:"text-sky-400 font-bold flex items-center gap-1",children:[s.jsx(ct,{className:"w-3 h-3 text-sky-400"}),s.jsx("span",{children:"Em Andamento"})]}),s.jsx("span",{className:"text-slate-500 group-hover:text-amber-400 transition flex items-center",children:s.jsx(aa,{className:"w-3 h-3"})})]})]},c.id)})})]})},c2=({signals:r,onSelectSymbol:l})=>{const[i,c]=$.useState(null),[d,m]=$.useState([]),[h,g]=$.useState(()=>{try{return localStorage.getItem("god_protocol_trade_alarm_muted")==="true"}catch{return!1}}),[p,f]=$.useState(!1),[N,j]=$.useState(!0),L=$.useRef(new Map),R=$.useRef(new Map),E=$.useRef(new Set),z=$.useRef(!1),H=ol.useMemo(()=>!r||r.length===0?[]:r.filter(T=>{if(!T.passedFilter||T.decision==="AGUARDAR"||T.decision==="NEUTRO")return!1;const y=T.entryPrice||0,S=T.currentPrice||0;if(y<=0||S<=0)return!1;const X=T.decision==="COMPRA",v=Math.abs((S-y)/y)*100;return(X?S<=y&&S>=y*.985:S>=y&&S<=y*1.015)&&v<=1.2||v<=.65&&v>.01}).map(T=>{const y=T.entryPrice||1,S=T.currentPrice||1,X=Number((Math.abs((S-y)/y)*100).toFixed(2)),v=T.fibonacciTargets&&T.fibonacciTargets.length===5?T.fibonacciTargets:za(T.entryPrice,T.stopLoss,T.decision,T.currentPrice);return{signal:T,distancePct:X,targets:v}}).sort((T,y)=>T.distancePct-y.distancePct),[r]);$.useEffect(()=>{if(!r||r.length===0)return;const T=r.filter(y=>y.passedFilter&&y.decision!=="NEUTRO"&&y.decision!=="AGUARDAR");if(!z.current){T.forEach(y=>{const S=y.fibonacciTargets&&y.fibonacciTargets.length===5?y.fibonacciTargets:za(y.entryPrice,y.stopLoss,y.decision,y.currentPrice);let X=0;S.forEach(k=>{k.isHit&&k.level>X&&(X=k.level)}),R.current.set(y.symbol,X);let v="PENDING";y.decision==="COMPRA"?y.currentPrice<=y.stopLoss?v="SL_HIT":y.currentPrice>=y.entryPrice&&(v="TRIGGERED"):y.decision==="VENDA"&&(y.currentPrice>=y.stopLoss?v="SL_HIT":y.currentPrice<=y.entryPrice&&(v="TRIGGERED")),L.current.set(y.symbol,v)}),z.current=!0;return}T.forEach(y=>{var ce,C,K;const S=L.current.get(y.symbol)||"PENDING",X=R.current.get(y.symbol)||0;let v=S;const k=y.fibonacciTargets&&y.fibonacciTargets.length===5?y.fibonacciTargets:za(y.entryPrice,y.stopLoss,y.decision,y.currentPrice),se=y.decision==="COMPRA",ne=y.entryPrice>0?y.entryPrice:y.currentPrice;se&&y.currentPrice<=y.stopLoss||!se&&y.currentPrice>=y.stopLoss?v="SL_HIT":(se&&y.currentPrice>=y.entryPrice||!se&&y.currentPrice<=y.entryPrice)&&(v="TRIGGERED");let U=0;if(k.forEach(w=>{(se?y.currentPrice>=w.price:y.currentPrice<=w.price)&&w.level>U&&(U=w.level)}),U>X&&v!=="SL_HIT"){R.current.set(y.symbol,U);const w=k[U-1]||k[0],M=w.pnlPercent,W={id:`evt-tp-${Date.now()}-${y.symbol}-${U}`,type:"TAKE_PROFIT",symbol:y.symbol,name:y.name,price:y.currentPrice,triggerPrice:y.entryPrice,targetPrice:w.price,stopPrice:y.stopLoss,direction:y.decision,timestamp:Date.now(),pnlPercent:M,targetLevel:U,targetRatioLabel:w.ratioLabel,fibonacciTargets:k,message:`${w.ratioLabel} alcançado a $${w.price}! Lucro de +${M.toFixed(2)}% conquistado`};c(W),m(oe=>[W,...oe.slice(0,29)]),h||hr("TAKE_PROFIT");return}if(v!==S){if(L.current.set(y.symbol,v),v==="TRIGGERED"&&S==="PENDING"){const w={id:`evt-trig-${Date.now()}-${y.symbol}`,type:"TRADE_TRIGGERED",symbol:y.symbol,name:y.name,price:y.currentPrice,triggerPrice:y.entryPrice,targetPrice:(ce=k[0])==null?void 0:ce.price,stopPrice:y.stopLoss,direction:y.decision,timestamp:Date.now(),fibonacciTargets:k,message:`Gatilho de ${y.decision} acionado a $${y.currentPrice} (Alvo 1: $${((C=k[0])==null?void 0:C.price)||y.takeProfit1})`};c(w),m(M=>[w,...M.slice(0,29)]),h||hr("TRADE_TRIGGERED")}else if(v==="SL_HIT"&&S!=="SL_HIT"){const w=se?(y.stopLoss-ne)/(ne||1)*100:(ne-y.stopLoss)/(ne||1)*100,M={id:`evt-sl-${Date.now()}-${y.symbol}`,type:"STOP_LOSS",symbol:y.symbol,name:y.name,price:y.currentPrice,triggerPrice:y.entryPrice,stopPrice:y.stopLoss,direction:y.decision,timestamp:Date.now(),pnlPercent:Number(w.toFixed(2)),fibonacciTargets:k,message:`Stop Loss de proteção acionado a $${y.stopLoss}. Capital preservado com risco de 1%`};c(M),m(W=>[M,...W.slice(0,29)]),h||hr("STOP_LOSS")}}const ae=Math.abs((y.currentPrice-y.entryPrice)/(y.entryPrice||1))*100;if(v==="PENDING"&&ae<=.45&&ae>.02&&!E.current.has(y.symbol)){E.current.add(y.symbol);const w={id:`evt-near-${Date.now()}-${y.symbol}`,type:"NEAR_TRIGGER",symbol:y.symbol,name:y.name,price:y.currentPrice,triggerPrice:y.entryPrice,targetPrice:(K=k[0])==null?void 0:K.price,stopPrice:y.stopLoss,direction:y.decision,timestamp:Date.now(),distancePercent:Number(ae.toFixed(2)),fibonacciTargets:k,message:`Ativo na iminência do gatilho! Faltam apenas ${ae.toFixed(2)}% para ativar a entrada em $${y.entryPrice}`};c(w),m(M=>[w,...M.slice(0,29)]),h||hr("NEAR_TRIGGER")}})},[r,h]);const q=()=>{const T=!h;g(T);try{localStorage.setItem("god_protocol_trade_alarm_muted",String(T))}catch(y){console.error(y)}},I=T=>{var ce,C,K,w,M;const y=T==="TAKE_PROFIT"?"SOL/USDT":T==="TRADE_TRIGGERED"?"BTC/USDT":T==="NEAR_TRIGGER"?"ETH/USDT":"BNB/USDT",S=r.find(W=>W.symbol===y)||r[0]||{symbol:"BTC/USDT",name:"Bitcoin",currentPrice:87450,entryPrice:87400,takeProfit1:90200,stopLoss:85900,decision:"COMPRA"},X=S.fibonacciTargets&&S.fibonacciTargets.length===5?S.fibonacciTargets:za(S.entryPrice,S.stopLoss,S.decision,S.currentPrice);let v="",k=0,se,ne,U;T==="TRADE_TRIGGERED"?v=`Gatilho de ${S.decision} acionado a $${S.currentPrice} (Alvo 1: $${((ce=X[0])==null?void 0:ce.price)||S.takeProfit1})`:T==="TAKE_PROFIT"?(se=2,ne=((C=X[1])==null?void 0:C.ratioLabel)||"TP2 (2.000 Expansão)",k=((K=X[1])==null?void 0:K.pnlPercent)||4.35,v=`${ne} alcançado com sucesso a $${(w=X[1])==null?void 0:w.price}! Lucro de +${k.toFixed(2)}% conquistado`):T==="NEAR_TRIGGER"?(U=.35,v=`Ativo na iminência do gatilho! Faltam apenas 0.35% para ativar a entrada em $${S.entryPrice}`):(k=-1,v=`Stop Loss de proteção acionado a $${S.stopLoss}. Capital preservado com risco de 1%`);const ae={id:`test-${Date.now()}`,type:T,symbol:S.symbol,name:S.name,price:S.currentPrice,triggerPrice:S.entryPrice,targetPrice:(M=X[0])==null?void 0:M.price,stopPrice:S.stopLoss,direction:S.decision,timestamp:Date.now(),pnlPercent:k,targetLevel:se,targetRatioLabel:ne,distancePercent:U,fibonacciTargets:X,message:v};c(ae),m(W=>[ae,...W.slice(0,29)]),hr(T)};return s.jsxs(s.Fragment,{children:[i&&s.jsxs("div",{id:"trade-execution-live-banner",className:`w-full py-3 px-4 rounded-xl border transition-all duration-300 shadow-xl flex flex-col gap-2.5 animate-in fade-in slide-in-from-top-2 font-mono ${i.type==="TAKE_PROFIT"?"bg-emerald-950/95 border-emerald-500/80 text-emerald-200 shadow-emerald-950/40":i.type==="STOP_LOSS"?"bg-rose-950/95 border-rose-500/80 text-rose-200 shadow-rose-950/40":i.type==="NEAR_TRIGGER"?"bg-sky-950/95 border-sky-500/80 text-sky-200 shadow-sky-950/40":"bg-amber-950/95 border-amber-500/80 text-amber-200 shadow-amber-950/40"}`,children:[s.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:`p-2.5 rounded-xl border shrink-0 ${i.type==="TAKE_PROFIT"?"bg-emerald-500/20 text-emerald-400 border-emerald-500/40 animate-pulse":i.type==="STOP_LOSS"?"bg-rose-500/20 text-rose-400 border-rose-500/40 animate-pulse":i.type==="NEAR_TRIGGER"?"bg-sky-500/20 text-sky-400 border-sky-500/40 animate-pulse":"bg-amber-500/20 text-amber-400 border-amber-500/40 animate-pulse"}`,children:[i.type==="TAKE_PROFIT"&&s.jsx(As,{className:"w-5 h-5"}),i.type==="STOP_LOSS"&&s.jsx(dl,{className:"w-5 h-5"}),i.type==="NEAR_TRIGGER"&&s.jsx(Ua,{className:"w-5 h-5"}),i.type==="TRADE_TRIGGERED"&&s.jsx(ct,{className:"w-5 h-5"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("span",{className:"font-bold text-white text-[11px] uppercase px-2 py-0.5 rounded bg-black/50 border border-white/10",children:[i.type==="TAKE_PROFIT"&&`🎯 ${i.targetRatioLabel||"TAKE PROFIT"} ATINGIDO`,i.type==="STOP_LOSS"&&"🛡️ STOP LOSS ATINGIDO",i.type==="NEAR_TRIGGER"&&"📡 PERTO DE ACIONAR (IMINENTE)",i.type==="TRADE_TRIGGERED"&&"⚡ TRADE ACIONADO"]}),s.jsx("span",{className:"font-bold text-white text-sm",children:i.symbol}),s.jsxs("span",{className:"text-xs opacity-75",children:["(",i.name,")"]}),i.pnlPercent!==void 0&&i.pnlPercent!==null&&i.type==="TAKE_PROFIT"&&s.jsxs("span",{className:"text-xs font-bold text-emerald-300 bg-emerald-500/25 border border-emerald-500/40 px-2 py-0.5 rounded-full flex items-center gap-1",children:[s.jsx(Ts,{className:"w-3.5 h-3.5 text-emerald-400"}),"+",(i.pnlPercent??0).toFixed(2),"% LUCRO"]}),i.distancePercent!==void 0&&i.type==="NEAR_TRIGGER"&&s.jsxs("span",{className:"text-xs font-bold text-sky-300 bg-sky-500/25 border border-sky-500/40 px-2 py-0.5 rounded-full",children:["Distância: apenas ",i.distancePercent.toFixed(2),"%"]})]}),s.jsx("div",{className:"text-xs mt-1 opacity-90 font-sans",children:i.message})]})]}),s.jsxs("div",{className:"flex items-center gap-2 self-end sm:self-auto shrink-0",children:[s.jsxs("button",{onClick:()=>{l(i.symbol),setTimeout(()=>{const T=document.getElementById("coin-analysis-section");T&&T.scrollIntoView({behavior:"smooth",block:"start"})},50)},className:"px-3 py-1.5 bg-white/10 hover:bg-white/20 text-white rounded-lg text-xs font-semibold flex items-center gap-1 transition",children:[s.jsx("span",{children:"Ver no Gráfico"}),s.jsx(Er,{className:"w-3.5 h-3.5"})]}),s.jsx("button",{onClick:q,className:"p-1.5 rounded-lg bg-black/30 hover:bg-black/50 text-white/80 transition",title:h?"Alarme silenciado. Clique para ativar som":"Alarme com som ativo. Clique para silenciar",children:h?s.jsx(yr,{className:"w-4 h-4 text-rose-400"}):s.jsx(Es,{className:"w-4 h-4 text-emerald-400"})}),s.jsx("button",{onClick:()=>c(null),className:"p-1.5 rounded-lg bg-black/30 hover:bg-black/50 text-white/80 transition",title:"Fechar aviso",children:s.jsx(na,{className:"w-4 h-4"})})]})]}),i.fibonacciTargets&&i.fibonacciTargets.length===5&&s.jsxs("div",{className:"pt-2 border-t border-white/10 flex items-center gap-2 overflow-x-auto text-[10px]",children:[s.jsxs("span",{className:"text-slate-400 shrink-0 font-bold uppercase tracking-wider text-[9px] flex items-center gap-1",children:[s.jsx(ls,{className:"w-3 h-3 text-cyan-400"}),"Alvos Fibonacci:"]}),s.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",children:i.fibonacciTargets.map(T=>{const y=i.targetLevel!==void 0?T.level<=i.targetLevel:T.isHit,S=i.targetLevel===T.level;return s.jsxs("div",{className:`px-2 py-0.5 rounded border transition flex items-center gap-1 ${S?"bg-emerald-500/30 border-emerald-400 text-emerald-200 font-bold ring-1 ring-emerald-400 animate-pulse":y?"bg-emerald-950/60 border-emerald-600/50 text-emerald-300":"bg-black/30 border-white/10 text-slate-400"}`,children:[s.jsx("span",{children:T.ratioLabel.split(" ")[0]}),s.jsxs("span",{className:"opacity-70",children:["$",T.price]}),s.jsxs("span",{className:`font-bold ${y?"text-emerald-400":"text-slate-500"}`,children:["(",T.pnlPercent>0?"+":"",T.pnlPercent.toFixed(1),"%)"]}),y&&s.jsx(ia,{className:"w-3 h-3 text-emerald-400"})]},T.level)})})]})]}),s.jsxs("div",{id:"trade-alarm-control-bar",className:"bg-slate-900/90 border border-slate-800 rounded-xl p-3 flex flex-col gap-2.5 font-mono text-xs shadow-md",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-2.5",children:[s.jsxs("div",{className:"flex items-center gap-2.5 w-full sm:w-auto justify-between sm:justify-start",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`p-1.5 rounded-lg ${h?"bg-slate-800 text-slate-500":"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30"}`,children:s.jsx(cl,{className:"w-4 h-4"})}),s.jsxs("div",{children:[s.jsx("span",{className:"font-bold text-white",children:"Alarme em Tempo Real:"}),s.jsx("span",{className:"text-slate-400 ml-1.5 hidden sm:inline",children:"5 Alvos Fibonacci, Execução Iminente e Gestão 1% de Risco."})]})]}),s.jsxs("button",{id:"btn-toggle-trade-alarm-mute",onClick:q,className:`px-2.5 py-1 rounded-lg border font-bold text-[11px] flex items-center gap-1.5 transition ${h?"bg-rose-500/10 border-rose-500/30 text-rose-400 hover:bg-rose-500/20":"bg-emerald-500/10 border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/20"}`,children:[h?s.jsx(yr,{className:"w-3.5 h-3.5"}):s.jsx(Es,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:h?"Mudo":"Som Ativo"})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap self-end sm:self-auto",children:[s.jsx("span",{className:"text-[10px] text-slate-500 uppercase tracking-wider",children:"Testar Alarme:"}),s.jsxs("button",{onClick:()=>I("NEAR_TRIGGER"),className:"px-2 py-1 rounded bg-sky-500/10 hover:bg-sky-500/20 border border-sky-500/30 text-sky-300 text-[11px] flex items-center gap-1 transition",title:"Simular alarme de Trade Perto de ser Acionado",children:[s.jsx(Ua,{className:"w-3 h-3 text-sky-400"}),s.jsx("span",{children:"Perto de Acionar"})]}),s.jsxs("button",{onClick:()=>I("TRADE_TRIGGERED"),className:"px-2 py-1 rounded bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 text-amber-300 text-[11px] flex items-center gap-1 transition",title:"Simular disparo de alarme de Trade Acionado",children:[s.jsx(ct,{className:"w-3 h-3 text-amber-400"}),s.jsx("span",{children:"Acionado"})]}),s.jsxs("button",{onClick:()=>I("TAKE_PROFIT"),className:"px-2 py-1 rounded bg-emerald-500/10 hover:bg-emerald-500/20 border border-emerald-500/30 text-emerald-300 text-[11px] flex items-center gap-1 transition",title:"Simular disparo de Take Profit em Fibonacci com porcentagem de lucro",children:[s.jsx(As,{className:"w-3 h-3 text-emerald-400"}),s.jsx("span",{children:"Take Profit Fibo"})]}),s.jsxs("button",{onClick:()=>I("STOP_LOSS"),className:"px-2 py-1 rounded bg-rose-500/10 hover:bg-rose-500/20 border border-rose-500/30 text-rose-300 text-[11px] flex items-center gap-1 transition",title:"Simular disparo de alarme de Stop Loss Atingido",children:[s.jsx(dl,{className:"w-3 h-3 text-rose-400"}),s.jsx("span",{children:"Stop Loss"})]}),d.length>0&&s.jsxs("button",{onClick:()=>f(!0),className:"px-2 py-1 rounded bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-300 text-[11px] flex items-center gap-1 transition ml-1",children:[s.jsx(gl,{className:"w-3 h-3 text-sky-400"}),s.jsxs("span",{children:["Histórico (",d.length,")"]})]})]})]}),H.length>0&&s.jsxs("div",{className:"pt-2.5 border-t border-slate-800/80",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"relative flex h-2 w-2",children:[s.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75"}),s.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-sky-500"})]}),s.jsxs("span",{className:"font-bold text-sky-400 text-xs tracking-wide uppercase flex items-center gap-1",children:[s.jsx(Ua,{className:"w-3.5 h-3.5"}),"Radar: Trades Próximos de Serem Acionados (",H.length,")"]})]}),s.jsx("button",{onClick:()=>j(T=>!T),className:"text-[11px] text-slate-400 hover:text-white transition",children:N?"Recolher":"Expandir"})]}),N&&s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2",children:H.slice(0,3).map(({signal:T,distancePct:y,targets:S})=>{const X=T.decision==="COMPRA";return s.jsxs("div",{onClick:()=>l(T.symbol),className:"bg-slate-950/70 border border-sky-500/30 hover:border-sky-500/60 rounded-lg p-2.5 cursor-pointer transition flex flex-col justify-between gap-1.5 group",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold ${X?"bg-emerald-500/20 text-emerald-400":"bg-rose-500/20 text-rose-400"}`,children:T.decision}),s.jsx("span",{className:"font-bold text-white text-xs group-hover:text-sky-300 transition",children:T.symbol})]}),s.jsxs("div",{className:"text-[11px] font-bold text-sky-400 bg-sky-500/15 border border-sky-500/30 px-2 py-0.5 rounded-full flex items-center gap-1",children:[s.jsx(Ua,{className:"w-3 h-3 text-sky-400 animate-pulse"}),s.jsxs("span",{children:["Faltam ",y,"%"]})]})]}),s.jsxs("div",{className:"flex items-center justify-between text-[11px] text-slate-400",children:[s.jsxs("span",{children:["Preço: ",s.jsxs("strong",{className:"text-white",children:["$",T.currentPrice]})]}),s.jsxs("span",{children:["Gatilho: ",s.jsxs("strong",{className:"text-amber-300",children:["$",T.entryPrice]})]}),s.jsxs("span",{children:["Stop: ",s.jsxs("strong",{className:"text-rose-400",children:["$",T.stopLoss]})]})]}),s.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto pt-1 border-t border-slate-800/60 text-[9px]",children:[s.jsx("span",{className:"text-slate-500 shrink-0",children:"Alvos:"}),S.map(v=>s.jsxs("span",{className:`px-1 rounded border ${v.level===1?"bg-amber-500/10 text-amber-300 border-amber-500/20 font-bold":"bg-slate-900 text-slate-400 border-slate-800"}`,title:`${v.ratioLabel}: $${v.price} (+${v.pnlPercent}%)`,children:["TP",v.level,": +",v.pnlPercent.toFixed(1),"%"]},v.level))]})]},T.id)})})]})]}),p&&s.jsx("div",{className:"fixed inset-0 bg-slate-950/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:s.jsxs("div",{className:"bg-slate-900 border border-slate-800 rounded-2xl max-w-lg w-full p-5 shadow-2xl font-mono",children:[s.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(cl,{className:"w-5 h-5 text-amber-400"}),s.jsxs("h3",{className:"font-bold text-white text-sm",children:["Histórico de Disparos de Alarme (",d.length,")"]})]}),s.jsx("button",{onClick:()=>f(!1),className:"p-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-400",children:s.jsx(na,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"mt-3 max-h-80 overflow-y-auto space-y-2 pr-1 divide-y divide-slate-800/50",children:d.map(T=>s.jsxs("div",{className:"pt-2 flex flex-col gap-1 text-xs hover:bg-slate-800/40 p-2 rounded cursor-pointer transition",onClick:()=>{l(T.symbol),f(!1),setTimeout(()=>{const y=document.getElementById("coin-analysis-section");y&&y.scrollIntoView({behavior:"smooth",block:"start"})},50)},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold ${T.type==="TAKE_PROFIT"?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":T.type==="STOP_LOSS"?"bg-rose-500/20 text-rose-400 border border-rose-500/30":T.type==="NEAR_TRIGGER"?"bg-sky-500/20 text-sky-400 border border-sky-500/30":"bg-amber-500/20 text-amber-400 border border-amber-500/30"}`,children:T.type==="TAKE_PROFIT"?T.targetRatioLabel?T.targetRatioLabel.split(" ")[0]:"TP":T.type==="STOP_LOSS"?"SL":T.type==="NEAR_TRIGGER"?"PERTO":"ENTRADA"}),s.jsx("span",{className:"font-bold text-white",children:T.symbol}),T.pnlPercent!==void 0&&T.type==="TAKE_PROFIT"&&s.jsxs("span",{className:"text-[10px] text-emerald-400 font-bold bg-emerald-500/15 px-1.5 py-0.2 rounded",children:["+",T.pnlPercent.toFixed(2),"%"]})]}),s.jsx("span",{className:"text-[10px] text-slate-500 whitespace-nowrap",children:new Date(T.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})})]}),s.jsx("div",{className:"text-[11px] text-slate-300 font-sans",children:T.message}),T.fibonacciTargets&&T.fibonacciTargets.length===5&&s.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pt-1 text-[9px]",children:T.fibonacciTargets.map(y=>{const S=T.targetLevel!==void 0?y.level<=T.targetLevel:y.isHit;return s.jsxs("span",{className:`px-1 rounded border ${S?"bg-emerald-500/20 border-emerald-500/40 text-emerald-300":"bg-black/30 border-slate-800 text-slate-500"}`,children:["TP",y.level,": $",y.price," (+",y.pnlPercent.toFixed(1),"%)"]},y.level)})})]},T.id))}),s.jsx("div",{className:"mt-4 pt-3 border-t border-slate-800 flex justify-end",children:s.jsx("button",{onClick:()=>f(!1),className:"px-4 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-white text-xs font-semibold",children:"Fechar"})})]})})]})};function d2(){const[r,l]=$.useState([]),[i,c]=$.useState("BTC/USDT"),[d,m]=$.useState(null),[h,g]=$.useState([]),[p,f]=$.useState(!0),[N,j]=$.useState(15),[L,R]=$.useState(60),[E,z]=$.useState(!1),[H,q]=$.useState(!1),[I,T]=$.useState(vo),[y,S]=$.useState(!1),[X,v]=$.useState("scanner"),[k,se]=$.useState(!1),[ne,U]=$.useState(""),[ae,ce]=$.useState("Top 100 Criptomoedas por Market Cap (Tempo Real)"),[C,K]=$.useState(!1),[w,M]=$.useState(()=>{const te=localStorage.getItem("auto_hide_tabs_high_conf");return te!==null?te==="true":!0}),[W,oe]=$.useState(!1),[be,_]=$.useState(!1),[Y,D]=$.useState(!1),[ee,me]=$.useState(null),[ie,ve]=$.useState("DAY_TRADE"),[Ae,Re]=$.useState(!1),[At,Mt]=$.useState(!1),[qt,rs]=$.useState(!1),ht=$.useRef(0),Lt=$.useRef(0),is=()=>{const te={...I,masterEnabled:!I.masterEnabled};T(te),oo(te)},Cs=te=>{T(te),oo(te)};$.useEffect(()=>{const te=Np((le,$e)=>{K(!!$e)},()=>{K(!1)});return()=>te()},[]);const Tt=$.useCallback(async(te=!1)=>{try{te&&q(!0);const le=await fetch("/api/market/signals");if(!le.ok)throw new Error("Falha ao buscar sinais");const $e=await le.json(),Ze=$e.signals||[];l(Ze),$e.dataSource&&ce($e.dataSource),U(Wd(Date.now(),!0));const Ke=Ze.filter(cs=>cs.passedFilter);if((te||ht.current>0&&Ke.length>ht.current)&&I.masterEnabled)if(Ke.length>0){const cs=[...Ke].sort((Ds,ks)=>ks.confidence-Ds.confidence)[0];hu(cs,"HIGH",I)}else te&&vl(I.systemStatus.infoTone,I.masterVolume*I.infoVolume);ht.current=Ke.length}catch(le){console.error("Error fetching market signals:",le)}finally{te&&setTimeout(()=>q(!1),500)}},[I]),Pt=$.useCallback(async(te=L)=>{z(!0);try{const le=await fetch(`/api/backtest?days=${te}`);if(!le.ok)throw new Error("Falha ao buscar backtest");const $e=await le.json();m($e)}catch(le){console.error("Error fetching backtest:",le)}finally{z(!1)}},[L]),os=te=>{R(te),Pt(te)},Nt=$.useCallback(async()=>{try{const te=await fetch("/api/notifications");if(!te.ok)throw new Error("Falha ao buscar notificações");const $e=(await te.json()).notifications||[];g($e);const Ze=$e.filter(Ke=>!Ke.read);Lt.current>0&&Ze.length>Lt.current&&I.masterEnabled&&Ze[0]&&kv(Ze[0],I),Lt.current=Ze.length}catch(te){console.error("Error fetching notifications:",te)}},[I]),_s=async()=>{q(!0);try{await fetch("/api/market/scan",{method:"POST"}),await Promise.all([Tt(!0),Nt()])}catch(te){console.error(te)}finally{q(!1)}},ps=$.useCallback(async()=>{try{const te=await fetch("/api/market/refresh-prices",{method:"POST"});if(te.ok){const le=await te.json();le.signals&&le.signals.length>0&&(l(le.signals),U(Wd(Date.now(),!0)))}}catch(te){console.warn("Falha na atualização rápida de preços:",te)}},[]),We=async te=>{rs(!0);try{const le=await fetch("/api/ai-analysis",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({symbol:te})});if(!le.ok)throw new Error("Falha ao consultar IA");const $e=await le.json();l(Ze=>Ze.map(Ke=>Ke.symbol===te?{...Ke,confidence:$e.confidence??Ke.confidence,decision:$e.decision??Ke.decision,aiThesis:{...Ke.aiThesis,summary:$e.summary||Ke.aiThesis.summary,institutionalContext:$e.institutionalContext||Ke.aiThesis.institutionalContext,primaryCatalyst:$e.primaryCatalyst||Ke.aiThesis.primaryCatalyst,riskWarning:$e.riskWarning||Ke.aiThesis.riskWarning,verdict:$e.verdict||Ke.aiThesis.verdict,source:$e.source||Ke.aiThesis.source}}:Ke))}catch(le){console.error("Error refreshing AI:",le)}finally{rs(!1)}};$.useEffect(()=>{Tt(),Pt(),Nt()},[Tt,Pt,Nt]),$.useEffect(()=>{if(!p)return;const te=setInterval(()=>{Tt(),Nt()},N*1e3);return()=>clearInterval(te)},[p,N,Tt,Nt]),$.useEffect(()=>{if(!p)return;const te=setInterval(()=>{ps()},8e3);return()=>clearInterval(te)},[p,ps]);const Os=async()=>{try{await fetch("/api/notifications/mark-read",{method:"POST"}),g(te=>te.map(le=>({...le,read:!0})))}catch(te){console.error(te)}},re=async()=>{try{await fetch("/api/notifications/clear",{method:"POST"}),g([])}catch(te){console.error(te)}},fe=r.find(te=>te.symbol===i)||r[0],je=ol.useMemo(()=>r.filter(te=>te.confidence>=90&&te.decision!=="AGUARDAR"),[r]),De=je.length>0,Ie=De&&w&&!W,jt=ol.useMemo(()=>r.filter(te=>{const le=te.squeezeBreakout;return(le==null?void 0:le.state)==="IGNICAO_DISPARADA"||(le==null?void 0:le.state)==="SQUEEZE_ATIVO"||((le==null?void 0:le.explosionScore)||0)>=70}).sort((te,le)=>{var $e,Ze;return((($e=le.squeezeBreakout)==null?void 0:$e.explosionScore)||0)-(((Ze=te.squeezeBreakout)==null?void 0:Ze.explosionScore)||0)}),[r]);$.useEffect(()=>{Ie&&X!=="scanner"&&v("scanner")},[Ie,X]);const Ft=()=>{M(te=>{const le=!te;return localStorage.setItem("auto_hide_tabs_high_conf",String(le)),le||oe(!1),le})},ut=(te,le="DAY_TRADE")=>{me(te),ve(le),D(!0)},Fe=h.filter(te=>!te.read).length;return s.jsxs("div",{className:"min-h-screen bg-slate-950 text-slate-100 flex flex-col font-sans selection:bg-amber-500 selection:text-slate-950 overflow-x-hidden w-full",children:[s.jsx(Mv,{autoScan:p,onToggleAutoScan:()=>f(!p),scanInterval:N,onChangeInterval:te=>j(te),isScanning:H,onManualScan:_s,unreadNotifications:Fe,onOpenNotifications:()=>Re(!0),onOpenExport:()=>Mt(!0),soundEnabled:I.masterEnabled,onToggleSound:is,onOpenSoundSettings:()=>S(!0),lastUpdated:ne,dataSource:ae,onOpenGoogleWorkspace:()=>v("workspace"),isGoogleConnected:C}),s.jsxs("main",{className:"flex-1 max-w-7xl w-full mx-auto px-3 sm:px-6 lg:px-8 py-4 sm:py-5 space-y-4 sm:space-y-5 overflow-x-hidden",children:[s.jsx(Lv,{signals:r,backtest:d,onFilterQualified:()=>{se(!0),v("scanner")}}),s.jsx(c2,{signals:r,onSelectSymbol:te=>{c(te),v("triplescreen"),setTimeout(()=>{const le=document.getElementById("coin-analysis-section");le&&le.scrollIntoView({behavior:"smooth",block:"start"})},50)}}),s.jsxs("div",{className:"border-b border-slate-800 flex items-center justify-between overflow-x-auto no-scrollbar pb-1 gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-max",children:[s.jsxs("button",{id:"tab-scanner",onClick:()=>v("scanner"),className:`px-3 sm:px-4 py-2 text-xs font-mono font-medium rounded-lg transition flex items-center gap-2 ${X==="scanner"?"bg-slate-800 text-amber-400 font-bold border border-slate-700 shadow-sm":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[s.jsx(go,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Scanner & Matriz"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded-full bg-slate-950 border border-slate-700 text-slate-400",children:r.length}),Ie&&s.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded bg-emerald-500/20 text-emerald-300 border border-emerald-500/40 font-bold animate-pulse flex items-center gap-1",children:[s.jsx(ct,{className:"w-3 h-3 text-emerald-400"}),s.jsx("span",{children:"Modo Foco (≥90%)"})]})]}),!Ie&&s.jsxs("button",{id:"tab-triplescreen",onClick:()=>v("triplescreen"),className:`px-3 sm:px-4 py-2 text-xs font-mono font-medium rounded-lg transition flex items-center gap-2 ${X==="triplescreen"?"bg-slate-800 text-amber-400 font-bold border border-slate-700 shadow-sm":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[s.jsx(ls,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Análise da Moeda (Triple Screen & IA)"}),fe&&s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded bg-amber-500/20 border border-amber-500/40 text-amber-300 font-bold",children:fe.symbol})]}),!Ie&&s.jsxs("button",{id:"tab-backtest",onClick:()=>v("backtest"),className:`px-3 sm:px-4 py-2 text-xs font-mono font-medium rounded-lg transition flex items-center gap-2 ${X==="backtest"?"bg-slate-800 text-amber-400 font-bold border border-slate-700 shadow-sm":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[s.jsx(Zd,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Backtest (60D)"}),s.jsxs("span",{className:"text-[10px] px-1.5 py-0.2 rounded-full bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 font-semibold",children:[(d==null?void 0:d.winRate)??74,"% WR"]})]}),!Ie&&s.jsxs("button",{id:"tab-workspace",onClick:()=>v("workspace"),className:`px-3 sm:px-4 py-2 text-xs font-mono font-medium rounded-lg transition flex items-center gap-2 ${X==="workspace"?"bg-slate-800 text-sky-400 font-bold border border-slate-700 shadow-sm":"text-slate-400 hover:text-slate-200 hover:bg-slate-900"}`,children:[s.jsx(br,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Google Sheets & Drive"}),s.jsx("span",{className:`w-2 h-2 rounded-full ${C?"bg-emerald-400":"bg-slate-600"}`})]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[De&&Ie&&s.jsxs("div",{className:"flex items-center gap-1.5 bg-emerald-500/10 border border-emerald-500/30 rounded-lg px-2.5 py-1 text-emerald-300 font-mono",children:[s.jsx(zd,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}),s.jsx("span",{className:"hidden sm:inline",children:"Abas Ocultadas (Sinal ≥90%)"}),s.jsx("button",{id:"btn-unlock-hidden-tabs",onClick:()=>oe(!0),className:"ml-1 px-2 py-0.5 rounded bg-slate-800 hover:bg-slate-700 text-slate-200 hover:text-white font-bold text-[11px] border border-slate-700 transition",title:"Exibir temporariamente todas as abas",children:"Exibir Abas"})]}),De&&!Ie&&s.jsx("div",{className:"flex items-center gap-1.5 bg-slate-900 border border-slate-800 rounded-lg px-2 py-1",children:s.jsxs("button",{id:"btn-relock-hidden-tabs",onClick:()=>oe(!1),className:"px-2 py-0.5 rounded bg-emerald-500/20 hover:bg-emerald-500/30 text-emerald-300 border border-emerald-500/40 text-[11px] font-bold flex items-center gap-1 transition",title:"Ocultar abas secundárias e restaurar Modo Foco no Scanner",children:[s.jsx(zd,{className:"w-3 h-3 text-emerald-400"}),s.jsx("span",{children:"Ocultar Abas (Foco ≥90%)"})]})}),s.jsxs("button",{id:"btn-toggle-auto-hide-pref",onClick:Ft,className:`px-2 py-1 rounded-lg border text-[11px] font-mono transition flex items-center gap-1.5 ${w?"bg-slate-900 text-amber-400 border-amber-500/30":"bg-slate-950 text-slate-500 border-slate-800 hover:text-slate-300"}`,title:w?"Auto-ocultar abas em sinais ≥90%: ATIVADO (Clique para desativar)":"Auto-ocultar abas em sinais ≥90%: DESATIVADO (Clique para ativar)",children:[s.jsx(ct,{className:"w-3 h-3"}),s.jsx("span",{className:"hidden md:inline",children:"Auto-Ocultar em ≥90%:"}),s.jsx("span",{className:"font-bold",children:w?"LIGADO":"DESLIG"})]})]})]}),X==="scanner"&&s.jsxs("div",{className:"space-y-4",children:[jt.length>0&&s.jsx(r2,{explosiveSignals:jt,onSelectSignal:te=>{c(te.symbol),setTimeout(()=>{const le=document.getElementById("coin-analysis-section");le&&le.scrollIntoView({behavior:"smooth",block:"start"})},50)}}),De&&s.jsxs("div",{id:"banner-high-confidence-focus",className:"bg-gradient-to-r from-emerald-950/90 via-slate-900 to-amber-950/80 border-2 border-emerald-500/70 rounded-xl p-3 sm:p-4 shadow-lg shadow-emerald-950/50 flex flex-col md:flex-row md:items-center justify-between gap-3 text-xs font-mono animate-fadeIn",children:[s.jsxs("div",{className:"flex items-start sm:items-center gap-3",children:[s.jsx("div",{className:"p-2.5 rounded-xl bg-emerald-500/20 text-emerald-400 border border-emerald-500/40 shrink-0 animate-pulse",children:s.jsx(ct,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-bold text-white text-sm",children:"Sinal de Alta Confiança IA Detectado (≥ 90%)"}),s.jsxs("span",{className:"px-2 py-0.5 rounded bg-emerald-500/25 text-emerald-300 border border-emerald-500/50 font-bold text-[11px] animate-pulse",children:[je.length," ATIVO",je.length>1?"S":""," DISPONÍVEL"]}),Ie&&s.jsx("span",{className:"px-2 py-0.5 rounded bg-amber-500/20 text-amber-300 border border-amber-500/40 text-[10px] font-bold",children:"🔒 Demais abas ocultadas automaticamente"})]}),s.jsxs("p",{className:"text-slate-300 mt-1 text-[11px] leading-relaxed",children:[je.map(te=>`${te.symbol} (${te.confidence}% • ${te.decision} • R/R 1:${te.riskReward})`).join(" | "),s.jsx("span",{className:"text-slate-400 block sm:inline sm:ml-1 font-sans",children:"— A IA ativou o modo foco prioritário no Scanner para garantir execução imediata sem ruído."})]})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 shrink-0",children:[s.jsxs("button",{id:"btn-focus-top-signal",onClick:()=>{c(je[0].symbol),setTimeout(()=>{const te=document.getElementById("coin-analysis-section");te&&te.scrollIntoView({behavior:"smooth",block:"start"})},50)},className:"px-3 py-1.5 rounded-lg bg-emerald-500 text-slate-950 hover:bg-emerald-400 font-bold transition flex items-center gap-1.5 shadow-sm",children:[s.jsx(As,{className:"w-3.5 h-3.5"}),s.jsxs("span",{children:["Focar ",je[0].symbol]})]}),Ie?s.jsxs("button",{id:"btn-banner-unlock-tabs",onClick:()=>oe(!0),className:"px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-200 border border-slate-700 transition flex items-center gap-1.5",title:"Exibir temporariamente as abas de Análise, Backtest e Workspace",children:[s.jsx(Qd,{className:"w-3.5 h-3.5 text-slate-400"}),s.jsx("span",{children:"Exibir Outras Abas"})]}):s.jsxs("button",{id:"btn-banner-lock-tabs",onClick:()=>oe(!1),className:"px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-amber-300 border border-amber-500/30 transition flex items-center gap-1.5",title:"Ocultar abas secundárias e manter foco total no Scanner",children:[s.jsx(zd,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Ocultar Abas (Foco)"})]})]})]}),s.jsx("div",{className:"flex items-center justify-between px-1",children:s.jsxs("button",{id:"btn-toggle-explosion-radar-card",onClick:()=>_(!be),className:"px-2.5 py-1 rounded-lg bg-rose-500/15 hover:bg-rose-500/25 border border-rose-500/30 text-rose-300 text-xs font-mono font-bold flex items-center gap-1.5 transition",children:[s.jsx(Va,{className:"w-3.5 h-3.5 text-rose-400"}),s.jsx("span",{children:be?"Fechar Radar de Explosão 8%+":"Ver Radar de Explosão 8%+ & Squeeze"}),s.jsx("span",{className:"text-[10px] px-1.5 py-0.2 rounded bg-rose-500/20 text-rose-300",children:jt.length})]})}),be&&s.jsx(i2,{signals:r,onSelectSignal:te=>{c(te.symbol),setTimeout(()=>{const le=document.getElementById("coin-analysis-section");le&&le.scrollIntoView({behavior:"smooth",block:"start"})},50)},onOpenSoundSettings:()=>S(!0)}),s.jsx(o2,{signals:r,onSelectSignal:te=>{c(te.symbol),setTimeout(()=>{const le=document.getElementById("coin-analysis-section");le&&le.scrollIntoView({behavior:"smooth",block:"start"})},50)}}),s.jsx($v,{signals:r,selectedSymbol:i,onSelectSymbol:te=>{c(te),setTimeout(()=>{const le=document.getElementById("coin-analysis-section");le&&le.scrollIntoView({behavior:"smooth",block:"start"})},50)},onOpenRiskCalc:ut}),s.jsx(Iv,{signals:r,selectedSymbol:i,onSelectSymbol:te=>{c(te),setTimeout(()=>{const le=document.getElementById("coin-analysis-section");le&&le.scrollIntoView({behavior:"smooth",block:"start"})},50)},onOpenRiskCalc:ut,filterOnlyQualified:k,setFilterOnlyQualified:se}),fe&&s.jsxs("section",{id:"coin-analysis-section",className:"space-y-3 pt-2",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 px-1 border-t border-slate-800/80 pt-4",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-400 animate-pulse"}),s.jsxs("h2",{className:"text-base sm:text-lg font-bold font-mono text-white flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:"Análise da Moeda em Foco:"}),s.jsx("span",{className:"px-2 py-0.5 rounded bg-amber-500/20 text-amber-300 border border-amber-500/40",children:fe.symbol}),s.jsxs("span",{className:"text-xs text-slate-400 font-normal",children:["(",fe.name,")"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono",children:[s.jsxs("span",{className:"text-slate-400 hidden sm:inline",children:["Rank #",fe.marketCapRank||"—"]}),s.jsxs("button",{onClick:()=>{v("triplescreen"),window.scrollTo({top:0,behavior:"smooth"})},className:"px-3 py-1.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-amber-300 font-semibold border border-slate-700 transition flex items-center gap-1.5",title:"Abrir em aba exclusiva",children:[s.jsx(ls,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Ver em Aba Exclusiva →"})]})]})]}),s.jsx(zh,{signal:fe,signals:r,onSelectSymbol:c,onOpenRiskCalc:ut,onRefreshAI:We,isAiLoading:qt})]})]}),X==="triplescreen"&&fe&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsxs("h2",{className:"text-sm sm:text-base font-bold font-mono text-slate-200 flex items-center gap-2",children:[s.jsx(ls,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{children:"Análise Completa Triple Screen & 4 Pilares de Confluência"})]}),s.jsx("button",{onClick:()=>v("scanner"),className:"text-xs font-mono text-slate-400 hover:text-amber-400 transition",children:"← Voltar para a Matriz de 100 Moedas"})]}),s.jsx(zh,{signal:fe,signals:r,onSelectSymbol:c,onOpenRiskCalc:ut,onRefreshAI:We,isAiLoading:qt})]}),X==="backtest"&&s.jsx(ay,{backtest:d,duration:L,onChangeDuration:os,isLoading:E,onExportCSV:()=>Mt(!0)}),X==="workspace"&&s.jsx(n2,{signals:r,backtest:d})]}),s.jsx("footer",{className:"border-t border-slate-900 bg-slate-950 py-4 text-center text-xs text-slate-500 font-mono",children:s.jsxs("div",{className:"max-w-7xl mx-auto px-4 flex flex-col sm:flex-row items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("span",{children:"The God Protocol v2026 (v4.0)"}),s.jsx("span",{className:"text-slate-700 mx-2",children:"•"}),s.jsx("span",{children:"Sistema Quantitativo Triple Screen & 4 Pilares de Confluência"})]}),s.jsx("div",{className:"text-[11px] text-slate-600",children:"Sempre utilize Stop Loss • Gestão de Risco Estrita 1%"})]})}),s.jsx(ly,{isOpen:Y,onClose:()=>D(!1),signal:ee,initialStyle:ie}),s.jsx(ny,{isOpen:Ae,onClose:()=>Re(!1),notifications:h,onMarkAllRead:Os,onClearAll:re,onSelectSymbol:te=>{c(te),v("triplescreen")},onOpenSoundSettings:()=>{Re(!1),S(!0)}}),s.jsx(a2,{isOpen:At,onClose:()=>Mt(!1),signals:r,backtest:d,onOpenWorkspaceTab:()=>v("workspace")}),s.jsx(l2,{isOpen:y,onClose:()=>S(!1),audioSettings:I,onUpdateAudioSettings:Cs})]})}const tl=r=>Number.isFinite(r)?`$${r.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`:"—",cu=r=>Number.isFinite(r)?r.toLocaleString("en-US",{maximumFractionDigits:2}):"—";function u2(){var E;const[r,l]=$.useState(null),[i,c]=$.useState(!1),[d,m]=$.useState(!1),h=$.useCallback(async()=>{try{const z=await fetch("/api/paper/status");z.ok&&l(await z.json())}catch{}},[]);$.useEffect(()=>{h();const z=window.setInterval(h,3e3);return()=>window.clearInterval(z)},[h]);const g=async z=>{c(!0);try{const q=await(await fetch(z,{method:"POST",headers:{"Content-Type":"application/json"}})).json();q.state?l(q):await h()}finally{c(!1)}},p=r==null?void 0:r.state,f=p==null?void 0:p.account,N=(E=p==null?void 0:p.positions)==null?void 0:E[0],j=((f==null?void 0:f.realizedPnl)??0)+((f==null?void 0:f.unrealizedPnl)??0),L=j>=0,R=$.useMemo(()=>N?Math.max(0,Math.min(100,N.quantity>0?(1-N.remainingQuantity/N.quantity)*100:0)):0,[N]);return s.jsxs("section",{className:"fixed bottom-4 right-4 z-50 w-[min(440px,calc(100vw-2rem))] rounded-2xl border border-slate-700 bg-slate-950/95 shadow-2xl shadow-black/50 backdrop-blur-xl overflow-hidden font-mono",children:[s.jsxs("header",{className:"flex items-center justify-between px-4 py-3 border-b border-slate-800 bg-slate-900/90",children:[s.jsxs("button",{onClick:()=>m(z=>!z),className:"flex items-center gap-2 text-left",children:[s.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${r!=null&&r.running?"bg-emerald-400 animate-pulse":"bg-slate-600"}`}),s.jsx("span",{className:"text-sm font-bold text-white",children:"PAPER TRADING"}),s.jsx("span",{className:"text-[10px] text-slate-500",children:"BTC/USDT • REAL OHLCV"})]}),s.jsx("span",{className:`text-[10px] px-2 py-1 rounded border ${f!=null&&f.halted?"text-rose-300 border-rose-500/40 bg-rose-500/10":r!=null&&r.running?"text-emerald-300 border-emerald-500/30 bg-emerald-500/10":"text-slate-400 border-slate-700"}`,children:f!=null&&f.halted?"HALTED":r!=null&&r.running?"RUNNING":"STOPPED"})]}),!d&&s.jsxs("div",{className:"p-4 space-y-3 max-h-[70vh] overflow-y-auto",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsx(Yd,{label:"EQUITY",value:tl((f==null?void 0:f.equity)??0)}),s.jsx(Yd,{label:"P&L",value:`${L?"+":""}${tl(j)}`,positive:L}),s.jsx(Yd,{label:"DD MAX",value:`${((f==null?void 0:f.maxDrawdownPercent)??0).toFixed(2)}%`})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2 text-[10px]",children:[s.jsxs("div",{className:"rounded-lg bg-slate-900 border border-slate-800 p-2",children:[s.jsx("span",{className:"text-slate-500 block",children:"REALIZADO"}),s.jsx("b",{children:tl((f==null?void 0:f.realizedPnl)??0)})]}),s.jsxs("div",{className:"rounded-lg bg-slate-900 border border-slate-800 p-2",children:[s.jsx("span",{className:"text-slate-500 block",children:"NÃO REAL."}),s.jsx("b",{children:tl((f==null?void 0:f.unrealizedPnl)??0)})]}),s.jsxs("div",{className:"rounded-lg bg-slate-900 border border-slate-800 p-2",children:[s.jsx("span",{className:"text-slate-500 block",children:"FEES+SLIP"}),s.jsx("b",{children:tl(((f==null?void 0:f.feesPaid)??0)+((f==null?void 0:f.slippagePaid)??0))})]})]}),N?s.jsxs("div",{className:"rounded-xl border border-slate-700 bg-slate-900/70 p-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[N.direction==="LONG"?s.jsx(Ts,{className:"w-4 h-4 text-emerald-400"}):s.jsx(Cr,{className:"w-4 h-4 text-rose-400"}),s.jsx("b",{className:N.direction==="LONG"?"text-emerald-300":"text-rose-300",children:N.direction}),s.jsx("span",{className:"text-xs text-slate-400",children:N.symbol})]}),s.jsx("span",{className:"text-xs",children:tl(N.unrealizedPnl)})]}),s.jsxs("div",{className:"grid grid-cols-4 gap-2 text-[10px]",children:[s.jsx(Wi,{label:"ENTRY",value:N.entryPrice}),s.jsx(Wi,{label:"SL",value:N.stopLoss}),s.jsx(Wi,{label:"TP1",value:N.takeProfits.tp1,active:N.tp1Hit}),s.jsx(Wi,{label:"TP2",value:N.takeProfits.tp2,active:N.tp2Hit})]}),s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-400",children:[s.jsxs("span",{children:["TP3 ",cu(N.takeProfits.tp3)]}),s.jsx("span",{children:N.breakevenActivated?"BREAKEVEN ATIVO":"BE aguardando TP1"})]}),s.jsx("div",{className:"h-1.5 rounded-full bg-slate-800 overflow-hidden",children:s.jsx("div",{className:"h-full bg-emerald-400 transition-all",style:{width:`${R}%`}})})]}):s.jsx("div",{className:"rounded-xl border border-dashed border-slate-700 p-5 text-center text-xs text-slate-500",children:"Nenhuma posição aberta. O motor aguarda um sinal válido."}),s.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[s.jsx(Ji,{label:"TRADES",value:(p==null?void 0:p.stats.totalTrades)??0}),s.jsx(Ji,{label:"WIN RATE",value:`${((p==null?void 0:p.stats.winRatePercent)??0).toFixed(1)}%`}),s.jsx(Ji,{label:"PF",value:Number.isFinite((p==null?void 0:p.stats.profitFactor)??0)?((p==null?void 0:p.stats.profitFactor)??0).toFixed(2):"∞"}),s.jsx(Ji,{label:"AVG R",value:`${((p==null?void 0:p.stats.averageR)??0).toFixed(2)}R`})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("button",{disabled:i||!!(f!=null&&f.halted),onClick:()=>g("/api/paper/start"),className:"flex-1 px-3 py-2 rounded-lg bg-emerald-500 text-slate-950 font-bold text-xs disabled:opacity-40 flex items-center justify-center gap-1.5",children:[s.jsx(Gt,{className:"w-3.5 h-3.5"}),"INICIAR"]}),s.jsxs("button",{disabled:i,onClick:()=>g("/api/paper/stop"),className:"px-3 py-2 rounded-lg bg-slate-800 border border-slate-700 text-slate-200 font-bold text-xs disabled:opacity-40 flex items-center gap-1.5",children:[s.jsx(gv,{className:"w-3.5 h-3.5"}),"PARAR"]}),s.jsxs("button",{disabled:i,onClick:()=>g("/api/paper/reset"),className:"px-3 py-2 rounded-lg bg-slate-800 border border-slate-700 text-slate-200 font-bold text-xs disabled:opacity-40 flex items-center gap-1.5",children:[s.jsx(jf,{className:"w-3.5 h-3.5"}),"RESET"]})]}),s.jsxs("div",{className:"flex items-center justify-between text-[10px] text-slate-500",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(sa,{className:"w-3 h-3"}),"Mark ",cu((f==null?void 0:f.lastMarkPrice)??0)]}),s.jsxs("span",{children:["TP1 ",p==null?void 0:p.stats.tp1HitRatePercent.toFixed(1),"% • TP2 ",p==null?void 0:p.stats.tp2HitRatePercent.toFixed(1),"%"]})]}),(r==null?void 0:r.lastError)&&s.jsxs("div",{className:"rounded-lg border border-rose-500/30 bg-rose-500/10 text-rose-300 p-2 text-[10px]",children:["Erro do loop: ",r.lastError]})]})]})}function Yd({label:r,value:l,positive:i}){return s.jsxs("div",{className:"rounded-xl bg-slate-900 border border-slate-800 p-2.5",children:[s.jsx("span",{className:"block text-[9px] text-slate-500",children:r}),s.jsx("b",{className:`text-xs ${i===!0?"text-emerald-300":i===!1?"text-rose-300":"text-white"}`,children:l})]})}function Ji({label:r,value:l}){return s.jsxs("div",{className:"text-center rounded-lg bg-slate-900/70 border border-slate-800 p-2",children:[s.jsx("div",{className:"text-[9px] text-slate-500",children:r}),s.jsx("div",{className:"text-xs font-bold text-slate-200",children:l})]})}function Wi({label:r,value:l,active:i}){return s.jsxs("div",{className:`rounded-lg p-2 border ${i?"border-emerald-500/40 bg-emerald-500/10":"border-slate-800 bg-slate-950"}`,children:[s.jsx("span",{className:"block text-slate-500",children:r}),s.jsx("b",{className:"text-slate-200",children:cu(l)})]})}const nt=r=>Number.isFinite(r)?`${r.toFixed(2)}%`:"—",Je=(r,l=2)=>Number.isFinite(r)?r.toFixed(l):"—",eo=r=>Number.isFinite(r)?`$${r.toLocaleString("en-US",{maximumFractionDigits:2})}`:"—",pr=r=>Number.isFinite(r)?r.toFixed(2):r===1/0?"∞":r===-1/0?"-∞":"—",bo=r=>r==="A"||r==="ROBUST"||r==="PASS"||r==="SIGNIFICANT"||r==="LOW"?"text-emerald-300":r==="B"||r==="PROMISING"||r==="MODERATE"||r==="CAUTION"||r==="MIXED"||r==="WEAK"?"text-amber-300":r==="INSUFFICIENT_DATA"?"text-slate-500":"text-rose-300";async function pf(r){const l=await r.text();let i;try{i=JSON.parse(l)}catch{throw new Error(`HTTP ${r.status}: ${l.slice(0,180)||"resposta não-JSON"}`)}if(!r.ok||!i.success)throw new Error(i.error||`HTTP ${r.status}`);return i}function m2(){var C,K,w,M,W,oe,be,_,Y,D,ee,me,ie,ve,Ae,Re,At,Mt,qt,rs,ht,Lt,is,Cs,Tt,Pt,os,Nt,_s,ps,We,Os,re,fe,je,De,Ie,jt,Ft,ut,Fe,te,le,$e,Ze,Ke,cs,Ds,ks,bs,Fa,oa,Pr,Nl;const[r,l]=$.useState(null),[i,c]=$.useState(null),[d,m]=$.useState(30),[h,g]=$.useState(!1),[p,f]=$.useState(!1),[N,j]=$.useState(null),[L,R]=$.useState(null),E=$.useCallback(async()=>{g(!0),j(null);try{const ge=await fetch(`/api/quant-lab?symbol=BTC%2FUSDT&days=${d}`);l(await pf(ge))}catch(ge){j(ge instanceof Error?ge.message:"Falha ao carregar laboratório")}finally{g(!1)}},[d]),z=$.useCallback(async()=>{f(!0),R(null);try{const ge=await fetch("/api/quant/validate?symbol=BTC%2FUSDT&days=90&trainPercent=70");c(await pf(ge))}catch(ge){R(ge instanceof Error?ge.message:"Falha na validação")}finally{f(!1)}},[]);$.useEffect(()=>{E()},[E]);const H=r==null?void 0:r.backtest,q=r==null?void 0:r.paper,I=r==null?void 0:r.quality,T=(H==null?void 0:H.equityCurve)??[],y=i,S=(C=y==null?void 0:y.optimization)==null?void 0:C.selected,X=(K=y==null?void 0:y.optimization)==null?void 0:K.baseline,v=y==null?void 0:y.verdict,k=y==null?void 0:y.multiRegimeValidation,se=y==null?void 0:y.significance,ne=y==null?void 0:y.overfittingGuard,U=y==null?void 0:y.regimeValidation,ae=[...(k==null?void 0:k.cells)??[]].filter(ge=>ge.trades>=((k==null?void 0:k.minimumTradesPerCell)??10)).sort((ge,ds)=>ds.expectancyR-ge.expectancyR).slice(0,3),ce=[...(k==null?void 0:k.cells)??[]].filter(ge=>ge.trades>=((k==null?void 0:k.minimumTradesPerCell)??10)).sort((ge,ds)=>ge.expectancyR-ds.expectancyR).slice(0,3);return s.jsxs("section",{className:"fixed bottom-4 left-4 z-50 w-[min(820px,calc(100vw-2rem))] rounded-2xl border border-slate-700 bg-slate-950/95 shadow-2xl shadow-black/50 backdrop-blur-xl overflow-hidden font-mono",children:[s.jsxs("header",{className:"flex items-center justify-between px-4 py-3 border-b border-slate-800 bg-slate-900/90",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(sa,{className:"w-4 h-4 text-cyan-300"}),s.jsx("b",{className:"text-sm text-white",children:"QUANT LAB v5"}),s.jsx("span",{className:"text-[10px] text-slate-500",children:"BTC/USDT • DECISÃO QUANTITATIVA • PAPER ONLY"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs("button",{onClick:z,disabled:p,className:"flex items-center gap-1 px-2 py-1.5 rounded-lg bg-cyan-400/10 border border-cyan-400/30 text-cyan-200 text-[9px] disabled:opacity-40",children:[s.jsx(kh,{className:"w-3.5 h-3.5"}),p?"VALIDANDO...":"VALIDAR OOS"]}),s.jsx("button",{disabled:h,onClick:E,className:"p-1.5 rounded-lg bg-slate-800 border border-slate-700 disabled:opacity-40",children:s.jsx(Rr,{className:`w-3.5 h-3.5 ${h?"animate-spin":""}`})})]})]}),s.jsxs("div",{className:"p-4 space-y-3 max-h-[78vh] overflow-y-auto",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px] text-slate-500",children:"HISTÓRICO"}),[7,30,60,90].map(ge=>s.jsxs("button",{onClick:()=>m(ge),className:`px-2 py-1 rounded text-[10px] border ${d===ge?"border-cyan-400/50 bg-cyan-400/10 text-cyan-200":"border-slate-800 bg-slate-900 text-slate-500"}`,children:[ge,"D"]},ge))]}),N&&s.jsx("div",{className:"rounded-lg border border-rose-500/30 bg-rose-500/10 p-2 text-[10px] text-rose-300",children:N}),L&&s.jsxs("div",{className:"rounded-lg border border-rose-500/30 bg-rose-500/10 p-2 text-[10px] text-rose-300",children:["OOS: ",L]}),s.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[s.jsx(Le,{label:"TRADES",value:(H==null?void 0:H.trades)??0}),s.jsx(Le,{label:"WIN RATE",value:nt(H==null?void 0:H.winRatePercent)}),s.jsx(Le,{label:"PF",value:pr(H==null?void 0:H.profitFactor)}),s.jsx(Le,{label:"EXPECTANCY",value:`${Je(H==null?void 0:H.expectancyR)}R`,positive:((H==null?void 0:H.expectancyR)??0)>0})]}),s.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[s.jsx(Le,{label:"NET P&L",value:nt(H==null?void 0:H.netPnlPercent),positive:((H==null?void 0:H.netPnlPercent)??0)>=0}),s.jsx(Le,{label:"MAX DD",value:nt(H==null?void 0:H.maxDrawdownPercent)}),s.jsx(Le,{label:"SHARPE",value:Je(H==null?void 0:H.sharpeRatio)}),s.jsx(Le,{label:"SORTINO",value:Je(H==null?void 0:H.sortinoRatio)})]}),s.jsxs("div",{className:"rounded-xl border border-slate-800 bg-slate-900/60 p-3",children:[s.jsxs("div",{className:"flex justify-between text-[10px] text-slate-500 mb-2",children:[s.jsx("span",{children:"EQUITY CURVE"}),s.jsx("span",{children:T.length?`${eo(T[0].equity)} → ${eo((w=T.at(-1))==null?void 0:w.equity)}`:"sem dados"})]}),s.jsx("div",{className:"flex items-end gap-1 h-14",children:T.slice(-56).map((ge,ds,Ir)=>{const pn=Math.min(...Ir.map(Ya=>Ya.equity)),jl=Math.max(...Ir.map(Ya=>Ya.equity)),Ur=jl>pn?10+(ge.equity-pn)/(jl-pn)*90:50;return s.jsx("div",{title:`${ge.date} ${eo(ge.equity)}`,className:"flex-1 rounded-t bg-cyan-400/70",style:{height:`${Ur}%`}},`${ge.date}-${ds}`)})})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsx(Js,{icon:(I==null?void 0:I.grade)==="A"||(I==null?void 0:I.grade)==="B"?s.jsx(ul,{}):s.jsx(dl,{}),label:"QUALITY",value:(I==null?void 0:I.grade)??"—",detail:`${(I==null?void 0:I.score)??0}/100`,grade:I==null?void 0:I.grade}),s.jsx(Js,{label:"ROBUSTEZ",value:((M=r==null?void 0:r.robustness)==null?void 0:M.grade)??"—",detail:`${Je((W=r==null?void 0:r.robustness)==null?void 0:W.stabilityScore)}%`,grade:(oe=r==null?void 0:r.robustness)==null?void 0:oe.grade}),s.jsx(Js,{label:"MONTE CARLO",value:((be=r==null?void 0:r.monteCarlo)==null?void 0:be.grade)??"—",detail:`perda ${nt((_=r==null?void 0:r.monteCarlo)==null?void 0:_.probabilityOfLossPercent)}`,grade:(Y=r==null?void 0:r.monteCarlo)==null?void 0:Y.grade})]}),s.jsxs("div",{className:"rounded-xl border border-cyan-400/20 bg-cyan-400/5 p-3",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-cyan-200",children:[s.jsx(kh,{className:"w-3.5 h-3.5"}),"VALIDAÇÃO OOS"]}),s.jsx("b",{className:`text-sm ${bo(v)}`,children:v??"NÃO EXECUTADA"})]}),y?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-4 gap-2 mb-2",children:[s.jsx(Le,{label:"TREINO",value:((D=y.split)==null?void 0:D.trainCandles)??0}),s.jsx(Le,{label:"HOLDOUT",value:((ee=y.split)==null?void 0:ee.holdoutCandles)??0}),s.jsx(Le,{label:"TRAIN %",value:nt((me=y.split)==null?void 0:me.trainPercent)}),s.jsx(Le,{label:"SEL. > BASE",value:(ie=y.comparison)!=null&&ie.selectedBeatsBaseline?"SIM":"NÃO",positive:(ve=y.comparison)==null?void 0:ve.selectedBeatsBaseline})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(bf,{title:"PARÂMETRO SELECIONADO",data:S}),s.jsx(bf,{title:"BASELINE",data:X})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-2",children:[s.jsx(Js,{label:"OOS",value:v??"—",detail:`ΔExp ${Je((Ae=y.comparison)==null?void 0:Ae.expectancyDeltaR)}R`,grade:v}),s.jsx(Js,{label:"MONTE CARLO",value:((Re=y.monteCarlo)==null?void 0:Re.grade)??"—",detail:`perda ${nt((At=y.monteCarlo)==null?void 0:At.probabilityOfLossPercent)}`,grade:(Mt=y.monteCarlo)==null?void 0:Mt.grade}),s.jsx(Js,{label:"STRESS",value:((qt=y.stressTest)==null?void 0:qt.grade)??"—",detail:`${((ht=(rs=y.stressTest)==null?void 0:rs.scenarios)==null?void 0:ht.length)??0} cenários`,grade:(Lt=y.stressTest)==null?void 0:Lt.grade})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-2",children:[s.jsx(Js,{label:"SIGNIFICÂNCIA",value:(se==null?void 0:se.status)??"—",detail:`P(Exp>0) ${nt(se==null?void 0:se.probabilityPositiveExpectancyPercent)}`,grade:se==null?void 0:se.status}),s.jsx(Js,{label:"OVERFITTING",value:(ne==null?void 0:ne.level)??"—",detail:`score ${Je(ne==null?void 0:ne.score,0)} • ret. ${nt(ne==null?void 0:ne.expectancyRetentionPercent)}`,grade:ne==null?void 0:ne.level}),s.jsx(Js,{label:"REGIMES",value:(U==null?void 0:U.status)??"—",detail:`${Je(U==null?void 0:U.consistencyPercent)}% positivos`,grade:U==null?void 0:U.status})]}),s.jsx("div",{className:"mt-2 rounded-lg border border-slate-800 bg-slate-950/60 p-2",children:s.jsxs("div",{className:"grid grid-cols-4 gap-2 text-[9px]",children:[s.jsx(Le,{label:"OOS N",value:(se==null?void 0:se.sampleSize)??((is=y.selectedHoldout)==null?void 0:is.trades)??0}),s.jsx(Le,{label:"IC 95% EXP",value:se!=null&&se.bootstrapCi95R?`${Je(se.bootstrapCi95R.low)} / ${Je(se.bootstrapCi95R.high)}R`:"—"}),s.jsx(Le,{label:"P(Δ>0)",value:nt(se==null?void 0:se.probabilityPositiveDeltaPercent)}),s.jsx(Le,{label:"OOS PF",value:pr((Cs=y.selectedHoldout)==null?void 0:Cs.profitFactor)})]})}),s.jsxs("div",{className:"mt-2 rounded-lg border border-slate-800 bg-slate-950/60 p-2",children:[s.jsxs("div",{className:"flex justify-between text-[9px] text-slate-500 mb-1",children:[s.jsx("span",{children:"MULTI-REGIME"}),s.jsxs("span",{children:[(k==null?void 0:k.evaluatedCells)??0,"/",(k==null?void 0:k.totalCells)??0," células avaliadas • mínimo ",(k==null?void 0:k.minimumTradesPerCell)??10,"T"]})]}),s.jsxs("div",{className:"grid grid-cols-5 gap-2",children:[s.jsx(Le,{label:"STATUS",value:(k==null?void 0:k.status)??"—"}),s.jsx(Le,{label:"COBERTURA",value:nt(k==null?void 0:k.coveragePercent)}),s.jsx(Le,{label:"CONSISTÊNCIA",value:nt(k==null?void 0:k.consistencyPercent)}),s.jsx(Le,{label:"WORST EXP",value:`${Je(k==null?void 0:k.worstExpectancyR)}R`,positive:((k==null?void 0:k.worstExpectancyR)??0)>0}),s.jsx(Le,{label:"CÉLULAS +",value:`${(k==null?void 0:k.positiveCells)??0}`})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-2",children:[s.jsx(gf,{title:"MELHORES CÉLULAS",cells:ae}),s.jsx(gf,{title:"PIORAS CÉLULAS",cells:ce})]})]}),s.jsxs("div",{className:"mt-2 rounded-lg border border-slate-800 bg-slate-950/60 p-2",children:[s.jsx("div",{className:"text-[9px] text-slate-500 mb-1",children:"FUNDING / DERIVATIVOS"}),s.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[s.jsx(Le,{label:"EVENTOS",value:(k==null?void 0:k.fundingEvents)??0}),s.jsx(Le,{label:"COBERTURA",value:nt(k==null?void 0:k.fundingCoveragePercent)}),s.jsx(Le,{label:"BINANCE",value:((Tt=k==null?void 0:k.fundingSources)==null?void 0:Tt["binance-futures"])??0}),s.jsx(Le,{label:"OKX",value:((Pt=k==null?void 0:k.fundingSources)==null?void 0:Pt["okx-swap"])??0})]})]}),s.jsxs("div",{className:"mt-2 text-[9px] text-slate-500",children:["OOS Δ P&L: ",nt((os=y.comparison)==null?void 0:os.netProfitDeltaPercent)," • Δ DD: ",nt((Nt=y.comparison)==null?void 0:Nt.drawdownDeltaPercent)," • MC P05: ",Je((_s=y.monteCarlo)==null?void 0:_s.p05FinalR),"R • P95 DD: ",Je((ps=y.monteCarlo)==null?void 0:ps.p95MaxDrawdownR),"R • PF retenção: ",nt(ne==null?void 0:ne.profitFactorRetentionPercent)]}),(We=y.warnings)!=null&&We.length||(re=(Os=y.optimization)==null?void 0:Os.warnings)!=null&&re.length?s.jsx("div",{className:"mt-2 text-[9px] text-amber-300",children:[...y.warnings??[],...((fe=y.optimization)==null?void 0:fe.warnings)??[]].slice(0,4).join(" • ")}):null]}):s.jsx("div",{className:"text-[9px] text-slate-500",children:"Clique em VALIDAR OOS. A validação usa janela cronológica e não altera os parâmetros ativos."})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{className:"rounded-xl border border-slate-800 bg-slate-900/60 p-3",children:[s.jsxs("div",{className:"flex justify-between mb-2",children:[s.jsx("span",{className:"text-[10px] text-slate-500",children:"LONG × SHORT"}),s.jsxs("span",{className:"text-[9px] text-slate-600",children:["amostra ",((je=r==null?void 0:r.statistics)==null?void 0:je.sampleSize)??0]})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:(((De=r==null?void 0:r.statistics)==null?void 0:De.directions)??[]).map(ge=>s.jsxs("div",{className:"rounded-lg border border-slate-800 bg-slate-950 p-2",children:[s.jsx("b",{className:"text-[10px] text-white",children:ge.direction}),s.jsxs("div",{className:"grid grid-cols-3 gap-1 mt-2",children:[s.jsx(Le,{label:"N",value:ge.trades}),s.jsx(Le,{label:"WR",value:nt(ge.winRatePercent)}),s.jsx(Le,{label:"EXP",value:`${Je(ge.expectancyR)}R`,positive:ge.expectancyR>0})]})]},ge.direction))})]}),s.jsx(Xd,{title:"WALK-FORWARD / OOS",grade:(Ie=r==null?void 0:r.walkForward)==null?void 0:Ie.grade,lines:[`Trades OOS: ${((jt=r==null?void 0:r.walkForward)==null?void 0:jt.outOfSampleTrades)??0}`,`Expectancy: ${Je((Ft=r==null?void 0:r.walkForward)==null?void 0:Ft.outOfSampleExpectancyR)}R`,`PF: ${pr((ut=r==null?void 0:r.walkForward)==null?void 0:ut.outOfSampleProfitFactor)}`,`Consistência: ${nt((Fe=r==null?void 0:r.walkForward)==null?void 0:Fe.consistencyPercent)}`]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(Xd,{title:"STRESS TEST",grade:(te=r==null?void 0:r.stressTest)==null?void 0:te.grade,lines:(((le=r==null?void 0:r.stressTest)==null?void 0:le.scenarios)??[]).map(ge=>`${ge.label}: ${ge.status} • ${Je(ge.expectancyR)}R`)}),s.jsx(Xd,{title:"MONTE CARLO",grade:($e=r==null?void 0:r.monteCarlo)==null?void 0:$e.grade,lines:[`P(Perda): ${nt((Ze=r==null?void 0:r.monteCarlo)==null?void 0:Ze.probabilityOfLossPercent)}`,`P(DD>10R): ${nt((Ke=r==null?void 0:r.monteCarlo)==null?void 0:Ke.probabilityOfDrawdownOver10RPercent)}`,`P05 final: ${Je((cs=r==null?void 0:r.monteCarlo)==null?void 0:cs.p05FinalR)}R`]})]}),s.jsxs("div",{className:"rounded-xl border border-slate-800 bg-slate-900/60 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-slate-500 mb-2",children:[s.jsx(Ts,{className:"w-3 h-3"}),"ESTABILIDADE TEMPORAL"]}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:(((Ds=r==null?void 0:r.timeSeries)==null?void 0:Ds.periods)??[]).slice(-8).map(ge=>s.jsxs("div",{className:"text-center",children:[s.jsx("span",{className:"block text-[8px] text-slate-600",children:ge.period}),s.jsxs("b",{className:ge.expectancyR>=0?"text-emerald-300":"text-rose-300",children:[Je(ge.expectancyR),"R"]}),s.jsxs("span",{className:"block text-[8px] text-slate-600",children:[ge.trades,"T"]})]},ge.period))})]}),s.jsxs("div",{className:"grid grid-cols-4 gap-2 text-[9px] text-slate-500",children:[s.jsx(Le,{label:"OOS PF",value:pr((ks=r==null?void 0:r.walkForward)==null?void 0:ks.outOfSampleProfitFactor)}),s.jsx(Le,{label:"MC P05",value:`${Je((bs=r==null?void 0:r.monteCarlo)==null?void 0:bs.p05FinalR)}R`}),s.jsx(Le,{label:"MC P95 DD",value:`${Je((Fa=r==null?void 0:r.monteCarlo)==null?void 0:Fa.p95MaxDrawdownR)}R`}),s.jsx(Le,{label:"P(DD>10R)",value:nt((oa=r==null?void 0:r.monteCarlo)==null?void 0:oa.probabilityOfDrawdownOver10RPercent)})]}),s.jsxs("div",{className:"rounded-lg border border-slate-800 p-2 text-[9px] text-slate-500",children:[s.jsx("b",{className:"text-slate-400",children:"ALERTA:"})," ",(Pr=I==null?void 0:I.warnings)!=null&&Pr.length?I.warnings.slice(0,3).join(" • "):"Nenhum alerta de qualidade do backtest."]}),s.jsxs("div",{className:"flex items-center justify-between text-[9px] text-slate-600",children:[s.jsxs("span",{children:["Paper: ",(q==null?void 0:q.trades)??0," trades • equity ",eo(q==null?void 0:q.equity)," • ",q!=null&&q.halted?"HALTED":"ACTIVE"]}),s.jsxs("span",{children:["BT × Paper: ",((Nl=r==null?void 0:r.comparison)==null?void 0:Nl.status)??"—"]})]}),s.jsxs("div",{className:"flex items-center gap-2 text-[9px] text-slate-600",children:[s.jsx(Cr,{className:"w-3 h-3"}),"Parâmetros OOS são candidatos. PASS não ativa execução financeira."]})]})]})}function Le({label:r,value:l,positive:i}){return s.jsxs("div",{className:"rounded-lg bg-slate-950 border border-slate-800 p-2",children:[s.jsx("span",{className:"block text-[8px] text-slate-500",children:r}),s.jsx("b",{className:`text-[11px] ${i===!0?"text-emerald-300":i===!1?"text-rose-300":"text-slate-200"}`,children:l})]})}function Js({icon:r,label:l,value:i,detail:c,grade:d}){return s.jsxs("div",{className:"rounded-xl border border-slate-800 bg-slate-900/60 p-3",children:[r&&s.jsx("span",{className:bo(d),children:r}),s.jsx("span",{className:"block text-[8px] text-slate-500",children:l}),s.jsx("b",{className:`text-sm ${bo(d)}`,children:i}),s.jsx("span",{className:"block text-[9px] text-slate-600",children:c})]})}function Xd({title:r,grade:l,lines:i}){return s.jsxs("div",{className:"rounded-xl border border-slate-800 bg-slate-900/60 p-3",children:[s.jsx("div",{className:"text-[9px] text-slate-500",children:r}),s.jsx("b",{className:`text-xs ${bo(l)}`,children:l??"—"}),i.map(c=>s.jsx("div",{className:"text-[9px] text-slate-500",children:c},c))]})}function bf({title:r,data:l}){return s.jsxs("div",{className:"rounded-lg border border-slate-800 bg-slate-950 p-2",children:[s.jsx("div",{className:"text-[8px] text-slate-500 mb-1",children:r}),l?s.jsxs("div",{className:"grid grid-cols-5 gap-1 text-[9px]",children:[s.jsxs("span",{children:["S ",l.minScore]}),s.jsxs("span",{children:["C ",l.minConfidence]}),s.jsxs("span",{children:["ATR ",Je(l.atrStopMultiple)]}),s.jsxs("span",{children:["RR ",Je(l.rewardRisk)]}),s.jsxs("span",{children:["H ",l.maxHoldingBars]}),s.jsxs("span",{className:"text-emerald-300",children:["E ",Je(l.expectancyR),"R"]}),s.jsxs("span",{children:["PF ",pr(l.profitFactor)]}),s.jsxs("span",{children:["DD ",nt(l.maxDrawdownPercent)]}),s.jsxs("span",{children:["N ",l.trades]})]}):s.jsx("span",{className:"text-[9px] text-slate-600",children:"sem seleção"})]})}function gf({title:r,cells:l}){return s.jsxs("div",{className:"rounded-lg border border-slate-800 p-2",children:[s.jsx("div",{className:"text-[8px] text-slate-500 mb-1",children:r}),l.map(i=>s.jsxs("div",{className:"flex items-center justify-between gap-2 text-[8px] border-t border-slate-800/60 py-1",children:[s.jsxs("span",{className:"text-slate-400 truncate",children:[i.trend,"/",i.volatility,"/",i.funding]}),s.jsxs("span",{className:i.expectancyR>0?"text-emerald-300":"text-rose-300",children:[Je(i.expectancyR),"R • ",i.trades,"T"]})]},i.key))]})}const fr="https://thegod-indol.vercel.app".replace(/\/$/,"");if(fr){const r=window.fetch.bind(window);window.fetch=(l,i)=>{if(typeof l=="string"&&l.startsWith("/api/"))return r(`${fr}${l}`,i);if(l instanceof URL&&l.pathname.startsWith("/api/"))return r(`${fr}${l.pathname}${l.search}`,i);if(l instanceof Request&&new URL(l.url).pathname.startsWith("/api/")){const c=new URL(l.url);return c.protocol=new URL(fr).protocol,c.host=new URL(fr).host,r(new Request(c.toString(),l),i)}return r(l,i)}}function x2(){return s.jsxs(s.Fragment,{children:[s.jsx(d2,{}),s.jsx(u2,{}),s.jsx(m2,{})]})}qg.createRoot(document.getElementById("root")).render(s.jsx($.StrictMode,{children:s.jsx(x2,{})}));