-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicrobotEvolutionLab.hta
More file actions
293 lines (291 loc) · 340 KB
/
Copy pathMicrobotEvolutionLab.hta
File metadata and controls
293 lines (291 loc) · 340 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8" />
<title>Microbot Evolution Lab - 0.1.228</title>
<HTA:APPLICATION
ID="MicrobotEvolutionLabApp"
APPLICATIONNAME="Microbot Evolution Lab"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
ICON="favicon.ico"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="maximize"
NAVIGABLE="yes"
/>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🤖</text></svg>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Microbot Evolution Lab - Beta 0.1.2</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;800&display=swap" rel="stylesheet">
<script>
window.onerror = function(msg, url, line) {
console.error("Diagnostic error listener caught:", msg, url, line);
}; var container = document.getElementById('root');
if (container) {
container.innerHTML = '<div style="background:#080E14;color:#FF6B00;padding:30px;font-family:monospace;min-height:100vh;">' +
'<h2 style="color:#00E5FF">⚠️ MICROBOT EVOLUTION LAB RUNTIME LOG</h2>' +
'<p style="margin-top:10px;"><strong>Error:</strong> ' + msg + '</p>' +
'<p><strong>Location:</strong> Line ' + lineNo + ':' + columnNo + '</p>' +
'<pre style="background:#0f1a24;padding:15px;border:1px solid #00E5FF;margin-top:15px;color:#fff;overflow:auto;">' + (error && error.stack ? error.stack : msg) + '</pre>' +
'</div>';
}
return false;
};
</script>
<script type="module" crossorigin>var ld=Object.defineProperty;var ad=(e,t,n)=>t in e?ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var I=(e,t,n)=>ad(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function cd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wa={exports:{}},Oi={},Ha={exports:{}},K={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ar=Symbol.for("react.element"),ud=Symbol.for("react.portal"),dd=Symbol.for("react.fragment"),hd=Symbol.for("react.strict_mode"),fd=Symbol.for("react.profiler"),pd=Symbol.for("react.provider"),gd=Symbol.for("react.context"),md=Symbol.for("react.forward_ref"),yd=Symbol.for("react.suspense"),xd=Symbol.for("react.memo"),vd=Symbol.for("react.lazy"),bl=Symbol.iterator;function Sd(e){return e===null||typeof e!="object"?null:(e=bl&&e[bl]||e["@@iterator"],typeof e=="function"?e:null)}var Ua={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_a=Object.assign,Za={};function Hn(e,t,n){this.props=e,this.context=t,this.refs=Za,this.updater=n||Ua}Hn.prototype.isReactComponent={};Hn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Hn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Qa(){}Qa.prototype=Hn.prototype;function Rs(e,t,n){this.props=e,this.context=t,this.refs=Za,this.updater=n||Ua}var Ns=Rs.prototype=new Qa;Ns.constructor=Rs;_a(Ns,Hn.prototype);Ns.isPureReactComponent=!0;var Rl=Array.isArray,Ya=Object.prototype.hasOwnProperty,Ts={current:null},Xa={key:!0,ref:!0,__self:!0,__source:!0};function Ja(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)Ya.call(t,r)&&!Xa.hasOwnProperty(r)&&(i[r]=t[r]);var c=arguments.length-2;if(c===1)i.children=n;else if(1<c){for(var u=Array(c),h=0;h<c;h++)u[h]=arguments[h+2];i.children=u}if(e&&e.defaultProps)for(r in c=e.defaultProps,c)i[r]===void 0&&(i[r]=c[r]);return{$$typeof:Ar,type:e,key:o,ref:s,props:i,_owner:Ts.current}}function wd(e,t){return{$$typeof:Ar,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Fs(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ar}function Id(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Nl=/\/+/g;function io(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Id(""+e.key):t.toString(36)}function ii(e,t,n,r,i){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(o){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Ar:case ud:s=!0}}if(s)return s=e,i=i(s),e=r===""?"."+io(s,0):r,Rl(i)?(n="",e!=null&&(n=e.replace(Nl,"$&/")+"/"),ii(i,t,n,"",function(h){return h})):i!=null&&(Fs(i)&&(i=wd(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(Nl,"$&/")+"/")+e)),t.push(i)),1;if(s=0,r=r===""?".":r+":",Rl(e))for(var c=0;c<e.length;c++){o=e[c];var u=r+io(o,c);s+=ii(o,t,n,u,i)}else if(u=Sd(e),typeof u=="function")for(e=u.call(e),c=0;!(o=e.next()).done;)o=o.value,u=r+io(o,c++),s+=ii(o,t,n,u,i);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function zr(e,t,n){if(e==null)return e;var r=[],i=0;return ii(e,r,"","",function(o){return t.call(n,o,i++)}),r}function Cd(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Fe={current:null},oi={transition:null},Ed={ReactCurrentDispatcher:Fe,ReactCurrentBatchConfig:oi,ReactCurrentOwner:Ts};function Ka(){throw Error("act(...) is not supported in production builds of React.")}K.Children={map:zr,forEach:function(e,t,n){zr(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return zr(e,function(){t++}),t},toArray:function(e){return zr(e,function(t){return t})||[]},only:function(e){if(!Fs(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};K.Component=Hn;K.Fragment=dd;K.Profiler=fd;K.PureComponent=Rs;K.StrictMode=hd;K.Suspense=yd;K.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ed;K.act=Ka;K.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=_a({},e.props),i=e.key,o=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,s=Ts.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(u in t)Ya.call(t,u)&&!Xa.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&c!==void 0?c[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){c=Array(u);for(var h=0;h<u;h++)c[h]=arguments[h+2];r.children=c}return{$$typeof:Ar,type:e.type,key:i,ref:o,props:r,_owner:s}};K.createContext=function(e){return e={$$typeof:gd,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:pd,_context:e},e.Consumer=e};K.createElement=Ja;K.createFactory=function(e){var t=Ja.bind(null,e);return t.type=e,t};K.createRef=function(){return{current:null}};K.forwardRef=function(e){return{$$typeof:md,render:e}};K.isValidElement=Fs;K.lazy=function(e){return{$$typeof:vd,_payload:{_status:-1,_result:e},_init:Cd}};K.memo=function(e,t){return{$$typeof:xd,type:e,compare:t===void 0?null:t}};K.startTransition=function(e){var t=oi.transition;oi.transition={};try{e()}finally{oi.transition=t}};K.unstable_act=Ka;K.useCallback=function(e,t){return Fe.current.useCallback(e,t)};K.useContext=function(e){return Fe.current.useContext(e)};K.useDebugValue=function(){};K.useDeferredValue=function(e){return Fe.current.useDeferredValue(e)};K.useEffect=function(e,t){return Fe.current.useEffect(e,t)};K.useId=function(){return Fe.current.useId()};K.useImperativeHandle=function(e,t,n){return Fe.current.useImperativeHandle(e,t,n)};K.useInsertionEffect=function(e,t){return Fe.current.useInsertionEffect(e,t)};K.useLayoutEffect=function(e,t){return Fe.current.useLayoutEffect(e,t)};K.useMemo=function(e,t){return Fe.current.useMemo(e,t)};K.useReducer=function(e,t,n){return Fe.current.useReducer(e,t,n)};K.useRef=function(e){return Fe.current.useRef(e)};K.useState=function(e){return Fe.current.useState(e)};K.useSyncExternalStore=function(e,t,n){return Fe.current.useSyncExternalStore(e,t,n)};K.useTransition=function(){return Fe.current.useTransition()};K.version="18.3.1";Ha.exports=K;var G=Ha.exports;const As=cd(G);/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var kd=G,Md=Symbol.for("react.element"),bd=Symbol.for("react.fragment"),Rd=Object.prototype.hasOwnProperty,Nd=kd.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Td={key:!0,ref:!0,__self:!0,__source:!0};function $a(e,t,n){var r,i={},o=null,s=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)Rd.call(t,r)&&!Td.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:Md,type:e,key:o,ref:s,props:i,_owner:Nd.current}}Oi.Fragment=bd;Oi.jsx=$a;Oi.jsxs=$a;Wa.exports=Oi;var l=Wa.exports,jo={},qa={exports:{}},_e={},ec={exports:{}},tc={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(e){function t(R,N){var g=R.length;R.push(N);e:for(;0<g;){var j=g-1>>>1,F=R[j];if(0<i(F,N))R[j]=N,R[g]=F,g=j;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var N=R[0],g=R.pop();if(g!==N){R[0]=g;e:for(var j=0,F=R.length,W=F>>>1;j<W;){var J=2*(j+1)-1,ne=R[J],S=J+1,Y=R[S];if(0>i(ne,g))S<F&&0>i(Y,ne)?(R[j]=Y,R[S]=g,j=S):(R[j]=ne,R[J]=g,j=J);else if(S<F&&0>i(Y,g))R[j]=Y,R[S]=g,j=S;else break e}}return N}function i(R,N){var g=R.sortIndex-N.sortIndex;return g!==0?g:R.id-N.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,c=s.now();e.unstable_now=function(){return s.now()-c}}var u=[],h=[],m=1,v=null,y=3,E=!1,k=!1,w=!1,B=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(R){for(var N=n(h);N!==null;){if(N.callback===null)r(h);else if(N.startTime<=R)r(h),N.sortIndex=N.expirationTime,t(u,N);else break;N=n(h)}}function M(R){if(w=!1,x(R),!k)if(n(u)!==null)k=!0,b(a);else{var N=n(h);N!==null&&d(M,N.startTime-R)}}function a(R,N){k=!1,w&&(w=!1,p(A),A=-1),E=!0;var g=y;try{for(x(N),v=n(u);v!==null&&(!(v.expirationTime>N)||R&&!X());){var j=v.callback;if(typeof j=="function"){v.callback=null,y=v.priorityLevel;var F=j(v.expirationTime<=N);N=e.unstable_now(),typeof F=="function"?v.callback=F:v===n(u)&&r(u),x(N)}else r(u);v=n(u)}if(v!==null)var W=!0;else{var J=n(h);J!==null&&d(M,J.startTime-N),W=!1}return W}finally{v=null,y=g,E=!1}}var C=!1,T=null,A=-1,Q=5,O=-1;function X(){return!(e.unstable_now()-O<Q)}function ee(){if(T!==null){var R=e.unstable_now();O=R;var N=!0;try{N=T(!0,R)}finally{N?z():(C=!1,T=null)}}else C=!1}var z;if(typeof f=="function")z=function(){f(ee)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,U=L.port2;L.port1.onmessage=ee,z=function(){U.postMessage(null)}}else z=function(){B(ee,0)};function b(R){T=R,C||(C=!0,z())}function d(R,N){A=B(function(){R(e.unstable_now())},N)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_continueExecution=function(){k||E||(k=!0,b(a))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(R){switch(y){case 1:case 2:case 3:var N=3;break;default:N=y}var g=y;y=N;try{return R()}finally{y=g}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,N){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var g=y;y=R;try{return N()}finally{y=g}},e.unstable_scheduleCallback=function(R,N,g){var j=e.unstable_now();switch(typeof g=="object"&&g!==null?(g=g.delay,g=typeof g=="number"&&0<g?j+g:j):g=j,R){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=g+F,R={id:m++,callback:N,priorityLevel:R,startTime:g,expirationTime:F,sortIndex:-1},g>j?(R.sortIndex=g,t(h,R),n(u)===null&&R===n(h)&&(w?(p(A),A=-1):w=!0,d(M,g-j))):(R.sortIndex=F,t(u,R),k||E||(k=!0,b(a))),R},e.unstable_shouldYield=X,e.unstable_wrapCallback=function(R){var N=y;return function(){var g=y;y=N;try{return R.apply(this,arguments)}finally{y=g}}}})(tc);ec.exports=tc;var Fd=ec.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ad=G,Ue=Fd;function P(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var nc=new Set,gr={};function un(e,t){Dn(e,t),Dn(e+"Capture",t)}function Dn(e,t){for(gr[e]=t,e=0;e<t.length;e++)nc.add(t[e])}var vt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bo=Object.prototype.hasOwnProperty,jd=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Tl={},Fl={};function Bd(e){return Bo.call(Fl,e)?!0:Bo.call(Tl,e)?!1:jd.test(e)?Fl[e]=!0:(Tl[e]=!0,!1)}function Pd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Dd(e,t,n,r){if(t===null||typeof t>"u"||Pd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ae(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var Ce={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ce[e]=new Ae(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ce[t]=new Ae(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ce[e]=new Ae(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ce[e]=new Ae(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ce[e]=new Ae(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ce[e]=new Ae(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ce[e]=new Ae(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ce[e]=new Ae(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ce[e]=new Ae(e,5,!1,e.toLowerCase(),null,!1,!1)});var js=/[\-:]([a-z])/g;function Bs(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(js,Bs);Ce[t]=new Ae(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(js,Bs);Ce[t]=new Ae(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(js,Bs);Ce[t]=new Ae(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ce[e]=new Ae(e,1,!1,e.toLowerCase(),null,!1,!1)});Ce.xlinkHref=new Ae("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ce[e]=new Ae(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ps(e,t,n,r){var i=Ce.hasOwnProperty(t)?Ce[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Dd(t,n,i,r)&&(n=null),r||i===null?Bd(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ct=Ad.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vr=Symbol.for("react.element"),pn=Symbol.for("react.portal"),gn=Symbol.for("react.fragment"),Ds=Symbol.for("react.strict_mode"),Po=Symbol.for("react.profiler"),rc=Symbol.for("react.provider"),ic=Symbol.for("react.context"),zs=Symbol.for("react.forward_ref"),Do=Symbol.for("react.suspense"),zo=Symbol.for("react.suspense_list"),Vs=Symbol.for("react.memo"),kt=Symbol.for("react.lazy"),oc=Symbol.for("react.offscreen"),Al=Symbol.iterator;function Qn(e){return e===null||typeof e!="object"?null:(e=Al&&e[Al]||e["@@iterator"],typeof e=="function"?e:null)}var ce=Object.assign,oo;function tr(e){if(oo===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);oo=t&&t[1]||""}return`
`+oo+e}var so=!1;function lo(e,t){if(!e||so)return"";so=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(h){var r=h}Reflect.construct(e,[],t)}else{try{t.call()}catch(h){r=h}e.call(t.prototype)}else{try{throw Error()}catch(h){r=h}e()}}catch(h){if(h&&r&&typeof h.stack=="string"){for(var i=h.stack.split(`
`),o=r.stack.split(`
`),s=i.length-1,c=o.length-1;1<=s&&0<=c&&i[s]!==o[c];)c--;for(;1<=s&&0<=c;s--,c--)if(i[s]!==o[c]){if(s!==1||c!==1)do if(s--,c--,0>c||i[s]!==o[c]){var u=`
`+i[s].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=s&&0<=c);break}}}finally{so=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?tr(e):""}function zd(e){switch(e.tag){case 5:return tr(e.type);case 16:return tr("Lazy");case 13:return tr("Suspense");case 19:return tr("SuspenseList");case 0:case 2:case 15:return e=lo(e.type,!1),e;case 11:return e=lo(e.type.render,!1),e;case 1:return e=lo(e.type,!0),e;default:return""}}function Vo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case gn:return"Fragment";case pn:return"Portal";case Po:return"Profiler";case Ds:return"StrictMode";case Do:return"Suspense";case zo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ic:return(e.displayName||"Context")+".Consumer";case rc:return(e._context.displayName||"Context")+".Provider";case zs:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Vs:return t=e.displayName||null,t!==null?t:Vo(e.type)||"Memo";case kt:t=e._payload,e=e._init;try{return Vo(e(t))}catch{}}return null}function Vd(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Vo(t);case 8:return t===Ds?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Gt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function sc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Gd(e){var t=sc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Gr(e){e._valueTracker||(e._valueTracker=Gd(e))}function lc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=sc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function mi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Go(e,t){var n=t.checked;return ce({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function jl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Gt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function ac(e,t){t=t.checked,t!=null&&Ps(e,"checked",t,!1)}function Oo(e,t){ac(e,t);var n=Gt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Lo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Lo(e,t.type,Gt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Bl(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Lo(e,t,n){(t!=="number"||mi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var nr=Array.isArray;function Nn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Gt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Wo(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(P(91));return ce({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Pl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(P(92));if(nr(n)){if(1<n.length)throw Error(P(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Gt(n)}}function cc(e,t){var n=Gt(t.value),r=Gt(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Dl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function uc(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ho(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?uc(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Or,dc=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Or=Or||document.createElement("div"),Or.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Or.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function mr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var sr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Od=["Webkit","ms","Moz","O"];Object.keys(sr).forEach(function(e){Od.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),sr[t]=sr[e]})});function hc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||sr.hasOwnProperty(e)&&sr[e]?(""+t).trim():t+"px"}function fc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=hc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Ld=ce({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Uo(e,t){if(t){if(Ld[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(P(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(P(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(P(61))}if(t.style!=null&&typeof t.style!="object")throw Error(P(62))}}function _o(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Zo=null;function Gs(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qo=null,Tn=null,Fn=null;function zl(e){if(e=Pr(e)){if(typeof Qo!="function")throw Error(P(280));var t=e.stateNode;t&&(t=_i(t),Qo(e.stateNode,e.type,t))}}function pc(e){Tn?Fn?Fn.push(e):Fn=[e]:Tn=e}function gc(){if(Tn){var e=Tn,t=Fn;if(Fn=Tn=null,zl(e),t)for(e=0;e<t.length;e++)zl(t[e])}}function mc(e,t){return e(t)}function yc(){}var ao=!1;function xc(e,t,n){if(ao)return e(t,n);ao=!0;try{return mc(e,t,n)}finally{ao=!1,(Tn!==null||Fn!==null)&&(yc(),gc())}}function yr(e,t){var n=e.stateNode;if(n===null)return null;var r=_i(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(P(231,t,typeof n));return n}var Yo=!1;if(vt)try{var Yn={};Object.defineProperty(Yn,"passive",{get:function(){Yo=!0}}),window.addEventListener("test",Yn,Yn),window.removeEventListener("test",Yn,Yn)}catch{Yo=!1}function Wd(e,t,n,r,i,o,s,c,u){var h=Array.prototype.slice.call(arguments,3);try{t.apply(n,h)}catch(m){this.onError(m)}}var lr=!1,yi=null,xi=!1,Xo=null,Hd={onError:function(e){lr=!0,yi=e}};function Ud(e,t,n,r,i,o,s,c,u){lr=!1,yi=null,Wd.apply(Hd,arguments)}function _d(e,t,n,r,i,o,s,c,u){if(Ud.apply(this,arguments),lr){if(lr){var h=yi;lr=!1,yi=null}else throw Error(P(198));xi||(xi=!0,Xo=h)}}function dn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function vc(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Vl(e){if(dn(e)!==e)throw Error(P(188))}function Zd(e){var t=e.alternate;if(!t){if(t=dn(e),t===null)throw Error(P(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return Vl(i),e;if(o===r)return Vl(i),t;o=o.sibling}throw Error(P(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s)throw Error(P(189))}}if(n.alternate!==r)throw Error(P(190))}if(n.tag!==3)throw Error(P(188));return n.stateNode.current===n?e:t}function Sc(e){return e=Zd(e),e!==null?wc(e):null}function wc(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=wc(e);if(t!==null)return t;e=e.sibling}return null}var Ic=Ue.unstable_scheduleCallback,Gl=Ue.unstable_cancelCallback,Qd=Ue.unstable_shouldYield,Yd=Ue.unstable_requestPaint,pe=Ue.unstable_now,Xd=Ue.unstable_getCurrentPriorityLevel,Os=Ue.unstable_ImmediatePriority,Cc=Ue.unstable_UserBlockingPriority,vi=Ue.unstable_NormalPriority,Jd=Ue.unstable_LowPriority,Ec=Ue.unstable_IdlePriority,Li=null,ht=null;function Kd(e){if(ht&&typeof ht.onCommitFiberRoot=="function")try{ht.onCommitFiberRoot(Li,e,void 0,(e.current.flags&128)===128)}catch{}}var ot=Math.clz32?Math.clz32:eh,$d=Math.log,qd=Math.LN2;function eh(e){return e>>>=0,e===0?32:31-($d(e)/qd|0)|0}var Lr=64,Wr=4194304;function rr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Si(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var c=s&~i;c!==0?r=rr(c):(o&=s,o!==0&&(r=rr(o)))}else s=n&~i,s!==0?r=rr(s):o!==0&&(r=rr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ot(t),i=1<<n,r|=e[n],t&=~i;return r}function th(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nh(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var s=31-ot(o),c=1<<s,u=i[s];u===-1?(!(c&n)||c&r)&&(i[s]=th(c,t)):u<=t&&(e.expiredLanes|=c),o&=~c}}function Jo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function kc(){var e=Lr;return Lr<<=1,!(Lr&4194240)&&(Lr=64),e}function co(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function jr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ot(t),e[t]=n}function rh(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-ot(n),o=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~o}}function Ls(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ot(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var te=0;function Mc(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var bc,Ws,Rc,Nc,Tc,Ko=!1,Hr=[],Ft=null,At=null,jt=null,xr=new Map,vr=new Map,bt=[],ih="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Ol(e,t){switch(e){case"focusin":case"focusout":Ft=null;break;case"dragenter":case"dragleave":At=null;break;case"mouseover":case"mouseout":jt=null;break;case"pointerover":case"pointerout":xr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":vr.delete(t.pointerId)}}function Xn(e,t,n,r,i,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},t!==null&&(t=Pr(t),t!==null&&Ws(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function oh(e,t,n,r,i){switch(t){case"focusin":return Ft=Xn(Ft,e,t,n,r,i),!0;case"dragenter":return At=Xn(At,e,t,n,r,i),!0;case"mouseover":return jt=Xn(jt,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return xr.set(o,Xn(xr.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,vr.set(o,Xn(vr.get(o)||null,e,t,n,r,i)),!0}return!1}function Fc(e){var t=qt(e.target);if(t!==null){var n=dn(t);if(n!==null){if(t=n.tag,t===13){if(t=vc(n),t!==null){e.blockedOn=t,Tc(e.priority,function(){Rc(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function si(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=$o(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Zo=r,n.target.dispatchEvent(r),Zo=null}else return t=Pr(n),t!==null&&Ws(t),e.blockedOn=n,!1;t.shift()}return!0}function Ll(e,t,n){si(e)&&n.delete(t)}function sh(){Ko=!1,Ft!==null&&si(Ft)&&(Ft=null),At!==null&&si(At)&&(At=null),jt!==null&&si(jt)&&(jt=null),xr.forEach(Ll),vr.forEach(Ll)}function Jn(e,t){e.blockedOn===t&&(e.blockedOn=null,Ko||(Ko=!0,Ue.unstable_scheduleCallback(Ue.unstable_NormalPriority,sh)))}function Sr(e){function t(i){return Jn(i,e)}if(0<Hr.length){Jn(Hr[0],e);for(var n=1;n<Hr.length;n++){var r=Hr[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ft!==null&&Jn(Ft,e),At!==null&&Jn(At,e),jt!==null&&Jn(jt,e),xr.forEach(t),vr.forEach(t),n=0;n<bt.length;n++)r=bt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<bt.length&&(n=bt[0],n.blockedOn===null);)Fc(n),n.blockedOn===null&&bt.shift()}var An=Ct.ReactCurrentBatchConfig,wi=!0;function lh(e,t,n,r){var i=te,o=An.transition;An.transition=null;try{te=1,Hs(e,t,n,r)}finally{te=i,An.transition=o}}function ah(e,t,n,r){var i=te,o=An.transition;An.transition=null;try{te=4,Hs(e,t,n,r)}finally{te=i,An.transition=o}}function Hs(e,t,n,r){if(wi){var i=$o(e,t,n,r);if(i===null)So(e,t,r,Ii,n),Ol(e,r);else if(oh(i,e,t,n,r))r.stopPropagation();else if(Ol(e,r),t&4&&-1<ih.indexOf(e)){for(;i!==null;){var o=Pr(i);if(o!==null&&bc(o),o=$o(e,t,n,r),o===null&&So(e,t,r,Ii,n),o===i)break;i=o}i!==null&&r.stopPropagation()}else So(e,t,r,null,n)}}var Ii=null;function $o(e,t,n,r){if(Ii=null,e=Gs(r),e=qt(e),e!==null)if(t=dn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=vc(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ii=e,null}function Ac(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Xd()){case Os:return 1;case Cc:return 4;case vi:case Jd:return 16;case Ec:return 536870912;default:return 16}default:return 16}}var Nt=null,Us=null,li=null;function jc(){if(li)return li;var e,t=Us,n=t.length,r,i="value"in Nt?Nt.value:Nt.textContent,o=i.length;for(e=0;e<n&&t[e]===i[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===i[o-r];r++);return li=i.slice(e,1<r?1-r:void 0)}function ai(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ur(){return!0}function Wl(){return!1}function Ze(e){function t(n,r,i,o,s){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var c in e)e.hasOwnProperty(c)&&(n=e[c],this[c]=n?n(o):o[c]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Ur:Wl,this.isPropagationStopped=Wl,this}return ce(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ur)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ur)},persist:function(){},isPersistent:Ur}),t}var Un={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_s=Ze(Un),Br=ce({},Un,{view:0,detail:0}),ch=Ze(Br),uo,ho,Kn,Wi=ce({},Br,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zs,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Kn&&(Kn&&e.type==="mousemove"?(uo=e.screenX-Kn.screenX,ho=e.screenY-Kn.screenY):ho=uo=0,Kn=e),uo)},movementY:function(e){return"movementY"in e?e.movementY:ho}}),Hl=Ze(Wi),uh=ce({},Wi,{dataTransfer:0}),dh=Ze(uh),hh=ce({},Br,{relatedTarget:0}),fo=Ze(hh),fh=ce({},Un,{animationName:0,elapsedTime:0,pseudoElement:0}),ph=Ze(fh),gh=ce({},Un,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),mh=Ze(gh),yh=ce({},Un,{data:0}),Ul=Ze(yh),xh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vh={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Sh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sh[e])?!!t[e]:!1}function Zs(){return wh}var Ih=ce({},Br,{key:function(e){if(e.key){var t=xh[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ai(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?vh[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zs,charCode:function(e){return e.type==="keypress"?ai(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ai(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ch=Ze(Ih),Eh=ce({},Wi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_l=Ze(Eh),kh=ce({},Br,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zs}),Mh=Ze(kh),bh=ce({},Un,{propertyName:0,elapsedTime:0,pseudoElement:0}),Rh=Ze(bh),Nh=ce({},Wi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Th=Ze(Nh),Fh=[9,13,27,32],Qs=vt&&"CompositionEvent"in window,ar=null;vt&&"documentMode"in document&&(ar=document.documentMode);var Ah=vt&&"TextEvent"in window&&!ar,Bc=vt&&(!Qs||ar&&8<ar&&11>=ar),Zl=" ",Ql=!1;function Pc(e,t){switch(e){case"keyup":return Fh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mn=!1;function jh(e,t){switch(e){case"compositionend":return Dc(t);case"keypress":return t.which!==32?null:(Ql=!0,Zl);case"textInput":return e=t.data,e===Zl&&Ql?null:e;default:return null}}function Bh(e,t){if(mn)return e==="compositionend"||!Qs&&Pc(e,t)?(e=jc(),li=Us=Nt=null,mn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Bc&&t.locale!=="ko"?null:t.data;default:return null}}var Ph={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Yl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ph[e.type]:t==="textarea"}function zc(e,t,n,r){pc(r),t=Ci(t,"onChange"),0<t.length&&(n=new _s("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var cr=null,wr=null;function Dh(e){Yc(e,0)}function Hi(e){var t=vn(e);if(lc(t))return e}function zh(e,t){if(e==="change")return t}var Vc=!1;if(vt){var po;if(vt){var go="oninput"in document;if(!go){var Xl=document.createElement("div");Xl.setAttribute("oninput","return;"),go=typeof Xl.oninput=="function"}po=go}else po=!1;Vc=po&&(!document.documentMode||9<document.documentMode)}function Jl(){cr&&(cr.detachEvent("onpropertychange",Gc),wr=cr=null)}function Gc(e){if(e.propertyName==="value"&&Hi(wr)){var t=[];zc(t,wr,e,Gs(e)),xc(Dh,t)}}function Vh(e,t,n){e==="focusin"?(Jl(),cr=t,wr=n,cr.attachEvent("onpropertychange",Gc)):e==="focusout"&&Jl()}function Gh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Hi(wr)}function Oh(e,t){if(e==="click")return Hi(t)}function Lh(e,t){if(e==="input"||e==="change")return Hi(t)}function Wh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lt=typeof Object.is=="function"?Object.is:Wh;function Ir(e,t){if(lt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Bo.call(t,i)||!lt(e[i],t[i]))return!1}return!0}function Kl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $l(e,t){var n=Kl(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Kl(n)}}function Oc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Oc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lc(){for(var e=window,t=mi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=mi(e.document)}return t}function Ys(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")}function Hh(e){var t=Lc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Oc(n.ownerDocument.documentElement,n)){if(r!==null&&Ys(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=$l(n,o);var s=$l(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Uh=vt&&"documentMode"in document&&11>=document.documentMode,yn=null,qo=null,ur=null,es=!1;function ql(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;es||yn==null||yn!==mi(r)||(r=yn,"selectionStart"in r&&Ys(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ur&&Ir(ur,r)||(ur=r,r=Ci(qo,"onSelect"),0<r.length&&(t=new _s("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yn)))}function _r(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var xn={animationend:_r("Animation","AnimationEnd"),animationiteration:_r("Animation","AnimationIteration"),animationstart:_r("Animation","AnimationStart"),transitionend:_r("Transition","TransitionEnd")},mo={},Wc={};vt&&(Wc=document.createElement("div").style,"AnimationEvent"in window||(delete xn.animationend.animation,delete xn.animationiteration.animation,delete xn.animationstart.animation),"TransitionEvent"in window||delete xn.transitionend.transition);function Ui(e){if(mo[e])return mo[e];if(!xn[e])return e;var t=xn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Wc)return mo[e]=t[n];return e}var Hc=Ui("animationend"),Uc=Ui("animationiteration"),_c=Ui("animationstart"),Zc=Ui("transitionend"),Qc=new Map,ea="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ht(e,t){Qc.set(e,t),un(t,[e])}for(var yo=0;yo<ea.length;yo++){var xo=ea[yo],_h=xo.toLowerCase(),Zh=xo[0].toUpperCase()+xo.slice(1);Ht(_h,"on"+Zh)}Ht(Hc,"onAnimationEnd");Ht(Uc,"onAnimationIteration");Ht(_c,"onAnimationStart");Ht("dblclick","onDoubleClick");Ht("focusin","onFocus");Ht("focusout","onBlur");Ht(Zc,"onTransitionEnd");Dn("onMouseEnter",["mouseout","mouseover"]);Dn("onMouseLeave",["mouseout","mouseover"]);Dn("onPointerEnter",["pointerout","pointerover"]);Dn("onPointerLeave",["pointerout","pointerover"]);un("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));un("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));un("onBeforeInput",["compositionend","keypress","textInput","paste"]);un("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));un("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));un("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ir="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Qh=new Set("cancel close invalid load scroll toggle".split(" ").concat(ir));function ta(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,_d(r,t,void 0,e),e.currentTarget=null}function Yc(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var s=r.length-1;0<=s;s--){var c=r[s],u=c.instance,h=c.currentTarget;if(c=c.listener,u!==o&&i.isPropagationStopped())break e;ta(i,c,h),o=u}else for(s=0;s<r.length;s++){if(c=r[s],u=c.instance,h=c.currentTarget,c=c.listener,u!==o&&i.isPropagationStopped())break e;ta(i,c,h),o=u}}}if(xi)throw e=Xo,xi=!1,Xo=null,e}function ie(e,t){var n=t[os];n===void 0&&(n=t[os]=new Set);var r=e+"__bubble";n.has(r)||(Xc(t,e,2,!1),n.add(r))}function vo(e,t,n){var r=0;t&&(r|=4),Xc(n,e,r,t)}var Zr="_reactListening"+Math.random().toString(36).slice(2);function Cr(e){if(!e[Zr]){e[Zr]=!0,nc.forEach(function(n){n!=="selectionchange"&&(Qh.has(n)||vo(n,!1,e),vo(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Zr]||(t[Zr]=!0,vo("selectionchange",!1,t))}}function Xc(e,t,n,r){switch(Ac(t)){case 1:var i=lh;break;case 4:i=ah;break;default:i=Hs}n=i.bind(null,t,n,e),i=void 0,!Yo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function So(e,t,n,r,i){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i||c.nodeType===8&&c.parentNode===i)break;if(s===4)for(s=r.return;s!==null;){var u=s.tag;if((u===3||u===4)&&(u=s.stateNode.containerInfo,u===i||u.nodeType===8&&u.parentNode===i))return;s=s.return}for(;c!==null;){if(s=qt(c),s===null)return;if(u=s.tag,u===5||u===6){r=o=s;continue e}c=c.parentNode}}r=r.return}xc(function(){var h=o,m=Gs(n),v=[];e:{var y=Qc.get(e);if(y!==void 0){var E=_s,k=e;switch(e){case"keypress":if(ai(n)===0)break e;case"keydown":case"keyup":E=Ch;break;case"focusin":k="focus",E=fo;break;case"focusout":k="blur",E=fo;break;case"beforeblur":case"afterblur":E=fo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":E=Hl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":E=dh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":E=Mh;break;case Hc:case Uc:case _c:E=ph;break;case Zc:E=Rh;break;case"scroll":E=ch;break;case"wheel":E=Th;break;case"copy":case"cut":case"paste":E=mh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":E=_l}var w=(t&4)!==0,B=!w&&e==="scroll",p=w?y!==null?y+"Capture":null:y;w=[];for(var f=h,x;f!==null;){x=f;var M=x.stateNode;if(x.tag===5&&M!==null&&(x=M,p!==null&&(M=yr(f,p),M!=null&&w.push(Er(f,M,x)))),B)break;f=f.return}0<w.length&&(y=new E(y,k,null,n,m),v.push({event:y,listeners:w}))}}if(!(t&7)){e:{if(y=e==="mouseover"||e==="pointerover",E=e==="mouseout"||e==="pointerout",y&&n!==Zo&&(k=n.relatedTarget||n.fromElement)&&(qt(k)||k[St]))break e;if((E||y)&&(y=m.window===m?m:(y=m.ownerDocument)?y.defaultView||y.parentWindow:window,E?(k=n.relatedTarget||n.toElement,E=h,k=k?qt(k):null,k!==null&&(B=dn(k),k!==B||k.tag!==5&&k.tag!==6)&&(k=null)):(E=null,k=h),E!==k)){if(w=Hl,M="onMouseLeave",p="onMouseEnter",f="mouse",(e==="pointerout"||e==="pointerover")&&(w=_l,M="onPointerLeave",p="onPointerEnter",f="pointer"),B=E==null?y:vn(E),x=k==null?y:vn(k),y=new w(M,f+"leave",E,n,m),y.target=B,y.relatedTarget=x,M=null,qt(m)===h&&(w=new w(p,f+"enter",k,n,m),w.target=x,w.relatedTarget=B,M=w),B=M,E&&k)t:{for(w=E,p=k,f=0,x=w;x;x=fn(x))f++;for(x=0,M=p;M;M=fn(M))x++;for(;0<f-x;)w=fn(w),f--;for(;0<x-f;)p=fn(p),x--;for(;f--;){if(w===p||p!==null&&w===p.alternate)break t;w=fn(w),p=fn(p)}w=null}else w=null;E!==null&&na(v,y,E,w,!1),k!==null&&B!==null&&na(v,B,k,w,!0)}}e:{if(y=h?vn(h):window,E=y.nodeName&&y.nodeName.toLowerCase(),E==="select"||E==="input"&&y.type==="file")var a=zh;else if(Yl(y))if(Vc)a=Lh;else{a=Gh;var C=Vh}else(E=y.nodeName)&&E.toLowerCase()==="input"&&(y.type==="checkbox"||y.type==="radio")&&(a=Oh);if(a&&(a=a(e,h))){zc(v,a,n,m);break e}C&&C(e,y,h),e==="focusout"&&(C=y._wrapperState)&&C.controlled&&y.type==="number"&&Lo(y,"number",y.value)}switch(C=h?vn(h):window,e){case"focusin":(Yl(C)||C.contentEditable==="true")&&(yn=C,qo=h,ur=null);break;case"focusout":ur=qo=yn=null;break;case"mousedown":es=!0;break;case"contextmenu":case"mouseup":case"dragend":es=!1,ql(v,n,m);break;case"selectionchange":if(Uh)break;case"keydown":case"keyup":ql(v,n,m)}var T;if(Qs)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else mn?Pc(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(Bc&&n.locale!=="ko"&&(mn||A!=="onCompositionStart"?A==="onCompositionEnd"&&mn&&(T=jc()):(Nt=m,Us="value"in Nt?Nt.value:Nt.textContent,mn=!0)),C=Ci(h,A),0<C.length&&(A=new Ul(A,e,null,n,m),v.push({event:A,listeners:C}),T?A.data=T:(T=Dc(n),T!==null&&(A.data=T)))),(T=Ah?jh(e,n):Bh(e,n))&&(h=Ci(h,"onBeforeInput"),0<h.length&&(m=new Ul("onBeforeInput","beforeinput",null,n,m),v.push({event:m,listeners:h}),m.data=T))}Yc(v,t)})}function Er(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ci(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,o=i.stateNode;i.tag===5&&o!==null&&(i=o,o=yr(e,n),o!=null&&r.unshift(Er(e,o,i)),o=yr(e,t),o!=null&&r.push(Er(e,o,i))),e=e.return}return r}function fn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function na(e,t,n,r,i){for(var o=t._reactName,s=[];n!==null&&n!==r;){var c=n,u=c.alternate,h=c.stateNode;if(u!==null&&u===r)break;c.tag===5&&h!==null&&(c=h,i?(u=yr(n,o),u!=null&&s.unshift(Er(n,u,c))):i||(u=yr(n,o),u!=null&&s.push(Er(n,u,c)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var Yh=/\r\n?/g,Xh=/\u0000|\uFFFD/g;function ra(e){return(typeof e=="string"?e:""+e).replace(Yh,`
`).replace(Xh,"")}function Qr(e,t,n){if(t=ra(t),ra(e)!==t&&n)throw Error(P(425))}function Ei(){}var ts=null,ns=null;function rs(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var is=typeof setTimeout=="function"?setTimeout:void 0,Jh=typeof clearTimeout=="function"?clearTimeout:void 0,ia=typeof Promise=="function"?Promise:void 0,Kh=typeof queueMicrotask=="function"?queueMicrotask:typeof ia<"u"?function(e){return ia.resolve(null).then(e).catch($h)}:is;function $h(e){setTimeout(function(){throw e})}function wo(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Sr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Sr(t)}function Bt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function oa(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var _n=Math.random().toString(36).slice(2),dt="__reactFiber$"+_n,kr="__reactProps$"+_n,St="__reactContainer$"+_n,os="__reactEvents$"+_n,qh="__reactListeners$"+_n,ef="__reactHandles$"+_n;function qt(e){var t=e[dt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[St]||n[dt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=oa(e);e!==null;){if(n=e[dt])return n;e=oa(e)}return t}e=n,n=e.parentNode}return null}function Pr(e){return e=e[dt]||e[St],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function vn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(P(33))}function _i(e){return e[kr]||null}var ss=[],Sn=-1;function Ut(e){return{current:e}}function oe(e){0>Sn||(e.current=ss[Sn],ss[Sn]=null,Sn--)}function re(e,t){Sn++,ss[Sn]=e.current,e.current=t}var Ot={},be=Ut(Ot),De=Ut(!1),on=Ot;function zn(e,t){var n=e.type.contextTypes;if(!n)return Ot;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ze(e){return e=e.childContextTypes,e!=null}function ki(){oe(De),oe(be)}function sa(e,t,n){if(be.current!==Ot)throw Error(P(168));re(be,t),re(De,n)}function Jc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(P(108,Vd(e)||"Unknown",i));return ce({},n,r)}function Mi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ot,on=be.current,re(be,e),re(De,De.current),!0}function la(e,t,n){var r=e.stateNode;if(!r)throw Error(P(169));n?(e=Jc(e,t,on),r.__reactInternalMemoizedMergedChildContext=e,oe(De),oe(be),re(be,e)):oe(De),re(De,n)}var gt=null,Zi=!1,Io=!1;function Kc(e){gt===null?gt=[e]:gt.push(e)}function tf(e){Zi=!0,Kc(e)}function _t(){if(!Io&>!==null){Io=!0;var e=0,t=te;try{var n=gt;for(te=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}gt=null,Zi=!1}catch(i){throw gt!==null&&(gt=gt.slice(e+1)),Ic(Os,_t),i}finally{te=t,Io=!1}}return null}var wn=[],In=0,bi=null,Ri=0,Ye=[],Xe=0,sn=null,mt=1,yt="";function Qt(e,t){wn[In++]=Ri,wn[In++]=bi,bi=e,Ri=t}function $c(e,t,n){Ye[Xe++]=mt,Ye[Xe++]=yt,Ye[Xe++]=sn,sn=e;var r=mt;e=yt;var i=32-ot(r)-1;r&=~(1<<i),n+=1;var o=32-ot(t)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,mt=1<<32-ot(t)+i|n<<i|r,yt=o+e}else mt=1<<o|n<<i|r,yt=e}function Xs(e){e.return!==null&&(Qt(e,1),$c(e,1,0))}function Js(e){for(;e===bi;)bi=wn[--In],wn[In]=null,Ri=wn[--In],wn[In]=null;for(;e===sn;)sn=Ye[--Xe],Ye[Xe]=null,yt=Ye[--Xe],Ye[Xe]=null,mt=Ye[--Xe],Ye[Xe]=null}var He=null,We=null,se=!1,it=null;function qc(e,t){var n=Je(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function aa(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,He=e,We=Bt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,He=e,We=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=sn!==null?{id:mt,overflow:yt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Je(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,He=e,We=null,!0):!1;default:return!1}}function ls(e){return(e.mode&1)!==0&&(e.flags&128)===0}function as(e){if(se){var t=We;if(t){var n=t;if(!aa(e,t)){if(ls(e))throw Error(P(418));t=Bt(n.nextSibling);var r=He;t&&aa(e,t)?qc(r,n):(e.flags=e.flags&-4097|2,se=!1,He=e)}}else{if(ls(e))throw Error(P(418));e.flags=e.flags&-4097|2,se=!1,He=e}}}function ca(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;He=e}function Yr(e){if(e!==He)return!1;if(!se)return ca(e),se=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!rs(e.type,e.memoizedProps)),t&&(t=We)){if(ls(e))throw eu(),Error(P(418));for(;t;)qc(e,t),t=Bt(t.nextSibling)}if(ca(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(P(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){We=Bt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}We=null}}else We=He?Bt(e.stateNode.nextSibling):null;return!0}function eu(){for(var e=We;e;)e=Bt(e.nextSibling)}function Vn(){We=He=null,se=!1}function Ks(e){it===null?it=[e]:it.push(e)}var nf=Ct.ReactCurrentBatchConfig;function $n(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(P(309));var r=n.stateNode}if(!r)throw Error(P(147,e));var i=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(s){var c=i.refs;s===null?delete c[o]:c[o]=s},t._stringRef=o,t)}if(typeof e!="string")throw Error(P(284));if(!n._owner)throw Error(P(290,e))}return e}function Xr(e,t){throw e=Object.prototype.toString.call(t),Error(P(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ua(e){var t=e._init;return t(e._payload)}function tu(e){function t(p,f){if(e){var x=p.deletions;x===null?(p.deletions=[f],p.flags|=16):x.push(f)}}function n(p,f){if(!e)return null;for(;f!==null;)t(p,f),f=f.sibling;return null}function r(p,f){for(p=new Map;f!==null;)f.key!==null?p.set(f.key,f):p.set(f.index,f),f=f.sibling;return p}function i(p,f){return p=Vt(p,f),p.index=0,p.sibling=null,p}function o(p,f,x){return p.index=x,e?(x=p.alternate,x!==null?(x=x.index,x<f?(p.flags|=2,f):x):(p.flags|=2,f)):(p.flags|=1048576,f)}function s(p){return e&&p.alternate===null&&(p.flags|=2),p}function c(p,f,x,M){return f===null||f.tag!==6?(f=No(x,p.mode,M),f.return=p,f):(f=i(f,x),f.return=p,f)}function u(p,f,x,M){var a=x.type;return a===gn?m(p,f,x.props.children,M,x.key):f!==null&&(f.elementType===a||typeof a=="object"&&a!==null&&a.$$typeof===kt&&ua(a)===f.type)?(M=i(f,x.props),M.ref=$n(p,f,x),M.return=p,M):(M=gi(x.type,x.key,x.props,null,p.mode,M),M.ref=$n(p,f,x),M.return=p,M)}function h(p,f,x,M){return f===null||f.tag!==4||f.stateNode.containerInfo!==x.containerInfo||f.stateNode.implementation!==x.implementation?(f=To(x,p.mode,M),f.return=p,f):(f=i(f,x.children||[]),f.return=p,f)}function m(p,f,x,M,a){return f===null||f.tag!==7?(f=rn(x,p.mode,M,a),f.return=p,f):(f=i(f,x),f.return=p,f)}function v(p,f,x){if(typeof f=="string"&&f!==""||typeof f=="number")return f=No(""+f,p.mode,x),f.return=p,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case Vr:return x=gi(f.type,f.key,f.props,null,p.mode,x),x.ref=$n(p,null,f),x.return=p,x;case pn:return f=To(f,p.mode,x),f.return=p,f;case kt:var M=f._init;return v(p,M(f._payload),x)}if(nr(f)||Qn(f))return f=rn(f,p.mode,x,null),f.return=p,f;Xr(p,f)}return null}function y(p,f,x,M){var a=f!==null?f.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return a!==null?null:c(p,f,""+x,M);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Vr:return x.key===a?u(p,f,x,M):null;case pn:return x.key===a?h(p,f,x,M):null;case kt:return a=x._init,y(p,f,a(x._payload),M)}if(nr(x)||Qn(x))return a!==null?null:m(p,f,x,M,null);Xr(p,x)}return null}function E(p,f,x,M,a){if(typeof M=="string"&&M!==""||typeof M=="number")return p=p.get(x)||null,c(f,p,""+M,a);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case Vr:return p=p.get(M.key===null?x:M.key)||null,u(f,p,M,a);case pn:return p=p.get(M.key===null?x:M.key)||null,h(f,p,M,a);case kt:var C=M._init;return E(p,f,x,C(M._payload),a)}if(nr(M)||Qn(M))return p=p.get(x)||null,m(f,p,M,a,null);Xr(f,M)}return null}function k(p,f,x,M){for(var a=null,C=null,T=f,A=f=0,Q=null;T!==null&&A<x.length;A++){T.index>A?(Q=T,T=null):Q=T.sibling;var O=y(p,T,x[A],M);if(O===null){T===null&&(T=Q);break}e&&T&&O.alternate===null&&t(p,T),f=o(O,f,A),C===null?a=O:C.sibling=O,C=O,T=Q}if(A===x.length)return n(p,T),se&&Qt(p,A),a;if(T===null){for(;A<x.length;A++)T=v(p,x[A],M),T!==null&&(f=o(T,f,A),C===null?a=T:C.sibling=T,C=T);return se&&Qt(p,A),a}for(T=r(p,T);A<x.length;A++)Q=E(T,p,A,x[A],M),Q!==null&&(e&&Q.alternate!==null&&T.delete(Q.key===null?A:Q.key),f=o(Q,f,A),C===null?a=Q:C.sibling=Q,C=Q);return e&&T.forEach(function(X){return t(p,X)}),se&&Qt(p,A),a}function w(p,f,x,M){var a=Qn(x);if(typeof a!="function")throw Error(P(150));if(x=a.call(x),x==null)throw Error(P(151));for(var C=a=null,T=f,A=f=0,Q=null,O=x.next();T!==null&&!O.done;A++,O=x.next()){T.index>A?(Q=T,T=null):Q=T.sibling;var X=y(p,T,O.value,M);if(X===null){T===null&&(T=Q);break}e&&T&&X.alternate===null&&t(p,T),f=o(X,f,A),C===null?a=X:C.sibling=X,C=X,T=Q}if(O.done)return n(p,T),se&&Qt(p,A),a;if(T===null){for(;!O.done;A++,O=x.next())O=v(p,O.value,M),O!==null&&(f=o(O,f,A),C===null?a=O:C.sibling=O,C=O);return se&&Qt(p,A),a}for(T=r(p,T);!O.done;A++,O=x.next())O=E(T,p,A,O.value,M),O!==null&&(e&&O.alternate!==null&&T.delete(O.key===null?A:O.key),f=o(O,f,A),C===null?a=O:C.sibling=O,C=O);return e&&T.forEach(function(ee){return t(p,ee)}),se&&Qt(p,A),a}function B(p,f,x,M){if(typeof x=="object"&&x!==null&&x.type===gn&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Vr:e:{for(var a=x.key,C=f;C!==null;){if(C.key===a){if(a=x.type,a===gn){if(C.tag===7){n(p,C.sibling),f=i(C,x.props.children),f.return=p,p=f;break e}}else if(C.elementType===a||typeof a=="object"&&a!==null&&a.$$typeof===kt&&ua(a)===C.type){n(p,C.sibling),f=i(C,x.props),f.ref=$n(p,C,x),f.return=p,p=f;break e}n(p,C);break}else t(p,C);C=C.sibling}x.type===gn?(f=rn(x.props.children,p.mode,M,x.key),f.return=p,p=f):(M=gi(x.type,x.key,x.props,null,p.mode,M),M.ref=$n(p,f,x),M.return=p,p=M)}return s(p);case pn:e:{for(C=x.key;f!==null;){if(f.key===C)if(f.tag===4&&f.stateNode.containerInfo===x.containerInfo&&f.stateNode.implementation===x.implementation){n(p,f.sibling),f=i(f,x.children||[]),f.return=p,p=f;break e}else{n(p,f);break}else t(p,f);f=f.sibling}f=To(x,p.mode,M),f.return=p,p=f}return s(p);case kt:return C=x._init,B(p,f,C(x._payload),M)}if(nr(x))return k(p,f,x,M);if(Qn(x))return w(p,f,x,M);Xr(p,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,f!==null&&f.tag===6?(n(p,f.sibling),f=i(f,x),f.return=p,p=f):(n(p,f),f=No(x,p.mode,M),f.return=p,p=f),s(p)):n(p,f)}return B}var Gn=tu(!0),nu=tu(!1),Ni=Ut(null),Ti=null,Cn=null,$s=null;function qs(){$s=Cn=Ti=null}function el(e){var t=Ni.current;oe(Ni),e._currentValue=t}function cs(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function jn(e,t){Ti=e,$s=Cn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Pe=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if($s!==e)if(e={context:e,memoizedValue:t,next:null},Cn===null){if(Ti===null)throw Error(P(308));Cn=e,Ti.dependencies={lanes:0,firstContext:e}}else Cn=Cn.next=e;return t}var en=null;function tl(e){en===null?en=[e]:en.push(e)}function ru(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,tl(t)):(n.next=i.next,i.next=n),t.interleaved=n,wt(e,r)}function wt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Mt=!1;function nl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function iu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function xt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Pt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,wt(e,n)}return i=r.interleaved,i===null?(t.next=t,tl(r)):(t.next=i.next,i.next=t),r.interleaved=t,wt(e,n)}function ci(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ls(e,n)}}function da(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Fi(e,t,n,r){var i=e.updateQueue;Mt=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,c=i.shared.pending;if(c!==null){i.shared.pending=null;var u=c,h=u.next;u.next=null,s===null?o=h:s.next=h,s=u;var m=e.alternate;m!==null&&(m=m.updateQueue,c=m.lastBaseUpdate,c!==s&&(c===null?m.firstBaseUpdate=h:c.next=h,m.lastBaseUpdate=u))}if(o!==null){var v=i.baseState;s=0,m=h=u=null,c=o;do{var y=c.lane,E=c.eventTime;if((r&y)===y){m!==null&&(m=m.next={eventTime:E,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var k=e,w=c;switch(y=t,E=n,w.tag){case 1:if(k=w.payload,typeof k=="function"){v=k.call(E,v,y);break e}v=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=w.payload,y=typeof k=="function"?k.call(E,v,y):k,y==null)break e;v=ce({},v,y);break e;case 2:Mt=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,y=i.effects,y===null?i.effects=[c]:y.push(c))}else E={eventTime:E,lane:y,tag:c.tag,payload:c.payload,callback:c.callback,next:null},m===null?(h=m=E,u=v):m=m.next=E,s|=y;if(c=c.next,c===null){if(c=i.shared.pending,c===null)break;y=c,c=y.next,y.next=null,i.lastBaseUpdate=y,i.shared.pending=null}}while(!0);if(m===null&&(u=v),i.baseState=u,i.firstBaseUpdate=h,i.lastBaseUpdate=m,t=i.shared.interleaved,t!==null){i=t;do s|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);an|=s,e.lanes=s,e.memoizedState=v}}function ha(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(P(191,i));i.call(r)}}}var Dr={},ft=Ut(Dr),Mr=Ut(Dr),br=Ut(Dr);function tn(e){if(e===Dr)throw Error(P(174));return e}function rl(e,t){switch(re(br,t),re(Mr,e),re(ft,Dr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ho(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ho(t,e)}oe(ft),re(ft,t)}function On(){oe(ft),oe(Mr),oe(br)}function ou(e){tn(br.current);var t=tn(ft.current),n=Ho(t,e.type);t!==n&&(re(Mr,e),re(ft,n))}function il(e){Mr.current===e&&(oe(ft),oe(Mr))}var le=Ut(0);function Ai(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Co=[];function ol(){for(var e=0;e<Co.length;e++)Co[e]._workInProgressVersionPrimary=null;Co.length=0}var ui=Ct.ReactCurrentDispatcher,Eo=Ct.ReactCurrentBatchConfig,ln=0,ae=null,me=null,xe=null,ji=!1,dr=!1,Rr=0,rf=0;function Ee(){throw Error(P(321))}function sl(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!lt(e[n],t[n]))return!1;return!0}function ll(e,t,n,r,i,o){if(ln=o,ae=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ui.current=e===null||e.memoizedState===null?af:cf,e=n(r,i),dr){o=0;do{if(dr=!1,Rr=0,25<=o)throw Error(P(301));o+=1,xe=me=null,t.updateQueue=null,ui.current=uf,e=n(r,i)}while(dr)}if(ui.current=Bi,t=me!==null&&me.next!==null,ln=0,xe=me=ae=null,ji=!1,t)throw Error(P(300));return e}function al(){var e=Rr!==0;return Rr=0,e}function ut(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xe===null?ae.memoizedState=xe=e:xe=xe.next=e,xe}function qe(){if(me===null){var e=ae.alternate;e=e!==null?e.memoizedState:null}else e=me.next;var t=xe===null?ae.memoizedState:xe.next;if(t!==null)xe=t,me=e;else{if(e===null)throw Error(P(310));me=e,e={memoizedState:me.memoizedState,baseState:me.baseState,baseQueue:me.baseQueue,queue:me.queue,next:null},xe===null?ae.memoizedState=xe=e:xe=xe.next=e}return xe}function Nr(e,t){return typeof t=="function"?t(e):t}function ko(e){var t=qe(),n=t.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=e;var r=me,i=r.baseQueue,o=n.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}r.baseQueue=i=o,n.pending=null}if(i!==null){o=i.next,r=r.baseState;var c=s=null,u=null,h=o;do{var m=h.lane;if((ln&m)===m)u!==null&&(u=u.next={lane:0,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),r=h.hasEagerState?h.eagerState:e(r,h.action);else{var v={lane:m,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null};u===null?(c=u=v,s=r):u=u.next=v,ae.lanes|=m,an|=m}h=h.next}while(h!==null&&h!==o);u===null?s=r:u.next=c,lt(r,t.memoizedState)||(Pe=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do o=i.lane,ae.lanes|=o,an|=o,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Mo(e){var t=qe(),n=t.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=e(o,s.action),s=s.next;while(s!==i);lt(o,t.memoizedState)||(Pe=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function su(){}function lu(e,t){var n=ae,r=qe(),i=t(),o=!lt(r.memoizedState,i);if(o&&(r.memoizedState=i,Pe=!0),r=r.queue,cl(uu.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||xe!==null&&xe.memoizedState.tag&1){if(n.flags|=2048,Tr(9,cu.bind(null,n,r,i,t),void 0,null),ve===null)throw Error(P(349));ln&30||au(n,t,i)}return i}function au(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ae.updateQueue,t===null?(t={lastEffect:null,stores:null},ae.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function cu(e,t,n,r){t.value=n,t.getSnapshot=r,du(t)&&hu(e)}function uu(e,t,n){return n(function(){du(t)&&hu(e)})}function du(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!lt(e,n)}catch{return!0}}function hu(e){var t=wt(e,1);t!==null&&st(t,e,1,-1)}function fa(e){var t=ut();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:e},t.queue=e,e=e.dispatch=lf.bind(null,ae,e),[t.memoizedState,e]}function Tr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ae.updateQueue,t===null?(t={lastEffect:null,stores:null},ae.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function fu(){return qe().memoizedState}function di(e,t,n,r){var i=ut();ae.flags|=e,i.memoizedState=Tr(1|t,n,void 0,r===void 0?null:r)}function Qi(e,t,n,r){var i=qe();r=r===void 0?null:r;var o=void 0;if(me!==null){var s=me.memoizedState;if(o=s.destroy,r!==null&&sl(r,s.deps)){i.memoizedState=Tr(t,n,o,r);return}}ae.flags|=e,i.memoizedState=Tr(1|t,n,o,r)}function pa(e,t){return di(8390656,8,e,t)}function cl(e,t){return Qi(2048,8,e,t)}function pu(e,t){return Qi(4,2,e,t)}function gu(e,t){return Qi(4,4,e,t)}function mu(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yu(e,t,n){return n=n!=null?n.concat([e]):null,Qi(4,4,mu.bind(null,t,e),n)}function ul(){}function xu(e,t){var n=qe();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sl(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function vu(e,t){var n=qe();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sl(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Su(e,t,n){return ln&21?(lt(n,t)||(n=kc(),ae.lanes|=n,an|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Pe=!0),e.memoizedState=n)}function of(e,t){var n=te;te=n!==0&&4>n?n:4,e(!0);var r=Eo.transition;Eo.transition={};try{e(!1),t()}finally{te=n,Eo.transition=r}}function wu(){return qe().memoizedState}function sf(e,t,n){var r=zt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Iu(e))Cu(t,n);else if(n=ru(e,t,n,r),n!==null){var i=Te();st(n,e,r,i),Eu(n,t,r)}}function lf(e,t,n){var r=zt(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Iu(e))Cu(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,c=o(s,n);if(i.hasEagerState=!0,i.eagerState=c,lt(c,s)){var u=t.interleaved;u===null?(i.next=i,tl(t)):(i.next=u.next,u.next=i),t.interleaved=i;return}}catch{}finally{}n=ru(e,t,i,r),n!==null&&(i=Te(),st(n,e,r,i),Eu(n,t,r))}}function Iu(e){var t=e.alternate;return e===ae||t!==null&&t===ae}function Cu(e,t){dr=ji=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Eu(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ls(e,n)}}var Bi={readContext:$e,useCallback:Ee,useContext:Ee,useEffect:Ee,useImperativeHandle:Ee,useInsertionEffect:Ee,useLayoutEffect:Ee,useMemo:Ee,useReducer:Ee,useRef:Ee,useState:Ee,useDebugValue:Ee,useDeferredValue:Ee,useTransition:Ee,useMutableSource:Ee,useSyncExternalStore:Ee,useId:Ee,unstable_isNewReconciler:!1},af={readContext:$e,useCallback:function(e,t){return ut().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:pa,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,di(4194308,4,mu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return di(4194308,4,e,t)},useInsertionEffect:function(e,t){return di(4,2,e,t)},useMemo:function(e,t){var n=ut();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ut();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=sf.bind(null,ae,e),[r.memoizedState,e]},useRef:function(e){var t=ut();return e={current:e},t.memoizedState=e},useState:fa,useDebugValue:ul,useDeferredValue:function(e){return ut().memoizedState=e},useTransition:function(){var e=fa(!1),t=e[0];return e=of.bind(null,e[1]),ut().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ae,i=ut();if(se){if(n===void 0)throw Error(P(407));n=n()}else{if(n=t(),ve===null)throw Error(P(349));ln&30||au(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,pa(uu.bind(null,r,o,e),[e]),r.flags|=2048,Tr(9,cu.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ut(),t=ve.identifierPrefix;if(se){var n=yt,r=mt;n=(r&~(1<<32-ot(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Rr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=rf++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},cf={readContext:$e,useCallback:xu,useContext:$e,useEffect:cl,useImperativeHandle:yu,useInsertionEffect:pu,useLayoutEffect:gu,useMemo:vu,useReducer:ko,useRef:fu,useState:function(){return ko(Nr)},useDebugValue:ul,useDeferredValue:function(e){var t=qe();return Su(t,me.memoizedState,e)},useTransition:function(){var e=ko(Nr)[0],t=qe().memoizedState;return[e,t]},useMutableSource:su,useSyncExternalStore:lu,useId:wu,unstable_isNewReconciler:!1},uf={readContext:$e,useCallback:xu,useContext:$e,useEffect:cl,useImperativeHandle:yu,useInsertionEffect:pu,useLayoutEffect:gu,useMemo:vu,useReducer:Mo,useRef:fu,useState:function(){return Mo(Nr)},useDebugValue:ul,useDeferredValue:function(e){var t=qe();return me===null?t.memoizedState=e:Su(t,me.memoizedState,e)},useTransition:function(){var e=Mo(Nr)[0],t=qe().memoizedState;return[e,t]},useMutableSource:su,useSyncExternalStore:lu,useId:wu,unstable_isNewReconciler:!1};function nt(e,t){if(e&&e.defaultProps){t=ce({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function us(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ce({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Yi={isMounted:function(e){return(e=e._reactInternals)?dn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Te(),i=zt(e),o=xt(r,i);o.payload=t,n!=null&&(o.callback=n),t=Pt(e,o,i),t!==null&&(st(t,e,i,r),ci(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Te(),i=zt(e),o=xt(r,i);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Pt(e,o,i),t!==null&&(st(t,e,i,r),ci(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Te(),r=zt(e),i=xt(n,r);i.tag=2,t!=null&&(i.callback=t),t=Pt(e,i,r),t!==null&&(st(t,e,r,n),ci(t,e,r))}};function ga(e,t,n,r,i,o,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,s):t.prototype&&t.prototype.isPureReactComponent?!Ir(n,r)||!Ir(i,o):!0}function ku(e,t,n){var r=!1,i=Ot,o=t.contextType;return typeof o=="object"&&o!==null?o=$e(o):(i=ze(t)?on:be.current,r=t.contextTypes,o=(r=r!=null)?zn(e,i):Ot),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Yi,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function ma(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Yi.enqueueReplaceState(t,t.state,null)}function ds(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},nl(e);var o=t.contextType;typeof o=="object"&&o!==null?i.context=$e(o):(o=ze(t)?on:be.current,i.context=zn(e,o)),i.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(us(e,t,o,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Yi.enqueueReplaceState(i,i.state,null),Fi(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Ln(e,t){try{var n="",r=t;do n+=zd(r),r=r.return;while(r);var i=n}catch(o){i=`
Error generating stack: `+o.message+`
`+o.stack}return{value:e,source:t,stack:i,digest:null}}function bo(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function hs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var df=typeof WeakMap=="function"?WeakMap:Map;function Mu(e,t,n){n=xt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Di||(Di=!0,Is=r),hs(e,t)},n}function bu(e,t,n){n=xt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){hs(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){hs(e,t),typeof r!="function"&&(Dt===null?Dt=new Set([this]):Dt.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function ya(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new df;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=kf.bind(null,e,t,n),t.then(e,e))}function xa(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function va(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=xt(-1,1),t.tag=2,Pt(n,t,1))),n.lanes|=1),e)}var hf=Ct.ReactCurrentOwner,Pe=!1;function Ne(e,t,n,r){t.child=e===null?nu(t,null,n,r):Gn(t,e.child,n,r)}function Sa(e,t,n,r,i){n=n.render;var o=t.ref;return jn(t,i),r=ll(e,t,n,r,o,i),n=al(),e!==null&&!Pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,It(e,t,i)):(se&&n&&Xs(t),t.flags|=1,Ne(e,t,r,i),t.child)}function wa(e,t,n,r,i){if(e===null){var o=n.type;return typeof o=="function"&&!xl(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Ru(e,t,o,r,i)):(e=gi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&i)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:Ir,n(s,r)&&e.ref===t.ref)return It(e,t,i)}return t.flags|=1,e=Vt(o,r),e.ref=t.ref,e.return=t,t.child=e}function Ru(e,t,n,r,i){if(e!==null){var o=e.memoizedProps;if(Ir(o,r)&&e.ref===t.ref)if(Pe=!1,t.pendingProps=r=o,(e.lanes&i)!==0)e.flags&131072&&(Pe=!0);else return t.lanes=e.lanes,It(e,t,i)}return fs(e,t,n,r,i)}function Nu(e,t,n){var r=t.pendingProps,i=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},re(kn,Oe),Oe|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,re(kn,Oe),Oe|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,re(kn,Oe),Oe|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,re(kn,Oe),Oe|=r;return Ne(e,t,i,n),t.child}function Tu(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function fs(e,t,n,r,i){var o=ze(n)?on:be.current;return o=zn(t,o),jn(t,i),n=ll(e,t,n,r,o,i),r=al(),e!==null&&!Pe?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,It(e,t,i)):(se&&r&&Xs(t),t.flags|=1,Ne(e,t,n,i),t.child)}function Ia(e,t,n,r,i){if(ze(n)){var o=!0;Mi(t)}else o=!1;if(jn(t,i),t.stateNode===null)hi(e,t),ku(t,n,r),ds(t,n,r,i),r=!0;else if(e===null){var s=t.stateNode,c=t.memoizedProps;s.props=c;var u=s.context,h=n.contextType;typeof h=="object"&&h!==null?h=$e(h):(h=ze(n)?on:be.current,h=zn(t,h));var m=n.getDerivedStateFromProps,v=typeof m=="function"||typeof s.getSnapshotBeforeUpdate=="function";v||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(c!==r||u!==h)&&ma(t,s,r,h),Mt=!1;var y=t.memoizedState;s.state=y,Fi(t,r,s,i),u=t.memoizedState,c!==r||y!==u||De.current||Mt?(typeof m=="function"&&(us(t,n,m,r),u=t.memoizedState),(c=Mt||ga(t,n,c,r,y,u,h))?(v||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),s.props=r,s.state=u,s.context=h,r=c):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,iu(e,t),c=t.memoizedProps,h=t.type===t.elementType?c:nt(t.type,c),s.props=h,v=t.pendingProps,y=s.context,u=n.contextType,typeof u=="object"&&u!==null?u=$e(u):(u=ze(n)?on:be.current,u=zn(t,u));var E=n.getDerivedStateFromProps;(m=typeof E=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(c!==v||y!==u)&&ma(t,s,r,u),Mt=!1,y=t.memoizedState,s.state=y,Fi(t,r,s,i);var k=t.memoizedState;c!==v||y!==k||De.current||Mt?(typeof E=="function"&&(us(t,n,E,r),k=t.memoizedState),(h=Mt||ga(t,n,h,r,y,k,u)||!1)?(m||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,k,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,k,u)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||c===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=k),s.props=r,s.state=k,s.context=u,r=h):(typeof s.componentDidUpdate!="function"||c===e.memoizedProps&&y===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&y===e.memoizedState||(t.flags|=1024),r=!1)}return ps(e,t,n,r,o,i)}function ps(e,t,n,r,i,o){Tu(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return i&&la(t,n,!1),It(e,t,o);r=t.stateNode,hf.current=t;var c=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Gn(t,e.child,null,o),t.child=Gn(t,null,c,o)):Ne(e,t,c,o),t.memoizedState=r.state,i&&la(t,n,!0),t.child}function Fu(e){var t=e.stateNode;t.pendingContext?sa(e,t.pendingContext,t.pendingContext!==t.context):t.context&&sa(e,t.context,!1),rl(e,t.containerInfo)}function Ca(e,t,n,r,i){return Vn(),Ks(i),t.flags|=256,Ne(e,t,n,r),t.child}var gs={dehydrated:null,treeContext:null,retryLane:0};function ms(e){return{baseLanes:e,cachePool:null,transitions:null}}function Au(e,t,n){var r=t.pendingProps,i=le.current,o=!1,s=(t.flags&128)!==0,c;if((c=s)||(c=e!==null&&e.memoizedState===null?!1:(i&2)!==0),c?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),re(le,i&1),e===null)return as(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,o?(r=t.mode,o=t.child,s={mode:"hidden",children:s},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=Ki(s,r,0,null),e=rn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=ms(n),t.memoizedState=gs,e):dl(t,s));if(i=e.memoizedState,i!==null&&(c=i.dehydrated,c!==null))return ff(e,t,s,r,c,i,n);if(o){o=r.fallback,s=t.mode,i=e.child,c=i.sibling;var u={mode:"hidden",children:r.children};return!(s&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=Vt(i,u),r.subtreeFlags=i.subtreeFlags&14680064),c!==null?o=Vt(c,o):(o=rn(o,s,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,s=e.child.memoizedState,s=s===null?ms(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=e.childLanes&~n,t.memoizedState=gs,r}return o=e.child,e=o.sibling,r=Vt(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function dl(e,t){return t=Ki({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Jr(e,t,n,r){return r!==null&&Ks(r),Gn(t,e.child,null,n),e=dl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ff(e,t,n,r,i,o,s){if(n)return t.flags&256?(t.flags&=-257,r=bo(Error(P(422))),Jr(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,i=t.mode,r=Ki({mode:"visible",children:r.children},i,0,null),o=rn(o,i,s,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&Gn(t,e.child,null,s),t.child.memoizedState=ms(s),t.memoizedState=gs,o);if(!(t.mode&1))return Jr(e,t,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var c=r.dgst;return r=c,o=Error(P(419)),r=bo(o,r,void 0),Jr(e,t,s,r)}if(c=(s&e.childLanes)!==0,Pe||c){if(r=ve,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,wt(e,i),st(r,e,i,-1))}return yl(),r=bo(Error(P(421))),Jr(e,t,s,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Mf.bind(null,e),i._reactRetry=t,null):(e=o.treeContext,We=Bt(i.nextSibling),He=t,se=!0,it=null,e!==null&&(Ye[Xe++]=mt,Ye[Xe++]=yt,Ye[Xe++]=sn,mt=e.id,yt=e.overflow,sn=t),t=dl(t,r.children),t.flags|=4096,t)}function Ea(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),cs(e.return,t,n)}function Ro(e,t,n,r,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function ju(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(Ne(e,t,r.children,n),r=le.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ea(e,n,t);else if(e.tag===19)Ea(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(re(le,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Ai(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ro(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ai(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ro(t,!0,n,null,o);break;case"together":Ro(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function hi(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function It(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),an|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(P(153));if(t.child!==null){for(e=t.child,n=Vt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Vt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function pf(e,t,n){switch(t.tag){case 3:Fu(t),Vn();break;case 5:ou(t);break;case 1:ze(t.type)&&Mi(t);break;case 4:rl(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;re(Ni,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(re(le,le.current&1),t.flags|=128,null):n&t.child.childLanes?Au(e,t,n):(re(le,le.current&1),e=It(e,t,n),e!==null?e.sibling:null);re(le,le.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ju(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),re(le,le.current),r)break;return null;case 22:case 23:return t.lanes=0,Nu(e,t,n)}return It(e,t,n)}var Bu,ys,Pu,Du;Bu=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ys=function(){};Pu=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,tn(ft.current);var o=null;switch(n){case"input":i=Go(e,i),r=Go(e,r),o=[];break;case"select":i=ce({},i,{value:void 0}),r=ce({},r,{value:void 0}),o=[];break;case"textarea":i=Wo(e,i),r=Wo(e,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ei)}Uo(n,r);var s;n=null;for(h in i)if(!r.hasOwnProperty(h)&&i.hasOwnProperty(h)&&i[h]!=null)if(h==="style"){var c=i[h];for(s in c)c.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else h!=="dangerouslySetInnerHTML"&&h!=="children"&&h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(gr.hasOwnProperty(h)?o||(o=[]):(o=o||[]).push(h,null));for(h in r){var u=r[h];if(c=i!=null?i[h]:void 0,r.hasOwnProperty(h)&&u!==c&&(u!=null||c!=null))if(h==="style")if(c){for(s in c)!c.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&c[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(o||(o=[]),o.push(h,n)),n=u;else h==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,c=c?c.__html:void 0,u!=null&&c!==u&&(o=o||[]).push(h,u)):h==="children"?typeof u!="string"&&typeof u!="number"||(o=o||[]).push(h,""+u):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&(gr.hasOwnProperty(h)?(u!=null&&h==="onScroll"&&ie("scroll",e),o||c===u||(o=[])):(o=o||[]).push(h,u))}n&&(o=o||[]).push("style",n);var h=o;(t.updateQueue=h)&&(t.flags|=4)}};Du=function(e,t,n,r){n!==r&&(t.flags|=4)};function qn(e,t){if(!se)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ke(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function gf(e,t,n){var r=t.pendingProps;switch(Js(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ke(t),null;case 1:return ze(t.type)&&ki(),ke(t),null;case 3:return r=t.stateNode,On(),oe(De),oe(be),ol(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Yr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,it!==null&&(ks(it),it=null))),ys(e,t),ke(t),null;case 5:il(t);var i=tn(br.current);if(n=t.type,e!==null&&t.stateNode!=null)Pu(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(P(166));return ke(t),null}if(e=tn(ft.current),Yr(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[dt]=t,r[kr]=o,e=(t.mode&1)!==0,n){case"dialog":ie("cancel",r),ie("close",r);break;case"iframe":case"object":case"embed":ie("load",r);break;case"video":case"audio":for(i=0;i<ir.length;i++)ie(ir[i],r);break;case"source":ie("error",r);break;case"img":case"image":case"link":ie("error",r),ie("load",r);break;case"details":ie("toggle",r);break;case"input":jl(r,o),ie("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},ie("invalid",r);break;case"textarea":Pl(r,o),ie("invalid",r)}Uo(n,o),i=null;for(var s in o)if(o.hasOwnProperty(s)){var c=o[s];s==="children"?typeof c=="string"?r.textContent!==c&&(o.suppressHydrationWarning!==!0&&Qr(r.textContent,c,e),i=["children",c]):typeof c=="number"&&r.textContent!==""+c&&(o.suppressHydrationWarning!==!0&&Qr(r.textContent,c,e),i=["children",""+c]):gr.hasOwnProperty(s)&&c!=null&&s==="onScroll"&&ie("scroll",r)}switch(n){case"input":Gr(r),Bl(r,o,!0);break;case"textarea":Gr(r),Dl(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=Ei)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=uc(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[dt]=t,e[kr]=r,Bu(e,t,!1,!1),t.stateNode=e;e:{switch(s=_o(n,r),n){case"dialog":ie("cancel",e),ie("close",e),i=r;break;case"iframe":case"object":case"embed":ie("load",e),i=r;break;case"video":case"audio":for(i=0;i<ir.length;i++)ie(ir[i],e);i=r;break;case"source":ie("error",e),i=r;break;case"img":case"image":case"link":ie("error",e),ie("load",e),i=r;break;case"details":ie("toggle",e),i=r;break;case"input":jl(e,r),i=Go(e,r),ie("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=ce({},r,{value:void 0}),ie("invalid",e);break;case"textarea":Pl(e,r),i=Wo(e,r),ie("invalid",e);break;default:i=r}Uo(n,i),c=i;for(o in c)if(c.hasOwnProperty(o)){var u=c[o];o==="style"?fc(e,u):o==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&dc(e,u)):o==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&mr(e,u):typeof u=="number"&&mr(e,""+u):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(gr.hasOwnProperty(o)?u!=null&&o==="onScroll"&&ie("scroll",e):u!=null&&Ps(e,o,u,s))}switch(n){case"input":Gr(e),Bl(e,r,!1);break;case"textarea":Gr(e),Dl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Gt(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Nn(e,!!r.multiple,o,!1):r.defaultValue!=null&&Nn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Ei)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return ke(t),null;case 6:if(e&&t.stateNode!=null)Du(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(P(166));if(n=tn(br.current),tn(ft.current),Yr(t)){if(r=t.stateNode,n=t.memoizedProps,r[dt]=t,(o=r.nodeValue!==n)&&(e=He,e!==null))switch(e.tag){case 3:Qr(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Qr(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[dt]=t,t.stateNode=r}return ke(t),null;case 13:if(oe(le),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(se&&We!==null&&t.mode&1&&!(t.flags&128))eu(),Vn(),t.flags|=98560,o=!1;else if(o=Yr(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(P(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(P(317));o[dt]=t}else Vn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ke(t),o=!1}else it!==null&&(ks(it),it=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||le.current&1?ye===0&&(ye=3):yl())),t.updateQueue!==null&&(t.flags|=4),ke(t),null);case 4:return On(),ys(e,t),e===null&&Cr(t.stateNode.containerInfo),ke(t),null;case 10:return el(t.type._context),ke(t),null;case 17:return ze(t.type)&&ki(),ke(t),null;case 19:if(oe(le),o=t.memoizedState,o===null)return ke(t),null;if(r=(t.flags&128)!==0,s=o.rendering,s===null)if(r)qn(o,!1);else{if(ye!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Ai(e),s!==null){for(t.flags|=128,qn(o,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,s=o.alternate,s===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,o.type=s.type,e=s.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return re(le,le.current&1|2),t.child}e=e.sibling}o.tail!==null&&pe()>Wn&&(t.flags|=128,r=!0,qn(o,!1),t.lanes=4194304)}else{if(!r)if(e=Ai(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),qn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!se)return ke(t),null}else 2*pe()-o.renderingStartTime>Wn&&n!==1073741824&&(t.flags|=128,r=!0,qn(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=pe(),t.sibling=null,n=le.current,re(le,r?n&1|2:n&1),t):(ke(t),null);case 22:case 23:return ml(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Oe&1073741824&&(ke(t),t.subtreeFlags&6&&(t.flags|=8192)):ke(t),null;case 24:return null;case 25:return null}throw Error(P(156,t.tag))}function mf(e,t){switch(Js(t),t.tag){case 1:return ze(t.type)&&ki(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return On(),oe(De),oe(be),ol(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return il(t),null;case 13:if(oe(le),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(P(340));Vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return oe(le),null;case 4:return On(),null;case 10:return el(t.type._context),null;case 22:case 23:return ml(),null;case 24:return null;default:return null}}var Kr=!1,Me=!1,yf=typeof WeakSet=="function"?WeakSet:Set,V=null;function En(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ue(e,t,r)}else n.current=null}function xs(e,t,n){try{n()}catch(r){ue(e,t,r)}}var ka=!1;function xf(e,t){if(ts=wi,e=Lc(),Ys(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,c=-1,u=-1,h=0,m=0,v=e,y=null;t:for(;;){for(var E;v!==n||i!==0&&v.nodeType!==3||(c=s+i),v!==o||r!==0&&v.nodeType!==3||(u=s+r),v.nodeType===3&&(s+=v.nodeValue.length),(E=v.firstChild)!==null;)y=v,v=E;for(;;){if(v===e)break t;if(y===n&&++h===i&&(c=s),y===o&&++m===r&&(u=s),(E=v.nextSibling)!==null)break;v=y,y=v.parentNode}v=E}n=c===-1||u===-1?null:{start:c,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(ns={focusedElem:e,selectionRange:n},wi=!1,V=t;V!==null;)if(t=V,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,V=e;else for(;V!==null;){t=V;try{var k=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(k!==null){var w=k.memoizedProps,B=k.memoizedState,p=t.stateNode,f=p.getSnapshotBeforeUpdate(t.elementType===t.type?w:nt(t.type,w),B);p.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(P(163))}}catch(M){ue(t,t.return,M)}if(e=t.sibling,e!==null){e.return=t.return,V=e;break}V=t.return}return k=ka,ka=!1,k}function hr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&xs(t,n,o)}i=i.next}while(i!==r)}}function Xi(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function vs(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function zu(e){var t=e.alternate;t!==null&&(e.alternate=null,zu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[dt],delete t[kr],delete t[os],delete t[qh],delete t[ef])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Vu(e){return e.tag===5||e.tag===3||e.tag===4}function Ma(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Vu(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.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 Ss(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ei));else if(r!==4&&(e=e.child,e!==null))for(Ss(e,t,n),e=e.sibling;e!==null;)Ss(e,t,n),e=e.sibling}function ws(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ws(e,t,n),e=e.sibling;e!==null;)ws(e,t,n),e=e.sibling}var we=null,rt=!1;function Et(e,t,n){for(n=n.child;n!==null;)Gu(e,t,n),n=n.sibling}function Gu(e,t,n){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount(Li,n)}catch{}switch(n.tag){case 5:Me||En(n,t);case 6:var r=we,i=rt;we=null,Et(e,t,n),we=r,rt=i,we!==null&&(rt?(e=we,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):we.removeChild(n.stateNode));break;case 18:we!==null&&(rt?(e=we,n=n.stateNode,e.nodeType===8?wo(e.parentNode,n):e.nodeType===1&&wo(e,n),Sr(e)):wo(we,n.stateNode));break;case 4:r=we,i=rt,we=n.stateNode.containerInfo,rt=!0,Et(e,t,n),we=r,rt=i;break;case 0:case 11:case 14:case 15:if(!Me&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&xs(n,t,s),i=i.next}while(i!==r)}Et(e,t,n);break;case 1:if(!Me&&(En(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){ue(n,t,c)}Et(e,t,n);break;case 21:Et(e,t,n);break;case 22:n.mode&1?(Me=(r=Me)||n.memoizedState!==null,Et(e,t,n),Me=r):Et(e,t,n);break;default:Et(e,t,n)}}function ba(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yf),t.forEach(function(r){var i=bf.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function tt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var o=e,s=t,c=s;e:for(;c!==null;){switch(c.tag){case 5:we=c.stateNode,rt=!1;break e;case 3:we=c.stateNode.containerInfo,rt=!0;break e;case 4:we=c.stateNode.containerInfo,rt=!0;break e}c=c.return}if(we===null)throw Error(P(160));Gu(o,s,i),we=null,rt=!1;var u=i.alternate;u!==null&&(u.return=null),i.return=null}catch(h){ue(i,t,h)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ou(t,e),t=t.sibling}function Ou(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(tt(t,e),ct(e),r&4){try{hr(3,e,e.return),Xi(3,e)}catch(w){ue(e,e.return,w)}try{hr(5,e,e.return)}catch(w){ue(e,e.return,w)}}break;case 1:tt(t,e),ct(e),r&512&&n!==null&&En(n,n.return);break;case 5:if(tt(t,e),ct(e),r&512&&n!==null&&En(n,n.return),e.flags&32){var i=e.stateNode;try{mr(i,"")}catch(w){ue(e,e.return,w)}}if(r&4&&(i=e.stateNode,i!=null)){var o=e.memoizedProps,s=n!==null?n.memoizedProps:o,c=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{c==="input"&&o.type==="radio"&&o.name!=null&&ac(i,o),_o(c,s);var h=_o(c,o);for(s=0;s<u.length;s+=2){var m=u[s],v=u[s+1];m==="style"?fc(i,v):m==="dangerouslySetInnerHTML"?dc(i,v):m==="children"?mr(i,v):Ps(i,m,v,h)}switch(c){case"input":Oo(i,o);break;case"textarea":cc(i,o);break;case"select":var y=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var E=o.value;E!=null?Nn(i,!!o.multiple,E,!1):y!==!!o.multiple&&(o.defaultValue!=null?Nn(i,!!o.multiple,o.defaultValue,!0):Nn(i,!!o.multiple,o.multiple?[]:"",!1))}i[kr]=o}catch(w){ue(e,e.return,w)}}break;case 6:if(tt(t,e),ct(e),r&4){if(e.stateNode===null)throw Error(P(162));i=e.stateNode,o=e.memoizedProps;try{i.nodeValue=o}catch(w){ue(e,e.return,w)}}break;case 3:if(tt(t,e),ct(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Sr(t.containerInfo)}catch(w){ue(e,e.return,w)}break;case 4:tt(t,e),ct(e);break;case 13:tt(t,e),ct(e),i=e.child,i.flags&8192&&(o=i.memoizedState!==null,i.stateNode.isHidden=o,!o||i.alternate!==null&&i.alternate.memoizedState!==null||(pl=pe())),r&4&&ba(e);break;case 22:if(m=n!==null&&n.memoizedState!==null,e.mode&1?(Me=(h=Me)||m,tt(t,e),Me=h):tt(t,e),ct(e),r&8192){if(h=e.memoizedState!==null,(e.stateNode.isHidden=h)&&!m&&e.mode&1)for(V=e,m=e.child;m!==null;){for(v=V=m;V!==null;){switch(y=V,E=y.child,y.tag){case 0:case 11:case 14:case 15:hr(4,y,y.return);break;case 1:En(y,y.return);var k=y.stateNode;if(typeof k.componentWillUnmount=="function"){r=y,n=y.return;try{t=r,k.props=t.memoizedProps,k.state=t.memoizedState,k.componentWillUnmount()}catch(w){ue(r,n,w)}}break;case 5:En(y,y.return);break;case 22:if(y.memoizedState!==null){Na(v);continue}}E!==null?(E.return=y,V=E):Na(v)}m=m.sibling}e:for(m=null,v=e;;){if(v.tag===5){if(m===null){m=v;try{i=v.stateNode,h?(o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(c=v.stateNode,u=v.memoizedProps.style,s=u!=null&&u.hasOwnProperty("display")?u.display:null,c.style.display=hc("display",s))}catch(w){ue(e,e.return,w)}}}else if(v.tag===6){if(m===null)try{v.stateNode.nodeValue=h?"":v.memoizedProps}catch(w){ue(e,e.return,w)}}else if((v.tag!==22&&v.tag!==23||v.memoizedState===null||v===e)&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===e)break e;for(;v.sibling===null;){if(v.return===null||v.return===e)break e;m===v&&(m=null),v=v.return}m===v&&(m=null),v.sibling.return=v.return,v=v.sibling}}break;case 19:tt(t,e),ct(e),r&4&&ba(e);break;case 21:break;default:tt(t,e),ct(e)}}function ct(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Vu(n)){var r=n;break e}n=n.return}throw Error(P(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(mr(i,""),r.flags&=-33);var o=Ma(e);ws(e,o,i);break;case 3:case 4:var s=r.stateNode.containerInfo,c=Ma(e);Ss(e,c,s);break;default:throw Error(P(161))}}catch(u){ue(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function vf(e,t,n){V=e,Lu(e)}function Lu(e,t,n){for(var r=(e.mode&1)!==0;V!==null;){var i=V,o=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||Kr;if(!s){var c=i.alternate,u=c!==null&&c.memoizedState!==null||Me;c=Kr;var h=Me;if(Kr=s,(Me=u)&&!h)for(V=i;V!==null;)s=V,u=s.child,s.tag===22&&s.memoizedState!==null?Ta(i):u!==null?(u.return=s,V=u):Ta(i);for(;o!==null;)V=o,Lu(o),o=o.sibling;V=i,Kr=c,Me=h}Ra(e)}else i.subtreeFlags&8772&&o!==null?(o.return=i,V=o):Ra(e)}}function Ra(e){for(;V!==null;){var t=V;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Me||Xi(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Me)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:nt(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&ha(t,o,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ha(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var h=t.alternate;if(h!==null){var m=h.memoizedState;if(m!==null){var v=m.dehydrated;v!==null&&Sr(v)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(P(163))}Me||t.flags&512&&vs(t)}catch(y){ue(t,t.return,y)}}if(t===e){V=null;break}if(n=t.sibling,n!==null){n.return=t.return,V=n;break}V=t.return}}function Na(e){for(;V!==null;){var t=V;if(t===e){V=null;break}var n=t.sibling;if(n!==null){n.return=t.return,V=n;break}V=t.return}}function Ta(e){for(;V!==null;){var t=V;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Xi(4,t)}catch(u){ue(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(u){ue(t,i,u)}}var o=t.return;try{vs(t)}catch(u){ue(t,o,u)}break;case 5:var s=t.return;try{vs(t)}catch(u){ue(t,s,u)}}}catch(u){ue(t,t.return,u)}if(t===e){V=null;break}var c=t.sibling;if(c!==null){c.return=t.return,V=c;break}V=t.return}}var Sf=Math.ceil,Pi=Ct.ReactCurrentDispatcher,hl=Ct.ReactCurrentOwner,Ke=Ct.ReactCurrentBatchConfig,q=0,ve=null,ge=null,Ie=0,Oe=0,kn=Ut(0),ye=0,Fr=null,an=0,Ji=0,fl=0,fr=null,Be=null,pl=0,Wn=1/0,pt=null,Di=!1,Is=null,Dt=null,$r=!1,Tt=null,zi=0,pr=0,Cs=null,fi=-1,pi=0;function Te(){return q&6?pe():fi!==-1?fi:fi=pe()}function zt(e){return e.mode&1?q&2&&Ie!==0?Ie&-Ie:nf.transition!==null?(pi===0&&(pi=kc()),pi):(e=te,e!==0||(e=window.event,e=e===void 0?16:Ac(e.type)),e):1}function st(e,t,n,r){if(50<pr)throw pr=0,Cs=null,Error(P(185));jr(e,n,r),(!(q&2)||e!==ve)&&(e===ve&&(!(q&2)&&(Ji|=n),ye===4&&Rt(e,Ie)),Ve(e,r),n===1&&q===0&&!(t.mode&1)&&(Wn=pe()+500,Zi&&_t()))}function Ve(e,t){var n=e.callbackNode;nh(e,t);var r=Si(e,e===ve?Ie:0);if(r===0)n!==null&&Gl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Gl(n),t===1)e.tag===0?tf(Fa.bind(null,e)):Kc(Fa.bind(null,e)),Kh(function(){!(q&6)&&_t()}),n=null;else{switch(Mc(r)){case 1:n=Os;break;case 4:n=Cc;break;case 16:n=vi;break;case 536870912:n=Ec;break;default:n=vi}n=Xu(n,Wu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Wu(e,t){if(fi=-1,pi=0,q&6)throw Error(P(327));var n=e.callbackNode;if(Bn()&&e.callbackNode!==n)return null;var r=Si(e,e===ve?Ie:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Vi(e,r);else{t=r;var i=q;q|=2;var o=Uu();(ve!==e||Ie!==t)&&(pt=null,Wn=pe()+500,nn(e,t));do try{Cf();break}catch(c){Hu(e,c)}while(!0);qs(),Pi.current=o,q=i,ge!==null?t=0:(ve=null,Ie=0,t=ye)}if(t!==0){if(t===2&&(i=Jo(e),i!==0&&(r=i,t=Es(e,i))),t===1)throw n=Fr,nn(e,0),Rt(e,r),Ve(e,pe()),n;if(t===6)Rt(e,r);else{if(i=e.current.alternate,!(r&30)&&!wf(i)&&(t=Vi(e,r),t===2&&(o=Jo(e),o!==0&&(r=o,t=Es(e,o))),t===1))throw n=Fr,nn(e,0),Rt(e,r),Ve(e,pe()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(P(345));case 2:Yt(e,Be,pt);break;case 3:if(Rt(e,r),(r&130023424)===r&&(t=pl+500-pe(),10<t)){if(Si(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Te(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=is(Yt.bind(null,e,Be,pt),t);break}Yt(e,Be,pt);break;case 4:if(Rt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var s=31-ot(r);o=1<<s,s=t[s],s>i&&(i=s),r&=~o}if(r=i,r=pe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Sf(r/1960))-r,10<r){e.timeoutHandle=is(Yt.bind(null,e,Be,pt),r);break}Yt(e,Be,pt);break;case 5:Yt(e,Be,pt);break;default:throw Error(P(329))}}}return Ve(e,pe()),e.callbackNode===n?Wu.bind(null,e):null}function Es(e,t){var n=fr;return e.current.memoizedState.isDehydrated&&(nn(e,t).flags|=256),e=Vi(e,t),e!==2&&(t=Be,Be=n,t!==null&&ks(t)),e}function ks(e){Be===null?Be=e:Be.push.apply(Be,e)}function wf(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!lt(o(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Rt(e,t){for(t&=~fl,t&=~Ji,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ot(t),r=1<<n;e[n]=-1,t&=~r}}function Fa(e){if(q&6)throw Error(P(327));Bn();var t=Si(e,0);if(!(t&1))return Ve(e,pe()),null;var n=Vi(e,t);if(e.tag!==0&&n===2){var r=Jo(e);r!==0&&(t=r,n=Es(e,r))}if(n===1)throw n=Fr,nn(e,0),Rt(e,t),Ve(e,pe()),n;if(n===6)throw Error(P(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Yt(e,Be,pt),Ve(e,pe()),null}function gl(e,t){var n=q;q|=1;try{return e(t)}finally{q=n,q===0&&(Wn=pe()+500,Zi&&_t())}}function cn(e){Tt!==null&&Tt.tag===0&&!(q&6)&&Bn();var t=q;q|=1;var n=Ke.transition,r=te;try{if(Ke.transition=null,te=1,e)return e()}finally{te=r,Ke.transition=n,q=t,!(q&6)&&_t()}}function ml(){Oe=kn.current,oe(kn)}function nn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Jh(n)),ge!==null)for(n=ge.return;n!==null;){var r=n;switch(Js(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ki();break;case 3:On(),oe(De),oe(be),ol();break;case 5:il(r);break;case 4:On();break;case 13:oe(le);break;case 19:oe(le);break;case 10:el(r.type._context);break;case 22:case 23:ml()}n=n.return}if(ve=e,ge=e=Vt(e.current,null),Ie=Oe=t,ye=0,Fr=null,fl=Ji=an=0,Be=fr=null,en!==null){for(t=0;t<en.length;t++)if(n=en[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,o=n.pending;if(o!==null){var s=o.next;o.next=i,r.next=s}n.pending=r}en=null}return e}function Hu(e,t){do{var n=ge;try{if(qs(),ui.current=Bi,ji){for(var r=ae.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}ji=!1}if(ln=0,xe=me=ae=null,dr=!1,Rr=0,hl.current=null,n===null||n.return===null){ye=1,Fr=t,ge=null;break}e:{var o=e,s=n.return,c=n,u=t;if(t=Ie,c.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var h=u,m=c,v=m.tag;if(!(m.mode&1)&&(v===0||v===11||v===15)){var y=m.alternate;y?(m.updateQueue=y.updateQueue,m.memoizedState=y.memoizedState,m.lanes=y.lanes):(m.updateQueue=null,m.memoizedState=null)}var E=xa(s);if(E!==null){E.flags&=-257,va(E,s,c,o,t),E.mode&1&&ya(o,h,t),t=E,u=h;var k=t.updateQueue;if(k===null){var w=new Set;w.add(u),t.updateQueue=w}else k.add(u);break e}else{if(!(t&1)){ya(o,h,t),yl();break e}u=Error(P(426))}}else if(se&&c.mode&1){var B=xa(s);if(B!==null){!(B.flags&65536)&&(B.flags|=256),va(B,s,c,o,t),Ks(Ln(u,c));break e}}o=u=Ln(u,c),ye!==4&&(ye=2),fr===null?fr=[o]:fr.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var p=Mu(o,u,t);da(o,p);break e;case 1:c=u;var f=o.type,x=o.stateNode;if(!(o.flags&128)&&(typeof f.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Dt===null||!Dt.has(x)))){o.flags|=65536,t&=-t,o.lanes|=t;var M=bu(o,c,t);da(o,M);break e}}o=o.return}while(o!==null)}Zu(n)}catch(a){t=a,ge===n&&n!==null&&(ge=n=n.return);continue}break}while(!0)}function Uu(){var e=Pi.current;return Pi.current=Bi,e===null?Bi:e}function yl(){(ye===0||ye===3||ye===2)&&(ye=4),ve===null||!(an&268435455)&&!(Ji&268435455)||Rt(ve,Ie)}function Vi(e,t){var n=q;q|=2;var r=Uu();(ve!==e||Ie!==t)&&(pt=null,nn(e,t));do try{If();break}catch(i){Hu(e,i)}while(!0);if(qs(),q=n,Pi.current=r,ge!==null)throw Error(P(261));return ve=null,Ie=0,ye}function If(){for(;ge!==null;)_u(ge)}function Cf(){for(;ge!==null&&!Qd();)_u(ge)}function _u(e){var t=Yu(e.alternate,e,Oe);e.memoizedProps=e.pendingProps,t===null?Zu(e):ge=t,hl.current=null}function Zu(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=mf(n,t),n!==null){n.flags&=32767,ge=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ye=6,ge=null;return}}else if(n=gf(n,t,Oe),n!==null){ge=n;return}if(t=t.sibling,t!==null){ge=t;return}ge=t=e}while(t!==null);ye===0&&(ye=5)}function Yt(e,t,n){var r=te,i=Ke.transition;try{Ke.transition=null,te=1,Ef(e,t,n,r)}finally{Ke.transition=i,te=r}return null}function Ef(e,t,n,r){do Bn();while(Tt!==null);if(q&6)throw Error(P(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(P(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(rh(e,o),e===ve&&(ge=ve=null,Ie=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||$r||($r=!0,Xu(vi,function(){return Bn(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Ke.transition,Ke.transition=null;var s=te;te=1;var c=q;q|=4,hl.current=null,xf(e,n),Ou(n,e),Hh(ns),wi=!!ts,ns=ts=null,e.current=n,vf(n),Yd(),q=c,te=s,Ke.transition=o}else e.current=n;if($r&&($r=!1,Tt=e,zi=i),o=e.pendingLanes,o===0&&(Dt=null),Kd(n.stateNode),Ve(e,pe()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Di)throw Di=!1,e=Is,Is=null,e;return zi&1&&e.tag!==0&&Bn(),o=e.pendingLanes,o&1?e===Cs?pr++:(pr=0,Cs=e):pr=0,_t(),null}function Bn(){if(Tt!==null){var e=Mc(zi),t=Ke.transition,n=te;try{if(Ke.transition=null,te=16>e?16:e,Tt===null)var r=!1;else{if(e=Tt,Tt=null,zi=0,q&6)throw Error(P(331));var i=q;for(q|=4,V=e.current;V!==null;){var o=V,s=o.child;if(V.flags&16){var c=o.deletions;if(c!==null){for(var u=0;u<c.length;u++){var h=c[u];for(V=h;V!==null;){var m=V;switch(m.tag){case 0:case 11:case 15:hr(8,m,o)}var v=m.child;if(v!==null)v.return=m,V=v;else for(;V!==null;){m=V;var y=m.sibling,E=m.return;if(zu(m),m===h){V=null;break}if(y!==null){y.return=E,V=y;break}V=E}}}var k=o.alternate;if(k!==null){var w=k.child;if(w!==null){k.child=null;do{var B=w.sibling;w.sibling=null,w=B}while(w!==null)}}V=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,V=s;else e:for(;V!==null;){if(o=V,o.flags&2048)switch(o.tag){case 0:case 11:case 15:hr(9,o,o.return)}var p=o.sibling;if(p!==null){p.return=o.return,V=p;break e}V=o.return}}var f=e.current;for(V=f;V!==null;){s=V;var x=s.child;if(s.subtreeFlags&2064&&x!==null)x.return=s,V=x;else e:for(s=f;V!==null;){if(c=V,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Xi(9,c)}}catch(a){ue(c,c.return,a)}if(c===s){V=null;break e}var M=c.sibling;if(M!==null){M.return=c.return,V=M;break e}V=c.return}}if(q=i,_t(),ht&&typeof ht.onPostCommitFiberRoot=="function")try{ht.onPostCommitFiberRoot(Li,e)}catch{}r=!0}return r}finally{te=n,Ke.transition=t}}return!1}function Aa(e,t,n){t=Ln(n,t),t=Mu(e,t,1),e=Pt(e,t,1),t=Te(),e!==null&&(jr(e,1,t),Ve(e,t))}function ue(e,t,n){if(e.tag===3)Aa(e,e,n);else for(;t!==null;){if(t.tag===3){Aa(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Dt===null||!Dt.has(r))){e=Ln(n,e),e=bu(t,e,1),t=Pt(t,e,1),e=Te(),t!==null&&(jr(t,1,e),Ve(t,e));break}}t=t.return}}function kf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Te(),e.pingedLanes|=e.suspendedLanes&n,ve===e&&(Ie&n)===n&&(ye===4||ye===3&&(Ie&130023424)===Ie&&500>pe()-pl?nn(e,0):fl|=n),Ve(e,t)}function Qu(e,t){t===0&&(e.mode&1?(t=Wr,Wr<<=1,!(Wr&130023424)&&(Wr=4194304)):t=1);var n=Te();e=wt(e,t),e!==null&&(jr(e,t,n),Ve(e,n))}function Mf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Qu(e,n)}function bf(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(P(314))}r!==null&&r.delete(t),Qu(e,n)}var Yu;Yu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||De.current)Pe=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Pe=!1,pf(e,t,n);Pe=!!(e.flags&131072)}else Pe=!1,se&&t.flags&1048576&&$c(t,Ri,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;hi(e,t),e=t.pendingProps;var i=zn(t,be.current);jn(t,n),i=ll(null,t,r,e,i,n);var o=al();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ze(r)?(o=!0,Mi(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,nl(t),i.updater=Yi,t.stateNode=i,i._reactInternals=t,ds(t,r,e,n),t=ps(null,t,r,!0,o,n)):(t.tag=0,se&&o&&Xs(t),Ne(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(hi(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Nf(r),e=nt(r,e),i){case 0:t=fs(null,t,r,e,n);break e;case 1:t=Ia(null,t,r,e,n);break e;case 11:t=Sa(null,t,r,e,n);break e;case 14:t=wa(null,t,r,nt(r.type,e),n);break e}throw Error(P(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:nt(r,i),fs(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:nt(r,i),Ia(e,t,r,i,n);case 3:e:{if(Fu(t),e===null)throw Error(P(387));r=t.pendingProps,o=t.memoizedState,i=o.element,iu(e,t),Fi(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Ln(Error(P(423)),t),t=Ca(e,t,r,n,i);break e}else if(r!==i){i=Ln(Error(P(424)),t),t=Ca(e,t,r,n,i);break e}else for(We=Bt(t.stateNode.containerInfo.firstChild),He=t,se=!0,it=null,n=nu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Vn(),r===i){t=It(e,t,n);break e}Ne(e,t,r,n)}t=t.child}return t;case 5:return ou(t),e===null&&as(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,rs(r,i)?s=null:o!==null&&rs(r,o)&&(t.flags|=32),Tu(e,t),Ne(e,t,s,n),t.child;case 6:return e===null&&as(t),null;case 13:return Au(e,t,n);case 4:return rl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Gn(t,null,r,n):Ne(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:nt(r,i),Sa(e,t,r,i,n);case 7:return Ne(e,t,t.pendingProps,n),t.child;case 8:return Ne(e,t,t.pendingProps.children,n),t.child;case 12:return Ne(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,re(Ni,r._currentValue),r._currentValue=s,o!==null)if(lt(o.value,s)){if(o.children===i.children&&!De.current){t=It(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var u=c.firstContext;u!==null;){if(u.context===r){if(o.tag===1){u=xt(-1,n&-n),u.tag=2;var h=o.updateQueue;if(h!==null){h=h.shared;var m=h.pending;m===null?u.next=u:(u.next=m.next,m.next=u),h.pending=u}}o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),cs(o.return,n,t),c.lanes|=n;break}u=u.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(P(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),cs(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Ne(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,jn(t,n),i=$e(i),r=r(i),t.flags|=1,Ne(e,t,r,n),t.child;case 14:return r=t.type,i=nt(r,t.pendingProps),i=nt(r.type,i),wa(e,t,r,i,n);case 15:return Ru(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:nt(r,i),hi(e,t),t.tag=1,ze(r)?(e=!0,Mi(t)):e=!1,jn(t,n),ku(t,r,i),ds(t,r,i,n),ps(null,t,r,!0,e,n);case 19:return ju(e,t,n);case 22:return Nu(e,t,n)}throw Error(P(156,t.tag))};function Xu(e,t){return Ic(e,t)}function Rf(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Je(e,t,n,r){return new Rf(e,t,n,r)}function xl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Nf(e){if(typeof e=="function")return xl(e)?1:0;if(e!=null){if(e=e.$$typeof,e===zs)return 11;if(e===Vs)return 14}return 2}function Vt(e,t){var n=e.alternate;return n===null?(n=Je(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function gi(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")xl(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case gn:return rn(n.children,i,o,t);case Ds:s=8,i|=8;break;case Po:return e=Je(12,n,t,i|2),e.elementType=Po,e.lanes=o,e;case Do:return e=Je(13,n,t,i),e.elementType=Do,e.lanes=o,e;case zo:return e=Je(19,n,t,i),e.elementType=zo,e.lanes=o,e;case oc:return Ki(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case rc:s=10;break e;case ic:s=9;break e;case zs:s=11;break e;case Vs:s=14;break e;case kt:s=16,r=null;break e}throw Error(P(130,e==null?e:typeof e,""))}return t=Je(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function rn(e,t,n,r){return e=Je(7,e,r,t),e.lanes=n,e}function Ki(e,t,n,r){return e=Je(22,e,r,t),e.elementType=oc,e.lanes=n,e.stateNode={isHidden:!1},e}function No(e,t,n){return e=Je(6,e,null,t),e.lanes=n,e}function To(e,t,n){return t=Je(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Tf(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=co(0),this.expirationTimes=co(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=co(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function vl(e,t,n,r,i,o,s,c,u){return e=new Tf(e,t,n,c,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Je(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},nl(o),e}function Ff(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:pn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Ju(e){if(!e)return Ot;e=e._reactInternals;e:{if(dn(e)!==e||e.tag!==1)throw Error(P(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ze(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(P(171))}if(e.tag===1){var n=e.type;if(ze(n))return Jc(e,n,t)}return t}function Ku(e,t,n,r,i,o,s,c,u){return e=vl(n,r,!0,e,i,o,s,c,u),e.context=Ju(null),n=e.current,r=Te(),i=zt(n),o=xt(r,i),o.callback=t??null,Pt(n,o,i),e.current.lanes=i,jr(e,i,r),Ve(e,r),e}function $i(e,t,n,r){var i=t.current,o=Te(),s=zt(i);return n=Ju(n),t.context===null?t.context=n:t.pendingContext=n,t=xt(o,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Pt(i,t,s),e!==null&&(st(e,i,s,o),ci(e,i,s)),s}function Gi(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function ja(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Sl(e,t){ja(e,t),(e=e.alternate)&&ja(e,t)}function Af(){return null}var $u=typeof reportError=="function"?reportError:function(e){console.error(e)};function wl(e){this._internalRoot=e}qi.prototype.render=wl.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(P(409));$i(e,t,null,null)};qi.prototype.unmount=wl.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cn(function(){$i(null,e,null,null)}),t[St]=null}};function qi(e){this._internalRoot=e}qi.prototype.unstable_scheduleHydration=function(e){if(e){var t=Nc();e={blockedOn:null,target:e,priority:t};for(var n=0;n<bt.length&&t!==0&&t<bt[n].priority;n++);bt.splice(n,0,e),n===0&&Fc(e)}};function Il(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function eo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ba(){}function jf(e,t,n,r,i){if(i){if(typeof r=="function"){var o=r;r=function(){var h=Gi(s);o.call(h)}}var s=Ku(t,r,e,0,null,!1,!1,"",Ba);return e._reactRootContainer=s,e[St]=s.current,Cr(e.nodeType===8?e.parentNode:e),cn(),s}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var c=r;r=function(){var h=Gi(u);c.call(h)}}var u=vl(e,0,!1,null,null,!1,!1,"",Ba);return e._reactRootContainer=u,e[St]=u.current,Cr(e.nodeType===8?e.parentNode:e),cn(function(){$i(t,u,n,r)}),u}function to(e,t,n,r,i){var o=n._reactRootContainer;if(o){var s=o;if(typeof i=="function"){var c=i;i=function(){var u=Gi(s);c.call(u)}}$i(t,s,e,i)}else s=jf(n,t,e,i,r);return Gi(s)}bc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=rr(t.pendingLanes);n!==0&&(Ls(t,n|1),Ve(t,pe()),!(q&6)&&(Wn=pe()+500,_t()))}break;case 13:cn(function(){var r=wt(e,1);if(r!==null){var i=Te();st(r,e,1,i)}}),Sl(e,1)}};Ws=function(e){if(e.tag===13){var t=wt(e,134217728);if(t!==null){var n=Te();st(t,e,134217728,n)}Sl(e,134217728)}};Rc=function(e){if(e.tag===13){var t=zt(e),n=wt(e,t);if(n!==null){var r=Te();st(n,e,t,r)}Sl(e,t)}};Nc=function(){return te};Tc=function(e,t){var n=te;try{return te=e,t()}finally{te=n}};Qo=function(e,t,n){switch(t){case"input":if(Oo(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=_i(r);if(!i)throw Error(P(90));lc(r),Oo(r,i)}}}break;case"textarea":cc(e,n);break;case"select":t=n.value,t!=null&&Nn(e,!!n.multiple,t,!1)}};mc=gl;yc=cn;var Bf={usingClientEntryPoint:!1,Events:[Pr,vn,_i,pc,gc,gl]},er={findFiberByHostInstance:qt,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Pf={bundleType:er.bundleType,version:er.version,rendererPackageName:er.rendererPackageName,rendererConfig:er.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ct.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Sc(e),e===null?null:e.stateNode},findFiberByHostInstance:er.findFiberByHostInstance||Af,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qr.isDisabled&&qr.supportsFiber)try{Li=qr.inject(Pf),ht=qr}catch{}}_e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Bf;_e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Il(t))throw Error(P(200));return Ff(e,t,null,n)};_e.createRoot=function(e,t){if(!Il(e))throw Error(P(299));var n=!1,r="",i=$u;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=vl(e,1,!1,null,null,n,!1,r,i),e[St]=t.current,Cr(e.nodeType===8?e.parentNode:e),new wl(t)};_e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(P(188)):(e=Object.keys(e).join(","),Error(P(268,e)));return e=Sc(t),e=e===null?null:e.stateNode,e};_e.flushSync=function(e){return cn(e)};_e.hydrate=function(e,t,n){if(!eo(t))throw Error(P(200));return to(null,e,t,!0,n)};_e.hydrateRoot=function(e,t,n){if(!Il(e))throw Error(P(405));var r=n!=null&&n.hydratedSources||null,i=!1,o="",s=$u;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=Ku(t,null,e,1,n??null,i,!1,o,s),e[St]=t.current,Cr(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new qi(t)};_e.render=function(e,t,n){if(!eo(t))throw Error(P(200));return to(null,e,t,!1,n)};_e.unmountComponentAtNode=function(e){if(!eo(e))throw Error(P(40));return e._reactRootContainer?(cn(function(){to(null,null,e,!1,function(){e._reactRootContainer=null,e[St]=null})}),!0):!1};_e.unstable_batchedUpdates=gl;_e.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!eo(n))throw Error(P(200));if(e==null||e._reactInternals===void 0)throw Error(P(38));return to(e,t,n,!1,r)};_e.version="18.3.1-next-f1338f8080-20240426";function qu(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(qu)}catch(e){console.error(e)}}qu(),qa.exports=_e;var Df=qa.exports,Pa=Df;jo.createRoot=Pa.createRoot,jo.hydrateRoot=Pa.hydrateRoot;class Da{constructor(t,n,r=60){I(this,"cellSize");I(this,"cols");I(this,"rows");I(this,"grid");this.cellSize=r,this.cols=Math.ceil(t/r),this.rows=Math.ceil(n/r),this.grid=new Map}clear(){this.grid.clear()}getKey(t,n){return`${t},${n}`}insert(t){const n=Math.floor(t.x/this.cellSize),r=Math.floor(t.y/this.cellSize),i=this.getKey(n,r);this.grid.has(i)||this.grid.set(i,[]),this.grid.get(i).push(t)}getNearby(t,n,r){const i=Math.max(0,Math.floor((t-r)/this.cellSize)),o=Math.min(this.cols-1,Math.floor((t+r)/this.cellSize)),s=Math.max(0,Math.floor((n-r)/this.cellSize)),c=Math.min(this.rows-1,Math.floor((n+r)/this.cellSize)),u=[];for(let h=i;h<=o;h++)for(let m=s;m<=c;m++){const v=this.getKey(h,m),y=this.grid.get(v);y&&u.push(...y)}return u}}class Mn{constructor(t,n=12,r=8,i=0){I(this,"boundary");I(this,"capacity");I(this,"maxDepth");I(this,"depth");I(this,"points",[]);I(this,"divided",!1);I(this,"northwest",null);I(this,"northeast",null);I(this,"southwest",null);I(this,"southeast",null);this.boundary=t,this.capacity=n,this.maxDepth=r,this.depth=i}subdivide(){const{x:t,y:n,width:r,height:i}=this.boundary,o=r/2,s=i/2,c=this.depth+1;this.northwest=new Mn({x:t,y:n,width:o,height:s},this.capacity,this.maxDepth,c),this.northeast=new Mn({x:t+o,y:n,width:o,height:s},this.capacity,this.maxDepth,c),this.southwest=new Mn({x:t,y:n+s,width:o,height:s},this.capacity,this.maxDepth,c),this.southeast=new Mn({x:t+o,y:n+s,width:o,height:s},this.capacity,this.maxDepth,c),this.divided=!0}insert(t){if(!this.contains(this.boundary,t))return!1;if(this.points.length<this.capacity&&!this.divided)return this.points.push(t),!0;if(this.depth>=this.maxDepth)return this.points.push(t),!0;if(!this.divided){let n=!0;for(let r=1;r<this.points.length;r++)if(this.points[r].x!==this.points[0].x||this.points[r].y!==this.points[0].y){n=!1;break}if(n&&this.points.length>0&&t.x===this.points[0].x&&t.y===this.points[0].y)return this.points.push(t),!0;this.subdivide();for(const r of this.points)this.insertToChildren(r);this.points=[]}return this.insertToChildren(t)}insertToChildren(t){return this.northwest&&this.northwest.insert(t)||this.northeast&&this.northeast.insert(t)||this.southwest&&this.southwest.insert(t)||this.southeast&&this.southeast.insert(t)||!1}contains(t,n){return n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height}queryRange(t,n=[]){var r,i,o,s;if(!this.intersectsCircle(this.boundary,t))return n;for(const c of this.points)(c.x-t.x)*(c.x-t.x)+(c.y-t.y)*(c.y-t.y)<=t.radius*t.radius&&n.push(c);return this.divided&&((r=this.northwest)==null||r.queryRange(t,n),(i=this.northeast)==null||i.queryRange(t,n),(o=this.southwest)==null||o.queryRange(t,n),(s=this.southeast)==null||s.queryRange(t,n)),n}intersectsCircle(t,n){const r=Math.max(t.x,Math.min(n.x,t.x+t.width)),i=Math.max(t.y,Math.min(n.y,t.y+t.height)),o=n.x-r,s=n.y-i;return o*o+s*s<=n.radius*n.radius}clear(){this.points=[],this.divided=!1,this.northwest=null,this.northeast=null,this.southwest=null,this.southeast=null}}class Ge{constructor(t,n,r=50){I(this,"pool",[]);I(this,"factory");I(this,"resetFn");this.factory=t,this.resetFn=n;for(let i=0;i<r;i++)this.pool.push(this.factory())}acquire(){const t=this.pool.pop()||this.factory();return this.resetFn(t),t}release(t){this.pool.push(t)}get size(){return this.pool.length}}new Ge(()=>({x1:0,y1:0,x2:0,y2:0,intensity:1}),e=>{e.x1=0,e.y1=0,e.x2=0,e.y2=0,e.intensity=1},100);new Ge(()=>({x:0,y:0}),e=>{e.x=0,e.y=0},200);new Ge(()=>({id:"",x:0,y:0,value:25,radius:3.5,type:"NUTRIENT_DOT",color:"#00E676"}),e=>{e.id="",e.x=0,e.y=0,e.value=25,e.radius=3.5,e.type="NUTRIENT_DOT",e.color="#00E676"},150);const ei=new Ge(()=>({id:0,x:0,y:0,vx:0,vy:0,life:0,maxLife:0,color:"#ffffff",size:1}),e=>{e.id=0,e.x=0,e.y=0,e.vx=0,e.vy=0,e.life=0,e.maxLife=0,e.color="#ffffff",e.size=1},100);new Ge(()=>({x:0,y:0,life:1,color:"#ffffff"}),e=>{e.x=0,e.y=0,e.life=1,e.color="#ffffff"},500);new Ge(()=>({x:0,y:0,intensity:1,color:"#00E676"}),e=>{e.x=0,e.y=0,e.intensity=1,e.color="#00E676"},1e3);new Ge(()=>({id:"",x:0,y:0,radius:4,color:"#34d399"}),e=>{e.id="",e.x=0,e.y=0,e.radius=4,e.color="#34d399"},1e3);new Ge(()=>({x:0,y:0,activationLevel:0,color:"#06b6d4"}),e=>{e.x=0,e.y=0,e.activationLevel=0,e.color="#06b6d4"},1e3);new Ge(()=>({x:0,y:0,z:0,nx:0,ny:0,nz:1}),e=>{e.x=0,e.y=0,e.z=0,e.nx=0,e.ny=0,e.nz=1},5e3);new Ge(()=>({x:0,y:0,vx:0,vy:0,life:1}),e=>{e.x=0,e.y=0,e.vx=0,e.vy=0,e.life=1},2e3);new Ge(()=>({x:0,y:0,radius:3,viralLoad:1}),e=>{e.x=0,e.y=0,e.radius=3,e.viralLoad=1},3e3);new Ge(()=>({x:0,y:0,wavelengthNm:520,intensity:1,life:1}),e=>{e.x=0,e.y=0,e.wavelengthNm=520,e.intensity=1,e.life=1},3500);new Ge(()=>({x:0,y:0,vx:0,vy:0,life:1}),e=>{e.x=0,e.y=0,e.vx=0,e.vy=0,e.life=1},4e3);class zf{constructor(t,n,r=10){I(this,"resolution");I(this,"cols");I(this,"rows");I(this,"buffer");I(this,"activeEmitters",[]);I(this,"emitterPool");this.resolution=r,this.cols=Math.ceil(t/r),this.rows=Math.ceil(n/r),this.buffer=new Float32Array(this.cols*this.rows),this.emitterPool=new Ge(()=>({x:0,y:0,amount:0,life:0,active:!1}),i=>{i.active=!1},100)}registerEmitter(t,n,r,i=60){const o=this.emitterPool.acquire();o.x=t,o.y=n,o.amount=r,o.life=i,o.active=!0,this.activeEmitters.push(o)}processEmitters(){for(let t=this.activeEmitters.length-1;t>=0;t--){const n=this.activeEmitters[t];n.life<=0?(this.emitterPool.release(n),this.activeEmitters.splice(t,1)):(this.addPheromone(n.x,n.y,n.amount),n.life--)}}addPheromone(t,n,r){const i=Math.floor(t/this.resolution),o=Math.floor(n/this.resolution);i>=0&&i<this.cols&&o>=0&&o<this.rows&&(this.buffer[o*this.cols+i]+=r)}getPheromone(t,n){const r=Math.floor(t/this.resolution),i=Math.floor(n/this.resolution);return r>=0&&r<this.cols&&i>=0&&i<this.rows?this.buffer[i*this.cols+r]:0}decay(t=.98){const n=new Float32Array(this.cols*this.rows),r=.1;for(let i=0;i<this.rows;i++)for(let o=0;o<this.cols;o++){const s=i*this.cols+o;let c=this.buffer[s];if(c>0){let u=0,h=0;i>0&&(h+=this.buffer[(i-1)*this.cols+o],u++),i<this.rows-1&&(h+=this.buffer[(i+1)*this.cols+o],u++),o>0&&(h+=this.buffer[i*this.cols+(o-1)],u++),o<this.cols-1&&(h+=this.buffer[i*this.cols+(o+1)],u++);const m=c*(1-r)+h/Math.max(1,u)*r;n[s]=m*t,n[s]<.01&&(n[s]=0)}}this.buffer=n}}const Jt=class Jt{constructor(){I(this,"nextSpeciesId",1)}static getInstance(){return Jt.instance||(Jt.instance=new Jt),Jt.instance}evaluateMatingCompatibility(t,n){const r=this.calculateAlleleDistance(t,n),i=.4;if(r>i)return{compatible:!1,distance:r,isHybrid:!1,fertilityFactor:0};const o=t.speciesId!==n.speciesId;let s=1;return o&&(s=Math.max(.1,1-r/i)),{compatible:!0,distance:r,isHybrid:o,fertilityFactor:s}}calculateAlleleDistance(t,n){if(!t.genome||!n.genome)return 0;let r=0;return r+=Math.abs(t.genome.speedAllele.baseValue-n.genome.speedAllele.baseValue),r+=Math.abs(t.genome.visionAllele.baseValue-n.genome.visionAllele.baseValue),r+=Math.abs(t.genome.efficiencyAllele.baseValue-n.genome.efficiencyAllele.baseValue),r/3}getSpeciesId(){return this.nextSpeciesId++}};I(Jt,"instance");let bn=Jt;class za{constructor(t=60){I(this,"cellSize");I(this,"grid",new Map);this.cellSize=t}getKey(t,n){const r=Math.floor(t/this.cellSize),i=Math.floor(n/this.cellSize);return`${r},${i}`}clear(){this.grid.clear()}insert(t){const n=this.getKey(t.x,t.y);let r=this.grid.get(n);r||(r=[],this.grid.set(n,r)),r.push(t)}query(t,n,r){const i=[],o=Math.floor((t-r)/this.cellSize),s=Math.floor((t+r)/this.cellSize),c=Math.floor((n-r)/this.cellSize),u=Math.floor((n+r)/this.cellSize),h=r*r;for(let m=o;m<=s;m++)for(let v=c;v<=u;v++){const y=`${m},${v}`,E=this.grid.get(y);if(E)for(let k=0;k<E.length;k++){const w=E[k],B=w.x-t,p=w.y-n;B*B+p*p<=h&&i.push(w)}}return i}}class Vf{constructor(){I(this,"ctx",null);I(this,"isMuted",!0);I(this,"masterGain",null);I(this,"masterVolume",.3);I(this,"lastFeedTime",0);I(this,"feedCooldownMs",80);I(this,"activeOscCount",0);I(this,"maxConcurrentOsc",6);I(this,"spatialPanners",new Map);I(this,"telemetryBufferIdx",0);I(this,"telemetrySize",256);I(this,"velocityMetrics",new Float32Array(256));I(this,"stressMetrics",new Float32Array(256));I(this,"droneOsc",null);I(this,"droneGain",null)}sanitizeReset(){if(this.spatialPanners.forEach(t=>{try{t.disconnect()}catch{}}),this.spatialPanners.clear(),this.masterGain&&this.ctx)try{this.masterGain.gain.setValueAtTime(this.masterGain.gain.value,this.ctx.currentTime),this.masterGain.gain.linearRampToValueAtTime(0,this.ctx.currentTime+.05)}catch{}if(this.activeOscCount=0,this.ctx&&this.ctx.state==="suspended")try{this.ctx.resume()}catch{}}dispose(){if(this.stopAmbientDrone(),this.spatialPanners.forEach(t=>{try{t.disconnect()}catch{}}),this.spatialPanners.clear(),this.masterGain){try{this.masterGain.disconnect()}catch{}this.masterGain=null}if(this.ctx){try{this.ctx.state!=="closed"&&this.ctx.close()}catch{}this.ctx=null}this.activeOscCount=0}initCtx(){if(!this.ctx&&typeof window<"u"){const t=window.AudioContext||window.webkitAudioContext;if(t)try{this.ctx=new t,this.masterGain=this.ctx.createGain(),this.masterGain.gain.setValueAtTime(this.masterVolume,this.ctx.currentTime),this.masterGain.connect(this.ctx.destination)}catch{this.ctx=null,this.masterGain=null}}}setVolume(t){this.masterVolume=Math.max(0,Math.min(1,t)),this.masterGain&&this.ctx&&this.masterGain.gain.setValueAtTime(this.masterVolume,this.ctx.currentTime)}getSpatialPanner(t){if(!this.ctx)return null;const n=Math.max(-1,Math.min(1,(t-400)/400)),r=Math.round(n*10);if(!this.spatialPanners.has(r)){const i=this.ctx.createStereoPanner();i.pan.value=n,i.connect(this.masterGain),this.spatialPanners.set(r,i)}return this.spatialPanners.get(r)||null}getVolume(){return this.masterVolume}playFeedSound(t=440){if(this.isMuted)return;const n=performance.now();if(!(n-this.lastFeedTime<this.feedCooldownMs)&&(this.lastFeedTime=n,!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain))))try{const r=Math.max(220,Math.min(880,t)),i=this.ctx.createOscillator(),o=this.ctx.createGain();i.type="sine",i.frequency.setValueAtTime(r,this.ctx.currentTime),o.gain.setValueAtTime(0,this.ctx.currentTime),o.gain.linearRampToValueAtTime(.06,this.ctx.currentTime+.01),o.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+.12),i.connect(o),o.connect(this.masterGain),this.activeOscCount++,i.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{o.disconnect()}catch{}},i.start(),i.stop(this.ctx.currentTime+.12)}catch{}}playAmbientDrone(t,n){if(this.velocityMetrics[this.telemetryBufferIdx]=t,this.stressMetrics[this.telemetryBufferIdx]=n,this.telemetryBufferIdx=(this.telemetryBufferIdx+1)%this.telemetrySize,this.isMuted){this.stopAmbientDrone();return}if(this.initCtx(),!(!this.ctx||!this.masterGain))try{(!this.droneOsc||!this.droneGain)&&(this.droneOsc=this.ctx.createOscillator(),this.droneGain=this.ctx.createGain(),this.droneOsc.type="sine",this.droneOsc.connect(this.droneGain),this.droneGain.connect(this.masterGain),this.droneGain.gain.setValueAtTime(.001,this.ctx.currentTime),this.droneOsc.start());const r=50+t*20,i=Math.max(.001,Math.min(.15,n*.15));this.droneOsc.frequency.setTargetAtTime(r,this.ctx.currentTime,.5),this.droneGain.gain.setTargetAtTime(i,this.ctx.currentTime,1)}catch{}}stopAmbientDrone(){if(this.droneOsc&&this.droneGain){try{this.droneOsc.stop(),this.droneOsc.disconnect(),this.droneGain.disconnect()}catch{}this.droneOsc=null,this.droneGain=null}}playBiomeHum(t){if(!this.isMuted&&!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain)))try{const n=this.ctx.createOscillator(),r=this.ctx.createGain();if(t==="TOXIC_SLUDGE")n.type="sawtooth",n.frequency.setValueAtTime(60,this.ctx.currentTime);else if(t==="CRYO_ZONE")n.type="sine",n.frequency.setValueAtTime(180,this.ctx.currentTime);else if(t==="HIGH_G_FIELD")n.type="triangle",n.frequency.setValueAtTime(45,this.ctx.currentTime);else return;r.gain.setValueAtTime(0,this.ctx.currentTime),r.gain.linearRampToValueAtTime(.04,this.ctx.currentTime+1),r.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+3),n.connect(r),r.connect(this.masterGain),this.activeOscCount++,n.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{r.disconnect()}catch{}},n.start(),n.stop(this.ctx.currentTime+3)}catch{}}toggleMute(){return this.isMuted=!this.isMuted,this.isMuted&&this.masterGain&&this.ctx?this.masterGain.gain.setValueAtTime(0,this.ctx.currentTime):!this.isMuted&&this.masterGain&&this.ctx&&this.masterGain.gain.setValueAtTime(this.masterVolume,this.ctx.currentTime),this.isMuted}getMuted(){return this.isMuted}playDisasterSound(t){if(!this.isMuted&&!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain)))try{const n=this.ctx.createOscillator(),r=this.ctx.createGain();t==="METEOR"||t==="STORM"?(n.type="sawtooth",n.frequency.setValueAtTime(150,this.ctx.currentTime),n.frequency.exponentialRampToValueAtTime(40,this.ctx.currentTime+1)):t==="VOID"||t==="INVERSION"?(n.type="triangle",n.frequency.setValueAtTime(40,this.ctx.currentTime),n.frequency.linearRampToValueAtTime(120,this.ctx.currentTime+.8)):(n.type="square",n.frequency.setValueAtTime(200,this.ctx.currentTime)),r.gain.setValueAtTime(0,this.ctx.currentTime),r.gain.linearRampToValueAtTime(.15,this.ctx.currentTime+.1),r.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+1),n.connect(r),r.connect(this.masterGain),this.activeOscCount++,n.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{r.disconnect()}catch{}},n.start(),n.stop(this.ctx.currentTime+1)}catch{}}playSpeciationEvent(t){if(!this.isMuted&&!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain)))try{const n=this.getSpatialPanner(t);if(!n)return;const r=this.ctx.createOscillator(),i=this.ctx.createGain();r.type="square",r.frequency.setValueAtTime(440,this.ctx.currentTime),r.frequency.exponentialRampToValueAtTime(880,this.ctx.currentTime+.1),i.gain.setValueAtTime(0,this.ctx.currentTime),i.gain.linearRampToValueAtTime(.1,this.ctx.currentTime+.05),i.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+.3),r.connect(i),i.connect(n),this.activeOscCount++,r.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{i.disconnect()}catch{}},r.start(),r.stop(this.ctx.currentTime+.3)}catch{}}playExtinctionEvent(t){if(!this.isMuted&&!(this.activeOscCount>=this.maxConcurrentOsc)&&(this.initCtx(),!(!this.ctx||!this.masterGain)))try{const n=this.getSpatialPanner(t);if(!n)return;const r=this.ctx.createOscillator(),i=this.ctx.createGain();r.type="sawtooth",r.frequency.setValueAtTime(120,this.ctx.currentTime),r.frequency.exponentialRampToValueAtTime(20,this.ctx.currentTime+.4),i.gain.setValueAtTime(0,this.ctx.currentTime),i.gain.linearRampToValueAtTime(.1,this.ctx.currentTime+.05),i.gain.exponentialRampToValueAtTime(.001,this.ctx.currentTime+.5),r.connect(i),i.connect(n),this.activeOscCount++,r.onended=()=>{this.activeOscCount=Math.max(0,this.activeOscCount-1);try{i.disconnect()}catch{}},r.start(),r.stop(this.ctx.currentTime+.5)}catch{}}}const Le=new Vf;function Gf(e,t,n,r,i,o){let s=0,c=0,u=0,h=0;for(const p of n){const f=e.x-p.x,x=e.y-p.y,M=Math.hypot(f,x);if(M<p.radius+e.visionRadius){const a=(p.radius+e.visionRadius-M)/(p.radius+e.visionRadius);u+=f/(M||1)*a*4,h+=x/(M||1)*a*4}}if(Math.hypot(u,h)>.1)return s+=u,c+=h,{desiredHeading:Math.atan2(c,s),state:"EVADING_HAZARD"};let m=null,v=1/0;for(const p of t){const f=p.x-e.x,x=p.y-e.y,M=Math.hypot(f,x);M<=e.visionRadius&&M<v&&(v=M,m=p)}if(m){const p=m.x-e.x,f=m.y-e.y;return{desiredHeading:Math.atan2(f,p),state:"SEEKING_ENERGY"}}if(o&&e.battery>e.maxBattery*.5){const x=new Float32Array(4);x[0]=e.x+Math.cos(e.heading-.5)*20,x[1]=e.y+Math.sin(e.heading-.5)*20,x[2]=e.x+Math.cos(e.heading+.5)*20,x[3]=e.y+Math.sin(e.heading+.5)*20;const M=o.getPheromone(x[0],x[1]),a=o.getPheromone(x[2],x[3]);if(M>.1||a>.1){if(M>a)return{desiredHeading:e.heading-.2,state:"WANDERING"};if(a>M)return{desiredHeading:e.heading+.2,state:"WANDERING"}}}const y=60;let E=0,k=0;if(e.x<y?E=(y-e.x)/y:e.x>r-y&&(E=-(e.x-(r-y))/y),e.y<y?k=(y-e.y)/y:e.y>i-y&&(k=-(e.y-(i-y))/y),Math.hypot(E,k)>.1)return{desiredHeading:Math.atan2(k+Math.sin(e.heading)*.5,E+Math.cos(e.heading)*.5),state:"WANDERING"};const w=(Math.random()-.5)*.3;return{desiredHeading:e.heading+w,state:"WANDERING"}}const Kt=class Kt{constructor(){I(this,"globalStressIndex",0);I(this,"stressHistory",new Float32Array(1e3));I(this,"markerBuffer",new Float32Array(3e3));I(this,"historyIndex",0);I(this,"maxHistory",1e3);I(this,"defaultMarkers",new Map);this.initDefaultMarkers()}initDefaultMarkers(){this.defaultMarkers.set("STRESS_SPEED_BOOST",{geneId:"SPEED",activationLevel:0,heritability:.75,stressThreshold:.4}),this.defaultMarkers.set("STRESS_EFFICIENCY_BOOST",{geneId:"EFFICIENCY",activationLevel:0,heritability:.6,stressThreshold:.5}),this.defaultMarkers.set("RADIATION_DEFENSE",{geneId:"ARMOR",activationLevel:0,heritability:.8,stressThreshold:.6})}getDefaultMarkers(){return Array.from(this.defaultMarkers.values()).map(t=>({...t}))}static getInstance(){return Kt.instance||(Kt.instance=new Kt),Kt.instance}getGlobalStress(){return this.globalStressIndex}updateGlobalStress(t){this.globalStressIndex=t}recordStressFrame(){this.stressHistory[this.historyIndex]=this.globalStressIndex,this.historyIndex=(this.historyIndex+1)%this.maxHistory}modulateGeneExpression(t,n){t.epigenome||(t.epigenome=this.getDefaultMarkers());for(const r of t.epigenome)n>=r.stressThreshold?r.activationLevel=Math.min(1,r.activationLevel+.05*n):r.activationLevel=Math.max(0,r.activationLevel-.01),r.geneId==="SPEED"&&r.activationLevel>0?t.speed=Math.min(10,t.maxSpeed*(1+.25*r.activationLevel)):r.geneId==="EFFICIENCY"&&r.activationLevel>0?t.energyEfficiency=Math.min(3,t.energyEfficiency*(1+.2*r.activationLevel)):r.geneId==="ARMOR"&&r.activationLevel>0&&(t.armorGene=Math.min(.9,(t.armorGene||0)+.05*r.activationLevel))}inheritEpigenome(t,n=.85){return t.map(r=>{const i=Math.random()<r.heritability;return{...r,activationLevel:i?r.activationLevel*n:0}})}packMarkerBuffer(t){var r,i,o;let n=0;for(let s=0;s<t.length&&n<3e3;s++){const c=t[s].epigenome||[];this.markerBuffer[n++]=((r=c[0])==null?void 0:r.activationLevel)||0,this.markerBuffer[n++]=((i=c[1])==null?void 0:i.activationLevel)||0,this.markerBuffer[n++]=((o=c[2])==null?void 0:o.activationLevel)||0}return this.markerBuffer.subarray(0,n)}getStressHistory(){const t=new Float32Array(this.maxHistory);return t.set(this.stressHistory.subarray(this.historyIndex),0),t.set(this.stressHistory.subarray(0,this.historyIndex),this.maxHistory-this.historyIndex),t}};I(Kt,"instance");let Rn=Kt;const $t=class $t{constructor(){}static getInstance(){return $t.instance||($t.instance=new $t),$t.instance}safeSqrt(t){return isNaN(t)||t<=0?0:Math.sqrt(t)}safeAtan2(t,n){return isNaN(t)||isNaN(n)?0:Math.atan2(t,n)}safeDiv(t,n,r=0){if(isNaN(t)||isNaN(n)||n===0)return r;const i=t/n;return isFinite(i)?i:r}clampVector(t,n=1e3){const r=isNaN(t.x)||!isFinite(t.x)?0:t.x,i=isNaN(t.y)||!isFinite(t.y)?0:t.y,o=this.safeSqrt(r*r+i*i);if(o>n){const s=n/o;return{x:r*s,y:i*s}}return{x:r,y:i}}sanitizePosition(t,n,r,i){let o=isNaN(t)||!isFinite(t)?r/2:t,s=isNaN(n)||!isFinite(n)?i/2:n;return o=Math.max(0,Math.min(r,o)),s=Math.max(0,Math.min(i,s)),{x:o,y:s}}sanitizeMicrobotState(t,n,r){const i=this.sanitizePosition(t.x,t.y,n,r);t.x=i.x,t.y=i.y,t.vx=isNaN(t.vx)||!isFinite(t.vx)?0:Math.max(-10,Math.min(10,t.vx)),t.vy=isNaN(t.vy)||!isFinite(t.vy)?0:Math.max(-10,Math.min(10,t.vy)),t.speed=isNaN(t.speed)||!isFinite(t.speed)?2:Math.max(.5,Math.min(10,t.speed)),t.battery=isNaN(t.battery)||!isFinite(t.battery)?t.maxBattery:Math.max(0,Math.min(t.maxBattery,t.battery))}};I($t,"instance");let Pn=$t;function Re(e,t,n){return isNaN(e)?t:Math.max(t,Math.min(n,e))}function Xt(e){return isNaN(e)||!isFinite(e)?0:e}function Of(e,t,n,r,i,o,s,c=15,u=[]){const h=Math.hypot(n*i,r*i),m=Math.max(1,Math.ceil(isNaN(h)?1:h/10)),v=Pn.getInstance().safeDiv(n*i,m,0),y=Pn.getInstance().safeDiv(r*i,m,0);let E=e,k=t,w=!1;for(let B=0;B<m;B++){E+=v,k+=y,E=Xt(E),k=Xt(k);for(const p of u)if(Math.hypot(E-p.x,k-p.y)<p.radius){w=!0;const f=Pn.getInstance().safeAtan2(k-p.y,E-p.x);E=p.x+Math.cos(f)*p.radius,k=p.y+Math.sin(f)*p.radius}if(E<c||E>o-c||k<c||k>s-c){E=Re(E,c,o-c),k=Re(k,c,s-c);break}}return{x:E,y:k,hitHazard:w}}const Lf={};function Wf(e){const t=window.location.protocol==="file:"||window.location.href.includes("app.asar")||window.location.protocol==="tauri:"||window.location.href.includes("android_asset");let n=e.startsWith("/")?e.substring(1):e;if(window.location.href.includes("android_asset")||window.location.origin==="https://localhost"||window.location.protocol==="file:"||window.location.protocol==="capacitor:"||window.location.protocol==="ionic:"){const r=window.location.href.split("index.html")[0];return r.endsWith("/")?`${r}${n}`:`${r}/${n}`}if(typeof import.meta<"u"&&Lf){const r="./";let i=r.endsWith("/")?`${r}${n}`:`${r}/${n}`;return i.startsWith("/")&&(i="."+i),i}return t?(n.startsWith("./")&&(n=n.substring(2)),n):e}function Hf(e){let t=Wf(e);t.startsWith("/")&&(t="."+t);try{const n=typeof window<"u"?window.location.href:"http://localhost";return new URL(t,n).href}catch{return t}}class Va{constructor(){I(this,"worker",null);I(this,"isSupported");I(this,"workerScriptUrl","");I(this,"errorStrikes",0);I(this,"maxStrikes",3);I(this,"onWorkerRestarted");I(this,"lastStateSnapshot",null);this.isSupported=typeof window<"u"&&typeof window.Worker<"u"}initWorker(t){if(!(!this.isSupported||this.errorStrikes>=this.maxStrikes)){this.workerScriptUrl=typeof t=="string"?t:t.href;try{const n=typeof t=="string"?Hf(t):t;this.worker=new Worker(n,{type:"module"})}catch{try{this.worker=new Worker(this.workerScriptUrl)}catch(r){console.warn("Worker initialization fallback:",r)}}this.worker&&(this.worker.onerror=n=>{console.error("Web Worker Error:",n),this.errorStrikes++,this.terminate(),this.errorStrikes<=this.maxStrikes?(console.log(`Self-healing Worker Auto-Restarting (Attempt ${this.errorStrikes}/${this.maxStrikes})...`),setTimeout(()=>{this.initWorker(this.workerScriptUrl),this.onWorkerRestarted&&this.onWorkerRestarted()},500)):console.error("Worker exceeded max retry strikes, operating in main thread fallback.")})}}resetStrikes(){this.errorStrikes=0}getLastSnapshot(){return this.lastStateSnapshot}saveSnapshot(t){this.lastStateSnapshot=t,this.postTask("RESTORE_SNAPSHOT",{snapshot:t})}postTask(t,n){t==="RESTORE_SNAPSHOT"&&(this.lastStateSnapshot=n.snapshot),this.worker&&this.worker.postMessage({type:t,payload:n})}terminate(){this.worker&&(this.worker.terminate(),this.worker=null)}}class Ga{constructor(t,n,r=10){I(this,"width");I(this,"height");I(this,"resolution");I(this,"cols");I(this,"rows");I(this,"buffer");this.width=t,this.height=n,this.resolution=r,this.cols=Math.ceil(t/r),this.rows=Math.ceil(n/r),this.buffer=new Float32Array(this.cols*this.rows)}addPheromone(t,n,r){const i=Math.floor(t/this.resolution),o=Math.floor(n/this.resolution);if(i>=0&&i<this.cols&&o>=0&&o<this.rows){const s=o*this.cols+i;this.buffer[s]=Math.min(1,this.buffer[s]+r)}}getPheromone(t,n){const r=Math.floor(t/this.resolution),i=Math.floor(n/this.resolution);return r>=0&&r<this.cols&&i>=0&&i<this.rows?this.buffer[i*this.cols+r]:0}decay(t){for(let n=0;n<this.buffer.length;n++)this.buffer[n]>0&&(this.buffer[n]=Math.max(0,this.buffer[n]-t))}reset(){this.buffer.fill(0)}}class Uf{constructor(){I(this,"eventQueue",[]);I(this,"activeEvent",null)}triggerCataclysm(t,n,r,i=300){const o={id:`cataclysm-${Date.now()}-${Math.floor(Math.random()*1e3)}`,type:t,durationFrames:i,remainingFrames:i,intensity:1,epicenterX:n/2,epicenterY:r/2,radius:Math.min(n,r)*.45};return this.eventQueue.push(o),this.activeEvent||(this.activeEvent=this.eventQueue.shift()||null),o}getActiveEvent(){return this.activeEvent}update(){if(!this.activeEvent){this.eventQueue.length>0&&(this.activeEvent=this.eventQueue.shift()||null);return}this.activeEvent.remainingFrames--,this.activeEvent.remainingFrames<=0&&(this.activeEvent=this.eventQueue.shift()||null)}reset(){this.eventQueue=[],this.activeEvent=null}computeTectonicDeformation(t,n,r){if(r.type!=="TECTONIC_INVERSION")return{dx:0,dy:0,heightShift:0};const i=Math.hypot(t-r.epicenterX,n-r.epicenterY);if(i>r.radius)return{dx:0,dy:0,heightShift:0};const o=i/r.radius,s=Math.sin(o*Math.PI*2)*r.intensity,c=Math.atan2(n-r.epicenterY,t-r.epicenterX);return{dx:Math.cos(c)*s*5,dy:Math.sin(c)*s*5,heightShift:(1-o)*20*r.intensity}}computeSolarStormEffects(t){return t.type!=="SOLAR_STORM"?{energyBlackout:!1,forceFieldInversion:!1,visionReduction:1}:{energyBlackout:Math.random()<.3*t.intensity,forceFieldInversion:t.remainingFrames%20<10,visionReduction:Math.max(.2,1-.7*t.intensity)}}}class _f{constructor(){I(this,"viralSpores",[]);I(this,"baseInfectionRate",.05);I(this,"antibodyDecayRate",.002)}updateSpores(t,n){for(let r=this.viralSpores.length-1;r>=0;r--){const i=this.viralSpores[r];i.x+=i.vx,i.y+=i.vy,i.lifetimeFrames--,(i.x<0||i.x>t||i.y<0||i.y>n||i.lifetimeFrames<=0)&&this.viralSpores.splice(r,1)}}calculateInfectionProbability(t,n){const r=n.antibodyLevels[t.genomeSequence]||0,o=Math.min(1,this.baseInfectionRate*t.viralLoad)*(1-Math.min(.95,r));return Math.max(.001,o)}spliceViralGenes(t,n){if(!t)return t;const r={...t};return r.speedAllele&&(r.speedAllele={...r.speedAllele,baseValue:Math.max(.5,Math.min(10,r.speedAllele.baseValue*(1+n.length%5*.05)))}),r}updateImmunityProfile(t){if(t){for(const n of Object.keys(t.antibodyLevels))t.antibodyLevels[n]=Math.max(0,t.antibodyLevels[n]-this.antibodyDecayRate);if(t.isInfected&&t.activeVirusId){const n=t.antibodyLevels[t.activeVirusId]||0;t.antibodyLevels[t.activeVirusId]=Math.min(1,n+.015),t.antibodyLevels[t.activeVirusId]>=.85&&(t.isInfected=!1,t.viralLoad=0)}}}packAntibodyLevelsToFloat32(t,n){if(!t||!t.antibodyLevels)return;const r=Object.values(t.antibodyLevels);for(let i=0;i<r.length&&i<n.length;i++)n[i]=r[i]}}class Zf{constructor(){I(this,"currentCondition",{weather:"TEMPERATE",temperatureCelsius:22,humidityPercent:50,atmosphericPressure:1,cycleFrameCount:0});I(this,"cycleDurationFrames",1800)}updateAtmosphere(){this.currentCondition.cycleFrameCount++,this.currentCondition.cycleFrameCount%this.cycleDurationFrames===0&&this.shiftWeather()}shiftWeather(){const t=["TEMPERATE","HEATWAVE","GLACIAL_BLIZZARD","ACID_RAIN","HIGH_PRESSURE_GALE"],n=Math.floor(Math.random()*t.length);switch(this.currentCondition.weather=t[n],this.currentCondition.weather){case"HEATWAVE":this.currentCondition.temperatureCelsius=48,this.currentCondition.humidityPercent=20,this.currentCondition.atmosphericPressure=1.1;break;case"GLACIAL_BLIZZARD":this.currentCondition.temperatureCelsius=-18,this.currentCondition.humidityPercent=85,this.currentCondition.atmosphericPressure=1.3;break;case"ACID_RAIN":this.currentCondition.temperatureCelsius=30,this.currentCondition.humidityPercent=95,this.currentCondition.atmosphericPressure=.9;break;case"HIGH_PRESSURE_GALE":this.currentCondition.temperatureCelsius=15,this.currentCondition.humidityPercent=60,this.currentCondition.atmosphericPressure=1.45;break;default:this.currentCondition.temperatureCelsius=22,this.currentCondition.humidityPercent=50,this.currentCondition.atmosphericPressure=1;break}}calculateThermalBatteryDrain(t){const n=this.currentCondition.temperatureCelsius;let r=1;return n>35&&(r+=(n-35)*.02),n<5&&(r+=(5-n)*.025),t*r}calculateThermalMobilityDrag(t){const n=this.currentCondition.temperatureCelsius;return n<0?t*Math.max(.4,1+n*.015):t}calculateInsulationEfficiency(t,n){const r=this.currentCondition.temperatureCelsius;return r>30?Math.min(1,.5+(t||0)*.5):r<5?Math.min(1,.5+(n||0)*.5):1}}class Qf{constructor(){I(this,"clusters",new Map);I(this,"bindings",[])}getCluster(t){return this.clusters.get(t)}getMemberCluster(t){for(const n of this.clusters.values())if(n.memberIds.includes(t))return n}createBinding(t,n,r=18){const i=this.bindings.find(s=>s.cellId===t&&s.partnerId===n||s.cellId===n&&s.partnerId===t);if(i)return i;const o={cellId:t,partnerId:n,bondStrength:.9,restDistance:r,currentDistance:r,integrity:1};return this.bindings.push(o),o}calculateBondForce(t,n){t.currentDistance=n;const r=n-t.restDistance,o=-(.05*t.bondStrength)*r;Math.abs(r)>t.restDistance*2.5?t.integrity=Math.max(0,t.integrity-.1):t.integrity=Math.min(1,t.integrity+.01);const s=t.integrity<=0;return{forceMagnitude:o,isBroken:s}}calculateSynchronizedCiliaThrust(t,n){let r=0,i=0,o=0;for(let h=0;h<t.length;h++){const m=t[h],v=n[h]||1;r+=Math.cos(m)*v,i+=Math.sin(m)*v,o+=v}if(o<=0)return{vx:0,vy:0,totalThrust:0};const s=r/o,c=i/o,u=Math.sqrt(s*s+c*c)*1.5;return{vx:s,vy:c,totalThrust:u}}redistributeClusterEnergy(t,n,r){let i=t.sharedEnergyPool;for(let h=0;h<n.length;h++)i+=n[h];const o=n.length;if(o===0)return[];const s=i/(o+.5),c=[];let u=0;for(let h=0;h<o;h++){const m=r[h]||100,v=Math.min(m,s);c.push(v),u+=v}return t.sharedEnergyPool=Math.max(0,Math.min(t.maxSharedEnergy||500,i-u)),c}calculateDeflectedDamage(t,n,r){if(t<=0)return{mitigatedDamage:0,absorbedByArmor:0,deflectedPercentage:1};const i=Math.min(10,n*(1+r)),o=i/(i+4),s=t*o;return{mitigatedDamage:t-s,absorbedByArmor:s,deflectedPercentage:o}}packBondVectorsToFloat32(t){let n=0;for(let r=0;r<this.bindings.length&&n+4<=t.length;r++){const i=this.bindings[r];t[n]=i.bondStrength,t[n+1]=i.restDistance,t[n+2]=i.currentDistance,t[n+3]=i.integrity,n+=4}}}class Yf{constructor(){I(this,"defaultWavelength",520)}createSignature(t=520,n=1,r="PULSE"){return{wavelengthNm:Math.max(380,Math.min(750,t)),frequencyHz:Math.max(.1,Math.min(20,n)),intensity:.8,phase:Math.random()*Math.PI*2,emissionTimer:0,pattern:r,camouflageFactor:0}}updateSignature(t,n){t.emissionTimer+=n;const r=t.frequencyHz*2*Math.PI;t.pattern==="PULSE"?t.intensity=Math.max(0,Math.sin(t.emissionTimer*r+t.phase)):t.pattern==="STROBE"?t.intensity=Math.sin(t.emissionTimer*r)>.6?1:0:t.pattern==="CONTINUOUS"?t.intensity=.85:t.pattern==="PHASE_SHIFT"&&(t.phase+=.02,t.intensity=(Math.sin(t.emissionTimer*r+t.phase)+1)*.5)}modulateWavelength(t,n){t.wavelengthNm=Math.max(380,Math.min(750,t.wavelengthNm+n))}calculatePerceivedOpticalSignal(t,n,r=1){if(n<=0)return{perceivedIntensity:t.intensity,perceivedHueDelta:0};const i=Math.exp(-.005*n),o=Math.max(0,1/(1+.002*n*n))*i,s=t.intensity*o*r*(1-t.camouflageFactor),c=(t.wavelengthNm-520)/230;return{perceivedIntensity:s,perceivedHueDelta:c}}calculateCamouflageFactor(t,n,r=.5){const i=Math.abs(t-n),s=Math.max(0,1-i/150)*Math.min(1,r*1.2);return Math.max(0,Math.min(.95,s))}calculateFluidDiffraction(t,n=1){const r=t*1e-9,o=Math.asin(Math.min(1,r/5e-6)),s=1/Math.pow(t/500,4)*.05*n;return{diffractionAngle:o,spectralScattering:s}}}class Xf{constructor(t=2e3,n=2e3){I(this,"pulses",[]);I(this,"gridResolution",32);I(this,"pulseDensityGrid");I(this,"gridWidth");I(this,"gridHeight");I(this,"quorumThreshold",.65);I(this,"refractoryPeriod",60);this.gridWidth=Math.ceil(t/this.gridResolution),this.gridHeight=Math.ceil(n/this.gridResolution),this.pulseDensityGrid=new Float32Array(this.gridWidth*this.gridHeight)}emitPulse(t,n,r,i=50){const o={emitterId:t,x:n,y:r,voltageMv:Math.max(10,Math.min(150,i)),frequencyHz:2.5,radius:60,durationLeft:30};return this.pulses.push(o),o}calculateLocalDensity(t,n,r=100){let i=0;for(const o of this.pulses){const s=o.x-t,c=o.y-n,u=Math.sqrt(s*s+c*c);if(u<=r+o.radius){const h=Math.max(0,1-u/(r+o.radius));i+=o.voltageMv*h}}return i/200}updatePulseGrid(t){this.pulseDensityGrid.fill(0);for(let n=this.pulses.length-1;n>=0;n--){const r=this.pulses[n];if(r.durationLeft-=t,r.durationLeft<=0){this.pulses.splice(n,1);continue}const i=Math.floor(r.x/this.gridResolution),o=Math.floor(r.y/this.gridResolution);if(i>=0&&i<this.gridWidth&&o>=0&&o<this.gridHeight){const s=o*this.gridWidth+i;this.pulseDensityGrid[s]+=r.voltageMv*(r.durationLeft/30)}}}evaluateCollectiveBehavior(t,n=0,r=0){return t>=1.2&&r>.6?"SPORULATION":t>=.9&&n>.4?"DEFENSIVE_WALL":t>=this.quorumThreshold?"SWARMING":"SOLITARY"}packPulseDensitiesToFloat32(t){const n=t&&t.length>=this.pulseDensityGrid.length?t:new Float32Array(this.pulseDensityGrid.length);return n.set(this.pulseDensityGrid),n}}class Jf{constructor(t=2e3,n=2e3,r=40){I(this,"cols");I(this,"rows");I(this,"cellSize");I(this,"velocityX");I(this,"velocityY");I(this,"viscosityField");this.cellSize=r,this.cols=Math.ceil(t/r),this.rows=Math.ceil(n/r);const i=this.cols*this.rows;this.velocityX=new Float32Array(i),this.velocityY=new Float32Array(i),this.viscosityField=new Float32Array(i).fill(1)}getVelocity(t,n){const r=Math.max(0,Math.min(this.cols-1,Math.floor(t/this.cellSize))),o=Math.max(0,Math.min(this.rows-1,Math.floor(n/this.cellSize)))*this.cols+r;return{vx:this.velocityX[o]||0,vy:this.velocityY[o]||0}}addForce(t,n,r,i,o=60){const s=Math.floor(t/this.cellSize),c=Math.floor(n/this.cellSize),u=Math.ceil(o/this.cellSize);for(let h=Math.max(0,c-u);h<=Math.min(this.rows-1,c+u);h++)for(let m=Math.max(0,s-u);m<=Math.min(this.cols-1,s+u);m++){const v=h*this.cols+m,y=(m+.5)*this.cellSize,E=(h+.5)*this.cellSize,k=(y-t)*(y-t)+(E-n)*(E-n);if(k<o*o){const w=1-Math.sqrt(k)/o;this.velocityX[v]+=r*w*.1,this.velocityY[v]+=i*w*.1}}}advectAndDiffuse(t,n=.985){const r=this.cols*this.rows;for(let i=0;i<r;i++)this.velocityX[i]*=n,this.velocityY[i]*=n,isFinite(this.velocityX[i])||(this.velocityX[i]=0),isFinite(this.velocityY[i])||(this.velocityY[i]=0)}calculateFluidInfluence(t,n,r,i,o=.05){const s=this.getVelocity(t,n),c=s.vx-r,u=s.vy-i,h=c*o,m=u*o;return{forceX:h,forceY:m}}disperseParticles(t,n=.2){for(let r=0;r<t.length;r++){const i=t[r],o=this.getVelocity(i.x,i.y);i.x+=o.vx*n,i.y+=o.vy*n,i.vx!==void 0&&(i.vx+=o.vx*n*.1),i.vy!==void 0&&(i.vy+=o.vy*n*.1)}}}class Kf{constructor(t,n,r){I(this,"width");I(this,"height");I(this,"config");I(this,"microbots",[]);I(this,"energyParticles",[]);I(this,"hazards",[]);I(this,"speedFields",[]);I(this,"fluidZones",[]);I(this,"gravityWells",[]);I(this,"catalystZones",[]);I(this,"chemicalGrid");I(this,"pheromoneGrid");I(this,"meteors",[]);I(this,"voidRifts",[]);I(this,"portals",[]);I(this,"biomes",[]);I(this,"spores",[]);I(this,"viralManager",new _f);I(this,"atmosphereManager",new Zf);I(this,"multicellularManager",new Qf);I(this,"opticalManager",new Yf);I(this,"quorumManager",new Xf);I(this,"fluidField",new Jf);I(this,"cataclysmManager",new Uf);I(this,"activeDisasters",[]);I(this,"disasterParticles",[]);I(this,"selectedMicrobotId",null);I(this,"threadManager");I(this,"wasmModule",null);I(this,"energyPositionsX",new Float32Array(5e3));I(this,"energyPositionsY",new Float32Array(5e3));I(this,"raycastBuffer",new Float32Array(100));I(this,"spatialGrid");I(this,"spatialHash");I(this,"totalBirths",0);I(this,"totalDeaths",0);I(this,"generationCount",1);I(this,"frameCount",0);I(this,"seasonFrameCount",0);I(this,"disasterTimer",0);I(this,"SEASON_DURATION_FRAMES",2700);I(this,"populationHistory",new Array(30).fill(45));I(this,"birthHistory",new Array(30).fill(0));I(this,"deathHistory",new Array(30).fill(0));I(this,"historyTimeline",[]);I(this,"positionBuffer");I(this,"positionsView");I(this,"lastFrameTime",performance.now());I(this,"actualTPS",0);I(this,"recentBirths",0);I(this,"recentDeaths",0);I(this,"nextBotIdNum",1);I(this,"nextFoodIdNum",1);I(this,"nextFieldIdNum",1);I(this,"speciationDiversityBuffer",new Float32Array(100));I(this,"speciationDiversityIndex",0);this.width=t,this.height=n,this.config=r,this.spatialGrid=new Da(t,n,100),this.threadManager=new Va,this.threadManager.initWorker(new URL("data:video/mp2t;base64,Ly8gV2ViIFdvcmtlciB0aHJlYWQgb2ZmbG9hZGluZyBoZWF2eSBnZW5ldGljIGNhbGN1bGF0aW9ucyBhbmQgc3BhdGlhbCBwaHlzaWNzDQpzZWxmLm9ubWVzc2FnZSA9IChldmVudDogTWVzc2FnZUV2ZW50KSA9PiB7DQogIGNvbnN0IHsgdHlwZSwgcGF5bG9hZCB9ID0gZXZlbnQuZGF0YTsNCiAgaWYgKHR5cGUgPT09ICdDQUxDVUxBVEVfRElTVEFOQ0VTJykgew0KICAgIGNvbnN0IHsgYm90cywgZm9vZCB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCByZXN1bHRzID0gW107DQogICAgZm9yIChsZXQgaSA9IDA7IGkgPCBib3RzLmxlbmd0aDsgaSsrKSB7DQogICAgICBsZXQgY2xvc2VzdERpc3QgPSBJbmZpbml0eTsNCiAgICAgIGxldCBjbG9zZXN0Rm9vZElkID0gbnVsbDsNCiAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgZm9vZC5sZW5ndGg7IGorKykgew0KICAgICAgICBjb25zdCBkeCA9IGZvb2Rbal0ueCAtIGJvdHNbaV0ueDsNCiAgICAgICAgY29uc3QgZHkgPSBmb29kW2pdLnkgLSBib3RzW2ldLnk7DQogICAgICAgIGNvbnN0IGRTcSA9IGR4ICogZHggKyBkeSAqIGR5Ow0KICAgICAgICBpZiAoZFNxIDwgY2xvc2VzdERpc3QpIHsNCiAgICAgICAgICBjbG9zZXN0RGlzdCA9IGRTcTsNCiAgICAgICAgICBjbG9zZXN0Rm9vZElkID0gZm9vZFtqXS5pZDsNCiAgICAgICAgfQ0KICAgICAgfQ0KICAgICAgcmVzdWx0cy5wdXNoKHsgYm90SWQ6IGJvdHNbaV0uaWQsIGNsb3Nlc3RGb29kSWQsIGRpc3RhbmNlOiBNYXRoLnNxcnQoY2xvc2VzdERpc3QpIH0pOw0KICAgIH0NCiAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdHlwZTogJ0RJU1RBTkNFU19DQUxDVUxBVEVEJywgcGF5bG9hZDogcmVzdWx0cyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQ1JPU1NPVkVSX0ROQScpIHsNCiAgICBjb25zdCB7IHBhcmVudEEsIHBhcmVudEIsIG11dGF0aW9uUmF0ZSB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCBvZmZzcHJpbmcgPSB7DQogICAgICBzcGVlZDogTWF0aC5yYW5kb20oKSA8IDAuNSA/IHBhcmVudEEuc3BlZWQgOiBwYXJlbnRCLnNwZWVkLA0KICAgICAgdmlzaW9uUmFkaXVzOiBNYXRoLnJhbmRvbSgpIDwgMC41ID8gcGFyZW50QS52aXNpb25SYWRpdXMgOiBwYXJlbnRCLnZpc2lvblJhZGl1cywNCiAgICAgIGVuZXJneUVmZmljaWVuY3k6IE1hdGgucmFuZG9tKCkgPCAwLjUgPyBwYXJlbnRBLmVuZXJneUVmZmljaWVuY3kgOiBwYXJlbnRCLmVuZXJneUVmZmljaWVuY3ksDQogICAgICBodWU6IE1hdGgucmFuZG9tKCkgPCAwLjUgPyBwYXJlbnRBLmh1ZSA6IHBhcmVudEIuaHVlDQogICAgfTsNCiAgICBpZiAoTWF0aC5yYW5kb20oKSA8IG11dGF0aW9uUmF0ZSkgew0KICAgICAgb2Zmc3ByaW5nLnNwZWVkICs9IChNYXRoLnJhbmRvbSgpIC0gMC41KSAqIDAuNDsNCiAgICAgIG9mZnNwcmluZy52aXNpb25SYWRpdXMgKz0gKE1hdGgucmFuZG9tKCkgLSAwLjUpICogMTU7DQogICAgfQ0KICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB0eXBlOiAnRE5BX0NST1NTT1ZFUl9DT01QTEVURScsIHBheWxvYWQ6IG9mZnNwcmluZyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQkFUQ0hfQ09MTElTSU9OUycpIHsNCiAgICBjb25zdCB7IGVudGl0aWVzLCByYWRpdXMgfSA9IHBheWxvYWQ7DQogICAgY29uc3QgY29sbGlzaW9ucyA9IFtdOw0KICAgIGNvbnN0IHJhZFNxID0gcmFkaXVzICogcmFkaXVzOw0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZW50aXRpZXMubGVuZ3RoOyBpKyspIHsNCiAgICAgIGZvciAobGV0IGogPSBpICsgMTsgaiA8IGVudGl0aWVzLmxlbmd0aDsgaisrKSB7DQogICAgICAgIGNvbnN0IGR4ID0gZW50aXRpZXNbal0ueCAtIGVudGl0aWVzW2ldLng7DQogICAgICAgIGNvbnN0IGR5ID0gZW50aXRpZXNbal0ueSAtIGVudGl0aWVzW2ldLnk7DQogICAgICAgIGlmIChkeCAqIGR4ICsgZHkgKiBkeSA8PSByYWRTcSkgew0KICAgICAgICAgIGNvbGxpc2lvbnMucHVzaChbZW50aXRpZXNbaV0uaWQsIGVudGl0aWVzW2pdLmlkXSk7DQogICAgICAgIH0NCiAgICAgIH0NCiAgICB9DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdDT0xMSVNJT05TX0NPTVBVVEVEJywgcGF5bG9hZDogY29sbGlzaW9ucyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnUVVBRFRSRUVfQlVJTEQnKSB7DQogICAgY29uc3QgeyBwb2ludHMgfSA9IHBheWxvYWQ7DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdRVUFEVFJFRV9CVUlMVCcsIHBheWxvYWQ6IHsgY291bnQ6IHBvaW50cy5sZW5ndGggfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnU1BFQ0lBVElPTl9RVUVSSUVTJykgew0KICAgIC8vIFByb2Nlc3MgRmxvYXQzMkFycmF5IGFycmF5cyBmb3IgemVyby1jb3B5IHNlcmlhbGl6YXRpb24gb3ZlcmhlYWQNCiAgICBjb25zdCB7IGdlbm9tZUEsIGdlbm9tZUIgfSA9IHBheWxvYWQ7DQogICAgbGV0IGRpc3RhbmNlID0gMDsNCiAgICBpZiAoZ2Vub21lQSAmJiBnZW5vbWVCICYmIGdlbm9tZUEubGVuZ3RoID09PSBnZW5vbWVCLmxlbmd0aCkgew0KICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBnZW5vbWVBLmxlbmd0aDsgaSsrKSB7DQogICAgICAgIGRpc3RhbmNlICs9IE1hdGgucG93KGdlbm9tZUFbaV0gLSBnZW5vbWVCW2ldLCAyKTsNCiAgICAgIH0NCiAgICAgIGRpc3RhbmNlID0gTWF0aC5zcXJ0KGRpc3RhbmNlKTsNCiAgICB9DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdTUEVDSUFUSU9OX1JFU1VMVCcsIHBheWxvYWQ6IHsgZGlzdGFuY2UgfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQkFUQ0hfUEhZU0lDU19RVUVSWScpIHsNCiAgICBjb25zdCB7IHBvc2l0aW9uc0J1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCBjb29yZHMgPSBuZXcgRmxvYXQzMkFycmF5KHBvc2l0aW9uc0J1ZmZlcik7DQogICAgY29uc3QgcmVzdWx0cyA9IG5ldyBGbG9hdDMyQXJyYXkoY29vcmRzLmxlbmd0aCAvIDIpOw0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgY29vcmRzLmxlbmd0aDsgaSArPSAyKSB7DQogICAgICByZXN1bHRzW2kgLyAyXSA9IE1hdGguaHlwb3QoY29vcmRzW2ldLCBjb29yZHNbaSArIDFdKTsNCiAgICB9DQogICAgKHNlbGYgYXMgYW55KS5wb3N0TWVzc2FnZSh7IHR5cGU6ICdQSFlTSUNTX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IHJlc3VsdHMuYnVmZmVyIH0sIFtyZXN1bHRzLmJ1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdXQVNNX1NQQVRJQUxfU1RBVEUnKSB7DQogICAgY29uc3QgeyBzcGF0aWFsQnVmZmVyIH0gPSBwYXlsb2FkOw0KICAgIChzZWxmIGFzIGFueSkucG9zdE1lc3NhZ2UoeyB0eXBlOiAnV0FTTV9TUEFUSUFMX1VQREFURUQnLCBwYXlsb2FkOiBzcGF0aWFsQnVmZmVyIH0sIFtzcGF0aWFsQnVmZmVyXSk7DQogIH0gZWxzZSBpZiAodHlwZSA9PT0gJ0JJT01FX1BIWVNJQ1NfUVVFUlknKSB7DQogICAgY29uc3QgeyBiaW9tZUJ1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICAoc2VsZiBhcyBhbnkpLnBvc3RNZXNzYWdlKHsgdHlwZTogJ0JJT01FX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IGJpb21lQnVmZmVyIH0sIFtiaW9tZUJ1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdQTEFTVElDSVRZX1FVRVJZJykgew0KICAgIGNvbnN0IHsgd2VpZ2h0c0J1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICAoc2VsZiBhcyBhbnkpLnBvc3RNZXNzYWdlKHsgdHlwZTogJ1BMQVNUSUNJVFlfUVVFUllfUkVTVUxUJywgcGF5bG9hZDogd2VpZ2h0c0J1ZmZlciB9LCBbd2VpZ2h0c0J1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdWSVJBTF9RVUVSWScpIHsNCiAgICBjb25zdCB7IHZpcmFsQnVmZmVyIH0gPSBwYXlsb2FkOw0KICAgIChzZWxmIGFzIGFueSkucG9zdE1lc3NhZ2UoeyB0eXBlOiAnVklSQUxfUVVFUllfUkVTVUxUJywgcGF5bG9hZDogdmlyYWxCdWZmZXIgfSwgW3ZpcmFsQnVmZmVyXSk7DQogIH0gZWxzZSBpZiAodHlwZSA9PT0gJ01VTFRJQ0VMTFVMQVJfUVVFUlknKSB7DQogICAgY29uc3QgeyB0aXNzdWVCdWZmZXIgfSA9IHBheWxvYWQ7DQogICAgKHNlbGYgYXMgYW55KS5wb3N0TWVzc2FnZSh7IHR5cGU6ICdNVUxUSUNFTExVTEFSX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IHRpc3N1ZUJ1ZmZlciB9LCBbdGlzc3VlQnVmZmVyXSk7DQogIH0gZWxzZSBpZiAodHlwZSA9PT0gJ1JFU1RPUkVfU05BUFNIT1QnKSB7DQogICAgY29uc3QgeyBzbmFwc2hvdDogX3NuYXBzaG90IH0gPSBwYXlsb2FkOw0KICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB0eXBlOiAnU05BUFNIT1RfUkVTVE9SRUQnLCBwYXlsb2FkOiB7IHN1Y2Nlc3M6IHRydWUsIHRpbWVzdGFtcDogRGF0ZS5ub3coKSB9IH0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdHRVRfU05BUFNIT1QnKSB7DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdTTkFQU0hPVF9TRVJJQUxJWkVEJywgcGF5bG9hZDogeyB0aW1lc3RhbXA6IERhdGUubm93KCkgfSB9KTsNCiAgfQ0KfTsNCg==",import.meta.url)),this.spatialHash=new za(60),this.chemicalGrid=new Ga(t,n,20),this.positionBuffer=new SharedArrayBuffer(1e3*2*4),this.positionsView=new Float32Array(this.positionBuffer),this.generateBiomes(),this.initWASM(),this.resetSimulation()}async initWASM(){try{const n=await(await fetch("./physics.wasm")).arrayBuffer(),r=await WebAssembly.instantiate(n,{env:{abort:()=>console.log("WASM abort")}});this.wasmModule=r.instance.exports,console.log("WASM Physics Module initialized successfully.")}catch(t){console.error("Failed to initialize WASM module:",t)}}generateBiomes(){this.biomes=[];const t=2,n=2,r=this.width/t,i=this.height/n,o=["NORMAL","TOXIC_SLUDGE","CRYO_ZONE","HIGH_G_FIELD"];for(let c=o.length-1;c>0;c--){const u=Math.floor(Math.random()*(c+1));[o[c],o[u]]=[o[u],o[c]]}let s=0;for(let c=0;c<t;c++)for(let u=0;u<n;u++){const h=o[s%o.length];let m="rgba(255,255,255,0)";h==="TOXIC_SLUDGE"&&(m="rgba(163, 230, 53, 0.05)"),h==="CRYO_ZONE"&&(m="rgba(56, 189, 248, 0.05)"),h==="HIGH_G_FIELD"&&(m="rgba(244, 63, 94, 0.05)"),this.biomes.push({id:`biome-${c}-${u}`,type:h,x:c*r,y:u*i,width:r,height:i,color:m}),s++}}getBiomeAt(t,n){return this.biomes.find(r=>t>=r.x&&t<=r.x+r.width&&n>=r.y&&n<=r.y+r.height)}resetSimulation(){this.microbots=[],this.energyParticles=[],this.hazards=[],this.speedFields=[],this.fluidZones=[],this.gravityWells=[],this.catalystZones=[],this.chemicalGrid.reset(),this.portals=[],this.activeDisasters=[],this.selectedMicrobotId=null,this.totalBirths=0,this.totalDeaths=0,this.generationCount=1,this.nextBotIdNum=1,this.frameCount=0,this.seasonFrameCount=0,this.lastFrameTime=performance.now(),this.actualTPS=0,this.historyTimeline=[],this.threadManager.terminate(),this.threadManager=new Va,this.threadManager.initWorker(new URL("data:video/mp2t;base64,Ly8gV2ViIFdvcmtlciB0aHJlYWQgb2ZmbG9hZGluZyBoZWF2eSBnZW5ldGljIGNhbGN1bGF0aW9ucyBhbmQgc3BhdGlhbCBwaHlzaWNzDQpzZWxmLm9ubWVzc2FnZSA9IChldmVudDogTWVzc2FnZUV2ZW50KSA9PiB7DQogIGNvbnN0IHsgdHlwZSwgcGF5bG9hZCB9ID0gZXZlbnQuZGF0YTsNCiAgaWYgKHR5cGUgPT09ICdDQUxDVUxBVEVfRElTVEFOQ0VTJykgew0KICAgIGNvbnN0IHsgYm90cywgZm9vZCB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCByZXN1bHRzID0gW107DQogICAgZm9yIChsZXQgaSA9IDA7IGkgPCBib3RzLmxlbmd0aDsgaSsrKSB7DQogICAgICBsZXQgY2xvc2VzdERpc3QgPSBJbmZpbml0eTsNCiAgICAgIGxldCBjbG9zZXN0Rm9vZElkID0gbnVsbDsNCiAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgZm9vZC5sZW5ndGg7IGorKykgew0KICAgICAgICBjb25zdCBkeCA9IGZvb2Rbal0ueCAtIGJvdHNbaV0ueDsNCiAgICAgICAgY29uc3QgZHkgPSBmb29kW2pdLnkgLSBib3RzW2ldLnk7DQogICAgICAgIGNvbnN0IGRTcSA9IGR4ICogZHggKyBkeSAqIGR5Ow0KICAgICAgICBpZiAoZFNxIDwgY2xvc2VzdERpc3QpIHsNCiAgICAgICAgICBjbG9zZXN0RGlzdCA9IGRTcTsNCiAgICAgICAgICBjbG9zZXN0Rm9vZElkID0gZm9vZFtqXS5pZDsNCiAgICAgICAgfQ0KICAgICAgfQ0KICAgICAgcmVzdWx0cy5wdXNoKHsgYm90SWQ6IGJvdHNbaV0uaWQsIGNsb3Nlc3RGb29kSWQsIGRpc3RhbmNlOiBNYXRoLnNxcnQoY2xvc2VzdERpc3QpIH0pOw0KICAgIH0NCiAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdHlwZTogJ0RJU1RBTkNFU19DQUxDVUxBVEVEJywgcGF5bG9hZDogcmVzdWx0cyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQ1JPU1NPVkVSX0ROQScpIHsNCiAgICBjb25zdCB7IHBhcmVudEEsIHBhcmVudEIsIG11dGF0aW9uUmF0ZSB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCBvZmZzcHJpbmcgPSB7DQogICAgICBzcGVlZDogTWF0aC5yYW5kb20oKSA8IDAuNSA/IHBhcmVudEEuc3BlZWQgOiBwYXJlbnRCLnNwZWVkLA0KICAgICAgdmlzaW9uUmFkaXVzOiBNYXRoLnJhbmRvbSgpIDwgMC41ID8gcGFyZW50QS52aXNpb25SYWRpdXMgOiBwYXJlbnRCLnZpc2lvblJhZGl1cywNCiAgICAgIGVuZXJneUVmZmljaWVuY3k6IE1hdGgucmFuZG9tKCkgPCAwLjUgPyBwYXJlbnRBLmVuZXJneUVmZmljaWVuY3kgOiBwYXJlbnRCLmVuZXJneUVmZmljaWVuY3ksDQogICAgICBodWU6IE1hdGgucmFuZG9tKCkgPCAwLjUgPyBwYXJlbnRBLmh1ZSA6IHBhcmVudEIuaHVlDQogICAgfTsNCiAgICBpZiAoTWF0aC5yYW5kb20oKSA8IG11dGF0aW9uUmF0ZSkgew0KICAgICAgb2Zmc3ByaW5nLnNwZWVkICs9IChNYXRoLnJhbmRvbSgpIC0gMC41KSAqIDAuNDsNCiAgICAgIG9mZnNwcmluZy52aXNpb25SYWRpdXMgKz0gKE1hdGgucmFuZG9tKCkgLSAwLjUpICogMTU7DQogICAgfQ0KICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB0eXBlOiAnRE5BX0NST1NTT1ZFUl9DT01QTEVURScsIHBheWxvYWQ6IG9mZnNwcmluZyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQkFUQ0hfQ09MTElTSU9OUycpIHsNCiAgICBjb25zdCB7IGVudGl0aWVzLCByYWRpdXMgfSA9IHBheWxvYWQ7DQogICAgY29uc3QgY29sbGlzaW9ucyA9IFtdOw0KICAgIGNvbnN0IHJhZFNxID0gcmFkaXVzICogcmFkaXVzOw0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZW50aXRpZXMubGVuZ3RoOyBpKyspIHsNCiAgICAgIGZvciAobGV0IGogPSBpICsgMTsgaiA8IGVudGl0aWVzLmxlbmd0aDsgaisrKSB7DQogICAgICAgIGNvbnN0IGR4ID0gZW50aXRpZXNbal0ueCAtIGVudGl0aWVzW2ldLng7DQogICAgICAgIGNvbnN0IGR5ID0gZW50aXRpZXNbal0ueSAtIGVudGl0aWVzW2ldLnk7DQogICAgICAgIGlmIChkeCAqIGR4ICsgZHkgKiBkeSA8PSByYWRTcSkgew0KICAgICAgICAgIGNvbGxpc2lvbnMucHVzaChbZW50aXRpZXNbaV0uaWQsIGVudGl0aWVzW2pdLmlkXSk7DQogICAgICAgIH0NCiAgICAgIH0NCiAgICB9DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdDT0xMSVNJT05TX0NPTVBVVEVEJywgcGF5bG9hZDogY29sbGlzaW9ucyB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnUVVBRFRSRUVfQlVJTEQnKSB7DQogICAgY29uc3QgeyBwb2ludHMgfSA9IHBheWxvYWQ7DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdRVUFEVFJFRV9CVUlMVCcsIHBheWxvYWQ6IHsgY291bnQ6IHBvaW50cy5sZW5ndGggfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnU1BFQ0lBVElPTl9RVUVSSUVTJykgew0KICAgIC8vIFByb2Nlc3MgRmxvYXQzMkFycmF5IGFycmF5cyBmb3IgemVyby1jb3B5IHNlcmlhbGl6YXRpb24gb3ZlcmhlYWQNCiAgICBjb25zdCB7IGdlbm9tZUEsIGdlbm9tZUIgfSA9IHBheWxvYWQ7DQogICAgbGV0IGRpc3RhbmNlID0gMDsNCiAgICBpZiAoZ2Vub21lQSAmJiBnZW5vbWVCICYmIGdlbm9tZUEubGVuZ3RoID09PSBnZW5vbWVCLmxlbmd0aCkgew0KICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBnZW5vbWVBLmxlbmd0aDsgaSsrKSB7DQogICAgICAgIGRpc3RhbmNlICs9IE1hdGgucG93KGdlbm9tZUFbaV0gLSBnZW5vbWVCW2ldLCAyKTsNCiAgICAgIH0NCiAgICAgIGRpc3RhbmNlID0gTWF0aC5zcXJ0KGRpc3RhbmNlKTsNCiAgICB9DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdTUEVDSUFUSU9OX1JFU1VMVCcsIHBheWxvYWQ6IHsgZGlzdGFuY2UgfSB9KTsNCiAgfSBlbHNlIGlmICh0eXBlID09PSAnQkFUQ0hfUEhZU0lDU19RVUVSWScpIHsNCiAgICBjb25zdCB7IHBvc2l0aW9uc0J1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICBjb25zdCBjb29yZHMgPSBuZXcgRmxvYXQzMkFycmF5KHBvc2l0aW9uc0J1ZmZlcik7DQogICAgY29uc3QgcmVzdWx0cyA9IG5ldyBGbG9hdDMyQXJyYXkoY29vcmRzLmxlbmd0aCAvIDIpOw0KICAgIGZvciAobGV0IGkgPSAwOyBpIDwgY29vcmRzLmxlbmd0aDsgaSArPSAyKSB7DQogICAgICByZXN1bHRzW2kgLyAyXSA9IE1hdGguaHlwb3QoY29vcmRzW2ldLCBjb29yZHNbaSArIDFdKTsNCiAgICB9DQogICAgKHNlbGYgYXMgYW55KS5wb3N0TWVzc2FnZSh7IHR5cGU6ICdQSFlTSUNTX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IHJlc3VsdHMuYnVmZmVyIH0sIFtyZXN1bHRzLmJ1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdXQVNNX1NQQVRJQUxfU1RBVEUnKSB7DQogICAgY29uc3QgeyBzcGF0aWFsQnVmZmVyIH0gPSBwYXlsb2FkOw0KICAgIChzZWxmIGFzIGFueSkucG9zdE1lc3NhZ2UoeyB0eXBlOiAnV0FTTV9TUEFUSUFMX1VQREFURUQnLCBwYXlsb2FkOiBzcGF0aWFsQnVmZmVyIH0sIFtzcGF0aWFsQnVmZmVyXSk7DQogIH0gZWxzZSBpZiAodHlwZSA9PT0gJ0JJT01FX1BIWVNJQ1NfUVVFUlknKSB7DQogICAgY29uc3QgeyBiaW9tZUJ1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICAoc2VsZiBhcyBhbnkpLnBvc3RNZXNzYWdlKHsgdHlwZTogJ0JJT01FX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IGJpb21lQnVmZmVyIH0sIFtiaW9tZUJ1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdQTEFTVElDSVRZX1FVRVJZJykgew0KICAgIGNvbnN0IHsgd2VpZ2h0c0J1ZmZlciB9ID0gcGF5bG9hZDsNCiAgICAoc2VsZiBhcyBhbnkpLnBvc3RNZXNzYWdlKHsgdHlwZTogJ1BMQVNUSUNJVFlfUVVFUllfUkVTVUxUJywgcGF5bG9hZDogd2VpZ2h0c0J1ZmZlciB9LCBbd2VpZ2h0c0J1ZmZlcl0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdWSVJBTF9RVUVSWScpIHsNCiAgICBjb25zdCB7IHZpcmFsQnVmZmVyIH0gPSBwYXlsb2FkOw0KICAgIChzZWxmIGFzIGFueSkucG9zdE1lc3NhZ2UoeyB0eXBlOiAnVklSQUxfUVVFUllfUkVTVUxUJywgcGF5bG9hZDogdmlyYWxCdWZmZXIgfSwgW3ZpcmFsQnVmZmVyXSk7DQogIH0gZWxzZSBpZiAodHlwZSA9PT0gJ01VTFRJQ0VMTFVMQVJfUVVFUlknKSB7DQogICAgY29uc3QgeyB0aXNzdWVCdWZmZXIgfSA9IHBheWxvYWQ7DQogICAgKHNlbGYgYXMgYW55KS5wb3N0TWVzc2FnZSh7IHR5cGU6ICdNVUxUSUNFTExVTEFSX1FVRVJZX1JFU1VMVCcsIHBheWxvYWQ6IHRpc3N1ZUJ1ZmZlciB9LCBbdGlzc3VlQnVmZmVyXSk7DQogIH0gZWxzZSBpZiAodHlwZSA9PT0gJ1JFU1RPUkVfU05BUFNIT1QnKSB7DQogICAgY29uc3QgeyBzbmFwc2hvdDogX3NuYXBzaG90IH0gPSBwYXlsb2FkOw0KICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB0eXBlOiAnU05BUFNIT1RfUkVTVE9SRUQnLCBwYXlsb2FkOiB7IHN1Y2Nlc3M6IHRydWUsIHRpbWVzdGFtcDogRGF0ZS5ub3coKSB9IH0pOw0KICB9IGVsc2UgaWYgKHR5cGUgPT09ICdHRVRfU05BUFNIT1QnKSB7DQogICAgc2VsZi5wb3N0TWVzc2FnZSh7IHR5cGU6ICdTTkFQU0hPVF9TRVJJQUxJWkVEJywgcGF5bG9hZDogeyB0aW1lc3RhbXA6IERhdGUubm93KCkgfSB9KTsNCiAgfQ0KfTsNCg==",import.meta.url)),this.spatialGrid.clear(),this.nextFieldIdNum=1,this.recentBirths=0,this.recentDeaths=0,this.populationHistory=new Array(30).fill(this.config.startPopulation),this.birthHistory=new Array(30).fill(0),this.deathHistory=new Array(30).fill(0),this.historyTimeline=[];for(let t=0;t<this.config.startPopulation;t++)this.spawnMicrobot();this.spawnMultipleFood(80),this.updateHazardsCount(),this.microbots.length>0&&(this.selectedMicrobotId=this.microbots[0].id)}exportSyntheticRulesets(){return JSON.stringify({version:"0.1.224",timestamp:Date.now(),gravityWells:this.gravityWells,speedFields:this.speedFields,fluidZones:this.fluidZones},null,2)}exportNASBrainArchitectures(){const t=this.microbots.map(n=>({botId:n.id,nasBrain:n.nasBrain,organelles:n.organelles,mitochondrialDNA:n.mitochondrialDNA})).filter(n=>n.nasBrain||n.organelles&&n.organelles.length>0);return JSON.stringify({version:"0.1.224",timestamp:Date.now(),architectures:t},null,2)}exportState(){const t={microbots:this.microbots,energyParticles:this.energyParticles,hazards:this.hazards,speedFields:this.speedFields,fluidZones:this.fluidZones,gravityWells:this.gravityWells,catalystZones:this.catalystZones,chemicalGridBuffer:Array.from(this.chemicalGrid.buffer),meteors:this.meteors,activeDisasters:this.activeDisasters,config:this.config,stats:{totalBirths:this.totalBirths,totalDeaths:this.totalDeaths,generationCount:this.generationCount,frameCount:this.frameCount}};return btoa(JSON.stringify(t))}importState(t){try{const n=JSON.parse(atob(t));this.microbots=n.microbots||[],this.energyParticles=n.energyParticles||[],this.hazards=n.hazards||[],this.speedFields=n.speedFields||[],this.fluidZones=n.fluidZones||[],this.gravityWells=n.gravityWells||[],this.catalystZones=n.catalystZones||[],n.chemicalGridBuffer&&this.chemicalGrid.buffer.set(n.chemicalGridBuffer),this.meteors=n.meteors||[],this.activeDisasters=n.activeDisasters||[],this.config={...this.config,...n.config},n.stats&&(this.totalBirths=n.stats.totalBirths,this.totalDeaths=n.stats.totalDeaths,this.generationCount=n.stats.generationCount,this.frameCount=n.stats.frameCount),this.nextBotIdNum=this.microbots.length+1,this.nextFoodIdNum=this.energyParticles.length+1,console.log("Successfully imported ecosystem state")}catch(n){console.error("Failed to import state hash:",n)}}resize(t,n){this.width=Math.max(400,t),this.height=Math.max(400,n),this.spatialGrid=new Da(this.width,this.height,60),this.chemicalGrid=new Ga(this.width,this.height,20),this.pheromoneGrid=new zf(this.width,this.height,10),this.spatialHash=new za(80),this.generateBiomes()}spawnMicrobot(t,n){const r=`MB-${String(this.nextBotIdNum++).padStart(4,"0")}`;let i=Math.random()*(this.width-100)+50,o=Math.random()*(this.height-100)+50,s=2+(Math.random()-.5)*.5,c=.1+(Math.random()-.5)*.04,u=120+(Math.random()-.5)*30,h=100,m=1,v=185,y=1,E=null,k=Math.random()*.5,w=Math.random()>.8?1:0,B=Math.random()*.8+1,p=[{geneId:"SPEED_BOOST",activationLevel:0,heritability:.3,stressThreshold:8},{geneId:"VISION_BOOST",activationLevel:0,heritability:.2,stressThreshold:6}];if(t){i=t.x+(Math.random()-.5)*20,o=t.y+(Math.random()-.5)*20,y=t.generation+1,E=t.id,t.offspringCount++,n&&n.offspringCount++,y>this.generationCount&&(this.generationCount=y);const a=this.config.currentSeason==="AUTUMN"?1.5:1,C=this.config.mutationRate*a;s=Re(Xt(t.speed+(Math.random()-.5)*C*1.5),1,5),c=Re(Xt(t.turnRate+(Math.random()-.5)*C*.1),.04,.3),u=Re(Xt(t.visionRadius+(Math.random()-.5)*C*50),60,260),m=Re(Xt(t.energyEfficiency+(Math.random()-.5)*C*.4),.6,2.5),v=Xt((t.hue+(Math.random()-.5)*C*80+360)%360),k=Re((t.armorGene||0)+(Math.random()-.5)*C*.2,0,.8),w=(t.inkGlandGene||0)>.5?Math.random()<C*2?0:1:Math.random()<C*2?1:0,B=Re((t.panicGene||1)+(Math.random()-.5)*C*.5,1,2.5),t.epigenome&&(p=t.epigenome.map(T=>{const A=Math.random()<T.heritability;return{...T,activationLevel:A?T.activationLevel*.8:0}}))}const f=s>3.4&&m>1.4,x=f?"#f43f5e":`hsl(${Math.round(v)}, 95%, 55%)`,M={id:r,speciesId:(t==null?void 0:t.speciesId)||bn.getInstance().getSpeciesId(),isHybrid:t&&n?bn.getInstance().evaluateMatingCompatibility(t,n).isHybrid:!1,fertility:t&&n?bn.getInstance().evaluateMatingCompatibility(t,n).fertilityFactor:(t==null?void 0:t.fertility)??1,x:i,y:o,vx:Math.cos(Math.random()*Math.PI*2)*s,vy:Math.sin(Math.random()*Math.PI*2)*s,heading:Math.random()*Math.PI*2,speed:s,maxSpeed:s,turnRate:c,visionRadius:u,battery:h,maxBattery:h,energyEfficiency:m,hue:v,color:x,generation:y,parentId:E,offspringCount:0,age:0,behaviorState:"WANDERING",energyCollected:0,isPredator:f,teleportCooldown:0,armorGene:k,inkGlandGene:w,inkCooldown:0,panicGene:B,panicTimer:0,trail:[],batteryHistory:new Array(30).fill(h),genome:{speedAllele:{geneId:"SPEED",baseValue:s,quantumVariance:2,state:"ENTANGLED",observationProbability:.5},visionAllele:{geneId:"VISION",baseValue:u,quantumVariance:50,state:"ENTANGLED",observationProbability:.5},efficiencyAllele:{geneId:"EFFICIENCY",baseValue:m,quantumVariance:.8,state:"ENTANGLED",observationProbability:.5},mutationTendency:{geneId:"MUTATION",baseValue:.1,quantumVariance:.1,state:"ENTANGLED",observationProbability:.5},adhesionGene:{geneId:"ADHESION",baseValue:Math.random()<.2?.8:.2,quantumVariance:.5,state:"ENTANGLED",observationProbability:.1}},epigenome:p};return Pn.getInstance().sanitizeMicrobotState(M,this.width,this.height),this.microbots.push(M),this.totalBirths++,this.recentBirths++,M}spawnMultipleBots(t){for(let n=0;n<t;n++)this.spawnMicrobot()}spawnFoodParticle(t="NUTRIENT_DOT",n,r){const i=n??Math.random()*(this.width-60)+30,o=r??Math.random()*(this.height-60)+30,s=t==="SUPER_CHARGER"?50:t==="MUTAGEN_ORB"?30:25,c=t==="SUPER_CHARGER"?5:t==="MUTAGEN_ORB"?6:3.5,u=t==="SUPER_CHARGER"?"#00E5FF":t==="MUTAGEN_ORB"?"#E040FB":"#00E676";this.energyParticles.push({id:`F-${this.nextFoodIdNum++}`,x:i,y:o,value:s,radius:c,type:t,color:u})}spawnFood(t,n,r){const i=t??Math.random()*(this.width-80)+40,o=n??Math.random()*(this.height-80)+40;let s=r||"NUTRIENT_DOT";if(!r){const v=Math.random();v<.78?s="NUTRIENT_DOT":v<.9?s="SUPER_CHARGER":s="MUTAGEN_ORB"}let c=25,u=4,h="#00E676";s==="SUPER_CHARGER"?(c=50,u=6,h="#00E5FF"):s==="MUTAGEN_ORB"&&(c=30,u=5,h="#E040FB");const m={id:`EP-${this.nextFoodIdNum++}`,x:i,y:o,value:c,radius:u,type:s,color:h};this.energyParticles.push(m)}spawnMultipleFood(t){for(let n=0;n<t;n++)this.spawnFood()}spawnHazard(t,n){const r=`HZ-${this.hazards.length+1}`,i=60+Math.random()*40,o=t??Math.random()*(this.width-i*2)+i,s=n??Math.random()*(this.height-i*2)+i,c=Math.random()*Math.PI*2;this.hazards.push({id:r,x:o,y:s,radius:i,damageRate:.8,vx:Math.cos(c)*1.5,vy:Math.sin(c)*1.5})}spawnSpeedField(t,n){const r=`SF-${this.nextFieldIdNum++}`;this.speedFields.push({id:r,x:t,y:n,radius:50,multiplier:1.8})}triggerMeteorStrike(t,n){const r=t??Math.random()*(this.width-200)+100,i=n??Math.random()*(this.height-200)+100;Le.playDisasterSound("METEOR"),this.meteors.push({id:`M-${Date.now()}`,x:r,y:i,radius:10,maxRadius:110,progress:0})}triggerVoidRift(t,n){const r=t??Math.random()*(this.width-200)+100,i=n??Math.random()*(this.height-200)+100;Le.playDisasterSound("VOID"),this.voidRifts.push({id:`VR-${Date.now()}`,x:r,y:i,radius:90,pullForce:2.8})}getElevation(t,n){return .5}spawnSpore(t,n){const r=t!==void 0?t:Math.random()*(this.width-60)+30,i=n!==void 0?n:Math.random()*(this.height-60)+30;this.spores||(this.spores=[]),this.spores.push({id:`SPORE-${Date.now()}-${Math.floor(Math.random()*1e3)}`,x:r,y:i,vx:(Math.random()-.5)*2,vy:(Math.random()-.5)*2,radius:3,hostId:null,life:1e3})}clearHazards(){this.hazards=[]}spawnPortalPair(){const t=`PORTAL-${Date.now()}-A`,n=`PORTAL-${Date.now()}-B`,r=Math.random()*(this.width/2-100)+50,i=Math.random()*(this.height-100)+50,o=Math.random()*(this.width/2-100)+(this.width/2+50),s=Math.random()*(this.height-100)+50;this.portals.push({id:t,x:r,y:i,radius:45,linkedId:n}),this.portals.push({id:n,x:o,y:s,radius:45,linkedId:t})}runBenchmark(){console.log("--- STARTING DIAGNOSTIC BENCHMARK ---"),this.resetSimulation(),this.config.isPaused=!1,this.spawnMultipleBots(3e3),this.spawnMultipleFood(200),this.updateHazardsCount(),setTimeout(()=>{console.log(`Benchmark Complete. Actual TPS: ${this.actualTPS.toFixed(1)}`),alert(`Diagnostic Benchmark Complete!
Average Simulation TPS with 3000 bots: ${this.actualTPS.toFixed(1)}`)},5e3)}updateHazardsCount(){for(;this.hazards.length<this.config.hazardCount;)this.spawnHazard();this.hazards.length>this.config.hazardCount&&(this.hazards=this.hazards.slice(0,this.config.hazardCount))}overrideMicrobotGenes(t,n){const r=this.microbots.find(i=>i.id===t);r&&(n.speed!==void 0&&(r.speed=n.speed),n.visionRadius!==void 0&&(r.visionRadius=n.visionRadius),n.energyEfficiency!==void 0&&(r.energyEfficiency=n.energyEfficiency),n.turnRate!==void 0&&(r.turnRate=n.turnRate),n.hue!==void 0&&(r.hue=n.hue,r.color=`hsl(${Math.round(n.hue)}, 95%, 55%)`),r.isPredator=r.speed>3.4&&r.energyEfficiency>1.4,r.isPredator&&(r.color="#f43f5e"))}triggerSolarFlare(){Le.playDisasterSound("FLARE"),this.activeDisasters.push({type:"SOLAR_FLARE",active:!0,intensity:1,durationLeft:200});for(let t=0;t<30;t++){const n=ei.acquire();n.x=this.width/2+(Math.random()-.5)*100,n.y=this.height/2+(Math.random()-.5)*100,n.vx=(Math.random()-.5)*25,n.vy=(Math.random()-.5)*25,n.life=100+Math.random()*50,n.color="#FFD700",this.disasterParticles.push(n)}}triggerRadiationStorm(){Le.playDisasterSound("STORM"),this.activeDisasters.push({type:"RADIATION_STORM",active:!0,intensity:.8,durationLeft:400});for(let t=0;t<30;t++){const n=ei.acquire();n.x=this.width/2+(Math.random()-.5)*100,n.y=this.height/2+(Math.random()-.5)*100,n.vx=(Math.random()-.5)*15,n.vy=(Math.random()-.5)*15,n.life=100+Math.random()*50,n.color="#39ff14",this.disasterParticles.push(n)}}triggerMagneticInversion(){Le.playDisasterSound("INVERSION"),this.activeDisasters.push({type:"MAGNETIC_INVERSION",active:!0,intensity:1,durationLeft:300});for(let t=0;t<40;t++){const n=ei.acquire();n.x=this.width/2,n.y=this.height/2,n.vx=(Math.random()-.5)*20,n.vy=(Math.random()-.5)*20,n.life=80+Math.random()*40,n.color="#9d00ff",this.disasterParticles.push(n)}}getLineageTree(t){const n=this.microbots.find(o=>o.id===t)||null;let r=null;n&&n.parentId&&(r=this.microbots.find(o=>o.id===n.parentId)||null);const i=n?this.microbots.filter(o=>o.parentId===n.id):[];return{parent:r,current:n,children:i}}selectRandomMicrobot(){if(this.microbots.length===0)return this.selectedMicrobotId=null,null;const t=Math.floor(Math.random()*this.microbots.length),n=this.microbots[t];return this.selectedMicrobotId=n.id,n}getSelectedMicrobot(){return this.selectedMicrobotId&&this.microbots.find(t=>t.id===this.selectedMicrobotId)||null}update(t=1){var p,f,x,M;if(this.config.isPaused)return;const n=performance.now(),r=n-this.lastFrameTime;this.actualTPS=r>0?1e3/r:0,this.lastFrameTime=n;const i=this.config.simSpeed*t;if(this.config.autoSeasonCycle&&(this.seasonFrameCount+=i,this.seasonFrameCount>=this.SEASON_DURATION_FRAMES)){this.seasonFrameCount=0;const a=["SPRING","SUMMER","AUTUMN","WINTER"],C=a.indexOf(this.config.currentSeason),T=a[(C+1)%a.length];this.config.currentSeason=T}if(this.config.autoDisastersEnabled&&(this.disasterTimer+=i,this.disasterTimer>=this.config.disasterScheduleInterval)){this.disasterTimer=0;const a=["SOLAR_FLARE","RADIATION_STORM","MAGNETIC_INVERSION"],C=a[Math.floor(Math.random()*a.length)];C==="SOLAR_FLARE"?this.triggerSolarFlare():C==="RADIATION_STORM"?this.triggerRadiationStorm():this.triggerMagneticInversion()}let o=1,s=1,c=1;this.config.currentSeason==="SPRING"?o=1.5:this.config.currentSeason==="SUMMER"?c=1.15:this.config.currentSeason==="AUTUMN"?o=.75:this.config.currentSeason==="WINTER"&&(o=.4,s=1.4);let u=1;if(this.config.weatherEvent==="SOLAR_FLARE")u=2.5;else if(this.config.weatherEvent==="RESOURCE_BLOOM")this.frameCount%8===0&&this.energyParticles.length<this.config.maxEnergyParticles*1.5&&this.spawnFood();else if(this.config.weatherEvent==="TOXIC_DRIFT")for(const a of this.hazards){const C=a.vx||1.2,T=a.vy||1.2;a.x+=C*i,a.y+=T*i,(a.x<a.radius||a.x>this.width-a.radius)&&(a.vx=-C),(a.y<a.radius||a.y>this.height-a.radius)&&(a.vy=-T)}for(let a=this.activeDisasters.length-1;a>=0;a--){const C=this.activeDisasters[a];C.durationLeft-=i,C.durationLeft<=0&&this.activeDisasters.splice(a,1)}const h=this.activeDisasters.some(a=>a.type==="RADIATION_STORM"),m=this.activeDisasters.some(a=>a.type==="MAGNETIC_INVERSION");this.frameCount%5===0&&(this.chemicalGrid.decay(.04*i),this.pheromoneGrid&&(this.pheromoneGrid.processEmitters(),this.pheromoneGrid.decay(.02*i)));for(let a=this.spores.length-1;a>=0;a--){const C=this.spores[a];if(C.life-=i,!C.hostId){C.x+=C.vx*i,C.y+=C.vy*i,C.x<0&&(C.x+=this.width),C.x>this.width&&(C.x-=this.width),C.y<0&&(C.y+=this.height),C.y>this.height&&(C.y-=this.height);for(const T of this.microbots)if(!T.isInfected&&!T.hasAntibodies){const A=Math.hypot(T.x-C.x,T.y-C.y);if(A<T.visionRadius*.5&&(C.vx+=(T.x-C.x)*.01,C.vy+=(T.y-C.y)*.01),A<15){C.hostId=T.id,T.isInfected=!0,T.infectionTimer=800;break}}}C.life<=0&&this.spores.splice(a,1)}this.spatialGrid.clear();const v=new Mn({x:0,y:0,width:this.width,height:this.height},8);for(const a of this.energyParticles)this.spatialGrid.insert(a),v.insert(a);const y=this.config.energySpawnRate*o;this.frameCount%Math.max(1,Math.floor(20/y))===0&&this.energyParticles.length<this.config.maxEnergyParticles&&this.spawnFood();const E=new Set,k=new Set;let w=0;for(const a of this.microbots){if(a.age+=i,w<1e3&&(this.positionsView[w*2]=a.x,this.positionsView[w*2+1]=a.y),w++,!a.isPredator&&a.speed>3.4&&a.energyEfficiency>1.4&&(a.isPredator=!0,a.color="#f43f5e"),a.teleportCooldown&&a.teleportCooldown>0)a.teleportCooldown-=i;else for(const g of this.portals)if(Math.hypot(a.x-g.x,a.y-g.y)<g.radius){const F=this.portals.find(W=>W.id===g.linkedId);if(F){a.x=F.x+(Math.random()-.5)*20,a.y=F.y+(Math.random()-.5)*20,a.teleportCooldown=60;break}}let C=a.speed*c;if(a.panicTimer&&a.panicTimer>0&&(C*=a.panicGene||1.5,a.panicTimer-=i),a.inkCooldown&&a.inkCooldown>0&&(a.inkCooldown-=i),a.behaviorState==="REPRODUCING"||a.battery>a.maxBattery*.8){const g=(Math.abs(a.vx)+Math.abs(a.vy))*.1;this.pheromoneGrid.addPheromone(a.x-a.vx,a.y-a.vy,g)}const T=this.getElevation(a.x,a.y),A=this.getElevation(a.x+1,a.y)-T,Q=this.getElevation(a.x,a.y+1)-T;a.vx-=A*15*i,a.vy-=Q*15*i;const O=.85+T*.1;a.vx*=O,a.vy*=O;const X=this.getBiomeAt(a.x,a.y);if(X){if(X.type==="TOXIC_SLUDGE")C*=.6,a.battery-=.15*i;else if(X.type==="CRYO_ZONE")C*=.4,a.battery-=.08*(1.5/a.energyEfficiency)*i;else if(X.type==="HIGH_G_FIELD"){const g=X.x+X.width/2,j=X.y+X.height/2,F=Math.atan2(j-a.y,g-a.x),W=.5;a.vx+=Math.cos(F)*W*i,a.vy+=Math.sin(F)*W*i}}if(h&&(a.battery-=.1*i,Math.random()<.005*i&&(a.hue=(a.hue+Math.random()*40-20+360)%360,a.color=`hsl(${Math.round(a.hue)}, 95%, 55%)`)),(a.battery<a.maxBattery*.25||X&&(X.type==="TOXIC_SLUDGE"||X.type==="CRYO_ZONE")||h)&&a.genome){const g=a.genome,j=[g.speedAllele,g.visionAllele,g.efficiencyAllele];for(const F of j)if(F.state==="ENTANGLED"||F.state==="DECAYING"){F.state="OBSERVED";const J=Math.random()<F.observationProbability?F.quantumVariance:-F.quantumVariance;F.geneId==="SPEED"?(a.speed=Re(a.speed+J,1,5),a.maxSpeed=a.speed):F.geneId==="VISION"?a.visionRadius=Re(a.visionRadius+J,40,260):F.geneId==="EFFICIENCY"&&(a.energyEfficiency=Re(a.energyEfficiency+J,.4,3))}}m&&Math.random()<.05*i&&(a.heading+=Math.PI,a.vx=-a.vx,a.vy=-a.vy);for(const g of this.speedFields)Math.hypot(a.x-g.x,a.y-g.y)<g.radius&&(C*=g.multiplier);for(const g of this.fluidZones)if(Math.hypot(a.x-g.x,a.y-g.y)<g.radius)if(g.isNonNewtonian){const F=a.vx*a.vx+a.vy*a.vy,W=Math.max(.1,1-g.baseDrag*F*.05);a.vx*=W,a.vy*=W,C*=W}else a.vx*=g.baseDrag,a.vy*=g.baseDrag,C*=g.baseDrag;for(const g of this.gravityWells){const j=g.x-a.x,F=g.y-a.y,W=Math.hypot(j,F);if(W>0&&W<g.radius){const J=g.force*(1-W/g.radius);a.vx+=j/W*J*i,a.vy+=F/W*J*i}}for(const g of this.catalystZones)if(Math.hypot(a.x-g.x,a.y-g.y)<g.radius&&a.genome){const F=g.mutationDirection*.02*i;g.targetGene==="SPEED"?(a.genome.speedAllele.baseValue=Re(a.genome.speedAllele.baseValue+F,1,5),a.speed=a.genome.speedAllele.baseValue,a.maxSpeed=a.speed):g.targetGene==="VISION"?(a.genome.visionAllele.baseValue=Re(a.genome.visionAllele.baseValue+F*20,40,260),a.visionRadius=a.genome.visionAllele.baseValue):g.targetGene==="EFFICIENCY"&&(a.genome.efficiencyAllele.baseValue=Re(a.genome.efficiencyAllele.baseValue+F*.5,.4,3),a.energyEfficiency=a.genome.efficiencyAllele.baseValue)}this.frameCount%15===0&&(a.trail.push({x:a.x,y:a.y}),a.trail.length>12&&a.trail.shift(),this.config.showPheromoneTrails&&this.chemicalGrid.addPheromone(a.x,a.y,.1*i));const z=this.spatialGrid.getNearby(a.x,a.y,a.visionRadius),L=Gf(a,z,this.hazards,this.width,this.height,this.pheromoneGrid);if(a.behaviorState=L.state,a.behaviorState==="WANDERING"||a.behaviorState==="SEEKING_ENERGY"){const g=this.chemicalGrid.getPheromone(a.x+Math.cos(a.heading-.5)*15,a.y+Math.sin(a.heading-.5)*15),j=this.chemicalGrid.getPheromone(a.x+Math.cos(a.heading+.5)*15,a.y+Math.sin(a.heading+.5)*15),F=this.chemicalGrid.getPheromone(a.x+Math.cos(a.heading)*15,a.y+Math.sin(a.heading)*15);(g>0||j>0||F>0)&&(g>j&&g>F?L.desiredHeading-=.2:j>g&&j>F&&(L.desiredHeading+=.2))}if(a.isPredator){let g=null,j=a.visionRadius;for(const F of this.microbots)if(F.id!==a.id&&!F.isPredator){const W=Math.hypot(a.x-F.x,a.y-F.y);W<j&&(j=W,g=F)}if(g){a.behaviorState="HUNTING_PREY";const F=Math.atan2(g.y-a.y,g.x-a.x);if(L.desiredHeading=F,g.panicGene&&(!g.panicTimer||g.panicTimer<=0)&&(g.panicTimer=60,g.behaviorState="EVADING_HAZARD"),g.inkGlandGene&&g.inkGlandGene>.5&&(!g.inkCooldown||g.inkCooldown<=0)&&(g.inkCooldown=300,this.hazards.push({id:`INK-${Date.now()}`,x:g.x,y:g.y,radius:40,damageRate:.5,vx:0,vy:0})),j<16){const J=35*(g.armorGene?1-g.armorGene:1);a.battery=Math.min(a.maxBattery,a.battery+J),a.energyCollected+=J,g.battery-=J}}}let U=L.desiredHeading-a.heading;for(;U<-Math.PI;)U+=Math.PI*2;for(;U>Math.PI;)U-=Math.PI*2;if(a.heading+=Re(U,-a.turnRate*i,a.turnRate*i),a.symbiontPartnerId){const g=this.microbots.find(j=>j.id===a.symbiontPartnerId);if(g&&Math.hypot(a.x-g.x,a.y-g.y)<100){const F=a.battery+g.battery;a.battery=F/2,g.battery=F/2,a.visionRadius=Math.max(a.visionRadius,g.visionRadius);const W=(a.vx+g.vx)/2,J=(a.vy+g.vy)/2;a.vx=W,a.vy=J,g.vx=W,g.vy=J,this.config.showPheromoneTrails&&this.chemicalGrid.addPheromone((a.x+g.x)/2,(a.y+g.y)/2,.2)}}a.isInfected&&(a.battery-=this.config.batteryDrainMultiplier*2*i,a.infectionTimer!==void 0&&(a.infectionTimer-=i,a.infectionTimer<=0&&(a.isInfected=!1,Math.random()>.5&&(a.hasAntibodies=!0,a.hue=130)))),a.vx=Math.cos(a.heading)*C,a.vy=Math.sin(a.heading)*C;const b=Of(a.x,a.y,a.vx,a.vy,i,this.width,this.height,15,this.hazards);a.x=b.x,a.y=b.y,b.hitHazard&&(a.heading+=Math.PI),a.temperature=22+(this.config.weatherEvent==="SOLAR_FLARE"?18:0),this.config.weatherEvent==="TOXIC_DRIFT"&&(a.radiationExposure=(a.radiationExposure||0)+.1*i),a.battery<a.maxBattery*.3||a.radiationExposure&&a.radiationExposure>5?(a.epigeneticStress=(a.epigeneticStress||0)+.05*i,Rn.getInstance().updateGlobalStress(Math.max(Rn.getInstance().getGlobalStress(),a.epigeneticStress))):a.epigeneticStress=Math.max(0,(a.epigeneticStress||0)-.01*i),a.epigenome&&a.epigeneticStress&&a.epigeneticStress>0&&a.epigenome.forEach(g=>{a.epigeneticStress>g.stressThreshold&&g.activationLevel<1&&(g.activationLevel=Math.min(1,g.activationLevel+.02*i),g.geneId==="SPEED_BOOST"?a.speed=Math.min(a.maxSpeed*1.5,a.speed*(1+.01*g.activationLevel)):g.geneId==="VISION_BOOST"&&(a.visionRadius=Math.min(300,a.visionRadius*(1+.02*g.activationLevel))))});const d=Math.pow(a.speed,1.3)*(a.mass||1),R=a.nasBrain?a.nasBrain.passiveEnergyCost*.05:0,N=(.08*(d/(a.energyEfficiency||1))+R)*this.config.batteryDrainMultiplier*u*s*i;if(a.battery-=N,this.frameCount%10===0&&(a.batteryHistory||(a.batteryHistory=[]),a.batteryHistory.push(Math.max(0,a.battery)),a.batteryHistory.length>30&&a.batteryHistory.shift()),a.isParasite){for(const g of this.microbots)if(g.id!==a.id&&!g.isParasite&&Math.hypot(g.x-a.x,g.y-a.y)<18){const F=.5*i;g.battery=Math.max(0,g.battery-F),a.battery=Math.min(a.maxBattery,a.battery+F)}}for(const g of this.microbots)if(g.id!==a.id&&!a.isPredator&&!g.isPredator&&Math.hypot(g.x-a.x,g.y-a.y)<25&&Math.abs(a.hue-g.hue)<20){a.symbiontPartnerId=g.id;const F=(a.battery+g.battery)/2;a.battery=F,g.battery=F}for(const g of this.microbots)if(g.id!==a.id){const j=g.x-a.x,F=g.y-a.y,W=j*j+F*F;if(W<100&&W>0){const J=Math.sqrt(W),ne=j/J,S=F/J;if((p=a.genome)!=null&&p.adhesionGene&&((f=g.genome)!=null&&f.adhesionGene)&&a.genome.adhesionGene.baseValue>.6&&g.genome.adhesionGene.baseValue>.6)if(!a.clusterId&&!g.clusterId){const _=`C-${Date.now()}-${Math.floor(Math.random()*1e3)}`;a.clusterId=_,g.clusterId=_,a.boundTo=[g.id],g.boundTo=[a.id]}else a.clusterId&&!g.clusterId?(g.clusterId=a.clusterId,(x=a.boundTo)==null||x.push(g.id),g.boundTo=[a.id]):!a.clusterId&&g.clusterId&&(a.clusterId=g.clusterId,(M=g.boundTo)==null||M.push(a.id),a.boundTo=[g.id]);if(a.clusterId&&a.clusterId===g.clusterId){const Z=(10-J)*.1;a.x-=ne*Z,a.y-=S*Z,g.x+=ne*Z,g.y+=S*Z;continue}a.x-=ne*1.5,a.y-=S*1.5,g.x+=ne*1.5,g.y+=S*1.5;const Y=a.vx-g.vx,D=a.vy-g.vy,H=2*(ne*Y+S*D)/2;a.vx-=H*ne,a.vy-=H*S,g.vx+=H*ne,g.vy+=H*S}}if(a.isInfected)if(a.infectionTimer=(a.infectionTimer||0)+i,a.battery-=.1*i,a.behaviorState="INFECTED",a.infectionTimer>=300)a.isInfected=!1,a.hasAntibodies=!0;else for(const g of this.microbots)g.id!==a.id&&!g.isInfected&&!g.hasAntibodies&&Math.hypot(a.x-g.x,a.y-g.y)<20&&Math.random()<.35&&(g.isInfected=!0,g.infectionTimer=0);if(a.battery<=0){k.add(a.id),this.totalDeaths++,this.recentDeaths++;continue}for(const g of z){if(E.has(g.id))continue;const j=Math.hypot(a.x-g.x,a.y-g.y);if(j<12&&(j<10+g.radius&&(a.battery=Math.min(a.maxBattery,a.battery+g.value*a.energyEfficiency),a.energyCollected+=g.value,Le.playFeedSound(440+a.hue%300)),g.type==="MUTAGEN_ORB"&&(a.speed=Math.max(1,Math.min(5,a.speed+(Math.random()-.5)*1.2)),a.visionRadius=Math.max(60,Math.min(260,a.visionRadius+(Math.random()-.5)*40)),a.energyEfficiency=Math.max(.6,Math.min(2.5,a.energyEfficiency+(Math.random()-.5)*.5))),a.battery>=a.maxBattery*.95&&this.microbots.length<this.config.maxPopulation)){let F=!1;const W=[],J=a.visionRadius*a.visionRadius;for(const ne of this.microbots)if(ne.id!==a.id){const S=ne.x-a.x,Y=ne.y-a.y;S*S+Y*Y<=J&&W.push(ne)}for(const ne of W)if(ne.battery>=ne.maxBattery*.8&&bn.getInstance().evaluateMatingCompatibility(a,ne).compatible){a.battery-=45,ne.battery-=45,a.behaviorState="REPRODUCING",ne.behaviorState="REPRODUCING",this.spawnMicrobot(a,ne),F=!0;break}F||(a.battery-=45,a.behaviorState="REPRODUCING",this.spawnMicrobot(a))}}}E.size>0&&(this.energyParticles=this.energyParticles.filter(a=>!E.has(a.id))),k.size>0&&(this.microbots=this.microbots.filter(a=>!k.has(a.id)));const B=new Map;for(const a of this.microbots)a.clusterId&&(B.has(a.clusterId)||B.set(a.clusterId,[]),B.get(a.clusterId).push(a));for(B.forEach(a=>{if(a.length<2)return;let C=0,T=0,A=0;a.forEach(ee=>{C+=ee.vx,T+=ee.vy,A+=ee.battery});const Q=C/a.length,O=T/a.length,X=A/a.length;a.forEach(ee=>{ee.vx=Q,ee.vy=O,ee.battery=X})});this.microbots.length<12;)this.spawnMicrobot();for(let a=this.disasterParticles.length-1;a>=0;a--){const C=this.disasterParticles[a];C.x+=C.vx*i,C.y+=C.vy*i,C.life-=2*i,C.life<=0&&(ei.release(C),this.disasterParticles.splice(a,1))}if(this.frameCount%30===0&&this.updateTelemetryBuffers(),this.frameCount%60===0&&this.recordHistorySnapshot(),this.frameCount%180===0&&this.biomes.length>0&&this.microbots.length>0){const a=this.microbots[Math.floor(Math.random()*this.microbots.length)],C=this.getBiomeAt(a.x,a.y);C&&Le.playBiomeHum(C.type)}}updateTelemetryBuffers(){Rn.getInstance().recordStressFrame(),this.populationHistory.push(this.microbots.length),this.populationHistory.length>30&&this.populationHistory.shift(),this.birthHistory.push(this.recentBirths),this.birthHistory.length>30&&this.birthHistory.shift(),this.deathHistory.push(this.recentDeaths),this.deathHistory.length>30&&this.deathHistory.shift(),this.recentBirths=0,this.recentDeaths=0}recordHistorySnapshot(){const t=this.getStats();this.historyTimeline.push({time:Math.floor(this.frameCount/60),population:t.currentPopulation,avgSpeed:t.avgSpeed,avgVision:t.avgVision,diversity:t.shannonDiversityIndex}),this.historyTimeline.length>60&&this.historyTimeline.shift()}triggerOutbreak(){if(Le.playDisasterSound("VIRUS"),this.microbots.length===0)return;const t=Math.floor(Math.random()*this.microbots.length);this.microbots[t].isInfected=!0,this.microbots[t].infectionTimer=0}getStats(){const t=this.microbots.length;let n=0,r=0,i=0,o=0,s=0;const c=new Array(10).fill(0),u=new Array(10).fill(0),h=new Array(10).fill(0),m=new Array(12).fill(0),v={NORMAL:0,TOXIC_SLUDGE:0,CRYO_ZONE:0,HIGH_G_FIELD:0};for(const w of this.microbots){n+=w.speed,r+=w.visionRadius,i+=w.energyEfficiency,w.isPredator&&o++,w.isInfected&&s++;const B=Math.max(0,Math.min(9,Math.floor((w.speed-1)/4*10)));c[B]++;const p=Math.max(0,Math.min(9,Math.floor((w.visionRadius-60)/200*10)));u[p]++;const f=Math.max(0,Math.min(9,Math.floor((w.energyEfficiency-.6)/1.9*10)));h[f]++;const x=Math.max(0,Math.min(11,Math.floor(w.hue/360*12)));m[x]++;const M=this.getBiomeAt(w.x,w.y);M&&v[M.type]!==void 0?v[M.type]++:v.NORMAL++}let y=0;if(t>0){for(const w of m)if(w>0){const B=w/t;y-=B*Math.log(B)}}this.speciationDiversityBuffer[this.speciationDiversityIndex]=y,this.speciationDiversityIndex=(this.speciationDiversityIndex+1)%100;const E=new Float32Array(100);for(let w=0;w<100;w++){const B=(this.speciationDiversityIndex+w)%100;E[w]=this.speciationDiversityBuffer[B]}const k=Math.min(100,Math.floor(this.seasonFrameCount/this.SEASON_DURATION_FRAMES*100));return{currentPopulation:t,generationCount:this.generationCount,energyParticleCount:this.energyParticles.length,avgSpeed:t>0?n/t:0,avgVision:t>0?r/t:0,avgEfficiency:t>0?i/t:0,totalBirths:this.totalBirths,totalDeaths:this.totalDeaths,predatorCount:o,infectedCount:s,shannonDiversityIndex:parseFloat(y.toFixed(2)),currentSeason:this.config.currentSeason,seasonProgressPct:k,actualTPS:this.actualTPS,populationHistory:[...this.populationHistory],birthHistory:[...this.birthHistory],deathHistory:[...this.deathHistory],stressHistory:Rn.getInstance().getStressHistory(),speedHistogram:c,visionHistogram:u,efficiencyHistogram:h,diversityBuckets:m,biomePopulation:v,historyTimeline:this.historyTimeline,speciationDiversityRingBuffer:E}}}const ed="microbot_evolution_lab_config",ti={startPopulation:45,maxPopulation:250,mutationRate:.15,energySpawnRate:4,maxEnergyParticles:120,hazardCount:3,batteryDrainMultiplier:1,simSpeed:1,targetFPS:60,isPaused:!1,showSensoryRings:!0,showMovementTrails:!0,showTargetVectors:!0,showEnergyForceLines:!0,showSensoryRaycasts:!0,showPheromoneTrails:!0,isSplitView:!1,weatherEvent:"CLEAR",brushMode:"NONE",heatmapMode:"OFF",currentSeason:"SPRING",autoSeasonCycle:!1,enableFrameInterpolation:!0,headlessMode:!1,showTerrainContour:!1,autoDisastersEnabled:!1,disasterScheduleInterval:3600};function $f(){try{const e=localStorage.getItem(ed);if(e){const t=JSON.parse(e),n={...ti};for(const r in t)r in ti&&typeof t[r]==typeof ti[r]&&(n[r]=t[r]);return n.isPaused=!1,n}}catch(e){console.error("Failed to load config from storage:",e)}return{...ti}}function qf(e){try{localStorage.setItem(ed,JSON.stringify(e))}catch(t){console.error("Failed to save config to storage:",t)}}/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var e0={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.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const t0=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),$=(e,t)=>{const n=G.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:o=2,absoluteStrokeWidth:s,className:c="",children:u,...h},m)=>G.createElement("svg",{ref:m,...e0,width:i,height:i,stroke:r,strokeWidth:s?Number(o)*24/Number(i):o,className:["lucide",`lucide-${t0(e)}`,c].join(" "),...h},[...t.map(([v,y])=>G.createElement(v,y)),...Array.isArray(u)?u:[u]]));return n.displayName=`${e}`,n};/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Cl=$("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const td=$("AlertCircle",[["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"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const n0=$("AlertOctagon",[["polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2",key:"h1p8hx"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const or=$("AlertTriangle",[["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-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const r0=$("Award",[["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}],["path",{d:"M15.477 12.89 17 22l-5-3-5 3 1.523-9.11",key:"em7aur"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const i0=$("BatteryCharging",[["path",{d:"M15 7h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1sdynx"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1",key:"1gkd3k"}],["path",{d:"m11 7-3 5h4l-3 5",key:"b4a64w"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const o0=$("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ni=$("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ri=$("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const s0=$("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const l0=$("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const a0=$("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lt=$("Dna",[["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m17 6-2.5-2.5",key:"5cdfhj"}],["path",{d:"m14 8-1-1",key:"15nbz5"}],["path",{d:"m7 18 2.5 2.5",key:"16tu1a"}],["path",{d:"m3.5 14.5.5.5",key:"hapbhd"}],["path",{d:"m20 9 .5.5",key:"1n7z02"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m10 16 1.5 1.5",key:"11lckj"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ms=$("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const c0=$("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nd=$("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rd=$("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const u0=$("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const d0=$("Layers",[["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:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const h0=$("MousePointerClick",[["path",{d:"m9 9 5 12 1.8-5.2L21 14Z",key:"1b76lo"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const f0=$("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const p0=$("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bs=$("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const g0=$("RefreshCw",[["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"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const m0=$("RotateCcw",[["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"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const y0=$("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const El=$("ShieldAlert",[["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"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const x0=$("Skull",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["path",{d:"M8 20v2h8v-2",key:"ded4og"}],["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M16 20a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20",key:"xq9p5u"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v0=$("Sliders",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const id=$("Sparkles",[["path",{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z",key:"17u4zn"}],["path",{d:"M5 3v4",key:"bklmnn"}],["path",{d:"M19 17v4",key:"iiml17"}],["path",{d:"M3 5h4",key:"nem4j1"}],["path",{d:"M17 19h4",key:"lbex7p"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const S0=$("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kl=$("Target",[["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"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const w0=$("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const I0=$("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const C0=$("Wind",[["path",{d:"M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2",key:"1k4u03"}],["path",{d:"M9.6 4.6A2 2 0 1 1 11 8H2",key:"b7d0fd"}],["path",{d:"M12.6 19.4A2 2 0 1 0 14 16H2",key:"1p5cb3"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wt=$("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ml=$("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]),E0=As.memo(({buckets:e,shannonIndex:t=1.8})=>{const n=G.useMemo(()=>Math.max(1,...e),[e]),r=t<.8;return l.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.85)",border:r?"1px solid #f43f5e":"1px solid rgba(0, 229, 255, 0.3)",borderRadius:12,padding:"8px 12px",backdropFilter:"blur(12px)",boxShadow:r?"0 0 15px rgba(244, 63, 94, 0.4)":"0 6px 20px rgba(0,0,0,0.4)",width:175},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4},children:[l.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.62rem",fontWeight:800,color:r?"#f43f5e":"#ffffff",letterSpacing:"0.05em",display:"flex",alignItems:"center",gap:4},children:[r&&l.jsx(td,{style:{width:10,height:10,color:"#f43f5e"}}),"GENETIC DIVERSITY"]}),l.jsxs("span",{style:{fontSize:"0.62rem",fontFamily:"'JetBrains Mono', monospace",color:r?"#f43f5e":"#00E5FF",fontWeight:800},children:["H: ",t.toFixed(2)]})]}),l.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:24,paddingTop:2},children:e.map((i,o)=>{const s=i/n*100,c=Math.round(o/e.length*360);return l.jsx("div",{title:`Group ${o+1}: ${i} bots`,style:{flex:1,height:`${Math.max(15,s)}%`,backgroundColor:`hsl(${c}, 90%, 60%)`,borderRadius:"2px 2px 0 0",transition:"height 0.2s ease",boxShadow:`0 0 4px hsl(${c}, 90%, 60%)`}},o)})})]})}),k0=({config:e,stats:t,onUpdateConfig:n,onReset:r,onStep:i,onOpenRosterMenu:o,onOpenGuide:s,onOpenBlueprintStudio:c,onSpawnFood:u,onSpawnBots:h,onSpawnHazard:m,onTriggerMeteor:v,onTriggerVoidRift:y,onTriggerOutbreak:E,onTriggerRadiationStorm:k,onTriggerMagneticInversion:w,onTriggerSolarFlare:B,onTriggerPortal:p,onExportTelemetryCSV:f,onExportConfigJSON:x,onImportConfigJSON:M})=>{const a=G.useRef(null),C=A=>{var X;const Q=(X=A.target.files)==null?void 0:X[0];if(!Q)return;const O=new FileReader;O.onload=ee=>{var z;try{const L=JSON.parse((z=ee.target)==null?void 0:z.result);M(L)}catch{alert("Invalid JSON preset file!")}},O.readAsText(Q)},T={SPRING:"🌸 Spring",SUMMER:"☀️ Summer",AUTUMN:"🍂 Autumn",WINTER:"❄️ Winter"};return l.jsxs("header",{className:"top-nav-bar",children:[l.jsxs("div",{className:"brand-badge",children:[l.jsx("div",{className:"brand-icon-box",children:l.jsx(l0,{style:{width:22,height:22}})}),l.jsxs("div",{children:[l.jsxs("h1",{className:"brand-title",children:["MICROBOT ",l.jsx("span",{children:"EVOLUTION LAB"})]}),l.jsx("p",{className:"brand-sub",children:"2D Autonomous Artificial Life & Genetic Evolution Engine"})]})]}),l.jsxs("div",{className:"glass-deck-pill",children:[l.jsx("button",{onClick:()=>n({isPaused:!e.isPaused}),className:e.isPaused?"btn-holo btn-holo-green":"btn-holo btn-holo-orange",children:e.isPaused?l.jsxs(l.Fragment,{children:[l.jsx(p0,{style:{width:13,height:13,fill:"currentColor"}}),l.jsx("span",{children:"RESUME"})]}):l.jsxs(l.Fragment,{children:[l.jsx(f0,{style:{width:13,height:13,fill:"currentColor"}}),l.jsx("span",{children:"PAUSE"})]})}),l.jsx("button",{onClick:i,disabled:!e.isPaused,className:"btn-holo btn-holo-dark",style:{opacity:e.isPaused?1:.4},children:"STEP"}),l.jsxs("button",{onClick:r,className:"btn-holo btn-holo-dark",children:[l.jsx(m0,{style:{width:12,height:12}}),l.jsx("span",{children:"RESET"})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginLeft:6,fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E5FF"},children:[l.jsx("span",{style:{fontWeight:800,color:"#ffffff"},children:"SPEED:"}),l.jsx("input",{type:"range",min:"0.01",max:"5.0",step:"0.05",value:e.simSpeed,onChange:A=>n({simSpeed:parseFloat(A.target.value)}),style:{width:70,height:4}}),l.jsxs("span",{style:{fontWeight:800,width:64},children:[e.simSpeed.toFixed(2),"x (",t.actualTPS?t.actualTPS.toFixed(0):0," TPS)"]})]}),l.jsx("div",{style:{display:"flex",alignItems:"center",gap:4,marginLeft:4},children:l.jsxs("select",{value:e.targetFPS||60,onChange:A=>n({targetFPS:parseInt(A.target.value,10)}),style:{background:"#080E14",color:"#00E5FF",fontWeight:800,border:"1px solid rgba(0, 229, 255, 0.4)",borderRadius:6,padding:"2px 4px",fontSize:"0.65rem",cursor:"pointer"},children:[l.jsx("option",{value:"30",children:"30 FPS"}),l.jsx("option",{value:"60",children:"60 FPS"}),l.jsx("option",{value:"120",children:"120 FPS"}),l.jsx("option",{value:"240",children:"MAX FPS"})]})})]}),l.jsxs("div",{className:"glass-deck-pill",children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E676"},children:[l.jsx(C0,{style:{width:12,height:12}}),l.jsxs("select",{value:e.currentSeason||"SPRING",onChange:A=>n({currentSeason:A.target.value}),style:{background:"#080E14",color:"#00E676",fontWeight:800,border:"1px solid rgba(0, 230, 118, 0.4)",borderRadius:6,padding:"3px 6px",fontSize:"0.68rem",cursor:"pointer"},children:[l.jsx("option",{value:"SPRING",children:T.SPRING}),l.jsx("option",{value:"SUMMER",children:T.SUMMER}),l.jsx("option",{value:"AUTUMN",children:T.AUTUMN}),l.jsx("option",{value:"WINTER",children:T.WINTER})]}),l.jsxs("span",{style:{color:"#8B949E",fontSize:"0.62rem"},children:["(",t.seasonProgressPct||0,"%)"]})]}),l.jsxs("button",{onClick:()=>n({showPheromoneTrails:!e.showPheromoneTrails}),className:e.showPheromoneTrails?"btn-holo btn-holo-magenta":"btn-holo btn-holo-dark",style:{fontSize:"0.68rem",padding:"4px 8px"},children:[l.jsx(id,{style:{width:12,height:12}}),l.jsx("span",{children:"PHEROMONES"})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[l.jsx("button",{onClick:()=>Le.toggleMute(),className:Le.getMuted()?"btn-holo btn-holo-dark":"btn-holo btn-holo-cyan",style:{fontSize:"0.68rem",padding:"4px 8px"},title:"Toggle Procedural Spatial Audio",children:l.jsx("span",{children:Le.getMuted()?"🔇 MUTED":"🔊 AUDIO"})}),l.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",defaultValue:.3,onChange:A=>Le.setVolume(parseFloat(A.target.value)),style:{width:50,height:3,accentColor:"#00E5FF"},title:"Master Volume"})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#FF6B00"},children:[l.jsx(S0,{style:{width:12,height:12}}),l.jsxs("select",{value:e.weatherEvent||"CLEAR",onChange:A=>n({weatherEvent:A.target.value}),style:{background:"#080E14",color:"#FF6B00",fontWeight:800,border:"1px solid rgba(255, 107, 0, 0.4)",borderRadius:6,padding:"3px 6px",fontSize:"0.68rem",cursor:"pointer"},children:[l.jsx("option",{value:"CLEAR",children:"☀️ Weather: Clear"}),l.jsx("option",{value:"SOLAR_FLARE",children:"🔥 Solar Flare (+Drain)"}),l.jsx("option",{value:"TOXIC_DRIFT",children:"☣️ Toxic Drift (Hazards)"}),l.jsx("option",{value:"RESOURCE_BLOOM",children:"🌸 Resource Bloom (Food)"})]})]})]}),l.jsxs("div",{className:"glass-deck-pill",children:[l.jsx("button",{onClick:()=>n({autoDisastersEnabled:!e.autoDisastersEnabled}),className:e.autoDisastersEnabled?"btn-holo btn-holo-orange":"btn-holo btn-holo-dark",style:{fontSize:"0.65rem"},title:"Toggle Automated Periodic Disasters",children:l.jsx("span",{children:e.autoDisastersEnabled?"🔥 AUTO-DISASTERS ON":"🔥 AUTO-DISASTERS OFF"})}),l.jsx("button",{onClick:x,className:"btn-holo btn-holo-cyan",title:"Save preset .json",children:l.jsx(Ms,{style:{width:12,height:12}})}),l.jsx("button",{onClick:()=>{var A;return(A=a.current)==null?void 0:A.click()},className:"btn-holo btn-holo-cyan",title:"Load preset .json",children:l.jsx(w0,{style:{width:12,height:12}})}),l.jsx("input",{ref:a,type:"file",accept:".json",onChange:C,style:{display:"none"}}),l.jsxs("button",{onClick:f,className:"btn-holo btn-holo-green",title:"Export CSV Data",children:[l.jsx(Ms,{style:{width:12,height:12}}),l.jsx("span",{children:"CSV"})]}),l.jsxs("button",{onClick:c,className:"btn-holo btn-holo-cyan",children:[l.jsx(Lt,{style:{width:13,height:13}}),l.jsx("span",{children:"BLUEPRINT STUDIO"})]}),l.jsx("button",{onClick:s,className:"btn-holo btn-holo-cyan",children:l.jsx(u0,{style:{width:13,height:13}})}),l.jsxs("button",{onClick:o,className:"btn-holo btn-holo-magenta",children:[l.jsx(kl,{style:{width:13,height:13}}),l.jsx("span",{children:"ROSTER"})]}),l.jsxs("button",{onClick:u,className:"btn-holo btn-holo-green",children:[l.jsx(bs,{style:{width:13,height:13}}),l.jsx("span",{children:"+20 FOOD"})]}),l.jsxs("button",{onClick:h,className:"btn-holo btn-holo-cyan",children:[l.jsx(bs,{style:{width:13,height:13}}),l.jsx("span",{children:"+10 BOTS"})]}),l.jsxs("button",{onClick:m,className:"btn-holo btn-holo-orange",children:[l.jsx(El,{style:{width:13,height:13}}),l.jsx("span",{children:"+HAZARD"})]}),l.jsx("button",{onClick:v,className:"btn-holo btn-holo-orange",title:"Invoke Meteor Strike",children:l.jsx("span",{children:"☄️ METEOR"})}),l.jsx("button",{onClick:p,className:"btn-holo btn-holo-magenta",title:"Spawn Linked Portals",children:l.jsx("span",{children:"🌀 PORTAL"})}),l.jsx("button",{onClick:y,className:"btn-holo btn-holo-magenta",title:"Invoke Gravitational Void Rift",children:l.jsx("span",{children:"🌌 RIFT"})}),l.jsx("button",{onClick:E,className:"btn-holo btn-holo-green",title:"Inject Viral Outbreak",children:l.jsx("span",{children:"☣️ VIRUS"})}),l.jsx("button",{onClick:k,className:"btn-holo btn-holo-orange",title:"Trigger Radiation Storm",children:l.jsx("span",{children:"☢️ STORM"})}),l.jsx("button",{onClick:B,className:"btn-holo btn-holo-orange",title:"Trigger Solar Flare",children:l.jsx("span",{children:"☀️ FLARE"})}),l.jsx("button",{onClick:w,className:"btn-holo btn-holo-magenta",title:"Trigger Magnetic Inversion",children:l.jsx("span",{children:"🧲 INVERT"})})]}),l.jsx(E0,{buckets:t.diversityBuckets||new Array(12).fill(1),shannonIndex:t.shannonDiversityIndex})]})};function M0(e){const t={timestamp:new Date().toISOString(),generation:e.generationCount,speciationThreshold:.4,hybridInfertilityPenalty:1,pheromoneGrid:e.pheromoneGrid?{cols:e.pheromoneGrid.cols,rows:e.pheromoneGrid.rows,bufferLength:e.pheromoneGrid.buffer.length}:null,species:[]},n=new Map;for(const s of e.microbots)s.speciesId&&n.set(s.speciesId,(n.get(s.speciesId)||0)+1);n.forEach((s,c)=>{t.species.push({speciesId:c,population:s})});const r=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=`microbot_speciation_profile_gen${e.generationCount}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}const b0=({config:e,engine:t,onUpdateConfig:n,onExportStateSync:r,onImportStateSync:i,onRunBenchmark:o,onSpawnSpore:s,onExportRunData:c,onExportEpigenetics:u})=>{const[h,m]=G.useState("all");return l.jsxs("div",{className:"glass-panel",style:{padding:"12px 14px"},children:[l.jsxs("div",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.85rem",fontWeight:800,color:"#ffffff",letterSpacing:"0.05em",marginBottom:10,display:"flex",alignItems:"center",gap:6},children:[l.jsx("span",{style:{color:"#00E5FF"},children:"●"})," PARAMETERS & CONTROLS",l.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:6},children:[l.jsx("span",{style:{fontSize:"0.6rem",padding:"2px 6px",borderRadius:4,background:"rgba(244, 63, 94, 0.2)",border:"1px solid rgba(244, 63, 94, 0.4)",color:"#F43F5E",fontWeight:800},children:"🔥 CATACLYSM READY"}),l.jsx("span",{style:{fontSize:"0.6rem",padding:"2px 6px",borderRadius:4,background:"rgba(59, 130, 246, 0.2)",border:"1px solid rgba(59, 130, 246, 0.4)",color:"#3B82F6",fontWeight:800},children:"🌤️ CLIMATE & IMMUNITY"}),l.jsx("span",{style:{fontSize:"0.6rem",padding:"2px 6px",borderRadius:4,background:"rgba(0, 229, 255, 0.2)",border:"1px solid rgba(0, 229, 255, 0.4)",color:"#00E5FF",fontWeight:800},children:"✨ MULTICELLULAR & OPTICAL"}),l.jsx("span",{style:{fontSize:"0.6rem",padding:"2px 6px",borderRadius:4,background:"rgba(250, 204, 21, 0.2)",border:"1px solid rgba(250, 204, 21, 0.4)",color:"#FACC15",fontWeight:800},children:"🌊 QUORUM & HYDRO"}),l.jsxs("select",{value:e.targetFPS||60,onChange:v=>n({targetFPS:parseInt(v.target.value,10)}),style:{background:"#080E14",color:"#00E676",fontWeight:800,border:"1px solid rgba(0, 230, 118, 0.4)",borderRadius:6,padding:"2px 6px",fontSize:"0.62rem",cursor:"pointer"},children:[l.jsx("option",{value:"60",children:"60 FPS (Smooth)"}),l.jsx("option",{value:"30",children:"30 FPS (Balanced)"}),l.jsx("option",{value:"15",children:"15 FPS (Battery Saver)"})]}),l.jsx("span",{style:{fontSize:"0.62rem",color:"#00E676"},children:"⚡ WORKER ON"}),l.jsx("button",{onClick:()=>alert("WASM SIMD Spatial Hashing Engine Active (64KB Shared Memory)"),className:"btn-holo btn-holo-cyan",style:{fontSize:"0.62rem",padding:"2px 6px",display:"flex",alignItems:"center",gap:4},children:"⚡ WASM GRID ON"}),l.jsx("span",{style:{fontSize:"0.62rem",color:"#00E676",border:"1px solid rgba(0,230,118,0.4)",borderRadius:6,padding:"2px 6px",background:"#080E14"},children:"🌿 BIOMES ON"})]})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.6)",borderRadius:10,border:"1px solid rgba(0, 229, 255, 0.2)",padding:"8px 10px"},children:[l.jsxs("div",{className:"accordion-header",onClick:()=>m(h==="pop"?"all":"pop"),style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[l.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#00E5FF",display:"flex",alignItems:"center",gap:6},children:[l.jsx(I0,{style:{width:13,height:13}})," Population Dynamics"]}),h==="pop"||h==="all"?l.jsx(ri,{style:{width:14,height:14,color:"#8B949E"}}):l.jsx(ni,{style:{width:14,height:14,color:"#8B949E"}})]}),(h==="pop"||h==="all")&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,overflow:"hidden",transition:"max-height 0.3s ease, opacity 0.3s ease",maxHeight:600,opacity:1},children:[l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[l.jsxs("div",{children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Start Pop"}),l.jsx("span",{style:{color:"#00E5FF",fontWeight:700},children:e.startPopulation})]}),l.jsx("input",{type:"range",min:"10",max:"150",step:"5",value:e.startPopulation,onChange:v=>n({startPopulation:parseInt(v.target.value,10)}),style:{width:"100%",height:4}})]}),l.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:l.jsx("path",{d:"M 0 14 L 10 10 L 20 12 L 30 6 L 40 4 L 50 8",fill:"none",stroke:"#00E5FF",strokeWidth:"1.5"})})]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[l.jsxs("div",{children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Max Population"}),l.jsx("span",{style:{color:"#00E5FF",fontWeight:700},children:e.maxPopulation})]}),l.jsx("input",{type:"range",min:"50",max:"400",step:"10",value:e.maxPopulation,onChange:v=>n({maxPopulation:parseInt(v.target.value,10)}),style:{width:"100%",height:4}})]}),l.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:l.jsx("path",{d:"M 0 12 L 12 14 L 25 8 L 38 4 L 50 2",fill:"none",stroke:"#00E676",strokeWidth:"1.5"})})]})]})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.6)",borderRadius:10,border:"1px solid rgba(224, 64, 251, 0.2)",padding:"8px 10px"},children:[l.jsxs("div",{className:"accordion-header",onClick:()=>m(h==="gen"?"all":"gen"),style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[l.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#E040FB",display:"flex",alignItems:"center",gap:6},children:[l.jsx(Lt,{style:{width:13,height:13}})," Genetic Dynamics"]}),h==="gen"||h==="all"?l.jsx(ri,{style:{width:14,height:14,color:"#8B949E"}}):l.jsx(ni,{style:{width:14,height:14,color:"#8B949E"}})]}),(h==="gen"||h==="all")&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.jsxs("div",{children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Mutation Tendency"}),l.jsxs("span",{style:{color:"#E040FB",fontWeight:800},children:[(e.mutationRate*100).toFixed(0),"%"]})]}),l.jsx("input",{type:"range",min:"0.01",max:"0.50",step:"0.01",value:e.mutationRate,onChange:v=>n({mutationRate:parseFloat(v.target.value)}),style:{width:"100%",height:4,marginTop:4}})]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Symbiosis & Parasitism"}),l.jsx("span",{style:{color:"#00E5FF",fontWeight:800},children:"ENABLED"})]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[l.jsxs("div",{children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Battery Drain Rate"}),l.jsxs("span",{style:{color:"#E040FB",fontWeight:700},children:[e.batteryDrainMultiplier.toFixed(1),"x"]})]}),l.jsx("input",{type:"range",min:"0.2",max:"3.0",step:"0.1",value:e.batteryDrainMultiplier,onChange:v=>{const y=parseFloat(v.target.value);n({batteryDrainMultiplier:isNaN(y)?1:Math.max(.1,Math.min(5,y))})},style:{width:"100%",height:4}})]}),l.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:l.jsx("path",{d:"M 0 14 L 12 10 L 25 12 L 38 6 L 50 4",fill:"none",stroke:"#E040FB",strokeWidth:"1.5"})})]})]})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.6)",borderRadius:10,border:"1px solid rgba(255, 107, 0, 0.2)",padding:"8px 10px"},children:[l.jsxs("div",{className:"accordion-header",onClick:()=>m(h==="env"?"all":"env"),style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[l.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#FF6B00",display:"flex",alignItems:"center",gap:6},children:[l.jsx(El,{style:{width:13,height:13}})," Environmental Forces"]}),h==="env"||h==="all"?l.jsx(ri,{style:{width:14,height:14,color:"#8B949E"}}):l.jsx(ni,{style:{width:14,height:14,color:"#8B949E"}})]}),(h==="env"||h==="all")&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[l.jsxs("div",{children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Energy Spawn Rate"}),l.jsxs("span",{style:{color:"#FF6B00",fontWeight:700},children:[e.energySpawnRate.toFixed(1),"/s"]})]}),l.jsx("input",{type:"range",min:"0.5",max:"12.0",step:"0.5",value:e.energySpawnRate,onChange:v=>{const y=parseFloat(v.target.value);n({energySpawnRate:isNaN(y)?5:Math.max(.1,Math.min(20,y))})},style:{width:"100%",height:4}})]}),l.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:l.jsx("path",{d:"M 0 12 L 15 14 L 30 6 L 50 2",fill:"none",stroke:"#FF6B00",strokeWidth:"1.5"})})]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 50px",gap:8,alignItems:"center"},children:[l.jsxs("div",{children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Hazard Zones"}),l.jsx("span",{style:{color:"#FF6B00",fontWeight:700},children:e.hazardCount})]}),l.jsx("input",{type:"range",min:"0",max:"12",step:"1",value:e.hazardCount,onChange:v=>n({hazardCount:parseInt(v.target.value,10)}),style:{width:"100%",height:4}})]}),l.jsx("svg",{viewBox:"0 0 50 16",style:{width:50,height:16},children:l.jsx("path",{d:"M 0 14 L 10 10 L 20 12 L 30 4 L 40 10 L 50 6",fill:"none",stroke:"#FF6B00",strokeWidth:"1.5"})})]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginTop:8},children:[l.jsx("span",{children:"Show Terrain Contour"}),l.jsx("button",{onClick:()=>n({showTerrainContour:!e.showTerrainContour}),className:e.showTerrainContour?"btn-holo btn-holo-cyan":"btn-holo btn-holo-dark",style:{padding:"2px 8px"},children:e.showTerrainContour?"ON":"OFF"})]})]})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.6)",borderRadius:10,border:"1px solid rgba(0, 150, 255, 0.2)",padding:"8px 10px"},children:[l.jsxs("div",{className:"accordion-header",onClick:()=>m(h==="sync"?"all":"sync"),style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[l.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#0096FF",display:"flex",alignItems:"center",gap:6},children:[l.jsx(s0,{style:{width:13,height:13}})," Ecosystem Sync"]}),h==="sync"||h==="all"?l.jsx(ri,{style:{width:14,height:14,color:"#8B949E"}}):l.jsx(ni,{style:{width:14,height:14,color:"#8B949E"}})]}),(h==="sync"||h==="all")&&l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("button",{className:"btn-holo btn-holo-cyan",style:{flex:1,justifyContent:"center",fontSize:"0.65rem"},onClick:r,children:"Export State"}),l.jsx("button",{className:"btn-holo btn-holo-magenta",style:{flex:1,justifyContent:"center",fontSize:"0.65rem"},onClick:i,children:"Import State"})]}),l.jsx("button",{className:"btn-holo btn-holo-orange",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem"},onClick:o,children:"Run Diagnostic Benchmark (3000 bots)"}),s&&l.jsx("button",{className:"btn-holo btn-holo-magenta",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem"},onClick:s,children:"Spawn Parasitic Spores"}),c&&l.jsx("button",{className:"btn-holo btn-holo-cyan",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem"},onClick:c,children:"Export Full Run Data (JSON)"}),u&&l.jsx("button",{className:"btn-holo btn-holo-magenta",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem"},onClick:u,children:"Export Epigenetic Profiles (JSON)"}),l.jsxs("button",{onClick:()=>M0(t),className:"btn-holo btn-holo-cyan",style:{width:"100%",justifyContent:"center",fontSize:"0.65rem",display:"flex",alignItems:"center",gap:6},children:[l.jsx(Ms,{size:12}),"Export Speciation Profile"]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginTop:4},children:[l.jsx("span",{children:"Headless Mode (100x Speed)"}),l.jsx("button",{onClick:()=>n({headlessMode:!e.headlessMode}),className:e.headlessMode?"btn-holo btn-holo-cyan":"btn-holo btn-holo-dark",style:{padding:"2px 8px"},children:e.headlessMode?"ON":"OFF"})]})]})]})]})]})},R0=({bot:e,stats:t,onClose:n,onOverrideGenes:r,onOpenLineageModal:i,onOpenCrisprModal:o,onOpenNeuralModal:s})=>{const[c,u]=G.useState("telemetry");if(!e)return l.jsxs("div",{className:"glass-panel",style:{padding:"24px 16px",textAlign:"center"},children:[l.jsx(a0,{style:{width:28,height:28,color:"#00E5FF",margin:"0 auto 8px auto",display:"block"}}),l.jsx("p",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.8rem",color:"#ffffff",fontWeight:800},children:"BOT DATA HUB"}),l.jsxs("p",{style:{fontSize:"0.7rem",color:"#8B949E",marginTop:4},children:["Select any microbot on the canvas grid or click ",l.jsx("strong",{style:{color:"#00E5FF"},children:"SELECT BOT MENU"})," to view real-time telemetry."]})]});const h=Math.max(0,Math.min(100,e.battery/e.maxBattery*100)),m=e.batteryHistory||new Array(30).fill(e.battery),v=Math.max(e.maxBattery,...m),y={WANDERING:{bg:"rgba(30, 41, 59, 0.6)",border:"#334155",text:"#cbd5e1",label:"WANDERING 🧭"},SEEKING_ENERGY:{bg:"rgba(0, 230, 118, 0.2)",border:"#00E676",text:"#00E676",label:"HUNTING FOOD 🍏"},EVADING_HAZARD:{bg:"rgba(255, 107, 0, 0.2)",border:"#FF6B00",text:"#FF6B00",label:"FLEEING HAZARD 💥"},REPRODUCING:{bg:"rgba(224, 64, 251, 0.2)",border:"#E040FB",text:"#E040FB",label:"SEEKING MATE 🧬"}},E=y[e.behaviorState]||y.WANDERING;return l.jsxs("div",{className:"glass-panel",style:{padding:"14px",border:"1px solid rgba(0, 229, 255, 0.4)",boxShadow:"0 0 25px rgba(0, 229, 255, 0.15)"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.battery<25&&l.jsx(td,{style:{width:16,height:16,color:"#FF6B00"}}),l.jsxs("div",{children:[l.jsx("div",{style:{fontFamily:"'JetBrains Mono', monospace",fontWeight:800,fontSize:"0.95rem",color:"#00E5FF"},children:e.id}),l.jsxs("div",{style:{fontSize:"0.65rem",color:"#8B949E",fontFamily:"'JetBrains Mono', monospace"},children:["GEN R",e.generation," • PARENT: ",e.parentId||"ORIGIN"]})]})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[l.jsxs("button",{onClick:i,className:"btn-holo btn-holo-magenta",style:{padding:"4px 8px",fontSize:"0.65rem"},title:"View Family Lineage Tree",children:[l.jsx(rd,{style:{width:12,height:12}}),l.jsx("span",{children:"TREE"})]}),o&&l.jsxs("button",{onClick:o,className:"btn-holo btn-holo-cyan",style:{padding:"4px 8px",fontSize:"0.65rem"},title:"Open CRISPR Editor",children:[l.jsx(Lt,{style:{width:12,height:12}}),l.jsx("span",{children:"CRISPR"})]}),s&&l.jsxs("button",{onClick:s,className:"btn-holo btn-holo-cyan",style:{padding:"4px 8px",fontSize:"0.65rem"},title:"View Neural Brain",children:[l.jsx(Cl,{style:{width:12,height:12}}),l.jsx("span",{children:"NEURAL"})]}),l.jsx("button",{onClick:n,style:{background:"transparent",border:"none",color:"#8B949E",cursor:"pointer",padding:4},title:"Deselect",children:l.jsx(Wt,{style:{width:16,height:16}})})]})]}),l.jsxs("div",{style:{display:"flex",gap:6,marginBottom:10,borderBottom:"1px solid rgba(255, 255, 255, 0.08)",paddingBottom:6},children:[l.jsxs("button",{onClick:()=>u("telemetry"),className:c==="telemetry"?"btn-holo btn-holo-cyan":"btn-holo btn-holo-dark",style:{flex:1,padding:"4px 6px",fontSize:"0.68rem"},children:[l.jsx(v0,{style:{width:12,height:12}})," TELEMETRY"]}),l.jsxs("button",{onClick:()=>u("dna"),className:c==="dna"?"btn-holo btn-holo-magenta":"btn-holo btn-holo-dark",style:{flex:1,padding:"4px 6px",fontSize:"0.68rem"},children:[l.jsx(Lt,{style:{width:12,height:12}})," GENE INSPECTOR"]})]}),c==="telemetry"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{padding:"5px 10px",borderRadius:8,background:E.bg,border:"1px solid "+E.border,color:E.text,fontSize:"0.7rem",fontFamily:"'JetBrains Mono', monospace",fontWeight:800,display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[l.jsx("span",{children:"BEHAVIOR:"}),l.jsx("span",{children:E.label})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)",marginBottom:10},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",marginBottom:4},children:[l.jsxs("span",{style:{color:"#8B949E",display:"flex",alignItems:"center",gap:4},children:[l.jsx(i0,{style:{width:13,height:13,color:"#00E5FF"}})," Battery Charge"]}),l.jsxs("span",{style:{color:"#00E5FF",fontWeight:800},children:[e.battery.toFixed(1)," / ",e.maxBattery.toFixed(0)," (",h.toFixed(0),"%)"]})]}),l.jsx("div",{style:{width:"100%",height:6,background:"#1e293b",borderRadius:3,overflow:"hidden"},children:l.jsx("div",{style:{height:"100%",width:`${h}%`,background:h>40?"linear-gradient(90deg, #00E5FF, #00E676)":h>20?"#FF6B00":"#f43f5e",transition:"width 0.2s ease"}})})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(0, 229, 255, 0.15)",marginBottom:10},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginBottom:4},children:[l.jsx("span",{children:"Battery Charge Trend"}),l.jsx("span",{style:{color:"#00E5FF"},children:"Live"})]}),l.jsx("svg",{viewBox:"0 0 100 24",style:{width:"100%",height:24,overflow:"visible"},children:l.jsx("path",{d:m.map((k,w)=>{const B=w/(m.length-1)*100,p=24-k/v*20;return`${w===0?"M":"L"} ${B} ${p}`}).join(" "),fill:"none",stroke:"#00E5FF",strokeWidth:"1.8"})})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(224, 64, 251, 0.15)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginBottom:6},children:[l.jsx("span",{children:"Speed/Vision/Efficiency"}),l.jsx("span",{style:{color:"#E040FB"},children:"Last Mins"})]}),l.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:32},children:t.speedHistogram.map((k,w)=>{const B=Math.max(1,...t.speedHistogram),p=k/B*100;return l.jsx("div",{style:{flex:1,height:`${Math.max(15,p)}%`,backgroundColor:w<3?"#E040FB":w<7?"#00E5FF":"#00E676",borderRadius:"2px 2px 0 0"}},w)})})]})]}):l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[l.jsx("div",{style:{fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#E040FB",fontWeight:800},children:"REAL-TIME GENETIC OVERRIDES"}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[l.jsx(nd,{style:{width:12,height:12,color:"#00E5FF"}})," Speed"]}),l.jsxs("span",{style:{color:"#00E5FF",fontWeight:800},children:[e.speed.toFixed(2)," px/f"]})]}),l.jsx("input",{type:"range",min:"1.0",max:"5.0",step:"0.1",value:e.speed,onChange:k=>r(e.id,{speed:parseFloat(k.target.value)}),style:{width:"100%",height:4,marginTop:4}})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[l.jsx(c0,{style:{width:12,height:12,color:"#60a5fa"}})," Vision Radius"]}),l.jsxs("span",{style:{color:"#60a5fa",fontWeight:800},children:[e.visionRadius.toFixed(0)," px"]})]}),l.jsx("input",{type:"range",min:"60",max:"260",step:"5",value:e.visionRadius,onChange:k=>r(e.id,{visionRadius:parseInt(k.target.value,10)}),style:{width:"100%",height:4,marginTop:4}})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[l.jsx(Ml,{style:{width:12,height:12,color:"#00E676"}})," Efficiency"]}),l.jsxs("span",{style:{color:"#00E676",fontWeight:800},children:[e.energyEfficiency.toFixed(2),"x"]})]}),l.jsx("input",{type:"range",min:"0.6",max:"2.5",step:"0.1",value:e.energyEfficiency,onChange:k=>r(e.id,{energyEfficiency:parseFloat(k.target.value)}),style:{width:"100%",height:4,marginTop:4}})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",padding:8,borderRadius:8,border:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Color Hue Alignment"}),l.jsxs("span",{style:{color:e.color,fontWeight:800},children:[e.hue.toFixed(0),"°"]})]}),l.jsx("input",{type:"range",min:"0",max:"360",step:"5",value:e.hue,onChange:k=>r(e.id,{hue:parseInt(k.target.value,10)}),style:{width:"100%",height:4,marginTop:4}})]})]})]})},N0=({bots:e})=>{const t=G.useRef(null);return G.useEffect(()=>{const n=t.current;if(!n)return;const r=n.getContext("2d");if(!r)return;let i;const o=()=>{r.fillStyle="#060A10",r.fillRect(0,0,n.width,n.height),r.strokeStyle="rgba(0, 229, 255, 0.1)",r.lineWidth=1;for(let s=0;s<n.width;s+=20)r.beginPath(),r.moveTo(s,0),r.lineTo(s,n.height),r.stroke();for(let s=0;s<n.height;s+=20)r.beginPath(),r.moveTo(0,s),r.lineTo(n.width,s),r.stroke();r.globalCompositeOperation="screen",e.forEach(s=>{const u=10+Math.max(0,Math.min(1,(s.speed-1)/4))*(n.width-20),h=Math.max(0,Math.min(1,(s.energyEfficiency-.6)/1.9)),m=n.height-10-h*(n.height-20),y=3+Math.max(0,Math.min(1,(s.visionRadius-40)/110))*7,E=r.createRadialGradient(u,m,0,u,m,y);E.addColorStop(0,s.color),E.addColorStop(1,"rgba(0,0,0,0)"),r.fillStyle=E,r.beginPath(),r.arc(u,m,y,0,Math.PI*2),r.fill()}),r.globalCompositeOperation="source-over",r.fillStyle="rgba(255,255,255,0.4)",r.font="8px 'JetBrains Mono'",r.fillText("SPEED →",n.width/2-15,n.height-4),r.save(),r.translate(8,n.height/2+25),r.rotate(-Math.PI/2),r.fillText("EFFICIENCY →",0,0),r.restore(),i=requestAnimationFrame(o)};return o(),()=>cancelAnimationFrame(i)},[e]),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.75)",borderRadius:10,border:"1px solid rgba(0, 229, 255, 0.25)",padding:"10px",marginTop:8},children:[l.jsxs("div",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.72rem",fontWeight:800,color:"#00E5FF",display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6},children:[l.jsx(Cl,{style:{width:13,height:13}})," 2D GENETIC DRIFT"]}),l.jsx("span",{style:{color:"#8B949E",fontSize:"0.65rem"},children:"Speed / Eff / Vis"})]}),l.jsx("canvas",{ref:t,width:220,height:150,style:{borderRadius:8,border:"1px solid rgba(0,229,255,0.1)",width:"100%"}})]})};class Oa{static mapGenomeToPhenotype(t){var o,s,c,u;const n=((o=t==null?void 0:t.defenseAllele)==null?void 0:o.baseValue)||1,r=((s=t==null?void 0:t.speedAllele)==null?void 0:s.baseValue)||1,i=((c=t==null?void 0:t.visionAllele)==null?void 0:c.baseValue)||100;return{armorPlatesCount:Math.min(8,Math.max(0,Math.floor(n*2))),armorThickness:Math.min(6,Math.max(1,n*1.5)),thrustFinsLength:Math.min(15,Math.max(3,r*3)),thrustFinsAngle:Math.PI/4,bioluminescentLureGlow:Math.min(1,i/250),lureHue:(((u=t==null?void 0:t.hueAllele)==null?void 0:u.baseValue)||180)%360}}static renderPhenotype(t,n,r){if(t.save(),t.translate(n.x,n.y),t.rotate(n.heading||0),r.thrustFinsLength>0&&(t.fillStyle=n.color||"#00E5FF",t.beginPath(),t.moveTo(-n.radius,-n.radius*.5),t.lineTo(-n.radius-r.thrustFinsLength,-n.radius*.8),t.lineTo(-n.radius-r.thrustFinsLength*.5,0),t.lineTo(-n.radius-r.thrustFinsLength,n.radius*.8),t.lineTo(-n.radius,n.radius*.5),t.fill()),r.armorPlatesCount>0){t.strokeStyle="#94a3b8",t.lineWidth=r.armorThickness;for(let i=0;i<r.armorPlatesCount;i++){const o=i/r.armorPlatesCount*Math.PI*2;t.beginPath(),t.arc(0,0,n.radius+r.armorThickness*.5,o,o+Math.PI/r.armorPlatesCount*.8),t.stroke()}}r.bioluminescentLureGlow>0&&(t.shadowColor=`hsl(${r.lureHue}, 100%, 50%)`,t.shadowBlur=12*r.bioluminescentLureGlow,t.fillStyle=`hsl(${r.lureHue}, 100%, 70%)`,t.beginPath(),t.arc(n.radius+6,0,3*r.bioluminescentLureGlow,0,Math.PI*2),t.fill(),t.shadowBlur=0),t.restore()}}const Fo=({engine:e,onSelectBot:t,onSelectRandomBot:n,onUpdateConfig:r})=>{const i=G.useRef(null),o=G.useRef(null),s=G.useRef(null),c=G.useRef(null),u=G.useRef(null),h=G.useRef(null),m=G.useRef(null),v=G.useRef(!0),y=G.useRef(!1),E=G.useRef(window.devicePixelRatio||1),k=G.useRef(0),[w,B]=As.useState(!1);G.useEffect(()=>{const z=i.current;if(!z)return;const L=()=>{const R=z.getBoundingClientRect(),N=Math.max(600,Math.floor(z.clientWidth||R.width||1e3)),g=Math.max(400,Math.floor(z.clientHeight||R.height||650)),j=o.current;if(j){const F=E.current;j.width=Math.floor(N*F),j.height=Math.floor(g*F),j.style.width=`${N}px`,j.style.height=`${g}px`;const W=j.getContext("2d");W&&W.scale(F,F),e.resize(N,g),v.current=!0}};let U=performance.now();const b=setInterval(()=>{const R=performance.now();if(R-U>=1e3){const N=k.current;k.current=0,U=R,N<30&&E.current>.5?(E.current=Math.max(.5,E.current-.25),L()):N>55&&E.current<(window.devicePixelRatio||1)&&(E.current=Math.min(window.devicePixelRatio||1,E.current+.1),L())}},1e3);L();const d=new ResizeObserver(L);return d.observe(z),()=>{d.disconnect(),clearInterval(b)}},[e]),G.useEffect(()=>{const z=()=>{y.current=!1};return window.addEventListener("mouseup",z),()=>{window.removeEventListener("mouseup",z)}},[]);const p=(z,L)=>{m.current||(m.current=document.createElement("canvas"));const U=m.current;if(U.width!==z||U.height!==L||v.current){U.width=z,U.height=L;const b=U.getContext("2d");if(b){b.clearRect(0,0,z,L);for(const d of e.gravityWells||[]){const R=b.createRadialGradient(d.x,d.y,0,d.x,d.y,d.radius);R.addColorStop(0,"rgba(139, 92, 246, 0.4)"),R.addColorStop(1,"rgba(139, 92, 246, 0)"),b.fillStyle=R,b.beginPath(),b.arc(d.x,d.y,d.radius,0,Math.PI*2),b.fill()}for(const d of e.fluidZones||[]){const R=b.createRadialGradient(d.x,d.y,0,d.x,d.y,d.radius);R.addColorStop(0,d.isNonNewtonian?"rgba(59, 130, 246, 0.3)":"rgba(14, 165, 233, 0.3)"),R.addColorStop(1,"rgba(14, 165, 233, 0)"),b.fillStyle=R,b.beginPath(),b.arc(d.x,d.y,d.radius,0,Math.PI*2),b.fill()}for(const d of e.catalystZones||[]){const R=b.createRadialGradient(d.x,d.y,0,d.x,d.y,d.radius);R.addColorStop(0,d.mutationDirection>0?"rgba(34, 197, 94, 0.3)":"rgba(239, 68, 68, 0.3)"),R.addColorStop(1,"rgba(34, 197, 94, 0)"),b.fillStyle=R,b.beginPath(),b.arc(d.x,d.y,d.radius,0,Math.PI*2),b.fill()}}}return U},f=(z,L)=>{s.current||(s.current=document.createElement("canvas"));const U=s.current;U.width=z,U.height=L;const b=U.getContext("2d");if(!b)return U;b.fillStyle="#080E14",b.fillRect(0,0,z,L),b.strokeStyle="rgba(0, 229, 255, 0.05)",b.lineWidth=1;const d=40;for(let N=0;N<z;N+=d)b.beginPath(),b.moveTo(N,0),b.lineTo(N,L),b.stroke();for(let N=0;N<L;N+=d)b.beginPath(),b.moveTo(0,N),b.lineTo(z,N),b.stroke();b.strokeStyle="rgba(0, 229, 255, 0.08)";const R=60;for(let N=0;N<z;N+=R)b.beginPath(),b.moveTo(N,0),b.lineTo(N,L),b.stroke();for(let N=0;N<L;N+=R)b.beginPath(),b.moveTo(0,N),b.lineTo(z,N),b.stroke();if(e&&e.biomes)for(const N of e.biomes)N.color!=="rgba(255,255,255,0)"&&(b.fillStyle=N.color,b.fillRect(N.x,N.y,N.width,N.height)),b.strokeStyle="rgba(0, 229, 255, 0.15)",b.lineWidth=1,b.strokeRect(N.x,N.y,N.width,N.height),b.fillStyle="rgba(255, 255, 255, 0.1)",b.font="8px 'JetBrains Mono', monospace",b.fillText(N.type.replace(/_/g," "),N.x+8,N.y+16);if(e&&e.config.showTerrainContour){b.fillStyle="rgba(0, 229, 255, 0.05)";const N=10;for(let g=0;g<L;g+=N)for(let j=0;j<z;j+=N){const F=e.getElevation(j,g);F>.3&&F<.32&&b.fillRect(j,g,N,N),F>.6&&F<.62&&b.fillRect(j,g,N,N),F>.8&&F<.82&&b.fillRect(j,g,N,N)}}return v.current=!1,U},x=(z,L)=>{h.current||(h.current=document.createElement("canvas"));const U=h.current;(U.width!==z||U.height!==L)&&(U.width=z,U.height=L);const b=U.getContext("2d");if(b&&e.pheromoneGrid){b.clearRect(0,0,z,L),b.fillStyle="rgba(255, 107, 0, 0.8)";const d=e.pheromoneGrid,R=d.buffer,N=d.cols,g=10;for(let j=0;j<R.length;j++){const F=R[j];if(F>.05){const W=Math.floor(j/N),J=j%N;b.globalAlpha=Math.min(1,F*.5),b.fillRect(J*g,W*g,g,g)}}b.globalAlpha=1}return U};G.useEffect(()=>{let z,L=performance.now();const U=()=>{const b=o.current;if(b){const d=b.getContext("2d");if(d){if(k.current++,document.hidden){z=requestAnimationFrame(U);return}const R=performance.now();let N=(R-L)/(1e3/(e.config.targetFPS||60));if(N>3&&(N=3),L=R,e.config.headlessMode){for(let S=0;S<100;S++)e.update(N);d.fillStyle="#080E14",d.fillRect(0,0,b.width,b.height),d.font="800 16px 'JetBrains Mono', monospace",d.fillStyle="#00E5FF",d.textAlign="center",d.fillText("HEADLESS MODE ACTIVE (100x SPEED)",b.width/2,b.height/2),d.font="800 10px 'JetBrains Mono', monospace",d.fillStyle="#8B949E",d.fillText(`Generation ${e.generationCount} | Pop: ${e.microbots.length}`,b.width/2,b.height/2+20),z=requestAnimationFrame(U);return}e.update(N),(v.current||!s.current)&&f(b.width,b.height),c.current?(c.current.width!==b.width||c.current.height!==b.height)&&(c.current.width=b.width,c.current.height=b.height):(c.current=document.createElement("canvas"),c.current.width=b.width,c.current.height=b.height);const g=c.current.getContext("2d");g&&(g.fillStyle="rgba(8, 14, 20, 0.25)",g.fillRect(0,0,b.width,b.height)),d.clearRect(0,0,b.width,b.height),d.drawImage(s.current,0,0);const j=p(b.width,b.height);d.drawImage(j,0,0),e.config.enableFrameInterpolation&&d.drawImage(c.current,0,0);const F=e.config.heatmapMode||"OFF";if(F!=="OFF"){const D=b.width/20,H=b.height/15;for(let _=0;_<20;_++)for(let Z=0;Z<15;Z++){const de=_*D+D/2,je=Z*H+H/2;let Qe=0,at="255, 107, 0";if(F==="MORTALITY"){at="244, 63, 94";for(const he of e.hazards)Math.hypot(de-he.x,je-he.y)<he.radius*1.5&&(Qe+=.35)}else if(F==="FOOD_DENSITY"){at="0, 230, 118";for(const he of e.energyParticles)Math.hypot(de-he.x,je-he.y)<100&&(Qe+=.25)}else if(F==="TRAFFIC"){at="0, 229, 255";for(const he of e.microbots)Math.hypot(de-he.x,je-he.y)<120&&(Qe+=.2)}Qe=Math.min(.65,Qe),Qe>.05&&(d.fillStyle=`rgba(${at}, ${Qe})`,d.fillRect(_*D,Z*H,D,H))}}const W=b.width*.5,J=b.height*.5;if(d.save(),d.globalAlpha=.08,d.fillStyle="#16a34a",d.fillRect(0,0,W,J),d.fillStyle="#dc2626",d.fillRect(W,0,W,J),d.fillStyle="#ea580c",d.fillRect(0,J,W,J),d.fillStyle="#0284c7",d.fillRect(W,J,W,J),d.restore(),e.config.showPheromoneTrails&&e.chemicalGrid){u.current||(u.current=document.createElement("canvas")),(u.current.width!==b.width||u.current.height!==b.height)&&(u.current.width=b.width,u.current.height=b.height);const S=u.current.getContext("2d");if(S){S.clearRect(0,0,b.width,b.height),S.fillStyle="#00E676";const Y=e.chemicalGrid,D=Y.buffer,H=Y.cols,_=Y.resolution;for(let Z=0;Z<D.length;Z++){const de=D[Z];if(de>.05){const je=Math.floor(Z/H),Qe=Z%H;S.globalAlpha=de*.8,S.fillRect(Qe*_,je*_,_,_)}}S.globalAlpha=1,d.drawImage(u.current,0,0)}}if(e.config.showPheromoneTrails&&e.pheromoneGrid){const S=x(b.width,b.height);d.drawImage(S,0,0)}d.strokeStyle="rgba(0, 229, 255, 0.12)",d.lineWidth=1.5;for(let S=50;S<b.height;S+=120)d.beginPath(),d.moveTo(0,S),d.lineTo(b.width,S+Math.sin(S+Date.now()*.002)*15),d.stroke();for(const S of e.speedFields){const Y=d.createRadialGradient(S.x,S.y,5,S.x,S.y,S.radius);Y.addColorStop(0,"rgba(0, 229, 255, 0.3)"),Y.addColorStop(1,"rgba(0, 229, 255, 0)"),d.fillStyle=Y,d.beginPath(),d.arc(S.x,S.y,S.radius,0,Math.PI*2),d.fill(),d.strokeStyle="rgba(0, 229, 255, 0.5)",d.lineWidth=1,d.beginPath(),d.arc(S.x,S.y,S.radius,0,Math.PI*2),d.stroke()}if(e.spores){d.fillStyle="#E040FB";for(const S of e.spores)S.hostId||(d.beginPath(),d.arc(S.x,S.y,S.radius,0,Math.PI*2),d.fill(),d.shadowBlur=10,d.shadowColor="#E040FB",d.stroke(),d.shadowBlur=0)}for(const S of e.portals){const Y=Date.now()/300,D=d.createRadialGradient(S.x,S.y,2,S.x,S.y,S.radius);D.addColorStop(0,"rgba(217, 70, 239, 0.8)"),D.addColorStop(.5,"rgba(139, 92, 246, 0.4)"),D.addColorStop(1,"rgba(139, 92, 246, 0)"),d.fillStyle=D,d.beginPath(),d.arc(S.x,S.y,S.radius,0,Math.PI*2),d.fill(),d.strokeStyle="rgba(217, 70, 239, 0.9)",d.lineWidth=2,d.beginPath(),d.arc(S.x,S.y,S.radius*.8,Y,Y+Math.PI),d.stroke(),d.strokeStyle="rgba(139, 92, 246, 0.9)",d.beginPath(),d.arc(S.x,S.y,S.radius*.6,-Y,-Y+Math.PI),d.stroke(),d.font="800 10px 'JetBrains Mono', monospace",d.fillStyle="#d946ef",d.textAlign="center",d.fillText("PORTAL",S.x,S.y-S.radius-5)}g&&e.config.enableFrameInterpolation&&g.drawImage(b,0,0);for(const S of e.hazards){const Y=Math.sin(Date.now()/350)*4,D=Math.max(10,S.radius+Y),H=d.createRadialGradient(S.x,S.y,5,S.x,S.y,D);H.addColorStop(0,"rgba(255, 107, 0, 0.35)"),H.addColorStop(.7,"rgba(255, 107, 0, 0.15)"),H.addColorStop(1,"rgba(255, 107, 0, 0)"),d.fillStyle=H,d.beginPath(),d.arc(S.x,S.y,D,0,Math.PI*2),d.fill(),d.strokeStyle="rgba(255, 107, 0, 0.6)",d.lineWidth=1.5,d.setLineDash([6,6]),d.beginPath(),d.arc(S.x,S.y,S.radius,0,Math.PI*2),d.stroke(),d.setLineDash([]),d.font="800 9px 'JetBrains Mono', monospace",d.fillStyle="rgba(255, 107, 0, 0.8)",d.textAlign="center",d.fillText(S.id,S.x,S.y+3)}for(const S of e.energyParticles){if(d.shadowColor=S.color,d.shadowBlur=10,d.fillStyle=S.color,d.beginPath(),d.arc(S.x,S.y,S.radius,0,Math.PI*2),d.fill(),S.type==="SUPER_CHARGER")d.strokeStyle="#ffffff",d.lineWidth=1,d.stroke();else if(S.type==="MUTAGEN_ORB"){const Y=S.radius+Math.sin(Date.now()/150)*2;d.strokeStyle="#E040FB",d.lineWidth=1.2,d.beginPath(),d.arc(S.x,S.y,Y,0,Math.PI*2),d.stroke()}d.shadowBlur=0}for(const S of e.disasterParticles)d.fillStyle=S.color,d.globalAlpha=S.life/150,d.beginPath(),d.arc(S.x,S.y,2+S.life/50,0,Math.PI*2),d.fill();if(d.globalAlpha=1,e.config.showEnergyForceLines){d.lineWidth=1;for(const S of e.microbots){const Y=e.spatialGrid.getNearby(S.x,S.y,S.visionRadius);for(const D of Y){const H=Math.hypot(S.x-D.x,S.y-D.y);if(H<=S.visionRadius){const _=(1-H/S.visionRadius)*.45;d.strokeStyle=D.type==="MUTAGEN_ORB"?`rgba(224, 64, 251, ${_})`:D.type==="SUPER_CHARGER"?`rgba(0, 229, 255, ${_})`:`rgba(0, 230, 118, ${_})`,d.beginPath(),d.moveTo(S.x,S.y),d.quadraticCurveTo((S.x+D.x)/2+Math.sin(Date.now()/200+S.x)*10,(S.y+D.y)/2+Math.cos(Date.now()/200+S.y)*10,D.x,D.y),d.stroke()}}}}const ne=e.getSelectedMicrobot();for(const S of e.microbots){const Y=ne&&ne.id===S.id;if(S.boundTo&&S.boundTo.length>0){d.save(),d.lineWidth=3,d.strokeStyle="rgba(0, 255, 128, 0.6)",d.lineCap="round",d.beginPath();for(const at of S.boundTo){const he=e.microbots.find(Se=>Se.id===at);he&&he.id>S.id&&(d.moveTo(S.x,S.y),d.lineTo(he.x,he.y))}d.stroke(),d.restore()}if(e.config.showSensoryRaycasts||Y){const he=Math.PI*.8,Se=S.heading-he/2;for(let fe=0;fe<8;fe++){const Zt=Se+fe/7*he;let no="rgba(0, 229, 255, 0.15)",hn=S.visionRadius;for(const et of e.energyParticles){const Zn=Math.hypot(S.x-et.x,S.y-et.y);if(Zn<S.visionRadius){const ro=Math.atan2(et.y-S.y,et.x-S.x);Math.abs(ro-Zt)<.25&&(no=et.color,hn=Math.min(hn,Zn))}}for(const et of e.hazards){const Zn=Math.hypot(S.x-et.x,S.y-et.y);if(Zn<S.visionRadius+et.radius){const ro=Math.atan2(et.y-S.y,et.x-S.x);Math.abs(ro-Zt)<.3&&(no="rgba(255, 107, 0, 0.7)",hn=Math.min(hn,Zn))}}const od=S.x+Math.cos(Zt)*hn,sd=S.y+Math.sin(Zt)*hn;d.strokeStyle=no,d.lineWidth=Y?1.5:1,d.beginPath(),d.moveTo(S.x,S.y),d.lineTo(od,sd),d.stroke()}}if(e.config.showMovementTrails&&S.trail.length>1){const at=S.genome&&Object.values(S.genome).some(fe=>fe.state==="DECAYING"),he=S.genome&&Object.values(S.genome).some(fe=>fe.state==="ENTANGLED"),Se=S.trail.length;Se>1&&(d.lineCap="round",d.lineJoin="round");for(let fe=1;fe<Se;fe++){const Zt=Math.pow(fe/Se,2)*.7;at?(d.strokeStyle=fe%2===0?"#f43f5e":S.color,d.lineWidth=1.5+fe/Se*2,d.setLineDash([2,4])):he?(d.strokeStyle="#E040FB",d.lineWidth=1.5+fe/Se*2,d.setLineDash([4,2])):(d.strokeStyle=S.color,d.lineWidth=1.5+fe/Se*2.5,d.setLineDash([]),d.shadowColor=S.color,d.shadowBlur=4),d.globalAlpha=Zt,d.shadowBlur=S.organelles&&S.organelles.length>0?22+fe/Se*14:18+fe/Se*12,d.shadowColor=d.strokeStyle,d.beginPath(),d.moveTo(S.trail[fe-1].x,S.trail[fe-1].y),d.lineTo(S.trail[fe].x,S.trail[fe].y),d.stroke(),d.globalAlpha=Zt*.6,d.shadowBlur=4,d.shadowColor="#ffffff",d.lineWidth=1,d.strokeStyle="#ffffff",d.stroke()}d.setLineDash([]),d.shadowBlur=0,d.globalAlpha=1}const D=14;d.strokeStyle=S.color,d.lineWidth=1.2,d.globalAlpha=.5,d.beginPath(),d.moveTo(S.x,S.y),d.lineTo(S.x+Math.cos(S.heading)*D,S.y+Math.sin(S.heading)*D),d.stroke(),d.globalAlpha=1,(Y||e.config.showSensoryRings)&&(d.strokeStyle=Y?S.isPredator?"#f43f5e":"#00E5FF":"rgba(0, 229, 255, 0.12)",d.lineWidth=Y?1.5:.8,d.beginPath(),d.arc(S.x,S.y,S.visionRadius,0,Math.PI*2),d.stroke());const H=Oa.mapGenomeToPhenotype(S.genome);Oa.renderPhenotype(d,S,H),d.save(),d.translate(S.x,S.y),d.rotate(S.heading),d.shadowColor=S.color,d.shadowBlur=Y?20:10,d.fillStyle=S.color,d.beginPath(),d.moveTo(10,0),d.lineTo(-8,-6),d.lineTo(-4,0),d.lineTo(-8,6),d.closePath(),d.fill(),S.isPredator&&(d.strokeStyle="#f43f5e",d.lineWidth=1.5,d.beginPath(),d.moveTo(8,-4),d.lineTo(14,-7),d.moveTo(8,4),d.lineTo(14,7),d.stroke()),d.fillStyle="#ffffff",d.beginPath(),d.arc(6,0,2,0,Math.PI*2),d.fill(),d.shadowBlur=0,d.restore();const _=Math.max(0,Math.min(1,S.battery/S.maxBattery)),Z=20,de=3,je=S.x-Z/2,Qe=S.y-14;if(d.fillStyle="rgba(0, 0, 0, 0.7)",d.fillRect(je,Qe,Z,de),d.fillStyle=_>.4?"#00E676":_>.2?"#FF6B00":"#f43f5e",d.fillRect(je,Qe,Z*_,de),Y){const he=18+Math.sin(Date.now()/200)*3;d.strokeStyle=S.isPredator?"#f43f5e":"#00E5FF",d.lineWidth=2,d.beginPath(),d.arc(S.x,S.y,he,0,Math.PI*2),d.stroke();const Se=S.behaviorState==="HUNTING_PREY"?"Predator Hunting ⚔️":S.behaviorState==="SEEKING_ENERGY"?"Hunting Food 🍏":S.behaviorState==="EVADING_HAZARD"?"Fleeing Hazard 💥":S.behaviorState==="REPRODUCING"?"Seeking Mate 🧬":"Wandering 🧭";d.font="800 11px 'JetBrains Mono', monospace",d.fillStyle=S.isPredator?"#f43f5e":"#00E5FF",d.textAlign="center",d.fillText(`★ ${S.id} (${Se})`,S.x,S.y-22)}}}if(d&&e.cataclysmManager&&e.cataclysmManager.getActiveEvent()){const R=e.cataclysmManager.getActiveEvent();R&&R.type==="TECTONIC_INVERSION"?(d.save(),d.fillStyle="rgba(255, 107, 0, 0.08)",d.fillRect(0,0,b.width,b.height),d.restore()):R&&R.type==="SOLAR_STORM"&&(d.save(),d.fillStyle="rgba(224, 64, 251, 0.08)",d.fillRect(0,0,b.width,b.height),d.restore())}if(d&&e.atmosphereManager){const R=e.atmosphereManager.currentCondition.weather;R==="HEATWAVE"?(d.save(),d.fillStyle="rgba(245, 158, 11, 0.05)",d.fillRect(0,0,b.width,b.height),d.restore()):R==="GLACIAL_BLIZZARD"&&(d.save(),d.fillStyle="rgba(147, 197, 253, 0.06)",d.fillRect(0,0,b.width,b.height),d.restore())}if(d&&e.multicellularManager&&e.multicellularManager.bindings.length>0){d.save(),d.strokeStyle="rgba(0, 229, 255, 0.4)",d.lineWidth=1.5,d.beginPath();for(const R of e.multicellularManager.bindings){const N=e.microbots.find(j=>j.id===R.cellId),g=e.microbots.find(j=>j.id===R.partnerId);N&&g&&R.integrity>0&&(d.moveTo(N.x,N.y),d.lineTo(g.x,g.y))}d.stroke(),d.restore()}if(d&&e.fluidField){d.save(),d.strokeStyle="rgba(56, 189, 248, 0.12)",d.lineWidth=1,d.beginPath();const R=e.fluidField.cellSize*2;for(let N=R/2;N<e.height;N+=R)for(let g=R/2;g<e.width;g+=R){const j=e.fluidField.getVelocity(g,N);Math.hypot(j.vx,j.vy)>.05&&(d.moveTo(g,N),d.lineTo(g+j.vx*15,N+j.vy*15))}d.stroke(),d.restore()}}z=requestAnimationFrame(U)};return U(),()=>cancelAnimationFrame(z)},[e]);const M=z=>{const L=o.current;if(!L)return;const U=L.getBoundingClientRect(),b=z.clientX-U.left,d=z.clientY-U.top,R=e.config.brushMode||"NONE";if(R==="PAINT_FOOD")e.spawnFood(b,d);else if(R==="PAINT_HAZARD")e.spawnHazard(b,d);else if(R==="PAINT_SPEED_FIELD")e.spawnSpeedField(b,d);else{let N=null,g=28;for(const j of e.microbots){const F=Math.hypot(j.x-b,j.y-d);F<g&&(g=F,N=j)}if(N)t(N.id);else for(let j=0;j<5;j++)e.spawnFood(b+(Math.random()-.5)*20,d+(Math.random()-.5)*20)}},a=G.useRef(null),C=(z,L=!1)=>{z.cancelable&&z.preventDefault();const U=o.current;if(U){if(z.touches.length===2){const b=z.touches[0],d=z.touches[1],R=Math.hypot(b.clientX-d.clientX,b.clientY-d.clientY);if(a.current&&L){const N=R-a.current;Math.abs(N)>2&&(E.current=Math.max(.1,Math.min(3,E.current+N*.008)))}a.current=R;return}if(a.current=null,z.touches.length===1){const b=U.getBoundingClientRect(),d=z.touches[0].clientX-b.left,R=z.touches[0].clientY-b.top,N=e.config.brushMode||"NONE";if(N==="PAINT_FOOD")e.spawnFood(d,R),!L&&navigator.vibrate&&navigator.vibrate(10);else if(N==="PAINT_HAZARD")e.spawnHazard(d,R),!L&&navigator.vibrate&&navigator.vibrate([15,30,15]);else if(N==="PAINT_SPEED_FIELD")e.spawnSpeedField(d,R),!L&&navigator.vibrate&&navigator.vibrate(15);else if(!L){let g=null,j=35;for(const F of e.microbots){const W=Math.hypot(F.x-d,F.y-R);W<j&&(j=W,g=F)}if(g)t(g.id),navigator.vibrate&&navigator.vibrate(20);else{for(let F=0;F<5;F++)e.spawnFood(d+(Math.random()-.5)*20,R+(Math.random()-.5)*20);navigator.vibrate&&navigator.vibrate(10)}}}}},T=e.getSelectedMicrobot(),A=e.config.brushMode||"NONE",Q=e.config.heatmapMode||"OFF",O=e.microbots.length<15,X=e.activeDisasters.some(z=>z.type==="RADIATION_STORM"),ee=e.activeDisasters.some(z=>z.type==="MAGNETIC_INVERSION");return l.jsxs("div",{ref:i,className:"canvas-viewport-card",style:{width:"100%",height:"100%"},children:[O&&l.jsxs("div",{style:{position:"absolute",top:60,left:"50%",transform:"translateX(-50%)",zIndex:22,display:"flex",alignItems:"center",gap:8,padding:"6px 18px",background:"rgba(244, 63, 94, 0.85)",border:"1px solid #f43f5e",borderRadius:12,color:"#ffffff",fontFamily:"'JetBrains Mono', monospace",fontSize:"0.75rem",fontWeight:800,boxShadow:"0 0 25px rgba(244, 63, 94, 0.5)",pointerEvents:"none"},children:[l.jsx(or,{style:{width:14,height:14}}),l.jsx("span",{children:"⚠️ EXTINCTION CRISIS ALERT: POPULATION BELOW 15 BOTS! RECOVERY INITIATED"})]}),X&&l.jsxs("div",{style:{position:"absolute",top:96,left:"50%",transform:"translateX(-50%)",zIndex:22,display:"flex",alignItems:"center",gap:8,padding:"6px 18px",background:"rgba(245, 158, 11, 0.85)",border:"1px solid #f59e0b",borderRadius:12,color:"#ffffff",fontFamily:"'JetBrains Mono', monospace",fontSize:"0.75rem",fontWeight:800,boxShadow:"0 0 25px rgba(245, 158, 11, 0.5)",pointerEvents:"none"},children:[l.jsx(or,{style:{width:14,height:14}}),l.jsx("span",{children:"☢️ GLOBAL RADIATION STORM ACTIVE: MUTATION RATES INCREASED"})]}),ee&&l.jsxs("div",{style:{position:"absolute",top:132,left:"50%",transform:"translateX(-50%)",zIndex:22,display:"flex",alignItems:"center",gap:8,padding:"6px 18px",background:"rgba(217, 70, 239, 0.85)",border:"1px solid #d946ef",borderRadius:12,color:"#ffffff",fontFamily:"'JetBrains Mono', monospace",fontSize:"0.75rem",fontWeight:800,boxShadow:"0 0 25px rgba(217, 70, 239, 0.5)",pointerEvents:"none"},children:[l.jsx(or,{style:{width:14,height:14}}),l.jsx("span",{children:"🧲 POLARITY INVERSION: ALL HEADINGS REVERSED"})]}),l.jsxs("div",{style:{position:"absolute",top:14,left:"50%",transform:"translateX(-50%)",zIndex:20,display:"flex",alignItems:"center",gap:12,padding:"6px 16px",background:"rgba(15, 26, 36, 0.85)",border:"1px solid rgba(0, 229, 255, 0.35)",borderRadius:20,backdropFilter:"blur(12px)",boxShadow:"0 8px 24px rgba(0,0,0,0.5)",pointerEvents:"auto"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[l.jsx("div",{style:{width:10,height:10,borderRadius:"50%",backgroundColor:T?T.color:"#00E5FF",boxShadow:"0 0 10px "+(T?T.color:"#00E5FF")}}),l.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.8rem",fontWeight:800,color:"#ffffff"},children:["TRACKING: ",T?T.id:"SEARCHING..."]})]}),l.jsxs("button",{onClick:n,className:"btn-holo btn-holo-cyan",style:{padding:"4px 10px",fontSize:"0.68rem"},children:[l.jsx(kl,{style:{width:12,height:12}}),l.jsx("span",{children:"SWITCH BOT"})]})]}),l.jsxs("div",{style:{position:"absolute",top:14,right:14,zIndex:20,display:"flex",alignItems:"center",gap:6,padding:"4px 8px",background:"rgba(15, 26, 36, 0.85)",border:"1px solid rgba(0, 229, 255, 0.3)",borderRadius:10,backdropFilter:"blur(12px)"},children:[l.jsxs("span",{style:{fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",display:"flex",alignItems:"center",gap:4},children:[l.jsx(d0,{style:{width:12,height:12}})," HEATMAP:"]}),l.jsxs("select",{value:Q,onChange:z=>r({heatmapMode:z.target.value}),style:{background:"#080E14",color:"#00E5FF",fontWeight:800,border:"1px solid rgba(0, 229, 255, 0.4)",borderRadius:6,padding:"2px 6px",fontSize:"0.65rem",cursor:"pointer"},children:[l.jsx("option",{value:"OFF",children:"Off"}),l.jsx("option",{value:"MORTALITY",children:"🔴 Mortality"}),l.jsx("option",{value:"FOOD_DENSITY",children:"🟢 Food Density"}),l.jsx("option",{value:"TRAFFIC",children:"🔵 Traffic Pathing"})]})]}),l.jsxs("div",{style:{position:"absolute",top:14,left:14,zIndex:20,display:"flex",alignItems:"center",gap:6,padding:"4px 8px",background:"rgba(15, 26, 36, 0.85)",border:"1px solid rgba(0, 229, 255, 0.3)",borderRadius:10,backdropFilter:"blur(12px)"},children:[l.jsx("span",{style:{fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:"BRUSH:"}),l.jsxs("button",{onClick:()=>r({brushMode:A==="PAINT_FOOD"?"NONE":"PAINT_FOOD"}),className:A==="PAINT_FOOD"?"btn-holo btn-holo-green":"btn-holo btn-holo-dark",style:{padding:"3px 6px",fontSize:"0.65rem"},children:[l.jsx(Ml,{style:{width:10,height:10}})," FOOD"]}),l.jsxs("button",{onClick:()=>e.spawnFood(void 0,void 0,"MUTAGEN_ORB"),className:"btn-holo btn-holo-magenta",style:{padding:"3px 6px",fontSize:"0.65rem"},title:"Spawn Mutagen Orb",children:[l.jsx(Lt,{style:{width:10,height:10}})," MUTAGEN"]}),l.jsxs("button",{onClick:()=>r({brushMode:A==="PAINT_HAZARD"?"NONE":"PAINT_HAZARD"}),className:A==="PAINT_HAZARD"?"btn-holo btn-holo-orange":"btn-holo btn-holo-dark",style:{padding:"3px 6px",fontSize:"0.65rem"},children:[l.jsx(El,{style:{width:10,height:10}})," HAZARD"]}),l.jsxs("button",{onClick:()=>r({brushMode:A==="PAINT_SPEED_FIELD"?"NONE":"PAINT_SPEED_FIELD"}),className:A==="PAINT_SPEED_FIELD"?"btn-holo btn-holo-cyan":"btn-holo btn-holo-dark",style:{padding:"3px 6px",fontSize:"0.65rem"},children:[l.jsx(id,{style:{width:10,height:10}})," SPEED FIELD"]})]}),l.jsx("canvas",{ref:o,onMouseDown:z=>{y.current=!0,M(z)},onMouseMove:z=>{y.current&&M(z)},onMouseUp:()=>{y.current=!1},onTouchStart:z=>C(z,!1),onTouchMove:z=>C(z,!0),onTouchEnd:()=>{a.current=null},onWheel:z=>{z.cancelable&&z.preventDefault();const L=-z.deltaY;E.current=Math.max(.1,Math.min(3,E.current+L*.001))},style:{display:"block",width:"100%",height:"100%",cursor:A!=="NONE"?"cell":"crosshair",touchAction:"none"}}),w&&l.jsxs("div",{style:{position:"absolute",inset:0,zIndex:50,background:"rgba(8, 14, 20, 0.92)",backdropFilter:"blur(12px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#F0F6FC",gap:12},children:[l.jsx(or,{style:{width:48,height:48,color:"#FF6B00"}}),l.jsx("div",{style:{fontSize:"1.1rem",fontWeight:600},children:"Render Context or WASM Interrupted"}),l.jsx("div",{style:{fontSize:"0.85rem",color:"#8B949E"},children:"Zero-Failure Guardrails active. Click below to recover render and WASM pipeline."}),l.jsx("button",{onClick:()=>B(!1),style:{padding:"8px 20px",background:"#00E5FF",color:"#080E14",fontWeight:700,borderRadius:6,border:"none",cursor:"pointer"},children:"Recover Quorum & Hydrodynamics Pipeline"})]}),l.jsxs("div",{style:{position:"absolute",bottom:14,left:14,zIndex:20,background:"rgba(15, 26, 36, 0.75)",padding:"5px 12px",borderRadius:8,border:"1px solid rgba(255, 255, 255, 0.1)",fontSize:"0.7rem",color:"#8B949E",display:"flex",alignItems:"center",gap:6,pointerEvents:"none",fontFamily:"'JetBrains Mono', monospace"},children:[l.jsx(h0,{style:{width:14,height:14,color:"#00E676"}}),l.jsx("span",{children:A==="PAINT_FOOD"?"Click or drag to paint food clusters!":A==="PAINT_HAZARD"?"Click to paint hazard zones!":A==="PAINT_SPEED_FIELD"?"Click to paint speed fields!":"Click anywhere on canvas to drop food!"})]})]})},T0=({stats:e})=>{const t=e.populationHistory||new Array(30).fill(45),n=e.birthHistory||new Array(30).fill(0),r=e.deathHistory||new Array(30).fill(0),i=Math.max(1,...t),o=Math.max(1,...n),s=Math.max(1,...r);return l.jsx("div",{className:"analytics-cube-container",children:l.jsxs("div",{className:"cube-card-3d",children:[l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",borderRadius:8,padding:6,border:"1px solid rgba(0, 229, 255, 0.2)",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.55rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E5FF",fontWeight:800},children:[l.jsx("span",{children:"POPULATION TIME"}),l.jsx("span",{children:e.currentPopulation})]}),l.jsx("svg",{viewBox:"0 0 100 30",style:{width:"100%",height:24,overflow:"visible"},children:l.jsx("path",{d:t.map((c,u)=>{const h=u/(t.length-1)*100,m=30-c/i*24;return`${u===0?"M":"L"} ${h} ${m}`}).join(" "),fill:"none",stroke:"#00E5FF",strokeWidth:"2"})})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",borderRadius:8,padding:6,border:"1px solid rgba(0, 230, 118, 0.2)",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.55rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E676",fontWeight:800},children:[l.jsx("span",{children:"TOTAL BIRTHS"}),l.jsx("span",{children:e.totalBirths})]}),l.jsx("svg",{viewBox:"0 0 100 30",style:{width:"100%",height:24,overflow:"visible"},children:l.jsx("path",{d:`${n.map((c,u)=>{const h=u/(n.length-1)*100,m=30-c/o*22;return`${u===0?"M":"L"} ${h} ${m}`}).join(" ")} L 100 30 L 0 30 Z`,fill:"rgba(0, 230, 118, 0.25)",stroke:"#00E676",strokeWidth:"1.5"})})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",borderRadius:8,padding:6,border:"1px solid rgba(224, 64, 251, 0.2)",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.55rem",fontFamily:"'JetBrains Mono', monospace",color:"#E040FB",fontWeight:800},children:[l.jsx("span",{children:"GEN COUNT"}),l.jsxs("span",{children:["#",e.generationCount]})]}),l.jsx("svg",{viewBox:"0 0 100 30",style:{width:"100%",height:24,overflow:"visible"},children:l.jsx("path",{d:n.map((c,u)=>{const h=u/(n.length-1)*100,m=28-c/o*20;return`${u===0?"M":"L"} ${h} ${m}`}).join(" "),fill:"none",stroke:"#E040FB",strokeWidth:"2"})})]}),l.jsxs("div",{style:{background:"rgba(8, 14, 20, 0.7)",borderRadius:8,padding:6,border:"1px solid rgba(255, 107, 0, 0.2)",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.55rem",fontFamily:"'JetBrains Mono', monospace",color:"#FF6B00",fontWeight:800},children:[l.jsx("span",{children:"DEATH RATE"}),l.jsx("span",{children:e.totalDeaths})]}),l.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:2,height:24,paddingTop:2},children:r.slice(-15).map((c,u)=>{const h=s>0?c/s*100:10;return l.jsx("div",{style:{flex:1,height:`${Math.max(15,h)}%`,backgroundColor:"#FF6B00",borderRadius:"1px 1px 0 0"}},u)})})]})]})})},F0=({isOpen:e,onClose:t})=>e?l.jsx("div",{style:{position:"fixed",inset:0,zIndex:50,background:"rgba(3, 7, 18, 0.85)",backdropFilter:"blur(10px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:l.jsxs("div",{style:{background:"#0b0f19",border:"2px solid #00f0ff",borderRadius:"18px",maxWidth:"620px",width:"100%",padding:"24px",boxShadow:"0 0 40px rgba(0, 240, 255, 0.3)",position:"relative"},children:[l.jsx("button",{onClick:t,style:{position:"absolute",top:16,right:16,background:"transparent",border:"none",color:"#94a3b8",cursor:"pointer"},children:l.jsx(Wt,{style:{width:20,height:20}})}),l.jsxs("h2",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"1.2rem",color:"#ffffff",marginBottom:6,display:"flex",alignItems:"center",gap:10},children:[l.jsx(Ml,{style:{color:"#00f0ff"}})," HOW TO PLAY MICROBOT EVOLUTION LAB"]}),l.jsx("p",{style:{fontSize:"0.8rem",color:"#94a3b8",marginBottom:20},children:"A 100% automated autonomous artificial life sandbox. Watch microbots steer, search for food, avoid hazards, and reproduce!"}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[l.jsxs("div",{style:{background:"rgba(15, 23, 42, 0.6)",padding:12,borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.08)",display:"flex",gap:12},children:[l.jsx("div",{style:{width:32,height:32,borderRadius:8,background:"rgba(0, 240, 255, 0.2)",color:"#00f0ff",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,flexShrink:0},children:"1"}),l.jsxs("div",{children:[l.jsx("h4",{style:{fontSize:"0.85rem",color:"#ffffff",fontWeight:700},children:"Inspect Microbot Telemetry"}),l.jsxs("p",{style:{fontSize:"0.75rem",color:"#94a3b8",marginTop:2},children:["Click ",l.jsx("strong",{children:"🎯 SELECT BOT"})," or click any microbot directly on the canvas grid to inspect its real-time battery level, movement speed, vision range, and behavior state."]})]})]}),l.jsxs("div",{style:{background:"rgba(15, 23, 42, 0.6)",padding:12,borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.08)",display:"flex",gap:12},children:[l.jsx("div",{style:{width:32,height:32,borderRadius:8,background:"rgba(16, 185, 129, 0.2)",color:"#34d399",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,flexShrink:0},children:"2"}),l.jsxs("div",{children:[l.jsx("h4",{style:{fontSize:"0.85rem",color:"#ffffff",fontWeight:700},children:"Interactive Mouse Canvas Spawner"}),l.jsxs("p",{style:{fontSize:"0.75rem",color:"#94a3b8",marginTop:2},children:["Click anywhere on the simulation grid to drop ",l.jsx("strong",{children:"5 green food particles"})," directly under your cursor, or use ",l.jsx("strong",{children:"🍏 +20 FOOD"})," and ",l.jsx("strong",{children:"🤖 +10 BOTS"})," buttons!"]})]})]}),l.jsxs("div",{style:{background:"rgba(15, 23, 42, 0.6)",padding:12,borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.08)",display:"flex",gap:12},children:[l.jsx("div",{style:{width:32,height:32,borderRadius:8,background:"rgba(168, 85, 247, 0.2)",color:"#c084fc",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:800,flexShrink:0},children:"3"}),l.jsxs("div",{children:[l.jsx("h4",{style:{fontSize:"0.85rem",color:"#ffffff",fontWeight:700},children:"Genetic Evolution & Hazards"}),l.jsx("p",{style:{fontSize:"0.75rem",color:"#94a3b8",marginTop:2},children:"When microbots reach full battery, they reproduce asexually. Offspring inherit mutated traits (speed, vision, energy efficiency). Spawn red hazard zones to watch microbots evolve evasion!"})]})]})]}),l.jsx("div",{style:{marginTop:24,textAlign:"right"},children:l.jsx("button",{onClick:t,className:"btn btn-cyan",style:{padding:"10px 24px",fontSize:"0.85rem"},children:"START EXPERIMENT"})})]})}):null,A0=({isOpen:e,microbots:t,selectedBotId:n,onSelectBot:r,onClose:i})=>{const[o,s]=G.useState(""),[c,u]=G.useState("gen");if(!e)return null;const h=t.filter(m=>m.id.toLowerCase().includes(o.toLowerCase())).sort((m,v)=>c==="gen"?v.generation-m.generation:c==="battery"?v.battery-m.battery:c==="age"?v.age-m.age:c==="offspring"?v.offspringCount-m.offspringCount:0);return l.jsx("div",{style:{position:"fixed",inset:0,zIndex:60,background:"rgba(3, 7, 18, 0.85)",backdropFilter:"blur(10px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:l.jsxs("div",{style:{background:"#0b0f19",border:"2px solid #00f0ff",borderRadius:"18px",maxWidth:"680px",width:"100%",maxHeight:"85vh",display:"flex",flexDirection:"column",boxShadow:"0 0 40px rgba(0, 240, 255, 0.3)",overflow:"hidden"},children:[l.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid rgba(255, 255, 255, 0.1)",display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(15, 23, 42, 0.9)"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,color:"#00f0ff"},children:[l.jsx(kl,{style:{width:22,height:22}}),l.jsxs("div",{children:[l.jsx("h2",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"1rem",fontWeight:800,color:"#ffffff"},children:"SELECT MICROBOT FROM ROSTER"}),l.jsxs("p",{style:{fontSize:"0.72rem",color:"#94a3b8"},children:["Active Population: ",t.length," Microbots"]})]})]}),l.jsx("button",{onClick:i,style:{background:"transparent",border:"none",color:"#94a3b8",cursor:"pointer",padding:4},children:l.jsx(Wt,{style:{width:20,height:20}})})]}),l.jsxs("div",{style:{padding:"12px 20px",background:"rgba(15, 23, 42, 0.5)",display:"flex",gap:12,borderBottom:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{flex:1,position:"relative",display:"flex",alignItems:"center"},children:[l.jsx(y0,{style:{width:14,height:14,color:"#94a3b8",position:"absolute",left:10}}),l.jsx("input",{type:"text",placeholder:"Search by ID (e.g. MB-0005)...",value:o,onChange:m=>s(m.target.value),style:{width:"100%",padding:"6px 10px 6px 32px",background:"#030712",border:"1px solid rgba(0, 240, 255, 0.3)",borderRadius:8,color:"#ffffff",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",outline:"none"}})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:"0.72rem",color:"#94a3b8",fontFamily:"'JetBrains Mono', monospace"},children:[l.jsx("span",{children:"SORT:"}),l.jsxs("select",{value:c,onChange:m=>u(m.target.value),style:{background:"#030712",color:"#00f0ff",fontWeight:700,border:"1px solid rgba(0, 240, 255, 0.3)",borderRadius:8,padding:"6px 10px",fontSize:"0.75rem",cursor:"pointer"},children:[l.jsx("option",{value:"gen",children:"Highest Generation"}),l.jsx("option",{value:"battery",children:"Most Battery"}),l.jsx("option",{value:"age",children:"Oldest Age"}),l.jsx("option",{value:"offspring",children:"Most Offspring"})]})]})]}),l.jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px",display:"flex",flexDirection:"column",gap:10},children:h.length===0?l.jsxs("div",{style:{textAlign:"center",padding:"40px",color:"#94a3b8",fontSize:"0.8rem"},children:['No microbots found matching "',o,'".']}):h.map(m=>{const v=m.id===n,y=Math.max(0,Math.min(100,m.battery/m.maxBattery*100));return l.jsxs("div",{style:{background:v?"rgba(0, 240, 255, 0.12)":"rgba(15, 23, 42, 0.7)",border:v?"2px solid #00f0ff":"1px solid rgba(255, 255, 255, 0.1)",borderRadius:12,padding:"12px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,transition:"all 0.2s ease"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[l.jsx("div",{style:{width:18,height:18,borderRadius:"50%",backgroundColor:m.color,border:"2px solid #ffffff",boxShadow:"0 0 8px "+m.color}}),l.jsxs("div",{children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[l.jsx("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontWeight:800,fontSize:"0.9rem",color:"#ffffff"},children:m.id}),l.jsxs("span",{style:{fontSize:"0.65rem",background:"rgba(168, 85, 247, 0.2)",color:"#c084fc",border:"1px solid rgba(168, 85, 247, 0.4)",padding:"2px 6px",borderRadius:6,fontWeight:700,fontFamily:"'JetBrains Mono', monospace"},children:["GEN #",m.generation]})]}),l.jsxs("div",{style:{display:"flex",gap:12,fontSize:"0.7rem",color:"#94a3b8",marginTop:4,fontFamily:"'JetBrains Mono', monospace"},children:[l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[l.jsx(nd,{style:{width:12,height:12,color:"#00f0ff"}})," ",m.speed.toFixed(1)," px/f"]}),l.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[l.jsx(r0,{style:{width:12,height:12,color:"#fbbf24"}})," ",m.offspringCount," kids"]}),l.jsxs("span",{children:["State: ",l.jsx("strong",{style:{color:"#34d399"},children:m.behaviorState.replace("_"," ")})]})]})]})]}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[l.jsxs("div",{style:{width:90},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.65rem",color:"#00f0ff",marginBottom:3,fontFamily:"'JetBrains Mono', monospace"},children:[l.jsx("span",{children:"Charge"}),l.jsxs("span",{children:[y.toFixed(0),"%"]})]}),l.jsx("div",{style:{width:"100%",height:6,background:"#1e293b",borderRadius:3,overflow:"hidden"},children:l.jsx("div",{style:{height:"100%",width:`${y}%`,background:y>40?"#00f0ff":"#fbbf24"}})})]}),l.jsx("button",{onClick:()=>{r(m.id),i()},className:v?"btn btn-cyan":"btn btn-purple",style:{padding:"6px 12px",fontSize:"0.72rem"},children:v?"✓ SELECTED":"SELECT THIS BOT"})]})]},m.id)})})]})})},j0=({isOpen:e,selectedBot:t,engine:n,onSelectBot:r,onClose:i})=>{if(!e||!t||!n)return null;const o=h=>{const m=[];let v=h;for(;v.parentId;){const y=n.microbots.find(E=>E.id===v.parentId);if(!y)break;m.unshift(y),v=y}return m},s=(h,m=0)=>{const v=n.microbots.filter(y=>y.parentId===h.id);return v.length===0?null:l.jsx("div",{style:{marginLeft:m>0?20:0,borderLeft:m>0?"1px dashed #546575":"none",paddingLeft:m>0?10:0},children:v.map(y=>l.jsxs("div",{style:{marginTop:8},children:[l.jsxs("div",{onClick:()=>r(y.id),style:{background:"rgba(15, 26, 36, 0.8)",border:"1px solid rgba(0, 230, 118, 0.4)",borderRadius:8,padding:"6px 12px",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8},children:[l.jsx("div",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:y.color}}),l.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.75rem",fontWeight:600,color:"#00E676"},children:[y.id," (Gen ",y.generation,")"]})]}),s(y,m+1)]},y.id))})},c=o(t),u=t.parentId&&c.length===0;return l.jsx("div",{style:{position:"fixed",inset:0,zIndex:60,background:"rgba(3, 7, 18, 0.85)",backdropFilter:"blur(10px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:l.jsxs("div",{style:{background:"#0b0f19",border:"2px solid #E040FB",borderRadius:"18px",maxWidth:"680px",width:"100%",maxHeight:"90vh",overflowY:"auto",padding:"24px",boxShadow:"0 0 40px rgba(224, 64, 251, 0.3)",position:"relative"},children:[l.jsx("button",{onClick:i,style:{position:"absolute",top:16,right:16,background:"transparent",border:"none",color:"#8B949E",cursor:"pointer"},children:l.jsx(Wt,{style:{width:20,height:20}})}),l.jsxs("h2",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"1.1rem",color:"#ffffff",marginBottom:6,display:"flex",alignItems:"center",gap:10},children:[l.jsx(rd,{style:{color:"#E040FB"}})," INTERACTIVE FAMILY LINEAGE TREE"]}),l.jsxs("p",{style:{fontSize:"0.75rem",color:"#8B949E",marginBottom:20},children:["Tracking genealogical heritage and offspring mutations for ",l.jsx("strong",{children:t.id})," (Gen #",t.generation,")."]}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,alignItems:"flex-start"},children:[l.jsx("div",{style:{fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginBottom:4},children:"ANCESTRY LINEAGE"}),u&&l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#f43f5e",fontSize:"0.75rem",fontStyle:"italic",marginBottom:8},children:[l.jsx(x0,{style:{width:14,height:14}})," Origin Parent Extinct"]}),c.map(h=>l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:"100%"},children:[l.jsxs("div",{onClick:()=>r(h.id),style:{background:"rgba(15, 26, 36, 0.8)",border:"1px solid rgba(0, 229, 255, 0.4)",borderRadius:10,padding:"6px 14px",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:8,alignSelf:"flex-start"},children:[l.jsx("div",{style:{width:10,height:10,borderRadius:"50%",backgroundColor:h.color}}),l.jsxs("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"0.8rem",fontWeight:700,color:"#00E5FF"},children:[h.id," (Gen ",h.generation,")"]})]}),l.jsx("div",{style:{color:"#E040FB",fontSize:"1.2rem",margin:"4px 0",alignSelf:"flex-start",paddingLeft:12},children:"↓"})]},h.id)),l.jsxs("div",{style:{background:"rgba(224, 64, 251, 0.15)",border:"2px solid #E040FB",borderRadius:14,padding:"12px 24px",boxShadow:"0 0 20px rgba(224, 64, 251, 0.3)",alignSelf:"stretch",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:10},children:[l.jsx("div",{style:{width:16,height:16,borderRadius:"50%",backgroundColor:t.color,boxShadow:"0 0 10px "+t.color}}),l.jsx("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontWeight:800,fontSize:"1.1rem",color:"#ffffff"},children:t.id})]}),l.jsxs("div",{style:{fontSize:"0.72rem",color:"#E040FB",fontFamily:"'JetBrains Mono', monospace",marginTop:4},children:["Generation #",t.generation," • Speed: ",t.speed.toFixed(1)," px/f • Vision: ",t.visionRadius.toFixed(0),"px"]})]}),l.jsx("div",{style:{color:"#E040FB",fontSize:"1.2rem",margin:"4px 0",alignSelf:"flex-start",paddingLeft:12},children:"↓"}),l.jsxs("div",{style:{width:"100%"},children:[l.jsx("div",{style:{fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",marginBottom:8},children:"OFFSPRING DESCENDANTS"}),n.microbots.filter(h=>h.parentId===t.id).length===0?l.jsx("div",{style:{fontSize:"0.75rem",color:"#546575",fontStyle:"italic"},children:"No active offspring descendants."}):s(t)]})]}),l.jsx("div",{style:{marginTop:24,textAlign:"right"},children:l.jsx("button",{onClick:i,className:"btn-holo btn-holo-magenta",style:{padding:"8px 18px"},children:"CLOSE TREE"})})]})})},B0=({isOpen:e,onSpawnBlueprint:t,onClose:n})=>{const[r,i]=G.useState("ALPHA-STRAIN-V1"),[o,s]=G.useState(3.2),[c,u]=G.useState(160),[h,m]=G.useState(1.8),[v]=G.useState(.15),[y,E]=G.useState(280),[k,w]=G.useState(5);if(!e)return null;const B=`hsl(${y}, 95%, 55%)`,p=()=>{t({speed:o,maxSpeed:o,visionRadius:c,energyEfficiency:h,turnRate:v,hue:y,color:B},k),n()};return l.jsx("div",{style:{position:"fixed",inset:0,zIndex:60,background:"rgba(3, 7, 18, 0.85)",backdropFilter:"blur(12px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:l.jsxs("div",{style:{background:"#0b0f19",border:"2px solid #00E5FF",borderRadius:"18px",maxWidth:"560px",width:"100%",padding:"24px",boxShadow:"0 0 40px rgba(0, 229, 255, 0.3)",position:"relative"},children:[l.jsx("button",{onClick:n,style:{position:"absolute",top:16,right:16,background:"transparent",border:"none",color:"#8B949E",cursor:"pointer"},children:l.jsx(Wt,{style:{width:20,height:20}})}),l.jsxs("h2",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"1.1rem",color:"#ffffff",marginBottom:6,display:"flex",alignItems:"center",gap:10},children:[l.jsx(Lt,{style:{color:"#00E5FF"}})," BLUEPRINT STUDIO & GENE DESIGNER"]}),l.jsx("p",{style:{fontSize:"0.75rem",color:"#8B949E",marginBottom:20},children:"Craft custom genetic strains and spawn custom artificial life blueprints into the evolution matrix."}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[l.jsxs("div",{children:[l.jsx("label",{style:{fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E",display:"block",marginBottom:4},children:"STRAIN NAME DESIGNATION"}),l.jsx("input",{type:"text",value:r,onChange:f=>i(f.target.value),style:{width:"100%",background:"#080E14",border:"1px solid rgba(0, 229, 255, 0.3)",borderRadius:8,padding:"8px 12px",color:"#00E5FF",fontFamily:"'JetBrains Mono', monospace",fontWeight:800}})]}),l.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.7rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Target Velocity (Speed)"}),l.jsxs("span",{style:{color:"#00E5FF",fontWeight:800},children:[o.toFixed(1)," px/f"]})]}),l.jsx("input",{type:"range",min:"1.0",max:"5.0",step:"0.1",value:o,onChange:f=>s(parseFloat(f.target.value)),style:{width:"100%",height:4,marginTop:6}})]}),l.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.7rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Sensory Vision Radius"}),l.jsxs("span",{style:{color:"#60a5fa",fontWeight:800},children:[c," px"]})]}),l.jsx("input",{type:"range",min:"60",max:"260",step:"5",value:c,onChange:f=>u(parseInt(f.target.value,10)),style:{width:"100%",height:4,marginTop:6}})]}),l.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.7rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Energy Efficiency Rating"}),l.jsxs("span",{style:{color:"#00E676",fontWeight:800},children:[h.toFixed(1),"x"]})]}),l.jsx("input",{type:"range",min:"0.6",max:"2.5",step:"0.1",value:h,onChange:f=>m(parseFloat(f.target.value)),style:{width:"100%",height:4,marginTop:6}})]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[l.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Pigment Hue"}),l.jsxs("span",{style:{color:B,fontWeight:800},children:[y,"°"]})]}),l.jsx("input",{type:"range",min:"0",max:"360",step:"5",value:y,onChange:f=>E(parseInt(f.target.value,10)),style:{width:"100%",height:4,marginTop:6}})]}),l.jsxs("div",{style:{background:"rgba(15, 26, 36, 0.7)",padding:10,borderRadius:10,border:"1px solid rgba(255,255,255,0.08)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.68rem",fontFamily:"'JetBrains Mono', monospace",color:"#8B949E"},children:[l.jsx("span",{children:"Spawn Count"}),l.jsxs("span",{style:{color:"#E040FB",fontWeight:800},children:[k," Bots"]})]}),l.jsx("input",{type:"range",min:"1",max:"25",step:"1",value:k,onChange:f=>w(parseInt(f.target.value,10)),style:{width:"100%",height:4,marginTop:6}})]})]})]}),l.jsxs("div",{style:{marginTop:24,display:"flex",gap:10,justifyContent:"flex-end"},children:[l.jsx("button",{onClick:n,className:"btn-holo btn-holo-dark",children:"CANCEL"}),l.jsxs("button",{onClick:p,className:"btn-holo btn-holo-cyan",style:{padding:"8px 18px"},children:[l.jsx(bs,{style:{width:14,height:14}})," SPAWN STRAIN BLUEPRINT"]})]})]})})},P0=({bot:e,onClose:t,onUpdateTraits:n})=>{if(!e)return l.jsx("div",{className:"glass-modal-overlay",children:l.jsxs("div",{className:"glass-modal",style:{width:400},children:[l.jsxs("div",{className:"modal-header",children:[l.jsxs("h2",{children:[l.jsx(Lt,{})," CRISPR EDITOR"]}),l.jsx("button",{className:"btn-icon",onClick:t,children:l.jsx(Wt,{})})]}),l.jsx("div",{style:{padding:20,textAlign:"center",color:"#8B949E"},children:l.jsx("p",{children:"No microbot selected for editing."})})]})});const r=(i,o)=>o?l.jsxs("div",{style:{marginBottom:15,background:"rgba(0,0,0,0.3)",padding:10,borderRadius:8,border:"1px solid rgba(0,229,255,0.1)"},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:5},children:[l.jsx("span",{style:{color:"#00E5FF",fontWeight:"bold",fontSize:"0.8rem"},children:i}),l.jsxs("span",{style:{color:o.state==="ENTANGLED"?"#FFD700":o.state==="OBSERVED"?"#00E676":"#FF6B00",fontSize:"0.7rem"},children:["[",o.state,"]"]})]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:"#8B949E",fontSize:"0.7rem"},children:[l.jsxs("span",{children:["Base: ",o.baseValue.toFixed(2)]}),l.jsxs("span",{children:["Var: ±",o.quantumVariance.toFixed(2)]}),l.jsxs("span",{children:["Prob: ",(o.observationProbability*100).toFixed(0),"%"]})]})]}):null;return l.jsx("div",{className:"glass-modal-overlay",children:l.jsxs("div",{className:"glass-modal",style:{width:450,maxHeight:"80vh",overflowY:"auto"},children:[l.jsxs("div",{className:"modal-header",children:[l.jsxs("h2",{children:[l.jsx(Lt,{})," CRISPR EDITOR"]}),l.jsx("button",{className:"btn-icon",onClick:t,children:l.jsx(Wt,{})})]}),l.jsxs("div",{style:{padding:15},children:[l.jsxs("div",{style:{marginBottom:20},children:[l.jsxs("h3",{style:{color:"#fff",fontSize:"0.9rem",marginBottom:10},children:["Target: ",e.id]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[l.jsxs("div",{children:[l.jsx("label",{style:{color:"#8B949E",fontSize:"0.7rem"},children:"Speed"}),l.jsx("input",{type:"range",min:"1",max:"5",step:"0.1",value:e.speed,onChange:i=>n(e.id,{speed:parseFloat(i.target.value)}),style:{width:"100%"}})]}),l.jsxs("div",{children:[l.jsx("label",{style:{color:"#8B949E",fontSize:"0.7rem"},children:"Vision"}),l.jsx("input",{type:"range",min:"40",max:"260",step:"5",value:e.visionRadius,onChange:i=>n(e.id,{visionRadius:parseFloat(i.target.value)}),style:{width:"100%"}})]}),l.jsxs("div",{children:[l.jsx("label",{style:{color:"#8B949E",fontSize:"0.7rem"},children:"Efficiency"}),l.jsx("input",{type:"range",min:"0.4",max:"3",step:"0.1",value:e.energyEfficiency,onChange:i=>n(e.id,{energyEfficiency:parseFloat(i.target.value)}),style:{width:"100%"}})]}),l.jsxs("div",{children:[l.jsx("label",{style:{color:"#8B949E",fontSize:"0.7rem"},children:"Turn Rate"}),l.jsx("input",{type:"range",min:"0.05",max:"0.3",step:"0.01",value:e.turnRate,onChange:i=>n(e.id,{turnRate:parseFloat(i.target.value)}),style:{width:"100%"}})]})]})]}),l.jsx("h3",{style:{color:"#FFD700",fontSize:"0.8rem",marginBottom:10,borderBottom:"1px solid rgba(255,215,0,0.2)",paddingBottom:5},children:"QUANTUM GENOME (SUPERPOSITION)"}),e.genome?l.jsxs(l.Fragment,{children:[r("Speed Allele",e.genome.speedAllele),r("Vision Allele",e.genome.visionAllele),r("Efficiency Allele",e.genome.efficiencyAllele)]}):l.jsx("div",{style:{textAlign:"center",color:"#8B949E",padding:10},children:"No quantum genome data available."}),l.jsx("button",{className:"btn-holo btn-holo-green",style:{width:"100%",marginTop:10,justifyContent:"center"},onClick:t,children:"APPLY & CLOSE"})]})]})})},D0=({bot:e,onClose:t})=>{const[n,r]=G.useState(0),i=G.useRef(null);return G.useEffect(()=>{let o;const s=()=>{r(c=>(c+.1)%(Math.PI*2)),o=requestAnimationFrame(s)};return s(),()=>cancelAnimationFrame(o)},[]),G.useEffect(()=>{var k,w;const o=i.current;if(!o)return;const s=o.getContext("2d");if(!s)return;s.clearRect(0,0,o.width,o.height);const c=[{label:"ENERGY",val:e.battery/e.maxBattery},{label:"VISION",val:e.visionRadius/300},{label:"PANIC",val:e.panicTimer&&e.panicTimer>0?1:0},{label:"AGE",val:Math.min(e.age/5e3,1)}],u=[{val:Math.sin(n+0)*.5+.5},{val:Math.sin(n+1)*.5+.5},{val:Math.sin(n+2)*.5+.5},{val:Math.sin(n+3)*.5+.5},{val:Math.sin(n+4)*.5+.5}],h=[{label:"SPEED",val:e.speed/e.maxSpeed},{label:"TURN",val:e.turnRate/.5},{label:"ADHESION",val:((w=(k=e.genome)==null?void 0:k.adhesionGene)==null?void 0:w.baseValue)||0}],m=[c,u,h],v=o.width,y=o.height,E=[50,v/2,v-50];for(let B=0;B<m.length-1;B++){const p=m[B],f=m[B+1],x=E[B],M=E[B+1];p.forEach((a,C)=>{const T=y/(p.length+1)*(C+1);f.forEach((A,Q)=>{const O=y/(f.length+1)*(Q+1),X=(C*3+Q*7+e.id.charCodeAt(0))%10/10,ee=a.val*X;s.beginPath(),s.moveTo(x,T),s.lineTo(M,O),s.strokeStyle=`rgba(0, 229, 255, ${.1+ee*.4})`,s.lineWidth=1+ee*2,s.stroke();const z=(Math.sin(n+X*5)+1)/2,L=x+(M-x)*z,U=T+(O-T)*z;ee>.3&&(s.beginPath(),s.arc(L,U,2,0,Math.PI*2),s.fillStyle=`rgba(255, 255, 255, ${ee})`,s.fill())})})}for(let B=0;B<m.length;B++){const p=m[B],f=E[B];p.forEach((x,M)=>{const a=y/(p.length+1)*(M+1);if(s.beginPath(),s.arc(f,a,8+x.val*4,0,Math.PI*2),s.fillStyle=B===1?"#E040FB":"#00E5FF",s.fill(),s.strokeStyle="rgba(255, 255, 255, 0.8)",s.lineWidth=2,s.stroke(),x.label){s.fillStyle="#8B949E",s.font='10px "JetBrains Mono", monospace',s.textAlign=B===0?"right":"left";const C=B===0?f-20:f+20;s.fillText(x.label,C,a+4),s.fillStyle="#FFFFFF",s.fillText((x.val*100).toFixed(0)+"%",C,a+16)}})}},[e,n]),l.jsx("div",{className:"modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(5, 8, 12, 0.85)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},children:l.jsxs("div",{className:"glass-panel",style:{width:"600px",height:"450px",position:"relative",display:"flex",flexDirection:"column",boxShadow:"0 0 50px rgba(0, 229, 255, 0.2)"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid rgba(0, 229, 255, 0.2)"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[l.jsx(o0,{style:{width:20,height:20,color:"#E040FB"}}),l.jsx("h2",{style:{fontFamily:"'JetBrains Mono', monospace",color:"#ffffff",fontSize:"1.1rem",margin:0},children:"LIVE NEURAL BRAIN VISUALIZER"})]}),l.jsx("button",{onClick:t,style:{background:"transparent",border:"none",color:"#8B949E",cursor:"pointer"},children:l.jsx(Wt,{style:{width:24,height:24}})})]}),l.jsxs("div",{style:{padding:"10px 20px",display:"flex",alignItems:"center",gap:20,background:"rgba(0,0,0,0.2)"},children:[l.jsxs("div",{children:[l.jsx("span",{style:{fontSize:"0.7rem",color:"#8B949E",fontFamily:"'JetBrains Mono', monospace"},children:"BOT ID"}),l.jsx("div",{style:{color:"#00E5FF",fontWeight:700},children:e.id})]}),l.jsxs("div",{children:[l.jsx("span",{style:{fontSize:"0.7rem",color:"#8B949E",fontFamily:"'JetBrains Mono', monospace"},children:"BEHAVIOR STATE"}),l.jsxs("div",{style:{color:"#E040FB",fontWeight:700,display:"flex",alignItems:"center",gap:6},children:[l.jsx(Cl,{style:{width:14,height:14}})," ",e.behaviorState]})]})]}),l.jsx("div",{style:{flex:1,padding:20,position:"relative"},children:l.jsx("canvas",{ref:i,width:560,height:320,style:{width:"100%",height:"100%",filter:"drop-shadow(0 0 8px rgba(0,229,255,0.4))"}})})]})})},z0=({bots:e})=>{const t=G.useRef(null),[n,r]=G.useState({x:0,y:0}),[i,o]=G.useState(1),[s,c]=G.useState({x:0,y:0}),u=G.useRef(!1),h=G.useRef({x:0,y:0});G.useEffect(()=>{const w=t.current;if(!w)return;const B=w.getContext("2d");if(!B)return;let p,f=0;const x=()=>{f+=.005,B.fillStyle="#060A10",B.fillRect(0,0,w.width,w.height);const M=w.width/2+s.x,a=w.height/2+s.y,C=80*i;B.strokeStyle="rgba(0, 229, 255, 0.15)",B.lineWidth=1;const T={};e.forEach(A=>{T[A.color]||(T[A.color]={count:0,hue:A.hue}),T[A.color].count++}),Object.keys(T).forEach((A,Q)=>{const O=T[A],X=Q/Object.keys(T).length*Math.PI*2+f+n.y,ee=O.hue/360*Math.PI+n.x,z=C*Math.sin(ee)*Math.cos(X),L=C*Math.cos(ee),b=180/(180+C*Math.sin(ee)*Math.sin(X)),d=M+z*b,R=a+L*b;B.fillStyle=A,B.beginPath(),B.arc(d,R,Math.max(2,(2+Math.log2(O.count))*b),0,Math.PI*2),B.fill(),O.count>5&&(B.font="600 8px 'JetBrains Mono'",B.fillStyle="rgba(255,255,255,0.5)",B.fillText(`n:${O.count}`,d+5,R))}),p=requestAnimationFrame(x)};return x(),()=>cancelAnimationFrame(p)},[e]);const m=w=>{u.current=!0,h.current={x:w.clientX,y:w.clientY}},v=w=>{if(!u.current)return;const B=w.clientX-h.current.x,p=w.clientY-h.current.y;h.current={x:w.clientX,y:w.clientY},w.shiftKey?c(f=>({x:f.x+B,y:f.y+p})):r(f=>({x:f.x-p*.01,y:f.y+B*.01}))},y=()=>{u.current=!1},E=w=>{w.preventDefault(),o(B=>Math.max(.1,Math.min(5,B-w.deltaY*.001)))},k=()=>{const w=t.current;if(!w)return;const B=w.toDataURL("image/png"),p=document.createElement("a");p.href=B,p.download=`genetic_constellation_${Date.now()}.png`,p.click()};return l.jsxs("div",{style:{background:"rgba(11, 15, 25, 0.85)",border:"1px solid rgba(0, 229, 255, 0.3)",borderRadius:12,padding:8},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:4},children:[l.jsx("span",{style:{fontSize:"0.65rem",fontFamily:"'JetBrains Mono', monospace",color:"#00E5FF",fontWeight:800},children:"3D GENETIC CONSTELLATION MAP"}),l.jsx("button",{onClick:k,style:{background:"transparent",border:"none",color:"#00E5FF",fontSize:"0.6rem",cursor:"pointer"},title:"Export 3D Snapshot PNG",children:"📸 PNG"})]}),l.jsx("canvas",{ref:t,width:180,height:130,style:{borderRadius:8,cursor:"grab"},onMouseDown:m,onMouseMove:v,onMouseUp:y,onMouseLeave:y,onWheel:E})]})},La=({error:e,onRecover:t})=>e?l.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(3, 7, 18, 0.9)",backdropFilter:"blur(8px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:9999,color:"#f8fafc",fontFamily:"'Inter', sans-serif"},children:l.jsxs("div",{className:"holo-panel",style:{padding:"30px 40px",maxWidth:600,textAlign:"center",borderColor:"rgba(244, 63, 94, 0.4)"},children:[l.jsx(n0,{size:48,color:"#f43f5e",style:{margin:"0 auto 20px"}}),l.jsx("h2",{style:{fontSize:"1.5rem",fontWeight:700,margin:"0 0 10px",color:"#f43f5e"},children:"Simulation Exception"}),l.jsx("p",{style:{fontSize:"0.9rem",color:"#94a3b8",margin:"0 0 20px",lineHeight:1.5},children:"An unhandled error occurred in the simulation engine or web worker thread."}),l.jsx("div",{style:{background:"rgba(0,0,0,0.4)",padding:15,borderRadius:8,fontFamily:"'JetBrains Mono', monospace",fontSize:"0.8rem",color:"#fb7185",textAlign:"left",marginBottom:30,border:"1px solid rgba(244, 63, 94, 0.2)",wordBreak:"break-all"},children:e.message||"Unknown Error"}),l.jsxs("button",{onClick:t,style:{background:"linear-gradient(135deg, #f43f5e 0%, #be123c 100%)",color:"#fff",border:"none",padding:"12px 24px",borderRadius:8,fontSize:"0.9rem",fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:8,margin:"0 auto"},children:[l.jsx(g0,{size:16})," Recover and Restart Engine"]})]})}):null;class V0{constructor(){I(this,"listeners",new Set);I(this,"lastStats",null);I(this,"intervalId",null);I(this,"organelleRingBuffer",new Float32Array(50));I(this,"pendingUpdate",!1)}getOrganelleRingBuffer(){return this.organelleRingBuffer}subscribe(t){return this.listeners.add(t),this.lastStats&&t(this.lastStats),()=>this.listeners.delete(t)}startPolling(t,n=80){this.intervalId&&this.stopPolling(),this.intervalId=window.setInterval(()=>{this.pendingUpdate||(this.pendingUpdate=!0,requestAnimationFrame(()=>{this.lastStats=t.getStats(),this.listeners.forEach(r=>r(this.lastStats)),this.pendingUpdate=!1}))},n)}stopPolling(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}forceUpdate(t){this.lastStats=t.getStats(),this.listeners.forEach(n=>n(this.lastStats))}}const Ao=new V0,G0=()=>{const[e,t]=G.useState($f),n=G.useRef(null);n.current||(n.current=new Kf(1200,800,{...e,isPaused:!1}));const r=n.current,[i,o]=G.useState(()=>r.selectRandomMicrobot()),[s,c]=G.useState(()=>r.getStats()),[u,h]=G.useState(!1),[m,v]=G.useState(!1),[y,E]=G.useState(!1),[k,w]=G.useState(!1),[B,p]=G.useState(!1),[f,x]=G.useState(!1),[M,a]=G.useState(null);G.useEffect(()=>{const D=Z=>{a(Z.error||new Error(Z.message))},H=Z=>{a(Z.reason instanceof Error?Z.reason:new Error(String(Z.reason)))},_=Z=>{Z.preventDefault(),a(new Error("WebGL Context Lost: The GPU has dropped the context. Click 'Recover' to restart rendering."))};return window.addEventListener("error",D),window.addEventListener("unhandledrejection",H),window.addEventListener("webglcontextlost",_,!0),()=>{window.removeEventListener("error",D),window.removeEventListener("unhandledrejection",H),window.removeEventListener("webglcontextlost",_,!0),Le.dispose()}},[]),G.useEffect(()=>{const D=()=>{!document.hidden&&r&&r.update(.01)};return document.addEventListener("visibilitychange",D),()=>document.removeEventListener("visibilitychange",D)},[r]),G.useEffect(()=>{Ao.startPolling(r,33);const D=Ao.subscribe(H=>{c(H);const _=r.getSelectedMicrobot();if(!_&&r.microbots.length>0){const Z=r.selectRandomMicrobot();o(Z)}else _?o({..._}):(r.selectedMicrobotId&&(r.selectedMicrobotId=null),o(null))});return()=>{D(),Ao.stopPolling()}},[r]);const C=D=>{t(H=>{const _={...H,...D};return qf(_),r&&(r.config=_,"hazardCount"in D&&r.updateHazardsCount()),_})},T=()=>{if(r){r.resetSimulation();const D=r.selectRandomMicrobot();o(D?{...D}:null),c(r.getStats())}},A=()=>{r&&e.isPaused&&(r.update(1),c(r.getStats()))},Q=D=>{if(r)if(D){r.selectedMicrobotId=D;const H=r.getSelectedMicrobot();o(H?{...H}:null)}else r.selectedMicrobotId=null,o(null)},O=()=>{if(r){const D=r.selectRandomMicrobot();o(D?{...D}:null)}},X=()=>{r&&r.spawnMultipleFood(20)},ee=()=>{r&&(r.spawnMultipleBots(10),i||O())},z=()=>{r&&(r.spawnHazard(),t(D=>({...D,hazardCount:r.hazards.length})))},L=()=>{r&&r.triggerSolarFlare()},U=()=>{r&&r.spawnPortalPair()},b=()=>{if(r&&typeof r.spawnSpore=="function")for(let D=0;D<5;D++)r.spawnSpore()},d=(D,H)=>{if(r){for(let _=0;_<H;_++){const Z=r.spawnMicrobot();r.overrideMicrobotGenes(Z.id,D)}c(r.getStats())}},R=(D,H)=>{if(r){r.overrideMicrobotGenes(D,H);const _=r.getSelectedMicrobot();_&&o({..._})}},N=()=>{if(!r)return;const D=`Timestamp (ISO 8601),Time (s),Population,Avg Speed,Avg Vision,Total Births,Total Deaths,Predators,Season
`,H=s.historyTimeline.map(je=>`${new Date(je.time*1e3).toISOString()},${je.time},${je.population},${je.avgSpeed.toFixed(2)},${je.avgVision.toFixed(1)},${s.totalBirths},${s.totalDeaths},${s.predatorCount},${s.currentSeason}`).join(`
`),_=new Blob([D+H],{type:"text/csv"}),Z=URL.createObjectURL(_),de=document.createElement("a");de.href=Z,de.download=`microbot_telemetry_${new Date().toISOString().slice(0,10)}.csv`,de.click(),URL.revokeObjectURL(Z)},g=()=>{if(!r)return;const D={timestamp:new Date().toISOString(),config:e,stats:s,populationHistory:r.populationHistory,birthHistory:r.birthHistory,deathHistory:r.deathHistory,generationCount:r.generationCount,totalDeaths:r.totalDeaths},H=new Blob([JSON.stringify(D,null,2)],{type:"application/json"}),_=URL.createObjectURL(H),Z=document.createElement("a");Z.href=_,Z.download=`microbot_telemetry_${Date.now()}.json`,Z.click(),URL.revokeObjectURL(_)},j=()=>{if(!r)return;const D=r.microbots.filter(de=>de.epigenome&&de.epigenome.length>0).map(de=>({id:de.id,generation:de.generation,stress:de.epigeneticStress,epigenome:de.epigenome})),H=new Blob([JSON.stringify({timestamp:new Date().toISOString(),profiles:D},null,2)],{type:"application/json"}),_=URL.createObjectURL(H),Z=document.createElement("a");Z.href=_,Z.download=`microbot_epigenetics_${Date.now()}.json`,Z.click(),URL.revokeObjectURL(_)},F=()=>{const D="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e,null,2)),H=document.createElement("a");H.href=D,H.download=`microbot_preset_config_${new Date().toISOString().slice(0,10)}.json`,H.click()},W=D=>{C(D),alert("Simulation Preset Loaded Successfully!")},J=()=>{if(!r)return;const D=r.exportState();navigator.clipboard.writeText(D).then(()=>{alert("Ecosystem state copied to clipboard as sync hash!")}).catch(H=>{console.error("Failed to copy",H),alert("Failed to copy to clipboard.")})},ne=()=>{if(!r)return;const D=prompt("Paste your sync hash here:");D&&(r.importState(D),c(r.getStats()),alert("Ecosystem synced successfully!"))},S=i&&r?r.getLineageTree(i.id):{current:null};let Y="radial-gradient(circle at 50% 30%, rgba(15, 30, 45, 0.6) 0%, rgba(8, 14, 20, 0.95) 70%)";return s.currentSeason==="WINTER"?Y="radial-gradient(circle at 50% 30%, rgba(10, 20, 45, 0.6) 0%, rgba(5, 10, 25, 0.95) 70%)":s.currentSeason==="SUMMER"&&(Y="radial-gradient(circle at 50% 30%, rgba(45, 30, 15, 0.6) 0%, rgba(20, 14, 8, 0.95) 70%)"),r!=null&&r.activeDisasters.some(D=>D.type==="RADIATION_STORM"&&D.active)&&(Y="radial-gradient(circle at 50% 30%, rgba(20, 45, 15, 0.6) 0%, rgba(10, 25, 5, 0.95) 70%)"),l.jsxs("div",{className:"app-container",style:{background:`${Y}, radial-gradient(circle at 80% 80%, rgba(224, 64, 251, 0.05) 0%, transparent 50%), radial-gradient(circle at 20% 80%, rgba(0, 229, 255, 0.05) 0%, transparent 50%)`},children:[l.jsx(La,{error:M,onRecover:()=>{a(null),T()}}),l.jsx(A0,{isOpen:m,microbots:r.microbots,selectedBotId:i?i.id:null,onSelectBot:D=>Q(D),onClose:()=>v(!1)}),l.jsx(F0,{isOpen:u,onClose:()=>h(!1)}),l.jsx(j0,{isOpen:y,selectedBot:S.current,engine:r,onSelectBot:D=>{Q(D)},onClose:()=>E(!1)}),k&&l.jsx(B0,{isOpen:!0,onClose:()=>w(!1),onSpawnBlueprint:d}),B&&l.jsx(P0,{bot:i,onClose:()=>p(!1),onUpdateTraits:R}),f&&i&&l.jsx(D0,{bot:i,onClose:()=>x(!1)}),M&&l.jsx(La,{error:M,onRecover:()=>a(null)}),l.jsx(k0,{config:e,stats:s,onUpdateConfig:C,onReset:T,onStep:A,onOpenRosterMenu:()=>v(!0),onOpenGuide:()=>h(!0),onOpenBlueprintStudio:()=>w(!0),onSpawnFood:X,onSpawnBots:ee,onSpawnHazard:z,onTriggerMeteor:()=>r==null?void 0:r.triggerMeteorStrike(),onTriggerVoidRift:()=>r==null?void 0:r.triggerVoidRift(),onTriggerOutbreak:()=>r==null?void 0:r.triggerOutbreak(),onTriggerRadiationStorm:()=>r==null?void 0:r.triggerRadiationStorm(),onTriggerMagneticInversion:()=>r==null?void 0:r.triggerMagneticInversion(),onTriggerSolarFlare:L,onTriggerPortal:U,onExportTelemetryCSV:N,onExportConfigJSON:F,onImportConfigJSON:W}),l.jsxs("main",{className:"workspace-grid",children:[l.jsxs("div",{className:"sidebar-col",children:[l.jsx("div",{className:"inspector-panel-container",children:l.jsx(R0,{bot:i,stats:s,onClose:()=>Q(null),onOverrideGenes:R,onOpenLineageModal:()=>E(!0),onOpenCrisprModal:()=>p(!0),onOpenNeuralModal:()=>x(!0)})}),l.jsx(b0,{config:e,engine:n.current,onUpdateConfig:C,onExportStateSync:J,onImportStateSync:ne,onRunBenchmark:()=>r==null?void 0:r.runBenchmark(),onSpawnSpore:b,onExportRunData:g,onExportEpigenetics:j}),l.jsx(z0,{bots:(r==null?void 0:r.microbots)||[]}),l.jsx(N0,{bots:r?r.microbots:[]})]}),l.jsxs("div",{className:"main-viewport-col",children:[e.isSplitView?l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,height:"100%"},children:[l.jsx(Fo,{engine:r,onSelectBot:Q,onSelectRandomBot:O,onUpdateConfig:C}),l.jsx(Fo,{engine:r,onSelectBot:Q,onSelectRandomBot:O,onUpdateConfig:C})]}):l.jsx(Fo,{engine:r,onSelectBot:Q,onSelectRandomBot:O,onUpdateConfig:C}),l.jsx(T0,{stats:s})]})]})]})};class O0 extends G.Component{constructor(){super(...arguments);I(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){console.error("Uncaught render error:",n,r)}render(){var n;return this.state.hasError?l.jsxs("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0,0,0,0.85)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:99999,color:"white",fontFamily:"'JetBrains Mono', monospace"},children:[l.jsx(or,{color:"#ff3366",size:64,style:{marginBottom:20}}),l.jsx("h1",{style:{color:"#ff3366",margin:0},children:"Render Exception Detected"}),l.jsx("p",{style:{maxWidth:600,textAlign:"center",color:"#ccc",margin:"20px 0"},children:((n=this.state.error)==null?void 0:n.message)||"Unknown error"}),l.jsx("button",{onClick:()=>window.location.reload(),style:{padding:"10px 20px",background:"rgba(255, 51, 102, 0.2)",border:"1px solid #ff3366",color:"#ff3366",borderRadius:8,cursor:"pointer",fontWeight:"bold"},children:"Reboot Simulation Kernel"})]}):this.props.children}}jo.createRoot(document.getElementById("root")).render(l.jsx(As.StrictMode,{children:l.jsx(O0,{children:l.jsx(G0,{})})}));</script>
<style rel="stylesheet" crossorigin>:root{--bg-void: #080E14;--panel-glass: rgba(15, 26, 36, .75);--panel-border: rgba(0, 229, 255, .22);--panel-glow: rgba(0, 229, 255, .15);--glass-backdrop-filter: blur(12px) saturate(180%);--cyan-glow: #00E5FF;--magenta-glow: #E040FB;--orange-hazard: #FF6B00;--bio-green: #00E676;--text-primary: #F0F6FC;--text-muted: #8B949E;--text-dim: #546575}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){:root{--glass-backdrop-filter: blur(16px) saturate(200%)}}@media (max-width: 768px){.app-container{padding:4px}}*{box-sizing:border-box;margin:0;padding:0}body{font-family:Inter,system-ui,-apple-system,sans-serif;background-color:var(--bg-void);color:var(--text-primary);min-height:100vh;overflow:hidden;-webkit-user-select:none;user-select:none}.app-container{display:flex;flex-direction:column;height:100vh;width:100vw;overflow:hidden;background:radial-gradient(circle at 50% 30%,#0f1e2d99,#080e14f2 70%),radial-gradient(circle at 80% 80%,rgba(224,64,251,.05) 0%,transparent 50%),radial-gradient(circle at 20% 80%,rgba(0,229,255,.05) 0%,transparent 50%);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);position:relative}.top-nav-bar{display:flex;align-items:center;justify-content:space-between;padding:10px 18px;z-index:30;gap:12px}.brand-badge{display:flex;align-items:center;gap:10px}.brand-icon-box{width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,#00e5ffcc,#e040fbcc);display:flex;align-items:center;justify-content:center;color:#fff;box-shadow:0 0 15px #00e5ff66}.brand-title{font-family:JetBrains Mono,monospace;font-size:1rem;font-weight:800;letter-spacing:.05em;color:#fff;text-shadow:0 0 10px rgba(0,229,255,.4)}.brand-title span{color:var(--cyan-glow)}.brand-sub{font-size:.68rem;color:var(--text-muted);font-family:Inter,sans-serif}.glass-deck-pill{background:#080e14a6;border:1px solid rgba(255,255,255,.08);border-top:1px solid rgba(255,255,255,.15);border-left:1px solid rgba(255,255,255,.12);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border-radius:12px;padding:6px 12px;display:flex;align-items:center;gap:10px;box-shadow:0 8px 32px #0009,inset 0 0 10px #00e5ff1a;transition:border-color .3s ease,box-shadow .3s ease}.glass-deck-pill:hover{border-color:#00e5ffb3;box-shadow:0 8px 32px #0009,inset 0 0 15px #00e5ff33,0 0 20px #00e5ff33}.holo-panel{background:#080e14bf;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(255,255,255,.08);border-top:1px solid rgba(255,255,255,.15);border-left:1px solid rgba(255,255,255,.12);border-radius:16px;box-shadow:0 10px 40px #000c,inset 0 0 20px #00e5ff26,0 0 15px #00e5ff1a;transition:box-shadow .3s ease,border-color .3s ease}.holo-panel:hover{border-color:#00e5ff99;box-shadow:0 10px 40px #000c,inset 0 0 30px #00e5ff40,0 0 25px #00e5ff33}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.glass-panel{-webkit-backdrop-filter:blur(16px) saturate(180%);backdrop-filter:blur(16px) saturate(180%);border-width:.5px}}.btn-holo{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:8px;font-family:JetBrains Mono,monospace;font-size:.72rem;font-weight:700;cursor:pointer;border:1px solid transparent;transition:all .2s ease;text-transform:uppercase}.btn-holo-cyan{background:#00e5ff1f;border-color:#00e5ff59;color:var(--cyan-glow)}.btn-holo-cyan:hover{background:#00e5ff40;box-shadow:0 0 14px #00e5ff66}.btn-holo-magenta{background:#e040fb1f;border-color:#e040fb59;color:var(--magenta-glow)}.btn-holo-magenta:hover{background:#e040fb40;box-shadow:0 0 14px #e040fb66}.btn-holo-green{background:#00e6761f;border-color:#00e67659;color:var(--bio-green)}.btn-holo-green:hover{background:#00e67640;box-shadow:0 0 14px #00e67666}.btn-holo-orange{background:#ff6b001f;border-color:#ff6b0059;color:var(--orange-hazard)}.btn-holo-orange:hover{background:#ff6b0040;box-shadow:0 0 14px #ff6b0066}.btn-holo-dark{background:#ffffff0d;border-color:#ffffff1f;color:var(--text-muted)}.btn-holo-dark:hover{background:#ffffff1f;color:#fff}@keyframes pulse-glow{0%{box-shadow:0 0 10px #00e5ff66}50%{box-shadow:0 0 25px #00e5ffcc}to{box-shadow:0 0 10px #00e5ff66}}.glass-panel{background:#0c141ca6;backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid rgba(0,229,255,.35);box-shadow:0 8px 32px #000000a6,inset 0 1px #ffffff0d;will-change:transform;transform:translateZ(0);position:relative;transition:border-color .25s ease,box-shadow .25s ease}@media (max-width: 768px){.glass-panel{background:#0c141cd9;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}}@media (-webkit-min-device-pixel-ratio: 2),(min-resolution: 192dpi){.glass-panel{border-width:.5px;box-shadow:0 4px 20px #00000080,inset 0 .5px #ffffff1a}}.glass-panel:hover{border-color:#00e5ff8c;box-shadow:0 8px 32px #000000bf,0 0 16px #00e5ff40}.accordion-header{cursor:pointer;transition:opacity .2s ease,transform .1s ease;-webkit-user-select:none;user-select:none}.accordion-header:hover{opacity:.8}.accordion-header:active{transform:scale(.98)}.workspace-grid{display:grid;grid-template-columns:320px 1fr;grid-template-rows:1fr auto;gap:12px;padding:0 16px 16px;flex:1;overflow:hidden}.sidebar-col{display:flex;flex-direction:column;gap:12px;overflow-y:auto;padding-right:8px;scrollbar-gutter:stable}.main-viewport-col{position:relative;display:flex;flex-direction:column;gap:12px;overflow:hidden}.canvas-viewport-card{flex:1;position:relative;border-radius:16px;border:1px solid rgba(0,229,255,.25);overflow:hidden;background:#04080d;box-shadow:inset 0 0 40px #000000e6,0 0 25px #00e5ff1a}input[type=range]{accent-color:var(--cyan-glow);cursor:pointer}.analytics-cube-container{position:absolute;bottom:16px;right:16px;z-index:25;width:220px;height:180px;perspective:900px;pointer-events:auto}.cube-card-3d{width:100%;height:100%;background:#0f1a24d9;border:1px solid rgba(0,229,255,.35);border-radius:14px;-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);transform:rotateY(-8deg) rotateX(6deg);transition:transform .3s ease,box-shadow .3s ease;box-shadow:-10px 15px 25px #0009,0 0 20px #00e5ff33;padding:10px;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:6px}.cube-card-3d:hover{transform:rotateY(0) rotateX(0) scale(1.03);box-shadow:0 15px 35px #000c,0 0 30px #00e5ff59}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:#080e1466}::-webkit-scrollbar-thumb{background:#00e5ff40;border-radius:3px}::-webkit-scrollbar-thumb:hover{background:#00e5ff80}@media (max-width: 768px){.workspace-grid{display:flex;flex-direction:column;padding:0 4px 4px;gap:8px}.sidebar-col{position:absolute;bottom:0;left:0;right:0;max-height:45vh;z-index:50;background:#080e14f2;border-top:2px solid rgba(0,229,255,.5);border-radius:20px 20px 0 0;padding:16px 12px calc(16px + env(safe-area-inset-bottom));box-shadow:0 -10px 40px #000000e6,inset 0 2px 10px #00e5ff33;backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px)}.main-viewport-col{flex:1;margin-bottom:40vh}.analytics-cube-container{transform:scale(.7);bottom:45vh;right:8px}.top-nav-bar{padding:6px 10px}.brand-title{font-size:.85rem}}</style>
</head>
<body>
<div id="root"></div>
<!-- Deployment cache bust 1 -->
</body>
</html>